@lacneu/atrium 0.84.16 → 0.84.17

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 (72) hide show
  1. package/dist/assets/{AccessTab-ZwxPNcS7.js → AccessTab-DhFQZGzx.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-C0npZhxy.js → AdvancedFilter-DhMwg7nB.js} +1 -1
  3. package/dist/assets/AgentFilesTab-4sCRfaeL.js +3 -0
  4. package/dist/assets/AnomaliesTab-DRPqd0B0.js +1 -0
  5. package/dist/assets/AuditTab-CoJzgU4A.js +1 -0
  6. package/dist/assets/BridgeTab-Cyq6ii7O.js +1 -0
  7. package/dist/assets/{ChatDefaultsTab-CTf8JrL7.js → ChatDefaultsTab-ffTdOd77.js} +1 -1
  8. package/dist/assets/{DataTableShell-ZXwE42Fk.js → DataTableShell-C0MSDiic.js} +1 -1
  9. package/dist/assets/{DetailChips-B3Il0xXy.js → DetailChips-V2Qp_G9Y.js} +1 -1
  10. package/dist/assets/FeedbacksTab-4P7NTQHQ.js +1 -0
  11. package/dist/assets/{FieldLabel-83bK1ECz.js → FieldLabel-CrPuHD7O.js} +1 -1
  12. package/dist/assets/FilesTab-DhNYdwv6.js +1 -0
  13. package/dist/assets/{FilterBar-CXoCWT0o.js → FilterBar-Of8GWz2N.js} +1 -1
  14. package/dist/assets/{GroupsTab-RdFo311S.js → GroupsTab-JG0ZRFjT.js} +1 -1
  15. package/dist/assets/InstancesTab-Z4FtEPKO.js +1 -0
  16. package/dist/assets/IntegrationsTab-Cwaeqx7m.js +1 -0
  17. package/dist/assets/KpiTab-CW4PL5Q2.js +1 -0
  18. package/dist/assets/PreferencesTab-CWPxzO4u.js +1 -0
  19. package/dist/assets/ProjectPage-DMyEKLjd.js +1 -0
  20. package/dist/assets/{PromptInjectionsTab-CyMC6gEv.js → PromptInjectionsTab-netn591W.js} +2 -2
  21. package/dist/assets/RolesTab-BEQu-Exi.js +1 -0
  22. package/dist/assets/ScheduledTab-DwU5L2Il.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-CfyqKLAB.js +1 -0
  24. package/dist/assets/{SubAgentReportsTab-DOQX8r0T.js → SubAgentReportsTab-Z3ozWsvu.js} +1 -1
  25. package/dist/assets/ThemeShowroom-CJH5AUOa.js +1 -0
  26. package/dist/assets/{TimeRangePicker-Ba4ZnAYy.js → TimeRangePicker-Cq_PGNzt.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-DXwy6QXD.js → TimezoneCombobox-n6rUGOTZ.js} +1 -1
  28. package/dist/assets/TracesTab-DNfS8ryM.js +1 -0
  29. package/dist/assets/UsersTab-B3TSVToM.js +1 -0
  30. package/dist/assets/VoiceTab-DiKi0oXO.js +1 -0
  31. package/dist/assets/{api-CmD2gXMO.js → api-DRlXTl06.js} +5 -5
  32. package/dist/assets/{button-CeWAnaYG.js → button-CTuIl1H-.js} +1 -1
  33. package/dist/assets/{card-C-qzU79p.js → card-Bf8slN_1.js} +1 -1
  34. package/dist/assets/chevrons-up-down-BCCw67LL.js +1 -0
  35. package/dist/assets/{compatView-BqlICbc0.js → compatView-DGV2AVAR.js} +1 -1
  36. package/dist/assets/{dispatchErrorInfo-ab4vRzyN.js → dispatchErrorInfo-ZyhGCDRg.js} +1 -1
  37. package/dist/assets/{dist-C8ENKKAI.js → dist-BA_3OmOa.js} +1 -1
  38. package/dist/assets/{dist-hb3SnWuW.js → dist-uRF7WBqM.js} +1 -1
  39. package/dist/assets/{highlighted-body-OFNGDK62-BRZVq3Wk.js → highlighted-body-OFNGDK62-PQt_lrzL.js} +1 -1
  40. package/dist/assets/index-D48cFy6f.js +324 -0
  41. package/dist/assets/{list-CvqgTGVJ.js → list-CntaIhDp.js} +1 -1
  42. package/dist/assets/mermaid-GHXKKRXX-CiGFgQis.js +1 -0
  43. package/dist/assets/{pdf-BbqwVBZD.js → pdf-BpJ-W-U1.js} +1 -1
  44. package/dist/assets/roleDescriptions-CoFSIkRg.js +1 -0
  45. package/dist/assets/{table-4Ca5s05D.js → table-D0yilGWI.js} +1 -1
  46. package/dist/assets/{tabs-CKnJvYvt.js → tabs-KQ0HdNTL.js} +1 -1
  47. package/dist/assets/x-BM-3QiyY.js +1 -0
  48. package/dist/index.html +6 -6
  49. package/package.json +1 -1
  50. package/dist/assets/AgentFilesTab-M_Gmg0wF.js +0 -3
  51. package/dist/assets/AnomaliesTab-w6aAZT6p.js +0 -1
  52. package/dist/assets/AuditTab-CDx_Nwt8.js +0 -1
  53. package/dist/assets/BridgeTab-DKpXqDGG.js +0 -1
  54. package/dist/assets/FeedbacksTab-C_mI4E-g.js +0 -1
  55. package/dist/assets/FilesTab-DvRSc3CJ.js +0 -1
  56. package/dist/assets/InstancesTab-CujbnLia.js +0 -1
  57. package/dist/assets/IntegrationsTab-JKwHyGIs.js +0 -1
  58. package/dist/assets/KpiTab-Cj6B_RdZ.js +0 -1
  59. package/dist/assets/PreferencesTab-COtRls1_.js +0 -1
  60. package/dist/assets/ProjectPage-M_kIwZBz.js +0 -1
  61. package/dist/assets/RolesTab-CVhPa2oT.js +0 -1
  62. package/dist/assets/ScheduledTab-CL7OPTCH.js +0 -1
  63. package/dist/assets/ServiceAccountsTab-Czg2Ojqx.js +0 -1
  64. package/dist/assets/ThemeShowroom-C__m8oUW.js +0 -1
  65. package/dist/assets/TracesTab-CFf1gMlT.js +0 -1
  66. package/dist/assets/UsersTab-CXQBxJVh.js +0 -1
  67. package/dist/assets/VoiceTab-Bbua5EQd.js +0 -1
  68. package/dist/assets/chevrons-up-down-J0DBTDYl.js +0 -1
  69. package/dist/assets/index-DzhtdTgH.js +0 -324
  70. package/dist/assets/mermaid-GHXKKRXX-CCJFSyZY.js +0 -1
  71. package/dist/assets/roleDescriptions-DRKSgXRv.js +0 -1
  72. package/dist/assets/x-AcXhdLkY.js +0 -1
