@lacneu/atrium 0.104.3 → 0.105.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-BEJ_Jyn5.js +1 -0
- package/dist/assets/{AdminSettings-CtNcFhMz.js → AdminSettings-5meEb9W8.js} +1 -1
- package/dist/assets/{AdvancedFilter-Cod8SSd6.js → AdvancedFilter-xN0--ljK.js} +1 -1
- package/dist/assets/AgentFilesTab-Can04JU-.js +3 -0
- package/dist/assets/AnomaliesTab-4RaS1dK-.js +1 -0
- package/dist/assets/AuditTab-Sl2mKF7H.js +1 -0
- package/dist/assets/BridgeTab-CuyyGEDU.js +1 -0
- package/dist/assets/ChatDefaultsTab-BUW8zL7h.js +1 -0
- package/dist/assets/{ConfirmDialog-B7k0wvSi.js → ConfirmDialog-2GlWReLp.js} +1 -1
- package/dist/assets/{DataTableShell-DvtkASQG.js → DataTableShell-DbR2ZB8f.js} +1 -1
- package/dist/assets/DeletedChatsTab-CJeOOn67.js +1 -0
- package/dist/assets/{DetailChips-DDAtgnjA.js → DetailChips-3dcLcTwx.js} +1 -1
- package/dist/assets/{EntitySheet-DRzkWKlH.js → EntitySheet-C6w3z1QT.js} +1 -1
- package/dist/assets/FeedbacksTab-Xzcf0-m6.js +1 -0
- package/dist/assets/{FieldLabel-imj_Z0rZ.js → FieldLabel-C4REF2c9.js} +1 -1
- package/dist/assets/FilesTab-CAQXH5ub.js +1 -0
- package/dist/assets/{FilterBar-DCCuFxDn.js → FilterBar-DB4FJ8Dg.js} +1 -1
- package/dist/assets/GroupsTab-Bza-axVm.js +1 -0
- package/dist/assets/InstancesTab-ylJayyDG.js +1 -0
- package/dist/assets/IntegrationsTab-SlsD4tnS.js +1 -0
- package/dist/assets/KnobRow-C5AnEUHi.js +1 -0
- package/dist/assets/KpiTab-66ywB2qQ.js +1 -0
- package/dist/assets/PreferencesTab-DVGrydjd.js +1 -0
- package/dist/assets/ProjectPage-m5wYC2Rt.js +1 -0
- package/dist/assets/PromptInjectionsTab-Dj53oYJM.js +4 -0
- package/dist/assets/RolesTab-DWAYA0bo.js +1 -0
- package/dist/assets/ScheduledTab-CgXOwbXe.js +1 -0
- package/dist/assets/ServiceAccountsTab-DDHjiTam.js +1 -0
- package/dist/assets/SubAgentReportsTab-CkY5rTJw.js +1 -0
- package/dist/assets/ThemeShowroom-CP-Ano4O.js +1 -0
- package/dist/assets/{TimeRangePicker-BZtw1JkM.js → TimeRangePicker-BWc2zMyq.js} +1 -1
- package/dist/assets/{TimezoneCombobox-CeRN4N3z.js → TimezoneCombobox-BFCCUJtt.js} +1 -1
- package/dist/assets/TracesTab--6clA1rh.js +1 -0
- package/dist/assets/TrashTab-DLVzwkoC.js +1 -0
- package/dist/assets/UsersTab-CZ7JvSwK.js +1 -0
- package/dist/assets/VoiceTab-jKwAy1TX.js +1 -0
- package/dist/assets/{alert-dialog-BcJMHbhI.js → alert-dialog-DC8Z8Wmm.js} +1 -1
- package/dist/assets/api-V6x-16tY.js +44 -0
- package/dist/assets/{badge-ChMMFtuW.js → badge-X282ki8x.js} +1 -1
- package/dist/assets/{button-C_rIPtCv.js → button-Dk2mXV1u.js} +1 -1
- package/dist/assets/{card-BV8NO76j.js → card-BOTLCW-9.js} +1 -1
- package/dist/assets/check-BgudyeCZ.js +1 -0
- package/dist/assets/{checkbox-DPxJTQjc.js → checkbox-D6bftQAn.js} +1 -1
- package/dist/assets/chevron-left-C0Y3isEh.js +1 -0
- package/dist/assets/chevron-right-Bh8XLdLx.js +1 -0
- package/dist/assets/chevron-up-DvUmXiwf.js +1 -0
- package/dist/assets/chevrons-up-down-PaGXQ-HZ.js +1 -0
- package/dist/assets/compatView-B790jH8G.js +1 -0
- package/dist/assets/convexApi-BPs2Hfq9.js +1 -0
- package/dist/assets/{copy-DbstFM9Q.js → copy-rAnqIOxQ.js} +1 -1
- package/dist/assets/{cronDescribe-CkiSvbCK.js → cronDescribe-_S84hFUo.js} +1 -1
- package/dist/assets/{deliveryRecorder-B_kVKMkR.js → deliveryRecorder-C4wafMM5.js} +1 -1
- package/dist/assets/{dialog-CPAskUwF.js → dialog-BNsKJRIY.js} +1 -1
- package/dist/assets/dispatchErrorInfo-3a3ZRCxk.js +1 -0
- package/dist/assets/{dist-BjZo0sql.js → dist-BH0QTybL.js} +1 -1
- package/dist/assets/{dist-Uf18yR_a.js → dist-BIRd8lcZ.js} +1 -1
- package/dist/assets/{dist-Bu9sqVcp.js → dist-BR-NmSzA.js} +1 -1
- package/dist/assets/{dist-CYh9BuQS.js → dist-BcFkCuIu.js} +1 -1
- package/dist/assets/{dist-CzmY6YrA.js → dist-Dn0V4znq.js} +1 -1
- package/dist/assets/{download-BaebAe6Z.js → download-D9QjuqE8.js} +1 -1
- package/dist/assets/{dropdown-menu-BVKVjups.js → dropdown-menu-CvM7DyUW.js} +1 -1
- package/dist/assets/{eye-LggiM6Z5.js → eye-uNqwwZRR.js} +1 -1
- package/dist/assets/{format-AQELUhPa.js → format-BrALULQ2.js} +1 -1
- package/dist/assets/{groupManageView-DC3eSLA1.js → groupManageView-CDgw3aW6.js} +1 -1
- package/dist/assets/index-CIz3ifJj.css +1 -0
- package/dist/assets/index-DfYoeoNU.js +158 -0
- package/dist/assets/{input-CSZu-bVE.js → input-BxgrPOQB.js} +1 -1
- package/dist/assets/{list-obbqPBzD.js → list-Dh8ZiyiT.js} +1 -1
- package/dist/assets/loader-circle-BotUEUd9.js +1 -0
- package/dist/assets/{lock-BlVhOk85.js → lock-EGsKhQj8.js} +1 -1
- package/dist/assets/{pencil-K7SBkvHL.js → pencil-DNZlqJcO.js} +1 -1
- package/dist/assets/plus-D_fN9BU6.js +1 -0
- package/dist/assets/{popover-C-Y_Yoco.js → popover-BwLP1xvY.js} +1 -1
- package/dist/assets/roleDescriptions-3xKxmmOg.js +1 -0
- package/dist/assets/rotate-ccw-Cyt4JAE8.js +1 -0
- package/dist/assets/{search-Dz6sLH0-.js → search-Bwyf2eDv.js} +1 -1
- package/dist/assets/{select-CjcMQhwm.js → select-BTp5btAs.js} +1 -1
- package/dist/assets/{server-DcInl3Nh.js → server-DLcIoj6y.js} +1 -1
- package/dist/assets/{speech-ehUcmGCg.js → speech-CsTQ-A5Z.js} +1 -1
- package/dist/assets/{star-5ysDlx3k.js → star-C8s9YR-B.js} +1 -1
- package/dist/assets/{switch--NPD3Vp0.js → switch-CGlTuNUT.js} +1 -1
- package/dist/assets/{table-rRR3TpMc.js → table-CbcTxWSv.js} +1 -1
- package/dist/assets/{tabs-B8emuY1B.js → tabs-CgaqwjVr.js} +1 -1
- package/dist/assets/toast-n2l0FW-G.js +1 -0
- package/dist/assets/{tooltip-Ct0TGxtk.js → tooltip-CRMDA8JT.js} +1 -1
- package/dist/assets/{trash-2-xhtrhYsd.js → trash-2-DMkzussw.js} +1 -1
- package/dist/assets/trashPage-CaQsoE3L.js +1 -0
- package/dist/assets/trashView-nGIDBl8U.js +1 -0
- package/dist/assets/{triangle-alert-DoL9TI6v.js → triangle-alert-CcKY6Wsw.js} +1 -1
- package/dist/assets/{usageView-BuRtXekW.js → usageView-ht_gv_iV.js} +1 -1
- package/dist/assets/{useChart-bV4rotdu.js → useChart-6Fi69FKB.js} +1 -1
- package/dist/assets/{useFontScale-DiSkEM6I.js → useFontScale-CPt1xprW.js} +1 -1
- package/dist/assets/{useStartNewChat-8wVLrYnZ.js → useStartNewChat-rxpg0noT.js} +2 -2
- package/dist/assets/{use_paginated_query-CebdO_HQ.js → use_paginated_query-SUExS5Ri.js} +1 -1
- package/dist/assets/{users-CRbE186D.js → users-BYrKGPt9.js} +1 -1
- package/dist/assets/x-C7RkX_i_.js +1 -0
- package/dist/index.html +54 -54
- package/package.json +1 -1
- package/dist/assets/AccessTab-D8xdWzT5.js +0 -1
- package/dist/assets/AgentFilesTab-Dfkkm3Fw.js +0 -3
- package/dist/assets/AnomaliesTab-DlZ5M2UC.js +0 -1
- package/dist/assets/AuditTab-Dh6gO6j5.js +0 -1
- package/dist/assets/BridgeTab-Bnu9R5N4.js +0 -1
- package/dist/assets/ChatDefaultsTab-CxmayDqi.js +0 -1
- package/dist/assets/DeletedChatsTab-CnaK-AH0.js +0 -1
- package/dist/assets/FeedbacksTab-D4LKaB_2.js +0 -1
- package/dist/assets/FilesTab-D3XWSI2t.js +0 -1
- package/dist/assets/GroupsTab-DbayDYbZ.js +0 -1
- package/dist/assets/InstancesTab-031fn2Jt.js +0 -1
- package/dist/assets/IntegrationsTab-1whhDsmk.js +0 -1
- package/dist/assets/KnobRow-D6kXWvVI.js +0 -1
- package/dist/assets/KpiTab-2Vk6EtCf.js +0 -1
- package/dist/assets/PreferencesTab-B5h49bYq.js +0 -1
- package/dist/assets/ProjectPage-BNKL-iOz.js +0 -1
- package/dist/assets/PromptInjectionsTab-Bmn1iSpB.js +0 -4
- package/dist/assets/RolesTab-DHxLatAl.js +0 -1
- package/dist/assets/ScheduledTab-NHSyQ677.js +0 -1
- package/dist/assets/ServiceAccountsTab-CKV8crhK.js +0 -1
- package/dist/assets/SubAgentReportsTab-BWfXOTck.js +0 -1
- package/dist/assets/ThemeShowroom-Do9I3hrR.js +0 -1
- package/dist/assets/TracesTab-BNWFPad2.js +0 -1
- package/dist/assets/TrashTab-D5irFeF0.js +0 -1
- package/dist/assets/UsersTab-CHs3CRev.js +0 -1
- package/dist/assets/VoiceTab-DRvjgMdZ.js +0 -1
- package/dist/assets/api-CWqdeSbN.js +0 -44
- package/dist/assets/check-DdmANHSb.js +0 -1
- package/dist/assets/chevron-left-ByEQraEh.js +0 -1
- package/dist/assets/chevron-right-DMqzlhWH.js +0 -1
- package/dist/assets/chevron-up-B3KYmtzo.js +0 -1
- package/dist/assets/chevrons-up-down-CITEfz7_.js +0 -1
- package/dist/assets/compatView-Cz5KNXa-.js +0 -1
- package/dist/assets/convexApi-G20_TNBS.js +0 -1
- package/dist/assets/dispatchErrorInfo-7H2cJGwt.js +0 -1
- package/dist/assets/index-DLjKxzJ_.css +0 -1
- package/dist/assets/index-Dq26_OeV.js +0 -158
- package/dist/assets/loader-circle-BqKiW3X9.js +0 -1
- package/dist/assets/plus-DTL4K-j9.js +0 -1
- package/dist/assets/roleDescriptions-DHny6e80.js +0 -1
- package/dist/assets/rotate-ccw-CvefWwHW.js +0 -1
- package/dist/assets/toast-C_YfUacM.js +0 -1
- package/dist/assets/trashPage-3suR6eIy.js +0 -1
- package/dist/assets/trashView-CwUC01r_.js +0 -1
- package/dist/assets/x-CcIT4ync.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,AA as i,Av as a,BA as o,Bj as s,Bv as c,CA as l,DA as u,EA as d,FA as f,GA as p,Gj as m,Gv as h,HA as g,Hj as ee,Hv as _,IA as v,Ij as te,Iv as y,JA as b,Jv as ne,KA as re,Kj as ie,Kv as ae,LA as oe,Lj as se,Lv as ce,MA as le,NA as ue,OA as de,PA as fe,QA as pe,RA as me,Rv as he,SA as ge,TA as _e,UA as ve,Uj as ye,Uv as x,VA as be,Vj as xe,Vv as Se,WA as Ce,Wj as we,Wv as Te,XA as Ee,Xj as De,Xo as Oe,YA as ke,Yj as Ae,ZA as je,_A as S,_Q as Me,_d as Ne,aj as Pe,bA as Fe,bQ as C,bc as Ie,cj as Le,dd as Re,dj as ze,ej as Be,fd as Ve,fj as He,gA as Ue,ij as We,jA as Ge,k as w,kA as Ke,lj as qe,md as Je,mj as Ye,nj as Xe,oj as Ze,pd as Qe,pj as $e,qA as et,qj as tt,qv as nt,rj as rt,sj as it,t as T,tj as at,ud as ot,uj as st,vA as E,wA as ct,xA as lt,yA as ut,yQ as dt,zA as ft,zv as pt}from"./api-CWqdeSbN.js";import{i as mt,n as D,o as ht,r as gt,s as _t}from"./FieldLabel-imj_Z0rZ.js";import{n as vt,t as O}from"./useNavigate-D3GIoxyW.js";import{r as k}from"./dist-CzmY6YrA.js";import{t as yt}from"./chevron-right-DMqzlhWH.js";import{t as bt}from"./chevron-up-B3KYmtzo.js";import{t as xt}from"./chevrons-up-down-CITEfz7_.js";import{n as St,t as Ct}from"./usageView-BuRtXekW.js";import{t as wt}from"./loader-circle-BqKiW3X9.js";import{t as Tt}from"./checkbox-DPxJTQjc.js";import{t as A}from"./server-DcInl3Nh.js";import{t as j}from"./triangle-alert-DoL9TI6v.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CjcMQhwm.js";import{n as Et,r as Dt,t as Ot}from"./popover-C-Y_Yoco.js";import{i as kt,n as At,r as jt,t as Mt}from"./tabs-B8emuY1B.js";import{t as L}from"./button-C_rIPtCv.js";import{t as R}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as Nt}from"./toast-C_YfUacM.js";import{t as z}from"./badge-ChMMFtuW.js";import{a as B,n as Pt}from"./format-AQELUhPa.js";import{a as Ft,n as It,o as Lt,r as Rt,t as zt}from"./dialog-CPAskUwF.js";import{t as Bt}from"./appHost-CH3EGcJw.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-rRR3TpMc.js";import{t as Gt}from"./FilterBar-DCCuFxDn.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-Cz5KNXa-.js";import{t as W}from"./dispatchErrorInfo-7H2cJGwt.js";var $t=w(`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=w(`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,r]=(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]),f=(0,G.useMemo)(()=>vn(s),[s]),p=(0,G.useMemo)(()=>yn(s),[s]),m=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function h(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:fe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ge(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(I,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:Ke()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),c.map(e=>(0,Z.jsx)(F,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(I,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(M,{placeholder:de()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),f.map(e=>(0,Z.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(I,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:u()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),p.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))]})]})]}),m.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:_e(),sortKey:`target`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:ct(),sortKey:`state`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:l(),sortKey:`instance`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:ge(),sortKey:`host`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:lt(),sortKey:`version`,sort:a,onSort:h}),(0,Z.jsx)(V,{children:Fe()}),(0,Z.jsx)(Q,{label:ut(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Z.jsx)(Ut,{children:m.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)(V,{"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)(bt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(xt,{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:ue({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:B(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?` · ${B(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:[Oe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${B(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:[le({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${B(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?E():e===`error`?S():Ue()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(z,{variant:`secondary`,children:E()}):e===`error`?(0,Z.jsx)(z,{variant:`destructive`,children:S()}):(0,Z.jsx)(z,{variant:`outline`,children:Ue()})}function wn(){return C(T.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=C(T.compat.getBridgeCompat,{}),n=C(T.me.getMe,{host:Bt})?.role===`admin`,i=C(T.admin.listInstances,n?{}:`skip`),o=C(T.agents.usageForInstances,n?{}:`skip`),s=O(),c=()=>void s({to:`/settings/anomalies`,search:{status:`open`}}),l=un(e?e.targets:[],t?t.targets:[],i??[]),{section:u}=vt({from:`/settings/bridge`}),d=O({from:`/settings/bridge`}),f=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,m=f!==null&&Xt(f,`hermes`)&&!l.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:c}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Be()}),o&&o.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:r()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:Je()}),(0,Z.jsx)(V,{children:Qe()}),(0,Z.jsx)(V,{children:Ve()}),(0,Z.jsx)(V,{children:Re()}),(0,Z.jsx)(V,{children:ot()})]})}),(0,Z.jsx)(Ut,{children:o.flatMap(e=>{let t=Ct(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)(z,{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,l.length>0?(0,Z.jsxs)(Mt,{value:l.some(e=>e.key===u)?u:l[0]?.key??`openclaw`,onValueChange:e=>void d({search:{section:e},replace:!0}),children:[(0,Z.jsx)(jt,{className:`w-full`,children:l.map(e=>(0,Z.jsxs)(kt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),l.map(e=>(0,Z.jsx)(At,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:f,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):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:ae(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,h({build:t.buildVersion??`?`})]}):null,` · `,Te(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?x():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ce()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=Pt(e.checkedAt),m=e.startedAt==null?null:Pt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(St,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(j,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?ve():l===`gateways_unreachable`?ft({count:u.length}):c?g():be({count:s.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}),` `,o({time:f})]}),m?(0,Z.jsx)(`span`,{children:oe({time:m})}):null,a]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:me({names:u.join(`, `)})}):null,c?(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:v()})]})}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)),[p,m]=(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)(A,{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)(z,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ne()}),(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":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(yt,{size:13,"aria-hidden":!0}),f({count:t.length})]}),p?(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:[pe(),i.length>0?(0,Z.jsx)(z,{variant:`destructive`,children:Ee({count:i.length})}):a>0?(0,Z.jsx)(z,{variant:`destructive`,children:ke()}):(0,Z.jsx)(z,{variant:`secondary`,children:je()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[b({version:e.vendoredVersion}),r?` · `+et({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ie({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)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(yt,{size:13,"aria-hidden":!0}),re({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:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Ne({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:c({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:x()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(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)(z,{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)(zt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(It,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(Lt,{children:De({instance:e.displayName??e.name})}),(0,Z.jsx)(Rt,{children:Ae()})]}),(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)(St,{"aria-hidden":!0}):(0,Z.jsx)(j,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?We():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,rt()]}):null}function jn({instance:e,onClose:t}){let n=dt(T.admin.upsertInstanceConfig),r=Me(T.bridge.validateMediaPaths),i=Nt(),a=Vt(e.config?.contentLocale,void 0),[o,c]=(0,G.useState)(()=>mt(e.config??{},a)),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,h]=(0,G.useState)(null),g=o.inboundMediaMode===`shared-fs`,_=o.mediaMode===`shared-fs`,v=g||_;async function y(){f(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(Le(),e)}finally{f(!1)}}async function b(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:gt(o,r,a)}),t()}catch(e){i.error(ee(),e)}finally{u(!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)(D,{label:tt(),help:xe()}),(0,Z.jsxs)(I,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(P,{children:_t.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:ie(),help:s()}),(0,Z.jsxs)(I,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(P,{children:ht.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:m(),help:se()}),(0,Z.jsx)(R,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Ye(),help:$e()}),(0,Z.jsx)(R,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:He(),help:ze()}),(0,Z.jsx)(R,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Tt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Z.jsx)(D,{label:we(),help:te()})]}),v&&p!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:p.reachable?!p.inbound&&!p.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(j,{"aria-hidden":!0}),at({reason:p.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Ze(),result:p.inbound}),(0,Z.jsx)($,{label:Pe(),result:p.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:it()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(j,{"aria-hidden":!0}),Xe()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:d,children:[d?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?qe():st()]}),(0,Z.jsx)(L,{size:`sm`,onClick:()=>void b(),disabled:l,children:ye()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Ot,{children:[(0,Z.jsx)(Dt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?pt():he({count:e.length}),(0,Z.jsx)(k,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Et,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ce()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(z,{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{$ as r,$v as i,An as a,B as o,Cn as s,Dn as c,En as l,F as u,G as d,H as f,I as p,J as m,Jj as h,K as g,L as _,Mn as v,Nn as y,Ny as b,On as x,P as ee,Pn as S,Q as te,Qv as C,R as w,Sn as ne,Tn as T,U as E,V as D,W as re,X as ie,Xv as O,Y as ae,Yv as k,Z as oe,Zv as A,_Q as se,_n as ce,ah as le,bQ as j,bb as M,bn as ue,ch as de,dn as fe,et as pe,ey as me,fn as he,gd as ge,gn as _e,hn as ve,ih as ye,jn as be,k as xe,kn as Se,lQ as N,lh as Ce,ln as we,mb as Te,mn as Ee,nh as De,nt as Oe,ny as ke,oh as Ae,pb as je,pn as Me,q as Ne,rh as Pe,rt as Fe,ry as Ie,sh as Le,t as P,th as Re,ty as ze,uh as Be,un as Ve,vb as He,vn as Ue,wn as We,xn as Ge,yQ as F,yn as Ke,z as qe}from"./api-CWqdeSbN.js";import{t as Je}from"./use_paginated_query-CebdO_HQ.js";import{t as Ye}from"./loader-circle-BqKiW3X9.js";import{t as I}from"./checkbox-DPxJTQjc.js";import{t as Xe}from"./plus-DTL4K-j9.js";import{t as Ze}from"./triangle-alert-DoL9TI6v.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-CjcMQhwm.js";import{n as Qe,r as $e,t as et}from"./popover-C-Y_Yoco.js";import{t as H}from"./button-C_rIPtCv.js";import{t as U}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{a as tt,t as W}from"./KnobRow-D6kXWvVI.js";import{n as nt}from"./capabilities-CASxhKEd.js";import{a as rt}from"./compatView-Cz5KNXa-.js";/* empty css */import{t as it}from"./switch--NPD3Vp0.js";var at=xe(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),G=t(e(),1),ot=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function st(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 ct=[`auto`,`hybrid`,`tool`,`off`];function lt(e){switch(e){case`auto`:return be();case`hybrid`:return a();case`tool`:return Se();default:return x()}}function K(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function ut(e){return typeof e==`string`&&ct.includes(e)}function q(e){return{injection:ut(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function dt(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function ft(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?s():pt(e)?Me():null:We(),i=q(e),a=t.injection!==i.injection||!dt(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),c=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:c,invalidReason:c?null:l()}}function pt(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function mt(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 ht(e){return e.ok?null:e.code===`scope_refused`?s():e.code===`stale_default`?ne():e.code===`write_unknown`||e.code===`not_confirmed`?Ke():e.code===`not_applied`?Ue():e.code===`default_too_large`?fe():e.code===`allowlist_too_large`?he():e.code===`plugin_too_old`?Me():e.code===`source_not_allowed`?Ee():e.code===`plugin_config_lag`?ve():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?T():Ge({code:e.code})}function gt(e,t){let n=K(e),r=K(t);if(n.injection!==r.injection||!dt(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 J=n();function _t({instanceName:e,row:t,supported:n}){let r=se(P.knowledge.setAgentKnowledgeDefault),[i,a]=(0,G.useState)(t),[o,s]=(0,G.useState)(()=>q(t)),[l,u]=(0,G.useState)(`idle`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),h=e=>{a(e),s(q(e)),f(null)},g=gt(i,t);(0,G.useEffect)(()=>{p&&g&&(m(!1),h(t))},[p,g]);let _=ft(i,o,n),y=_.readOnlyReason===null;async function b(){u(`saving`),f(null);try{let n=ht(await r({instanceName:e,agentId:t.agentId,injection:o.injection,sources:o.sources,expected:K(i)}));f(n),u(n===null?`done`:`idle`),n===null&&m(!0)}catch(e){f(ht({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsxs)(V,{value:o.injection,onValueChange:e=>{ut(e)&&s({...o,injection:e})},disabled:!y,children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":v(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:ct.map(e=>(0,J.jsx)(B,{value:e,children:lt(e)},e))})]})}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),t.sources.map(e=>(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:y?`pointer`:`default`},title:e.description||void 0,children:[(0,J.jsx)(I,{checked:o.sources.includes(e.id),onCheckedChange:()=>s(mt(t,o,e.id)),disabled:!y,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,J.jsx)(`span`,{children:e.label})]},e.id)),g&&!p?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[Ve(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>h(t),children:we()})]}):null,t.overridesAllowed?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ue()}),y?(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsx)(H,{size:`sm`,disabled:!_.dirty||!_.valid||l===`saving`,onClick:()=>void b(),children:l===`saving`?M():A()})}):(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:_.readOnlyReason}),y&&_.dirty&&_.invalidReason!==null?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_.invalidReason}):null,l===`done`&&d===null?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,d===null?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function vt({instanceName:e}){let t=j(P.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Je(P.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,J.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":S(),children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),t.supported?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:We()}),n.map(n=>(0,J.jsx)(_t,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ce({shown:n.length})}),(0,J.jsx)(H,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:_e()})]}):null]})}function Y(e){return e.displayName??e.agentId}function yt(e){return e.displayName!==null&&e.displayName.toLowerCase()!==e.agentId.toLowerCase()}function X(e){return e.normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase().trim()}function bt(e,t){let n=X(t);return n===``||X(Y(e)).includes(n)||X(e.agentId).includes(n)}var xt=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function Z(e,t){return xt.compare(Y(e),Y(t))||xt.compare(e.agentId,t.agentId)}function St(e,t){return e.filter(e=>e.showReasoningDefault!==null).sort(Z).map(e=>({agent:e,show:e.showReasoningDefault,sameAsDefault:e.showReasoningDefault===t}))}function Ct(e,t){return wt(e.length)?e.filter(e=>bt(e.agent,t)):[...e]}function wt(e){return e>8}function Q(e,t){let n=e.filter(e=>e.showReasoningDefault===null&&e.presentInLastOk!==!1&&bt(e,t));return[...n.filter(e=>e.enabled).sort(Z),...n.filter(e=>!e.enabled).sort(Z)]}function Tt(e){return!e}function Et(e,t){return t===null?-1:e.findIndex(e=>e.agentId===t)}function Dt(e,t){return t===null?e[0]??null:e.find(e=>e.agentId===t)??null}function Ot(e,t,n){if(n===0)return-1;switch(t){case`ArrowDown`:return e<0?0:Math.min(e+1,n-1);case`ArrowUp`:return e<=0?0:e-1;case`Home`:return 0;case`End`:return n-1;default:return Math.min(e,n-1)}}var $=e=>e?Fe():Oe();function kt(e,t){return e===null||e.kind!==t.kind?!1:e.kind===`instance`||t.kind===`agent`&&e.agentId===t.agentId}function At({instanceName:e}){let t=j(P.agents.listAgentsForInstance,{instanceName:e}),n=F(P.agents.setInstanceReasoningDefault),i=F(P.agents.setAgentReasoningDefault),[a,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(null),[d,f]=(0,G.useState)(``),[h,v]=(0,G.useState)(``),y=(0,G.useRef)(null),b=(0,G.useId)(),x=t?.showReasoningDefault===!0,S=t?.agents??[],C=(0,G.useMemo)(()=>St(S,x),[S,x]),w=Ct(C,h),ne=Q(S,``).length>0;async function T(e,t,n){s(e),l(null),f(``);try{return await t(),f(n),!0}catch{return l(e),!1}finally{s(t=>t===e?null:t)}}let E=t=>void T({kind:`instance`},()=>n({instanceName:e,show:t}),_({value:$(t)})),D=(t,n,r)=>T({kind:`agent`,agentId:t.agentId},()=>i({instanceName:e,agentId:t.agentId,show:n}),r);async function re(e){await D(e,null,ee({agent:Y(e)}))&&y.current?.focus()}let O=a!==null;return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row oc-rdefaults`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:pe()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}),t===void 0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):S.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__default`,children:[(0,J.jsx)(`label`,{htmlFor:b,className:`oc-rdefaults__default-label`,children:oe()}),(0,J.jsx)(`span`,{className:`oc-rdefaults__state`,"aria-hidden":!0,children:a?.kind===`instance`?(0,J.jsx)(Ye,{size:14,className:`oc-rdefaults__spin`}):$(x)}),(0,J.jsx)(it,{id:b,checked:x,disabled:O,"aria-busy":a?.kind===`instance`,onCheckedChange:E})]}),c?.kind===`instance`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsxs)(`div`,{className:`oc-rdefaults__exhead`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__exlabel`,children:ie({count:C.length})}),(0,J.jsx)(jt,{agents:S,instanceDefault:x,disabled:!ne,triggerRef:y,onPick:e=>{let t=Tt(x);D(e,t,p({agent:Y(e),value:$(t)}))}})]}),C.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ae()}):(0,J.jsxs)(J.Fragment,{children:[wt(C.length)?(0,J.jsx)(U,{type:`search`,value:h,onChange:e=>v(e.target.value),placeholder:o(),"aria-label":o(),className:`oc-rdefaults__filter`}):null,w.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:qe()}):(0,J.jsx)(`ul`,{className:`oc-rdefaults__list`,"aria-label":ie({count:C.length}),children:w.map(({agent:e,show:t,sameAsDefault:n})=>{let r=Y(e),i={kind:`agent`,agentId:e.agentId};return(0,J.jsxs)(`li`,{className:`oc-rdefaults__item`,children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__who`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:r}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,n?(0,J.jsx)(`span`,{className:`oc-rdefaults__same`,children:m()}):null]}),(0,J.jsxs)(`div`,{className:`oc-rdefaults__ctl`,children:[kt(a,i)?(0,J.jsx)(Ye,{size:14,className:`oc-rdefaults__spin`,"aria-label":M()}):null,(0,J.jsx)(W,{field:`showReasoning`,ariaLabel:Ne({agent:r}),options:[{id:`on`,label:Fe()},{id:`off`,label:Oe()}],value:t?`on`:`off`,onChange:t=>void D(e,t===`on`,u({agent:r,value:$(t===`on`)})),disabled:O}),(0,J.jsx)(H,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":g({agent:r}),title:g({agent:r}),onClick:()=>void re(e),children:(0,J.jsx)(at,{"aria-hidden":!0})})]}),kt(c,i)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error oc-rdefaults__rowerror`,role:`alert`,children:k()}):null]},e.agentId)})})]}),c?.kind===`agent`&&!C.some(e=>e.agent.agentId===c.agentId)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null]}),(0,J.jsx)(`p`,{className:`oc-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:d})]})}function jt({agents:e,instanceDefault:t,disabled:n,triggerRef:r,onPick:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(null),p=(0,G.useId)(),m=(0,G.useRef)(null),h=Q(e,s),g=Et(h,l),_=Q(e,``).length===0,v=e=>`${p}-opt-${e}`;function y(){o(!1),c(``),u(null)}function b(e){u(e>=0?h[e].agentId:null),e>=0&&m.current?.querySelector(`#${CSS.escape(v(e))}`)?.scrollIntoView({block:`nearest`})}function x(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)e.preventDefault(),b(Ot(g,e.key,h.length));else if(e.key===`Enter`){e.preventDefault();let t=Dt(h,l);t===null?u(null):(y(),i(t))}}return(0,J.jsxs)(et,{open:a,onOpenChange:e=>e?o(!0):y(),children:[(0,J.jsx)($e,{asChild:!0,children:(0,J.jsxs)(H,{ref:r,variant:`outline`,size:`sm`,disabled:n,children:[(0,J.jsx)(Xe,{"aria-hidden":!0}),d()]})}),(0,J.jsxs)(Qe,{align:`end`,className:`oc-rdefaults__pop p-0`,children:[(0,J.jsx)(`p`,{className:`oc-rdefaults__pophint`,children:re({value:$(Tt(t))})}),(0,J.jsx)(U,{autoFocus:!0,type:`search`,role:`combobox`,"aria-expanded":!0,"aria-controls":p,"aria-autocomplete":`list`,"aria-activedescendant":g>=0&&g<h.length?v(g):void 0,"aria-label":E(),placeholder:E(),value:s,onChange:e=>{c(e.target.value),u(null)},onKeyDown:x,className:`oc-rdefaults__search`}),(0,J.jsx)(`div`,{id:p,ref:m,role:`listbox`,"aria-label":d(),className:`oc-rdefaults__options`,children:h.length===0?(0,J.jsx)(`p`,{className:`oc-rdefaults__empty`,children:_?D():f()}):h.map((e,t)=>(0,J.jsxs)(`div`,{id:v(t),role:`option`,"aria-selected":t===g,className:`oc-rdefaults__opt${e.enabled?``:` is-disabled`}${t===g?` is-active`:``}`,onMouseEnter:()=>u(e.agentId),onMouseDown:e=>e.preventDefault(),onClick:()=>{y(),i(e)},children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:Y(e)}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,e.enabled?null:(0,J.jsx)(`span`,{className:`oc-rdefaults__badge`,children:w()})]},e.agentId))})]})]})}function Mt({instance:e}){let t=F(P.admin.upsertInstanceConfig),n=j(P.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,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Le()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsxs)(V,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":Le(),children:(0,J.jsx)(L,{placeholder:le()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:c,children:le()}),d.map(e=>(0,J.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,J.jsx)(H,{size:`sm`,disabled:!l||o===`saving`,onClick:()=>void u(),children:o===`saving`?M():A()})]}),o===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,o===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null]})}function Nt({instance:e}){let t=F(P.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,G.useState)(n),[o,s]=(0,G.useState)(r===null?``:String(r)),[c,l]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n),s(r===null?``:String(r)),l(`idle`)},[e._id,n,r]);let u=o.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=!i||d===null||Number.isInteger(d)&&d>=4e3&&d<=6e4,p=i!==n||(d??null)!==r;async function m(){l(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||d===null||Number.isNaN(d)?delete n.curationBudgetChars:n.curationBudgetChars=d,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,J.jsx)(I,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":de()}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:de()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f,"aria-label":ye(),disabled:!i}),(0,J.jsx)(H,{size:`sm`,disabled:!p||!f||c===`saving`,onClick:()=>void m(),children:c===`saving`?M():A()})]}),f?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Pe()}),c===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,c===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:De()})]})}function Pt({instance:e}){let t=F(P.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,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Be()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.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,J.jsx)(H,{size:`sm`,disabled:!u||!l||a===`saving`,onClick:()=>void d(),children:a===`saving`?M():A()})]}),l?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Re()}),a===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,a===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ce()})]})}function Ft(){let e=se(P.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=j(P.admin.listInstances,{}),[a,o]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[r,a]);let s=(r?.length??0)>1,c=r!==void 0&&r.length===0,l=j(P.compat.forInstance,a?{instanceName:a}:`skip`),u=a?nt(l,`configDefaults`):`loading`,d=u===`loading`?null:u.blocked,f=(0,G.useMemo)(()=>s&&a?{instanceName:a}:{},[s,a]),p=(0,G.useRef)(0),m=(0,G.useCallback)(async()=>{let t=++p.current;n({status:`loading`});try{let r=st(await e(f));if(p.current!==t)return;n({status:`done`,current:r})}catch{if(p.current!==t)return;n({status:`error`})}},[e,f]);(0,G.useEffect)(()=>{d===!1&&(s&&!a||m())},[m,d,s,a]);let g=t.status===`done`?t.current:null,_=(0,G.useMemo)(()=>ot.map(e=>({id:e,label:tt(e)})),[]),v=(0,G.useMemo)(()=>[{id:`fast`,label:Te()},{id:`standard`,label:je()}],[]);return(0,J.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}),s&&a?(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,J.jsxs)(V,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(R,{size:`sm`,"aria-label":b(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:(r??[]).map(e=>(0,J.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):u===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):u.blocked?(0,J.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,J.jsx)(Ze,{size:14,"aria-hidden":!0}),` `,rt(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):t.status===`error`?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[C(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>void m(),children:He()})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:ke()}),(0,J.jsx)(W,{field:`thinkingLevel`,options:_,value:g?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:ke()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ze()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:me()}),(0,J.jsx)(W,{field:`fastMode`,options:v,value:g===null||g.fastModeDefault===null?null:g.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:me()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]}),(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:ge()})]}),(()=>{let e=r?.find(e=>e.name===(a??r[0]?.name));return e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pt,{instance:e}),(0,J.jsx)(Nt,{instance:e}),(0,J.jsx)(Mt,{instance:e}),(0,J.jsx)(At,{instanceName:e.name}),(0,J.jsx)(vt,{instanceName:e.name})]}):null})()]})}export{Ft as ChatDefaultsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./bundle-mjs-C73ZY4La.js";import{HM as t,aO as n,hO as r,mO as i,oO as a,sO as o,t as s,yQ as c}from"./api-CWqdeSbN.js";import{t as l}from"./use_paginated_query-CebdO_HQ.js";import{t as u}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{n as d}from"./ConfirmDialog-B7k0wvSi.js";import{r as f}from"./trashView-CwUC01r_.js";import{n as p,t as m}from"./trashPage-3suR6eIy.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(s.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=c(s.trash.restoreChat),b=c(s.trash.purgeChat),x=c(s.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:r({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:a(),description:n(),confirmLabel:o(),destructive:!0})&&await x({})},children:o()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:t()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:i()}):(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{$R as r,AR as i,BR as a,Cz as o,DR as s,Dz as c,ER as l,Ez as u,FR as d,GR as f,HR as p,IR as m,JR as ee,KR as te,LR as ne,MR as re,NR as ie,OR as ae,PR as oe,QR as h,RR as se,Sz as g,TR as _,Tz as v,UR as y,VR as b,WR as x,XR as S,YR as C,ZR as w,_z as T,am as E,az as D,bQ as O,bz as k,cz as A,dz as j,ez as M,fz as N,gz as P,hz as F,iz as I,jR as L,kR as R,lz as z,mz as B,nz as ce,oz as V,pz as H,qR as U,rm as W,rz as G,sz as K,t as q,tz as le,uz as ue,vz as de,wz as fe,xz as pe,yQ as J,yz as me,zR as he}from"./api-CWqdeSbN.js";import{t as ge}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{n as _e}from"./format-AQELUhPa.js";import{n as Y}from"./ConfirmDialog-B7k0wvSi.js";import{t as ve}from"./DataTableShell-DvtkASQG.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>c(),incorrect:()=>u(),incoherence:()=>v(),formatting:()=>fe(),latency:()=>o(),api_error:()=>g(),other:()=>pe()},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:me()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:de()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:k()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=J(q.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1);async function p(){let t=c.trim();if(!(!t||u)){d(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let m=[];try{m=i.contextJson?JSON.parse(i.contextJson):[]}catch{m=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${T()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:f(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:P()}),(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:L()}),(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:F()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.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`?B():e.authorRole===`agent`?e.authorLabel??E():H()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:N()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:j(),value:c,maxLength:2e3,rows:3,onChange:e=>l(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 p(),disabled:!c.trim()||u,children:u?ue():z()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||K()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||K()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I({count:i.contextCount??m.length,truncated:i.contextTruncated?G():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.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,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ce()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.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:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?r({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[h(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,w()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=O(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),r=Y(),[o,c]=(0,X.useState)(null),[u,f]=(0,X.useState)({});async function h(e){if(o===e._id){c(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});f(t=>({...t,[e._id]:n}))}c(e._id)}async function g(e){await r({title:s(),description:l(),confirmLabel:_(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&c(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,Z.jsx)(`strong`,{children:C()}),` `,ee()]}),(0,Z.jsx)(ve,{title:U(),rows:e,emptyHint:te(),isExpanded:e=>o===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Z.jsx)(be,{data:u[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:x(),cell:e=>_e(e.at),sort:e=>e.at},{header:y(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:p(),cell:e=>e.messageRole===`user`?b():a(),sort:e=>e.messageRole},{header:he(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${se({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ne(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:m(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:d(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:oe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ie()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:W()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:re()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?i():R(),onSelect:()=>void h(e)},{label:ae(),onSelect:()=>void g(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{$X as ee,AZ as te,CZ as r,DZ as i,EZ as a,OZ as ne,QX as re,SZ as ie,TZ as ae,XX as oe,YX as o,ZX as s,_Z as c,aZ as l,bQ as se,bZ as ce,cZ as le,cm as ue,dZ as de,eZ as fe,fQ as pe,fZ as me,gZ as u,hZ as d,iZ as he,kZ as ge,lQ as _e,lZ as ve,lm as f,mZ as p,nZ as ye,oZ as be,pZ as m,rZ as h,sZ as xe,t as g,tZ as Se,uZ as _,vU as v,vZ as y,wZ as b,xZ as x,yQ as S,yZ as C}from"./api-CWqdeSbN.js";import{c as w,g as T,n as E,r as D,t as O}from"./dropdown-menu-BVKVjups.js";import{t as k}from"./download-BaebAe6Z.js";import{t as A}from"./checkbox-DPxJTQjc.js";import{t as j}from"./rotate-ccw-CvefWwHW.js";import{t as Ce}from"./trash-2-xhtrhYsd.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CjcMQhwm.js";import{a as we,c as Te,i as Ee,n as De,o as Oe,r as ke,s as Ae,t as je}from"./alert-dialog-BcJMHbhI.js";import{t as L}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{r as Me}from"./toast-C_YfUacM.js";import{t as R}from"./badge-ChMMFtuW.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-rRR3TpMc.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return C();case`audio`:return y();case`video`:return c();case`pdf`:return u();case`document`:return d();case`archive`:return p();default:return m()}}function K(){let[e,t]=(0,H.useState)(W),[n,c]=(0,H.useState)(W),[u,d]=(0,H.useState)(W),[p,m]=(0,H.useState)(W),[y,C]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=S(g.files.softDelete),Y=Me();function Ie(){t(W),c(W),d(W),m(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ye())}catch(e){Y.error(Se(),e)}}let X=se(g.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:u===W?void 0:u,category:p===W?void 0:p,includeAutoGenerated:y||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(pe(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:_e()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||u!==W||p!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":ge(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(F,{value:W,children:ne()}),(0,U.jsx)(F,{value:`inbound`,children:i()}),(0,U.jsx)(F,{value:`outbound`,children:a()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:c,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":ae(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(F,{value:W,children:b()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:u,onValueChange:d,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":r(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(F,{value:W,children:ie()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:p,onValueChange:m,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":x(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(F,{value:W,children:ce()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(A,{checked:y,onCheckedChange:e=>C(e===!0),"aria-label":f()}),(0,U.jsx)(`span`,{children:f()})]}),$?(0,U.jsxs)(L,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(j,{size:14,"aria-hidden":!0}),l()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?oe():s()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:me()}),(0,U.jsx)(z,{children:de()}),(0,U.jsx)(z,{children:_()}),(0,U.jsx)(z,{children:ve()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{className:`text-right`,children:xe()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(R,{variant:`outline`,style:{marginLeft:6},children:ue()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(R,{variant:`secondary`,children:e.direction===`inbound`?i():a()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(O,{children:[(0,U.jsx)(w,{asChild:!0,children:(0,U.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":he(),children:(0,U.jsx)(T,{size:16})})}),(0,U.jsxs)(E,{align:`end`,children:[e.url?(0,U.jsx)(D,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(k,{size:14}),be()]})}):(0,U.jsxs)(D,{disabled:!0,children:[(0,U.jsx)(k,{size:14}),re()]}),(0,U.jsxs)(D,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ce,{size:14}),h()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:o({cap:Be})}):null]}),(0,U.jsx)(je,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(Ee,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(Te,{children:fe()}),(0,U.jsx)(we,{children:ee()})]}),(0,U.jsxs)(Oe,{children:[(0,U.jsx)(ke,{children:v()}),(0,U.jsx)(De,{onClick:()=>void Le(),children:h()})]})]})})]})}export{K 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,$x as i,AS as a,BS as o,Bx as s,CS as c,Cx as l,DS as u,Dx as d,ES as f,Ex as p,FS as m,Fb as h,Fx as g,GS as _,Gb as v,Gx as y,HS as b,Hx as x,IS as S,Ib as C,Ix as w,JS as T,Jb as E,Jx as D,KS as O,Kb as k,Kx as A,LS as j,Lb as ee,Lx as te,MS as M,Mx as ne,NS as N,Nx as re,OS as ie,PS as P,Px as ae,Qb as F,Qx as oe,RS as se,Rb as ce,Rx as le,SS as ue,Sx as de,TS as fe,Tx as pe,US as me,Ux as he,VS as ge,Vx as I,WS as _e,Wb as ve,Wx as L,Xb as ye,Xx as be,Yb as xe,Yx as Se,Zb as Ce,Zx as we,_S as Te,_x as Ee,aS as De,ax as Oe,bQ as R,bS as ke,bx as Ae,cS as je,cx as Me,dS as Ne,dx as Pe,eS as Fe,ex as Ie,fS as Le,fx as Re,gS as ze,gx as Be,hx as Ve,iS as He,ix as Ue,jS as We,jx as Ge,k as Ke,kS as qe,lS as Je,lx as Ye,mx as Xe,nS as Ze,nx as Qe,oS as $e,ox as et,px as tt,qS as nt,qb as rt,qx as it,rS as at,rx as ot,sS as st,sx as ct,t as z,tS as lt,tx as ut,uS as B,ux as dt,vS as ft,vx as pt,wS as mt,wx as ht,xS as gt,xx as _t,yQ as V,yS as H,yx as vt,zS as yt,zx as bt}from"./api-CWqdeSbN.js";import{t as xt}from"./chevron-left-ByEQraEh.js";import{t as St}from"./chevron-right-DMqzlhWH.js";import{t as U}from"./checkbox-DPxJTQjc.js";import{t as Ct}from"./server-DcInl3Nh.js";import{i as wt,n as Tt,r as Et,t as Dt}from"./users-CRbE186D.js";import{t as W}from"./star-5ysDlx3k.js";import{t as Ot}from"./x-CcIT4ync.js";import{a as kt,i as At,n as jt,r as Mt,t as Nt}from"./select-CjcMQhwm.js";import{i as Pt,n as Ft,r as It,t as Lt}from"./tabs-B8emuY1B.js";import{t as G}from"./button-C_rIPtCv.js";import{t as K}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as q}from"./toast-C_YfUacM.js";import{t as J}from"./badge-ChMMFtuW.js";import{a as Rt,n as zt,o as Bt,r as Vt,t as Ht}from"./dialog-CPAskUwF.js";import{t as Ut}from"./appHost-CH3EGcJw.js";import{n as Wt}from"./ConfirmDialog-B7k0wvSi.js";import{t as Gt}from"./EntitySheet-DRzkWKlH.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-DC3eSLA1.js";import{t as tn}from"./FilterBar-DCCuFxDn.js";import{t as nn}from"./DataTableShell-DvtkASQG.js";import{t as Z}from"./DetailChips-DDAtgnjA.js";var rn=Ke(`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=R(z.groups.listGroups,{}),t=R(z.me.getMe,{host:Ut})?.role===`admin`,n=V(z.groups.createGroup),r=V(z.groups.updateGroup),i=V(z.groups.deleteGroup),s=Wt(),c=q(),[l,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(an),[v,y]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(``),E=(0,Q.useMemo)(()=>{if(!e)return e;let t=C.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,C]);function D(){p(null),g(an),d(!0)}function k(e){p(e),g({name:e.name,description:e.description??``}),d(!0)}async function A(){try{f?await r({groupId:f._id,name:h.name,description:h.description}):await n({name:h.name,description:h.description||void 0}),g(an),p(null),d(!1)}catch(e){c.error(he(),e)}}async function ee(e){if(await s({title:qe({name:e.name}),description:ie(),confirmWord:e.name,confirmLabel:u(),cancelLabel:m(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(x(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}),t?(0,$.jsx)(pn,{}):null,(0,$.jsx)(tn,{q:C,onQChange:w,onReset:()=>w(``),canReset:C!==``,searchPlaceholder:o()}),(0,$.jsx)(nn,{title:T(),rows:E,addLabel:O(),onAdd:t?D:void 0,emptyHint:_(),columns:[{header:_e(),cell:e=>e.name,sort:e=>e.name},{header:me(),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:Ge({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:b(),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:ge(),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:yt(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:se(),onSelect:()=>k(e)},{label:j(),variant:`destructive`,onSelect:()=>void ee(e)}]:[]]}),(0,$.jsx)(Gt,{open:l,onOpenChange:d,title:f?N():P(),description:M(),canSubmit:!!h.name.trim(),onSubmit:A,submitLabel:S(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:We()}),(0,$.jsx)(K,{value:h.name,onChange:e=>g({...h,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,$.jsx)(K,{value:h.description,onChange:e=>g({...h,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}),ft()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ze({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Te(),(0,$.jsx)(St,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=R(z.groups.getGroup,n&&e?{groupId:e}:`skip`),a=i?.viewerIsAdmin===!0,o=R(z.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),s=R(z.groups.listAssignableUsers,n&&a?{}:`skip`),u=V(z.groups.addMember),d=V(z.groups.removeMember),p=V(z.groups.bulkSetMembers),m=V(z.groups.setGroupManager),h=q(),[g,_]=(0,Q.useState)(``),[v,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(`members`),[C,w]=(0,Q.useState)(1),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(new Set),k=(0,Q.useRef)(null),j=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ee=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),te=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),M=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>X(e.instanceName,e.agentId))),[i]),ne=(0,Q.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?X(e.instanceName,e.agentId):null},[i]);(0,Q.useEffect)(()=>{_(``),b(``),S(`members`),w(1),E(null),k.current=null},[n,e]),(0,Q.useEffect)(()=>{w(1)},[g]),(0,Q.useEffect)(()=>{n&&i&&e&&k.current!==e&&(k.current=e,O(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let N=(0,Q.useMemo)(()=>s?Yt(s,g,D):[],[s,g,D]);async function re(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){h.error(I(),Y(e))}}async function ie(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){h.error(y(),e)}}let P=qt(N,e=>j.has(e.userId)),ae=N.filter(e=>j.has(e.userId)).length,F=Xt(N,C,sn);async function oe(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:P!==`all`})}catch(e){h.error(I(),Y(e))}}let se=(e,t)=>(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":de({user:t}),title:de({user:t}),onClick:()=>E({userId:e,label:t}),children:[(0,$.jsx)(Et,{size:13,"aria-hidden":!0}),l()]});return(0,$.jsx)(Ht,{open:n,onOpenChange:r,children:(0,$.jsxs)(zt,{className:`oc-access`,children:[(0,$.jsxs)(Rt,{children:[(0,$.jsx)(Bt,{children:f({name:t})}),(0,$.jsx)(Vt,{children:i&&!a?bt():fe()})]}),(0,$.jsxs)(Lt,{value:x,onValueChange:S,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}),mt(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,$.jsxs)(Pt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ct,{size:13,"aria-hidden":!0}),ue(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,$.jsxs)(Pt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(rn,{size:13,"aria-hidden":!0}),Ze(),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()}):a?s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:je()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:g,onChange:e=>_(e.target.value),placeholder:c(),className:`oc-access__search`}),N.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ke()}):(0,$.jsxs)($.Fragment,{children:[N.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(U,{checked:P===`all`||P===`some`&&`indeterminate`,onCheckedChange:()=>void oe(),"aria-label":H()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:H()}),(0,$.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[ae,` / `,N.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=j.has(e.userId),n=Jt(e),r=ee.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:t,onCheckedChange:()=>void re(e.userId,t),"aria-label":Le({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&&te.has(e.userId)?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:_t()}):null,(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:en(e.role)}),t?se(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?A():it(),title:r?A():it(),onClick:()=>void ie(e.userId,r),children:(0,$.jsx)(wt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(cn,{page:F.page,pageCount:F.pageCount,onPage:w})]})]}):e?(0,$.jsx)(un,{groupId:e,members:i.members,agentsButton:se}):null}),(0,$.jsxs)(Ft,{value:`agents`,children:[i&&!a?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Re()}):null,o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:st()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:v,onChange:e=>b(e.target.value),placeholder:gt(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,$.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,defaultKey:ne,viewerIsAdmin:a,query:v},`${e}-${t._id}`))})]})]}),(0,$.jsx)(Ft,{value:`charts`,children:(0,$.jsx)(mn,{groupId:e})})]}),(0,$.jsx)(dn,{groupId:e,member:T,onOpenChange:e=>{e||E(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=R(z.groupInvites.listGroupInviteRequests,{groupId:e}),i=V(z.groupInvites.requestGroupInvite),a=V(z.groups.removeMember),o=Wt(),s=q(),[c,l]=(0,Q.useState)(``),[u,f]=(0,Q.useState)(1),h=Xt(t,u,sn);async function _(t){t.preventDefault();let n=c.trim();if(n)try{await i({groupId:e,email:n}),l(``),s.success(ae())}catch(e){s.error(re(),e)}}async function v(t,n){if(await o({title:d({user:n}),description:pe({user:n}),confirmLabel:ht(),cancelLabel:m(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){s.error(I(),Y(e))}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void _(e),children:[(0,$.jsx)(K,{type:`email`,value:c,onChange:e=>l(e.target.value),placeholder:w(),"aria-label":le()}),(0,$.jsxs)(G,{type:`submit`,size:`sm`,disabled:!c.trim(),children:[(0,$.jsx)(Tt,{size:14,"aria-hidden":!0}),g()]})]}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:te()}),t.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Ae()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:h.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:_t()}):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":D(),title:D(),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":d({user:e.label}),title:e.manager?p():e.lastGroup?ve():d({user:e.label}),onClick:()=>void v(e.userId,e.label),children:(0,$.jsx)(Ot,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,$.jsx)(cn,{page:h.page,pageCount:h.pageCount,onPage:f})]}),r!==void 0&&r.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:ne()}),(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 i=R(z.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),a=V(z.groups.setMemberAgents),o=V(z.groups.setMemberDefaultAgent),s=q();async function c(e){try{await e()}catch(e){s.error(v(),e)}}let l=i?.agents??[],u=new Map(l.map(e=>[X(e.instanceName,e.agentId),e])),d=[...u.keys()],f=new Set(l.filter(e=>e.allowed).map(e=>X(e.instanceName,e.agentId)));function p(n){if(!e||!t||!i)return;let r=Kt(d,f,i.restricted,n).map(e=>{let t=u.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});c(()=>a({groupId:e,userId:t.userId,agents:r}))}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:Ie({user:t?.label??``})}),(0,$.jsx)(Vt,{children:r()})]}),i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):i===null||l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:k()}):(0,$.jsxs)($.Fragment,{children:[i.settable?null:(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h()}),i.adminNarrowed?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):null,i.restrictedByAdmin&&!i.viewerIsAdmin?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:C()}):null,(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,children:i.restricted?Ce():F()}),i.restricted?(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:!i.settable||i.restrictedByAdmin&&!i.viewerIsAdmin,onClick:()=>e&&t?void c(()=>a({groupId:e,userId:t.userId,agents:null})):void 0,children:ye()}):null]}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:l.map(n=>{let r=X(n.instanceName,n.agentId),a=n.displayName??n.agentId;return(0,$.jsxs)(`div`,{className:`oc-access__row oc-reveal-host`,children:[(0,$.jsx)(U,{checked:n.allowed,disabled:!i.settable||i.restrictedByAdmin&&!i.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>p(r),"aria-label":xe({name:a})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:a,children:a}),n.limitedByAdmin?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:ee()}):null,n.state===`deleted`?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:at()}):null,n.allowed?n.isMemberDefault?(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!i.settable,"aria-label":E(),title:E(),onClick:()=>e&&t?void c(()=>o({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 oc-reveal oc-hit`,disabled:!i.settable,"aria-label":rt(),title:rt(),onClick:()=>e&&t?void c(()=>o({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,$.jsx)(W,{size:14})}):null]},r)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:o}){let c=R(z.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),l=V(z.groups.assignAgentToGroup),u=V(z.groups.removeAgentFromGroup),d=V(z.groups.bulkSetGroupAgents),f=V(z.groups.claimAgentForGroup),p=V(z.groups.setGroupDefaultAgent),m=q(),[h,g]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{g(1)},[o]),!e)return null;let _=$t(c?.agents??[],o),v=c?.discovery&&!c.discovery.lastPollOk,y=e=>Zt({assigned:r.has(X(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),b=_.filter(e=>y(e)!==`claim`),x=_.filter(e=>y(e)===`claim`);if(o.trim()&&_.length===0)return null;let S=b.filter(e=>y(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),C=qt(S,e=>r.has(X(t,e.agentId))),w=Xt(b,h,sn);async function T(n,r){try{r?await u({groupId:e,instanceName:t,agentId:n}):await l({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(s(),Y(e))}}async function E(){if(S.length===0)return;let n=S.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:C!==`all`})}catch(e){m.error(s(),Y(e))}}async function D(n){try{await f({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(ct(),e)}}async function O(n){try{await p({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){m.error(ut(),e)}}let k=e=>e.reservedForGroup?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:et()}):e.reserved?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?Ue():Oe({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}),v?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:He()}):null]}),c===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Je()}):_.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:v?De():$e()}):(0,$.jsxs)($.Fragment,{children:[S.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(U,{checked:C===`all`||C===`some`&&`indeterminate`,onCheckedChange:()=>void E(),"aria-label":H()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:H()})]}):null,w.pageItems.map(e=>{let n=X(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=y(e)===`locked`;return(0,$.jsxs)(`div`,{className:`oc-access__row oc-reveal-host${s?` is-disabled`:``}`,children:[(0,$.jsx)(U,{checked:a,disabled:s&&!a,onCheckedChange:()=>void T(e.agentId,a),"aria-label":Ne({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,k(e),o?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:at()}):null,a?i===n?(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":ot(),title:ot(),onClick:()=>void O(null),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault oc-reveal oc-hit`,"aria-label":Qe(),title:Qe(),onClick:()=>void O(e.agentId),children:(0,$.jsx)(W,{size:14})}):null]},e.agentId)}),(0,$.jsx)(cn,{page:w.page,pageCount:w.pageCount,onPage:g}),x.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:Pe()}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:dt()}),x.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":Me({name:t}),onClick:()=>void D(e.agentId),children:Ye()})]},e.agentId)})]}):null]})]})}function pn(){let e=R(z.groupInvites.listPendingInviteRequests,{}),t=V(z.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(tt(),e)}}return(0,$.jsxs)(`section`,{className:`oc-invites`,"aria-label":vt(),children:[(0,$.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,$.jsx)(Tt,{size:14,"aria-hidden":!0}),vt(),(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??`?`,` ·`,` `,pt({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?Ve():Xe()}),(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:Ee()}),(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:Be()})]},e._id))})]})}function mn({groupId:e}){let t=R(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=V(z.charts.assignChartToGroup),r=V(z.charts.removeChartFromGroup),a=V(z.charts.setGroupDefaultChart),o=V(z.charts.addChartToGroupPool),s=V(z.charts.removeChartFromGroupPool),c=q();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:lt()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":we({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":be(),title:be(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:Se()}):null,d?(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":oe({name:e.name}),title:oe({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(Ot,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.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:i()})}),(0,$.jsx)(jt,{children:u.map(e=>(0,$.jsx)(Mt,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Fe()}):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{$I as r,AI as i,AL as a,BI as o,BL as s,Bt as c,CI as l,CL as u,Cr as d,Cs as f,DI as p,DL as m,Dh as h,EI as g,EL as _,Eh as v,FI as y,FL as ee,GI as b,GL as x,HI as S,HL as te,Ht as ne,II as C,IL as re,It as ie,JI as w,JL as ae,KI as T,KL as oe,LI as E,LL as D,Lt as se,MI as O,ML as ce,Mb as le,NI as ue,NL as de,Nb as fe,OI as pe,OL as me,Oh as he,PI as ge,PL as _e,Pb as ve,QI as ye,RI as be,RL as xe,Rj as Se,Rt as Ce,SI as we,SL as Te,Sr as Ee,Ss as De,TI as Oe,TL as ke,Th as Ae,Tr as je,Ts as Me,UI as Ne,UL as Pe,Ut as Fe,VI as Ie,VL as Le,Vt as Re,WI as ze,WL as Be,Wt as Ve,XI as He,XL as Ue,YI as We,YL as Ge,ZI as Ke,ZL as qe,_I as Je,_L as Ye,_Q as k,_r as Xe,_s as Ze,aI as Qe,aL as $e,bI as et,bL as tt,bQ as A,bd as nt,br as rt,bs as it,cI as at,cL as ot,dI as st,dL as ct,ds as lt,eL as ut,fG as dt,fI as ft,fL as pt,fs as mt,gI as ht,gL as gt,gr as _t,gs as vt,hI as yt,hL as bt,hs as xt,iI as St,iL as Ct,jL as wt,kI as Tt,kL as Et,lI as Dt,lL as Ot,ls as kt,mI as At,mL as jt,ms as Mt,nI as Nt,nL as Pt,oI as Ft,oL as It,pG as Lt,pI as Rt,pL as j,ps as zt,qI as Bt,qL as Vt,rI as Ht,rL as M,sI as Ut,sL as N,t as P,tL as Wt,uI as Gt,uL as Kt,us as qt,vI as Jt,vL as Yt,vr as Xt,vs as Zt,wI as Qt,wL as $t,wr as en,ws as tn,xI as nn,xL as rn,xd as an,xr as on,xs as sn,yI as cn,yL as ln,yQ as F,yd as un,yr as dn,ys as fn,zI as pn,zL as mn,zj as hn,zt as gn}from"./api-CWqdeSbN.js";import{a as _n,c as vn}from"./FieldLabel-imj_Z0rZ.js";import{t as yn}from"./checkbox-DPxJTQjc.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-CjcMQhwm.js";import{n as bn,r as xn,t as Sn}from"./popover-C-Y_Yoco.js";import{t as V}from"./button-C_rIPtCv.js";import{t as H}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as U}from"./toast-C_YfUacM.js";import{t as W}from"./badge-ChMMFtuW.js";import{a as G,n as K,o as q,r as Cn,t as wn}from"./dialog-CPAskUwF.js";import{n as Tn}from"./ConfirmDialog-B7k0wvSi.js";import{t as En}from"./EntitySheet-DRzkWKlH.js";import{a as Dn}from"./groupManageView-DC3eSLA1.js";import{t as On}from"./DataTableShell-DvtkASQG.js";import{InstanceConfigDialog as kn}from"./BridgeTab-Bnu9R5N4.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],An=new Set(Y),jn=`conversational`;function Mn(e){let t=new Set((e??[]).filter(e=>An.has(e)));return t.size===0?[jn]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:_n,widgetsEnabled:!0,widgetPromptConfirm:!1},Nn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Pn(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 Fn(){let e=A(P.admin.listInstances,{}),t=A(P.agents.listAllInstanceAgents,{}),n=F(P.admin.upsertInstance),r=F(P.widgets.setInstanceWidgets),i=F(P.admin.deleteInstance),o=U(),[l,p]=(0,J.useState)(!1),[h,g]=(0,J.useState)(Z),[v,y]=(0,J.useState)(null),[b,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(null);async function O(){try{let t=await n({instanceId:T??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}),i=T===null?null:e?.find(e=>e._id===T),a=i?.config?.widgetsEnabled!==!1,o=i?.config?.widgetPromptConfirm===!0;h.kind===`openclaw`&&(h.widgetsEnabled!==a||h.widgetPromptConfirm!==o)&&await r({instanceId:t,enabled:h.widgetsEnabled,promptConfirm:h.widgetPromptConfirm}),g(Z),E(null),p(!1)}catch(e){o.error(Ge(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[ae(),(0,X.jsx)(`strong`,{children:Vt()}),oe()]}),(0,X.jsx)(On,{title:x(),rows:e,addLabel:Be(),onAdd:()=>{E(null),g(Z),p(!0)},emptyHint:Pe(),columns:[{header:te(),cell:e=>e.name,sort:e=>e.name},{header:Le(),cell:e=>(0,X.jsx)(W,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:s(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:mn(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:qe(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(W,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?Dt():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ee(),onSelect:()=>{E(e._id),g(Pn(e)),p(!0)}},{label:Ue(),onSelect:()=>y(e.name)},{label:tt(),onSelect:()=>w(e)},{label:xe(),onSelect:()=>S(e)},{label:D(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:D(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,X.jsx)(En,{open:l,onOpenChange:p,title:T?_e():re(),description:ce(),canSubmit:!!(h.name&&h.gatewayUrl),onSubmit:O,submitLabel:wt(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:a(),children:[(0,X.jsx)(H,{value:h.name,disabled:T!==null,onChange:e=>g({...h,name:e.target.value})}),T?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:de()}):null]}),(0,X.jsx)($,{label:Et(),children:(0,X.jsxs)(B,{value:h.kind,onValueChange:e=>g({...h,kind:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(z,{value:`hermes`,children:`Hermes`})]})]})}),h.kind===`hermes`?(0,X.jsx)($,{label:an(),children:(0,X.jsxs)(B,{value:h.transport,onValueChange:e=>g({...h,transport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`ws`,children:nt()}),(0,X.jsx)(z,{value:`rest`,children:un()})]})]})}):null,(0,X.jsx)($,{label:me(),children:(0,X.jsx)(H,{value:h.gatewayUrl,onChange:e=>g({...h,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:m(),children:(0,X.jsx)(H,{value:h.bridgeUrl,placeholder:_(),onChange:e=>g({...h,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:ke(),children:(0,X.jsx)(H,{value:h.displayName,onChange:e=>g({...h,displayName:e.target.value})})}),(0,X.jsxs)($,{label:hn(),children:[(0,X.jsxs)(B,{value:h.streamTransport,onValueChange:e=>g({...h,streamTransport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsx)(R,{children:vn.map(e=>(0,X.jsx)(z,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Se()})]}),(0,X.jsx)($,{label:$t(),children:(0,X.jsx)(H,{value:h.gatewayVersion,placeholder:u(),onChange:e=>g({...h,gatewayVersion:e.target.value})})}),h.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:xt(),children:[(0,X.jsxs)(B,{value:h.authMode,onValueChange:e=>g({...h,authMode:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`token`,children:Mt()}),(0,X.jsx)(z,{value:`trusted-proxy`,children:zt()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.authMode===`trusted-proxy`?lt():mt()})]}),h.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:Me(),children:[(0,X.jsxs)(B,{value:h.personScopes,onValueChange:e=>g({...h,personScopes:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`capped`,children:tn()}),(0,X.jsx)(z,{value:`full`,children:f()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.personScopes===`full`?sn():De()})]}):null,h.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:it(),children:[(0,X.jsxs)(B,{value:h.identitySource,onValueChange:e=>g({...h,identitySource:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`canonical`,children:fn()}),(0,X.jsx)(z,{value:`email`,children:Zt()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.identitySource===`email`?vt():Ze()})]}):null,h.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:je(),children:[(0,X.jsxs)(B,{value:h.participantIdentity,onValueChange:e=>g({...h,participantIdentity:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`owner`,children:en()}),(0,X.jsx)(z,{value:`self`,children:d()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.participantIdentity===`self`?_t():Ee()})]}):null,h.kind===`openclaw`?(0,X.jsxs)($,{label:on(),children:[(0,X.jsxs)(B,{value:h.managePermissionModes?`on`:`off`,onValueChange:e=>g({...h,managePermissionModes:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`off`,children:rt()}),(0,X.jsx)(z,{value:`on`,children:dn()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.managePermissionModes?Xe():Xt()})]}):null,h.kind===`openclaw`?(0,X.jsxs)($,{label:Ve(),children:[(0,X.jsxs)(B,{value:h.widgetsEnabled?`on`:`off`,onValueChange:e=>g({...h,widgetsEnabled:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`on`,children:Fe()}),(0,X.jsx)(z,{value:`off`,children:ne()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.widgetsEnabled?Re():c()})]}):null,h.kind===`openclaw`&&h.widgetsEnabled?(0,X.jsxs)($,{label:gn(),children:[(0,X.jsxs)(B,{value:h.widgetPromptConfirm?`on`:`off`,onValueChange:e=>g({...h,widgetPromptConfirm:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`off`,children:Ce()}),(0,X.jsx)(z,{value:`on`,children:se()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:ie()})]}):null,h.authMode===`trusted-proxy`?(0,X.jsx)($,{label:qt(),children:(0,X.jsx)(H,{value:h.systemIdentity,placeholder:kt(),onChange:e=>g({...h,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:Te(),children:(0,X.jsx)(H,{value:h.gatewayHttpUrl,placeholder:rn(),onChange:e=>g({...h,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(Wn,{instanceName:v,open:v!==null,onOpenChange:e=>{e||y(null)}}),b?(0,X.jsx)(kn,{instance:b,onClose:()=>S(null)},b._id):null,C?(0,X.jsx)(In,{instance:C,onClose:()=>w(null)},C._id):null]})}function In({instance:e,onClose:t}){let n=A(P.instanceSecrets.listInstanceSecretStatus,{}),r=Nn[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(wn,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(G,{children:[(0,X.jsx)(q,{children:ln({instance:e.displayName??e.name})}),(0,X.jsx)(Cn,{children:Yt()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(zn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(Rn,{instance:e})}),(0,X.jsx)(Ln,{instance:e})]})})}function Ln({instance:e}){let t=k(P.instanceSync.forceInstanceSync),n=U(),[i,a]=(0,J.useState)(!1);async function o(){if(!i){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ye());break;case`no_agents`:n.success(He());break;case`no_bridge_url`:n.error(We());break;case`deploy_misconfigured`:n.error(w());break;case`unauthorized`:n.error(T());break;case`not_served`:n.error(b());break;default:n.error(Bt());break}}catch(e){n.error(Ke(),e)}finally{a(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:i,children:i?r():ut()})})]})}function Rn({instance:e}){let t=A(P.bridgeAuth.listBridgeAuthStatus,{}),n=k(P.bridgeAuth.mintBridgeSecret),r=F(P.bridgeAuth.revokeBridgeSecret),i=U(),[a,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){s(!0);try{let t=await n({instanceId:e._id});l(t.plaintext),d(!1)}catch(e){i.error(E(),e)}finally{s(!1)}}}async function h(){if(!a){s(!0);try{await r({instanceId:e._id}),l(null),i.success(be())}catch(e){i.error(E(),e)}finally{s(!1)}}}async function g(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,X.jsxs)($,{label:Ne(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(W,{variant:p?`outline`:`secondary`,children:p?`${jt()} · ${f.prefix}…${f.lastFour}`:j()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?o():Ie()}),p?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:pn()}):null]})]}),c?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:C()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?Lt():dt()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:y()})]}):null]})}function zn({instanceId:e,field:t,updatedAt:n}){let r=k(P.instanceSecrets.setInstanceSecret),i=F(P.instanceSecrets.clearInstanceSecret),a=k(P.deviceIdentity.generateDeviceIdentity),o=U(),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(!1),h=n!==null,g=t===`deviceIdentity`,_=t===`token`?Ye():t===`deviceIdentity`?gt():bt();async function v(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),f(null),m(!1),o.success(ot())}catch(e){o.error(N(),e)}finally{u(!1)}}}async function ee(){if(!l){u(!0);try{await i({instanceId:e,field:t}),f(null),m(!1),o.success(It())}catch(e){o.error(N(),e)}finally{u(!1)}}}async function b(){if(!l){u(!0);try{let t=await a({instanceId:e});f(t),m(!1),o.success(M())}catch(e){o.error(Wt(),e)}finally{u(!1)}}}let x=d?`openclaw devices approve ${d.id}`:``;async function S(){if(x)try{await navigator.clipboard.writeText(x),m(!0)}catch{}}return(0,X.jsxs)($,{label:_,children:[g?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Ct()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(W,{variant:h?`outline`:`secondary`,children:h?jt():j()}),(0,X.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:h?ct():pt(),onChange:e=>c(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void v(),disabled:l||s.trim().length===0,children:Kt()}),g?(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void b(),disabled:l,children:$e()}):null,h?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:l,children:Ot()}):null]})]}),d?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:M()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Pt()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:x}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:p?Lt():dt()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{f(null),m(!1)},children:y()})]}):null]})}var Bn={conversational:Qt,documentary:we,summarizer:he,curator:v},Vn={conversational:l,documentary:nn,summarizer:h,curator:Ae},Hn=e=>(Bn[e]??(()=>e))(),Q=e=>(Vn[e]??(()=>``))();function Un({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:pe()}),t.map(e=>(0,X.jsx)(W,{variant:`secondary`,className:`oc-agenttype__chip`,title:Q(e),children:(0,X.jsx)(`span`,{className:`oc-agenttype__label`,children:Hn(e)})},e)),(0,X.jsxs)(Sn,{children:[(0,X.jsx)(xn,{asChild:!0,children:(0,X.jsx)(V,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:p()})}),(0,X.jsxs)(bn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:g()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Oe()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(yn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Hn(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Q(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=A(P.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=F(P.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=F(P.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=F(P.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Mn(r);e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=F(P.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=F(P.agents.removeInstanceAgent),l=F(P.agents.setAgentReservation),u=A(P.groups.listGroupLabels,t?{}:`skip`),d=Tn(),f=U();async function p(t,n){if(e&&await d({title:Qe({name:n}),description:St(),confirmLabel:Ft()}))try{await l({instanceName:e,agentId:t,groupId:null})}catch(e){f.error(O(),Dn(e))}}async function m(t,n,r){if(!e)return;let i=(u??[]).find(e=>e._id===r)?.name??`?`;if(await d({title:ve({name:n,group:i}),description:fe({group:i}),confirmLabel:le()}))try{await l({instanceName:e,agentId:t,groupId:r})}catch(e){f.error(O(),Dn(e))}}async function h(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(O(),e)}}async function g(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){f.error(O(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){f.error(O(),e)}}async function v(t,n){if(e&&await d({title:Jt({name:n}),description:Je(),confirmLabel:ht(),destructive:!0}))try{await c({instanceName:e,agentId:t}),f.success(yt())}catch(e){f.error(O(),e)}}return(0,X.jsx)(wn,{open:t,onOpenChange:n,children:(0,X.jsxs)(K,{className:`oc-access`,children:[(0,X.jsxs)(G,{children:[(0,X.jsx)(q,{children:ge({name:e??``})}),(0,X.jsx)(Cn,{children:ue()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:At()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Rt():r.discovery.lastPollOk?ft():st({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:Gt()}):(0,X.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(yn,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void h(t.agentId,e===!0)}),(0,X.jsxs)(`div`,{className:`oc-agentcard__main`,children:[(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,X.jsx)(W,{variant:`outline`,children:t.reserved.groupName===null?Ut():at({group:t.reserved.groupName})}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:Nt()}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(t.agentId,a),children:cn()})]}):i?(0,X.jsx)(W,{variant:`default`,children:Dt()}):(0,X.jsx)(V,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void g(t.agentId),children:et()})]})]}),t.reserved?(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(V,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void p(t.agentId,a),children:Ft()}),(0,X.jsxs)(B,{value:``,onValueChange:e=>void m(t.agentId,a,e),children:[(0,X.jsx)(L,{size:`sm`,className:`h-7`,children:(0,X.jsx)(I,{placeholder:Ht()})}),(0,X.jsx)(R,{children:(u??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,X.jsx)(z,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,X.jsx)(Un,{agentId:t.agentId,types:o,onToggle:e=>void _(t.agentId,e,o)}):null,t.enabled?(0,X.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){f.error(O(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let a=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(H,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:i(),"aria-label":Tt(),onChange:e=>r(e.target.value),onBlur:a,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Fn as InstancesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Az as r,Bz as i,Fz as a,Gg as o,Hg as s,Hz as c,Iz as l,Jg as u,Kg as d,Lz as f,Mz as p,Nz as m,Pz as h,Rz as g,Ug as _,Vg as v,Vz as y,Wg as b,Yg as x,_Q as S,bQ as C,jz as w,kz as T,qg as E,t as D,yQ as O,zz as k}from"./api-CWqdeSbN.js";import{t as A}from"./checkbox-DPxJTQjc.js";import"./select-CjcMQhwm.js";import{t as j}from"./button-C_rIPtCv.js";import{t as M}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{t as N}from"./badge-ChMMFtuW.js";var P=t(e(),1),F=n();function I(){let e=C(D.integrations.status.status,{}),t=O(D.admin.setIntegrationConfig),[n,o]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&o(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:c()});let s=n,d=(e,t,n)=>o({...s,[e]:{...s[e],[t]:n}}),_=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),` `,(0,F.jsx)(`strong`,{children:i()}),` `,k()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:l()}),note:a(),children:[(0,F.jsx)(R,{label:m(),children:(0,F.jsx)(M,{value:s.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>d(`langfuse`,`host`,e.target.value),onBlur:()=>_(`langfuse`,{host:s.langfuse.host??``})})}),(0,F.jsx)(z,{label:T(),checked:s.langfuse.enabled??!0,onChange:e=>{d(`langfuse`,`enabled`,e),_(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:l()}),note:h(),children:[(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:s.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>d(`opik`,`baseUrl`,e.target.value),onBlur:()=>_(`opik`,{baseUrl:s.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:s.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||r(),onChange:e=>d(`opik`,`workspace`,e.target.value),onBlur:()=>_(`opik`,{workspace:s.opik.workspace??``})})}),(0,F.jsx)(z,{label:T(),checked:s.opik.enabled??!0,onChange:e=>{d(`opik`,`enabled`,e),_(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:x()}),note:u(),children:[(0,F.jsx)(R,{label:E(),children:(0,F.jsx)(M,{value:s.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>d(`otlp`,`endpoint`,e.target.value),onBlur:()=>_(`otlp`,{endpoint:s.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:T(),checked:s.otlp.enabled??!0,onChange:e=>{d(`otlp`,`enabled`,e),_(`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=S(D.integrations.otlpSecret.setOtlpHeaders),n=O(D.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),f=async()=>{u(!0),c(null);try{await t({headersJson:r}),i(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,F.jsxs)(R,{label:d(),children:[(0,F.jsx)(M,{value:r,placeholder:e?o():b(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(j,{size:`sm`,disabled:l||r.trim().length===0,onClick:()=>void f(),children:_()}),e?(0,F.jsx)(j,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:s()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:v()})]})}export{I as IntegrationsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,BW as i,Jy as a,M as o,N as s,Qy as c,Sb as l,Yy as u,_b as d,bQ as f,bb as p,eb as m,gb as h,hb as g,it as _,j as v,mb as y,nt as b,pb as x,qy as S,rt as C,t as w,tt as T,vb as E,xb as D,yQ as O,yb as ee}from"./api-CWqdeSbN.js";import{t as te}from"./loader-circle-BqKiW3X9.js";import{t as ne}from"./rotate-ccw-CvefWwHW.js";import"./convexApi-G20_TNBS.js";import{r as re,t as ie}from"./capabilities-CASxhKEd.js";var k=t(e(),1),A={thinkingLevel:`segmented`,model:`list`,fastMode:`segmented`,showReasoning:`segmented`};function j(e,t){return A[e]===`segmented`&&t<=5?`segmented`:`list`}function M(e,t){return e!=null&&e[t]!==void 0}var N=[`inherit`,`fast`,`standard`];function P(e){return e==null||e.fastMode===void 0?`inherit`:e.fastMode?`fast`:`standard`}function F(e){return e===`inherit`?g():e===`fast`?y():x()}function I(e){return e===`inherit`?null:e===`fast`}function L(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function R(e){return e.length?e[0].toUpperCase()+e.slice(1):e}var z={off:`Off`,minimal:`Min`,low:`Low`,medium:`Med`,high:`High`,xhigh:`XHigh`};function B(e,t){return z[e]??t}function V(e){return H(e).used}function H(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 U(e){return e?e.promptBudgetBeforeReserve!=null&&e.promptBudgetBeforeReserve>0?e.promptBudgetBeforeReserve:e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null:null}function W(e){if(!e)return null;if(e.sessionOverfull===!0)return`compaction_failed`;let t=V(e),n=U(e);return t!=null&&n!=null&&t>n?`estimate_exceeds_budget`:null}function ae(e){return H(e).source}function G(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function K(e,t){let n=G(e,t);return n===null?null:m({pct:n,used:L(e),total:L(t)})}function q(e){return c({level:e??`full`})}function J(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?u({cost:e.toFixed(2),tokens:L(t)}):n?a({cost:e.toFixed(2)}):r?S({tokens:L(t)}):null}function oe(e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):null}function se(e,t=5){let n=e?.contextPercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=V(e),i=U(e);if(r===null||i===null)return null;let a=G(r,i);if(a===null)return null;let o=Math.abs(n-a);return o<=t?null:{gateway:n,derived:a,delta:o}}function ce(e,t){let n=t?C():b();return e===`agent`?{inheritedLabel:s(),resetLabel:v({value:n})}:e===`instance`?{inheritedLabel:o(),resetLabel:r({value:n})}:{}}function Y(e,t){let n=f(w.compat.forChat,e===null?`skip`:{chatId:e,...t?{routedAgent:t}:{}}),r=n==null?null:n.capabilities;return{can:(0,k.useCallback)(e=>ie(r,e),[r]),resolved:r!==null,loading:n===void 0,gatewayVersion:n?.gatewayVersion??null,provider:n?.provider??null,beyondValidated:n?.versionBeyondValidated===!0}}var X=n();function Z(e){let t=O(w.chats.setSessionKnob),[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(null);return{apply:(0,k.useCallback)(async(n,i)=>{r(n),a(null);let o={chatId:e};n===`fastMode`?o.fastMode=i:n===`showReasoning`?o.showReasoning=i:o[n]=i;try{await t(o)}catch{a({field:n,value:i})}finally{r(null)}},[e,t]),pending:n,error:i}}function Q({label:e,overridden:t,onReset:n,pending:r,error:i,onRetry:a,help:o,children:s,resettable:c=!0,inheritedLabel:u,resetLabel:d}){return(0,X.jsxs)(`div`,{className:`oc-spanel__row${t?` is-overridden`:``}`,children:[(0,X.jsxs)(`div`,{className:`oc-spanel__rowhead`,children:[(0,X.jsx)(`span`,{className:`oc-spanel__label`,children:e}),r?(0,X.jsx)(te,{size:13,className:`oc-spanel__spin`,"aria-label":p()}):t?c?(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:d??D(),"aria-label":d??D(),onClick:n,children:(0,X.jsx)(ne,{size:12,"aria-hidden":!0})}):null:(0,X.jsx)(`span`,{className:`oc-spanel__badge`,children:u??l()})]}),(0,X.jsx)(`div`,{className:`oc-spanel__ctl`,children:s}),o?(0,X.jsx)(`p`,{className:`oc-spanel__help`,children:o}):null,i?(0,X.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[ee(),(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:a,children:E()})]}):null]})}function le({options:e,value:t,onChange:n,ariaLabel:r,disabled:i}){return(0,X.jsx)(`div`,{className:`oc-spanel__seg`,role:`group`,"aria-label":r,children:e.map(e=>(0,X.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 ue({options:e,value:t,onChange:n,disabled:r,ariaLabel:i}){let a=t===null||e.some(e=>e.id===t);return(0,X.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,X.jsx)(`option`,{value:``,disabled:!0,children:`—`}):null,a?null:(0,X.jsx)(`option`,{value:t,children:t}),e.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function $({field:e,options:t,value:n,onChange:r,disabled:i,ariaLabel:a}){return j(e,t.length)===`list`?(0,X.jsx)(ue,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a}):(0,X.jsx)(le,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a})}function de({chatId:e,sm:t,settings:n}){let{apply:r,pending:a,error:o}=Z(e),{can:s}=Y(e),c=a!==null,l=(0,k.useCallback)(()=>{o&&r(o.field,o.value)},[r,o]),u=t?.thinkingLevels??[],f=t?.availableModels??[],p=P(n),m=re(s,{hasModels:f.length>0,hasLevels:u.length>0,described:t!==null});return(0,X.jsxs)(X.Fragment,{children:[m.model?(0,X.jsx)(Q,{label:i(),overridden:M(n,`model`),onReset:()=>void r(`model`,null),pending:a===`model`,error:o?.field===`model`,onRetry:l,resettable:m.reset,children:(0,X.jsx)($,{field:`model`,options:f,value:t?.model??null,onChange:e=>void r(`model`,e),disabled:c,ariaLabel:i()})}):null,m.thinking?(0,X.jsx)(Q,{label:d(),overridden:M(n,`thinkingLevel`),onReset:()=>void r(`thinkingLevel`,null),pending:a===`thinkingLevel`,error:o?.field===`thinkingLevel`,onRetry:l,resettable:m.reset,children:(0,X.jsx)($,{field:`thinkingLevel`,ariaLabel:d(),options:u.map(e=>({id:e.id,label:B(e.id,R(e.label)),title:R(e.label)})),value:t?.thinkingLevel??null,onChange:e=>void r(`thinkingLevel`,e),disabled:c})}):null,(0,X.jsx)(fe,{chatId:e,overridden:M(n,`showReasoning`),onApply:e=>void r(`showReasoning`,e),pending:a===`showReasoning`,error:o?.field===`showReasoning`,onRetry:l,disabled:c}),m.speed?(0,X.jsx)(Q,{label:h(),overridden:M(n,`fastMode`),onReset:()=>void r(`fastMode`,null),pending:a===`fastMode`,error:o?.field===`fastMode`,onRetry:l,resettable:m.reset,children:(0,X.jsx)($,{field:`fastMode`,ariaLabel:h(),options:N.map(e=>({id:e,label:F(e)})),value:p,onChange:e=>void r(`fastMode`,I(e)),disabled:c})}):null]})}function fe({chatId:e,overridden:t,onApply:n,pending:r,error:i,onRetry:a,disabled:o}){let s=f(w.messages.getSessionMeta,{chatId:e}),c=s?.showReasoning===!0,{inheritedLabel:l,resetLabel:u}=ce(s?.showReasoningDefaultSource,s?.showReasoningDefault===!0);return(0,X.jsx)(Q,{label:_(),overridden:t,inheritedLabel:l,resetLabel:u,onReset:()=>n(null),pending:r,error:i,onRetry:a,help:T(),children:(0,X.jsx)($,{field:`showReasoning`,ariaLabel:_(),options:[{id:`on`,label:C()},{id:`off`,label:b()}],value:s==null?null:c?`on`:`off`,onChange:e=>n(e===`on`),disabled:o})})}export{R as a,G as c,J as d,V as f,q as g,M as h,oe as i,se as l,L as m,de as n,K as o,U as p,Y as r,W as s,$ as t,ae as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,FB as i,GB as a,Gk as o,HB as s,Hk as c,Jk as l,Kk as ee,PB as u,Qk as d,UB as f,Uk as p,WB as m,Wk as h,Xk as g,Yk as te,Zk as ne,bQ as _,eA as v,gV as y,nA as b,qk as x,t as S,tA as C}from"./api-CWqdeSbN.js";import{n as w,t as T}from"./useNavigate-D3GIoxyW.js";import"./convexApi-G20_TNBS.js";import{c as E,n as re,o as ie}from"./searchSchemas-Dm-Qg010.js";import{t as D}from"./appHost-CH3EGcJw.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-BV8NO76j.js";import{n as N,t as P}from"./TimeRangePicker-BZtw1JkM.js";var F=t(e(),1),I={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`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=_(S.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=_(S.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:y()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:a()}),(0,R.jsx)(j,{children:f()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,R.jsx)(H,{series:n})})]})]})}function H({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),o=t=>6+t*468/(e.length-1),s=e=>74-e*68/r,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${o(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),l=e[e.length-1];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[u(),` p50 `,B(l.cP50),` `,m()]}),(0,R.jsxs)(`span`,{children:[i(),` p50 `,B(l.aP50),` `,m()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":a(),children:[(0,R.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:b(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:C(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:v(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:r(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:d(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:ne(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:g(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function ae(){let e=w({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=ie(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...E(e)})}),{from:i,to:a}=N(n),{rowLimit:o,buckets:s}=J(i,a),c=_(S.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>s&&e.set(t,n.slice(n.length-s));return e},[c,s]),d=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[te(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:l()})]}),(0,R.jsx)(Y,{value:n,onChange:r})]});return c===void 0?(0,R.jsxs)(R.Fragment,{children:[d,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:x()})]}):c.length===0?(0,R.jsxs)(R.Fragment,{children:[d,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:ee()})]}):(0,R.jsxs)(R.Fragment,{children:[d,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(u.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(oe,{config:e,series:u.get(e.metric)??[]},e.metric))})]},e):null})]})}function Y({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{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,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:o({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:h()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:p({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.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,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":c({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,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,R.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{ae as KpiTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$K as r,$Z as i,AK as a,Al as o,BK as s,BZ as c,DK as l,EK as u,FK as d,FZ as ee,GK as f,GZ as te,HK as p,HZ as m,IK as h,IZ as ne,JK as re,JZ as ie,KK as ae,KZ as oe,LK as se,LZ as ce,MK as g,MZ as le,NK as ue,NZ as de,OK as fe,PK as _,PZ as pe,QK as me,QZ as he,RK as v,RZ as y,TK as b,UK as x,UZ as S,VK as C,VZ as w,WK as T,WZ as E,XK as D,XZ as O,YK as k,YZ as A,ZK as j,ZZ as M,aq as N,bQ as P,cq as F,dl as I,eQ as L,eq as R,fl as ge,gl as _e,hl as ve,iQ as ye,iq as be,jK as xe,jL as Se,kK as Ce,kl as we,lQ as Te,ll as Ee,lq as De,ml as Oe,nq as ke,oq as Ae,pl as je,qK as Me,qZ as Ne,rq as Pe,sq as Fe,t as z,tQ as Ie,tq as Le,ul as Re,uq as ze,wl as Be,yQ as B,zK as Ve,zZ as He}from"./api-CWqdeSbN.js";import{t as V}from"./checkbox-DPxJTQjc.js";import{a as Ue,i as We,n as Ge,r as H,t as Ke}from"./select-CjcMQhwm.js";import{t as U}from"./button-C_rIPtCv.js";import{t as W}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{c as qe,d as Je,r as Ye,t as Xe,u as Ze}from"./useFontScale-DiSkEM6I.js";import{r as Qe}from"./toast-C_YfUacM.js";import{t as G}from"./badge-ChMMFtuW.js";import{t as K}from"./appHost-CH3EGcJw.js";import{t as $e}from"./localePickerView-C2RmOS86.js";import{t as et}from"./switch--NPD3Vp0.js";import{t as tt}from"./TimezoneCombobox-CeRN4N3z.js";var q=t(e(),1),J=[{id:`messages`,label:()=>ze()},{id:`composer`,label:()=>De()},{id:`sidebar`,label:()=>F()},{id:`notifications`,label:()=>f()},{id:`other`,label:()=>Fe()}],Y={showSource:{category:`messages`,label:()=>Ae(),help:()=>N()},showReport:{category:`messages`,label:()=>be(),help:()=>Pe()},copyAssistant:{category:`messages`,label:()=>ke()},copyUser:{category:`messages`,label:()=>Le()},showDelete:{category:`messages`,label:()=>R()},showTools:{category:`messages`,label:()=>r(),help:()=>me()},voiceInput:{category:`composer`,label:()=>j(),help:()=>D()},showUsage:{category:`composer`,label:()=>k(),help:()=>re()},autoReadAloud:{category:`composer`,label:()=>o(),help:()=>we()},showChatAge:{category:`sidebar`,label:()=>Me(),help:()=>ae()},notifSound:{category:`notifications`,label:()=>T(),help:()=>x()},notifSystem:{category:`notifications`,label:()=>p(),help:()=>C()},replySound:{category:`notifications`,label:()=>s(),help:()=>Ve()}};function X(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function nt(e,t){let n=X(t.trim()),r=new Map(J.map(e=>[e.id,e.label()])),i=new Map(J.map(e=>[e.id,[]]));for(let t of e){let e=Y[t],a=e?.category??`other`;n&&!X(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return J.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 Z(e){return e===`admin`}function Q(e){return e===!0?`on`:e===!1?`off`:`inherit`}function ot(e){return e===`on`||e!==`off`&&null}function st(e){return at(e)?it[e]:void 0}var $=n(),ct={voiceInput:()=>Ce()};function lt({prefKey:e,ui:t}){let n=B(z.admin.setUiPrefDefault),r=B(z.admin.setFeatureEnabled),i=st(e),a=i?ct[e]?.():void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,$.jsx)(`span`,{className:`oc-prefs__gov-label`,children:ue()}),(0,$.jsxs)(Ke,{value:Q(t.defaults[e]),onValueChange:t=>void n({key:e,value:ot(t)}),children:[(0,$.jsx)(We,{size:`sm`,className:`w-36`,children:(0,$.jsx)(Ue,{})}),(0,$.jsxs)(Ge,{children:[(0,$.jsx)(H,{value:`on`,children:l()}),(0,$.jsx)(H,{value:`off`,children:u()}),(0,$.jsx)(H,{value:`inherit`,children:b()})]})]}),i?(0,$.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,$.jsx)(V,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":g()}),g()]}):null]}),a?(0,$.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function ut({current:e,enabled:t}){let n=B(z.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Ze(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,$.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[_e(),e?(0,$.jsx)(G,{variant:`secondary`,children:Je(e,qe())}):null]}),(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:a?je():r?Oe():ve()})]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:Ee()}):null,(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?Re():e?I():ge()})]})]})}function dt(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=P(z.me.getMe,{host:K}),o=i?.ui,s=Z(i?.role)&&n,c=B(z.me.setUiPref).withOptimisticUpdate(Ye),l=(0,q.useMemo)(()=>o?nt(Object.keys(o.effective),e):[],[o,e]);return o?(0,$.jsxs)(`div`,{className:`oc-prefs-panel`,children:[Z(i?.role)?(0,$.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,$.jsx)(V,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":_()}),_()]}):null,s?(0,$.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,$.jsx)(`p`,{children:xe()}),(0,$.jsx)(`p`,{children:a()}),(0,$.jsx)(`p`,{children:fe()})]}):null,(0,$.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:v(),"aria-label":v(),className:`mb-2`}),l.length===0?(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:se()}):(0,$.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,$.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,$.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Y[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],l=o.userOverrides[e]!==void 0;return(0,$.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,$.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,$.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,$.jsx)(G,{variant:`outline`,children:h()}):l?(0,$.jsx)(G,{variant:`secondary`,children:Be()}):null]}),r?(0,$.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,$.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,$.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:d()}):null,(0,$.jsx)(et,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,$.jsx)(lt,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,$.jsx)(ut,{current:i?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,$.jsx)(`div`,{className:`oc-prefs__empty`,children:Te()})}var ft={sm:()=>S(),md:()=>m(),lg:()=>w(),xl:()=>c(),"2xl":()=>He(),"3xl":()=>y()};function pt(){let e=P(z.me.getMe,{host:K}),t=B(z.me.setLocale),n=B(z.me.setTimezone),r=B(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:K});n&&e.setQuery(z.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),a=B(z.me.setMyName),o=Qe(),s=e?.locale??`default`,c=e?.name??``,[l,u]=(0,q.useState)(null),d=l??c,f=d.trim()!==c.trim();async function p(){try{await a({name:d}),u(null),o.success(M())}catch(e){o.error(O(),e)}}return(0,$.jsxs)(`div`,{className:`oc-appearance`,children:[(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:Ie()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:L()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(W,{className:`max-w-xs`,value:d,maxLength:120,placeholder:i(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),p())}}),(0,$.jsx)(U,{size:`sm`,disabled:!f,onClick:()=>void p(),children:Se()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[$e().map(e=>(0,$.jsx)(U,{variant:s===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,$.jsx)(U,{variant:s==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:ye()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:ce()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:ne()})]}),(0,$.jsxs)(`div`,{className:`oc-show__row`,children:[(0,$.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,$.jsx)(U,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:ee()})]}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:oe()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,$.jsx)(`div`,{className:`oc-show__row`,children:Xe.map(t=>(0,$.jsx)(U,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:ft[t]()},t))}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(0,$.jsxs)(`section`,{className:`oc-show__section`,children:[(0,$.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,$.jsx)(`h2`,{className:`oc-show__title`,children:de()}),(0,$.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(0,$.jsx)(dt,{})]})]})}export{pt as PreferencesTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BO as r,CO as i,Ck as a,DO as o,GO as s,HO as c,ID as l,IO as u,Is as d,JO as f,KO as p,LO as m,Ls as h,MO as g,NO as ee,PO as _,QO as v,RO as y,SO as b,TO as x,Tk as te,UO as ne,VO as re,WO as S,XO as ie,YO as ae,ZO as C,_O as oe,bO as se,bQ as w,dT as ce,ek as le,fQ as ue,fk as de,gO as T,gk as fe,hk as pe,ik as me,jO as he,k as E,lQ as D,lk as ge,nk as _e,ok as ve,qO as ye,rk as O,t as k,tk as be,uk as xe,vO as Se,vk as A,wk as Ce,xO as j,yO as we,yQ as M,yk as N,zO as P}from"./api-CWqdeSbN.js";import{n as Te,t as F}from"./useNavigate-D3GIoxyW.js";import{A as Ee,B as I,C as L,D as De,E as R,F as Oe,G as ke,H as Ae,I as z,J as je,K as Me,R as Ne,S as Pe,T as Fe,U as Ie,V as Le,W as Re,_ as ze,a as B,f as V,h as Be,i as Ve,j as He,m as Ue,n as We,o as Ge,p as H,r as Ke,s as U,t as qe,u as Je,w as Ye,x as Xe,y as Ze,z as Qe}from"./useStartNewChat-8wVLrYnZ.js";import{r as $e}from"./dist-CzmY6YrA.js";import{t as et}from"./chevron-right-DMqzlhWH.js";import{c as tt,g as nt,i as rt,n as it,r as W,s as at,t as ot}from"./dropdown-menu-BVKVjups.js";import{n as st,t as ct}from"./eye-LggiM6Z5.js";import{t as lt}from"./list-obbqPBzD.js";import{t as ut}from"./pencil-K7SBkvHL.js";import{t as dt}from"./trash-2-xhtrhYsd.js";import{t as G}from"./button-C_rIPtCv.js";import{t as ft}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as pt}from"./toast-C_YfUacM.js";import{n as mt,r as ht}from"./ConfirmDialog-B7k0wvSi.js";import{t as gt}from"./EntitySheet-DRzkWKlH.js";import{r as _t,t as vt}from"./measureClone-CHN0WNEY.js";import{r as yt,t as bt}from"./trashView-CwUC01r_.js";var xt=E(`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`}]]),St=E(`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`}]]),Ct=E(`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`}]]),K=E(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),q=t(e(),1),J=n();function wt({className:e}){return(0,J.jsx)(tt,{asChild:!0,children:(0,J.jsx)(G,{variant:`ghost`,size:`icon-xs`,"aria-label":i(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,J.jsx)(nt,{})})})}function Tt({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:o}){let s=M(k.projects.renameProject),c=M(k.projects.setProjectColor),l=M(k.projects.moveProject),u=M(k.projects.deleteProject),d=M(k.projects.createProject),f=mt(),p=yt(),m=ht(),[h,g]=(0,q.useState)(!1),[_,v]=(0,q.useState)(t),[y,ne]=(0,q.useState)(!1),[re,S]=(0,q.useState)(!1),ie=w(k.projects.projectTreeCount,re?{projectId:e}:`skip`);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(ot,{onOpenChange:e=>e&&S(!0),children:[(0,J.jsx)(wt,{className:i}),(0,J.jsxs)(it,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,J.jsxs)(W,{onSelect:()=>o(),children:[(0,J.jsx)(Me,{}),` `,ve()]}),(0,J.jsxs)(W,{onSelect:()=>{v(t),g(!0)},children:[(0,J.jsx)(ut,{}),` `,b()]}),(0,J.jsxs)(W,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await m({title:C(),label:te(),placeholder:Ce(),confirmLabel:a()});t&&await d({name:t,parentId:e})})},children:[(0,J.jsx)(ke,{}),` `,C()]}),(0,J.jsxs)(W,{onSelect:()=>ne(!0),children:[(0,J.jsx)(St,{}),` `,ee()]}),(0,J.jsx)(rt,{children:we()}),(0,J.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,J.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void c({projectId:e,color:null}),"aria-label":Se(),children:`✕`}),Ve.map(t=>(0,J.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void c({projectId:e,color:t.value})},t.value))]}),(0,J.jsx)(at,{}),(0,J.jsxs)(W,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=ie?.folders??0,r=ie?.chats??0;await f({title:ge({name:t}),description:bt({folders:n,chats:r,days:p}),confirmWord:x(),confirmLabel:xe(),destructive:!0})&&await u({projectId:e})})},children:[(0,J.jsx)(dt,{}),` `,x()]})]})]}),(0,J.jsx)(gt,{open:h,onOpenChange:g,title:pe(),canSubmit:_.trim().length>0,onSubmit:async()=>{await s({projectId:e,name:_.trim()}),g(!1)},submitLabel:b(),children:(0,J.jsx)(ft,{value:_,onChange:e=>v(e.target.value),autoFocus:!0})}),y?(0,J.jsx)(Ke,{open:y,onOpenChange:ne,title:he(),movingFolderId:e,currentId:r,onPick:t=>void l({projectId:e,parentId:t})}):null]})}function Y({chat:e,currentFolderId:t,className:n}){let r=M(k.chats.pinChat),i=M(k.chats.deleteChat),a=M(k.chats.renameChat),o=M(k.chats.setChatSidebar),s=M(k.chats.moveChatToProject),c=mt(),u=yt(),[d,f]=(0,q.useState)(!1),[p,m]=(0,q.useState)(e.title??``),[h,ee]=(0,q.useState)(!1);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(ot,{children:[(0,J.jsx)(wt,{className:n}),(0,J.jsxs)(it,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,J.jsxs)(W,{onSelect:()=>{m(e.title??``),f(!0)},children:[(0,J.jsx)(ut,{}),` `,b()]}),(0,J.jsxs)(W,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,J.jsx)(Qe,{}):(0,J.jsx)(I,{}),e.pinned?j():se()]}),(0,J.jsxs)(W,{onSelect:()=>ee(!0),children:[(0,J.jsx)(St,{}),` `,_()]}),e.pinned&&e.inSidebar?null:(0,J.jsxs)(W,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,J.jsx)(Le,{}):(0,J.jsx)(K,{}),e.inSidebar?O():me()]}),(0,J.jsx)(at,{}),(0,J.jsxs)(W,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:oe(),description:T({days:u}),confirmLabel:x(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,J.jsx)(dt,{}),` `,x()]})]})]}),(0,J.jsx)(gt,{open:d,onOpenChange:f,title:l(),canSubmit:p.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:p.trim()}),f(!1)},submitLabel:b(),children:(0,J.jsx)(ft,{value:p,onChange:e=>m(e.target.value),autoFocus:!0})}),h?(0,J.jsx)(Ke,{open:h,onOpenChange:ee,title:g(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function Et(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function Dt(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 Ot(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}function kt(e,t){return{available:e,required:[t]}}function At(e){return{labels:e===0,moved:e>=2}}var jt=`oc.projpage.view`;function Mt(){let e=localStorage.getItem(jt);return e===`cards`||e===`list`?e:`columns`}var X=e=>`into:${e}`,Nt=e=>`col:${e??`null`}`,Pt=e=>`crumb:${e}`;function Ft(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 Z(){let{projectId:e}=je({from:`/project/$projectId`}),t=F(),n=w(k.projects.projectPage,{projectId:e});return(0,J.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,J.jsx)(`p`,{className:`oc-projpage__hint`,children:D()}):n===null?(0,J.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,J.jsx)(`h2`,{children:P()}),(0,J.jsx)(`p`,{className:`oc-projpage__hint`,children:y()}),(0,J.jsx)(G,{variant:`outline`,onClick:()=>void t({to:`/`}),children:m()})]}):(0,J.jsx)(It,{page:n})})}function It({page:e}){let t=F(),n=mt(),i=yt(),s=ht(),l=pt(),m=M(k.projects.renameProject),g=M(k.projects.setProjectColor),_=M(k.projects.deleteProject),y=M(k.projects.createProject),S=M(k.projects.moveProject),ie=M(k.projects.setProjectSidebar),ae=M(k.chats.moveChatToProject),oe=M(k.chats.reorderChat),se=M(k.projects.reorderProject),de=w(k.projects.projectTreeCount,{projectId:e.project._id}),[T,me]=(0,q.useState)(Mt),E=(0,q.useRef)(null),D=(0,q.useRef)(null),ve=At(_t(()=>{let e=E.current,t=D.current;if(e===null||t===null)return null;let n=vt(t,[e=>{e.setAttribute(`data-labels`,`on`),e.setAttribute(`data-moved`,`off`)},e=>{e.setAttribute(`data-labels`,`off`),e.setAttribute(`data-moved`,`off`)}],`oc-projpage__actions--measure`);return{available:e.clientWidth,required:n}},()=>[E.current],[ue(),e.project.sidebarHidden],{hysteresis:24})),O=ve.moved,A=e=>{localStorage.setItem(jt,e),me(e)},j=w(k.projects.folderColumns,T===`columns`?{projectId:e.project._id}:`skip`),P=w(k.projects.projectTreeList,T===`list`?{projectId:e.project._id}:`skip`),{c:I}=Te({from:`/project/$projectId`}),L=w(k.projects.listProjects,{}),R=w(k.chatReads.myBusyChats,{}),z=(0,q.useMemo)(()=>new Set(R??[]),[R]),{byChat:je}=Ne(R??null),Me=w(k.chatReads.myChatReads,{}),Le=(0,q.useMemo)(()=>Ot(e.chats,Me??[]),[e.chats,Me]),B=(0,q.useRef)(null),V=()=>[B.current],{startNewChat:We,picker:Qe}=qe(e=>void t({to:`/chat/$chatId`,params:{chatId:e}}),V),$e=()=>void We({projectId:e.project._id}),et=async()=>{let t=await s({title:C(),label:te(),placeholder:Ce(),confirmLabel:a(),returnFocus:V});t&&await y({name:t,parentId:e.project._id})},[K,wt]=(0,q.useState)(``),[Tt,Y]=(0,q.useState)(!1),[kt,X]=(0,q.useState)(e.project.name),[Nt,Pt]=(0,q.useState)(!1),[Z,It]=(0,q.useState)(``);(0,q.useEffect)(()=>{let e=setTimeout(()=>It(K.trim()),180);return()=>clearTimeout(e)},[K]);let Q=w(k.search.searchConversations,Z.length>=2?{query:Z,projectId:e.project._id}:`skip`),Bt=Fe(Ye(ze,{activationConstraint:{distance:4}}),Ye(Ze,{activationConstraint:{delay:250,tolerance:8}})),$=(0,q.useRef)(!1),Ht=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Wt,Gt]=(0,q.useState)(null),Kt=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=j?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||N()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(L??[]).find(t=>t._id===e)?.name??``}}return null},qt=e=>Gt(Kt(String(e.active.id))),Jt=(0,q.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=Pe(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=Pe(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=Pe(n(`crumb:`));if(a.length>0)return a;let o=Pe(n(`col:`));return o.length>0?o:Xe(n(t?`folder:`:`chat:`))},[]),Yt=t=>{if(T===`columns`){for(let e of j?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(T===`list`){let e=P?.chats.find(e=>e._id===t);return e?{list:P.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},Xt=t=>{if(T===`columns`){for(let e of j?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(T===`list`){let e=P?.folders.find(e=>e._id===t);if(!e||!P)return null;let n=e.parentId??P.rootId;return{list:He(P.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},Zt=async e=>{Gt(null),Ht();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=Ft(r);if(e!==void 0){if(a){let t=i.slice(5);await ae({chatId:t,projectId:e})}else{let t=i.slice(7);if(t===e)return;if(!Ee(L??[],t,e)){l.error(v());return}await S({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=Yt(t);if(!n)return;n.list.some(t=>t._id===e)||await ae({chatId:e,projectId:n.folderId});let a=Dt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await oe({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Xt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Ee(L??[],e,n.parentId)){l.error(v());return}await S({projectId:e,parentId:n.parentId})}let a=Dt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await se({projectId:e,...a});return}}catch{l.error(v())}},[,Qt]=(0,q.useState)(0);(0,q.useEffect)(()=>{let e=window.setInterval(()=>Qt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let $t=Date.now(),en=Ge(e.project),tn=Et(e.chats,K),nn=e.breadcrumb.slice(0,-1),rn=e=>()=>{$.current||e()};return(0,J.jsx)(Oe.Provider,{value:je,children:(0,J.jsxs)(Ue,{sensors:Bt,collisionDetection:Jt,onDragStart:qt,onDragEnd:Zt,children:[(0,J.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":en},children:[(0,J.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":u(),children:[nn.map(e=>(0,J.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,J.jsx)(Lt,{folderId:e._id,children:(0,J.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:rn(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,J.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,J.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,J.jsxs)(`header`,{ref:E,className:`oc-projpage__head`,children:[(0,J.jsxs)(`div`,{className:`oc-projpage__titlebox`,children:[(0,J.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,J.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name})]}),e.project.sidebarHidden?(0,J.jsxs)(G,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:h(),onClick:()=>{ie({projectId:e.project._id,hidden:!1})},children:[(0,J.jsx)(st,{"aria-hidden":!0}),(0,J.jsx)(`span`,{children:d()}),(0,J.jsx)(ct,{"aria-hidden":!0})]}):null,(0,J.jsxs)(`div`,{ref:D,className:`oc-projpage__actions`,"data-labels":ve.labels?`on`:`off`,"data-moved":O?`on`:`off`,children:[(0,J.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":_e(),children:[(0,J.jsx)(G,{variant:T===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":_e(),title:_e(),"aria-pressed":T===`cards`,onClick:()=>A(`cards`),children:(0,J.jsx)(Ct,{})}),(0,J.jsx)(G,{variant:T===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":be(),title:be(),"aria-pressed":T===`columns`,onClick:()=>A(`columns`),children:(0,J.jsx)(xt,{})}),(0,J.jsx)(G,{variant:T===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":le(),title:le(),"aria-pressed":T===`list`,onClick:()=>A(`list`),children:(0,J.jsx)(lt,{})})]}),(0,J.jsxs)(G,{variant:`outline`,size:`sm`,className:`oc-projpage__actbtn`,"aria-label":p(),title:p(),onClick:$e,children:[(0,J.jsx)(Ie,{}),(0,J.jsx)(`span`,{className:`oc-projpage__actlabel`,children:p()})]}),(0,J.jsxs)(G,{variant:`outline`,size:`sm`,className:`oc-projpage__actbtn`,"aria-label":C(),title:C(),onClick:()=>void et(),children:[(0,J.jsx)(ke,{}),(0,J.jsx)(`span`,{className:`oc-projpage__actlabel`,children:C()})]}),(0,J.jsxs)(ot,{children:[(0,J.jsx)(tt,{asChild:!0,children:(0,J.jsx)(G,{ref:B,variant:`ghost`,size:`icon-sm`,"aria-label":fe(),children:(0,J.jsx)(nt,{})})}),(0,J.jsxs)(it,{align:`end`,className:`w-48`,children:[O?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(W,{onSelect:$e,children:[(0,J.jsx)(Ie,{}),` `,p()]}),(0,J.jsxs)(W,{onSelect:()=>void et(),children:[(0,J.jsx)(ke,{}),` `,C()]}),(0,J.jsx)(at,{})]}):null,(0,J.jsxs)(W,{onSelect:()=>{X(e.project.name),Y(!0)},children:[(0,J.jsx)(ut,{}),` `,b()]}),(0,J.jsxs)(W,{onSelect:()=>Pt(!0),children:[(0,J.jsx)(St,{}),` `,ee()]}),(0,J.jsx)(rt,{children:we()}),(0,J.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,J.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void g({projectId:e.project._id,color:null}),"aria-label":Se(),children:`✕`}),Ve.map(t=>(0,J.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void g({projectId:e.project._id,color:t.value})},t.value))]}),(0,J.jsx)(at,{}),(0,J.jsxs)(W,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let a=de?.folders??0,o=de?.chats??0;await n({title:ge({name:e.project.name}),description:bt({folders:a,chats:o,days:i}),confirmWord:x(),confirmLabel:xe(),destructive:!0})&&(await _({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,J.jsx)(dt,{}),` `,x()]})]})]})]})]}),T===`columns`?(0,J.jsx)(Ut,{data:j,currentId:e.project._id,busyIds:z,suppressClick:$,locateChatId:I??null}):T===`list`?(0,J.jsx)(Vt,{data:P,busyIds:z,suppressClick:$,locateChatId:I??null}):(0,J.jsxs)(J.Fragment,{children:[e.children.length>0?(0,J.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,J.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:f()}),(0,J.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,J.jsx)(U,{items:e.children.map(e=>`folder:${e._id}`),strategy:Je,children:e.children.map(t=>(0,J.jsx)(Rt,{child:t,parentId:e.project._id,now:$t,suppressClick:$},t._id))})})]}):null,(0,J.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,J.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,J.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ye()}),e.chats.length>0?(0,J.jsx)(ft,{value:K,onChange:e=>wt(e.target.value),placeholder:ne(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,J.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?re():r()}):tn.length===0&&(Q??[]).length===0?(0,J.jsx)(`p`,{className:`oc-projpage__hint`,children:c({term:K.trim()})}):(0,J.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,J.jsx)(U,{items:tn.map(e=>`chat:${e._id}`),strategy:H,children:tn.map(t=>(0,J.jsx)(zt,{chat:t,currentFolderId:e.project._id,now:$t,busy:z.has(t._id),unread:Le.has(t._id),locate:t._id===I,suppressClick:$},t._id))})})]}),Z.length>=2&&Q!==void 0?(0,J.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,J.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:o()}),Q.length===0?(0,J.jsx)(`p`,{className:`oc-projpage__hint`,children:c({term:Z})}):(0,J.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,J.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Z&&De(e.messageId,Z),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,J.jsx)(Ae,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,J.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,J.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||ce()}),e.projectPath&&e.projectPath.length>1?(0,J.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,J.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,J.jsx)(gt,{open:Tt,onOpenChange:Y,title:pe(),canSubmit:kt.trim().length>0,onSubmit:async()=>{await m({projectId:e.project._id,name:kt.trim()}),Y(!1)},submitLabel:b(),children:(0,J.jsx)(ft,{value:kt,onChange:e=>X(e.target.value),autoFocus:!0})}),Nt?(0,J.jsx)(Ke,{open:Nt,onOpenChange:Pt,title:he(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void S({projectId:e.project._id,parentId:t})}):null,Qe]}),(0,J.jsx)(Be,{children:Wt?(0,J.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Wt.kind===`folder`?(0,J.jsx)(Re,{size:13,"aria-hidden":!0}):(0,J.jsx)(Ae,{size:13,"aria-hidden":!0}),(0,J.jsx)(`span`,{children:Wt.label})]}):null})]})})}function Lt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=L({id:Pt(e)});return(0,J.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Rt({child:e,parentId:t,now:n,suppressClick:r}){let i=F(),a=V({id:`folder:${e._id}`}),o=L({id:X(e._id)});return(0,J.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card oc-reveal-host`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":Ge(e),transform:R.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,J.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,J.jsx)(Re,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,J.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,J.jsx)(Tt,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu oc-reveal oc-hit`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,J.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?s({count:e.folderCount})+` · `:``,S({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,J.jsx)(`span`,{className:`oc-projpage__cardage`,children:We(e.lastActivityAt,n)})]})}function Q({chat:e}){let t=M(k.chats.setChatSidebar),n=e.inSidebar?O():me();return(0,J.jsx)(G,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn oc-hit`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,J.jsx)(Le,{}):(0,J.jsx)(K,{})})}function zt({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=(0,q.useContext)(Oe).get(e._id),c=F(),l=B(e.color),u=V({id:`chat:${e._id}`}),d=Bt(a);return(0,J.jsxs)(`li`,{ref:e=>{u.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow oc-reveal-host`+(u.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:R.Transform.toString(u.transform),transition:u.transition},children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||c({to:`/chat/$chatId`,params:{chatId:e._id}})},...u.listeners,...u.attributes,children:[l?(0,J.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,J.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,J.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||N()}),e.pinned?(0,J.jsx)(I,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,J.jsx)(`span`,{className:`oc-projpage__chatage`,children:We(e.updatedAt,n)}),r?(0,J.jsx)(`span`,{className:z(s,A()).className,title:z(s,A()).label,"aria-label":z(s,A()).label}):null,i&&!r?(0,J.jsx)(`span`,{className:`oc-chatitem__unread`,title:de(),"aria-label":de()}):null]}),(0,J.jsx)(Q,{chat:e}),(0,J.jsx)(Y,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu oc-reveal oc-hit`})]})}function Bt(e){let t=(0,q.useRef)(null);return(0,q.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Vt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,q.useState)(new Set),o=(0,q.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,J.jsx)(`p`,{className:`oc-projpage__hint`,children:D()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=He(e.folders,a);return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{items:u.map(e=>`chat:${e._id}`),strategy:H,children:u.map(e=>(0,J.jsx)(Ht,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,J.jsx)(U,{items:d.map(e=>`folder:${e._id}`),strategy:H,children:d.map(t=>(0,J.jsx)($,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,J.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&He(e.folders,null).length===0?(0,J.jsx)(`p`,{className:`oc-projpage__hint`,children:re()}):c(null,0)})}function $({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=F(),c=V({id:`folder:${e._id}`}),l=L({id:X(e._id)});return(0,J.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,J.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder oc-reveal-host`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":Ge(e),transform:R.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,J.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?ie():ae(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,J.jsx)(et,{size:13}):(0,J.jsx)($e,{size:13})}),(0,J.jsx)(Re,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,J.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,J.jsx)(Tt,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu oc-reveal oc-hit`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Ht({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=(0,q.useContext)(Oe).get(e._id),o=F(),s=V({id:`chat:${e._id}`}),c=Bt(r),l=B(e.color);return(0,J.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat oc-reveal-host`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:R.Transform.toString(s.transform),transition:s.transition},children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||o({to:`/chat/$chatId`,params:{chatId:e._id}})},...s.listeners,...s.attributes,children:[l?(0,J.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,J.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,J.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||N()}),n?(0,J.jsx)(`span`,{className:z(a,``).className,"aria-hidden":!0}):null]}),(0,J.jsx)(Y,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu oc-reveal oc-hit`}),(0,J.jsx)(Q,{chat:e})]})}function Ut({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,q.useRef)(null);(0,q.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]);let o=(0,q.useRef)(null),s=(0,q.useRef)(null),c=_t(()=>{let e=o.current,t=s.current;return e===null||t===null?null:kt(e.clientWidth,t.getBoundingClientRect().width)},()=>[o.current],[e===void 0],{hysteresis:24})>0;if(e===void 0)return(0,J.jsx)(`p`,{className:`oc-projpage__hint`,children:D()});let l=c?e.columns.slice(-1):e.columns;return(0,J.jsxs)(`div`,{ref:o,className:`oc-projpage__colswrap`,children:[(0,J.jsxs)(`div`,{ref:s,className:`oc-projpage__colprobes`,"aria-hidden":!0,children:[(0,J.jsx)(`div`,{className:`oc-projpage__col`}),(0,J.jsx)(`div`,{className:`oc-projpage__col is-last`})]}),(0,J.jsx)(`div`,{className:`oc-projpage__cols`+(c?` oc-projpage__cols--one`:``),"data-layout":c?`one-level`:`columns`,ref:a,children:l.map(a=>(0,J.jsx)(Wt,{col:a,isLast:a===e.columns[e.columns.length-1],currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})]})}function Wt({col:e,isLast:t,currentId:n,busyIds:i,suppressClick:a,locateChatId:o}){let s=F(),c=L({id:Nt(e.folderId)});return(0,J.jsxs)(`div`,{ref:c.setNodeRef,className:`oc-projpage__col`+(c.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,J.jsx)(U,{items:e.folders.map(e=>`folder:${e._id}`),strategy:H,children:e.folders.map(t=>(0,J.jsx)(Gt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:a,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,J.jsx)(U,{items:e.chats.map(e=>`chat:${e._id}`),strategy:H,children:e.chats.map(t=>(0,J.jsx)(Kt,{chat:t,folderId:e.folderId,busy:i.has(t._id),locate:t._id===o,suppressClick:a,onOpen:()=>void s({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,J.jsx)(`p`,{className:`oc-projpage__colempty`,children:r()}):null]})}function Gt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=V({id:`folder:${e._id}`}),o=L({id:X(e._id)});return(0,J.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder oc-reveal-host`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":Ge(e),transform:R.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,J.jsx)(Re,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,J.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,J.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,J.jsx)(Tt,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu oc-reveal oc-hit`,onOpen:i})]})}function Kt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=(0,q.useContext)(Oe).get(e._id),s=V({id:`chat:${e._id}`}),c=Bt(r),l=B(e.color);return(0,J.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat oc-reveal-host`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:R.Transform.toString(s.transform),transition:s.transition},children:[(0,J.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...s.listeners,...s.attributes,children:[l?(0,J.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,J.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,J.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||N()}),n?(0,J.jsx)(`span`,{className:z(o,``).className,"aria-hidden":!0}):null]}),(0,J.jsx)(Y,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat oc-reveal oc-hit`}),(0,J.jsx)(Q,{chat:e})]})}export{Z as ProjectPage};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Aj as i,Ap as a,Cd as o,Cj as s,Dj as c,Ej as l,Fj as u,Hj as d,Mh as f,Mj as p,Mp as m,Nh as h,Nj as g,Ns as _,Oj as ee,Pj as te,Sd as v,Sj as y,Tj as b,Uj as x,_j as S,ap as C,bQ as w,bj as ne,cp as re,gj as ie,jh as ae,jj as oe,jp as se,kh as ce,kj as T,kp as E,lp as D,op as O,sp as k,t as A,vj as j,wd as M,wj as N,xj as P,yQ as F,yj as I}from"./api-CWqdeSbN.js";import{i as L,n as R,r as z,t as B}from"./FieldLabel-imj_Z0rZ.js";import{t as V}from"./checkbox-DPxJTQjc.js";import{c as H,d as U,l as le,u as W}from"./tooltip-Ct0TGxtk.js";import{a as G,i as K,n as q,r as J,t as Y}from"./select-CjcMQhwm.js";import{t as X}from"./button-C_rIPtCv.js";import{r as ue}from"./toast-C_YfUacM.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:i,help:T},documentary_fetch:{label:ee,help:c},inbound_files:{label:l,help:b},history_summary:{label:h,help:f},file_curation:{label:m,help:D},quote_reply:{label:se,help:a}},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:j,references:S,files:ie,previous_summary:ae,new_messages:r,max_chars:ce,file_name:re,budget_chars:k,feedback:O,content:C,excerpt:E};function _e(){let e=w(A.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:s()})});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:u(),help:te()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:N()}),(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=F(A.admin.upsertInstanceConfig),n=ue(),r=w(A.me.getMe,{host:de}),i=e.config??{},a=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[s,c]=(0,Q.useState)(()=>L(i,a));(0,Q.useEffect)(()=>{c(L(i,a))},[a,e._id]);let[l,u]=(0,Q.useState)(!1),f=s.promptInjections,p=(e,t)=>c({...s,promptInjections:{...f,[e]:{...f[e],...t}}});async function m(){u(!0);try{await t({instanceId:e._id,config:z(s,i,a)})}catch(e){n.error(d(),e)}finally{u(!1)}}async function h(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(d(),e)}}let g=e.config?.contentLocale??`default`,_=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:M()}),(0,$.jsxs)(Y,{value:g,onValueChange:e=>void h(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:v({locale:_})}),pe().map(e=>(0,$.jsx)(J,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:o()})]}),le.map(e=>(0,$.jsx)(ye,{injKey:e,def:H[e],i18n:me[e],row:f[e]??{enabled:!0,template:H[e].defaultTemplate[a]},contentLocale:a,onChange:t=>p(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(X,{size:`sm`,onClick:()=>void m(),disabled:l,children:x()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),d=W(e,r,i),f=d?U(d,u):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(V,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(R,{label:n.label(),help:n.help()})]}):(0,$.jsx)(R,{label:n.label(),help:n.help()}),c&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:p()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:oe()}),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:()=>s(e=>!e),children:o?P():y()}),c&&(0,$.jsx)(X,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:g()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:f}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:ne()}),t.pluralDefaultTemplate!==void 0&&!l?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:_()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:I()})})]})}export{_e as PromptInjectionsTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$P as r,AF as i,BF as a,CF as o,DF as s,EF as c,FF as l,IF as u,LF as d,MF as f,NF as p,OF as m,PF as h,QP as g,RF as _,SF as v,TF as ee,XP as y,ZP as b,_F as x,bF as te,bQ as ne,dF as re,eF as ie,fF as ae,gF as oe,hF as S,iF as C,jF as w,kF as T,mF as E,nF as D,nm as O,pF as k,rF as A,t as j,tF as M,uF as N,vF as P,wF as F,xF as I,yF as L,yQ as R,zF as z}from"./api-CWqdeSbN.js";import{t as B}from"./lock-BlVhOk85.js";import{t as V}from"./checkbox-DPxJTQjc.js";import{t as H}from"./button-C_rIPtCv.js";import{t as U}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as W}from"./toast-C_YfUacM.js";import{t as G}from"./badge-ChMMFtuW.js";import{n as K}from"./ConfirmDialog-B7k0wvSi.js";import{t as q}from"./EntitySheet-DRzkWKlH.js";import{t as J}from"./roleDescriptions-DHny6e80.js";var Y=t(e(),1),X=n(),Z=[{group:()=>a(),keys:[{key:`traces.read`,label:()=>l()},{key:`traces.read.content`,label:()=>h(),phi:!0},{key:`traces.write`,label:()=>p()}]},{group:()=>z(),keys:[{key:`kpi.read`,label:()=>l()},{key:`kpi.write`,label:()=>p()}]},{group:()=>_(),keys:[{key:`openclaw.query`,label:()=>f()},{key:`anomalies.read`,label:()=>w()},{key:`anomalies.report`,label:()=>i()}]},{group:()=>d(),keys:[{key:`chats.read`,label:()=>l()},{key:`selfheal`,label:()=>m()},{key:`media.repair`,label:()=>s()},{key:`feedback.respond`,label:()=>O()}]},{group:()=>u(),keys:[{key:`admin.manage`,label:()=>T()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=ne(j.apiKeys.listRoles,{}),t=R(j.apiKeys.createRole),n=R(j.apiKeys.ensureRolesSeeded),i=R(j.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(j.apiKeys.listRoles,{});r&&e.setQuery(j.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),a=K(),s=W(),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)($),[p,m]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{s.error(ee(),e)})},[n,s]);let h=e??[];async function _(e,t){if(Q(e.permissions))return;if(e.builtin){await a({title:F({name:e.name}),description:o(),confirmLabel:v()});return}if(p.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];m(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){s.error(I(),e)}finally{m(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function w(){try{await t({key:d.key,name:d.name,description:d.description||void 0,permissions:[]}),f($),u(!1)}catch(e){s.error(te(),e)}}let T=e===void 0,O=!T&&h.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`}),` `,P(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,x()]}),(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:oe()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(H,{size:`sm`,onClick:()=>{f($),u(!0)},children:S()})})]}),T?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:E()}):O?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(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:ae()}),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?c({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:h.map(e=>{let t=Q(e.permissions),n=p.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,{}),` `,re()]}):(0,X.jsx)(G,{variant:`secondary`,children:N()})]}),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?C():n?A():r,onCheckedChange:()=>void _(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(q,{open:l,onOpenChange:u,title:D(),description:M(),canSubmit:!!(d.key&&d.name),onSubmit:w,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:r()}),(0,X.jsx)(U,{value:d.key,placeholder:g(),onChange:e=>f({...d,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,X.jsx)(U,{value:d.name,onChange:e=>f({...d,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:y()}),(0,X.jsx)(U,{value:d.description,onChange:e=>f({...d,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{$J as r,$Y as i,AY as a,BX as o,BY as s,CY as c,DY as l,EY as u,FX as d,GJ as f,GX as p,GY as m,HX as h,HY as g,IX as _,JJ as ee,KJ as te,KX as ne,KY as re,LJ as v,LX as y,MX as ie,MY as ae,NX as oe,NY as b,OY as se,PX as ce,QJ as le,QY as ue,RX as de,RY as fe,SY as x,TY as pe,UJ as me,UX as he,UY as ge,VX as _e,VY as ve,WJ as ye,WX as be,WY as xe,XJ as Se,YJ as Ce,YY as we,ZJ as Te,_Q as S,_Y as Ee,aX as De,aY as Oe,bQ as ke,bY as Ae,cX as je,dX as Me,eX as Ne,eY as Pe,fQ as C,fX as Fe,gY as Ie,iX as Le,iY as Re,jY as ze,k as w,kY as Be,lQ as Ve,lX as He,nX as Ue,nY as We,oX as T,oY as Ge,pX as Ke,qJ as qe,qX as Je,qY as Ye,rX as Xe,rY as Ze,t as E,tX as Qe,tY as $e,uX as et,vY as D,wY as tt,xY as nt,yY as rt,zX as it,zY as at}from"./api-CWqdeSbN.js";import{t as O}from"./chevron-left-ByEQraEh.js";import{t as k}from"./chevron-right-DMqzlhWH.js";import{t as ot}from"./list-obbqPBzD.js";import{t as st}from"./loader-circle-BqKiW3X9.js";import{a as ct,i as lt,n as ut,r as dt,t as ft}from"./cronDescribe-CkiSvbCK.js";import{t as pt}from"./pencil-K7SBkvHL.js";import{t as mt}from"./rotate-ccw-CvefWwHW.js";import{t as ht}from"./trash-2-xhtrhYsd.js";import{a as A,i as j,n as M,r as N,t as P}from"./select-CjcMQhwm.js";import{a as gt,c as _t,i as vt,n as yt,o as bt,r as xt,s as St,t as Ct}from"./alert-dialog-BcJMHbhI.js";import{n as F,r as I,t as wt}from"./popover-C-Y_Yoco.js";import{t as L}from"./button-C_rIPtCv.js";import{t as Tt}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as Et}from"./toast-C_YfUacM.js";import{t as R}from"./badge-ChMMFtuW.js";import{a as Dt,i as Ot,n as kt,o as At,r as jt,t as Mt}from"./dialog-CPAskUwF.js";import{t as Nt}from"./appHost-CH3EGcJw.js";import{r as Pt}from"./measureClone-CHN0WNEY.js";import{a as Ft,i as z,n as It,o as Lt,r as B,t as Rt}from"./table-rRR3TpMc.js";import{t as zt}from"./FilterBar-DCCuFxDn.js";/* empty css */import{t as Bt}from"./useTableLayout-Cmwnuzxb.js";import{a as Vt,c as V,i as H,l as U,n as Ht,o as Ut,r as Wt,s as W,t as Gt,u as Kt}from"./TimezoneCombobox-CeRN4N3z.js";var qt=w(`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=w(`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`}]]),G=t(e(),1),K=n();function Yt(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Xt({value:e,onChange:t}){let n=U(e),r=(0,G.useMemo)(()=>new Date,[]),[i,o]=(0,G.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[s,c]=(0,G.useState)(!1),l=(0,G.useMemo)(()=>Yt(C()),[]),u=(0,G.useMemo)(()=>new Intl.DateTimeFormat(C(),{month:`long`,year:`numeric`}),[]),d=(0,G.useMemo)(()=>new Intl.DateTimeFormat(C(),{dateStyle:`medium`,timeStyle:`short`}),[]),f=V(i.year,i.month),p=n?.hour??9,m=n?.minute??0,h=(e,n,r,i,a)=>t(Kt(e,n,r,i,a)),g=(e,t,n)=>{o({year:e,month:t}),h(e,t,n,p,m)},_=e=>{let t=new Date(i.year,i.month+e,1);o({year:t.getFullYear(),month:t.getMonth()})},ee=n===null?ae():d.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,K.jsxs)(wt,{modal:!0,open:s,onOpenChange:c,children:[(0,K.jsx)(I,{asChild:!0,children:(0,K.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":b(),children:[(0,K.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,K.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ee})]})}),(0,K.jsxs)(F,{align:`start`,className:`oc-dtp__pop`,children:[(0,K.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,K.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ze(),onClick:()=>_(-1),children:(0,K.jsx)(O,{size:15,"aria-hidden":!0})}),(0,K.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(i.year,i.month,1))}),(0,K.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":a(),onClick:()=>_(1),children:(0,K.jsx)(k,{size:15,"aria-hidden":!0})})]}),(0,K.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,K.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),f.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,K.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:()=>g(e.year,e.month,e.day),children:e.day},t)})]}),(0,K.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,K.jsxs)(P,{value:String(p),onValueChange:e=>h(i.year,i.month,n?.day??r.getDate(),Number(e),m),children:[(0,K.jsx)(j,{size:`sm`,"aria-label":Be(),children:(0,K.jsx)(A,{})}),(0,K.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,K.jsx)(N,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,K.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,K.jsxs)(P,{value:String(m),onValueChange:e=>h(i.year,i.month,n?.day??r.getDate(),p,Number(e)),children:[(0,K.jsx)(j,{size:`sm`,"aria-label":se(),children:(0,K.jsx)(A,{})}),(0,K.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,K.jsx)(N,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function Zt(e,t){return{available:e,required:[14*t]}}function Qt(e,t){return e.length===0?null:t===null?e[0]:e.find(e=>e>=t)??e[e.length-1]}function q(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function $t(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function en(e){let t=new Map;for(let n of e){let e=q(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 tn(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get($t(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function nn(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 rn(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 an(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var J=3;function on({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=C(),l=(0,G.useMemo)(()=>en(e),[e]),u=(0,G.useMemo)(()=>nn(s),[s]),d=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),f=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),p=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),m=(0,G.useMemo)(()=>new Intl.DateTimeFormat(s,{weekday:`long`,day:`numeric`,month:`long`}),[s]),h=new Date,g=(0,G.useRef)(null),_=(0,G.useRef)(null),ee=(0,G.useRef)(null),[te,ne]=(0,G.useState)(0),re=Pt(()=>{let e=g.current,t=_.current;return e===null||t===null?null:Zt(e.clientWidth,t.getBoundingClientRect().width)},()=>[g.current],[s],{hysteresis:24}),v=t??(re===0?`month`:`agenda`),y=e=>{if(v===`year`){i({year:n.year+e,month:n.month});return}let t=new Date(n.year,n.month+e,1);i({year:t.getFullYear(),month:t.getMonth()})},ie=v===`year`?String(n.year):d.format(new Date(n.year,n.month,1));return(0,K.jsxs)(`div`,{ref:g,className:`oc-cal`,"data-mode":v,children:[(0,K.jsxs)(`span`,{ref:_,className:`oc-cal__event oc-cal__chipmeasure`,"aria-hidden":!0,children:[(0,K.jsx)(`span`,{className:`oc-cal__evdot`}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:p.format(new Date(2e3,0,1,23,59))})]}),(0,K.jsxs)(`div`,{ref:ee,className:`oc-cal__head`,children:[(0,K.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,"aria-label":rt(),onClick:()=>y(-1),children:(0,K.jsx)(O,{})}),(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,"aria-label":D(),onClick:()=>y(1),children:(0,K.jsx)(k,{})}),(0,K.jsx)(L,{variant:`ghost`,size:`sm`,onClick:()=>{i({year:h.getFullYear(),month:h.getMonth()}),ne(e=>e+1)},children:Ae()})]}),(0,K.jsx)(`span`,{className:`oc-cal__title`,children:ie}),(0,K.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,K.jsx)(L,{variant:v===`agenda`?`secondary`:`ghost`,size:`sm`,"aria-pressed":v===`agenda`,onClick:()=>r(`agenda`),children:x()}),(0,K.jsx)(L,{variant:v===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":v===`month`,onClick:()=>r(`month`),children:tt()}),(0,K.jsx)(L,{variant:v===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":v===`year`,onClick:()=>r(`year`),children:c()})]})]}),v===`agenda`?(0,K.jsx)(ln,{cursor:n,byDay:l,dayFmt:m,timeFmt:p,now:h,onEventClick:a,anchorKey:`${n.year}-${n.month}-${te}`,headRef:ee}):v===`month`?(0,K.jsx)(un,{cursor:n,byDay:l,weekdays:u,timeFmt:p,now:h,onEventClick:a}):(0,K.jsx)(dn,{year:n.year,byDay:l,monthShortFmt:f,now:h,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,K.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function sn(e){return`cal-event:${e}`}function cn(e=document){let t=e.querySelector(`.oc-cal`);return t===null?[]:[t.querySelector(`.oc-cal__modes [aria-pressed="true"]`)??t.querySelector(`.oc-cal__head button`)]}function Y(e,t){let n=e.parentElement;for(;n!==null;){let e=getComputedStyle(n).overflowY;if((e===`auto`||e===`scroll`)&&n.scrollHeight>n.clientHeight)break;n=n.parentElement}if(n===null)return;let r=n.getBoundingClientRect().top+n.clientTop,i=t?.getBoundingClientRect().height??0;n.scrollTop+=Math.floor(e.getBoundingClientRect().top-r-i)}function ln({cursor:e,byDay:t,dayFmt:n,timeFmt:r,now:i,onEventClick:a,anchorKey:o,headRef:s}){let c=V(e.year,e.month).filter(e=>e.inMonth).map(e=>({c:e,list:t.get($t(e.year,e.month,e.day))??[]})).filter(({list:e})=>e.length>0),l=i.getFullYear()===e.year&&i.getMonth()===e.month?i.getDate():null,u=Qt(c.map(({c:e})=>e.day),l),d=(0,G.useRef)(null),f=(0,G.useRef)(null),p=c.length>0?c[0].c.day:null;return(0,G.useLayoutEffect)(()=>{if(u===null||f.current===o)return;f.current=o;let e=d.current?.querySelector(`[data-day="${u}"]`),t=s.current;e&&(u===p&&t!==null&&e.getBoundingClientRect().top>=t.getBoundingClientRect().bottom||Y(e,t))},[o,u,p,s]),c.length===0?(0,K.jsx)(`p`,{className:`oc-cal__agendaempty`,children:nt()}):(0,K.jsx)(`div`,{ref:d,className:`oc-cal__agenda`,children:c.map(({c:e,list:t})=>{let o=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,K.jsxs)(`section`,{className:`oc-cal__agendaday`,"data-day":e.day,children:[(0,K.jsx)(`h4`,{className:`oc-cal__agendadate`+(o?` oc-cal__agendadate--today`:``),children:n.format(new Date(e.year,e.month,e.day))}),t.map(e=>{let t=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,K.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]}),n=`oc-cal__agendaitem`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),i=e.color?{"--cal-ev":e.color}:void 0;return a?(0,K.jsx)(L,{type:`button`,variant:`ghost`,"data-focus-key":sn(e.id),className:`${n} h-auto min-h-11 w-full justify-start font-normal`,style:i,onClick:()=>a(e),children:t},e.id):(0,K.jsx)(`div`,{className:n,style:i,children:t},e.id)})]},e.day)})})}function un({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=V(e.year,e.month);return(0,K.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,K.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get($t(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,K.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,K.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,J).map(e=>(0,K.jsxs)(`button`,{type:`button`,"data-focus-key":sn(e.id),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,K.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,K.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,K.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>J?(0,K.jsx)(`span`,{className:`oc-cal__more`,children:Ee({count:o.length-J})}):null]},n)})]})}function dn({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,K.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=tn(t,e,o),c=V(e,o);return(0,K.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,K.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,K.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,K.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var fn={h:36e5,min:6e4,s:1e3,ms:1};function pn(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])*fn[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 X(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 Z(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=X(t[0],0,59),r=X(t[1],0,23),i=X(t[2],1,31),a=X(t[3],1,12),o=X(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var Q=new Map;function mn(e){let t=Q.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return Q.set(e,n),n}function hn(e,t){if(t!==null){let n=mn(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 gn(e,t,n,r,i,a){if(a===null||mn(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=hn(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 _n(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=Z(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=hn(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=gn(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=gn(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 vn=`crons`;function yn(e,t){return`${e}\u0000${t}`}function bn(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=yn(a.instanceName,e.id);i.set(o,a);let s=Ut(e)!==`active`,c=_n(s?null:pn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:vn,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 xn(e){return e?.data?.code??`unknown`}function Sn({status:e}){switch(W(e)){case`ok`:return(0,K.jsx)(R,{variant:`secondary`,children:re()});case`error`:return(0,K.jsx)(R,{variant:`destructive`,children:xe()});case`running`:return(0,K.jsx)(R,{variant:`outline`,children:ge()});case`other`:return(0,K.jsx)(R,{variant:`outline`,children:e});case`none`:return(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function Cn(){let e=S(E.scheduled.listMyCrons),t=S(E.scheduled.getCronDetail),n=S(E.scheduled.listCronRuns),a=S(E.scheduled.updateCron),c=S(E.scheduled.removeCron),ae=S(E.scheduled.runCronNow),b=Et(),se=ke(E.me.getMe,{host:Nt})?.timezone,[x,Ee]=(0,G.useState)(null),[Ae,ze]=(0,G.useState)(!1),[w,Be]=(0,G.useState)(!1),[D,tt]=(0,G.useState)(null),[nt,rt]=(0,G.useState)(null),[O,k]=(0,G.useState)(null),[F,I]=(0,G.useState)(null),[wt,Pt]=(0,G.useState)(!1),[V,U]=(0,G.useState)(Ht),[W,Kt]=(0,G.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Yt=e=>{localStorage.setItem(`oc.sched.view`,e),Kt(e)},[Zt,Qt]=(0,G.useState)(null),[q,$t]=(0,G.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),en=(0,G.useMemo)(()=>{let e=[];for(let t of x??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,V)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[x,V]),tn=(0,G.useMemo)(()=>Zt===`year`?an(q.year):rn(q.year,q.month),[Zt,q]),nn=(0,G.useMemo)(()=>bn(en,tn.startMs,tn.endMs),[en,tn]),J=(0,G.useRef)(null),sn=e=>{let t=nn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||(J.current=e.id,gn(t.instanceName,t.job))},Y=(0,G.useCallback)(async()=>{ze(!0),Be(!1);try{Ee(await e({}))}catch{Be(!0)}finally{ze(!1)}},[e]);(0,G.useEffect)(()=>{Y()},[Y]);let ln=(0,G.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),un=(0,G.useRef)(null),dn=(0,G.useRef)(null),fn=Bt(dn,[x,V,W,C()]);(0,G.useEffect)(()=>{x!==null&&un.current!==null&&un.current.scrollIntoView({block:`center`})},[x]);let pn=(0,G.useMemo)(()=>new Intl.DateTimeFormat(C(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{tt(e);try{await t(),b.success(n),await Y()}catch(e){b.toast({variant:`error`,title:T({code:xn(e)})})}finally{tt(null)}},Z=(0,G.useRef)(0),Q=(0,G.useRef)(0),mn=()=>J.current===null?[]:cn(),hn=async(e,t)=>{if(t.id===null)return;let r=++Z.current;k({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;k({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;k(null),b.toast({variant:`error`,title:T({code:xn(e)})})}},gn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;I({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;I(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;I(null),b.toast({variant:`error`,title:T({code:xn(e)})})}},_n=async()=>{if(F===null)return;let e={};if(F.nameDirty&&F.name.trim()===``||F.messageDirty&&F.hasMessage&&F.message.trim()===``){b.toast({variant:`error`,title:me()});return}if(F.nameDirty&&F.name.trim()!==``&&(e.name=F.name.trim()),F.scheduleDirty){if(F.scheduleKind===`cron`&&F.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:F.cronExpr.trim(),...F.tz.trim()===``?{}:{tz:F.tz.trim()}};else if(F.scheduleKind===`every`){let t=Number(F.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[F.everyUnit])})}else if(F.scheduleKind===`at`&&F.at!==``){let t=Date.parse(F.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(F.scheduleDirty&&e.schedule===void 0){b.toast({variant:`error`,title:ye()});return}if(F.messageDirty&&F.hasMessage&&F.message.trim()!==``&&(e.message=F.message.trim()),Object.keys(e).length===0){I(null);return}let t=Q.current;Pt(!0);try{await a({instanceName:F.instanceName,jobId:F.jobId,patch:e}),b.success(Ze()),t===Q.current&&I(null),await Y()}catch(e){b.toast({variant:`error`,title:T({code:xn(e)})})}finally{Pt(!1)}},vn=x?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,K.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Je()}),(0,K.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":l(),children:[(0,K.jsx)(L,{variant:W===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":u(),title:u(),"aria-pressed":W===`list`,onClick:()=>Yt(`list`),children:(0,K.jsx)(ot,{})}),(0,K.jsx)(L,{variant:W===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":pe(),title:pe(),"aria-pressed":W===`calendar`,onClick:()=>Yt(`calendar`),children:(0,K.jsx)(qt,{})})]}),(0,K.jsxs)(L,{variant:`ghost`,size:`sm`,onClick:()=>void Y(),disabled:Ae,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,K.jsx)(mt,{size:14,"aria-hidden":!0}),ne()]})]}),x!==null&&vn>0?(0,K.jsxs)(zt,{q:V.q,onQChange:e=>U(t=>({...t,q:e})),searchPlaceholder:ve(),onReset:()=>U(Ht),canReset:Wt(V),children:[(0,K.jsxs)(P,{value:V.state,onValueChange:e=>U(t=>({...t,state:e})),children:[(0,K.jsx)(j,{size:`sm`,className:`w-40`,children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`all`,children:s()}),(0,K.jsx)(N,{value:`active`,children:oe()}),(0,K.jsx)(N,{value:`paused`,children:ce()}),(0,K.jsx)(N,{value:`auto-disabled`,children:ie()})]})]}),(0,K.jsxs)(P,{value:V.result,onValueChange:e=>U(t=>({...t,result:e})),children:[(0,K.jsx)(j,{size:`sm`,className:`w-40`,children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`all`,children:at()}),(0,K.jsx)(N,{value:`ok`,children:re()}),(0,K.jsx)(N,{value:`error`,children:xe()}),(0,K.jsx)(N,{value:`running`,children:ge()}),(0,K.jsx)(N,{value:`none`,children:g()})]})]})]}):null,x===null?(0,K.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Ae,children:w?p():Ve()}):W===`calendar`?(0,K.jsxs)(K.Fragment,{children:[w?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null,x.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,K.jsx)(on,{events:nn.events,mode:Zt,cursor:q,onModeChange:Qt,onCursorChange:$t,onEventClick:sn,footnote:Ie()})]}):(0,K.jsxs)(K.Fragment,{children:[w?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):null,x.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):null,(0,K.jsx)(`div`,{ref:dn,className:`oc-tablefit`,"data-layout":fn,children:x.map(e=>{let t=e.jobs.filter(e=>Vt(e,V)),n=Wt(V)&&e.jobs.length>0&&t.length===0;return(0,K.jsxs)(`section`,{style:{marginBottom:20},children:[x.length>1||e.error||!e.supported?(0,K.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,K.jsx)(R,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:h({code:e.error})}):e.jobs.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):n?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,K.jsxs)(Rt,{children:[(0,K.jsx)(Ft,{children:(0,K.jsxs)(Lt,{children:[(0,K.jsx)(z,{children:o()}),(0,K.jsx)(z,{children:it()}),(0,K.jsx)(z,{children:de()}),(0,K.jsx)(z,{children:y()}),(0,K.jsx)(z,{children:_()}),(0,K.jsx)(z,{children:Ye()}),(0,K.jsx)(z,{children:Ge()})]})}),(0,K.jsx)(It,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=D===r,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,K.jsxs)(Lt,{ref:t.id!==null&&t.id===ln?un:void 0,"data-state":t.id!==null&&t.id===ln?`selected`:void 0,children:[(0,K.jsx)(B,{className:`oc-dt__lead font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??d()}),(0,K.jsx)(B,{"data-label":it(),children:(0,K.jsx)(R,{variant:`secondary`,children:t.agentId})}),(0,K.jsxs)(B,{className:`whitespace-nowrap`,"data-label":de(),children:[(0,K.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=ft(t.schedule),n=e===null?null:ut(e);return n===null?null:(0,K.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,K.jsx)(B,{className:`whitespace-nowrap text-muted-foreground`,"data-label":y(),children:t.nextRunAtMs===null?`—`:pn.format(t.nextRunAtMs)}),(0,K.jsx)(B,{"data-label":_(),children:Ut(t)===`auto-disabled`?(0,K.jsx)(R,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${pn.format(t.autoDisabledAtMs)}`}`,children:ie()}):Ut(t)===`active`?(0,K.jsx)(R,{variant:`secondary`,children:oe()}):Ut(t)===`paused`?(0,K.jsx)(R,{variant:`outline`,children:ce()}):(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,K.jsxs)(B,{"data-label":Ye(),children:[(0,K.jsx)(Sn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,K.jsx)(R,{variant:`destructive`,title:t.lastDeliveryError??Ke(),children:m()}):null]}),(0,K.jsx)(B,{className:`oc-dt__actionsrow whitespace-nowrap`,children:t.id===null?(0,K.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,K.jsx)(st,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,K.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:Me(),"aria-label":Me(),disabled:D!==null,onClick:()=>void X(r,async()=>{let n=await ae({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},De()),children:(0,K.jsx)(dt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:H(t)===`pause`?et():He(),"aria-label":H(t)===`pause`?et():He(),disabled:D!==null,onClick:()=>void X(r,()=>a({instanceName:e.instanceName,jobId:t.id,patch:{enabled:H(t)===`resume`}}),H(t)===`pause`?Le():Xe()),children:H(t)===`pause`?(0,K.jsx)(ct,{size:14,"aria-hidden":!0}):(0,K.jsx)(lt,{size:14,"aria-hidden":!0})}):null,s?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:Oe(),"aria-label":Oe(),disabled:D!==null,onClick:()=>{J.current=null,gn(e.instanceName,t)},children:(0,K.jsx)(pt,{size:14,"aria-hidden":!0})}):null,s?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:Re(),"aria-label":Re(),disabled:D!==null,onClick:()=>void hn(e.instanceName,t),children:(0,K.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,o?(0,K.jsx)(L,{variant:`ghost`,size:`icon-sm`,title:je(),"aria-label":je(),disabled:D!==null,onClick:()=>rt({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,K.jsx)(ht,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:he()})]},e.instanceName)})}),vn>0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:v()}):null]}),(0,K.jsx)(Ct,{open:nt!==null,onOpenChange:e=>{e||rt(null)},children:(0,K.jsxs)(vt,{children:[(0,K.jsxs)(St,{children:[(0,K.jsx)(_t,{children:Qe()}),(0,K.jsx)(gt,{children:Ne({name:nt?.name??``})})]}),(0,K.jsxs)(bt,{children:[(0,K.jsx)(xt,{children:i()}),(0,K.jsx)(yt,{onClick:()=>{let e=nt;rt(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>c({instanceName:e.instanceName,jobId:e.jobId}),Ue())},children:ue()})]})]})}),(0,K.jsx)(Mt,{open:O!==null,onOpenChange:e=>{e||(Z.current++,k(null))},children:(0,K.jsxs)(kt,{style:{maxWidth:640},children:[(0,K.jsx)(Dt,{children:(0,K.jsx)(At,{children:We({name:O?.name??``})})}),O?.entries===null?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):O!==null&&O.entries.length===0?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:$e()}):O===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:O.entries.map((e,t)=>(0,K.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,K.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,K.jsx)(Sn,{status:e.status}),(0,K.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?pn.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,K.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,K.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,K.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[we({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,K.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,K.jsx)(Mt,{open:F!==null,onOpenChange:e=>{e||(Q.current++,I(null))},children:(0,K.jsxs)(kt,{className:`oc-cronedit`,returnFocus:mn,children:[(0,K.jsxs)(Dt,{children:[(0,K.jsx)(At,{children:Pe()}),(0,K.jsx)(jt,{children:r()})]}),F===null?null:F.loading?(0,K.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):(0,K.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,K.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:o()}),(0,K.jsx)(Tt,{value:F.name,maxLength:200,onChange:e=>I({...F,name:e.target.value,nameDirty:!0})})]}),(0,K.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:le()}),(0,K.jsxs)(P,{value:F.scheduleKind,onValueChange:e=>I({...F,scheduleKind:e,scheduleDirty:!0}),children:[(0,K.jsx)(j,{children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`cron`,children:Te()}),(0,K.jsx)(N,{value:`every`,children:Se()}),(0,K.jsx)(N,{value:`at`,children:Ce()})]})]}),F.scheduleKind===`cron`?(0,K.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,K.jsx)(Tt,{value:F.cronExpr,onChange:e=>I({...F,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,K.jsx)(Gt,{value:F.tz,onChange:e=>I({...F,tz:e,scheduleDirty:!0}),fallbackTz:se??void 0})]}):F.scheduleKind===`every`?(0,K.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,K.jsx)(Tt,{type:`number`,min:1,value:F.everyValue,onChange:e=>I({...F,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,K.jsxs)(P,{value:F.everyUnit,onValueChange:e=>I({...F,everyUnit:e,scheduleDirty:!0}),children:[(0,K.jsx)(j,{style:{maxWidth:160},children:(0,K.jsx)(A,{})}),(0,K.jsxs)(M,{children:[(0,K.jsx)(N,{value:`minutes`,children:ee()}),(0,K.jsx)(N,{value:`hours`,children:qe()}),(0,K.jsx)(N,{value:`days`,children:te()})]})]})]}):(0,K.jsx)(Xt,{value:F.at,onChange:e=>I({...F,at:e,scheduleDirty:!0})})]}),F.hasMessage?(0,K.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,K.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Fe()}),(0,K.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:F.message,onChange:e=>I({...F,message:e.target.value,messageDirty:!0})})]}):null]}),(0,K.jsxs)(Ot,{children:[(0,K.jsx)(L,{variant:`ghost`,onClick:()=>I(null),children:i()}),(0,K.jsxs)(L,{onClick:()=>void _n(),disabled:F===null||F.loading||wt,children:[wt?(0,K.jsx)(st,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,f()]})]})]})})]})}export{Cn as ScheduledTab};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$G as r,AG as ee,BG as te,CG as i,CK as ne,DG as a,EG as o,FG as re,GG as ie,HG as ae,IG as oe,JG as se,KG as ce,LG as le,MG as ue,NG as de,OG as fe,PG as pe,QG as me,RG as he,SG as s,SK as ge,TG as c,UG as _e,VG as ve,WG as ye,XG as be,YG as xe,ZG as Se,_G as Ce,_K as we,_Q as Te,aG as l,aK as Ee,bG as u,bK as De,bQ as d,cG as f,cK as Oe,dG as p,dK as ke,eK as Ae,fG as m,fK as je,gG as Me,gK as Ne,hG as Pe,hK as Fe,iG as h,iK as Ie,jG as Le,kG as Re,lG as g,lK as ze,mG as _,mK as Be,nK as Ve,oG as v,oK as He,pG as y,pK as Ue,qG as We,rK as Ge,sG as b,sK as Ke,t as x,tK as qe,uG as S,uK as Je,vG as C,vK as w,wG as T,wK as Ye,xG as E,xK as Xe,yG as D,yK as O,yQ as k,zG as Ze}from"./api-CWqdeSbN.js";import{n as Qe,t as $e}from"./useNavigate-D3GIoxyW.js";import{t as A}from"./check-DdmANHSb.js";import{r as et}from"./dist-CzmY6YrA.js";import{t as tt}from"./chevron-right-DMqzlhWH.js";import{t as j}from"./copy-DbstFM9Q.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CjcMQhwm.js";import{t as L}from"./button-C_rIPtCv.js";import{t as R}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as nt}from"./toast-C_YfUacM.js";import{t as z}from"./badge-ChMMFtuW.js";import{n as B,t as V}from"./format-AQELUhPa.js";import{a as H,i as U,n as W,o as G,r as K,t as q}from"./dialog-CPAskUwF.js";import{n as rt}from"./ConfirmDialog-B7k0wvSi.js";import{t as it}from"./EntitySheet-DRzkWKlH.js";import{t as at}from"./FilterBar-DCCuFxDn.js";import{t as ot}from"./DataTableShell-DvtkASQG.js";import{t as st}from"./roleDescriptions-DHny6e80.js";var J=t(e(),1),Y=n(),ct=[{value:`never`,label:()=>S(),days:null},{value:`30`,label:()=>g(),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??``,i=e.status??Z,[a,o]=(0,J.useState)(Z),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===Z?void 0:e})}),Ce=d(x.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===Z?void 0:a,disabled:i===Z?void 0:i===`disabled`}}),l=d(x.apiKeys.listKeys,{}),u=d(x.apiKeys.listRoles,{}),f=k(x.apiKeys.createServiceAccount),p=k(x.apiKeys.updateServiceAccount),m=k(x.apiKeys.deleteServiceAccount),Me=Te(x.apiKeys.mintApiKey),Pe=k(x.apiKeys.revokeApiKey),h=rt(),g=nt(),_=n!==``||a!==Z||i!==Z;function v(){o(Z),t({search:{},replace:!0})}let[y,b]=(0,J.useState)(!1),[S,C]=(0,J.useState)(Q),[T,E]=(0,J.useState)(null),[D,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 l??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[l]);function $(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function dt(){try{T?(await p({serviceAccountId:T,name:S.name,roleKey:S.roleKey,description:S.description}),g.success(ae())):await f({name:S.name,roleKey:S.roleKey,description:S.description||void 0}),C(Q),E(null),b(!1)}catch(e){g.error(T?_e():ye(),e)}}function ft(e){C({name:e.name,roleKey:e.roleKey,description:e.description??``}),E(e._id),b(!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 Me({serviceAccountId:e._id,expiresAt:r});q({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){g.error(ve(),e)}finally{V.current=!1,B(null)}}async function mt(e){if(await h({title:te(),description:(0,Y.jsxs)(Y.Fragment,{children:[Ze(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,he(),` `,(0,Y.jsx)(`strong`,{children:le()}),` `,oe()]}),confirmWord:e.name,confirmLabel:re(),destructive:!0}))try{await m({serviceAccountId:e._id}),g.success(pe(),e.name)}catch(e){g.error(de(),e)}}async function ht(e){if(await h({title:ue(),description:(0,Y.jsxs)(Y.Fragment,{children:[Le(),` `,(0,Y.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ee()]}),confirmLabel:Re(),destructive:!0})&&!H.has(e._id)){U(t=>new Set(t).add(e._id));try{await Pe({keyId:e._id})}catch(e){g.error(fe(),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:Ye()}),(0,Y.jsxs)(at,{q:n,onQChange:s,searchPlaceholder:ne(),onReset:v,canReset:_,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:Xe()}),(u??[]).map(e=>(0,Y.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,Y.jsxs)(I,{value:i,onValueChange:c,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:De()}),(0,Y.jsx)(F,{value:`active`,children:O()}),(0,Y.jsx)(F,{value:`disabled`,children:w()})]})]})]}),(0,Y.jsx)(ot,{title:we(),rows:Ce,addLabel:Ne(),onAdd:()=>{C(Q),E(null),b(!0)},emptyHint:Fe(),isExpanded:e=>D.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:ke(),onSelect:()=>ft(e)},{label:Be(),onSelect:()=>void pt(e)}]:[],{label:D.has(e._id)?Ue():je(),onSelect:()=>$(e._id)},...(e.managedBy??null)===null?[{label:Je(),variant:`destructive`,onSelect:()=>void mt(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,Y.jsx)(L,{variant:`ghost`,size:`icon-sm`,"aria-label":D.has(e._id)?ze():Oe(),onClick:()=>$(e._id),children:D.has(e._id)?(0,Y.jsx)(et,{}):(0,Y.jsx)(tt,{})})},{header:Ke(),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:He(),sort:e=>e.roleKey,cell:e=>(0,Y.jsx)(z,{variant:`secondary`,children:e.roleKey})},{header:Ee(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:w()}):(0,Y.jsx)(z,{variant:`outline`,children:O()})},{header:Ie(),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:Ge(),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?Ve():qe({count:t})})}}]}),(0,Y.jsx)(it,{open:y,onOpenChange:e=>{b(e),e||E(null)},title:T?Ae():Se(),description:T?r():be(),canSubmit:!!(S.name&&S.roleKey),onSubmit:dt,submitLabel:T?me():xe(),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:se()}),(0,Y.jsx)(R,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,Y.jsxs)(`label`,{className:`oc-field`,children:[(0,Y.jsx)(`span`,{className:`oc-field__label`,children:We()}),(0,Y.jsxs)(I,{value:S.roleKey||void 0,onValueChange:e=>C({...S,roleKey:e}),children:[(0,Y.jsx)(N,{className:`w-full`,children:(0,Y.jsx)(M,{placeholder:ce()})}),(0,Y.jsx)(P,{children:(u??[]).map(e=>(0,Y.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===S.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:ie()}),(0,Y.jsx)(R,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})}),(0,Y.jsx)(ut,{minted:K,onClose:()=>q(null)})]})}function lt({account:e,keys:t,onRevoke:n,revoking:r}){return(0,Y.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,Y.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[a(),` `,(0,Y.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,Y.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):(0,Y.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,Y.jsx)(`thead`,{children:(0,Y.jsxs)(`tr`,{children:[(0,Y.jsx)(`th`,{children:c()}),(0,Y.jsx)(`th`,{children:T()}),(0,Y.jsx)(`th`,{children:i()}),(0,Y.jsx)(`th`,{children:s()}),(0,Y.jsx)(`th`,{children:E()}),(0,Y.jsx)(`th`,{children:u()}),(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:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?D():C()}):null})]},t._id))})]})]})}function ut({minted:e,onClose:t}){let[n,r]=(0,J.useState)(!1);async function ee(){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:Ce()}),(0,Y.jsx)(K,{children:Me({name:e.accountName})})]}),(0,Y.jsx)(`div`,{className:`oc-sa__minted-warning`,children:Pe()}),(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 ee(),"aria-label":_(),children:[n?(0,Y.jsx)(A,{}):(0,Y.jsx)(j,{}),n?y():m()]})]}),(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?b():B(e)}function pt(e){return e===null?`—`:V(e)}function mt(e){return e.disabled?(0,Y.jsx)(z,{variant:`destructive`,children:v()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,Y.jsx)(z,{variant:`outline`,children:l()}):(0,Y.jsx)(z,{variant:`outline`,children:h()})}export{$ as ServiceAccountsTab};
|