@lacneu/atrium 0.101.2 → 0.101.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/dist/assets/{AccessTab-CgoSHwRq.js → AccessTab-DwQXs7Qd.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-05ypZDMe.js → AdvancedFilter-BmALfXnB.js} +1 -1
  3. package/dist/assets/AgentFilesTab-BXBJmeSc.js +3 -0
  4. package/dist/assets/{AnomaliesTab-QCxh3MK3.js → AnomaliesTab-CofoaMkF.js} +1 -1
  5. package/dist/assets/{AuditTab-ZSJKAmT-.js → AuditTab-XWQHKIp_.js} +1 -1
  6. package/dist/assets/BridgeTab-BUFvmr2d.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-Dmd6QOKm.js +1 -0
  8. package/dist/assets/{DataTableShell-BUYroEsA.js → DataTableShell-BYSvf6VZ.js} +1 -1
  9. package/dist/assets/DeletedChatsTab-C_hfpRhG.js +1 -0
  10. package/dist/assets/{DetailChips-Zknkp3Iu.js → DetailChips-DUlvwews.js} +1 -1
  11. package/dist/assets/{FeedbacksTab-DVZNIYyH.js → FeedbacksTab-DXelU8Ru.js} +1 -1
  12. package/dist/assets/{FieldLabel-BP6EBGVI.js → FieldLabel-CcWGFs5F.js} +1 -1
  13. package/dist/assets/FilesTab-DkcqLbSs.js +1 -0
  14. package/dist/assets/{FilterBar-BrdWP0oO.js → FilterBar-BgVXfm-6.js} +1 -1
  15. package/dist/assets/{GroupsTab-Bq7pFctp.js → GroupsTab-I7HSSXyG.js} +1 -1
  16. package/dist/assets/InstancesTab-CQwASkfp.js +1 -0
  17. package/dist/assets/IntegrationsTab-C2ZW4PH-.js +1 -0
  18. package/dist/assets/{KpiTab-CgNFLZ4K.js → KpiTab-LgHgVxRb.js} +1 -1
  19. package/dist/assets/PreferencesTab-BH7-p_lT.js +1 -0
  20. package/dist/assets/ProjectPage-Bl8fhfx1.js +1 -0
  21. package/dist/assets/PromptInjectionsTab-BIURoP_R.js +4 -0
  22. package/dist/assets/{RolesTab-yEfSrKGO.js → RolesTab-Baw2YHq3.js} +1 -1
  23. package/dist/assets/ScheduledTab-DORhocyn.js +1 -0
  24. package/dist/assets/ServiceAccountsTab-UmjjOrwp.js +1 -0
  25. package/dist/assets/{SubAgentReportsTab-CBEyyvZD.js → SubAgentReportsTab-cm_UrpNl.js} +1 -1
  26. package/dist/assets/ThemeShowroom-CFTzDqq9.js +1 -0
  27. package/dist/assets/{TimeRangePicker-BcvPW9JK.js → TimeRangePicker-CSLm7VwE.js} +1 -1
  28. package/dist/assets/{TimezoneCombobox-Djj8VaFK.js → TimezoneCombobox-ObUCuHhu.js} +1 -1
  29. package/dist/assets/TracesTab-BhR-6Ixe.js +1 -0
  30. package/dist/assets/{TrashTab-NsT89bEO.js → TrashTab-BZUmrLBK.js} +1 -1
  31. package/dist/assets/{UsersTab-Dyf8X1a7.js → UsersTab-Cxo_mjSa.js} +1 -1
  32. package/dist/assets/VoiceTab-BP_6mdHw.js +1 -0
  33. package/dist/assets/api--rqKQo-l.js +44 -0
  34. package/dist/assets/{button-BbEZKLza.js → button-HksxbiUF.js} +1 -1
  35. package/dist/assets/{card-Du7JykLJ.js → card-BS-Ukkxw.js} +1 -1
  36. package/dist/assets/chevrons-up-down-4c0Fo5uU.js +1 -0
  37. package/dist/assets/{compatView-BDU79WFh.js → compatView-BmFG4Q3R.js} +1 -1
  38. package/dist/assets/{dispatchErrorInfo-CoXI4U8X.js → dispatchErrorInfo-CW3gRHkP.js} +1 -1
  39. package/dist/assets/{dist-DkeZNw3H.js → dist-BDjijy9l.js} +1 -1
  40. package/dist/assets/{dist-l5bFdBkH.js → dist-DjxjpzgS.js} +1 -1
  41. package/dist/assets/{dist-DuDAYkx5.js → dist-e05Gnyj5.js} +1 -1
  42. package/dist/assets/{dist-Bfmsr8JO.js → dist-lcVkVTM0.js} +1 -1
  43. package/dist/assets/{highlighted-body-OFNGDK62-B8sH7UMy.js → highlighted-body-OFNGDK62-DAKnlLPW.js} +1 -1
  44. package/dist/assets/index-l7elBM2O.js +447 -0
  45. package/dist/assets/{list-Bhy47ogH.js → list-DnhyuzZ4.js} +1 -1
  46. package/dist/assets/mermaid-GHXKKRXX-CvLURkTf.js +1 -0
  47. package/dist/assets/{pdf-Dxeqzi2x.js → pdf-CgxfnVev.js} +1 -1
  48. package/dist/assets/roleDescriptions-Csn1bSUI.js +1 -0
  49. package/dist/assets/{table-BrECCZpB.js → table-CwhkOFwK.js} +1 -1
  50. package/dist/assets/{trashPage-svjv-CK6.js → trashPage-DgXB4jOM.js} +1 -1
  51. package/dist/assets/{use_paginated_query-C842MAhU.js → use_paginated_query-BKOSBoa7.js} +1 -1
  52. package/dist/assets/x-C5eyKPkE.js +1 -0
  53. package/dist/index.html +8 -8
  54. package/package.json +1 -1
  55. package/dist/assets/AgentFilesTab-DHL8Lt63.js +0 -3
  56. package/dist/assets/BridgeTab-BJEkCzek.js +0 -1
  57. package/dist/assets/ChatDefaultsTab-CMbP2VpD.js +0 -1
  58. package/dist/assets/DeletedChatsTab-DP3F_9Es.js +0 -1
  59. package/dist/assets/FilesTab-COkrJcj5.js +0 -1
  60. package/dist/assets/InstancesTab-DMYsJ9Eh.js +0 -1
  61. package/dist/assets/IntegrationsTab-BTLLarPk.js +0 -1
  62. package/dist/assets/PreferencesTab-BnBhz2n4.js +0 -1
  63. package/dist/assets/ProjectPage-CUsvZaGD.js +0 -1
  64. package/dist/assets/PromptInjectionsTab-B5AV0diL.js +0 -4
  65. package/dist/assets/ScheduledTab-Bfsl1JLw.js +0 -1
  66. package/dist/assets/ServiceAccountsTab-c3kMpEBz.js +0 -1
  67. package/dist/assets/ThemeShowroom-D_KOxmeA.js +0 -1
  68. package/dist/assets/TracesTab-BBUTNwmq.js +0 -1
  69. package/dist/assets/VoiceTab-CakW8mBV.js +0 -1
  70. package/dist/assets/api-Ca1H8N44.js +0 -44
  71. package/dist/assets/chevrons-up-down-DCwhEy5H.js +0 -1
  72. package/dist/assets/index-Wii4FZxb.js +0 -447
  73. package/dist/assets/mermaid-GHXKKRXX-qTTPfzhk.js +0 -1
  74. package/dist/assets/roleDescriptions-DUp1v5cq.js +0 -1
  75. package/dist/assets/x-BvlIg0Y4.js +0 -1
@@ -0,0 +1 @@
1
+ import{FN as e,MN as t,NN as n,PN as r,jN as i}from"./api--rqKQo-l.js";var a={pending:e,user:r,admin:n,observer:t,agent:i};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-Ca1H8N44.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--rqKQo-l.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 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{BE as t,FE as n,IE as r,KD as i,LE as a,RE as o,jE as s,zE as c}from"./api-Ca1H8N44.js";import{t as l}from"./button-BbEZKLza.js";import{An as u,In as d,ct as f,kt as p,m}from"./index-Wii4FZxb.js";var h=e();function g({status:e,loadMore:t}){return e!==`CanLoadMore`&&e!==`LoadingMore`?null:(0,h.jsx)(l,{variant:`outline`,size:`sm`,className:`self-start`,disabled:e===`LoadingMore`,onClick:()=>t(50),children:s()})}function _({items:e,onRestore:s,onPurge:g}){let _=f();return(0,h.jsx)(`ul`,{className:`oc-trash__list`,children:e.map(e=>(0,h.jsxs)(`li`,{className:`oc-trash__item`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__meta`,children:[(0,h.jsx)(`span`,{className:`oc-trash__title`,children:e.title||i()}),(0,h.jsxs)(`span`,{className:`oc-trash__dates`,children:[e.owner===void 0?null:(0,h.jsxs)(`span`,{className:`oc-trash__owner`,children:[e.owner,` · `]}),t({date:p(e.trashedAt)}),e.purgeAfter===null?null:` · ${c({date:m(e.purgeAfter)})}`]})]}),(0,h.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,h.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>void s(e._id),children:[(0,h.jsx)(d,{}),` `,o()]}),(0,h.jsxs)(l,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:async()=>{await _({title:r(),description:n(),confirmLabel:a(),destructive:!0})&&await g(e._id)},children:[(0,h.jsx)(u,{}),` `,a()]})]})]},e._id))})}export{g as n,_ as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{BE as t,FE as n,IE as r,KD as i,LE as a,RE as o,jE as s,zE as c}from"./api--rqKQo-l.js";import{t as l}from"./button-HksxbiUF.js";import{An as u,In as d,ct as f,kt as p,m}from"./index-l7elBM2O.js";var h=e();function g({status:e,loadMore:t}){return e!==`CanLoadMore`&&e!==`LoadingMore`?null:(0,h.jsx)(l,{variant:`outline`,size:`sm`,className:`self-start`,disabled:e===`LoadingMore`,onClick:()=>t(50),children:s()})}function _({items:e,onRestore:s,onPurge:g}){let _=f();return(0,h.jsx)(`ul`,{className:`oc-trash__list`,children:e.map(e=>(0,h.jsxs)(`li`,{className:`oc-trash__item`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__meta`,children:[(0,h.jsx)(`span`,{className:`oc-trash__title`,children:e.title||i()}),(0,h.jsxs)(`span`,{className:`oc-trash__dates`,children:[e.owner===void 0?null:(0,h.jsxs)(`span`,{className:`oc-trash__owner`,children:[e.owner,` · `]}),t({date:p(e.trashedAt)}),e.purgeAfter===null?null:` · ${c({date:m(e.purgeAfter)})}`]})]}),(0,h.jsxs)(`div`,{className:`oc-trash__actions`,children:[(0,h.jsxs)(l,{variant:`outline`,size:`sm`,onClick:()=>void s(e._id),children:[(0,h.jsx)(d,{}),` `,o()]}),(0,h.jsxs)(l,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:async()=>{await _({title:r(),description:n(),confirmLabel:a(),destructive:!0})&&await g(e._id)},children:[(0,h.jsx)(u,{}),` `,a()]})]})]},e._id))})}export{g as n,_ as t};
@@ -1 +1 @@
1
- import{a as e,l as t}from"./bundle-mjs-C73ZY4La.js";import{BX as n,IX as r,JX as i,UX as a,XX as o}from"./api-Ca1H8N44.js";var s=t(e(),1),c=(e,t,n)=>r=>{let i={...r.queries},a=r.nextPageKey,o=r.nextPageKey+1,s=r.nextPageKey+2;i[a]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,endCursor:t}}},i[o]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,cursor:t,endCursor:n}}};let c={...r.ongoingSplits};return c[e]=[a,o],{...r,nextPageKey:s,queries:i,ongoingSplits:c}},l=e=>t=>{let n=t.ongoingSplits[e];if(n===void 0)return t;let r={...t.queries};delete r[e];let i={...t.ongoingSplits};delete i[e];let a=t.pageKeys.slice(),o=t.pageKeys.findIndex(t=>t===e);return o>=0&&(a=[...t.pageKeys.slice(0,o),...n,...t.pageKeys.slice(o+1)]),{...t,queries:r,pageKeys:a,ongoingSplits:i}};function u(e,t,n){let{user:r}=p(e,t,n,!0);return r}var d=Symbol(`includePageKeys`),f=Symbol(`page`);function p(e,t,u,p=!0){if(typeof u?.initialNumItems!=`number`||u.initialNumItems<0)throw Error(`\`options.initialNumItems\` must be a positive number. Received \`${u?.initialNumItems}\`.`);let m=t===`skip`,g=m?{}:t,_=a(e),v=(0,s.useMemo)(()=>()=>{let t=h();return{query:e,args:g,id:t,nextPageKey:1,pageKeys:m?[]:[0],queries:m?{}:{0:{query:e,args:{...g,paginationOpts:{numItems:u.initialNumItems,cursor:null,id:t}}}},ongoingSplits:{},skip:m}},[JSON.stringify(o(g)),_,u.initialNumItems,m]),[y,b]=(0,s.useState)(v),x=y;(a(e)!==a(y.query)||JSON.stringify(o(g))!==JSON.stringify(o(y.args))||m!==y.skip)&&(x=v(),b(x));let S=n().logger,C=r(x.queries),w=u[d]??!1,[T,E,D]=(0,s.useMemo)(()=>{let e,t=[];for(let n of x.pageKeys){if(e=C[n],e===void 0)break;if(e instanceof Error){if(e.message.includes(`InvalidCursor`)||e instanceof i&&typeof e.data==`object`&&e.data?.isConvexSystemError===!0&&e.data?.paginationError===`InvalidCursor`)return S.warn(`usePaginatedQuery hit error, resetting pagination state: `+e.message),b(v),[[],void 0,void 0];if(p)throw e;return[t,void 0,e]}let r=x.ongoingSplits[n];if(r===void 0?e.splitCursor&&(e.pageStatus===`SplitRecommended`||e.pageStatus===`SplitRequired`||e.page.length>u.initialNumItems*2)&&b(c(n,e.splitCursor,e.continueCursor)):C[r[0]]!==void 0&&C[r[1]]!==void 0&&b(l(n)),e.pageStatus===`SplitRequired`)return[t,void 0,void 0];t.push(...w?e.page.map(e=>({...e,[f]:n.toString()})):e.page)}return[t,e,void 0]},[C,x.pageKeys,x.ongoingSplits,u.initialNumItems,v,S,w,p]);return{user:{results:T,...(0,s.useMemo)(()=>{if(D!==void 0)return{status:`Error`,isLoading:!1,error:D,loadMore:()=>{}};if(E===void 0)return x.nextPageKey===1?{status:`LoadingFirstPage`,isLoading:!0,loadMore:()=>{}}:{status:`LoadingMore`,isLoading:!0,loadMore:e=>{}};if(E.isDone)return{status:`Exhausted`,isLoading:!1,loadMore:e=>{}};let e=E.continueCursor,t=!1;return{status:`CanLoadMore`,isLoading:!1,loadMore:n=>{t||(t=!0,b(t=>{let r=[...t.pageKeys,t.nextPageKey],i={...t.queries};return i[t.nextPageKey]={query:t.query,args:{...t.args,paginationOpts:{numItems:n,cursor:e,id:t.id}}},{...t,nextPageKey:t.nextPageKey+1,pageKeys:r,queries:i}}))}}},[D,E,x.nextPageKey])},internal:{state:x}}}var m=0;function h(){return m++,m}export{u as t};
1
+ import{a as e,l as t}from"./bundle-mjs-C73ZY4La.js";import{LX as n,VX as r,WX as i,YX as a,ZX as o}from"./api--rqKQo-l.js";var s=t(e(),1),c=(e,t,n)=>r=>{let i={...r.queries},a=r.nextPageKey,o=r.nextPageKey+1,s=r.nextPageKey+2;i[a]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,endCursor:t}}},i[o]={query:r.query,args:{...r.args,paginationOpts:{...r.queries[e].args.paginationOpts,cursor:t,endCursor:n}}};let c={...r.ongoingSplits};return c[e]=[a,o],{...r,nextPageKey:s,queries:i,ongoingSplits:c}},l=e=>t=>{let n=t.ongoingSplits[e];if(n===void 0)return t;let r={...t.queries};delete r[e];let i={...t.ongoingSplits};delete i[e];let a=t.pageKeys.slice(),o=t.pageKeys.findIndex(t=>t===e);return o>=0&&(a=[...t.pageKeys.slice(0,o),...n,...t.pageKeys.slice(o+1)]),{...t,queries:r,pageKeys:a,ongoingSplits:i}};function u(e,t,n){let{user:r}=p(e,t,n,!0);return r}var d=Symbol(`includePageKeys`),f=Symbol(`page`);function p(e,t,u,p=!0){if(typeof u?.initialNumItems!=`number`||u.initialNumItems<0)throw Error(`\`options.initialNumItems\` must be a positive number. Received \`${u?.initialNumItems}\`.`);let m=t===`skip`,g=m?{}:t,_=i(e),v=(0,s.useMemo)(()=>()=>{let t=h();return{query:e,args:g,id:t,nextPageKey:1,pageKeys:m?[]:[0],queries:m?{}:{0:{query:e,args:{...g,paginationOpts:{numItems:u.initialNumItems,cursor:null,id:t}}}},ongoingSplits:{},skip:m}},[JSON.stringify(o(g)),_,u.initialNumItems,m]),[y,b]=(0,s.useState)(v),x=y;(i(e)!==i(y.query)||JSON.stringify(o(g))!==JSON.stringify(o(y.args))||m!==y.skip)&&(x=v(),b(x));let S=r().logger,C=n(x.queries),w=u[d]??!1,[T,E,D]=(0,s.useMemo)(()=>{let e,t=[];for(let n of x.pageKeys){if(e=C[n],e===void 0)break;if(e instanceof Error){if(e.message.includes(`InvalidCursor`)||e instanceof a&&typeof e.data==`object`&&e.data?.isConvexSystemError===!0&&e.data?.paginationError===`InvalidCursor`)return S.warn(`usePaginatedQuery hit error, resetting pagination state: `+e.message),b(v),[[],void 0,void 0];if(p)throw e;return[t,void 0,e]}let r=x.ongoingSplits[n];if(r===void 0?e.splitCursor&&(e.pageStatus===`SplitRecommended`||e.pageStatus===`SplitRequired`||e.page.length>u.initialNumItems*2)&&b(c(n,e.splitCursor,e.continueCursor)):C[r[0]]!==void 0&&C[r[1]]!==void 0&&b(l(n)),e.pageStatus===`SplitRequired`)return[t,void 0,void 0];t.push(...w?e.page.map(e=>({...e,[f]:n.toString()})):e.page)}return[t,e,void 0]},[C,x.pageKeys,x.ongoingSplits,u.initialNumItems,v,S,w,p]);return{user:{results:T,...(0,s.useMemo)(()=>{if(D!==void 0)return{status:`Error`,isLoading:!1,error:D,loadMore:()=>{}};if(E===void 0)return x.nextPageKey===1?{status:`LoadingFirstPage`,isLoading:!0,loadMore:()=>{}}:{status:`LoadingMore`,isLoading:!0,loadMore:e=>{}};if(E.isDone)return{status:`Exhausted`,isLoading:!1,loadMore:e=>{}};let e=E.continueCursor,t=!1;return{status:`CanLoadMore`,isLoading:!1,loadMore:n=>{t||(t=!0,b(t=>{let r=[...t.pageKeys,t.nextPageKey],i={...t.queries};return i[t.nextPageKey]={query:t.query,args:{...t.args,paginationOpts:{numItems:n,cursor:e,id:t.id}}},{...t,nextPageKey:t.nextPageKey+1,pageKeys:r,queries:i}}))}}},[D,E,x.nextPageKey])},internal:{state:x}}}var m=0;function h(){return m++,m}export{u as t};
@@ -0,0 +1 @@
1
+ import{E as e}from"./api--rqKQo-l.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-Wii4FZxb.js"></script>
65
+ <script type="module" crossorigin src="/assets/index-l7elBM2O.js"></script>
66
66
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
67
- <link rel="modulepreload" crossorigin href="/assets/api-Ca1H8N44.js">
68
- <link rel="modulepreload" crossorigin href="/assets/dist-DkeZNw3H.js">
69
- <link rel="modulepreload" crossorigin href="/assets/dist-DuDAYkx5.js">
70
- <link rel="modulepreload" crossorigin href="/assets/dist-Bfmsr8JO.js">
71
- <link rel="modulepreload" crossorigin href="/assets/dist-l5bFdBkH.js">
72
- <link rel="modulepreload" crossorigin href="/assets/x-BvlIg0Y4.js">
73
- <link rel="modulepreload" crossorigin href="/assets/button-BbEZKLza.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/api--rqKQo-l.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/dist-BDjijy9l.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/dist-e05Gnyj5.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/dist-lcVkVTM0.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/dist-DjxjpzgS.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/x-C5eyKPkE.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/button-HksxbiUF.js">
74
74
  <link rel="stylesheet" crossorigin href="/assets/index-DEccjMsV.css">
