@lacneu/atrium 0.84.17 → 0.84.18

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.
Files changed (63) hide show
  1. package/dist/assets/{AccessTab-DhFQZGzx.js → AccessTab-C4qktb9N.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-DhMwg7nB.js → AdvancedFilter-DzABuYe4.js} +1 -1
  3. package/dist/assets/AgentFilesTab-tv2KHmyO.js +3 -0
  4. package/dist/assets/{AnomaliesTab-DRPqd0B0.js → AnomaliesTab-POfetzRk.js} +1 -1
  5. package/dist/assets/{AuditTab-CoJzgU4A.js → AuditTab-DNtJSFCG.js} +1 -1
  6. package/dist/assets/{BridgeTab-Cyq6ii7O.js → BridgeTab-CzyyKpM3.js} +1 -1
  7. package/dist/assets/{ChatDefaultsTab-ffTdOd77.js → ChatDefaultsTab-B0YNJjM5.js} +1 -1
  8. package/dist/assets/{DataTableShell-C0MSDiic.js → DataTableShell-DGGSIwCx.js} +1 -1
  9. package/dist/assets/{DetailChips-V2Qp_G9Y.js → DetailChips-DTzXBtIX.js} +1 -1
  10. package/dist/assets/{FeedbacksTab-4P7NTQHQ.js → FeedbacksTab-BJvVbEdR.js} +1 -1
  11. package/dist/assets/{FieldLabel-CrPuHD7O.js → FieldLabel-CEa671vG.js} +1 -1
  12. package/dist/assets/FilesTab-B79u5xo1.js +1 -0
  13. package/dist/assets/{FilterBar-Of8GWz2N.js → FilterBar-D_6ObXjr.js} +1 -1
  14. package/dist/assets/{GroupsTab-JG0ZRFjT.js → GroupsTab-FU1hfvWY.js} +1 -1
  15. package/dist/assets/{InstancesTab-Z4FtEPKO.js → InstancesTab-D0YmHvV-.js} +1 -1
  16. package/dist/assets/{IntegrationsTab-Cwaeqx7m.js → IntegrationsTab-BEVGWeVW.js} +1 -1
  17. package/dist/assets/KpiTab-BLkA1s66.js +1 -0
  18. package/dist/assets/PreferencesTab-D56grf46.js +1 -0
  19. package/dist/assets/ProjectPage-C9wOIZOD.js +1 -0
  20. package/dist/assets/{PromptInjectionsTab-netn591W.js → PromptInjectionsTab-X6VRyQUy.js} +2 -2
  21. package/dist/assets/RolesTab-Dunonnsb.js +1 -0
  22. package/dist/assets/ScheduledTab-DCpRYvbc.js +1 -0
  23. package/dist/assets/{ServiceAccountsTab-CfyqKLAB.js → ServiceAccountsTab-D2TjT-Y0.js} +1 -1
  24. package/dist/assets/{SubAgentReportsTab-Z3ozWsvu.js → SubAgentReportsTab-C0O27eOL.js} +1 -1
  25. package/dist/assets/{ThemeShowroom-CJH5AUOa.js → ThemeShowroom-CbWueTmW.js} +1 -1
  26. package/dist/assets/{TimeRangePicker-Cq_PGNzt.js → TimeRangePicker-DVMsYipt.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-n6rUGOTZ.js → TimezoneCombobox-D1Wotasq.js} +1 -1
  28. package/dist/assets/TracesTab-CHxsnBQk.js +1 -0
  29. package/dist/assets/{UsersTab-B3TSVToM.js → UsersTab-OinNV3dC.js} +1 -1
  30. package/dist/assets/VoiceTab-C-4Z4mUZ.js +1 -0
  31. package/dist/assets/api-Dawxt_aS.js +44 -0
  32. package/dist/assets/{button-CTuIl1H-.js → button-alklyZ2M.js} +1 -1
  33. package/dist/assets/{card-Bf8slN_1.js → card-CDvn9R5v.js} +1 -1
  34. package/dist/assets/chevrons-up-down-CFK9IaHn.js +1 -0
  35. package/dist/assets/{compatView-DGV2AVAR.js → compatView-C9_KgDNH.js} +1 -1
  36. package/dist/assets/{dispatchErrorInfo-ZyhGCDRg.js → dispatchErrorInfo-d7ehNfS4.js} +1 -1
  37. package/dist/assets/{dist-BA_3OmOa.js → dist-C3BrQPF_.js} +1 -1
  38. package/dist/assets/{dist-uRF7WBqM.js → dist-DlDq3K4D.js} +1 -1
  39. package/dist/assets/{highlighted-body-OFNGDK62-PQt_lrzL.js → highlighted-body-OFNGDK62-BytsI_cI.js} +1 -1
  40. package/dist/assets/{index-D48cFy6f.js → index-C-ySA5Hs.js} +61 -61
  41. package/dist/assets/{list-CntaIhDp.js → list-Bs_wfimY.js} +1 -1
  42. package/dist/assets/mermaid-GHXKKRXX-CBJEr4Xn.js +1 -0
  43. package/dist/assets/{pdf-BpJ-W-U1.js → pdf-DRZjZEuv.js} +1 -1
  44. package/dist/assets/roleDescriptions-C21oVyp7.js +1 -0
  45. package/dist/assets/{table-D0yilGWI.js → table-CJ3_5RvQ.js} +1 -1
  46. package/dist/assets/{tabs-KQ0HdNTL.js → tabs-D-3HavQe.js} +1 -1
  47. package/dist/assets/x-BSVAMcNy.js +1 -0
  48. package/dist/index.html +6 -6
  49. package/package.json +1 -1
  50. package/dist/assets/AgentFilesTab-4sCRfaeL.js +0 -3
  51. package/dist/assets/FilesTab-DhNYdwv6.js +0 -1
  52. package/dist/assets/KpiTab-CW4PL5Q2.js +0 -1
  53. package/dist/assets/PreferencesTab-CWPxzO4u.js +0 -1
  54. package/dist/assets/ProjectPage-DMyEKLjd.js +0 -1
  55. package/dist/assets/RolesTab-BEQu-Exi.js +0 -1
  56. package/dist/assets/ScheduledTab-DwU5L2Il.js +0 -1
  57. package/dist/assets/TracesTab-DNfS8ryM.js +0 -1
  58. package/dist/assets/VoiceTab-DiKi0oXO.js +0 -1
  59. package/dist/assets/api-DRlXTl06.js +0 -44
  60. package/dist/assets/chevrons-up-down-BCCw67LL.js +0 -1
  61. package/dist/assets/mermaid-GHXKKRXX-CiGFgQis.js +0 -1
  62. package/dist/assets/roleDescriptions-CoFSIkRg.js +0 -1
  63. package/dist/assets/x-BM-3QiyY.js +0 -1
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$D as i,$E as a,$i as o,AD as s,AE as c,Ac as l,BD as u,BE as d,CD as f,CE as p,DD as m,DE as h,ED as g,EE as _,FD as ee,FE as v,G as te,GD as y,GE as b,H as ne,HD as re,HE as x,ID as ie,IE as S,J as ae,JD as oe,JE as C,K as se,KD as ce,KE as w,LD as le,MD as ue,ME as de,ND as fe,NE as pe,OD as me,OE as he,Oc as ge,PD as _e,PE as ve,Q as ye,QD as be,QE as xe,RD as Se,RE as T,SD as Ce,SE as we,TD as Te,TE as Ee,U as De,UD as E,UE as D,VD as Oe,VE as O,W as ke,WD as Ae,WE as je,X as Me,XD as Ne,XE as Pe,Y as Fe,YD as Ie,YE as Le,Z as Re,ZD as ze,ZE as Be,_D as Ve,_E as He,aD as Ue,aV as k,bD as A,bE as We,cD as Ge,dD as Ke,eD as qe,eO as Je,eS as Ye,ea as Xe,et as Ze,fD as Qe,gD as $e,gE as et,hD as tt,hE as j,iD as nt,iP as M,it as rt,jD as it,jE as at,jc as ot,kD as st,kE as ct,kc as lt,lD as N,mD as ut,mE as dt,nD as ft,nO as pt,nt as mt,oD as ht,oV as P,pD as gt,q as _t,qD as vt,qE as yt,rD as bt,rO as xt,rP as St,rV as F,rt as Ct,sD as wt,t as I,tD as Tt,tO as Et,tS as Dt,ta as Ot,tt as kt,uD as At,vD as jt,vE as Mt,wD as Nt,wE as Pt,xD as Ft,xE as It,yD as Lt,yE as Rt,zD as zt,zE as Bt}from"./api-DRlXTl06.js";import{a as Vt,c as Ht}from"./FieldLabel-CrPuHD7O.js";import{t as L}from"./button-CTuIl1H-.js";import{$ as R,Bt as Ut,Dt as z,Et as B,Q as V,Rt as Wt,U as Gt,X as H,Z as U,_ as Kt,at as W,et as G,jt as K,nt as q,ot as qt,rt as Jt,tt as Yt,ut as Xt,zt as Zt}from"./index-D48cFy6f.js";import{t as Qt}from"./DataTableShell-C0MSDiic.js";import{InstanceConfigDialog as $t}from"./BridgeTab-Cyq6ii7O.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],en=new Set(Y),tn=`conversational`;function nn(e){let t=new Set((e??[]).filter(e=>en.has(e)));return t.size===0?[tn]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,systemIdentity:``,streamTransport:Vt},rn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function an(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function on(){let e=P(I.admin.listInstances,{}),t=P(I.agents.listAllInstanceAgents,{}),n=k(I.admin.upsertInstance),a=k(I.admin.deleteInstance),c=z(),[l,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(Z),[h,_]=(0,J.useState)(null),[v,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null);async function de(){try{await n({instanceId:C??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,...f.kind===`openclaw`?{authMode:f.authMode,personScopes:f.personScopes,identitySource:f.identitySource,systemIdentity:f.systemIdentity||void 0}:{},streamTransport:f.streamTransport}),p(Z),w(null),d(!1)}catch(e){c.error(Et(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[Je(),(0,X.jsx)(`strong`,{children:i()}),be()]}),(0,X.jsx)(Qt,{title:ze(),rows:e,addLabel:Ne(),onAdd:()=>{w(null),p(Z),d(!0)},emptyHint:Ie(),columns:[{header:oe(),cell:e=>e.name,sort:e=>e.name},{header:vt(),cell:e=>(0,X.jsx)(B,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ce(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:y(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:xt(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(B,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?j():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Oe(),onSelect:()=>{w(e._id),p(an(e)),d(!0)}},{label:pt(),onSelect:()=>_(e.name)},{label:g(),onSelect:()=>S(e)},{label:Ae(),onSelect:()=>b(e)},{label:E(),variant:`destructive`,onSelect:()=>void a({instanceId:e._id})}],bulkActions:[{label:E(),variant:`destructive`,onSelect:e=>e.forEach(e=>void a({instanceId:e}))}]}),(0,X.jsx)(Kt,{open:l,onOpenChange:d,title:C?u():re(),description:Se(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:de,submitLabel:le(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:ie(),children:[(0,X.jsx)(K,{value:f.name,disabled:C!==null,onChange:e=>p({...f,name:e.target.value})}),C?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:zt()}):null]}),(0,X.jsx)($,{label:ee(),children:(0,X.jsxs)(H,{value:f.kind,onValueChange:e=>p({...f,kind:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(V,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,X.jsx)($,{label:Ot(),children:(0,X.jsxs)(H,{value:f.transport,onValueChange:e=>p({...f,transport:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`ws`,children:Xe()}),(0,X.jsx)(V,{value:`rest`,children:o()})]})]})}):null,(0,X.jsx)($,{label:_e(),children:(0,X.jsx)(K,{value:f.gatewayUrl,onChange:e=>p({...f,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:fe(),children:(0,X.jsx)(K,{value:f.bridgeUrl,placeholder:ue(),onChange:e=>p({...f,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:it(),children:(0,X.jsx)(K,{value:f.displayName,onChange:e=>p({...f,displayName:e.target.value})})}),(0,X.jsxs)($,{label:Dt(),children:[(0,X.jsxs)(H,{value:f.streamTransport,onValueChange:e=>p({...f,streamTransport:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsx)(U,{children:Ht.map(e=>(0,X.jsx)(V,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ye()})]}),(0,X.jsx)($,{label:s(),children:(0,X.jsx)(K,{value:f.gatewayVersion,placeholder:st(),onChange:e=>p({...f,gatewayVersion:e.target.value})})}),f.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:ae(),children:[(0,X.jsxs)(H,{value:f.authMode,onValueChange:e=>p({...f,authMode:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`token`,children:_t()}),(0,X.jsx)(V,{value:`trusted-proxy`,children:se()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.authMode===`trusted-proxy`?ke():te()})]}),f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:rt(),children:[(0,X.jsxs)(H,{value:f.personScopes,onValueChange:e=>p({...f,personScopes:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`capped`,children:Ct()}),(0,X.jsx)(V,{value:`full`,children:mt()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.personScopes===`full`?Ze():kt()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:r(),children:[(0,X.jsxs)(H,{value:f.identitySource,onValueChange:e=>p({...f,identitySource:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`canonical`,children:ye()}),(0,X.jsx)(V,{value:`email`,children:Re()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.identitySource===`email`?Fe():Me()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsx)($,{label:De(),children:(0,X.jsx)(K,{value:f.systemIdentity,placeholder:ne(),onChange:e=>p({...f,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:me(),children:(0,X.jsx)(K,{value:f.gatewayHttpUrl,placeholder:m(),onChange:e=>p({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(hn,{instanceName:h,open:h!==null,onOpenChange:e=>{e||_(null)}}),v?(0,X.jsx)($t,{instance:v,onClose:()=>b(null)},v._id):null,x?(0,X.jsx)(sn,{instance:x,onClose:()=>S(null)},x._id):null]})}function sn({instance:e,onClose:t}){let n=P(I.instanceSecrets.listInstanceSecretStatus,{}),r=rn[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(Yt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(q,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(W,{children:[(0,X.jsx)(qt,{children:Te({instance:e.displayName??e.name})}),(0,X.jsx)(Jt,{children:Nt()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(un,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(ln,{instance:e})}),(0,X.jsx)(cn,{instance:e})]})})}function cn({instance:e}){let t=F(I.instanceSync.forceInstanceSync),n=z(),[r,i]=(0,J.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(nt());break;case`no_agents`:n.success(ft());break;case`no_bridge_url`:n.error(Tt());break;case`deploy_misconfigured`:n.error(qe());break;case`unauthorized`:n.error(xe());break;case`not_served`:n.error(Be());break;default:n.error(a());break}}catch(e){n.error(bt(),e)}finally{i(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?Ue():ht()})})]})}function ln({instance:e}){let t=P(I.bridgeAuth.listBridgeAuthStatus,{}),n=F(I.bridgeAuth.mintBridgeSecret),r=k(I.bridgeAuth.revokeBridgeSecret),i=z(),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(D(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(je())}catch(e){i.error(D(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,X.jsxs)($,{label:Le(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(B,{variant:f?`outline`:`secondary`,children:f?`${A()} · ${d.prefix}…${d.lastFour}`:Lt()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(L,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?w():yt()}),f?(0,X.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:b()}):null]})]}),s?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:x()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,X.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?M():St()})]}),(0,X.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:O()})]}):null]})}function un({instanceId:e,field:t,updatedAt:n}){let r=F(I.instanceSecrets.setInstanceSecret),i=k(I.instanceSecrets.clearInstanceSecret),a=F(I.deviceIdentity.generateDeviceIdentity),o=z(),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=n!==null,_=t===`deviceIdentity`,ee=t===`token`?f():t===`deviceIdentity`?Ce():Ft();async function v(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(ut())}catch(e){o.error(gt(),e)}finally{u(!1)}}}async function te(){if(!l){u(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(Qe())}catch(e){o.error(gt(),e)}finally{u(!1)}}}async function y(){if(!l){u(!0);try{p(await a({instanceId:e})),h(!1),o.success(N())}catch(e){o.error(wt(),e)}finally{u(!1)}}}let b=d?`openclaw devices approve ${d.id}`:``;async function ne(){if(b)try{await navigator.clipboard.writeText(b),h(!0)}catch{}}return(0,X.jsxs)($,{label:ee,children:[_?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:At()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(B,{variant:g?`outline`:`secondary`,children:g?A():Lt()}),(0,X.jsx)(K,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?Ve():jt(),onChange:e=>c(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(L,{size:`sm`,onClick:()=>void v(),disabled:l||s.trim().length===0,children:$e()}),_?(0,X.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void y(),disabled:l,children:Ke()}):null,g?(0,X.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void te(),disabled:l,children:tt()}):null]})]}),d?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:N()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:b}),(0,X.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void ne(),children:m?M():St()})]}),(0,X.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:O()})]}):null]})}var dn={conversational:c,documentary:he,summarizer:ot,curator:lt},fn={conversational:ct,documentary:h,summarizer:l,curator:ge},Q=e=>(dn[e]??(()=>e))(),pn=e=>(fn[e]??(()=>``))();function mn({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:ve()}),t.map(e=>(0,X.jsx)(B,{variant:`secondary`,className:`oc-agenttype__chip`,title:pn(e),children:Q(e)},e)),(0,X.jsxs)(Wt,{children:[(0,X.jsx)(Ut,{asChild:!0,children:(0,X.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:pe()})}),(0,X.jsxs)(Zt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:de()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:at()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(Xt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Q(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:pn(r)})]})]},r)})})]})]})]})}function hn({instanceName:e,open:t,onOpenChange:n}){let r=P(I.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(I.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=k(I.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=k(I.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=nn(r);e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=k(I.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=k(I.agents.removeInstanceAgent),l=Gt(),u=z();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(T(),e)}}async function m(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(T(),e)}}async function h(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(T(),e)}}async function g(t,n){if(e&&await l({title:Pt({name:n}),description:p(),confirmLabel:we(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(It())}catch(e){u.error(T(),e)}}return(0,X.jsx)(Yt,{open:t,onOpenChange:n,children:(0,X.jsxs)(q,{className:`oc-access`,children:[(0,X.jsxs)(W,{children:[(0,X.jsx)(qt,{children:d({name:e??``})}),(0,X.jsx)(Jt,{children:Bt()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:We()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Rt():r.discovery.lastPollOk?Mt():He({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:et()}):(0,X.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(Xt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(B,{variant:`outline`,className:`oc-access__gone`,children:dt()}),(0,X.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(t.agentId,a),children:Ee()})]}):i?(0,X.jsx)(B,{variant:`default`,children:j()}):(0,X.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void m(t.agentId),children:_()})]}),t.enabled?(0,X.jsx)(mn,{agentId:t.agentId,types:o,onToggle:e=>void h(t.agentId,e,o)}):null,t.enabled?(0,X.jsx)(gn,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){u.error(T(),e)}}}):null]},t.agentId)})})]})]})})}function gn({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(K,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:S(),"aria-label":v(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{on as InstancesTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$D as i,$E as a,$i as o,AD as s,AE as c,Ac as l,BD as u,BE as d,CD as f,CE as p,DD as m,DE as h,ED as g,EE as _,FD as ee,FE as v,G as te,GD as y,GE as b,H as ne,HD as re,HE as x,ID as ie,IE as S,J as ae,JD as oe,JE as C,K as se,KD as ce,KE as w,LD as le,MD as ue,ME as de,ND as fe,NE as pe,OD as me,OE as he,Oc as ge,PD as _e,PE as ve,Q as ye,QD as be,QE as xe,RD as Se,RE as T,SD as Ce,SE as we,TD as Te,TE as Ee,U as De,UD as E,UE as D,VD as Oe,VE as O,W as ke,WD as Ae,WE as je,X as Me,XD as Ne,XE as Pe,Y as Fe,YD as Ie,YE as Le,Z as Re,ZD as ze,ZE as Be,_D as Ve,_E as He,aD as Ue,bD as k,bE as We,cD as Ge,dD as Ke,eD as qe,eO as Je,eS as Ye,ea as Xe,et as Ze,fD as Qe,gD as $e,gE as et,hD as tt,hE as A,iD as nt,iP as j,iV as M,it as rt,jD as it,jE as at,jc as ot,kD as st,kE as ct,kc as lt,lD as N,mD as ut,mE as dt,nD as ft,nO as pt,nt as mt,oD as ht,oV as P,pD as gt,q as _t,qD as vt,qE as yt,rD as bt,rO as xt,rP as St,rt as Ct,sD as wt,sV as F,t as I,tD as Tt,tO as Et,tS as Dt,ta as Ot,tt as kt,uD as At,vD as jt,vE as Mt,wD as Nt,wE as Pt,xD as Ft,xE as It,yD as Lt,yE as Rt,zD as zt,zE as Bt}from"./api-Dawxt_aS.js";import{a as Vt,c as Ht}from"./FieldLabel-CEa671vG.js";import{t as L}from"./button-alklyZ2M.js";import{$ as R,Bt as Ut,Dt as z,Et as B,Q as V,Rt as Wt,U as Gt,X as H,Z as U,_ as Kt,at as W,et as G,jt as K,nt as q,ot as qt,rt as Jt,tt as Yt,ut as Xt,zt as Zt}from"./index-C-ySA5Hs.js";import{t as Qt}from"./DataTableShell-DGGSIwCx.js";import{InstanceConfigDialog as $t}from"./BridgeTab-CzyyKpM3.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],en=new Set(Y),tn=`conversational`;function nn(e){let t=new Set((e??[]).filter(e=>en.has(e)));return t.size===0?[tn]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,systemIdentity:``,streamTransport:Vt},rn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function an(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function on(){let e=F(I.admin.listInstances,{}),t=F(I.agents.listAllInstanceAgents,{}),n=P(I.admin.upsertInstance),a=P(I.admin.deleteInstance),c=z(),[l,d]=(0,J.useState)(!1),[f,p]=(0,J.useState)(Z),[h,_]=(0,J.useState)(null),[v,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null);async function de(){try{await n({instanceId:C??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,...f.kind===`openclaw`?{authMode:f.authMode,personScopes:f.personScopes,identitySource:f.identitySource,systemIdentity:f.systemIdentity||void 0}:{},streamTransport:f.streamTransport}),p(Z),w(null),d(!1)}catch(e){c.error(Et(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[Je(),(0,X.jsx)(`strong`,{children:i()}),be()]}),(0,X.jsx)(Qt,{title:ze(),rows:e,addLabel:Ne(),onAdd:()=>{w(null),p(Z),d(!0)},emptyHint:Ie(),columns:[{header:oe(),cell:e=>e.name,sort:e=>e.name},{header:vt(),cell:e=>(0,X.jsx)(B,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ce(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:y(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:xt(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(B,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?A():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Oe(),onSelect:()=>{w(e._id),p(an(e)),d(!0)}},{label:pt(),onSelect:()=>_(e.name)},{label:g(),onSelect:()=>S(e)},{label:Ae(),onSelect:()=>b(e)},{label:E(),variant:`destructive`,onSelect:()=>void a({instanceId:e._id})}],bulkActions:[{label:E(),variant:`destructive`,onSelect:e=>e.forEach(e=>void a({instanceId:e}))}]}),(0,X.jsx)(Kt,{open:l,onOpenChange:d,title:C?u():re(),description:Se(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:de,submitLabel:le(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:ie(),children:[(0,X.jsx)(K,{value:f.name,disabled:C!==null,onChange:e=>p({...f,name:e.target.value})}),C?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:zt()}):null]}),(0,X.jsx)($,{label:ee(),children:(0,X.jsxs)(H,{value:f.kind,onValueChange:e=>p({...f,kind:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(V,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,X.jsx)($,{label:Ot(),children:(0,X.jsxs)(H,{value:f.transport,onValueChange:e=>p({...f,transport:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`ws`,children:Xe()}),(0,X.jsx)(V,{value:`rest`,children:o()})]})]})}):null,(0,X.jsx)($,{label:_e(),children:(0,X.jsx)(K,{value:f.gatewayUrl,onChange:e=>p({...f,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:fe(),children:(0,X.jsx)(K,{value:f.bridgeUrl,placeholder:ue(),onChange:e=>p({...f,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:it(),children:(0,X.jsx)(K,{value:f.displayName,onChange:e=>p({...f,displayName:e.target.value})})}),(0,X.jsxs)($,{label:Dt(),children:[(0,X.jsxs)(H,{value:f.streamTransport,onValueChange:e=>p({...f,streamTransport:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsx)(U,{children:Ht.map(e=>(0,X.jsx)(V,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Ye()})]}),(0,X.jsx)($,{label:s(),children:(0,X.jsx)(K,{value:f.gatewayVersion,placeholder:st(),onChange:e=>p({...f,gatewayVersion:e.target.value})})}),f.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:ae(),children:[(0,X.jsxs)(H,{value:f.authMode,onValueChange:e=>p({...f,authMode:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`token`,children:_t()}),(0,X.jsx)(V,{value:`trusted-proxy`,children:se()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.authMode===`trusted-proxy`?ke():te()})]}),f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:rt(),children:[(0,X.jsxs)(H,{value:f.personScopes,onValueChange:e=>p({...f,personScopes:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`capped`,children:Ct()}),(0,X.jsx)(V,{value:`full`,children:mt()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.personScopes===`full`?Ze():kt()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:r(),children:[(0,X.jsxs)(H,{value:f.identitySource,onValueChange:e=>p({...f,identitySource:e}),children:[(0,X.jsx)(R,{size:`sm`,className:`w-full`,children:(0,X.jsx)(G,{})}),(0,X.jsxs)(U,{children:[(0,X.jsx)(V,{value:`canonical`,children:ye()}),(0,X.jsx)(V,{value:`email`,children:Re()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:f.identitySource===`email`?Fe():Me()})]}):null,f.authMode===`trusted-proxy`?(0,X.jsx)($,{label:De(),children:(0,X.jsx)(K,{value:f.systemIdentity,placeholder:ne(),onChange:e=>p({...f,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:me(),children:(0,X.jsx)(K,{value:f.gatewayHttpUrl,placeholder:m(),onChange:e=>p({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(hn,{instanceName:h,open:h!==null,onOpenChange:e=>{e||_(null)}}),v?(0,X.jsx)($t,{instance:v,onClose:()=>b(null)},v._id):null,x?(0,X.jsx)(sn,{instance:x,onClose:()=>S(null)},x._id):null]})}function sn({instance:e,onClose:t}){let n=F(I.instanceSecrets.listInstanceSecretStatus,{}),r=rn[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(Yt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(q,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(W,{children:[(0,X.jsx)(qt,{children:Te({instance:e.displayName??e.name})}),(0,X.jsx)(Jt,{children:Nt()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(un,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(ln,{instance:e})}),(0,X.jsx)(cn,{instance:e})]})})}function cn({instance:e}){let t=M(I.instanceSync.forceInstanceSync),n=z(),[r,i]=(0,J.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(nt());break;case`no_agents`:n.success(ft());break;case`no_bridge_url`:n.error(Tt());break;case`deploy_misconfigured`:n.error(qe());break;case`unauthorized`:n.error(xe());break;case`not_served`:n.error(Be());break;default:n.error(a());break}}catch(e){n.error(bt(),e)}finally{i(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?Ue():ht()})})]})}function ln({instance:e}){let t=F(I.bridgeAuth.listBridgeAuthStatus,{}),n=M(I.bridgeAuth.mintBridgeSecret),r=P(I.bridgeAuth.revokeBridgeSecret),i=z(),[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),f=d!==void 0;async function p(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(D(),e)}finally{o(!1)}}}async function m(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(je())}catch(e){i.error(D(),e)}finally{o(!1)}}}async function h(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,X.jsxs)($,{label:Le(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:C()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(B,{variant:f?`outline`:`secondary`,children:f?`${k()} · ${d.prefix}…${d.lastFour}`:Lt()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(L,{size:`sm`,onClick:()=>void p(),disabled:a,children:f?w():yt()}),f?(0,X.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void m(),disabled:a,children:b()}):null]})]}),s?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:x()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,X.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:l?j():St()})]}),(0,X.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:O()})]}):null]})}function un({instanceId:e,field:t,updatedAt:n}){let r=M(I.instanceSecrets.setInstanceSecret),i=P(I.instanceSecrets.clearInstanceSecret),a=M(I.deviceIdentity.generateDeviceIdentity),o=z(),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1),g=n!==null,_=t===`deviceIdentity`,ee=t===`token`?f():t===`deviceIdentity`?Ce():Ft();async function v(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(ut())}catch(e){o.error(gt(),e)}finally{u(!1)}}}async function te(){if(!l){u(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(Qe())}catch(e){o.error(gt(),e)}finally{u(!1)}}}async function y(){if(!l){u(!0);try{p(await a({instanceId:e})),h(!1),o.success(N())}catch(e){o.error(wt(),e)}finally{u(!1)}}}let b=d?`openclaw devices approve ${d.id}`:``;async function ne(){if(b)try{await navigator.clipboard.writeText(b),h(!0)}catch{}}return(0,X.jsxs)($,{label:ee,children:[_?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:At()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(B,{variant:g?`outline`:`secondary`,children:g?k():Lt()}),(0,X.jsx)(K,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?Ve():jt(),onChange:e=>c(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(L,{size:`sm`,onClick:()=>void v(),disabled:l||s.trim().length===0,children:$e()}),_?(0,X.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void y(),disabled:l,children:Ke()}):null,g?(0,X.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void te(),disabled:l,children:tt()}):null]})]}),d?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:N()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Ge()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:b}),(0,X.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void ne(),children:m?j():St()})]}),(0,X.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:O()})]}):null]})}var dn={conversational:c,documentary:he,summarizer:ot,curator:lt},fn={conversational:ct,documentary:h,summarizer:l,curator:ge},Q=e=>(dn[e]??(()=>e))(),pn=e=>(fn[e]??(()=>``))();function mn({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:ve()}),t.map(e=>(0,X.jsx)(B,{variant:`secondary`,className:`oc-agenttype__chip`,title:pn(e),children:Q(e)},e)),(0,X.jsxs)(Wt,{children:[(0,X.jsx)(Ut,{asChild:!0,children:(0,X.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:pe()})}),(0,X.jsxs)(Zt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:de()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:at()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(Xt,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Q(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:pn(r)})]})]},r)})})]})]})]})}function hn({instanceName:e,open:t,onOpenChange:n}){let r=F(I.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=P(I.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=P(I.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=P(I.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=nn(r);e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=P(I.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(I.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=P(I.agents.removeInstanceAgent),l=Gt(),u=z();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(T(),e)}}async function m(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(T(),e)}}async function h(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(T(),e)}}async function g(t,n){if(e&&await l({title:Pt({name:n}),description:p(),confirmLabel:we(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(It())}catch(e){u.error(T(),e)}}return(0,X.jsx)(Yt,{open:t,onOpenChange:n,children:(0,X.jsxs)(q,{className:`oc-access`,children:[(0,X.jsxs)(W,{children:[(0,X.jsx)(qt,{children:d({name:e??``})}),(0,X.jsx)(Jt,{children:Bt()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:We()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Rt():r.discovery.lastPollOk?Mt():He({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:et()}):(0,X.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(Xt,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(B,{variant:`outline`,className:`oc-access__gone`,children:dt()}),(0,X.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void g(t.agentId,a),children:Ee()})]}):i?(0,X.jsx)(B,{variant:`default`,children:A()}):(0,X.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void m(t.agentId),children:_()})]}),t.enabled?(0,X.jsx)(mn,{agentId:t.agentId,types:o,onToggle:e=>void h(t.agentId,e,o)}):null,t.enabled?(0,X.jsx)(gn,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){u.error(T(),e)}}}):null]},t.agentId)})})]})]})})}function gn({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(K,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:S(),"aria-label":v(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{on as InstancesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bk as r,Fk as i,Gk as a,Gl as o,Hk as s,Ik as c,Jk as l,Jl as u,Kk as d,Kl as f,Lk as p,Ql as m,Rk as h,Uk as g,Vk as _,Wk as v,Wl as y,Xl as b,Yl as x,Zl as S,aV as C,oV as w,qk as T,ql as E,rV as D,t as O,zk as k}from"./api-DRlXTl06.js";import{t as A}from"./button-CTuIl1H-.js";import{Et as j,jt as M,ut as N}from"./index-D48cFy6f.js";var P=t(e(),1),F=n();function I(){let e=w(O.integrations.status.status,{}),t=C(O.admin.setIntegrationConfig),[n,o]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&o(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:l()});let u=n,f=(e,t,n)=>o({...u,[e]:{...u[e],[t]:n}}),y=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,F.jsx)(`strong`,{children:d()}),` `,a()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:s()}),note:_(),children:[(0,F.jsx)(R,{label:k(),children:(0,F.jsx)(M,{value:u.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>f(`langfuse`,`host`,e.target.value),onBlur:()=>y(`langfuse`,{host:u.langfuse.host??``})})}),(0,F.jsx)(z,{label:i(),checked:u.langfuse.enabled??!0,onChange:e=>{f(`langfuse`,`enabled`,e),y(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:s()}),note:r(),children:[(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:u.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>f(`opik`,`baseUrl`,e.target.value),onBlur:()=>y(`opik`,{baseUrl:u.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:u.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||c(),onChange:e=>f(`opik`,`workspace`,e.target.value),onBlur:()=>y(`opik`,{workspace:u.opik.workspace??``})})}),(0,F.jsx)(z,{label:i(),checked:u.opik.enabled??!0,onChange:e=>{f(`opik`,`enabled`,e),y(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:S(),children:[(0,F.jsx)(R,{label:b(),children:(0,F.jsx)(M,{value:u.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>f(`otlp`,`endpoint`,e.target.value),onBlur:()=>y(`otlp`,{endpoint:u.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:i(),checked:u.otlp.enabled??!0,onChange:e=>{f(`otlp`,`enabled`,e),y(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=D(O.integrations.otlpSecret.setOtlpHeaders),n=C(O.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),d=async()=>{l(!0),s(null);try{await t({headersJson:r}),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:x(),children:[(0,F.jsx)(M,{value:r,placeholder:e?u():E(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void d(),children:f()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:o()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:y()})]})}export{I as IntegrationsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bk as r,Fk as i,Gk as a,Gl as o,Hk as s,Ik as c,Jk as l,Jl as u,Kk as d,Kl as f,Lk as p,Ql as m,Rk as h,Uk as g,Vk as _,Wk as v,Wl as y,Xl as b,Yl as x,Zl as S,iV as C,oV as w,qk as T,ql as E,sV as D,t as O,zk as k}from"./api-Dawxt_aS.js";import{t as A}from"./button-alklyZ2M.js";import{Et as j,jt as M,ut as N}from"./index-C-ySA5Hs.js";var P=t(e(),1),F=n();function I(){let e=D(O.integrations.status.status,{}),t=w(O.admin.setIntegrationConfig),[n,o]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&o(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:l()});let u=n,f=(e,t,n)=>o({...u,[e]:{...u[e],[t]:n}}),y=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,F.jsx)(`strong`,{children:d()}),` `,a()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:s()}),note:_(),children:[(0,F.jsx)(R,{label:k(),children:(0,F.jsx)(M,{value:u.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>f(`langfuse`,`host`,e.target.value),onBlur:()=>y(`langfuse`,{host:u.langfuse.host??``})})}),(0,F.jsx)(z,{label:i(),checked:u.langfuse.enabled??!0,onChange:e=>{f(`langfuse`,`enabled`,e),y(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:s()}),note:r(),children:[(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:u.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>f(`opik`,`baseUrl`,e.target.value),onBlur:()=>y(`opik`,{baseUrl:u.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:u.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||c(),onChange:e=>f(`opik`,`workspace`,e.target.value),onBlur:()=>y(`opik`,{workspace:u.opik.workspace??``})})}),(0,F.jsx)(z,{label:i(),checked:u.opik.enabled??!0,onChange:e=>{f(`opik`,`enabled`,e),y(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:v()}):(0,F.jsx)(j,{variant:`outline`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:S(),children:[(0,F.jsx)(R,{label:b(),children:(0,F.jsx)(M,{value:u.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>f(`otlp`,`endpoint`,e.target.value),onBlur:()=>y(`otlp`,{endpoint:u.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:i(),checked:u.otlp.enabled??!0,onChange:e=>{f(`otlp`,`enabled`,e),y(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=C(O.integrations.otlpSecret.setOtlpHeaders),n=w(O.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),d=async()=>{l(!0),s(null);try{await t({headersJson:r}),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:x(),children:[(0,F.jsx)(M,{value:r,placeholder:e?u():E(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void d(),children:f()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:o()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:y()})]})}export{I as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AA as r,MA as i,SA as a,_b as o,ab as s,cb as c,db as l,fb as u,gb as d,hb as f,ib as p,jA as m,kA as h,lb as g,mb as _,ob as v,pb as ee,rj as te,sV as y,sb as b,t as x,ub as S,vb as C,xA as w}from"./api-Dawxt_aS.js";import{Gn as T,Kn as E,i as D,o as O,q as ne,r as re}from"./index-C-ySA5Hs.js";import{a as k,n as A,o as j,r as M,t as N}from"./card-CDvn9R5v.js";import{n as P,t as F}from"./TimeRangePicker-DVMsYipt.js";var I=t(e(),1),L={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},R=Object.keys(L).length,z=n(),B=15,V=e=>String(Math.round(e));function H(){let e=y(x.me.getMe,{host:ne})?.permissions?.includes(`traces.read`)??!1,t=y(x.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,I.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,B).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:te()}),(0,z.jsxs)(N,{children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{children:i()}),(0,z.jsx)(M,{children:r()})]}),(0,z.jsx)(A,{children:n.length<2?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):(0,z.jsx)(U,{series:n})})]})]})}function U({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),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,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,z.jsxs)(`span`,{style:{color:`var(--primary)`},children:[w(),` p50 `,V(l.cP50),` `,m()]}),(0,z.jsxs)(`span`,{children:[a(),` p50 `,V(l.aP50),` `,m()]})]}),(0,z.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":i(),children:[(0,z.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,z.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var W=[{metric:`api.calls`,label:C(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:o(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:d(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:f(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:_(),unit:`/h`,group:`Chat`,isError:!1},{metric:L.ASSISTANT_STREAM_ERRORS,label:ee(),unit:`/h`,group:`Assistant`,isError:!0},{metric:L.ASSISTANT_ANNOUNCE_ERRORS,label:u(),unit:`/h`,group:`Assistant`,isError:!0}],G=R,K=[`API`,`OpenClaw`,`Chat`,`Assistant`],q=1e3,J=36e5;function Y(e,t){let n=Math.max(1,Math.ceil((t-e)/J)),r=Math.min(n*G,q);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/G))}}function ie(){let e=E({from:`/settings/kpi`}),t=T({from:`/settings/kpi`}),n=D(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...O(e)})}),{from:i,to:a}=P(n),{rowLimit:o,buckets:s}=Y(i,a),u=y(x.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),d=(0,I.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>s&&e.set(t,n.slice(n.length-s));return e},[u,s]),f=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),` `,(0,z.jsx)(`span`,{className:`oc-filter__window`,children:S()})]}),(0,z.jsx)(ae,{value:n,onChange:r})]});return u===void 0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:g()})]}):u.length===0?(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}):(0,z.jsxs)(z.Fragment,{children:[f,(0,z.jsx)(H,{}),K.map(e=>{let t=W.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,z.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,z.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,z.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,z.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function ae({value:e,onChange:t}){return(0,z.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,z.jsx)(F,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,z.jsxs)(N,{size:`sm`,className:`oc-kpi__card`,children:[(0,z.jsxs)(k,{children:[(0,z.jsx)(j,{className:`oc-kpi__card-title`,children:e.label}),(0,z.jsx)(M,{className:`oc-kpi__card-metric`,children:(0,z.jsx)(`code`,{children:e.metric})})]}),(0,z.jsxs)(A,{className:`oc-kpi__card-body`,children:[(0,z.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,z.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,z.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,z.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,z.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,z.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:b({value:$(n.bucket)})}):(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:v()}),(0,z.jsx)(`span`,{className:`oc-kpi__muted`,children:s({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,z.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,z.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":p({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,z.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,z.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ie as KpiTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,$n as i,AB as a,AF as o,BB as s,BF as c,CB as l,CF as u,DB as d,DF as f,EB as ee,EF as p,FB as m,FF as h,GF as te,HB as ne,HF as re,IB as ie,IF as ae,JF as oe,Jn as se,KF as ce,LB as le,LD as ue,LF as de,MB as fe,MF as pe,NB as me,NF as he,OB as ge,OF as _e,PB as ve,PF as g,QB as _,QF as v,Qn as y,RB as b,RF as x,SB as S,SF as C,TB as w,TF as T,UB as E,UF as D,VB as O,VF as k,WB as A,WF as j,XF as M,Xn as N,YF as P,Yn as F,ZF as ye,Zn as be,_F as xe,bF as Se,eI as Ce,er as we,gF as Te,hr as Ee,jB as De,jF as Oe,kB as ke,kF as I,lr as Ae,mr as je,oV as L,qB as Me,qF as Ne,r as R,sV as z,t as B,tI as Pe,tr as Fe,vF as Ie,wB as Le,wF as Re,xB as ze,xF as Be,yF as Ve,zB as He,zF as Ue}from"./api-Dawxt_aS.js";import{t as V}from"./button-alklyZ2M.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-C-ySA5Hs.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-D1Wotasq.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>Pe()},{id:`composer`,label:()=>Ce()},{id:`sidebar`,label:()=>r()},{id:`notifications`,label:()=>ae()},{id:`other`,label:()=>v()}],X={showSource:{category:`messages`,label:()=>ye(),help:()=>M()},showReport:{category:`messages`,label:()=>P(),help:()=>oe()},copyAssistant:{category:`messages`,label:()=>Ne()},copyUser:{category:`messages`,label:()=>ce()},showDelete:{category:`messages`,label:()=>te()},showTools:{category:`messages`,label:()=>j(),help:()=>D()},voiceInput:{category:`composer`,label:()=>re(),help:()=>k()},showUsage:{category:`composer`,label:()=>c(),help:()=>Ue()},autoReadAloud:{category:`composer`,label:()=>Ee(),help:()=>je()},showChatAge:{category:`sidebar`,label:()=>x(),help:()=>de()},notifSound:{category:`notifications`,label:()=>h(),help:()=>g()},notifSystem:{category:`notifications`,label:()=>he(),help:()=>pe()},replySound:{category:`notifications`,label:()=>Oe(),help:()=>o()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>Se()};function ut({prefKey:e,ui:t}){let n=L(B.admin.setUiPrefDefault),r=L(B.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:Re()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:Ie()}),(0,J.jsx)(U,{value:`off`,children:xe()}),(0,J.jsx)(U,{value:`inherit`,children:Te()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":u()}),u()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=L(B.me.setDictationShortcut),[r,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[Fe(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?y():r?i():we()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:se()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?F():e?N():be()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=z(B.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=L(B.me.setUiPref).withOptimisticUpdate(Je),c=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":T()}),T()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:C()}),(0,J.jsx)(`p`,{children:Be()}),(0,J.jsx)(`p`,{children:Ve()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:I(),"aria-label":I(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:_e()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:f()}):l?(0,J.jsx)(H,{variant:`secondary`,children:Ae()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:p()}):null,(0,J.jsx)(nt,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:_()})}var pt={sm:()=>fe(),md:()=>De(),lg:()=>a(),xl:()=>ke(),"2xl":()=>ge(),"3xl":()=>d()};function mt(){let e=z(B.me.getMe,{host:G}),t=L(B.me.setLocale),n=L(B.me.setTimezone),r=L(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:G});n&&e.setQuery(B.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=L(B.me.setMyName),a=Ke(),o=e?.locale??`default`,c=e?.name??``,[u,d]=(0,q.useState)(null),f=u??c,p=f.trim()!==c.trim();async function h(){try{await i({name:f}),d(null),a.success(s())}catch(e){a.error(He(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:E()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:ne(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),h())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void h(),children:ue()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:O()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:b()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:o===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:o==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:Me()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ie()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ee()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:w()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:Le()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:m()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:S()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ze()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$v as r,By as i,Ct as a,Cy as o,D as s,Ey as c,Fv as l,Fy as u,Hv as d,Iv as f,Jv as p,Lv as ee,My as m,Nv as te,Oy as h,Pv as g,Py as _,QB as v,Qv as y,Rg as ne,Rv as b,St as re,Sy as ie,Ty as ae,Uv as oe,Vv as x,Vy as se,Xv as ce,Yv as le,_y as ue,ay as de,by as fe,cy as pe,dy as S,ey as me,fy as C,gy as he,iy as ge,jv as w,jy as _e,ly as ve,my as ye,ny as be,oV as T,oy as E,py as D,qv as xe,ry as Se,sV as O,sy as k,t as A,ty as j,uy as Ce,vy as we,wy as Te,yy as M,zv as N,zy as Ee}from"./api-Dawxt_aS.js";import{t as De}from"./list-Bs_wfimY.js";import{t as P}from"./button-alklyZ2M.js";import{A as Oe,An as ke,Bn as Ae,C as je,D as F,Dt as Me,E as Ne,Ft as Pe,Gn as I,Hn as Fe,It as Ie,J as Le,Kn as Re,Lt as ze,Mn as Be,Mt as Ve,Nn as He,Nt as Ue,O as L,P as We,Pn as Ge,Pt as R,S as Ke,Sn as qe,T as Je,Tn as Ye,U as Xe,W as Ze,Y as Qe,_ as $e,b as z,bn as et,d as tt,dn as nt,f as rt,g as B,h as V,j as H,jn as U,jt as W,k as it,kn as G,m as at,p as ot,qn as st,v as K,vn as ct,w as lt,wn as ut,x as q,y as dt,yn as J}from"./index-C-ySA5Hs.js";var ft=s(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),pt=s(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),mt=s(`layout-grid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),Y=s(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":N(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Ge,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:a,onOpen:s}){let u=T(A.projects.renameProject),f=T(A.projects.setProjectColor),p=T(A.projects.moveProject),ee=T(A.projects.deleteProject),m=T(A.projects.createProject),te=Xe(),h=Ze(),[_,v]=(0,X.useState)(!1),[y,ne]=(0,X.useState)(t),[re,oe]=(0,X.useState)(!1),[ce,ue]=(0,X.useState)(!1),de=O(A.projects.projectTreeCount,ce?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{onOpenChange:e=>e&&ue(!0),children:[(0,Z.jsx)(ht,{className:a}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>s(),children:[(0,Z.jsx)(U,{}),` `,ie()]}),(0,Z.jsxs)(R,{onSelect:()=>{ne(t),v(!0)},children:[(0,Z.jsx)(et,{}),` `,b()]}),(0,Z.jsxs)(R,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await h({title:D(),label:se(),placeholder:i(),confirmLabel:Ee()});t&&await m({name:t,parentId:e})})},children:[(0,Z.jsx)(ke,{}),` `,D()]}),(0,Z.jsxs)(R,{onSelect:()=>oe(!0),children:[(0,Z.jsx)(pt,{}),` `,le()]}),(0,Z.jsx)(Pe,{children:l()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void f({projectId:e,color:null}),"aria-label":g(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void f({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=de?.folders??0,r=de?.chats??0;await te({title:ae({name:t}),description:n>0?o({folders:n,chats:r}):r>0?Te({count:r}):d(),confirmWord:x(),confirmLabel:c(),destructive:!0})&&await ee({projectId:e})})},children:[(0,Z.jsx)(nt,{}),` `,x()]})]})]}),(0,Z.jsx)($e,{open:_,onOpenChange:v,title:_e(),canSubmit:y.trim().length>0,onSubmit:async()=>{await u({projectId:e,name:y.trim()}),v(!1)},submitLabel:b(),children:(0,Z.jsx)(W,{value:y,onChange:e=>ne(e.target.value),autoFocus:!0})}),re?(0,Z.jsx)(ot,{open:re,onOpenChange:oe,title:xe(),movingFolderId:e,currentId:r,onPick:t=>void p({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let r=T(A.chats.pinChat),i=T(A.chats.deleteChat),a=T(A.chats.renameChat),o=T(A.chats.setChatSidebar),s=T(A.chats.moveChatToProject),c=Xe(),[l,u]=(0,X.useState)(!1),[m,h]=(0,X.useState)(e.title??``),[g,_]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(R,{onSelect:()=>{h(e.title??``),u(!0)},children:[(0,Z.jsx)(et,{}),` `,b()]}),(0,Z.jsxs)(R,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ct,{}):(0,Z.jsx)(J,{}),e.pinned?ee():f()]}),(0,Z.jsxs)(R,{onSelect:()=>_(!0),children:[(0,Z.jsx)(pt,{}),` `,ce()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(R,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{}),e.inSidebar?M():fe()]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:te(),description:d(),confirmLabel:x(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)(nt,{}),` `,x()]})]})]}),(0,Z.jsx)($e,{open:l,onOpenChange:u,title:w(),canSubmit:m.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:m.trim()}),u(!1)},submitLabel:b(),children:(0,Z.jsx)(W,{value:m,onChange:e=>h(e.target.value),autoFocus:!0})}),g?(0,Z.jsx)(ot,{open:g,onOpenChange:_,title:p(),currentId:t,onPick:t=>void s({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function yt(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Tt(){let{projectId:e}=st({from:`/project/$projectId`}),t=I(),n=O(A.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:v()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:j()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:me()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:r()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=I(),n=Xe(),r=Ze(),s=Me(),f=T(A.projects.renameProject),p=T(A.projects.setProjectColor),ee=T(A.projects.deleteProject),te=T(A.projects.createProject),h=T(A.projects.moveProject),_=T(A.projects.setProjectSidebar),v=T(A.chats.moveChatToProject),ie=T(A.chats.reorderChat),ce=T(A.projects.reorderProject),fe=O(A.projects.projectTreeCount,{projectId:e.project._id}),[S,me]=(0,X.useState)(xt),C=e=>{localStorage.setItem(bt,e),me(e)},w=O(A.projects.folderColumns,S===`columns`?{projectId:e.project._id}:`skip`),E=O(A.projects.projectTreeList,S===`list`?{projectId:e.project._id}:`skip`),{c:k}=Re({from:`/project/$projectId`}),j=O(A.projects.listProjects,{}),M=O(A.chatReads.myBusyChats,{}),N=(0,X.useMemo)(()=>new Set(M??[]),[M]),Ae=O(A.chatReads.myChatReads,{}),Fe=(0,X.useMemo)(()=>yt(e.chats,Ae??[]),[e.chats,Ae]),{startNewChat:L,picker:qe}=tt(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[z,rt]=(0,X.useState)(``),[V,H]=(0,X.useState)(!1),[U,st]=(0,X.useState)(e.project.name),[ct,J]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(z.trim()),180);return()=>clearTimeout(e)},[z]);let Q=O(A.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=Oe(it(lt,{activationConstraint:{distance:4}}),it(Je,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=w?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||u()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(j??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=F(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=F(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=F(n(`crumb:`));if(a.length>0)return a;let o=F(n(`col:`));return o.length>0?o:Ne(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(S===`columns`){for(let e of w?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(S===`list`){let e=E?.chats.find(e=>e._id===t);return e?{list:E.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Pt=t=>{if(S===`columns`){for(let e of w?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(S===`list`){let e=E?.folders.find(e=>e._id===t);if(!e||!E)return null;let n=e.parentId??E.rootId;return{list:Qe(E.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(a)await v({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Le(j??[],t,e)){s.error(ye());return}await h({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await v({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ie({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Le(j??[],e,n.parentId)){s.error(ye());return}await h({projectId:e,parentId:n.parentId})}let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await ce({projectId:e,...a});return}}catch{s.error(ye())}},[,Lt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=B(e.project),Bt=_t(e.chats,z),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ke,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":y(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(P,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:a(),onClick:()=>{_({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(He,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:re()}),(0,Z.jsx)(Be,{"aria-hidden":!0})]}):null,(0,Z.jsxs)(`div`,{className:`oc-projpage__actions`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__viewtoggle`,role:`group`,"aria-label":we(),children:[(0,Z.jsx)(P,{variant:S===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":we(),title:we(),"aria-pressed":S===`cards`,onClick:()=>C(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(P,{variant:S===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ue(),title:ue(),"aria-pressed":S===`columns`,onClick:()=>C(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(P,{variant:S===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":he(),title:he(),"aria-pressed":S===`list`,onClick:()=>C(`list`),children:(0,Z.jsx)(De,{})})]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void L({projectId:e.project._id}),children:[(0,Z.jsx)(Ye,{}),pe()]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await r({title:D(),label:se(),placeholder:i(),confirmLabel:Ee()});t&&await te({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(ke,{}),D()]}),(0,Z.jsxs)(Ve,{children:[(0,Z.jsx)(ze,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":m(),children:(0,Z.jsx)(Ge,{})})}),(0,Z.jsxs)(Ue,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(R,{onSelect:()=>{st(e.project.name),H(!0)},children:[(0,Z.jsx)(et,{}),` `,b()]}),(0,Z.jsxs)(R,{onSelect:()=>J(!0),children:[(0,Z.jsx)(pt,{}),` `,le()]}),(0,Z.jsx)(Pe,{children:l()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void p({projectId:e.project._id,color:null}),"aria-label":g(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void p({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Ie,{}),(0,Z.jsxs)(R,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=fe?.folders??0,a=fe?.chats??0;await n({title:ae({name:e.project.name}),description:i>0?o({folders:i,chats:a}):a>0?Te({count:a}):d(),confirmWord:x(),confirmLabel:c(),destructive:!0})&&(await ee({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(nt,{}),` `,x()]})]})]})]})]}),S===`columns`?(0,Z.jsx)(Ft,{data:w,currentId:e.project._id,busyIds:N,suppressClick:$,locateChatId:k??null}):S===`list`?(0,Z.jsx)(Mt,{data:E,busyIds:N,suppressClick:$,locateChatId:k??null}):(0,Z.jsxs)(Z.Fragment,{children:[e.children.length>0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:Ce()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:dt,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ve()}),e.chats.length>0?(0,Z.jsx)(W,{value:z,onChange:e=>rt(e.target.value),placeholder:de(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?Se():be()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ge({term:z.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(K,{items:Bt.map(e=>`chat:${e._id}`),strategy:q,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:N.has(t._id),unread:Fe.has(t._id),locate:t._id===k,suppressClick:$},t._id))})})]}),Y.length>=2&&Q!==void 0?(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:oe()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ge({term:Y})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:Q.map(e=>(0,Z.jsx)(`li`,{className:`oc-projpage__chatrow`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{e.messageId&&Y&&We(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||ne()}),e.projectPath&&e.projectPath.length>1?(0,Z.jsx)(`span`,{className:`oc-projpage__hitpath`,children:e.projectPath.join(` › `)}):null,e.snippet?(0,Z.jsx)(`span`,{className:`oc-projpage__hitsnippet`,children:e.snippet}):null]})]})},`${e.chatId}:${e.messageId??`t`}`))})]}):null]}),(0,Z.jsx)($e,{open:V,onOpenChange:H,title:_e(),canSubmit:U.trim().length>0,onSubmit:async()=>{await f({projectId:e.project._id,name:U.trim()}),H(!1)},submitLabel:b(),children:(0,Z.jsx)(W,{value:U,onChange:e=>st(e.target.value),autoFocus:!0})}),ct?(0,Z.jsx)(ot,{open:ct,onOpenChange:J,title:xe(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void h({projectId:e.project._id,parentId:t})}):null,qe]}),(0,Z.jsx)(je,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(G,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ut,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=L({id:Ct(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=I(),a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__card`+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":B(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(G,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?k({count:e.folderCount})+` · `:``,E({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:rt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=T(A.chats.setChatSidebar),n=e.inSidebar?M():fe();return(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":n,title:n,className:`oc-projpage__barbtn`+(e.inSidebar?` is-on`:``),disabled:e.pinned&&e.inSidebar,onClick:n=>{n.stopPropagation(),t({chatId:e._id,hidden:e.inSidebar})},children:e.inSidebar?(0,Z.jsx)(qe,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=I(),c=V(e.color),l=z({id:`chat:${e._id}`}),d=jt(a);return(0,Z.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),d.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:H.Transform.toString(l.transform),transition:l.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...l.listeners,...l.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||u()}),e.pinned?(0,Z.jsx)(J,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:rt(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:_(),"aria-label":_()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:h(),"aria-label":h()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,X.useState)(new Set),o=(0,X.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:v()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=Qe(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Qe(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:Se()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=I(),c=z({id:`folder:${e._id}`}),l=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":B(e),transform:H.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?C():S(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(Ae,{size:13}):(0,Z.jsx)(Fe,{size:13})}),(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=I(),o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||u()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:v()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(It,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=I(),s=L({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.jsx)(Rt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:be()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=z({id:`folder:${e._id}`}),o=L({id:$(e._id)});return(0,Z.jsxs)(`div`,{ref:e=>{a.setNodeRef(e),o.setNodeRef(e)},className:`oc-projpage__colentry oc-projpage__colentry--folder`+(e.selected||n?` is-selected`:``)+(o.isOver?` is-over`:``)+(a.isDragging?` is-dragging`:``),style:{"--proj-hue":B(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=z({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||u()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
@@ -1,4 +1,4 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bx as r,Fc as i,Fo as a,Fx as o,Go as s,Gx as c,Hx as l,Ic as u,Io as d,Ix as f,Jx as p,Ko as m,Kx as h,Lx as g,Mc as _,Mo as ee,Mx as te,Nc as ne,No as v,Nx as y,Pc as b,Po as x,Px as S,Rx as C,Uo as w,Ux as T,Vx as re,Wo as ie,Wx as ae,Xx as oe,Yx as E,Zx as D,aS as O,aV as k,iS as A,ia as j,na as M,oV as N,qx as P,ra as F,t as I,yt as L,zx as R}from"./api-DRlXTl06.js";import{i as z,n as B,r as V,t as H}from"./FieldLabel-CrPuHD7O.js";import{t as U}from"./button-CTuIl1H-.js";import{$ as W,Dt as se,Q as G,Qt as K,X as q,Xt as ce,Yt as J,Z as Y,Zt as le,et as X,q as ue,ut as de}from"./index-D48cFy6f.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:h,help:c},documentary_fetch:{label:ae,help:T},inbound_files:{label:l,help:re},history_summary:{label:u,help:i},file_curation:{label:m,help:d},quote_reply:{label:s,help:ie}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bx as r,Fc as i,Fo as a,Fx as o,Go as s,Gx as c,Hx as l,Ic as u,Io as d,Ix as f,Jx as p,Ko as m,Kx as h,Lx as g,Mc as _,Mo as ee,Mx as te,Nc as ne,No as v,Nx as y,Pc as b,Po as x,Px as S,Rx as C,Uo as w,Ux as T,Vx as re,Wo as ie,Wx as ae,Xx as oe,Yx as E,Zx as D,aS as O,iS as k,ia as A,na as j,oV as M,qx as N,ra as P,sV as F,t as I,yt as L,zx as R}from"./api-Dawxt_aS.js";import{i as z,n as B,r as V,t as H}from"./FieldLabel-CEa671vG.js";import{t as U}from"./button-alklyZ2M.js";import{$ as W,Dt as se,Q as G,Qt as K,X as q,Xt as ce,Yt as J,Z as Y,Zt as le,et as X,q as ue,ut as de}from"./index-C-ySA5Hs.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:h,help:c},documentary_fetch:{label:ae,help:T},inbound_files:{label:l,help:re},history_summary:{label:u,help:i},file_curation:{label:m,help:d},quote_reply:{label:s,help:ie}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
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
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:S,references:y,files:te,previous_summary:b,new_messages:ne,max_chars:_,file_name:a,budget_chars:x,feedback:v,content:ee,excerpt:w};function _e(){let e=N(I.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:R()})});let i=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:D(),help:oe()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:r()}),(0,$.jsxs)(q,{value:i._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:i},i._id)]})}function ve({instance:e}){let t=k(I.admin.upsertInstanceConfig),n=se(),r=N(I.me.getMe,{host:ue}),i=e.config??{},a=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[o,s]=(0,Q.useState)(()=>z(i,a));(0,Q.useEffect)(()=>{s(z(i,a))},[a,e._id]);let[c,l]=(0,Q.useState)(!1),u=o.promptInjections,d=(e,t)=>s({...o,promptInjections:{...u,[e]:{...u[e],...t}}});async function f(){l(!0);try{await t({instanceId:e._id,config:V(o,i,a)})}catch(e){n.error(A(),e)}finally{l(!1)}}async function p(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(A(),e)}}let m=e.config?.contentLocale??`default`,h=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:j()}),(0,$.jsxs)(q,{value:m,onValueChange:e=>void p(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:M({locale:h})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:F()})]}),ce.map(e=>(0,$.jsx)(ye,{injKey:e,def:J[e],i18n:me[e],row:u[e]??{enabled:!0,template:J[e].defaultTemplate[a]},contentLocale:a,onChange:t=>d(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void f(),disabled:c,children:O()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[s,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),m=le(e,r,i),h=m?K(m,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(de,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:p()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,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:P()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?g():C()}),l&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:E()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:f()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:L()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:o()})})]})}export{_e as PromptInjectionsTab};
4
+ - [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:S,references:y,files:te,previous_summary:b,new_messages:ne,max_chars:_,file_name:a,budget_chars:x,feedback:v,content:ee,excerpt:w};function _e(){let e=F(I.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:R()})});let i=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:D(),help:oe()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:r()}),(0,$.jsxs)(q,{value:i._id,onValueChange:e=>n(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:i},i._id)]})}function ve({instance:e}){let t=M(I.admin.upsertInstanceConfig),n=se(),r=F(I.me.getMe,{host:ue}),i=e.config??{},a=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[o,s]=(0,Q.useState)(()=>z(i,a));(0,Q.useEffect)(()=>{s(z(i,a))},[a,e._id]);let[c,l]=(0,Q.useState)(!1),u=o.promptInjections,d=(e,t)=>s({...o,promptInjections:{...u,[e]:{...u[e],...t}}});async function f(){l(!0);try{await t({instanceId:e._id,config:V(o,i,a)})}catch(e){n.error(k(),e)}finally{l(!1)}}async function p(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(k(),e)}}let m=e.config?.contentLocale??`default`,h=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:A()}),(0,$.jsxs)(q,{value:m,onValueChange:e=>void p(e),children:[(0,$.jsx)(W,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(X,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:j({locale:h})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:P()})]}),ce.map(e=>(0,$.jsx)(ye,{injKey:e,def:J[e],i18n:me[e],row:u[e]??{enabled:!0,template:J[e].defaultTemplate[a]},contentLocale:a,onChange:t=>d(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(U,{size:`sm`,onClick:()=>void f(),disabled:c,children:O()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[s,c]=(0,Q.useState)(!1),l=r.template.trim()!==t.defaultTemplate[i],u=t.togglable&&!r.enabled,d=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),m=le(e,r,i),h=m?K(m,d):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(de,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:p()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:u,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:N()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?g():C()}),l&&(0,$.jsx)(U,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:E()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:f()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:L()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:o()})})]})}export{_e as PromptInjectionsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,BT as i,CT as a,DT as o,ET as ee,FT as s,GT as c,HT as l,IT as te,JT as u,KT as d,LT as f,MT as p,NT as m,OT as h,PT as ne,QT as g,RT as re,ST as ie,TT as _,UT as v,VT as y,WT as b,XT as x,YT as S,ZT as C,cT as ae,dT as w,fT as T,gT as E,gs as D,hT as O,jT as k,kT as A,lT as j,mT as M,oV as N,pT as P,qT as F,sV as I,t as L,uT as R,wT as oe,zT as z}from"./api-Dawxt_aS.js";import{t as B}from"./button-alklyZ2M.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-C-ySA5Hs.js";import{t as J}from"./roleDescriptions-C21oVyp7.js";var Y=t(e(),1),X=n(),Z=[{group:()=>g(),keys:[{key:`traces.read`,label:()=>F()},{key:`traces.read.content`,label:()=>d(),phi:!0},{key:`traces.write`,label:()=>c()}]},{group:()=>C(),keys:[{key:`kpi.read`,label:()=>F()},{key:`kpi.write`,label:()=>c()}]},{group:()=>x(),keys:[{key:`openclaw.query`,label:()=>b()},{key:`anomalies.read`,label:()=>v()},{key:`anomalies.report`,label:()=>l()}]},{group:()=>S(),keys:[{key:`chats.read`,label:()=>F()},{key:`selfheal`,label:()=>i()},{key:`media.repair`,label:()=>z()},{key:`feedback.respond`,label:()=>D()}]},{group:()=>u(),keys:[{key:`admin.manage`,label:()=>y()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=I(L.apiKeys.listRoles,{}),t=N(L.apiKeys.createRole),n=N(L.apiKeys.ensureRolesSeeded),i=N(L.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(L.apiKeys.listRoles,{});r&&e.setQuery(L.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),c=W(),l=V(),[u,d]=(0,Y.useState)(!1),[g,v]=(0,Y.useState)($),[y,b]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{l.error(f(),e)})},[n,l]);let x=e??[];async function S(e,t){if(Q(e.permissions))return;if(e.builtin){await c({title:te({name:e.name}),description:s(),confirmLabel:ne()});return}if(y.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];b(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){l.error(m(),e)}finally{b(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function C(){try{await t({key:g.key,name:g.name,description:g.description||void 0,permissions:[]}),v($),d(!1)}catch(e){l.error(p(),e)}}let D=e===void 0,F=!D&&x.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[k(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,r(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,A()]}),(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:h()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{v($),d(!0)},children:o()})})]}),D?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):F?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(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:oe()}),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?re({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:x.map(e=>{let t=Q(e.permissions),n=y.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,a()]}):(0,X.jsx)(U,{variant:`secondary`,children:ie()})]}),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)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?E():n?O():r,onCheckedChange:()=>void S(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:u,onOpenChange:d,title:M(),description:P(),canSubmit:!!(g.key&&g.name),onSubmit:C,submitLabel:T(),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:w()}),(0,X.jsx)(K,{value:g.key,placeholder:R(),onChange:e=>v({...g,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:j()}),(0,X.jsx)(K,{value:g.name,onChange:e=>v({...g,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:ae()}),(0,X.jsx)(K,{value:g.description,onChange:e=>v({...g,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{$R as r,AR as i,Az as a,BL as o,Cz as s,D as c,DR as l,Dz as u,Ez as ee,FL as d,FR as f,Fz as p,GL as te,GR as ne,HL as re,HR as ie,IL as ae,IR as oe,Iz as se,JL as ce,JR as le,KL as ue,KR as de,LL as fe,MR as pe,Mz as me,NR as he,Nz as ge,OL as _e,OR as ve,Oz as ye,PL as be,PR as xe,Pz as Se,QB as Ce,QR as we,RL as Te,RR as Ee,SR as De,Sz as Oe,Tz as ke,UL as Ae,UR as je,VL as Me,VR as Ne,WL as Pe,WR as Fe,XL as Ie,YL as Le,YR as m,ZL as Re,ZR as ze,_R as Be,bR as h,cR as Ve,dR as g,eV as _,ez as He,fR as Ue,gR as We,hR as Ge,iV as v,jR as Ke,jz as qe,kR as Je,kz as Ye,lR as Xe,mR as Ze,nz as Qe,pR as $e,qL as et,qR as tt,sR as nt,sV as rt,t as y,tz as it,uR as b,vR as at,wz as ot,xR as x,xz as st,yR as ct,zL as lt}from"./api-Dawxt_aS.js";import{t as ut}from"./list-Bs_wfimY.js";import{t as S}from"./button-alklyZ2M.js";import{$ as C,Bn as w,Bt as dt,Ct as ft,Dn as pt,Dt as mt,Et as T,Q as E,Rt as D,St as ht,Tt as gt,Vn as O,X as k,Z as A,_n as _t,_t as vt,at as yt,bn as bt,bt as xt,dn as St,et as j,gt as Ct,hn as wt,it as Tt,jt as Et,nt as Dt,on as Ot,ot as kt,q as At,rt as jt,tt as Mt,vt as Nt,wt as Pt,xn as Ft,xt as It,yt as Lt,zt as M}from"./index-C-ySA5Hs.js";import{a as Rt,i as N,n as zt,o as Bt,r as P,t as Vt}from"./table-CJ3_5RvQ.js";import{t as Ht}from"./FilterBar-D_6ObXjr.js";/* empty css */import{a as Ut,c as F,i as I,l as Wt,n as Gt,o as L,r as Kt,s as qt,t as Jt,u as R}from"./TimezoneCombobox-D1Wotasq.js";var Yt=c(`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`}]]),Xt=c(`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`}]]),z=t(e(),1),B=n();function V(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 Zt({value:e,onChange:t}){let n=Wt(e),r=(0,z.useMemo)(()=>new Date,[]),[i,a]=(0,z.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,z.useState)(!1),c=(0,z.useMemo)(()=>V(_()),[]),l=(0,z.useMemo)(()=>new Intl.DateTimeFormat(_(),{month:`long`,year:`numeric`}),[]),u=(0,z.useMemo)(()=>new Intl.DateTimeFormat(_(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=F(i.year,i.month),d=n?.hour??9,f=n?.minute??0,p=(e,n,r,i,a)=>t(R(e,n,r,i,a)),te=(e,t,n)=>{a({year:e,month:t}),p(e,t,n,d,f)},ne=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},re=n===null?x():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,B.jsxs)(D,{modal:!0,open:o,onOpenChange:s,children:[(0,B.jsx)(dt,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":De(),children:[(0,B.jsx)(Yt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,B.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:re})]})}),(0,B.jsxs)(M,{align:`start`,className:`oc-dtp__pop`,children:[(0,B.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":h(),onClick:()=>ne(-1),children:(0,B.jsx)(O,{size:15,"aria-hidden":!0})}),(0,B.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ct(),onClick:()=>ne(1),children:(0,B.jsx)(w,{size:15,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>te(e.year,e.month,e.day),children:e.day},t)})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,B.jsxs)(k,{value:String(d),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),Number(e),f),children:[(0,B.jsx)(C,{size:`sm`,"aria-label":at(),children:(0,B.jsx)(j,{})}),(0,B.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,B.jsx)(E,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,B.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,B.jsxs)(k,{value:String(f),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),d,Number(e)),children:[(0,B.jsx)(C,{size:`sm`,"aria-label":Be(),children:(0,B.jsx)(j,{})}),(0,B.jsx)(A,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,B.jsx)(E,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function H(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Qt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function $t(e){let t=new Map;for(let n of e){let e=H(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 U(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(Qt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function en(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function tn(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function nn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var W=3;function rn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=_(),c=(0,z.useMemo)(()=>$t(e),[e]),l=(0,z.useMemo)(()=>en(s),[s]),u=(0,z.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,z.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),d=(0,z.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),f=new Date,p=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},te=t===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,B.jsxs)(`div`,{className:`oc-cal`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":b(),onClick:()=>p(-1),children:(0,B.jsx)(O,{})}),(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":Xe(),onClick:()=>p(1),children:(0,B.jsx)(w,{})}),(0,B.jsx)(S,{variant:`ghost`,size:`sm`,onClick:()=>i({year:f.getFullYear(),month:f.getMonth()}),children:g()})]}),(0,B.jsx)(`span`,{className:`oc-cal__title`,children:te}),(0,B.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,B.jsx)(S,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:$e()}),(0,B.jsx)(S,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:Ue()})]})]}),t===`month`?(0,B.jsx)(an,{cursor:n,byDay:c,weekdays:l,timeFmt:d,now:f,onEventClick:a}):(0,B.jsx)(on,{year:n.year,byDay:c,monthShortFmt:ee,now:f,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,B.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function an({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=F(e.year,e.month);return(0,B.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Qt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,B.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,B.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,W).map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,B.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,B.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>W?(0,B.jsx)(`span`,{className:`oc-cal__more`,children:Ve({count:o.length-W})}):null]},n)})]})}function on({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,B.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=U(t,e,o),c=F(e,o);return(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,B.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,B.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,B.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var G={h:36e5,min:6e4,s:1e3,ms:1};function sn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*G[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var cn=new Map;function J(e){let t=cn.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return cn.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=q(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=L(e)!==`active`,c=Z(s?null:sn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(qt(e)){case`ok`:return(0,B.jsx)(T,{variant:`secondary`,children:f()});case`error`:return(0,B.jsx)(T,{variant:`destructive`,children:he()});case`running`:return(0,B.jsx)(T,{variant:`outline`,children:pe()});case`other`:return(0,B.jsx)(T,{variant:`outline`,children:e});case`none`:return(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=v(y.scheduled.listMyCrons),t=v(y.scheduled.getCronDetail),n=v(y.scheduled.listCronRuns),c=v(y.scheduled.updateCron),De=v(y.scheduled.removeCron),Be=v(y.scheduled.runCronNow),h=mt(),Ve=rt(y.me.getMe,{host:At})?.timezone,[g,Ue]=(0,z.useState)(null),[Xe,$e]=(0,z.useState)(!1),[b,at]=(0,z.useState)(!1),[x,ct]=(0,z.useState)(null),[w,dt]=(0,z.useState)(null),[D,O]=(0,z.useState)(null),[M,F]=(0,z.useState)(null),[Wt,qt]=(0,z.useState)(!1),[R,V]=(0,z.useState)(Gt),[H,Qt]=(0,z.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),$t=e=>{localStorage.setItem(`oc.sched.view`,e),Qt(e)},[U,en]=(0,z.useState)(`month`),[W,an]=(0,z.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),on=(0,z.useMemo)(()=>{let e=[];for(let t of g??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Ut(r,R)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[g,R]),G=(0,z.useMemo)(()=>U===`year`?nn(W.year):tn(W.year,W.month),[U,W]),sn=(0,z.useMemo)(()=>un(on,G.startMs,G.endMs),[on,G]),K=e=>{let t=sn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},q=(0,z.useCallback)(async()=>{$e(!0),at(!1);try{Ue(await e({}))}catch{at(!0)}finally{$e(!1)}},[e]);(0,z.useEffect)(()=>{q()},[q]);let cn=(0,z.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,z.useRef)(null);(0,z.useEffect)(()=>{g!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[g]);let Y=(0,z.useMemo)(()=>new Intl.DateTimeFormat(_(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{ct(e);try{await t(),h.success(n),await q()}catch(e){h.toast({variant:`error`,title:m({code:dn(e)})})}finally{ct(null)}},Z=(0,z.useRef)(0),Q=(0,z.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;O({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;O({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;O(null),h.toast({variant:`error`,title:m({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;F({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;F(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;F(null),h.toast({variant:`error`,title:m({code:dn(e)})})}},mn=async()=>{if(M===null)return;let e={};if(M.nameDirty&&M.name.trim()===``||M.messageDirty&&M.hasMessage&&M.message.trim()===``){h.toast({variant:`error`,title:be()});return}if(M.nameDirty&&M.name.trim()!==``&&(e.name=M.name.trim()),M.scheduleDirty){if(M.scheduleKind===`cron`&&M.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:M.cronExpr.trim(),...M.tz.trim()===``?{}:{tz:M.tz.trim()}};else if(M.scheduleKind===`every`){let t=Number(M.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[M.everyUnit])})}else if(M.scheduleKind===`at`&&M.at!==``){let t=Date.parse(M.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(M.scheduleDirty&&e.schedule===void 0){h.toast({variant:`error`,title:d()});return}if(M.messageDirty&&M.hasMessage&&M.message.trim()!==``&&(e.message=M.message.trim()),Object.keys(e).length===0){F(null);return}let t=Q.current;qt(!0);try{await c({instanceName:M.instanceName,jobId:M.jobId,patch:e}),h.success(ce()),t===Q.current&&F(null),await q()}catch(e){h.toast({variant:`error`,title:m({code:dn(e)})})}finally{qt(!1)}},hn=g?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:se()}),(0,B.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":We(),children:[(0,B.jsx)(S,{variant:H===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ge(),title:Ge(),"aria-pressed":H===`list`,onClick:()=>$t(`list`),children:(0,B.jsx)(ut,{})}),(0,B.jsx)(S,{variant:H===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ze(),title:Ze(),"aria-pressed":H===`calendar`,onClick:()=>$t(`calendar`),children:(0,B.jsx)(Yt,{})})]}),(0,B.jsxs)(S,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:Xe,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,B.jsx)(wt,{size:14,"aria-hidden":!0}),p()]})]}),g!==null&&hn>0?(0,B.jsxs)(Ht,{q:R.q,onQChange:e=>V(t=>({...t,q:e})),searchPlaceholder:i(),onReset:()=>V(Gt),canReset:Kt(R),children:[(0,B.jsxs)(k,{value:R.state,onValueChange:e=>V(t=>({...t,state:e})),children:[(0,B.jsx)(C,{size:`sm`,className:`w-40`,children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`all`,children:Je()}),(0,B.jsx)(E,{value:`active`,children:Oe()}),(0,B.jsx)(E,{value:`paused`,children:s()}),(0,B.jsx)(E,{value:`auto-disabled`,children:st()})]})]}),(0,B.jsxs)(k,{value:R.result,onValueChange:e=>V(t=>({...t,result:e})),children:[(0,B.jsx)(C,{size:`sm`,className:`w-40`,children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`all`,children:ve()}),(0,B.jsx)(E,{value:`ok`,children:f()}),(0,B.jsx)(E,{value:`error`,children:he()}),(0,B.jsx)(E,{value:`running`,children:pe()}),(0,B.jsx)(E,{value:`none`,children:Ke()})]})]})]}):null,g===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Xe,children:b?Se():Ce()}):H===`calendar`?(0,B.jsxs)(B.Fragment,{children:[b?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null,g.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):(0,B.jsx)(rn,{events:sn.events,mode:U,cursor:W,onModeChange:en,onCursorChange:an,onEventClick:K,footnote:nt()})]}):(0,B.jsxs)(B.Fragment,{children:[b?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null,g.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ge()}):null,g.map(e=>{let t=e.jobs.filter(e=>Ut(e,R)),n=Kt(R)&&e.jobs.length>0&&t.length===0;return(0,B.jsxs)(`section`,{style:{marginBottom:20},children:[g.length>1||e.error||!e.supported?(0,B.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,B.jsx)(T,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:qe({code:e.error})}):e.jobs.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):n?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,B.jsxs)(Vt,{children:[(0,B.jsx)(Rt,{children:(0,B.jsxs)(Bt,{children:[(0,B.jsx)(N,{children:Ye()}),(0,B.jsx)(N,{children:ye()}),(0,B.jsx)(N,{children:u()}),(0,B.jsx)(N,{children:ee()}),(0,B.jsx)(N,{children:ke()}),(0,B.jsx)(N,{children:oe()}),(0,B.jsx)(N,{children:Re()})]})}),(0,B.jsx)(zt,{children:t.map((t,n)=>{let i=`${e.instanceName}:${t.id??n}`,a=x===i,o=e.manageSupported,l=e.kind===`openclaw`&&o;return(0,B.jsxs)(Bt,{ref:t.id!==null&&t.id===cn?J:void 0,"data-state":t.id!==null&&t.id===cn?`selected`:void 0,children:[(0,B.jsx)(P,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??ot()}),(0,B.jsx)(P,{children:(0,B.jsx)(T,{variant:`secondary`,children:t.agentId})}),(0,B.jsxs)(P,{className:`whitespace-nowrap`,children:[(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Ct(t.schedule),n=e===null?null:vt(e);return n===null?null:(0,B.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,B.jsx)(P,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,B.jsx)(P,{children:L(t)===`auto-disabled`?(0,B.jsx)(T,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:st()}):L(t)===`active`?(0,B.jsx)(T,{variant:`secondary`,children:Oe()}):L(t)===`paused`?(0,B.jsx)(T,{variant:`outline`,children:s()}):(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,B.jsxs)(P,{children:[(0,B.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,B.jsx)(T,{variant:`destructive`,title:t.lastDeliveryError??Qe(),children:xe()}):null]}),(0,B.jsx)(P,{className:`whitespace-nowrap`,children:t.id===null?(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,B.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsxs)(`span`,{className:`oc-cronactions`,children:[l?(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:He(),"aria-label":He(),disabled:x!==null,onClick:()=>void X(i,async()=>{let n=await Be({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},le()),children:(0,B.jsx)(Ot,{size:14,"aria-hidden":!0})}):null,l&&t.enabled!==null?(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:I(t)===`pause`?r():we(),"aria-label":I(t)===`pause`?r():we(),disabled:x!==null,onClick:()=>void X(i,()=>c({instanceName:e.instanceName,jobId:t.id,patch:{enabled:I(t)===`resume`}}),I(t)===`pause`?tt():de()),children:I(t)===`pause`?(0,B.jsx)(Ft,{size:14,"aria-hidden":!0}):(0,B.jsx)(_t,{size:14,"aria-hidden":!0})}):null,l?(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:Ie(),"aria-label":Ie(),disabled:x!==null,onClick:()=>void pn(e.instanceName,t),children:(0,B.jsx)(bt,{size:14,"aria-hidden":!0})}):null,l?(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:Le(),"aria-label":Le(),disabled:x!==null,onClick:()=>void ln(e.instanceName,t),children:(0,B.jsx)(Xt,{size:14,"aria-hidden":!0})}):null,o?(0,B.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:ze(),"aria-label":ze(),disabled:x!==null,onClick:()=>dt({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,B.jsx)(St,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:me()})]},e.instanceName)}),hn>0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:_e()}):null]}),(0,B.jsx)(Nt,{open:w!==null,onOpenChange:e=>{e||dt(null)},children:(0,B.jsxs)(It,{children:[(0,B.jsxs)(Pt,{children:[(0,B.jsx)(gt,{children:Fe()}),(0,B.jsx)(ht,{children:je({name:w?.name??``})})]}),(0,B.jsxs)(ft,{children:[(0,B.jsx)(xt,{children:ie()}),(0,B.jsx)(Lt,{onClick:()=>{let e=w;dt(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>De({instanceName:e.instanceName,jobId:e.jobId}),ne())},children:Ne()})]})]})}),(0,B.jsx)(Mt,{open:D!==null,onOpenChange:e=>{e||(Z.current++,O(null))},children:(0,B.jsxs)(Dt,{style:{maxWidth:640},children:[(0,B.jsx)(yt,{children:(0,B.jsx)(kt,{children:et({name:D?.name??``})})}),D?.entries===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):D!==null&&D.entries.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):D===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:D.entries.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,B.jsx)(fn,{status:e.status}),(0,B.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,B.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[Ee({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,B.jsx)(Mt,{open:M!==null,onOpenChange:e=>{e||(Q.current++,F(null))},children:(0,B.jsxs)(Dt,{className:`oc-cronedit`,children:[(0,B.jsxs)(yt,{children:[(0,B.jsx)(kt,{children:te()}),(0,B.jsx)(jt,{children:Pe()})]}),M===null?null:M.loading?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ye()}),(0,B.jsx)(Et,{value:M.name,maxLength:200,onChange:e=>F({...M,name:e.target.value,nameDirty:!0})})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ae()}),(0,B.jsxs)(k,{value:M.scheduleKind,onValueChange:e=>F({...M,scheduleKind:e,scheduleDirty:!0}),children:[(0,B.jsx)(C,{children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`cron`,children:re()}),(0,B.jsx)(E,{value:`every`,children:Me()}),(0,B.jsx)(E,{value:`at`,children:o()})]})]}),M.scheduleKind===`cron`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(Et,{value:M.cronExpr,onChange:e=>F({...M,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,B.jsx)(Jt,{value:M.tz,onChange:e=>F({...M,tz:e,scheduleDirty:!0}),fallbackTz:Ve??void 0})]}):M.scheduleKind===`every`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(Et,{type:`number`,min:1,value:M.everyValue,onChange:e=>F({...M,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,B.jsxs)(k,{value:M.everyUnit,onValueChange:e=>F({...M,everyUnit:e,scheduleDirty:!0}),children:[(0,B.jsx)(C,{style:{maxWidth:160},children:(0,B.jsx)(j,{})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(E,{value:`minutes`,children:lt()}),(0,B.jsx)(E,{value:`hours`,children:Te()}),(0,B.jsx)(E,{value:`days`,children:fe()})]})]})]}):(0,B.jsx)(Zt,{value:M.at,onChange:e=>F({...M,at:e,scheduleDirty:!0})})]}),M.hasMessage?(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:it()}),(0,B.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:M.message,onChange:e=>F({...M,message:e.target.value,messageDirty:!0})})]}):null]}),(0,B.jsxs)(Tt,{children:[(0,B.jsx)(S,{variant:`ghost`,onClick:()=>F(null),children:ie()}),(0,B.jsxs)(S,{onClick:()=>void mn(),disabled:M===null||M.loading||Wt,children:[Wt?(0,B.jsx)(pt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,ae()]})]})]})})]})}export{pn as ScheduledTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,$P as i,AP as ee,BP as te,CP as ne,DP as re,EP as ie,FP as ae,GP as oe,HP as se,IP as ce,JP as le,KP as ue,LP as de,MP as fe,NP as pe,OP as me,PP as he,QN as a,QP as ge,RP as _e,SP as ve,TP as ye,UP as be,VP as xe,WP as Se,XN as o,XP as Ce,YN as s,YP as we,ZN as Te,ZP as Ee,_P as De,aF as Oe,aP as c,aV as l,bP as ke,cF as Ae,cP as u,dF as je,dP as d,eF as Me,eP as f,fF as Ne,fP as p,gP as m,hF as Pe,hP as h,iF as Fe,iP as g,jP as Ie,kP as Le,lF as _,lP as v,mF as Re,mP as y,nF as ze,nP as b,oF as Be,oP as x,oV as S,pF as Ve,pP as C,qP as He,rF as Ue,rP as w,rV as We,sF as Ge,sP as T,t as E,tF as Ke,tP as D,uF as O,uP as k,vP as A,wP as qe,xP as Je,yP as Ye,zP as Xe}from"./api-DRlXTl06.js";import{t as j}from"./button-CTuIl1H-.js";import{$ as M,Bn as Ze,Dt as Qe,Et as N,Gn as $e,Hn as et,In as P,Kn as tt,Q as F,U as nt,Un as I,X as L,Z as R,_ as rt,at as z,ct as B,et as V,it as H,jt as U,nt as W,ot as G,rt as it,st as at,tt as K}from"./index-D48cFy6f.js";import{t as ot}from"./FilterBar-Of8GWz2N.js";import{t as st}from"./DataTableShell-C0MSDiic.js";import{t as ct}from"./roleDescriptions-CoFSIkRg.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>D(),days:null},{value:`30`,label:()=>f(),days:30},{value:`90`,label:()=>r(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=tt({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??X,[a,o]=(0,q.useState)(X),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Te=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),De=S(E.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:r===X?void 0:r===`disabled`}}),c=S(E.apiKeys.listKeys,{}),u=S(E.apiKeys.listRoles,{}),d=l(E.apiKeys.createServiceAccount),f=l(E.apiKeys.updateServiceAccount),p=l(E.apiKeys.deleteServiceAccount),m=We(E.apiKeys.mintApiKey),h=l(E.apiKeys.revokeApiKey),g=nt(),v=Qe(),y=n!==``||a!==X||r!==X;function b(){o(X),t({search:{},replace:!0})}let[x,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(Z),[D,k]=(0,q.useState)(null),[A,P]=(0,q.useState)(new Set),[I,z]=(0,q.useState)(null),B=(0,q.useRef)(!1),[H,W]=(0,q.useState)(new Set),[G,it]=(0,q.useState)({}),[at,K]=(0,q.useState)(null),Y=(0,q.useMemo)(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[c]);function Q(e){P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await f({serviceAccountId:D,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(pe())):await d({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Z),k(null),C(!1)}catch(e){v.error(D?he():ae(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),C(!0)}async function mt(e){if(B.current)return;B.current=!0;let t=G[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;z(e._id);try{let t=await m({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(fe(),e)}finally{B.current=!1,z(null)}}async function $(e){if(await g({title:Ie(),description:(0,J.jsxs)(J.Fragment,{children:[ee(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Le(),` `,(0,J.jsx)(`strong`,{children:me()}),` `,re()]}),confirmWord:e.name,confirmLabel:ie(),destructive:!0}))try{await p({serviceAccountId:e._id}),v.success(ye(),e.name)}catch(e){v.error(qe(),e)}}async function ht(e){if(await g({title:ne(),description:(0,J.jsxs)(J.Fragment,{children:[ve(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Je()]}),confirmLabel:ke(),destructive:!0})&&!H.has(e._id)){W(t=>new Set(t).add(e._id));try{await h({keyId:e._id})}catch(e){v.error(Ye(),e)}finally{W(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:Re(),onReset:b,canReset:y,children:[(0,J.jsxs)(L,{value:a,onValueChange:o,children:[(0,J.jsx)(M,{size:`sm`,className:`w-40`,children:(0,J.jsx)(V,{placeholder:Ve()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:Ne()}),(u??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(L,{value:r,onValueChange:Te,children:[(0,J.jsx)(M,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:je()}),(0,J.jsx)(F,{value:`active`,children:O()}),(0,J.jsx)(F,{value:`disabled`,children:_()})]})]})]}),(0,J.jsx)(st,{title:Ae(),rows:De,addLabel:Ge(),onAdd:()=>{T(Z),k(null),C(!0)},emptyHint:Be(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[...(e.managedBy??null)===null?[{label:ze(),onSelect:()=>pt(e)},{label:Oe(),onSelect:()=>void mt(e)}]:[],{label:A.has(e._id)?Fe():Ue(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:Ke(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Me():i(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,J.jsx)(et,{}):(0,J.jsx)(Ze,{})})},{header:ge(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ee(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})},{header:Ce(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:_()}):(0,J.jsx)(N,{variant:`outline`,children:O()})},{header:we(),cell:e=>(0,J.jsxs)(L,{value:G[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(M,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(R,{children:lt.map(e=>(0,J.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:le(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:I===e._id?He():ue({count:t})})}}]}),(0,J.jsx)(rt,{open:x,onOpenChange:e=>{C(e),e||k(null)},title:D?oe():se(),description:D?Se():xe(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:D?be():te(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Xe()}),(0,J.jsx)(U,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:_e()}),(0,J.jsxs)(L,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,J.jsx)(M,{className:`w-full`,children:(0,J.jsx)(V,{placeholder:de()})}),(0,J.jsx)(R,{children:(u??[]).map(e=>(0,J.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(u??[]).find(e=>e.key===w.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ce()}),(0,J.jsx)(U,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:at,onClose:()=>K(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[A(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:m()}),(0,J.jsx)(`th`,{children:h()}),(0,J.jsx)(`th`,{children:y()}),(0,J.jsx)(`th`,{children:C()}),(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:d()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:B(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?k():v()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(K,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(z,{children:[(0,J.jsx)(G,{children:u()}),(0,J.jsx)(it,{children:T({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:x()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":c(),children:[n?(0,J.jsx)(I,{}):(0,J.jsx)(P,{}),n?g():w()]})]}),(0,J.jsx)(H,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:b()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?a():B(e)}function mt(e){return e===null?`—`:at(e)}function $(e){return e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:Te()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(N,{variant:`outline`,children:o()}):(0,J.jsx)(N,{variant:`outline`,children:s()})}export{Q as ServiceAccountsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,$P as i,AP as ee,BP as te,CP as ne,DP as re,EP as ie,FP as ae,GP as oe,HP as se,IP as ce,JP as le,KP as ue,LP as de,MP as fe,NP as pe,OP as me,PP as he,QN as a,QP as ge,RP as _e,SP as ve,TP as ye,UP as be,VP as xe,WP as Se,XN as o,XP as Ce,YN as s,YP as we,ZN as Te,ZP as Ee,_P as De,aF as Oe,aP as c,bP as ke,cF as Ae,cP as l,dF as je,dP as u,eF as Me,eP as d,fF as Ne,fP as f,gP as p,hF as Pe,hP as m,iF as Fe,iP as h,iV as Ie,jP as Le,kP as Re,lF as g,lP as _,mF as ze,mP as v,nF as Be,nP as y,oF as Ve,oP as b,oV as x,pF as He,pP as S,qP as Ue,rF as We,rP as C,sF as Ge,sP as w,sV as T,t as E,tF as Ke,tP as D,uF as O,uP as k,vP as A,wP as qe,xP as Je,yP as Ye,zP as Xe}from"./api-Dawxt_aS.js";import{t as j}from"./button-alklyZ2M.js";import{$ as M,Bn as Ze,Dt as Qe,Et as N,Gn as $e,Hn as et,In as P,Kn as tt,Q as F,U as nt,Un as I,X as L,Z as R,_ as rt,at as z,ct as B,et as V,it as H,jt as U,nt as W,ot as G,rt as it,st as at,tt as K}from"./index-C-ySA5Hs.js";import{t as ot}from"./FilterBar-D_6ObXjr.js";import{t as st}from"./DataTableShell-DGGSIwCx.js";import{t as ct}from"./roleDescriptions-C21oVyp7.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>D(),days:null},{value:`30`,label:()=>d(),days:30},{value:`90`,label:()=>r(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=tt({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??X,[a,o]=(0,q.useState)(X),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),Te=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),De=T(E.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:r===X?void 0:r===`disabled`}}),c=T(E.apiKeys.listKeys,{}),l=T(E.apiKeys.listRoles,{}),u=x(E.apiKeys.createServiceAccount),d=x(E.apiKeys.updateServiceAccount),f=x(E.apiKeys.deleteServiceAccount),p=Ie(E.apiKeys.mintApiKey),m=x(E.apiKeys.revokeApiKey),h=nt(),_=Qe(),v=n!==``||a!==X||r!==X;function y(){o(X),t({search:{},replace:!0})}let[b,S]=(0,q.useState)(!1),[C,w]=(0,q.useState)(Z),[D,k]=(0,q.useState)(null),[A,P]=(0,q.useState)(new Set),[I,z]=(0,q.useState)(null),B=(0,q.useRef)(!1),[H,W]=(0,q.useState)(new Set),[G,it]=(0,q.useState)({}),[at,K]=(0,q.useState)(null),Y=(0,q.useMemo)(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[c]);function Q(e){P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await d({serviceAccountId:D,name:C.name,roleKey:C.roleKey,description:C.description}),_.success(pe())):await u({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),w(Z),k(null),S(!1)}catch(e){_.error(D?he():ae(),e)}}function pt(e){w({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),S(!0)}async function mt(e){if(B.current)return;B.current=!0;let t=G[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;z(e._id);try{let t=await p({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(fe(),e)}finally{B.current=!1,z(null)}}async function $(e){if(await h({title:Le(),description:(0,J.jsxs)(J.Fragment,{children:[ee(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Re(),` `,(0,J.jsx)(`strong`,{children:me()}),` `,re()]}),confirmWord:e.name,confirmLabel:ie(),destructive:!0}))try{await f({serviceAccountId:e._id}),_.success(ye(),e.name)}catch(e){_.error(qe(),e)}}async function ht(e){if(await h({title:ne(),description:(0,J.jsxs)(J.Fragment,{children:[ve(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Je()]}),confirmLabel:ke(),destructive:!0})&&!H.has(e._id)){W(t=>new Set(t).add(e._id));try{await m({keyId:e._id})}catch(e){_.error(Ye(),e)}finally{W(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Pe()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:ze(),onReset:y,canReset:v,children:[(0,J.jsxs)(L,{value:a,onValueChange:o,children:[(0,J.jsx)(M,{size:`sm`,className:`w-40`,children:(0,J.jsx)(V,{placeholder:He()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:Ne()}),(l??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(L,{value:r,onValueChange:Te,children:[(0,J.jsx)(M,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:je()}),(0,J.jsx)(F,{value:`active`,children:O()}),(0,J.jsx)(F,{value:`disabled`,children:g()})]})]})]}),(0,J.jsx)(st,{title:Ae(),rows:De,addLabel:Ge(),onAdd:()=>{w(Z),k(null),S(!0)},emptyHint:Ve(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[...(e.managedBy??null)===null?[{label:Be(),onSelect:()=>pt(e)},{label:Oe(),onSelect:()=>void mt(e)}]:[],{label:A.has(e._id)?Fe():We(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:Ke(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?Me():i(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,J.jsx)(et,{}):(0,J.jsx)(Ze,{})})},{header:ge(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ee(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})},{header:Ce(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:g()}):(0,J.jsx)(N,{variant:`outline`,children:O()})},{header:we(),cell:e=>(0,J.jsxs)(L,{value:G[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(M,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(R,{children:lt.map(e=>(0,J.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:le(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:I===e._id?Ue():ue({count:t})})}}]}),(0,J.jsx)(rt,{open:b,onOpenChange:e=>{S(e),e||k(null)},title:D?oe():se(),description:D?Se():xe(),canSubmit:!!(C.name&&C.roleKey),onSubmit:ft,submitLabel:D?be():te(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:Xe()}),(0,J.jsx)(U,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:_e()}),(0,J.jsxs)(L,{value:C.roleKey||void 0,onValueChange:e=>w({...C,roleKey:e}),children:[(0,J.jsx)(M,{className:`w-full`,children:(0,J.jsx)(V,{placeholder:de()})}),(0,J.jsx)(R,{children:(l??[]).map(e=>(0,J.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(l??[]).find(e=>e.key===C.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ce()}),(0,J.jsx)(U,{value:C.description,onChange:e=>w({...C,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:at,onClose:()=>K(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[A(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:De()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:m()}),(0,J.jsx)(`th`,{children:v()}),(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:f()}),(0,J.jsx)(`th`,{children:u()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:B(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?k():_()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(K,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(z,{children:[(0,J.jsx)(G,{children:l()}),(0,J.jsx)(it,{children:w({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:b()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":c(),children:[n?(0,J.jsx)(I,{}):(0,J.jsx)(P,{}),n?h():C()]})]}),(0,J.jsx)(H,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:y()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?a():B(e)}function mt(e){return e===null?`—`:at(e)}function $(e){return e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:Te()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(N,{variant:`outline`,children:o()}):(0,J.jsx)(N,{variant:`outline`,children:s()})}export{Q as ServiceAccountsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,Cl as i,Gc as a,Hc as o,Jc as s,Kc as c,Qc as l,Sl as u,Tl as d,Uc as f,Vc as p,Wc as m,Xc as h,Yc as g,Zc as _,_l as v,aV as y,al as b,bl as x,cl as S,dl as C,el as w,fl as T,gl as E,hl as D,il as O,ll as k,ml as A,nl as j,oV as M,ol as N,pl as P,qc as F,rl as I,sl as L,t as R,tl as ee,ul as z,vl as B,wl as V,xl as H,yl as U}from"./api-DRlXTl06.js";import{t as W}from"./button-CTuIl1H-.js";import{U as G,ct as K}from"./index-D48cFy6f.js";import{t as q}from"./DataTableShell-C0MSDiic.js";var J=t(e(),1),Y=n(),X={hung:()=>S(),wrong_result:()=>L(),error:()=>N(),other:()=>b()},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=y(R.subAgentReports.respondToReport),[i,o]=(0,J.useState)(e.thread),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(!1);async function v(){let t=u.trim();if(!(!t||f)){p(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{p(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,O({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:I()}),(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:j()}),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`?ee():w()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:r()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:l(),value:u,maxLength:2e3,rows:3,onChange:e=>d(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 v(),disabled:!u.trim()||f,children:f?h():_()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[g({count:t.children.length}),t.childrenTruncated?` ${s()}`:``,t.textTruncated?` ${F()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${c()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(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:m()}),(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=M(R.subAgentReports.listForAdmin,{}),t=y(R.subAgentReports.readReport),n=y(R.subAgentReports.deleteReport),r=G(),[a,s]=(0,J.useState)(null),[c,l]=(0,J.useState)({});async function m(e){if(a===e._id){s(null);return}if(!c[e._id]){let n=await t({reportId:e._id});l(t=>({...t,[e._id]:n}))}s(e._id)}async function h(e){await r({title:f(),description:o(),confirmLabel:p(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&s(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,Y.jsx)(`strong`,{children:u()}),` `,H()]}),(0,Y.jsx)(q,{title:d(),rows:e,emptyHint:V(),isExpanded:e=>a===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:x(),cell:e=>K(e.at),sort:e=>e.at},{header:U(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:B(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:v(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${A({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:E(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:D(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:P()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:T()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?z():C(),onSelect:()=>void m(e)},{label:k(),onSelect:()=>void h(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$c as r,Cl as i,Gc as a,Hc as o,Jc as s,Kc as c,Qc as l,Sl as u,Tl as d,Uc as f,Vc as p,Wc as m,Xc as h,Yc as g,Zc as _,_l as v,al as y,bl as b,cl as x,dl as S,el as C,fl as w,gl as T,hl as E,il as D,ll as O,ml as k,nl as A,oV as j,ol as M,pl as N,qc as P,rl as F,sV as I,sl as L,t as R,tl as ee,ul as z,vl as B,wl as V,xl as H,yl as U}from"./api-Dawxt_aS.js";import{t as W}from"./button-alklyZ2M.js";import{U as G,ct as K}from"./index-C-ySA5Hs.js";import{t as q}from"./DataTableShell-DGGSIwCx.js";var J=t(e(),1),Y=n(),X={hung:()=>x(),wrong_result:()=>L(),error:()=>M(),other:()=>y()},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=j(R.subAgentReports.respondToReport),[i,o]=(0,J.useState)(e.thread),[u,d]=(0,J.useState)(``),[f,p]=(0,J.useState)(!1);async function v(){let t=u.trim();if(!(!t||f)){p(!0);try{await n({reportId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{p(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,D({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:F()}),(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:A()}),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`?ee():C()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:r()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:l(),value:u,maxLength:2e3,rows:3,onChange:e=>d(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 v(),disabled:!u.trim()||f,children:f?h():_()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[g({count:t.children.length}),t.childrenTruncated?` ${s()}`:``,t.textTruncated?` ${P()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${c()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(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:m()}),(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=I(R.subAgentReports.listForAdmin,{}),t=j(R.subAgentReports.readReport),n=j(R.subAgentReports.deleteReport),r=G(),[a,s]=(0,J.useState)(null),[c,l]=(0,J.useState)({});async function m(e){if(a===e._id){s(null);return}if(!c[e._id]){let n=await t({reportId:e._id});l(t=>({...t,[e._id]:n}))}s(e._id)}async function h(e){await r({title:f(),description:o(),confirmLabel:p(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&s(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),` `,(0,Y.jsx)(`strong`,{children:u()}),` `,H()]}),(0,Y.jsx)(q,{title:d(),rows:e,emptyHint:V(),isExpanded:e=>a===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:b(),cell:e=>K(e.at),sort:e=>e.at},{header:U(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:B(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:v(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${k({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:T(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:E(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:N()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:w()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?z():S(),onSelect:()=>void m(e)},{label:O(),onSelect:()=>void h(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AI as i,BI as a,Bc as o,CI as s,CL as c,DI as l,EI as u,FI as d,GI as f,HI as p,II as m,JB as h,JI as g,KI as _,LI as v,Lc as ee,MI as te,NI as ne,OI as re,PI as ie,QI as ae,RI as oe,Rc as se,SI as y,SL as ce,TI as le,UI as ue,VI as b,WI as de,XI as fe,YB as pe,YI as me,ZI as he,_I as ge,_L as _e,aI as ve,aL as ye,aV as x,bI as be,bL as xe,cI as Se,cL as Ce,dI as we,dL as Te,eL as Ee,fI as De,fL as Oe,gI as ke,gL as Ae,hI as je,hL as Me,iI as Ne,iL as Pe,jI as Fe,kI as Ie,lI as Le,lL as Re,mI as ze,mL as S,nI as Be,nL as Ve,oI as C,oL as He,oV as w,pI as Ue,pL as We,qB as Ge,qI as Ke,r as qe,rI as Je,rL as Ye,rV as Xe,sI as Ze,sL as Qe,t as T,tL as $e,uI as E,uL as et,vI as tt,vL as nt,wI as rt,wL as it,xI as at,xL as ot,yI as st,yL as ct,zI as lt,zc as D}from"./api-DRlXTl06.js";import{t as O}from"./x-BM-3QiyY.js";import{t as k}from"./button-CTuIl1H-.js";import{$ as A,Et as j,Fn as ut,Ft as dt,G as ft,It as M,K as pt,Lt as mt,Mt as ht,Nt as gt,Pn as N,Pt as P,Q as F,Un as I,X as L,Z as R,et as z,jt as B,ln as V,q as H,ut as U}from"./index-D48cFy6f.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-Bf8slN_1.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-D0yilGWI.js";import{t as Dt}from"./TimeRangePicker-Cq_PGNzt.js";import{t as Ot}from"./FilterBar-Of8GWz2N.js";import{t as kt}from"./AdvancedFilter-DhMwg7nB.js";var q=t(e(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Pt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function J(e,t,n){return Pt(e,t,n)>=At}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(le());if(e.size>Lt)throw Error(rt());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(y());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Nt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(y());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);J(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),p.putImageData(e,0,0)}let m=J(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Bt)??await Y(f,`image/png`);if(!h)throw Error(at());return{blob:h,hasAlpha:m}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ut(e)}async function Ut(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(s())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?pe():e===`dark`?h():Ge()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:s}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:qe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(I,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),s?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:s,"aria-label":o(),title:o(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=w(T.charts.listMyCharts),r=x(T.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ae()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Me()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:S(),subtitle:We(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?Oe():n.via===`owner`?Te():et({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Re()}):null]})}function Qt(){let e=x(T.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1);async function m(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(b())}}}async function h(){if(s(null),l(!1),t.trim()===``){s(lt());return}let a;try{a=JSON.parse(r)}catch{s(b());return}d(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:me()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Ke()}),(0,X.jsx)(B,{value:t,onChange:e=>n(e.target.value),placeholder:_(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:f()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:de(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(V,{className:`size-4`}),ue(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void m(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void h(),children:p()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:a()}):null]})]})}function $t({chart:e}){let t=Xe(T.charts.setChartLogo),n=x(T.charts.removeChartLogo),[r,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function d(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Vt(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function f(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await d(e,n)}async function p(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function m(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await d(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function h({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?te():Fe()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(V,{className:`size-4`}),t?Ie():i(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void f(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void m(e),children:l()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:re()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ne()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(h,{mode:`light`}),(0,X.jsx)(h,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:u()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=w(T.me.getMe,{host:H}),n=x(T.charts.addChartDomain),r=x(T.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){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 f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:be()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ke()}):u.map(e=>(0,X.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":je({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(B,{value:i,onChange:e=>a(e.target.value),placeholder:tt(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:ge()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:st()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=x(T.charts.updateChart),n=x(T.charts.deleteChart),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.name),[s,c]=(0,q.useState)(()=>$(e.tokens)),[l,u]=(0,q.useState)(e.tokens.bpm??0),[f,p]=(0,q.useState)(null),[m,h]=(0,q.useState)(!1);function g(){o(e.name),c($(e.tokens)),u(e.tokens.bpm??0),p(null),i(!0)}async function _(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(s)}catch{p(b());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:g,children:d()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:ie()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:De()}),(0,X.jsx)(B,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":D()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?se():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ee()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:we()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void _(),children:ze()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Ue()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=w(T.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:m()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=x(T.charts.addChartToGroupPool),i=x(T.charts.removeChartFromGroupPool),a=e.restrictedToGroups,o=e.poolGroups,s=new Set((o??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await i({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(j,{variant:a?`secondary`:`outline`,className:`oc-chart-avail__state`,children:a?$e():e.kind===`custom`&&e.scope===`personal`?C():Ve()}),e.isGlobalDefault?(0,X.jsx)(j,{variant:`default`,children:Ee()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ae()}),(o??[]).map(e=>(0,X.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":fe({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(L,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(A,{size:`sm`,className:`w-56`,children:(0,X.jsx)(z,{placeholder:he()})}),(0,X.jsx)(R,{children:c.map(e=>(0,X.jsx)(F,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:r()}):null]})]})}function an({chart:e}){let t=x(T.charts.promoteChartToCommon),n=x(T.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(j,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ve():C()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ze({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Ne()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Je()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=x(T.admin.setDefaultThemeMode),i=x(T.admin.setDefaultLocale),a=x(T.charts.setDefaultChart),o=w(T.charts.listChartsAdmin),s=w(T.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:nt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:S()}),pt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:He()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{chart:e,groups:s??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Pe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ye()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Le()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(an,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:it()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ot()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(k,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]})]})}function sn(){let e=w(T.me.getMe,{host:H}),t=ft(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Z),[c,l]=(0,q.useState)(Z),[u,d]=(0,q.useState)(Gt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Gt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(sn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:ct()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(N,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(j,{variant:`outline`,children:`Outline`}),(0,X.jsx)(j,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(B,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(L,{value:n,onValueChange:r,children:[(0,X.jsx)(A,{className:`w-56`,children:(0,X.jsx)(z,{placeholder:`Select…`})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(F,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(U,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(L,{value:o,onValueChange:s,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes directions`}),(0,X.jsx)(F,{value:`inbound`,children:`inbound`}),(0,X.jsx)(F,{value:`outbound`,children:`outbound`}),(0,X.jsx)(F,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(L,{value:c,onValueChange:l,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(F,{value:`info`,children:`info`}),(0,X.jsx)(F,{value:`warn`,children:`warn`}),(0,X.jsx)(F,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(ht,{children:[(0,X.jsx)(mt,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(N,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(dt,{children:`Actions`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(U,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(U,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(j,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(I,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(N,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AI as i,BI as a,Bc as o,CI as s,CL as c,DI as l,EI as u,FI as d,GI as f,HI as p,II as m,JB as h,JI as g,KI as _,LI as v,Lc as ee,MI as te,NI as ne,OI as re,PI as ie,QI as ae,RI as oe,Rc as se,SI as y,SL as ce,TI as le,UI as ue,VI as b,WI as de,XB as fe,XI as pe,YB as me,YI as he,ZI as ge,_I as _e,_L as ve,aI as ye,aL as be,bI as xe,bL as Se,cI as Ce,cL as we,dI as Te,dL as Ee,eL as De,fI as Oe,fL as ke,gI as Ae,gL as je,hI as Me,hL as Ne,iI as Pe,iL as Fe,iV as Ie,jI as Le,kI as Re,lI as ze,lL as Be,mI as Ve,mL as x,nI as He,nL as Ue,oI as S,oL as We,oV as C,pI as Ge,pL as Ke,qI as qe,r as Je,rI as Ye,rL as Xe,sI as Ze,sL as Qe,sV as w,t as T,tL as $e,uI as E,uL as et,vI as tt,vL as nt,wI as rt,wL as it,xI as at,xL as ot,yI as st,yL as ct,zI as lt,zc as D}from"./api-Dawxt_aS.js";import{t as O}from"./x-BSVAMcNy.js";import{t as k}from"./button-alklyZ2M.js";import{$ as A,Et as j,Fn as ut,Ft as dt,G as ft,It as M,K as pt,Lt as mt,Mt as ht,Nt as gt,Pn as N,Pt as P,Q as F,Un as I,X as L,Z as R,et as z,jt as B,ln as V,q as H,ut as U}from"./index-C-ySA5Hs.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-CDvn9R5v.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-CJ3_5RvQ.js";import{t as Dt}from"./TimeRangePicker-DVMsYipt.js";import{t as Ot}from"./FilterBar-D_6ObXjr.js";import{t as kt}from"./AdvancedFilter-DzABuYe4.js";var q=t(e(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Pt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function J(e,t,n){return Pt(e,t,n)>=At}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(le());if(e.size>Lt)throw Error(rt());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(y());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Nt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(y());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);J(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),p.putImageData(e,0,0)}let m=J(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Y(f,`image/webp`,Bt)??await Y(f,`image/png`);if(!h)throw Error(at());return{blob:h,hasAlpha:m}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ut(e)}async function Ut(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(s())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Y(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?fe():e===`dark`?me():h()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:s}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Je(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(I,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Yt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),s?(0,X.jsx)(k,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:s,"aria-label":o(),title:o(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=w(T.charts.listMyCharts),r=C(T.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:je()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Xt,{selected:e===null,title:x(),subtitle:Ke(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?ke():n.via===`owner`?Ee():et({group:n.via.group});return(0,X.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Be()}):null]})}function Qt(){let e=C(T.charts.importChart),[t,n]=(0,q.useState)(``),[r,i]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1),[u,d]=(0,q.useState)(!1);async function m(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),l(!1);try{i(await t.text())}catch{s(b())}}}async function h(){if(s(null),l(!1),t.trim()===``){s(lt());return}let a;try{a=JSON.parse(r)}catch{s(b());return}d(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{d(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:he()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:g()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:qe()}),(0,X.jsx)(B,{value:t,onChange:e=>n(e.target.value),placeholder:_(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:f()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:de(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(V,{className:`size-4`}),ue(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void m(e)})]})}),(0,X.jsx)(k,{size:`sm`,disabled:u,onClick:()=>void h(),children:p()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:a()}):null]})]})}function $t({chart:e}){let t=Ie(T.charts.setChartLogo),n=C(T.charts.removeChartLogo),[r,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(null),c=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function d(n,r,i){if(e.chartId!==void 0){s(null),a(!0);try{let{blob:a,hasAlpha:o}=await Vt(r,i?{variantFor:i}:{}),s=await a.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function f(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await d(e,n)}async function p(t){if(e.chartId!==void 0){s(null),a(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}async function m(e){let t=c(e===`light`?`dark`:`light`);if(t){s(null),a(!0);try{await d(e,await(await fetch(t)).blob(),e)}catch(e){s(e instanceof Error?e.message:String(e))}finally{a(!1)}}}function h({mode:e}){let t=c(e),n=c(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?te():Le()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(V,{className:`size-4`}),t?Re():i(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void f(e,t)})]})}),!t&&n?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void m(e),children:l()}):null,t?(0,X.jsx)(k,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void p(e),children:re()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ne()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(h,{mode:`light`}),(0,X.jsx)(h,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:u()}):null,o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})}function en({chart:e}){let t=w(T.me.getMe,{host:H}),n=C(T.charts.addChartDomain),r=C(T.charts.removeChartDomain),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(null),[c,l]=(0,q.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){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 f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:xe()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ae()}):u.map(e=>(0,X.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Me({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(O,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(B,{value:i,onChange:e=>a(e.target.value),placeholder:tt(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(k,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:_e()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:st()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function tn({chart:e}){let t=C(T.charts.updateChart),n=C(T.charts.deleteChart),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(e.name),[s,c]=(0,q.useState)(()=>$(e.tokens)),[l,u]=(0,q.useState)(e.tokens.bpm??0),[f,p]=(0,q.useState)(null),[m,h]=(0,q.useState)(!1);function g(){o(e.name),c($(e.tokens)),u(e.tokens.bpm??0),p(null),i(!0)}async function _(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(s)}catch{p(b());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function v(){if(e.chartId!==void 0&&window.confirm(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:g,children:d()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void v(),children:ie()})]})})]}),r?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Oe()}),(0,X.jsx)(B,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:D()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":D()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?se():`${l} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:ee()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:Te()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,disabled:m,onClick:()=>void _(),children:Ve()}),(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:Ge()})]})]}):null,(0,X.jsx)($t,{chart:e}),(0,X.jsx)(en,{chart:e})]})}function nn(){let e=w(T.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:oe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:v()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:m()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(tn,{chart:e},e.key))})]})}function rn({chart:e,groups:t}){let n=C(T.charts.addChartToGroupPool),i=C(T.charts.removeChartFromGroupPool),a=e.restrictedToGroups,o=e.poolGroups,s=new Set((o??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await i({groupId:t,chartKey:e.key})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(j,{variant:a?`secondary`:`outline`,className:`oc-chart-avail__state`,children:a?$e():e.kind===`custom`&&e.scope===`personal`?S():Ue()}),e.isGlobalDefault?(0,X.jsx)(j,{variant:`default`,children:De()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:ae()}),(o??[]).map(e=>(0,X.jsxs)(j,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":pe({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(O,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(L,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(A,{size:`sm`,className:`w-56`,children:(0,X.jsx)(z,{placeholder:ge()})}),(0,X.jsx)(R,{children:c.map(e=>(0,X.jsx)(F,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:r()}):null]})]})}function an({chart:e}){let t=C(T.charts.promoteChartToCommon),n=C(T.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(E()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(j,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ye():S()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ze({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(k,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:Pe()}):null,(0,X.jsx)(k,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:Ye()})]})]})}function on({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=C(T.admin.setDefaultThemeMode),i=C(T.admin.setDefaultLocale),a=C(T.charts.setDefaultChart),o=w(T.charts.listChartsAdmin),s=w(T.groups.listGroups,{}),l=e??`system`,u=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:nt()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:we()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Qe()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:x()}),pt.map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(k,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:We()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:be()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(rn,{chart:e,groups:s??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Fe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Xe()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(en,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ce()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:He()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(an,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:it()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:c()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(k,{variant:l===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:qt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ce()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ot()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(k,{variant:u===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]})]})}function sn(){let e=w(T.me.getMe,{host:H}),t=ft(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)(Qt,{}),(0,X.jsx)(nn,{}),e?.role===`admin`?(0,X.jsx)(on,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function cn(){let[e,t]=(0,q.useState)(!0),[n,r]=(0,q.useState)(`per-user`),[i,a]=(0,q.useState)(``),[o,s]=(0,q.useState)(Z),[c,l]=(0,q.useState)(Z),[u,d]=(0,q.useState)(Gt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Gt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(sn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:ct()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(k,{variant:`outline`,children:`Outline`}),(0,X.jsx)(k,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(k,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(k,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(k,{size:`sm`,children:`Small`}),(0,X.jsx)(k,{children:`Default`}),(0,X.jsx)(k,{size:`lg`,children:`Large`}),(0,X.jsx)(k,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(N,{})}),(0,X.jsx)(k,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(j,{variant:`outline`,children:`Outline`}),(0,X.jsx)(j,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(B,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(L,{value:n,onValueChange:r,children:[(0,X.jsx)(A,{className:`w-56`,children:(0,X.jsx)(z,{placeholder:`Select…`})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(F,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(U,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(L,{value:o,onValueChange:s,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes directions`}),(0,X.jsx)(F,{value:`inbound`,children:`inbound`}),(0,X.jsx)(F,{value:`outbound`,children:`outbound`}),(0,X.jsx)(F,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(L,{value:c,onValueChange:l,children:[(0,X.jsx)(A,{size:`sm`,children:(0,X.jsx)(z,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(F,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(F,{value:`info`,children:`info`}),(0,X.jsx)(F,{value:`warn`,children:`warn`}),(0,X.jsx)(F,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:Kt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(ht,{children:[(0,X.jsx)(mt,{asChild:!0,children:(0,X.jsx)(k,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(N,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(dt,{children:`Actions`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{children:`Edit`}),(0,X.jsx)(P,{children:`Duplicate`}),(0,X.jsx)(M,{}),(0,X.jsx)(P,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(k,{size:`sm`,children:`Save`}),(0,X.jsx)(k,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(U,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(U,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(j,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(I,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(k,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(N,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{cn as ThemeShowroom};