@lacneu/atrium 0.87.2 → 0.88.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/assets/AccessTab-ltWQiPGn.js +1 -0
  2. package/dist/assets/{AdvancedFilter-ksMf6bcD.js → AdvancedFilter-D_IAxoTH.js} +1 -1
  3. package/dist/assets/AgentFilesTab-DKg-5AOZ.js +3 -0
  4. package/dist/assets/AnomaliesTab-Dshz0Xdo.js +1 -0
  5. package/dist/assets/AuditTab-DZViPs0S.js +1 -0
  6. package/dist/assets/BridgeTab-CULepdP_.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-BW8xCDPC.js +1 -0
  8. package/dist/assets/{DataTableShell-K5cImuMP.js → DataTableShell-CgfEZzcq.js} +1 -1
  9. package/dist/assets/{DetailChips-Xge7xE-L.js → DetailChips-BWOhDvfm.js} +1 -1
  10. package/dist/assets/FeedbacksTab-CtKRbyAA.js +1 -0
  11. package/dist/assets/{FieldLabel-DVWzsIR3.js → FieldLabel-ObN4xPwN.js} +1 -1
  12. package/dist/assets/FilesTab-CmzQqlbZ.js +1 -0
  13. package/dist/assets/{FilterBar-DLMcpn_E.js → FilterBar-YVVbd65x.js} +1 -1
  14. package/dist/assets/GroupsTab-C4hW_HZp.js +1 -0
  15. package/dist/assets/InstancesTab-BScBfWJZ.js +1 -0
  16. package/dist/assets/IntegrationsTab-BoN5nv7u.js +1 -0
  17. package/dist/assets/KpiTab-CZk6V7_p.js +1 -0
  18. package/dist/assets/PreferencesTab-C6_BZOL8.js +1 -0
  19. package/dist/assets/ProjectPage-D0_yFA88.js +1 -0
  20. package/dist/assets/PromptInjectionsTab-BToYYWRN.js +4 -0
  21. package/dist/assets/RolesTab-Dqf82Nw4.js +1 -0
  22. package/dist/assets/ScheduledTab-DgYEuqzx.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-BuxSQV5z.js +1 -0
  24. package/dist/assets/SubAgentReportsTab-CbhBlx3_.js +1 -0
  25. package/dist/assets/ThemeShowroom-Bq3JZseY.js +1 -0
  26. package/dist/assets/{TimeRangePicker-BIobKXvm.js → TimeRangePicker-Bo3B16zc.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-C_pawxor.js → TimezoneCombobox-DvhM5ae3.js} +1 -1
  28. package/dist/assets/TracesTab-BYz48MmX.js +1 -0
  29. package/dist/assets/UsersTab-CRl1CgUo.js +1 -0
  30. package/dist/assets/VoiceTab-D9o7TRAg.js +1 -0
  31. package/dist/assets/api-CKGeK7QS.js +44 -0
  32. package/dist/assets/{button-C7mIcWuE.js → button-HWWS6bgL.js} +1 -1
  33. package/dist/assets/{card-D96d_4Et.js → card-MbRTJSAv.js} +1 -1
  34. package/dist/assets/chevrons-up-down-AQ82L9UQ.js +1 -0
  35. package/dist/assets/{compatView-D2UZENK3.js → compatView-Bc7ErYFT.js} +1 -1
  36. package/dist/assets/dispatchErrorInfo-cGLdZODI.js +1 -0
  37. package/dist/assets/{dist-CLt4MJ3r.js → dist-BVlixrts.js} +1 -1
  38. package/dist/assets/{dist-CNXx0sNo.js → dist-CgIoeCFu.js} +1 -1
  39. package/dist/assets/{dist-CU23SxxP.js → dist-QaMCaCpK.js} +1 -1
  40. package/dist/assets/{highlighted-body-OFNGDK62-CO9Mn_bf.js → highlighted-body-OFNGDK62-BHc3abNI.js} +1 -1
  41. package/dist/assets/index-0DcZwf39.css +1 -0
  42. package/dist/assets/index-BZLPehFE.js +327 -0
  43. package/dist/assets/{list-PsjK33SL.js → list-CTSN7gc5.js} +1 -1
  44. package/dist/assets/mermaid-GHXKKRXX-vvzO9QCP.js +1 -0
  45. package/dist/assets/{pdf-jxqL4Jk_.js → pdf-CMtKos9j.js} +1 -1
  46. package/dist/assets/roleDescriptions-B2IUxsB1.js +1 -0
  47. package/dist/assets/{table-CXJLU3m_.js → table-VhRaEfeZ.js} +1 -1
  48. package/dist/assets/x-CZJSCjdP.js +1 -0
  49. package/dist/index.html +8 -8
  50. package/package.json +1 -1
  51. package/dist/assets/AccessTab-BjWb2utN.js +0 -1
  52. package/dist/assets/AgentFilesTab-DAHA88Tu.js +0 -3
  53. package/dist/assets/AnomaliesTab-CVua97lJ.js +0 -1
  54. package/dist/assets/AuditTab-hTs6iFsI.js +0 -1
  55. package/dist/assets/BridgeTab-DPbj0zcY.js +0 -1
  56. package/dist/assets/ChatDefaultsTab-CdYRaOgV.js +0 -1
  57. package/dist/assets/FeedbacksTab-CvTz752R.js +0 -1
  58. package/dist/assets/FilesTab-BOw97zky.js +0 -1
  59. package/dist/assets/GroupsTab-D5ycprxr.js +0 -1
  60. package/dist/assets/InstancesTab-TaKSA8bY.js +0 -1
  61. package/dist/assets/IntegrationsTab-D59mPoaZ.js +0 -1
  62. package/dist/assets/KpiTab-1Hx_0Uao.js +0 -1
  63. package/dist/assets/PreferencesTab-3cXC4S1l.js +0 -1
  64. package/dist/assets/ProjectPage-nBPDSUUX.js +0 -1
  65. package/dist/assets/PromptInjectionsTab-BHhqTYDk.js +0 -4
  66. package/dist/assets/RolesTab-DWR9sNW0.js +0 -1
  67. package/dist/assets/ScheduledTab-R_UJhAFC.js +0 -1
  68. package/dist/assets/ServiceAccountsTab-CJoq437S.js +0 -1
  69. package/dist/assets/SubAgentReportsTab-DCrEW3GB.js +0 -1
  70. package/dist/assets/ThemeShowroom-BePky4K4.js +0 -1
  71. package/dist/assets/TracesTab-l-lueZac.js +0 -1
  72. package/dist/assets/UsersTab-CNvCzpBh.js +0 -1
  73. package/dist/assets/VoiceTab-LihfD0So.js +0 -1
  74. package/dist/assets/api-CnXjOprV.js +0 -44
  75. package/dist/assets/chevrons-up-down-CPB13Hhb.js +0 -1
  76. package/dist/assets/dispatchErrorInfo-Ct8igIIE.js +0 -1
  77. package/dist/assets/index-0t8eOneo.js +0 -327
  78. package/dist/assets/index-CURSwr6F.css +0 -1
  79. package/dist/assets/mermaid-GHXKKRXX-BxbNoi0T.js +0 -1
  80. package/dist/assets/roleDescriptions-Bm8ptI3N.js +0 -1
  81. package/dist/assets/x-Cd7Svlfj.js +0 -1
@@ -0,0 +1 @@
1
+ import{$k as e,Qk as t,Zk as n,eA as r,tA as i}from"./api-CKGeK7QS.js";var a={pending:i,user:r,admin:e,observer:t,agent:n};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-CnXjOprV.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
1
+ import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-CKGeK7QS.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
@@ -0,0 +1 @@
1
+ import{D as e}from"./api-CKGeK7QS.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
package/dist/index.html CHANGED
@@ -62,15 +62,15 @@
62
62
  document.documentElement.dataset.motion = "static";
63
63
  })();
64
64
  </script>
65
- <script type="module" crossorigin src="/assets/index-0t8eOneo.js"></script>
65
+ <script type="module" crossorigin src="/assets/index-BZLPehFE.js"></script>
66
66
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
67
- <link rel="modulepreload" crossorigin href="/assets/api-CnXjOprV.js">
68
- <link rel="modulepreload" crossorigin href="/assets/dist-CLt4MJ3r.js">
69
- <link rel="modulepreload" crossorigin href="/assets/dist-CU23SxxP.js">
70
- <link rel="modulepreload" crossorigin href="/assets/dist-CNXx0sNo.js">
71
- <link rel="modulepreload" crossorigin href="/assets/x-Cd7Svlfj.js">
72
- <link rel="modulepreload" crossorigin href="/assets/button-C7mIcWuE.js">
73
- <link rel="stylesheet" crossorigin href="/assets/index-CURSwr6F.css">
67
+ <link rel="modulepreload" crossorigin href="/assets/api-CKGeK7QS.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/dist-BVlixrts.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/dist-QaMCaCpK.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/dist-CgIoeCFu.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/x-CZJSCjdP.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/button-HWWS6bgL.js">
73
+ <link rel="stylesheet" crossorigin href="/assets/index-0DcZwf39.css">
74
74
  </head>
75
75
  <body>
76
76
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.87.2",
3
+ "version": "0.88.1",
4
4
  "description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CG as r,MG as i,av as a,cv as o,dv as s,fv as c,hv as l,iv as u,lv as d,mv as f,nv as p,ov as m,pv as h,rv as g,sv as _,t as v,tv as y,uv as b}from"./api-CnXjOprV.js";import{At as x,et as S,it as C,nt as w,rt as T,tt as E}from"./index-0t8eOneo.js";var D=t(e(),1);function O(e){return e===`user`?a():e===`all`?u():g({group:e.group})}function k(e){return e===`common`?p():e===`owner`?y():g({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=i(v.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=i(v.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:l()}),(0,A.jsxs)(S,{value:t,onValueChange:n,children:[(0,A.jsx)(T,{size:`sm`,"aria-label":f(),children:(0,A.jsx)(C,{placeholder:f()})}),(0,A.jsx)(E,{children:(e??[]).map(e=>(0,A.jsx)(w,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:h()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(x,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:s()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(x,{variant:`default`,children:m()}):null,(0,A.jsx)(x,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(x,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:d()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(x,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:o()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(x,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,Ah as i,Au as a,Bh as o,CG as s,Ch as c,Cu as l,Dh as u,Du as d,Eh as f,Eu as p,Fh as m,Fu as h,Gh as g,Hh as _,Ih as v,Jl as y,Kh as b,Lh as x,MG as S,Mh as C,Mu as w,Ng as T,Nh as E,Nu as D,Oh as ee,Ou as O,PI as k,Ph as A,Pu as j,Ql as M,Rh as N,Sh as P,Su as F,TG as te,Ta as ne,Th as re,Tu as I,Uh as ie,Vh as L,Wh as R,Xl as z,Yl as B,Zl as V,_u as H,bh as ae,bu as oe,gu as U,hu as se,jG as ce,jg as le,jh as ue,ju as de,kG as W,kh as fe,ku as pe,qh as me,ql as he,t as G,vh as ge,vu as _e,wh as ve,wu as ye,xh as be,xu as xe,yh as Se,yu as Ce,zh as we}from"./api-CnXjOprV.js";import{t as K}from"./button-C7mIcWuE.js";import{At as Te,Ct as Ee,Dt as De,Et as Oe,Ot as ke,St as Ae,Tt as je,V as Me,Z as Ne,at as Pe,et as Fe,it as Ie,jt as q,kt as Le,lt as Re,nt as ze,ot as Be,rt as Ve,st as He,tt as Ue,un as J,ut as We,wt as Ge}from"./index-0t8eOneo.js";import{n as Ke,t as qe}from"./curation-CQksaIbm.js";import{a as Je}from"./compatView-D2UZENK3.js";/* empty css */var Y=t(e(),1),X=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
