@lacneu/atrium 0.49.0 → 0.51.0

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 (74) hide show
  1. package/dist/assets/AccessTab-BTTUfIwc.js +1 -0
  2. package/dist/assets/{AdvancedFilter-BzRzcaLe.js → AdvancedFilter-BQlL-4N9.js} +1 -1
  3. package/dist/assets/AgentFilesTab-By3Jzopm.js +3 -0
  4. package/dist/assets/AnomaliesTab-Cs6vlfDv.js +1 -0
  5. package/dist/assets/AuditTab-BOu6pgTB.js +1 -0
  6. package/dist/assets/BridgeTab-DFpunFsv.js +1 -0
  7. package/dist/assets/ChatDefaultsTab-DkHZTknY.js +1 -0
  8. package/dist/assets/{DataTableShell-CySP6pgB.js → DataTableShell-KGrtOG5M.js} +1 -1
  9. package/dist/assets/{DetailChips-CqgbiqUw.js → DetailChips-C2LFFpNg.js} +1 -1
  10. package/dist/assets/FeedbacksTab-D34MEu6C.js +1 -0
  11. package/dist/assets/{FieldLabel-CyXK3G_H.js → FieldLabel-CKVYl95W.js} +1 -1
  12. package/dist/assets/FilesTab-ByKXXey8.js +1 -0
  13. package/dist/assets/{FilterBar-irfwrPVv.js → FilterBar-BVVVO1_O.js} +1 -1
  14. package/dist/assets/GroupsTab-CJUI6gQ9.js +1 -0
  15. package/dist/assets/InstancesTab-Cb_2msXj.js +1 -0
  16. package/dist/assets/IntegrationsTab-B9Nkc7-l.js +1 -0
  17. package/dist/assets/KpiTab-B6SqslSj.js +1 -0
  18. package/dist/assets/PreferencesTab-BdvOFp2E.js +1 -0
  19. package/dist/assets/PromptInjectionsTab-CgAFhOn5.js +4 -0
  20. package/dist/assets/RolesTab-CtV113pW.js +1 -0
  21. package/dist/assets/ServiceAccountsTab-Bu_j0kUL.js +1 -0
  22. package/dist/assets/SubAgentReportsTab-G_s4_aPf.js +1 -0
  23. package/dist/assets/ThemeShowroom-CbU-xJra.js +1 -0
  24. package/dist/assets/{TimeRangePicker-3h2VniWx.js → TimeRangePicker-NSOkx3C0.js} +1 -1
  25. package/dist/assets/TracesTab-Wo-rxO1v.js +1 -0
  26. package/dist/assets/UsersTab-DO7Wa8iJ.js +1 -0
  27. package/dist/assets/VoiceTab-ilUT53Ds.js +1 -0
  28. package/dist/assets/{button-Dbs-wspp.js → button-b04wLuGq.js} +1 -1
  29. package/dist/assets/{card-B_7M0l5O.js → card-DdBF2ct9.js} +1 -1
  30. package/dist/assets/chevrons-up-down-Kyw8BbOf.js +1 -0
  31. package/dist/assets/{compatView-CeYXlVzu.js → compatView-S4X8HKXY.js} +1 -1
  32. package/dist/assets/dispatchErrorInfo-Cs8_1qCQ.js +1 -0
  33. package/dist/assets/{dist-CF-vNq7s.js → dist-6oi7FQ0i.js} +1 -1
  34. package/dist/assets/{dist-CZwMA8Oj.js → dist-CtUr3P8h.js} +1 -1
  35. package/dist/assets/{dist-BC4E1wqn.js → dist-DBet7oNc.js} +1 -1
  36. package/dist/assets/{dist-D8Kd0X5G.js → dist-HBBi9Y25.js} +5 -5
  37. package/dist/assets/{highlighted-body-OFNGDK62-DSPtdVav.js → highlighted-body-OFNGDK62-BOjjbbd6.js} +1 -1
  38. package/dist/assets/{index-BH6LVgWl.css → index-CBZrw7d-.css} +1 -1
  39. package/dist/assets/index-DBQ43N4_.js +238 -0
  40. package/dist/assets/mermaid-GHXKKRXX-CXCdU_oF.js +1 -0
  41. package/dist/assets/{pdf-Dwqw551E.js → pdf-D7AA0FY6.js} +1 -1
  42. package/dist/assets/roleDescriptions-onSlZ7A3.js +1 -0
  43. package/dist/assets/{table-RDie4v3L.js → table-CtNwimV_.js} +1 -1
  44. package/dist/assets/{tabs-uwXJdjSE.js → tabs-BJyz65LR.js} +1 -1
  45. package/dist/assets/x-DBKGK4o_.js +1 -0
  46. package/dist/index.html +8 -8
  47. package/package.json +1 -1
  48. package/dist/assets/AccessTab-C5QpmPe2.js +0 -1
  49. package/dist/assets/AgentFilesTab-DgyYp1Yu.js +0 -3
  50. package/dist/assets/AnomaliesTab-BfvM_oKR.js +0 -1
  51. package/dist/assets/AuditTab-B5U0zwjP.js +0 -1
  52. package/dist/assets/BridgeTab-BHnMaTub.js +0 -1
  53. package/dist/assets/ChatDefaultsTab-BKky_1Av.js +0 -1
  54. package/dist/assets/FeedbacksTab-UO9aY9Rc.js +0 -1
  55. package/dist/assets/FilesTab-BAhDA2Oi.js +0 -1
  56. package/dist/assets/GroupsTab-KElXEjtm.js +0 -1
  57. package/dist/assets/InstancesTab-CnxJKNrU.js +0 -1
  58. package/dist/assets/IntegrationsTab-C_WMMnfP.js +0 -1
  59. package/dist/assets/KpiTab-DLCBfUyr.js +0 -1
  60. package/dist/assets/PreferencesTab-CsHMsOBx.js +0 -1
  61. package/dist/assets/PromptInjectionsTab-Iuv2LIWX.js +0 -4
  62. package/dist/assets/RolesTab-JyOSiabk.js +0 -1
  63. package/dist/assets/ServiceAccountsTab-C1S0vg1x.js +0 -1
  64. package/dist/assets/SubAgentReportsTab-DmMB0i9U.js +0 -1
  65. package/dist/assets/ThemeShowroom-DxS8vmei.js +0 -1
  66. package/dist/assets/TracesTab-DTrYQKIz.js +0 -1
  67. package/dist/assets/UsersTab-Bg8hwoUX.js +0 -1
  68. package/dist/assets/VoiceTab-CjWmW8mr.js +0 -1
  69. package/dist/assets/chevrons-up-down-CGy16B32.js +0 -1
  70. package/dist/assets/dispatchErrorInfo-CgEoICK4.js +0 -1
  71. package/dist/assets/index-Se6baszB.js +0 -233
  72. package/dist/assets/mermaid-GHXKKRXX-C_IvlBqL.js +0 -1
  73. package/dist/assets/roleDescriptions-DuRh679l.js +0 -1
  74. package/dist/assets/x-B-jDgsYW.js +0 -1
@@ -0,0 +1 @@
1
+ import{Gy as e,Jy as t,Ky as n,Yy as r,qy as i}from"./dist-HBBi9Y25.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{n}from"./dist-D8Kd0X5G.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{n}from"./dist-HBBi9Y25.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{d as r,f as i,h as a,n as o,t as s,u as c,v as l,y as u}from"./dist-D8Kd0X5G.js";import{t as d}from"./dist-BC4E1wqn.js";import{Dt as f,Et as p,Ot as m}from"./index-Se6baszB.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=a(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:s=`horizontal`,dir:l,activationMode:f=`automatic`,...p}=e,m=d(l),[h,v]=i({prop:r,onChange:a,defaultProp:o??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:c(),value:h,onValueChange:v,orientation:s,dir:m,activationMode:f,children:(0,g.jsx)(u.div,{dir:m,"data-orientation":s,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=S(w,n),o=b(n);return(0,g.jsx)(f,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(u.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=S(E,n),s=b(n),c=A(o.baseId,r),d=j(o.baseId,r),f=r===o.value;return(0,g.jsx)(p,{asChild:!0,...s,focusable:!i,active:f,children:(0,g.jsx)(u.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":d,"data-state":f?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:l(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:l(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:l(e.onFocus,()=>{let e=o.activationMode!==`manual`;!f&&!i&&e&&o.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:a,children:o,...s}=e,c=S(O,n),l=A(c.baseId,i),d=j(c.baseId,i),f=i===c.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(r,{present:a||f,children:({present:n})=>(0,g.jsx)(u.div,{"data-state":f?`active`:`inactive`,"data-orientation":c.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&o})})});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:o(`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:o(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:o(`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:o(`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{d as r,f as i,h as a,n as o,t as s,u as c,v as l,y as u}from"./dist-HBBi9Y25.js";import{t as d}from"./dist-DBet7oNc.js";import{Dt as f,Et as p,Ot as m}from"./index-DBQ43N4_.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=a(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:a,defaultValue:o,orientation:s=`horizontal`,dir:l,activationMode:f=`automatic`,...p}=e,m=d(l),[h,v]=i({prop:r,onChange:a,defaultProp:o??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:c(),value:h,onValueChange:v,orientation:s,dir:m,activationMode:f,children:(0,g.jsx)(u.div,{dir:m,"data-orientation":s,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=S(w,n),o=b(n);return(0,g.jsx)(f,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,g.jsx)(u.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=S(E,n),s=b(n),c=A(o.baseId,r),d=j(o.baseId,r),f=r===o.value;return(0,g.jsx)(p,{asChild:!0,...s,focusable:!i,active:f,children:(0,g.jsx)(u.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":d,"data-state":f?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:l(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:l(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:l(e.onFocus,()=>{let e=o.activationMode!==`manual`;!f&&!i&&e&&o.onValueChange(r)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:a,children:o,...s}=e,c=S(O,n),l=A(c.baseId,i),d=j(c.baseId,i),f=i===c.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(r,{present:a||f,children:({present:n})=>(0,g.jsx)(u.div,{"data-state":f?`active`:`inactive`,"data-orientation":c.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:d,tabIndex:0,...s,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&o})})});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:o(`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:o(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:o(`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:o(`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"./dist-HBBi9Y25.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
@@ -53,15 +53,15 @@
53
53
  document.documentElement.dataset.motion = "static";
54
54
  })();
55
55
  </script>
56
- <script type="module" crossorigin src="/assets/index-Se6baszB.js"></script>
56
+ <script type="module" crossorigin src="/assets/index-DBQ43N4_.js"></script>
57
57
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
58
- <link rel="modulepreload" crossorigin href="/assets/dist-D8Kd0X5G.js">
59
- <link rel="modulepreload" crossorigin href="/assets/dist-BC4E1wqn.js">
60
- <link rel="modulepreload" crossorigin href="/assets/dist-CZwMA8Oj.js">
61
- <link rel="modulepreload" crossorigin href="/assets/dist-CF-vNq7s.js">
62
- <link rel="modulepreload" crossorigin href="/assets/x-B-jDgsYW.js">
63
- <link rel="modulepreload" crossorigin href="/assets/button-Dbs-wspp.js">
64
- <link rel="stylesheet" crossorigin href="/assets/index-BH6LVgWl.css">
58
+ <link rel="modulepreload" crossorigin href="/assets/dist-HBBi9Y25.js">
59
+ <link rel="modulepreload" crossorigin href="/assets/dist-DBet7oNc.js">
60
+ <link rel="modulepreload" crossorigin href="/assets/dist-CtUr3P8h.js">
61
+ <link rel="modulepreload" crossorigin href="/assets/dist-6oi7FQ0i.js">
62
+ <link rel="modulepreload" crossorigin href="/assets/x-DBKGK4o_.js">
63
+ <link rel="modulepreload" crossorigin href="/assets/button-b04wLuGq.js">
64
+ <link rel="stylesheet" crossorigin href="/assets/index-CBZrw7d-.css">
65
65
  </head>
66
66
  <body>
67
67
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.49.0",
3
+ "version": "0.51.0",
4
4
  "description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$u as r,E as i,Ju as a,Ku as o,Qu as s,Xu as c,Yu as l,Zu as u,ad as d,ed as f,hM as p,id as m,nd as h,oM as g,od as _,qu as v,rd as y,td as b}from"./dist-D8Kd0X5G.js";import{C as x,S,b as C,ct as w,w as T,x as E}from"./index-Se6baszB.js";var D=t(e(),1);function O(e){return e===`user`?c():e===`all`?l():a({group:e.group})}function k(e){return e===`common`?v():e===`owner`?o():a({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=p(i.admin.listUsers,{}),[t,n]=(0,D.useState)(``),a=p(i.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),(0,A.jsxs)(C,{value:t,onValueChange:n,children:[(0,A.jsx)(x,{size:`sm`,"aria-label":d(),children:(0,A.jsx)(T,{placeholder:d()})}),(0,A.jsx)(E,{children:(e??[]).map(e=>(0,A.jsx)(S,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):a===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:g()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:y()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:a.user.label}),(0,A.jsx)(w,{variant:`secondary`,children:a.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),a.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.groups.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:b()}),a.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(w,{variant:`default`,children:u()}):null,(0,A.jsx)(w,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(w,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),a.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:a.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(w,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:r()}),a.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:s()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:a.permissions.map(e=>(0,A.jsx)(w,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ac as r,Ar as i,Bc as a,Br as o,Cc as s,Cr as c,Dc as l,Dr as u,E as d,Ec as f,Er as p,Fc as m,Fr as h,HE as g,Hr as _,Ic as v,Ir as y,Lc as b,Lr as x,Mc as S,Mr as C,Nc as w,Nr as T,Oc as E,Or as D,Pc as ee,Pr as O,Rc as te,Rr as ne,Sc as k,Sl as re,Sr as A,Tc as j,Tr as M,Vc as N,Vr as P,_c as F,bc as ie,cM as I,dr as L,fM as R,fc as ae,fr as z,gc as B,hM as V,hc as oe,hr as se,jc as ce,jr as H,kc as le,kr as U,lr as ue,mM as de,mc as fe,mr as pe,oM as W,pc as me,pr as he,ur as ge,vc as _e,wc as ve,wl as G,wr as ye,xc as be,yc as xe,zc as Se,zr as Ce}from"./dist-D8Kd0X5G.js";import{t as K}from"./button-Dbs-wspp.js";import{At as q,C as we,G as Te,H as Ee,J as De,K as Oe,S as ke,U as Ae,W as je,Y as Me,b as Ne,ct as Pe,dt as Fe,ft as Ie,ht as Le,mt as Re,q as ze,ut as Be,w as Ve,x as He,xt as Ue,y as We,z as J}from"./index-Se6baszB.js";import{n as Ge,t as Ke}from"./curation-CQksaIbm.js";import{i as qe}from"./compatView-CeYXlVzu.js";/* empty css */var Y=t(e(),1),X=2e4,Je=6e4;function Ye(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Xe(e){return e<=0?0:Math.round(e/Je*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Ze(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var Qe=3;function $e(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<Qe&&a.push(e)):t>0&&(i+=t,o.length<Qe&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function et(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function tt(){let e=V(d.me.getMe,{host:Ue}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),i=V(d.admin.listInstances,e!==void 0&&t?{}:`skip`),[o,s]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!i||i.length===0||(!o||!i.some(e=>e.name===o))&&s(i[0].name)},[t,i,o]);let c=V(d.agents.listAgentsForInstance,t&&o?{instanceName:o}:`skip`),l=V(d.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),u=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return o===null||c===void 0?i!==void 0&&i.length===0?[]:void 0:c.agents.map(e=>({instanceName:o,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(l!==void 0)return l.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,o,c,i,l]),[f,p]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!u||u.length===0||(!f||!u.some(e=>$(e)===f))&&p($(u[0]))},[u,f]);let h=u?.find(e=>$(e)===f)??null,g=R(d.agentFiles.listAgentFiles),[_,y]=(0,Y.useState)({status:`idle`}),C=h?.instanceName??null,T=h?.agentId??null,E=V(d.compat.forInstance,n&&C!==null?{instanceName:C}:`skip`),D=n&&C!==null?We(E,`agentFiles`):null,O=D===null?!1:D===`loading`?null:D.blocked,k=(0,Y.useCallback)(async()=>{if(!(C===null||T===null)){y({status:`loading`});try{y({status:`done`,files:(await g({instanceName:C,agentId:T})).files})}catch{y({status:`error`})}}},[g,C,T]);(0,Y.useEffect)(()=>{O===!1&&k()},[k,O]);let[A,j]=(0,Y.useState)(null),M=V(d.agentFileCuration.listCurations,t&&C!==null&&T!==null?{instanceName:C,agentId:T}:`skip`),P=V(d.agentFileCuration.curationSettings,t&&C!==null?{instanceName:C}:`skip`),F=R(d.agentFileCuration.requestCuration),[ie,L]=(0,Y.useState)(null),[ae,z]=(0,Y.useState)(null),{toast:B}=J(),oe=(0,Y.useMemo)(()=>{let e=new Map;for(let t of M??[])e.has(t.name)||e.set(t.name,t);return e},[M]),se=(0,Y.useCallback)(async e=>{if(!(C===null||T===null)){L(e);try{let t=await F({instanceName:C,agentId:T,name:e,trigger:`manual`});t.ok?B({title:Ce(),variant:`success`}):B({title:ne({reason:t.reason??`unknown`}),variant:`error`})}catch{B({title:x(),variant:`error`})}finally{L(null)}}},[F,C,T,B]),H=I(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]);return e===void 0||u===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:N()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(i?.length??0)>1?(0,Q.jsxs)(Ne,{value:o??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":a(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:(i??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,u.length>0?(0,Q.jsxs)(Ne,{value:f??``,onValueChange:e=>p(e),children:[(0,Q.jsx)(we,{size:`sm`,"aria-label":Se(),children:(0,Q.jsx)(Ve,{})}),(0,Q.jsx)(He,{children:u.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()})]}),h===null?null:D===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):D!==null&&D.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(q,{size:14,"aria-hidden":!0}),` `,qe(D.gatewayVersion,D.provider)]}):_.status===`loading`||_.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):_.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[v(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void k(),children:re()})]}):_.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:_.files.map(e=>{let n=Ye(e.size),i=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Pe,{variant:`outline`,children:m()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:ee({size:Z(e.size,H)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${i?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:w({pct:U.format(n)})}),i?(0,Q.jsx)(q,{size:14,className:`oc-afiles__warn`,"aria-label":S()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>j(e),children:t?r():le()}),t&&!e.missing?(0,Q.jsx)(nt,{curatable:Ke.includes(e.name),size:e.size??0,budget:P?.budgetChars??null,enabled:P?.enabled??!1,curation:oe.get(e.name)??null,inFlight:ie===e.name,onCurate:()=>void se(e.name),onReview:e=>z(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ce({used:Z(Ze(_.files),H),total:Z(Je,H),pct:U.format(Xe(Ze(_.files)))})})]}),A&&h?(0,Q.jsx)(rt,{instanceName:h.instanceName,agentId:h.agentId,name:A.name,isAdmin:t,onClose:()=>j(null),onSaved:()=>void k()}):null,ae?(0,Q.jsx)(it,{curationId:ae,onClose:()=>z(null),onApplied:()=>{z(null),k()}}):null]})}function nt({curatable:e,size:t,budget:n,enabled:r,curation:i,inFlight:a,onCurate:s,onReview:c}){return i?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(i._id),children:P()}):a||i?.status===`dispatched`||i?.status===`applying`?(0,Q.jsx)(Pe,{variant:`outline`,className:`oc-afiles__curate-status`,children:o()}):e&&r&&n!==null&&Ge(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:_()}):null}function rt({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=R(d.agentFiles.getAgentFile),c=R(d.agentFiles.setAgentFile),u=J(),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(``),[b,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(!1),[w,T]=(0,Y.useState)(!1),[D,ee]=(0,Y.useState)(!1),O=(0,Y.useCallback)(async r=>{_(!1);try{let i=await o({instanceName:e,agentId:t,name:n});m({content:i.content,updatedAtMs:i.updatedAtMs}),r||y(i.content),T(!1)}catch{_(!0)}},[o,e,t,n]);(0,Y.useEffect)(()=>{O(!1)},[O]);async function te(){if(p!==null){C(!0),ee(!1);try{await c({instanceName:e,agentId:t,name:n,content:v,baseUpdatedAtMs:p.updatedAtMs??void 0}),u.success(k({name:n})),a(),await O(!1)}catch(e){et(e)?T(!0):ee(!0)}finally{C(!1)}}}let ne=p!==null&&v!==p.content,A=(0,Y.useMemo)(()=>p===null?null:$e(p.content,v),[p,v]),M=v.length>X,N=I(),P=(0,Y.useMemo)(()=>new Intl.NumberFormat(N),[N]);return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:E({name:n})}),(0,Q.jsxs)(Ie,{children:[l({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,f()]})]})]}),h?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ie(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void O(!1),children:re()})]}):p===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:v,readOnly:!r,spellCheck:!1,onChange:e=>y(e.target.value),"aria-label":E({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:j()}),w?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[xe(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void O(!0),children:_e()})]}):null,D?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:be()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${M?` is-over`:``}`,children:ve({count:P.format(v.length),max:P.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!ne||S||w,onClick:()=>x(!0),children:S?G():s()}):null]})]}),(0,Q.jsx)(Ee,{open:b,onOpenChange:x,children:(0,Q.jsxs)(Te,{children:[(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Me,{children:F({name:n})}),(0,Q.jsx)(Oe,{children:B({agent:t})})]}),A?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:oe({added:A.added,removed:A.removed})}),A.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:fe()}),A.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,A.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:me()}),A.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(je,{children:g()}),(0,Q.jsx)(Ae,{onClick:()=>void te(),children:ae()})]})]})})]})})}function it({curationId:e,onClose:t,onApplied:n}){let r=V(d.agentFileCuration.getProposal,{curationId:e}),a=R(d.agentFileCuration.approveCuration),o=de(d.agentFileCuration.rejectCuration),{toast:s}=J(),[l,f]=(0,Y.useState)(null),[m,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(``),b=I(),S=(0,Y.useMemo)(()=>r?$e(r.beforeContent,r.proposedContent):null,[r]);async function w(){f(`approve`);try{let t=await a({curationId:e});t.ok?(s({title:y(),variant:`success`}),n()):s({title:t.reason===`conflict`?O():T({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:x(),variant:`error`})}finally{f(null)}}async function E(n){f(`reject`);try{let r=_.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?ge():h(),variant:`success`}):s({title:i(),variant:`error`}),t()}catch{s({title:x(),variant:`error`})}finally{f(null)}}return(0,Q.jsx)(Be,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Fe,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Re,{children:[(0,Q.jsx)(Le,{children:r?C({name:r.name}):W()}),(0,Q.jsx)(Ie,{children:H()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:W()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[U({before:Z(r.beforeSize,b),after:Z(r.proposedSize,b)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(q,{size:13,"aria-hidden":!0}),` `,D()]}):null]}),S?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:u({added:S.added,removed:S.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:ue({feedback:r.feedback})}):null,S&&S.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:A()}),(0,Q.jsx)(`ul`,{children:S.sampleRemoved.map((e,t)=>(0,Q.jsx)(`li`,{children:e||`\xA0`},t))})]}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__review-panes oc-afiles__review-panes--2`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:c()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:p()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),m?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:se()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:pe(),value:_,onChange:e=>v(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>g(!1),disabled:l!==null,children:he()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void E(!1),disabled:l!==null,children:l===`reject`?G():z()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void E(!0),disabled:l!==null,children:l===`reject`?G():L()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>g(!0),disabled:l!==null||r==null,children:M()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void w(),disabled:l!==null||r==null,children:l===`approve`?G():ye()})]})]})})}export{tt as AgentFilesTab};