@@ -0,0 +1 @@
1
+ import{_T as e,bT as t,vT as n,xT as r,yT as i}from"./api-DRlXTl06.js";var a={pending:r,user:t,admin:i,observer:n,agent:e};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-CmD2gXMO.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-DRlXTl06.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{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-CmD2gXMO.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-DzhtdTgH.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:d=`automatic`,...p}=e,m=f(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:d,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),f=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(d,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":f,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(a,{present:o||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:l(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-DRlXTl06.js";import{Gt as d,Jt as f,Kt as p,qt as m}from"./index-D48cFy6f.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:d=`automatic`,...p}=e,m=f(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:d,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),f=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(d,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":f,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(a,{present:o||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:l(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
@@ -0,0 +1 @@
1
+ import{D as e}from"./api-DRlXTl06.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,13 +62,13 @@
62
62
  document.documentElement.dataset.motion = "static";
63
63
  })();
64
64
  </script>
65
- <script type="module" crossorigin src="/assets/index-DzhtdTgH.js"></script>
65
+ <script type="module" crossorigin src="/assets/index-D48cFy6f.js"></script>
66
66
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
67
- <link rel="modulepreload" crossorigin href="/assets/api-CmD2gXMO.js">
68
- <link rel="modulepreload" crossorigin href="/assets/dist-hb3SnWuW.js">
69
- <link rel="modulepreload" crossorigin href="/assets/dist-C8ENKKAI.js">
70
- <link rel="modulepreload" crossorigin href="/assets/x-AcXhdLkY.js">
71
- <link rel="modulepreload" crossorigin href="/assets/button-CeWAnaYG.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/api-DRlXTl06.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/dist-uRF7WBqM.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/dist-BA_3OmOa.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/x-BM-3QiyY.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/button-CTuIl1H-.js">
72
72
  <link rel="stylesheet" crossorigin href="/assets/index-9JURmeVM.css">
73
73
  </head>
74
74
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.84.16",
3
+ "version": "0.84.17",
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{$d as r,$o as i,Ao as a,Do as o,Eo as s,Jd as c,Jo as l,Oo as u,QB as d,Qd as f,Qo as p,Sf as m,To as h,XB as g,Xd as _,Xo as v,Yd as y,Yo as b,Zd as x,Zo as S,_f as C,aV as w,af as T,an as E,as as D,bf as O,cf as k,cp as A,cs as j,df as M,ds as N,eN as P,ef as ee,es as F,ff as te,fs as I,gf as L,hf as ne,iV as R,if as z,is as B,jo as re,ko as V,lf as H,ls as ie,mf as ae,nV as U,nf as oe,ns as se,of as ce,op as le,os as ue,pf as de,ps as fe,qd as pe,qo as me,rf as he,rs as ge,sf as _e,ss as ve,t as W,tf as ye,ts as be,uf as xe,us as Se,vf as Ce,xf as we,yf as Te}from"./api-CmD2gXMO.js";import{t as G}from"./button-CeWAnaYG.js";import{$ as Ee,B as De,Ct as Oe,Dt as K,Et as ke,Q as Ae,St as je,Tt as Me,X as Ne,Z as Pe,at as Fe,bt as Ie,et as Le,nt as Re,ot as ze,q as Be,rt as Ve,tt as He,un as q,vt as Ue,wt as We,xt as Ge,yt as Ke}from"./index-DzhtdTgH.js";import{n as qe,t as Je}from"./curation-CQksaIbm.js";import{a as Ye}from"./compatView-BqlICbc0.js";/* empty css */var J=t(e(),1),Y=2e4,Xe=6e4;function Ze(e){return typeof e!=`number`||e<=0?0:Math.round(e/Y*100)}function Qe(e){return e<=0?0:Math.round(e/Xe*100)}function X(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function $e(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Z=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<Z&&a.push(e)):t>0&&(i+=t,o.length<Z&&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=w(W.me.getMe,{host:Be}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=w(W.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,a]=(0,J.useState)(null);(0,J.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&a(r[0].name)},[t,r,i]);let o=w(W.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),s=w(W.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),c=(0,J.useMemo)(()=>{if(e!==void 0){if(t)return i===null||o===void 0?r!==void 0&&r.length===0?[]:void 0:o.agents.map(e=>({instanceName:i,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(s!==void 0)return s.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,i,o,r,s]),[l,u]=(0,J.useState)(null);(0,J.useEffect)(()=>{!c||c.length===0||(!l||!c.some(e=>$(e)===l))&&u($(c[0]))},[c,l]);let f=c?.find(e=>$(e)===l)??null,p=U(W.agentFiles.listAgentFiles),[h,_]=(0,J.useState)({status:`idle`}),v=f?.instanceName??null,y=f?.agentId??null,b=w(W.compat.forInstance,n&&v!==null?{instanceName:v}:`skip`),x=n&&v!==null?De(b,`agentFiles`):null,S=x===null?!1:x===`loading`?null:x.blocked,T=(0,J.useCallback)(async()=>{if(!(v===null||y===null)){_({status:`loading`});try{_({status:`done`,files:(await p({instanceName:v,agentId:y})).files})}catch(e){_({status:`error`,dashboardAbsent:tt(e)})}}},[p,v,y]);(0,J.useEffect)(()=>{S===!1&&T()},[T,S]);let[D,k]=(0,J.useState)(null),A=w(W.agentFileCuration.listCurations,t&&v!==null&&y!==null?{instanceName:v,agentId:y}:`skip`),N=w(W.agentFileCuration.curationSettings,t&&v!==null?{instanceName:v}:`skip`),P=U(W.agentFileCuration.requestCuration),[ee,F]=(0,J.useState)(null),[I,R]=(0,J.useState)(null),{toast:z}=K(),B=(0,J.useMemo)(()=>{let e=new Map;for(let t of A??[])e.has(t.name)||e.set(t.name,t);return e},[A]),re=(0,J.useCallback)(async e=>{if(!(v===null||y===null)){F(e);try{let t=await P({instanceName:v,agentId:y,name:e,trigger:`manual`});t.ok?z({title:Se(),variant:`success`}):z({title:ie({reason:t.reason??`unknown`}),variant:`error`})}catch{z({title:j(),variant:`error`})}finally{F(null)}}},[P,v,y,z]),V=d(),H=(0,J.useMemo)(()=>new Intl.NumberFormat(V,{maximumFractionDigits:0}),[V]);return e===void 0||c===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Ne,{value:i??``,onValueChange:e=>a(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":we(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(Pe,{children:(r??[]).map(e=>(0,Q.jsx)(Ae,{value:e.name,children:e.name},e.name))})]}):null,c.length>0?(0,Q.jsxs)(Ne,{value:l??``,onValueChange:e=>u(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":O(),children:(0,Q.jsx)(Le,{})}),(0,Q.jsx)(Pe,{children:c.map(e=>(0,Q.jsx)(Ae,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Te()})]}),f===null?null:x===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):x!==null&&x.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,Ye(x.gatewayVersion,x.provider)]}):h.status===`loading`||h.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):h.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[h.dashboardAbsent?E():C(),` `,!h.dashboardAbsent&&(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void T(),children:le()})]}):h.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ce()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:h.files.map(e=>{let n=Ze(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(ke,{variant:`outline`,children:L()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ne({size:X(e.size,V)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:ae({pct:H.format(n)})}),r?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":de()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>k(e),children:t?M():xe()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:Je.includes(e.name),size:e.size??0,budget:N?.budgetChars??null,enabled:N?.enabled??!1,curation:B.get(e.name)??null,inFlight:ee===e.name,onCurate:()=>void re(e.name),onReview:e=>R(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:te({used:X($e(h.files),V),total:X(Xe,V),pct:H.format(Qe($e(h.files)))})})]}),D&&f?(0,Q.jsx)(at,{instanceName:f.instanceName,agentId:f.agentId,name:D.name,isAdmin:t,onClose:()=>k(null),onSaved:()=>void T()}):null,I?(0,Q.jsx)(ot,{curationId:I,onClose:()=>R(null),onApplied:()=>{R(null),T()}}):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)(G,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>s(i._id),children:I()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(ke,{variant:`outline`,className:`oc-afiles__curate-status`,children:N()}):e&&r&&n!==null&&qe(t,n)?(0,Q.jsx)(G,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:o,children:fe()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:i,onClose:a,onSaved:o}){let s=U(W.agentFiles.getAgentFile),l=U(W.agentFiles.setAgentFile),u=K(),[p,m]=(0,J.useState)(null),[h,v]=(0,J.useState)(!1),[b,S]=(0,J.useState)(``),[C,w]=(0,J.useState)(!1),[E,D]=(0,J.useState)(!1),[O,j]=(0,J.useState)(!1),[M,N]=(0,J.useState)(!1),F=(0,J.useCallback)(async r=>{v(!1);try{let i=await s({instanceName:e,agentId:t,name:n});m({content:i.content,updatedAtMs:i.updatedAtMs}),r||S(i.content),j(!1)}catch{v(!0)}},[s,e,t,n]);(0,J.useEffect)(()=>{F(!1)},[F]);async function te(){if(p!==null){D(!0),N(!1);try{await l({instanceName:e,agentId:t,name:n,content:b,baseUpdatedAtMs:p.updatedAtMs??void 0}),u.success(he({name:n})),o(),await F(!1)}catch(e){nt(e)?j(!0):N(!0)}finally{D(!1)}}}let I=p!==null&&b!==p.content,L=(0,J.useMemo)(()=>p===null?null:et(p.content,b),[p,b]),ne=b.length>Y,R=d(),B=(0,J.useMemo)(()=>new Intl.NumberFormat(R),[R]);return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>!e&&a(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(ze,{children:H({name:n})}),(0,Q.jsxs)(Ve,{children:[k({agent:t,instance:e}),i?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,_e()]})]})]}),h?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ye(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void F(!1),children:le()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:b,readOnly:!i,spellCheck:!1,onChange:e=>S(e.target.value),"aria-label":H({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ce()}),O?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ee(),` `,(0,Q.jsx)(G,{variant:`outline`,size:`sm`,onClick:()=>void F(!0),children:r()})]}):null,M?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:oe()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${ne?` is-over`:``}`,children:T({count:B.format(b.length),max:B.format(Y)})}),i?(0,Q.jsx)(G,{size:`sm`,disabled:!I||E||O,onClick:()=>w(!0),children:E?A():z()}):null]})]}),(0,Q.jsx)(Ue,{open:C,onOpenChange:w,children:(0,Q.jsxs)(Ge,{children:[(0,Q.jsxs)(We,{children:[(0,Q.jsx)(Me,{children:f({name:n})}),(0,Q.jsx)(je,{children:x({agent:t})})]}),L?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:_({added:L.added,removed:L.removed})}),L.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:y()}),L.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,L.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:c()}),L.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Oe,{children:[(0,Q.jsx)(Ie,{children:P()}),(0,Q.jsx)(Ke,{onClick:()=>void te(),children:pe()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=w(W.agentFileCuration.getProposal,{curationId:e}),c=U(W.agentFileCuration.approveCuration),f=R(W.agentFileCuration.rejectCuration),{toast:m}=K(),[_,y]=(0,J.useState)(null),[x,C]=(0,J.useState)(!1),[T,E]=(0,J.useState)(``),O=d(),k=(0,J.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function M(){y(`approve`);try{let t=await c({curationId:e});t.ok?(m({title:ve(),variant:`success`}),n()):m({title:t.reason===`conflict`?D():B({reason:t.reason??`unknown`}),variant:`error`})}catch{m({title:j(),variant:`error`})}finally{y(null)}}async function N(n){y(`reject`);try{let r=T.trim();(await f({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?m({title:n?s():ue(),variant:`success`}):m({title:be(),variant:`error`}),t()}catch{m({title:j(),variant:`error`})}finally{y(null)}}return(0,Q.jsx)(He,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Re,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Fe,{children:[(0,Q.jsx)(ze,{children:r?ge({name:r.name}):g()}),(0,Q.jsx)(Ve,{children:se()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:be()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[F({before:X(r.beforeSize,O),after:X(r.proposedSize,O)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,i()]}):null]}),k?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:p({added:k.added,removed:k.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:h({feedback:r.feedback})}):null,k&&k.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:me()}),(0,Q.jsx)(`ul`,{children:k.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:l()}),(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:S()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),x?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:re()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:a(),value:T,onChange:e=>E(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`ghost`,onClick:()=>C(!1),disabled:_!==null,children:V()}),(0,Q.jsx)(G,{variant:`outline`,onClick:()=>void N(!1),disabled:_!==null,children:_===`reject`?A():u()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void N(!0),disabled:_!==null,children:_===`reject`?A():o()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(G,{variant:`outline`,onClick:()=>C(!0),disabled:_!==null||r==null,children:v()}),(0,Q.jsx)(G,{variant:`default`,onClick:()=>void M(),disabled:_!==null||r==null,children:_===`approve`?A():b()})]})]})})}export{rt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$w as r,Aw as i,Bw as a,Cw as o,Dw as s,Ew as ee,Fw as te,Gw as ne,Hw as re,Iw as c,Jw as l,Kw as ie,Lw as u,Mw as d,Nw as ae,Ow as oe,Pw as f,Qw as se,Rw as ce,Sw as le,Tw as ue,Uw as de,Vw as fe,Ww as pe,Xw as me,Yw as he,Zw as ge,_w as p,aT as m,aV as h,bw as _e,dw as g,eT as ve,fw as _,gw as v,hw as y,iT as b,iV as ye,jw as be,kw as xe,mw as x,nT as S,oT as C,pw as w,qw as T,rT as E,t as D,tT as O,vw as k,ww as A,xw as j,yw as M,zw as Se}from"./api-CmD2gXMO.js";import{$ as N,Dt as Ce,Et as P,Gn as F,Kn as we,Q as I,U as Te,X as L,Z as R,at as z,ct as B,et as V,i as Ee,nt as H,o as De,ot as U,q as Oe,tt as W}from"./index-DzhtdTgH.js";import{n as ke}from"./TimeRangePicker-Ba4ZnAYy.js";import{t as Ae}from"./FilterBar-CXoCWT0o.js";import{t as je}from"./DataTableShell-ZXwE42Fk.js";import{t as G}from"./dispatchErrorInfo-ab4vRzyN.js";var K=t(e(),1),q=n(),J=`__all__`,Me=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ne(e){return e===`open`?C():e===`acknowledged`?m():b()}var Pe=[`info`,`warn`,`critical`],Fe=[`detector`,`agent`,`user`],Ie={kind:`relative`,from:`now-30d`,to:`now`},Le=200,Y=`all`;function X(){let e=we({from:`/settings/anomalies`}),t=F({from:`/settings/anomalies`}),n=e.q??``,p=e.status===Y?J:e.status,m=e.severity??J,g=e.kind??J,[_,v]=(0,K.useState)(J),y=Ee(e.from,e.to),{from:b,to:x}=ke(y),C=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),w=e=>void t({search:t=>({...t,status:e===J?Y:e})}),k=e=>void t({search:t=>({...t,severity:e===J?void 0:e})}),z=e=>void t({search:t=>({...t,kind:e===J?void 0:e})}),H=e=>void t({search:t=>({...t,...De(e)})}),U=Te(),W=Ce(),G=ye(D.anomalies.resolveAnomaly),X=(h(D.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),Z=h(D.anomalies.listAnomalies,{limit:Le,filter:{q:n||void 0,from:b,to:x,anomalyStatus:p===J?void 0:p,severity:m===J?void 0:m,source:_===J?void 0:_,kind:g===J?void 0:g}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),$=n!==``||p!==`open`||m!==J||_!==J||g!==J||y.kind!==`relative`||y.from!==Ie.from;function Ue(){v(J),t({search:{status:`open`},replace:!0})}async function We(e){if(await U({title:E(),description:(0,q.jsxs)(q.Fragment,{children:[S(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,O(),` `,(0,q.jsx)(`strong`,{children:ve()}),`.`,` `,r()]}),confirmLabel:se()}))try{await G({anomalyId:e._id,status:`resolved`}),W.success(ge(),e.kind)}catch(e){W.error(me(),e)}}async function Ge(e){try{await G({anomalyId:e._id,status:`acknowledged`}),W.success(he(),e.kind)}catch(e){W.error(l(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,q.jsx)(`strong`,{children:ie()}),` `,ne(),` `,(0,q.jsx)(`strong`,{children:pe()}),` `,de(),` `,(0,q.jsx)(`strong`,{children:re()}),` `,fe(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:a()})]}),(0,q.jsxs)(Ae,{q:n,onQChange:C,searchPlaceholder:Se(),timeRange:y,onTimeRangeChange:H,onReset:Ue,canReset:$,children:[(0,q.jsxs)(L,{value:p,onValueChange:w,children:[(0,q.jsx)(N,{size:`sm`,className:`w-36`,children:(0,q.jsx)(V,{})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(I,{value:J,children:ce()}),Me.map(e=>(0,q.jsx)(I,{value:e.value,children:Ne(e.value)},e.value))]})]}),(0,q.jsxs)(L,{value:m,onValueChange:k,children:[(0,q.jsx)(N,{size:`sm`,className:`w-36`,children:(0,q.jsx)(V,{placeholder:u()})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(I,{value:J,children:ae()}),Pe.map(e=>(0,q.jsx)(I,{value:e,children:e},e))]})]}),(0,q.jsxs)(L,{value:_,onValueChange:v,children:[(0,q.jsx)(N,{size:`sm`,className:`w-32`,children:(0,q.jsx)(V,{placeholder:d()})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(I,{value:J,children:be()}),Fe.map(e=>(0,q.jsx)(I,{value:e,children:e},e))]})]}),(0,q.jsxs)(L,{value:g,onValueChange:z,children:[(0,q.jsx)(N,{size:`sm`,className:`w-36`,children:(0,q.jsx)(V,{placeholder:i()})}),(0,q.jsxs)(R,{children:[(0,q.jsx)(I,{value:J,children:xe()}),Q.map(e=>(0,q.jsx)(I,{value:e,children:e},e))]})]})]}),(0,q.jsx)(je,{title:oe(),rows:Z,emptyHint:p===`open`?s():ee(),rowActions:e=>X&&e.status===`open`?[{label:ue(),onSelect:()=>void We(e)},{label:A(),onSelect:()=>void Ge(e)}]:[],columns:[{header:o(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:B(e.at)}),sort:e=>e.at},{header:i(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:c(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,q.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:f({when:B(e.firstAt)}),children:te({count:String(e.occurrenceCount)})}):(0,q.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:u(),cell:e=>(0,q.jsx)(Be,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:le(),cell:e=>(0,q.jsx)(Ve,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:d(),cell:e=>(0,q.jsx)(P,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:j(),cell:e=>(0,q.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,q.jsx)(ze,{row:e})]}),sort:e=>e.message},{header:_e(),cell:e=>(0,q.jsx)(Re,{row:e}),sort:e=>e.evidence??null},{header:M(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:He(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}var Z=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]);function Q(e){if(!Z.has(e.kind)||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function Re({row:e}){let t=F();if(e.kind===`subagent.failure`){let n=$(e);return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,k()]}):null]})}let n=Q(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,q.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,k()]})}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=G(n.dominantCode),i=n.sampleCorrelationId;return(0,q.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,q.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,q.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,q.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,k()]}):null]})}function ze({row:e}){let[t,n]=(0,K.useState)(!1),r=h(D.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[p(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(W,{open:t,onOpenChange:n,children:(0,q.jsxs)(H,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(z,{children:(0,q.jsx)(U,{children:v()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:y()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:x()}):(0,q.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,q.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,q.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,q.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Be({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function Ve({status:e}){return e===`open`?(0,q.jsx)(P,{variant:`destructive`,children:w()}):e===`acknowledged`?(0,q.jsx)(P,{variant:`secondary`,children:_()}):(0,q.jsx)(P,{variant:`outline`,children:g()})}function He(e){return e.length>8?e.slice(0,8):e}export{X as AnomaliesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,Ca as i,Da as a,Ea as o,QT as s,Sa as c,Ta as l,aE as u,aV as d,cE as f,dE as p,eE as m,fE as h,iE as g,lE as _,nE as v,oE as y,rE as b,sE as x,t as S,tE as C,uE as w,wa as T}from"./api-CmD2gXMO.js";import{$ as E,Gn as D,Kn as O,Q as k,X as A,Z as j,a as M,ct as N,et as P,i as F,n as I,o as L,s as R}from"./index-DzhtdTgH.js";import{n as ee}from"./TimeRangePicker-Ba4ZnAYy.js";import{t as z}from"./FilterBar-CXoCWT0o.js";import{t as B}from"./AdvancedFilter-C0npZhxy.js";import{t as V}from"./DataTableShell-ZXwE42Fk.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:a()},{value:`realLabel`,label:o()},{value:`targetLabel`,label:l()},{value:`impersonated`,label:T()},{value:`resource`,label:i()},{value:`resourceId`,label:c()}];function q(){let e=O({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,i=e.action??G,a=e.impersonated??G,o=e.resource??G,c=F(e.from,e.to),l=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:T,to:I}=ee(c),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...L(e)})}),Q=e=>void t({search:t=>({...t,adv:M(e)}),replace:!0}),$=d(S.admin.listAudit,{filter:{q:n||void 0,from:T,to:I,action:i===G?void 0:i,resource:o===G?void 0:o,impersonated:a===G?void 0:a===`yes`,advanced:l.length>0?l:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||i!==G||a!==G||o!==G||l.length>0||c.kind!==`relative`||c.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[h(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:p()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:w(),timeRange:c,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(A,{value:i,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:_()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:f()}),te.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]}),(0,U.jsxs)(A,{value:a,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:x()}),(0,U.jsx)(k,{value:`yes`,children:y()}),(0,U.jsx)(k,{value:`no`,children:u()})]})]}),(0,U.jsxs)(A,{value:o,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(P,{placeholder:g()})}),(0,U.jsxs)(j,{children:[(0,U.jsx)(k,{value:G,children:b()}),ne.map(e=>(0,U.jsx)(k,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:l,onChange:Q}),(0,U.jsx)(V,{title:v(),rows:$,emptyHint:C(),columns:[{header:m(),cell:e=>N(e.at),sort:e=>e.at},{header:_(),cell:e=>e.action,sort:e=>e.action},{header:r(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:s(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:g(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,Ad as i,Bb as a,Cx as o,D as s,Dd as c,Dx as l,Ed as u,Ex as d,Fb as f,Fd as p,Gb as m,Gi as h,Hb as g,Ib as _,Id as v,Jb as y,Ji as ee,Kb as b,Ki as te,Lb as ne,Mb as x,Md as re,Nb as ie,Nd as ae,Od as oe,Ox as se,Pb as ce,Pd as le,Qb as ue,Qx as de,Rb as fe,Sx as pe,Td as me,Tx as he,Ub as ge,Vb as _e,Wb as ve,Wi as ye,Xb as be,Yb as xe,Zb as Se,Zi as Ce,Zx as we,_x as Te,aS as Ee,aV as S,ax as De,bx as Oe,cS as ke,cx as Ae,dS as je,dx as Me,ex as Ne,fx as Pe,gx as Fe,hx as Ie,iS as Le,iV as Re,ix as ze,j as Be,jb as C,jd as w,kd as Ve,kx as He,lx as Ue,mx as We,nS as Ge,nV as Ke,nx as qe,oS as Je,on as Ye,ox as Xe,px as Ze,qb as Qe,qi as $e,rS as et,rx as tt,sS as nt,sx as rt,t as T,tS as it,tx as at,uS as ot,ux as st,vx as ct,wd as lt,wx as ut,xx as dt,yd as ft,yx as pt,zb as mt}from"./api-CmD2gXMO.js";import{t as ht}from"./chevrons-up-down-J0DBTDYl.js";import{i as gt,n as E,o as _t,r as vt,s as yt}from"./FieldLabel-83bK1ECz.js";import{i as bt,n as xt,r as St,t as Ct}from"./tabs-CKnJvYvt.js";import{t as D}from"./button-CeWAnaYG.js";import{$ as O,Bn as wt,Bt as Tt,Dn as Et,Dt,Et as k,F as Ot,Gn as kt,Hn as A,Kn as At,Q as j,Rn as M,Rt as jt,X as N,Z as P,at as Mt,ct as F,et as I,jt as L,lt as R,nt as Nt,ot as Pt,pn as z,q as Ft,rt as It,tt as Lt,un as B,ut as Rt,zn as zt,zt as Bt}from"./index-DzhtdTgH.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-4Ca5s05D.js";import{t as Gt}from"./FilterBar-CXoCWT0o.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-BqlICbc0.js";import{t as W}from"./dispatchErrorInfo-ab4vRzyN.js";var $t=s(`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=s(`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,r]=(0,G.useState)(dn),[i,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),i),[s,n,i]);function p(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:xe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:b(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(N,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:ve()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(j,{value:J,children:m()}),c.map(e=>(0,Z.jsx)(j,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(N,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(I,{placeholder:ge()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(j,{value:J,children:m()}),l.map(e=>(0,Z.jsx)(j,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(N,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(I,{placeholder:g()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(j,{value:J,children:m()}),u.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))]})]})]}),d.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:a(),sortKey:`target`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:mt(),sortKey:`state`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:fe(),sortKey:`instance`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:ne(),sortKey:`host`,sort:i,onSort:p}),(0,Z.jsx)(Q,{label:_(),sortKey:`version`,sort:i,onSort:p}),(0,Z.jsx)(V,{children:f()}),(0,Z.jsx)(Q,{label:ce(),sortKey:`lastOk`,sort:i,onSort:p})]})}),(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)(zt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(A,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ht,{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:y({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:R(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?` · ${R(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:[Be({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${R(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:[Qe({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?ie():e===`error`?x():C()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(k,{variant:`secondary`,children:ie()}):e===`error`?(0,Z.jsx)(k,{variant:`destructive`,children:x()}):(0,Z.jsx)(k,{variant:`outline`,children:C()})}function wn(){return S(T.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=S(T.compat.getBridgeCompat,{}),n=S(T.me.getMe,{host:Ft})?.role===`admin`,r=S(T.admin.listInstances,n?{}:`skip`),i=S(T.agents.usageForInstances,n?{}:`skip`),a=kt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=un(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=At({from:`/settings/bridge`}),l=kt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Xt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,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:Ie()}),i&&i.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:We()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:ee()}),(0,Z.jsx)(V,{children:$e()}),(0,Z.jsx)(V,{children:te()}),(0,Z.jsx)(V,{children:h()}),(0,Z.jsx)(V,{children:ye()})]})}),(0,Z.jsx)(Ut,{children:i.flatMap(e=>{let t=Ot(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)(Ct,{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)(St,{className:`w-full`,children:s.map(e=>(0,Z.jsxs)(bt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(z,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),s.map(e=>(0,Z.jsx)(xt,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ft()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let i=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,a=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,o=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)}),a?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:le(),children:[`(`,a,`)`]})]}):null,i?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ae({build:t.buildVersion??`?`})]}):null,` · `,re(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?w():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:De()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=F(e.checkedAt),p=e.startedAt==null?null:F(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(M,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(B,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?ze():l===`gateways_unreachable`?Ne({count:u.length}):c?tt():qe({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,at({time:f})]}),p?(0,Z.jsx)(`span`,{children:ue({time:p})}):null,o]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r({names:u.join(`, `)})}):null,c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:Se()})]})}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)(z,{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`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:v()}),(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)(A,{size:13,"aria-hidden":!0}):(0,Z.jsx)(wt,{size:13,"aria-hidden":!0}),be({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??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[Ze(),i.length>0?(0,Z.jsx)(k,{variant:`destructive`,children:Me({count:i.length})}):a>0?(0,Z.jsx)(k,{variant:`destructive`,children:st()}):(0,Z.jsx)(k,{variant:`secondary`,children:Pe()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[Ue({version:e.vendoredVersion}),r?` · `+Ae({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ye({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)(A,{size:13,"aria-hidden":!0}):(0,Z.jsx)(wt,{size:13,"aria-hidden":!0}),rt({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:a,providerName:o}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ve()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Ce({provider:o})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:oe({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:w()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),a.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:lt()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:a.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`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(Nt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Mt,{children:[(0,Z.jsx)(Pt,{children:je({instance:e.displayName??e.name})}),(0,Z.jsx)(It,{children:ot()})]}),(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)(B,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?pt():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,ct()]}):null}function jn({instance:e,onClose:t}){let n=Re(T.admin.upsertInstanceConfig),r=Ke(T.bridge.validateMediaPaths),i=Dt(),a=Vt(e.config?.contentLocale,void 0),[s,c]=(0,G.useState)(()=>gt(e.config??{},a)),[u,f]=(0,G.useState)(!1),[p,m]=(0,G.useState)(!1),[h,g]=(0,G.useState)(null),_=s.inboundMediaMode===`shared-fs`,v=s.mediaMode===`shared-fs`,y=_||v;async function ee(){m(!0),g(null);try{g(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(o(),e)}finally{m(!1)}}async function b(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:vt(s,r,a)}),t()}catch(e){i.error(et(),e)}finally{f(!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)(E,{label:ke(),help:Ge()}),(0,Z.jsxs)(N,{value:s.mediaMode,onValueChange:e=>c({...s,mediaMode:e}),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(P,{children:yt.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:nt(),help:it()}),(0,Z.jsxs)(N,{value:s.inboundMediaMode,onValueChange:e=>c({...s,inboundMediaMode:e}),children:[(0,Z.jsx)(O,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(I,{})}),(0,Z.jsx)(P,{children:_t.map(e=>(0,Z.jsx)(j,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:Je(),help:de()}),(0,Z.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>c({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),y&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:He(),help:se()}),(0,Z.jsx)(L,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>c({...s,inboundAgentMount:e.target.value})})]}),v&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(E,{label:l(),help:d()}),(0,Z.jsx)(L,{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)(Rt,{checked:s.rehydration,onCheckedChange:e=>c({...s,rehydration:e===!0})}),(0,Z.jsx)(E,{label:Ee(),help:we()})]}),y&&h!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:h.reachable?!h.inbound&&!h.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),Fe({reason:h.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:dt(),result:h.inbound}),(0,Z.jsx)($,{label:Oe(),result:h.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pe()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(B,{"aria-hidden":!0}),Te()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[y&&(0,Z.jsxs)(D,{variant:`outline`,size:`sm`,onClick:()=>void ee(),disabled:p,children:[p?(0,Z.jsx)(Et,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,p?ut():he()]}),(0,Z.jsx)(D,{size:`sm`,onClick:()=>void b(),disabled:u,children:Le()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(jt,{children:[(0,Z.jsx)(Tt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?c():u({count:e.length}),(0,Z.jsx)(A,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Bt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:me()}),(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{$O as r,AO as i,Ak as a,BO as o,Ck as s,Dk as c,Ek as l,FO as u,GO as d,HO as f,IO as p,JO as ee,KO as te,LO as m,MO as h,Mk as g,NO as _,Ok as v,PO as y,QO as ne,RO as re,Sk as ie,Tk as b,UO as x,VO as S,WO as C,XO as w,YO as T,ZO as E,_k as D,_s as O,aV as k,ak as A,bk as j,ck as M,dk as N,ek as P,fk as F,gk as I,hk as L,iV as R,ik as z,jO as B,jk as V,kk as H,lk as ae,mk as U,nk as W,ok as G,pk as K,qO as q,rk as J,sk as oe,t as Y,tk as se,uk as ce,vk as le,wk as ue,xk as de,yk as fe,ys as pe,zO as me}from"./api-CmD2gXMO.js";import{t as he}from"./button-CeWAnaYG.js";import{U as ge,ct as _e}from"./index-DzhtdTgH.js";import{t as ve}from"./DataTableShell-ZXwE42Fk.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>g(),incorrect:()=>V(),incoherence:()=>a(),formatting:()=>H(),latency:()=>v(),api_error:()=>c(),other:()=>l()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ue()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:s()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:b()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=R(Y.feedback.respondToFeedback),[a,o]=(0,X.useState)(e.thread),[s,c]=(0,X.useState)(``),[l,u]=(0,X.useState)(!1);async function d(){let t=s.trim();if(!(!t||l)){u(!0);try{await i({feedbackId:e._id,text:t}),o(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),c(``)}finally{u(!1)}}}let f=[];try{f=r.contextJson?JSON.parse(r.contextJson):[]}catch{f=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${ie()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:w(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:de()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:p()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),a.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:a.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Z.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?fe():e.authorRole===`agent`?e.authorLabel??pe():le()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:D()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:I(),value:s,maxLength:2e3,rows:3,onChange:e=>c(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(he,{size:`sm`,onClick:()=>void d(),disabled:!s.trim()||l,children:l?L():U()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||F()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:N()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||F()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ce()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,f.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ae({count:r.contextCount??f.length,truncated:r.contextTruncated?M():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:f.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:oe()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:G()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?z({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[J(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,W()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=k(Y.feedback.listForAdmin,{}),t=R(Y.feedback.readSnapshot),n=R(Y.feedback.deleteFeedback),a=ge(),[s,c]=(0,X.useState)(null),[l,p]=(0,X.useState)({});async function g(e){if(s===e._id){c(null);return}if(!l[e._id]){let n=await t({feedbackId:e._id});p(t=>({...t,[e._id]:n}))}c(e._id)}async function v(e){await a({title:h(),description:B(),confirmLabel:i(),destructive:!0})&&(await n({feedbackId:e._id}),s===e._id&&c(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[se(),` `,(0,Z.jsx)(`strong`,{children:P()}),` `,r()]}),(0,Z.jsx)(ve,{title:ne(),rows:e,emptyHint:E(),isExpanded:e=>s===e._id&&!!l[e._id],renderExpanded:e=>l[e._id]?(0,Z.jsx)(be,{data:l[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:T(),cell:e=>_e(e.at),sort:e=>e.at},{header:ee(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:q(),cell:e=>e.messageRole===`user`?te():d(),sort:e=>e.messageRole},{header:C(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${x({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:f(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:S(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:o(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:me()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:re()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:O()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:m()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:s===e._id?u():y(),onSelect:()=>void g(e)},{label:_(),onSelect:()=>void v(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$z as ee,Bz as r,Cs as i,Gz as te,Hz as ne,Iz as re,Jz as ie,Kz as ae,Lz as oe,QB as a,Qz as o,Rz as s,Ss as c,Uz as l,Vz as u,Wz as d,XB as se,Xz as ce,Yz as le,Zz as ue,_B as de,aB as f,aV as fe,cB as pe,dB as me,eB as p,eN as he,fB as ge,gB as _e,hB as ve,iB as m,iV as ye,lB as be,mB as h,nB as g,oB as _,pB as v,qz as y,rB as b,sB as x,t as S,tB as C,uB as w,zz as T}from"./api-CmD2gXMO.js";import{t as E}from"./button-CeWAnaYG.js";import{$ as D,Ct as O,Dt as k,Et as A,Fn as j,Lt as M,Mt as N,Nt as xe,Pn as Se,Pt as P,Q as F,St as Ce,Tt as we,X as I,Z as L,bt as Te,dn as Ee,et as R,hn as De,ut as Oe,vt as ke,wt as Ae,xt as je,yt as Me}from"./index-DzhtdTgH.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-4Ca5s05D.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return _();case`audio`:return f();case`video`:return m();case`pdf`:return b();case`document`:return g();case`archive`:return C();default:return p()}}function K(){let[e,t]=(0,H.useState)(W),[n,f]=(0,H.useState)(W),[p,m]=(0,H.useState)(W),[g,_]=(0,H.useState)(W),[b,C]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=ye(S.files.softDelete),Y=k();function Ie(){t(W),f(W),m(W),_(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(l())}catch(e){Y.error(ne(),e)}}let X=fe(S.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:p===W?void 0:p,category:g===W?void 0:g,includeAutoGenerated:b||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(a(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:se()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||p!==W||g!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:de()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":_e(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:ve()}),(0,U.jsx)(F,{value:`inbound`,children:h()}),(0,U.jsx)(F,{value:`outbound`,children:v()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:f,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":ge(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:me()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:p,onValueChange:m,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":w(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:be()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:g,onValueChange:_,children:[(0,U.jsx)(D,{size:`sm`,"aria-label":pe(),children:(0,U.jsx)(R,{})}),(0,U.jsxs)(L,{children:[(0,U.jsx)(F,{value:W,children:x()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:b,onCheckedChange:e=>C(e===!0),"aria-label":i()}),(0,U.jsx)(`span`,{children:i()})]}),$?(0,U.jsxs)(E,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(De,{size:14,"aria-hidden":!0}),ae()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?oe():s()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:ee()}),(0,U.jsx)(z,{children:o()}),(0,U.jsx)(z,{children:ue()}),(0,U.jsx)(z,{children:ce()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{className:`text-right`,children:ie()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(A,{variant:`outline`,style:{marginLeft:6},children:c()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(A,{variant:`secondary`,children:e.direction===`inbound`?h():v()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(N,{children:[(0,U.jsx)(M,{asChild:!0,children:(0,U.jsx)(E,{variant:`ghost`,size:`icon`,"aria-label":te(),children:(0,U.jsx)(Se,{size:16})})}),(0,U.jsxs)(xe,{align:`end`,children:[e.url?(0,U.jsx)(P,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(j,{size:14}),y()]})}):(0,U.jsxs)(P,{disabled:!0,children:[(0,U.jsx)(j,{size:14}),T()]}),(0,U.jsxs)(P,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),d()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:re({cap:Be})}):null]}),(0,U.jsx)(ke,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(je,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(we,{children:u()}),(0,U.jsx)(Ce,{children:r()})]}),(0,U.jsxs)(O,{children:[(0,U.jsx)(Te,{children:he()}),(0,U.jsx)(Me,{onClick:()=>void Le(),children:d()})]})]})})]})}export{K as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$D as i,$E as a,$i as o,$x as s,AD as c,AE as l,Ac as u,BD as d,BE as f,CD as p,CE as m,DD as h,DE as g,ED as _,EE as v,FD as ee,FE as y,G as b,GD as x,GE as S,H as te,HD as ne,HE as C,ID as re,J as ie,JD as ae,JE as w,K as oe,KD as se,KE as T,LD as ce,LE as E,MD as le,ME as ue,ND as de,NE as fe,OD as pe,OE as me,Oc as he,PD as ge,PE as _e,Q as ve,QD as ye,QE as be,RD as xe,RE as Se,SD as Ce,SE as we,TD as Te,TE as Ee,U as De,UD as Oe,UE as ke,VD as Ae,VE as je,W as Me,WD as Ne,WE as Pe,X as Fe,XD as Ie,XE as Le,Y as Re,YD as ze,YE as Be,Z as Ve,ZD as He,ZE as Ue,_D as We,_E as Ge,aD as Ke,aV as D,bD as qe,bE as Je,cD as O,dD as Ye,eD as Xe,eO as Ze,eS as Qe,ea as $e,et,fD as tt,gD as nt,gE as rt,hD as it,hE as at,iD as ot,iV as k,it as st,jD as ct,jE as lt,jc as ut,kD as dt,kE as ft,kc as pt,lD as mt,mD as ht,mE as gt,nD as _t,nO as vt,nP as yt,nV as A,nt as bt,oD as xt,pD as St,pE as Ct,q as wt,qD as Tt,qE as Et,rD as Dt,rP as Ot,rt as kt,sD as At,t as j,tD as jt,tO as Mt,ta as Nt,tt as Pt,uD as Ft,vD as M,vE as It,wD as Lt,wE as Rt,xD as zt,xE as Bt,yD as N,yE as Vt,zD as Ht,zE as Ut}from"./api-CmD2gXMO.js";import{a as Wt,c as Gt}from"./FieldLabel-83bK1ECz.js";import{t as P}from"./button-CeWAnaYG.js";import{$ as F,Bt as Kt,Dt as I,Et as L,Q as R,Rt as qt,U as Jt,X as z,Z as B,_ as Yt,at as V,et as H,jt as U,nt as W,ot as G,rt as K,tt as q,ut as J,zt as Xt}from"./index-DzhtdTgH.js";import{t as Zt}from"./DataTableShell-ZXwE42Fk.js";import{InstanceConfigDialog as Qt}from"./BridgeTab-DKpXqDGG.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],$t=new Set(X),en=`conversational`;function tn(e){let t=new Set((e??[]).filter(e=>$t.has(e)));return t.size===0?[en]: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`,systemIdentity:``,streamTransport:Wt},nn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function rn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`}}function an(){let e=D(j.admin.listInstances,{}),t=D(j.agents.listAllInstanceAgents,{}),n=k(j.admin.upsertInstance),a=k(j.admin.deleteInstance),l=I(),[u,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(Q),[g,v]=(0,Y.useState)(null),[y,S]=(0,Y.useState)(null),[C,w]=(0,Y.useState)(null),[T,E]=(0,Y.useState)(null);async function ue(){try{await n({instanceId:T??void 0,name:p.name,gatewayUrl:p.gatewayUrl,bridgeUrl:p.bridgeUrl||void 0,displayName:p.displayName||void 0,kind:p.kind,transport:p.kind===`hermes`?p.transport:void 0,gatewayVersion:p.gatewayVersion||void 0,gatewayHttpUrl:p.gatewayHttpUrl||void 0,...p.kind===`openclaw`?{authMode:p.authMode,personScopes:p.personScopes,identitySource:p.identitySource,systemIdentity:p.systemIdentity||void 0}:{},streamTransport:p.streamTransport}),m(Q),E(null),f(!1)}catch(e){l.error(Ze(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[i(),(0,Z.jsx)(`strong`,{children:ye()}),He()]}),(0,Z.jsx)(Zt,{title:Ie(),rows:e,addLabel:ze(),onAdd:()=>{E(null),m(Q),f(!0)},emptyHint:ae(),columns:[{header:Tt(),cell:e=>e.name,sort:e=>e.name},{header:se(),cell:e=>(0,Z.jsx)(L,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:x(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:Ne(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:vt(),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)(L,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?gt():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:d(),onSelect:()=>{E(e._id),m(rn(e)),f(!0)}},{label:Mt(),onSelect:()=>v(e.name)},{label:Te(),onSelect:()=>w(e)},{label:Oe(),onSelect:()=>S(e)},{label:ne(),variant:`destructive`,onSelect:()=>void a({instanceId:e._id})}],bulkActions:[{label:ne(),variant:`destructive`,onSelect:e=>e.forEach(e=>void a({instanceId:e}))}]}),(0,Z.jsx)(Yt,{open:u,onOpenChange:f,title:T?Ht():Ae(),description:ce(),canSubmit:!!(p.name&&p.gatewayUrl),onSubmit:ue,submitLabel:re(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:ee(),children:[(0,Z.jsx)(U,{value:p.name,disabled:T!==null,onChange:e=>m({...p,name:e.target.value})}),T?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:xe()}):null]}),(0,Z.jsx)($,{label:ge(),children:(0,Z.jsxs)(z,{value:p.kind,onValueChange:e=>m({...p,kind:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(R,{value:`hermes`,children:`Hermes`})]})]})}),p.kind===`hermes`?(0,Z.jsx)($,{label:Nt(),children:(0,Z.jsxs)(z,{value:p.transport,onValueChange:e=>m({...p,transport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`ws`,children:$e()}),(0,Z.jsx)(R,{value:`rest`,children:o()})]})]})}):null,(0,Z.jsx)($,{label:de(),children:(0,Z.jsx)(U,{value:p.gatewayUrl,onChange:e=>m({...p,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:le(),children:(0,Z.jsx)(U,{value:p.bridgeUrl,placeholder:ct(),onChange:e=>m({...p,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:c(),children:(0,Z.jsx)(U,{value:p.displayName,onChange:e=>m({...p,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:Qe(),children:[(0,Z.jsxs)(z,{value:p.streamTransport,onValueChange:e=>m({...p,streamTransport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsx)(B,{children:Gt.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:s()})]}),(0,Z.jsx)($,{label:dt(),children:(0,Z.jsx)(U,{value:p.gatewayVersion,placeholder:pe(),onChange:e=>m({...p,gatewayVersion:e.target.value})})}),p.kind===`openclaw`?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)($,{label:ie(),children:[(0,Z.jsxs)(z,{value:p.authMode,onValueChange:e=>m({...p,authMode:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`token`,children:wt()}),(0,Z.jsx)(R,{value:`trusted-proxy`,children:oe()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:p.authMode===`trusted-proxy`?Me():b()})]}),p.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:st(),children:[(0,Z.jsxs)(z,{value:p.personScopes,onValueChange:e=>m({...p,personScopes:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`capped`,children:kt()}),(0,Z.jsx)(R,{value:`full`,children:bt()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:p.personScopes===`full`?et():Pt()})]}):null,p.authMode===`trusted-proxy`?(0,Z.jsxs)($,{label:r(),children:[(0,Z.jsxs)(z,{value:p.identitySource,onValueChange:e=>m({...p,identitySource:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`canonical`,children:ve()}),(0,Z.jsx)(R,{value:`email`,children:Ve()})]})]}),(0,Z.jsx)(`p`,{className:`oc-field__hint`,children:p.identitySource===`email`?Re():Fe()})]}):null,p.authMode===`trusted-proxy`?(0,Z.jsx)($,{label:De(),children:(0,Z.jsx)(U,{value:p.systemIdentity,placeholder:te(),onChange:e=>m({...p,systemIdentity:e.target.value})})}):null]}):null,(0,Z.jsx)($,{label:h(),children:(0,Z.jsx)(U,{value:p.gatewayHttpUrl,placeholder:_(),onChange:e=>m({...p,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(hn,{instanceName:g,open:g!==null,onOpenChange:e=>{e||v(null)}}),y?(0,Z.jsx)(Qt,{instance:y,onClose:()=>S(null)},y._id):null,C?(0,Z.jsx)(on,{instance:C,onClose:()=>w(null)},C._id):null]})}function on({instance:e,onClose:t}){let n=D(j.instanceSecrets.listInstanceSecretStatus,{}),r=nn[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)(q,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(W,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:Lt({instance:e.displayName??e.name})}),(0,Z.jsx)(K,{children:p()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(ln,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(cn,{instance:e})}),(0,Z.jsx)(sn,{instance:e})]})})}function sn({instance:e}){let t=A(j.instanceSync.forceInstanceSync),n=I(),[r,i]=(0,Y.useState)(!1);async function o(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Dt());break;case`no_agents`:n.success(jt());break;case`no_bridge_url`:n.error(Xe());break;case`deploy_misconfigured`:n.error(a());break;case`unauthorized`:n.error(Ue());break;case`not_served`:n.error(Le());break;default:n.error(be());break}}catch(e){n.error(_t(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?ot():Ke()})})]})}function cn({instance:e}){let t=D(j.bridgeAuth.listBridgeAuthStatus,{}),n=A(j.bridgeAuth.mintBridgeSecret),r=k(j.bridgeAuth.revokeBridgeSecret),i=I(),[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(!1),d=(t??[]).find(t=>t.instanceId===e._id),p=d!==void 0;async function m(){if(!a){o(!0);try{c((await n({instanceId:e._id})).plaintext),u(!1)}catch(e){i.error(C(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),c(null),i.success(ke())}catch(e){i.error(C(),e)}finally{o(!1)}}}async function g(){if(s)try{await navigator.clipboard.writeText(s),u(!0)}catch{}}return(0,Z.jsxs)($,{label:w(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Et()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:p?`outline`:`secondary`,children:p?`${N()} · ${d.prefix}…${d.lastFour}`:M()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?S():T()}),p?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:Pe()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:je()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:l?Ot():yt()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{c(null),u(!1)},children:f()})]}):null]})}function ln({instanceId:e,field:t,updatedAt:n}){let r=A(j.instanceSecrets.setInstanceSecret),i=k(j.instanceSecrets.clearInstanceSecret),a=A(j.deviceIdentity.generateDeviceIdentity),o=I(),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[d,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=n!==null,_=t===`deviceIdentity`,v=t===`token`?Ce():t===`deviceIdentity`?zt():qe();async function ee(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),p(null),h(!1),o.success(St())}catch(e){o.error(tt(),e)}finally{u(!1)}}}async function y(){if(!l){u(!0);try{await i({instanceId:e,field:t}),p(null),h(!1),o.success(Ye())}catch(e){o.error(tt(),e)}finally{u(!1)}}}async function b(){if(!l){u(!0);try{p(await a({instanceId:e})),h(!1),o.success(O())}catch(e){o.error(xt(),e)}finally{u(!1)}}}let x=d?`openclaw devices approve ${d.id}`:``;async function S(){if(x)try{await navigator.clipboard.writeText(x),h(!0)}catch{}}return(0,Z.jsxs)($,{label:v,children:[_?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:mt()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:g?`outline`:`secondary`,children:g?N():M()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:g?nt():We(),onChange:e=>c(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void ee(),disabled:l||s.trim().length===0,children:it()}),_?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void b(),disabled:l,children:Ft()}):null,g?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void y(),disabled:l,children:ht()}):null]})]}),d?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:O()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:At()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:x}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:m?Ot():yt()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{p(null),h(!1)},children:f()})]}):null]})}var un={conversational:ft,documentary:g,summarizer:ut,curator:pt},dn={conversational:me,documentary:v,summarizer:u,curator:he},fn=e=>(un[e]??(()=>e))(),pn=e=>(dn[e]??(()=>``))();function mn({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:fe()}),t.map(e=>(0,Z.jsx)(L,{variant:`secondary`,className:`oc-agenttype__chip`,title:pn(e),children:fn(e)},e)),(0,Z.jsxs)(qt,{children:[(0,Z.jsx)(Kt,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ue()})}),(0,Z.jsxs)(Xt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:lt()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:l()}),(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)(J,{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:fn(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:pn(r)})]})]},r)})})]})]})]})}function hn({instanceName:e,open:t,onOpenChange:n}){let r=D(j.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=k(j.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(j.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(j.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=k(j.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(j.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(j.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=k(j.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(j.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=tn(r);e.setQuery(j.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=k(j.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(j.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(j.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=k(j.agents.removeInstanceAgent),l=Jt(),u=I();async function d(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){u.error(E(),e)}}async function f(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){u.error(E(),e)}}async function p(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){u.error(E(),e)}}async function h(t,n){if(e&&await l({title:m({name:n}),description:we(),confirmLabel:Bt(),destructive:!0}))try{await c({instanceName:e,agentId:t}),u.success(Je())}catch(e){u.error(E(),e)}}return(0,Z.jsx)(q,{open:t,onOpenChange:n,children:(0,Z.jsxs)(W,{className:`oc-access`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:Ut({name:e??``})}),(0,Z.jsx)(K,{children:Se()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:Vt()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?It():r.discovery.lastPollOk?Ge():rt({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:at()}):(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)(J,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void d(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:Ct()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void h(t.agentId,a),children:Rt()})]}):i?(0,Z.jsx)(L,{variant:`default`,children:gt()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void f(t.agentId),children:Ee()})]}),t.enabled?(0,Z.jsx)(mn,{agentId:t.agentId,types:o,onToggle:e=>void p(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(gn,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){u.error(E(),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)(U,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:y(),"aria-label":_e(),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{an as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bk as r,Fk as i,Gk as a,Gl as o,Hk as s,Ik as c,Jl as l,Kk as u,Kl as d,Lk as f,Pk as p,Ql as m,Rk as h,Uk as g,Vk as _,Wk as v,Wl as y,Xl as b,Yl as x,Zl as S,aV as C,iV as w,nV as T,qk as E,ql as D,t as O,zk as k}from"./api-CmD2gXMO.js";import{t as A}from"./button-CeWAnaYG.js";import{Et as j,jt as M,ut as N}from"./index-DzhtdTgH.js";var P=t(e(),1),F=n();function I(){let e=C(O.integrations.status.status,{}),t=w(O.admin.setIntegrationConfig),[n,o]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&o(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:E()});let l=n,d=(e,t,n)=>o({...l,[e]:{...l[e],[t]:n}}),y=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[u(),` `,(0,F.jsx)(`strong`,{children:a()}),` `,v()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:s()}):(0,F.jsx)(j,{variant:`outline`,children:_()}),note:r(),children:[(0,F.jsx)(R,{label:h(),children:(0,F.jsx)(M,{value:l.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>d(`langfuse`,`host`,e.target.value),onBlur:()=>y(`langfuse`,{host:l.langfuse.host??``})})}),(0,F.jsx)(z,{label:p(),checked:l.langfuse.enabled??!0,onChange:e=>{d(`langfuse`,`enabled`,e),y(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:s()}):(0,F.jsx)(j,{variant:`outline`,children:_()}),note:k(),children:[(0,F.jsx)(R,{label:f(),children:(0,F.jsx)(M,{value:l.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>d(`opik`,`baseUrl`,e.target.value),onBlur:()=>y(`opik`,{baseUrl:l.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:c(),children:(0,F.jsx)(M,{value:l.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||i(),onChange:e=>d(`opik`,`workspace`,e.target.value),onBlur:()=>y(`opik`,{workspace:l.opik.workspace??``})})}),(0,F.jsx)(z,{label:p(),checked:l.opik.enabled??!0,onChange:e=>{d(`opik`,`enabled`,e),y(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(j,{variant:`secondary`,children:g()}):(0,F.jsx)(j,{variant:`outline`,children:s()}):(0,F.jsx)(j,{variant:`outline`,children:m()}),note:S(),children:[(0,F.jsx)(R,{label:b(),children:(0,F.jsx)(M,{value:l.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>d(`otlp`,`endpoint`,e.target.value),onBlur:()=>y(`otlp`,{endpoint:l.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:p(),checked:l.otlp.enabled??!0,onChange:e=>{d(`otlp`,`enabled`,e),y(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(N,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=T(O.integrations.otlpSecret.setOtlpHeaders),n=w(O.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,s]=(0,P.useState)(null),[c,u]=(0,P.useState)(!1),f=async()=>{u(!0),s(null);try{await t({headersJson:r}),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,F.jsxs)(R,{label:x(),children:[(0,F.jsx)(M,{value:r,placeholder:e?l():D(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void f(),children:d()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:o()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:y()})]})}export{I as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AA as r,OA as i,_b as a,aV as o,ab as s,bA as c,cb as l,db as u,fb as d,gb as f,hb as p,ib as m,jA as h,kA as g,lb as _,mb as ee,nj as te,ob as ne,pb as v,rb as y,sb as b,t as x,ub as S,xA as C}from"./api-CmD2gXMO.js";import{Gn as w,Kn as T,i as E,o as re,q as ie,r as D}from"./index-DzhtdTgH.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-C-qzU79p.js";import{n as N,t as P}from"./TimeRangePicker-Ba4ZnAYy.js";var F=t(e(),1),I={API_CALLS:`api.calls`,API_ERRORS:`api.errors`,API_LATENCY_AVG_MS:`api.latency.avg_ms`,OPENCLAW_INGEST:`openclaw.ingest`,CHAT_SEND:`chat.send`,ASSISTANT_STREAM_ERRORS:`assistant.stream.errors`,ASSISTANT_ANNOUNCE_ERRORS:`assistant.announce.errors`,CONVEX_PROBE_LATENCY_AVG_MS:`convex.probe.latency.avg_ms`},L=Object.keys(I).length,R=n(),z=15,B=e=>String(Math.round(e));function V(){let e=o(x.me.getMe,{host:ie})?.permissions?.includes(`traces.read`)??!1,t=o(x.deliveryTiming.listDeliverySessions,e?{}:`skip`),n=(0,F.useMemo)(()=>t?t.filter(e=>!e.active&&e.rollup!==null&&e.rollup.cP50!==null&&e.rollup.aP50!==null).slice(0,z).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:te()}),(0,R.jsxs)(M,{children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{children:h()}),(0,R.jsx)(j,{children:g()})]}),(0,R.jsx)(k,{children:n.length<2?(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,R.jsx)(H,{series:n})})]})]})}function H({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),i=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),o=e=>74-e*68/i,s=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${o(e).toFixed(1)}`).join(` `),l=e[e.length-1];return(0,R.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,R.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,R.jsxs)(`span`,{style:{color:`var(--primary)`},children:[c(),` p50 `,B(l.cP50),` `,r()]}),(0,R.jsxs)(`span`,{children:[C(),` p50 `,B(l.aP50),` `,r()]})]}),(0,R.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":h(),children:[(0,R.jsx)(`path`,{d:s(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,R.jsx)(`path`,{d:s(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var U=[{metric:`api.calls`,label:a(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:f(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:p(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:ee(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:v(),unit:`/h`,group:`Chat`,isError:!1},{metric:I.ASSISTANT_STREAM_ERRORS,label:d(),unit:`/h`,group:`Assistant`,isError:!0},{metric:I.ASSISTANT_ANNOUNCE_ERRORS,label:u(),unit:`/h`,group:`Assistant`,isError:!0}],W=L,G=[`API`,`OpenClaw`,`Chat`,`Assistant`],K=1e3,q=36e5;function J(e,t){let n=Math.max(1,Math.ceil((t-e)/q)),r=Math.min(n*W,K);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/W))}}function ae(){let e=T({from:`/settings/kpi`}),t=w({from:`/settings/kpi`}),n=E(e.from,e.to,D,`now`),r=e=>void t({search:t=>({...t,...re(e)})}),{from:i,to:a}=N(n),{rowLimit:s,buckets:c}=J(i,a),u=o(x.kpi.listKpis,{limit:s,filter:{from:i,to:a}}),d=(0,F.useMemo)(()=>{let e=new Map;for(let t of u??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>c&&e.set(t,n.slice(n.length-c));return e},[u,c]),f=(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,R.jsx)(`span`,{className:`oc-filter__window`,children:_()})]}),(0,R.jsx)(Y,{value:n,onChange:r})]});return u===void 0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:l()})]}):u.length===0?(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),(0,R.jsx)(`p`,{className:`oc-admin__hint`,children:b()})]}):(0,R.jsxs)(R.Fragment,{children:[f,(0,R.jsx)(V,{}),G.map(e=>{let t=U.filter(t=>t.group===e);return t.some(e=>(d.get(e.metric)??[]).length>0)?(0,R.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,R.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,R.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,R.jsx)(oe,{config:e,series:d.get(e.metric)??[]},e.metric))})]},e):null})]})}function Y({value:e,onChange:t}){return(0,R.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,R.jsx)(P,{value:e,onChange:t})})}function oe({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,r=n?n.value:0;return(0,R.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,R.jsxs)(O,{children:[(0,R.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,R.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,R.jsx)(`code`,{children:e.metric})})]}),(0,R.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,R.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,R.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&r>0?` oc-kpi__value--error`:``),children:Q(r)}),(0,R.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,R.jsx)(ce,{series:t,isError:e.isError,unit:e.unit}),(0,R.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,R.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:ne({value:$(n.bucket)})}):(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:s()}),(0,R.jsx)(`span`,{className:`oc-kpi__muted`,children:m({count:t.length})})]})]})]})}var X=240,Z=48,se=1;function ce({series:e,isError:t,unit:n}){if(e.length===0)return(0,R.jsx)(`div`,{className:`oc-kpi__chart oc-kpi__chart--empty`,"aria-hidden":!0});let r=e.reduce((e,t)=>t.value>e?t.value:e,0),i=X/e.length,a=Math.max(i-se,1);return(0,R.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":y({max:Q(r),unit:n}),children:e.map((e,o)=>{let s=r>0?e.value/r*(Z-1):0,c=o*i,l=Z-s;return(0,R.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,R.jsxs)(`title`,{children:[$(e.bucket),` · `,Q(e.value),` `,n]})},e.bucket)})})}function Q(e){return Number.isFinite(e)?Math.abs(e)>=1e3?(e/1e3).toFixed(e%1e3==0?0:1)+`k`:String(e):`0`}function $(e){let t=new Date(`${e}:00:00Z`);return Number.isNaN(t.getTime())?e:`${String(t.getUTCDate()).padStart(2,`0`)}/${String(t.getUTCMonth()+1).padStart(2,`0`)} ${String(t.getUTCHours()).padStart(2,`0`)}h`}export{ae as KpiTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,$n as i,AB as a,AF as o,BB as s,BF as c,CB as l,CF as u,DB as d,DF as f,EB as p,EF as m,FB as ee,FF as h,GB as te,GF as ne,HB as re,HF as ie,IB as ae,ID as oe,IF as se,JF as ce,Jn as le,KF as ue,LB as de,LF as fe,MB as pe,MF as me,NB as he,NF as ge,OB as _e,OF as g,PB as ve,PF as _,QF as v,Qn as y,RB as b,RF as x,SB as S,SF as C,TB as w,TF as T,UF as E,VB as D,VF as O,WF as k,XB as A,XF as j,Xn as M,YF as N,Yn as P,ZF as F,Zn as ye,_F as be,aV as I,bB as xe,bF as Se,eI as Ce,er as we,gF as Te,hF as Ee,hr as De,iV as L,jB as Oe,jF as ke,kB as Ae,kF as je,lr as Me,mr as Ne,qF as Pe,r as R,t as z,tr as Fe,vF as Ie,wB as Le,wF as B,xB as Re,xF as ze,yB as Be,yF as Ve,zB as He,zF as Ue}from"./api-CmD2gXMO.js";import{t as V}from"./button-CeWAnaYG.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-DzhtdTgH.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-DXwy6QXD.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:()=>Ce()},{id:`composer`,label:()=>r()},{id:`sidebar`,label:()=>v()},{id:`notifications`,label:()=>h()},{id:`other`,label:()=>F()}],X={showSource:{category:`messages`,label:()=>j(),help:()=>N()},showReport:{category:`messages`,label:()=>ce(),help:()=>Pe()},copyAssistant:{category:`messages`,label:()=>ue()},copyUser:{category:`messages`,label:()=>ne()},showDelete:{category:`messages`,label:()=>k()},showTools:{category:`messages`,label:()=>E(),help:()=>ie()},voiceInput:{category:`composer`,label:()=>O(),help:()=>c()},showUsage:{category:`composer`,label:()=>Ue(),help:()=>x()},autoReadAloud:{category:`composer`,label:()=>De(),help:()=>Ne()},showChatAge:{category:`sidebar`,label:()=>fe(),help:()=>se()},notifSound:{category:`notifications`,label:()=>_(),help:()=>ge()},notifSystem:{category:`notifications`,label:()=>me(),help:()=>ke()},replySound:{category:`notifications`,label:()=>o(),help:()=>je()}};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:()=>Ve()};function ut({prefKey:e,ui:t}){let n=L(z.admin.setUiPrefDefault),r=L(z.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:u()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:be()}),(0,J.jsx)(U,{value:`off`,children:Te()}),(0,J.jsx)(U,{value:`inherit`,children:Ee()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":C()}),C()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=L(z.me.setDictationShortcut),[r,a]=(0,q.useState)(!1),[o,s]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(s(!0),window.setTimeout(()=>s(!1),1800));return}a(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[Fe(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:o?y():r?i():we()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:le()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?P():e?M():ye()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=I(z.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=L(z.me.setUiPref).withOptimisticUpdate(Je),c=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":B()}),B()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:ze()}),(0,J.jsx)(`p`,{children:Se()}),(0,J.jsx)(`p`,{children:Ie()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:g(),"aria-label":g(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:f()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:m()}):l?(0,J.jsx)(H,{variant:`secondary`,children:Me()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:T()}):null,(0,J.jsx)(nt,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:A()})}var pt={sm:()=>a(),md:()=>Ae(),lg:()=>_e(),xl:()=>d(),"2xl":()=>p(),"3xl":()=>w()};function mt(){let e=I(z.me.getMe,{host:G}),t=L(z.me.setLocale),n=L(z.me.setTimezone),r=L(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:G});n&&e.setQuery(z.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=L(z.me.setMyName),a=Ke(),o=e?.locale??`default`,c=e?.name??``,[u,d]=(0,q.useState)(null),f=u??c,p=f.trim()!==c.trim();async function m(){try{await i({name:f}),d(null),a.success(b())}catch(e){a.error(de(),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:re()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:D()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:f,maxLength:120,placeholder:s(),onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&p&&(e.preventDefault(),m())}}),(0,J.jsx)(V,{size:`sm`,disabled:!p,onClick:()=>void m(),children:oe()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:He()})]}),(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:ae()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(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:te()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(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:Le()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:l()})]}),(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:S()})]}),(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:he()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(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:Be()})]}),(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{$v as r,Av as i,Ay as a,Bv as o,By as s,Ct as c,Cy as l,D as u,Dy as d,Fv as ee,Hv as f,Iv as te,Jv as p,Kv as m,Lv as h,Mv as g,Nv as _,Ny as v,Pv as ne,Py as y,Qv as b,Rg as re,Rv as x,Ry as ie,St as ae,Sy as oe,Ty as se,Vv as ce,XB as S,Yv as C,Zv as le,_y as w,aV as T,ay as E,cy as ue,dy as de,ey as fe,fy as D,gy as pe,hy as me,iV as O,iy as he,jy as ge,ly as _e,ny as ve,oy as k,py as ye,qv as A,ry as be,sy as xe,t as j,ty as Se,uy as M,vy as N,wy as Ce,xy as we,yy as P,zy as Te}from"./api-CmD2gXMO.js";import{t as Ee}from"./list-CvqgTGVJ.js";import{t as F}from"./button-CeWAnaYG.js";import{A as De,An as Oe,Bn as ke,C as Ae,D as I,Dt as je,E as Me,Ft as Ne,Gn as L,Hn as Pe,It as Fe,J as Ie,Kn as Le,Lt as Re,Mn as ze,Mt as Be,Nn as Ve,Nt as He,O as R,P as Ue,Pn as We,Pt as z,S as Ge,Sn as Ke,T as qe,Tn as Je,U as Ye,W as Xe,Y as Ze,_ as Qe,b as B,bn as $e,d as et,dn as tt,f as nt,g as rt,h as V,j as H,jn as U,jt as W,k as it,kn as G,m as at,p as ot,qn as st,v as K,vn as ct,w as lt,wn as ut,x as q,y as dt,yn as J}from"./index-DzhtdTgH.js";var ft=u(`columns-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`M15 3v18`,key:`14nvp0`}]]),pt=u(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),mt=u(`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=u(`panel-left`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}]]),X=t(e(),1),Z=n();function ht({className:e}){return(0,Z.jsx)(Re,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-xs`,"aria-label":x(),className:e,onClick:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),children:(0,Z.jsx)(We,{})})})}function Q({folderId:e,name:t,color:n,currentParentId:r,className:i,onOpen:c}){let u=O(j.projects.renameProject),d=O(j.projects.setProjectColor),ee=O(j.projects.moveProject),f=O(j.projects.deleteProject),te=O(j.projects.createProject),g=Ye(),v=Xe(),[y,b]=(0,X.useState)(!1),[re,x]=(0,X.useState)(t),[ae,S]=(0,X.useState)(!1),[C,le]=(0,X.useState)(!1),w=T(j.projects.projectTreeCount,C?{projectId:e}:`skip`);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{onOpenChange:e=>e&&le(!0),children:[(0,Z.jsx)(ht,{className:i}),(0,Z.jsxs)(He,{align:`end`,className:`w-48`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(z,{onSelect:()=>c(),children:[(0,Z.jsx)(U,{}),` `,we()]}),(0,Z.jsxs)(z,{onSelect:()=>{x(t),b(!0)},children:[(0,Z.jsx)($e,{}),` `,h()]}),(0,Z.jsxs)(z,{onSelect:()=>{requestAnimationFrame(async()=>{let t=await v({title:D(),label:s(),placeholder:Te(),confirmLabel:ie()});t&&await te({name:t,parentId:e})})},children:[(0,Z.jsx)(Oe,{}),` `,D()]}),(0,Z.jsxs)(z,{onSelect:()=>S(!0),children:[(0,Z.jsx)(pt,{}),` `,p()]}),(0,Z.jsx)(Ne,{children:ne()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void d({projectId:e,color:null}),"aria-label":_(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(n===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void d({projectId:e,color:t.value})},t.value))]}),(0,Z.jsx)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{let n=w?.folders??0,r=w?.chats??0;await g({title:Ce({name:t}),description:n>0?oe({folders:n,chats:r}):r>0?l({count:r}):ce(),confirmWord:o(),confirmLabel:se(),destructive:!0})&&await f({projectId:e})})},children:[(0,Z.jsx)(tt,{}),` `,o()]})]})]}),(0,Z.jsx)(Qe,{open:y,onOpenChange:b,title:a(),canSubmit:re.trim().length>0,onSubmit:async()=>{await u({projectId:e,name:re.trim()}),b(!1)},submitLabel:h(),children:(0,Z.jsx)(W,{value:re,onChange:e=>x(e.target.value),autoFocus:!0})}),ae?(0,Z.jsx)(ot,{open:ae,onOpenChange:S,title:m(),movingFolderId:e,currentId:r,onPick:t=>void ee({projectId:e,parentId:t})}):null]})}function gt({chat:e,currentFolderId:t,className:n}){let r=O(j.chats.pinChat),a=O(j.chats.deleteChat),s=O(j.chats.renameChat),c=O(j.chats.setChatSidebar),l=O(j.chats.moveChatToProject),u=Ye(),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(e.title??``),[_,v]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(ht,{className:n}),(0,Z.jsxs)(He,{align:`end`,className:`w-52`,onClick:e=>e.stopPropagation(),children:[(0,Z.jsxs)(z,{onSelect:()=>{m(e.title??``),f(!0)},children:[(0,Z.jsx)($e,{}),` `,h()]}),(0,Z.jsxs)(z,{onSelect:()=>void r({chatId:e._id,pinned:!e.pinned}),children:[e.pinned?(0,Z.jsx)(ct,{}):(0,Z.jsx)(J,{}),e.pinned?te():ee()]}),(0,Z.jsxs)(z,{onSelect:()=>v(!0),children:[(0,Z.jsx)(pt,{}),` `,C()]}),e.pinned&&e.inSidebar?null:(0,Z.jsxs)(z,{onSelect:()=>void c({chatId:e._id,hidden:e.inSidebar}),children:[e.inSidebar?(0,Z.jsx)(Ke,{}):(0,Z.jsx)(Y,{}),e.inSidebar?N():P()]}),(0,Z.jsx)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{requestAnimationFrame(async()=>{await u({title:g(),description:ce(),confirmLabel:o(),destructive:!0})&&await a({chatId:e._id})})},children:[(0,Z.jsx)(tt,{}),` `,o()]})]})]}),(0,Z.jsx)(Qe,{open:d,onOpenChange:f,title:i(),canSubmit:p.trim().length>0,onSubmit:async()=>{await s({chatId:e._id,title:p.trim()}),f(!1)},submitLabel:h(),children:(0,Z.jsx)(W,{value:p,onChange:e=>m(e.target.value),autoFocus:!0})}),_?(0,Z.jsx)(ot,{open:_,onOpenChange:v,title:A(),currentId:t,onPick:t=>void l({chatId:e._id,projectId:t})}):null]})}function _t(e,t){let n=t.trim().toLowerCase();return n===``?e:e.filter(e=>(e.title??``).toLowerCase().includes(n))}function vt(e,t,n,r,i){let a=e.map(t),o=a.indexOf(i);if(o<0)return null;let s=a.indexOf(r);if(s>=0){let t=[...e],[r]=t.splice(s,1);t.splice(o,0,r);let i=t[o-1],a=t[o+1];return{prevKey:i===void 0?null:n(i),nextKey:a===void 0?null:n(a)}}let c=e[o-1];return{prevKey:c===void 0?null:n(c),nextKey:n(e[o])}}function yt(e,t){let n=new Map(t.map(e=>[e.chatId,e.lastSeenAt])),r=new Set;for(let t of e){let e=n.get(t._id);e!==void 0&&t.lastAssistantAt!==null&&t.lastAssistantAt>e&&r.add(t._id)}return r}var bt=`oc.projpage.view`;function xt(){let e=localStorage.getItem(bt);return e===`cards`||e===`list`?e:`columns`}var $=e=>`into:${e}`,St=e=>`col:${e??`null`}`,Ct=e=>`crumb:${e}`;function wt(e){if(e.startsWith(`into:`))return e.slice(5);if(e.startsWith(`crumb:`))return e.slice(6);if(e.startsWith(`col:`)){let t=e.slice(4);return t===`null`?null:t}}function Tt(){let{projectId:e}=st({from:`/project/$projectId`}),t=L(),n=T(j.projects.projectPage,{projectId:e});return(0,Z.jsx)(`div`,{className:`oc-projpage`,children:n===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:S()}):n===null?(0,Z.jsxs)(`div`,{className:`oc-projpage__notfound`,children:[(0,Z.jsx)(`h2`,{children:fe()}),(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:r()}),(0,Z.jsx)(F,{variant:`outline`,onClick:()=>void t({to:`/`}),children:b()})]}):(0,Z.jsx)(Et,{page:n})})}function Et({page:e}){let t=L(),n=Ye(),r=Xe(),i=je(),u=O(j.projects.renameProject),d=O(j.projects.setProjectColor),ee=O(j.projects.deleteProject),te=O(j.projects.createProject),g=O(j.projects.moveProject),v=O(j.projects.setProjectSidebar),b=O(j.chats.moveChatToProject),x=O(j.chats.reorderChat),S=O(j.projects.reorderProject),C=T(j.projects.projectTreeCount,{projectId:e.project._id}),[E,de]=(0,X.useState)(xt),fe=e=>{localStorage.setItem(bt,e),de(e)},k=T(j.projects.folderColumns,E===`columns`?{projectId:e.project._id}:`skip`),A=T(j.projects.projectTreeList,E===`list`?{projectId:e.project._id}:`skip`),{c:M}=Le({from:`/project/$projectId`}),N=T(j.projects.listProjects,{}),we=T(j.chatReads.myBusyChats,{}),P=(0,X.useMemo)(()=>new Set(we??[]),[we]),ke=T(j.chatReads.myChatReads,{}),Pe=(0,X.useMemo)(()=>yt(e.chats,ke??[]),[e.chats,ke]),{startNewChat:R,picker:Ke}=et(e=>void t({to:`/chat/$chatId`,params:{chatId:e}})),[B,nt]=(0,X.useState)(``),[V,H]=(0,X.useState)(!1),[U,st]=(0,X.useState)(e.project.name),[ct,J]=(0,X.useState)(!1),[Y,ht]=(0,X.useState)(``);(0,X.useEffect)(()=>{let e=setTimeout(()=>ht(B.trim()),180);return()=>clearTimeout(e)},[B]);let Q=T(j.search.searchConversations,Y.length>=2?{query:Y,projectId:e.project._id}:`skip`),gt=De(it(lt,{activationConstraint:{distance:4}}),it(qe,{activationConstraint:{delay:250,tolerance:8}})),$=(0,X.useRef)(!1),St=()=>{$.current=!0,setTimeout(()=>{$.current=!1},0)},[Ct,Tt]=(0,X.useState)(null),Et=t=>{if(t.startsWith(`chat:`)){let n=t.slice(5),r=e.chats.find(e=>e._id===n),i=k?.columns.flatMap(e=>e.chats).find(e=>e._id===n);return{kind:`chat`,label:(r??i)?.title||y()}}if(t.startsWith(`folder:`)){let e=t.slice(7);return{kind:`folder`,label:(N??[]).find(t=>t._id===e)?.name??``}}return null},kt=e=>Tt(Et(String(e.active.id))),jt=(0,X.useCallback)(e=>{let t=String(e.active.id).startsWith(`folder:`),n=t=>({...e,droppableContainers:e.droppableContainers.filter(e=>String(e.id).startsWith(t))}),r=I(n(`into:`));if(r.length>0){if(!t)return r;let n=r[0],i=e.droppableRects.get(n.id),a=e.pointerCoordinates?.y;if(i&&a!=null){let e=i.height*.3;if(a>i.top+e&&a<i.top+i.height-e)return r}}let i=I(n(t?`folder:`:`chat:`));if(i.length>0)return i;let a=I(n(`crumb:`));if(a.length>0)return a;let o=I(n(`col:`));return o.length>0?o:Me(n(t?`folder:`:`chat:`))},[]),Nt=t=>{if(E===`columns`){for(let e of k?.columns??[])if(e.chats.some(e=>e._id===t))return{list:e.chats,folderId:e.folderId};return null}if(E===`list`){let e=A?.chats.find(e=>e._id===t);return e?{list:A.chats.filter(t=>t.folderId===e.folderId),folderId:e.folderId}:null}return e.chats.some(e=>e._id===t)?{list:e.chats,folderId:e.project._id}:null},Pt=t=>{if(E===`columns`){for(let e of k?.columns??[])if(e.folders.some(e=>e._id===t))return{list:e.folders,parentId:e.folderId};return null}if(E===`list`){let e=A?.folders.find(e=>e._id===t);if(!e||!A)return null;let n=e.parentId??A.rootId;return{list:Ze(A.folders,e.parentId),parentId:n}}return e.children.some(e=>e._id===t)?{list:e.children,parentId:e.project._id}:null},It=async e=>{Tt(null),St();let{active:t,over:n}=e;if(!n)return;let r=String(n.id),a=String(t.id),o=a.startsWith(`chat:`);try{let e=wt(r);if(e!==void 0){if(o)await b({chatId:a.slice(5),projectId:e});else{let t=a.slice(7);if(t===e)return;if(!Ie(N??[],t,e)){i.error(ye());return}await g({projectId:t,parentId:e})}return}if(o&&r.startsWith(`chat:`)){let e=a.slice(5),t=r.slice(5);if(e===t)return;let n=Nt(t);if(!n)return;n.list.some(t=>t._id===e)||await b({chatId:e,projectId:n.folderId});let i=vt(n.list,e=>e._id,e=>e.sortKey,e,t);i&&await x({chatId:e,...i});return}if(!o&&r.startsWith(`folder:`)){let e=a.slice(7),t=r.slice(7);if(e===t)return;let n=Pt(t);if(!n)return;if(!n.list.some(t=>t._id===e)){if(!Ie(N??[],e,n.parentId)){i.error(ye());return}await g({projectId:e,parentId:n.parentId})}let o=vt(n.list,e=>e._id,e=>e.sortKey,e,t);o&&await S({projectId:e,...o});return}}catch{i.error(ye())}},[,Lt]=(0,X.useState)(0);(0,X.useEffect)(()=>{let e=window.setInterval(()=>Lt(e=>e+1),6e4);return()=>window.clearInterval(e)},[]);let Rt=Date.now(),zt=rt(e.project),Bt=_t(e.chats,B),Vt=e.breadcrumb.slice(0,-1),Ht=e=>()=>{$.current||e()};return(0,Z.jsxs)(Ge,{sensors:gt,collisionDetection:jt,onDragStart:kt,onDragEnd:It,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__body`,style:{"--proj-hue":zt},children:[(0,Z.jsxs)(`nav`,{className:`oc-projpage__crumbs`,"aria-label":le(),children:[Vt.map(e=>(0,Z.jsxs)(`span`,{className:`oc-projpage__crumb`,children:[(0,Z.jsx)(Dt,{folderId:e._id,children:(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__crumblink`,onClick:Ht(()=>void t({to:`/project/$projectId`,params:{projectId:e._id}})),children:e.name})}),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbsep`,"aria-hidden":!0,children:`›`})]},e._id)),(0,Z.jsx)(`span`,{className:`oc-projpage__crumbcur`,children:e.project.name})]}),(0,Z.jsxs)(`header`,{className:`oc-projpage__head`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__dot`,"aria-hidden":!0}),(0,Z.jsx)(`h1`,{className:`oc-projpage__title`,children:e.project.name}),e.project.sidebarHidden?(0,Z.jsxs)(F,{variant:`ghost`,size:`sm`,className:`oc-projpage__hiddenbadge`,title:c(),onClick:()=>{v({projectId:e.project._id,hidden:!1})},children:[(0,Z.jsx)(Ve,{"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:ae()}),(0,Z.jsx)(ze,{"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":w(),children:[(0,Z.jsx)(F,{variant:E===`cards`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":w(),title:w(),"aria-pressed":E===`cards`,onClick:()=>fe(`cards`),children:(0,Z.jsx)(mt,{})}),(0,Z.jsx)(F,{variant:E===`columns`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":pe(),title:pe(),"aria-pressed":E===`columns`,onClick:()=>fe(`columns`),children:(0,Z.jsx)(ft,{})}),(0,Z.jsx)(F,{variant:E===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":me(),title:me(),"aria-pressed":E===`list`,onClick:()=>fe(`list`),children:(0,Z.jsx)(Ee,{})})]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:()=>void R({projectId:e.project._id}),children:[(0,Z.jsx)(Je,{}),xe()]}),(0,Z.jsxs)(F,{variant:`outline`,size:`sm`,onClick:async()=>{let t=await r({title:D(),label:s(),placeholder:Te(),confirmLabel:ie()});t&&await te({name:t,parentId:e.project._id})},children:[(0,Z.jsx)(Oe,{}),D()]}),(0,Z.jsxs)(Be,{children:[(0,Z.jsx)(Re,{asChild:!0,children:(0,Z.jsx)(F,{variant:`ghost`,size:`icon-sm`,"aria-label":ge(),children:(0,Z.jsx)(We,{})})}),(0,Z.jsxs)(He,{align:`end`,className:`w-48`,children:[(0,Z.jsxs)(z,{onSelect:()=>{st(e.project.name),H(!0)},children:[(0,Z.jsx)($e,{}),` `,h()]}),(0,Z.jsxs)(z,{onSelect:()=>J(!0),children:[(0,Z.jsx)(pt,{}),` `,p()]}),(0,Z.jsx)(Ne,{children:ne()}),(0,Z.jsxs)(`div`,{className:`oc-colorgrid`,children:[(0,Z.jsx)(`button`,{className:`oc-colorgrid__none`,onClick:()=>void d({projectId:e.project._id,color:null}),"aria-label":_(),children:`✕`}),at.map(t=>(0,Z.jsx)(`button`,{className:`oc-colorgrid__dot`+(e.project.color===t.value?` is-selected`:``),style:{background:t.hue},"aria-label":t.value,onClick:()=>void d({projectId:e.project._id,color:t.value})},t.value))]}),(0,Z.jsx)(Fe,{}),(0,Z.jsxs)(z,{variant:`destructive`,onSelect:()=>{let r=e.project.parentId;requestAnimationFrame(async()=>{let i=C?.folders??0,a=C?.chats??0;await n({title:Ce({name:e.project.name}),description:i>0?oe({folders:i,chats:a}):a>0?l({count:a}):ce(),confirmWord:o(),confirmLabel:se(),destructive:!0})&&(await ee({projectId:e.project._id}),t(r===null?{to:`/`}:{to:`/project/$projectId`,params:{projectId:r}}))})},children:[(0,Z.jsx)(tt,{}),` `,o()]})]})]})]})]}),E===`columns`?(0,Z.jsx)(Ft,{data:k,currentId:e.project._id,busyIds:P,suppressClick:$,locateChatId:M??null}):E===`list`?(0,Z.jsx)(Mt,{data:A,busyIds:P,suppressClick:$,locateChatId:M??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:_e()}),(0,Z.jsx)(`div`,{className:`oc-projpage__cards`,children:(0,Z.jsx)(K,{items:e.children.map(e=>`folder:${e._id}`),strategy:dt,children:e.children.map(t=>(0,Z.jsx)(Ot,{child:t,parentId:e.project._id,now:Rt,suppressClick:$},t._id))})})]}):null,(0,Z.jsxs)(`section`,{className:`oc-projpage__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-projpage__convhead`,children:[(0,Z.jsx)(`h2`,{className:`oc-projpage__subtitle`,children:ue()}),e.chats.length>0?(0,Z.jsx)(W,{value:B,onChange:e=>nt(e.target.value),placeholder:he(),className:`oc-projpage__filter`}):null]}),e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:e.children.length===0?ve():Se()}):Bt.length===0&&(Q??[]).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:be({term:B.trim()})}):(0,Z.jsx)(`ul`,{className:`oc-projpage__chats`,children:(0,Z.jsx)(K,{items:Bt.map(e=>`chat:${e._id}`),strategy:q,children:Bt.map(t=>(0,Z.jsx)(At,{chat:t,currentFolderId:e.project._id,now:Rt,busy:P.has(t._id),unread:Pe.has(t._id),locate:t._id===M,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:f()}),Q.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:be({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&&Ue(e.messageId,Y),t({to:`/chat/$chatId`,params:{chatId:e.chatId},...e.messageId?{search:{m:e.messageId}}:{}})},children:[(0,Z.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-projpage__hitico`}),(0,Z.jsxs)(`span`,{className:`oc-projpage__hitbody`,children:[(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||re()}),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)(Qe,{open:V,onOpenChange:H,title:a(),canSubmit:U.trim().length>0,onSubmit:async()=>{await u({projectId:e.project._id,name:U.trim()}),H(!1)},submitLabel:h(),children:(0,Z.jsx)(W,{value:U,onChange:e=>st(e.target.value),autoFocus:!0})}),ct?(0,Z.jsx)(ot,{open:ct,onOpenChange:J,title:m(),movingFolderId:e.project._id,currentId:e.project.parentId,onPick:t=>void g({projectId:e.project._id,parentId:t})}):null,Ke]}),(0,Z.jsx)(Ae,{children:Ct?(0,Z.jsxs)(`div`,{className:`oc-projpage__dragghost`,children:[Ct.kind===`folder`?(0,Z.jsx)(G,{size:13,"aria-hidden":!0}):(0,Z.jsx)(ut,{size:13,"aria-hidden":!0}),(0,Z.jsx)(`span`,{children:Ct.label})]}):null})]})}function Dt({folderId:e,children:t}){let{setNodeRef:n,isOver:r}=R({id:Ct(e)});return(0,Z.jsx)(`span`,{ref:n,className:r?`oc-projpage__cdrop is-over`:`oc-projpage__cdrop`,children:t})}function Ot({child:e,parentId:t,now:n,suppressClick:r}){let i=L(),a=B({id:`folder:${e._id}`}),o=R({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":rt(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&i({to:`/project/$projectId`,params:{projectId:e._id}})},...a.listeners,...a.attributes,role:`link`,tabIndex:0,children:[(0,Z.jsxs)(`span`,{className:`oc-projpage__cardhead`,children:[(0,Z.jsx)(G,{size:15,"aria-hidden":!0,className:`oc-projpage__cardico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__cardname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__cardmenu`,onOpen:()=>void i({to:`/project/$projectId`,params:{projectId:e._id}})})]}),(0,Z.jsxs)(`span`,{className:`oc-projpage__cardmeta`,children:[e.folderCount>0?k({count:e.folderCount})+` · `:``,E({count:e.recursiveChatCount})]}),e.lastActivityAt===null?null:(0,Z.jsx)(`span`,{className:`oc-projpage__cardage`,children:nt(e.lastActivityAt,n)})]})}function kt({chat:e}){let t=O(j.chats.setChatSidebar),n=e.inSidebar?N():P();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)(Ke,{}):(0,Z.jsx)(Y,{})})}function At({chat:e,currentFolderId:t,now:n,busy:r,unread:i,locate:a,suppressClick:o}){let s=L(),c=V(e.color),l=B({id:`chat:${e._id}`}),u=jt(a);return(0,Z.jsxs)(`li`,{ref:e=>{l.setNodeRef(e),u.current=e},className:`oc-projpage__chatrow`+(l.isDragging?` is-dragging`:``)+(a?` is-locate`:``),style:{transform:H.Transform.toString(l.transform),transition:l.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__chatbtn`,onClick:()=>{o.current||s({to:`/chat/$chatId`,params:{chatId:e._id}})},...l.listeners,...l.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__chattitle`,children:e.title||y()}),e.pinned?(0,Z.jsx)(J,{size:12,"aria-hidden":!0,className:`oc-projpage__chatpin`}):null,(0,Z.jsx)(`span`,{className:`oc-projpage__chatage`,children:nt(e.updatedAt,n)}),r?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,title:v(),"aria-label":v()}):null,i&&!r?(0,Z.jsx)(`span`,{className:`oc-chatitem__unread`,title:d(),"aria-label":d()}):null]}),(0,Z.jsx)(kt,{chat:e}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__chatmenu`})]})}function jt(e){let t=(0,X.useRef)(null);return(0,X.useEffect)(()=>{e&&t.current&&t.current.scrollIntoView({block:`center`})},[e]),t}function Mt({data:e,busyIds:t,suppressClick:n,locateChatId:r}){let[i,a]=(0,X.useState)(new Set),o=(0,X.useMemo)(()=>{let t=new Map;for(let n of e?.chats??[]){let e=t.get(n.folderId);e===void 0?t.set(n.folderId,[n]):e.push(n)}return t},[e]);if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:S()});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=Ze(e.folders,a);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(K,{items:u.map(e=>`chat:${e._id}`),strategy:q,children:u.map(e=>(0,Z.jsx)(Pt,{chat:e,depth:l,busy:t.has(e._id),locate:e._id===r,suppressClick:n},e._id))}),(0,Z.jsx)(K,{items:d.map(e=>`folder:${e._id}`),strategy:q,children:d.map(t=>(0,Z.jsx)(Nt,{folder:t,parentId:a??e.rootId,depth:l,folded:i.has(t._id),onToggle:()=>s(t._id),suppressClick:n,children:i.has(t._id)?null:c(t._id,l+1)},t._id))})]})};return(0,Z.jsx)(`div`,{className:`oc-projpage__tree`,children:(o.get(e.rootId)??[]).length===0&&Ze(e.folders,null).length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:ve()}):c(null,0)})}function Nt({folder:e,parentId:t,depth:n,folded:r,onToggle:i,suppressClick:a,children:o}){let s=L(),c=B({id:`folder:${e._id}`}),l=R({id:$(e._id)});return(0,Z.jsxs)(`div`,{className:`oc-projpage__treegroup`,children:[(0,Z.jsxs)(`div`,{ref:e=>{c.setNodeRef(e),l.setNodeRef(e)},className:`oc-projpage__treerow oc-projpage__treerow--folder`+(l.isOver?` is-over`:``)+(c.isDragging?` is-dragging`:``),style:{"--tree-depth":n,"--proj-hue":rt(e),transform:H.Transform.toString(c.transform),transition:c.transition},...c.listeners,...c.attributes,role:`button`,tabIndex:0,onClick:()=>{a.current||s({to:`/project/$projectId`,params:{projectId:e._id}})},onKeyDown:t=>{t.key===`Enter`&&s({to:`/project/$projectId`,params:{projectId:e._id}})},children:[(0,Z.jsx)(`button`,{type:`button`,className:`oc-projpage__treechev`,"aria-label":r?de():M(),"aria-expanded":!r,onClick:e=>{e.stopPropagation(),!a.current&&i()},onMouseDown:e=>e.stopPropagation(),onTouchStart:e=>e.stopPropagation(),children:r?(0,Z.jsx)(ke,{size:13}):(0,Z.jsx)(Pe,{size:13})}),(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__treemenu`,onOpen:()=>void s({to:`/project/$projectId`,params:{projectId:e._id}})})]}),o]})}function Pt({chat:e,depth:t,busy:n,locate:r,suppressClick:i}){let a=L(),o=B({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__treerow oc-projpage__treerow--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{"--tree-depth":t,transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a({to:`/chat/$chatId`,params:{chatId:e._id}})},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||y()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:e.folderId,className:`oc-projpage__treemenu`}),(0,Z.jsx)(kt,{chat:e})]})}function Ft({data:e,currentId:t,busyIds:n,suppressClick:r,locateChatId:i}){let a=(0,X.useRef)(null);return(0,X.useEffect)(()=>{let e=a.current;e&&(e.scrollLeft=e.scrollWidth)},[e?.columns.length??0,t]),e===void 0?(0,Z.jsx)(`p`,{className:`oc-projpage__hint`,children:S()}):(0,Z.jsx)(`div`,{className:`oc-projpage__cols`,ref:a,children:e.columns.map((a,o)=>(0,Z.jsx)(It,{col:a,isLast:o===e.columns.length-1,currentId:t,busyIds:n,suppressClick:r,locateChatId:i},a.folderId??`root`))})}function It({col:e,isLast:t,currentId:n,busyIds:r,suppressClick:i,locateChatId:a}){let o=L(),s=R({id:St(e.folderId)});return(0,Z.jsxs)(`div`,{ref:s.setNodeRef,className:`oc-projpage__col`+(s.isOver?` is-over`:``)+(t?` is-last`:``),children:[(0,Z.jsx)(K,{items:e.folders.map(e=>`folder:${e._id}`),strategy:q,children:e.folders.map(t=>(0,Z.jsx)(Lt,{folder:t,parentId:e.folderId,isCurrent:t._id===n,suppressClick:i,onOpen:()=>void o({to:`/project/$projectId`,params:{projectId:t._id}})},t._id))}),(0,Z.jsx)(K,{items:e.chats.map(e=>`chat:${e._id}`),strategy:q,children:e.chats.map(t=>(0,Z.jsx)(Rt,{chat:t,folderId:e.folderId,busy:r.has(t._id),locate:t._id===a,suppressClick:i,onOpen:()=>void o({to:`/chat/$chatId`,params:{chatId:t._id}})},t._id))}),e.folders.length===0&&e.chats.length===0?(0,Z.jsx)(`p`,{className:`oc-projpage__colempty`,children:Se()}):null]})}function Lt({folder:e,parentId:t,isCurrent:n,suppressClick:r,onOpen:i}){let a=B({id:`folder:${e._id}`}),o=R({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":rt(e),transform:H.Transform.toString(a.transform),transition:a.transition},onClick:()=>{r.current||i()},onKeyDown:e=>{e.key===`Enter`&&e.target===e.currentTarget&&i()},...a.listeners,...a.attributes,role:`button`,tabIndex:0,children:[(0,Z.jsx)(G,{size:13,"aria-hidden":!0,className:`oc-projpage__colico`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.name}),(0,Z.jsx)(`span`,{className:`oc-projpage__colchev`,"aria-hidden":!0,children:`›`}),(0,Z.jsx)(Q,{folderId:e._id,name:e.name,color:e.color,currentParentId:t,className:`oc-projpage__colmenu`,onOpen:i})]})}function Rt({chat:e,folderId:t,busy:n,locate:r,suppressClick:i,onOpen:a}){let o=B({id:`chat:${e._id}`}),s=jt(r),c=V(e.color);return(0,Z.jsxs)(`div`,{ref:e=>{o.setNodeRef(e),s.current=e},className:`oc-projpage__colentry oc-projpage__colentry--chat`+(o.isDragging?` is-dragging`:``)+(r?` is-locate`:``),style:{transform:H.Transform.toString(o.transform),transition:o.transition},children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-projpage__colchatbtn`,onClick:()=>{i.current||a()},...o.listeners,...o.attributes,children:[c?(0,Z.jsx)(`span`,{className:`oc-chatitem__dot`,style:{background:c}}):(0,Z.jsx)(`span`,{className:`oc-chatitem__dot oc-chatitem__dot--empty`}),(0,Z.jsx)(`span`,{className:`oc-projpage__colname`,children:e.title||y()}),n?(0,Z.jsx)(`span`,{className:`oc-chatitem__busy`,"aria-hidden":!0}):null]}),(0,Z.jsx)(gt,{chat:e,currentFolderId:t,className:`oc-projpage__colmenu oc-projpage__colmenu--chat`}),(0,Z.jsx)(kt,{chat:e})]})}export{Tt as ProjectPage};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,BT as i,CT as a,DT as o,ET as ee,FT as te,GT as s,HT as c,IT as ne,JT as l,KT as u,LT as re,MT as ie,NT as d,OT as f,PT as p,RT as m,ST as h,TT as g,UT as _,VT as v,WT as y,XT as b,YT as x,ZT as S,aV as ae,cT as C,dT as w,fT as T,gs as E,hT as D,iV as O,jT as k,kT as A,lT as j,mT as M,pT as N,qT as P,sT as F,t as I,uT as L,wT as R,xT as oe,zT as z}from"./api-CmD2gXMO.js";import{t as B}from"./button-CeWAnaYG.js";import{Dt as V,En as H,Et as U,U as W,_ as G,jt as K,ut as q}from"./index-DzhtdTgH.js";import{t as J}from"./roleDescriptions-DRKSgXRv.js";var Y=t(e(),1),X=n(),Z=[{group:()=>S(),keys:[{key:`traces.read`,label:()=>u()},{key:`traces.read.content`,label:()=>s(),phi:!0},{key:`traces.write`,label:()=>y()}]},{group:()=>b(),keys:[{key:`kpi.read`,label:()=>u()},{key:`kpi.write`,label:()=>y()}]},{group:()=>x(),keys:[{key:`openclaw.query`,label:()=>_()},{key:`anomalies.read`,label:()=>c()},{key:`anomalies.report`,label:()=>v()}]},{group:()=>l(),keys:[{key:`chats.read`,label:()=>u()},{key:`selfheal`,label:()=>z()},{key:`media.repair`,label:()=>m()},{key:`feedback.respond`,label:()=>E()}]},{group:()=>P(),keys:[{key:`admin.manage`,label:()=>i()}]}],se=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function ce(){let e=ae(I.apiKeys.listRoles,{}),t=O(I.apiKeys.createRole),n=O(I.apiKeys.ensureRolesSeeded),i=O(I.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(I.apiKeys.listRoles,{});r&&e.setQuery(I.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),s=W(),c=V(),[l,u]=(0,Y.useState)(!1),[m,_]=(0,Y.useState)($),[v,y]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{c.error(ne(),e)})},[n,c]);let b=e??[];async function x(e,t){if(Q(e.permissions))return;if(e.builtin){await s({title:te({name:e.name}),description:p(),confirmLabel:d()});return}if(v.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];y(t=>new Set(t).add(e._id));try{await i({roleId:e._id,permissions:n})}catch(e){c.error(ie(),e)}finally{y(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function S(){try{await t({key:m.key,name:m.name,description:m.description||void 0,permissions:[]}),_($),u(!1)}catch(e){c.error(k(),e)}}let E=e===void 0,P=!E&&b.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[r(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,A(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,f()]}),(0,X.jsxs)(`div`,{className:`oc-dt`,children:[(0,X.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,X.jsx)(`h2`,{className:`oc-dt__title`,children:o()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{_($),u(!0)},children:ee()})})]}),E?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):P?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:a()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?re({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:b.map(e=>{let t=Q(e.permissions),n=v.has(e._id);return(0,X.jsxs)(`tr`,{children:[(0,X.jsxs)(`th`,{className:`oc-matrix__rolecell`,children:[(0,X.jsxs)(`div`,{className:`oc-matrix__rolename`,children:[(0,X.jsx)(`span`,{children:e.name}),(0,X.jsx)(`code`,{className:`oc-matrix__rolekey`,children:e.key}),e.builtin?(0,X.jsxs)(U,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(H,{}),` `,h()]}):(0,X.jsx)(U,{variant:`secondary`,children:oe()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),se.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(q,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?D():n?M():r,onCheckedChange:()=>void x(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(G,{open:l,onOpenChange:u,title:N(),description:T(),canSubmit:!!(m.key&&m.name),onSubmit:S,submitLabel:w(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:L()}),(0,X.jsx)(K,{value:m.key,placeholder:j(),onChange:e=>_({...m,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:C()}),(0,X.jsx)(K,{value:m.name,onChange:e=>_({...m,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:F()}),(0,X.jsx)(K,{value:m.description,onChange:e=>_({...m,description:e.target.value})})]})]})})]})}export{ce as RolesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as r,AR as i,Az as a,BL as o,BR as s,Cz as c,D as l,DL as u,DR as ee,Dz as d,ER as f,Ez as p,FL as te,FR as ne,GL as re,GR as ie,HL as ae,HR as oe,IL as se,JL as ce,JR as m,KL as le,KR as ue,LL as de,LR as fe,MR as pe,Mz as me,NL as he,NR as ge,Nz as _e,OR as ve,Oz as ye,PL as be,PR as xe,Pz as Se,QB as h,QR as Ce,RL as we,Sz as Te,Tz as Ee,UL as De,UR as Oe,VL as ke,VR as Ae,WL as je,WR as Me,XB as Ne,XL as Pe,XR as Fe,YL as Ie,ZR as Le,_R as Re,aV as ze,bR as Be,bz as Ve,cR as g,dR as He,ez as Ue,fR as _,gR as We,hR as Ge,jR as Ke,jz as qe,kR as Je,kz as Ye,lR as Xe,mR as Ze,nV as v,oR as Qe,pR as $e,qL as et,qR as tt,sR as nt,t as y,tz as rt,uR as it,vR as at,wz as ot,xR as b,xz as st,yR as ct,yz as lt,zL as ut}from"./api-CmD2gXMO.js";import{t as dt}from"./list-CvqgTGVJ.js";import{t as x}from"./button-CeWAnaYG.js";import{$ as S,Bn as C,Bt as ft,Ct as pt,Dn as mt,Dt as ht,Et as w,Q as T,Rt as E,St as gt,Tt as _t,Vn as D,X as O,Z as k,_n as vt,_t as yt,at as bt,bn as xt,bt as St,dn as Ct,et as A,gt as wt,hn as Tt,it as Et,jt as Dt,nt as Ot,on as kt,ot as At,q as jt,rt as Mt,tt as Nt,vt as Pt,wt as Ft,xn as It,xt as Lt,yt as Rt,zt as j}from"./index-DzhtdTgH.js";import{a as zt,i as M,n as Bt,o as Vt,r as N,t as Ht}from"./table-4Ca5s05D.js";import{t as Ut}from"./FilterBar-CXoCWT0o.js";/* empty css */import{a as Wt,c as P,i as F,l as Gt,n as Kt,o as I,r as qt,s as Jt,t as Yt,u as L}from"./TimezoneCombobox-DXwy6QXD.js";var Xt=l(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Zt=l(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),R=t(e(),1),z=n();function B(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Qt({value:e,onChange:t}){let n=Gt(e),r=(0,R.useMemo)(()=>new Date,[]),[i,a]=(0,R.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,R.useState)(!1),c=(0,R.useMemo)(()=>B(h()),[]),l=(0,R.useMemo)(()=>new Intl.DateTimeFormat(h(),{month:`long`,year:`numeric`}),[]),u=(0,R.useMemo)(()=>new Intl.DateTimeFormat(h(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=P(i.year,i.month),d=n?.hour??9,f=n?.minute??0,p=(e,n,r,i,a)=>t(L(e,n,r,i,a)),te=(e,t,n)=>{a({year:e,month:t}),p(e,t,n,d,f)},ne=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},re=n===null?Be():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,z.jsxs)(E,{modal:!0,open:o,onOpenChange:s,children:[(0,z.jsx)(ft,{asChild:!0,children:(0,z.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":b(),children:[(0,z.jsx)(Xt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,z.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:re})]})}),(0,z.jsxs)(j,{align:`start`,className:`oc-dtp__pop`,children:[(0,z.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":ct(),onClick:()=>ne(-1),children:(0,z.jsx)(D,{size:15,"aria-hidden":!0})}),(0,z.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":at(),onClick:()=>ne(1),children:(0,z.jsx)(C,{size:15,"aria-hidden":!0})})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,z.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,z.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>te(e.year,e.month,e.day),children:e.day},t)})]}),(0,z.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,z.jsxs)(O,{value:String(d),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),Number(e),f),children:[(0,z.jsx)(S,{size:`sm`,"aria-label":Re(),children:(0,z.jsx)(A,{})}),(0,z.jsx)(k,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,z.jsx)(T,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,z.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,z.jsxs)(O,{value:String(f),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),d,Number(e)),children:[(0,z.jsx)(S,{size:`sm`,"aria-label":We(),children:(0,z.jsx)(A,{})}),(0,z.jsx)(k,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,z.jsx)(T,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function V(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function $t(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function en(e){let t=new Map;for(let n of e){let e=V(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function H(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get($t(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function tn(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function nn(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function rn(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var U=3;function an({events:e,mode:t,cursor:n,onModeChange:r,onCursorChange:i,onEventClick:a,footnote:o}){let s=h(),c=(0,R.useMemo)(()=>en(e),[e]),l=(0,R.useMemo)(()=>tn(s),[s]),u=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`,year:`numeric`}),[s]),ee=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{month:`long`}),[s]),d=(0,R.useMemo)(()=>new Intl.DateTimeFormat(s,{hour:`2-digit`,minute:`2-digit`}),[s]),f=new Date,p=e=>{if(t===`year`){i({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);i({year:r.getFullYear(),month:r.getMonth()})},te=t===`year`?String(n.year):u.format(new Date(n.year,n.month,1));return(0,z.jsxs)(`div`,{className:`oc-cal`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,z.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,"aria-label":Xe(),onClick:()=>p(-1),children:(0,z.jsx)(D,{})}),(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,"aria-label":g(),onClick:()=>p(1),children:(0,z.jsx)(C,{})}),(0,z.jsx)(x,{variant:`ghost`,size:`sm`,onClick:()=>i({year:f.getFullYear(),month:f.getMonth()}),children:it()})]}),(0,z.jsx)(`span`,{className:`oc-cal__title`,children:te}),(0,z.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,z.jsx)(x,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>r(`month`),children:_()}),(0,z.jsx)(x,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>r(`year`),children:He()})]})]}),t===`month`?(0,z.jsx)(on,{cursor:n,byDay:c,weekdays:l,timeFmt:d,now:f,onEventClick:a}):(0,z.jsx)(sn,{year:n.year,byDay:c,monthShortFmt:ee,now:f,onOpenMonth:e=>{i({year:n.year,month:e}),r(`month`)}}),o?(0,z.jsx)(`p`,{className:`oc-cal__footnote`,children:o}):null]})}function on({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=P(e.year,e.month);return(0,z.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,z.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get($t(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,z.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,z.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,U).map(e=>(0,z.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,z.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,z.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,z.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>U?(0,z.jsx)(`span`,{className:`oc-cal__more`,children:nt({count:o.length-U})}):null]},n)})]})}function sn({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,z.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=H(t,e,o),c=P(e,o);return(0,z.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,z.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,z.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,z.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var W={h:36e5,min:6e4,s:1e3,ms:1};function cn(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*W[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function G(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function K(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=G(t[0],0,59),r=G(t[1],0,23),i=G(t[2],1,31),a=G(t[3],1,12),o=G(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var q=new Map;function J(e){let t=q.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return q.set(e,n),n}function Y(e,t){if(t!==null){let n=J(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||J(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=Y(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=K(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=Y(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function ln(e,t){return`${e}\u0000${t}`}function un(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=ln(a.instanceName,e.id);i.set(o,a);let s=I(e)!==`active`,c=Z(s?null:cn(e.schedule),e.nextRunAtMs,t,n);for(let t of c)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:s,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function dn(e){return e?.data?.code??`unknown`}function fn({status:e}){switch(Jt(e)){case`ok`:return(0,z.jsx)(w,{variant:`secondary`,children:xe()});case`error`:return(0,z.jsx)(w,{variant:`destructive`,children:pe()});case`running`:return(0,z.jsx)(w,{variant:`outline`,children:Ke()});case`other`:return(0,z.jsx)(w,{variant:`outline`,children:e});case`none`:return(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function pn(){let e=v(y.scheduled.listMyCrons),t=v(y.scheduled.getCronDetail),n=v(y.scheduled.listCronRuns),l=v(y.scheduled.updateCron),Re=v(y.scheduled.removeCron),Be=v(y.scheduled.runCronNow),g=ht(),He=ze(y.me.getMe,{host:jt})?.timezone,[_,We]=(0,R.useState)(null),[Xe,nt]=(0,R.useState)(!1),[it,at]=(0,R.useState)(!1),[b,ct]=(0,R.useState)(null),[C,ft]=(0,R.useState)(null),[E,D]=(0,R.useState)(null),[j,P]=(0,R.useState)(null),[Gt,Jt]=(0,R.useState)(!1),[L,B]=(0,R.useState)(Kt),[V,$t]=(0,R.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),en=e=>{localStorage.setItem(`oc.sched.view`,e),$t(e)},[H,tn]=(0,R.useState)(`month`),[U,on]=(0,R.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),sn=(0,R.useMemo)(()=>{let e=[];for(let t of _??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Wt(r,L)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[_,L]),W=(0,R.useMemo)(()=>H===`year`?rn(U.year):nn(U.year,U.month),[H,U]),cn=(0,R.useMemo)(()=>un(sn,W.startMs,W.endMs),[sn,W]),G=e=>{let t=cn.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||pn(t.instanceName,t.job)},K=(0,R.useCallback)(async()=>{nt(!0),at(!1);try{We(await e({}))}catch{at(!0)}finally{nt(!1)}},[e]);(0,R.useEffect)(()=>{K()},[K]);let q=(0,R.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),J=(0,R.useRef)(null);(0,R.useEffect)(()=>{_!==null&&J.current!==null&&J.current.scrollIntoView({block:`center`})},[_]);let Y=(0,R.useMemo)(()=>new Intl.DateTimeFormat(h(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{ct(e);try{await t(),g.success(n),await K()}catch(e){g.toast({variant:`error`,title:m({code:dn(e)})})}finally{ct(null)}},Z=(0,R.useRef)(0),Q=(0,R.useRef)(0),ln=async(e,t)=>{if(t.id===null)return;let r=++Z.current;D({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;D({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;D(null),g.toast({variant:`error`,title:m({code:dn(e)})})}},pn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;P({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;P(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;P(null),g.toast({variant:`error`,title:m({code:dn(e)})})}},mn=async()=>{if(j===null)return;let e={};if(j.nameDirty&&j.name.trim()===``||j.messageDirty&&j.hasMessage&&j.message.trim()===``){g.toast({variant:`error`,title:he()});return}if(j.nameDirty&&j.name.trim()!==``&&(e.name=j.name.trim()),j.scheduleDirty){if(j.scheduleKind===`cron`&&j.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:j.cronExpr.trim(),...j.tz.trim()===``?{}:{tz:j.tz.trim()}};else if(j.scheduleKind===`every`){let t=Number(j.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[j.everyUnit])})}else if(j.scheduleKind===`at`&&j.at!==``){let t=Date.parse(j.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(j.scheduleDirty&&e.schedule===void 0){g.toast({variant:`error`,title:be()});return}if(j.messageDirty&&j.hasMessage&&j.message.trim()!==``&&(e.message=j.message.trim()),Object.keys(e).length===0){P(null);return}let t=Q.current;Jt(!0);try{await l({instanceName:j.instanceName,jobId:j.jobId,patch:e}),g.success(et()),t===Q.current&&P(null),await K()}catch(e){g.toast({variant:`error`,title:m({code:dn(e)})})}finally{Jt(!1)}},hn=_?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:Se()}),(0,z.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":Ge(),children:[(0,z.jsx)(x,{variant:V===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ze(),title:Ze(),"aria-pressed":V===`list`,onClick:()=>en(`list`),children:(0,z.jsx)(dt,{})}),(0,z.jsx)(x,{variant:V===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":$e(),title:$e(),"aria-pressed":V===`calendar`,onClick:()=>en(`calendar`),children:(0,z.jsx)(Xt,{})})]}),(0,z.jsxs)(x,{variant:`ghost`,size:`sm`,onClick:()=>void K(),disabled:Xe,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,z.jsx)(Tt,{size:14,"aria-hidden":!0}),_e()]})]}),_!==null&&hn>0?(0,z.jsxs)(Ut,{q:L.q,onQChange:e=>B(t=>({...t,q:e})),searchPlaceholder:Je(),onReset:()=>B(Kt),canReset:qt(L),children:[(0,z.jsxs)(O,{value:L.state,onValueChange:e=>B(t=>({...t,state:e})),children:[(0,z.jsx)(S,{size:`sm`,className:`w-40`,children:(0,z.jsx)(A,{})}),(0,z.jsxs)(k,{children:[(0,z.jsx)(T,{value:`all`,children:ve()}),(0,z.jsx)(T,{value:`active`,children:Ve()}),(0,z.jsx)(T,{value:`paused`,children:st()}),(0,z.jsx)(T,{value:`auto-disabled`,children:lt()})]})]}),(0,z.jsxs)(O,{value:L.result,onValueChange:e=>B(t=>({...t,result:e})),children:[(0,z.jsx)(S,{size:`sm`,className:`w-40`,children:(0,z.jsx)(A,{})}),(0,z.jsxs)(k,{children:[(0,z.jsx)(T,{value:`all`,children:ee()}),(0,z.jsx)(T,{value:`ok`,children:xe()}),(0,z.jsx)(T,{value:`error`,children:pe()}),(0,z.jsx)(T,{value:`running`,children:Ke()}),(0,z.jsx)(T,{value:`none`,children:i()})]})]})]}):null,_===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Xe,children:it?me():Ne()}):V===`calendar`?(0,z.jsxs)(z.Fragment,{children:[it?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):null,_.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):(0,z.jsx)(an,{events:cn.events,mode:H,cursor:U,onModeChange:tn,onCursorChange:on,onEventClick:G,footnote:Qe()})]}):(0,z.jsxs)(z.Fragment,{children:[it?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:me()}):null,_.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:qe()}):null,_.map(e=>{let t=e.jobs.filter(e=>Wt(e,L)),n=qt(L)&&e.jobs.length>0&&t.length===0;return(0,z.jsxs)(`section`,{style:{marginBottom:20},children:[_.length>1||e.error||!e.supported?(0,z.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,z.jsx)(w,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Ye({code:e.error})}):e.jobs.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:ye()}):n?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,z.jsxs)(Ht,{children:[(0,z.jsx)(zt,{children:(0,z.jsxs)(Vt,{children:[(0,z.jsx)(M,{children:d()}),(0,z.jsx)(M,{children:p()}),(0,z.jsx)(M,{children:Ee()}),(0,z.jsx)(M,{children:ot()}),(0,z.jsx)(M,{children:c()}),(0,z.jsx)(M,{children:ne()}),(0,z.jsx)(M,{children:Pe()})]})}),(0,z.jsx)(Bt,{children:t.map((t,n)=>{let i=`${e.instanceName}:${t.id??n}`,a=b===i,o=e.manageSupported,s=e.kind===`openclaw`&&o;return(0,z.jsxs)(Vt,{ref:t.id!==null&&t.id===q?J:void 0,"data-state":t.id!==null&&t.id===q?`selected`:void 0,children:[(0,z.jsx)(N,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??Te()}),(0,z.jsx)(N,{children:(0,z.jsx)(w,{variant:`secondary`,children:t.agentId})}),(0,z.jsxs)(N,{className:`whitespace-nowrap`,children:[(0,z.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=wt(t.schedule),n=e===null?null:yt(e);return n===null?null:(0,z.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,z.jsx)(N,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:Y.format(t.nextRunAtMs)}),(0,z.jsx)(N,{children:I(t)===`auto-disabled`?(0,z.jsx)(w,{variant:`destructive`,title:`${t.autoDisabledReason??``}${t.autoDisabledAtMs===null?``:` · ${Y.format(t.autoDisabledAtMs)}`}`,children:lt()}):I(t)===`active`?(0,z.jsx)(w,{variant:`secondary`,children:Ve()}):I(t)===`paused`?(0,z.jsx)(w,{variant:`outline`,children:st()}):(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,z.jsxs)(N,{children:[(0,z.jsx)(fn,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,z.jsx)(w,{variant:`destructive`,title:t.lastDeliveryError??rt(),children:ge()}):null]}),(0,z.jsx)(N,{className:`whitespace-nowrap`,children:t.id===null?(0,z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,z.jsx)(mt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,z.jsxs)(`span`,{className:`oc-cronactions`,children:[s?(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:r(),"aria-label":r(),disabled:b!==null,onClick:()=>void X(i,async()=>{let n=await Be({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},tt()),children:(0,z.jsx)(kt,{size:14,"aria-hidden":!0})}):null,s&&t.enabled!==null?(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:F(t)===`pause`?Ce():Le(),"aria-label":F(t)===`pause`?Ce():Le(),disabled:b!==null,onClick:()=>void X(i,()=>l({instanceName:e.instanceName,jobId:t.id,patch:{enabled:F(t)===`resume`}}),F(t)===`pause`?ue():ie()),children:F(t)===`pause`?(0,z.jsx)(It,{size:14,"aria-hidden":!0}):(0,z.jsx)(vt,{size:14,"aria-hidden":!0})}):null,s?(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Ie(),"aria-label":Ie(),disabled:b!==null,onClick:()=>void pn(e.instanceName,t),children:(0,z.jsx)(xt,{size:14,"aria-hidden":!0})}):null,s?(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:ce(),"aria-label":ce(),disabled:b!==null,onClick:()=>void ln(e.instanceName,t),children:(0,z.jsx)(Zt,{size:14,"aria-hidden":!0})}):null,o?(0,z.jsx)(x,{variant:`ghost`,size:`icon-sm`,title:Fe(),"aria-label":Fe(),disabled:b!==null,onClick:()=>ft({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,z.jsx)(Ct,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:a()})]},e.instanceName)}),hn>0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:u()}):null]}),(0,z.jsx)(Pt,{open:C!==null,onOpenChange:e=>{e||ft(null)},children:(0,z.jsxs)(Lt,{children:[(0,z.jsxs)(Ft,{children:[(0,z.jsx)(_t,{children:Oe()}),(0,z.jsx)(gt,{children:oe({name:C?.name??``})})]}),(0,z.jsxs)(pt,{children:[(0,z.jsx)(St,{children:Ae()}),(0,z.jsx)(Rt,{onClick:()=>{let e=C;ft(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>Re({instanceName:e.instanceName,jobId:e.jobId}),Me())},children:s()})]})]})}),(0,z.jsx)(Nt,{open:E!==null,onOpenChange:e=>{e||(Z.current++,D(null))},children:(0,z.jsxs)(Ot,{style:{maxWidth:640},children:[(0,z.jsx)(bt,{children:(0,z.jsx)(At,{children:le({name:E?.name??``})})}),E?.entries===null?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):E!==null&&E.entries.length===0?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:re()}):E===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:E.entries.map((e,t)=>(0,z.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,z.jsx)(fn,{status:e.status}),(0,z.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?Y.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,z.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,z.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,z.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[fe({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,z.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,z.jsx)(Nt,{open:j!==null,onOpenChange:e=>{e||(Q.current++,P(null))},children:(0,z.jsxs)(Ot,{className:`oc-cronedit`,children:[(0,z.jsxs)(bt,{children:[(0,z.jsx)(At,{children:je()}),(0,z.jsx)(Mt,{children:De()})]}),j===null?null:j.loading?(0,z.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}):(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:d()}),(0,z.jsx)(Dt,{value:j.name,maxLength:200,onChange:e=>P({...j,name:e.target.value,nameDirty:!0})})]}),(0,z.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:ae()}),(0,z.jsxs)(O,{value:j.scheduleKind,onValueChange:e=>P({...j,scheduleKind:e,scheduleDirty:!0}),children:[(0,z.jsx)(S,{children:(0,z.jsx)(A,{})}),(0,z.jsxs)(k,{children:[(0,z.jsx)(T,{value:`cron`,children:ke()}),(0,z.jsx)(T,{value:`every`,children:o()}),(0,z.jsx)(T,{value:`at`,children:ut()})]})]}),j.scheduleKind===`cron`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(Dt,{value:j.cronExpr,onChange:e=>P({...j,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,z.jsx)(Yt,{value:j.tz,onChange:e=>P({...j,tz:e,scheduleDirty:!0}),fallbackTz:He??void 0})]}):j.scheduleKind===`every`?(0,z.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,z.jsx)(Dt,{type:`number`,min:1,value:j.everyValue,onChange:e=>P({...j,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,z.jsxs)(O,{value:j.everyUnit,onValueChange:e=>P({...j,everyUnit:e,scheduleDirty:!0}),children:[(0,z.jsx)(S,{style:{maxWidth:160},children:(0,z.jsx)(A,{})}),(0,z.jsxs)(k,{children:[(0,z.jsx)(T,{value:`minutes`,children:we()}),(0,z.jsx)(T,{value:`hours`,children:de()}),(0,z.jsx)(T,{value:`days`,children:se()})]})]})]}):(0,z.jsx)(Qt,{value:j.at,onChange:e=>P({...j,at:e,scheduleDirty:!0})})]}),j.hasMessage?(0,z.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,z.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ue()}),(0,z.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:j.message,onChange:e=>P({...j,message:e.target.value,messageDirty:!0})})]}):null]}),(0,z.jsxs)(Et,{children:[(0,z.jsx)(x,{variant:`ghost`,onClick:()=>P(null),children:Ae()}),(0,z.jsxs)(x,{onClick:()=>void mn(),disabled:j===null||j.loading||Gt,children:[Gt?(0,z.jsx)(mt,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,te()]})]})]})})]})}export{pn as ScheduledTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,$P as i,AP as ee,BP as te,CP as ne,DP as re,EP as ie,FP as ae,GP as oe,HP as se,IP as ce,JN as a,JP as le,KP as ue,LP as de,MP as fe,NP as pe,OP as me,PP as he,QN as o,QP as ge,RP as _e,SP as ve,TP as ye,UP as be,VP as xe,WP as Se,XN as s,XP as Ce,YN as we,YP as Te,ZN as Ee,ZP as De,_P as c,aF as Oe,aP as l,aV as u,bP as ke,cF as d,cP as f,dF as Ae,dP as p,eF as je,eP as m,fF as Me,fP as h,gP as g,hP as _,iF as Ne,iP as v,iV as y,jP as Pe,kP as Fe,lF as b,lP as x,mF as Ie,mP as S,nF as Le,nP as C,nV as Re,oF as ze,oP as w,pF as Be,pP as T,qP as Ve,rF as He,rP as E,sF as Ue,sP as D,t as O,tF as We,tP as k,uF as Ge,uP as A,vP as Ke,wP as qe,xP as Je,yP as Ye,zP as Xe}from"./api-CmD2gXMO.js";import{t as j}from"./button-CeWAnaYG.js";import{$ as M,Bn as Ze,Dt as Qe,Et as N,Gn as $e,Hn as et,In as P,Kn as tt,Q as F,U as nt,Un as I,X as L,Z as R,_ as rt,at as z,ct as B,et as V,it as H,jt as U,nt as W,ot as G,rt as it,st as at,tt as K}from"./index-DzhtdTgH.js";import{t as ot}from"./FilterBar-CXoCWT0o.js";import{t as st}from"./DataTableShell-ZXwE42Fk.js";import{t as ct}from"./roleDescriptions-DRKSgXRv.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>m(),days:null},{value:`30`,label:()=>r(),days:30},{value:`90`,label:()=>o(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=tt({from:`/settings/serviceAccounts`}),t=$e({from:`/settings/serviceAccounts`}),n=e.q??``,r=e.status??X,[a,o]=(0,q.useState)(X),s=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),we=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),Ee=u(O.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:r===X?void 0:r===`disabled`}}),c=u(O.apiKeys.listKeys,{}),l=u(O.apiKeys.listRoles,{}),f=y(O.apiKeys.createServiceAccount),p=y(O.apiKeys.updateServiceAccount),m=y(O.apiKeys.deleteServiceAccount),h=Re(O.apiKeys.mintApiKey),g=y(O.apiKeys.revokeApiKey),_=nt(),v=Qe(),x=n!==``||a!==X||r!==X;function S(){o(X),t({search:{},replace:!0})}let[C,w]=(0,q.useState)(!1),[T,E]=(0,q.useState)(Z),[D,k]=(0,q.useState)(null),[A,P]=(0,q.useState)(new Set),[I,z]=(0,q.useState)(null),B=(0,q.useRef)(!1),[H,W]=(0,q.useState)(new Set),[G,it]=(0,q.useState)({}),[at,K]=(0,q.useState)(null),Y=(0,q.useMemo)(()=>{let e=new Map;for(let t of c??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[c]);function Q(e){P(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{D?(await p({serviceAccountId:D,name:T.name,roleKey:T.roleKey,description:T.description}),v.success(fe())):await f({name:T.name,roleKey:T.roleKey,description:T.description||void 0}),E(Z),k(null),w(!1)}catch(e){v.error(D?pe():he(),e)}}function pt(e){E({name:e.name,roleKey:e.roleKey,description:e.description??``}),k(e._id),w(!0)}async function mt(e){if(B.current)return;B.current=!0;let t=G[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;z(e._id);try{let t=await h({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Pe(),e)}finally{B.current=!1,z(null)}}async function $(e){if(await _({title:ee(),description:(0,J.jsxs)(J.Fragment,{children:[Fe(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,me(),` `,(0,J.jsx)(`strong`,{children:re()}),` `,ie()]}),confirmWord:e.name,confirmLabel:ye(),destructive:!0}))try{await m({serviceAccountId:e._id}),v.success(qe(),e.name)}catch(e){v.error(ne(),e)}}async function ht(e){if(await _({title:ve(),description:(0,J.jsxs)(J.Fragment,{children:[Je(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,ke()]}),confirmLabel:Ye(),destructive:!0})&&!H.has(e._id)){W(t=>new Set(t).add(e._id));try{await g({keyId:e._id})}catch(e){v.error(Ke(),e)}finally{W(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}),(0,J.jsxs)(ot,{q:n,onQChange:s,searchPlaceholder:Be(),onReset:S,canReset:x,children:[(0,J.jsxs)(L,{value:a,onValueChange:o,children:[(0,J.jsx)(M,{size:`sm`,className:`w-40`,children:(0,J.jsx)(V,{placeholder:Me()})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:Ae()}),(l??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(L,{value:r,onValueChange:we,children:[(0,J.jsx)(M,{size:`sm`,className:`w-36`,children:(0,J.jsx)(V,{})}),(0,J.jsxs)(R,{children:[(0,J.jsx)(F,{value:X,children:Ge()}),(0,J.jsx)(F,{value:`active`,children:b()}),(0,J.jsx)(F,{value:`disabled`,children:d()})]})]})]}),(0,J.jsx)(st,{title:Ue(),rows:Ee,addLabel:ze(),onAdd:()=>{E(Z),k(null),w(!0)},emptyHint:Oe(),isExpanded:e=>A.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:H}),rowActions:e=>[...(e.managedBy??null)===null?[{label:We(),onSelect:()=>pt(e)},{label:Ne(),onSelect:()=>void mt(e)}]:[],{label:A.has(e._id)?He():Le(),onSelect:()=>Q(e._id)},...(e.managedBy??null)===null?[{label:je(),variant:`destructive`,onSelect:()=>void $(e)}]:[]],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":A.has(e._id)?i():ge(),onClick:()=>Q(e._id),children:A.has(e._id)?(0,J.jsx)(et,{}):(0,J.jsx)(Ze,{})})},{header:De(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:Ce(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})},{header:Te(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:d()}):(0,J.jsx)(N,{variant:`outline`,children:b()})},{header:le(),cell:e=>(0,J.jsxs)(L,{value:G[e._id]??`never`,onValueChange:t=>it(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(M,{size:`sm`,className:`w-32`,children:(0,J.jsx)(V,{})}),(0,J.jsx)(R,{children:lt.map(e=>(0,J.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:Ve(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:I===e._id?ue():oe({count:t})})}}]}),(0,J.jsx)(rt,{open:C,onOpenChange:e=>{w(e),e||k(null)},title:D?Se():xe(),description:D?be():te(),canSubmit:!!(T.name&&T.roleKey),onSubmit:ft,submitLabel:D?se():Xe(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:_e()}),(0,J.jsx)(U,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:de()}),(0,J.jsxs)(L,{value:T.roleKey||void 0,onValueChange:e=>E({...T,roleKey:e}),children:[(0,J.jsx)(M,{className:`w-full`,children:(0,J.jsx)(V,{placeholder:ce()})}),(0,J.jsx)(R,{children:(l??[]).map(e=>(0,J.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(l??[]).find(e=>e.key===T.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ae()}),(0,J.jsx)(U,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:at,onClose:()=>K(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[c(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:_()}),(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:T()}),(0,J.jsx)(`th`,{children:h()}),(0,J.jsx)(`th`,{children:p()}),(0,J.jsx)(`th`,{children:A()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:B(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:!t.disabled&&(e.managedBy??null)===null?(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?x():f()}):null})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(K,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(W,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(z,{children:[(0,J.jsx)(G,{children:D()}),(0,J.jsx)(it,{children:w({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:l()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":v(),children:[n?(0,J.jsx)(I,{}):(0,J.jsx)(P,{}),n?E():C()]})]}),(0,J.jsx)(H,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:k()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?Ee():B(e)}function mt(e){return e===null?`—`:at(e)}function $(e){return e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:s()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(N,{variant:`outline`,children:we()}):(0,J.jsx)(N,{variant:`outline`,children:a()})}export{Q as ServiceAccountsTab};