@lacneu/atrium 0.104.0 → 0.104.3
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-D8xdWzT5.js +1 -0
- package/dist/assets/{AdminSettings-BdVeeUB1.js → AdminSettings-CtNcFhMz.js} +1 -1
- package/dist/assets/{AdvancedFilter-B4QfxxEB.js → AdvancedFilter-Cod8SSd6.js} +1 -1
- package/dist/assets/AgentFilesTab-Dfkkm3Fw.js +3 -0
- package/dist/assets/AnomaliesTab-DlZ5M2UC.js +1 -0
- package/dist/assets/AuditTab-Dh6gO6j5.js +1 -0
- package/dist/assets/BridgeTab-Bnu9R5N4.js +1 -0
- package/dist/assets/ChatDefaultsTab-CxmayDqi.js +1 -0
- package/dist/assets/{ConfirmDialog-BmOX8o6F.js → ConfirmDialog-B7k0wvSi.js} +1 -1
- package/dist/assets/{DataTableShell-BTk71L7O.js → DataTableShell-DvtkASQG.js} +1 -1
- package/dist/assets/DeletedChatsTab-CnaK-AH0.js +1 -0
- package/dist/assets/{DetailChips-BU-SQfjj.js → DetailChips-DDAtgnjA.js} +1 -1
- package/dist/assets/EntitySheet-DRzkWKlH.js +1 -0
- package/dist/assets/FeedbacksTab-D4LKaB_2.js +1 -0
- package/dist/assets/{FieldLabel-Wb5bwK7r.js → FieldLabel-imj_Z0rZ.js} +1 -1
- package/dist/assets/FilesTab-D3XWSI2t.js +1 -0
- package/dist/assets/{FilterBar-D2w0wWnm.js → FilterBar-DCCuFxDn.js} +1 -1
- package/dist/assets/GroupsTab-DbayDYbZ.js +1 -0
- package/dist/assets/InstancesTab-031fn2Jt.js +1 -0
- package/dist/assets/IntegrationsTab-1whhDsmk.js +1 -0
- package/dist/assets/KnobRow-D6kXWvVI.js +1 -0
- package/dist/assets/KpiTab-2Vk6EtCf.js +1 -0
- package/dist/assets/PreferencesTab-B5h49bYq.js +1 -0
- package/dist/assets/ProjectPage-BNKL-iOz.js +1 -0
- package/dist/assets/PromptInjectionsTab-Bmn1iSpB.js +4 -0
- package/dist/assets/RolesTab-DHxLatAl.js +1 -0
- package/dist/assets/ScheduledTab-NHSyQ677.js +1 -0
- package/dist/assets/ServiceAccountsTab-CKV8crhK.js +1 -0
- package/dist/assets/SubAgentReportsTab-BWfXOTck.js +1 -0
- package/dist/assets/ThemeShowroom-Do9I3hrR.js +1 -0
- package/dist/assets/{TimeRangePicker-BvcqBpnq.js → TimeRangePicker-BZtw1JkM.js} +1 -1
- package/dist/assets/{TimezoneCombobox-BUC66FuM.js → TimezoneCombobox-CeRN4N3z.js} +1 -1
- package/dist/assets/TracesTab-BNWFPad2.js +1 -0
- package/dist/assets/TrashTab-D5irFeF0.js +1 -0
- package/dist/assets/UsersTab-CHs3CRev.js +1 -0
- package/dist/assets/VoiceTab-DRvjgMdZ.js +1 -0
- package/dist/assets/{alert-dialog-BwvaE8oD.js → alert-dialog-BcJMHbhI.js} +1 -1
- package/dist/assets/{api-jG5Fwsg4.js → api-CWqdeSbN.js} +5 -5
- package/dist/assets/{badge-CSm2xaYH.js → badge-ChMMFtuW.js} +1 -1
- package/dist/assets/{button-sV7hIR3f.js → button-C_rIPtCv.js} +1 -1
- package/dist/assets/{card-i1bbFYFv.js → card-BV8NO76j.js} +1 -1
- package/dist/assets/check-DdmANHSb.js +1 -0
- package/dist/assets/{checkbox-U99HMqP3.js → checkbox-DPxJTQjc.js} +1 -1
- package/dist/assets/chevron-left-ByEQraEh.js +1 -0
- package/dist/assets/chevron-right-DMqzlhWH.js +1 -0
- package/dist/assets/chevron-up-B3KYmtzo.js +1 -0
- package/dist/assets/chevrons-up-down-CITEfz7_.js +1 -0
- package/dist/assets/{compatView-Cqu0P9sx.js → compatView-Cz5KNXa-.js} +1 -1
- package/dist/assets/convexApi-G20_TNBS.js +1 -0
- package/dist/assets/{copy-BIRdG3Nl.js → copy-DbstFM9Q.js} +1 -1
- package/dist/assets/{cronDescribe-D9eP5CDy.js → cronDescribe-CkiSvbCK.js} +1 -1
- package/dist/assets/{deliveryRecorder-DEtCAEff.js → deliveryRecorder-B_kVKMkR.js} +1 -1
- package/dist/assets/{dialog-Bpoyy7pR.js → dialog-CPAskUwF.js} +1 -1
- package/dist/assets/dispatchErrorInfo-7H2cJGwt.js +1 -0
- package/dist/assets/{dist-D7Oplune.js → dist-BjZo0sql.js} +1 -1
- package/dist/assets/{dist-ChYvHRlL.js → dist-Bu9sqVcp.js} +1 -1
- package/dist/assets/{dist-t45SSvfU.js → dist-CYh9BuQS.js} +1 -1
- package/dist/assets/{dist-Bxf4XoMW.js → dist-CzmY6YrA.js} +1 -1
- package/dist/assets/{dist-B9q2nlqC.js → dist-Uf18yR_a.js} +1 -1
- package/dist/assets/{download-DQYw1N-_.js → download-BaebAe6Z.js} +1 -1
- package/dist/assets/{dropdown-menu-yCbwljS-.js → dropdown-menu-BVKVjups.js} +1 -1
- package/dist/assets/{eye-CZuTJsZX.js → eye-LggiM6Z5.js} +1 -1
- package/dist/assets/{format-BQaxlN43.js → format-AQELUhPa.js} +1 -1
- package/dist/assets/{groupManageView-BcbLXWZ4.js → groupManageView-DC3eSLA1.js} +1 -1
- package/dist/assets/index-DLjKxzJ_.css +1 -0
- package/dist/assets/index-Dq26_OeV.js +158 -0
- package/dist/assets/{input-DReDYsos.js → input-CSZu-bVE.js} +1 -1
- package/dist/assets/{list-kKcfLqpz.js → list-obbqPBzD.js} +1 -1
- package/dist/assets/loader-circle-BqKiW3X9.js +1 -0
- package/dist/assets/{lock-DJQnxN_w.js → lock-BlVhOk85.js} +1 -1
- package/dist/assets/{pencil-C_IJUeJn.js → pencil-K7SBkvHL.js} +1 -1
- package/dist/assets/plus-DTL4K-j9.js +1 -0
- package/dist/assets/{popover-BcL-AsC2.js → popover-C-Y_Yoco.js} +1 -1
- package/dist/assets/roleDescriptions-DHny6e80.js +1 -0
- package/dist/assets/rotate-ccw-CvefWwHW.js +1 -0
- package/dist/assets/{search-CGco_tlI.js → search-Dz6sLH0-.js} +1 -1
- package/dist/assets/{select-DGKgMOlh.js → select-CjcMQhwm.js} +1 -1
- package/dist/assets/{server-ClLFUY_D.js → server-DcInl3Nh.js} +1 -1
- package/dist/assets/{speech-DO_eJ8Aq.js → speech-ehUcmGCg.js} +1 -1
- package/dist/assets/{star-B6yMf_Hc.js → star-5ysDlx3k.js} +1 -1
- package/dist/assets/{switch-D-QGMGm7.js → switch--NPD3Vp0.js} +1 -1
- package/dist/assets/{table-CIrFKiPM.js → table-rRR3TpMc.js} +1 -1
- package/dist/assets/{tabs-BWfAdnjK.js → tabs-B8emuY1B.js} +1 -1
- package/dist/assets/toast-C_YfUacM.js +1 -0
- package/dist/assets/{tooltip-CobtYK4c.js → tooltip-Ct0TGxtk.js} +1 -1
- package/dist/assets/{trash-2-UxV-pTWt.js → trash-2-xhtrhYsd.js} +1 -1
- package/dist/assets/trashPage-3suR6eIy.js +1 -0
- package/dist/assets/trashView-CwUC01r_.js +1 -0
- package/dist/assets/{triangle-alert-BMryltpr.js → triangle-alert-DoL9TI6v.js} +1 -1
- package/dist/assets/{usageView-CKi8uUZb.js → usageView-BuRtXekW.js} +1 -1
- package/dist/assets/{useChart-BE4pYQJh.js → useChart-bV4rotdu.js} +1 -1
- package/dist/assets/{useFontScale-DCa0acMC.js → useFontScale-DiSkEM6I.js} +1 -1
- package/dist/assets/{useStartNewChat-BatYRWH7.js → useStartNewChat-8wVLrYnZ.js} +2 -2
- package/dist/assets/{use_paginated_query-imV3AXlW.js → use_paginated_query-CebdO_HQ.js} +1 -1
- package/dist/assets/{users-CBI99oGw.js → users-CRbE186D.js} +1 -1
- package/dist/assets/x-CcIT4ync.js +1 -0
- package/dist/index.html +54 -54
- package/package.json +1 -1
- package/dist/assets/AccessTab-Bk4_F0iH.js +0 -1
- package/dist/assets/AgentFilesTab-Dlm2lBii.js +0 -3
- package/dist/assets/AnomaliesTab-D_QuI8BU.js +0 -1
- package/dist/assets/AuditTab-DOfKzC0D.js +0 -1
- package/dist/assets/BridgeTab-OC_GNU22.js +0 -1
- package/dist/assets/ChatDefaultsTab-BeTKiTFl.js +0 -1
- package/dist/assets/DeletedChatsTab-BCD6pwBJ.js +0 -1
- package/dist/assets/EntitySheet-BXEY6TCb.js +0 -1
- package/dist/assets/FeedbacksTab-Ch0Og-WD.js +0 -1
- package/dist/assets/FilesTab-C6xs9TIo.js +0 -1
- package/dist/assets/GroupsTab-Dktghl12.js +0 -1
- package/dist/assets/InstancesTab-B_jY-L5V.js +0 -1
- package/dist/assets/IntegrationsTab-CA10qkLR.js +0 -1
- package/dist/assets/KnobRow-DsPgcIxU.js +0 -1
- package/dist/assets/KpiTab-DN2VV-KL.js +0 -1
- package/dist/assets/PreferencesTab-DCUtb7jt.js +0 -1
- package/dist/assets/ProjectPage-CZbKzufX.js +0 -1
- package/dist/assets/PromptInjectionsTab-D-qkRO-x.js +0 -4
- package/dist/assets/RolesTab-B-kY1GSh.js +0 -1
- package/dist/assets/ScheduledTab-C3lqr_Wn.js +0 -1
- package/dist/assets/ServiceAccountsTab-4Tcuxr0L.js +0 -1
- package/dist/assets/SubAgentReportsTab-BvaMpkUp.js +0 -1
- package/dist/assets/ThemeShowroom-BNUhcoUx.js +0 -1
- package/dist/assets/TracesTab-CmHSn4oj.js +0 -1
- package/dist/assets/TrashTab-CCNS2Ybn.js +0 -1
- package/dist/assets/UsersTab-B-H2pRkF.js +0 -1
- package/dist/assets/VoiceTab-C4f9SFZl.js +0 -1
- package/dist/assets/check-MG02lA-U.js +0 -1
- package/dist/assets/chevron-left-cmPkj5_M.js +0 -1
- package/dist/assets/chevron-right-DbysoSJS.js +0 -1
- package/dist/assets/chevron-up-DQBDpk9Z.js +0 -1
- package/dist/assets/chevrons-up-down-3woN2nFd.js +0 -1
- package/dist/assets/convexApi-DeaVGrsr.js +0 -1
- package/dist/assets/dispatchErrorInfo-DBq1hdag.js +0 -1
- package/dist/assets/index-CHdY282S.css +0 -1
- package/dist/assets/index-CVhaNoJz.js +0 -158
- package/dist/assets/loader-circle-_HV4tchJ.js +0 -1
- package/dist/assets/plus-A35Qzur2.js +0 -1
- package/dist/assets/roleDescriptions-D-rhX1-Q.js +0 -1
- package/dist/assets/rotate-ccw-XgdDTtI8.js +0 -1
- package/dist/assets/toast-daONdZpX.js +0 -1
- package/dist/assets/trashPage-CFUn9bkp.js +0 -1
- package/dist/assets/trashView-CrjCfgVT.js +0 -1
- package/dist/assets/x-TiVTngrx.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1,4 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,Bh as i,Gh as a,Hh as o,Jh as s,Kh as c,Qh as l,Rh as u,Sg as d,Uh as f,Vh as p,Wh as m,Xh as h,Yh as g,Zh as _,_g as v,ag as y,bQ as b,bg as x,cg as S,dg as C,eg as w,fg as T,gg as E,hg as D,ig as O,lg as k,mg as A,ng as j,og as M,pg as N,qh as P,rg as F,sg as I,t as L,tg as R,ug as ee,vg as z,xg as B,yQ as V,yg as H,zh as U}from"./api-CWqdeSbN.js";import{t as W}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{n as G}from"./format-AQELUhPa.js";import{n as K}from"./ConfirmDialog-B7k0wvSi.js";import{t as q}from"./DataTableShell-DvtkASQG.js";var J=t(e(),1),Y=n(),X={hung:()=>y(),wrong_result:()=>O(),error:()=>F(),other:()=>j()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=V(L.subAgentReports.respondToReport),[i,u]=(0,J.useState)(e.thread),[d,v]=(0,J.useState)(``),[y,b]=(0,J.useState)(!1);async function x(){let t=d.trim();if(!(!t||y)){b(!0);try{await n({reportId:e._id,text:t}),u(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),v(``)}finally{b(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,R({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:r()}),i.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:i.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?l():_()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:h()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:g(),value:d,maxLength:2e3,rows:3,onChange:e=>v(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void x(),disabled:!d.trim()||y,children:y?P():s()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[c({count:t.children.length}),t.childrenTruncated?` ${a()}`:``,t.textTruncated?` ${m()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${f()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:o()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=b(L.subAgentReports.listForAdmin,{}),t=V(L.subAgentReports.readReport),n=V(L.subAgentReports.deleteReport),r=K(),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({reportId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function f(e){await r({title:i(),description:U(),confirmLabel:u(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&o(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[x(),` `,(0,Y.jsx)(`strong`,{children:H()}),` `,z()]}),(0,Y.jsx)(q,{title:d(),rows:e,emptyHint:B(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Y.jsx)($,{data:s[e._id]}):null,columns:[{header:v(),cell:e=>G(e.at),sort:e=>e.at},{header:E(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:D(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:A(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${C({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:N(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:T(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ee()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:k()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?I():S(),onSelect:()=>void l(e)},{label:M(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$q as r,AJ as i,Aq as a,Bq as o,CJ as s,Cq as c,DJ as l,Dq as u,EJ as d,Eq as f,Fh as p,Fq as m,Gq as h,Hq as g,Ih as _,Iq as v,Jq as y,Kq as b,Lh as x,Lq as ee,MJ as te,Mq as ne,NJ as re,Nq as ie,OJ as ae,Oq as oe,Ph as se,Pq as ce,Qq as le,Rq as ue,SJ as de,Sq as fe,TJ as pe,Tq as me,Uq as he,Vq as ge,Wq as _e,Xq as S,Yq as ve,Zq as ye,_J as be,_Q as xe,_q as Se,aJ as Ce,aQ as we,bJ as Te,bQ as C,bq as Ee,cJ as De,dJ as Oe,dq as ke,eJ as Ae,fJ as je,fq as Me,gJ as Ne,gq as Pe,hJ as Fe,hq as w,iJ as Ie,jJ as Le,jq as T,kJ as Re,kq as ze,lJ as Be,mJ as Ve,mq as He,nJ as Ue,o as We,oJ as Ge,oQ as Ke,pJ as qe,pq as Je,qq as Ye,rJ as Xe,sJ as Ze,sQ as Qe,t as E,tJ as $e,uJ as et,vJ as tt,vq as nt,wJ as rt,wq as it,xJ as at,xq as ot,yJ as st,yQ as D,yq as O,zq as ct}from"./api-CWqdeSbN.js";import{t as k}from"./check-DdmANHSb.js";import{c as lt,g as A,i as ut,n as dt,r as j,s as M,t as ft}from"./dropdown-menu-BVKVjups.js";import{t as pt}from"./download-BaebAe6Z.js";import{t as N}from"./checkbox-DPxJTQjc.js";import{i as P,n as mt,r as ht}from"./useChart-bV4rotdu.js";import{t as F}from"./x-CcIT4ync.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-CjcMQhwm.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{t as U}from"./badge-ChMMFtuW.js";import{t as W}from"./appHost-CH3EGcJw.js";import{t as gt}from"./localePickerView-C2RmOS86.js";import{a as _t,i as vt,n as yt,o as bt,r as xt,t as St}from"./card-BV8NO76j.js";import{a as Ct,i as G,n as wt,o as K,r as q,t as Tt}from"./table-rRR3TpMc.js";import{t as Et}from"./TimeRangePicker-BZtw1JkM.js";import{t as Dt}from"./FilterBar-DCCuFxDn.js";import{t as Ot}from"./AdvancedFilter-Cod8SSd6.js";var J=t(e(),1),kt=.1,At=[248,248,248],jt=[24,24,24];function Mt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Nt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Y(e,t,n){return Nt(e,t,n)>=kt}function Pt(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function Ft(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var It=12*1024*1024,Lt=480,Rt=160,zt=.92;async function Bt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(ce());if(e.size>It)throw Error(ie());let{source:n,width:r,height:i,cleanup:o}=await Vt(e);try{let o=e.type===`image/svg+xml`,s=Math.min(Lt/r,Rt/i,o?1/0:1),c=Math.max(1,Math.round(r*s)),l=Math.max(1,Math.round(i*s)),u=document.createElement(`canvas`);u.width=c,u.height=l;let d=u.getContext(`2d`);if(!d)throw Error(T());d.imageSmoothingEnabled=!0,d.imageSmoothingQuality=`high`,d.drawImage(n,0,0,c,l);let f=Mt(d.getImageData(0,0,c,l).data,c,l)??{x:0,y:0,width:c,height:l},p=document.createElement(`canvas`);p.width=f.width,p.height=f.height;let m=p.getContext(`2d`);if(!m)throw Error(T());if(m.drawImage(u,f.x,f.y,f.width,f.height,0,0,f.width,f.height),t.variantFor){let e=m.getImageData(0,0,f.width,f.height);Y(e.data,f.width,f.height)?Pt(e.data,t.variantFor===`dark`?At:jt):Ft(e.data),m.putImageData(e,0,0)}let h=Y(m.getImageData(0,0,f.width,f.height).data,f.width,f.height),g=await X(p,`image/webp`,zt)??await X(p,`image/png`);if(!g)throw Error(a());return{blob:g,hasAlpha:h}}finally{o()}}async function Vt(e){if(e.type===`image/svg+xml`)return Ht(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ht(e)}async function Ht(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(ne())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function X(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Ut(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Q=`__all__`,Wt={kind:`relative`,from:`now-24h`,to:`now`},Gt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Kt(e){return e===`light`?Qe():e===`dark`?Ke():we()}var qt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Jt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:qt.map(e=>{let t=n[e];return(0,Z.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Yt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:We(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(k,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Jt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":x(),title:x(),children:(0,Z.jsx)(pt,{className:`size-4`})}):null]})}function Xt({selectedKey:e,resolvedMode:t}){let n=C(E.charts.listMyCharts),r=D(E.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:pe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Yt,{selected:e===null,title:s(),subtitle:de(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?at():n.via===`owner`?Te():st({group:n.via.group});return(0,Z.jsx)(Yt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Ut(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:tt()}):null]})}function Zt(){let e=D(E.charts.importChart),[t,n]=(0,J.useState)(``),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1),[u,d]=(0,J.useState)(!1);async function f(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{let e=await t.text();a(e)}catch{s(S())}}}async function p(){if(s(null),l(!1),t.trim()===``){s(y());return}let r;try{r=JSON.parse(i)}catch{s(S());return}d(!0);try{await e({name:t.trim(),tokens:r}),l(!0),n(``),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ie()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ue()}),(0,Z.jsx)(H,{value:t,onChange:e=>n(e.target.value),placeholder:$e(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ae()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:i,onChange:e=>a(e.target.value),placeholder:r(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(P,{className:`size-4`}),le(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void f(e)})]})}),(0,Z.jsx)(V,{size:`sm`,disabled:u,onClick:()=>void p(),children:ye()})]}),o?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:ve()}):null]})]})}function Qt({chart:e}){let t=xe(E.charts.setChartLogo),n=D(E.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,s]=(0,J.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function l(n,r,a){if(e.chartId!==void 0){s(null),i(!0);try{let{blob:i,hasAlpha:o}=await Bt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function u(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await l(e,n)}async function d(t){if(e.chartId!==void 0){s(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),i(!0);try{await l(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?ge():o()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(V,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(P,{className:`size-4`}),t?ue():ct(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void u(e,t)})]})}),!t&&n?(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:v()}):null,t?(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:ee()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:g()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(p,{mode:`light`}),(0,Z.jsx)(p,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:m()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function $t({chart:e}){let t=C(E.me.getMe,{host:W}),n=D(E.charts.addChartDomain),r=D(E.charts.removeChartDomain),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1);if(t?.role!==`admin`)return null;let d=e.domains??[];async function p(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function m(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ze()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:d.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:me()}):d.map(e=>(0,Z.jsxs)(U,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":it({domain:e}),onClick:()=>void m(e),children:(0,Z.jsx)(F,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(H,{value:i,onChange:e=>a(e.target.value),placeholder:u(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,Z.jsx)(V,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void p(),children:f()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:oe()}),o?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function en(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=D(E.charts.updateChart),n=D(E.charts.deleteChart),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.name),[s,l]=(0,J.useState)(()=>en(e.tokens)),[u,d]=(0,J.useState)(e.tokens.bpm??0),[f,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(!1);function v(){o(e.name),l(en(e.tokens)),d(e.tokens.bpm??0),m(null),i(!0)}async function y(){if(e.chartId===void 0)return;m(null);let n;try{n=JSON.parse(s)}catch{m(S());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){m(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function b(){if(e.chartId!==void 0&&window.confirm(O()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(V,{variant:`outline`,size:`sm`,onClick:v,children:_e()}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>void b(),children:he()})]})})]}),r?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:ot()}),(0,Z.jsx)(H,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:_()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":_()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?p():`${u} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:se()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:Ee()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{size:`sm`,disabled:h,onClick:()=>void y(),children:c()}),(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:fe()})]})]}):null,(0,Z.jsx)(Qt,{chart:e}),(0,Z.jsx)($t,{chart:e})]})}function nn(){let e=C(E.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ye()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:b()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:h()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=D(E.charts.addChartToGroupPool),r=D(E.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,o=new Set((a??[]).map(e=>e.groupId)),s=t.filter(e=>!o.has(e._id));async function c(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function l(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(U,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?et():e.kind===`custom`&&e.scope===`personal`?w():Oe()}),e.isGlobalDefault?(0,Z.jsx)(U,{variant:`default`,children:Be()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Ze()}),(a??[]).map(e=>(0,Z.jsxs)(U,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ce({group:e.name}),onClick:()=>void l(e.groupId),children:(0,Z.jsx)(F,{className:`size-3`})})]},e.groupId)),s.length>0?(0,Z.jsxs)(B,{value:``,onValueChange:e=>void c(e),children:[(0,Z.jsx)(L,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(I,{placeholder:Ge()})}),(0,Z.jsx)(R,{children:s.map(e=>(0,Z.jsx)(z,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:De()}):null]})]})}function an({chart:e}){let t=D(E.charts.promoteChartToCommon),n=D(E.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(O()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(U,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?He():w()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Pe({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Je()}):null,(0,Z.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Me()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=D(E.admin.setDefaultThemeMode),a=D(E.admin.setDefaultLocale),o=D(E.charts.setDefaultChart),c=C(E.charts.listChartsAdmin),u=C(E.groups.listGroups,{}),f=e??`system`,p=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:l()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:be()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void o({name:null}),children:s()}),ht.map(e=>(0,Z.jsx)(V,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(V,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void o({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Fe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(rn,{chart:e,groups:u??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:qe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)($t,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:nt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ke()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(an,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:re()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(V,{variant:f===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Kt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:Le()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:i()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:gt().map(e=>(0,Z.jsx)(V,{variant:p===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]})]})}function sn(){let e=C(E.me.getMe,{host:W}),t=mt(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Xt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)(Zt,{}),(0,Z.jsx)(nn,{}),e?.role===`admin`?(0,Z.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Q),[c,l]=(0,J.useState)(Q),[u,d]=(0,J.useState)(Wt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Wt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(sn,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:ae()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{children:`Default`}),(0,Z.jsx)(V,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(V,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(V,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(V,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(V,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(V,{size:`sm`,children:`Small`}),(0,Z.jsx)(V,{children:`Default`}),(0,Z.jsx)(V,{size:`lg`,children:`Large`}),(0,Z.jsx)(V,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(A,{})}),(0,Z.jsx)(V,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(U,{children:`Default`}),(0,Z.jsx)(U,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(U,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(U,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(H,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(B,{value:n,onValueChange:r,children:[(0,Z.jsx)(L,{className:`w-56`,children:(0,Z.jsx)(I,{placeholder:`Select…`})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(z,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(N,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(Dt,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(B,{value:o,onValueChange:s,children:[(0,Z.jsx)(L,{size:`sm`,children:(0,Z.jsx)(I,{})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(z,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(z,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(z,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(B,{value:c,onValueChange:l,children:[(0,Z.jsx)(L,{size:`sm`,children:(0,Z.jsx)(I,{})}),(0,Z.jsxs)(R,{children:[(0,Z.jsx)(z,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(z,{value:`info`,children:`info`}),(0,Z.jsx)(z,{value:`warn`,children:`warn`}),(0,Z.jsx)(z,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(Ot,{fields:Gt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(Et,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(ft,{children:[(0,Z.jsx)(lt,{asChild:!0,children:(0,Z.jsx)(V,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(A,{})})}),(0,Z.jsxs)(dt,{align:`start`,children:[(0,Z.jsx)(ut,{children:`Actions`}),(0,Z.jsx)(M,{}),(0,Z.jsx)(j,{children:`Edit`}),(0,Z.jsx)(j,{children:`Duplicate`}),(0,Z.jsx)(M,{}),(0,Z.jsx)(j,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(St,{className:`w-full max-w-80`,children:[(0,Z.jsxs)(_t,{children:[(0,Z.jsx)(bt,{children:`Instance`}),(0,Z.jsx)(xt,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(yt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(vt,{className:`gap-2`,children:[(0,Z.jsx)(V,{size:`sm`,children:`Save`}),(0,Z.jsx)(V,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(Tt,{children:[(0,Z.jsx)(Ct,{children:(0,Z.jsxs)(K,{children:[(0,Z.jsx)(G,{className:`w-8`,children:(0,Z.jsx)(N,{"aria-label":`select all`})}),(0,Z.jsx)(G,{children:`Name`}),(0,Z.jsx)(G,{children:`Mode`}),(0,Z.jsx)(G,{className:`text-right`,children:`Status`}),(0,Z.jsx)(G,{className:`w-8`})]})}),(0,Z.jsx)(wt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(K,{children:[(0,Z.jsx)(q,{children:(0,Z.jsx)(N,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(q,{className:`font-medium`,children:e.n}),(0,Z.jsx)(q,{children:(0,Z.jsx)(U,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(q,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(k,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(q,{children:(0,Z.jsx)(V,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(A,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gf as r,Jf as i,Kf as a,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gf as r,Jf as i,Kf as a,Xf as o,Yf as s,Zf as c,aA as l,cA as u,dA as d,fA as f,hA as p,iA as m,lA as h,mA as g,oA as _,pA as v,qf as y,rA as b,sA as x,uA as S}from"./api-CWqdeSbN.js";import{n as C,t as w}from"./search-Dz6sLH0-.js";import{n as T,r as E,t as D}from"./popover-C-Y_Yoco.js";import{t as O}from"./button-C_rIPtCv.js";import{t as k}from"./input-CSZu-bVE.js";import{n as A}from"./format-AQELUhPa.js";var j=t(e(),1),M={s:1e3,m:6e4,h:36e5,d:864e5,w:6048e5};function N(e,t){let n=e.trim();if(n===`now`)return t;let r=/^now-(\d+)([smhdw])$/.exec(n);if(r===null)return null;let i=Number(r[1]),a=M[r[2]];return!Number.isFinite(i)||a===void 0?null:t-i*a}function P(e,t=Date.now()){return e.kind===`absolute`?{from:e.from,to:e.to}:{from:N(e.from,t)??t-M.h,to:N(e.to,t)??t}}var F=[{label:p(),from:`now-5m`},{label:g(),from:`now-15m`},{label:v(),from:`now-30m`},{label:f(),from:`now-1h`},{label:d(),from:`now-3h`},{label:S(),from:`now-6h`},{label:h(),from:`now-12h`},{label:u(),from:`now-24h`},{label:x(),from:`now-2d`},{label:_(),from:`now-7d`},{label:l(),from:`now-30d`},{label:m(),from:`now-90d`},{label:b(),from:`now-520w`}];function I(e){return A(e,{day:`2-digit`,month:`2-digit`,hour:`2-digit`,minute:`2-digit`})}function L(e){if(e.kind===`relative`){let t=F.find(t=>t.from===e.from&&e.to===`now`);return t?t.label:`${e.from} → ${e.to}`}return`${I(e.from)} → ${I(e.to)}`}function R(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}T${n(t.getHours())}:${n(t.getMinutes())}`}function z(e){if(e===``)return null;let t=new Date(e).getTime();return Number.isNaN(t)?null:t}function B(e){let t=e.trim();return t===`true`?!0:t===`false`?!1:t!==``&&Number.isFinite(Number(t))?Number(t):e}var V=n();function H(e){let[t,n]=(0,j.useState)(0);return(0,j.useEffect)(()=>{if(e.kind!==`relative`)return;let t=window.setInterval(()=>n(e=>e+1),3e4);return()=>window.clearInterval(t)},[e.kind]),(0,j.useMemo)(()=>{let{from:t,to:n}=P(e);return e.kind===`absolute`?{from:t,to:n}:{from:U(t),to:U(n)}},[e,t])}function U(e){return Math.floor(e/6e4)*6e4}function W({value:e,onChange:t}){let[n,l]=(0,j.useState)(!1),[u,d]=(0,j.useState)(``),f=P(e),[p,m]=(0,j.useState)(()=>R(f.from)),[h,g]=(0,j.useState)(()=>R(f.to));function _(t){if(t){let t=P(e);m(R(t.from)),g(R(t.to)),d(``)}l(t)}function v(e){t({kind:`relative`,from:e,to:`now`}),l(!1)}function b(){let e=z(p),n=z(h);e===null||n===null||(t({kind:`absolute`,from:e,to:n}),l(!1))}let x=(0,j.useMemo)(()=>{let e=u.trim().toLowerCase();return e===``?F:F.filter(t=>t.label.toLowerCase().includes(e)||t.from.toLowerCase().includes(e))},[u]),S=z(p)!==null&&z(h)!==null;return(0,V.jsxs)(D,{open:n,onOpenChange:_,children:[(0,V.jsx)(E,{asChild:!0,children:(0,V.jsxs)(O,{variant:`outline`,size:`sm`,className:`oc-timerange__trigger`,children:[(0,V.jsx)(C,{}),L(e)]})}),(0,V.jsx)(T,{align:`end`,sideOffset:6,className:`oc-timerange__panel oc-overlay-layer rounded-lg border-border`,children:(0,V.jsxs)(`div`,{className:`oc-timerange__cols`,children:[(0,V.jsxs)(`div`,{className:`oc-timerange__absolute`,children:[(0,V.jsx)(`div`,{className:`oc-timerange__section-title`,children:c()}),(0,V.jsxs)(`label`,{className:`oc-field`,children:[(0,V.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,V.jsx)(k,{type:`datetime-local`,value:p,onChange:e=>m(e.target.value)})]}),(0,V.jsxs)(`label`,{className:`oc-field`,children:[(0,V.jsx)(`span`,{className:`oc-field__label`,children:s()}),(0,V.jsx)(k,{type:`datetime-local`,value:h,onChange:e=>g(e.target.value)})]}),(0,V.jsx)(O,{size:`sm`,className:`oc-timerange__apply`,disabled:!S,onClick:b,children:i()})]}),(0,V.jsxs)(`div`,{className:`oc-timerange__relative`,children:[(0,V.jsxs)(`div`,{className:`oc-timerange__search`,children:[(0,V.jsx)(w,{className:`oc-timerange__search-icon`,"aria-hidden":!0}),(0,V.jsx)(k,{value:u,onChange:e=>d(e.target.value),placeholder:y(),"aria-label":a()})]}),(0,V.jsx)(`ul`,{className:`oc-timerange__list`,children:x.length===0?(0,V.jsx)(`li`,{className:`oc-timerange__empty`,children:r()}):x.map(t=>(0,V.jsx)(`li`,{children:(0,V.jsx)(`button`,{type:`button`,className:`oc-timerange__option`+(e.kind===`relative`&&e.from===t.from&&e.to===`now`?` is-active`:``),onClick:()=>v(t.from),children:t.label})},t.from))})]})]})})]})}export{H as n,B as r,W as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{FY as r,
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{FY as r,IY as i,LY as a,PY as o}from"./api-CWqdeSbN.js";import{t as s}from"./check-DdmANHSb.js";import{t as c}from"./chevrons-up-down-CITEfz7_.js";import{n as l,r as u,t as d}from"./popover-C-Y_Yoco.js";import{t as f}from"./input-CSZu-bVE.js";/* empty css */var p=t(e(),1);function m(e){if(e==null||e===``)return`none`;let t=e.trim().toLowerCase();return t===`ok`||t===`success`||t===`completed`?`ok`:t===`error`||t===`failed`||t===`failure`?`error`:t===`running`||t===`in_progress`||t===`pending`?`running`:`other`}function h(e){return e===!0?`active`:e===!1?`paused`:`unknown`}function g(e){return typeof e.autoDisabledReason==`string`&&e.autoDisabledReason!==``?`auto-disabled`:h(e.enabled)}function _(e){return g(e)===`active`?`pause`:`resume`}var v={q:``,state:`all`,result:`all`};function y(e){return e.q.trim()!==``||e.state!==`all`||e.result!==`all`}function b(e,t){let n=t.q.trim().toLowerCase();return!(n!==``&&!`${e.name??``} ${e.agentId}`.toLowerCase().includes(n)||t.state!==`all`&&g(e)!==t.state||t.result!==`all`&&m(e.lastRunStatus)!==t.result)}function x(){try{let e=Intl.supportedValuesOf;return typeof e==`function`?e(`timeZone`):[]}catch{return[]}}function S(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone??``}catch{return``}}function C(e,t,n=50,r){let i=e=>e.toLowerCase().replace(/[_/]+/g,` `),a=i(t.trim()),o=(a===``?e:e.filter(e=>i(e).includes(a))).slice(0,n);return r&&r!==``&&!o.includes(r)?[r,...o].slice(0,n):o}function w(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=[];for(let e=0;e<42;e++){let n=new Date(r.getFullYear(),r.getMonth(),r.getDate()+e);i.push({year:n.getFullYear(),month:n.getMonth(),day:n.getDate(),inMonth:n.getMonth()===t})}return i}function T(e,t,n,r,i){let a=(e,t=2)=>String(e).padStart(t,`0`);return`${a(e,4)}-${a(t+1)}-${a(n)}T${a(r)}:${a(i)}`}function E(e){let t=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(t===null)return null;let[,n,r,i,a,o]=t;return{year:Number(n),month:Number(r)-1,day:Number(i),hour:Number(a),minute:Number(o)}}var D=n();function O({value:e,onChange:t,className:n,fallbackTz:m}){let h=(0,p.useMemo)(()=>x(),[]),[g,_]=(0,p.useState)(!1),[v,y]=(0,p.useState)(``);if(h.length===0)return(0,D.jsx)(f,{value:e,onChange:e=>t(e.target.value),placeholder:m||S()||`America/Toronto`,className:n});let b=C(h,v,h.length,e||void 0),w=e===``?m||S()||o():e;return(0,D.jsxs)(d,{modal:!0,open:g,onOpenChange:e=>{_(e),e||y(``)},children:[(0,D.jsx)(u,{asChild:!0,children:(0,D.jsxs)(`button`,{type:`button`,className:`oc-tzcombo__trigger${n?` ${n}`:``}`,"aria-label":a(),children:[(0,D.jsx)(`span`,{className:`oc-tzcombo__value`,children:w}),(0,D.jsx)(c,{size:14,"aria-hidden":!0,className:`oc-tzcombo__chev`})]})}),(0,D.jsxs)(l,{align:`start`,className:`oc-tzcombo__pop p-0`,children:[(0,D.jsx)(f,{autoFocus:!0,value:v,onChange:e=>y(e.target.value),placeholder:i(),className:`oc-tzcombo__search`}),(0,D.jsx)(`div`,{className:`oc-tzcombo__list`,role:`listbox`,children:b.length===0?(0,D.jsx)(`p`,{className:`oc-tzcombo__empty`,children:r()}):b.map(n=>(0,D.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":n===e,className:`oc-tzcombo__opt`,onClick:()=>{t(n),_(!1),y(``)},children:[(0,D.jsx)(s,{size:13,"aria-hidden":!0,className:`oc-tzcombo__check`,style:{opacity:+(n===e)}}),(0,D.jsx)(`span`,{children:n})]},n))})]})]})}export{b as a,w as c,_ as i,E as l,v as n,g as o,y as r,m as s,O as t,T as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$B as r,$M as i,AB as a,BB as o,Bd as s,CN as c,DB as l,EN as u,FB as d,GM as f,Hd as p,IB as m,JB as h,JM as g,KB as _,KM as v,LB as y,MB as b,NB as x,OB as S,PB as C,QB as ee,QM as te,RB as ne,SN as re,TN as ie,UM as ae,VB as oe,Vd as se,WM as ce,XB as le,XM as ue,YB as de,YM as fe,ZB as pe,ZM as me,_N as he,aN as ge,aV as w,bN as _e,bQ as T,cN as ve,cV as E,dN as ye,dV as D,eN as be,eV as O,fN as xe,fV as k,gN as Se,gV as A,hN as Ce,hV as j,iN as we,iV as M,jB as Te,k as Ee,kB as De,lN as Oe,lV as ke,mN as Ae,mV as je,nN as Me,nV as Ne,oN as Pe,oV as Fe,pN as Ie,pV as Le,qB as Re,qM as ze,rN as Be,rV as N,sN as Ve,sV as He,t as P,tN as Ue,tV as We,uN as Ge,uV as Ke,vN as qe,wN as Je,xN as Ye,yN as Xe,yQ as F,zB as Ze}from"./api-CWqdeSbN.js";import{n as Qe,t as $e}from"./useNavigate-D3GIoxyW.js";import{t as et}from"./check-DdmANHSb.js";import{t as tt}from"./copy-DbstFM9Q.js";import{n as nt,t as rt}from"./eye-LggiM6Z5.js";import{o as it,r as at}from"./deliveryRecorder-B_kVKMkR.js";import{t as ot}from"./x-CcIT4ync.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-CjcMQhwm.js";import{i as V,n as H,r as st,t as ct}from"./tabs-B8emuY1B.js";import{t as U}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{t as W}from"./badge-ChMMFtuW.js";import{a as lt,n as G}from"./format-AQELUhPa.js";import{a as ut,n as dt,o as ft,r as pt,t as mt}from"./dialog-CPAskUwF.js";import{c as ht,o as gt,s as _t,u as vt}from"./searchSchemas-Dm-Qg010.js";import{t as yt}from"./appHost-CH3EGcJw.js";import{n as bt}from"./TimeRangePicker-BZtw1JkM.js";import{t as K}from"./FilterBar-DCCuFxDn.js";import{t as xt}from"./AdvancedFilter-Cod8SSd6.js";import{t as St}from"./DataTableShell-DvtkASQG.js";var Ct=Ee(`scroll-text`,[[`path`,{d:`M15 12h-5`,key:`r7krc0`}],[`path`,{d:`M15 8h-5`,key:`1khuty`}],[`path`,{d:`M19 17V5a2 2 0 0 0-2-2H4`,key:`zz82l3`}],[`path`,{d:`M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3`,key:`1ph1d7`}]]),q=t(e(),1),J=n(),Y={kind:`relative`,from:`now-520w`,to:`now`},X=e=>e===null?`-`:String(Math.round(e));function wt(e){let t=e.indexOf(`:`);if(t<0)return e;let n=e.slice(0,t),r=e.slice(t+1);return n===`admin`?pe():n===`agent`?`${le()} - ${r}`:e}function Tt(){let e=T(P.me.getMe,{host:yt})?.role===`admin`,t=T(P.deliveryTiming.getDeliveryStatus,{}),n=F(P.deliveryTiming.startDeliveryRecord),r=F(P.deliveryTiming.stopDeliveryRecord),[i,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1),c=t?.recording??!1,l=async()=>{s(!0);try{c?await r({}):await n({})}finally{s(!1)}};return(0,J.jsxs)(`section`,{className:`mb-4 flex flex-col gap-3 rounded-lg border border-border p-4`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold`,children:A()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:j()})]}),e?(0,J.jsx)(U,{variant:c?`destructive`:`default`,size:`sm`,disabled:o||t===void 0,onClick:()=>void l(),children:c?Le():je()}):null]}),c?(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm`,children:[(0,J.jsx)(W,{variant:`secondary`,children:k()}),t?.startedAt?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:D({time:lt(t.startedAt)})}):null]}):null,(0,J.jsx)(`div`,{children:(0,J.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>a(e=>!e),children:i?E():ke()})}),i?(0,J.jsx)(Et,{isAdmin:e}):null]})}function Et({isAdmin:e}){let t=T(P.deliveryTiming.listDeliverySessions,{}),n=F(P.deliveryTiming.deleteDeliverySessions),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(`all`),[c,l]=(0,q.useState)(Y),[u,d]=(0,q.useState)(null),{from:f,to:p}=bt(c),m=c.to===`now`?1/0:p,g=i.trim()!==``||o!==`all`||c!==Y,_=()=>{a(``),s(`all`),l(Y)},v=(0,q.useMemo)(()=>{if(t===void 0)return;let e=i.trim().toLowerCase();return t.filter(t=>(e===``||t.startedBy.toLowerCase().includes(e))&&(o===`all`||(o===`active`?t.active:!t.active))&&t.startedAt>=f&&t.startedAt<=m).map(e=>({...e,_id:e.sessionId}))},[t,i,o,f,m]),y=e=>{let t=new Set((v??[]).map(e=>e.sessionId)),r=e.filter(e=>t.has(e));r.length!==0&&(n({sessionIds:r}),u!==null&&r.includes(u)&&d(null))};return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsx)(K,{q:i,onQChange:a,searchPlaceholder:Fe(),timeRange:c,onTimeRangeChange:l,onReset:_,canReset:g,children:(0,J.jsxs)(B,{value:o,onValueChange:e=>s(e),children:[(0,J.jsx)(L,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:`all`,children:w()}),(0,J.jsx)(z,{value:`active`,children:M()}),(0,J.jsx)(z,{value:`stopped`,children:N()})]})]})}),(0,J.jsx)(St,{title:He(),rows:v,emptyHint:S(),columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(U,{variant:`ghost`,size:`icon`,"aria-label":u===e.sessionId?h():de(),onClick:()=>d(t=>t===e.sessionId?null:e.sessionId),children:u===e.sessionId?(0,J.jsx)(nt,{size:15,"aria-hidden":!0}):(0,J.jsx)(rt,{size:15,"aria-hidden":!0})})},{header:Ne(),sort:e=>e.startedAt,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.startedAt)})},{header:We(),sort:e=>e.stoppedAt,cell:e=>e.stoppedAt===null?(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:`-`}):(0,J.jsx)(`span`,{className:`tabular-nums`,children:G(e.stoppedAt)})},{header:O(),sort:e=>e.count,cell:e=>(0,J.jsx)(`span`,{className:`tabular-nums`,children:X(e.count)})},{header:r(),sort:e=>e.startedBy,cell:e=>wt(e.startedBy)},{header:ee(),sort:e=>e.active,cell:e=>e.active?(0,J.jsx)(W,{variant:`secondary`,children:M()}):(0,J.jsx)(`span`,{className:`text-muted-foreground`,children:N()})}],rowActions:e?e=>[{label:Re(),variant:`destructive`,onSelect:()=>y([e.sessionId])}]:void 0,bulkActions:e?[{label:Re(),variant:`destructive`,onSelect:e=>y(e)}]:void 0,isExpanded:e=>e.sessionId===u,renderExpanded:e=>(0,J.jsx)(Dt,{sessionId:e.sessionId})})]})}function Dt({sessionId:e}){let t=T(P.deliveryTiming.getDeliveryReport,{sessionId:e}),[n,r]=(0,q.useState)(!1);return(0,J.jsx)(Ot,{report:t,copied:n,onCopy:()=>{t&&navigator.clipboard?.writeText(at(t)).then(()=>{r(!0),window.setTimeout(()=>r(!1),1200)}).catch(()=>{})}})}function Ot({report:e,copied:t,onCopy:n}){if(!e)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:_()});if(e.count===0||e.segments===null)return(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ke()});let r=e.segments,i=(e,t)=>(0,J.jsxs)(`tr`,{className:`border-t border-border`,children:[(0,J.jsx)(`td`,{className:`py-1`,children:e}),(0,J.jsx)(`td`,{className:`py-1 text-right tabular-nums`,children:t.count}),(0,J.jsxs)(`td`,{className:`py-1 text-right tabular-nums`,children:[X(t.p50),` / `,X(t.p95),` / `,X(t.max)]})]});return(0,J.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,J.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[e.count,` `,l()]}),(0,J.jsxs)(U,{variant:`outline`,size:`sm`,onClick:n,children:[t?(0,J.jsx)(et,{size:13,"aria-hidden":!0}):(0,J.jsx)(tt,{size:13,"aria-hidden":!0}),t?De():a()]})]}),(0,J.jsxs)(`table`,{className:`w-full text-sm`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{className:`text-left text-muted-foreground`,children:[(0,J.jsx)(`th`,{className:`py-1 font-medium`,children:Ze()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:ne()}),(0,J.jsx)(`th`,{className:`py-1 text-right font-medium`,children:y()})]})}),(0,J.jsxs)(`tbody`,{children:[i(m(),r.bridge),i(d(),r.A),i(C(),r.C)]})]}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:x()}),e.truncated?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Te()}):null,(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:b()})]})}var kt=[50,100,200,500],Z=`all`,Q=`__all__`,At=[`2xx`,`4xx`,`5xx`],jt=[`user`,`service`,`system`],Mt=[`inbound`,`outbound`,`internal`],Nt={kind:`relative`,from:`now-30d`,to:`now`},Pt=[{value:`kind`,label:`kind`},{value:`status`,label:`status`},{value:`latencyMs`,label:p()},{value:`principalType`,label:se()},{value:`direction`,label:`direction`},{value:`roleKey`,label:s()},{value:`route`,label:`route`},{value:`correlationId`,label:`correlationId`}];function Ft(){let e=Qe({from:`/settings/traces`}),t=$e({from:`/settings/traces`}),n=e.limit,r=e.kind,a=e.statusClass??Q,s=e.principalType??Q,l=e.direction??Q,d=e.roleKey??Q,f=e.q??``,p=e.correlationId,m=gt(e.from,e.to),h=(0,q.useMemo)(()=>vt(e.adv),[e.adv]),{from:_,to:y}=bt(m),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),ee=e=>void t({search:t=>({...t,limit:e})}),ne=e=>void t({search:t=>({...t,kind:e})}),ae=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),se=e=>void t({search:t=>({...t,statusClass:e===Q?void 0:e})}),ce=e=>void t({search:t=>({...t,principalType:e===Q?void 0:e})}),le=e=>void t({search:t=>({...t,direction:e===Q?void 0:e})}),de=e=>void t({search:t=>({...t,roleKey:e===Q?void 0:e})}),pe=e=>void t({search:t=>({...t,...ht(e)})}),w=e=>void t({search:t=>({...t,adv:_t(e)}),replace:!0}),E=T(P.observability.listEvents,{limit:n}),D=T(P.observability.listEvents,{limit:n,kind:r===Z?void 0:r,...p?{correlationId:p}:{},filter:{q:f||void 0,from:_,to:y,statusClass:a===Q?void 0:a,principalType:s===Q?void 0:s,direction:l===Q?void 0:l,roleKey:d===Q?void 0:d,advanced:h.length>0?h:void 0}}),O=(0,q.useMemo)(()=>{let e=new Set;for(let t of E??[])e.add(t.kind);return[...e].sort()},[E]),k=(0,q.useMemo)(()=>{let e=new Set;for(let t of E??[])t.roleKey&&e.add(t.roleKey);return[...e].sort()},[E]),A=f!==``||a!==Q||s!==Q||l!==Q||d!==Q||h.length>0||m.kind!==`relative`||m.from!==Nt.from;function j(){t({search:{limit:100,kind:`all`},replace:!0})}let M=b?E?.filter(e=>e.correlationId===b):D,Te=e.section,Ee=e=>void t({search:t=>({...t,section:e}),replace:!0});return(0,J.jsxs)(ct,{value:Te,onValueChange:e=>Ee(e),children:[(0,J.jsxs)(st,{className:`w-full`,children:[(0,J.jsxs)(V,{value:`latency`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(it,{size:13,"aria-hidden":!0}),oe()]}),(0,J.jsxs)(V,{value:`events`,className:`flex-1 gap-1.5`,children:[(0,J.jsx)(Ct,{size:13,"aria-hidden":!0}),o()]})]}),(0,J.jsx)(H,{value:`latency`,children:(0,J.jsx)(Tt,{})}),(0,J.jsxs)(H,{value:`events`,className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`p`,{className:`oc-admin__hint`,children:[u(),(0,J.jsx)(`strong`,{children:ie()}),Je(),` `,(0,J.jsx)(`span`,{className:`oc-filter__window`,children:c()})]}),(0,J.jsxs)(K,{q:f,onQChange:ae,searchPlaceholder:re(),timeRange:m,onTimeRangeChange:pe,onReset:j,canReset:A,children:[(0,J.jsxs)(B,{value:a,onValueChange:se,children:[(0,J.jsx)(L,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:Ye()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:_e()}),At.map(e=>(0,J.jsx)(z,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:s,onValueChange:ce,children:[(0,J.jsx)(L,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:Xe()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:qe()}),jt.map(e=>(0,J.jsx)(z,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:l,onValueChange:le,children:[(0,J.jsx)(L,{size:`sm`,className:`w-32`,children:(0,J.jsx)(I,{placeholder:he()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:Se()}),Mt.map(e=>(0,J.jsx)(z,{value:e,children:e},e))]})]}),(0,J.jsxs)(B,{value:d,onValueChange:de,children:[(0,J.jsx)(L,{size:`sm`,className:`w-36`,children:(0,J.jsx)(I,{placeholder:Ce()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(z,{value:Q,children:Ae()}),k.map(e=>(0,J.jsx)(z,{value:e,children:e},e))]})]}),(0,J.jsx)(`input`,{list:`oc-trace-kinds`,className:`oc-input oc-input--sm w-44`,value:r===Z?``:r,placeholder:Ie(),"aria-label":Ie(),onChange:e=>{let t=e.target.value.trim();ne(t===``?Z:t)}}),(0,J.jsx)(`datalist`,{id:`oc-trace-kinds`,children:O.map(e=>(0,J.jsx)(`option`,{value:e},e))}),(0,J.jsxs)(B,{value:String(n),onValueChange:e=>ee(Number(e)),children:[(0,J.jsx)(L,{size:`sm`,className:`w-28`,children:(0,J.jsx)(I,{})}),(0,J.jsx)(R,{children:kt.map(e=>(0,J.jsx)(z,{value:String(e),children:xe({count:e})},e))})]})]}),(0,J.jsx)(xt,{fields:Pt,seed:h,onChange:w}),b?(0,J.jsx)(`div`,{className:`oc-traces__followline`,children:(0,J.jsxs)(`button`,{type:`button`,className:`oc-traces__chip`,onClick:()=>x(null),title:ye(),children:[(0,J.jsxs)(`span`,{className:`oc-traces__chip-label`,children:[Ge(),(0,J.jsx)(`code`,{children:$(b)})]}),(0,J.jsx)(ot,{className:`oc-traces__chip-x`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`sr-only`,children:Oe()})]})}):null,(0,J.jsx)(St,{title:ve(),rows:M,emptyHint:b?Ve():Pe(),columns:[{header:ge(),sort:e=>e.at,cell:e=>(0,J.jsx)(`span`,{className:`oc-traces__time`,children:G(e.at)})},{header:we(),sort:e=>e.kind,cell:e=>(0,J.jsx)(W,{variant:`secondary`,children:e.kind})},{header:Be(),sort:e=>Lt(e)??null,cell:e=>{let t=Lt(e);return t?(0,J.jsxs)(`span`,{className:`oc-traces__fail`,title:t,children:[`✕ `,t]}):(0,J.jsx)(`span`,{className:`oc-traces__ok`,"aria-label":Me(),children:`✓`})}},{header:Ue(),sort:e=>e.direction,cell:e=>e.direction?(0,J.jsx)(W,{variant:`outline`,children:e.direction}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:be(),sort:e=>e.principalType,cell:e=>(0,J.jsxs)(`span`,{className:`oc-traces__principal`,children:[(0,J.jsx)(W,{variant:`outline`,children:e.principalType}),e.principalId?(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:$(e.principalId)}):null]})},{header:i(),sort:e=>e.roleKey,cell:e=>e.roleKey?(0,J.jsx)(W,{variant:`secondary`,children:e.roleKey}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:te(),sort:e=>e.route,cell:e=>e.route?(0,J.jsxs)(`span`,{className:`oc-traces__route`,children:[e.method?(0,J.jsx)(`span`,{className:`oc-traces__method`,children:e.method}):null,(0,J.jsx)(`code`,{className:`oc-traces__mono`,children:e.route})]}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:me(),sort:e=>e.status,cell:e=>e.status===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsx)(`span`,{className:`oc-traces__status ${It(e.status)}`,children:e.status})},{header:ue(),sort:e=>e.latencyMs,cell:e=>e.latencyMs===null?(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}):(0,J.jsxs)(`span`,{className:`oc-traces__mono`,children:[e.latencyMs,` ms`]})},{header:fe(),sort:e=>e.correlationId,cell:e=>e.correlationId?(0,J.jsx)(`button`,{type:`button`,className:`oc-traces__corr`,title:g(),onClick:()=>x(e.correlationId),children:$(e.correlationId)}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})},{header:ze(),sort:e=>+!!e.meta,cell:e=>e.meta?(0,J.jsx)(U,{variant:`outline`,size:`sm`,onClick:()=>C(e),children:v()}):(0,J.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}]}),(0,J.jsx)(Rt,{row:S,onClose:()=>C(null)})]})]})}function It(e){return e>=500?`oc-traces__status--5xx`:e>=400?`oc-traces__status--4xx`:e>=200&&e<300?`oc-traces__status--2xx`:`oc-traces__status--other`}function $(e){return e.length>8?e.slice(0,8):e}function Lt(e){if(typeof e.status==`number`&&e.status>=400)return String(e.status);if(!e.meta)return null;try{let t=JSON.parse(e.meta);if(e.kind===`openclaw.dispatch`&&t.dispatchStatus===`failed`)return t.errorCode??`failed`;if(e.kind===`assistant.stream`&&t.phase===`finalize`&&(t.streamStatus===`error`||t.streamStatus===`aborted`))return t.streamStatus;if(e.kind===`openclaw.ingest.denied`)return`denied`}catch{}return null}function Rt({row:e,onClose:t}){let n=(0,q.useMemo)(()=>{if(!e?.meta)return``;try{return JSON.stringify(JSON.parse(e.meta),null,2)}catch{return e.meta}},[e]);return(0,J.jsx)(mt,{open:e!==null,onOpenChange:e=>{e||t()},children:e?(0,J.jsxs)(dt,{className:`max-w-lg`,children:[(0,J.jsxs)(ut,{children:[(0,J.jsxs)(ft,{className:`oc-traces__meta-title`,children:[f(),` `,(0,J.jsx)(`code`,{children:e.kind}),(0,J.jsx)(W,{variant:`outline`,children:ce()})]}),(0,J.jsx)(pt,{children:ae()})]}),(0,J.jsx)(`pre`,{className:`oc-traces__meta-json`,children:n})]}):null})}export{Ft as TracesTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,BD as i,GD as a,HD as o,HM as s,JD as c,KD as l,LD as u,QD as d,RD as f,UD as p,VD as m,WD as h,XD as g,YD as _,ZD as v,bQ as y,fQ as b,k as x,nO as S,qD as C,rO as w,t as T,yQ as E,zD as D}from"./api-CWqdeSbN.js";import{t as O}from"./use_paginated_query-CebdO_HQ.js";import{t as k}from"./trash-2-xhtrhYsd.js";import{t as A}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{r as j}from"./toast-C_YfUacM.js";import{n as M}from"./format-AQELUhPa.js";import{n as N}from"./ConfirmDialog-B7k0wvSi.js";import{r as P}from"./fileMetaView-Ci5C4w9Q.js";import{r as F}from"./trashView-CwUC01r_.js";import{n as I,t as L}from"./trashPage-3suR6eIy.js";var R=x(`scan-search`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]),z=t(e(),1);function B(e,t){let n=e.find(e=>e.status===`running`&&!e.stale)??null,r=e.find(e=>e.mode===`dryRun`&&e.status===`done`)??null,i=e.find(e=>e.mode===`apply`&&(e.status===`done`||e.status===`refused`)&&(r===null||e.startedAt>r.startedAt))??null,a=null;return n===null?r===null||i!==null?a=`no_report`:r.applicableUntil===null||r.applicableUntil<=t?a=`expired`:r.mirrorMissing>0?a=`mirror`:r.orphans.count===0&&(a=`nothing`):a=`running`,{running:n,report:r,lastApply:i,applyBlock:a}}var V=n();function H(){let e=y(T.blobSweep.listBlobSweeps,{}),t=y(T.blobQuarantine.quarantineSettings,{}),n=E(T.blobSweep.startBlobSweep),x=N(),{toast:S}=j(),[w,O]=(0,z.useState)(!1),F=b(),I=e=>P(e,F),L=B(e??[],Date.now()),H=L.report,U=async e=>{O(!0);try{await e()}catch(e){S({title:u(),description:e.message,variant:`error`})}finally{O(!1)}},W=()=>U(()=>n({mode:`dryRun`})),G=async()=>{H!==null&&await x({title:m({count:H.orphans.count}),description:i({size:I(H.orphans.bytes)}),confirmLabel:o(),destructive:!0})&&await U(()=>n({mode:`apply`,confirms:H._id}))};return(0,V.jsxs)(`section`,{className:`oc-trash__body`,"aria-labelledby":`oc-blobsweep-title`,children:[(0,V.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,V.jsx)(`h3`,{id:`oc-blobsweep-title`,className:`oc-trash__heading`,children:r()}),(0,V.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,V.jsxs)(A,{variant:`outline`,size:`sm`,disabled:w||L.running!==null,onClick:()=>void W(),children:[(0,V.jsx)(R,{}),` `,v()]}),(0,V.jsxs)(A,{variant:`ghost`,size:`sm`,className:`h-auto min-h-8 shrink whitespace-normal text-left text-destructive`,disabled:w||L.applyBlock!==null,onClick:()=>void G(),children:[(0,V.jsx)(k,{}),` `,o()]})]})]}),(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:d({days:H?.minAgeDays??7,quarantine:t?.days??7})}),e===void 0?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:s()}):null,L.running===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:g({scanned:L.running.blobsScanned})}),e!==void 0&&H===null&&L.running===null?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:_()}):null,H===null?null:(0,V.jsxs)(`div`,{className:`oc-trash__hint`,children:[(0,V.jsx)(`p`,{children:c({date:M(H.finishedAt??H.startedAt),count:H.orphans.count,size:I(H.orphans.bytes),scanned:H.blobsScanned})}),(0,V.jsxs)(`ul`,{children:[(0,V.jsx)(`li`,{children:C({count:H.byOrigin.upload?.count??0,size:I(H.byOrigin.upload?.bytes??0)})}),(0,V.jsx)(`li`,{children:l({count:H.byOrigin.unregistered?.count??0,size:I(H.byOrigin.unregistered?.bytes??0)})})]}),H.importing>0?(0,V.jsx)(`p`,{children:a({count:H.importing})}):null,H.mirrorMissing>0?(0,V.jsx)(`p`,{className:`text-destructive`,children:h({count:H.mirrorMissing})}):null,L.applyBlock===`expired`?(0,V.jsx)(`p`,{children:p()}):null]}),L.lastApply===null?null:(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:L.lastApply.status===`refused`?f({date:M(L.lastApply.finishedAt??L.lastApply.startedAt)}):D({date:M(L.lastApply.finishedAt??L.lastApply.startedAt),count:L.lastApply.deleted.count,size:I(L.lastApply.deleted.bytes)})})]})}function U(){let{results:e,status:t,loadMore:n}=O(T.trash.adminListTrash,{},{initialNumItems:50}),r=F(),i=E(T.trash.adminRestoreChat),a=E(T.trash.adminPurgeChat);return(0,V.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:w({days:r})}),t===`LoadingFirstPage`?(0,V.jsx)(`p`,{className:`oc-trash__hint`,children:s()}):e.length===0?(0,V.jsx)(`p`,{className:`oc-trash__empty`,children:S()}):(0,V.jsx)(L,{items:e,onRestore:e=>i({chatId:e}),onPurge:e=>a({chatId:e})}),(0,V.jsx)(I,{status:t,loadMore:n}),(0,V.jsx)(H,{})]})}export{U as TrashTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as r,$j as i,CR as a,QL as o,Qj as s,SR as c,XL as l,ZL as u,Zj as d,_R as f,aM as p,aR as m,bQ as h,bR as ee,cM as g,cR as te,dR as ne,eM as _,eR as re,fR as ie,gR as v,hR as ae,hS as y,iM as b,iR as oe,jL as se,lM as x,lR as ce,mR as le,mS as S,nM as C,nR as ue,oM as w,oR as T,pR as de,pS as E,rM as D,rR as fe,sM as O,sR as pe,t as k,tM as A,tR as me,uR as he,vR as ge,wR as j,xR as _e,yQ as M,yR as ve}from"./api-CWqdeSbN.js";import{n as ye,t as be}from"./useNavigate-D3GIoxyW.js";import{c as N,i as P,n as F,r as xe,t as Se}from"./dropdown-menu-BVKVjups.js";import{t as I}from"./checkbox-DPxJTQjc.js";import{t as L}from"./server-DcInl3Nh.js";import{t as R}from"./star-5ysDlx3k.js";import{a as z,i as B,n as V,r as H,t as U}from"./select-CjcMQhwm.js";import{t as W}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{r as G}from"./toast-C_YfUacM.js";import{t as K}from"./badge-ChMMFtuW.js";import{a as Ce,n as we,o as Te,r as Ee,t as De}from"./dialog-CPAskUwF.js";import{t as Oe}from"./appHost-CH3EGcJw.js";import{n as ke,r as Ae}from"./ConfirmDialog-B7k0wvSi.js";import{a as q}from"./groupManageView-DC3eSLA1.js";import{a as je,o as J,t as Y}from"./AdminSettings-CtNcFhMz.js";import{t as Me}from"./FilterBar-DCCuFxDn.js";import{t as Ne}from"./DataTableShell-DvtkASQG.js";import{t as Pe}from"./DetailChips-DDAtgnjA.js";var X=t(e(),1),Z=n();function Fe({profileId:e,userLabel:t,open:n,onOpenChange:r}){let i=h(k.agents.listAgentPoolForUser,n&&e?{profileId:e}:`skip`),a=h(k.agents.listUserAgents,n&&e?{profileId:e}:`skip`),o=new Set((a??[]).map(e=>`${e.instanceName}/${e.agentId}`)),s=(a??[]).find(e=>e.isDefault)??null,c=s?`${s.instanceName}/${s.agentId}`:null,l=new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),u=[...(i?.agents??[]).map(e=>({...e,outOfPool:!1})),...(a??[]).filter(e=>!l.has(`${e.instanceName}/${e.agentId}`)).map(e=>({instanceName:e.instanceName,agentId:e.agentId,displayName:e.displayName,emoji:e.emoji,model:e.model,kind:e.kind,enabled:e.enabled,state:e.state,outOfPool:!0}))],d=new Map;for(let e of u){let t=d.get(e.instanceName)??[];t.push(e),d.set(e.instanceName,t)}return(0,Z.jsx)(De,{open:n,onOpenChange:r,children:(0,Z.jsxs)(we,{className:`oc-access`,children:[(0,Z.jsxs)(Ce,{children:[(0,Z.jsx)(Te,{children:x({user:t})}),(0,Z.jsx)(Ee,{children:g()})]}),i?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:i.inGroup?O():w()}):null,(0,Z.jsx)(`div`,{className:`oc-access__list`,children:i===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:p()}):u.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:C()}):[...d.entries()].map(([t,n])=>(0,Z.jsx)(Ie,{profileId:e,instanceName:t,kind:n[0].kind,agents:n,assigned:o,defaultKey:c},t))})]})})}function Ie({profileId:e,instanceName:t,kind:n,agents:r,assigned:a,defaultKey:o}){let c=M(k.agents.assignAgent),l=M(k.agents.removeAgent),u=M(k.agents.setDefaultAgent),f=G();if(!e)return null;async function p(n,r){try{r?await l({profileId:e,instanceName:t,agentId:n}):await c({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(b(),q(e))}}async function m(n){try{await u({profileId:e,instanceName:t,agentId:n})}catch(e){f.error(D(),q(e))}}return(0,Z.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Z.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Z.jsx)(L,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:t}),(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n})]}),r.map(e=>{let n=`${t}/${e.agentId}`,r=a.has(n),c=o===n,l=e.state===`deleted`,u=!e.enabled;return(0,Z.jsxs)(`div`,{className:`oc-access__row oc-reveal-host${u?` is-disabled`:``}`,children:[(0,Z.jsx)(I,{checked:r,disabled:(l||u)&&!r,onCheckedChange:()=>void p(e.agentId,r),"aria-label":A({name:e.displayName??e.agentId})}),(0,Z.jsxs)(`span`,{className:`oc-access__label`,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,l?(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:_()}):null,e.outOfPool?(0,Z.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:i()}):null,r?c?(0,Z.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":s(),title:s(),children:(0,Z.jsx)(R,{size:14,fill:`currentColor`})}):(0,Z.jsx)(W,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault oc-reveal oc-hit`,"aria-label":d(),title:d(),disabled:u,onClick:()=>void m(e.agentId),children:(0,Z.jsx)(R,{size:14})}):null]},e.agentId)})]})}var Q=`__all__`;function $(e){switch(e){case`pending`:return E();case`user`:return S();case`admin`:return y();default:return e}}function Le({granted:e,onToggle:t}){let n=new Set(e),r=Y.filter(e=>n.has(J[e])).length;return(0,Z.jsxs)(Se,{children:[(0,Z.jsx)(N,{asChild:!0,children:(0,Z.jsx)(W,{variant:`outline`,size:`sm`,className:`h-8 w-36 justify-start font-normal`,children:r===0?j():a({count:r})})}),(0,Z.jsxs)(F,{align:`start`,className:`w-52`,children:[(0,Z.jsx)(P,{children:c()}),Y.map(e=>{let r=J[e];return(0,Z.jsxs)(xe,{className:`gap-2`,onSelect:e=>{e.preventDefault(),t(r)},children:[(0,Z.jsx)(I,{checked:n.has(r),"aria-hidden":!0,tabIndex:-1,className:`pointer-events-none`}),(0,Z.jsx)(`span`,{children:je[e]()})]},e)})]})]})}function Re(){let e=ye({from:`/settings/users`}),t=be({from:`/settings/users`}),n=e.q??``,i=e.role??Q,a=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),s=e=>void t({search:t=>({...t,role:e===Q?void 0:e})}),c=h(k.admin.listUsers,{filter:{q:n||void 0,role:i===Q?void 0:i},withAgents:!0}),d=h(k.me.getMe,{host:Oe}),p=M(k.admin.setRole),g=M(k.admin.setUserPermissions),_=M(k.admin.startImpersonation),y=M(k.admin.deleteUser),b=M(k.admin.setUserName),x=ke(),S=Ae(),C=G(),[w,E]=(0,X.useState)(null),D=(0,X.useMemo)(()=>{let e=new Set([`pending`,`user`,`admin`]);for(let t of c??[])e.add(t.role);return[...e]},[c]),O=n!==``||i!==Q;function A(){t({search:{},replace:!0})}async function j(e){try{await p(e)}catch(e){C.error(_e(),e)}}async function N(e){try{await g(e)}catch(e){C.error(ee(),e)}}async function P(e){let t=e.email||e.name||e.canonical||e.userId.slice(0,8);if(await x({title:de(),description:ie({user:t}),confirmWord:ne(),confirmLabel:he(),destructive:!0}))try{await y({profileId:e._id}),C.success(te({user:t}))}catch(e){C.error(ce(),e)}}async function F(e){let t=e.email||e.name||e.userId.slice(0,8),n=await S({title:T(),label:m({user:t}),placeholder:oe(),defaultValue:e.name??``,confirmLabel:se()});if(n!==null)try{await b({profileId:e._id,name:n}),C.success(fe())}catch(e){C.error(ue(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Me,{q:n,onQChange:a,searchPlaceholder:ve(),onReset:A,canReset:O,children:(0,Z.jsxs)(U,{value:i,onValueChange:s,children:[(0,Z.jsx)(B,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:Q,children:ge()}),D.map(e=>(0,Z.jsx)(H,{value:e,children:$(e)},e))]})]})}),(0,Z.jsx)(Ne,{title:f(),rows:c,emptyHint:v(),rowActions:e=>{let t=[{label:l(),onSelect:()=>E({profileId:e._id,label:e.email||e.name||e.canonical||e.userId.slice(0,8)})},{label:pe(),onSelect:()=>void F(e)}];return e.userId!==d?.userId&&t.push({label:ae(),onSelect:()=>void _({profileId:e._id})},{label:le(),variant:`destructive`,onSelect:()=>void P(e)}),t},columns:[{header:me(),cell:e=>{let t=e.email||e.name||e.canonical||e.userId.slice(0,8),n=e.email&&e.name&&e.name!==e.email?e.name:null;return(0,Z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Z.jsx)(`span`,{children:t}),n?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:n}):null]})},sort:e=>e.email||e.name||e.canonical||e.userId},{header:re(),sort:e=>e.role===`admin`?2:+(e.role===`user`),cell:e=>(0,Z.jsxs)(U,{value:e.role,onValueChange:t=>void j({profileId:e._id,role:t}),children:[(0,Z.jsx)(B,{size:`sm`,className:`w-28`,children:(0,Z.jsx)(z,{})}),(0,Z.jsxs)(V,{children:[(0,Z.jsx)(H,{value:`pending`,children:$(`pending`)}),(0,Z.jsx)(H,{value:`user`,children:$(`user`)}),(0,Z.jsx)(H,{value:`admin`,children:$(`admin`)})]})]})},{header:r(),sort:e=>e.role===`admin`?9999:e.extraPermissions?.length??0,cell:e=>e.role===`admin`?(0,Z.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:o()}):(0,Z.jsx)(Le,{granted:e.extraPermissions??[],onToggle:t=>{let n=new Set(e.extraPermissions??[]);n.has(t)?n.delete(t):n.add(t),N({profileId:e._id,permissions:[...n]})}})},{header:u(),cell:e=>(0,Z.jsx)(Pe,{icon:(0,Z.jsx)(L,{size:12,"aria-hidden":!0}),total:e.agentCount??0,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount??0}]}),(0,Z.jsx)(Fe,{profileId:w?.profileId??null,userLabel:w?.label??``,open:w!==null,onOpenChange:e=>{e||E(null)}})]})}export{Re as UsersTab};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,Bu as i,Cl as a,Dl as o,El as s,Fl as c,Gu as l,Hu as u,Iu as d,Ju as f,Ku as ee,Lu as p,Ml as m,Nl as h,Ol as g,Oz as _,Pl as v,Qu as y,Ru as te,Sl as ne,Tl as re,Ul as b,Uu as x,Vu as S,Wu as C,Xu as w,Yu as ie,Yv as ae,Zu as oe,Zv as se,_Q as ce,ad as le,bQ as T,bb as E,bl as ue,cl as de,ed as D,fQ as fe,id as pe,jl as me,lQ as O,nd as he,od as ge,qu as k,rd as A,t as j,td as M,xl as N,yQ as P,zu as F}from"./api-CWqdeSbN.js";import{n as I,t as L}from"./useNavigate-D3GIoxyW.js";import{a as _e,c as R,d as ve,f as ye,i as be,l as z,m as xe,o as Se,p as Ce,r as we}from"./speech-ehUcmGCg.js";import{t as B}from"./checkbox-DPxJTQjc.js";import{a as V,i as H,n as U,r as W,t as G}from"./select-CjcMQhwm.js";import{i as K,n as q,r as Te,t as Ee}from"./tabs-B8emuY1B.js";import{t as J}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{t as Y}from"./badge-ChMMFtuW.js";import{t as X}from"./appHost-CH3EGcJw.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>r()],[`fr-FR`,()=>c()],[`en-US`,()=>v()],[`en-GB`,()=>h()],[`de-DE`,()=>m()],[`es-ES`,()=>me()]],Oe=[[`0.75`,()=>oe()],[`1`,()=>w()],[`1.25`,()=>ie()],[`1.5`,()=>f()]],$=0;function ke({instance:e}){let t=P(j.admin.upsertInstanceConfig),n=e.config??{},r={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[i,o]=(0,Z.useState)(r),[s,c]=(0,Z.useState)(`idle`),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),m=ce(j.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{o({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),c(`idle`)},[e._id]);let h=i.enabled!==r.enabled||i.engine!==r.engine||i.lang!==r.lang||i.rate!==r.rate||i.autoRead!==r.autoRead;async function g(){c(`saving`);try{let n={...e.config??{}};n.voiceEnabled=i.enabled,i.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,i.lang===`auto`?delete n.voiceLang:n.voiceLang=i.lang;let r=Number.parseFloat(i.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,i.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),c(`idle`)}catch{c(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(Y,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(B,{checked:i.enabled,onCheckedChange:e=>o({...i,enabled:e===!0}),"aria-label":M()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:M()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:a()}),(0,Q.jsxs)(G,{value:i.engine,onValueChange:e=>o({...i,engine:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":a(),children:(0,Q.jsx)(V,{})}),(0,Q.jsxs)(U,{children:[(0,Q.jsx)(W,{value:`browser`,children:ne()}),e.kind===`hermes`?null:(0,Q.jsx)(W,{value:`gateway`,children:N()})]})]})]}),i.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ue()}):null,i.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()}),(0,Q.jsxs)(G,{value:i.lang,onValueChange:e=>o({...i,lang:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":D(),children:(0,Q.jsx)(V,{})}),(0,Q.jsx)(U,{children:De.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:y()}),(0,Q.jsxs)(G,{value:i.rate,onValueChange:e=>o({...i,rate:e}),disabled:!i.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":y(),children:(0,Q.jsx)(V,{})}),(0,Q.jsx)(U,{children:Oe.map(([e,t])=>(0,Q.jsx)(W,{value:e,children:t()},e))})]})]}),i.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(B,{checked:i.autoRead,onCheckedChange:e=>o({...i,autoRead:e===!0}),disabled:!i.enabled,"aria-label":k()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(J,{size:`sm`,disabled:!h||s===`saving`,onClick:()=>void g(),children:s===`saving`?E():se()}),(0,Q.jsx)(J,{variant:`outline`,size:`sm`,disabled:!i.enabled||u,onClick:()=>{let t=Number.parseFloat(i.rate)||1,n=++$;if(p(!1),z(),R(),i.engine!==`gateway`){Se(x(),{lang:_e(i.lang,fe()),rate:t});return}d(!0),m({instanceName:e.name,text:x()}).then(({mime:e,audioBase64:r})=>{n===$&&be(r,e,{rate:t})}).catch(()=>{n===$&&p(!0)}).finally(()=>d(!1))},children:u?E():l()}),(0,Q.jsx)(J,{variant:`ghost`,size:`sm`,onClick:()=>{$++,d(!1),z(),R()},children:C()})]}),s===`error`||f?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:f?de():ae()}):null]})}function Ae({stt:e}){let t=T(j.me.getMe,{host:X}),n=P(j.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,a=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:S()}),(0,Q.jsx)(Y,{variant:e?`secondary`:`outline`,children:e?p():d()}),(0,Q.jsx)(Y,{variant:r?`secondary`:`destructive`,children:r?o():s()})]}),a?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(B,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":g()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]})}function je(){let e=T(j.admin.listInstances,{}),t=(0,Z.useMemo)(()=>ve(),[]),n=(0,Z.useMemo)(()=>we(),[]),{section:r}=I({from:`/settings/voice`}),i=L({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(Y,{variant:t?`secondary`:`destructive`,className:`h-auto shrink whitespace-normal text-left`,children:t?le():pe()}),(0,Q.jsx)(Y,{variant:n?`secondary`:`destructive`,className:`h-auto shrink whitespace-normal text-left`,children:n?A():he()})]}),(0,Q.jsxs)(Ee,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(Te,{className:`w-full`,children:[(0,Q.jsxs)(K,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(ye,{size:13,"aria-hidden":!0}),re()]}),(0,Q.jsxs)(K,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Ce,{size:13,"aria-hidden":!0}),S()]}),(0,Q.jsxs)(K,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(xe,{size:13,"aria-hidden":!0}),F()]})]}),(0,Q.jsx)(q,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(q,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(q,{value:`talk`,children:[(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:F()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:te()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=P(j.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,i=e.kind===`hermes`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(Y,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:b()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(B,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":_()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]})]})}export{je as VoiceTab};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{E as r,O as i,i as a,o,v as s,x as c}from"./api-
|
|
1
|
+
import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{E as r,O as i,i as a,o,v as s,x as c}from"./api-CWqdeSbN.js";import{a as l,c as u,i as d,l as f,n as p,o as ee,r as m,s as h,t as g,u as _}from"./dist-Uf18yR_a.js";import{n as v}from"./button-C_rIPtCv.js";var y=t(e(),1),b=n(),x=`AlertDialog`,[S,te]=s(x,[_]),C=_(),w=e=>{let{__scopeAlertDialog:t,...n}=e,r=C(t);return(0,b.jsx)(ee,{...r,...n,modal:!0})};w.displayName=x;var T=`AlertDialogTrigger`,E=y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=C(n);return(0,b.jsx)(u,{...i,...r,ref:t})});E.displayName=T;var D=`AlertDialogPortal`,O=e=>{let{__scopeAlertDialog:t,...n}=e,r=C(t);return(0,b.jsx)(l,{...r,...n})};O.displayName=D;var k=`AlertDialogOverlay`,A=y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=C(n);return(0,b.jsx)(d,{...i,...r,ref:t})});A.displayName=k;var j=`AlertDialogContent`,[M,N]=S(j),P=r(`AlertDialogContent`),F=y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...a}=e,o=C(n),s=y.useRef(null),l=i(t,s),u=y.useRef(null);return(0,b.jsx)(f,{contentName:j,titleName:I,docsSlug:`alert-dialog`,children:(0,b.jsx)(M,{scope:n,cancelRef:u,children:(0,b.jsxs)(p,{role:`alertdialog`,...o,...a,ref:l,onOpenAutoFocus:c(a.onOpenAutoFocus,e=>{e.preventDefault(),u.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,b.jsx)(P,{children:r}),(0,b.jsx)(ne,{contentRef:s})]})})})});F.displayName=j;var I=`AlertDialogTitle`,L=y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=C(n);return(0,b.jsx)(h,{...i,...r,ref:t})});L.displayName=I;var R=`AlertDialogDescription`,z=y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=C(n);return(0,b.jsx)(m,{...i,...r,ref:t})});z.displayName=R;var B=`AlertDialogAction`,V=y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=C(n);return(0,b.jsx)(g,{...i,...r,ref:t})});V.displayName=B;var H=`AlertDialogCancel`,U=y.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:a}=N(H,n),o=C(n),s=i(t,a);return(0,b.jsx)(g,{...o,...r,ref:s})});U.displayName=H;var ne=({contentRef:e})=>{let t=`\`${j}\` requires a description for the component to be accessible for screen reader users.
|
|
2
2
|
|
|
3
3
|
You can add a description to the \`${j}\` by passing a \`${R}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
|
|
4
4
|
|