@@ -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,Bv as ee,E as a,Fv as o,Gv as te,Hv as ne,Iv as s,Jv as re,Kv as c,Lv as l,Mv as u,Nv as d,Pv as f,Qv as ie,Rv as p,Sy as m,Uv as ae,Vv as oe,Wv as se,Xv as ce,Yv as h,Zv as g,_y as le,ay as ue,by as _,cy as de,dy as fe,ey as pe,fy as me,gy as he,hM as v,hy as ge,iy as _e,jv as y,ly as ve,mM as ye,my as b,ny as x,oy as S,py as C,qv as w,ry as T,sy as E,ty as D,uy as O,vy as k,xy as A,yy as j,zv as M}from"./dist-D8Kd0X5G.js";import{B as N,C as P,S as F,Xt as be,Yt as I,a as xe,b as L,ct as R,dt as z,et as Se,ht as B,mt as V,r as Ce,ut as H,w as U,x as W,xt as we,z as Te}from"./index-Se6baszB.js";import{n as Ee}from"./TimeRangePicker-3h2VniWx.js";import{t as De}from"./FilterBar-irfwrPVv.js";import{t as Oe}from"./DataTableShell-CySP6pgB.js";import{t as G}from"./dispatchErrorInfo-CgEoICK4.js";var K=t(e(),1),q=n(),J=`__all__`,ke=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Ae(e){return e===`open`?m():e===`acknowledged`?A():_()}var je=[`info`,`warn`,`critical`],Me=[`detector`,`agent`,`user`],Ne={kind:`relative`,from:`now-30d`,to:`now`},Pe=200,Y=`all`;function X(){let e=be({from:`/settings/anomalies`}),t=I({from:`/settings/anomalies`}),n=e.q??``,i=e.status===Y?J:e.status,o=e.severity??J,s=e.kind??J,[l,u]=(0,K.useState)(J),d=Ce(e.from,e.to),{from:f,to:m}=Ee(d),_=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),y=e=>void t({search:t=>({...t,status:e===J?Y:e})}),A=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})}),B=e=>void t({search:t=>({...t,...xe(e)})}),V=N(),H=Te(),G=ye(a.anomalies.resolveAnomaly),X=(v(a.me.getMe,{host:we})?.permissions??[]).includes(`admin.manage`),Z=v(a.anomalies.listAnomalies,{limit:Pe,filter:{q:n||void 0,from:f,to:m,anomalyStatus:i===J?void 0:i,severity:o===J?void 0:o,source:l===J?void 0:l,kind:s===J?void 0:s}}),Q=(0,K.useMemo)(()=>{let e=new Set;for(let t of Z??[])e.add(t.kind);return[...e].sort()},[Z]),ze=n!==``||i!==`open`||o!==J||l!==J||s!==J||d.kind!==`relative`||d.from!==Ne.from;function Be(){u(J),t({search:{status:`open`},replace:!0})}async function Ve(e){if(await V({title:j(),description:(0,q.jsxs)(q.Fragment,{children:[k(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,le(),` `,(0,q.jsx)(`strong`,{children:he()}),`.`,` `,ge()]}),confirmLabel:b()}))try{await G({anomalyId:e._id,status:`resolved`}),H.success(C(),e.kind)}catch(e){H.error(me(),e)}}async function He(e){try{await G({anomalyId:e._id,status:`acknowledged`}),H.success(fe(),e.kind)}catch(e){H.error(O(),e)}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`p`,{className:`oc-admin__hint`,children:[ve(),` `,(0,q.jsx)(`strong`,{children:de()}),` `,E(),` `,(0,q.jsx)(`strong`,{children:S()}),` `,ue(),` `,(0,q.jsx)(`strong`,{children:_e()}),` `,T(),` `,(0,q.jsx)(`span`,{className:`oc-filter__window`,children:x()})]}),(0,q.jsxs)(De,{q:n,onQChange:_,searchPlaceholder:D(),timeRange:d,onTimeRangeChange:B,onReset:Be,canReset:ze,children:[(0,q.jsxs)(L,{value:i,onValueChange:y,children:[(0,q.jsx)(P,{size:`sm`,className:`w-36`,children:(0,q.jsx)(U,{})}),(0,q.jsxs)(W,{children:[(0,q.jsx)(F,{value:J,children:pe()}),ke.map(e=>(0,q.jsx)(F,{value:e.value,children:Ae(e.value)},e.value))]})]}),(0,q.jsxs)(L,{value:o,onValueChange:A,children:[(0,q.jsx)(P,{size:`sm`,className:`w-36`,children:(0,q.jsx)(U,{placeholder:r()})}),(0,q.jsxs)(W,{children:[(0,q.jsx)(F,{value:J,children:ie()}),je.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(L,{value:l,onValueChange:u,children:[(0,q.jsx)(P,{size:`sm`,className:`w-32`,children:(0,q.jsx)(U,{placeholder:g()})}),(0,q.jsxs)(W,{children:[(0,q.jsx)(F,{value:J,children:ce()}),Me.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]}),(0,q.jsxs)(L,{value:s,onValueChange:z,children:[(0,q.jsx)(P,{size:`sm`,className:`w-36`,children:(0,q.jsx)(U,{placeholder:h()})}),(0,q.jsxs)(W,{children:[(0,q.jsx)(F,{value:J,children:re()}),Q.map(e=>(0,q.jsx)(F,{value:e,children:e},e))]})]})]}),(0,q.jsx)(Oe,{title:w(),rows:Z,emptyHint:i===`open`?c():te(),rowActions:e=>X&&e.status===`open`?[{label:se(),onSelect:()=>void Ve(e)},{label:ae(),onSelect:()=>void He(e)}]:[],columns:[{header:ne(),cell:e=>(0,q.jsx)(`span`,{className:`oc-traces__time`,children:Se(e.at)}),sort:e=>e.at},{header:h(),cell:e=>(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:r(),cell:e=>(0,q.jsx)(Le,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:oe(),cell:e=>(0,q.jsx)($,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:g(),cell:e=>(0,q.jsx)(R,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:ee(),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)(Ie,{row:e})]}),sort:e=>e.message},{header:M(),cell:e=>(0,q.jsx)(Fe,{row:e}),sort:e=>e.evidence??null},{header:p(),cell:e=>e.correlationId?(0,q.jsx)(`code`,{className:`oc-traces__mono`,children:Re(e.correlationId)}):(0,q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function Z(e){if(e.kind!==`openclaw.dispatch_failures`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{dominantCode:t.dominantCode,sampleCorrelationId:t.sampleCorrelationId}}catch{return{}}}function Q(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 Fe({row:e}){let t=I();if(e.kind===`subagent.failure`){let n=Q(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:[`↗ `,l()]}):null]})}let n=Z(e);if(!n.dominantCode)return(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:{q:i,limit:100}}),children:[`↗ `,l()]}):null]})}function Ie({row:e}){let[t,n]=(0,K.useState)(!1),r=v(a.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:[s(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,q.jsx)(H,{open:t,onOpenChange:n,children:(0,q.jsxs)(z,{className:`oc-anomaly__attachments-dialog`,children:[(0,q.jsx)(V,{children:(0,q.jsx)(B,{children:o()})}),r===void 0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:f()}):r.length===0?(0,q.jsx)(`p`,{className:`oc-traces__muted`,children:d()}):(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 Le({severity:e}){return(0,q.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function $({status:e}){return e===`open`?(0,q.jsx)(R,{variant:`destructive`,children:u()}):e===`acknowledged`?(0,q.jsx)(R,{variant:`secondary`,children:y()}):(0,q.jsx)(R,{variant:`outline`,children:i()})}function Re(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{Cb as r,Db as i,E as a,Eb as o,Sb as s,Sn as c,Tb as l,_b as u,_n as d,bb as f,bn as p,gb as m,hM as h,hb as g,mb as _,pb as v,vb as y,vn as b,wb as x,xb as S,xn as C,yb as w,yn as T}from"./dist-D8Kd0X5G.js";import{C as E,S as D,Xt as O,Yt as k,a as A,b as j,et as M,i as N,o as P,r as F,t as I,w as L,x as R}from"./index-Se6baszB.js";import{n as ee}from"./TimeRangePicker-3h2VniWx.js";import{t as z}from"./FilterBar-irfwrPVv.js";import{t as B}from"./AdvancedFilter-BzRzcaLe.js";import{t as V}from"./DataTableShell-CySP6pgB.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:I,to:`now`},G=`__all__`,K=[{value:`action`,label:c()},{value:`realLabel`,label:C()},{value:`targetLabel`,label:p()},{value:`impersonated`,label:T()},{value:`resource`,label:b()},{value:`resourceId`,label:d()}];function q(){let e=O({from:`/settings/audit`}),t=k({from:`/settings/audit`}),n=e.q??``,c=e.action??G,d=e.impersonated??G,p=e.resource??G,b=F(e.from,e.to),C=(0,H.useMemo)(()=>P(e.adv),[e.adv]),{from:T,to:I}=ee(b),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,...A(e)})}),Q=e=>void t({search:t=>({...t,adv:N(e)}),replace:!0}),$=h(a.admin.listAudit,{filter:{q:n||void 0,from:T,to:I,action:c===G?void 0:c,resource:p===G?void 0:p,impersonated:d===G?void 0:d===`yes`,advanced:C.length>0?C: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!==``||c!==G||d!==G||p!==G||C.length>0||b.kind!==`relative`||b.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:[i(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:o()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:l(),timeRange:b,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(j,{value:c,onValueChange:J,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:x()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:r()}),te.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]}),(0,U.jsxs)(j,{value:d,onValueChange:Y,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:s()}),(0,U.jsx)(D,{value:`yes`,children:S()}),(0,U.jsx)(D,{value:`no`,children:f()})]})]}),(0,U.jsxs)(j,{value:p,onValueChange:X,children:[(0,U.jsx)(E,{size:`sm`,className:`w-40`,children:(0,U.jsx)(L,{placeholder:w()})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(D,{value:G,children:y()}),ne.map(e=>(0,U.jsx)(D,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:C,onChange:Q}),(0,U.jsx)(V,{title:u(),rows:$,emptyHint:m(),columns:[{header:g(),cell:e=>M(e.at),sort:e=>e.at},{header:x(),cell:e=>e.action,sort:e=>e.action},{header:_(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:v(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:w(),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{$s as r,Ag as i,Ah as a,Bh as o,Bt as s,Cg as c,Ch as l,D as u,Dg as d,Dh as f,E as p,Eg as m,Eh as h,Fh as g,Gh as ee,Gs as _,Hh as te,Ht as v,Ih as ne,Jh as re,Js as y,Kh as ie,Ks as b,Kt as x,Lh as ae,Mh as oe,Nh as S,Og as se,Oh as ce,Ph as le,Qs as ue,Rh as de,Sg as fe,Sh as pe,Tg as me,Th as he,Uh as ge,Us as _e,Ut as ve,Vh as ye,Vt as be,Wh as xe,Ws as Se,Xs as C,Yh as Ce,Ys as we,Zs as Te,_g as Ee,_h as De,ah as Oe,bh as ke,ch as Ae,dh as je,ec as Me,eh as Ne,fM as Pe,fh as Fe,gh as Ie,hM as w,hh as Le,ih as Re,jg as ze,jh as Be,kh as Ve,lh as He,mM as Ue,mh as T,nh as We,oh as Ge,ph as Ke,qh as qe,qs as Je,rh as Ye,sh as Xe,tc as Ze,th as E,uh as Qe,vg as $e,vh as et,wg as tt,wh as nt,xg as rt,xh as it,yh as at,zh as ot,zs as st,zt as ct}from"./dist-D8Kd0X5G.js";import{i as D,r as lt}from"./dist-BC4E1wqn.js";import{t as ut}from"./chevrons-up-down-CGy16B32.js";import{i as dt,n as O,o as ft,r as pt,s as mt}from"./FieldLabel-CyXK3G_H.js";import{i as ht,n as gt,r as _t,t as vt}from"./tabs-uwXJdjSE.js";import{t as k}from"./button-Dbs-wspp.js";import{At as A,C as j,Kt as yt,Nt as bt,Q as xt,S as M,X as St,Xt as Ct,Yt as wt,Z as Tt,b as N,ct as P,dt as Et,et as F,ft as Dt,ht as Ot,lt as I,m as kt,mt as At,p as jt,qt as L,tt as R,ut as Mt,w as z,x as B,xt as Nt,z as Pt,zt as Ft}from"./index-Se6baszB.js";import{r as It}from"./locales-CPjguROj.js";import{a as V,i as H,n as Lt,o as U,r as W,t as Rt}from"./table-RDie4v3L.js";import{t as zt}from"./FilterBar-irfwrPVv.js";import{a as Bt,n as Vt,o as Ht,r as Ut,s as Wt,t as Gt}from"./compatView-CeYXlVzu.js";import{t as G}from"./dispatchErrorInfo-CgEoICK4.js";var Kt=u(`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`}]]),qt=u(`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`}]]),K=t(e(),1);function Jt(e){return e.filter(e=>e.state===`error`)}function Yt(e){return e.reachable&&Jt(e.targets).length===0}function Xt(e){return e.state===`error`&&e.lastErrorCode!==null}function Zt(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function Qt(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function $t(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,q(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(q(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return Qt(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>q(e)===r)}))}function J(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var Y=`__all__`,en={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function tn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function nn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function Z(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function rn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function an(e,t,n){switch(e){case`state`:return(X[t.state]??99)-(X[n.state]??99);case`instance`:return Z(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return Z(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Ht(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function on(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=rn(t.key,e),a=rn(t.key,r);return i&&a?0:i?1:a?-1:n*an(t.key,e,r)})}function sn(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(X[e]??99)-(X[t]??99))}function cn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>Z(e.label,t.label))}function ln(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Ht(e,t)??Z(e,t))}var Q=n();function un({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(en),[i,a]=(0,K.useState)(null),o=(0,K.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),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null})),[e,t]),s=(0,K.useMemo)(()=>sn(o),[o]),c=(0,K.useMemo)(()=>cn(o),[o]),l=(0,K.useMemo)(()=>ln(o),[o]),u=(0,K.useMemo)(()=>on(nn(o,n),i),[o,n,i]);function d(e){a(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(zt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Le(),onReset:()=>r(en),canReset:tn(n),children:[(0,Q.jsxs)(N,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(z,{placeholder:Ke()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(M,{value:Y,children:T()}),s.map(e=>(0,Q.jsx)(M,{value:e,children:fn(e)},e))]})]}),(0,Q.jsxs)(N,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(z,{placeholder:Fe()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(M,{value:Y,children:T()}),c.map(e=>(0,Q.jsx)(M,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(N,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(z,{placeholder:je()})}),(0,Q.jsxs)(B,{children:[(0,Q.jsx)(M,{value:Y,children:T()}),l.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))]})]})]}),u.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Qe()}):(0,Q.jsxs)(Rt,{className:`oc-conn__table`,children:[(0,Q.jsx)(V,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)($,{label:He(),sortKey:`target`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ae(),sortKey:`state`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Xe(),sortKey:`instance`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Ge(),sortKey:`host`,sort:i,onSort:d}),(0,Q.jsx)($,{label:Oe(),sortKey:`version`,sort:i,onSort:d}),(0,Q.jsx)(H,{children:Re()}),(0,Q.jsx)($,{label:Ye(),sortKey:`lastOk`,sort:i,onSort:d})]})}),(0,Q.jsx)(Lt,{children:u.map(e=>(0,Q.jsx)(dn,{r:e},e._id))})]})]})}function $({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Q.jsx)(H,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Q.jsx)(lt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ut,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function dn({r:e}){let t=Xt(e)?G(e.lastErrorCode):null,n=Zt(e)?G(e.lastDownstreamRejectCode):null;return(0,Q.jsxs)(K.Fragment,{children:[(0,Q.jsxs)(U,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Q.jsx)(W,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(pn,{state:e.state})}),(0,Q.jsx)(W,{children:e.instanceLabel?(0,Q.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Q.jsx)(W,{children:e.gatewayVersion?(0,Q.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Q.jsx)(W,{children:(0,Q.jsx)(`span`,{className:`oc-conn__stats`,children:De({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Q.jsx)(W,{children:e.lastOkAt?(0,Q.jsx)(`span`,{className:`oc-traces__mono`,children:R(e.lastOkAt)}):(0,Q.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),t||n?(0,Q.jsx)(U,{className:`oc-conn__detail-row`,children:(0,Q.jsxs)(W,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Q.jsx)(`strong`,{children:t.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${R(e.lastErrorAt)}`:``,(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,n?(0,Q.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Ie({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function fn(e){return e===`connected`?We():e===`error`?E():Ne()}function pn({state:e}){return e===`connected`?(0,Q.jsx)(P,{variant:`secondary`,children:We()}):e===`error`?(0,Q.jsx)(P,{variant:`destructive`,children:E()}):(0,Q.jsx)(P,{variant:`outline`,children:Ne()})}function mn(){return w(p.bridgeHealth.getBridgeHealth,{})}function hn(){let e=mn(),t=w(p.compat.getBridgeCompat,{}),n=w(p.me.getMe,{host:Nt})?.role===`admin`,r=w(p.admin.listInstances,n?{}:`skip`),i=w(p.agents.usageForInstances,n?{}:`skip`),a=wt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),c=$t(e?e.targets:[],t?t.targets:[],r??[]),{section:l}=Ct({from:`/settings/bridge`}),u=wt({from:`/settings/bridge`}),d=t?.compat??null,f=t===void 0?`loading`:t===null?`nodata`:`ready`,m=d!==null&&Vt(d,`hermes`)&&!c.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(gn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:g()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:le()}),(0,Q.jsxs)(Rt,{children:[(0,Q.jsx)(V,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)(H,{children:ve()}),(0,Q.jsx)(H,{children:v()}),(0,Q.jsx)(H,{children:be()}),(0,Q.jsx)(H,{children:s()}),(0,Q.jsx)(H,{children:ct()})]})}),(0,Q.jsx)(Lt,{children:i.flatMap(e=>{let t=kt(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Q.jsxs)(U,{children:[(0,Q.jsx)(W,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Q.jsx)(W,{children:t.provider}),(0,Q.jsx)(W,{children:t.label}),(0,Q.jsx)(W,{children:(0,Q.jsxs)(P,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Q.jsx)(W,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,c.length>0?(0,Q.jsxs)(vt,{value:c.some(e=>e.key===l)?l:c[0]?.key??`openclaw`,onValueChange:e=>void u({search:{section:e},replace:!0}),children:[(0,Q.jsx)(_t,{className:`w-full`,children:c.map(e=>(0,Q.jsxs)(ht,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(bt,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),c.map(e=>(0,Q.jsx)(gt,{value:e.key,children:(0,Q.jsx)(_n,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:d,compatStatus:f,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:st()}):null]})}function gn({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,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Bt(t.bridgeVersion)}),a?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:r(),children:[`(`,a,`)`]})]}):null,i?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,ue({build:t.buildVersion??`?`})]}):null,` · `,Te(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?C():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:h()});let s=Jt(e.targets),c=!e.reachable,u=Yt(e),d=u?`ok`:`error`,p=F(e.checkedAt),m=e.startedAt==null?null:F(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:u?(0,Q.jsx)(yt,{size:22}):c?(0,Q.jsx)(qt,{size:22}):(0,Q.jsx)(A,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:u?he():c?nt():l({count:s.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Kt,{size:12,"aria-hidden":!0}),` `,pe({time:p})]}),m?(0,Q.jsx)(`span`,{children:it({time:m})}):null,o]}),c?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:G(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Q.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:ke()})]})}function _n({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Wt(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:Gt(t,e,r)})}let d=l.map(e=>e.state),f=d.includes(`beyond`)?`beyond`:d.length>0&&d.every(e=>e===`supported`)?`supported`:null,[p,m]=(0,K.useState)(!1);return(0,Q.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Q.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Q.jsx)(bt,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),f?(0,Q.jsx)(P,{variant:f===`beyond`?`destructive`:`secondary`,children:Ut(f)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:Ze()}),(0,Q.jsx)(yn,{providerName:J(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Q.jsx)(vn,{protocol:o}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),at({count:t.length})]}),p?(0,Q.jsx)(un,{connections:t,displayByInstance:c}):null]})}function vn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[];return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[S(),i.length>0?(0,Q.jsx)(P,{variant:`destructive`,children:Be({count:i.length})}):(0,Q.jsx)(P,{variant:`secondary`,children:oe()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[a({version:e.vendoredVersion}),r?` · `+Ve({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(D,{size:13,"aria-hidden":!0}):(0,Q.jsx)(L,{size:13,"aria-hidden":!0}),ce({count:r.gapList.length})]}),t?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Q.jsx)(`li`,{children:(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function yn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Me()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:x({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:Je({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:C()}),e?(0,Q.jsx)(Cn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}):(0,Q.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Q.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Bt(e.version)}),(0,Q.jsx)(P,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:Ut(e.state)})]},e.instanceName))})]})}function bn({instance:e,onClose:t}){return(0,Q.jsx)(Mt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Et,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(At,{children:[(0,Q.jsx)(Ot,{children:ze({instance:e.displayName??e.name})}),(0,Q.jsx)(Dt,{children:i()})]}),(0,Q.jsx)(Sn,{instance:e,onClose:t})]})})}function xn({label:e,result:t}){return t?t.checked?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Q.jsx)(yt,{"aria-hidden":!0}):(0,Q.jsx)(A,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?ot():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,de()]}):null}function Sn({instance:e,onClose:t}){let n=Ue(p.admin.upsertInstanceConfig),r=Pe(p.bridge.validateMediaPaths),i=Pt(),a=It(e.config?.contentLocale,void 0),[s,l]=(0,K.useState)(()=>dt(e.config??{},a)),[u,f]=(0,K.useState)(!1),[h,g]=(0,K.useState)(!1),[_,v]=(0,K.useState)(null),y=s.inboundMediaMode===`shared-fs`,b=s.mediaMode===`shared-fs`,x=y||b;async function oe(){g(!0),v(null);try{v(await r({instanceName:e.name,inboundMediaMode:s.inboundMediaMode,mediaMode:s.mediaMode}))}catch(e){i.error(ge(),e)}finally{g(!1)}}async function S(){f(!0);try{let r=e.config??{};await n({instanceId:e._id,config:pt(s,r,a)}),t()}catch(e){i.error(c(),e)}finally{f(!1)}}return(0,Q.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Q.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:se(),help:fe()}),(0,Q.jsxs)(N,{value:s.mediaMode,onValueChange:e=>l({...s,mediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(z,{})}),(0,Q.jsx)(B,{children:mt.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:d(),help:rt()}),(0,Q.jsxs)(N,{value:s.inboundMediaMode,onValueChange:e=>l({...s,inboundMediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(z,{})}),(0,Q.jsx)(B,{children:ft.map(e=>(0,Q.jsx)(M,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:m(),help:$e()}),(0,Q.jsx)(I,{type:`number`,min:1,max:4096,className:`w-full`,value:s.mediaMaxMb,onChange:e=>l({...s,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),x&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[y&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:Ce(),help:re()}),(0,Q.jsx)(I,{className:`w-full`,spellCheck:!1,value:s.inboundAgentMount,onChange:e=>l({...s,inboundAgentMount:e.target.value})})]}),b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(O,{label:qe(),help:ie()}),(0,Q.jsx)(I,{className:`w-full`,spellCheck:!1,value:s.outboundAgentMount,onChange:e=>l({...s,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(jt,{checked:s.rehydration,onCheckedChange:e=>l({...s,rehydration:e===!0})}),(0,Q.jsx)(O,{label:me(),help:Ee()})]}),x&&_!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:_.reachable?!_.inbound&&!_.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(A,{"aria-hidden":!0}),ne({reason:_.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(xn,{label:ye(),result:_.inbound}),(0,Q.jsx)(xn,{label:o(),result:_.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:te()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(A,{"aria-hidden":!0}),ae()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[x&&(0,Q.jsxs)(k,{variant:`outline`,size:`sm`,onClick:()=>void oe(),disabled:h,children:[h?(0,Q.jsx)(Ft,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,h?xe():ee()]}),(0,Q.jsx)(k,{size:`sm`,onClick:()=>void S(),disabled:u,children:tt()})]})]})})}function Cn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(St,{children:[(0,Q.jsx)(xt,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?b():_({count:e.length}),(0,Q.jsx)(D,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(Tt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:Se()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(P,{variant:`secondary`,children:e},e))})]})]})}export{hn as BridgeTab,bn as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Ai as r,Bc as i,Di as a,E as o,Fi as s,Gt as c,Ii as l,Mi as u,Ni as d,Oi as f,Pi as p,Sl as m,_l as h,ac as g,cc as _,fM as v,hM as y,ic as b,ji as x,kg as S,ki as C,lc as w,mM as T,nc as E,oM as D,oc as O,rc as k,sc as A,uc as j,vl as M,wl as N}from"./dist-D8Kd0X5G.js";import{t as P}from"./button-Dbs-wspp.js";import{At as F,C as I,S as L,b as R,d as z,f as B,lt as V,p as H,w as U,x as W,y as G}from"./index-Se6baszB.js";import{i as K}from"./compatView-CeYXlVzu.js";/* empty css */var q=t(e(),1),J=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function Y(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var X=n();function Z({instance:e}){let t=T(o.admin.upsertInstanceConfig),n=y(o.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,q.useState)(r),[s,c]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{a(r),c(`idle`)},[e._id,r]);let l=`__none__`,f=i!==r;async function p(){c(`saving`);try{let n={...e.config??{}};i===``||i===l?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),c(`done`)}catch{c(`error`)}}let m=n?.agents??[];return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:d()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:u()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsxs)(R,{value:i===``?l:i,onValueChange:e=>a(e===l?``:e),children:[(0,X.jsx)(I,{className:`oc-cdefaults__select`,"aria-label":d(),children:(0,X.jsx)(U,{placeholder:x()})}),(0,X.jsxs)(W,{children:[(0,X.jsx)(L,{value:l,children:x()}),m.map(e=>(0,X.jsx)(L,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,X.jsx)(P,{size:`sm`,disabled:!f||s===`saving`,onClick:()=>void p(),children:s===`saving`?N():b()})]}),s===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:k()}):null,s===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null]})}function Q({instance:e}){let t=T(o.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,i=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[a,s]=(0,q.useState)(n),[c,l]=(0,q.useState)(i===null?``:String(i)),[u,d]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{s(n),l(i===null?``:String(i)),d(`idle`)},[e._id,n,i]);let m=c.trim(),h=m===``?null:/^\d+$/.test(m)?Number.parseInt(m,10):NaN,g=!a||h===null||Number.isInteger(h)&&h>=4e3&&h<=6e4,_=a!==n||(h??null)!==i;async function v(){d(`saving`);try{let n={...e.config??{}};n.curationEnabled=a,!a||h===null||Number.isNaN(h)?delete n.curationBudgetChars:n.curationBudgetChars=h,await t({instanceId:e._id,config:n}),d(`done`)}catch{d(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,X.jsx)(H,{checked:a,onCheckedChange:e=>s(e===!0),"aria-label":p()}),(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:c,onChange:e=>l(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!g,"aria-label":r(),disabled:!a}),(0,X.jsx)(P,{size:`sm`,disabled:!_||!g||u===`saving`,onClick:()=>void v(),children:u===`saving`?N():b()})]}),g?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:C()}),u===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:k()}):null,u===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:f()})]})}function $({instance:e}){let t=T(o.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,q.useState)(n===null?``:String(n)),[c,u]=(0,q.useState)(`idle`);(0,q.useEffect)(()=>{i(n===null?``:String(n)),u(`idle`)},[e._id,n]);let d=r.trim(),f=d===``?null:/^\d+$/.test(d)?Number.parseInt(d,10):NaN,p=f===null||Number.isInteger(f)&&f>=1e3&&f<=2e5,m=(f??null)!==n;async function h(){u(`saving`);try{let n={...e.config??{}};f===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=f,await t({instanceId:e._id,config:n}),u(`done`)}catch{u(`error`)}}return(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:l()}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,X.jsx)(V,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!p}),(0,X.jsx)(P,{size:`sm`,disabled:!m||!p||c===`saving`,onClick:()=>void h(),children:c===`saving`?N():b()})]}),p?null:(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:a()}),c===`done`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:k()}):null,c===`error`?(0,X.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:E()}):null,(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:s()})]})}function ee(){let e=v(o.agentFiles.getChatDefaults),[t,n]=(0,q.useState)({status:`loading`}),r=y(o.admin.listInstances,{}),[a,s]=(0,q.useState)(null);(0,q.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[r,a]);let l=(r?.length??0)>1,u=r!==void 0&&r.length===0,d=y(o.compat.forInstance,a?{instanceName:a}:`skip`),f=a?G(d,`configDefaults`):`loading`,p=f===`loading`?null:f.blocked,b=(0,q.useMemo)(()=>l&&a?{instanceName:a}:{},[l,a]),x=(0,q.useRef)(0),C=(0,q.useCallback)(async()=>{let t=++x.current;n({status:`loading`});try{let r=Y(await e(b));if(x.current!==t)return;n({status:`done`,current:r})}catch{if(x.current!==t)return;n({status:`error`})}},[e,b]);(0,q.useEffect)(()=>{p===!1&&(l&&!a||C())},[C,p,l,a]);let T=t.status===`done`?t.current:null,E=(0,q.useMemo)(()=>J.map(e=>({id:e,label:B(e)})),[]),k=(0,q.useMemo)(()=>[{id:`fast`,label:M()},{id:`standard`,label:h()}],[]);return(0,X.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:j()}),l&&a?(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:i()}),(0,X.jsxs)(R,{value:a,onValueChange:e=>s(e),children:[(0,X.jsx)(I,{size:`sm`,"aria-label":i(),children:(0,X.jsx)(U,{})}),(0,X.jsx)(W,{children:(r??[]).map(e=>(0,X.jsx)(L,{value:e.name,children:e.name},e.name))})]})]}):null,u?(0,X.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:S()}):f===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):f.blocked?(0,X.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,X.jsx)(F,{size:14,"aria-hidden":!0}),` `,K(f.gatewayVersion,f.provider)]}):t.status===`loading`?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):t.status===`error`?(0,X.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[g(),` `,(0,X.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void C(),children:m()})]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:w()}),(0,X.jsx)(z,{options:E,value:T?.thinkingDefault??null,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:_()})]}),(0,X.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,X.jsx)(`span`,{className:`oc-cdefaults__label`,children:A()}),(0,X.jsx)(z,{options:k,value:T===null||T.fastModeDefault===null?null:T.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0}),(0,X.jsx)(`p`,{className:`oc-cdefaults__help`,children:O()})]}),(0,X.jsx)(`p`,{className:`oc-cdefaults__note`,children:c()})]}),(()=>{let e=r?.find(e=>e.name===(a??r[0]?.name));return e?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{instance:e}),(0,X.jsx)(Q,{instance:e}),(0,X.jsx)(Z,{instance:e})]}):null})()]})}export{ee as ChatDefaultsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,AC as i,BC as a,CC as o,DC as s,E as c,EC as l,FC as u,GS as d,HC as f,HS as p,IC as m,JS as h,Jr as ee,KS as g,Kr as _,LC as te,MC as ne,NC as re,OC as ie,PC as v,QS as y,RC as b,SC as x,TC as S,UC as C,US as w,VC as T,WS as E,XS as D,YS as O,ZS as k,_C as A,aC as j,bC as M,cC as N,dC as P,eC as F,fC as I,gC as L,hC as R,hM as z,iC as B,jC as V,kC as ae,lC as H,mC as U,mM as W,nC as G,oC as K,pC as q,qS as J,rC as oe,sC as se,tC as ce,uC as le,vC as ue,wC as de,xC as fe,yC as pe,zC as me}from"./dist-D8Kd0X5G.js";import{t as he}from"./button-Dbs-wspp.js";import{B as ge,et as _e}from"./index-Se6baszB.js";import{t as Y}from"./DataTableShell-CySP6pgB.js";var X=t(e(),1),Z=n(),ve={altered_words:()=>C(),incorrect:()=>f(),incoherence:()=>T(),formatting:()=>a(),latency:()=>me(),api_error:()=>b(),other:()=>te()},Q=e=>ve[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:u()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:v()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:m()})}function ye({data:e,closeReason:t}){let n=e.snapshot,r=W(c.feedback.respondToFeedback),[a,u]=(0,X.useState)(e.thread),[d,f]=(0,X.useState)(``),[p,m]=(0,X.useState)(!1);async function g(){let t=d.trim();if(!(!t||p)){m(!0);try{await r({feedbackId:e._id,text:t}),u(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),f(``)}finally{m(!1)}}}let _=[];try{_=n.contextJson?JSON.parse(n.contextJson):[]}catch{_=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:n.displayedMatchesStored,sourceWasOpen:n.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,n.messageRole,n.isRegeneration?` · ${re()}`:``,n.openclawModel?` · ${n.openclawModel}`:``,n.openclawRuntime?` (${n.openclawRuntime})`:``]})]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ne()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,t?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:h()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:t})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),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`?i():e.authorRole===`agent`?e.authorLabel??ee():ae()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:ie()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:s(),value:d,maxLength:2e3,rows:3,onChange:e=>f(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 g(),disabled:!d.trim()||p,children:p?l():S()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:de()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.messageText||o()})]}),n.clientInfo?.sourceWasOpen&&n.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:x()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.displayedText||o()})]}):null,n.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:n.promptText})]}):null,_.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M({count:n.contextCount??_.length,truncated:n.contextTruncated?pe():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:_.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,n.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ue()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[n.outboxText??``,n.outboxStatus?`\n[status: ${n.outboxStatus}]`:``]})]}):null,n.clientInfo?.extensionsDetected&&n.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:n.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:L()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[n.clientInfo?.language,n.clientInfo?.timezone,n.clientInfo?.theme?R({theme:n.clientInfo.theme}):null,n.runId?`run ${n.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,n.clientInfo?.plugins&&n.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[U(),` `,n.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,q()]})]}):null,n.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:n.clientInfo.userAgent}):null]})]})]})}function be(){let e=z(c.feedback.listForAdmin,{}),t=W(c.feedback.readSnapshot),n=W(c.feedback.deleteFeedback),i=ge(),[a,o]=(0,X.useState)(null),[s,l]=(0,X.useState)({});async function u(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});l(t=>({...t,[e._id]:n}))}o(e._id)}async function f(e){await i({title:E(),description:w(),confirmLabel:p(),destructive:!0})&&(await n({feedbackId:e._id}),a===e._id&&o(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[I(),` `,(0,Z.jsx)(`strong`,{children:P()}),` `,le()]}),(0,Z.jsx)(Y,{title:H(),rows:e,emptyHint:N(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(ye,{data:s[e._id],closeReason:e.userCloseReason}):null,columns:[{header:se(),cell:e=>_e(e.at),sort:e=>e.at},{header:K(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:j(),cell:e=>e.messageRole===`user`?B():oe(),sort:e=>e.messageRole},{header:G(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${ce({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:r(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:y(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:k()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:D()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:_()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:O()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?J():g(),onSelect:()=>void u(e)},{label:d(),onSelect:()=>void f(e),variant:`destructive`}]})]})}export{be as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aj as ee,Bj as te,Cj as r,Dj as i,E as a,Ej as o,Fj as s,HE as ne,Ij as c,Lj as l,Mj as re,Nj as u,Oj as d,Pj as f,Qr as p,Rj as ie,Sj as ae,Tj as m,Zr as oe,_j as se,aj as ce,bj as le,cM as ue,cj as de,dj as fe,fj as pe,gj as me,hM as he,hj as ge,jj as _e,kj as h,lj as ve,mM as ye,mj as be,oM as xe,oj as Se,pj as g,sj as _,uj as v,vj as y,wj as b,xj as x,yj as S,zj as C}from"./dist-D8Kd0X5G.js";import{t as w}from"./button-Dbs-wspp.js";import{C as T,Ft as E,G as D,H as O,Ht as k,J as A,K as j,S as M,U as Ce,Ut as N,W as we,Y as Te,b as P,ct as F,it as I,jt as Ee,nt as De,p as Oe,q as ke,rt as Ae,st as je,w as L,x as R,z as Me}from"./index-Se6baszB.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-RDie4v3L.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return h();case`audio`:return d();case`video`:return i();case`pdf`:return o();case`document`:return m();case`archive`:return b();default:return r()}}function K(){let[e,t]=(0,H.useState)(W),[n,r]=(0,H.useState)(W),[i,o]=(0,H.useState)(W),[d,m]=(0,H.useState)(W),[h,b]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=ye(a.files.softDelete),Y=Me();function Ie(){t(W),r(W),o(W),m(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(pe())}catch(e){Y.error(fe(),e)}}let X=he(a.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:i===W?void 0:i,category:d===W?void 0:d,includeAutoGenerated:h||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(ue(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:xe()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||i!==W||d!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(P,{value:e,onValueChange:t,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":C(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:ie()}),(0,U.jsx)(M,{value:`inbound`,children:l()}),(0,U.jsx)(M,{value:`outbound`,children:c()})]})]}),(0,U.jsxs)(P,{value:n,onValueChange:r,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":s(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:f()}),Q.chats.map(e=>(0,U.jsx)(M,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(P,{value:i,onValueChange:o,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":u(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:re()}),Q.instances.map(e=>(0,U.jsx)(M,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(P,{value:d,onValueChange:m,children:[(0,U.jsx)(T,{size:`sm`,"aria-label":_e(),children:(0,U.jsx)(L,{})}),(0,U.jsxs)(R,{children:[(0,U.jsx)(M,{value:W,children:ee()}),Q.categories.map(e=>(0,U.jsx)(M,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(Oe,{checked:h,onCheckedChange:e=>b(e===!0),"aria-label":p()}),(0,U.jsx)(`span`,{children:p()})]}),$?(0,U.jsxs)(w,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(E,{size:14,"aria-hidden":!0}),ge()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?Se():_()}):(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:ae()}),(0,U.jsx)(z,{children:x()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{children:S()}),(0,U.jsx)(z,{children:y()}),(0,U.jsx)(z,{className:`text-right`,children:se()})]})}),(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)(F,{variant:`outline`,style:{marginLeft:6},children:oe()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(F,{variant:`secondary`,children:e.direction===`inbound`?l():c()})}),(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)(De,{children:[(0,U.jsx)(je,{asChild:!0,children:(0,U.jsx)(w,{variant:`ghost`,size:`icon`,"aria-label":be(),children:(0,U.jsx)(k,{size:16})})}),(0,U.jsxs)(Ae,{align:`end`,children:[e.url?(0,U.jsx)(I,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(N,{size:14}),me()]})}):(0,U.jsxs)(I,{disabled:!0,children:[(0,U.jsx)(N,{size:14}),de()]}),(0,U.jsxs)(I,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ee,{size:14}),g()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:ce({cap:Be})}):null]}),(0,U.jsx)(O,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(D,{children:[(0,U.jsxs)(A,{children:[(0,U.jsx)(Te,{children:v()}),(0,U.jsx)(j,{children:ve()})]}),(0,U.jsxs)(ke,{children:[(0,U.jsx)(we,{children:ne()}),(0,U.jsx)(Ce,{onClick:()=>void Le(),children:g()})]})]})})]})}export{K as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,Au as i,Bl as a,Bu as o,Cu as s,D as c,Du as l,E as u,Eu as d,Fu as f,Gl as p,Gu as m,Hl as h,Hu as g,Il as _,Iu as v,Jl as y,Kl as b,Ll as x,Lu as ee,Mu as S,Nu as C,Ou as te,Pu as w,Ql as T,Rl as E,Ru as ne,Su as D,Tu as re,Ul as O,Uu as k,Vl as A,Vu as j,Wl as M,Wu as ie,Xl as N,Yl as P,Zl as F,_u as ae,au as oe,bu as se,cu as I,du as ce,eu as le,fu as ue,gu as L,hM as R,hu as de,iu as fe,ju as pe,ku as me,lu as he,mM as z,mu as ge,nu as _e,ou as ve,pu as ye,ql as be,ru as xe,su as B,tu as Se,uu as Ce,vu as we,wu as Te,xu as Ee,yu as De,zl as Oe,zu as ke}from"./dist-D8Kd0X5G.js";import{t as Ae}from"./x-B-jDgsYW.js";import{i as V,n as H,r as je,t as Me}from"./tabs-uwXJdjSE.js";import{t as U}from"./button-Dbs-wspp.js";import{B as Ne,C as Pe,Jt as Fe,Mt as W,Nt as G,S as Ie,b as Le,ct as K,dt as Re,ft as ze,ht as Be,lt as q,mt as Ve,p as J,qt as He,u as Ue,ut as We,w as Ge,x as Ke,xt as qe,z as Y}from"./index-Se6baszB.js";import{t as Je}from"./FilterBar-irfwrPVv.js";import{t as Ye}from"./DataTableShell-CySP6pgB.js";import{t as X}from"./DetailChips-CqgbiqUw.js";var Xe=c(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Z=c(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Ze=c(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),Q=t(e(),1);function Qe(e,t,n){let r=t.trim().toLowerCase();return[...r?e.filter(e=>[e.email,e.name,e.canonical].some(e=>e!=null&&e.toLowerCase().includes(r))):e.slice()].sort((e,t)=>!n.has(e.userId)-+!n.has(t.userId))}function $e(e,t){let n=e.filter(e=>e.source===`discovered`),r=t.trim().toLowerCase();return r?n.filter(e=>(e.displayName??e.agentId).toLowerCase().includes(r)||e.agentId.toLowerCase().includes(r)):n}function et(e){let t=e.name?.trim()??``,n=e.email?.trim()??``,r=e.canonical?.trim()||`u-${e.userId.slice(0,8)}`;return t?{primary:t,secondary:n||`@${r}`}:n?{primary:n,secondary:null}:{primary:`@${r}`,secondary:null}}function tt(e){switch(e){case`admin`:return ue();case`user`:return ce();case`pending`:return Ce();default:return e}}function nt(e,t){if(e.length===0)return`none`;let n=0;for(let r of e)t(r)&&n++;return n===0?`none`:n===e.length?`all`:`some`}function rt(e,t,n){let r=Math.max(1,Math.ceil(e.length/n)),i=Math.min(Math.max(1,Math.floor(t)),r),a=(i-1)*n;return{pageItems:e.slice(a,a+n),page:i,pageCount:r}}var $=n(),it={name:``,description:``};function at(){let e=R(u.groups.listGroups,{}),t=R(u.me.getMe,{host:qe})?.role===`admin`,n=z(u.groups.createGroup),r=z(u.groups.updateGroup),a=z(u.groups.deleteGroup),s=Ne(),c=Y(),[p,h]=(0,Q.useState)(!1),[_,y]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(it),[T,D]=(0,Q.useState)(null),[O,A]=(0,Q.useState)(``),M=(0,Q.useMemo)(()=>{if(!e)return e;let t=O.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t)||e.members.some(e=>e.label.toLowerCase().includes(t))||e.agents.some(e=>e.toLowerCase().includes(t))||e.charts.some(e=>e.name.toLowerCase().includes(t))):e},[e,O]);function N(){y(null),x(it),h(!0)}function P(e){y(e),x({name:e.name,description:e.description??``}),h(!0)}async function F(){try{_?await r({groupId:_._id,name:b.name,description:b.description}):await n({name:b.name,description:b.description||void 0}),x(it),y(null),h(!1)}catch(e){c.error(Oe(),e)}}async function ae(e){if(await s({title:d({name:e.name}),description:re(),confirmWord:e.name,confirmLabel:Te(),cancelLabel:S(),destructive:!0}))try{await a({groupId:e._id})}catch(e){c.error(E(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}),(0,$.jsx)(Je,{q:O,onQChange:A,onReset:()=>A(``),canReset:O!==``,searchPlaceholder:ee()}),(0,$.jsx)(Ye,{title:m(),rows:M,addLabel:k(),onAdd:t?N:void 0,emptyHint:g(),columns:[{header:j(),cell:e=>e.name,sort:e=>e.name},{header:o(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Ze,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(Z,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:ke(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(G,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ne(),cell:e=>(0,$.jsx)(X,{icon:(0,$.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:v(),onSelect:()=>D({groupId:e._id,name:e.name})},...t?[{label:f(),onSelect:()=>P(e)},{label:w(),variant:`destructive`,onSelect:()=>void ae(e)}]:[]]}),(0,$.jsx)(Ue,{open:p,onOpenChange:h,title:_?i():pe(),description:me(),canSubmit:!!b.name.trim(),onSubmit:F,submitLabel:C(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,$.jsx)(q,{value:b.name,onChange:e=>x({...b,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:l()}),(0,$.jsx)(q,{value:b.description,onChange:e=>x({...b,description:e.target.value})})]})]})}),(0,$.jsx)(ct,{groupId:T?.groupId??null,groupName:T?.name??``,open:T!==null,onOpenChange:e=>{e||D(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(Fe,{size:14,"aria-hidden":!0}),de()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ye({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ge(),(0,$.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=R(u.groups.getGroup,n&&e?{groupId:e}:`skip`),a=R(u.groups.listAssignableInstances,n?{}:`skip`),o=R(u.groups.listAssignableUsers,n?{}:`skip`),c=z(u.groups.addMember),l=z(u.groups.removeMember),d=z(u.groups.bulkSetMembers),f=z(u.groups.setGroupManager),p=Y(),[m,g]=(0,Q.useState)(``),[_,v]=(0,Q.useState)(``),[y,b]=(0,Q.useState)(`members`),[ee,S]=(0,Q.useState)(1),[C,te]=(0,Q.useState)(new Set),w=(0,Q.useRef)(null),E=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ne=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),re=i?.viewerIsAdmin===!0,k=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[i]);(0,Q.useEffect)(()=>{g(``),v(``),b(`members`),S(1),w.current=null},[n,e]),(0,Q.useEffect)(()=>{S(1)},[m]),(0,Q.useEffect)(()=>{n&&i&&e&&w.current!==e&&(w.current=e,te(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let j=(0,Q.useMemo)(()=>o?Qe(o,m,C):[],[o,m,C]);async function ie(t,n){if(e)try{n?await l({groupId:e,userId:t}):await c({groupId:e,userId:t})}catch(e){p.error(x(),e)}}async function N(t,n){if(e)try{await f({groupId:e,userId:t,manager:!n})}catch(e){p.error(A(),e)}}let P=nt(j,e=>E.has(e.userId)),F=j.filter(e=>E.has(e.userId)).length,I=rt(j,ee,ot);async function ce(){if(!e||j.length===0)return;let t=j.map(e=>e.userId);try{await d({groupId:e,userIds:t,member:P!==`all`})}catch(e){p.error(x(),e)}}return(0,$.jsx)(We,{open:n,onOpenChange:r,children:(0,$.jsxs)(Re,{className:`oc-access`,children:[(0,$.jsxs)(Ve,{children:[(0,$.jsx)(Be,{children:s({name:t})}),(0,$.jsx)(ze,{children:D()})]}),(0,$.jsxs)(Me,{value:y,onValueChange:b,className:`oc-access__tabs`,children:[(0,$.jsxs)(je,{className:`w-full`,children:[(0,$.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ze,{size:13,"aria-hidden":!0}),Ee(),i?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:E.size}):null]}),(0,$.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(G,{size:13,"aria-hidden":!0}),De(),i?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:k.size}):null]}),(0,$.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Xe,{size:13,"aria-hidden":!0}),T(),i?(0,$.jsx)(K,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(H,{value:`members`,children:o===void 0||i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:m,onChange:e=>g(e.target.value),placeholder:se(),className:`oc-access__search`}),j.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ae()}):(0,$.jsxs)($.Fragment,{children:[j.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(J,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void ce(),"aria-label":L()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:L()}),(0,$.jsxs)(K,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,j.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:I.pageItems.map(e=>{let t=E.has(e.userId),n=et(e),r=ne.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(J,{checked:t,onCheckedChange:()=>void ie(e.userId,t),"aria-label":he({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,$.jsx)(K,{variant:`outline`,className:`oc-access__role`,children:tt(e.role)}),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&re?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?h():O(),title:r?h():O(),onClick:()=>void N(e.userId,r),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):t&&r?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":M(),title:M(),children:(0,$.jsx)(Z,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(st,{page:I.page,pageCount:I.pageCount,onPage:S})]})]})}),(0,$.jsx)(H,{value:`agents`,children:a===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):a.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:fe()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(q,{value:_,onChange:e=>v(e.target.value),placeholder:we(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:a.map(t=>(0,$.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:k,query:_},`${e}-${t._id}`))})]})}),(0,$.jsx)(H,{value:`charts`,children:(0,$.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:i,query:a}){let o=R(u.groups.listAssignableAgents,{instanceName:t}),s=z(u.groups.assignAgentToGroup),c=z(u.groups.removeAgentFromGroup),l=z(u.groups.bulkSetGroupAgents),d=Y(),[f,p]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{p(1)},[a]),!e)return null;let m=$e(o?.agents??[],a),h=o?.discovery&&!o.discovery.lastPollOk;if(a.trim()&&m.length===0)return null;let g=m.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),v=nt(g,e=>i.has(`${t}/${e.agentId}`)),y=rt(m,f,ot);async function b(n,r){try{r?await c({groupId:e,instanceName:t,agentId:n}):await s({groupId:e,instanceName:t,agentId:n})}catch(e){d.error(_(),e)}}async function x(){if(g.length===0)return;let n=g.map(e=>e.agentId);try{await l({groupId:e,instanceName:t,agentIds:n,assigned:v!==`all`})}catch(e){d.error(_(),e)}}return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(G,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(K,{variant:`outline`,className:`oc-access__kind`,children:n}),h?(0,$.jsx)(K,{variant:`outline`,className:`oc-access__stale`,children:Se()}):null]}),o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ve()}):m.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h?_e():xe()}):(0,$.jsxs)($.Fragment,{children:[g.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(J,{checked:v===`all`?!0:v===`some`?`indeterminate`:!1,onCheckedChange:()=>void x(),"aria-label":L()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:L()})]}):null,y.pageItems.map(e=>{let n=`${t}/${e.agentId}`,a=i.has(n),o=e.presentInLastOk===!1,s=!e.enabled;return(0,$.jsxs)(`div`,{className:`oc-access__row${s?` is-disabled`:``}`,children:[(0,$.jsx)(J,{checked:a,disabled:(o||s)&&!a,onCheckedChange:()=>void b(e.agentId,a),"aria-label":I({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":r(),title:r(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):null,o?(0,$.jsx)(K,{variant:`outline`,className:`oc-access__gone`,children:le()}):null]},e.agentId)}),(0,$.jsx)(st,{page:y.page,pageCount:y.pageCount,onPage:p})]})]})}function ut({groupId:e}){let t=R(u.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=z(u.charts.assignChartToGroup),r=z(u.charts.removeChartFromGroup),i=z(u.charts.setGroupDefaultChart),o=z(u.charts.addChartToGroupPool),s=z(u.charts.removeChartFromGroupPool),c=Y();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:l,addable:d,canManagePool:f}=t;if(l.length===0&&!f)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:F()});async function m(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(a(),e)}}async function h(t){try{await i({groupId:e,chartKey:t})}catch(e){c.error(a(),e)}}async function g(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(a(),e)}}async function _(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(a(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(J,{checked:e.selected,onCheckedChange:()=>void m(e.chartKey,e.selected),"aria-label":be({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":b(),title:b(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void h(e.chartKey),children:p()}):null,f?(0,$.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":y({name:e.name}),title:y({name:e.name}),onClick:()=>void _(e.chartKey),children:(0,$.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),f?d.length>0?(0,$.jsxs)(Le,{value:``,onValueChange:e=>void g(e),children:[(0,$.jsx)(Pe,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(Ge,{placeholder:P()})}),(0,$.jsx)(Ke,{children:d.map(e=>(0,$.jsx)(Ie,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:N()}):null:null]})}export{at as GroupsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$i as i,$x as a,Ab as o,Ax as s,Bb as c,Bx as l,Cx as u,Dx as d,E as f,Ex as p,FD as m,Fb as h,Fx as g,Gb as _,Gx as v,Hb as y,Hx as b,Ib as x,Ix as S,Jb as ee,Jt as C,Jx as w,Kb as T,Kx as E,Lb as te,Lx as ne,Mb as re,Mx as ie,Nb as ae,Nx as oe,Ob as se,Ox as ce,PD as le,Pb as ue,Px as de,Qb as fe,Qi as pe,Qx as me,Rb as he,Rx as ge,Sx as _e,Tx as ve,Ub as ye,Ux as be,Vb as xe,Vx as Se,Wb as Ce,Wx as we,Xb as Te,Xt as Ee,Xx as De,Yb as D,Yt as Oe,Yx as ke,Zb as Ae,Zi as je,Zx as Me,_x as Ne,aS as Pe,ax as Fe,bg as Ie,bx as O,cS as Le,cx as Re,dS as ze,dx as Be,eS as k,ea as Ve,ex as A,fM as j,fS as He,fx as Ue,gx as We,hM as M,hx as Ge,iS as Ke,ix as qe,jb as Je,jx as Ye,kb as Xe,kx as Ze,lS as Qe,lx as $e,mM as N,mS as et,mx as tt,nS as nt,nx as rt,oS as it,ox as at,pS as ot,px as st,qb as ct,qx as lt,rS as ut,rx as dt,sS as ft,sx as pt,tS as mt,tx as ht,uS as gt,ux as _t,vx as vt,wx as yt,xx as bt,yg as xt,yx as St,zb as Ct,zx as wt}from"./dist-D8Kd0X5G.js";import{a as Tt,c as Et}from"./FieldLabel-CyXK3G_H.js";import{t as P}from"./button-Dbs-wspp.js";import{B as Dt,C as F,Q as Ot,S as I,X as kt,Z as At,b as L,ct as R,dt as z,ft as B,ht as V,lt as H,mt as U,p as W,u as jt,ut as G,w as K,x as q,z as J}from"./index-Se6baszB.js";import{t as Mt}from"./DataTableShell-CySP6pgB.js";import{InstanceConfigDialog as Nt}from"./BridgeTab-BHnMaTub.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],Pt=new Set(X),Ft=`conversational`;function It(e){let t=new Set((e??[]).filter(e=>Pt.has(e)));return t.size===0?[Ft]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Tt},Lt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Rt(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??``,streamTransport:e.streamTransport??`reactive`}}function zt(){let e=M(f.admin.listInstances,{}),t=M(f.agents.listAllInstanceAgents,{}),n=N(f.admin.upsertInstance),r=N(f.admin.deleteInstance),i=J(),[o,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(Q),[d,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null);async function S(){try{await n({instanceId:y??void 0,name:c.name,gatewayUrl:c.gatewayUrl,bridgeUrl:c.bridgeUrl||void 0,displayName:c.displayName||void 0,kind:c.kind,transport:c.kind===`hermes`?c.transport:void 0,gatewayVersion:c.gatewayVersion||void 0,gatewayHttpUrl:c.gatewayHttpUrl||void 0,streamTransport:c.streamTransport}),u(Q),x(null),s(!1)}catch(e){i.error(He(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ze(),(0,Z.jsx)(`strong`,{children:gt()}),Qe()]}),(0,Z.jsx)(Mt,{title:Le(),rows:e,addLabel:ft(),onAdd:()=>{x(null),u(Q),s(!0)},emptyHint:it(),columns:[{header:Pe(),cell:e=>e.name,sort:e=>e.name},{header:Ke(),cell:e=>(0,Z.jsx)(R,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ut(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:nt(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:et(),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)(R,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?Xe():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:me(),onSelect:()=>{x(e._id),u(Rt(e)),s(!0)}},{label:ot(),onSelect:()=>p(e.name)},{label:ne(),onSelect:()=>_(e)},{label:mt(),onSelect:()=>h(e)},{label:k(),variant:`destructive`,onSelect:()=>void r({instanceId:e._id})}],bulkActions:[{label:k(),variant:`destructive`,onSelect:e=>e.forEach(e=>void r({instanceId:e}))}]}),(0,Z.jsx)(jt,{open:o,onOpenChange:s,title:y?Me():a(),description:ke(),canSubmit:!!(c.name&&c.gatewayUrl),onSubmit:S,submitLabel:w(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:lt(),children:[(0,Z.jsx)(H,{value:c.name,disabled:y!==null,onChange:e=>u({...c,name:e.target.value})}),y?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:De()}):null]}),(0,Z.jsx)($,{label:E(),children:(0,Z.jsxs)(L,{value:c.kind,onValueChange:e=>u({...c,kind:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(I,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(I,{value:`hermes`,children:`Hermes`})]})]})}),c.kind===`hermes`?(0,Z.jsx)($,{label:Ee(),children:(0,Z.jsxs)(L,{value:c.transport,onValueChange:e=>u({...c,transport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(K,{})}),(0,Z.jsxs)(q,{children:[(0,Z.jsx)(I,{value:`ws`,children:Oe()}),(0,Z.jsx)(I,{value:`rest`,children:C()})]})]})}):null,(0,Z.jsx)($,{label:v(),children:(0,Z.jsx)(H,{value:c.gatewayUrl,onChange:e=>u({...c,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:we(),children:(0,Z.jsx)(H,{value:c.bridgeUrl,placeholder:be(),onChange:e=>u({...c,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:b(),children:(0,Z.jsx)(H,{value:c.displayName,onChange:e=>u({...c,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:Ie(),children:[(0,Z.jsxs)(L,{value:c.streamTransport,onValueChange:e=>u({...c,streamTransport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(K,{})}),(0,Z.jsx)(q,{children:Et.map(e=>(0,Z.jsx)(I,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:xt()})]}),(0,Z.jsx)($,{label:Se(),children:(0,Z.jsx)(H,{value:c.gatewayVersion,placeholder:l(),onChange:e=>u({...c,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:wt(),children:(0,Z.jsx)(H,{value:c.gatewayHttpUrl,placeholder:ge(),onChange:e=>u({...c,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Yt,{instanceName:d,open:d!==null,onOpenChange:e=>{e||p(null)}}),m?(0,Z.jsx)(Nt,{instance:m,onClose:()=>h(null)},m._id):null,g?(0,Z.jsx)(Bt,{instance:g,onClose:()=>_(null)},g._id):null]})}function Bt({instance:e,onClose:t}){let n=M(f.instanceSecrets.listInstanceSecretStatus,{}),r=Lt[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)(G,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(z,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{children:S({instance:e.displayName??e.name})}),(0,Z.jsx)(B,{children:g()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Ut,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Ht,{instance:e})}),(0,Z.jsx)(Vt,{instance:e})]})})}function Vt({instance:e}){let t=j(f.instanceSync.forceInstanceSync),n=J(),[r,i]=(0,Y.useState)(!1);async function a(){if(!r){i(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(Ge());break;case`no_agents`:n.success(st());break;case`no_bridge_url`:n.error(Ue());break;case`deploy_misconfigured`:n.error(Be());break;case`unauthorized`:n.error($e());break;case`not_served`:n.error(Re());break;default:n.error(_t());break}}catch(e){n.error(tt(),e)}finally{i(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:pt()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void a(),disabled:r,children:r?We():Ne()})})]})}function Ht({instance:e}){let t=M(f.bridgeAuth.listBridgeAuthStatus,{}),n=j(f.bridgeAuth.mintBridgeSecret),i=N(f.bridgeAuth.revokeBridgeSecret),a=J(),[o,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(null),[d,p]=(0,Y.useState)(!1),h=(t??[]).find(t=>t.instanceId===e._id),g=h!==void 0;async function _(){if(!o){c(!0);try{u((await n({instanceId:e._id})).plaintext),p(!1)}catch(e){a.error(A(),e)}finally{c(!1)}}}async function v(){if(!o){c(!0);try{await i({instanceId:e._id}),u(null),a.success(ht())}catch(e){a.error(A(),e)}finally{c(!1)}}}async function y(){if(l)try{await navigator.clipboard.writeText(l),p(!0)}catch{}}return(0,Z.jsxs)($,{label:at(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Fe()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:g?`outline`:`secondary`,children:g?`${Ye()} · ${h.prefix}…${h.lastFour}`:s()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void _(),disabled:o,children:g?dt():qe()}),g?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void v(),disabled:o,children:rt()}):null]})]}),l?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:r()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:l}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void y(),children:d?m():le()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{u(null),p(!1)},children:fe()})]}):null]})}function Ut({instanceId:e,field:t,updatedAt:n}){let r=j(f.instanceSecrets.setInstanceSecret),i=N(f.instanceSecrets.clearInstanceSecret),a=j(f.deviceIdentity.generateDeviceIdentity),o=J(),[c,l]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(!1),[_,v]=(0,Y.useState)(null),[y,b]=(0,Y.useState)(!1),x=n!==null,S=t===`deviceIdentity`,ee=t===`token`?de():t===`deviceIdentity`?oe():ie();async function C(){if(!(!c.trim()||h)){g(!0);try{await r({instanceId:e,field:t,plaintext:c}),l(``),v(null),b(!1),o.success(ve())}catch(e){o.error(yt(),e)}finally{g(!1)}}}async function w(){if(!h){g(!0);try{await i({instanceId:e,field:t}),v(null),b(!1),o.success(u())}catch(e){o.error(yt(),e)}finally{g(!1)}}}async function T(){if(!h){g(!0);try{v(await a({instanceId:e})),b(!1),o.success(O())}catch(e){o.error(vt(),e)}finally{g(!1)}}}let E=_?`openclaw devices approve ${_.id}`:``;async function te(){if(E)try{await navigator.clipboard.writeText(E),b(!0)}catch{}}return(0,Z.jsxs)($,{label:ee,children:[S?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:bt()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(R,{variant:x?`outline`:`secondary`,children:x?Ye():s()}),(0,Z.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:c,placeholder:x?ce():Ze(),onChange:e=>l(e.target.value)}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void C(),disabled:h||c.trim().length===0,children:d()}),S?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void T(),disabled:h,children:_e()}):null,x?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void w(),disabled:h,children:p()}):null]})]}),_?(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:St()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:E}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void te(),children:y?m():le()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{v(null),b(!1)},children:fe()})]}):null]})}var Wt={conversational:Ce,documentary:y,summarizer:Ve,curator:pe},Gt={conversational:ye,documentary:xe,summarizer:i,curator:je},Kt=e=>(Wt[e]??(()=>e))(),qt=e=>(Gt[e]??(()=>``))();function Jt({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:ee()}),t.map(e=>(0,Z.jsx)(R,{variant:`secondary`,className:`oc-agenttype__chip`,title:qt(e),children:Kt(e)},e)),(0,Z.jsxs)(kt,{children:[(0,Z.jsx)(Ot,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:ct()})}),(0,Z.jsxs)(At,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:T()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:_()}),(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)(W,{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:Kt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:qt(r)})]})]},r)})})]})]})]})}function Yt({instanceName:e,open:t,onOpenChange:n}){let r=M(f.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=N(f.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(f.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(f.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=N(f.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(f.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(f.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),s=N(f.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(f.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=It(r);e.setQuery(f.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),l=N(f.agents.removeInstanceAgent),u=Dt(),d=J();async function p(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){d.error(D(),e)}}async function m(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){d.error(D(),e)}}async function g(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await s({instanceName:e,agentId:t,types:i})}catch(e){d.error(D(),e)}}async function _(t,n){if(e&&await u({title:he({name:n}),description:te(),confirmLabel:x(),destructive:!0}))try{await l({instanceName:e,agentId:t}),d.success(h())}catch(e){d.error(D(),e)}}return(0,Z.jsx)(G,{open:t,onOpenChange:n,children:(0,Z.jsxs)(z,{className:`oc-access`,children:[(0,Z.jsxs)(U,{children:[(0,Z.jsx)(V,{children:Ae({name:e??``})}),(0,Z.jsx)(B,{children:Te()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:ue()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?ae():r.discovery.lastPollOk?re():Je({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:o()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(e=>{let t=e.presentInLastOk===!1,n=r.defaultAgentId===e.agentId,i=e.displayName??e.agentId,a=e.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(e.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(W,{checked:e.enabled,disabled:t,"aria-label":i,onCheckedChange:t=>void p(e.agentId,t===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:i,children:[e.emoji?`${e.emoji} `:``,i]}),e.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,t?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(R,{variant:`outline`,className:`oc-access__gone`,children:se()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void _(e.agentId,i),children:Ct()})]}):n?(0,Z.jsx)(R,{variant:`default`,children:Xe()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!e.enabled,onClick:()=>void m(e.agentId),children:c()})]}),e.enabled?(0,Z.jsx)(Jt,{agentId:e.agentId,types:a,onToggle:t=>void g(e.agentId,t,a)}):null]},e.agentId)})})]})]})})}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{zt as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,E as i,GC as a,JC as o,KC as s,QC as c,WC as l,XC as u,YC as d,ZC as f,_o as p,bo as m,ew as h,fM as g,go as _,hM as v,ho as y,mM as b,mo as x,nw as S,po as C,qC as w,rw as T,tw as E,vo as D,xo as O,yo as k}from"./dist-D8Kd0X5G.js";import{t as A}from"./button-Dbs-wspp.js";import{ct as j,lt as M,p as N}from"./index-Se6baszB.js";var P=t(e(),1),F=n();function I(){let e=v(i.integrations.status.status,{}),t=b(i.admin.setIntegrationConfig),[n,p]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&p(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:T()});let g=n,_=(e,t,n)=>p({...g,[e]:{...g[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:[S(),` `,(0,F.jsx)(`strong`,{children:E()}),` `,h()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(j,{variant:`secondary`,children:r()}):(0,F.jsx)(j,{variant:`outline`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:f()}),note:u(),children:[(0,F.jsx)(R,{label:o(),children:(0,F.jsx)(M,{value:g.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>_(`langfuse`,`host`,e.target.value),onBlur:()=>y(`langfuse`,{host:g.langfuse.host??``})})}),(0,F.jsx)(z,{label:l(),checked:g.langfuse.enabled??!0,onChange:e=>{_(`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:r()}):(0,F.jsx)(j,{variant:`outline`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:f()}),note:d(),children:[(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:g.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>_(`opik`,`baseUrl`,e.target.value),onBlur:()=>y(`opik`,{baseUrl:g.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:s(),children:(0,F.jsx)(M,{value:g.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||a(),onChange:e=>_(`opik`,`workspace`,e.target.value),onBlur:()=>y(`opik`,{workspace:g.opik.workspace??``})})}),(0,F.jsx)(z,{label:l(),checked:g.opik.enabled??!0,onChange:e=>{_(`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:r()}):(0,F.jsx)(j,{variant:`outline`,children:c()}):(0,F.jsx)(j,{variant:`outline`,children:O()}),note:m(),children:[(0,F.jsx)(R,{label:k(),children:(0,F.jsx)(M,{value:g.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>_(`otlp`,`endpoint`,e.target.value),onBlur:()=>y(`otlp`,{endpoint:g.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:l(),checked:g.otlp.enabled??!0,onChange:e=>{_(`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=g(i.integrations.otlpSecret.setOtlpHeaders),n=b(i.integrations.otlpSecret.clearOtlpHeaders),[r,a]=(0,P.useState)(``),[o,s]=(0,P.useState)(null),[c,l]=(0,P.useState)(!1),u=async()=>{l(!0),s(null);try{await t({headersJson:r}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}};return(0,F.jsxs)(R,{label:D(),children:[(0,F.jsx)(M,{value:r,placeholder:e?p():_(),onChange:e=>a(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(A,{size:`sm`,disabled:c||r.trim().length===0,onClick:()=>void u(),children:y()}),e?(0,F.jsx)(A,{variant:`ghost`,size:`sm`,disabled:c,onClick:()=>void n({}),children:x()}):null]}),o?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:o}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:C()})]})}export{I as IntegrationsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Am as r,Aw as i,Bm as a,Bw as o,Dm as s,E as c,Fm as l,Im as u,Lm as d,Lw as f,Mm as p,Nm as m,Om as h,Pm as g,Rm as _,Rw as v,dT as y,hM as b,jm as x,km as S,kw as C,zm as w,zw as T}from"./dist-D8Kd0X5G.js";import{Xt as ee,Yt as te,a as ne,n as re,r as E,xt as D}from"./index-Se6baszB.js";import{a as O,n as k,o as A,r as j,t as M}from"./card-B_7M0l5O.js";import{n as N,t as P}from"./TimeRangePicker-3h2VniWx.js";var F=t(e(),1),I=n(),L=15,R=e=>String(Math.round(e));function z(){let e=b(c.me.getMe,{host:D})?.permissions?.includes(`traces.read`)??!1,t=b(c.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,L).reverse().map(e=>({startedAt:e.startedAt,cP50:e.rollup?.cP50,aP50:e.rollup?.aP50})):[],[t]);return t===void 0?null:(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:y()}),(0,I.jsxs)(M,{children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{children:o()}),(0,I.jsx)(j,{children:v()})]}),(0,I.jsx)(k,{children:n.length<2?(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,I.jsx)(B,{series:n})})]})]})}function B({series:e}){let t=e.map(e=>e.cP50),n=e.map(e=>e.aP50),r=Math.max(1,...t,...n),a=t=>6+t*468/(e.length-1),s=e=>74-e*68/r,c=e=>e.map((e,t)=>`${t===0?`M`:`L`}${a(t).toFixed(1)},${s(e).toFixed(1)}`).join(` `),l=e[e.length-1];return(0,I.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,I.jsxs)(`div`,{className:`flex gap-3 text-xs text-muted-foreground`,children:[(0,I.jsxs)(`span`,{style:{color:`var(--primary)`},children:[C(),` p50 `,R(l.cP50),` `,T()]}),(0,I.jsxs)(`span`,{children:[i(),` p50 `,R(l.aP50),` `,T()]})]}),(0,I.jsxs)(`svg`,{viewBox:`0 0 480 80`,className:`h-20 w-full`,preserveAspectRatio:`none`,role:`img`,"aria-label":o(),children:[(0,I.jsx)(`path`,{d:c(n),fill:`none`,style:{stroke:`var(--muted-foreground)`},strokeWidth:1.5}),(0,I.jsx)(`path`,{d:c(t),fill:`none`,style:{stroke:`var(--primary)`},strokeWidth:1.5})]})]})}var V=[{metric:`api.calls`,label:a(),unit:`/h`,group:`API`,isError:!1},{metric:`api.errors`,label:w(),unit:`/h`,group:`API`,isError:!0},{metric:`api.latency.avg_ms`,label:_(),unit:`ms`,group:`API`,isError:!1},{metric:`openclaw.ingest`,label:d(),unit:`/h`,group:`OpenClaw`,isError:!1},{metric:`chat.send`,label:u(),unit:`/h`,group:`Chat`,isError:!1},{metric:`assistant.stream.errors`,label:l(),unit:`/h`,group:`Assistant`,isError:!0}],H=V.length,U=[`API`,`OpenClaw`,`Chat`,`Assistant`],W=1e3,G=36e5;function K(e,t){let n=Math.max(1,Math.ceil((t-e)/G)),r=Math.min(n*H,W);return{rowLimit:r,buckets:Math.max(1,Math.floor(r/H))}}function q(){let e=ee({from:`/settings/kpi`}),t=te({from:`/settings/kpi`}),n=E(e.from,e.to,re,`now`),r=e=>void t({search:t=>({...t,...ne(e)})}),{from:i,to:a}=N(n),{rowLimit:o,buckets:s}=K(i,a),l=b(c.kpi.listKpis,{limit:o,filter:{from:i,to:a}}),u=(0,F.useMemo)(()=>{let e=new Map;for(let t of l??[]){let n=e.get(t.metric)??[];n.push({bucket:t.bucket,value:t.value}),e.set(t.metric,n)}for(let[t,n]of e)n.sort((e,t)=>e.bucket<t.bucket?-1:+(e.bucket>t.bucket)),n.length>s&&e.set(t,n.slice(n.length-s));return e},[l,s]),d=(0,I.jsxs)(I.Fragment,{children:[(0,I.jsxs)(`p`,{className:`oc-admin__hint`,children:[g(),` `,(0,I.jsx)(`span`,{className:`oc-filter__window`,children:m()})]}),(0,I.jsx)(J,{value:n,onChange:r})]});return l===void 0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:p()})]}):l.length===0?(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),(0,I.jsx)(`p`,{className:`oc-admin__hint`,children:x()})]}):(0,I.jsxs)(I.Fragment,{children:[d,(0,I.jsx)(z,{}),U.map(e=>{let t=V.filter(t=>t.group===e);return t.some(e=>(u.get(e.metric)??[]).length>0)?(0,I.jsxs)(`section`,{className:`oc-kpi__group`,children:[(0,I.jsx)(`h2`,{className:`oc-kpi__group-title`,children:e}),(0,I.jsx)(`div`,{className:`oc-kpi__grid`,children:t.map(e=>(0,I.jsx)(Y,{config:e,series:u.get(e.metric)??[]},e.metric))})]},e):null})]})}function J({value:e,onChange:t}){return(0,I.jsx)(`div`,{className:`oc-kpi__toolbar`,children:(0,I.jsx)(P,{value:e,onChange:t})})}function Y({config:e,series:t}){let n=t.length>0?t[t.length-1]:null,i=n?n.value:0;return(0,I.jsxs)(M,{size:`sm`,className:`oc-kpi__card`,children:[(0,I.jsxs)(O,{children:[(0,I.jsx)(A,{className:`oc-kpi__card-title`,children:e.label}),(0,I.jsx)(j,{className:`oc-kpi__card-metric`,children:(0,I.jsx)(`code`,{children:e.metric})})]}),(0,I.jsxs)(k,{className:`oc-kpi__card-body`,children:[(0,I.jsxs)(`div`,{className:`oc-kpi__value-row`,children:[(0,I.jsx)(`span`,{className:`oc-kpi__value`+(e.isError&&i>0?` oc-kpi__value--error`:``),children:Q(i)}),(0,I.jsx)(`span`,{className:`oc-kpi__unit`,children:e.unit})]}),(0,I.jsx)(ae,{series:t,isError:e.isError,unit:e.unit}),(0,I.jsxs)(`div`,{className:`oc-kpi__axis`,children:[n?(0,I.jsx)(`span`,{className:`oc-kpi__axis-latest`,children:r({value:$(n.bucket)})}):(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:S()}),(0,I.jsx)(`span`,{className:`oc-kpi__muted`,children:h({count:t.length})})]})]})]})}var X=240,Z=48,ie=1;function ae({series:e,isError:t,unit:n}){if(e.length===0)return(0,I.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-ie,1);return(0,I.jsx)(`svg`,{className:`oc-kpi__chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,role:`img`,"aria-label":s({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,I.jsx)(`rect`,{className:`oc-kpi__bar`+(t&&e.value>0?` oc-kpi__bar--error`:``),x:c,y:l,width:a,height:s,children:(0,I.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{q as KpiTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$O as r,A as i,Ak as a,Ck as o,Dk as s,E as c,Ek as l,F as u,G as d,Gj as ee,Hj as te,I as ne,JO as re,Jj as ie,Jx as ae,Kj as oe,L as se,M as ce,Mk as le,N as f,Nk as p,Ok as ue,P as de,Pk as fe,QO as pe,Qj as me,Sk as he,Tk as ge,Uj as _e,Wj as m,X as h,XO as g,Xj as _,YO as v,Yj as y,Z as b,ZO as x,Zj as S,_k as C,ak as w,bk as T,ck as E,dk as D,ek as O,fk as k,gk as A,hM as j,hk as M,ik as N,j as P,jk as F,kk as I,lk as ve,mM as L,mk as ye,n as R,nk as z,oM as be,ok as B,pk as xe,qO as Se,qj as Ce,rk as we,sk as Te,tM as Ee,tk as V,uk as De,vk as Oe,wk as ke,xk as Ae,yk as je}from"./dist-D8Kd0X5G.js";import{t as H}from"./button-Dbs-wspp.js";import{A as Me,C as Ne,S as U,b as Pe,bt as Fe,ct as W,lt as G,p as K,vt as Ie,w as Le,x as Re,xt as q,yt as ze,z as Be}from"./index-Se6baszB.js";import{t as Ve}from"./localePickerView-C2RmOS86.js";var J=t(e(),1),Y=n();function He({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,Y.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,Y.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 X=[{id:`messages`,label:()=>fe()},{id:`composer`,label:()=>p()},{id:`sidebar`,label:()=>le()},{id:`notifications`,label:()=>xe()},{id:`other`,label:()=>F()}],Z={showSource:{category:`messages`,label:()=>a(),help:()=>I()},showReport:{category:`messages`,label:()=>ue(),help:()=>s()},copyAssistant:{category:`messages`,label:()=>l()},copyUser:{category:`messages`,label:()=>ge()},showDelete:{category:`messages`,label:()=>ke()},showTools:{category:`messages`,label:()=>o(),help:()=>he()},voiceInput:{category:`composer`,label:()=>Ae(),help:()=>T()},showUsage:{category:`composer`,label:()=>je(),help:()=>Oe()},autoReadAloud:{category:`composer`,label:()=>b(),help:()=>h()},showChatAge:{category:`sidebar`,label:()=>C(),help:()=>A()},showChatProvider:{category:`sidebar`,label:()=>M(),help:()=>ye()},notifSound:{category:`notifications`,label:()=>k(),help:()=>D()},notifSystem:{category:`notifications`,label:()=>De(),help:()=>ve()},replySound:{category:`notifications`,label:()=>E(),help:()=>Te()}};function Q(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Ue(e,t){let n=Q(t.trim()),r=new Map(X.map(e=>[e.id,e.label()])),i=new Map(X.map(e=>[e.id,[]]));for(let t of e){let e=Z[t],a=e?.category??`other`;n&&!Q(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return X.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var We=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showChatProvider`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],Ge={voiceInput:`voiceInput`};function Ke(e){return We.includes(e)}function $(e){return e===`admin`}function qe(e){return e===!0?`on`:e===!1?`off`:`inherit`}function Je(e){return e===`on`?!0:e===`off`?!1:null}function Ye(e){return Ke(e)?Ge[e]:void 0}var Xe={voiceInput:()=>x()};function Ze({prefKey:e,ui:t}){let n=L(c.admin.setUiPrefDefault),r=L(c.admin.setFeatureEnabled),i=Ye(e),a=i?Xe[e]?.():void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,Y.jsx)(`span`,{className:`oc-prefs__gov-label`,children:V()}),(0,Y.jsxs)(Pe,{value:qe(t.defaults[e]),onValueChange:t=>void n({key:e,value:Je(t)}),children:[(0,Y.jsx)(Ne,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(Le,{})}),(0,Y.jsxs)(Re,{children:[(0,Y.jsx)(U,{value:`on`,children:v()}),(0,Y.jsx)(U,{value:`off`,children:re()}),(0,Y.jsx)(U,{value:`inherit`,children:Se()})]})]}),i?(0,Y.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,Y.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":O()}),O()]}):null]}),a?(0,Y.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function Qe({current:e,enabled:t}){let n=L(c.me.setDictationShortcut),[r,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1);return(0,J.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){a(!1);return}let t=ze(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,Y.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[se(),e?(0,Y.jsx)(W,{variant:`secondary`,children:Fe(e,Ie())}):null]}),(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:o?de():r?u():ne()})]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:i()}):null,(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>a(e=>!e),children:r?P():e?ce():f()})]})]})}function $e(){let[e,t]=(0,J.useState)(``),[n,i]=(0,J.useState)(!1),a=j(c.me.getMe,{host:q}),o=a?.ui,s=$(a?.role)&&n,l=L(c.me.setUiPref).withOptimisticUpdate(Me),u=(0,J.useMemo)(()=>o?Ue(Object.keys(o.effective),e):[],[o,e]);return o?(0,Y.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(a?.role)?(0,Y.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,Y.jsx)(K,{checked:n,onCheckedChange:e=>i(e===!0),"aria-label":z()}),z()]}):null,s?(0,Y.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,Y.jsx)(`p`,{children:r()}),(0,Y.jsx)(`p`,{children:pe()}),(0,Y.jsx)(`p`,{children:g()})]}):null,(0,Y.jsx)(G,{value:e,onChange:e=>t(e.target.value),placeholder:B(),"aria-label":B(),className:`mb-2`}),u.length===0?(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:w()}):(0,Y.jsx)(`div`,{className:`oc-prefs`,children:u.map(e=>(0,Y.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,Y.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=Z[e],n=t?t.label():e,r=t?.help?.(),i=o.locked[e],a=o.effective[e],c=o.userOverrides[e]!==void 0;return(0,Y.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,Y.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,Y.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,Y.jsx)(W,{variant:`outline`,children:N()}):c?(0,Y.jsx)(W,{variant:`secondary`,children:d()}):null]}),r?(0,Y.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,Y.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&c?(0,Y.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void l({key:e,value:null}),children:we()}):null,(0,Y.jsx)(He,{checked:a,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),l({key:e,value:t})},"aria-label":n})]}),s?(0,Y.jsx)(Ze,{prefKey:e,ui:o}):null]},e)})]},e.id))}),(0,Y.jsx)(Qe,{current:a?.dictationShortcut??null,enabled:o.effective.voiceInput===!0})]}):(0,Y.jsx)(`div`,{className:`oc-prefs__empty`,children:be()})}function et(){let e=j(c.me.getMe,{host:q}),t=L(c.me.setLocale),n=L(c.me.setMyName),r=Be(),i=e?.locale??`default`,a=e?.name??``,[o,s]=(0,J.useState)(null),l=o??a,u=l.trim()!==a.trim();async function d(){try{await n({name:l}),s(null),r.success(ie())}catch(e){r.error(Ce(),e)}}return(0,Y.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:me()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:S()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Y.jsx)(G,{className:`max-w-xs`,value:l,maxLength:120,placeholder:_(),onChange:e=>s(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u&&(e.preventDefault(),d())}}),(0,Y.jsx)(H,{size:`sm`,disabled:!u,onClick:()=>void d(),children:ae()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:oe()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:ee()})]}),(0,Y.jsxs)(`div`,{className:`oc-show__row`,children:[Ve().map(e=>(0,Y.jsx)(H,{variant:i===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,Y.jsx)(H,{variant:i==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:Ee()})]}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:m()})]}),(0,Y.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Y.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Y.jsx)(`h2`,{className:`oc-show__title`,children:_e()}),(0,Y.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,Y.jsx)($e,{})]})]})}export{et as PreferencesTab};
@@ -1,4 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$h as r,$t as i,Cg as a,E as o,Qh as s,Qt as c,Zh as l,Zt as u,_r as d,aa as f,ag as p,br as m,cg as h,dg as g,eg as _,fg as v,gg as y,gr as b,hM as x,hg as S,ia as C,ig as w,lg as T,mM as ee,mg as E,na as D,ng as te,og as ne,pg as re,ra as ie,rg as ae,sg as O,ta as k,tg as A,ug as j,vr as M,wg as N,xr as P,yr as F}from"./dist-D8Kd0X5G.js";import{d as I,f as L,i as R,l as z,n as B,r as V,t as H,u as U}from"./FieldLabel-CyXK3G_H.js";import{t as W}from"./button-Dbs-wspp.js";import{C as G,S as K,b as q,p as J,w as Y,x as X,xt as oe,z as se}from"./index-Se6baszB.js";import{r as Z,t as ce}from"./locales-CPjguROj.js";import{t as le}from"./localePickerView-C2RmOS86.js";/* empty css */var Q=t(e(),1),$=n(),ue={media_delivery:{label:g,help:j},documentary_fetch:{label:T,help:h},inbound_files:{label:O,help:ne},history_summary:{label:f,help:C},file_curation:{label:P,help:m}},de={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
- - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
- Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
- - [Fait 1](fait-1.md) - note du projet`},fe={outboundDir:r,references:s,files:l,previous_summary:ie,new_messages:D,max_chars:k,file_name:F,budget_chars:M,feedback:d,content:b};function pe(){let e=x(o.admin.listInstances,{}),[t,n]=(0,Q.useState)(null);if(e===void 0)return(0,$.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,$.jsx)(`div`,{className:`oc-injtab`,children:(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:w()})});let r=e.find(e=>e._id===t)??e[0];return(0,$.jsxs)(`div`,{className:`oc-injtab`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,$.jsx)(B,{label:y(),help:S()}),(0,$.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,$.jsx)(`span`,{children:p()}),(0,$.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsx)(X,{children:e.map(e=>(0,$.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,$.jsx)(me,{instance:r},r._id)]})}function me({instance:e}){let t=ee(o.admin.upsertInstanceConfig),n=se(),r=x(o.me.getMe,{host:oe}),s=e.config??{},l=Z(e.config?.contentLocale,r?.defaultLocale??void 0),[d,f]=(0,Q.useState)(()=>R(s,l));(0,Q.useEffect)(()=>{f(R(s,l))},[l,e._id]);let[p,m]=(0,Q.useState)(!1),h=d.promptInjections,g=(e,t)=>f({...d,promptInjections:{...h,[e]:{...h[e],...t}}});async function _(){m(!0);try{await t({instanceId:e._id,config:V(d,s,l)})}catch(e){n.error(a(),e)}finally{m(!1)}}async function v(r){let i={...e.config??{}};r==="default"?delete i.contentLocale:i.contentLocale=r;try{await t({instanceId:e._id,config:i})}catch(e){n.error(a(),e)}}let y=e.config?.contentLocale??`default`,b=ce[Z(void 0,r?.defaultLocale??void 0)];return(0,$.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,$.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,$.jsx)(`span`,{children:i()}),(0,$.jsxs)(q,{value:y,onValueChange:e=>void v(e),children:[(0,$.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,$.jsx)(Y,{})}),(0,$.jsxs)(X,{children:[(0,$.jsx)(K,{value:`default`,children:u({locale:b})}),le().map(e=>(0,$.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:c()})]}),U.map(e=>(0,$.jsx)(he,{injKey:e,def:z[e],i18n:ue[e],row:h[e]??{enabled:!0,template:z[e].defaultTemplate[l]},contentLocale:l,onChange:t=>g(e,t)},e)),(0,$.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,$.jsx)(W,{size:`sm`,onClick:()=>void _(),disabled:p,children:N()})})]})}function he({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:a}){let[o,s]=(0,Q.useState)(!1),c=r.template.trim()!==t.defaultTemplate[i],l=t.togglable&&!r.enabled,u=Object.fromEntries(t.placeholders.map(e=>[e,de[e]??`{${e}}`])),d=I(e,r,i),f=d?L(d,u):``;return(0,$.jsxs)(`section`,{className:`oc-injcard`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,$.jsxs)(`label`,{className:`oc-field--row`,children:[(0,$.jsx)(J,{checked:r.enabled,onCheckedChange:e=>a({enabled:e===!0})}),(0,$.jsx)(B,{label:n.label(),help:n.help()})]}):(0,$.jsx)(B,{label:n.label(),help:n.help()}),c&&(0,$.jsx)(`span`,{className:`oc-injection__badge`,children:re()})]}),(0,$.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:l,rows:8,spellCheck:!1,onChange:e=>a({template:e.target.value})}),(0,$.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,$.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:v()}),t.placeholders.map(e=>(0,$.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,$.jsx)(`code`,{children:`{${e}}`}),(0,$.jsx)(H,{text:(fe[e]??(()=>e))()})]},e))]}),(0,$.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>s(e=>!e),children:o?te():ae()}),c&&(0,$.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>a({template:t.defaultTemplate[i]}),children:E()})]})]}),o&&(0,$.jsx)(`div`,{className:`oc-injcard__preview`,children:f?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:f}),(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:A()})]}):(0,$.jsx)(`span`,{className:`oc-injection__ph`,children:_()})})]})}export{pe as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$y as r,Ay as i,By as a,Cy as o,Dy as ee,E as s,Ey as c,Gr as l,Gy as u,Hy as d,Jy as f,Ky as p,Ly as m,Oy as h,Qy as g,Ry as te,Ty as ne,Uy as re,Vy as ie,Wy as _,Xy as v,Yy as y,Zy as b,ab as x,cb as S,db as C,eb as w,fb as T,hM as E,ib as D,jy as O,ky as k,lb as A,mM as j,nb as M,ob as N,qy as P,rb as F,sb as I,tb as L,ub as R,wy as z,zy as ae}from"./dist-D8Kd0X5G.js";import{t as B}from"./button-Dbs-wspp.js";import{B as V,Rt as H,ct as U,lt as W,p as G,u as K,z as q}from"./index-Se6baszB.js";import{t as J}from"./roleDescriptions-DuRh679l.js";var Y=t(e(),1),X=n(),Z=[{group:()=>T(),keys:[{key:`traces.read`,label:()=>I()},{key:`traces.read.content`,label:()=>N(),phi:!0},{key:`traces.write`,label:()=>x()}]},{group:()=>C(),keys:[{key:`kpi.read`,label:()=>I()},{key:`kpi.write`,label:()=>x()}]},{group:()=>R(),keys:[{key:`openclaw.query`,label:()=>D()},{key:`anomalies.read`,label:()=>F()},{key:`anomalies.report`,label:()=>M()}]},{group:()=>A(),keys:[{key:`chats.read`,label:()=>I()},{key:`selfheal`,label:()=>w()},{key:`feedback.respond`,label:()=>l()}]},{group:()=>S(),keys:[{key:`admin.manage`,label:()=>L()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=E(s.apiKeys.listRoles,{}),t=j(s.apiKeys.createRole),n=j(s.apiKeys.ensureRolesSeeded),l=j(s.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(s.apiKeys.listRoles,{});r&&e.setQuery(s.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),x=V(),S=q(),[C,w]=(0,Y.useState)(!1),[T,D]=(0,Y.useState)($),[A,M]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{S.error(g(),e)})},[n,S]);let N=e??[];async function F(e,t){if(Q(e.permissions)||A.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];if(!(e.builtin&&!await x({title:b({name:e.name}),description:v(),confirmLabel:y()}))){M(t=>new Set(t).add(e._id));try{await l({roleId:e._id,permissions:n})}catch(e){S.error(f(),e)}finally{M(t=>{let n=new Set(t);return n.delete(e._id),n})}}}async function I(){try{await t({key:T.key,name:T.name,description:T.description||void 0,permissions:[]}),D($),w(!1)}catch(e){S.error(P(),e)}}let L=e===void 0,R=!L&&N.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[p(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,u(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,_()]}),(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:re()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{D($),w(!0)},children:d()})})]}),L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):R?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,X.jsx)(`div`,{className:`oc-matrix__scroll`,children:(0,X.jsxs)(`table`,{className:`oc-matrix`,children:[(0,X.jsxs)(`thead`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`oc-matrix__corner`,rowSpan:2,children:ae()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?r({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:N.map(e=>{let t=Q(e.permissions),n=A.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,{}),` `,te()]}):(0,X.jsx)(U,{variant:`secondary`,children:m()})]}),J(e)?(0,X.jsx)(`p`,{className:`oc-matrix__roledesc`,children:J(e)}):null]}),oe.map(r=>(0,X.jsx)(`td`,{className:`oc-matrix__cell`,children:(0,X.jsx)(G,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?O():n?i():r,onCheckedChange:()=>void F(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(K,{open:C,onOpenChange:w,title:k(),description:h(),canSubmit:!!(T.key&&T.name),onSubmit:I,submitLabel:ee(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:c()}),(0,X.jsx)(W,{value:T.key,placeholder:ne(),onChange:e=>D({...T,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:z()}),(0,X.jsx)(W,{value:T.name,onChange:e=>D({...T,name:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:o()}),(0,X.jsx)(W,{value:T.description,onChange:e=>D({...T,description:e.target.value})})]})]})})]})}export{se as RolesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$D as r,AD as i,AO as ee,BD as a,BO as te,CO as ne,DD as o,DO as re,E as s,ED as c,EO as ie,FD as l,FO as ae,GD as u,GO as oe,HD as d,HO as se,ID as f,IO as ce,JD as p,KD as m,KO as le,LD as h,LO as ue,MD as g,MO as de,ND as _,NO as fe,OD as v,OO as pe,PD as y,PO as me,QD as he,RD as ge,RO as _e,SO as ve,TO as ye,UD as be,UO as xe,VD as b,VO as x,WD as S,WO as Se,XD as Ce,YD as C,ZD as we,_O as Te,aO as Ee,bO as De,cO as Oe,dO as ke,eO as Ae,fM as je,fO as Me,gO as Ne,hM as w,hO as Pe,iO as Fe,jD as T,jO as Ie,kD as E,kO as Le,lO as Re,mM as D,mO as ze,nO as Be,oO as Ve,pO as He,qD as O,rO as Ue,sO as We,tO as Ge,uO as Ke,vO as qe,wO as Je,xO as Ye,yO as Xe,zD as k,zO as Ze}from"./dist-D8Kd0X5G.js";import{n as A}from"./dist-CF-vNq7s.js";import{i as Qe}from"./dist-BC4E1wqn.js";import{t as j}from"./button-Dbs-wspp.js";import{$ as M,B as $e,C as N,S as P,Wt as F,Xt as et,Yt as tt,b as I,ct as L,dt as R,et as z,ft as B,ht as V,lt as H,mt as nt,pt as rt,qt as it,u as at,ut as U,w as W,x as G,z as ot}from"./index-Se6baszB.js";import{t as st}from"./FilterBar-irfwrPVv.js";import{t as ct}from"./DataTableShell-CySP6pgB.js";import{t as lt}from"./roleDescriptions-DuRh679l.js";var K=t(e(),1),q=n(),J=[{value:`never`,label:()=>g(),days:null},{value:`30`,label:()=>T(),days:30},{value:`90`,label:()=>i(),days:90}],Y=720*60*60*1e3,X=`__all__`,Z={name:``,roleKey:``,description:``};function Q(){let e=et({from:`/settings/serviceAccounts`}),t=tt({from:`/settings/serviceAccounts`}),n=e.q??``,i=e.status??X,[a,o]=(0,K.useState)(X),c=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),l=e=>void t({search:t=>({...t,status:e===X?void 0:e})}),u=w(s.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:i===X?void 0:i===`disabled`}}),d=w(s.apiKeys.listKeys,{}),f=w(s.apiKeys.listRoles,{}),p=D(s.apiKeys.createServiceAccount),m=D(s.apiKeys.updateServiceAccount),h=D(s.apiKeys.deleteServiceAccount),g=je(s.apiKeys.mintApiKey),_=D(s.apiKeys.revokeApiKey),v=$e(),y=ot(),ge=n!==``||a!==X||i!==X;function be(){o(X),t({search:{},replace:!0})}let[b,S]=(0,K.useState)(!1),[C,T]=(0,K.useState)(Z),[E,O]=(0,K.useState)(null),[k,A]=(0,K.useState)(new Set),[M,F]=(0,K.useState)(null),R=(0,K.useRef)(!1),[z,B]=(0,K.useState)(new Set),[V,nt]=(0,K.useState)({}),[rt,U]=(0,K.useState)(null),Y=(0,K.useMemo)(()=>{let e=new Map;for(let t of d??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[d]);function Q(e){A(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}async function ft(){try{E?(await m({serviceAccountId:E,name:C.name,roleKey:C.roleKey,description:C.description}),y.success(Ke())):await p({name:C.name,roleKey:C.roleKey,description:C.description||void 0}),T(Z),O(null),S(!1)}catch(e){y.error(E?ke():Me(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),S(!0)}async function mt(e){if(R.current)return;R.current=!0;let t=V[e._id]??`never`,n=J.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;F(e._id);try{let t=await g({serviceAccountId:e._id,expiresAt:r});U({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){y.error(Re(),e)}finally{R.current=!1,F(null)}}async function $(e){if(await v({title:Oe(),description:(0,q.jsxs)(q.Fragment,{children:[We(),` `,(0,q.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Ve(),` `,(0,q.jsx)(`strong`,{children:Ee()}),` `,Fe()]}),confirmWord:e.name,confirmLabel:Ue(),destructive:!0}))try{await h({serviceAccountId:e._id}),y.success(Be(),e.name)}catch(e){y.error(Ge(),e)}}async function ht(e){if(await v({title:Ae(),description:(0,q.jsxs)(q.Fragment,{children:[r(),` `,(0,q.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,he()]}),confirmLabel:we(),destructive:!0})&&!z.has(e._id)){B(t=>new Set(t).add(e._id));try{await _({keyId:e._id})}catch(e){y.error(Ce(),e)}finally{B(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:le()}),(0,q.jsxs)(st,{q:n,onQChange:c,searchPlaceholder:oe(),onReset:be,canReset:ge,children:[(0,q.jsxs)(I,{value:a,onValueChange:o,children:[(0,q.jsx)(N,{size:`sm`,className:`w-40`,children:(0,q.jsx)(W,{placeholder:Se()})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(P,{value:X,children:xe()}),(f??[]).map(e=>(0,q.jsx)(P,{value:e.key,children:e.key},e._id))]})]}),(0,q.jsxs)(I,{value:i,onValueChange:l,children:[(0,q.jsx)(N,{size:`sm`,className:`w-36`,children:(0,q.jsx)(W,{})}),(0,q.jsxs)(G,{children:[(0,q.jsx)(P,{value:X,children:se()}),(0,q.jsx)(P,{value:`active`,children:x()}),(0,q.jsx)(P,{value:`disabled`,children:te()})]})]})]}),(0,q.jsx)(ct,{title:Ze(),rows:u,addLabel:_e(),onAdd:()=>{T(Z),O(null),S(!0)},emptyHint:ue(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,q.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:z}),rowActions:e=>[{label:fe(),onSelect:()=>pt(e)},{label:ce(),onSelect:()=>void mt(e)},{label:k.has(e._id)?ae():me(),onSelect:()=>Q(e._id)},{label:de(),variant:`destructive`,onSelect:()=>void $(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,q.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?Ie():ee(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,q.jsx)(Qe,{}):(0,q.jsx)(it,{})})},{header:Le(),sort:e=>e.name,cell:e=>(0,q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,q.jsx)(`span`,{children:e.name}),e.description?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:pe(),sort:e=>e.roleKey,cell:e=>(0,q.jsx)(L,{variant:`secondary`,children:e.roleKey})},{header:re(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,q.jsx)(L,{variant:`destructive`,children:te()}):(0,q.jsx)(L,{variant:`outline`,children:x()})},{header:ie(),cell:e=>(0,q.jsxs)(I,{value:V[e._id]??`never`,onValueChange:t=>nt(n=>({...n,[e._id]:t})),children:[(0,q.jsx)(N,{size:`sm`,className:`w-32`,children:(0,q.jsx)(W,{})}),(0,q.jsx)(G,{children:J.map(e=>(0,q.jsx)(P,{value:e.value,children:e.label()},e.value))})]})},{header:ye(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,q.jsx)(`span`,{className:`oc-sa__keycount`,children:M===e._id?Je():ne({count:t})})}}]}),(0,q.jsx)(at,{open:b,onOpenChange:e=>{S(e),e||O(null)},title:E?ve():Xe(),description:E?Ye():qe(),canSubmit:!!(C.name&&C.roleKey),onSubmit:ft,submitLabel:E?De():Te(),children:(0,q.jsxs)(`div`,{className:`oc-form`,children:[(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Ne()}),(0,q.jsx)(H,{value:C.name,onChange:e=>T({...C,name:e.target.value})})]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:Pe()}),(0,q.jsxs)(I,{value:C.roleKey||void 0,onValueChange:e=>T({...C,roleKey:e}),children:[(0,q.jsx)(N,{className:`w-full`,children:(0,q.jsx)(W,{placeholder:ze()})}),(0,q.jsx)(G,{children:(f??[]).map(e=>(0,q.jsxs)(P,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(f??[]).find(e=>e.key===C.roleKey),t=e?lt(e):null;return t?(0,q.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,q.jsxs)(`label`,{className:`oc-field`,children:[(0,q.jsx)(`span`,{className:`oc-field__label`,children:He()}),(0,q.jsx)(H,{value:C.description,onChange:e=>T({...C,description:e.target.value})})]})]})}),(0,q.jsx)(dt,{minted:rt,onClose:()=>U(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,q.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,q.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[C(),` `,(0,q.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,q.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):(0,q.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{children:O()}),(0,q.jsx)(`th`,{children:m()}),(0,q.jsx)(`th`,{children:u()}),(0,q.jsx)(`th`,{children:S()}),(0,q.jsx)(`th`,{children:be()}),(0,q.jsx)(`th`,{children:d()}),(0,q.jsx)(`th`,{})]})}),(0,q.jsx)(`tbody`,{children:t.map(t=>(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`td`,{children:(0,q.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,q.jsx)(`td`,{children:(0,q.jsx)(L,{variant:`secondary`,children:e.roleKey})}),(0,q.jsx)(`td`,{children:z(t.createdAt)}),(0,q.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,q.jsx)(`td`,{children:mt(t.expiresAt)}),(0,q.jsx)(`td`,{children:$(t)}),(0,q.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,q.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?b():a()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,K.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,q.jsx)(U,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,q.jsxs)(R,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,q.jsxs)(nt,{children:[(0,q.jsx)(V,{children:k()}),(0,q.jsx)(B,{children:ge({name:e.accountName})})]}),(0,q.jsx)(`div`,{className:`oc-sa__minted-warning`,children:h()}),(0,q.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,q.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,q.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":f(),children:[n?(0,q.jsx)(A,{}):(0,q.jsx)(F,{}),n?l():y()]})]}),(0,q.jsx)(rt,{children:(0,q.jsx)(j,{onClick:()=>{r(!1),t()},children:_()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?E():z(e)}function mt(e){return e===null?`—`:M(e)}function $(e){return e.disabled?(0,q.jsx)(L,{variant:`destructive`,children:v()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,q.jsx)(L,{variant:`outline`,children:o()}):(0,q.jsx)(L,{variant:`outline`,children:c()})}export{Q as ServiceAccountsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aa as r,Ba as i,Ca as a,Da as o,E as s,Ea as c,Fa as l,Ga as u,Ha as d,Ia as f,Ja as p,Ka as m,La as h,Ma as g,Na as _,Oa as v,Pa as y,Ra as b,Sa as x,Ta as S,Ua as C,Va as w,Wa as T,_a as E,ba as D,da as O,fa as k,ga as A,hM as j,ha as M,ja as N,ka as P,mM as F,ma as I,pa as L,qa as ee,ua as R,va as z,wa as B,xa as V,ya as H,za as U}from"./dist-D8Kd0X5G.js";import{t as W}from"./button-Dbs-wspp.js";import{B as G,et as K}from"./index-Se6baszB.js";import{t as q}from"./DataTableShell-CySP6pgB.js";var J=t(e(),1),Y=n(),X={hung:()=>N(),wrong_result:()=>r(),error:()=>P(),other:()=>v()},Z=e=>(e&&X[e]?.())??e??`—`;function Q(e){let t=e.slice(e.lastIndexOf(`:`)+1)||e;return t.length>12?`${t.slice(0,12)}…`:t}function $({data:e}){let t=e.snapshot,n=F(s.subAgentReports.respondToReport),[r,i]=(0,J.useState)(e.thread),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(!1);async function p(){let t=l.trim();if(!(!t||d)){f(!0);try{await n({reportId:e._id,text:t}),i(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),u(``)}finally{f(!1)}}}return(0,Y.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,children:(0,Y.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Z(e.category),` · `,o({failed:t.failedCount,total:t.totalCount}),t.openclawModel?` · ${t.openclawModel}`:``,t.openclawRuntime?` (${t.openclawRuntime})`:``]})}),e.comment?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:c()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:S()}),r.length>0?(0,Y.jsx)(`div`,{className:`oc-fbadmin__thread`,children:r.map((e,t)=>(0,Y.jsxs)(`div`,{className:`oc-notif__msg oc-notif__msg--${e.authorRole}`,children:[(0,Y.jsx)(`span`,{className:`oc-notif__msg-who`,children:e.authorRole===`admin`?B():a()}),(0,Y.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Y.jsx)(`p`,{className:`oc-fbadmin__meta`,children:x()}),(0,Y.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:V(),value:l,maxLength:2e3,rows:3,onChange:e=>u(e.target.value.slice(0,2e3))}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Y.jsx)(W,{size:`sm`,onClick:()=>void p(),disabled:!l.trim()||d,children:d?H():D()})})]}),(0,Y.jsxs)(`section`,{children:[(0,Y.jsxs)(`h4`,{className:`oc-fbadmin__h`,children:[z({count:t.children.length}),t.childrenTruncated?` ${E()}`:``,t.textTruncated?` ${A()}`:``]}),(0,Y.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:t.children.map((e,n)=>(0,Y.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Y.jsxs)(`span`,{className:`oc-fbadmin__ctx-role`,children:[(e.taskName?.trim()||Q(e.childSessionKey))+` · ${e.status}`,e.phase?` · ${e.phase}`:``,e.childSessionKey===t.flaggedChildSessionKey?` · ${M()}`:``]}),e.errorMessage?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.errorMessage}):null,e.resultText?(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:e.resultText}):null]},n))})]}),t.parentText?(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I()}),(0,Y.jsx)(`pre`,{className:`oc-msg__source-pre`,children:t.parentText})]}):null,(0,Y.jsxs)(`section`,{children:[(0,Y.jsx)(`h4`,{className:`oc-fbadmin__h`,children:L()}),(0,Y.jsx)(`p`,{className:`oc-fbadmin__env`,children:[t.parentStatus?`status: ${t.parentStatus}`:null,t.parentErrorCode?`code: ${t.parentErrorCode}`:null,t.parentRunId?`run ${t.parentRunId.slice(0,12)}…`:null,e.correlationId?`corr ${e.correlationId.slice(0,16)}…`:null,t.openclawProvider].filter(Boolean).join(` · `)||`—`})]})]})}function te(){let e=j(s.subAgentReports.listForAdmin,{}),t=F(s.subAgentReports.readReport),n=F(s.subAgentReports.deleteReport),r=G(),[a,o]=(0,J.useState)(null),[c,v]=(0,J.useState)({});async function x(e){if(a===e._id){o(null);return}if(!c[e._id]){let n=await t({reportId:e._id});v(t=>({...t,[e._id]:n}))}o(e._id)}async function S(e){await r({title:k(),description:O(),confirmLabel:R(),destructive:!0})&&(await n({reportId:e._id}),a===e._id&&o(null))}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[m(),` `,(0,Y.jsx)(`strong`,{children:u()}),` `,T()]}),(0,Y.jsx)(q,{title:p(),rows:e,emptyHint:ee(),isExpanded:e=>a===e._id&&!!c[e._id],renderExpanded:e=>c[e._id]?(0,Y.jsx)($,{data:c[e._id]}):null,columns:[{header:C(),cell:e=>K(e.at),sort:e=>e.at},{header:d(),cell:e=>Z(e.category),sort:e=>Z(e.category)},{header:w(),cell:e=>`${e.failedCount}/${e.totalCount}`,sort:e=>e.failedCount},{header:i(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${h({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:U(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:b(),cell:e=>e.answered?(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:f()}):(0,Y.jsx)(`span`,{className:`oc-fbadmin__pill`,children:l()}),sort:e=>+!!e.answered}],rowActions:e=>[{label:a===e._id?_():y(),onSelect:()=>void x(e)},{label:g(),onSelect:()=>void S(e),variant:`destructive`}]})]})}export{te as SubAgentReportsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,$k as i,AA as a,BA as o,Bk as s,CA as c,D as l,DA as u,E as d,EA as f,FA as p,Fk as m,GA as h,Gk as g,HA as _,Hk as v,IA as y,Ik as ee,JA as te,Jk as ne,KA as re,Kk as ie,LA as ae,Lk as oe,MA as se,NA as ce,OA as le,PA as ue,QA as de,Qk as fe,RA as pe,Rk as me,SA as he,TA as ge,UA as _e,Uk as b,VA as ve,Vk as ye,WA as be,Wk as xe,XA as Se,Xk as Ce,YA as we,Yk as Te,ZA as Ee,Zk as De,_A as Oe,aA as ke,bA as x,cA as Ae,ca as S,dA as je,eA as Me,ej as Ne,fA as Pe,fM as Fe,gA as Ie,hA as Le,hM as C,iA as Re,iM as ze,jA as Be,kA as Ve,lA as He,la as w,mA as Ue,mM as T,n as We,nA as Ge,nM as Ke,nj as qe,oA as Je,oa as Ye,pA as Xe,qA as E,qk as Ze,rA as Qe,rM as $e,rj as et,sA as tt,sa as nt,tA as D,tj as rt,uA as it,vA as at,wA as ot,xA as st,yA as ct,zA as lt,zk as O}from"./dist-D8Kd0X5G.js";import{n as k}from"./dist-CF-vNq7s.js";import{t as A}from"./x-B-jDgsYW.js";import{t as j}from"./button-Dbs-wspp.js";import{C as M,Ht as N,S as P,Ut as ut,_t as dt,at as ft,b as F,ct as I,gt as pt,it as L,lt as R,nt as mt,ot as z,p as B,rt as ht,st as gt,w as V,x as H,xt as U}from"./index-Se6baszB.js";import{t as _t}from"./localePickerView-C2RmOS86.js";import{a as vt,i as yt,n as bt,o as xt,r as St,t as Ct}from"./card-B_7M0l5O.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-RDie4v3L.js";import{t as Dt}from"./TimeRangePicker-3h2VniWx.js";import{t as Ot}from"./FilterBar-irfwrPVv.js";import{t as kt}from"./AdvancedFilter-BzRzcaLe.js";var q=l(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),J=t(e(),1),At=.1,jt=[248,248,248],Mt=[24,24,24];function Nt(e,t,n){let r=t,i=n,a=-1,o=-1;for(let s=0;s<n;s++)for(let n=0;n<t;n++)e[(s*t+n)*4+3]>8&&(n<r&&(r=n),n>a&&(a=n),s<i&&(i=s),s>o&&(o=s));return a<0?null:{x:r,y:i,width:a-r+1,height:o-i+1}}function Pt(e,t,n){let r=t*n;if(r===0)return 0;let i=0;for(let t=3;t<e.length;t+=4)e[t]<=8&&i++;return i/r}function Y(e,t,n){return Pt(e,t,n)>=At}function Ft(e,t){for(let n=0;n<e.length;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2]}function It(e){for(let t=0;t<e.length;t+=4)e[t]=255-e[t],e[t+1]=255-e[t+1],e[t+2]=255-e[t+2]}var Lt=12*1024*1024,Rt=480,zt=160,Bt=.92;async function Vt(e,t={}){if(!e.type.startsWith(`image/`))throw Error(Re());if(e.size>Lt)throw Error(Qe());let{source:n,width:r,height:i,cleanup:a}=await Ht(e);try{let a=e.type===`image/svg+xml`,o=Math.min(Rt/r,zt/i,a?1/0:1),s=Math.max(1,Math.round(r*o)),c=Math.max(1,Math.round(i*o)),l=document.createElement(`canvas`);l.width=s,l.height=c;let u=l.getContext(`2d`);if(!u)throw Error(D());u.imageSmoothingEnabled=!0,u.imageSmoothingQuality=`high`,u.drawImage(n,0,0,s,c);let d=Nt(u.getImageData(0,0,s,c).data,s,c)??{x:0,y:0,width:s,height:c},f=document.createElement(`canvas`);f.width=d.width,f.height=d.height;let p=f.getContext(`2d`);if(!p)throw Error(D());if(p.drawImage(l,d.x,d.y,d.width,d.height,0,0,d.width,d.height),t.variantFor){let e=p.getImageData(0,0,d.width,d.height);Y(e.data,d.width,d.height)?Ft(e.data,t.variantFor===`dark`?jt:Mt):It(e.data),p.putImageData(e,0,0)}let m=Y(p.getImageData(0,0,d.width,d.height).data,d.width,d.height),h=await Ut(f,`image/webp`,Bt)??await Ut(f,`image/png`);if(!h)throw Error(Me());return{blob:h,hasAlpha:m}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return X(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return X(e)}async function X(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(Ge())),e.src=t}),{source:e,width:e.naturalWidth||300,height:e.naturalHeight||150,cleanup:()=>URL.revokeObjectURL(t)}}catch(e){throw URL.revokeObjectURL(t),e}}function Ut(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var Z=n();function Wt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Q=`__all__`,Gt={kind:`relative`,from:`now-24h`,to:`now`},Kt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function $({title:e,description:t,children:n}){return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,Z.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function qt(e){return e===`light`?ze():e===`dark`?$e():Ke()}var Jt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Yt({tokens:e,mode:t}){let n=e.colors[t];return(0,Z.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Jt.map(e=>{let t=n[e];return(0,Z.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Xt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,Z.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,Z.jsxs)(`button`,{type:`button`,className:We(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,Z.jsx)(k,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,Z.jsx)(Yt,{tokens:r,mode:i}):(0,Z.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,Z.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,Z.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,Z.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":w(),title:w(),children:(0,Z.jsx)(ut,{className:`size-4`})}):null]})}function Zt({selectedKey:e,resolvedMode:t}){let n=C(d.charts.listMyCharts),r=T(d.charts.setMyChart);async function i(e){try{await r({name:e})}catch{}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:we()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,Z.jsx)(Xt,{selected:e===null,title:E(),subtitle:re(),tokens:null,mode:t,onSelect:()=>void i(null)}),(n??[]).map(n=>{let r=n.via===`common`?h():n.via===`owner`?be():_e({group:n.via.group});return(0,Z.jsx)(Xt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void i(n.key),onExport:()=>Wt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:_()}):null]})}function Qt(){let e=T(d.charts.importChart),[t,n]=(0,J.useState)(``),[r,i]=(0,J.useState)(``),[a,o]=(0,J.useState)(null),[s,l]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1);async function h(e){let t=e.target.files?.[0];if(e.target.value=``,t){o(null),l(!1);try{i(await t.text())}catch{o(x())}}}async function g(){if(o(null),l(!1),t.trim()===``){o(at());return}let a;try{a=JSON.parse(r)}catch{o(x());return}m(!0);try{await e({name:t.trim(),tokens:a}),l(!0),n(``),i(``)}catch(e){o(e instanceof Error?e.message:String(e))}finally{m(!1)}}return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:le()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:u()})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:f()}),(0,Z.jsx)(R,{value:t,onChange:e=>n(e.target.value),placeholder:ge(),maxLength:60})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:ot()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:c(),rows:8,spellCheck:!1})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(q,{className:`size-4`}),he(),(0,Z.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void h(e)})]})}),(0,Z.jsx)(j,{size:`sm`,disabled:p,onClick:()=>void g(),children:st()})]}),a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null,s?(0,Z.jsx)(`p`,{className:`oc-chart-import__ok`,children:ct()}):null]})]})}function $t({chart:e}){let t=Fe(d.charts.setChartLogo),n=T(d.charts.removeChartLogo),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(null),s=t=>t===`light`?e.logoLightUrl:e.logoDarkUrl;async function c(n,r,a){if(e.chartId!==void 0){o(null),i(!0);try{let{blob:i,hasAlpha:o}=await Vt(r,a?{variantFor:a}:{}),s=await i.arrayBuffer();await t({chartId:e.chartId,bytes:s,mode:n,hasAlpha:o})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function l(e,t){let n=t.target.files?.[0];t.target.value=``,n&&await c(e,n)}async function u(t){if(e.chartId!==void 0){o(null),i(!0);try{await n({chartId:e.chartId,mode:t})}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}async function f(e){let t=s(e===`light`?`dark`:`light`);if(t){o(null),i(!0);try{await c(e,await(await fetch(t)).blob(),e)}catch(e){o(e instanceof Error?e.message:String(e))}finally{i(!1)}}}function p({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?je():it()}),(0,Z.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,Z.jsx)(`img`,{src:t,alt:``}):null}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,Z.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,Z.jsx)(q,{className:`size-4`}),t?Ae():He(),(0,Z.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void f(e),children:Je()}):null,t?(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:tt()}):null]})}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Pe()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,Z.jsx)(p,{mode:`light`}),(0,Z.jsx)(p,{mode:`dark`})]}),r?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:ke()}):null,a?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function en({chart:e}){let t=C(d.me.getMe,{host:U}),n=T(d.charts.addChartDomain),r=T(d.charts.removeChartDomain),[a,o]=(0,J.useState)(``),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1);if(t?.role!==`admin`)return null;let f=e.domains??[];async function p(){let t=a.trim();if(t!==``){c(null),u(!0);try{await n({chartKey:e.key,domain:t}),o(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}}}async function m(t){c(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:i()}),(0,Z.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__groups`,children:f.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Te()}):f.map(e=>(0,Z.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ne({domain:e}),onClick:()=>void m(e),children:(0,Z.jsx)(A,{className:`size-3`})})]},e))}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(R,{value:a,onChange:e=>o(e.target.value),placeholder:De(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&p()}}),(0,Z.jsx)(j,{variant:`outline`,size:`sm`,disabled:l,onClick:()=>void p(),children:Ce()})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:fe()}),s?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:s}):null]})]})}function tn(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=T(d.charts.updateChart),n=T(d.charts.deleteChart),[r,i]=(0,J.useState)(!1),[a,o]=(0,J.useState)(e.name),[s,c]=(0,J.useState)(()=>tn(e.tokens)),[l,u]=(0,J.useState)(e.tokens.bpm??0),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(!1);function _(){o(e.name),c(tn(e.tokens)),u(e.tokens.bpm??0),p(null),i(!0)}async function v(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(s)}catch{p(x());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;l>0?e.bpm=l:delete e.bpm}h(!0);try{await t({chartId:e.chartId,name:a.trim(),tokens:n}),i(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{h(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(b()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:r?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:_,children:Ue()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:Xe()})]})})]}),r?(0,Z.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:g()}),(0,Z.jsx)(R,{value:a,onChange:e=>o(e.target.value),maxLength:60})]}),(0,Z.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:S()}),(0,Z.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,Z.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:l,onChange:e=>u(Number(e.target.value)),"aria-label":S()}),(0,Z.jsx)(`span`,{className:`oc-chart-bpm__value`,children:l===0?nt():`${l} BPM`})]}),(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:Ye()})]}),(0,Z.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-import__label`,children:xe()}),(0,Z.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:s,onChange:e=>c(e.target.value),rows:10,spellCheck:!1})]}),f?(0,Z.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,disabled:m,onClick:()=>void v(),children:Ze()}),(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>i(!1),children:ie()})]})]}):null,(0,Z.jsx)($t,{chart:e}),(0,Z.jsx)(en,{chart:e})]})}function rn(){let e=C(d.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Oe()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ie()})]}),e!==void 0&&t.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Le()}):(0,Z.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,Z.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=T(d.charts.addChartToGroupPool),r=T(d.charts.removeChartFromGroupPool),i=e.restrictedToGroups,o=e.poolGroups,s=new Set((o??[]).map(e=>e.groupId)),c=t.filter(e=>!s.has(e._id));async function l(t){try{await n({groupId:t,chartKey:e.key})}catch{}}async function u(t){try{await r({groupId:t,chartKey:e.key})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(I,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?ue():e.kind===`custom`&&e.scope===`personal`?O():p()}),e.isGlobalDefault?(0,Z.jsx)(I,{variant:`default`,children:ce()}):null]}),(0,Z.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:Be()}),(o??[]).map(e=>(0,Z.jsxs)(I,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,Z.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":Ve({group:e.name}),onClick:()=>void u(e.groupId),children:(0,Z.jsx)(A,{className:`size-3`})})]},e.groupId)),c.length>0?(0,Z.jsxs)(F,{value:``,onValueChange:e=>void l(e),children:[(0,Z.jsx)(M,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(V,{placeholder:a()})}),(0,Z.jsx)(H,{children:c.map(e=>(0,Z.jsx)(P,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:se()}):null]})]})}function on({chart:e}){let t=T(d.charts.promoteChartToCommon),n=T(d.charts.deleteChart);async function r(){if(e.chartId!==void 0)try{await t({chartId:e.chartId})}catch{}}async function i(){if(e.chartId!==void 0&&window.confirm(b()))try{await n({chartId:e.chartId})}catch{}}return(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,Z.jsx)(I,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?me():O()}),e.ownerLabel?(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:s({owner:e.ownerLabel})}):null]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,Z.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:oe()}):null,(0,Z.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:ee()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let i=T(d.admin.setDefaultThemeMode),a=T(d.admin.setDefaultLocale),s=T(d.charts.setDefaultChart),c=C(d.charts.listChartsAdmin),l=C(d.groups.listGroups,{}),u=e??`system`,f=t??`fr`;return(0,Z.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h2`,{className:`oc-show__title`,children:Ee()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Se()})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:ve()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:o()})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void s({name:null}),children:E()}),dt.map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void s({name:e.key}),children:e.name},e.key)),(c??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,Z.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void s({name:e.key}),children:e.name},e.key))]})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:lt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:pe()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,Z.jsx)(an,{chart:e,groups:l??[]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:ae()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:(c??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,Z.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,Z.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,Z.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,Z.jsx)(en,{chart:e})]},e.key))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:v()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:ye()})]}),(()=>{let e=(c??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:m()}):(0,Z.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,Z.jsx)(on,{chart:e},e.key))})})()]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:et()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:qe()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,Z.jsx)(j,{variant:u===e?`default`:`outline`,size:`sm`,onClick:()=>void i({mode:e}),children:qt(e)},e))})]}),(0,Z.jsxs)(`section`,{className:`oc-show__section`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,Z.jsx)(`h3`,{className:`oc-show__title`,children:rt()}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:Ne()})]}),(0,Z.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,Z.jsx)(j,{variant:f===e.value?`default`:`outline`,size:`sm`,onClick:()=>void a({locale:e.value}),children:e.label},e.value))}),(0,Z.jsx)(`p`,{className:`oc-show__desc`,children:r()})]})]})}function cn(){let e=C(d.me.getMe,{host:U}),t=pt(e?.resolvedThemeMode);return(0,Z.jsxs)(`div`,{className:`oc-appearance`,children:[(0,Z.jsx)(Zt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,Z.jsx)(Qt,{}),(0,Z.jsx)(rn,{}),e?.role===`admin`?(0,Z.jsx)(sn,{defaultThemeMode:e.defaultThemeMode,defaultLocale:e.defaultLocale,defaultChartKey:e.defaultChartKey}):null]})}function ln(){let[e,t]=(0,J.useState)(!0),[n,r]=(0,J.useState)(`per-user`),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(Q),[c,l]=(0,J.useState)(Q),[u,d]=(0,J.useState)(Gt),f=i!==``||o!==Q||c!==Q;function p(){a(``),s(Q),l(Q),d(Gt)}return(0,Z.jsxs)(`div`,{className:`oc-show`,children:[(0,Z.jsx)(cn,{}),(0,Z.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,Z.jsx)(`summary`,{className:`oc-show__title`,children:de()}),(0,Z.jsxs)($,{title:`Buttons`,description:`Variants`,children:[(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(j,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,Z.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,Z.jsx)(j,{variant:`link`,children:`Link`})]}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Small`}),(0,Z.jsx)(j,{children:`Default`}),(0,Z.jsx)(j,{size:`lg`,children:`Large`}),(0,Z.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,Z.jsx)(N,{})}),(0,Z.jsx)(j,{disabled:!0,children:`Disabled`})]})]}),(0,Z.jsx)($,{title:`Badges`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(I,{children:`Default`}),(0,Z.jsx)(I,{variant:`secondary`,children:`Secondary`}),(0,Z.jsx)(I,{variant:`outline`,children:`Outline`}),(0,Z.jsx)(I,{variant:`destructive`,children:`Destructive`})]})}),(0,Z.jsx)($,{title:`Inputs & selection`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(R,{placeholder:`Text input…`}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsxs)(F,{value:n,onValueChange:r,children:[(0,Z.jsx)(M,{className:`w-56`,children:(0,Z.jsx)(V,{placeholder:`Select…`})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(P,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,Z.jsx)(P,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,Z.jsxs)(`label`,{className:`oc-show__check`,children:[(0,Z.jsx)(B,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,Z.jsx)($,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,Z.jsxs)(F,{value:o,onValueChange:s,children:[(0,Z.jsx)(M,{size:`sm`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(P,{value:Q,children:`Toutes directions`}),(0,Z.jsx)(P,{value:`inbound`,children:`inbound`}),(0,Z.jsx)(P,{value:`outbound`,children:`outbound`}),(0,Z.jsx)(P,{value:`internal`,children:`internal`})]})]}),(0,Z.jsxs)(F,{value:c,onValueChange:l,children:[(0,Z.jsx)(M,{size:`sm`,children:(0,Z.jsx)(V,{})}),(0,Z.jsxs)(H,{children:[(0,Z.jsx)(P,{value:Q,children:`Toutes sévérités`}),(0,Z.jsx)(P,{value:`info`,children:`info`}),(0,Z.jsx)(P,{value:`warn`,children:`warn`}),(0,Z.jsx)(P,{value:`critical`,children:`critical`})]})]})]}),(0,Z.jsx)(kt,{fields:Kt,onChange:()=>{}}),(0,Z.jsxs)(`div`,{className:`oc-show__row`,children:[(0,Z.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,Z.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,Z.jsx)($,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,Z.jsxs)(mt,{children:[(0,Z.jsx)(gt,{asChild:!0,children:(0,Z.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,Z.jsx)(N,{})})}),(0,Z.jsxs)(ht,{align:`start`,children:[(0,Z.jsx)(ft,{children:`Actions`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(L,{children:`Edit`}),(0,Z.jsx)(L,{children:`Duplicate`}),(0,Z.jsx)(z,{}),(0,Z.jsx)(L,{variant:`destructive`,children:`Delete`})]})]})}),(0,Z.jsx)($,{title:`Card`,children:(0,Z.jsxs)(Ct,{className:`w-80`,children:[(0,Z.jsxs)(vt,{children:[(0,Z.jsx)(xt,{children:`Instance`}),(0,Z.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,Z.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,Z.jsxs)(yt,{className:`gap-2`,children:[(0,Z.jsx)(j,{size:`sm`,children:`Save`}),(0,Z.jsx)(j,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,Z.jsx)($,{title:`Table`,children:(0,Z.jsxs)(Et,{children:[(0,Z.jsx)(wt,{children:(0,Z.jsxs)(G,{children:[(0,Z.jsx)(W,{className:`w-8`,children:(0,Z.jsx)(B,{"aria-label":`select all`})}),(0,Z.jsx)(W,{children:`Name`}),(0,Z.jsx)(W,{children:`Mode`}),(0,Z.jsx)(W,{className:`text-right`,children:`Status`}),(0,Z.jsx)(W,{className:`w-8`})]})}),(0,Z.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,Z.jsxs)(G,{children:[(0,Z.jsx)(K,{children:(0,Z.jsx)(B,{"aria-label":`select ${e.n}`})}),(0,Z.jsx)(K,{className:`font-medium`,children:e.n}),(0,Z.jsx)(K,{children:(0,Z.jsx)(I,{variant:`secondary`,children:e.m})}),(0,Z.jsx)(K,{className:`text-right`,children:(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,Z.jsx)(k,{className:`size-3.5`}),` `,e.s]})}),(0,Z.jsx)(K,{children:(0,Z.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,Z.jsx)(N,{})})})]},e.n))})]})}),(0,Z.jsx)($,{title:`App fragments`,description:`Chat-specific components`,children:(0,Z.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,Z.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,Z.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,Z.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,Z.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,Z.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,Z.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,Z.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,Z.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,Z.jsx)(`span`,{className:`oc-run-status__dot`}),(0,Z.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};