2
- `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
- `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=S(G.me.getMe,{host:Ne}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=S(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,c]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&c(r[0].name)},[t,r,i]);let l=S(G.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),u=S(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),d=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return i===null||l===void 0?r!==void 0&&r.length===0?[]:void 0:l.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(u!==void 0)return u.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,l,r,u]),[f,p]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!d||d.length===0||(!f||!d.some(e=>$(e)===f))&&p($(d[0]))},[d,f]);let h=d?.find(e=>$(e)===f)??null,y=W(G.agentFiles.listAgentFiles),[C,T]=(0,Y.useState)({status:`idle`}),E=h?.instanceName??null,D=h?.agentId??null,ee=S(G.compat.forInstance,n&&E!==null?{instanceName:E}:`skip`),O=n&&E!==null?Me(ee,`agentFiles`):null,k=O===null?!1:O===`loading`?null:O.blocked,A=(0,Y.useCallback)(async()=>{if(!(E===null||D===null)){T({status:`loading`});try{T({status:`done`,files:(await y({instanceName:E,agentId:D})).files})}catch(e){T({status:`error`,dashboardAbsent:tt(e)})}}},[y,E,D]);(0,Y.useEffect)(()=>{k===!1&&A()},[A,k]);let[j,M]=(0,Y.useState)(null),P=S(G.agentFileCuration.listCurations,t&&E!==null&&D!==null?{instanceName:E,agentId:D}:`skip`),F=S(G.agentFileCuration.curationSettings,t&&E!==null?{instanceName:E}:`skip`),re=W(G.agentFileCuration.requestCuration),[I,z]=(0,Y.useState)(null),[B,V]=(0,Y.useState)(null),{toast:H}=q(),ae=(0,Y.useMemo)(()=>{let e=new Map;for(let t of P??[])e.has(t.name)||e.set(t.name,t);return e},[P]),oe=(0,Y.useCallback)(async e=>{if(!(E===null||D===null)){z(e);try{let t=await re({instanceName:E,agentId:D,name:e,trigger:`manual`});t.ok?H({title:w(),variant:`success`}):H({title:de({reason:t.reason??`unknown`}),variant:`error`})}catch{H({title:a(),variant:`error`})}finally{z(null)}}},[re,E,D,H]),U=te(),se=(0,Y.useMemo)(()=>new Intl.NumberFormat(U,{maximumFractionDigits:0}),[U]);return e===void 0||d===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Fe,{value:i??``,onValueChange:e=>c(e),children:[(0,Q.jsx)(Ve,{size:`sm`,"aria-label":b(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ue,{children:(r??[]).map(e=>(0,Q.jsx)(ze,{value:e.name,children:e.name},e.name))})]}):null,d.length>0?(0,Q.jsxs)(Fe,{value:f??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(Ve,{size:`sm`,"aria-label":g(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ue,{children:d.map(e=>(0,Q.jsx)(ze,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()})]}),h===null?null:O===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):O!==null&&O.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,Je(O.gatewayVersion,O.provider)]}):C.status===`loading`||C.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):C.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[C.dashboardAbsent?ne():_(),` `,!C.dashboardAbsent&&(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void A(),children:le()})]}):C.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:C.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Te,{variant:`outline`,children:L()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:o({size:Z(e.size,U)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:we({pct:se.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":N()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>M(e),children:t?v():m()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:qe.includes(e.name),size:e.size??0,budget:F?.budgetChars??null,enabled:F?.enabled??!1,curation:ae.get(e.name)??null,inFlight:I===e.name,onCurate:()=>void oe(e.name),onReview:e=>V(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:x({used:Z(Qe(C.files),U),total:Z(Ye,U),pct:se.format(Ze(Qe(C.files)))})})]}),j&&h?(0,Q.jsx)(at,{instanceName:h.instanceName,agentId:h.agentId,name:j.name,isAdmin:t,onClose:()=>M(null),onSaved:()=>void A()}):null,B?(0,Q.jsx)(ot,{curationId:B,onClose:()=>V(null),onApplied:()=>{V(null),A()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:o,onReview:s}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:j()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Te,{variant:`outline`,className:`oc-afiles__curate-status`,children:D()}):e&&r&&n!==null&&Ke(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:h()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:a,onSaved:o}){let l=W(G.agentFiles.getAgentFile),d=W(G.agentFiles.setAgentFile),p=q(),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(!1),[S,w]=(0,Y.useState)(!1),[D,O]=(0,Y.useState)(!1),[j,M]=(0,Y.useState)(!1),N=(0,Y.useCallback)(async r=>{_(!1);try{let i=await l({instanceName:e,agentId:t,name:n});h({content:i.content,updatedAtMs:i.updatedAtMs}),r||y(i.content),O(!1)}catch{_(!0)}},[l,e,t,n]);(0,Y.useEffect)(()=>{N(!1)},[N]);async function F(){if(m!==null){w(!0),M(!1);try{await d({instanceName:e,agentId:t,name:n,content:v,baseUpdatedAtMs:m.updatedAtMs??void 0}),p.success(ee({name:n})),o(),await N(!1)}catch(e){nt(e)?O(!0):M(!0)}finally{w(!1)}}}let ne=m!==null&&v!==m.content,I=(0,Y.useMemo)(()=>m===null?null:et(m.content,v),[m,v]),ie=v.length>X,L=te(),R=(0,Y.useMemo)(()=>new Intl.NumberFormat(L),[L]);return(0,Q.jsx)(Pe,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Be,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(We,{children:A({name:n})}),(0,Q.jsxs)(He,{children:[E({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,C()]})]})]}),g?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[f(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void N(!1),children:le()})]}):m===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:v,readOnly:!r,spellCheck:!1,onChange:e=>y(e.target.value),"aria-label":A({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ue()}),D?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[re(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void N(!0),children:ve()})]}):null,j?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:u()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:i({count:R.format(v.length),max:R.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!ne||S||D,onClick:()=>x(!0),children:S?T():fe()}):null]})]}),(0,Q.jsx)(Ae,{open:b,onOpenChange:x,children:(0,Q.jsxs)(je,{children:[(0,Q.jsxs)(ke,{children:[(0,Q.jsx)(Le,{children:c({name:n})}),(0,Q.jsx)(Oe,{children:P({agent:t})})]}),I?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:be({added:I.added,removed:I.removed})}),I.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:ae()}),I.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,I.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:Se()}),I.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Ge,{children:k()}),(0,Q.jsx)(Ee,{onClick:()=>void F(),children:ge()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let i=S(G.agentFileCuration.getProposal,{curationId:e}),o=W(G.agentFileCuration.approveCuration),c=ce(G.agentFileCuration.rejectCuration),{toast:u}=q(),[f,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(``),b=te(),x=(0,Y.useMemo)(()=>i?et(i.beforeContent,i.proposedContent):null,[i]);async function C(){m(`approve`);try{let t=await o({curationId:e});t.ok?(u({title:pe(),variant:`success`}),n()):u({title:t.reason===`conflict`?d():p({reason:t.reason??`unknown`}),variant:`error`})}catch{u({title:a(),variant:`error`})}finally{m(null)}}async function w(n){m(`reject`);try{let r=_.trim();(await c({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?u({title:n?y():O(),variant:`success`}):u({title:l(),variant:`error`}),t()}catch{u({title:a(),variant:`error`})}finally{m(null)}}return(0,Q.jsx)(Pe,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Be,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(We,{children:i?I({name:i.name}):s()}),(0,Q.jsx)(He,{children:ye()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[F({before:Z(i.beforeSize,b),after:Z(i.proposedSize,b)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,xe()]}):null]}),x?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:oe({added:x.added,removed:x.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:he({feedback:i.feedback})}):null,x&&x.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:se()}),(0,Q.jsx)(`ul`,{children:x.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:U()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:Ce()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),h?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:r()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:M(),value:_,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>g(!1),disabled:f!==null,children:V()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void w(!1),disabled:f!==null,children:f===`reject`?T():z()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void w(!0),disabled:f!==null,children:f===`reject`?T():B()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>g(!0),disabled:f!==null||i==null,children:_e()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void C(),disabled:f!==null||i==null,children:f===`approve`?T():H()})]})]})})}export{rt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,AO as i,CO as ee,DO as te,EO as a,FO as o,GD as s,HD as c,IO as l,JD as u,KD as d,LO as f,MG as p,MO as ne,NO as m,OO as re,PO as ie,QD as ae,SO as oe,TO as se,UD as h,WD as g,XD as ce,YD as _,ZD as le,_O as ue,aO as de,bO as fe,cO as v,dO as y,eO as pe,fO as me,gO as he,hO as ge,iO as _e,jG as ve,jO as ye,kO as be,lO as b,mO as x,nO as xe,oO as S,pO as C,qD as w,rO as T,sO as E,t as D,tO as O,uO as k,vO as A,wO as j,xO as M,yO as Se}from"./api-CnXjOprV.js";import{At as N,Gn as P,Kn as Ce,Z as we,at as F,et as I,ft as L,i as Te,it as R,jt as Ee,lt as z,nt as B,o as De,ot as V,q as Oe,rt as H,tt as U,ut as W}from"./index-0t8eOneo.js";import{n as ke}from"./TimeRangePicker-BIobKXvm.js";import{t as Ae}from"./FilterBar-DLMcpn_E.js";import{t as je}from"./DataTableShell-K5cImuMP.js";import{t as G}from"./dispatchErrorInfo-Ct8igIIE.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?f():e===`acknowledged`?l():o()}var Pe=[`info`,`warn`,`critical`],Fe=[`detector`,`agent`,`user`],Ie={kind:`relative`,from:`now-30d`,to:`now`},Le=200,Y=`all`;function X(){let e=Ce({from:`/settings/anomalies`}),t=P({from:`/settings/anomalies`}),n=e.q??``,o=e.status===Y?J:e.status,s=e.severity??J,c=e.kind??J,[l,u]=(0,K.useState)(J),d=Te(e.from,e.to),{from:f,to:h}=ke(d),g=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),_=e=>void t({search:t=>({...t,status:e===J?Y:e})}),w=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),F=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),z=e=>void t({search:t=>({...t,...De(e)})}),V=Oe(),W=Ee(),G=ve(D.anomalies.resolveAnomaly),X=(p(D.me.getMe,{host:we})?.permissions??[]).includes(`admin.manage`),Z=p(D.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:f,to:h,anomalyStatus:o===J?void 0:o,severity:s===J?void 0:s,source:l===J?void 0:l,kind:c===J?void 0:c}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),$=n!==``||o!==`open`||s!==J||l!==J||c!==J||d.kind!==`relative`||d.from!==Ie.from;function Ue(){u(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await V({title:ie(),description:(0,q.jsxs)(q.Fragment,{children:[m(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,ne(),` `,(0,q.jsx)(`strong`,{children:ye()}),`.`,` `,i()]}),confirmLabel:be()}))try{await G({anomalyId:e._id,status:`resolved`}),W.success(re(),e.kind)}catch(e){W.error(te(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),W.success(a(),e.kind)}catch(e){W.error(se(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[j(),` `,(0,q.jsx)(`strong`,{children:ee()}),` `,oe(),` `,(0,q.jsx)(`strong`,{children:M()}),` `,fe(),` `,(0,q.jsx)(`strong`,{children:Se()}),` `,A(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:ue()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:g,searchPlaceholder:he(),timeRange:d,onTimeRangeChange:z,onReset:Ue,canReset:$,children:[(0,q.jsxs)(I,{value:o,onValueChange:_,children:[(0,q.jsx)(H,{size:`sm`,className:`w-36`,children:(0,q.jsx)(R,{})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(B,{value:J,children:ge()}),Me.map(e=>(0,q.jsx)(B,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(I,{value:s,onValueChange:w,children:[(0,q.jsx)(H,{size:`sm`,className:`w-36`,children:(0,q.jsx)(R,{placeholder:x()})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(B,{value:J,children:k()}),Pe.map(e=>(0,q.jsx)(B,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:l,onValueChange:u,children:[(0,q.jsx)(H,{size:`sm`,className:`w-32`,children:(0,q.jsx)(R,{placeholder:b()})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(B,{value:J,children:v()}),Fe.map(e=>(0,q.jsx)(B,{value:e,children:e},e))]})]}),(0,q.jsxs)(I,{value:c,onValueChange:F,children:[(0,q.jsx)(H,{size:`sm`,className:`w-36`,children:(0,q.jsx)(R,{placeholder:E()})}),(0,q.jsxs)(U,{children:[(0,q.jsx)(B,{value:J,children:S()}),Q.map(e=>(0,q.jsx)(B,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:de(),rows:Z,emptyHint:o===`open`?_e():T(),rowActions:e=>X&&e.status===`open`?[{label:xe(),onSelect:()=>void We(e)},{label:O(),onSelect:()=>void Ge(e)}]:[],columns:[{header:pe(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:L(e.at)}),sort:e=>e.at},{header:E(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:C(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:y({when:L(e.firstAt)}),children:me({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:x(),cell:e=>(0,q.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:r(),cell:e=>(0,q.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:b(),cell:e=>(0,q.jsx)(N,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ae(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(ze,{row:e})]}),sort:e=>e.message},{header:le(),cell:e=>(0,q.jsx)(Re,{row:e}),sort:e=>e.evidence??null},{header:ce(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var Z=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Q(e){if(!Z.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Re({row:e}){let t=P();if(e.kind===`subagent.failure`){let n=$(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,_()]}):null]})}let n=Q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,q.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,_()]})}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,_()]}):null]})}function ze({row:e}){let[t,n]=(0,K.useState)(!1),r=p(D.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[u(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(F,{open:t,onOpenChange:n,children:(0,q.jsxs)(V,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(z,{children:(0,q.jsx)(W,{children:w()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:d()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:s()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,q.jsx)(N,{variant:`destructive`,children:g()}):e===`acknowledged`?(0,q.jsx)(N,{variant:`secondary`,children:h()}):(0,q.jsx)(N,{variant:`outline`,children:c()})}function He(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ak as r,Bk as i,Fk as a,Gc as o,Hk as s,Ik as c,Jc as l,Kc as u,Lk as d,MG as f,Mk as p,Nk as m,Pk as h,Rk as g,Uk as _,Vk as v,Wc as y,Yc as b,jk as x,kk as S,qc as C,t as w,zk as T}from"./api-CnXjOprV.js";import{Gn as E,Kn as D,a as O,et as k,ft as A,i as j,it as M,n as N,nt as P,o as F,rt as I,s as L,tt as R}from"./index-0t8eOneo.js";import{n as ee}from"./TimeRangePicker-BIobKXvm.js";import{t as z}from"./FilterBar-DLMcpn_E.js";import{t as B}from"./AdvancedFilter-ksMf6bcD.js";import{t as V}from"./DataTableShell-K5cImuMP.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:N,to:`now`},G=`__all__`,K=[{value:`action`,label:b()},{value:`realLabel`,label:l()},{value:`targetLabel`,label:C()},{value:`impersonated`,label:u()},{value:`resource`,label:o()},{value:`resourceId`,label:y()}];function q(){let e=D({from:`/settings/audit`}),t=E({from:`/settings/audit`}),n=e.q??``,o=e.action??G,l=e.impersonated??G,u=e.resource??G,y=j(e.from,e.to),b=(0,H.useMemo)(()=>L(e.adv),[e.adv]),{from:C,to:N}=ee(y),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...F(e)})}),Q=e=>void t({search:t=>({...t,adv:O(e)}),replace:!0}),$=f(w.admin.listAudit,{filter:{q:n||void 0,from:C,to:N,action:o===G?void 0:o,resource:u===G?void 0:u,impersonated:l===G?void 0:l===`yes`,advanced:b.length>0?b:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||o!==G||l!==G||u!==G||b.length>0||y.kind!==`relative`||y.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:s()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:v(),timeRange:y,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(k,{value:o,onValueChange:J,children:[(0,U.jsx)(I,{size:`sm`,className:`w-40`,children:(0,U.jsx)(M,{placeholder:i()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{value:G,children:T()}),te.map(e=>(0,U.jsx)(P,{value:e,children:e},e))]})]}),(0,U.jsxs)(k,{value:l,onValueChange:Y,children:[(0,U.jsx)(I,{size:`sm`,className:`w-40`,children:(0,U.jsx)(M,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{value:G,children:g()}),(0,U.jsx)(P,{value:`yes`,children:d()}),(0,U.jsx)(P,{value:`no`,children:c()})]})]}),(0,U.jsxs)(k,{value:u,onValueChange:X,children:[(0,U.jsx)(I,{size:`sm`,className:`w-40`,children:(0,U.jsx)(M,{placeholder:a()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(P,{value:G,children:h()}),ne.map(e=>(0,U.jsx)(P,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:b,onChange:Q}),(0,U.jsx)(V,{title:m(),rows:$,emptyHint:p(),columns:[{header:x(),cell:e=>A(e.at),sort:e=>e.at},{header:i(),cell:e=>e.action,sort:e=>e.action},{header:r(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:S(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:a(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$m as r,$w as i,Aw as a,Bw as o,Cw as s,D as c,Dw as l,Ea as u,Ew as d,FT as f,Fw as p,Gw as m,HT as h,Hw as g,IT as ee,Iw as _,Jw as te,Kw as v,LT as ne,Lw as y,MG as b,MT as re,Mw as ie,NT as ae,Nw as oe,OT as se,Ow as ce,PT as le,Pw as ue,Qm as de,Qw as fe,RT as pe,Rw as me,Sw as x,Tw as he,Uw as ge,VT as _e,Vw as ve,Wm as ye,Ww as be,Xm as xe,Xw as Se,Ym as Ce,Yw as we,Zm as Te,Zw as Ee,_w as De,aT as Oe,ah as ke,ai as Ae,bw as je,cw as S,dc as Me,dw as Ne,eT as Pe,eh as Fe,fc as Ie,fw as Le,gw as Re,hc as ze,hw as Be,iT as Ve,ih as He,jG as Ue,jw as We,kG as Ge,kT as Ke,kw as qe,lw as C,mc as Je,mw as Ye,nT as Xe,nh as w,oT as Ze,oh as Qe,pc as $e,pw as et,qw as tt,rT as nt,rh as rt,sh as it,t as T,tT as at,th as ot,uw as E,vc as st,vw as ct,ww as lt,xw as ut,yw as dt,zT as ft,zw as pt}from"./api-CnXjOprV.js";import{r as D}from"./dist-CU23SxxP.js";import{t as mt}from"./chevrons-up-down-CPB13Hhb.js";import{i as ht,n as O,o as gt,r as _t,s as vt}from"./FieldLabel-DVWzsIR3.js";import{t as k}from"./button-C7mIcWuE.js";import{At as A,Bn as yt,Ft as j,G as bt,Gn as xt,Ht as St,K as Ct,Kn as wt,N as Tt,On as Et,U as Dt,Ut as Ot,Vn as kt,W as At,Wt as jt,Z as Mt,at as Nt,et as M,ft as Pt,it as N,jt as Ft,lt as It,mn as P,mt as Lt,nt as F,ot as Rt,pt as I,rt as L,st as zt,tt as R,un as z,ut as Bt,zn as B}from"./index-0t8eOneo.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-CXJLU3m_.js";import{t as Gt}from"./FilterBar-DLMcpn_E.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-D2UZENK3.js";import{t as W}from"./dispatchErrorInfo-Ct8igIIE.js";var $t=c(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=c(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function K(e){return e.filter(e=>e.state===`error`)}function tn(e){return e.reachable&&K(e.targets).length===0}function nn(e){return tn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function rn(e){return e.state===`error`&&e.lastErrorCode!==null}function an(e){return!!e.lastDownstreamRejectCode}function on(e){return!!e.lastLocalRefusalCode}function sn(e){return rn(e)||an(e)||on(e)}function q(e){return e.kind??`openclaw`}function cn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function ln(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return cn(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,un={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function dn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function fn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function pn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function mn(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function hn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=pn(t.key,e),a=pn(t.key,r);return i&&a?0:i?1:a?-1:n*mn(t.key,e,r)})}function gn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function _n(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function vn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??Z(e,t))}var Q=n();function yn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(un),[i,a]=(0,G.useState)(null),o=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>gn(o),[o]),l=(0,G.useMemo)(()=>_n(o),[o]),u=(0,G.useMemo)(()=>vn(o),[o]),f=(0,G.useMemo)(()=>hn(fn(o,n),i),[o,n,i]);function p(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:s(),onReset:()=>r(un),canReset:dn(n),children:[(0,Q.jsxs)(M,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(N,{placeholder:ut()})}),(0,Q.jsxs)(R,{children:[(0,Q.jsx)(F,{value:Y,children:x()}),c.map(e=>(0,Q.jsx)(F,{value:e,children:xn(e)},e))]})]}),(0,Q.jsxs)(M,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(L,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(N,{placeholder:je()})}),(0,Q.jsxs)(R,{children:[(0,Q.jsx)(F,{value:Y,children:x()}),l.map(e=>(0,Q.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(M,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(L,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(N,{placeholder:dt()})}),(0,Q.jsxs)(R,{children:[(0,Q.jsx)(F,{value:Y,children:x()}),u.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))]})]})]}),f.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ct()}):(0,Q.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)($,{label:De(),sortKey:`target`,sort:i,onSort:p}),(0,Q.jsx)($,{label:Re(),sortKey:`state`,sort:i,onSort:p}),(0,Q.jsx)($,{label:Be(),sortKey:`instance`,sort:i,onSort:p}),(0,Q.jsx)($,{label:Ye(),sortKey:`host`,sort:i,onSort:p}),(0,Q.jsx)($,{label:et(),sortKey:`version`,sort:i,onSort:p}),(0,Q.jsx)(V,{children:Le()}),(0,Q.jsx)($,{label:Ne(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(0,Q.jsx)(Ut,{children:f.map(e=>(0,Q.jsx)(bn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(yt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(mt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function bn({r:e}){let t=rn(e)?W(e.lastErrorCode):null,n=an(e)?W(e.lastDownstreamRejectCode):null,r=on(e)?W(e.lastLocalRefusalCode):null;return(0,Q.jsxs)(G.Fragment,{children:[(0,Q.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(U,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(Sn,{state:e.state})}),(0,Q.jsx)(U,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(U,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(U,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:he({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(U,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:I(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),sn(e)?(0,Q.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${I(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ae({label:r.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${I(e.lastLocalRefusalAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[lt({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${I(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function xn(e){return e===`connected`?E():e===`error`?C():S()}function Sn({state:e}){return e===`connected`?(0,Q.jsx)(A,{variant:`secondary`,children:E()}):e===`error`?(0,Q.jsx)(A,{variant:`destructive`,children:C()}):(0,Q.jsx)(A,{variant:`outline`,children:S()})}function Cn(){return b(T.bridgeHealth.getBridgeHealth,{})}function wn(){let e=Cn(),t=b(T.compat.getBridgeCompat,{}),n=b(T.me.getMe,{host:Mt})?.role===`admin`,r=b(T.admin.listInstances,n?{}:`skip`),i=b(T.agents.usageForInstances,n?{}:`skip`),a=xt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=ln(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=wt({from:`/settings/bridge`}),l=xt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(Tn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:v()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:m()}),(0,Q.jsxs)(Wt,{children:[(0,Q.jsx)(Ht,{children:(0,Q.jsxs)(H,{children:[(0,Q.jsx)(V,{children:ze()}),(0,Q.jsx)(V,{children:Je()}),(0,Q.jsx)(V,{children:$e()}),(0,Q.jsx)(V,{children:Ie()}),(0,Q.jsx)(V,{children:Me()})]})}),(0,Q.jsx)(Ut,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(H,{children:[(0,Q.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(U,{children:t.provider}),(0,Q.jsx)(U,{children:t.label}),(0,Q.jsx)(U,{children:(0,Q.jsxs)(A,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Q.jsxs)(Dt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(bt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(Ct,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(P,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(At,{value:e.key,children:(0,Q.jsx)(En,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):null]})}function Tn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:ke(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,He({build:t.buildVersion??`?`})]}):null,` · `,rt(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:_()});let s=K(e.targets),c=!e.reachable,l=nn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=Pt(e.checkedAt),m=e.startedAt==null?null:Pt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Q.jsx)(B,{size:22}):c||l===`gateways_unreachable`?(0,Q.jsx)(en,{size:22}):(0,Q.jsx)(z,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?p():l===`gateways_unreachable`?We({count:u.length}):c?ue():oe({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)($t,{size:12,"aria-hidden":!0}),` `,ie({time:f})]}),m?(0,Q.jsx)(`span`,{children:qe({time:m})}):null,o]}),l===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:a({names:u.join(`, `)})}):null,c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ce()})]})}function En({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let u=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;u.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let f=Qt(u.map(e=>e.state)),[p,m]=(0,G.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(P,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(A,{variant:f===`beyond`||f===`defective`?`destructive`:`secondary`,children:qt(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:it()}),(0,Q.jsx)(On,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:u}),o?(0,Q.jsx)(Dn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(kt,{size:13,"aria-hidden":!0}),l({count:t.length})]}),p?(0,Q.jsx)(yn,{connections:t,displayByInstance:c}):null]})}function Dn({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[be(),i.length>0?(0,Q.jsx)(A,{variant:`destructive`,children:g({count:i.length})}):a>0?(0,Q.jsx)(A,{variant:`destructive`,children:ve()}):(0,Q.jsx)(A,{variant:`secondary`,children:ge()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[o({version:e.vendoredVersion}),r?` · `+pt({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:u({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(kt,{size:13,"aria-hidden":!0}),me({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function On({support:e,compatStatus:t,compatReachable:n,manifest:i,instanceRows:a,providerName:o}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}),i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:st({provider:o})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:r({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:w()}),e?(0,Q.jsx)(Mn,{versions:e.validatedVersions}):null]}),a.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:a.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Q.jsx)(A,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function kn({instance:e,onClose:t}){return(0,Q.jsx)(Nt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Rt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(It,{children:[(0,Q.jsx)(Bt,{children:h({instance:e.displayName??e.name})}),(0,Q.jsx)(zt,{children:_e()})]}),(0,Q.jsx)(jn,{instance:e,onClose:t})]})})}function An({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(B,{"aria-hidden":!0}):(0,Q.jsx)(z,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?Se():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,we()]}):null}function jn({instance:e,onClose:t}){let n=Ue(T.admin.upsertInstanceConfig),r=Ge(T.bridge.validateMediaPaths),a=Ft(),o=Vt(e.config?.contentLocale,void 0),[s,c]=(0,G.useState)(()=>ht(e.config??{},o)),[l,u]=(0,G.useState)(!1),[d,p]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=s.inboundMediaMode===`shared-fs`,_=s.mediaMode===`shared-fs`,v=g||_;async function y(){p(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){a.error(Pe(),e)}finally{p(!1)}}async function b(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:_t(s,r,o)}),t()}catch(e){a.error(le(),e)}finally{u(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:ft(),help:ae()}),(0,Q.jsxs)(M,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Q.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(N,{})}),(0,Q.jsx)(R,{children:vt.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:pe(),help:re()}),(0,Q.jsxs)(M,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(L,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(N,{})}),(0,Q.jsx)(R,{children:gt.map(e=>(0,Q.jsx)(F,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:ne(),help:Ke()}),(0,Q.jsx)(j,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:Ze(),help:Oe()}),(0,Q.jsx)(j,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),_&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:Ve(),help:nt()}),(0,Q.jsx)(j,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Lt,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Q.jsx)(O,{label:ee(),help:se()})]}),v&&m!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(z,{"aria-hidden":!0}),tt({reason:m.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(An,{label:fe(),result:m.inbound}),(0,Q.jsx)(An,{label:Ee(),result:m.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(z,{"aria-hidden":!0}),te()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Q.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:d,children:[d?(0,Q.jsx)(Et,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?at():Xe()]}),(0,Q.jsx)(k,{size:`sm`,onClick:()=>void b(),disabled:l,children:f()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(St,{children:[(0,Q.jsx)(jt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?de():Te({count:e.length}),(0,Q.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Ot,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:xe()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(A,{variant:`secondary`,children:e},e))})]})]})}export{wn as BridgeTab,kn as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ad as r,BT as i,CG as a,Dd as o,Dg as s,Ed as c,Eg as l,Fd as u,Kh as d,MG as f,Md as p,Nd as m,Ng as h,Od as g,Pd as _,_c as v,ch as y,dh as b,fh as x,gh as S,hh as C,jG as w,jd as T,jg as E,kG as D,kd as O,lh as k,mh as A,ph as j,t as M,uh as N}from"./api-CnXjOprV.js";import{t as P}from"./button-C7mIcWuE.js";import{B as F,Ft as I,H as L,V as R,et as z,it as B,mt as V,nt as H,rt as U,tt as W,un as G}from"./index-0t8eOneo.js";import{a as K}from"./compatView-D2UZENK3.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=w(M.admin.upsertInstanceConfig),n=f(M.agents.listAgentsForInstance,{instanceName:e.name}),i=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[a,o]=(0,q.useState)(i),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{o(i),c(`idle`)},[e._id,i]);let l=`__none__`,u=a!==i;async function d(){c(`saving`);try{let n={...e.config??{}};a===``||a===l?delete n.converterAgentId:n.converterAgentId=a,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let m=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:T()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(z,{value:a===``?l:a,onValueChange:e=>o(e===l?``:e),children:[(0,X.jsx)(U,{className:`oc-cdefaults__select`,"aria-label":p(),children:(0,X.jsx)(B,{placeholder:r()})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(H,{value:l,children:r()}),m.map(e=>(0,X.jsx)(H,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!u||s===`saving`,onClick:()=>void d(),children:s===`saving`?h():N()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:k()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null]})}function Q({instance:e}){let t=w(M.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,q.useState)(n),[s,c]=(0,q.useState)(r===null?``:String(r)),[l,u]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(n),c(r===null?``:String(r)),u(`idle`)},[e._id,n,r]);let d=s.trim(),f=d===``?null:/^\d+$/.test(d)?Number.parseInt(d,10):NaN,p=!i||f===null||Number.isInteger(f)&&f>=4e3&&f<=6e4,_=i!==n||(f??null)!==r;async function v(){u(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||f===null||Number.isNaN(f)?delete n.curationBudgetChars:n.curationBudgetChars=f,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(V,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":m()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:m()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(I,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>c(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p,"aria-label":O(),disabled:!i}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!p||l===`saving`,onClick:()=>void v(),children:l===`saving`?h():N()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:g()}),l===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:k()}):null,l===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:o()})]})}function $({instance:e}){let t=w(M.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[a,o]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),l=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,d=l===null||Number.isInteger(l)&&l>=1e3&&l<=2e5,f=(l??null)!==n;async function p(){o(`saving`);try{let n={...e.config??{}};l===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=l,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:u()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(I,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!d}),(0,X.jsx)(P,{size:`sm`,disabled:!f||!d||a===`saving`,onClick:()=>void p(),children:a===`saving`?h():N()})]}),d?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:c()}),a===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:k()}):null,a===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:y()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:_()})]})}function ee(){let e=D(M.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=f(M.admin.listInstances,{}),[o,c]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!o||!r.some(e=>e.name===o))&&c(r[0].name)},[r,o]);let u=(r?.length??0)>1,p=r!==void 0&&r.length===0,m=f(M.compat.forInstance,o?{instanceName:o}:`skip`),h=o?R(m,`configDefaults`):`loading`,g=h===`loading`?null:h.blocked,_=(0,q.useMemo)(()=>u&&o?{instanceName:o}:{},[u,o]),y=(0,q.useRef)(0),w=(0,q.useCallback)(async()=>{let t=++y.current;n({status:`loading`});try{let r=Y(await e(_));if(y.current!==t)return;n({status:`done`,current:r})}catch{if(y.current!==t)return;n({status:`error`})}},[e,_]);(0,q.useEffect)(()=>{g===!1&&(u&&!o||w())},[w,g,u,o]);let T=t.status===`done`?t.current:null,O=(0,q.useMemo)(()=>J.map(e=>({id:e,label:L(e)})),[]),k=(0,q.useMemo)(()=>[{id:`fast`,label:s()},{id:`standard`,label:l()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),u&&o?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,X.jsxs)(z,{value:o,onValueChange:e=>c(e),children:[(0,X.jsx)(U,{size:`sm`,"aria-label":d(),children:(0,X.jsx)(B,{})}),(0,X.jsx)(W,{children:(r??[]).map(e=>(0,X.jsx)(H,{value:e.name,children:e.name},e.name))})]})]}):null,p?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:i()}):h===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):h.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(G,{size:14,"aria-hidden":!0}),` `,K(h.gatewayVersion,h.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[b(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:E()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:C()}),(0,X.jsx)(F,{field:`thinkingLevel`,options:O,value:T?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:C()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:A()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,X.jsx)(F,{field:`fastMode`,options:k,value:T===null||T.fastModeDefault===null?null:T.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:j()}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:x()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:v()})]}),(()=>{let e=r?.find(e=>e.name===(o??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,AM as i,BM as a,CM as o,DM as s,EM as c,FM as l,GM as u,HM as d,IM as f,JM as ee,KM as te,LM as p,MG as m,MM as h,NM as ne,OM as g,PM as _,QM as v,RM as re,SM as y,TM as b,UM as x,VM as ie,Vu as ae,WM as S,XM as C,YM as w,ZM as T,_M as E,aN as D,bM as O,cM as k,cN as A,dM as j,eN as M,fM as N,gM as P,hM as F,iN as I,jG as L,jM as R,kM as z,lM as B,lN as V,mM as H,nN as U,oN as W,pM as G,qM as oe,rN as K,sM as q,sN as se,t as J,tN as ce,uM as le,vM as ue,wM as de,xM as fe,yM as pe,zM as me,zu as he}from"./api-CnXjOprV.js";import{t as ge}from"./button-C7mIcWuE.js";import{ft as _e,q as Y}from"./index-0t8eOneo.js";import{t as ve}from"./DataTableShell-K5cImuMP.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>V(),incorrect:()=>A(),incoherence:()=>se(),formatting:()=>W(),latency:()=>D(),api_error:()=>I(),other:()=>K()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ce()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:M()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:U()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,o=L(J.feedback.respondToFeedback),[c,m]=(0,X.useState)(e.thread),[h,g]=(0,X.useState)(``),[y,b]=(0,X.useState)(!1);async function E(){let t=h.trim();if(!(!t||y)){b(!0);try{await o({feedbackId:e._id,text:t}),m(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),g(``)}finally{b(!1)}}}let D=[];try{D=i.contextJson?JSON.parse(i.contextJson):[]}catch{D=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${r()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:s(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:v()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:G()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:T()}),c.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:c.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?C():e.authorRole===`agent`?e.authorLabel??ae():w()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ee()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:oe(),value:h,maxLength:2e3,rows:3,onChange:e=>g(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void E(),disabled:!h.trim()||y,children:y?te():u()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||x()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:d()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||x()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ie()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,D.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a({count:i.contextCount??D.length,truncated:i.contextTruncated?me():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:D.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:re()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:f()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?l({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[_(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,ne()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=m(J.feedback.listForAdmin,{}),t=L(J.feedback.readSnapshot),n=L(J.feedback.deleteFeedback),r=Y(),[a,s]=(0,X.useState)(null),[l,u]=(0,X.useState)({});async function d(e){if(a===e._id){s(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});u(t=>({...t,[e._id]:n}))}s(e._id)}async function f(e){await r({title:B(),description:k(),confirmLabel:q(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&s(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,Z.jsx)(`strong`,{children:R()}),` `,i()]}),(0,Z.jsx)(ve,{title:z(),rows:e,emptyHint:g(),isExpanded:e=>a===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(be,{data:l[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:c(),cell:e=>_e(e.at),sort:e=>e.at},{header:b(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:de(),cell:e=>e.messageRole===`user`?o():y(),sort:e=>e.messageRole},{header:fe(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${O({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:pe(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:ue(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:E(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:P()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:F()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:he()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:H()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?N():j(),onSelect:()=>void d(e)},{label:le(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AW as r,BW as i,CG as a,CW as ee,DW as o,EW as s,FW as c,Gu as l,HW as te,IW as ne,LW as re,MG as u,MW as d,NW as f,OW as p,PI as ie,PW as ae,RW as oe,SW as se,TG as ce,TW as le,UW as ue,VW as m,WW as de,Wu as fe,_W as h,bW as pe,dW as me,fW as he,gW as ge,hW as _e,jG as ve,jW as g,kW as _,lW as ye,mW as be,pW as xe,t as v,uW as y,vW as b,wW as x,xW as S,yW as C,zW as w}from"./api-CnXjOprV.js";import{t as T}from"./button-C7mIcWuE.js";import{At as E,Ct as D,Dt as O,Et as k,Fn as A,In as j,It as M,Lt as Se,Ot as Ce,Rt as N,St as we,Tt as Te,Vt as Ee,dn as De,et as P,gn as Oe,it as F,jt as ke,kt as Ae,mt as je,nt as I,rt as L,tt as R,wt as Me}from"./index-0t8eOneo.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-CXJLU3m_.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return f();case`audio`:return d();case`video`:return g();case`pdf`:return r();case`document`:return _();case`archive`:return p();default:return o()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[o,d]=(0,H.useState)(W),[f,p]=(0,H.useState)(W),[g,_]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=ve(v.files.softDelete),Y=ke();function Ie(){t(W),r(W),d(W),p(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ge())}catch(e){Y.error(_e(),e)}}let X=u(v.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:o===W?void 0:o,category:f===W?void 0:f,includeAutoGenerated:g||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ce(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:a()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||o!==W||f!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:de()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(P,{value:e,onValueChange:t,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":ue(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(I,{value:W,children:te()}),(0,U.jsx)(I,{value:`inbound`,children:m()}),(0,U.jsx)(I,{value:`outbound`,children:i()})]})]}),(0,U.jsxs)(P,{value:n,onValueChange:r,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":w(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(I,{value:W,children:oe()}),Q.chats.map(e=>(0,U.jsx)(I,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(P,{value:o,onValueChange:d,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":re(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(I,{value:W,children:ne()}),Q.instances.map(e=>(0,U.jsx)(I,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(P,{value:f,onValueChange:p,children:[(0,U.jsx)(L,{size:`sm`,"aria-label":c(),children:(0,U.jsx)(F,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(I,{value:W,children:ae()}),Q.categories.map(e=>(0,U.jsx)(I,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(je,{checked:g,onCheckedChange:e=>_(e===!0),"aria-label":l()}),(0,U.jsx)(`span`,{children:l()})]}),$?(0,U.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(Oe,{size:14,"aria-hidden":!0}),C()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?y():me()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:s()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{children:x()}),(0,U.jsx)(z,{children:ee()}),(0,U.jsx)(z,{children:se()}),(0,U.jsx)(z,{className:`text-right`,children:S()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(E,{variant:`outline`,style:{marginLeft:6},children:fe()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(E,{variant:`secondary`,children:e.direction===`inbound`?m():i()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(M,{children:[(0,U.jsx)(Ee,{asChild:!0,children:(0,U.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":b(),children:(0,U.jsx)(A,{size:16})})}),(0,U.jsxs)(Se,{align:`end`,children:[e.url?(0,U.jsx)(N,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),pe()]})}):(0,U.jsxs)(N,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),he()]}),(0,U.jsxs)(N,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(De,{size:14}),h()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ye({cap:Be})}):null]}),(0,U.jsx)(we,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(Te,{children:[(0,U.jsxs)(Ce,{children:[(0,U.jsx)(Ae,{children:be()}),(0,U.jsx)(k,{children:xe()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Me,{children:ie()}),(0,U.jsx)(D,{onClick:()=>void Le(),children:h()})]})]})})]})}export{K as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,$g as i,A_ as a,B_ as o,C_ as s,D as c,D_ as l,E_ as u,F_ as d,G_ as f,Gg as p,H_ as m,I_ as h,J_ as g,Jg as _,K_ as v,Kg as y,L_ as b,MG as x,M_ as S,N_ as ee,O_ as C,P_ as w,Q_ as te,Qg as T,R_ as E,S_ as D,T_ as O,U_ as ne,V_ as k,W_ as A,X_ as re,Xg as ie,Y_ as ae,Yg as j,Z_ as M,Zg as N,__ as P,a_ as F,b_ as I,c_ as oe,d_ as L,e_ as se,ev as ce,f_ as le,g_ as R,h_ as ue,i_ as de,jG as z,j_ as fe,k_ as pe,l_ as me,m_ as he,n_ as ge,o_ as _e,p_ as ve,q_ as ye,qg as be,r_ as xe,s_ as Se,t as B,t_ as Ce,u_ as we,v_ as Te,w_ as Ee,x_ as De,y_ as Oe,z_ as ke}from"./api-CnXjOprV.js";import{t as Ae}from"./x-Cd7Svlfj.js";import{t as V}from"./button-C7mIcWuE.js";import{At as H,Ft as U,G as je,Hn as Me,K as W,U as Ne,Vn as Pe,W as G,Z as Fe,_ as Ie,at as Le,cn as Re,et as ze,fn as K,it as Be,jt as q,lt as Ve,mn as J,mt as Y,nt as He,ot as Ue,pn as X,q as We,rt as Ge,st as Ke,tt as qe,ut as Je}from"./index-0t8eOneo.js";import{t as Ye}from"./FilterBar-DLMcpn_E.js";import{t as Xe}from"./DataTableShell-K5cImuMP.js";import{t as Z}from"./DetailChips-Xge7xE-L.js";var Ze=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return De();case`user`:return I();case`pending`:return Oe();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=x(B.groups.listGroups,{}),t=x(B.me.getMe,{host:Fe})?.role===`admin`,n=z(B.groups.createGroup),i=z(B.groups.updateGroup),a=z(B.groups.deleteGroup),s=We(),c=q(),[l,u]=(0,Q.useState)(!1),[p,y]=(0,Q.useState)(null),[S,C]=(0,Q.useState)(it),[T,D]=(0,Q.useState)(null),[O,ie]=(0,Q.useState)(``),j=(0,Q.useMemo)(()=>{if(!e)return e;let t=O.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,O]);function N(){y(null),C(it),u(!0)}function P(e){y(e),C({name:e.name,description:e.description??``}),u(!0)}async function F(){try{p?await i({groupId:p._id,name:S.name,description:S.description}):await n({name:S.name,description:S.description||void 0}),C(it),y(null),u(!1)}catch(e){c.error(_(),e)}}async function I(e){if(await s({title:d({name:e.name}),description:w(),confirmWord:e.name,confirmLabel:ee(),cancelLabel:k(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(be(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),(0,$.jsx)(Ye,{q:O,onQChange:ie,onReset:()=>ie(``),canReset:O!==``,searchPlaceholder:v()}),(0,$.jsx)(Xe,{title:ce(),rows:j,addLabel:te(),onAdd:t?N:void 0,emptyHint:M(),columns:[{header:re(),cell:e=>e.name,sort:e=>e.name},{header:ae(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Re,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(X,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:g(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ye(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:f(),onSelect:()=>D({groupId:e._id,name:e.name})},...t?[{label:A(),onSelect:()=>P(e)},{label:ne(),variant:`destructive`,onSelect:()=>void I(e)}]:[]]}),(0,$.jsx)(Ie,{open:l,onOpenChange:u,title:p?ke():o(),description:E(),canSubmit:!!S.name.trim(),onSubmit:F,submitLabel:m(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:b()}),(0,$.jsx)(U,{value:S.name,onChange:e=>C({...S,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:h()}),(0,$.jsx)(U,{value:S.description,onChange:e=>C({...S,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:T?.groupId??null,groupName:T?.name??``,open:T!==null,onOpenChange:e=>{e||D(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Me,{size:14,"aria-hidden":!0}),Ee()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":D({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(V,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[s(),(0,$.jsx)(Pe,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let o=x(B.groups.getGroup,n&&e?{groupId:e}:`skip`),s=x(B.groups.listAssignableInstances,n?{}:`skip`),c=x(B.groups.listAssignableUsers,n?{}:`skip`),d=z(B.groups.addMember),f=z(B.groups.removeMember),p=z(B.groups.bulkSetMembers),m=z(B.groups.setGroupManager),h=q(),[g,_]=(0,Q.useState)(``),[v,b]=(0,Q.useState)(``),[ee,w]=(0,Q.useState)(`members`),[te,E]=(0,Q.useState)(1),[D,ne]=(0,Q.useState)(new Set),k=(0,Q.useRef)(null),A=(0,Q.useMemo)(()=>new Set((o?.members??[]).map(e=>e.userId)),[o]),re=(0,Q.useMemo)(()=>new Set((o?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[o]),ae=o?.viewerIsAdmin===!0,j=(0,Q.useMemo)(()=>new Set((o?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[o]);(0,Q.useEffect)(()=>{_(``),b(``),w(`members`),E(1),k.current=null},[n,e]),(0,Q.useEffect)(()=>{E(1)},[g]),(0,Q.useEffect)(()=>{n&&o&&e&&k.current!==e&&(k.current=e,ne(new Set((o.members??[]).map(e=>e.userId))))},[n,o,e]);let M=(0,Q.useMemo)(()=>c?Qe(c,g,D):[],[c,g,D]);async function P(t,n){if(e)try{n?await f({groupId:e,userId:t}):await d({groupId:e,userId:t})}catch(e){h.error(y(),e)}}async function F(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){h.error(ie(),e)}}let I=nt(M,e=>A.has(e.userId)),oe=M.filter(e=>A.has(e.userId)).length,L=rt(M,te,ot);async function se(){if(!e||M.length===0)return;let t=M.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:I!==`all`})}catch(e){h.error(y(),e)}}return(0,$.jsx)(Le,{open:n,onOpenChange:r,children:(0,$.jsxs)(Ue,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Je,{children:S({name:t})}),(0,$.jsx)(Ke,{children:fe()})]}),(0,$.jsxs)(Ne,{value:ee,onValueChange:w,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(W,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Re,{size:13,"aria-hidden":!0}),a(),o?(0,$.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,$.jsxs)(W,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),C(),o?(0,$.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,$.jsxs)(W,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),Se(),o?(0,$.jsx)(H,{variant:`secondary`,className:`oc-access__tabcount`,children:o.chartCount}):null]})]}),(0,$.jsx)(G,{value:`members`,children:c===void 0||o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:R()}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:he()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{value:g,onChange:e=>_(e.target.value),placeholder:pe(),className:`oc-access__search`}),M.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:u()}):(0,$.jsxs)($.Fragment,{children:[M.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:I===`all`?!0:I===`some`?`indeterminate`:!1,onCheckedChange:()=>void se(),"aria-label":O()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:O()}),(0,$.jsxs)(H,{variant:`outline`,className:`oc-access__count`,children:[oe,` / `,M.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:L.pageItems.map(e=>{let t=A.has(e.userId),n=et(e),r=re.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:t,onCheckedChange:()=>void P(e.userId,t),"aria-label":Te({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(H,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ae?(0,$.jsx)(V,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?N():T(),title:r?N():T(),onClick:()=>void F(e.userId,r),children:(0,$.jsx)(X,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":i(),title:i(),children:(0,$.jsx)(X,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:L.page,pageCount:L.pageCount,onPage:E})]})]})}),(0,$.jsx)(G,{value:`agents`,children:s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:R()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{value:v,onChange:e=>b(e.target.value),placeholder:l(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:s.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:j,query:v},`${e}-${t._id}`))})]})}),(0,$.jsx)(G,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=x(B.groups.listAssignableAgents,{instanceName:t}),o=z(B.groups.assignAgentToGroup),s=z(B.groups.removeAgentFromGroup),c=z(B.groups.bulkSetGroupAgents),l=q(),[u,d]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{d(1)},[i]),!e)return null;let f=$e(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&f.length===0)return null;let h=f.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=nt(h,e=>r.has(`${t}/${e.agentId}`)),_=rt(f,u,ot);async function v(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(p(),e)}}async function y(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){l.error(p(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(J,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(H,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,$.jsx)(H,{variant:`outline`,className:`oc-access__stale`,children:we()}):null]}),a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):f.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:m?L():le()}):(0,$.jsxs)($.Fragment,{children:[h.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(Y,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void y(),"aria-label":O()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:O()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,$.jsx)(Y,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":P({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":oe(),title:oe(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,$.jsx)(H,{variant:`outline`,className:`oc-access__gone`,children:me()}):null]},e.agentId)}),(0,$.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=x(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=z(B.charts.assignChartToGroup),r=z(B.charts.removeChartFromGroup),i=z(B.charts.setGroupDefaultChart),a=z(B.charts.addChartToGroupPool),o=z(B.charts.removeChartFromGroupPool),s=q();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:R()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:_e()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}async function f(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(j(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":ge({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":Ce(),title:Ce(),children:(0,$.jsx)(K,{size:14,fill:`currentColor`})}):(0,$.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void f(e.chartKey),children:se()}):null,u?(0,$.jsx)(V,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":xe({name:e.name}),title:xe({name:e.name}),onClick:()=>void m(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,$.jsxs)(ze,{value:``,onValueChange:e=>void p(e),children:[(0,$.jsx)(Ge,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Be,{placeholder:de()})}),(0,$.jsx)(qe,{children:l.map(e=>(0,$.jsx)(He,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()}):null:null]})}export{at as GroupsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,$d as i,$k as a,AA as o,AT as s,Ai as c,Aj as l,B as u,BA as d,CA as f,Ci as p,Cj as m,DA as h,Di as g,Dj as _,EA as v,Ei as y,Ej as b,FA as x,G as ee,GA as S,Gk as C,H as te,HA as w,IA as T,JA as E,Jk as D,K as ne,KA as re,Kk as ie,L as ae,LA as oe,MA as se,MG as O,Mj as ce,NA as le,Nj as ue,OA as de,OR as k,Oi as fe,Oj as pe,PA as me,QA as he,Qd as ge,Qk as _e,R as ve,RA as ye,SA as be,Sc as xe,Si as Se,Sj as Ce,TA as we,Ti as Te,Tj as Ee,U as De,UA as Oe,V as ke,VA as Ae,W as je,WA as Me,Wk as Ne,XA as A,Xd as Pe,Xk as Fe,YA as j,Yk as Ie,ZA as Le,Zd as Re,Zk as ze,_A as M,_i as Be,_j as Ve,aA as He,aj as Ue,bA as We,bc as Ge,bi as Ke,bj as qe,cA as Je,cj as Ye,dA as Xe,dj as Ze,eA as Qe,ej as $e,fA as et,fj as tt,gA as nt,gi as rt,gj as it,hA as at,hi as ot,hj as st,iA as ct,ij as lt,jA as ut,jG as N,jT as dt,ji as ft,jj as pt,kA as mt,kG as P,kR as ht,ki as gt,kj as _t,lA as vt,lj as yt,mA as F,mj as bt,nA as xt,nj as St,oA as Ct,oj as wt,pj as Tt,qA as Et,qk as Dt,rA as Ot,rj as kt,sA as At,sj as jt,t as I,tA as Mt,tj as Nt,uA as Pt,uj as Ft,vA as It,vi as Lt,vj as Rt,wA as zt,wi as Bt,wj as Vt,xA as Ht,xc as Ut,xi as Wt,xj as Gt,yA as L,yi as Kt,yj as R,z as qt,zA as z}from"./api-CnXjOprV.js";import{a as Jt,c as Yt}from"./FieldLabel-DVWzsIR3.js";import{t as B}from"./button-C7mIcWuE.js";import{At as V,Ft as H,Ht as Xt,Ut as Zt,Wt as Qt,_ as $t,at as en,et as U,it as W,jt as G,lt as tn,mt as nn,nt as K,ot as rn,q as an,rt as q,st as on,tt as J,ut as sn}from"./index-0t8eOneo.js";import{t as cn}from"./DataTableShell-K5cImuMP.js";import{InstanceConfigDialog as ln}from"./BridgeTab-DPbj0zcY.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],un=new Set(X),dn=`conversational`;function fn(e){let t=new Set((e??[]).filter(e=>un.has(e)));return t.size===0?[dn]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:Jt},pn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function mn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function hn(){let e=O(I.admin.listInstances,{}),t=O(I.agents.listAllInstanceAgents,{}),n=N(I.admin.upsertInstance),r=N(I.admin.deleteInstance),i=G(),[a,o]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(Q),[h,v]=(0,Y.useState)(null),[x,S]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null);async function re(){try{await n({instanceId:E??void 0,name:d.name,gatewayUrl:d.gatewayUrl,bridgeUrl:d.bridgeUrl||void 0,displayName:d.displayName||void 0,kind:d.kind,transport:d.kind===`hermes`?d.transport:void 0,gatewayVersion:d.gatewayVersion||void 0,gatewayHttpUrl:d.gatewayHttpUrl||void 0,...d.kind===`openclaw`?{authMode:d.authMode,personScopes:d.personScopes,identitySource:d.identitySource,participantIdentity:d.participantIdentity,managePermissionModes:d.managePermissionModes,systemIdentity:d.systemIdentity||void 0}:{},streamTransport:d.streamTransport}),f(Q),D(null),o(!1)}catch(e){i.error(pt(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[l(),(0,Z.jsx)(`strong`,{children:_t()}),pe()]}),(0,Z.jsx)(cn,{title:_(),rows:e,addLabel:b(),onAdd:()=>{D(null),f(Q),o(!0)},emptyHint:Ee(),columns:[{header:Vt(),cell:e=>e.name,sort:e=>e.name},{header:m(),cell:e=>(0,Z.jsx)(V,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:Ce(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Gt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:ue(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(V,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?C():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Ve(),onSelect:()=>{D(e._id),f(mn(e)),o(!0)}},{label:ce(),onSelect:()=>v(e.name)},{label:St(),onSelect:()=>T(e)},{label:qe(),onSelect:()=>S(e)},{label:R(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:R(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)($t,{open:a,onOpenChange:o,title:E?it():Rt(),description:bt(),canSubmit:!!(d.name&&d.gatewayUrl),onSubmit:re,submitLabel:Tt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:tt(),children:[(0,Z.jsx)(H,{value:d.name,disabled:E!==null,onChange:e=>f({...d,name:e.target.value})}),E?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:st()}):null]}),(0,Z.jsx)($,{label:Ze(),children:(0,Z.jsxs)(U,{value:d.kind,onValueChange:e=>f({...d,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(K,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(K,{value:`hermes`,children:`Hermes`})]})]})}),d.kind===`hermes`?(0,Z.jsx)($,{label:xe(),children:(0,Z.jsxs)(U,{value:d.transport,onValueChange:e=>f({...d,transport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(K,{value:`ws`,children:Ut()}),(0,Z.jsx)(K,{value:`rest`,children:Ge()})]})]})}):null,(0,Z.jsx)($,{label:Ft(),children:(0,Z.jsx)(H,{value:d.gatewayUrl,onChange:e=>f({...d,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:yt(),children:(0,Z.jsx)(H,{value:d.bridgeUrl,placeholder:Ye(),onChange:e=>f({...d,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:jt(),children:(0,Z.jsx)(H,{value:d.displayName,onChange:e=>f({...d,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:dt(),children:[(0,Z.jsxs)(U,{value:d.streamTransport,onValueChange:e=>f({...d,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsx)(J,{children:Yt.map(e=>(0,Z.jsx)(K,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s()})]}),(0,Z.jsx)($,{label:wt(),children:(0,Z.jsx)(H,{value:d.gatewayVersion,placeholder:Ue(),onChange:e=>f({...d,gatewayVersion:e.target.value})})}),d.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Wt(),children:[(0,Z.jsxs)(U,{value:d.authMode,onValueChange:e=>f({...d,authMode:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(K,{value:`token`,children:Ke()}),(0,Z.jsx)(K,{value:`trusted-proxy`,children:Kt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:d.authMode===`trusted-proxy`?Be():Lt()})]}),d.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ft(),children:[(0,Z.jsxs)(U,{value:d.personScopes,onValueChange:e=>f({...d,personScopes:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(K,{value:`capped`,children:c()}),(0,Z.jsx)(K,{value:`full`,children:gt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:d.personScopes===`full`?g():fe()})]}):null,d.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:y(),children:[(0,Z.jsxs)(U,{value:d.identitySource,onValueChange:e=>f({...d,identitySource:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(K,{value:`canonical`,children:Te()}),(0,Z.jsx)(K,{value:`email`,children:Bt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:d.identitySource===`email`?Se():p()})]}):null,d.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:ne(),children:[(0,Z.jsxs)(U,{value:d.participantIdentity,onValueChange:e=>f({...d,participantIdentity:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(K,{value:`owner`,children:ee()}),(0,Z.jsx)(K,{value:`self`,children:je()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:d.participantIdentity===`self`?ae():De()})]}):null,d.kind===`openclaw`?(0,Z.jsxs)($,{label:te(),children:[(0,Z.jsxs)(U,{value:d.managePermissionModes?`on`:`off`,onValueChange:e=>f({...d,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(W,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(K,{value:`off`,children:ke()}),(0,Z.jsx)(K,{value:`on`,children:u()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:d.managePermissionModes?ve():qt()})]}):null,d.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:rt(),children:(0,Z.jsx)(H,{value:d.systemIdentity,placeholder:ot(),onChange:e=>f({...d,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:lt(),children:(0,Z.jsx)(H,{value:d.gatewayHttpUrl,placeholder:kt(),onChange:e=>f({...d,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Tn,{instanceName:h,open:h!==null,onOpenChange:e=>{e||v(null)}}),x?(0,Z.jsx)(ln,{instance:x,onClose:()=>S(null)},x._id):null,w?(0,Z.jsx)(gn,{instance:w,onClose:()=>T(null)},w._id):null]})}function gn({instance:e,onClose:t}){let n=O(I.instanceSecrets.listInstanceSecretStatus,{}),r=pn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(en,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(rn,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(tn,{children:[(0,Z.jsx)(sn,{children:Nt({instance:e.displayName??e.name})}),(0,Z.jsx)(on,{children:$e()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(yn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(vn,{instance:e})}),(0,Z.jsx)(_n,{instance:e})]})})}function _n({instance:e}){let t=P(I.instanceSync.forceInstanceSync),n=G(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(me());break;case`no_agents`:n.success(se());break;case`no_bridge_url`:n.error(ut());break;case`deploy_misconfigured`:n.error(o());break;case`unauthorized`:n.error(de());break;case`not_served`:n.error(h());break;default:n.error(mt());break}}catch(e){n.error(le(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:v()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?x():T()})})]})}function vn({instance:e}){let t=O(I.bridgeAuth.listBridgeAuthStatus,{}),n=P(I.bridgeAuth.mintBridgeSecret),r=N(I.bridgeAuth.revokeBridgeSecret),i=G(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),p=d!==void 0;async function m(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(L(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(We())}catch(e){i.error(L(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:we(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:zt()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{variant:p?`outline`:`secondary`,children:p?`${A()} · ${d.prefix}…${d.lastFour}`:j()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(B,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?be():f()}),p?(0,Z.jsx)(B,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:Ht()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:It()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:l?ht():k()})]}),(0,Z.jsx)(B,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:M()})]}):null]})}function yn({instanceId:e,field:t,updatedAt:n}){let i=P(I.instanceSecrets.setInstanceSecret),a=N(I.instanceSecrets.clearInstanceSecret),o=P(I.deviceIdentity.generateDeviceIdentity),s=G(),[c,l]=(0,Y.useState)(``),[u,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,g]=(0,Y.useState)(!1),_=n!==null,v=t===`deviceIdentity`,y=t===`token`?r():t===`deviceIdentity`?he():Le();async function b(){if(!(!c.trim()||u)){f(!0);try{await i({instanceId:e,field:t,plaintext:c}),l(``),m(null),g(!1),s.success(Me())}catch(e){s.error(Oe(),e)}finally{f(!1)}}}async function x(){if(!u){f(!0);try{await a({instanceId:e,field:t}),m(null),g(!1),s.success(w())}catch(e){s.error(Oe(),e)}finally{f(!1)}}}async function ee(){if(!u){f(!0);try{m(await o({instanceId:e})),g(!1),s.success(z())}catch(e){s.error(oe(),e)}finally{f(!1)}}}let C=p?`openclaw devices approve ${p.id}`:``;async function te(){if(C)try{await navigator.clipboard.writeText(C),g(!0)}catch{}}return(0,Z.jsxs)($,{label:y,children:[v?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(V,{variant:_?`outline`:`secondary`,children:_?A():j()}),(0,Z.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:_?Et():E(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(B,{size:`sm`,onClick:()=>void b(),disabled:u||c.trim().length===0,children:re()}),v?(0,Z.jsx)(B,{size:`sm`,variant:`outline`,onClick:()=>void ee(),disabled:u,children:Ae()}):null,_?(0,Z.jsx)(B,{size:`sm`,variant:`destructive`,onClick:()=>void x(),disabled:u,children:S()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:z()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:C}),(0,Z.jsx)(B,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:h?ht():k()})]}),(0,Z.jsx)(B,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),g(!1)},children:M()})]}):null]})}var bn={conversational:Ct,documentary:ct,summarizer:i,curator:Re},xn={conversational:He,documentary:Ot,summarizer:ge,curator:Pe},Sn=e=>(bn[e]??(()=>e))(),Cn=e=>(xn[e]??(()=>``))();function wn({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:Pt()}),t.map(e=>(0,Z.jsx)(V,{variant:`secondary`,className:`oc-agenttype__chip`,title:Cn(e),children:Sn(e)},e)),(0,Z.jsxs)(Xt,{children:[(0,Z.jsx)(Qt,{asChild:!0,children:(0,Z.jsx)(B,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:vt()})}),(0,Z.jsxs)(Zt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Je()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:At()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(nn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Sn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Cn(r)})]})]},r)})})]})]})]})}function Tn({instanceName:e,open:t,onOpenChange:n}){let r=O(I.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=N(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)})}),o=N(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})}),s=N(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=fn(r);e.setQuery(I.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=N(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)})}),l=N(I.agents.removeInstanceAgent),u=an(),d=G();async function f(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(F(),e)}}async function p(t){if(e)try{await o({instanceName:e,agentId:t})}catch(e){d.error(F(),e)}}async function m(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){d.error(F(),e)}}async function h(t,n){if(e&&await u({title:Qe({name:n}),description:a(),confirmLabel:_e(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(ze())}catch(e){d.error(F(),e)}}return(0,Z.jsx)(en,{open:t,onOpenChange:n,children:(0,Z.jsxs)(rn,{className:`oc-access`,children:[(0,Z.jsxs)(tn,{children:[(0,Z.jsx)(sn,{children:nt({name:e??``})}),(0,Z.jsx)(on,{children:at()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Fe()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Ie():r.discovery.lastPollOk?D():Dt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ie()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(nn,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void f(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(V,{variant:`outline`,className:`oc-access__gone`,children:Ne()}),(0,Z.jsx)(B,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,a),children:Mt()})]}):i?(0,Z.jsx)(V,{variant:`default`,children:C()}):(0,Z.jsx)(B,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void p(t.agentId),children:xt()})]}),t.enabled?(0,Z.jsx)(wn,{agentId:t.agentId,types:o,onToggle:e=>void m(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(En,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){d.error(F(),e)}}}):null]},t.agentId)})})]})]})})}function En({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(H,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:et(),"aria-label":Xe(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{hn as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CN as r,MG as i,SN as a,_N as o,_p as s,bN as c,bp as l,dN as u,fN as d,fp as f,gN as p,gp as m,hN as h,hp as g,jG as _,kG as v,mN as y,mp as b,pN as x,pp as S,t as C,vN as w,vp as T,wN as E,xN as D,yN as O,yp as k}from"./api-CnXjOprV.js";import{t as A}from"./button-C7mIcWuE.js";import{At as j,Ft as M,mt as N}from"./index-0t8eOneo.js";var P=t(e(),1),F=n();function I(){let e=i(C.integrations.status.status,{}),t=_(C.admin.setIntegrationConfig),[n,s]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&s(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:E()});let f=n,m=(e,t,n)=>s({...f,[e]:{...f[e],[t]:n}}),g=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,F.jsx)(`strong`,{children:a()}),` `,D()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:w()}),note:o(),children:[(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:f.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>m(`langfuse`,`host`,e.target.value),onBlur:()=>g(`langfuse`,{host:f.langfuse.host??``})})}),(0,F.jsx)(z,{label:u(),checked:f.langfuse.enabled??!0,onChange:e=>{m(`langfuse`,`enabled`,e),g(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:w()}),note:p(),children:[(0,F.jsx)(R,{label:y(),children:(0,F.jsx)(M,{value:f.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>m(`opik`,`baseUrl`,e.target.value),onBlur:()=>g(`opik`,{baseUrl:f.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:x(),children:(0,F.jsx)(M,{value:f.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||d(),onChange:e=>m(`opik`,`workspace`,e.target.value),onBlur:()=>g(`opik`,{workspace:f.opik.workspace??``})})}),(0,F.jsx)(z,{label:u(),checked:f.opik.enabled??!0,onChange:e=>{m(`opik`,`enabled`,e),g(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:O()}):(0,F.jsx)(j,{variant:`outline`,children:l()}),note:k(),children:[(0,F.jsx)(R,{label:T(),children:(0,F.jsx)(M,{value:f.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>m(`otlp`,`endpoint`,e.target.value),onBlur:()=>g(`otlp`,{endpoint:f.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:u(),checked:f.otlp.enabled??!0,onChange:e=>{m(`otlp`,`enabled`,e),g(`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=v(C.integrations.otlpSecret.setOtlpHeaders),n=_(C.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,o]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),u=async()=>{l(!0),o(null);try{await t({headersJson:r}),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:s(),children:[(0,F.jsx)(M,{value:r,placeholder:e?m():g(),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 u(),children:b()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:S()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:f()})]})}export{I as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{BC as r,FC as i,GC as a,HC as o,IC as s,JC as c,KC as l,LC as u,MG as d,NP as f,PC as p,QN as m,RC as h,UC as g,VC as _,WC as ee,ZN as te,aP as ne,cP as v,oP as y,qC as b,sP as x,t as S,zC as C}from"./api-CnXjOprV.js";import{Gn as w,Kn as T,Z as E,i as re,o as ie,r as D}from"./index-0t8eOneo.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-D96d_4Et.js";import{n as N,t as P}from"./TimeRangePicker-BIobKXvm.js";var F=t(e(),1),I={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=d(S.me.getMe,{host:E})?.permissions?.includes(`traces.read`)??!1,t=d(S.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:f()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:v()}),(0,R.jsx)(j,{children:y()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:ne()}):(0,R.jsx)(H,{series:n})})]})]})}function H({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),i=t=>6+t*468/(e.length-1),a=e=>74-e*68/r,o=e=>e.map((e,t)=>`${t===0?`M`:`L`}${i(t).toFixed(1)},${a(e).toFixed(1)}`).join(` `),s=e[e.length-1];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[te(),` p50 `,B(s.cP50),` `,x()]}),(0,R.jsxs)(`span`,{children:[m(),` p50 `,B(s.aP50),` `,x()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":v(),children:[(0,R.jsx)(`path`,{d:o(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:o(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:c(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:b(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:l(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:a(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:ee(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:g(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:o(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function ae(){let e=T({from:`/settings/kpi`}),t=w({from:`/settings/kpi`}),n=re(e.from,e.to,D,`now`),i=e=>void t({search:t=>({...t,...ie(e)})}),{from:a,to:o}=N(n),{rowLimit:s,buckets:c}=J(a,o),l=d(S.kpi.listKpis,{limit:s,filter:{from:a,to:o}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>c&&e.set(t,n.slice(n.length-c));return e},[l,c]),f=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[_(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:r()})]}),(0,R.jsx)(Y,{value:n,onChange:i})]});return l===void 0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:C()})]}):l.length===0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:h()})]}):(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(u.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(oe,{config:e,series:u.get(e.metric)??[]},e.metric))})]},e):null})]})}function Y({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:u({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:s()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:i({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":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,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,R.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ae as KpiTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$W as r,$z as i,Ao as a,CB as o,CG as s,EB as c,Fo as l,Gz as u,Hz as d,Io as f,JW as p,Jz as m,KW as ee,Kz as h,MG as g,QW as te,Qz as ne,SB as re,So as ie,TB as ae,Uz as oe,Vz as se,Wz as ce,XW as le,Xz as _,YW as ue,Yz as de,ZW as fe,Zz as pe,_B as me,_o as he,aB as v,aG as y,bB as b,bo as x,cB as S,cG as C,dB as w,dG as T,eB as E,eG as D,fB as O,fG as k,gB as A,go as j,hB as M,hG as N,ho as P,iB as F,iG as I,jG as L,lB as R,lG as ge,mB as _e,mG as ve,nB as ye,nG as be,oB as xe,oG as Se,pB as Ce,pG as we,pj as Te,qW as Ee,qz as De,r as z,rB as Oe,rG as ke,sB as Ae,sG as je,t as B,tB as Me,tG as Ne,uB as Pe,uG as Fe,vB as Ie,vG as Le,vo as Re,wB as ze,xB as Be,xo as Ve,yB as He,yo as Ue}from"./api-CnXjOprV.js";import{t as V}from"./button-C7mIcWuE.js";import{At as H,Ft as U,Mt as We,Nt as Ge,Pt as Ke,R as qe,Z as W,et as Je,it as Ye,jt as Xe,mt as G,nt as K,rt as Ze,t as Qe,tt as $e}from"./index-0t8eOneo.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-C_pawxor.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:z(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:z(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>c()},{id:`composer`,label:()=>ae()},{id:`sidebar`,label:()=>ze()},{id:`notifications`,label:()=>Ae()},{id:`other`,label:()=>o()}],X={showSource:{category:`messages`,label:()=>re(),help:()=>Be()},showReport:{category:`messages`,label:()=>b(),help:()=>He()},copyAssistant:{category:`messages`,label:()=>Ie()},copyUser:{category:`messages`,label:()=>me()},showDelete:{category:`messages`,label:()=>A()},showTools:{category:`messages`,label:()=>M(),help:()=>_e()},voiceInput:{category:`composer`,label:()=>Ce(),help:()=>O()},showUsage:{category:`composer`,label:()=>w(),help:()=>Pe()},autoReadAloud:{category:`composer`,label:()=>f(),help:()=>l()},showChatAge:{category:`sidebar`,label:()=>R(),help:()=>S()},notifSound:{category:`notifications`,label:()=>xe(),help:()=>v()},notifSystem:{category:`notifications`,label:()=>F(),help:()=>Oe()},replySound:{category:`notifications`,label:()=>ye(),help:()=>Me()}};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:()=>u()};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:de()}),(0,J.jsxs)(Je,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(Ze,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ye,{})}),(0,J.jsxs)($e,{children:[(0,J.jsx)(K,{value:`on`,children:oe()}),(0,J.jsx)(K,{value:`off`,children:d()}),(0,J.jsx)(K,{value:`inherit`,children:se()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(G,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":m()}),m()]}):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,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Ge(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[ie(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ke(e,We())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?Ue():r?x():Ve()})]}),(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:P()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?j():e?he():Re()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),o=g(B.me.getMe,{host:W}),c=o?.ui,l=$(o?.role)&&n,u=L(B.me.setUiPref).withOptimisticUpdate(qe),d=(0,q.useMemo)(()=>c?Q(Object.keys(c.effective),e):[],[c,e]);return c?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(o?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(G,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":_()}),_()]}):null,l?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:De()}),(0,J.jsx)(`p`,{children:h()}),(0,J.jsx)(`p`,{children:ce()})]}):null,(0,J.jsx)(U,{value:e,onChange:e=>t(e.target.value),placeholder:E(),"aria-label":E(),className:`mb-2`}),d.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:i()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:d.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=c.locked[e],o=c.effective[e],s=c.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:ne()}):s?(0,J.jsx)(H,{variant:`secondary`,children:a()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&s?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void u({key:e,value:null}),children:pe()}):null,(0,J.jsx)(nt,{checked:o,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),u({key:e,value:t})},"aria-label":n})]}),l?(0,J.jsx)(ut,{prefKey:e,ui:c}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:o?.dictationShortcut??null,enabled:c.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:s()})}var pt={sm:()=>ke(),md:()=>be(),lg:()=>Ne(),xl:()=>D(),"2xl":()=>r(),"3xl":()=>te()};function mt(){let e=g(B.me.getMe,{host:W}),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:W});n&&e.setQuery(B.me.getMe,{host:W},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=L(B.me.setMyName),a=Xe(),o=e?.locale??`default`,s=e?.name??``,[c,l]=(0,q.useState)(null),u=c??s,d=u.trim()!==s.trim();async function f(){try{await i({name:u}),l(null),a.success(T())}catch(e){a.error(Fe(),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:N()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(U,{className:`max-w-xs`,value:u,maxLength:120,placeholder:we(),onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),f())}}),(0,J.jsx)(V,{size:`sm`,disabled:!d,onClick:()=>void f(),children:Te()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:k()})]}),(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:ge()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:C()})]}),(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:Le()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:je()})]}),(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:fe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:le()})]}),(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:ue()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:p()})]}),(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:Se()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Qe.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:I()})]}),(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:ee()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AS as i,BS as a,CG as o,CS as s,D as c,ES as l,FS as u,HS as d,Hi as f,IS as p,JS as m,KS as h,LS as g,MG as _,MS as v,NS as y,OS as ee,PS as b,QS as te,RS as ne,TS as re,US as x,Ui as ie,VS as S,WS as ae,XS as oe,YS as se,_C as ce,_S as C,cC as le,dC as ue,dS as de,eC as fe,fS as pe,gC as me,hC as he,hS as w,iC as ge,jG as T,jS as _e,kS as E,lS as D,lb as ve,mS as O,nC as ye,pS as k,qS as be,sC as xe,sS as A,t as j,tC as Se,uC as M,uS as Ce,vS as we,wS as N,yS as Te,zS as Ee}from"./api-CnXjOprV.js";import{r as De}from"./dist-CU23SxxP.js";import{t as Oe}from"./list-PsjK33SL.js";import{t as P}from"./button-C7mIcWuE.js";import{$ as ke,A as Ae,An as F,Bt as je,C as Me,Cn as Ne,D as I,E as Pe,En as Fe,Fn as Ie,Ft as L,Gn as R,It as Le,J as Re,Kn as ze,Lt as Be,M as Ve,Mn as He,Nn as Ue,O as z,Pn as We,Q as Ge,Rt as B,S as Ke,T as qe,Tn as Je,Vn as V,Vt as Ye,_ as Xe,b as H,bn as Ze,d as Qe,dn as $e,f as U,g as W,h as G,j as K,jn as et,jt as tt,k as nt,m as rt,p as it,q as at,qn as ot,v as q,w as st,x as J,xn as ct,y as lt,yn as ut,zt as dt}from"./index-0t8eOneo.js";var ft=c(`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=c(`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=c(`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=c(`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)(Ye,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-xs`,"aria-label":w(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(Ie,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:i,className:a,onOpen:o}){let c=T(j.projects.renameProject),l=T(j.projects.setProjectColor),u=T(j.projects.moveProject),d=T(j.projects.deleteProject),f=T(j.projects.createProject),p=at(),m=Re(),[h,g]=(0,X.useState)(!1),[v,y]=(0,X.useState)(t),[ee,b]=(0,X.useState)(!1),[ne,ie]=(0,X.useState)(!1),S=_(j.projects.projectTreeCount,ne?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Le,{onOpenChange:e=>e&&ie(!0),children:[(0,Z.jsx)(ht,{className:a}),(0,Z.jsxs)(Be,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(B,{onSelect:()=>o(),children:[(0,Z.jsx)(He,{}),` `,te()]}),(0,Z.jsxs)(B,{onSelect:()=>{y(t),g(!0)},children:[(0,Z.jsx)(ct,{}),` `,O()]}),(0,Z.jsxs)(B,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await m({title:x(),label:ce(),placeholder:me(),confirmLabel:he()});t&&await f({name:t,parentId:e})})},children:[(0,Z.jsx)(et,{}),` `,x()]}),(0,Z.jsxs)(B,{onSelect:()=>b(!0),children:[(0,Z.jsx)(pt,{}),` `,re()]}),(0,Z.jsx)(dt,{children:de()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e,color:null}),"aria-label":Ce(),children:`✕`}),rt.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 l({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(je,{}),(0,Z.jsxs)(B,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=S?.folders??0,i=S?.chats??0;await p({title:Se({name:t}),description:n>0?r({folders:n,chats:i}):i>0?fe({count:i}):we(),confirmWord:C(),confirmLabel:ye(),destructive:!0})&&await d({projectId:e})})},children:[(0,Z.jsx)($e,{}),` `,C()]})]})]}),(0,Z.jsx)(Xe,{open:h,onOpenChange:g,title:xe(),canSubmit:v.trim().length>0,onSubmit:async()=>{await c({projectId:e,name:v.trim()}),g(!1)},submitLabel:O(),children:(0,Z.jsx)(L,{value:v,onChange:e=>y(e.target.value),autoFocus:!0})}),ee?(0,Z.jsx)(it,{open:ee,onOpenChange:b,title:s(),movingFolderId:e,currentId:i,onPick:t=>void u({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let r=T(j.chats.pinChat),i=T(j.chats.deleteChat),a=T(j.chats.renameChat),o=T(j.chats.setChatSidebar),s=T(j.chats.moveChatToProject),c=at(),[u,d]=(0,X.useState)(!1),[f,p]=(0,X.useState)(e.title??``),[m,h]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Le,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(Be,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(B,{onSelect:()=>{p(e.title??``),d(!0)},children:[(0,Z.jsx)(ct,{}),` `,O()]}),(0,Z.jsxs)(B,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ut,{}):(0,Z.jsx)(Ze,{}),e.pinned?k():pe()]}),(0,Z.jsxs)(B,{onSelect:()=>h(!0),children:[(0,Z.jsx)(pt,{}),` `,l()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(B,{onSelect:()=>void o({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(Ne,{}):(0,Z.jsx)(Y,{}),e.inSidebar?se():oe()]}),(0,Z.jsx)(je,{}),(0,Z.jsxs)(B,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await c({title:D(),description:we(),confirmLabel:C(),destructive:!0})&&await i({chatId:e._id})})},children:[(0,Z.jsx)($e,{}),` `,C()]})]})]}),(0,Z.jsx)(Xe,{open:u,onOpenChange:d,title:A(),canSubmit:f.trim().length>0,onSubmit:async()=>{await a({chatId:e._id,title:f.trim()}),d(!1)},submitLabel:O(),children:(0,Z.jsx)(L,{value:f,onChange:e=>p(e.target.value),autoFocus:!0})}),m?(0,Z.jsx)(it,{open:m,onOpenChange:h,title:N(),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}=ot({from:`/project/$projectId`}),t=R(),n=_(j.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:o()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:_e()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:i()}),(0,Z.jsx)(P,{variant:`outline`,onClick:()=>void t({to:`/`}),children:E()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=R(),n=at(),i=Re(),o=tt(),c=T(j.projects.renameProject),l=T(j.projects.setProjectColor),d=T(j.projects.deleteProject),p=T(j.projects.createProject),g=T(j.projects.moveProject),te=T(j.projects.setProjectSidebar),S=T(j.chats.moveChatToProject),oe=T(j.chats.reorderChat),se=T(j.projects.reorderProject),pe=_(j.projects.projectTreeCount,{projectId:e.project._id}),[w,ge]=(0,X.useState)(xt),_e=e=>{localStorage.setItem(bt,e),ge(e)},E=_(j.projects.folderColumns,w===`columns`?{projectId:e.project._id}:`skip`),D=_(j.projects.projectTreeList,w===`list`?{projectId:e.project._id}:`skip`),{c:k}=ze({from:`/project/$projectId`}),A=_(j.projects.listProjects,{}),M=_(j.chatReads.myBusyChats,{}),N=(0,X.useMemo)(()=>new Set(M??[]),[M]),De=_(j.chatReads.myChatReads,{}),Ne=(0,X.useMemo)(()=>yt(e.chats,De??[]),[e.chats,De]),{startNewChat:He,picker:z}=Qe(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[V,H]=(0,X.useState)(``),[Ze,U]=(0,X.useState)(!1),[G,K]=(0,X.useState)(e.project.name),[ot,ut]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(V.trim()),180);return()=>clearTimeout(e)},[V]);let Q=_(j.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=Ae(nt(st,{activationConstraint:{distance:4}}),nt(qe,{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=E?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||ue()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(A??[]).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=I(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=I(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=I(n(`crumb:`));if(a.length>0)return a;let o=I(n(`col:`));return o.length>0?o:Pe(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(w===`columns`){for(let e of E?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(w===`list`){let e=D?.chats.find(e=>e._id===t);return e?{list:D.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(w===`columns`){for(let e of E?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(w===`list`){let e=D?.folders.find(e=>e._id===t);if(!e||!D)return null;let n=e.parentId??D.rootId;return{list:ke(D.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 S({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!Ge(A??[],t,e)){o.error(ae());return}await g({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 S({chatId:e,projectId:n.folderId});let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await oe({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Ge(A??[],e,n.parentId)){o.error(ae());return}await g({projectId:e,parentId:n.parentId})}let a=vt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await se({projectId:e,...a});return}}catch{o.error(ae())}},[,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=W(e.project),Bt=_t(e.chats,V),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":ee(),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:ie(),onClick:()=>{te({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(We,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:f()}),(0,Z.jsx)(Ue,{"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":m(),children:[(0,Z.jsx)(P,{variant:w===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":m(),title:m(),"aria-pressed":w===`cards`,onClick:()=>_e(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(P,{variant:w===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":be(),title:be(),"aria-pressed":w===`columns`,onClick:()=>_e(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(P,{variant:w===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":h(),title:h(),"aria-pressed":w===`list`,onClick:()=>_e(`list`),children:(0,Z.jsx)(Oe,{})})]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:()=>void He({projectId:e.project._id}),children:[(0,Z.jsx)(Fe,{}),ne()]}),(0,Z.jsxs)(P,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await i({title:x(),label:ce(),placeholder:me(),confirmLabel:he()});t&&await p({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(et,{}),x()]}),(0,Z.jsxs)(Le,{children:[(0,Z.jsx)(Ye,{asChild:!0,children:(0,Z.jsx)(P,{variant:`ghost`,size:`icon-sm`,"aria-label":le(),children:(0,Z.jsx)(Ie,{})})}),(0,Z.jsxs)(Be,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(B,{onSelect:()=>{K(e.project.name),U(!0)},children:[(0,Z.jsx)(ct,{}),` `,O()]}),(0,Z.jsxs)(B,{onSelect:()=>ut(!0),children:[(0,Z.jsx)(pt,{}),` `,re()]}),(0,Z.jsx)(dt,{children:de()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void l({projectId:e.project._id,color:null}),"aria-label":Ce(),children:`✕`}),rt.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 l({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(je,{}),(0,Z.jsxs)(B,{variant:`destructive`,onSelect:()=>{let i=e.project.parentId;requestAnimationFrame(async()=>{let a=pe?.folders??0,o=pe?.chats??0;await n({title:Se({name:e.project.name}),description:a>0?r({folders:a,chats:o}):o>0?fe({count:o}):we(),confirmWord:C(),confirmLabel:ye(),destructive:!0})&&(await d({projectId:e.project._id}),t(i===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:i}}))})},children:[(0,Z.jsx)($e,{}),` `,C()]})]})]})]})]}),w===`columns`?(0,Z.jsx)(Ft,{data:E,currentId:e.project._id,busyIds:N,suppressClick:$,locateChatId:k??null}):w===`list`?(0,Z.jsx)(Mt,{data:D,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:a()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(q,{items:e.children.map(e=>`folder:${e._id}`),strategy:lt,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:Ee()}),e.chats.length>0?(0,Z.jsx)(L,{value:V,onChange:e=>H(e.target.value),placeholder:u(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?y():v()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:b({term:V.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(q,{items:Bt.map(e=>`chat:${e._id}`),strategy:J,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:N.has(t._id),unread:Ne.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:Te()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:b({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&&Ve(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(Je,{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||ve()}),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)(Xe,{open:Ze,onOpenChange:U,title:xe(),canSubmit:G.trim().length>0,onSubmit:async()=>{await c({projectId:e.project._id,name:G.trim()}),U(!1)},submitLabel:O(),children:(0,Z.jsx)(L,{value:G,onChange:e=>K(e.target.value),autoFocus:!0})}),ot?(0,Z.jsx)(it,{open:ot,onOpenChange:ut,title:s(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void g({projectId:e.project._id,parentId:t})}):null,z]}),(0,Z.jsx)(Me,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(F,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Je,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=z({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=R(),a=H({id:`folder:${e._id}`}),o=z({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":W(e),transform:K.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)(F,{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?g({count:e.folderCount})+` · `:``,p({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:U(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=T(j.chats.setChatSidebar),n=e.inSidebar?se():oe();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)(Ne,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=R(),c=G(e.color),l=H({id:`chat:${e._id}`}),u=jt(a);return(0,Z.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),u.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:K.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||ue()}),e.pinned?(0,Z.jsx)(Ze,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:U(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:M(),"aria-label":M()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:ge(),"aria-label":ge()}):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),s=(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:o()});if(e===null)return null;let c=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),l=(a,o)=>{let u=s.get(a??e.rootId)??[],d=ke(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(q,{items:u.map(e=>`chat:${e._id}`),strategy:J,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:o,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(q,{items:d.map(e=>`folder:${e._id}`),strategy:J,children:d.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:a??e.rootId,depth:o,folded:i.has(t._id),onToggle:()=>c(t._id),suppressClick:n,children:i.has(t._id)?null:l(t._id,o+1)},t._id))})]})};return(0,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(s.get(e.rootId)??[]).length===0&&ke(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:y()}):l(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=R(),c=H({id:`folder:${e._id}`}),l=z({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":W(e),transform:K.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?d():S(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(V,{size:13}):(0,Z.jsx)(De,{size:13})}),(0,Z.jsx)(F,{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=R(),o=H({id:`chat:${e._id}`}),s=jt(r),c=G(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:K.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||ue()}),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:o()}):(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=R(),s=z({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)(q,{items:e.folders.map(e=>`folder:${e._id}`),strategy:J,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)(q,{items:e.chats.map(e=>`chat:${e._id}`),strategy:J,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:v()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=H({id:`folder:${e._id}`}),o=z({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":W(e),transform:K.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)(F,{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=H({id:`chat:${e._id}`}),s=jt(r),c=G(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:K.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||ue()}),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 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{CT as r,Cc as i,DT as a,ET as o,FT as s,MG as c,PT as l,ST as u,TT as d,Tc as f,_T as p,bT as m,cT as h,dT as g,du as _,ef as v,eu as y,fT as b,fu as ee,gT as te,hT as x,if as S,iu as C,jG as w,lT as T,mT as E,mu as ne,nf as re,nu as ie,pT as ae,pu as oe,rf as se,ru as ce,t as D,tf as O,tu as k,uT as A,vT as j,wT as M,wc as N,xT as P,yT as F,zi as I}from"./api-CnXjOprV.js";import{i as L,n as R,r as z,t as B}from"./FieldLabel-DVWzsIR3.js";import{t as V}from"./button-C7mIcWuE.js";import{Qt as le,Xt as H,Yt as U,Z as W,Zt as ue,et as G,it as K,jt as de,mt as fe,nt as q,rt as J,tt as Y}from"./index-0t8eOneo.js";import{r as X,t as Z}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),me={media_delivery:{label:u,help:P},documentary_fetch:{label:m,help:F},inbound_files:{label:j,help:p},history_summary:{label:S,help:se},file_curation:{label:ne,help:C},quote_reply:{label:oe,help:ee}},he={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
- - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
- Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
- - [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},ge={outboundDir:A,references:T,files:h,previous_summary:re,new_messages:O,max_chars:v,file_name:ce,budget_chars:ie,feedback:k,content:y,excerpt:_};function _e(){let e=c(D.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:x()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(R,{label:a(),help:o()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:te()}),(0,$.jsxs)(G,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(K,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(q,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=w(D.admin.upsertInstanceConfig),n=de(),r=c(D.me.getMe,{host:W}),a=e.config??{},o=X(e.config?.contentLocale,r?.defaultLocale??void 0),[u,d]=(0,Q.useState)(()=>L(a,o));(0,Q.useEffect)(()=>{d(L(a,o))},[o,e._id]);let[p,m]=(0,Q.useState)(!1),h=u.promptInjections,g=(e,t)=>d({...u,promptInjections:{...h,[e]:{...h[e],...t}}});async function _(){m(!0);try{await t({instanceId:e._id,config:z(u,a,o)})}catch(e){n.error(l(),e)}finally{m(!1)}}async function v(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(l(),e)}}let y=e.config?.contentLocale??`default`,b=Z[X(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:f()}),(0,$.jsxs)(G,{value:y,onValueChange:e=>void v(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(K,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(q,{value:`default`,children:i({locale:b})}),pe().map(e=>(0,$.jsx)(q,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:N()})]}),H.map(e=>(0,$.jsx)(ye,{injKey:e,def:U[e],i18n:me[e],row:h[e]??{enabled:!0,template:U[e].defaultTemplate[o]},contentLocale:o,onChange:t=>g(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(V,{size:`sm`,onClick:()=>void _(),disabled:p,children:s()})})]})}function ye({injKey:e,def:t,i18n:n,row:i,contentLocale:a,onChange:o}){let[s,c]=(0,Q.useState)(!1),l=i.template.trim()!==t.defaultTemplate[a],u=t.togglable&&!i.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),p=ue(e,i,a),m=p?le(p,f):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(fe,{checked:i.enabled,onCheckedChange:e=>o({enabled:e===!0})}),(0,$.jsx)(R,{label:n.label(),help:n.help()})]}):(0,$.jsx)(R,{label:n.label(),help:n.help()}),l&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:M()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:i.template,disabled:u,rows:8,spellCheck:!1,onChange:e=>o({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:r()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(B,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>c(e=>!e),children:s?ae():E()}),l&&(0,$.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>o({template:t.defaultTemplate[a]}),children:d()})]})]}),s&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:m?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:m}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:b()}),t.pluralDefaultTemplate!==void 0&&!u?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:I()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:g()})})]})}export{_e as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,BO as i,Ck as a,Dk as o,Ek as s,GO as c,HO as ee,KO as l,MG as te,Ok as u,QO as d,RO as f,Ru as p,Sk as m,Tk as h,UO as ne,VO as g,WO as _,_k as v,ak as y,bk as b,ck as x,dk as re,ek as ie,fk as ae,gk as S,hk as C,ik as w,jG as T,lk as E,mk as D,nk as O,ok as k,pk as A,rk as j,sk as M,t as N,tk as P,uk as F,vk as I,wk as L,xk as R,yk as oe,zO as z}from"./api-CnXjOprV.js";import{t as B}from"./button-C7mIcWuE.js";import{At as V,Dn as H,Ft as U,_ as W,jt as G,mt as K,q}from"./index-0t8eOneo.js";import{t as J}from"./roleDescriptions-Bm8ptI3N.js";var Y=t(e(),1),X=n(),Z=[{group:()=>u(),keys:[{key:`traces.read`,label:()=>a()},{key:`traces.read.content`,label:()=>m(),phi:!0},{key:`traces.write`,label:()=>R()}]},{group:()=>o(),keys:[{key:`kpi.read`,label:()=>a()},{key:`kpi.write`,label:()=>R()}]},{group:()=>s(),keys:[{key:`openclaw.query`,label:()=>b()},{key:`anomalies.read`,label:()=>oe()},{key:`anomalies.report`,label:()=>I()}]},{group:()=>h(),keys:[{key:`chats.read`,label:()=>a()},{key:`selfheal`,label:()=>S()},{key:`media.repair`,label:()=>C()},{key:`feedback.respond`,label:()=>p()}]},{group:()=>L(),keys:[{key:`admin.manage`,label:()=>v()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=te(N.apiKeys.listRoles,{}),t=T(N.apiKeys.createRole),n=T(N.apiKeys.ensureRolesSeeded),a=T(N.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(N.apiKeys.listRoles,{});r&&e.setQuery(N.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),o=q(),s=G(),[u,p]=(0,Y.useState)(!1),[m,h]=(0,Y.useState)($),[v,b]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{s.error(A(),e)})},[n,s]);let S=e??[];async function C(e,t){if(Q(e.permissions))return;if(e.builtin){await o({title:ae({name:e.name}),description:re(),confirmLabel:F()});return}if(v.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 a({roleId:e._id,permissions:n})}catch(e){s.error(E(),e)}finally{b(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function I(){try{await t({key:m.key,name:m.name,description:m.description||void 0,permissions:[]}),h($),p(!1)}catch(e){s.error(x(),e)}}let L=e===void 0,R=!L&&S.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[M(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,k(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,y()]}),(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:w()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{h($),p(!0)},children:j()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:O()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:P()}):(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:ie()}),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?D({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:S.map(e=>{let t=Q(e.permissions),n=v.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)(V,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,r()]}):(0,X.jsx)(V,{variant:`secondary`,children:d()})]}),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)(K,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?l():n?c():r,onCheckedChange:()=>void C(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(W,{open:u,onOpenChange:p,title:_(),description:ne(),canSubmit:!!(m.key&&m.name),onSubmit:I,submitLabel:ee(),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:g()}),(0,X.jsx)(U,{value:m.key,placeholder:i(),onChange:e=>h({...m,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:z()}),(0,X.jsx)(U,{value:m.name,onChange:e=>h({...m,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:f()}),(0,X.jsx)(U,{value:m.description,onChange:e=>h({...m,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$H as r,$U as i,$V as a,BH as o,CG as s,CU as c,D as l,DU as u,EU as ee,FH as d,GH as te,HH as f,IH as p,JU as m,KH as h,KU as ne,LH as re,MG as ie,MH as ae,NH as oe,PH as se,QH as ce,QU as le,RH as g,SH as ue,SU as de,TG as _,TU as fe,UH as pe,VH as me,WH as v,XU as he,YU as ge,ZU as _e,_H as ve,_U as ye,aH as be,aU as xe,aW as Se,bH as Ce,bU as y,cH as we,dH as Te,eU as Ee,eW as De,fH as Oe,fU as ke,gH as Ae,gU as je,hH as Me,hU as Ne,iU as Pe,iW as Fe,kG as b,lH as Ie,lU as Le,mH as Re,mU as ze,nU as Be,nW as Ve,oH as He,oU as Ue,oW as We,pH as Ge,pU as Ke,qH as qe,qU as Je,rU as Ye,rW as Xe,sH as Ze,sU as Qe,sW as $e,t as x,tU as et,tW as tt,uH as nt,vH as rt,vU as it,wU as at,xH as ot,yH as st,yU as ct,zH as lt}from"./api-CnXjOprV.js";import{t as ut}from"./list-PsjK33SL.js";import{t as S}from"./button-C7mIcWuE.js";import{At as C,Ct as dt,Dt as ft,Et as pt,Ft as mt,Hn as w,Ht as ht,On as gt,Ot as _t,Sn as vt,St as yt,Tt as bt,Ut as T,Vn as E,Wt as D,Z as xt,at as St,bt as Ct,ct as wt,dn as Tt,et as O,gn as Et,it as k,jt as Dt,kt as Ot,lt as kt,nt as A,on as At,ot as jt,rt as j,st as Mt,tt as M,ut as Nt,vn as Pt,wt as Ft,xn as It,xt as Lt}from"./index-0t8eOneo.js";import{a as Rt,i as N,n as zt,o as Bt,r as P,t as Vt}from"./table-CXJLU3m_.js";import{t as Ht}from"./FilterBar-DLMcpn_E.js";/* empty css */import{a as Ut,c as F,i as I,l as Wt,n as Gt,o as Kt,r as qt,s as Jt,t as Yt,u as L}from"./TimezoneCombobox-C_pawxor.js";var Xt=l(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Zt=l(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),R=t(e(),1),z=n();function B(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Qt({value:e,onChange:t}){let n=Wt(e),r=(0,R.useMemo)(()=>new Date,[]),[i,a]=(0,R.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,R.useState)(!1),c=(0,R.useMemo)(()=>B(_()),[]),l=(0,R.useMemo)(()=>new Intl.DateTimeFormat(_(),{month:`long`,year:`numeric`}),[]),u=(0,R.useMemo)(()=>new Intl.DateTimeFormat(_(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=F(i.year,i.month),d=n?.hour??9,p=n?.minute??0,m=(e,n,r,i,a)=>t(L(e,n,r,i,a)),ne=(e,t,n)=>{a({year:e,month:t}),m(e,t,n,d,p)},re=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},ie=n===null?h():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,z.jsxs)(ht,{modal:!0,open:o,onOpenChange:s,children:[(0,z.jsx)(D,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":qe(),children:[(0,z.jsx)(Xt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,z.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:ie})]})}),(0,z.jsxs)(T,{align:`start`,className:`oc-dtp__pop`,children:[(0,z.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":te(),onClick:()=>re(-1),children:(0,z.jsx)(w,{size:15,"aria-hidden":!0})}),(0,z.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":v(),onClick:()=>re(1),children:(0,z.jsx)(E,{size:15,"aria-hidden":!0})})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,z.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,z.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:()=>ne(e.year,e.month,e.day),children:e.day},t)})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,z.jsxs)(O,{value:String(d),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),Number(e),p),children:[(0,z.jsx)(j,{size:`sm`,"aria-label":pe(),children:(0,z.jsx)(k,{})}),(0,z.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,z.jsx)(A,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,z.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,z.jsxs)(O,{value:String(p),onValueChange:e=>m(i.year,i.month,n?.day??r.getDate(),d,Number(e)),children:[(0,z.jsx)(j,{size:`sm`,"aria-label":f(),children:(0,z.jsx)(k,{})}),(0,z.jsx)(M,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,z.jsx)(A,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function V(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function $t(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function en(e){let t=new Map;for(let n of e){let e=V(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function H(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get($t(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function tn(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function nn(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function rn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var U=3;function an({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=_(),c=(0,R.useMemo)(()=>en(e),[e]),l=(0,R.useMemo)(()=>tn(s),[s]),u=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),te=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),f=new Date,m=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()})},h=t===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,z.jsxs)(`div`,{className:`oc-cal`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":d(),onClick:()=>m(-1),children:(0,z.jsx)(w,{})}),(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":se(),onClick:()=>m(1),children:(0,z.jsx)(E,{})}),(0,z.jsx)(S,{variant:`ghost`,size:`sm`,onClick:()=>i({year:f.getFullYear(),month:f.getMonth()}),children:p()})]}),(0,z.jsx)(`span`,{className:`oc-cal__title`,children:h}),(0,z.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,z.jsx)(S,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:g()}),(0,z.jsx)(S,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:re()})]})]}),t===`month`?(0,z.jsx)(on,{cursor:n,byDay:c,weekdays:l,timeFmt:te,now:f,onEventClick:a}):(0,z.jsx)(sn,{year:n.year,byDay:c,monthShortFmt:ee,now:f,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,z.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function on({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=F(e.year,e.month);return(0,z.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,z.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get($t(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,z.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,z.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,U).map(e=>(0,z.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,z.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,z.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>U?(0,z.jsx)(`span`,{className:`oc-cal__more`,children:oe({count:o.length-U})}):null]},n)})]})}function sn({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,z.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=H(t,e,o),c=F(e,o);return(0,z.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,z.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,z.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,z.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var W={h:36e5,min:6e4,s:1e3,ms:1};function cn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*W[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function G(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function K(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=G(t[0],0,59),r=G(t[1],0,23),i=G(t[2],1,31),a=G(t[3],1,12),o=G(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var q=new Map;function J(e){let t=q.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return q.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=K(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=Kt(e)!==`active`,c=Z(s?null:cn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Jt(e)){case`ok`:return(0,z.jsx)(C,{variant:`secondary`,children:Ue()});case`error`:return(0,z.jsx)(C,{variant:`destructive`,children:Pe()});case`running`:return(0,z.jsx)(C,{variant:`outline`,children:Ye()});case`other`:return(0,z.jsx)(C,{variant:`outline`,children:e});case`none`:return(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=b(x.scheduled.listMyCrons),t=b(x.scheduled.getCronDetail),n=b(x.scheduled.listCronRuns),l=b(x.scheduled.updateCron),d=b(x.scheduled.removeCron),te=b(x.scheduled.runCronNow),f=Dt(),p=ie(x.me.getMe,{host:xt})?.timezone,[h,re]=(0,R.useState)(null),[oe,se]=(0,R.useState)(!1),[g,pe]=(0,R.useState)(!1),[v,qe]=(0,R.useState)(null),[w,ht]=(0,R.useState)(null),[T,E]=(0,R.useState)(null),[D,F]=(0,R.useState)(null),[Wt,Jt]=(0,R.useState)(!1),[L,B]=(0,R.useState)(Gt),[V,$t]=(0,R.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),en=e=>{localStorage.setItem(`oc.sched.view`,e),$t(e)},[H,tn]=(0,R.useState)(`month`),[U,on]=(0,R.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),sn=(0,R.useMemo)(()=>{let e=[];for(let t of h??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Ut(r,L)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[h,L]),W=(0,R.useMemo)(()=>H===`year`?rn(U.year):nn(U.year,U.month),[H,U]),cn=(0,R.useMemo)(()=>un(sn,W.startMs,W.endMs),[sn,W]),G=e=>{let t=cn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},K=(0,R.useCallback)(async()=>{se(!0),pe(!1);try{re(await e({}))}catch{pe(!0)}finally{se(!1)}},[e]);(0,R.useEffect)(()=>{K()},[K]);let q=(0,R.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,R.useRef)(null);(0,R.useEffect)(()=>{h!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[h]);let Y=(0,R.useMemo)(()=>new Intl.DateTimeFormat(_(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{qe(e);try{await t(),f.success(n),await K()}catch(e){f.toast({variant:`error`,title:y({code:dn(e)})})}finally{qe(null)}},Z=(0,R.useRef)(0),Q=(0,R.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;E({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;E({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;E(null),f.toast({variant:`error`,title:y({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),f.toast({variant:`error`,title:y({code:dn(e)})})}},mn=async()=>{if(D===null)return;let e={};if(D.nameDirty&&D.name.trim()===``||D.messageDirty&&D.hasMessage&&D.message.trim()===``){f.toast({variant:`error`,title:be()});return}if(D.nameDirty&&D.name.trim()!==``&&(e.name=D.name.trim()),D.scheduleDirty){if(D.scheduleKind===`cron`&&D.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:D.cronExpr.trim(),...D.tz.trim()===``?{}:{tz:D.tz.trim()}};else if(D.scheduleKind===`every`){let t=Number(D.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[D.everyUnit])})}else if(D.scheduleKind===`at`&&D.at!==``){let t=Date.parse(D.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(D.scheduleDirty&&e.schedule===void 0){f.toast({variant:`error`,title:He()});return}if(D.messageDirty&&D.hasMessage&&D.message.trim()!==``&&(e.message=D.message.trim()),Object.keys(e).length===0){F(null);return}let t=Q.current;Jt(!0);try{await l({instanceName:D.instanceName,jobId:D.jobId,patch:e}),f.success(st()),t===Q.current&&F(null),await K()}catch(e){f.toast({variant:`error`,title:y({code:dn(e)})})}finally{Jt(!1)}},hn=h?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:$e()}),(0,z.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":me(),children:[(0,z.jsx)(S,{variant:V===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":o(),title:o(),"aria-pressed":V===`list`,onClick:()=>en(`list`),children:(0,z.jsx)(ut,{})}),(0,z.jsx)(S,{variant:V===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":lt(),title:lt(),"aria-pressed":V===`calendar`,onClick:()=>en(`calendar`),children:(0,z.jsx)(Xt,{})})]}),(0,z.jsxs)(S,{variant:`ghost`,size:`sm`,onClick:()=>void K(),disabled:oe,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,z.jsx)(Et,{size:14,"aria-hidden":!0}),We()]})]}),h!==null&&hn>0?(0,z.jsxs)(Ht,{q:L.q,onQChange:e=>B(t=>({...t,q:e})),searchPlaceholder:et(),onReset:()=>B(Gt),canReset:qt(L),children:[(0,z.jsxs)(O,{value:L.state,onValueChange:e=>B(t=>({...t,state:e})),children:[(0,z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,z.jsx)(k,{})}),(0,z.jsxs)(M,{children:[(0,z.jsx)(A,{value:`all`,children:Ee()}),(0,z.jsx)(A,{value:`active`,children:Je()}),(0,z.jsx)(A,{value:`paused`,children:m()}),(0,z.jsx)(A,{value:`auto-disabled`,children:ne()})]})]}),(0,z.jsxs)(O,{value:L.result,onValueChange:e=>B(t=>({...t,result:e})),children:[(0,z.jsx)(j,{size:`sm`,className:`w-40`,children:(0,z.jsx)(k,{})}),(0,z.jsxs)(M,{children:[(0,z.jsx)(A,{value:`all`,children:r()}),(0,z.jsx)(A,{value:`ok`,children:Ue()}),(0,z.jsx)(A,{value:`error`,children:Pe()}),(0,z.jsx)(A,{value:`running`,children:Ye()}),(0,z.jsx)(A,{value:`none`,children:Be()})]})]})]}):null,h===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":oe,children:g?Se():s()}):V===`calendar`?(0,z.jsxs)(z.Fragment,{children:[g?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null,h.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):(0,z.jsx)(an,{events:cn.events,mode:H,cursor:U,onModeChange:tn,onCursorChange:on,onEventClick:G,footnote:ae()})]}):(0,z.jsxs)(z.Fragment,{children:[g?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):null,h.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}):null,h.map(e=>{let t=e.jobs.filter(e=>Ut(e,L)),n=qt(L)&&e.jobs.length>0&&t.length===0;return(0,z.jsxs)(`section`,{style:{marginBottom:20},children:[h.length>1||e.error||!e.supported?(0,z.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,z.jsx)(C,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve({code:e.error})}):e.jobs.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}):n?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}):(0,z.jsxs)(Vt,{children:[(0,z.jsx)(Rt,{children:(0,z.jsxs)(Bt,{children:[(0,z.jsx)(N,{children:De()}),(0,z.jsx)(N,{children:i()}),(0,z.jsx)(N,{children:le()}),(0,z.jsx)(N,{children:_e()}),(0,z.jsx)(N,{children:he()}),(0,z.jsx)(N,{children:Qe()}),(0,z.jsx)(N,{children:ue()})]})}),(0,z.jsx)(zt,{children:t.map((t,n)=>{let r=`${e.instanceName}:${t.id??n}`,i=v===r,a=e.manageSupported,o=e.kind===`openclaw`&&a;return(0,z.jsxs)(Bt,{ref:t.id!==null&&t.id===q?J:void 0,"data-state":t.id!==null&&t.id===q?`selected`:void 0,children:[(0,z.jsx)(P,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??ge()}),(0,z.jsx)(P,{children:(0,z.jsx)(C,{variant:`secondary`,children:t.agentId})}),(0,z.jsxs)(P,{className:`whitespace-nowrap`,children:[(0,z.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Ct(t.schedule),n=e===null?null:Lt(e);return n===null?null:(0,z.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,z.jsx)(P,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,z.jsx)(P,{children:Kt(t)===`auto-disabled`?(0,z.jsx)(C,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:ne()}):Kt(t)===`active`?(0,z.jsx)(C,{variant:`secondary`,children:Je()}):Kt(t)===`paused`?(0,z.jsx)(C,{variant:`outline`,children:m()}):(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,z.jsxs)(P,{children:[(0,z.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,z.jsx)(C,{variant:`destructive`,title:t.lastDeliveryError??u(),children:xe()}):null]}),(0,z.jsx)(P,{className:`whitespace-nowrap`,children:t.id===null?(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):i?(0,z.jsx)(gt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,z.jsxs)(`span`,{className:`oc-cronactions`,children:[o?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:fe(),"aria-label":fe(),disabled:v!==null,onClick:()=>void X(r,async()=>{let n=await te({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},ct()),children:(0,z.jsx)(At,{size:14,"aria-hidden":!0})}):null,o&&t.enabled!==null?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:I(t)===`pause`?at():c(),"aria-label":I(t)===`pause`?at():c(),disabled:v!==null,onClick:()=>void X(r,()=>l({instanceName:e.instanceName,jobId:t.id,patch:{enabled:I(t)===`resume`}}),I(t)===`pause`?it():ye()),children:I(t)===`pause`?(0,z.jsx)(vt,{size:14,"aria-hidden":!0}):(0,z.jsx)(Pt,{size:14,"aria-hidden":!0})}):null,o?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:ot(),"aria-label":ot(),disabled:v!==null,onClick:()=>void pn(e.instanceName,t),children:(0,z.jsx)(It,{size:14,"aria-hidden":!0})}):null,o?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:Ce(),"aria-label":Ce(),disabled:v!==null,onClick:()=>void ln(e.instanceName,t),children:(0,z.jsx)(Zt,{size:14,"aria-hidden":!0})}):null,a?(0,z.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:de(),"aria-label":de(),disabled:v!==null,onClick:()=>ht({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,z.jsx)(Tt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()})]},e.instanceName)}),hn>0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:a()}):null]}),(0,z.jsx)(yt,{open:w!==null,onOpenChange:e=>{e||ht(null)},children:(0,z.jsxs)(bt,{children:[(0,z.jsxs)(_t,{children:[(0,z.jsx)(Ot,{children:Ne()}),(0,z.jsx)(pt,{children:ze({name:w?.name??``})})]}),(0,z.jsxs)(ft,{children:[(0,z.jsx)(Ft,{children:Ke()}),(0,z.jsx)(dt,{onClick:()=>{let e=w;ht(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>d({instanceName:e.instanceName,jobId:e.jobId}),je())},children:ke()})]})]})}),(0,z.jsx)(St,{open:T!==null,onOpenChange:e=>{e||(Z.current++,E(null))},children:(0,z.jsxs)(jt,{style:{maxWidth:640},children:[(0,z.jsx)(kt,{children:(0,z.jsx)(Nt,{children:rt({name:T?.name??``})})}),T?.entries===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):T!==null&&T.entries.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}):T===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:T.entries.map((e,t)=>(0,z.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,z.jsx)(fn,{status:e.status}),(0,z.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,z.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[Le({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,z.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,z.jsx)(St,{open:D!==null,onOpenChange:e=>{e||(Q.current++,F(null))},children:(0,z.jsxs)(jt,{className:`oc-cronedit`,children:[(0,z.jsxs)(kt,{children:[(0,z.jsx)(Nt,{children:Ae()}),(0,z.jsx)(Mt,{children:Me()})]}),D===null?null:D.loading?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:De()}),(0,z.jsx)(mt,{value:D.name,maxLength:200,onChange:e=>F({...D,name:e.target.value,nameDirty:!0})})]}),(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Re()}),(0,z.jsxs)(O,{value:D.scheduleKind,onValueChange:e=>F({...D,scheduleKind:e,scheduleDirty:!0}),children:[(0,z.jsx)(j,{children:(0,z.jsx)(k,{})}),(0,z.jsxs)(M,{children:[(0,z.jsx)(A,{value:`cron`,children:Ge()}),(0,z.jsx)(A,{value:`every`,children:Oe()}),(0,z.jsx)(A,{value:`at`,children:Te()})]})]}),D.scheduleKind===`cron`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(mt,{value:D.cronExpr,onChange:e=>F({...D,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,z.jsx)(Yt,{value:D.tz,onChange:e=>F({...D,tz:e,scheduleDirty:!0}),fallbackTz:p??void 0})]}):D.scheduleKind===`every`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(mt,{type:`number`,min:1,value:D.everyValue,onChange:e=>F({...D,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,z.jsxs)(O,{value:D.everyUnit,onValueChange:e=>F({...D,everyUnit:e,scheduleDirty:!0}),children:[(0,z.jsx)(j,{style:{maxWidth:160},children:(0,z.jsx)(k,{})}),(0,z.jsxs)(M,{children:[(0,z.jsx)(A,{value:`minutes`,children:nt()}),(0,z.jsx)(A,{value:`hours`,children:Ie()}),(0,z.jsx)(A,{value:`days`,children:we()})]})]})]}):(0,z.jsx)(Qt,{value:D.at,onChange:e=>F({...D,at:e,scheduleDirty:!0})})]}),D.hasMessage?(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ee()}),(0,z.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:D.message,onChange:e=>F({...D,message:e.target.value,messageDirty:!0})})]}):null]}),(0,z.jsxs)(wt,{children:[(0,z.jsx)(S,{variant:`ghost`,onClick:()=>F(null),children:Ke()}),(0,z.jsxs)(S,{onClick:()=>void mn(),disabled:D===null||D.loading||Wt,children:[Wt?(0,z.jsx)(gt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Ze()]})]})]})})]})}export{pn as ScheduledTab};