75
75
  </head>
76
76
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.101.2",
3
+ "version": "0.101.3",
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,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$_ as r,Af as i,B_ as a,Bf as o,Df as s,Ef as c,F_ as l,Ff as u,G_ as d,Gf as f,HX as p,H_ as m,Hf as h,I_ as g,If as _,J_ as v,Jv as y,K_ as b,L_ as x,Lf as S,MX as C,Mf as w,Nf as T,Of as E,PX as D,Pf as O,Q_ as k,R_ as A,Rf as j,Tf as M,UV as N,U_ as ee,Uf as P,VX as F,V_ as I,Vf as L,W_ as R,Wf as z,X_ as te,Xv as B,Y_ as V,Z_ as ne,af as re,av as H,cf as ie,cv as U,ev as W,if as ae,iv as oe,jf as se,kf as ce,ks as le,lf as ue,lv as de,nv as fe,of as pe,ov as me,q_ as he,rf as ge,rv as _e,sf as ve,sv as ye,t as G,tv as be,uv as xe,zX as K,z_ as Se,zf as Ce}from"./api-Ca1H8N44.js";import{t as q}from"./button-BbEZKLza.js";import{Bt as we,Ct as Te,Dt as Ee,Gt as De,Ht as Oe,Jt as ke,Kt as Ae,Ot as je,St as Me,Tt as Ne,Ut as Pe,Vt as Fe,Wt as Ie,Yt as J,bt as Le,ft as Re,kn as Y,nt as ze,qt as Be,vt as Ve,wt as He,xt as Ue,yt as We}from"./index-Wii4FZxb.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{a as qe}from"./compatView-BDU79WFh.js";/* empty css */var X=t(e(),1),Je=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/Je*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=p(G.me.getMe,{host:Re}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=p(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!i||i.length===0||(!a||!i.some(e=>e.name===a))&&s(i[0].name)},[t,i,a]);let c=p(G.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),l=p(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return a===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,c,i,l]),[d,f]=(0,X.useState)(null);(0,X.useEffect)(()=>{!u||u.length===0||(!d||!u.some(e=>$(e)===d))&&f($(u[0]))},[u,d]);let m=u?.find(e=>$(e)===d)??null,g=K(G.agentFiles.listAgentFiles),[_,v]=(0,X.useState)({status:`idle`}),b=m?.instanceName??null,x=m?.agentId??null,S=p(G.compat.forInstance,n&&b!==null?{instanceName:b}:`skip`),w=n&&b!==null?ze(S,`agentFiles`):null,T=w===null?!1:w===`loading`?null:w.blocked,E=(0,X.useCallback)(async()=>{if(!(b===null||x===null)){v({status:`loading`});try{v({status:`done`,files:(await g({instanceName:b,agentId:x})).files})}catch(e){v({status:`error`,dashboardAbsent:tt(e)})}}},[g,b,x]);(0,X.useEffect)(()=>{T===!1&&E()},[E,T]);let[O,A]=(0,X.useState)(null),j=p(G.agentFileCuration.listCurations,t&&b!==null&&x!==null?{instanceName:b,agentId:x}:`skip`),M=p(G.agentFileCuration.curationSettings,t&&b!==null?{instanceName:b}:`skip`),N=K(G.agentFileCuration.requestCuration),[ee,P]=(0,X.useState)(null),[F,I]=(0,X.useState)(null),{toast:R}=J(),z=(0,X.useMemo)(()=>{let e=new Map;for(let t of j??[])e.has(t.name)||e.set(t.name,t);return e},[j]),te=(0,X.useCallback)(async e=>{if(!(b===null||x===null)){P(e);try{let t=await N({instanceName:b,agentId:x,name:e,trigger:`manual`});t.ok?R({title:h(),variant:`success`}):R({title:L({reason:t.reason??`unknown`}),variant:`error`})}catch{R({title:o(),variant:`error`})}finally{P(null)}}},[N,b,x,R]),B=D(),V=(0,X.useMemo)(()=>new Intl.NumberFormat(B,{maximumFractionDigits:0}),[B]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:xe()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ve,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":de(),children:(0,Q.jsx)(Me,{})}),(0,Q.jsx)(We,{children:(i??[]).map(e=>(0,Q.jsx)(Le,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Ve,{value:d??``,onValueChange:e=>f(e),children:[(0,Q.jsx)(Ue,{size:`sm`,"aria-label":U(),children:(0,Q.jsx)(Me,{})}),(0,Q.jsx)(We,{children:u.map(e=>(0,Q.jsx)(Le,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ye()})]}),m===null?null:w===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):w!==null&&w.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(Y,{size:14,"aria-hidden":!0}),` `,qe(w.gatewayVersion,w.provider)]}):_.status===`loading`||_.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):_.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_.dashboardAbsent?le():H(),` `,!_.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void E(),children:y()})]}):_.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:_.files.map(e=>{let n=Xe(e.size),i=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)(ke,{variant:`outline`,children:oe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:_e({size:Z(e.size,B)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` 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:fe({pct:V.format(n)})}),i?(0,Q.jsx)(Y,{size:14,className:`oc-afiles__warn`,"aria-label":be()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>A(e),children:t?r():k()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Ke.includes(e.name),size:e.size??0,budget:M?.budgetChars??null,enabled:M?.enabled??!1,curation:z.get(e.name)??null,inFlight:ee===e.name,onCurate:()=>void te(e.name),onReview:e=>I(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:W({used:Z(Qe(_.files),B),total:Z(Ye,B),pct:V.format(Ze(Qe(_.files)))})})]}),O&&m?(0,Q.jsx)(at,{instanceName:m.instanceName,agentId:m.agentId,name:O.name,isAdmin:t,onClose:()=>A(null),onSaved:()=>void E()}):null,F?(0,Q.jsx)(ot,{curationId:F,onClose:()=>I(null),onApplied:()=>{I(null),E()}}):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)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:z()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ke,{variant:`outline`,className:`oc-afiles__curate-status`,children:P()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:f()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:o}){let s=K(G.agentFiles.getAgentFile),c=K(G.agentFiles.setAgentFile),u=J(),[f,p]=(0,X.useState)(null),[h,_]=(0,X.useState)(!1),[S,w]=(0,X.useState)(``),[T,E]=(0,X.useState)(!1),[O,k]=(0,X.useState)(!1),[j,M]=(0,X.useState)(!1),[P,F]=(0,X.useState)(!1),L=(0,X.useCallback)(async r=>{_(!1);try{let i=await s({instanceName:e,agentId:t,name:n});p({content:i.content,updatedAtMs:i.updatedAtMs}),r||w(i.content),M(!1)}catch{_(!0)}},[s,e,t,n]);(0,X.useEffect)(()=>{L(!1)},[L]);async function z(){if(f!==null){k(!0),F(!1);try{await c({instanceName:e,agentId:t,name:n,content:S,baseUpdatedAtMs:f.updatedAtMs??void 0}),u.success(d({name:n})),o(),await L(!1)}catch(e){nt(e)?M(!0):F(!0)}finally{k(!1)}}}let re=f!==null&&S!==f.content,H=(0,X.useMemo)(()=>f===null?null:et(f.content,S),[f,S]),ie=S.length>Je,U=D(),W=(0,X.useMemo)(()=>new Intl.NumberFormat(U),[U]);return(0,Q.jsx)(Te,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(He,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(je,{children:ne({name:n})}),(0,Q.jsxs)(Ne,{children:[te({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,V()]})]})]}),h?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void L(!1),children:y()})]}):f===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:S,readOnly:!r,spellCheck:!1,onChange:e=>w(e.target.value),"aria-label":ne({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:v()}),j?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[m(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void L(!0),children:I()})]}):null,P?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:R()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ie?` is-over`:``}`,children:he({count:W.format(S.length),max:W.format(Je)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!re||O||j,onClick:()=>E(!0),children:O?B():b()}):null]})]}),(0,Q.jsx)(we,{open:T,onOpenChange:E,children:(0,Q.jsxs)(Pe,{children:[(0,Q.jsxs)(Ae,{children:[(0,Q.jsx)(Be,{children:a({name:n})}),(0,Q.jsx)(Ie,{children:Se({agent:t})})]}),H?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:A({added:H.added,removed:H.removed})}),H.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:x()}),H.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,H.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:g()}),H.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)(Oe,{children:N()}),(0,Q.jsx)(Fe,{onClick:()=>void z(),children:l()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=p(G.agentFileCuration.getProposal,{curationId:e}),a=K(G.agentFileCuration.approveCuration),l=F(G.agentFileCuration.rejectCuration),{toast:d}=J(),[f,m]=(0,X.useState)(null),[h,g]=(0,X.useState)(!1),[v,y]=(0,X.useState)(``),b=D(),x=(0,X.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function k(){m(`approve`);try{let t=await a({curationId:e});t.ok?(d({title:Ce(),variant:`success`}),n()):d({title:t.reason===`conflict`?S():_({reason:t.reason??`unknown`}),variant:`error`})}catch{d({title:o(),variant:`error`})}finally{m(null)}}async function A(n){m(`reject`);try{let r=v.trim();(await l({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?d({title:n?ae():j(),variant:`success`}):d({title:T(),variant:`error`}),t()}catch{d({title:o(),variant:`error`})}finally{m(null)}}return(0,Q.jsx)(Te,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(He,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Ee,{children:[(0,Q.jsx)(je,{children:r?u({name:r.name}):C()}),(0,Q.jsx)(Ne,{children:O()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[w({before:Z(r.beforeSize,b),after:Z(r.proposedSize,b)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(Y,{size:13,"aria-hidden":!0}),` `,se()]}):null]}),x?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:i({added:x.added,removed:x.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ge({feedback:r.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:M()}),(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:c()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.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:r.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:ue()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:ie(),value:v,onChange:e=>y(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>g(!1),disabled:f!==null,children:ve()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void A(!1),disabled:f!==null,children:f===`reject`?B():pe()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void A(!0),disabled:f!==null,children:f===`reject`?B():re()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>g(!0),disabled:f!==null||r==null,children:E()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void k(),disabled:f!==null||r==null,children:f===`approve`?B():s()})]})]})})}export{rt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,Ak as i,As as a,Bk as o,CA as s,C_ as c,Ck as l,Dk as u,E as d,Ek as f,Fk as p,GO as m,HX as h,Ik as ee,JO as g,KO as _,Lk as te,Mk as ne,Nk as re,Ok as ie,Pk as ae,QO as v,Rk as oe,SA as se,S_ as ce,Sk as le,Su as ue,Tk as de,UO as fe,VX as pe,Vk as me,WO as y,XO as he,YO as ge,ZO as _e,_A as ve,__ as ye,_k as be,_u as xe,ak as Se,bA as Ce,b_ as we,bk as Te,ck as Ee,dk as De,ek as Oe,f_ as ke,fk as Ae,gA as je,g_ as Me,gk as Ne,gu as Pe,hA as Fe,h_ as Ie,hk as Le,hu as Re,ik as ze,jk as Be,kk as Ve,lA as He,lk as Ue,mA as We,m_ as Ge,mk as Ke,nk as qe,o_ as Je,ok as Ye,oo as Xe,pA as Ze,p_ as Qe,pk as $e,qO as et,rk as b,sk as tt,t as x,tk as nt,uA as rt,uk as it,vA as at,v_ as ot,vk as S,vu as st,w_ as ct,wk as lt,x_ as ut,xk as dt,yA as ft,y_ as C,yk as pt,yu as mt,zX as ht,zk as gt}from"./api-Ca1H8N44.js";import{r as w}from"./dist-Bfmsr8JO.js";import{t as _t}from"./chevrons-up-down-DCwhEy5H.js";import{i as vt,n as T,o as yt,r as bt,s as xt}from"./FieldLabel-BP6EBGVI.js";import{t as E}from"./button-BbEZKLza.js";import{$t as D,At as O,Ct as St,Dt as Ct,Jn as wt,Jt as k,L as Tt,Mt as Et,Ot as Dt,Pn as A,St as j,Tt as Ot,Yt as kt,ar as M,at as At,bt as N,cn as jt,dr as P,fr as Mt,ft as Nt,it as Pt,jt as F,kn as I,on as Ft,or as It,ot as Lt,sn as Rt,sr as L,st as zt,vt as R,wt as Bt,xt as z,yt as B}from"./index-Wii4FZxb.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-BrECCZpB.js";import{t as Gt}from"./FilterBar-BrdWP0oO.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-BDU79WFh.js";import{t as W}from"./dispatchErrorInfo-CoXI4U8X.js";var $t=d(`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=d(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,i]=(0,G.useState)(dn),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),l=(0,G.useMemo)(()=>vn(s),[s]),u=(0,G.useMemo)(()=>yn(s),[s]),d=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function f(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:tt()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>i(t=>({...t,q:e})),searchPlaceholder:ze(),onReset:()=>i(dn),canReset:fn(n),children:[(0,Z.jsxs)(R,{value:n.state,onValueChange:e=>i(t=>({...t,state:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:qe()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(N,{value:J,children:b()}),c.map(e=>(0,Z.jsx)(N,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(R,{value:n.instance,onValueChange:e=>i(t=>({...t,instance:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(j,{placeholder:nt()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(N,{value:J,children:b()}),l.map(e=>(0,Z.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(R,{value:n.version,onValueChange:e=>i(t=>({...t,version:e})),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(j,{placeholder:Oe()})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(N,{value:J,children:b()}),u.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:r()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:v(),sortKey:`target`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:_e(),sortKey:`state`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:he(),sortKey:`instance`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:ge(),sortKey:`host`,sort:a,onSort:f}),(0,Z.jsx)(Q,{label:g(),sortKey:`version`,sort:a,onSort:f}),(0,Z.jsx)(V,{children:et()}),(0,Z.jsx)(Q,{label:_(),sortKey:`lastOk`,sort:a,onSort:f})]})}),(0,Z.jsx)(Ut,{children:d.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(It,{size:13,"aria-hidden":!0}):(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(_t,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:Ye({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:F(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${F(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Xe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${F(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Se({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${F(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?m():e===`error`?y():fe()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(k,{variant:`secondary`,children:m()}):e===`error`?(0,Z.jsx)(k,{variant:`destructive`,children:y()}):(0,Z.jsx)(k,{variant:`outline`,children:fe()})}function wn(){return h(x.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=h(x.compat.getBridgeCompat,{}),n=h(x.me.getMe,{host:Nt})?.role===`admin`,r=h(x.admin.listInstances,n?{}:`skip`),i=h(x.agents.usageForInstances,n?{}:`skip`),a=P(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Mt({from:`/settings/bridge`}),l=P({from:`/settings/bridge`}),d=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,m=d!==null&&Xt(d,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:o}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:u()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:f()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:mt()}),(0,Z.jsx)(V,{children:st()}),(0,Z.jsx)(V,{children:xe()}),(0,Z.jsx)(V,{children:Pe()}),(0,Z.jsx)(V,{children:Re()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Tt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(k,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,s.length>0?(0,Z.jsxs)(Pt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Z.jsx)(Lt,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(zt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(At,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Je()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:ce(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ut({build:t.buildVersion??`?`})]}):null,` · `,we(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?C():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:be()});let o=tn(e.targets),s=!e.reachable,c=rn(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=O(e.checkedAt),f=e.startedAt==null?null:O(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Z.jsx)(M,{size:22}):s||c===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(I,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?Ne():c===`gateways_unreachable`?Ae({count:l.length}):s?Le():Ke({count:o.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,$e({time:d})]}),f?(0,Z.jsx)(`span`,{children:it({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:De({names:l.join(`, `)})}):null,s?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Ue()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[f,p]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(A,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(k,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ct()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":f,onClick:()=>p(e=>!e),children:[f?(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(L,{size:13,"aria-hidden":!0}),Ee({count:t.length})]}),f?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],o=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[de(),i.length>0?(0,Z.jsx)(k,{variant:`destructive`,children:l({count:i.length})}):o>0?(0,Z.jsx)(k,{variant:`destructive`,children:le()}):(0,Z.jsx)(k,{variant:`secondary`,children:lt()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[dt({version:e.vendoredVersion}),r?` · `+Te({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),o>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(w,{size:13,"aria-hidden":!0}):(0,Z.jsx)(L,{size:13,"aria-hidden":!0}),pt({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:ue({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:Me({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:C()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ke()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(k,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(St,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Bt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Ct,{children:[(0,Z.jsx)(Dt,{children:s({instance:e.displayName??e.name})}),(0,Z.jsx)(Ot,{children:se()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(M,{"aria-hidden":!0}):(0,Z.jsx)(I,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?Be():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,i()]}):null}function jn({instance:e,onClose:t}){let n=pe(x.admin.upsertInstanceConfig),r=ht(x.bridge.validateMediaPaths),i=kt(),a=Vt(e.config?.contentLocale,void 0),[s,c]=(0,G.useState)(()=>vt(e.config??{},a)),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[m,h]=(0,G.useState)(null),g=s.inboundMediaMode===`shared-fs`,_=s.mediaMode===`shared-fs`,v=g||_;async function se(){f(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(p(),e)}finally{f(!1)}}async function ce(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:bt(s,r,a)}),t()}catch(e){i.error(Fe(),e)}finally{u(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:Ce(),help:We()}),(0,Z.jsxs)(R,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(B,{children:xt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:ft(),help:Ze()}),(0,Z.jsxs)(R,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(z,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(B,{children:yt.map(e=>(0,Z.jsx)(N,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:at(),help:rt()}),(0,Z.jsx)(D,{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,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:me(),help:o()}),(0,Z.jsx)(D,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(T,{label:gt(),help:oe()}),(0,Z.jsx)(D,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>c({...s,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Et,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Z.jsx)(T,{label:ve(),help:He()})]}),v&&m!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:m.reachable?!m.inbound&&!m.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),ie({reason:m.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:re(),result:m.inbound}),(0,Z.jsx)($,{label:ne(),result:m.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ae()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(I,{"aria-hidden":!0}),Ve()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(E,{variant:`outline`,size:`sm`,onClick:()=>void se(),disabled:d,children:[d?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?ee():te()]}),(0,Z.jsx)(E,{size:`sm`,onClick:()=>void ce(),disabled:l,children:je()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(jt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?Ie():Ge({count:e.length}),(0,Z.jsx)(w,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Rt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:Qe()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(k,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A_ as r,At as i,Bp as a,Bt as o,Ct as s,D_ as c,Dt as l,E_ as u,Et as d,Ft as f,Gp as p,HX as m,Hp as h,Ht as g,It as _,Jv as v,Kp as y,Lt as ee,MX as b,M_ as x,Mt as S,N_ as te,Nt as C,O_ as ne,Ot as re,Pt as w,Rp as T,Rt as ie,St as ae,T_ as E,Tt as oe,Up as se,Ut as ce,Uv as le,VX as D,Vp as ue,Vt as de,Wp as O,Wt as k,Wv as fe,Xv as A,bt as pe,j_ as me,jt as he,k_ as ge,kt as _e,lv as j,qp as ve,t as M,wt as N,xA as P,xt as F,xu as ye,yt as be,zX as I,zp as xe,zt as Se}from"./api-Ca1H8N44.js";import{t as Ce}from"./use_paginated_query-C842MAhU.js";import{t as L}from"./button-BbEZKLza.js";import{$t as R,Mt as z,St as B,bt as V,kn as we,nt as Te,rt as Ee,tt as H,vt as U,xt as W,yt as G}from"./index-Wii4FZxb.js";import{a as De}from"./compatView-BDU79WFh.js";/* empty css */var K=t(e(),1),Oe=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function ke(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 q=[`auto`,`hybrid`,`tool`,`off`];function Ae(e){switch(e){case`auto`:return de();case`hybrid`:return o();case`tool`:return Se();default:return ie()}}function J(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function Y(e){return typeof e==`string`&&q.includes(e)}function X(e){return{injection:Y(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function Z(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function je(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?C():Me(e)?s():null:w(),i=X(e),a=t.injection!==i.injection||!Z(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),c=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:c,invalidReason:c?null:_()}}function Me(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function Ne(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function Q(e){return e.ok?null:e.code===`scope_refused`?C():e.code===`stale_default`?S():e.code===`write_unknown`||e.code===`not_confirmed`?_e():e.code===`not_applied`?re():e.code===`default_too_large`?F():e.code===`allowlist_too_large`?ae():e.code===`plugin_too_old`?s():e.code===`source_not_allowed`?N():e.code===`plugin_config_lag`?oe():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?f():he({code:e.code})}function Pe(e,t){let n=J(e),r=J(t);if(n.injection!==r.injection||!Z(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var $=n();function Fe({instanceName:e,row:t,supported:n}){let r=I(M.knowledge.setAgentKnowledgeDefault),[a,o]=(0,K.useState)(t),[s,l]=(0,K.useState)(()=>X(t)),[d,f]=(0,K.useState)(`idle`),[p,m]=(0,K.useState)(null),[h,_]=(0,K.useState)(!1),v=e=>{o(e),l(X(e)),m(null)},y=Pe(a,t);(0,K.useEffect)(()=>{h&&y&&(_(!1),v(t))},[h,y]);let b=je(a,s,n),x=b.readOnlyReason===null;async function S(){f(`saving`),m(null);try{let n=Q(await r({instanceName:e,agentId:t.agentId,injection:s.injection,sources:s.sources,expected:J(a)}));m(n),f(n===null?`done`:`idle`),n===null&&_(!0)}catch(e){m(Q({ok:!1,code:String(e?.message??`error`).slice(0,60)})),f(`idle`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsxs)(U,{value:s.injection,onValueChange:e=>{Y(e)&&l({...s,injection:e})},disabled:!x,children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":g(),children:(0,$.jsx)(B,{})}),(0,$.jsx)(G,{children:q.map(e=>(0,$.jsx)(V,{value:e,children:Ae(e)},e))})]})}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:ee()}),t.sources.map(e=>(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:x?`pointer`:`default`},title:e.description||void 0,children:[(0,$.jsx)(z,{checked:s.sources.includes(e.id),onCheckedChange:()=>l(Ne(t,s,e.id)),disabled:!x,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,$.jsx)(`span`,{children:e.label})]},e.id)),y&&!h?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[pe(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>v(t),children:be()})]}):null,t.overridesAllowed?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()}),x?(0,$.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,$.jsx)(L,{size:`sm`,disabled:!b.dirty||!b.valid||d===`saving`,onClick:()=>void S(),children:d===`saving`?A():c()})}):(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:b.readOnlyReason}),x&&b.dirty&&b.invalidReason!==null?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:b.invalidReason}):null,d===`done`&&p===null?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,p===null?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:p})]})]})}function Ie({instanceName:e}){let t=m(M.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Ce(M.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,$.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":k(),children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:k()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ce()}),t.supported?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:w()}),n.map(n=>(0,$.jsx)(Fe,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:l({shown:n.length})}),(0,$.jsx)(L,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:d()})]}):null]})}function Le({instance:e}){let t=D(M.admin.upsertInstanceConfig),n=m(M.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,K.useState)(r),[o,s]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let l=`__none__`,d=i!==r;async function f(){s(`saving`);try{let n={...e.config??{}};i===``||i===l?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let p=n?.agents??[];return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:se()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsxs)(U,{value:i===``?l:i,onValueChange:e=>a(e===l?``:e),children:[(0,$.jsx)(W,{className:`oc-cdefaults__select`,"aria-label":O(),children:(0,$.jsx)(B,{placeholder:h()})}),(0,$.jsxs)(G,{children:[(0,$.jsx)(V,{value:l,children:h()}),p.map(e=>(0,$.jsx)(V,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,$.jsx)(L,{size:`sm`,disabled:!d||o===`saving`,onClick:()=>void f(),children:o===`saving`?A():c()})]}),o===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,o===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null]})}function Re({instance:e}){let t=D(M.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,o]=(0,K.useState)(n),[s,l]=(0,K.useState)(r===null?``:String(r)),[d,f]=(0,K.useState)(`idle`);(0,K.useEffect)(()=>{o(n),l(r===null?``:String(r)),f(`idle`)},[e._id,n,r]);let m=s.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,g=!i||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,_=i!==n||(h??null)!==r;async function v(){f(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),f(`done`)}catch{f(`error`)}}return(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,$.jsx)(z,{checked:i,onCheckedChange:e=>o(e===!0),"aria-label":p()}),(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:s,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":ue(),disabled:!i}),(0,$.jsx)(L,{size:`sm`,disabled:!_||!g||d===`saving`,onClick:()=>void v(),children:d===`saving`?A():c()})]}),g?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:a()}),d===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,d===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:xe()})]})}function ze({instance:e}){let t=D(M.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,K.useState)(n===null?``:String(n)),[a,o]=(0,K.useState)(`idle`);(0,K.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,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:ve()}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,$.jsx)(R,{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,$.jsx)(L,{size:`sm`,disabled:!f||!d||a===`saving`,onClick:()=>void p(),children:a===`saving`?A():c()})]}),d?null:(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:T()}),a===`done`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:u()}):null,a===`error`?(0,$.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]})}function Be(){let e=I(M.agentFiles.getChatDefaults),[t,n]=(0,K.useState)({status:`loading`}),i=m(M.admin.listInstances,{}),[a,o]=(0,K.useState)(null);(0,K.useEffect)(()=>{!i||i.length===0||(!a||!i.some(e=>e.name===a))&&o(i[0].name)},[i,a]);let s=(i?.length??0)>1,c=i!==void 0&&i.length===0,l=m(M.compat.forInstance,a?{instanceName:a}:`skip`),u=a?Te(l,`configDefaults`):`loading`,d=u===`loading`?null:u.blocked,f=(0,K.useMemo)(()=>s&&a?{instanceName:a}:{},[s,a]),p=(0,K.useRef)(0),h=(0,K.useCallback)(async()=>{let t=++p.current;n({status:`loading`});try{let r=ke(await e(f));if(p.current!==t)return;n({status:`done`,current:r})}catch{if(p.current!==t)return;n({status:`error`})}},[e,f]);(0,K.useEffect)(()=>{d===!1&&(s&&!a||h())},[h,d,s,a]);let g=t.status===`done`?t.current:null,_=(0,K.useMemo)(()=>Oe.map(e=>({id:e,label:Ee(e)})),[]),y=(0,K.useMemo)(()=>[{id:`fast`,label:fe()},{id:`standard`,label:le()}],[]);return(0,$.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),s&&a?(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:j()}),(0,$.jsxs)(U,{value:a,onValueChange:e=>o(e),children:[(0,$.jsx)(W,{size:`sm`,"aria-label":j(),children:(0,$.jsx)(B,{})}),(0,$.jsx)(G,{children:(i??[]).map(e=>(0,$.jsx)(V,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,$.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:P()}):u===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):u.blocked?(0,$.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,$.jsx)(we,{size:14,"aria-hidden":!0}),` `,De(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):t.status===`error`?(0,$.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[ne(),` `,(0,$.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void h(),children:v()})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:x()}),(0,$.jsx)(H,{field:`thinkingLevel`,options:_,value:g?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:x()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:me()})]}),(0,$.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,$.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,$.jsx)(H,{field:`fastMode`,options:y,value:g===null||g.fastModeDefault===null?null:g.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:r()}),(0,$.jsx)(`p`,{className:`oc-cdefaults__help`,children:ge()})]}),(0,$.jsx)(`p`,{className:`oc-cdefaults__note`,children:ye()})]}),(()=>{let e=i?.find(e=>e.name===(a??i[0]?.name));return e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(ze,{instance:e}),(0,$.jsx)(Re,{instance:e}),(0,$.jsx)(Le,{instance:e}),(0,$.jsx)(Ie,{instanceName:e.name})]}):null})()]})}export{Be as ChatDefaultsTab};
@@ -1 +0,0 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{HE as t,ME as n,NE as r,PE as i,VE as a,VX as o,mj as s,t as c}from"./api-Ca1H8N44.js";import{t as l}from"./use_paginated_query-C842MAhU.js";import{t as u}from"./button-BbEZKLza.js";import{ct as d,h as f}from"./index-Wii4FZxb.js";import{n as p,t as m}from"./trashPage-svjv-CK6.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(c.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=o(c.trash.restoreChat),b=o(c.trash.purgeChat),x=o(c.trash.emptyTrash),S=d();return(0,h.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:t({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:r(),description:n(),confirmLabel:i(),destructive:!0})&&await x({})},children:i()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:s()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:a()}):(0,h.jsx)(m,{items:e,onRestore:e=>y({chatId:e}),onPurge:e=>b({chatId:e})}),(0,h.jsx)(p,{status:g,loadMore:_})]})}export{g as DeletedChatsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$Y as r,AY as ee,BY as i,CY as a,DY as o,EY as s,FY as te,GY as ne,HX as re,HY as c,IY as l,JY as u,KY as d,LY as f,MX as p,MY as ie,NY as ae,OY as oe,PX as se,PY as ce,QY as le,RY as m,SY as ue,TY as de,UV as fe,UY as pe,VX as me,VY as h,WY as he,XY as g,YY as _,ZY as ge,bY as _e,ep as ve,jY as ye,kY as be,qY as xe,t as v,tp as y,vY as b,wY as x,xY as S,yY as C,zY as w}from"./api-Ca1H8N44.js";import{t as T}from"./button-BbEZKLza.js";import{An as E,Bt as D,Gt as O,Ht as k,In as A,Jt as j,Kt as M,Mt as Se,St as N,Ut as Ce,Vt as we,Wt as Te,Yt as Ee,an as De,bt as P,en as Oe,nn as F,nr as I,qt as ke,tn as Ae,tr as je,vt as L,xt as R,yt as z}from"./index-Wii4FZxb.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-BrECCZpB.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return c();case`audio`:return h();case`video`:return i();case`pdf`:return w();case`document`:return m();case`archive`:return f();default:return l()}}function q(){let[e,t]=(0,U.useState)(G),[n,i]=(0,U.useState)(G),[c,l]=(0,U.useState)(G),[f,m]=(0,U.useState)(G),[h,w]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=me(v.files.softDelete),Y=Ee();function Ie(){t(G),i(G),l(G),m(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(de())}catch(e){Y.error(x(),e)}}let X=re(v.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:c===G?void 0:c,category:f===G?void 0:f,includeAutoGenerated:h||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(se(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:p()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||c!==G||f!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:r()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":le(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:ge()}),(0,W.jsx)(P,{value:`inbound`,children:g()}),(0,W.jsx)(P,{value:`outbound`,children:_()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:i,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":u(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:xe()}),Q.chats.map(e=>(0,W.jsx)(P,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:c,onValueChange:l,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":d(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:ne()}),Q.instances.map(e=>(0,W.jsx)(P,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:f,onValueChange:m,children:[(0,W.jsx)(R,{size:`sm`,"aria-label":he(),children:(0,W.jsx)(N,{})}),(0,W.jsxs)(z,{children:[(0,W.jsx)(P,{value:G,children:pe()}),Q.categories.map(e=>(0,W.jsx)(P,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(Se,{checked:h,onCheckedChange:e=>w(e===!0),"aria-label":y()}),(0,W.jsx)(`span`,{children:y()})]}),$?(0,W.jsxs)(T,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(A,{size:14,"aria-hidden":!0}),oe()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?C():_e()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:te()}),(0,W.jsx)(B,{children:ce()}),(0,W.jsx)(B,{children:ae()}),(0,W.jsx)(B,{children:ie()}),(0,W.jsx)(B,{children:ye()}),(0,W.jsx)(B,{className:`text-right`,children:ee()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(j,{variant:`outline`,style:{marginLeft:6},children:ve()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(j,{variant:`secondary`,children:e.direction===`inbound`?g():_()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(Oe,{children:[(0,W.jsx)(De,{asChild:!0,children:(0,W.jsx)(T,{variant:`ghost`,size:`icon`,"aria-label":o(),children:(0,W.jsx)(je,{size:16})})}),(0,W.jsxs)(Ae,{align:`end`,children:[e.url?(0,W.jsx)(F,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(I,{size:14}),be()]})}):(0,W.jsxs)(F,{disabled:!0,children:[(0,W.jsx)(I,{size:14}),S()]}),(0,W.jsxs)(F,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(E,{size:14}),s()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:b({cap:Be})}):null]}),(0,W.jsx)(D,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ce,{children:[(0,W.jsxs)(M,{children:[(0,W.jsx)(ke,{children:a()}),(0,W.jsx)(Te,{children:ue()})]}),(0,W.jsxs)(O,{children:[(0,W.jsx)(k,{children:fe()}),(0,W.jsx)(we,{onClick:()=>void Le(),children:s()})]})]})})]})}export{q as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$F as i,$P as a,AF as o,AP as s,An as c,Ao as l,BF as u,BP as d,CF as f,CI as p,Co as m,DF as h,Dn as g,Do as _,EF as v,En as y,Eo as b,Eu as ee,FF as x,FP as S,Fn as te,Fo as C,GF as w,GP as T,HF as E,HP as D,HX as O,IF as k,IP as A,J as ne,JF as re,JP as ie,K as ae,KF as oe,KP as se,LF as ce,LP as le,LU as ue,MF as de,MP as j,Mn as fe,Mo as pe,NF as me,NP as he,Nn as ge,No as _e,OF as ve,OP as ye,On as be,Oo as xe,PF as Se,PP as Ce,Pn as we,Po as Te,Q as Ee,QF as De,QP as Oe,RF as ke,RP as Ae,RU as je,SF as Me,SI as Ne,So as Pe,TF as Fe,To as Ie,Tu as Le,UF as Re,UP as ze,VF as Be,VP as Ve,VX as M,WF as He,WP as Ue,X as We,XF as Ge,XP as Ke,Y as qe,YF as Je,YP as Ye,Z as Xe,ZF as Ze,ZP as Qe,_F as $e,_I as et,aF as tt,aI as nt,bF as rt,bI as it,bo as at,cF as ot,cI as st,cm as ct,cy as lt,dA as ut,dF as dt,dI as ft,dm as pt,eF as mt,eI as ht,et as gt,fA as _t,fF as vt,fI as yt,gF as bt,gI as xt,hF as St,hI as Ct,iF as N,iI as wt,jF as Tt,jP as Et,jn as Dt,jo as Ot,kF as kt,kP as At,kn as jt,ko as Mt,lF as P,lI as Nt,lm as Pt,ly as Ft,mF as It,mI as Lt,nF as Rt,nI as zt,oF as Bt,oI as Vt,pF as Ht,pI as Ut,q as Wt,qF as Gt,qP as Kt,rI as qt,sF as Jt,sI as Yt,t as F,tF as Xt,tI as Zt,uF as Qt,uI as $t,um as en,uy as tn,vF as nn,vI as rn,wF as an,wo as on,wu as sn,xF as cn,xI as ln,xo as un,yF as dn,yI as fn,yo as pn,zF as mn,zP as hn,zX as I}from"./api-Ca1H8N44.js";import{a as gn,c as _n}from"./FieldLabel-BP6EBGVI.js";import{t as L}from"./button-BbEZKLza.js";import{$t as R,Ct as vn,Dt as z,J as yn,Jt as B,Mt as V,Ot as H,St as U,Tt as bn,Yt as W,b as xn,bt as G,cn as Sn,ct as Cn,on as wn,sn as Tn,vt as K,wt as En,xt as q,yt as J}from"./index-Wii4FZxb.js";import{t as Dn}from"./DataTableShell-BUYroEsA.js";import{InstanceConfigDialog as On}from"./BridgeTab-BJEkCzek.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],kn=new Set(X),An=`conversational`;function jn(e){let t=new Set((e??[]).filter(e=>kn.has(e)));return t.size===0?[An]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:gn,widgetsEnabled:!0,widgetPromptConfirm:!1},Mn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Nn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Pn(){let e=O(F.admin.listInstances,{}),t=O(F.agents.listAllInstanceAgents,{}),n=M(F.admin.upsertInstance),a=M(F.widgets.setInstanceWidgets),o=M(F.admin.deleteInstance),s=W(),[u,d]=(0,Y.useState)(!1),[f,h]=(0,Y.useState)(Q),[v,x]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(null),[E,D]=(0,Y.useState)(null),[k,A]=(0,Y.useState)(null);async function ie(){try{let t=await n({instanceId:k??void 0,name:f.name,gatewayUrl:f.gatewayUrl,bridgeUrl:f.bridgeUrl||void 0,displayName:f.displayName||void 0,kind:f.kind,transport:f.kind===`hermes`?f.transport:void 0,gatewayVersion:f.gatewayVersion||void 0,gatewayHttpUrl:f.gatewayHttpUrl||void 0,...f.kind===`openclaw`?{authMode:f.authMode,personScopes:f.personScopes,identitySource:f.identitySource,participantIdentity:f.participantIdentity,managePermissionModes:f.managePermissionModes,systemIdentity:f.systemIdentity||void 0}:{},streamTransport:f.streamTransport}),r=k===null?null:e?.find(e=>e._id===k),i=r?.config?.widgetsEnabled!==!1,o=r?.config?.widgetPromptConfirm===!0;f.kind===`openclaw`&&(f.widgetsEnabled!==i||f.widgetPromptConfirm!==o)&&await a({instanceId:t,enabled:f.widgetsEnabled,promptConfirm:f.widgetPromptConfirm}),h(Q),A(null),d(!1)}catch(e){s.error(ln(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[it(),(0,Z.jsx)(`strong`,{children:fn()}),rn()]}),(0,Z.jsx)(Dn,{title:et(),rows:e,addLabel:xt(),onAdd:()=>{A(null),h(Q),d(!0)},emptyHint:Ct(),columns:[{header:Lt(),cell:e=>e.name,sort:e=>e.name},{header:Ut(),cell:e=>(0,Z.jsx)(B,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:yt(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:ft(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:p(),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)(B,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?S():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Yt(),onSelect:()=>{A(e._id),h(Nn(e)),d(!0)}},{label:Ne(),onSelect:()=>x(e.name)},{label:oe(),onSelect:()=>D(e)},{label:$t(),onSelect:()=>T(e)},{label:Nt(),variant:`destructive`,onSelect:()=>void o({instanceId:e._id})}],bulkActions:[{label:Nt(),variant:`destructive`,onSelect:e=>e.forEach(e=>void o({instanceId:e}))}]}),(0,Z.jsx)(xn,{open:u,onOpenChange:d,title:k?Vt():st(),description:wt(),canSubmit:!!(f.name&&f.gatewayUrl),onSubmit:ie,submitLabel:qt(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:zt(),children:[(0,Z.jsx)(R,{value:f.name,disabled:k!==null,onChange:e=>h({...f,name:e.target.value})}),k?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:nt()}):null]}),(0,Z.jsx)($,{label:Zt(),children:(0,Z.jsxs)(K,{value:f.kind,onValueChange:e=>h({...f,kind:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(G,{value:`hermes`,children:`Hermes`})]})]})}),f.kind===`hermes`?(0,Z.jsx)($,{label:ee(),children:(0,Z.jsxs)(K,{value:f.transport,onValueChange:e=>h({...f,transport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`ws`,children:Le()}),(0,Z.jsx)(G,{value:`rest`,children:sn()})]})]})}):null,(0,Z.jsx)($,{label:ht(),children:(0,Z.jsx)(R,{value:f.gatewayUrl,onChange:e=>h({...f,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:i(),children:(0,Z.jsx)(R,{value:f.bridgeUrl,placeholder:De(),onChange:e=>h({...f,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:Ze(),children:(0,Z.jsx)(R,{value:f.displayName,onChange:e=>h({...f,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:_t(),children:[(0,Z.jsxs)(K,{value:f.streamTransport,onValueChange:e=>h({...f,streamTransport:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsx)(J,{children:_n.map(e=>(0,Z.jsx)(G,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:ut()})]}),(0,Z.jsx)($,{label:Ge(),children:(0,Z.jsx)(R,{value:f.gatewayVersion,placeholder:Je(),onChange:e=>h({...f,gatewayVersion:e.target.value})})}),f.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:Ie(),children:[(0,Z.jsxs)(K,{value:f.authMode,onValueChange:e=>h({...f,authMode:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`token`,children:on()}),(0,Z.jsx)(G,{value:`trusted-proxy`,children:m()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.authMode===`trusted-proxy`?un():Pe()})]}),f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:C(),children:[(0,Z.jsxs)(K,{value:f.personScopes,onValueChange:e=>h({...f,personScopes:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`capped`,children:Te()}),(0,Z.jsx)(G,{value:`full`,children:_e()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.personScopes===`full`?Ot():pe()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:l(),children:[(0,Z.jsxs)(K,{value:f.identitySource,onValueChange:e=>h({...f,identitySource:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`canonical`,children:Mt()}),(0,Z.jsx)(G,{value:`email`,children:xe()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.identitySource===`email`?b():_()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:te(),children:[(0,Z.jsxs)(K,{value:f.participantIdentity,onValueChange:e=>h({...f,participantIdentity:e}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`owner`,children:we()}),(0,Z.jsx)(G,{value:`self`,children:ge()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.participantIdentity===`self`?y():fe()})]}):null,f.kind===`openclaw`?(0,Z.jsxs)($,{label:Dt(),children:[(0,Z.jsxs)(K,{value:f.managePermissionModes?`on`:`off`,onValueChange:e=>h({...f,managePermissionModes:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:c()}),(0,Z.jsx)(G,{value:`on`,children:jt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.managePermissionModes?g():be()})]}):null,f.kind===`openclaw`?(0,Z.jsxs)($,{label:gt(),children:[(0,Z.jsxs)(K,{value:f.widgetsEnabled?`on`:`off`,onValueChange:e=>h({...f,widgetsEnabled:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`on`,children:r()}),(0,Z.jsx)(G,{value:`off`,children:Ee()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:f.widgetsEnabled?Xe():We()})]}):null,f.kind===`openclaw`&&f.widgetsEnabled?(0,Z.jsxs)($,{label:qe(),children:[(0,Z.jsxs)(K,{value:f.widgetPromptConfirm?`on`:`off`,onValueChange:e=>h({...f,widgetPromptConfirm:e===`on`}),children:[(0,Z.jsx)(q,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(U,{})}),(0,Z.jsxs)(J,{children:[(0,Z.jsx)(G,{value:`off`,children:ne()}),(0,Z.jsx)(G,{value:`on`,children:Wt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:ae()})]}):null,f.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:at(),children:(0,Z.jsx)(R,{value:f.systemIdentity,placeholder:pn(),onChange:e=>h({...f,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:re(),children:(0,Z.jsx)(R,{value:f.gatewayHttpUrl,placeholder:Gt(),onChange:e=>h({...f,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Wn,{instanceName:v,open:v!==null,onOpenChange:e=>{e||x(null)}}),w?(0,Z.jsx)(On,{instance:w,onClose:()=>T(null)},w._id):null,E?(0,Z.jsx)(Fn,{instance:E,onClose:()=>D(null)},E._id):null]})}function Fn({instance:e,onClose:t}){let n=O(F.instanceSecrets.listInstanceSecretStatus,{}),r=Mn[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(vn,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(En,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(z,{children:[(0,Z.jsx)(H,{children:w({instance:e.displayName??e.name})}),(0,Z.jsx)(bn,{children:He()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Rn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ln,{instance:e})}),(0,Z.jsx)(In,{instance:e})]})})}function In({instance:e}){let t=I(F.instanceSync.forceInstanceSync),n=W(),[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(an());break;case`no_agents`:n.success(Me());break;case`no_bridge_url`:n.error(cn());break;case`deploy_misconfigured`:n.error(rt());break;case`unauthorized`:n.error(nn());break;case`not_served`:n.error($e());break;default:n.error(dn());break}}catch(e){n.error(f(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:bt()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?Fe():v()})})]})}function Ln({instance:e}){let t=O(F.bridgeAuth.listBridgeAuthStatus,{}),n=I(F.bridgeAuth.mintBridgeSecret),r=M(F.bridgeAuth.revokeBridgeSecret),i=W(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(P(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(Qt())}catch(e){i.error(P(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:St(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:It()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:p?`outline`:`secondary`,children:p?`${u()} · ${f.prefix}…${f.lastFour}`:mn()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?vt():Ht()}),p?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:dt()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:ot()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:l?je():ue()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),d(!1)},children:Jt()})]}):null]})}function Rn({instanceId:e,field:t,updatedAt:n}){let r=I(F.instanceSecrets.setInstanceSecret),i=M(F.instanceSecrets.clearInstanceSecret),a=I(F.deviceIdentity.generateDeviceIdentity),s=W(),[c,l]=(0,Y.useState)(``),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(!1),v=n!==null,y=t===`deviceIdentity`,b=t===`token`?Re():t===`deviceIdentity`?E():Be();async function ee(){if(!(!c.trim()||d)){f(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),m(null),_(!1),s.success(Se())}catch(e){s.error(me(),e)}finally{f(!1)}}}async function S(){if(!d){f(!0);try{await i({instanceId:e,field:t}),m(null),_(!1),s.success(de())}catch(e){s.error(me(),e)}finally{f(!1)}}}async function te(){if(!d){f(!0);try{m(await a({instanceId:e})),_(!1),s.success(kt())}catch(e){s.error(h(),e)}finally{f(!1)}}}let C=p?`openclaw devices approve ${p.id}`:``;async function w(){if(C)try{await navigator.clipboard.writeText(C),_(!0)}catch{}}return(0,Z.jsxs)($,{label:b,children:[y?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(B,{variant:v?`outline`:`secondary`,children:v?u():mn()}),(0,Z.jsx)(R,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:v?ce():ke(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(L,{size:`sm`,onClick:()=>void ee(),disabled:d||c.trim().length===0,children:k()}),y?(0,Z.jsx)(L,{size:`sm`,variant:`outline`,onClick:()=>void te(),disabled:d,children:Tt()}):null,v?(0,Z.jsx)(L,{size:`sm`,variant:`destructive`,onClick:()=>void S(),disabled:d,children:x()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:kt()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ve()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:C}),(0,Z.jsx)(L,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:g?je():ue()})]}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),_(!1)},children:Jt()})]}):null]})}var zn={conversational:Ke,documentary:ie,summarizer:pt,curator:Pt},Bn={conversational:Ye,documentary:Kt,summarizer:en,curator:ct},Vn=e=>(zn[e]??(()=>e))(),Hn=e=>(Bn[e]??(()=>``))();function Un({agentId:e,types:t,onToggle:n}){return(0,Z.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,Z.jsx)(`span`,{className:`oc-agentcard__types-label`,children:mt()}),t.map(e=>(0,Z.jsx)(B,{variant:`secondary`,className:`oc-agenttype__chip`,title:Hn(e),children:Vn(e)},e)),(0,Z.jsxs)(wn,{children:[(0,Z.jsx)(Sn,{asChild:!0,children:(0,Z.jsx)(L,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:a()})}),(0,Z.jsxs)(Tn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:Oe()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Qe()}),(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)(V,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Vn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Hn(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=O(F.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=M(F.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=M(F.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=M(F.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=jn(r);e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),c=M(F.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(F.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(F.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),l=M(F.agents.removeInstanceAgent),u=M(F.agents.setAgentReservation),f=O(F.groups.listGroupLabels,t?{}:`skip`),p=Cn(),m=W();async function h(t,n){if(e&&await p({title:Et({name:n}),description:s(),confirmLabel:j()}))try{await u({instanceName:e,agentId:t,groupId:null})}catch(e){m.error(N(),yn(e))}}async function g(t,n,r){if(!e)return;let i=(f??[]).find(e=>e._id===r)?.name??`?`;if(await p({title:tn({name:n,group:i}),description:Ft({group:i}),confirmLabel:lt()}))try{await u({instanceName:e,agentId:t,groupId:r})}catch(e){m.error(N(),yn(e))}}async function _(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){m.error(N(),e)}}async function v(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){m.error(N(),e)}}async function y(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){m.error(N(),e)}}async function b(t,n){if(e&&await p({title:Ue({name:n}),description:ze(),confirmLabel:D(),destructive:!0}))try{await l({instanceName:e,agentId:t}),m.success(Ve())}catch(e){m.error(N(),e)}}return(0,Z.jsx)(vn,{open:t,onOpenChange:n,children:(0,Z.jsxs)(En,{className:`oc-access`,children:[(0,Z.jsxs)(z,{children:[(0,Z.jsx)(H,{children:Bt({name:e??``})}),(0,Z.jsx)(bn,{children:tt()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:d()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?hn():r.discovery.lastPollOk?Ae():le({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:A()}):(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)(V,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void _(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,t.reserved?(0,Z.jsx)(B,{variant:`outline`,children:t.reserved.groupName===null?he():Ce({group:t.reserved.groupName})}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(B,{variant:`outline`,className:`oc-access__gone`,children:ye()}),(0,Z.jsx)(L,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void b(t.agentId,a),children:T()})]}):i?(0,Z.jsx)(B,{variant:`default`,children:S()}):(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void v(t.agentId),children:se()})]}),t.reserved?(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(L,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void h(t.agentId,a),children:j()}),(0,Z.jsxs)(K,{value:``,onValueChange:e=>void g(t.agentId,a,e),children:[(0,Z.jsx)(q,{size:`sm`,className:`h-7`,children:(0,Z.jsx)(U,{placeholder:At()})}),(0,Z.jsx)(J,{children:(f??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,Z.jsx)(G,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,Z.jsx)(Un,{agentId:t.agentId,types:o,onToggle:e=>void y(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await c({instanceName:e,agentId:t.agentId,description:n})}catch(e){m.error(N(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(R,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Rt(),"aria-label":Xt(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Pn as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ah as r,Dh as i,Eh as a,HX as o,Mh as s,Oh as c,Th as l,VX as u,aR as d,cR as f,dR as p,fR as m,iR as h,jh as g,kh as _,lR as v,mR as y,nR as b,oR as x,pR as S,rR as C,sR as w,t as T,tR as E,uR as D,wh as O,zX as k}from"./api-Ca1H8N44.js";import{t as A}from"./button-BbEZKLza.js";import{$t as j,Jt as M,Mt as N}from"./index-Wii4FZxb.js";var P=t(e(),1),F=n();function I(){let e=o(T.integrations.status.status,{}),t=u(T.admin.setIntegrationConfig),[n,i]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&i(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:y()});let a=n,c=(e,t,n)=>i({...a,[e]:{...a[e],[t]:n}}),l=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,F.jsx)(`strong`,{children:m()}),` `,p()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(M,{variant:`secondary`,children:D()}):(0,F.jsx)(M,{variant:`outline`,children:v()}):(0,F.jsx)(M,{variant:`outline`,children:f()}),note:w(),children:[(0,F.jsx)(R,{label:d(),children:(0,F.jsx)(j,{value:a.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>c(`langfuse`,`host`,e.target.value),onBlur:()=>l(`langfuse`,{host:a.langfuse.host??``})})}),(0,F.jsx)(z,{label:E(),checked:a.langfuse.enabled??!0,onChange:e=>{c(`langfuse`,`enabled`,e),l(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(M,{variant:`secondary`,children:D()}):(0,F.jsx)(M,{variant:`outline`,children:v()}):(0,F.jsx)(M,{variant:`outline`,children:f()}),note:x(),children:[(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(j,{value:a.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>c(`opik`,`baseUrl`,e.target.value),onBlur:()=>l(`opik`,{baseUrl:a.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:C(),children:(0,F.jsx)(j,{value:a.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||b(),onChange:e=>c(`opik`,`workspace`,e.target.value),onBlur:()=>l(`opik`,{workspace:a.opik.workspace??``})})}),(0,F.jsx)(z,{label:E(),checked:a.opik.enabled??!0,onChange:e=>{c(`opik`,`enabled`,e),l(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(M,{variant:`secondary`,children:D()}):(0,F.jsx)(M,{variant:`outline`,children:v()}):(0,F.jsx)(M,{variant:`outline`,children:s()}),note:g(),children:[(0,F.jsx)(R,{label:r(),children:(0,F.jsx)(j,{value:a.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>c(`otlp`,`endpoint`,e.target.value),onBlur:()=>l(`otlp`,{endpoint:a.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:E(),checked:a.otlp.enabled??!0,onChange:e=>{c(`otlp`,`enabled`,e),l(`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=k(T.integrations.otlpSecret.setOtlpHeaders),n=u(T.integrations.otlpSecret.clearOtlpHeaders),[r,o]=(0,P.useState)(``),[s,d]=(0,P.useState)(null),[f,p]=(0,P.useState)(!1),m=async()=>{p(!0),d(null);try{await t({headersJson:r}),o(``)}catch(e){d(e instanceof Error?e.message:String(e))}finally{p(!1)}};return(0,F.jsxs)(R,{label:_(),children:[(0,F.jsx)(j,{value:r,placeholder:e?c():i(),onChange:e=>o(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:f||r.trim().length===0,onClick:()=>void m(),children:a()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:f,onClick:()=>void n({}),children:l()}):null]}),s?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:s}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:O()})]})}export{I as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$W as r,AG as i,Bc as a,CG as o,CX as s,Cc as c,DG as l,DX as ee,EG as u,Ec as d,FG as f,HX as p,MG as m,MX as te,NG as h,OG as ne,PG as re,Pc as ie,QW as ae,SG as oe,SX as se,Sc as ce,TG as le,Tc as ue,VX as g,XW as de,ZW as fe,_G as pe,_X as me,aG as _,aX as he,bG as ge,bX as v,bc as y,cG as b,cX as x,dG as S,dX as C,eG as w,fG as T,fX as E,gG as D,gX as O,hG as k,hX as A,iG as j,iX as M,jG as N,kG as P,lG as F,lX as I,mG as L,mX as _e,nG as ve,nX as ye,oG as be,oX as xe,pG as Se,pX as Ce,r as R,rG as z,rI as we,rX as Te,sG as Ee,sX as De,t as B,tG as Oe,tX as ke,uG as Ae,uX as je,vG as Me,vX as Ne,wG as Pe,wX as Fe,wc as Ie,xG as Le,xX as Re,xc as ze,yG as Be,yX as Ve,yc as He,zc as Ue}from"./api-Ca1H8N44.js";import{t as V}from"./button-BbEZKLza.js";import{$t as H,H as We,Jt as U,Mt as W,Qt as Ge,St as Ke,Xt as qe,Yt as Je,Zt as Ye,bt as G,ft as K,t as Xe,vt as Ze,xt as Qe,yt as $e}from"./index-Wii4FZxb.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-Djj8VaFK.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>f()},{id:`composer`,label:()=>re()},{id:`sidebar`,label:()=>h()},{id:`notifications`,label:()=>D()},{id:`other`,label:()=>m()}],X={showSource:{category:`messages`,label:()=>N(),help:()=>i()},showReport:{category:`messages`,label:()=>P(),help:()=>ne()},copyAssistant:{category:`messages`,label:()=>l()},copyUser:{category:`messages`,label:()=>u()},showDelete:{category:`messages`,label:()=>le()},showTools:{category:`messages`,label:()=>Pe(),help:()=>o()},voiceInput:{category:`composer`,label:()=>oe(),help:()=>Le()},showUsage:{category:`composer`,label:()=>ge(),help:()=>Be()},autoReadAloud:{category:`composer`,label:()=>a(),help:()=>Ue()},showChatAge:{category:`sidebar`,label:()=>Me(),help:()=>pe()},notifSound:{category:`notifications`,label:()=>k(),help:()=>L()},notifSystem:{category:`notifications`,label:()=>Se(),help:()=>T()},replySound:{category:`notifications`,label:()=>S(),help:()=>Ae()}};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:()=>w()};function ut({prefKey:e,ui:t}){let n=g(B.admin.setUiPrefDefault),r=g(B.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:j()}),(0,J.jsxs)(Ze,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(Qe,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ke,{})}),(0,J.jsxs)($e,{children:[(0,J.jsx)(G,{value:`on`,children:ae()}),(0,J.jsx)(G,{value:`off`,children:fe()}),(0,J.jsx)(G,{value:`inherit`,children:de()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(W,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":z()}),z()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=g(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=Ye(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:[d(),e?(0,J.jsx)(U,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?c():r?Ie():ue()})]}),(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:He()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?y():e?ze():ce()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,i]=(0,q.useState)(!1),a=p(B.me.getMe,{host:K}),o=a?.ui,s=$(a?.role)&&n,c=g(B.me.setUiPref).withOptimisticUpdate(We),l=(0,q.useMemo)(()=>o?Q(Object.keys(o.effective),e):[],[o,e]);return o?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(a?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(W,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":_()}),_()]}):null,s?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:ve()}),(0,J.jsx)(`p`,{children:Oe()}),(0,J.jsx)(`p`,{children:r()})]}):null,(0,J.jsx)(H,{value:e,onChange:e=>t(e.target.value),placeholder:F(),"aria-label":F(),className:`mb-2`}),l.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:b()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:l.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],l=o.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)(U,{variant:`outline`,children:Ee()}):l?(0,J.jsx)(U,{variant:`secondary`,children:ie()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void c({key:e,value:null}),children:be()}):null,(0,J.jsx)(nt,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),c({key:e,value:t})},"aria-label":n})]}),s?(0,J.jsx)(ut,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:a?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:te()})}var pt={sm:()=>E(),md:()=>C(),lg:()=>je(),xl:()=>I(),"2xl":()=>x(),"3xl":()=>De()};function mt(){let e=p(B.me.getMe,{host:K}),t=g(B.me.setLocale),n=g(B.me.setTimezone),r=g(B.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(B.me.getMe,{host:K});n&&e.setQuery(B.me.getMe,{host:K},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=g(B.me.setMyName),a=Je(),o=e?.locale??`default`,c=e?.name??``,[l,u]=(0,q.useState)(null),d=l??c,f=d.trim()!==c.trim();async function m(){try{await i({name:d}),u(null),a.success(v())}catch(e){a.error(Ve(),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:Fe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:s()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(H,{className:`max-w-xs`,value:d,maxLength:120,placeholder:se(),onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&f&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!f,onClick:()=>void m(),children:we()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(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:Ne()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:me()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(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:ee()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:O()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:xe()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:he()})]}),(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:M()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Te()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:A()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:_e()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:Xe.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:Ce()})]}),(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:ye()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ke()})]}),(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{AD as r,CD as i,DD as a,E as o,GD as s,GE as c,HD as l,HX as u,ID as d,JE as f,KD as p,KE as m,Ko as h,LD as g,MX as _,ND as ee,OD as te,QD as ne,QE as v,SD as y,TD as re,UD as ie,UE as b,VX as x,WE as S,XD as ae,XE as C,YE as w,ZD as oe,_D as se,aD as ce,bD as le,dD as T,eD as ue,fD as de,gD as fe,hD as pe,iD as me,jD as E,kD as he,lD as ge,lE as D,mD as _e,oD as ve,pD as ye,qE as O,qo as be,sD as k,t as A,uD as j,vD as M,wD as N,xD as xe,yD as Se,zC as Ce,zD as P}from"./api-Ca1H8N44.js";import{r as we}from"./dist-Bfmsr8JO.js";import{t as Te}from"./list-Bhy47ogH.js";import{t as F}from"./button-BbEZKLza.js";import{$n as Ee,$t as De,A as Oe,An as ke,Bn as Ae,C as I,D as je,E as Me,Gn as Ne,I as Pe,Kn as Fe,M as Ie,N as Le,O as Re,P as L,Qn as ze,S as Be,T as Ve,Un as R,Vn as He,Xn as z,Yt as Ue,Zn as We,_ as Ge,_t as Ke,an as qe,b as Je,ct as Ye,d as Xe,dr as B,en as Ze,er as Qe,f as $e,fr as et,g as tt,gt as V,h as nt,ht as H,in as rt,j as U,k as it,lt as at,mt as ot,nn as W,p as st,pr as G,pt as ct,rn as lt,sr as ut,tn as dt,tr as ft,v as K,w as q,x as J,y as pt,zn as mt}from"./index-Wii4FZxb.js";var ht=o(`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`}]]),gt=o(`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`}]]),_t=o(`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=o(`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 vt({className:e}){return(0,Z.jsx)(qe,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-xs`,"aria-label":C(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(ft,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:a}){let o=x(A.projects.renameProject),s=x(A.projects.setProjectColor),f=x(A.projects.moveProject),p=x(A.projects.deleteProject),h=x(A.projects.createProject),_=Ye(),te=nt(),y=at(),[re,ie]=(0,X.useState)(!1),[b,S]=(0,X.useState)(t),[C,se]=(0,X.useState)(!1),[ce,le]=(0,X.useState)(!1),T=u(A.projects.projectTreeCount,ce?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ze,{onOpenChange:e=>e&&le(!0),children:[(0,Z.jsx)(vt,{className:i}),(0,Z.jsxs)(dt,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(W,{onSelect:()=>a(),children:[(0,Z.jsx)(ze,{}),` `,ee()]}),(0,Z.jsxs)(W,{onSelect:()=>{S(t),ie(!0)},children:[(0,Z.jsx)(He,{}),` `,w()]}),(0,Z.jsxs)(W,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await y({title:N(),label:ne(),placeholder:oe(),confirmLabel:ae()});t&&await h({name:t,parentId:e})})},children:[(0,Z.jsx)(We,{}),` `,N()]}),(0,Z.jsxs)(W,{onSelect:()=>se(!0),children:[(0,Z.jsx)(gt,{}),` `,ve()]}),(0,Z.jsx)(lt,{children:m()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void s({projectId:e,color:null}),"aria-label":c(),children:`✕`}),Ge.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 s({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(rt,{}),(0,Z.jsxs)(W,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=T?.folders??0,r=T?.chats??0;await _({title:d({name:t}),description:st({folders:n,chats:r,days:te}),confirmWord:v(),confirmLabel:g(),destructive:!0})&&await p({projectId:e})})},children:[(0,Z.jsx)(ke,{}),` `,v()]})]})]}),(0,Z.jsx)(Je,{open:re,onOpenChange:ie,title:l(),canSubmit:b.trim().length>0,onSubmit:async()=>{await o({projectId:e,name:b.trim()}),ie(!1)},submitLabel:w(),children:(0,Z.jsx)(De,{value:b,onChange:e=>S(e.target.value),autoFocus:!0})}),C?(0,Z.jsx)(tt,{open:C,onOpenChange:se,title:me(),movingFolderId:e,currentId:r,onPick:t=>void f({projectId:e,parentId:t})}):null]})}function yt({chat:e,currentFolderId:t,className:n}){let i=x(A.chats.pinChat),a=x(A.chats.deleteChat),o=x(A.chats.renameChat),s=x(A.chats.setChatSidebar),c=x(A.chats.moveChatToProject),l=Ye(),u=nt(),[d,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(e.title??``),[g,_]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Ze,{children:[(0,Z.jsx)(vt,{className:n}),(0,Z.jsxs)(dt,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(W,{onSelect:()=>{h(e.title??``),p(!0)},children:[(0,Z.jsx)(He,{}),` `,w()]}),(0,Z.jsxs)(W,{onSelect:()=>void i({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(mt,{}):(0,Z.jsx)(Ae,{}),e.pinned?f():O()]}),(0,Z.jsxs)(W,{onSelect:()=>_(!0),children:[(0,Z.jsx)(gt,{}),` `,k()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(W,{onSelect:()=>void s({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(R,{}):(0,Z.jsx)(Y,{}),e.inSidebar?r():E()]}),(0,Z.jsx)(rt,{}),(0,Z.jsxs)(W,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await l({title:S(),description:b({days:u}),confirmLabel:v(),destructive:!0})&&await a({chatId:e._id})})},children:[(0,Z.jsx)(ke,{}),` `,v()]})]})]}),(0,Z.jsx)(Je,{open:d,onOpenChange:p,title:D(),canSubmit:m.trim().length>0,onSubmit:async()=>{await o({chatId:e._id,title:m.trim()}),p(!1)},submitLabel:w(),children:(0,Z.jsx)(De,{value:m,onChange:e=>h(e.target.value),autoFocus:!0})}),g?(0,Z.jsx)(tt,{open:g,onOpenChange:_,title:ce(),currentId:t,onPick:t=>void c({chatId:e._id,projectId:t})}):null]})}function bt(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function xt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function St(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var Ct=`oc.projpage.view`;function wt(){let e=localStorage.getItem(Ct);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,Tt=e=>`col:${e??`null`}`,Et=e=>`crumb:${e}`;function Dt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Ot(){let{projectId:e}=G({from:`/project/$projectId`}),t=B(),n=u(A.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:_()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:de()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:T()}),(0,Z.jsx)(F,{variant:`outline`,onClick:()=>void t({to:`/`}),children:j()})]}):(0,Z.jsx)(kt,{page:n})})}function kt({page:e}){let t=B(),n=Ye(),r=nt(),i=at(),o=Ue(),s=x(A.projects.renameProject),f=x(A.projects.setProjectColor),_=x(A.projects.deleteProject),ee=x(A.projects.createProject),y=x(A.projects.moveProject),b=x(A.projects.setProjectSidebar),S=x(A.chats.moveChatToProject),C=x(A.chats.reorderChat),se=x(A.projects.reorderProject),ce=u(A.projects.projectTreeCount,{projectId:e.project._id}),[T,de]=(0,X.useState)(wt),E=e=>{localStorage.setItem(Ct,e),de(e)},D=u(A.projects.folderColumns,T===`columns`?{projectId:e.project._id}:`skip`),O=u(A.projects.projectTreeList,T===`list`?{projectId:e.project._id}:`skip`),{c:k}=et({from:`/project/$projectId`}),j=u(A.projects.listProjects,{}),M=u(A.chatReads.myBusyChats,{}),P=(0,X.useMemo)(()=>new Set(M??[]),[M]),{byChat:we}=Ke(M??null),Ae=u(A.chatReads.myChatReads,{}),I=(0,X.useMemo)(()=>St(e.chats,Ae??[]),[e.chats,Ae]),{startNewChat:L,picker:ze}=Xe(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[R,$e]=(0,X.useState)(``),[V,U]=(0,X.useState)(!1),[G,ut]=(0,X.useState)(e.project.name),[K,mt]=(0,X.useState)(!1),[Y,vt]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>vt(R.trim()),180);return()=>clearTimeout(e)},[R]);let Q=u(A.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),yt=Le(Ie(je,{activationConstraint:{distance:4}}),Ie(Re,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),Tt=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Et,Ot]=(0,X.useState)(null),kt=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=D?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||p()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(j??[]).find(t=>t._id===e)?.name??``}}return null},Mt=e=>Ot(kt(String(e.active.id))),Pt=(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=Oe(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=Oe(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=Oe(n(`crumb:`));if(a.length>0)return a;let o=Oe(n(`col:`));return o.length>0?o:it(n(t?`folder:`:`chat:`))},[]),It=t=>{if(T===`columns`){for(let e of D?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(T===`list`){let e=O?.chats.find(e=>e._id===t);return e?{list:O.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Lt=t=>{if(T===`columns`){for(let e of D?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(T===`list`){let e=O?.folders.find(e=>e._id===t);if(!e||!O)return null;let n=e.parentId??O.rootId;return{list:ot(O.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},zt=async e=>{Ot(null),Tt();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),i=String(t.id),a=i.startsWith(`chat:`);try{let e=Dt(r);if(e!==void 0){if(a)await S({chatId:i.slice(5),projectId:e});else{let t=i.slice(7);if(t===e)return;if(!ct(j??[],t,e)){o.error(re());return}await y({projectId:t,parentId:e})}return}if(a&&r.startsWith(`chat:`)){let e=i.slice(5),t=r.slice(5);if(e===t)return;let n=It(t);if(!n)return;n.list.some(t=>t._id===e)||await S({chatId:e,projectId:n.folderId});let a=xt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await C({chatId:e,...a});return}if(!a&&r.startsWith(`folder:`)){let e=i.slice(7),t=r.slice(7);if(e===t)return;let n=Lt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!ct(j??[],e,n.parentId)){o.error(re());return}await y({projectId:e,parentId:n.parentId})}let a=xt(n.list,e=>e._id,e=>e.sortKey,e,t);a&&await se({projectId:e,...a});return}}catch{o.error(re())}},[,Bt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Bt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Vt=Date.now(),Ht=pt(e.project),Ut=bt(e.chats,R),Wt=e.breadcrumb.slice(0,-1),Gt=e=>()=>{$.current||e()};return(0,Z.jsx)(H.Provider,{value:we,children:(0,Z.jsxs)(Ve,{sensors:yt,collisionDetection:Pt,onDragStart:Mt,onDragEnd:zt,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":Ht},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":ge(),children:[Wt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(At,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Gt(()=>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)(F,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:be(),onClick:()=>{b({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(Qe,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:h()}),(0,Z.jsx)(Ee,{"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":he(),children:[(0,Z.jsx)(F,{variant:T===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":he(),title:he(),"aria-pressed":T===`cards`,onClick:()=>E(`cards`),children:(0,Z.jsx)(_t,{})}),(0,Z.jsx)(F,{variant:T===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":te(),title:te(),"aria-pressed":T===`columns`,onClick:()=>E(`columns`),children:(0,Z.jsx)(ht,{})}),(0,Z.jsx)(F,{variant:T===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":a(),title:a(),"aria-pressed":T===`list`,onClick:()=>E(`list`),children:(0,Z.jsx)(Te,{})})]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>void L({projectId:e.project._id}),children:[(0,Z.jsx)(Fe,{}),Se()]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await i({title:N(),label:ne(),placeholder:oe(),confirmLabel:ae()});t&&await ee({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(We,{}),N()]}),(0,Z.jsxs)(Ze,{children:[(0,Z.jsx)(qe,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":ie(),children:(0,Z.jsx)(ft,{})})}),(0,Z.jsxs)(dt,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(W,{onSelect:()=>{ut(e.project.name),U(!0)},children:[(0,Z.jsx)(He,{}),` `,w()]}),(0,Z.jsxs)(W,{onSelect:()=>mt(!0),children:[(0,Z.jsx)(gt,{}),` `,ve()]}),(0,Z.jsx)(lt,{children:m()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void f({projectId:e.project._id,color:null}),"aria-label":c(),children:`✕`}),Ge.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 f({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(rt,{}),(0,Z.jsxs)(W,{variant:`destructive`,onSelect:()=>{let i=e.project.parentId;requestAnimationFrame(async()=>{let a=ce?.folders??0,o=ce?.chats??0;await n({title:d({name:e.project.name}),description:st({folders:a,chats:o,days:r}),confirmWord:v(),confirmLabel:g(),destructive:!0})&&(await _({projectId:e.project._id}),t(i===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:i}}))})},children:[(0,Z.jsx)(ke,{}),` `,v()]})]})]})]})]}),T===`columns`?(0,Z.jsx)(Rt,{data:D,currentId:e.project._id,busyIds:P,suppressClick:$,locateChatId:k??null}):T===`list`?(0,Z.jsx)(Ft,{data:O,busyIds:P,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:xe()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(J,{items:e.children.map(e=>`folder:${e._id}`),strategy:Be,children:e.children.map(t=>(0,Z.jsx)(jt,{child:t,parentId:e.project._id,now:Vt,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:le()}),e.chats.length>0?(0,Z.jsx)(De,{value:R,onChange:e=>$e(e.target.value),placeholder:fe(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?_e():ye()}):Ut.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:pe({term:R.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(J,{items:Ut.map(e=>`chat:${e._id}`),strategy:q,children:Ut.map(t=>(0,Z.jsx)(Nt,{chat:t,currentFolderId:e.project._id,now:Vt,busy:P.has(t._id),unread:I.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:ue()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:pe({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&&Pe(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(Ne,{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||Ce()}),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)(Je,{open:V,onOpenChange:U,title:l(),canSubmit:G.trim().length>0,onSubmit:async()=>{await s({projectId:e.project._id,name:G.trim()}),U(!1)},submitLabel:w(),children:(0,Z.jsx)(De,{value:G,onChange:e=>ut(e.target.value),autoFocus:!0})}),K?(0,Z.jsx)(tt,{open:K,onOpenChange:mt,title:me(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void y({projectId:e.project._id,parentId:t})}):null,ze]}),(0,Z.jsx)(Me,{children:Et?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Et.kind===`folder`?(0,Z.jsx)(z,{size:13,"aria-hidden":!0}):(0,Z.jsx)(Ne,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Et.label})]}):null})]})})}function At({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=U({id:Et(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function jt({child:e,parentId:t,now:n,suppressClick:r}){let i=B(),a=I({id:`folder:${e._id}`}),o=U({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":pt(e),transform:L.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)(z,{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?M({count:e.folderCount})+` · `:``,se({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:$e(e.lastActivityAt,n)})]})}function Mt({chat:e}){let t=x(A.chats.setChatSidebar),n=e.inSidebar?r():E();return(0,Z.jsx)(F,{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)(R,{}):(0,Z.jsx)(Y,{})})}function Nt({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let c=(0,X.useContext)(H).get(e._id),l=B(),u=K(e.color),d=I({id:`chat:${e._id}`}),f=Pt(a);return(0,Z.jsxs)(`li`,{ref:e=>{d.setNodeRef(e),f.current=e},className:`oc-projpage__chatrow`+(d.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:L.Transform.toString(d.transform),transition:d.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||l({to:`/chat/$chatId`,params:{chatId:e._id}})},...d.listeners,...d.attributes,children:[u?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:u}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||p()}),e.pinned?(0,Z.jsx)(Ae,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:$e(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:V(c,s()).className,title:V(c,s()).label,"aria-label":V(c,s()).label}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:P(),"aria-label":P()}):null]}),(0,Z.jsx)(Mt,{chat:e}),(0,Z.jsx)(yt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function Pt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Ft({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,X.useState)(new Set),o=(0,X.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:_()});if(e===null)return null;let s=e=>a(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n}),c=(a,l)=>{let u=o.get(a??e.rootId)??[],d=ot(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(J,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Lt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(J,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.jsx)(It,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&ot(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:_e()}):c(null,0)})}function It({folder:e,parentId:t,depth:n,folded:r,onToggle:a,suppressClick:o,children:s}){let c=B(),l=I({id:`folder:${e._id}`}),u=U({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{l.setNodeRef(e),u.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(u.isOver?` is-over`:``)+(l.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":pt(e),transform:L.Transform.toString(l.transform),transition:l.transition},...l.listeners,...l.attributes,role:`button`,tabIndex:0,onClick:()=>{o.current||c({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&c({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?i():y(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!o.current&&a()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(ut,{size:13}):(0,Z.jsx)(we,{size:13})}),(0,Z.jsx)(z,{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 c({to:`/project/$projectId`,params:{projectId:e._id}})})]}),s]})}function Lt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=(0,X.useContext)(H).get(e._id),o=B(),s=I({id:`chat:${e._id}`}),c=Pt(r),l=K(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:L.Transform.toString(s.transform),transition:s.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||o({to:`/chat/$chatId`,params:{chatId:e._id}})},...s.listeners,...s.attributes,children:[l?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||p()}),n?(0,Z.jsx)(`span`,{className:V(a,``).className,"aria-hidden":!0}):null]}),(0,Z.jsx)(yt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(Mt,{chat:e})]})}function Rt({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:_()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(zt,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function zt({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=B(),s=U({id:Tt(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)(J,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.jsx)(Bt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(J,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.jsx)(Vt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:ye()}):null]})}function Bt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=I({id:`folder:${e._id}`}),o=U({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":pt(e),transform:L.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)(z,{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 Vt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=(0,X.useContext)(H).get(e._id),s=I({id:`chat:${e._id}`}),c=Pt(r),l=K(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{s.setNodeRef(e),c.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(s.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:L.Transform.toString(s.transform),transition:s.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...s.listeners,...s.attributes,children:[l?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:l}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||p()}),n?(0,Z.jsx)(`span`,{className:V(o,``).className,"aria-hidden":!0}):null]}),(0,Z.jsx)(yt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(Mt,{chat:e})]})}export{Ot as ProjectPage};
@@ -1,4 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$k as r,Cf as i,Du as a,Gk as o,HX as s,Jk as c,Kk as l,Ou as u,Qk as d,Sf as f,Uk as p,Uo as m,VX as h,Wk as g,Xk as _,Yk as v,Zk as y,aA as ee,cA as te,df as ne,eA as b,ff as x,fm as S,gA as C,gm as w,hA as T,hm as E,iA as D,ku as re,mf as ie,mm as ae,nA as oe,oA as se,pf as O,pm as k,qk as A,rA as j,sA as M,t as N,tA as P,uf as F,wf as I,xf as L}from"./api-Ca1H8N44.js";import{i as R,n as z,r as B,t as V}from"./FieldLabel-BP6EBGVI.js";import{t as H}from"./button-BbEZKLza.js";import{Mt as ce,St as U,Yt as W,bt as G,ft as le,gn as ue,hn as de,mn as fe,pn as K,vt as q,xt as J,yt as Y}from"./index-Wii4FZxb.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:j,help:oe},documentary_fetch:{label:P,help:b},inbound_files:{label:r,help:d},history_summary:{label:w,help:E},file_curation:{label:I,help:ie},quote_reply:{label:i,help:f}},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:o,references:g,files:p,previous_summary:ae,new_messages:k,max_chars:S,file_name:O,budget_chars:x,feedback:ne,content:F,excerpt:L};function _e(){let e=s(N.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:_()})});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)(z,{label:te(),help:M()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:y()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(U,{})}),(0,$.jsx)(Y,{children:e.map(e=>(0,$.jsx)(G,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(ve,{instance:r},r._id)]})}function ve({instance:e}){let t=h(N.admin.upsertInstanceConfig),n=W(),r=s(N.me.getMe,{host:le}),i=e.config??{},o=X(e.config?.contentLocale,r?.defaultLocale??void 0),[c,l]=(0,Q.useState)(()=>R(i,o));(0,Q.useEffect)(()=>{l(R(i,o))},[o,e._id]);let[d,f]=(0,Q.useState)(!1),p=c.promptInjections,m=(e,t)=>l({...c,promptInjections:{...p,[e]:{...p[e],...t}}});async function g(){f(!0);try{await t({instanceId:e._id,config:B(c,i,o)})}catch(e){n.error(T(),e)}finally{f(!1)}}async function _(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(T(),e)}}let v=e.config?.contentLocale??`default`,y=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:re()}),(0,$.jsxs)(q,{value:v,onValueChange:e=>void _(e),children:[(0,$.jsx)(J,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(U,{})}),(0,$.jsxs)(Y,{children:[(0,$.jsx)(G,{value:`default`,children:a({locale:y})}),pe().map(e=>(0,$.jsx)(G,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:u()})]}),fe.map(e=>(0,$.jsx)(ye,{injKey:e,def:K[e],i18n:me[e],row:p[e]??{enabled:!0,template:K[e].defaultTemplate[o]},contentLocale:o,onChange:t=>m(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(H,{size:`sm`,onClick:()=>void g(),disabled:d,children:C()})})]})}function ye({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),u=r.template.trim()!==t.defaultTemplate[i],d=t.togglable&&!r.enabled,f=Object.fromEntries(t.placeholders.map(e=>[e,he[e]??`{${e}}`])),p=de(e,r,i),h=p?ue(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)(ce,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(z,{label:n.label(),help:n.help()})]}):(0,$.jsx)(z,{label:n.label(),help:n.help()}),u&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:ee()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:d,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:D()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(V,{text:(ge[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?c():v()}),u&&(0,$.jsx)(H,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:se()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:A()}),t.pluralDefaultTemplate!==void 0&&!d?(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:m()}):null]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:l()})})]})}export{_e as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$q as r,Aq as i,CJ as a,Cq as o,DJ as s,Dq as c,E as l,EJ as u,Eq as ee,FJ as te,Gq as d,HX as f,Hq as p,IJ as ne,Jq as m,Kq as re,MJ as ie,MX as ae,NJ as oe,OJ as se,Oq as ce,PJ as le,PX as h,Qq as g,SJ as ue,Sq as de,TJ as fe,Tq as pe,Uq as me,Vq as he,Wq as ge,Xq as _e,Yq as ve,Zq as ye,_q as be,aY as xe,bq as Se,cJ as Ce,cY as we,cq as Te,dJ as Ee,dY as De,eJ as _,fJ as Oe,fY as ke,gJ as Ae,gY as je,gq as Me,hJ as Ne,hY as Pe,hq as Fe,iY as Ie,jJ as Le,jq as Re,kJ as v,kq as ze,lJ as Be,lY as Ve,mJ as He,mY as Ue,mq as We,nJ as Ge,nY as Ke,oY as qe,pJ as Je,pY as Ye,qq as y,rY as Xe,sJ as Ze,sY as Qe,t as b,tJ as $e,tY as et,uJ as tt,uY as nt,vJ as rt,vq as it,wJ as at,wq as ot,xJ as st,xq as ct,yq as lt,zX as x}from"./api-Ca1H8N44.js";import{t as ut}from"./list-Bhy47ogH.js";import{t as S}from"./button-BbEZKLza.js";import{$t as dt,An as ft,Bt as pt,Ct as mt,Dt as ht,Et as gt,Gt as _t,Hn as vt,Ht as yt,In as bt,Jn as xt,Jt as C,Kt as St,Ot as Ct,Rn as wt,Rt as Tt,St as w,Tt as Et,Ut as Dt,Vn as Ot,Vt as kt,Wt as At,Yt as jt,bt as T,cn as E,cr as D,ft as Mt,on as O,qt as Nt,sn as k,sr as A,vt as j,wn as Pt,wt as Ft,xt as M,yt as N,zt as It}from"./index-Wii4FZxb.js";import{a as Lt,i as P,n as Rt,o as zt,r as F,t as Bt}from"./table-BrECCZpB.js";import{t as Vt}from"./FilterBar-BrdWP0oO.js";/* empty css */import{a as Ht,c as I,i as L,l as Ut,n as Wt,o as R,r as Gt,s as Kt,t as qt,u as z}from"./TimezoneCombobox-Djj8VaFK.js";var Jt=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`}]]),Yt=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`}]]),B=t(e(),1),V=n();function H(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Xt({value:e,onChange:t}){let n=Ut(e),i=(0,B.useMemo)(()=>new Date,[]),[a,o]=(0,B.useState)(()=>({year:n?.year??i.getFullYear(),month:n?.month??i.getMonth()})),[s,c]=(0,B.useState)(!1),l=(0,B.useMemo)(()=>H(h()),[]),u=(0,B.useMemo)(()=>new Intl.DateTimeFormat(h(),{month:`long`,year:`numeric`}),[]),ee=(0,B.useMemo)(()=>new Intl.DateTimeFormat(h(),{dateStyle:`medium`,timeStyle:`short`}),[]),te=I(a.year,a.month),d=n?.hour??9,f=n?.minute??0,p=(e,n,r,i,a)=>t(z(e,n,r,i,a)),ne=(e,t,n)=>{o({year:e,month:t}),p(e,t,n,d,f)},m=e=>{let t=new Date(a.year,a.month+e,1);o({year:t.getFullYear(),month:t.getMonth()})},re=n===null?$e():ee.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,V.jsxs)(O,{modal:!0,open:s,onOpenChange:c,children:[(0,V.jsx)(E,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":Ge(),children:[(0,V.jsx)(Jt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,V.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:re})]})}),(0,V.jsxs)(k,{align:`start`,className:`oc-dtp__pop`,children:[(0,V.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":_(),onClick:()=>m(-1),children:(0,V.jsx)(D,{size:15,"aria-hidden":!0})}),(0,V.jsx)(`span`,{className:`oc-dtp__month`,children:u.format(new Date(a.year,a.month,1))}),(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":r(),onClick:()=>m(1),children:(0,V.jsx)(A,{size:15,"aria-hidden":!0})})]}),(0,V.jsxs)(`div`,{className:`oc-dtp__grid`,children:[l.map((e,t)=>(0,V.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),te.map((e,t)=>{let r=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,V.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(r?` oc-dtp__day--sel`:``)+(a&&!r?` oc-dtp__day--today`:``),onClick:()=>ne(e.year,e.month,e.day),children:e.day},t)})]}),(0,V.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,V.jsxs)(j,{value:String(d),onValueChange:e=>p(a.year,a.month,n?.day??i.getDate(),Number(e),f),children:[(0,V.jsx)(M,{size:`sm`,"aria-label":g(),children:(0,V.jsx)(w,{})}),(0,V.jsx)(N,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,V.jsx)(T,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,V.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,V.jsxs)(j,{value:String(f),onValueChange:e=>p(a.year,a.month,n?.day??i.getDate(),d,Number(e)),children:[(0,V.jsx)(M,{size:`sm`,"aria-label":ye(),children:(0,V.jsx)(w,{})}),(0,V.jsx)(N,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,V.jsx)(T,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function U(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Zt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Qt(e){let t=new Map;for(let n of e){let e=U(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 $t(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(Zt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function en(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function tn(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function nn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var W=3;function rn({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=h(),c=(0,B.useMemo)(()=>Qt(e),[e]),l=(0,B.useMemo)(()=>en(s),[s]),u=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),te=(0,B.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),f=new Date,p=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},ne=t===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,V.jsxs)(`div`,{className:`oc-cal`,children:[(0,V.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,V.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":ge(),onClick:()=>p(-1),children:(0,V.jsx)(D,{})}),(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,"aria-label":me(),onClick:()=>p(1),children:(0,V.jsx)(A,{})}),(0,V.jsx)(S,{variant:`ghost`,size:`sm`,onClick:()=>i({year:f.getFullYear(),month:f.getMonth()}),children:d()})]}),(0,V.jsx)(`span`,{className:`oc-cal__title`,children:ne}),(0,V.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,V.jsx)(S,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:y()}),(0,V.jsx)(S,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:re()})]})]}),t===`month`?(0,V.jsx)(an,{cursor:n,byDay:c,weekdays:l,timeFmt:te,now:f,onEventClick:a}):(0,V.jsx)(on,{year:n.year,byDay:c,monthShortFmt:ee,now:f,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,V.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function an({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=I(e.year,e.month);return(0,V.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,V.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Zt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,V.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,V.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,W).map(e=>(0,V.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,V.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,V.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,V.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>W?(0,V.jsx)(`span`,{className:`oc-cal__more`,children:p({count:o.length-W})}):null]},n)})]})}function on({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,V.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=$t(t,e,o),c=I(e,o);return(0,V.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,V.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,V.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,V.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var sn={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])*sn[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 ln=new Map;function q(e){let t=ln.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 ln.set(e,n),n}function J(e,t){if(t!==null){let n=q(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 Y(e,t,n,r,i,a){if(a===null||q(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=J(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 X(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=J(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=Y(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=Y(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 Z=`crons`;function un(e,t){return`${e}\u0000${t}`}function dn(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=un(a.instanceName,e.id);i.set(o,a);let s=R(e)!==`active`,c=X(s?null:cn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Z,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var Q={minutes:6e4,hours:36e5,days:864e5};function $(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Kt(e)){case`ok`:return(0,V.jsx)(C,{variant:`secondary`,children:Ne()});case`error`:return(0,V.jsx)(C,{variant:`destructive`,children:Je()});case`running`:return(0,V.jsx)(C,{variant:`outline`,children:Oe()});case`other`:return(0,V.jsx)(C,{variant:`outline`,children:e});case`none`:return(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=x(b.scheduled.listMyCrons),t=x(b.scheduled.getCronDetail),n=x(b.scheduled.listCronRuns),r=x(b.scheduled.updateCron),l=x(b.scheduled.removeCron),d=x(b.scheduled.runCronNow),p=jt(),re=f(b.me.getMe,{host:Mt})?.timezone,[g,me]=(0,B.useState)(null),[ge,ye]=(0,B.useState)(!1),[_,Ge]=(0,B.useState)(!1),[y,$e]=(0,B.useState)(null),[E,D]=(0,B.useState)(null),[O,k]=(0,B.useState)(null),[A,I]=(0,B.useState)(null),[Ut,Kt]=(0,B.useState)(!1),[z,H]=(0,B.useState)(Wt),[U,Zt]=(0,B.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Qt=e=>{localStorage.setItem(`oc.sched.view`,e),Zt(e)},[$t,en]=(0,B.useState)(`month`),[W,an]=(0,B.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),on=(0,B.useMemo)(()=>{let e=[];for(let t of g??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Ht(r,z)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[g,z]),sn=(0,B.useMemo)(()=>$t===`year`?nn(W.year):tn(W.year,W.month),[$t,W]),cn=(0,B.useMemo)(()=>dn(on,sn.startMs,sn.endMs),[on,sn]),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,B.useCallback)(async()=>{ye(!0),Ge(!1);try{me(await e({}))}catch{Ge(!0)}finally{ye(!1)}},[e]);(0,B.useEffect)(()=>{K()},[K]);let ln=(0,B.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),q=(0,B.useRef)(null);(0,B.useEffect)(()=>{g!==null&&q.current!==null&&q.current.scrollIntoView({block:`center`})},[g]);let J=(0,B.useMemo)(()=>new Intl.DateTimeFormat(h(),{dateStyle:`medium`,timeStyle:`short`}),[]),Y=async(e,t,n)=>{$e(e);try{await t(),p.success(n),await K()}catch(e){p.toast({variant:`error`,title:v({code:$(e)})})}finally{$e(null)}},X=(0,B.useRef)(0),Z=(0,B.useRef)(0),un=async(e,t)=>{if(t.id===null)return;let r=++X.current;k({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==X.current)return;k({name:t.name??t.id,entries:i})}catch(e){if(r!==X.current)return;k(null),p.toast({variant:`error`,title:v({code:$(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Z.current;I({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%Q.days===0?(s=String(e/Q.days),c=`days`):e%Q.hours===0?(s=String(e/Q.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/Q.minutes))),c=`minutes`))}if(r!==Z.current)return;I(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Z.current)return;I(null),p.toast({variant:`error`,title:v({code:$(e)})})}},mn=async()=>{if(A===null)return;let e={};if(A.nameDirty&&A.name.trim()===``||A.messageDirty&&A.hasMessage&&A.message.trim()===``){p.toast({variant:`error`,title:We()});return}if(A.nameDirty&&A.name.trim()!==``&&(e.name=A.name.trim()),A.scheduleDirty){if(A.scheduleKind===`cron`&&A.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:A.cronExpr.trim(),...A.tz.trim()===``?{}:{tz:A.tz.trim()}};else if(A.scheduleKind===`every`){let t=Number(A.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*Q[A.everyUnit])})}else if(A.scheduleKind===`at`&&A.at!==``){let t=Date.parse(A.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(A.scheduleDirty&&e.schedule===void 0){p.toast({variant:`error`,title:Fe()});return}if(A.messageDirty&&A.hasMessage&&A.message.trim()!==``&&(e.message=A.message.trim()),Object.keys(e).length===0){I(null);return}let t=Z.current;Kt(!0);try{await r({instanceName:A.instanceName,jobId:A.jobId,patch:e}),p.success(ce()),t===Z.current&&I(null),await K()}catch(e){p.toast({variant:`error`,title:v({code:$(e)})})}finally{Kt(!1)}},hn=g?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,V.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:je()}),(0,V.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":_e(),children:[(0,V.jsx)(S,{variant:U===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":ve(),title:ve(),"aria-pressed":U===`list`,onClick:()=>Qt(`list`),children:(0,V.jsx)(ut,{})}),(0,V.jsx)(S,{variant:U===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":m(),title:m(),"aria-pressed":U===`calendar`,onClick:()=>Qt(`calendar`),children:(0,V.jsx)(Jt,{})})]}),(0,V.jsxs)(S,{variant:`ghost`,size:`sm`,onClick:()=>void K(),disabled:ge,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,V.jsx)(bt,{size:14,"aria-hidden":!0}),Pe()]})]}),g!==null&&hn>0?(0,V.jsxs)(Vt,{q:z.q,onQChange:e=>H(t=>({...t,q:e})),searchPlaceholder:tt(),onReset:()=>H(Wt),canReset:Gt(z),children:[(0,V.jsxs)(j,{value:z.state,onValueChange:e=>H(t=>({...t,state:e})),children:[(0,V.jsx)(M,{size:`sm`,className:`w-40`,children:(0,V.jsx)(w,{})}),(0,V.jsxs)(N,{children:[(0,V.jsx)(T,{value:`all`,children:Be()}),(0,V.jsx)(T,{value:`active`,children:Ke()}),(0,V.jsx)(T,{value:`paused`,children:Xe()}),(0,V.jsx)(T,{value:`auto-disabled`,children:et()})]})]}),(0,V.jsxs)(j,{value:z.result,onValueChange:e=>H(t=>({...t,result:e})),children:[(0,V.jsx)(M,{size:`sm`,className:`w-40`,children:(0,V.jsx)(w,{})}),(0,V.jsxs)(N,{children:[(0,V.jsx)(T,{value:`all`,children:Ce()}),(0,V.jsx)(T,{value:`ok`,children:Ne()}),(0,V.jsx)(T,{value:`error`,children:Je()}),(0,V.jsx)(T,{value:`running`,children:Oe()}),(0,V.jsx)(T,{value:`none`,children:Ee()})]})]})]}):null,g===null?(0,V.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":ge,children:_?Ue():ae()}):U===`calendar`?(0,V.jsxs)(V.Fragment,{children:[_?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}):null,g.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}):(0,V.jsx)(rn,{events:cn.events,mode:$t,cursor:W,onModeChange:en,onCursorChange:an,onEventClick:G,footnote:he()})]}):(0,V.jsxs)(V.Fragment,{children:[_?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}):null,g.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Ye()}):null,g.map(e=>{let t=e.jobs.filter(e=>Ht(e,z)),n=Gt(z)&&e.jobs.length>0&&t.length===0;return(0,V.jsxs)(`section`,{style:{marginBottom:20},children:[g.length>1||e.error||!e.supported?(0,V.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,V.jsx)(C,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:De({code:e.error})}):e.jobs.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}):n?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):(0,V.jsxs)(Bt,{children:[(0,V.jsx)(Lt,{children:(0,V.jsxs)(zt,{children:[(0,V.jsx)(P,{children:Ve()}),(0,V.jsx)(P,{children:we()}),(0,V.jsx)(P,{children:Qe()}),(0,V.jsx)(P,{children:qe()}),(0,V.jsx)(P,{children:xe()}),(0,V.jsx)(P,{children:Ae()}),(0,V.jsx)(P,{children:Re()})]})}),(0,V.jsx)(Rt,{children:t.map((t,n)=>{let a=`${e.instanceName}:${t.id??n}`,o=y===a,c=e.manageSupported,l=e.kind===`openclaw`&&c;return(0,V.jsxs)(zt,{ref:t.id!==null&&t.id===ln?q:void 0,"data-state":t.id!==null&&t.id===ln?`selected`:void 0,children:[(0,V.jsx)(F,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??Ie()}),(0,V.jsx)(F,{children:(0,V.jsx)(C,{variant:`secondary`,children:t.agentId})}),(0,V.jsxs)(F,{className:`whitespace-nowrap`,children:[(0,V.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=Tt(t.schedule),n=e===null?null:It(e);return n===null?null:(0,V.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,V.jsx)(F,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:J.format(t.nextRunAtMs)}),(0,V.jsx)(F,{children:R(t)===`auto-disabled`?(0,V.jsx)(C,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${J.format(t.autoDisabledAtMs)}`}`,children:et()}):R(t)===`active`?(0,V.jsx)(C,{variant:`secondary`,children:Ke()}):R(t)===`paused`?(0,V.jsx)(C,{variant:`outline`,children:Xe()}):(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,V.jsxs)(F,{children:[(0,V.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,V.jsx)(C,{variant:`destructive`,title:t.lastDeliveryError??ne(),children:He()}):null]}),(0,V.jsx)(F,{className:`whitespace-nowrap`,children:t.id===null?(0,V.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):o?(0,V.jsx)(xt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,V.jsxs)(`span`,{className:`oc-cronactions`,children:[l?(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:le(),"aria-label":le(),disabled:y!==null,onClick:()=>void Y(a,async()=>{let n=await d({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},se()),children:(0,V.jsx)(Pt,{size:14,"aria-hidden":!0})}):null,l&&t.enabled!==null?(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:L(t)===`pause`?oe():ie(),"aria-label":L(t)===`pause`?oe():ie(),disabled:y!==null,onClick:()=>void Y(a,()=>r({instanceName:e.instanceName,jobId:t.id,patch:{enabled:L(t)===`resume`}}),L(t)===`pause`?s():u()),children:L(t)===`pause`?(0,V.jsx)(vt,{size:14,"aria-hidden":!0}):(0,V.jsx)(wt,{size:14,"aria-hidden":!0})}):null,l?(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:i(),"aria-label":i(),disabled:y!==null,onClick:()=>void pn(e.instanceName,t),children:(0,V.jsx)(Ot,{size:14,"aria-hidden":!0})}):null,l?(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:ze(),"aria-label":ze(),disabled:y!==null,onClick:()=>void un(e.instanceName,t),children:(0,V.jsx)(Yt,{size:14,"aria-hidden":!0})}):null,c?(0,V.jsx)(S,{variant:`ghost`,size:`icon-sm`,title:Le(),"aria-label":Le(),disabled:y!==null,onClick:()=>D({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,V.jsx)(ft,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ke()})]},e.instanceName)}),hn>0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:Te()}):null]}),(0,V.jsx)(pt,{open:E!==null,onOpenChange:e=>{e||D(null)},children:(0,V.jsxs)(Dt,{children:[(0,V.jsxs)(St,{children:[(0,V.jsx)(Nt,{children:at()}),(0,V.jsx)(At,{children:a({name:E?.name??``})})]}),(0,V.jsxs)(_t,{children:[(0,V.jsx)(yt,{children:ue()}),(0,V.jsx)(kt,{onClick:()=>{let e=E;D(null),e!==null&&Y(`${e.instanceName}:${e.jobId}`,()=>l({instanceName:e.instanceName,jobId:e.jobId}),fe())},children:st()})]})]})}),(0,V.jsx)(mt,{open:O!==null,onOpenChange:e=>{e||(X.current++,k(null))},children:(0,V.jsxs)(Ft,{style:{maxWidth:640},children:[(0,V.jsx)(ht,{children:(0,V.jsx)(Ct,{children:c({name:O?.name??``})})}),O?.entries===null?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):O!==null&&O.entries.length===0?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ee()}):O===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:O.entries.map((e,t)=>(0,V.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,V.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,V.jsx)(fn,{status:e.status}),(0,V.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?J.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,V.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,V.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,V.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[rt({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,V.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,V.jsx)(mt,{open:A!==null,onOpenChange:e=>{e||(Z.current++,I(null))},children:(0,V.jsxs)(Ft,{className:`oc-cronedit`,children:[(0,V.jsxs)(ht,{children:[(0,V.jsx)(Ct,{children:pe()}),(0,V.jsx)(Et,{children:ot()})]}),A===null?null:A.loading?(0,V.jsx)(`p`,{className:`oc-admin__hint`,children:ae()}):(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,V.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ve()}),(0,V.jsx)(dt,{value:A.name,maxLength:200,onChange:e=>I({...A,name:e.target.value,nameDirty:!0})})]}),(0,V.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:o()}),(0,V.jsxs)(j,{value:A.scheduleKind,onValueChange:e=>I({...A,scheduleKind:e,scheduleDirty:!0}),children:[(0,V.jsx)(M,{children:(0,V.jsx)(w,{})}),(0,V.jsxs)(N,{children:[(0,V.jsx)(T,{value:`cron`,children:de()}),(0,V.jsx)(T,{value:`every`,children:ct()}),(0,V.jsx)(T,{value:`at`,children:Se()})]})]}),A.scheduleKind===`cron`?(0,V.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,V.jsx)(dt,{value:A.cronExpr,onChange:e=>I({...A,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,V.jsx)(qt,{value:A.tz,onChange:e=>I({...A,tz:e,scheduleDirty:!0}),fallbackTz:re??void 0})]}):A.scheduleKind===`every`?(0,V.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,V.jsx)(dt,{type:`number`,min:1,value:A.everyValue,onChange:e=>I({...A,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,V.jsxs)(j,{value:A.everyUnit,onValueChange:e=>I({...A,everyUnit:e,scheduleDirty:!0}),children:[(0,V.jsx)(M,{style:{maxWidth:160},children:(0,V.jsx)(w,{})}),(0,V.jsxs)(N,{children:[(0,V.jsx)(T,{value:`minutes`,children:lt()}),(0,V.jsx)(T,{value:`hours`,children:it()}),(0,V.jsx)(T,{value:`days`,children:be()})]})]})]}):(0,V.jsx)(Xt,{value:A.at,onChange:e=>I({...A,at:e,scheduleDirty:!0})})]}),A.hasMessage?(0,V.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,V.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:te()}),(0,V.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:A.message,onChange:e=>I({...A,message:e.target.value,messageDirty:!0})})]}):null]}),(0,V.jsxs)(gt,{children:[(0,V.jsx)(S,{variant:`ghost`,onClick:()=>I(null),children:ue()}),(0,V.jsxs)(S,{onClick:()=>void mn(),disabled:A===null||A.loading||Ut,children:[Ut?(0,V.jsx)(xt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,Me()]})]})]})})]})}export{pn as ScheduledTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$U as r,AU as i,AW as ee,BU as a,BW as te,CW as ne,DW as re,EW as ie,FU as o,FW as ae,GU as s,GW as oe,HU as c,HW as se,HX as l,IU as u,IW as ce,JU as d,JW as le,KU as f,KW as ue,LU as p,LW as de,MU as m,MW as fe,NU as h,NW as pe,OW as me,PU as he,PW as ge,QU as _e,RU as g,RW as ve,SW as ye,TW as be,UU as _,UW as xe,VU as Se,VW as Ce,VX as v,WU as y,WW as b,XU as x,YU as S,YW as we,ZU as C,_W as Te,aW as Ee,bW as De,cW as Oe,dW as ke,eW as Ae,fW as je,gW as Me,hW as Ne,iW as Pe,jU as w,jW as Fe,kU as T,kW as Ie,lW as Le,mW as Re,nW as ze,oW as Be,pW as Ve,qU as E,qW as He,rW as Ue,sW as We,t as D,tW as Ge,uW as Ke,vW as qe,wW as Je,xW as Ye,yW as Xe,zU as O,zW as Ze,zX as Qe}from"./api-Ca1H8N44.js";import{r as $e}from"./dist-Bfmsr8JO.js";import{t as k}from"./button-BbEZKLza.js";import{$t as A,At as j,Ct as M,Dt as N,Et as P,Jt as F,Ot as I,St as L,Tt as R,Yt as et,b as tt,bt as z,ct as nt,dr as rt,fr as it,kt as B,lr as V,rr as at,sr as ot,vt as H,wt as U,xt as W,yt as G}from"./index-Wii4FZxb.js";import{t as st}from"./FilterBar-BrdWP0oO.js";import{t as ct}from"./DataTableShell-BUYroEsA.js";import{t as lt}from"./roleDescriptions-DUp1v5cq.js";var K=t(e(),1),q=n(),J=[{value:`never`,label:()=>o(),days:null},{value:`30`,label:()=>he(),days:30},{value:`90`,label:()=>h(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=it({from:`/settings/serviceAccounts`}),t=rt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??X,[a,o]=(0,K.useState)(X),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),c=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),u=l(D.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:i===X?void 0:i===`disabled`}}),d=l(D.apiKeys.listKeys,{}),f=l(D.apiKeys.listRoles,{}),p=v(D.apiKeys.createServiceAccount),m=v(D.apiKeys.updateServiceAccount),h=v(D.apiKeys.deleteServiceAccount),he=Qe(D.apiKeys.mintApiKey),_e=v(D.apiKeys.revokeApiKey),g=nt(),_=et(),Se=n!==``||a!==X||i!==X;function y(){o(X),t({search:{},replace:!0})}let[x,S]=(0,K.useState)(!1),[C,w]=(0,K.useState)(Z),[T,E]=(0,K.useState)(null),[O,j]=(0,K.useState)(new Set),[M,N]=(0,K.useState)(null),P=(0,K.useRef)(!1),[I,R]=(0,K.useState)(new Set),[B,V]=(0,K.useState)({}),[at,U]=(0,K.useState)(null),Y=(0,K.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function Q(e){j(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{T?(await m({serviceAccountId:T,name:C.name,roleKey:C.roleKey,description:C.description}),_.success(Ve())):await p({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),w(Z),E(null),S(!1)}catch(e){_.error(T?Re():Ne(),e)}}function pt(e){w({name:e.name,roleKey:e.roleKey,description:e.description??``}),E(e._id),S(!0)}async function mt(e){if(P.current)return;P.current=!0;let t=B[e._id]??`never`,n=J.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;N(e._id);try{let t=await he({serviceAccountId:e._id,expiresAt:r});U({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){_.error(je(),e)}finally{P.current=!1,N(null)}}async function $(e){if(await g({title:ke(),description:(0,q.jsxs)(q.Fragment,{children:[Ke(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Le(),` `,(0,q.jsx)(`strong`,{children:Oe()}),` `,We()]}),confirmWord:e.name,confirmLabel:Be(),destructive:!0}))try{await h({serviceAccountId:e._id}),_.success(Ee(),e.name)}catch(e){_.error(Pe(),e)}}async function ht(e){if(await g({title:Ue(),description:(0,q.jsxs)(q.Fragment,{children:[ze(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ge()]}),confirmLabel:Ae(),destructive:!0})&&!I.has(e._id)){R(t=>new Set(t).add(e._id));try{await _e({keyId:e._id})}catch(e){_.error(r(),e)}finally{R(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),(0,q.jsxs)(st,{q:n,onQChange:s,searchPlaceholder:le(),onReset:y,canReset:Se,children:[(0,q.jsxs)(H,{value:a,onValueChange:o,children:[(0,q.jsx)(W,{size:`sm`,className:`w-40`,children:(0,q.jsx)(L,{placeholder:He()})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(z,{value:X,children:ue()}),(f??[]).map(e=>(0,q.jsx)(z,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(H,{value:i,onValueChange:c,children:[(0,q.jsx)(W,{size:`sm`,className:`w-36`,children:(0,q.jsx)(L,{})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(z,{value:X,children:oe()}),(0,q.jsx)(z,{value:`active`,children:b()}),(0,q.jsx)(z,{value:`disabled`,children:xe()})]})]})]}),(0,q.jsx)(ct,{title:se(),rows:u,addLabel:Ce(),onAdd:()=>{w(Z),E(null),S(!0)},emptyHint:te(),isExpanded:e=>O.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:I}),rowActions:e=>[...(e.managedBy??null)===null?[{label:ce(),onSelect:()=>pt(e)},{label:Ze(),onSelect:()=>void mt(e)}]:[],{label:O.has(e._id)?ve():de(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:ae(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(k,{variant:`ghost`,size:`icon-sm`,"aria-label":O.has(e._id)?ge():pe(),onClick:()=>Q(e._id),children:O.has(e._id)?(0,q.jsx)($e,{}):(0,q.jsx)(ot,{})})},{header:fe(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Fe(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(F,{variant:`secondary`,children:e.roleKey})},{header:ee(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(F,{variant:`destructive`,children:xe()}):(0,q.jsx)(F,{variant:`outline`,children:b()})},{header:Ie(),cell:e=>(0,q.jsxs)(H,{value:B[e._id]??`never`,onValueChange:t=>V(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(W,{size:`sm`,className:`w-32`,children:(0,q.jsx)(L,{})}),(0,q.jsx)(G,{children:J.map(e=>(0,q.jsx)(z,{value:e.value,children:e.label()},e.value))})]})},{header:me(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?re():ie({count:t})})}}]}),(0,q.jsx)(tt,{open:x,onOpenChange:e=>{S(e),e||E(null)},title:T?be():ye(),description:T?Je():Ye(),canSubmit:!!(C.name&&C.roleKey),onSubmit:ft,submitLabel:T?ne():De(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Xe()}),(0,q.jsx)(A,{value:C.name,onChange:e=>w({...C,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:qe()}),(0,q.jsxs)(H,{value:C.roleKey||void 0,onValueChange:e=>w({...C,roleKey:e}),children:[(0,q.jsx)(W,{className:`w-full`,children:(0,q.jsx)(L,{placeholder:Te()})}),(0,q.jsx)(G,{children:(f??[]).map(e=>(0,q.jsxs)(z,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===C.roleKey),t=e?lt(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Me()}),(0,q.jsx)(A,{value:C.description,onChange:e=>w({...C,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:at,onClose:()=>U(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[_e(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:x()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:d()}),(0,q.jsx)(`th`,{children:E()}),(0,q.jsx)(`th`,{children:f()}),(0,q.jsx)(`th`,{children:s()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(F,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:j(t.createdAt)}),(0,q.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:mt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,q.jsx)(k,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?y():_()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(M,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(U,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(N,{children:[(0,q.jsx)(I,{children:c()}),(0,q.jsx)(R,{children:Se({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:a()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":O(),children:[n?(0,q.jsx)(V,{}):(0,q.jsx)(at,{}),n?g():p()]})]}),(0,q.jsx)(P,{children:(0,q.jsx)(k,{onClick:()=>{r(!1),t()},children:u()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?m():j(e)}function mt(e){return e===null?`—`:B(e)}function $(e){return e.disabled?(0,q.jsx)(F,{variant:`destructive`,children:w()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(F,{variant:`outline`,children:i()}):(0,q.jsx)(F,{variant:`outline`,children:T()})}export{Q as ServiceAccountsTab};