@lacneu/atrium 0.71.2 → 0.71.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/assets/{AccessTab-CDi-2yXo.js → AccessTab-CdKVfyqH.js} +1 -1
  2. package/dist/assets/{AdvancedFilter-oNVoBmr5.js → AdvancedFilter-Zu9E_HNL.js} +1 -1
  3. package/dist/assets/AgentFilesTab-DAFNxXAK.js +3 -0
  4. package/dist/assets/{AnomaliesTab-BRIph00P.js → AnomaliesTab-IRWSMKNu.js} +1 -1
  5. package/dist/assets/{AuditTab-CDR9vWDW.js → AuditTab-BnUsbXj6.js} +1 -1
  6. package/dist/assets/BridgeTab-Dz34AzWo.js +1 -0
  7. package/dist/assets/{ChatDefaultsTab-V66EFWzF.js → ChatDefaultsTab-C7ARivyA.js} +1 -1
  8. package/dist/assets/{DataTableShell-BbVvH8AP.js → DataTableShell-DADb29_k.js} +1 -1
  9. package/dist/assets/{DetailChips-CEPfBJ3C.js → DetailChips-CthVhoem.js} +1 -1
  10. package/dist/assets/FeedbacksTab-Cq77svBj.js +1 -0
  11. package/dist/assets/{FieldLabel-YPTLow_x.js → FieldLabel-CsflJ8Xj.js} +2 -2
  12. package/dist/assets/FilesTab-B_FxsKyz.js +1 -0
  13. package/dist/assets/{FilterBar-BQxNZSAj.js → FilterBar-rwxELGmH.js} +1 -1
  14. package/dist/assets/GroupsTab-C466Sgxk.js +1 -0
  15. package/dist/assets/InstancesTab-IjQj3Qra.js +1 -0
  16. package/dist/assets/{IntegrationsTab-Ba2AWn_y.js → IntegrationsTab-6XpRN8B7.js} +1 -1
  17. package/dist/assets/{KpiTab-DDTX8X_Y.js → KpiTab-LRla1xPF.js} +1 -1
  18. package/dist/assets/PreferencesTab-CpBhQXxM.js +1 -0
  19. package/dist/assets/{ProjectPage-DXNQdzDR.js → ProjectPage-CvRKuSp1.js} +1 -1
  20. package/dist/assets/PromptInjectionsTab-DWKbGXeN.js +4 -0
  21. package/dist/assets/RolesTab-BWdTndqd.js +1 -0
  22. package/dist/assets/ScheduledTab-CUGfjwof.js +1 -0
  23. package/dist/assets/ServiceAccountsTab-CU5TtQL3.js +1 -0
  24. package/dist/assets/{SubAgentReportsTab-Bu0h7qO-.js → SubAgentReportsTab-ByonuC_d.js} +1 -1
  25. package/dist/assets/ThemeShowroom-BVNYmI8E.js +1 -0
  26. package/dist/assets/{TimeRangePicker-zbyQlb0G.js → TimeRangePicker-BtjTRcND.js} +1 -1
  27. package/dist/assets/{TimezoneCombobox-673xwoei.js → TimezoneCombobox-DHtTKpKk.js} +1 -1
  28. package/dist/assets/{TracesTab-DKr7xXLx.js → TracesTab-BgYWGRKc.js} +1 -1
  29. package/dist/assets/{UsersTab-CO_GLnNQ.js → UsersTab-Cb9WG2Ra.js} +1 -1
  30. package/dist/assets/VoiceTab-4109VeRq.js +1 -0
  31. package/dist/assets/api-Ckhqnz_N.js +44 -0
  32. package/dist/assets/{button-_UzA03A_.js → button-BqGzkZyv.js} +1 -1
  33. package/dist/assets/{card-BoGX4FTX.js → card-5AHkx9bi.js} +1 -1
  34. package/dist/assets/check-DOVIUTOQ.js +1 -0
  35. package/dist/assets/chevron-up-D0ejeWrc.js +1 -0
  36. package/dist/assets/chevrons-up-down-DBrVj0Y4.js +1 -0
  37. package/dist/assets/{compatView-DscksmHU.js → compatView-BfgkuS9a.js} +1 -1
  38. package/dist/assets/{dispatchErrorInfo-Cevbg9ej.js → dispatchErrorInfo-4Lxk_i8y.js} +1 -1
  39. package/dist/assets/{dist-Df0myUvd.js → dist-B0_pFzDK.js} +1 -1
  40. package/dist/assets/{dist-Bn5IE_M3.js → dist-myJrSmqk.js} +1 -1
  41. package/dist/assets/{dist-CtimXARj.js → dist-qDaH-Mvj.js} +1 -1
  42. package/dist/assets/{highlighted-body-OFNGDK62-DYD_5B4x.js → highlighted-body-OFNGDK62-BBIuZEWG.js} +1 -1
  43. package/dist/assets/index-Dl14wd3T.js +238 -0
  44. package/dist/assets/{list-Cfz6xpiH.js → list-BgUwuRwg.js} +1 -1
  45. package/dist/assets/mermaid-GHXKKRXX-DnfwDtiq.js +1 -0
  46. package/dist/assets/{pdf-DWIi2vJu.js → pdf-Ctq47c74.js} +1 -1
  47. package/dist/assets/roleDescriptions-B564TRKl.js +1 -0
  48. package/dist/assets/{table-ChZTpaGw.js → table-CDfLiIxi.js} +1 -1
  49. package/dist/assets/{tabs-DkJ2Ivbq.js → tabs-CEfW3KO4.js} +1 -1
  50. package/dist/assets/x-1whfPszp.js +1 -0
  51. package/dist/index.html +9 -9
  52. package/package.json +1 -1
  53. package/dist/assets/AgentFilesTab-YQT3_OHb.js +0 -3
  54. package/dist/assets/BridgeTab-DeYPFNVq.js +0 -1
  55. package/dist/assets/FeedbacksTab-ShRJwRig.js +0 -1
  56. package/dist/assets/FilesTab-DMUdEQ-m.js +0 -1
  57. package/dist/assets/GroupsTab-O4TXB1Ob.js +0 -1
  58. package/dist/assets/InstancesTab-Ct4hI8bm.js +0 -1
  59. package/dist/assets/PreferencesTab-CxFocwvh.js +0 -1
  60. package/dist/assets/PromptInjectionsTab-CFe9KSPE.js +0 -4
  61. package/dist/assets/RolesTab-DWLOWJub.js +0 -1
  62. package/dist/assets/ScheduledTab-KxaffW0K.js +0 -1
  63. package/dist/assets/ServiceAccountsTab-D2kskvcN.js +0 -1
  64. package/dist/assets/ThemeShowroom-Drc8NJ8v.js +0 -1
  65. package/dist/assets/VoiceTab-i90LqIO5.js +0 -1
  66. package/dist/assets/api-BASu8PYC.js +0 -44
  67. package/dist/assets/check-BVOFzT6U.js +0 -1
  68. package/dist/assets/chevron-up-BiXGHpx6.js +0 -1
  69. package/dist/assets/chevrons-up-down-DHCh-E-T.js +0 -1
  70. package/dist/assets/index-D02RwoOe.js +0 -238
  71. package/dist/assets/mermaid-GHXKKRXX-5UTQL7SN.js +0 -1
  72. package/dist/assets/roleDescriptions-s4fc4FW8.js +0 -1
  73. package/dist/assets/x-C5QQoypN.js +0 -1
@@ -0,0 +1 @@
1
+ import{CC as e,SC as t,TC as n,wC as r,xC as i}from"./api-Ckhqnz_N.js";var a={pending:n,user:r,admin:e,observer:t,agent:i};function o(e){if(e.builtin){let t=a[e.key];if(t)return t()}return e.description}export{o as t};
@@ -1 +1 @@
1
- import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-BASu8PYC.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
1
+ import{a as e,r as t}from"./bundle-mjs-C73ZY4La.js";import{r as n}from"./api-Ckhqnz_N.js";e();var r=t();function i({className:e,...t}){return(0,r.jsx)(`div`,{"data-slot":`table-container`,className:`relative w-full overflow-x-auto`,children:(0,r.jsx)(`table`,{"data-slot":`table`,className:n(`w-full caption-bottom text-sm`,e),...t})})}function a({className:e,...t}){return(0,r.jsx)(`thead`,{"data-slot":`table-header`,className:n(`[&_tr]:border-b`,e),...t})}function o({className:e,...t}){return(0,r.jsx)(`tbody`,{"data-slot":`table-body`,className:n(`[&_tr:last-child]:border-0`,e),...t})}function s({className:e,...t}){return(0,r.jsx)(`tr`,{"data-slot":`table-row`,className:n(`border-b transition-colors hover:bg-muted/50 has-aria-expanded:bg-muted/50 data-[state=selected]:bg-muted`,e),...t})}function c({className:e,...t}){return(0,r.jsx)(`th`,{"data-slot":`table-head`,className:n(`h-10 px-2 text-left align-middle font-medium whitespace-nowrap text-foreground [&:has([role=checkbox])]:pr-0`,e),...t})}function l({className:e,...t}){return(0,r.jsx)(`td`,{"data-slot":`table-cell`,className:n(`p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0`,e),...t})}export{a,c as i,o as n,s as o,l as r,i as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-BASu8PYC.js";import{t as d}from"./dist-Bn5IE_M3.js";import{Gt as f,Kt as p,qt as m}from"./index-D02RwoOe.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=d(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:f,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),d=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(f,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":d,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(a,{present:o||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:l(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{b as r,d as i,f as a,g as o,n as s,p as c,r as l,y as u}from"./api-Ckhqnz_N.js";import{t as d}from"./dist-myJrSmqk.js";import{Gt as f,Kt as p,qt as m}from"./index-Dl14wd3T.js";var h=t(e(),1),g=n(),_=`Tabs`,[v,y]=o(_,[m]),b=m(),[x,S]=v(_),C=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:a,onValueChange:o,defaultValue:s,orientation:l=`horizontal`,dir:u,activationMode:f=`automatic`,...p}=e,m=d(u),[h,v]=c({prop:a,onChange:o,defaultProp:s??``,caller:_});return(0,g.jsx)(x,{scope:n,baseId:i(),value:h,onValueChange:v,orientation:l,dir:m,activationMode:f,children:(0,g.jsx)(r.div,{dir:m,"data-orientation":l,...p,ref:t})})});C.displayName=_;var w=`TabsList`,T=h.forwardRef((e,t)=>{let{__scopeTabs:n,loop:i=!0,...a}=e,o=S(w,n),s=b(n);return(0,g.jsx)(p,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:(0,g.jsx)(r.div,{role:`tablist`,"aria-orientation":o.orientation,...a,ref:t})})});T.displayName=w;var E=`TabsTrigger`,D=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,disabled:a=!1,...o}=e,s=S(E,n),c=b(n),l=A(s.baseId,i),d=j(s.baseId,i),p=i===s.value;return(0,g.jsx)(f,{asChild:!0,...c,focusable:!a,active:p,children:(0,g.jsx)(r.button,{type:`button`,role:`tab`,"aria-selected":p,"aria-controls":d,"data-state":p?`active`:`inactive`,"data-disabled":a?``:void 0,disabled:a,id:l,...o,ref:t,onMouseDown:u(e.onMouseDown,e=>{!a&&e.button===0&&e.ctrlKey===!1?s.onValueChange(i):e.preventDefault()}),onKeyDown:u(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(i)}),onFocus:u(e.onFocus,()=>{let e=s.activationMode!==`manual`;!p&&!a&&e&&s.onValueChange(i)})})})});D.displayName=E;var O=`TabsContent`,k=h.forwardRef((e,t)=>{let{__scopeTabs:n,value:i,forceMount:o,children:s,...c}=e,l=S(O,n),u=A(l.baseId,i),d=j(l.baseId,i),f=i===l.value,p=h.useRef(f);return h.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,g.jsx)(a,{present:o||f,children:({present:n})=>(0,g.jsx)(r.div,{"data-state":f?`active`:`inactive`,"data-orientation":l.orientation,role:`tabpanel`,"aria-labelledby":u,hidden:!n,id:d,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&s})})});k.displayName=O;function A(e,t){return`${e}-trigger-${t}`}function j(e,t){return`${e}-content-${t}`}var M=C,N=T,P=D,F=k;function I({className:e,orientation:t=`horizontal`,...n}){return(0,g.jsx)(M,{"data-slot":`tabs`,"data-orientation":t,className:l(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...n})}var L=s(`group/tabs-list inline-flex w-fit items-center justify-center rounded-lg p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function R({className:e,variant:t=`default`,...n}){return(0,g.jsx)(N,{"data-slot":`tabs-list`,"data-variant":t,className:l(L({variant:t}),e),...n})}function z({className:e,...t}){return(0,g.jsx)(P,{"data-slot":`tabs-trigger`,className:l(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-all group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-sm group-data-[variant=line]/tabs-list:data-active:shadow-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent dark:group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:bg-background data-active:text-foreground dark:data-active:border-input dark:data-active:bg-input/30 dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function B({className:e,...t}){return(0,g.jsx)(F,{"data-slot":`tabs-content`,className:l(`flex-1 text-sm outline-none`,e),...t})}export{z as i,B as n,R as r,I as t};
@@ -0,0 +1 @@
1
+ import{D as e}from"./api-Ckhqnz_N.js";var t=e(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);export{t};
package/dist/index.html CHANGED
@@ -62,16 +62,16 @@
62
62
  document.documentElement.dataset.motion = "static";
63
63
  })();
64
64
  </script>
65
- <script type="module" crossorigin src="/assets/index-D02RwoOe.js"></script>
65
+ <script type="module" crossorigin src="/assets/index-Dl14wd3T.js"></script>
66
66
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-C73ZY4La.js">
67
- <link rel="modulepreload" crossorigin href="/assets/api-BASu8PYC.js">
68
- <link rel="modulepreload" crossorigin href="/assets/dist-CtimXARj.js">
69
- <link rel="modulepreload" crossorigin href="/assets/dist-Bn5IE_M3.js">
70
- <link rel="modulepreload" crossorigin href="/assets/dist-Df0myUvd.js">
71
- <link rel="modulepreload" crossorigin href="/assets/check-BVOFzT6U.js">
72
- <link rel="modulepreload" crossorigin href="/assets/chevron-up-BiXGHpx6.js">
73
- <link rel="modulepreload" crossorigin href="/assets/x-C5QQoypN.js">
74
- <link rel="modulepreload" crossorigin href="/assets/button-_UzA03A_.js">
67
+ <link rel="modulepreload" crossorigin href="/assets/api-Ckhqnz_N.js">
68
+ <link rel="modulepreload" crossorigin href="/assets/dist-qDaH-Mvj.js">
69
+ <link rel="modulepreload" crossorigin href="/assets/dist-myJrSmqk.js">
70
+ <link rel="modulepreload" crossorigin href="/assets/dist-B0_pFzDK.js">
71
+ <link rel="modulepreload" crossorigin href="/assets/check-DOVIUTOQ.js">
72
+ <link rel="modulepreload" crossorigin href="/assets/chevron-up-D0ejeWrc.js">
73
+ <link rel="modulepreload" crossorigin href="/assets/x-1whfPszp.js">
74
+ <link rel="modulepreload" crossorigin href="/assets/button-BqGzkZyv.js">
75
75
  <link rel="stylesheet" crossorigin href="/assets/index-SBwQs_kQ.css">
76
76
  </head>
77
77
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lacneu/atrium",
3
- "version": "0.71.2",
3
+ "version": "0.71.3",
4
4
  "description": "Atrium — public, self-hostable, Convex-backed web chat UI for AI agent gateways (OpenClaw today, Hermes next). Ships an origin-agnostic static bundle (Convex URL injected at runtime via /config.json).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,3 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Aa as r,Au as i,Ca as a,Cd as o,Cu as s,Da as c,Du as l,Ea as u,Eu as d,Fu as f,GR as p,Gi as m,Iu as h,Ji as g,KR as _,Ki as v,LR as y,Lu as b,Ma as x,Mu as S,Nu as C,O as w,Oa as T,Ou as E,Pu as D,Ru as ee,Sa as O,Su as k,Ta as A,Td as j,Tu as te,UA as M,UR as N,Wi as P,Xi as F,Yi as I,_a as L,_u as ne,ba as R,bu as re,du as ie,fa as ae,fu as z,ga as B,gu as V,ha as oe,hu as se,ja as H,ju as ce,ka as le,ku as ue,ma as U,mu as de,pa as fe,pu as pe,qi as me,t as W,uu as he,va as ge,vu as _e,wa as ve,wu as ye,xa as be,xu as xe,ya as Se,yu as Ce,zR as G,zu as we}from"./api-BASu8PYC.js";import{t as K}from"./button-_UzA03A_.js";import{$ as Te,B as Ee,Ct as De,Dt as q,Et as Oe,Q as ke,St as Ae,Tt as je,X as Me,Z as Ne,at as Pe,bt as Fe,et as Ie,nt as Le,ot as Re,q as ze,rn as J,rt as Be,tt as Ve,vt as He,wt as Ue,xt as We,yt as Ge}from"./index-D02RwoOe.js";import{n as Ke,t as qe}from"./curation-CQksaIbm.js";import{i as Je}from"./compatView-DscksmHU.js";/* empty css */var Y=t(e(),1),X=2e4,Ye=6e4;function Xe(e){return typeof e!=`number`||e<=0?0:Math.round(e/X*100)}function Ze(e){return e<=0?0:Math.round(e/Ye*100)}function Z(e,t){let n=(typeof e==`number`&&e>0?e:0)/1e3;return new Intl.NumberFormat(t,{minimumFractionDigits:1,maximumFractionDigits:1}).format(n)}function Qe(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var $e=3;function et(e,t){let n=new Map;for(let t of e.split(`
2
- `))n.set(t,(n.get(t)??0)+1);for(let e of t.split(`
3
- `))n.set(e,(n.get(e)??0)-1);let r=0,i=0,a=[],o=[];for(let[e,t]of n)t<0?(r+=-t,a.length<$e&&a.push(e)):t>0&&(i+=t,o.length<$e&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function tt(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function nt(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function rt(){let e=_(W.me.getMe,{host:ze}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=_(W.admin.listInstances,e!==void 0&&t?{}:`skip`),[a,s]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!t||!r||r.length===0||(!a||!r.some(e=>e.name===a))&&s(r[0].name)},[t,r,a]);let u=_(W.agents.listAgentsForInstance,t&&a?{instanceName:a}:`skip`),d=_(W.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),p=(0,Y.useMemo)(()=>{if(e!==void 0){if(t)return a===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:a,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}));if(d!==void 0)return d.map(e=>({instanceName:e.instanceName,agentId:e.agentId,label:`${e.emoji?`${e.emoji} `:``}${e.displayName??e.agentId}`}))}},[e,t,a,u,r,d]),[m,g]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{!p||p.length===0||(!m||!p.some(e=>$(e)===m))&&g($(p[0]))},[p,m]);let v=p?.find(e=>$(e)===m)??null,x=N(W.agentFiles.listAgentFiles),[O,k]=(0,Y.useState)({status:`idle`}),A=v?.instanceName??null,j=v?.agentId??null,te=_(W.compat.forInstance,n&&A!==null?{instanceName:A}:`skip`),M=n&&A!==null?Ee(te,`agentFiles`):null,P=M===null?!1:M===`loading`?null:M.blocked,F=(0,Y.useCallback)(async()=>{if(!(A===null||j===null)){k({status:`loading`});try{k({status:`done`,files:(await x({instanceName:A,agentId:j})).files})}catch(e){k({status:`error`,dashboardAbsent:tt(e)})}}},[x,A,j]);(0,Y.useEffect)(()=>{P===!1&&F()},[F,P]);let[I,L]=(0,Y.useState)(null),ne=_(W.agentFileCuration.listCurations,t&&A!==null&&j!==null?{instanceName:A,agentId:j}:`skip`),R=_(W.agentFileCuration.curationSettings,t&&A!==null?{instanceName:A}:`skip`),re=N(W.agentFileCuration.requestCuration),[ie,ae]=(0,Y.useState)(null),[z,B]=(0,Y.useState)(null),{toast:V}=q(),oe=(0,Y.useMemo)(()=>{let e=new Map;for(let t of ne??[])e.has(t.name)||e.set(t.name,t);return e},[ne]),se=(0,Y.useCallback)(async e=>{if(!(A===null||j===null)){ae(e);try{let t=await re({instanceName:A,agentId:j,name:e,trigger:`manual`});t.ok?V({title:le(),variant:`success`}):V({title:T({reason:t.reason??`unknown`}),variant:`error`})}catch{V({title:c(),variant:`error`})}finally{ae(null)}}},[re,A,j,V]),H=G(),U=(0,Y.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]);return e===void 0||p===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:we()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(Me,{value:a??``,onValueChange:e=>s(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":ee(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ne,{children:(r??[]).map(e=>(0,Q.jsx)(ke,{value:e.name,children:e.name},e.name))})]}):null,p.length>0?(0,Q.jsxs)(Me,{value:m??``,onValueChange:e=>g(e),children:[(0,Q.jsx)(Te,{size:`sm`,"aria-label":b(),children:(0,Q.jsx)(Ie,{})}),(0,Q.jsx)(Ne,{children:p.map(e=>(0,Q.jsx)(ke,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:h()})]}),v===null?null:M===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):M!==null&&M.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(J,{size:14,"aria-hidden":!0}),` `,Je(M.gatewayVersion,M.provider)]}):O.status===`loading`||O.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):O.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[O.dashboardAbsent?w():D(),` `,!O.dashboardAbsent&&(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void F(),children:o()})]}):O.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:f()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-afiles__list`,children:O.files.map(e=>{let n=Xe(e.size),r=n>=80;return(0,Q.jsxs)(`div`,{className:`oc-afiles__row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__name`,title:e.name,children:e.name}),e.missing?(0,Q.jsx)(Oe,{variant:`outline`,children:C()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:S({size:Z(e.size,H)})}),(0,Q.jsx)(`span`,{className:`oc-afiles__gauge${r?` is-warn`:``}`,"aria-hidden":!0,children:(0,Q.jsx)(`span`,{className:`oc-afiles__gauge-fill`,style:{width:`${Math.min(n,100)}%`}})}),(0,Q.jsx)(`span`,{className:`oc-afiles__pct`,children:ce({pct:U.format(n)})}),r?(0,Q.jsx)(J,{size:14,className:`oc-afiles__warn`,"aria-label":i()}):(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:()=>L(e),children:t?E():l()}),t&&!e.missing?(0,Q.jsx)(it,{curatable:qe.includes(e.name),size:e.size??0,budget:R?.budgetChars??null,enabled:R?.enabled??!1,curation:oe.get(e.name)??null,inFlight:ie===e.name,onCurate:()=>void se(e.name),onReview:e=>B(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ue({used:Z(Qe(O.files),H),total:Z(Ye,H),pct:U.format(Ze(Qe(O.files)))})})]}),I&&v?(0,Q.jsx)(at,{instanceName:v.instanceName,agentId:v.agentId,name:I.name,isAdmin:t,onClose:()=>L(null),onSaved:()=>void F()}):null,z?(0,Q.jsx)(ot,{curationId:z,onClose:()=>B(null),onApplied:()=>{B(null),F()}}):null]})}function it({curatable:e,size:t,budget:n,enabled:i,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(K,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:H()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Oe,{variant:`outline`,className:`oc-afiles__curate-status`,children:r()}):e&&i&&n!==null&&Ke(t,n)?(0,Q.jsx)(K,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:x()}):null}function at({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let c=N(W.agentFiles.getAgentFile),l=N(W.agentFiles.setAgentFile),u=q(),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),[g,_]=(0,Y.useState)(``),[v,b]=(0,Y.useState)(!1),[x,S]=(0,Y.useState)(!1),[C,w]=(0,Y.useState)(!1),[T,E]=(0,Y.useState)(!1),D=(0,Y.useCallback)(async r=>{h(!1);try{let i=await c({instanceName:e,agentId:t,name:n});p({content:i.content,updatedAtMs:i.updatedAtMs}),r||_(i.content),w(!1)}catch{h(!0)}},[c,e,t,n]);(0,Y.useEffect)(()=>{D(!1)},[D]);async function ee(){if(f!==null){S(!0),E(!1);try{await l({instanceName:e,agentId:t,name:n,content:g,baseUpdatedAtMs:f.updatedAtMs??void 0}),u.success(re({name:n})),a(),await D(!1)}catch(e){nt(e)?w(!0):E(!0)}finally{S(!1)}}}let O=f!==null&&g!==f.content,A=(0,Y.useMemo)(()=>f===null?null:et(f.content,g),[f,g]),P=g.length>X,F=G(),I=(0,Y.useMemo)(()=>new Intl.NumberFormat(F),[F]);return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:d({name:n})}),(0,Q.jsxs)(Be,{children:[te({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,ye()]})]})]}),m?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[_e(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void D(!1),children:o()})]}):f===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:g,readOnly:!r,spellCheck:!1,onChange:e=>_(e.target.value),"aria-label":d({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:s()}),C?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ne(),` `,(0,Q.jsx)(K,{variant:`outline`,size:`sm`,onClick:()=>void D(!0),children:V()})]}):null,T?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:Ce()}):null,(0,Q.jsxs)(`div`,{className:`oc-afiles__editor-foot`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${P?` is-over`:``}`,children:k({count:I.format(g.length),max:I.format(X)})}),r?(0,Q.jsx)(K,{size:`sm`,disabled:!O||x||C,onClick:()=>b(!0),children:x?j():xe()}):null]})]}),(0,Q.jsx)(He,{open:v,onOpenChange:b,children:(0,Q.jsxs)(We,{children:[(0,Q.jsxs)(Ue,{children:[(0,Q.jsx)(je,{children:se({name:n})}),(0,Q.jsx)(Ae,{children:de({agent:t})})]}),A?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:pe({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:z()}),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:ie()}),A.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(De,{children:[(0,Q.jsx)(Fe,{children:M()}),(0,Q.jsx)(Ge,{onClick:()=>void ee(),children:he()})]})]})})]})})}function ot({curationId:e,onClose:t,onApplied:n}){let r=_(W.agentFileCuration.getProposal,{curationId:e}),i=N(W.agentFileCuration.approveCuration),o=p(W.agentFileCuration.rejectCuration),{toast:s}=q(),[l,d]=(0,Y.useState)(null),[f,h]=(0,Y.useState)(!1),[b,x]=(0,Y.useState)(``),S=G(),C=(0,Y.useMemo)(()=>r?et(r.beforeContent,r.proposedContent):null,[r]);async function w(){d(`approve`);try{let t=await i({curationId:e});t.ok?(s({title:u(),variant:`success`}),n()):s({title:t.reason===`conflict`?ve():a({reason:t.reason??`unknown`}),variant:`error`})}catch{s({title:c(),variant:`error`})}finally{d(null)}}async function T(n){d(`reject`);try{let r=b.trim();(await o({curationId:e,...r?{comment:r}:{},relaunch:n})).ok?s({title:n?m():A(),variant:`success`}):s({title:R(),variant:`error`}),t()}catch{s({title:c(),variant:`error`})}finally{d(null)}}return(0,Q.jsx)(Ve,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Le,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Re,{children:r?O({name:r.name}):y()}),(0,Q.jsx)(Be,{children:be()})]}),r===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:R()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[Se({before:Z(r.beforeSize,S),after:Z(r.proposedSize,S)}),r.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),` `,ge()]}):null]}),C?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:L({added:C.added,removed:C.removed})}):null,r.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:P({feedback:r.feedback})}):null,C&&C.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:ae()}),(0,Q.jsx)(`ul`,{children:C.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:fe()}),(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:B()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:r.proposedContent})]})]})]}),f?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:F()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:I(),value:b,onChange:e=>x(e.target.value)}),(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`ghost`,onClick:()=>h(!1),disabled:l!==null,children:g()}),(0,Q.jsx)(K,{variant:`outline`,onClick:()=>void T(!1),disabled:l!==null,children:l===`reject`?j():me()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void T(!0),disabled:l!==null,children:l===`reject`?j():v()})]})]}):(0,Q.jsxs)(`div`,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(K,{variant:`outline`,onClick:()=>h(!0),disabled:l!==null||r==null,children:oe()}),(0,Q.jsx)(K,{variant:`default`,onClick:()=>void w(),disabled:l!==null||r==null,children:l===`approve`?j():U()})]})]})})}export{rt as AgentFilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$l as r,$v as i,Ay as a,Bv as o,Cy as s,D as c,Dy as l,Ey as u,Fy as d,GR as f,Gl as p,Gv as m,Hl as h,Hv as g,Jl as _,Jv as v,KR as y,Kl as b,Kv as x,Ll as S,Lv as C,My as ee,Ny as te,Oy as ne,Py as re,Ql as w,Qv as ie,Rv as T,Sy as ae,Ty as oe,UR as se,Ul as ce,Uv as le,Vl as ue,Vv as de,Wl as fe,Wv as pe,Xl as me,Xv as he,Yl as ge,Yv as _e,Zl as ve,Zv as E,_b as ye,_y as be,ay as xe,by as Se,cb as Ce,cy as we,db as Te,dr as Ee,dy as De,ey as Oe,fb as ke,fr as Ae,fy as D,gb as je,gr as Me,gy as Ne,hy as Pe,ib as Fe,iy as Ie,jy as Le,k as Re,ky as ze,lb as Be,lr as Ve,ly as He,mb as Ue,my as We,ny as Ge,oy as Ke,pb as qe,pr as Je,py as Ye,ql as Xe,qv as Ze,rb as Qe,ry as $e,sb as et,sy as tt,t as O,ty as nt,ub as rt,ur as it,uy as at,vy as ot,wy as st,xy as ct,yy as lt,zv as ut}from"./api-BASu8PYC.js";import{r as k}from"./dist-Bn5IE_M3.js";import{t as dt}from"./chevron-up-BiXGHpx6.js";import{t as ft}from"./chevrons-up-down-DHCh-E-T.js";import{i as pt,n as A,o as mt,r as ht,s as gt}from"./FieldLabel-YPTLow_x.js";import{i as _t,n as vt,r as yt,t as bt}from"./tabs-DkJ2Ivbq.js";import{t as xt}from"./button-_UzA03A_.js";import{$ as j,An as St,Bt as Ct,Dt as wt,Et as M,F as Tt,Fn as Et,Pn as Dt,Q as N,Rt as Ot,X as P,Z as F,at as kt,bn as At,ct as jt,et as I,jn as Mt,jt as L,lt as R,nt as Nt,on as z,ot as Pt,q as Ft,rn as B,rt as It,tt as Lt,ut as Rt,zt}from"./index-D02RwoOe.js";import{r as Bt}from"./locales-CPjguROj.js";import{a as V,i as H,n as Vt,o as U,r as W,t as Ht}from"./table-ChZTpaGw.js";import{t as Ut}from"./FilterBar-BQxNZSAj.js";import{a as Wt,n as Gt,o as Kt,r as qt,s as Jt,t as Yt}from"./compatView-DscksmHU.js";import{t as G}from"./dispatchErrorInfo-Cevbg9ej.js";var Xt=c(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),Zt=c(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=t(e(),1);function Qt(e){return e.filter(e=>e.state===`error`)}function $t(e){return e.reachable&&Qt(e.targets).length===0}function en(e){return $t(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function tn(e){return e.state===`error`&&e.lastErrorCode!==null}function nn(e){return!!e.lastDownstreamRejectCode}function q(e){return e.kind??`openclaw`}function rn(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function an(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 rn(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__`,on={q:``,state:Y,instance:Y,version:Y},X={connected:0,error:1,idle:2};function sn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function cn(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 ln(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`?t.lastOkAt===null:!1}function un(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 Kt(e,r)??Z(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return Z(t.targetLabel,n.targetLabel)}}function dn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=ln(t.key,e),a=ln(t.key,r);return i&&a?0:i?1:a?-1:n*un(t.key,e,r)})}function fn(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 pn(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 mn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Kt(e,t)??Z(e,t))}var Q=n();function hn({connections:e,displayByInstance:t}){let[n,r]=(0,K.useState)(on),[i,a]=(0,K.useState)(null),s=(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]),c=(0,K.useMemo)(()=>fn(s),[s]),l=(0,K.useMemo)(()=>pn(s),[s]),u=(0,K.useMemo)(()=>mn(s),[s]),d=(0,K.useMemo)(()=>dn(cn(s,n),i),[s,n,i]);function f(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:nt()}):(0,Q.jsxs)(`div`,{className:`oc-conn`,children:[(0,Q.jsxs)(Ut,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:ie(),onReset:()=>r(on),canReset:sn(n),children:[(0,Q.jsxs)(P,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(I,{placeholder:he()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(N,{value:Y,children:E()}),c.map(e=>(0,Q.jsx)(N,{value:e,children:_n(e)},e))]})]}),(0,Q.jsxs)(P,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-40`,children:(0,Q.jsx)(I,{placeholder:_e()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(N,{value:Y,children:E()}),l.map(e=>(0,Q.jsx)(N,{value:e.name,children:e.label},e.name))]})]}),(0,Q.jsxs)(P,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-36`,children:(0,Q.jsx)(I,{placeholder:v()})}),(0,Q.jsxs)(F,{children:[(0,Q.jsx)(N,{value:Y,children:E()}),u.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))]})]})]}),d.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Ze()}):(0,Q.jsxs)(Ht,{className:`oc-conn__table`,children:[(0,Q.jsx)(V,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)($,{label:x(),sortKey:`target`,sort:i,onSort:f}),(0,Q.jsx)($,{label:m(),sortKey:`state`,sort:i,onSort:f}),(0,Q.jsx)($,{label:pe(),sortKey:`instance`,sort:i,onSort:f}),(0,Q.jsx)($,{label:le(),sortKey:`host`,sort:i,onSort:f}),(0,Q.jsx)($,{label:g(),sortKey:`version`,sort:i,onSort:f}),(0,Q.jsx)(H,{children:de()}),(0,Q.jsx)($,{label:o(),sortKey:`lastOk`,sort:i,onSort:f})]})}),(0,Q.jsx)(Vt,{children:d.map(e=>(0,Q.jsx)(gn,{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)(dt,{size:13,"aria-hidden":!0}):(0,Q.jsx)(k,{size:13,"aria-hidden":!0}):(0,Q.jsx)(ft,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function gn({r:e}){let t=tn(e)?G(e.lastErrorCode):null,n=nn(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)(vn,{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:Oe({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:[i({label:n.label}),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${R(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function _n(e){return e===`connected`?ut():e===`error`?T():C()}function vn({state:e}){return e===`connected`?(0,Q.jsx)(M,{variant:`secondary`,children:ut()}):e===`error`?(0,Q.jsx)(M,{variant:`destructive`,children:T()}):(0,Q.jsx)(M,{variant:`outline`,children:C()})}function yn(){return y(O.bridgeHealth.getBridgeHealth,{})}function bn(){let e=yn(),t=y(O.compat.getBridgeCompat,{}),n=y(O.me.getMe,{host:Ft})?.role===`admin`,r=y(O.admin.listInstances,n?{}:`skip`),i=y(O.agents.usageForInstances,n?{}:`skip`),a=Dt(),o=()=>void a({to:`/settings/anomalies`,search:{status:`open`}}),s=an(e?e.targets:[],t?t.targets:[],r??[]),{section:c}=Et({from:`/settings/bridge`}),l=Dt({from:`/settings/bridge`}),u=t?.compat??null,d=t===void 0?`loading`:t===null?`nodata`:`ready`,f=u!==null&&Gt(u,`hermes`)&&!s.some(e=>e.key===`hermes`);return(0,Q.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Q.jsx)(xn,{health:e,compat:t,onSeeAnomalies:o}),(0,Q.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:ct()}),i&&i.length>0?(0,Q.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Q.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:Se()}),(0,Q.jsxs)(Ht,{children:[(0,Q.jsx)(V,{children:(0,Q.jsxs)(U,{children:[(0,Q.jsx)(H,{children:Je()}),(0,Q.jsx)(H,{children:Ae()}),(0,Q.jsx)(H,{children:Ee()}),(0,Q.jsx)(H,{children:it()}),(0,Q.jsx)(H,{children:Ve()})]})}),(0,Q.jsx)(Vt,{children:i.flatMap(e=>{let t=Tt(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)(M,{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,s.length>0?(0,Q.jsxs)(bt,{value:s.some(e=>e.key===c)?c:s[0]?.key??`openclaw`,onValueChange:e=>void l({search:{section:e},replace:!0}),children:[(0,Q.jsx)(yt,{className:`w-full`,children:s.map(e=>(0,Q.jsxs)(_t,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(z,{size:13,"aria-hidden":!0}),J(e.key)]},e.key))}),s.map(e=>(0,Q.jsx)(vt,{value:e.key,children:(0,Q.jsx)(Sn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:u,compatStatus:d,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,f?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}):null]})}function xn({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Q.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:Wt(t.bridgeVersion)}),i?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsxs)(`code`,{className:`oc-traces__mono`,title:ve(),children:[`(`,i,`)`]})]}):null,r?(0,Q.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,me({build:t.buildVersion??`?`})]}):null,` · `,ge(),` `,(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?_():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()});if(e===null)return(0,Q.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:De()});let o=Qt(e.targets),s=!e.reachable,c=en(e),l=e.unreachableInstances??[],u=c===`ok`?`ok`:c===`gateways_unreachable`?`warn`:`error`,d=jt(e.checkedAt),f=e.startedAt==null?null:jt(e.startedAt);return(0,Q.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${u}`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:c===`ok`?(0,Q.jsx)(St,{size:22}):s||c===`gateways_unreachable`?(0,Q.jsx)(Zt,{size:22}):(0,Q.jsx)(B,{size:22})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Q.jsx)(`div`,{className:`oc-bridge-card__title`,children:c===`ok`?at():c===`gateways_unreachable`?Ke({count:l.length}):s?He():we({count:o.length})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Q.jsxs)(`span`,{children:[(0,Q.jsx)(Xt,{size:12,"aria-hidden":!0}),` `,tt({time:d})]}),f?(0,Q.jsx)(`span`,{children:Ie({time:f})}):null,a]}),c===`gateways_unreachable`?(0,Q.jsx)(`p`,{className:`oc-bridge-card__hint`,children:xe({names:l.join(`, `)})}):null,s?(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:$e()})]})}function Sn({providerKey:e,connections:t,instances:n,manifest:i,compatStatus:a,compatReachable:o,protocol:s}){let c=i?Jt(i,e):null,l=new Map;for(let e of n)l.set(e.name,e.displayName??e.name);let u=[],d=new Set;for(let n of t){if(!n.instanceName||d.has(n.instanceName))continue;d.add(n.instanceName);let t=n.gatewayVersion??null;u.push({instanceName:n.instanceName,displayName:l.get(n.instanceName)??n.instanceName,version:t,state:Yt(t,e,i)})}let f=u.map(e=>e.state),p=f.includes(`beyond`)?`beyond`:f.length>0&&f.every(e=>e===`supported`)?`supported`:null,[m,h]=(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)(z,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Q.jsx)(`span`,{className:`oc-bridge-provider__name`,children:J(e)}),p?(0,Q.jsx)(M,{variant:p===`beyond`?`destructive`:`secondary`,children:qt(p)}):null]}),(0,Q.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:r()}),(0,Q.jsx)(wn,{providerName:J(e),support:c,compatStatus:a,compatReachable:o,manifest:i,instanceRows:u}),s?(0,Q.jsx)(Cn,{protocol:s}):null,(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":m,onClick:()=>h(e=>!e),children:[m?(0,Q.jsx)(k,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Mt,{size:13,"aria-hidden":!0}),Ge({count:t.length})]}),m?(0,Q.jsx)(hn,{connections:t,displayByInstance:l}):null]})}function Cn({protocol:e}){let[t,n]=(0,K.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[lt(),i.length>0?(0,Q.jsx)(M,{variant:`destructive`,children:be({count:i.length})}):a>0?(0,Q.jsx)(M,{variant:`destructive`,children:Ne()}):(0,Q.jsx)(M,{variant:`secondary`,children:ot()})]}),(0,Q.jsxs)(`p`,{className:`oc-admin__hint`,children:[Pe({version:e.vendoredVersion}),r?` · `+We({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Re({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Q.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Q.jsxs)(`li`,{children:[(0,Q.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Q.jsx)(k,{size:13,"aria-hidden":!0}):(0,Q.jsx)(Mt,{size:13,"aria-hidden":!0}),Ye({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 wn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:D()}):t===`nodata`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:w()}):(0,Q.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:Xe()}),r===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,Q.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Q.jsx)(`span`,{className:`oc-compat__label`,children:Me({provider:a})}),e&&e.range!==null?(0,Q.jsx)(`span`,{children:p({min:e.range.min,max:e.range.maxValidated})}):(0,Q.jsx)(`span`,{children:_()}),e?(0,Q.jsx)(On,{versions:e.validatedVersions}):null]}),i.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}):(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:Wt(e.version)}),(0,Q.jsx)(M,{variant:e.state===`supported`?`secondary`:e.state===`beyond`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function Tn({instance:e,onClose:t}){return(0,Q.jsx)(Lt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Q.jsxs)(Nt,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Q.jsxs)(kt,{children:[(0,Q.jsx)(Pt,{children:ye({instance:e.displayName??e.name})}),(0,Q.jsx)(It,{children:je()})]}),(0,Q.jsx)(Dn,{instance:e,onClose:t})]})})}function En({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)(St,{"aria-hidden":!0}):(0,Q.jsx)(B,{"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[e,` — `,t.ok?oe():t.detail]})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,st()]}):null}function Dn({instance:e,onClose:t}){let n=f(O.admin.upsertInstanceConfig),r=se(O.bridge.validateMediaPaths),i=wt(),o=Bt(e.config?.contentLocale,void 0),[c,p]=(0,K.useState)(()=>pt(e.config??{},o)),[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(null),b=c.inboundMediaMode===`shared-fs`,x=c.mediaMode===`shared-fs`,S=b||x;async function C(){_(!0),y(null);try{y(await r({instanceName:e.name,inboundMediaMode:c.inboundMediaMode,mediaMode:c.mediaMode}))}catch(e){i.error(ze(),e)}finally{_(!1)}}async function w(){h(!0);try{let r=e.config??{};await n({instanceId:e._id,config:ht(c,r,o)}),t()}catch(e){i.error(Be(),e)}finally{h(!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)(A,{label:Ue(),help:Ce()}),(0,Q.jsxs)(P,{value:c.mediaMode,onValueChange:e=>p({...c,mediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(F,{children:gt.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:qe(),help:et()}),(0,Q.jsxs)(P,{value:c.inboundMediaMode,onValueChange:e=>p({...c,inboundMediaMode:e}),children:[(0,Q.jsx)(j,{size:`sm`,className:`w-full`,children:(0,Q.jsx)(I,{})}),(0,Q.jsx)(F,{children:mt.map(e=>(0,Q.jsx)(N,{value:e,children:e},e))})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:ke(),help:Fe()}),(0,Q.jsx)(L,{type:`number`,min:1,max:4096,className:`w-full`,value:c.mediaMaxMb,onChange:e=>p({...c,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),S&&(0,Q.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[b&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:d(),help:re()}),(0,Q.jsx)(L,{className:`w-full`,spellCheck:!1,value:c.inboundAgentMount,onChange:e=>p({...c,inboundAgentMount:e.target.value})})]}),x&&(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(A,{label:te(),help:ee()}),(0,Q.jsx)(L,{className:`w-full`,spellCheck:!1,value:c.outboundAgentMount,onChange:e=>p({...c,outboundAgentMount:e.target.value})})]})]}),(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(Rt,{checked:c.rehydration,onCheckedChange:e=>p({...c,rehydration:e===!0})}),(0,Q.jsx)(A,{label:Te(),help:Qe()})]}),S&&v!==null&&(0,Q.jsx)(`div`,{className:`oc-bridge-config__check`,children:v.reachable?!v.inbound&&!v.outbound?(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(B,{"aria-hidden":!0}),ae({reason:v.reason??`?`})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(En,{label:l(),result:v.inbound}),(0,Q.jsx)(En,{label:u(),result:v.outbound}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ne()})]}):(0,Q.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Q.jsx)(B,{"aria-hidden":!0}),s()]})}),(0,Q.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[S&&(0,Q.jsxs)(xt,{variant:`outline`,size:`sm`,onClick:()=>void C(),disabled:g,children:[g?(0,Q.jsx)(At,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,g?a():Le()]}),(0,Q.jsx)(xt,{size:`sm`,onClick:()=>void w(),disabled:m,children:rt()})]})]})})}function On({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Q.jsxs)(Ot,{children:[(0,Q.jsx)(Ct,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?fe():ce({count:e.length}),(0,Q.jsx)(k,{size:13,"aria-hidden":!0})]})}),(0,Q.jsxs)(zt,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Q.jsx)(`p`,{className:`oc-compat__versions-title`,children:h()}),(0,Q.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Q.jsx)(M,{variant:`secondary`,children:e},e))})]})]})}export{bn as BridgeTab,Tn as InstanceConfigDialog};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$E as r,AD as i,BE as a,CD as o,DD as s,ED as c,FD as l,FE as u,GE as d,GR as f,HE as p,ID as m,IE as h,Ia as g,JE as _,KE as ee,KR as te,LE as ne,MD as re,ND as ie,OD as ae,PD as v,PE as y,QE as b,RE as x,Ra as S,SD as C,TD as w,UE as T,VE as E,WE as D,XE as O,YE as k,ZE as A,_D as j,aD as M,bD as N,cD as P,dD as F,eD as I,fD as L,gD as R,hD as z,iD as B,jD as V,kD as oe,lD as H,mD as U,nD as W,oD as G,pD as K,qE as q,rD as se,sD as ce,t as J,tD as le,uD as ue,vD as de,wD as fe,xD as pe,yD as me,zE as he}from"./api-BASu8PYC.js";import{t as ge}from"./button-_UzA03A_.js";import{U as _e,ct as Y}from"./index-D02RwoOe.js";import{t as ve}from"./DataTableShell-BbVvH8AP.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>m(),incorrect:()=>l(),incoherence:()=>v(),formatting:()=>ie(),latency:()=>re(),api_error:()=>V(),other:()=>i()},Q=e=>ye[e]?.()??e;function $({matches:e,sourceWasOpen:t}){return t?e===!0?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:ae()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:s()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:oe()})}function be({data:e,reference:t,closeReason:n}){let r=e.snapshot,i=f(J.feedback.respondToFeedback),[s,l]=(0,X.useState)(e.thread),[u,d]=(0,X.useState)(``),[p,m]=(0,X.useState)(!1);async function h(){let t=u.trim();if(!(!t||p)){m(!0);try{await i({feedbackId:e._id,text:t}),l(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),d(``)}finally{m(!1)}}}let g=[];try{g=r.contextJson?JSON.parse(r.contextJson):[]}catch{g=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:r.displayedMatchesStored,sourceWasOpen:r.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,r.messageRole,r.isRegeneration?` · ${c()}`:``,r.openclawModel?` · ${r.openclawModel}`:``,r.openclawRuntime?` (${r.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:I(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:w()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:e.comment})]}):null,n?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:a()}),(0,Z.jsx)(`p`,{className:`oc-fbadmin__comment`,children:n})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:fe()}),s.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:s.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`?o():e.authorRole===`agent`?e.authorLabel??S():C()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:pe()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:N(),value:u,maxLength:2e3,rows:3,onChange:e=>d(e.target.value.slice(0,2e3))}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,style:{justifyContent:`flex-end`},children:(0,Z.jsx)(ge,{size:`sm`,onClick:()=>void h(),disabled:!u.trim()||p,children:p?me():de()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:j()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.messageText||R()})]}),r.clientInfo?.sourceWasOpen&&r.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:z()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.displayedText||R()})]}):null,r.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:U()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:r.promptText})]}):null,g.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:K({count:r.contextCount??g.length,truncated:r.contextTruncated?L():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:g.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,r.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:F()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[r.outboxText??``,r.outboxStatus?`\n[status: ${r.outboxStatus}]`:``]})]}):null,r.clientInfo?.extensionsDetected&&r.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ue()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:r.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:H()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[r.clientInfo?.language,r.clientInfo?.timezone,r.clientInfo?.theme?P({theme:r.clientInfo.theme}):null,r.runId?`run ${r.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,r.clientInfo?.plugins&&r.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[ce(),` `,r.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,G()]})]}):null,r.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:r.clientInfo.userAgent}):null]})]})]})}function xe(){let e=te(J.feedback.listForAdmin,{}),t=f(J.feedback.readSnapshot),n=f(J.feedback.deleteFeedback),i=_e(),[a,o]=(0,X.useState)(null),[s,c]=(0,X.useState)({});async function l(e){if(a===e._id){o(null);return}if(!s[e._id]){let n=await t({feedbackId:e._id});c(t=>({...t,[e._id]:n}))}o(e._id)}async function m(e){await i({title:h(),description:u(),confirmLabel:y(),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:[M(),` `,(0,Z.jsx)(`strong`,{children:B()}),` `,se()]}),(0,Z.jsx)(ve,{title:W(),rows:e,emptyHint:le(),isExpanded:e=>a===e._id&&!!s[e._id],renderExpanded:e=>s[e._id]?(0,Z.jsx)(be,{data:s[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:r(),cell:e=>Y(e.at),sort:e=>e.at},{header:b(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:A(),cell:e=>e.messageRole===`user`?O():k(),sort:e=>e.messageRole},{header:_(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${q({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ee(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:d(),cell:e=>e.hasComment?`✎`:`—`,sort:e=>+!!e.hasComment},{header:D(),cell:e=>e.userClosedAt==null?e.resolvedAt==null?e.answered?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,children:T()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:p()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:g()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:E()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:a===e._id?he():x(),onSelect:()=>void l(e)},{label:ne(),onSelect:()=>void m(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$L as ee,AL as r,BL as i,CL as a,DL as te,EL as ne,FL as re,GL as o,GR as ie,HL as s,Ha as c,IL as l,JL as u,KL as d,KR as f,LL as p,LR as m,ML as ae,NL as oe,OL as se,PL as ce,QL as le,RL as ue,TL as de,UA as fe,UL as h,VL as g,Va as pe,WL as _,XL as me,YL as he,ZL as ge,eR as v,iR as _e,jL as y,kL as ve,nR as ye,qL as b,rR as x,t as S,tR as C,wL as w,zL as T,zR as E}from"./api-BASu8PYC.js";import{t as D}from"./button-_UzA03A_.js";import{$ as O,Ct as k,Dn as A,Dt as j,En as M,Et as N,Lt as P,Mt as be,Nt as xe,Pt as F,Q as I,St as Se,Tt as Ce,X as L,Z as R,bt as we,cn as Te,et as z,in as Ee,ut as De,vt as Oe,wt as ke,xt as Ae,yt as je}from"./index-D02RwoOe.js";import{a as Me,i as B,n as Ne,o as V,r as H,t as Pe}from"./table-ChZTpaGw.js";var U=t(e(),1),W=n(),G=`all`;function K(e){switch(e){case`image`:return b();case`audio`:return d();case`video`:return o();case`pdf`:return _();case`document`:return h();case`archive`:return s();default:return g()}}function q(){let[e,t]=(0,U.useState)(G),[n,o]=(0,U.useState)(G),[s,d]=(0,U.useState)(G),[h,g]=(0,U.useState)(G),[_,b]=(0,U.useState)(!1),[q,J]=(0,U.useState)(null),Fe=ie(S.files.softDelete),Y=j();function Ie(){t(G),o(G),d(G),g(G)}async function Le(){let e=q;if(J(null),e)try{await Fe({fileId:e.id}),Y.success(r())}catch(e){Y.error(ve(),e)}}let X=f(S.files.listMine,{direction:e===G?void 0:e,chatId:n===G?void 0:n,instanceName:s===G?void 0:s,category:h===G?void 0:h,includeAutoGenerated:_||void 0}),Re=(0,U.useMemo)(()=>new Intl.DateTimeFormat(E(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:m()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==G||n!==G||s!==G||h!==G;return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:_e()}),(0,W.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,W.jsxs)(L,{value:e,onValueChange:t,children:[(0,W.jsx)(O,{size:`sm`,"aria-label":x(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(I,{value:G,children:ye()}),(0,W.jsx)(I,{value:`inbound`,children:C()}),(0,W.jsx)(I,{value:`outbound`,children:v()})]})]}),(0,W.jsxs)(L,{value:n,onValueChange:o,children:[(0,W.jsx)(O,{size:`sm`,"aria-label":ee(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(I,{value:G,children:le()}),Q.chats.map(e=>(0,W.jsx)(I,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,W.jsxs)(L,{value:s,onValueChange:d,children:[(0,W.jsx)(O,{size:`sm`,"aria-label":ge(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(I,{value:G,children:me()}),Q.instances.map(e=>(0,W.jsx)(I,{value:e,children:e},e))]})]}):null,(0,W.jsxs)(L,{value:h,onValueChange:g,children:[(0,W.jsx)(O,{size:`sm`,"aria-label":he(),children:(0,W.jsx)(z,{})}),(0,W.jsxs)(R,{children:[(0,W.jsx)(I,{value:G,children:u()}),Q.categories.map(e=>(0,W.jsx)(I,{value:e,children:K(e)},e))]})]}),(0,W.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,W.jsx)(De,{checked:_,onCheckedChange:e=>b(e===!0),"aria-label":c()}),(0,W.jsx)(`span`,{children:c()})]}),$?(0,W.jsxs)(D,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,W.jsx)(Te,{size:14,"aria-hidden":!0}),oe()]}):null]}),Z.length===0?(0,W.jsx)(`p`,{className:`oc-admin__hint`,children:$?w():de()}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(Pe,{children:[(0,W.jsx)(Me,{children:(0,W.jsxs)(V,{children:[(0,W.jsx)(B,{children:i()}),(0,W.jsx)(B,{children:T()}),(0,W.jsx)(B,{children:ue()}),(0,W.jsx)(B,{children:p()}),(0,W.jsx)(B,{children:l()}),(0,W.jsx)(B,{className:`text-right`,children:re()})]})}),(0,W.jsx)(Ne,{children:Z.map(e=>(0,W.jsxs)(V,{children:[(0,W.jsxs)(H,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,W.jsx)(N,{variant:`outline`,style:{marginLeft:6},children:pe()}):null]}),(0,W.jsx)(H,{title:e.mimeType,children:K(e.category)}),(0,W.jsx)(H,{children:(0,W.jsx)(N,{variant:`secondary`,children:e.direction===`inbound`?C():v()})}),(0,W.jsx)(H,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,W.jsx)(H,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,W.jsx)(H,{className:`text-right`,children:(0,W.jsxs)(be,{children:[(0,W.jsx)(P,{asChild:!0,children:(0,W.jsx)(D,{variant:`ghost`,size:`icon`,"aria-label":ae(),children:(0,W.jsx)(M,{size:16})})}),(0,W.jsxs)(xe,{align:`end`,children:[e.url?(0,W.jsx)(F,{asChild:!0,children:(0,W.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(A,{size:14}),ce()]})}):(0,W.jsxs)(F,{disabled:!0,children:[(0,W.jsx)(A,{size:14}),ne()]}),(0,W.jsxs)(F,{variant:`destructive`,onSelect:()=>J({id:e._id,filename:e.filename}),children:[(0,W.jsx)(Ee,{size:14}),y()]})]})]})})]},e._id))})]}),ze?(0,W.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:a({cap:Be})}):null]}),(0,W.jsx)(Oe,{open:q!==null,onOpenChange:e=>!e&&J(null),children:(0,W.jsxs)(Ae,{children:[(0,W.jsxs)(ke,{children:[(0,W.jsx)(Ce,{children:se()}),(0,W.jsx)(Se,{children:te()})]}),(0,W.jsxs)(k,{children:[(0,W.jsx)(we,{children:fe()}),(0,W.jsx)(je,{onClick:()=>void Le(),children:y()})]})]})})]})}export{q as FilesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$d as r,Af as i,Bd as a,Bf as o,Cf as s,D as c,Df as l,Ef as u,Ff as d,GR as f,Gd as p,Gf as m,Hd as h,Hf as g,If as _,Jd as v,KR as y,Kd as b,Kf as x,Ld as S,Lf as C,Mf as ee,Nf as w,Of as te,Pf as ne,Qd as T,Rd as E,Rf as D,Sf as O,Tf as re,Ud as k,Uf as ie,Vd as A,Vf as j,Wd as M,Wf as ae,Xd as N,Yd as P,Zd as F,_f as I,af as oe,bf as se,cf as L,df as R,ef as z,ff as ce,gf as le,hf as ue,if as de,jf as fe,kf as pe,lf as me,mf as he,nf as ge,of as _e,pf as ve,qd as ye,rf as be,sf as xe,t as B,tf as Se,uf as Ce,vf as we,wf as Te,xf as Ee,yf as De,zd as Oe,zf as ke}from"./api-BASu8PYC.js";import{t as Ae}from"./x-C5QQoypN.js";import{i as V,n as H,r as je,t as Me}from"./tabs-DkJ2Ivbq.js";import{t as U}from"./button-_UzA03A_.js";import{$ as Ne,Dt as W,Et as G,Mn as Pe,Q as Fe,U as Ie,X as Le,Z as Re,_ as ze,an as K,at as Be,et as Ve,jn as He,jt as q,nt as Ue,on as J,ot as We,q as Ge,rt as Ke,tt as qe,ut as Y}from"./index-D02RwoOe.js";import{t as Je}from"./FilterBar-BQxNZSAj.js";import{t as Ye}from"./DataTableShell-BbVvH8AP.js";import{t as X}from"./DetailChips-CEPfBJ3C.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`}]]),Ze=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`}]]),Qe=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`}]]),Z=t(e(),1);function $e(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 et(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 tt(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 nt(e){switch(e){case`admin`:return ve();case`user`:return ce();case`pending`:return R();default:return e}}function rt(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 it(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 Q=n(),$={name:``,description:``};function at(){let e=y(B.groups.listGroups,{}),t=y(B.me.getMe,{host:Ge})?.role===`admin`,n=f(B.groups.createGroup),r=f(B.groups.updateGroup),s=f(B.groups.deleteGroup),c=Ie(),p=W(),[h,v]=(0,Z.useState)(!1),[b,S]=(0,Z.useState)(null),[T,E]=(0,Z.useState)($),[O,k]=(0,Z.useState)(null),[A,M]=(0,Z.useState)(``),N=(0,Z.useMemo)(()=>{if(!e)return e;let t=A.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,A]);function P(){S(null),E($),v(!0)}function F(e){S(e),E({name:e.name,description:e.description??``}),v(!0)}async function I(){try{b?await r({groupId:b._id,name:T.name,description:T.description}):await n({name:T.name,description:T.description||void 0}),E($),S(null),v(!1)}catch(e){p.error(a(),e)}}async function oe(e){if(await c({title:l({name:e.name}),description:u(),confirmWord:e.name,confirmLabel:re(),cancelLabel:w(),destructive:!0}))try{await s({groupId:e._id})}catch(e){p.error(Oe(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:m()}),(0,Q.jsx)(Je,{q:A,onQChange:M,onReset:()=>M(``),canReset:A!==``,searchPlaceholder:D()}),(0,Q.jsx)(Ye,{title:x(),rows:N,addLabel:ae(),onAdd:t?P:void 0,emptyHint:ie(),columns:[{header:g(),cell:e=>e.name,sort:e=>e.name},{header:j(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(Qe,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,Q.jsx)(Ze,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),sort:e=>e.memberCount},{header:o(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(J,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ke(),cell:e=>(0,Q.jsx)(X,{icon:(0,Q.jsx)(Xe,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,Q.jsx)(K,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:C(),onSelect:()=>k({groupId:e._id,name:e.name})},...t?[{label:_(),onSelect:()=>F(e)},{label:d(),variant:`destructive`,onSelect:()=>void oe(e)}]:[]]}),(0,Q.jsx)(ze,{open:h,onOpenChange:v,title:b?fe():ee(),description:i(),canSubmit:!!T.name.trim(),onSubmit:I,submitLabel:ne(),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:pe()}),(0,Q.jsx)(q,{value:T.name,onChange:e=>E({...T,name:e.target.value})})]}),(0,Q.jsxs)(`label`,{className:`oc-field`,children:[(0,Q.jsx)(`span`,{className:`oc-field__label`,children:te()}),(0,Q.jsx)(q,{value:T.description,onChange:e=>E({...T,description:e.target.value})})]})]})}),(0,Q.jsx)(ct,{groupId:O?.groupId??null,groupName:O?.name??``,open:O!==null,onOpenChange:e=>{e||k(null)}})]})}var ot=8;function st({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,Q.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,Q.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,Q.jsx)(Pe,{size:14,"aria-hidden":!0}),le()]}),(0,Q.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":he({page:e,pages:t}),children:[e,` / `,t]}),(0,Q.jsxs)(U,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[ue(),(0,Q.jsx)(He,{size:14,"aria-hidden":!0})]})]})}function ct({groupId:e,groupName:t,open:n,onOpenChange:i}){let a=y(B.groups.getGroup,n&&e?{groupId:e}:`skip`),o=y(B.groups.listAssignableInstances,n?{}:`skip`),c=y(B.groups.listAssignableUsers,n?{}:`skip`),l=f(B.groups.addMember),u=f(B.groups.removeMember),d=f(B.groups.bulkSetMembers),m=f(B.groups.setGroupManager),g=W(),[_,v]=(0,Z.useState)(``),[b,x]=(0,Z.useState)(``),[S,C]=(0,Z.useState)(`members`),[ee,w]=(0,Z.useState)(1),[te,ne]=(0,Z.useState)(new Set),T=(0,Z.useRef)(null),D=(0,Z.useMemo)(()=>new Set((a?.members??[]).map(e=>e.userId)),[a]),re=(0,Z.useMemo)(()=>new Set((a?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[a]),ie=a?.viewerIsAdmin===!0,A=(0,Z.useMemo)(()=>new Set((a?.agents??[]).map(e=>`${e.instanceName}/${e.agentId}`)),[a]);(0,Z.useEffect)(()=>{v(``),x(``),C(`members`),w(1),T.current=null},[n,e]),(0,Z.useEffect)(()=>{w(1)},[_]),(0,Z.useEffect)(()=>{n&&a&&e&&T.current!==e&&(T.current=e,ne(new Set((a.members??[]).map(e=>e.userId))))},[n,a,e]);let j=(0,Z.useMemo)(()=>c?$e(c,_,te):[],[c,_,te]);async function ae(t,n){if(e)try{n?await u({groupId:e,userId:t}):await l({groupId:e,userId:t})}catch(e){g.error(E(),e)}}async function N(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){g.error(h(),e)}}let P=rt(j,e=>D.has(e.userId)),F=j.filter(e=>D.has(e.userId)).length,R=it(j,ee,ot);async function z(){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){g.error(E(),e)}}return(0,Q.jsx)(qe,{open:n,onOpenChange:i,children:(0,Q.jsxs)(Ue,{className:`oc-access`,children:[(0,Q.jsxs)(Be,{children:[(0,Q.jsx)(We,{children:Te({name:t})}),(0,Q.jsx)(Ke,{children:s()})]}),(0,Q.jsxs)(Me,{value:S,onValueChange:C,className:`oc-access__tabs`,children:[(0,Q.jsxs)(je,{className:`w-full`,children:[(0,Q.jsxs)(V,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Qe,{size:13,"aria-hidden":!0}),O(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:D.size}):null]}),(0,Q.jsxs)(V,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),se(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:A.size}):null]}),(0,Q.jsxs)(V,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Xe,{size:13,"aria-hidden":!0}),r(),a?(0,Q.jsx)(G,{variant:`secondary`,className:`oc-access__tabcount`,children:a.chartCount}):null]})]}),(0,Q.jsx)(H,{value:`members`,children:c===void 0||a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:_e()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:_,onChange:e=>v(e.target.value),placeholder:Ee(),className:`oc-access__search`}),j.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:we()}):(0,Q.jsxs)(Q.Fragment,{children:[j.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(Y,{checked:P===`all`?!0:P===`some`?`indeterminate`:!1,onCheckedChange:()=>void z(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()}),(0,Q.jsxs)(G,{variant:`outline`,className:`oc-access__count`,children:[F,` / `,j.length]})]}):null,(0,Q.jsx)(`div`,{className:`oc-access__list`,children:R.pageItems.map(e=>{let t=D.has(e.userId),n=tt(e),r=re.has(e.userId);return(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(Y,{checked:t,onCheckedChange:()=>void ae(e.userId,t),"aria-label":Ce({user:n.primary})}),(0,Q.jsxs)(`span`,{className:`oc-access__who`,children:[(0,Q.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,Q.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__role`,children:nt(e.role)}),(0,Q.jsx)(`span`,{className:`oc-access__mgrslot`,children:t&&ie?(0,Q.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?k():M(),title:r?k():M(),onClick:()=>void N(e.userId,r),children:(0,Q.jsx)(Ze,{size:15,"aria-hidden":!0})}):t&&r?(0,Q.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":p(),title:p(),children:(0,Q.jsx)(Ze,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,Q.jsx)(st,{page:R.page,pageCount:R.pageCount,onPage:w})]})]})}),(0,Q.jsx)(H,{value:`agents`,children:o===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()}):o.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:oe()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(q,{value:b,onChange:e=>x(e.target.value),placeholder:De(),className:`oc-access__search`}),(0,Q.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,Q.jsx)(lt,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:A,query:b},`${e}-${t._id}`))})]})}),(0,Q.jsx)(H,{value:`charts`,children:(0,Q.jsx)(ut,{groupId:e})})]})]})})}function lt({groupId:e,instanceName:t,kind:n,assigned:r,query:i}){let a=y(B.groups.listAssignableAgents,{instanceName:t}),o=f(B.groups.assignAgentToGroup),s=f(B.groups.removeAgentFromGroup),c=f(B.groups.bulkSetGroupAgents),l=W(),[u,d]=(0,Z.useState)(1);if((0,Z.useEffect)(()=>{d(1)},[i]),!e)return null;let p=et(a?.agents??[],i),m=a?.discovery&&!a.discovery.lastPollOk;if(i.trim()&&p.length===0)return null;let h=p.filter(e=>e.presentInLastOk!==!1&&e.enabled!==!1),g=rt(h,e=>r.has(`${t}/${e.agentId}`)),_=it(p,u,ot);async function v(n,r){try{r?await s({groupId:e,instanceName:t,agentId:n}):await o({groupId:e,instanceName:t,agentId:n})}catch(e){l.error(S(),e)}}async function b(){if(h.length===0)return;let n=h.map(e=>e.agentId);try{await c({groupId:e,instanceName:t,agentIds:n,assigned:g!==`all`})}catch(e){l.error(S(),e)}}return(0,Q.jsxs)(`div`,{className:`oc-access__group`,children:[(0,Q.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,Q.jsx)(J,{size:13,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__kind`,children:n}),m?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__stale`,children:ge()}):null]}),a===void 0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:xe()}):p.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:m?be():de()}):(0,Q.jsxs)(Q.Fragment,{children:[h.length>1?(0,Q.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,Q.jsx)(Y,{checked:g===`all`?!0:g===`some`?`indeterminate`:!1,onCheckedChange:()=>void b(),"aria-label":I()}),(0,Q.jsx)(`span`,{className:`oc-access__label`,children:I()})]}):null,_.pageItems.map(e=>{let n=`${t}/${e.agentId}`,i=r.has(n),a=e.presentInLastOk===!1,o=!e.enabled;return(0,Q.jsxs)(`div`,{className:`oc-access__row${o?` is-disabled`:``}`,children:[(0,Q.jsx)(Y,{checked:i,disabled:(a||o)&&!i,onCheckedChange:()=>void v(e.agentId,i),"aria-label":me({name:e.displayName??e.agentId})}),(0,Q.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,Q.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,e.isDefaultOnInstance?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":z(),title:z(),children:(0,Q.jsx)(K,{size:14,fill:`currentColor`})}):null,a?(0,Q.jsx)(G,{variant:`outline`,className:`oc-access__gone`,children:Se()}):null]},e.agentId)}),(0,Q.jsx)(st,{page:_.page,pageCount:_.pageCount,onPage:d})]})]})}function ut({groupId:e}){let t=y(B.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=f(B.charts.assignChartToGroup),r=f(B.charts.removeChartFromGroup),i=f(B.charts.setGroupDefaultChart),a=f(B.charts.addChartToGroupPool),o=f(B.charts.removeChartFromGroupPool),s=W();if(!e)return null;if(t===void 0)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:L()});let{pool:c,addable:l,canManagePool:u}=t;if(c.length===0&&!u)return(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:T()});async function d(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){s.error(A(),e)}}async function p(t){try{await i({groupId:e,chartKey:t})}catch(e){s.error(A(),e)}}async function m(t){try{await a({groupId:e,chartKey:t})}catch(e){s.error(A(),e)}}async function h(t){try{await o({groupId:e,chartKey:t})}catch(e){s.error(A(),e)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`oc-access__list`,children:c.map(e=>(0,Q.jsxs)(`div`,{className:`oc-access__row`,children:[(0,Q.jsx)(Y,{checked:e.selected,onCheckedChange:()=>void d(e.chartKey,e.selected),"aria-label":v({name:e.name})}),(0,Q.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,Q.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":ye(),title:ye(),children:(0,Q.jsx)(K,{size:14,fill:`currentColor`})}):(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:b()}):null,u?(0,Q.jsx)(U,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":P({name:e.name}),title:P({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,Q.jsx)(Ae,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),u?l.length>0?(0,Q.jsxs)(Le,{value:``,onValueChange:e=>void m(e),children:[(0,Q.jsx)(Ne,{size:`sm`,className:`oc-access__search`,children:(0,Q.jsx)(Ve,{placeholder:N()})}),(0,Q.jsx)(Re,{children:l.map(e=>(0,Q.jsx)(Fe,{value:e.chartKey,children:e.name},e.chartKey))})]}):c.length===0?(0,Q.jsx)(`p`,{className:`oc-access__hint`,children:F()}):null:null]})}export{at as GroupsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$T as r,$w as i,AT as a,Aw as o,BT as s,CT as c,Cw as l,DT as u,Dw as d,ET as f,Ew as p,FT as m,Fw as h,GR as g,GT as _,Gj as v,Gw as y,HT as b,Hw as x,IT as ee,Iw as S,JT as te,Jo as C,Jw as w,KR as T,KT as E,Kw as D,LT as ne,Lw as re,MT as ie,Mw as ae,NT as oe,Nw as se,OT as ce,Ow as le,PT as ue,Pw as de,QT as fe,Qw as pe,RT as me,Rw as he,ST as ge,Sw as _e,TT as ve,Tw as ye,UR as O,UT as be,Uw as xe,VT as Se,Vw as k,WT as Ce,Wj as we,Ww as Te,XT as Ee,Xo as De,Xw as Oe,YT as ke,Yo as Ae,Yw as je,ZT as Me,Zw as Ne,_T as Pe,_w as Fe,aE as Ie,aT as Le,ab as Re,bT as ze,br as Be,bw as Ve,cT as He,dT as Ue,eE as We,eT as Ge,fT as A,gT as j,hT as Ke,iE as qe,iT as Je,jT as Ye,jw as Xe,kT as Ze,kw as Qe,lT as $e,mT as et,nE as tt,nT as nt,oE as rt,oT as it,ob as at,pT as ot,qT as st,qo as ct,qw as lt,rE as ut,rT as dt,sT as ft,t as M,tE as pt,tT as mt,uT as ht,vT as gt,vr as _t,vw as N,wT as vt,ww as yt,xT as bt,xw as xt,yT as St,yr as Ct,yw as wt,zT as Tt,zw as Et}from"./api-BASu8PYC.js";import{a as Dt,c as Ot}from"./FieldLabel-YPTLow_x.js";import{t as P}from"./button-_UzA03A_.js";import{$ as F,Bt as kt,Dt as I,Et as L,Q as R,Rt as At,U as jt,X as z,Z as B,_ as Mt,at as V,et as H,jt as U,nt as W,ot as G,rt as K,tt as q,ut as J,zt as Nt}from"./index-D02RwoOe.js";import{t as Pt}from"./DataTableShell-BbVvH8AP.js";import{InstanceConfigDialog as Ft}from"./BridgeTab-DeYPFNVq.js";var Y=t(e(),1),X=[`conversational`,`documentary`,`summarizer`,`curator`],It=new Set(X),Lt=`conversational`;function Rt(e){let t=new Set((e??[]).filter(e=>It.has(e)));return t.size===0?[Lt]:X.filter(e=>t.has(e))}var Z=n(),Q={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,streamTransport:Dt},zt={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Bt(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 Vt(){let e=T(M.admin.listInstances,{}),t=T(M.agents.listAllInstanceAgents,{}),n=g(M.admin.upsertInstance),i=g(M.admin.deleteInstance),o=I(),[c,l]=(0,Y.useState)(!1),[u,d]=(0,Y.useState)(Q),[f,p]=(0,Y.useState)(null),[h,v]=(0,Y.useState)(null),[y,x]=(0,Y.useState)(null),[S,C]=(0,Y.useState)(null);async function w(){try{await n({instanceId:S??void 0,name:u.name,gatewayUrl:u.gatewayUrl,bridgeUrl:u.bridgeUrl||void 0,displayName:u.displayName||void 0,kind:u.kind,transport:u.kind===`hermes`?u.transport:void 0,gatewayVersion:u.gatewayVersion||void 0,gatewayHttpUrl:u.gatewayHttpUrl||void 0,streamTransport:u.streamTransport}),d(Q),C(null),l(!1)}catch(e){o.error(qe(),e)}}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[ut(),(0,Z.jsx)(`strong`,{children:tt()}),pt()]}),(0,Z.jsx)(Pt,{title:We(),rows:e,addLabel:r(),onAdd:()=>{C(null),d(Q),l(!0)},emptyHint:fe(),columns:[{header:Me(),cell:e=>e.name,sort:e=>e.name},{header:Ee(),cell:e=>(0,Z.jsx)(L,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:ke(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:te(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:rt(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,Z.jsxs)(L,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?N():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:Ce(),onSelect:()=>{C(e._id),d(Bt(e)),l(!0)}},{label:Ie(),onSelect:()=>p(e.name)},{label:Ze(),onSelect:()=>x(e)},{label:st(),onSelect:()=>v(e)},{label:E(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:E(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,Z.jsx)(Mt,{open:c,onOpenChange:l,title:S?be():_(),description:Se(),canSubmit:!!(u.name&&u.gatewayUrl),onSubmit:w,submitLabel:s(),children:(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsxs)($,{label:Tt(),children:[(0,Z.jsx)(U,{value:u.name,disabled:S!==null,onChange:e=>d({...u,name:e.target.value})}),S?(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:b()}):null]}),(0,Z.jsx)($,{label:me(),children:(0,Z.jsxs)(z,{value:u.kind,onValueChange:e=>d({...u,kind:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`openclaw`,children:`OpenClaw`}),(0,Z.jsx)(R,{value:`hermes`,children:`Hermes`})]})]})}),u.kind===`hermes`?(0,Z.jsx)($,{label:Be(),children:(0,Z.jsxs)(z,{value:u.transport,onValueChange:e=>d({...u,transport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-56`,children:(0,Z.jsx)(H,{})}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{value:`ws`,children:Ct()}),(0,Z.jsx)(R,{value:`rest`,children:_t()})]})]})}):null,(0,Z.jsx)($,{label:ne(),children:(0,Z.jsx)(U,{value:u.gatewayUrl,onChange:e=>d({...u,gatewayUrl:e.target.value})})}),(0,Z.jsx)($,{label:ee(),children:(0,Z.jsx)(U,{value:u.bridgeUrl,placeholder:m(),onChange:e=>d({...u,bridgeUrl:e.target.value})})}),(0,Z.jsx)($,{label:ue(),children:(0,Z.jsx)(U,{value:u.displayName,onChange:e=>d({...u,displayName:e.target.value})})}),(0,Z.jsxs)($,{label:at(),children:[(0,Z.jsxs)(z,{value:u.streamTransport,onValueChange:e=>d({...u,streamTransport:e}),children:[(0,Z.jsx)(F,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(H,{})}),(0,Z.jsx)(B,{children:Ot.map(e=>(0,Z.jsx)(R,{value:e,children:e},e))})]}),(0,Z.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Re()})]}),(0,Z.jsx)($,{label:oe(),children:(0,Z.jsx)(U,{value:u.gatewayVersion,placeholder:ie(),onChange:e=>d({...u,gatewayVersion:e.target.value})})}),(0,Z.jsx)($,{label:Ye(),children:(0,Z.jsx)(U,{value:u.gatewayHttpUrl,placeholder:a(),onChange:e=>d({...u,gatewayHttpUrl:e.target.value})})})]})}),(0,Z.jsx)(Zt,{instanceName:f,open:f!==null,onOpenChange:e=>{e||p(null)}}),h?(0,Z.jsx)(Ft,{instance:h,onClose:()=>v(null)},h._id):null,y?(0,Z.jsx)(Ht,{instance:y,onClose:()=>x(null)},y._id):null]})}function Ht({instance:e,onClose:t}){let n=T(M.instanceSecrets.listInstanceSecretStatus,{}),r=zt[e.kind??`openclaw`],i=(0,Y.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,Z.jsx)(q,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(W,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:ce({instance:e.displayName??e.name})}),(0,Z.jsx)(K,{children:u()})]}),(0,Z.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,Z.jsx)(Gt,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,Z.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,Z.jsx)(Wt,{instance:e})}),(0,Z.jsx)(Ut,{instance:e})]})})}function Ut({instance:e}){let t=O(M.instanceSync.forceInstanceSync),n=I(),[r,a]=(0,Y.useState)(!1);async function o(){if(!r){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ft());break;case`no_agents`:n.success(Le());break;case`no_bridge_url`:n.error(Je());break;case`deploy_misconfigured`:n.error(dt());break;case`unauthorized`:n.error(mt());break;case`not_served`:n.error(Ge());break;default:n.error(nt());break}}catch(e){n.error(it(),e)}finally{a(!1)}}}return(0,Z.jsxs)(`div`,{className:`oc-form`,children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:i()}),(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:r,children:r?He():$e()})})]})}function Wt({instance:e}){let t=T(M.bridgeAuth.listBridgeAuthStatus,{}),n=O(M.bridgeAuth.mintBridgeSecret),r=g(M.bridgeAuth.revokeBridgeSecret),i=I(),[a,o]=(0,Y.useState)(!1),[s,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){o(!0);try{l((await n({instanceId:e._id})).plaintext),d(!1)}catch(e){i.error(D(),e)}finally{o(!1)}}}async function h(){if(!a){o(!0);try{await r({instanceId:e._id}),l(null),i.success(lt())}catch(e){i.error(D(),e)}finally{o(!1)}}}async function _(){if(s)try{await navigator.clipboard.writeText(s),d(!0)}catch{}}return(0,Z.jsxs)($,{label:pe(),children:[(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ne()}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:p?`outline`:`secondary`,children:p?`${c()} · ${f.prefix}…${f.lastFour}`:ge()}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(P,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?je():Oe()}),p?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:w()}):null]})]}),s?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`oc-sa__minted-warning`,children:y()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:s}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void _(),children:u?v():we()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:Te()})]}):null]})}function Gt({instanceId:e,field:t,updatedAt:n}){let r=O(M.instanceSecrets.setInstanceSecret),i=g(M.instanceSecrets.clearInstanceSecret),a=O(M.deviceIdentity.generateDeviceIdentity),o=I(),[s,l]=(0,Y.useState)(``),[u,d]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(!1),y=n!==null,b=t===`deviceIdentity`,x=t===`token`?f():t===`deviceIdentity`?ve():vt();async function ee(){if(!(!s.trim()||u)){d(!0);try{await r({instanceId:e,field:t,plaintext:s}),l(``),m(null),_(!1),o.success(Pe())}catch(e){o.error(j(),e)}finally{d(!1)}}}async function S(){if(!u){d(!0);try{await i({instanceId:e,field:t}),m(null),_(!1),o.success(Ke())}catch(e){o.error(j(),e)}finally{d(!1)}}}async function te(){if(!u){d(!0);try{m(await a({instanceId:e})),_(!1),o.success(A())}catch(e){o.error(ht(),e)}finally{d(!1)}}}let C=p?`openclaw devices approve ${p.id}`:``;async function w(){if(C)try{await navigator.clipboard.writeText(C),_(!0)}catch{}}return(0,Z.jsxs)($,{label:x,children:[b?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(L,{variant:y?`outline`:`secondary`,children:y?c():ge()}),(0,Z.jsx)(U,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:y?ze():bt(),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 ee(),disabled:u||s.trim().length===0,children:St()}),b?(0,Z.jsx)(P,{size:`sm`,variant:`outline`,onClick:()=>void te(),disabled:u,children:et()}):null,y?(0,Z.jsx)(P,{size:`sm`,variant:`destructive`,onClick:()=>void S(),disabled:u,children:gt()}):null]})]}),p?(0,Z.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium`,children:A()}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ue()}),(0,Z.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,Z.jsx)(`code`,{className:`oc-sa__minted-plain`,children:C}),(0,Z.jsx)(P,{variant:`outline`,size:`sm`,onClick:()=>void w(),children:h?v():we()})]}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,onClick:()=>{m(null),_(!1)},children:Te()})]}):null]})}var Kt={conversational:se,documentary:Xe,summarizer:De,curator:C},qt={conversational:ae,documentary:o,summarizer:Ae,curator:ct},Jt=e=>(Kt[e]??(()=>e))(),Yt=e=>(qt[e]??(()=>``))();function Xt({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:re()}),t.map(e=>(0,Z.jsx)(L,{variant:`secondary`,className:`oc-agenttype__chip`,title:Yt(e),children:Jt(e)},e)),(0,Z.jsxs)(At,{children:[(0,Z.jsx)(kt,{asChild:!0,children:(0,Z.jsx)(P,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:S()})}),(0,Z.jsxs)(Nt,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:h()}),(0,Z.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:de()}),(0,Z.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:X.map(r=>{let i=`agtype-${e}-${r}`;return(0,Z.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,Z.jsx)(J,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,Z.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Jt(r)}),(0,Z.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Yt(r)})]})]},r)})})]})]})]})}function Zt({instanceName:e,open:t,onOpenChange:n}){let r=T(M.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=g(M.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=g(M.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=g(M.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Rt(r);e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=g(M.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(M.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(M.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=g(M.agents.removeInstanceAgent),u=jt(),f=I();async function m(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(k(),e)}}async function h(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){f.error(k(),e)}}async function _(t,n,r){if(!e)return;let i=r.includes(n)?r.filter(e=>e!==n):[...r,n];try{await o({instanceName:e,agentId:t,types:i})}catch(e){f.error(k(),e)}}async function v(t,n){if(e&&await u({title:d({name:n}),description:p(),confirmLabel:ye(),destructive:!0}))try{await c({instanceName:e,agentId:t}),f.success(yt())}catch(e){f.error(k(),e)}}return(0,Z.jsx)(q,{open:t,onOpenChange:n,children:(0,Z.jsxs)(W,{className:`oc-access`,children:[(0,Z.jsxs)(V,{children:[(0,Z.jsx)(G,{children:xe({name:e??``})}),(0,Z.jsx)(K,{children:x()})]}),r===void 0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:l()}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?_e():r.discovery.lastPollOk?xt():Ve({error:r.discovery.error??`?`})}),r.agents.length===0?(0,Z.jsx)(`p`,{className:`oc-access__hint`,children:wt()}):(0,Z.jsx)(`div`,{className:`oc-access__list`,children:r.agents.map(t=>{let n=t.presentInLastOk===!1,i=r.defaultAgentId===t.agentId,a=t.displayName??t.agentId,o=t.types??[];return(0,Z.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,Z.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,Z.jsx)(J,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void m(t.agentId,e===!0)}),(0,Z.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,Z.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(L,{variant:`outline`,className:`oc-access__gone`,children:Fe()}),(0,Z.jsx)(P,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(t.agentId,a),children:le()})]}):i?(0,Z.jsx)(L,{variant:`default`,children:N()}):(0,Z.jsx)(P,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled,onClick:()=>void h(t.agentId),children:Qe()})]}),t.enabled?(0,Z.jsx)(Xt,{agentId:t.agentId,types:o,onToggle:e=>void _(t.agentId,e,o)}):null,t.enabled?(0,Z.jsx)(Qt,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){f.error(k(),e)}}}):null]},t.agentId)})})]})]})})}function Qt({value:e,onSave:t}){let[n,r]=(0,Y.useState)(e);(0,Y.useEffect)(()=>{r(e)},[e]);let i=()=>{n.trim()!==e.trim()&&t(n)};return(0,Z.jsx)(U,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:Et(),"aria-label":he(),onChange:e=>r(e.target.value),onBlur:i,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),i())}})}function $({label:e,children:t}){return(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Vt as InstancesTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AN as r,BN as i,BT as a,CN as o,CR as s,Ct as c,DN as l,DR as u,EN as d,ER as f,FN as p,GR as m,HN as h,IN as g,KR as _,LN as v,LR as ee,Lt as te,MN as ne,MR as re,Mt as ie,NN as ae,ON as oe,OR as se,PN as ce,RN as le,Rt as ue,SN as de,SR as fe,St as pe,TN as me,TR as he,VN as ge,_N as y,_R as b,_t as x,aN as S,bN as C,bR as w,bt as T,cN as E,cR as D,dN as O,dR as k,fN as A,fR as j,gN as M,gR as N,hN as P,hR as F,iN as I,jN as L,kN as _e,kR as ve,lN as ye,lR as be,mN as xe,mR as Se,oN as Ce,oR as we,pN as Te,pR as Ee,r as R,rN as De,sN as Oe,sR as ke,t as z,uN as B,uR as Ae,vN as je,vR as Me,vt as Ne,wN as Pe,wR as Fe,wt as Ie,xN as Le,xR as Re,xt as ze,yN as Be,yR as Ve,yt as He,zN as Ue}from"./api-BASu8PYC.js";import{t as V}from"./button-_UzA03A_.js";import{$ as We,At as Ge,Dt as Ke,Et as H,Ot as qe,Q as U,V as Je,X as Ye,Z as Xe,et as Ze,jt as W,kt as Qe,q as G,t as $e,ut as K}from"./index-D02RwoOe.js";import{t as et}from"./localePickerView-C2RmOS86.js";import{t as tt}from"./TimezoneCombobox-673xwoei.js";var q=t(e(),1),J=n();function nt({className:e,checked:t,onCheckedChange:n,disabled:r,...i}){return(0,J.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":t,"data-state":t?`checked`:`unchecked`,disabled:r,onClick:()=>n(!t),className:R(`peer inline-flex h-5 w-9 shrink-0 items-center rounded-full border border-transparent transition-colors outline-none`,`focus-visible:ring-2 focus-visible:ring-ring/50`,`disabled:cursor-not-allowed disabled:opacity-50`,t?`bg-primary`:`bg-input`,e),...i,children:(0,J.jsx)(`span`,{className:R(`pointer-events-none block size-4 rounded-full bg-background shadow transition-transform`,t?`translate-x-[18px]`:`translate-x-[2px]`)})})}var Y=[{id:`messages`,label:()=>h()},{id:`composer`,label:()=>ge()},{id:`sidebar`,label:()=>i()},{id:`notifications`,label:()=>o()},{id:`other`,label:()=>Ue()}],X={showSource:{category:`messages`,label:()=>le(),help:()=>v()},showReport:{category:`messages`,label:()=>g(),help:()=>p()},copyAssistant:{category:`messages`,label:()=>ce()},copyUser:{category:`messages`,label:()=>ae()},showDelete:{category:`messages`,label:()=>ne()},showTools:{category:`messages`,label:()=>L(),help:()=>r()},voiceInput:{category:`composer`,label:()=>_e(),help:()=>oe()},showUsage:{category:`composer`,label:()=>l(),help:()=>d()},autoReadAloud:{category:`composer`,label:()=>ue(),help:()=>te()},showChatAge:{category:`sidebar`,label:()=>me(),help:()=>Pe()},notifSound:{category:`notifications`,label:()=>de(),help:()=>Le()},notifSystem:{category:`notifications`,label:()=>C(),help:()=>Be()},replySound:{category:`notifications`,label:()=>je(),help:()=>y()}};function Z(e){return e.toLowerCase().normalize(`NFD`).replace(/\p{Diacritic}/gu,``)}function Q(e,t){let n=Z(t.trim()),r=new Map(Y.map(e=>[e.id,e.label()])),i=new Map(Y.map(e=>[e.id,[]]));for(let t of e){let e=X[t],a=e?.category??`other`;n&&!Z(`${e?e.label():t} ${e?.help?e.help():``} ${t} ${r.get(a)??``}`).includes(n)||i.get(a).push(t)}return Y.map(e=>({id:e.id,label:r.get(e.id),keys:i.get(e.id)})).filter(e=>e.keys.length>0)}var rt=[`showSource`,`showReport`,`copyAssistant`,`copyUser`,`showDelete`,`showTools`,`voiceInput`,`showChatAge`,`showUsage`,`autoReadAloud`,`notifSound`,`notifSystem`,`replySound`],it={voiceInput:`voiceInput`};function at(e){return rt.includes(e)}function $(e){return e===`admin`}function ot(e){return e===!0?`on`:e===!1?`off`:`inherit`}function st(e){return e===`on`?!0:e===`off`?!1:null}function ct(e){return at(e)?it[e]:void 0}var lt={voiceInput:()=>Oe()};function ut({prefKey:e,ui:t}){let n=m(z.admin.setUiPrefDefault),r=m(z.admin.setFeatureEnabled),i=ct(e),a=i?lt[e]?.():void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__gov`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__gov-row`,children:[(0,J.jsx)(`span`,{className:`oc-prefs__gov-label`,children:O()}),(0,J.jsxs)(Ye,{value:ot(t.defaults[e]),onValueChange:t=>void n({key:e,value:st(t)}),children:[(0,J.jsx)(We,{size:`sm`,className:`w-36`,children:(0,J.jsx)(Ze,{})}),(0,J.jsxs)(Xe,{children:[(0,J.jsx)(U,{value:`on`,children:S()}),(0,J.jsx)(U,{value:`off`,children:I()}),(0,J.jsx)(U,{value:`inherit`,children:De()})]})]}),i?(0,J.jsxs)(`span`,{className:`oc-prefs__gov-gate`,children:[(0,J.jsx)(K,{checked:t.featuresEnabled[i]===!0,onCheckedChange:e=>void r({key:i,enabled:e===!0}),"aria-label":B()}),B()]}):null]}),a?(0,J.jsx)(`span`,{className:`oc-prefs__gov-help`,children:a}):null]})}function dt({current:e,enabled:t}){let n=m(z.me.setDictationShortcut),[r,i]=(0,q.useState)(!1),[a,o]=(0,q.useState)(!1);return(0,q.useEffect)(()=>{if(!r)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){i(!1);return}let t=Qe(e);if(t===null){[`Shift`,`Control`,`Meta`,`Alt`].includes(e.key)||(o(!0),window.setTimeout(()=>o(!1),1800));return}i(!1),n({shortcut:t})};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[r,n]),(0,J.jsxs)(`div`,{className:`oc-prefs__row${t?``:` is-locked`}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[Ie(),e?(0,J.jsx)(H,{variant:`secondary`,children:Ge(e,qe())}):null]}),(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:a?ze():r?pe():c()})]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[e&&!r?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void n({shortcut:null}),children:x()}):null,(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,disabled:!t,"aria-pressed":r,onClick:()=>i(e=>!e),children:r?Ne():e?He():T()})]})]})}function ft(){let[e,t]=(0,q.useState)(``),[n,r]=(0,q.useState)(!1),i=_(z.me.getMe,{host:G}),a=i?.ui,o=$(i?.role)&&n,s=m(z.me.setUiPref).withOptimisticUpdate(Je),c=(0,q.useMemo)(()=>a?Q(Object.keys(a.effective),e):[],[a,e]);return a?(0,J.jsxs)(`div`,{className:`oc-prefs-panel`,children:[$(i?.role)?(0,J.jsxs)(`label`,{className:`oc-prefs__gov-toggle`,children:[(0,J.jsx)(K,{checked:n,onCheckedChange:e=>r(e===!0),"aria-label":A()}),A()]}):null,o?(0,J.jsxs)(`div`,{className:`oc-prefs__gov-head`,children:[(0,J.jsx)(`p`,{children:ye()}),(0,J.jsx)(`p`,{children:E()}),(0,J.jsx)(`p`,{children:Ce()})]}):null,(0,J.jsx)(W,{value:e,onChange:e=>t(e.target.value),placeholder:M(),"aria-label":M(),className:`mb-2`}),c.length===0?(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:P()}):(0,J.jsx)(`div`,{className:`oc-prefs`,children:c.map(e=>(0,J.jsxs)(`section`,{className:`oc-prefs__card`,children:[(0,J.jsx)(`h4`,{className:`oc-prefs__cat`,children:e.label}),e.keys.map(e=>{let t=X[e],n=t?t.label():e,r=t?.help?.(),i=a.locked[e],c=a.effective[e],l=a.userOverrides[e]!==void 0;return(0,J.jsxs)(`div`,{className:`oc-prefs__row${i?` is-locked`:``}`,children:[(0,J.jsxs)(`div`,{className:`oc-prefs__info`,children:[(0,J.jsxs)(`span`,{className:`oc-prefs__label`,children:[n,i?(0,J.jsx)(H,{variant:`outline`,children:xe()}):l?(0,J.jsx)(H,{variant:`secondary`,children:ie()}):null]}),r?(0,J.jsx)(`span`,{className:`oc-prefs__help`,children:r}):null]}),(0,J.jsxs)(`div`,{className:`oc-prefs__ctl`,children:[!i&&l?(0,J.jsx)(`button`,{type:`button`,className:`oc-prefs__reset`,onClick:()=>void s({key:e,value:null}),children:Te()}):null,(0,J.jsx)(nt,{checked:c,disabled:i,onCheckedChange:t=>{e===`notifSystem`&&t&&typeof Notification<`u`&&Notification.permission==="default"&&Notification.requestPermission(),s({key:e,value:t})},"aria-label":n})]}),o?(0,J.jsx)(ut,{prefKey:e,ui:a}):null]},e)})]},e.id))}),(0,J.jsx)(dt,{current:i?.dictationShortcut??null,enabled:a.effective.voiceInput===!0})]}):(0,J.jsx)(`div`,{className:`oc-prefs__empty`,children:ee()})}var pt={sm:()=>b(),md:()=>N(),lg:()=>F(),xl:()=>Se(),"2xl":()=>Ee(),"3xl":()=>j()};function mt(){let e=_(z.me.getMe,{host:G}),t=m(z.me.setLocale),n=m(z.me.setTimezone),r=m(z.me.setFontScale).withOptimisticUpdate((e,{scale:t})=>{let n=e.getQuery(z.me.getMe,{host:G});n&&e.setQuery(z.me.getMe,{host:G},{...n,fontScale:t,resolvedFontScale:t??`md`})}),i=m(z.me.setMyName),o=Ke(),c=e?.locale??`default`,l=e?.name??``,[d,p]=(0,q.useState)(null),h=d??l,g=h.trim()!==l.trim();async function v(){try{await i({name:h}),p(null),o.success(he())}catch(e){o.error(Fe(),e)}}return(0,J.jsxs)(`div`,{className:`oc-appearance`,children:[(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ve()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:se()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(W,{className:`max-w-xs`,value:h,maxLength:120,placeholder:u(),onChange:e=>p(e.target.value),onKeyDown:e=>{e.key===`Enter`&&g&&(e.preventDefault(),v())}}),(0,J.jsx)(V,{size:`sm`,disabled:!g,onClick:()=>void v(),children:a()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:f()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:s()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:fe()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[et().map(e=>(0,J.jsx)(V,{variant:c===e.value?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:e.value}),children:e.label},e.value)),(0,J.jsx)(V,{variant:c==="default"?`default`:`outline`,size:`sm`,onClick:()=>void t({locale:null}),children:re()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Re()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:k()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ae()})]}),(0,J.jsxs)(`div`,{className:`oc-show__row`,children:[(0,J.jsx)(tt,{value:e?.timezone??``,onChange:e=>void n({timezone:e})}),(0,J.jsx)(V,{variant:e?.timezone===null||e?.timezone===void 0?`default`:`outline`,size:`sm`,onClick:()=>void n({timezone:null}),children:be()})]}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:D()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:w()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Ve()})]}),(0,J.jsx)(`div`,{className:`oc-show__row`,children:$e.map(t=>(0,J.jsx)(V,{variant:(e?.fontScale??`md`)===t?`default`:`outline`,size:`sm`,onClick:()=>void r({scale:t}),children:pt[t]()},t))}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:Me()})]}),(0,J.jsxs)(`section`,{className:`oc-show__section`,children:[(0,J.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,J.jsx)(`h2`,{className:`oc-show__title`,children:ke()}),(0,J.jsx)(`p`,{className:`oc-show__desc`,children:we()})]}),(0,J.jsx)(ft,{})]})]})}export{mt as PreferencesTab};
@@ -1,4 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$i as r,$o as i,$y as a,By as o,Cr as s,GR as c,Gy as l,Hy as u,Jy as d,KR as f,Ky as p,Ly as m,Qi as h,Qo as g,Qy as _,Ry as v,Sr as y,Uy as b,Vy as x,Wy as S,Xy as C,Yy as w,Zi as T,Zo as ee,Zy as te,ca as ne,da as re,ea as ie,eb as ae,es as oe,la as se,lb as E,nb as D,qy as O,t as k,ta as A,tb as j,ts as M,ua as N,ub as P,xr as F,zy as I}from"./api-BASu8PYC.js";import{d as L,f as R,i as z,l as B,n as V,r as ce,t as H,u as U}from"./FieldLabel-YPTLow_x.js";import{t as W}from"./button-_UzA03A_.js";import{$ as G,Dt as le,Q as K,X as q,Z as J,et as Y,q as ue,ut as de}from"./index-D02RwoOe.js";import{r as X,t as fe}from"./locales-CPjguROj.js";import{t as pe}from"./localePickerView-C2RmOS86.js";/* empty css */var Z=t(e(),1),Q=n(),$={media_delivery:{label:te,help:C},documentary_fetch:{label:w,help:d},inbound_files:{label:O,help:p},history_summary:{label:M,help:oe},file_curation:{label:re,help:A},quote_reply:{label:N,help:se}},me={outboundDir:`/home/node/.openclaw/media/outbound`,references:`- gdrive/1a2b3c4d5e6f7890abcd
2
- - gdrive/0f9e8d7c6b5a4321dcba`,files:`- /home/node/.openclaw/media/inbound/rapport.pdf (124800 o, application/pdf)`,previous_summary:`Projet Alpha : budget 40 000 EUR ; choix du serveur en cours.`,new_messages:`Utilisateur : Compare OVH et Scaleway.
3
- Assistant : Comparaison en cours.`,max_chars:`6000`,file_name:`MEMORY.md`,budget_chars:`20000`,feedback:`Trop de suppressions dans la section des liens, garde-les.`,content:`# Memory index
4
- - [Fait 1](fait-1.md) - note du projet`,excerpt:`Le classement propose trois dossiers : Clients, Fournisseurs, Interne.`},he={outboundDir:I,references:v,files:m,previous_summary:i,new_messages:g,max_chars:ee,file_name:ie,budget_chars:r,feedback:h,content:T,excerpt:ne};function ge(){let e=f(k.admin.listInstances,{}),[t,n]=(0,Z.useState)(null);if(e===void 0)return(0,Q.jsx)(`div`,{className:`oc-settings__tab-loading`,"aria-busy":`true`});if(e.length===0)return(0,Q.jsx)(`div`,{className:`oc-injtab`,children:(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()})});let r=e.find(e=>e._id===t)??e[0];return(0,Q.jsxs)(`div`,{className:`oc-injtab`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__head`,children:[(0,Q.jsx)(V,{label:D(),help:j()}),(0,Q.jsxs)(`label`,{className:`oc-injtab__picker`,children:[(0,Q.jsx)(`span`,{children:l()}),(0,Q.jsxs)(q,{value:r._id,onValueChange:e=>n(e),children:[(0,Q.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(Y,{})}),(0,Q.jsx)(J,{children:e.map(e=>(0,Q.jsx)(K,{value:e._id,children:e.displayName??e.name},e._id))})]})]})]}),(0,Q.jsx)(_e,{instance:r},r._id)]})}function _e({instance:e}){let t=c(k.admin.upsertInstanceConfig),n=le(),r=f(k.me.getMe,{host:ue}),i=e.config??{},a=X(e.config?.contentLocale,r?.defaultLocale??void 0),[o,l]=(0,Z.useState)(()=>z(i,a));(0,Z.useEffect)(()=>{l(z(i,a))},[a,e._id]);let[u,d]=(0,Z.useState)(!1),p=o.promptInjections,m=(e,t)=>l({...o,promptInjections:{...p,[e]:{...p[e],...t}}});async function h(){d(!0);try{await t({instanceId:e._id,config:ce(o,i,a)})}catch(e){n.error(E(),e)}finally{d(!1)}}async function g(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(E(),e)}}let _=e.config?.contentLocale??`default`,v=fe[X(void 0,r?.defaultLocale??void 0)];return(0,Q.jsxs)(`div`,{className:`oc-injtab__body`,children:[(0,Q.jsxs)(`div`,{className:`oc-injtab__content-locale`,children:[(0,Q.jsx)(`span`,{children:s()}),(0,Q.jsxs)(q,{value:_,onValueChange:e=>void g(e),children:[(0,Q.jsx)(G,{size:`sm`,className:`min-w-44`,children:(0,Q.jsx)(Y,{})}),(0,Q.jsxs)(J,{children:[(0,Q.jsx)(K,{value:`default`,children:F({locale:v})}),pe().map(e=>(0,Q.jsx)(K,{value:e.value,children:e.label},e.value))]})]}),(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:y()})]}),U.map(e=>(0,Q.jsx)(ve,{injKey:e,def:B[e],i18n:$[e],row:p[e]??{enabled:!0,template:B[e].defaultTemplate[a]},contentLocale:a,onChange:t=>m(e,t)},e)),(0,Q.jsx)(`div`,{className:`oc-injtab__actions`,children:(0,Q.jsx)(W,{size:`sm`,onClick:()=>void h(),disabled:u,children:P()})})]})}function ve({injKey:e,def:t,i18n:n,row:r,contentLocale:i,onChange:s}){let[c,l]=(0,Z.useState)(!1),d=r.template.trim()!==t.defaultTemplate[i],f=t.togglable&&!r.enabled,p=Object.fromEntries(t.placeholders.map(e=>[e,me[e]??`{${e}}`])),m=L(e,r,i),h=m?R(m,p):``;return(0,Q.jsxs)(`section`,{className:`oc-injcard`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__head`,children:[t.togglable?(0,Q.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Q.jsx)(de,{checked:r.enabled,onCheckedChange:e=>s({enabled:e===!0})}),(0,Q.jsx)(V,{label:n.label(),help:n.help()})]}):(0,Q.jsx)(V,{label:n.label(),help:n.help()}),d&&(0,Q.jsx)(`span`,{className:`oc-injection__badge`,children:a()})]}),(0,Q.jsx)(`textarea`,{className:`oc-injcard__text`,value:r.template,disabled:f,rows:8,spellCheck:!1,onChange:e=>s({template:e.target.value})}),(0,Q.jsxs)(`div`,{className:`oc-injection__foot`,children:[(0,Q.jsxs)(`div`,{className:`oc-injcard__phs`,children:[(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:_()}),t.placeholders.map(e=>(0,Q.jsxs)(`span`,{className:`oc-injcard__ph-chip`,children:[(0,Q.jsx)(`code`,{children:`{${e}}`}),(0,Q.jsx)(H,{text:(he[e]??(()=>e))()})]},e))]}),(0,Q.jsxs)(`div`,{className:`oc-injcard__btns`,children:[(0,Q.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>l(e=>!e),children:c?u():b()}),d&&(0,Q.jsx)(W,{variant:`ghost`,size:`sm`,onClick:()=>s({template:t.defaultTemplate[i]}),children:ae()})]})]}),c&&(0,Q.jsx)(`div`,{className:`oc-injcard__preview`,children:h?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`pre`,{className:`oc-injcard__previewtext`,children:h}),(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:x()})]}):(0,Q.jsx)(`span`,{className:`oc-injection__ph`,children:o()})})]})}export{ge as PromptInjectionsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$C as r,AC as i,BC as ee,DC as a,EC as te,FC as ne,Fa as o,GC as s,GR as c,HC as re,IC as l,JC as u,KC as d,KR as f,LC as p,MC as m,NC as h,OC as g,PC as _,QC as v,RC as y,UC as b,VC as ie,WC as x,XC as S,YC as C,ZC as w,_C as T,bC as E,ew as D,fC as O,gC as k,hC as A,jC as j,kC as M,mC as N,pC as P,qC as F,t as I,tw as L,vC as R,yC as ae,zC as z}from"./api-BASu8PYC.js";import{t as B}from"./button-_UzA03A_.js";import{Dt as V,Et as H,U,_ as W,jt as G,ut as K,yn as q}from"./index-D02RwoOe.js";import{t as J}from"./roleDescriptions-s4fc4FW8.js";var Y=t(e(),1),X=n(),Z=[{group:()=>L(),keys:[{key:`traces.read`,label:()=>S()},{key:`traces.read.content`,label:()=>C(),phi:!0},{key:`traces.write`,label:()=>u()}]},{group:()=>D(),keys:[{key:`kpi.read`,label:()=>S()},{key:`kpi.write`,label:()=>u()}]},{group:()=>r(),keys:[{key:`openclaw.query`,label:()=>F()},{key:`anomalies.read`,label:()=>d()},{key:`anomalies.report`,label:()=>s()}]},{group:()=>v(),keys:[{key:`chats.read`,label:()=>S()},{key:`selfheal`,label:()=>b()},{key:`feedback.respond`,label:()=>o()}]},{group:()=>w(),keys:[{key:`admin.manage`,label:()=>x()}]}],oe=Z.flatMap(e=>e.keys.map(e=>e.key));function Q(e){return e.includes(`*`)}var $={key:``,name:``,description:``};function se(){let e=f(I.apiKeys.listRoles,{}),t=c(I.apiKeys.createRole),n=c(I.apiKeys.ensureRolesSeeded),r=c(I.apiKeys.updateRolePermissions).withOptimisticUpdate((e,{roleId:t,permissions:n})=>{let r=e.getQuery(I.apiKeys.listRoles,{});r&&e.setQuery(I.apiKeys.listRoles,{},r.map(e=>e._id===t?{...e,permissions:n}:e))}),o=U(),s=V(),[u,d]=(0,Y.useState)(!1),[v,b]=(0,Y.useState)($),[x,S]=(0,Y.useState)(new Set);(0,Y.useEffect)(()=>{n({}).catch(e=>{s.error(ie(),e)})},[n,s]);let C=e??[];async function w(e,t){if(Q(e.permissions))return;if(e.builtin){await o({title:ee({name:e.name}),description:z(),confirmLabel:y()});return}if(x.has(e._id))return;let n=e.permissions.includes(t)?e.permissions.filter(e=>e!==t):[...e.permissions,t];S(t=>new Set(t).add(e._id));try{await r({roleId:e._id,permissions:n})}catch(e){s.error(p(),e)}finally{S(t=>{let n=new Set(t);return n.delete(e._id),n})}}async function D(){try{await t({key:v.key,name:v.name,description:v.description||void 0,permissions:[]}),b($),d(!1)}catch(e){s.error(l(),e)}}let F=e===void 0,L=!F&&C.length===0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[ne(),` `,(0,X.jsx)(`code`,{children:`admin`}),` `,_(),` `,(0,X.jsx)(`code`,{children:`traces.read.content`}),` `,h()]}),(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:m()}),(0,X.jsx)(`div`,{className:`oc-dt__bar-actions`,children:(0,X.jsx)(B,{size:`sm`,onClick:()=>{b($),d(!0)},children:j()})})]}),F?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):L?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:M()}):(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:g()}),Z.map(e=>(0,X.jsx)(`th`,{className:`oc-matrix__group`,colSpan:e.keys.length,children:e.group()},e.group()))]}),(0,X.jsx)(`tr`,{children:Z.flatMap(e=>e.keys.map(e=>(0,X.jsxs)(`th`,{className:`oc-matrix__perm`,title:e.phi?re({key:e.key}):e.key,children:[e.label(),e.phi?(0,X.jsx)(`span`,{className:`oc-matrix__phi`,children:` ⚠`}):null]},e.key)))})]}),(0,X.jsx)(`tbody`,{children:C.map(e=>{let t=Q(e.permissions),n=x.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)(H,{variant:`outline`,className:`gap-1`,children:[(0,X.jsx)(q,{}),` `,a()]}):(0,X.jsx)(H,{variant:`secondary`,children:te()})]}),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)(K,{checked:t||e.permissions.includes(r),disabled:t||n,"aria-label":`${e.key} · ${r}`,title:t?E():n?ae():r,onCheckedChange:()=>void w(e,r)})},r))]},e.key)})})]})})]}),(0,X.jsx)(W,{open:u,onOpenChange:d,title:R(),description:T(),canSubmit:!!(v.key&&v.name),onSubmit:D,submitLabel:k(),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:A()}),(0,X.jsx)(G,{value:v.key,placeholder:N(),onChange:e=>b({...v,key:e.target.value})})]}),(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:P()}),(0,X.jsx)(G,{value:v.name,onChange:e=>b({...v,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)(G,{value:v.description,onChange:e=>b({...v,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{$F as r,AF as i,AI as a,BI as o,CF as s,CI as c,D as l,DF as u,EF as ee,FF as d,FI as f,HI as p,IF as m,II as h,JF as te,KR as ne,LF as re,LR as ie,MF as ae,MI as oe,NF as se,NI as ce,OF as le,OI as ue,PF as de,PI as fe,QF as pe,RF as me,RI as he,SF as ge,SI as _e,TF as ve,TI as ye,UI as be,UR as g,VI as xe,XF as _,YF as Se,ZF as v,_I as Ce,_L as we,aI as Te,bI as Ee,bL as De,cI as Oe,cL as ke,dL as Ae,eI as je,fL as Me,gI as Ne,gL as Pe,hF as Fe,hI as Ie,hL as Le,iI as y,jF as Re,jI as ze,kF as Be,kI as Ve,lI as He,lL as Ue,mI as We,mL as Ge,nI as Ke,oI as b,pL as qe,rI as Je,sI as Ye,sL as Xe,t as x,tI as Ze,uL as Qe,vI as $e,vL as et,wF as tt,xF as nt,xI as rt,xL as it,yI as at,yL as ot,zI as st,zR as S}from"./api-BASu8PYC.js";import{t as ct}from"./list-Cfz6xpiH.js";import{t as C}from"./button-_UzA03A_.js";import{$ as w,Bt as T,Ct as lt,Dt as ut,Et as E,Mn as D,Q as O,Rt as k,St as dt,Tt as ft,X as A,Z as j,_t as pt,at as mt,bn as ht,bt as gt,cn as _t,et as M,gt as vt,in as yt,it as bt,jn as N,jt as xt,mn as St,nt as Ct,ot as wt,pn as Tt,q as Et,rt as Dt,tn as Ot,tt as kt,un as At,vt as jt,wt as Mt,xt as Nt,yt as Pt,zt as P}from"./index-D02RwoOe.js";import{a as Ft,i as F,n as It,o as Lt,r as I,t as Rt}from"./table-ChZTpaGw.js";import{t as zt}from"./FilterBar-BQxNZSAj.js";/* empty css */import{a as L,c as Bt,i as Vt,l as Ht,n as Ut,o as Wt,r as Gt,s as R,t as Kt}from"./TimezoneCombobox-673xwoei.js";var qt=l(`calendar-days`,[[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`4`,rx:`2`,key:`1hopcy`}],[`path`,{d:`M3 10h18`,key:`8toen8`}],[`path`,{d:`M8 14h.01`,key:`6423bh`}],[`path`,{d:`M12 14h.01`,key:`1etili`}],[`path`,{d:`M16 14h.01`,key:`1gbofw`}],[`path`,{d:`M8 18h.01`,key:`lrp35t`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M16 18h.01`,key:`kzsmim`}]]),Jt=l(`history`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}],[`path`,{d:`M12 7v5l4 2`,key:`1fdv2h`}]]),z=t(e(),1),B=n();function V(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function Yt({value:e,onChange:t}){let n=Bt(e),r=(0,z.useMemo)(()=>new Date,[]),[i,a]=(0,z.useState)(()=>({year:n?.year??r.getFullYear(),month:n?.month??r.getMonth()})),[o,s]=(0,z.useState)(!1),c=(0,z.useMemo)(()=>V(S()),[]),l=(0,z.useMemo)(()=>new Intl.DateTimeFormat(S(),{month:`long`,year:`numeric`}),[]),u=(0,z.useMemo)(()=>new Intl.DateTimeFormat(S(),{dateStyle:`medium`,timeStyle:`short`}),[]),ee=R(i.year,i.month),d=n?.hour??9,f=n?.minute??0,p=(e,n,r,i,a)=>t(Ht(e,n,r,i,a)),m=(e,t,n)=>{a({year:e,month:t}),p(e,t,n,d,f)},h=e=>{let t=new Date(i.year,i.month+e,1);a({year:t.getFullYear(),month:t.getMonth()})},te=n===null?Oe():u.format(new Date(n.year,n.month,n.day,n.hour,n.minute));return(0,B.jsxs)(k,{modal:!0,open:o,onOpenChange:s,children:[(0,B.jsx)(T,{asChild:!0,children:(0,B.jsxs)(`button`,{type:`button`,className:`oc-dtp__trigger`,"aria-label":He(),children:[(0,B.jsx)(qt,{size:14,"aria-hidden":!0,className:`oc-dtp__icon`}),(0,B.jsx)(`span`,{className:n===null?`oc-dtp__placeholder`:void 0,children:te})]})}),(0,B.jsxs)(P,{align:`start`,className:`oc-dtp__pop`,children:[(0,B.jsxs)(`div`,{className:`oc-dtp__head`,children:[(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":Ye(),onClick:()=>h(-1),children:(0,B.jsx)(D,{size:15,"aria-hidden":!0})}),(0,B.jsx)(`span`,{className:`oc-dtp__month`,children:l.format(new Date(i.year,i.month,1))}),(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__nav`,"aria-label":b(),onClick:()=>h(1),children:(0,B.jsx)(N,{size:15,"aria-hidden":!0})})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__grid`,children:[c.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-dtp__wd`,children:e},t)),ee.map((e,t)=>{let i=n!==null&&n.year===e.year&&n.month===e.month&&n.day===e.day,a=r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,B.jsx)(`button`,{type:`button`,className:`oc-dtp__day`+(e.inMonth?``:` oc-dtp__day--out`)+(i?` oc-dtp__day--sel`:``)+(a&&!i?` oc-dtp__day--today`:``),onClick:()=>m(e.year,e.month,e.day),children:e.day},t)})]}),(0,B.jsxs)(`div`,{className:`oc-dtp__time`,children:[(0,B.jsxs)(A,{value:String(d),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),Number(e),f),children:[(0,B.jsx)(w,{size:`sm`,"aria-label":Te(),children:(0,B.jsx)(M,{})}),(0,B.jsx)(j,{className:`oc-dtp__timeopts`,children:Array.from({length:24},(e,t)=>(0,B.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]}),(0,B.jsx)(`span`,{className:`oc-dtp__colon`,children:`:`}),(0,B.jsxs)(A,{value:String(f),onValueChange:e=>p(i.year,i.month,n?.day??r.getDate(),d,Number(e)),children:[(0,B.jsx)(w,{size:`sm`,"aria-label":y(),children:(0,B.jsx)(M,{})}),(0,B.jsx)(j,{className:`oc-dtp__timeopts`,children:Array.from({length:60},(e,t)=>(0,B.jsx)(O,{value:String(t),children:String(t).padStart(2,`0`)},t))})]})]})]})]})}function H(e){let t=new Date(e),n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())}`}function Xt(e,t,n){let r=e=>String(e).padStart(2,`0`);return`${e}-${r(t+1)}-${r(n)}`}function Zt(e){let t=new Map;for(let n of e){let e=H(n.atMs),r=t.get(e);r===void 0?t.set(e,[n]):r.push(n)}for(let e of t.values())e.sort((e,t)=>e.atMs-t.atMs);return t}function U(e,t,n){let r=new Map,i=new Date(t,n+1,0).getDate();for(let a=1;a<=i;a++){let i=e.get(Xt(t,n,a));i!==void 0&&i.length>0&&r.set(a,i.length)}return r}function Qt(e){try{let t=new Intl.DateTimeFormat(e,{weekday:`narrow`});return Array.from({length:7},(e,n)=>t.format(new Date(2024,0,1+n)))}catch{return[`M`,`T`,`W`,`T`,`F`,`S`,`S`]}}function $t(e,t){let n=(new Date(e,t,1).getDay()+6)%7,r=new Date(e,t,1-n),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()+42);return{startMs:r.getTime(),endMs:i.getTime()}}function en(e){return{startMs:new Date(e,0,1).getTime(),endMs:new Date(e+1,0,1).getTime()}}var W=3;function tn({events:e,mode:t,cursor:n,onModeChange:i,onCursorChange:a,onEventClick:o,footnote:s}){let c=S(),l=(0,z.useMemo)(()=>Zt(e),[e]),u=(0,z.useMemo)(()=>Qt(c),[c]),ee=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`,year:`numeric`}),[c]),d=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{month:`long`}),[c]),f=(0,z.useMemo)(()=>new Intl.DateTimeFormat(c,{hour:`2-digit`,minute:`2-digit`}),[c]),p=new Date,m=e=>{if(t===`year`){a({year:n.year+e,month:n.month});return}let r=new Date(n.year,n.month+e,1);a({year:r.getFullYear(),month:r.getMonth()})},h=t===`year`?String(n.year):ee.format(new Date(n.year,n.month,1));return(0,B.jsxs)(`div`,{className:`oc-cal`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__head`,children:[(0,B.jsxs)(`div`,{className:`oc-cal__nav`,children:[(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":v(),onClick:()=>m(-1),children:(0,B.jsx)(D,{})}),(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":_(),onClick:()=>m(1),children:(0,B.jsx)(N,{})}),(0,B.jsx)(C,{variant:`ghost`,size:`sm`,onClick:()=>a({year:p.getFullYear(),month:p.getMonth()}),children:pe()})]}),(0,B.jsx)(`span`,{className:`oc-cal__title`,children:h}),(0,B.jsxs)(`div`,{className:`oc-cal__modes`,role:`group`,children:[(0,B.jsx)(C,{variant:t===`month`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`month`,onClick:()=>i(`month`),children:je()}),(0,B.jsx)(C,{variant:t===`year`?`secondary`:`ghost`,size:`sm`,"aria-pressed":t===`year`,onClick:()=>i(`year`),children:r()})]})]}),t===`month`?(0,B.jsx)(nn,{cursor:n,byDay:l,weekdays:u,timeFmt:f,now:p,onEventClick:o}):(0,B.jsx)(rn,{year:n.year,byDay:l,monthShortFmt:d,now:p,onOpenMonth:e=>{a({year:n.year,month:e}),i(`month`)}}),s?(0,B.jsx)(`p`,{className:`oc-cal__footnote`,children:s}):null]})}function nn({cursor:e,byDay:t,weekdays:n,timeFmt:r,now:i,onEventClick:a}){let o=R(e.year,e.month);return(0,B.jsxs)(`div`,{className:`oc-cal__month`,children:[n.map((e,t)=>(0,B.jsx)(`span`,{className:`oc-cal__wd`,children:e},t)),o.map((e,n)=>{let o=t.get(Xt(e.year,e.month,e.day))??[],s=i.getFullYear()===e.year&&i.getMonth()===e.month&&i.getDate()===e.day;return(0,B.jsxs)(`div`,{className:`oc-cal__day`+(e.inMonth?``:` oc-cal__day--out`)+(s?` oc-cal__day--today`:``),children:[(0,B.jsx)(`span`,{className:`oc-cal__daynum`,children:e.day}),o.slice(0,W).map(e=>(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__event`+(e.muted?` oc-cal__event--muted`:``)+(e.exact?` oc-cal__event--exact`:``),style:e.color?{"--cal-ev":e.color}:void 0,title:`${r.format(e.atMs)} ${e.title}`,onClick:a?()=>a(e):void 0,children:[(0,B.jsx)(`span`,{className:`oc-cal__evdot`,"aria-hidden":!0}),(0,B.jsx)(`span`,{className:`oc-cal__evtime`,children:r.format(e.atMs)}),(0,B.jsx)(`span`,{className:`oc-cal__evtitle`,children:e.title})]},e.id)),o.length>W?(0,B.jsx)(`span`,{className:`oc-cal__more`,children:Se({count:o.length-W})}):null]},n)})]})}function rn({year:e,byDay:t,monthShortFmt:n,now:r,onOpenMonth:i}){return(0,B.jsx)(`div`,{className:`oc-cal__year`,children:Array.from({length:12},(a,o)=>{let s=U(t,e,o),c=R(e,o);return(0,B.jsxs)(`button`,{type:`button`,className:`oc-cal__mini`,onClick:()=>i(o),children:[(0,B.jsx)(`span`,{className:`oc-cal__mininame`,children:n.format(new Date(e,o,1))}),(0,B.jsx)(`span`,{className:`oc-cal__minigrid`,"aria-hidden":!0,children:c.map((e,t)=>{let n=e.inMonth?s.get(e.day)??0:0,i=e.inMonth&&r.getFullYear()===e.year&&r.getMonth()===e.month&&r.getDate()===e.day;return(0,B.jsx)(`span`,{className:`oc-cal__minidot`+(e.inMonth?``:` is-out`)+(n===1?` has-one`:``)+(n>1?` has-many`:``)+(i?` is-today`:``)},t)})})]},o)})})}var G={h:36e5,min:6e4,s:1e3,ms:1};function an(e){if(e===null)return null;let t=e.trim(),n=/^every\s+(\d+(?:\.\d+)?)(h|min|s|ms)$/.exec(t);if(n!==null){let e=Number(n[1])*G[n[2]];return Number.isFinite(e)&&e>0?{kind:`every`,everyMs:e}:null}let r=/^(?:cron\s+)?([\d*,/-]+(?:\s+[\d*,/-]+){4})(?:\s*\(([^)]+)\))?$/.exec(t);if(r!==null)return{kind:`cron`,expr:r[1],tz:r[2]??null};let i=Date.parse(t);return Number.isFinite(i)?{kind:`at`,atMs:i}:null}function K(e,t,n){let r=new Set;for(let i of e.split(`,`)){let e=i,a=1,o=/^(.+)\/(\d{1,3})$/.exec(i);if(o!==null&&(e=o[1],a=Number(o[2]),a<1))return null;let s,c;if(e===`*`)s=t,c=n;else{let r=/^(\d{1,3})(?:-(\d{1,3}))?$/.exec(e);if(r===null||(s=Number(r[1]),c=r[2]===void 0?s:Number(r[2]),r[2]===void 0&&o!==null&&(c=n),s<t||c>n||s>c))return null}for(let e=s;e<=c;e+=a)r.add(e)}return r.size>0?[...r].sort((e,t)=>e-t):null}function q(e){let t=e.trim().split(/\s+/);if(t.length!==5)return null;let n=K(t[0],0,59),r=K(t[1],0,23),i=K(t[2],1,31),a=K(t[3],1,12),o=K(t[4],0,7);if(!n||!r||!i||!a||!o)return null;let s=new Set(o.map(e=>e%7));return{minutes:n,hours:r,dom:new Set(i),months:new Set(a),dow:s,domRestricted:t[2]!==`*`,dowRestricted:t[4]!==`*`}}var J=new Map;function Y(e){let t=J.get(e);if(t!==void 0)return t;let n=null;try{n=new Intl.DateTimeFormat(`en-US`,{timeZone:e,year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1})}catch{n=null}return J.set(e,n),n}function on(e,t){if(t!==null){let n=Y(t);if(n!==null){let t={};for(let r of n.formatToParts(e))r.type!==`literal`&&(t[r.type]=Number(r.value));return{y:t.year,mo:t.month-1,d:t.day,h:t.hour===24?0:t.hour,mi:t.minute}}}let n=new Date(e);return{y:n.getFullYear(),mo:n.getMonth(),d:n.getDate(),h:n.getHours(),mi:n.getMinutes()}}function X(e,t,n,r,i,a){if(a===null||Y(a)===null)return new Date(e,t,n,r,i).getTime();let o=Date.UTC(e,t,n,r,i),s=e=>{let t=on(e,a);return Date.UTC(t.y,t.mo,t.d,t.h,t.mi)-e},c=s(o),l=o-c,u=s(l);return u!==c&&(l=o-u),l}function Z(e,t,n,r){let i=new Map,a=(e,t)=>{e<n||e>=r||i.set(e,t||(i.get(e)??!1))};if(e?.kind===`at`)a(e.atMs,!0);else if(e?.kind===`every`){if(t!==null){let i=e.everyMs,o=Math.ceil((n-t)/i);for(let e=t+o*i,n=0;e<r&&n<400;e+=i,n++)a(e,e===t)}}else if(e?.kind===`cron`){let t=q(e.expr);if(t!==null&&t.hours.length*t.minutes.length<=400){let i=0,o=n-864e5;for(;o<r+864e5&&i<400;){let s=on(o,e.tz);if(t.months.has(s.mo+1)){let o=new Date(Date.UTC(s.y,s.mo,s.d)).getUTCDay(),c=t.dom.has(s.d),l=t.dow.has(o);if(t.domRestricted&&t.dowRestricted?c||l:c&&l)for(let o of t.hours)for(let c of t.minutes){if(i>=400)break;let t=X(s.y,s.mo,s.d,o,c,e.tz);t>=n&&t<r&&(a(t,!1),i++)}}o=X(s.y,s.mo,s.d,12,0,e.tz)+864e5}}}return t!==null&&a(t,!0),[...i.entries()].map(([e,t])=>({atMs:e,exact:t})).sort((e,t)=>e.atMs-t.atMs).slice(0,400)}var Q=`crons`;function sn(e,t){return`${e}\u0000${t}`}function cn(e,t,n){let r=[],i=new Map;for(let a of e){let{job:e}=a;if(e.id===null)continue;let o=sn(a.instanceName,e.id);i.set(o,a);let s=Z(e.enabled===!1?null:an(e.schedule),e.nextRunAtMs,t,n);for(let t of s)r.push({id:`${o}:${t.atMs}`,sourceId:Q,itemId:o,atMs:t.atMs,title:e.name??e.id,muted:e.enabled===!1,exact:t.exact})}return{events:r,byItemId:i}}var $={minutes:6e4,hours:36e5,days:864e5};function ln(e){return e?.data?.code??`unknown`}function un({status:e}){switch(L(e)){case`ok`:return(0,B.jsx)(E,{variant:`secondary`,children:_e()});case`error`:return(0,B.jsx)(E,{variant:`destructive`,children:Ee()});case`running`:return(0,B.jsx)(E,{variant:`outline`,children:at()});case`other`:return(0,B.jsx)(E,{variant:`outline`,children:e});case`none`:return(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}}function dn(){let e=g(x.scheduled.listMyCrons),t=g(x.scheduled.getCronDetail),n=g(x.scheduled.listCronRuns),r=g(x.scheduled.updateCron),l=g(x.scheduled.removeCron),pe=g(x.scheduled.runCronNow),_=ut(),Se=ne(x.me.getMe,{host:Et})?.timezone,[v,Te]=(0,z.useState)(null),[Oe,je]=(0,z.useState)(!1),[y,He]=(0,z.useState)(!1),[b,Ye]=(0,z.useState)(null),[T,D]=(0,z.useState)(null),[k,N]=(0,z.useState)(null),[P,L]=(0,z.useState)(null),[Bt,Ht]=(0,z.useState)(!1),[R,V]=(0,z.useState)(Ut),[H,Xt]=(0,z.useState)(()=>new URLSearchParams(window.location.search).get(`job`)===null&&localStorage.getItem(`oc.sched.view`)===`calendar`?`calendar`:`list`),Zt=e=>{localStorage.setItem(`oc.sched.view`,e),Xt(e)},[U,Qt]=(0,z.useState)(`month`),[W,nn]=(0,z.useState)(()=>{let e=new Date;return{year:e.getFullYear(),month:e.getMonth()}}),rn=(0,z.useMemo)(()=>{let e=[];for(let t of v??[]){if(!t.supported||t.error!==null)continue;let n=t.kind===`openclaw`&&t.manageSupported;for(let r of t.jobs)Vt(r,R)&&e.push({instanceName:t.instanceName,canEdit:n,job:r})}return e},[v,R]),G=(0,z.useMemo)(()=>U===`year`?en(W.year):$t(W.year,W.month),[U,W]),an=(0,z.useMemo)(()=>cn(rn,G.startMs,G.endMs),[rn,G]),K=e=>{let t=an.byItemId.get(e.itemId);t===void 0||!t.canEdit||t.job.id===null||dn(t.instanceName,t.job)},q=(0,z.useCallback)(async()=>{je(!0),He(!1);try{Te(await e({}))}catch{He(!0)}finally{je(!1)}},[e]);(0,z.useEffect)(()=>{q()},[q]);let J=(0,z.useMemo)(()=>new URLSearchParams(window.location.search).get(`job`),[]),Y=(0,z.useRef)(null);(0,z.useEffect)(()=>{v!==null&&Y.current!==null&&Y.current.scrollIntoView({block:`center`})},[v]);let on=(0,z.useMemo)(()=>new Intl.DateTimeFormat(S(),{dateStyle:`medium`,timeStyle:`short`}),[]),X=async(e,t,n)=>{Ye(e);try{await t(),_.success(n),await q()}catch(e){_.toast({variant:`error`,title:h({code:ln(e)})})}finally{Ye(null)}},Z=(0,z.useRef)(0),Q=(0,z.useRef)(0),sn=async(e,t)=>{if(t.id===null)return;let r=++Z.current;N({name:t.name??t.id,entries:null});try{let i=await n({instanceName:e,jobId:t.id,limit:20});if(r!==Z.current)return;N({name:t.name??t.id,entries:i})}catch(e){if(r!==Z.current)return;N(null),_.toast({variant:`error`,title:h({code:ln(e)})})}},dn=async(e,n)=>{if(n.id===null)return;let r=++Q.current;L({instanceName:e,jobId:n.id,loading:!0,name:n.name??``,scheduleKind:`cron`,cronExpr:``,tz:``,everyValue:`1`,everyUnit:`hours`,at:``,message:``,hasMessage:!1,scheduleDirty:!1,messageDirty:!1,nameDirty:!1});try{let i=(await t({instanceName:e,jobId:n.id})).job,a=i.scheduleKind===`every`||i.scheduleKind===`at`?i.scheduleKind:`cron`,o=``;if(a===`at`&&i.scheduleExpr!==null){let e=Date.parse(i.scheduleExpr);Number.isFinite(e)&&(o=new Date(e-new Date(e).getTimezoneOffset()*6e4).toISOString().slice(0,16))}let s=`1`,c=`hours`;if(a===`every`&&i.scheduleExpr!==null){let e=Number(i.scheduleExpr);Number.isFinite(e)&&e>0&&(e%$.days===0?(s=String(e/$.days),c=`days`):e%$.hours===0?(s=String(e/$.hours),c=`hours`):(s=String(Math.max(1,Math.round(e/$.minutes))),c=`minutes`))}if(r!==Q.current)return;L(e=>e===null||e.jobId!==n.id?e:{...e,loading:!1,name:i.name??e.name,scheduleKind:a,cronExpr:a===`cron`?i.scheduleExpr??``:``,tz:i.tz??``,everyValue:s,everyUnit:c,at:o,message:i.message??``,hasMessage:i.message!==null&&!i.messageTruncated})}catch(e){if(r!==Q.current)return;L(null),_.toast({variant:`error`,title:h({code:ln(e)})})}},fn=async()=>{if(P===null)return;let e={};if(P.nameDirty&&P.name.trim()===``||P.messageDirty&&P.hasMessage&&P.message.trim()===``){_.toast({variant:`error`,title:nt()});return}if(P.nameDirty&&P.name.trim()!==``&&(e.name=P.name.trim()),P.scheduleDirty){if(P.scheduleKind===`cron`&&P.cronExpr.trim()!==``)e.schedule={kind:`cron`,expr:P.cronExpr.trim(),...P.tz.trim()===``?{}:{tz:P.tz.trim()}};else if(P.scheduleKind===`every`){let t=Number(P.everyValue);Number.isFinite(t)&&t>=1&&(e.schedule={kind:`every`,everyMs:Math.round(t*$[P.everyUnit])})}else if(P.scheduleKind===`at`&&P.at!==``){let t=Date.parse(P.at);Number.isFinite(t)&&(e.schedule={kind:`at`,at:new Date(t).toISOString()})}}if(P.scheduleDirty&&e.schedule===void 0){_.toast({variant:`error`,title:ge()});return}if(P.messageDirty&&P.hasMessage&&P.message.trim()!==``&&(e.message=P.message.trim()),Object.keys(e).length===0){L(null);return}let t=Q.current;Ht(!0);try{await r({instanceName:P.instanceName,jobId:P.jobId,patch:e}),_.success(d()),t===Q.current&&L(null),await q()}catch(e){_.toast({variant:`error`,title:h({code:ln(e)})})}finally{Ht(!1)}},pn=v?.reduce((e,t)=>e+t.jobs.length,0)??0;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{style:{display:`flex`,alignItems:`flex-start`,gap:8,marginBottom:12},children:[(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{flex:1,margin:0},children:it()}),(0,B.jsxs)(`div`,{className:`oc-sched__viewtoggle`,role:`group`,"aria-label":Je(),children:[(0,B.jsx)(C,{variant:H===`list`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ke(),title:Ke(),"aria-pressed":H===`list`,onClick:()=>Zt(`list`),children:(0,B.jsx)(ct,{})}),(0,B.jsx)(C,{variant:H===`calendar`?`secondary`:`ghost`,size:`icon-sm`,"aria-label":Ze(),title:Ze(),"aria-pressed":H===`calendar`,onClick:()=>Zt(`calendar`),children:(0,B.jsx)(qt,{})})]}),(0,B.jsxs)(C,{variant:`ghost`,size:`sm`,onClick:()=>void q(),disabled:Oe,style:{display:`inline-flex`,alignItems:`center`,gap:4},children:[(0,B.jsx)(_t,{size:14,"aria-hidden":!0}),De()]})]}),v!==null&&pn>0?(0,B.jsxs)(zt,{q:R.q,onQChange:e=>V(t=>({...t,q:e})),searchPlaceholder:Ce(),onReset:()=>V(Ut),canReset:Gt(R),children:[(0,B.jsxs)(A,{value:R.state,onValueChange:e=>V(t=>({...t,state:e})),children:[(0,B.jsx)(w,{size:`sm`,className:`w-40`,children:(0,B.jsx)(M,{})}),(0,B.jsxs)(j,{children:[(0,B.jsx)(O,{value:`all`,children:Ne()}),(0,B.jsx)(O,{value:`active`,children:Xe()}),(0,B.jsx)(O,{value:`paused`,children:ke()})]})]}),(0,B.jsxs)(A,{value:R.result,onValueChange:e=>V(t=>({...t,result:e})),children:[(0,B.jsx)(w,{size:`sm`,className:`w-40`,children:(0,B.jsx)(M,{})}),(0,B.jsxs)(j,{children:[(0,B.jsx)(O,{value:`all`,children:Ie()}),(0,B.jsx)(O,{value:`ok`,children:_e()}),(0,B.jsx)(O,{value:`error`,children:Ee()}),(0,B.jsx)(O,{value:`running`,children:at()}),(0,B.jsx)(O,{value:`none`,children:$e()})]})]})]}):null,v===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,"aria-busy":Oe,children:y?ot():ie()}):H===`calendar`?(0,B.jsxs)(B.Fragment,{children:[y?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):null,v.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):(0,B.jsx)(tn,{events:an.events,mode:U,cursor:W,onModeChange:Qt,onCursorChange:nn,onEventClick:K,footnote:te()})]}):(0,B.jsxs)(B.Fragment,{children:[y?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ot()}):null,v.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:et()}):null,v.map(e=>{let t=e.jobs.filter(e=>Vt(e,R)),n=Gt(R)&&e.jobs.length>0&&t.length===0;return(0,B.jsxs)(`section`,{style:{marginBottom:20},children:[v.length>1||e.error||!e.supported?(0,B.jsxs)(`h3`,{style:{display:`flex`,alignItems:`center`,gap:8,fontSize:`0.85rem`,fontWeight:600,margin:`0 0 6px`},children:[e.instanceName,(0,B.jsx)(E,{variant:`outline`,children:e.kind})]}):null,e.supported?e.error?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Pe({code:e.error})}):e.jobs.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:Le()}):n?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:We()}):(0,B.jsxs)(Rt,{children:[(0,B.jsx)(Ft,{children:(0,B.jsxs)(Lt,{children:[(0,B.jsx)(F,{children:Ge()}),(0,B.jsx)(F,{children:qe()}),(0,B.jsx)(F,{children:Me()}),(0,B.jsx)(F,{children:Ae()}),(0,B.jsx)(F,{children:Qe()}),(0,B.jsx)(F,{children:c()}),(0,B.jsx)(F,{children:me()})]})}),(0,B.jsx)(It,{children:t.map((t,n)=>{let i=`${e.instanceName}:${t.id??n}`,a=b===i,s=e.manageSupported,c=e.kind===`openclaw`&&s;return(0,B.jsxs)(Lt,{ref:t.id!==null&&t.id===J?Y:void 0,"data-state":t.id!==null&&t.id===J?`selected`:void 0,children:[(0,B.jsx)(I,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:t.name??void 0,children:t.name??Ue()}),(0,B.jsx)(I,{children:(0,B.jsx)(E,{variant:`secondary`,children:t.agentId})}),(0,B.jsxs)(I,{className:`whitespace-nowrap`,children:[(0,B.jsx)(`span`,{style:{fontFamily:`var(--font-mono, monospace)`},children:t.schedule??`—`}),(()=>{let e=vt(t.schedule),n=e===null?null:pt(e);return n===null?null:(0,B.jsx)(`span`,{className:`text-muted-foreground`,style:{display:`block`,fontSize:`0.78rem`},children:n})})()]}),(0,B.jsx)(I,{className:`whitespace-nowrap text-muted-foreground`,children:t.nextRunAtMs===null?`—`:on.format(t.nextRunAtMs)}),(0,B.jsx)(I,{children:Wt(t.enabled)===`active`?(0,B.jsx)(E,{variant:`secondary`,children:Xe()}):Wt(t.enabled)===`paused`?(0,B.jsx)(E,{variant:`outline`,children:ke()}):(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`})}),(0,B.jsxs)(I,{children:[(0,B.jsx)(un,{status:t.lastRunStatus}),t.lastDelivered===!1?(0,B.jsx)(E,{variant:`destructive`,title:t.lastDeliveryError??be(),children:rt()}):null]}),(0,B.jsx)(I,{className:`whitespace-nowrap`,children:t.id===null?(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:`—`}):a?(0,B.jsx)(ht,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):(0,B.jsxs)(`span`,{className:`oc-cronactions`,children:[c?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:xe(),"aria-label":xe(),disabled:b!==null,onClick:()=>void X(i,async()=>{let n=await pe({instanceName:e.instanceName,jobId:t.id});if(n.ran!==!0&&n.runId===null)throw{data:{code:n.reason??`run_not_started`}}},f()),children:(0,B.jsx)(Ot,{size:14,"aria-hidden":!0})}):null,c&&t.enabled!==null?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:t.enabled?o():st(),"aria-label":t.enabled?o():st(),disabled:b!==null,onClick:()=>void X(i,()=>r({instanceName:e.instanceName,jobId:t.id,patch:{enabled:!t.enabled}}),t.enabled?fe():ce()),children:t.enabled?(0,B.jsx)(St,{size:14,"aria-hidden":!0}):(0,B.jsx)(At,{size:14,"aria-hidden":!0})}):null,c?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:re(),"aria-label":re(),disabled:b!==null,onClick:()=>void dn(e.instanceName,t),children:(0,B.jsx)(Tt,{size:14,"aria-hidden":!0})}):null,c?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:m(),"aria-label":m(),disabled:b!==null,onClick:()=>void sn(e.instanceName,t),children:(0,B.jsx)(Jt,{size:14,"aria-hidden":!0})}):null,s?(0,B.jsx)(C,{variant:`ghost`,size:`icon-sm`,title:he(),"aria-label":he(),disabled:b!==null,onClick:()=>D({instanceName:e.instanceName,jobId:t.id,name:t.name??t.id}),children:(0,B.jsx)(yt,{size:14,"aria-hidden":!0})}):null]})})]},t.id??`${e.instanceName}-${n}`)})})]}):(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:we()})]},e.instanceName)}),pn>0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:4},children:Fe()}):null]}),(0,B.jsx)(jt,{open:T!==null,onOpenChange:e=>{e||D(null)},children:(0,B.jsxs)(Nt,{children:[(0,B.jsxs)(Mt,{children:[(0,B.jsx)(ft,{children:ze()}),(0,B.jsx)(dt,{children:a({name:T?.name??``})})]}),(0,B.jsxs)(lt,{children:[(0,B.jsx)(gt,{children:Ve()}),(0,B.jsx)(Pt,{onClick:()=>{let e=T;D(null),e!==null&&X(`${e.instanceName}:${e.jobId}`,()=>l({instanceName:e.instanceName,jobId:e.jobId}),oe())},children:ue()})]})]})}),(0,B.jsx)(kt,{open:k!==null,onOpenChange:e=>{e||(Z.current++,N(null))},children:(0,B.jsxs)(Ct,{style:{maxWidth:640},children:[(0,B.jsx)(mt,{children:(0,B.jsx)(wt,{children:de({name:k?.name??``})})}),k?.entries===null?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):k!==null&&k.entries.length===0?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:se()}):k===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__runs`,style:{maxHeight:420,overflowY:`auto`},children:k.entries.map((e,t)=>(0,B.jsxs)(`div`,{className:`oc-cronpanel__run`,children:[(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-head`,children:[(0,B.jsx)(un,{status:e.status}),(0,B.jsx)(`span`,{children:typeof(e.runAtMs??e.ts)==`number`?on.format(e.runAtMs??e.ts):`—`}),typeof e.durationMs==`number`?(0,B.jsxs)(`span`,{className:`oc-cronpanel__run-dur`,children:[Math.round(e.durationMs/1e3),`s`]}):null]}),e.summary===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-summary`,children:e.summary}),e.error===null?null:(0,B.jsx)(`div`,{className:`oc-cronpanel__run-error`,children:e.error}),e.delivered===!1?(0,B.jsxs)(`div`,{className:`oc-cronpanel__run-undelivered`,children:[ye({channel:e.deliveryChannel??`—`}),e.deliveryError===null?null:(0,B.jsx)(`span`,{className:`oc-cronpanel__plain`,children:e.deliveryError})]}):null]},t))})]})}),(0,B.jsx)(kt,{open:P!==null,onOpenChange:e=>{e||(Q.current++,L(null))},children:(0,B.jsxs)(Ct,{className:`oc-cronedit`,children:[(0,B.jsxs)(mt,{children:[(0,B.jsx)(wt,{children:ae()}),(0,B.jsx)(Dt,{children:Re()})]}),P===null?null:P.loading?(0,B.jsx)(`p`,{className:`oc-admin__hint`,children:ie()}):(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:12},children:[(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:Ge()}),(0,B.jsx)(xt,{value:P.name,maxLength:200,onChange:e=>L({...P,name:e.target.value,nameDirty:!0})})]}),(0,B.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:i()}),(0,B.jsxs)(A,{value:P.scheduleKind,onValueChange:e=>L({...P,scheduleKind:e,scheduleDirty:!0}),children:[(0,B.jsx)(w,{children:(0,B.jsx)(M,{})}),(0,B.jsxs)(j,{children:[(0,B.jsx)(O,{value:`cron`,children:Be()}),(0,B.jsx)(O,{value:`every`,children:le()}),(0,B.jsx)(O,{value:`at`,children:u()})]})]}),P.scheduleKind===`cron`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(xt,{value:P.cronExpr,onChange:e=>L({...P,cronExpr:e.target.value,scheduleDirty:!0}),placeholder:`30 9 * * *`,style:{fontFamily:`var(--font-mono, monospace)`}}),(0,B.jsx)(Kt,{value:P.tz,onChange:e=>L({...P,tz:e,scheduleDirty:!0}),fallbackTz:Se??void 0})]}):P.scheduleKind===`every`?(0,B.jsxs)(`div`,{style:{display:`flex`,gap:8},children:[(0,B.jsx)(xt,{type:`number`,min:1,value:P.everyValue,onChange:e=>L({...P,everyValue:e.target.value,scheduleDirty:!0}),style:{maxWidth:120}}),(0,B.jsxs)(A,{value:P.everyUnit,onValueChange:e=>L({...P,everyUnit:e,scheduleDirty:!0}),children:[(0,B.jsx)(w,{style:{maxWidth:160},children:(0,B.jsx)(M,{})}),(0,B.jsxs)(j,{children:[(0,B.jsx)(O,{value:`minutes`,children:ee()}),(0,B.jsx)(O,{value:`hours`,children:ve()}),(0,B.jsx)(O,{value:`days`,children:tt()})]})]})]}):(0,B.jsx)(Yt,{value:P.at,onChange:e=>L({...P,at:e,scheduleDirty:!0})})]}),P.hasMessage?(0,B.jsxs)(`label`,{style:{display:`flex`,flexDirection:`column`,gap:4},children:[(0,B.jsx)(`span`,{className:`oc-admin__hint`,style:{margin:0},children:p()}),(0,B.jsx)(`textarea`,{className:`oc-cronedit__textarea`,rows:4,value:P.message,onChange:e=>L({...P,message:e.target.value,messageDirty:!0})})]}):null]}),(0,B.jsxs)(bt,{children:[(0,B.jsx)(C,{variant:`ghost`,onClick:()=>L(null),children:Ve()}),(0,B.jsxs)(C,{onClick:()=>void fn(),disabled:P===null||P.loading||Bt,children:[Bt?(0,B.jsx)(ht,{size:14,className:`oc-actrow__spin`,"aria-hidden":!0}):null,s()]})]})]})})]})}export{dn as ScheduledTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$M as r,$j as i,AM as ee,BM as te,Bj as a,CM as ne,DM as re,EM as ie,FM as ae,GM as oe,GR as o,Gj as s,HM as se,Hj as c,IM as ce,Ij as l,JM as le,Jj as u,KM as ue,KR as d,Kj as f,LM as de,Lj as p,MM as fe,NM as pe,OM as me,PM as he,QM as ge,Qj as m,RM as _e,Rj as ve,SM as ye,TM as be,UM as xe,UR as Se,Uj as Ce,VM as we,Vj as Te,WM as Ee,Wj as h,XM as g,Xj as _,YM as De,Yj as v,ZM as y,Zj as b,_M as Oe,aM as x,bM as ke,cM as Ae,dM as je,eM as S,eN as Me,fM as Ne,gM as Pe,hM as Fe,iM as C,jM as Ie,kM as Le,lM as Re,mM as ze,nM as w,nN as Be,oM as Ve,pM as He,qM as Ue,qj as T,rM as E,sM as We,t as D,tM as O,tN as Ge,uM as Ke,vM as qe,wM as Je,xM as Ye,yM as Xe,zM as Ze,zj as k}from"./api-BASu8PYC.js";import{t as A}from"./check-BVOFzT6U.js";import{r as Qe}from"./dist-Bn5IE_M3.js";import{t as j}from"./button-_UzA03A_.js";import{$ as M,Dt as $e,Et as N,Fn as et,On as P,Pn as tt,Q as F,U as nt,X as I,Z as L,_ as rt,at as R,ct as z,et as B,it as V,jn as it,jt as H,nt as U,ot as W,rt as at,st as G,tt as K}from"./index-D02RwoOe.js";import{t as ot}from"./FilterBar-BQxNZSAj.js";import{t as st}from"./DataTableShell-BbVvH8AP.js";import{t as ct}from"./roleDescriptions-s4fc4FW8.js";var q=t(e(),1),J=n(),lt=[{value:`never`,label:()=>c(),days:null},{value:`30`,label:()=>Te(),days:30},{value:`90`,label:()=>a(),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,s]=(0,q.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=d(D.apiKeys.listServiceAccounts,{filter:{q:n||void 0,role:a===X?void 0:a,disabled:i===X?void 0:i===`disabled`}}),f=d(D.apiKeys.listKeys,{}),p=d(D.apiKeys.listRoles,{}),m=o(D.apiKeys.createServiceAccount),ve=o(D.apiKeys.updateServiceAccount),Ce=o(D.apiKeys.deleteServiceAccount),Te=Se(D.apiKeys.mintApiKey),h=o(D.apiKeys.revokeApiKey),_=nt(),v=$e(),b=n!==``||a!==X||i!==X;function x(){s(X),t({search:{},replace:!0})}let[S,C]=(0,q.useState)(!1),[w,T]=(0,q.useState)(Z),[E,O]=(0,q.useState)(null),[k,A]=(0,q.useState)(new Set),[P,R]=(0,q.useState)(null),z=(0,q.useRef)(!1),[V,U]=(0,q.useState)(new Set),[W,at]=(0,q.useState)({}),[G,K]=(0,q.useState)(null),Y=(0,q.useMemo)(()=>{let e=new Map;for(let t of f??[]){let n=e.get(t.serviceAccountId)??[];n.push(t),e.set(t.serviceAccountId,n)}return e},[f]);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 ve({serviceAccountId:E,name:w.name,roleKey:w.roleKey,description:w.description}),v.success(ke())):await m({name:w.name,roleKey:w.roleKey,description:w.description||void 0}),T(Z),O(null),C(!1)}catch(e){v.error(E?Ye():ye(),e)}}function pt(e){T({name:e.name,roleKey:e.roleKey,description:e.description??``}),O(e._id),C(!0)}async function mt(e){if(z.current)return;z.current=!0;let t=W[e._id]??`never`,n=lt.find(e=>e.value===t)?.days??null,r=n?Date.now()+n*24*60*60*1e3:void 0;R(e._id);try{let t=await Te({serviceAccountId:e._id,expiresAt:r});K({accountName:e.name,plaintext:t.plaintext,prefix:t.prefix,lastFour:t.lastFour})}catch(e){v.error(Xe(),e)}finally{z.current=!1,R(null)}}async function $(e){if(await _({title:qe(),description:(0,J.jsxs)(J.Fragment,{children:[Oe(),` `,(0,J.jsx)(`span`,{className:`font-mono`,children:e.name}),` `,Pe(),` `,(0,J.jsx)(`strong`,{children:Fe()}),` `,ze()]}),confirmWord:e.name,confirmLabel:He(),destructive:!0}))try{await Ce({serviceAccountId:e._id}),v.success(Ne(),e.name)}catch(e){v.error(je(),e)}}async function ht(e){if(await _({title:Ke(),description:(0,J.jsxs)(J.Fragment,{children:[Re(),` `,(0,J.jsxs)(`span`,{className:`font-mono`,children:[e.prefix,`…`,e.lastFour]}),` `,Ae()]}),confirmLabel:We(),destructive:!0})&&!V.has(e._id)){U(t=>new Set(t).add(e._id));try{await h({keyId:e._id})}catch(e){v.error(Ve(),e)}finally{U(t=>{let n=new Set(t);return n.delete(e._id),n})}}}return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Be()}),(0,J.jsxs)(ot,{q:n,onQChange:c,searchPlaceholder:Ge(),onReset:x,canReset:b,children:[(0,J.jsxs)(I,{value:a,onValueChange:s,children:[(0,J.jsx)(M,{size:`sm`,className:`w-40`,children:(0,J.jsx)(B,{placeholder:Me()})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(F,{value:X,children:r()}),(p??[]).map(e=>(0,J.jsx)(F,{value:e.key,children:e.key},e._id))]})]}),(0,J.jsxs)(I,{value:i,onValueChange:l,children:[(0,J.jsx)(M,{size:`sm`,className:`w-36`,children:(0,J.jsx)(B,{})}),(0,J.jsxs)(L,{children:[(0,J.jsx)(F,{value:X,children:ge()}),(0,J.jsx)(F,{value:`active`,children:y()}),(0,J.jsx)(F,{value:`disabled`,children:g()})]})]})]}),(0,J.jsx)(st,{title:De(),rows:u,addLabel:le(),onAdd:()=>{T(Z),O(null),C(!0)},emptyHint:Ue(),isExpanded:e=>k.has(e._id),renderExpanded:e=>(0,J.jsx)(ut,{account:e,keys:Y.get(e._id)??[],onRevoke:ht,revoking:V}),rowActions:e=>[{label:xe(),onSelect:()=>pt(e)},{label:ue(),onSelect:()=>void mt(e)},{label:k.has(e._id)?oe():Ee(),onSelect:()=>Q(e._id)},{label:se(),variant:`destructive`,onSelect:()=>void $(e)}],columns:[{header:``,className:`w-8`,cell:e=>(0,J.jsx)(j,{variant:`ghost`,size:`icon-sm`,"aria-label":k.has(e._id)?we():te(),onClick:()=>Q(e._id),children:k.has(e._id)?(0,J.jsx)(Qe,{}):(0,J.jsx)(it,{})})},{header:Ze(),sort:e=>e.name,cell:e=>(0,J.jsxs)(`div`,{className:`flex flex-col`,children:[(0,J.jsx)(`span`,{children:e.name}),e.description?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:e.description}):null]})},{header:_e(),sort:e=>e.roleKey,cell:e=>(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})},{header:de(),sort:e=>+!!e.disabled,cell:e=>e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:g()}):(0,J.jsx)(N,{variant:`outline`,children:y()})},{header:ce(),cell:e=>(0,J.jsxs)(I,{value:W[e._id]??`never`,onValueChange:t=>at(n=>({...n,[e._id]:t})),children:[(0,J.jsx)(M,{size:`sm`,className:`w-32`,children:(0,J.jsx)(B,{})}),(0,J.jsx)(L,{children:lt.map(e=>(0,J.jsx)(F,{value:e.value,children:e.label()},e.value))})]})},{header:ae(),sort:e=>(Y.get(e._id)??[]).filter(e=>!e.disabled).length,cell:e=>{let t=(Y.get(e._id)??[]).filter(e=>!e.disabled).length;return(0,J.jsx)(`span`,{className:`oc-sa__keycount`,children:P===e._id?he():pe({count:t})})}}]}),(0,J.jsx)(rt,{open:S,onOpenChange:e=>{C(e),e||O(null)},title:E?fe():Le(),description:E?Ie():me(),canSubmit:!!(w.name&&w.roleKey),onSubmit:ft,submitLabel:E?ee():re(),children:(0,J.jsxs)(`div`,{className:`oc-form`,children:[(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ie()}),(0,J.jsx)(H,{value:w.name,onChange:e=>T({...w,name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:be()}),(0,J.jsxs)(I,{value:w.roleKey||void 0,onValueChange:e=>T({...w,roleKey:e}),children:[(0,J.jsx)(M,{className:`w-full`,children:(0,J.jsx)(B,{placeholder:Je()})}),(0,J.jsx)(L,{children:(p??[]).map(e=>(0,J.jsxs)(F,{value:e.key,children:[e.name,` (`,e.key,`)`]},e._id))})]}),(()=>{let e=(p??[]).find(e=>e.key===w.roleKey),t=e?ct(e):null;return t?(0,J.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null})()]}),(0,J.jsxs)(`label`,{className:`oc-field`,children:[(0,J.jsx)(`span`,{className:`oc-field__label`,children:ne()}),(0,J.jsx)(H,{value:w.description,onChange:e=>T({...w,description:e.target.value})})]})]})}),(0,J.jsx)(dt,{minted:G,onClose:()=>K(null)})]})}function ut({account:e,keys:t,onRevoke:n,revoking:r}){return(0,J.jsxs)(`div`,{className:`oc-sa__keys`,children:[(0,J.jsxs)(`div`,{className:`oc-sa__keys-head`,children:[x(),` `,(0,J.jsx)(`span`,{className:`font-medium`,children:e.name})]}),t.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:C()}):(0,J.jsxs)(`table`,{className:`oc-sa__keytable`,children:[(0,J.jsx)(`thead`,{children:(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`th`,{children:E()}),(0,J.jsx)(`th`,{children:w()}),(0,J.jsx)(`th`,{children:O()}),(0,J.jsx)(`th`,{children:S()}),(0,J.jsx)(`th`,{children:i()}),(0,J.jsx)(`th`,{children:m()}),(0,J.jsx)(`th`,{})]})}),(0,J.jsx)(`tbody`,{children:t.map(t=>(0,J.jsxs)(`tr`,{children:[(0,J.jsx)(`td`,{children:(0,J.jsxs)(`code`,{className:`oc-sa__keyid`,children:[t.prefix,`…`,t.lastFour]})}),(0,J.jsx)(`td`,{children:(0,J.jsx)(N,{variant:`secondary`,children:e.roleKey})}),(0,J.jsx)(`td`,{children:z(t.createdAt)}),(0,J.jsx)(`td`,{className:ft(t.lastUsedAt)?`oc-sa__stale`:``,children:pt(t.lastUsedAt)}),(0,J.jsx)(`td`,{children:mt(t.expiresAt)}),(0,J.jsx)(`td`,{children:$(t)}),(0,J.jsx)(`td`,{className:`text-right`,children:t.disabled?null:(0,J.jsx)(j,{variant:`destructive`,size:`sm`,disabled:r.has(t._id),onClick:()=>n(t),children:r.has(t._id)?b():_()})})]},t._id))})]})]})}function dt({minted:e,onClose:t}){let[n,r]=(0,q.useState)(!1);async function i(){if(e)try{await navigator.clipboard.writeText(e.plaintext),r(!0),window.setTimeout(()=>r(!1),2e3)}catch{}}return(0,J.jsx)(K,{open:e!==null,onOpenChange:e=>{e||(r(!1),t())},children:e?(0,J.jsxs)(U,{className:`max-w-lg`,showCloseButton:!1,onInteractOutside:e=>e.preventDefault(),onEscapeKeyDown:e=>e.preventDefault(),children:[(0,J.jsxs)(R,{children:[(0,J.jsx)(W,{children:v()}),(0,J.jsx)(at,{children:u({name:e.accountName})})]}),(0,J.jsx)(`div`,{className:`oc-sa__minted-warning`,children:T()}),(0,J.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,J.jsx)(`code`,{className:`oc-sa__minted-plain`,children:e.plaintext}),(0,J.jsxs)(j,{variant:`outline`,size:`sm`,onClick:()=>void i(),"aria-label":f(),children:[n?(0,J.jsx)(A,{}):(0,J.jsx)(P,{}),n?s():h()]})]}),(0,J.jsx)(V,{children:(0,J.jsx)(j,{onClick:()=>{r(!1),t()},children:Ce()})})]}):null})}function ft(e){return e===null?!1:Date.now()-e>Y}function pt(e){return e===null?k():z(e)}function mt(e){return e===null?`—`:G(e)}function $(e){return e.disabled?(0,J.jsx)(N,{variant:`destructive`,children:ve()}):e.expiresAt!==null&&e.expiresAt<Date.now()?(0,J.jsx)(N,{variant:`outline`,children:p()}):(0,J.jsx)(N,{variant:`outline`,children:l()})}export{Q as ServiceAccountsTab};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$N as r,$P as i,AP as a,BP as o,CP as s,D as c,DP as l,EP as u,FP as d,FR as f,GN as p,GP as m,GR as h,HP as g,IP as _,JN as v,JP as y,KN as ee,KP as te,KR as b,LP as ne,MP as re,NP as ie,NR as ae,OP as x,PP as oe,PR as se,QN as ce,QP as le,RP as ue,SP as de,TP as fe,UN as pe,UP as me,UR as he,VP as ge,WN as _e,WP as ve,XN as ye,XP as be,YN as xe,YP as Se,ZN as S,ZP as Ce,_P as we,aF as Te,aP as Ee,as as C,bP as De,cF as Oe,cP as ke,dF as Ae,dP as je,eF as Me,eP as Ne,fP as Pe,gP as Fe,hP as Ie,iF as Le,iP as Re,is as w,jP as ze,kP as Be,lF as Ve,lP as T,mP as He,nF as Ue,nP as We,ns as Ge,oF as Ke,oP as qe,pP as Je,qN as E,qP as Ye,r as Xe,rF as Ze,rP as Qe,rs as $e,sF as et,sP as tt,t as D,tF as O,tP as nt,uF as rt,uP as it,vP as at,wP as ot,xP as st,yP as ct,zP as lt}from"./api-BASu8PYC.js";import{t as k}from"./check-BVOFzT6U.js";import{t as A}from"./x-C5QQoypN.js";import{t as j}from"./button-_UzA03A_.js";import{$ as M,Dn as ut,En as N,Et as P,Ft as dt,G as ft,It as F,K as pt,Lt as mt,Mt as ht,Nt as gt,Pt as I,Q as L,X as R,Z as z,et as B,jt as V,q as H,ut as U}from"./index-D02RwoOe.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-BoGX4FTX.js";import{a as wt,i as W,n as Tt,o as G,r as K,t as Et}from"./table-ChZTpaGw.js";import{t as Dt}from"./TimeRangePicker-zbyQlb0G.js";import{t as Ot}from"./FilterBar-BQxNZSAj.js";import{t as kt}from"./AdvancedFilter-oNVoBmr5.js";var q=c(`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(Pe());if(e.size>Lt)throw Error(je());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(T());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(T());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 Wt(f,`image/webp`,Bt)??await Wt(f,`image/png`);if(!h)throw Error(ke());return{blob:h,hasAlpha:m}}finally{a()}}async function Ht(e){if(e.type===`image/svg+xml`)return Ut(e);if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e);return{source:t,width:t.width,height:t.height,cleanup:()=>t.close()}}catch{}return Ut(e)}async function Ut(e){let t=URL.createObjectURL(e);try{let e=new Image;return e.decoding=`async`,await new Promise((n,r)=>{e.onload=()=>n(),e.onerror=()=>r(Error(it())),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 Wt(e,t,n){return new Promise(r=>e.toBlob(e=>r(e),t,n))}var X=n();function Gt(e,t){let n=e.trim().replace(/[^A-Za-z0-9_.-]+/g,`-`).replace(/^-+|-+$/g,``)||`chart`,r=new Blob([JSON.stringify(t,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${n}.chart.json`,document.body.appendChild(a),a.click(),a.remove(),URL.revokeObjectURL(i)}var Z=`__all__`,Kt={kind:`relative`,from:`now-24h`,to:`now`},qt=[{value:`status`,label:`Statut`},{value:`latencyMs`,label:`Latence (ms)`},{value:`route`,label:`Route`},{value:`roleKey`,label:`Rôle`},{value:`correlationId`,label:`Corrélation`}];function Q({title:e,description:t,children:n}){return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:e}),t?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:t}):null]}),(0,X.jsx)(`div`,{className:`oc-show__demo`,children:n})]})}function Jt(e){return e===`light`?f():e===`dark`?se():ae()}var Yt=[`primary`,`secondary`,`accent`,`muted`,`chart-1`,`chart-2`];function Xt({tokens:e,mode:t}){let n=e.colors[t];return(0,X.jsx)(`div`,{className:`oc-chart-swatches`,"aria-hidden":!0,children:Yt.map(e=>{let t=n[e];return(0,X.jsx)(`span`,{className:`oc-chart-swatch`,style:t?{background:t}:void 0},e)})})}function Zt({selected:e,title:t,subtitle:n,tokens:r,mode:i,onSelect:a,onExport:o}){return(0,X.jsxs)(`div`,{className:`oc-chart-card-wrap`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Xe(`oc-chart-card`,e&&`oc-chart-card--selected`),"aria-pressed":e,onClick:a,children:[(0,X.jsxs)(`div`,{className:`oc-chart-card__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-card__title`,children:t}),e?(0,X.jsx)(k,{className:`size-4 text-primary`,"aria-hidden":!0}):null]}),r?(0,X.jsx)(Xt,{tokens:r,mode:i}):(0,X.jsx)(`div`,{className:`oc-chart-swatches oc-chart-swatches--native`,"aria-hidden":!0}),(0,X.jsx)(`div`,{className:`oc-chart-card__meta`,children:(0,X.jsx)(`span`,{className:`oc-chart-card__subtitle`,children:n})})]}),o?(0,X.jsx)(j,{type:`button`,variant:`ghost`,size:`icon`,className:`oc-chart-card__export`,onClick:o,"aria-label":C(),title:C(),children:(0,X.jsx)(ut,{className:`size-4`})}):null]})}function Qt({selectedKey:e,resolvedMode:t}){let n=b(D.charts.listMyCharts),r=h(D.charts.setMyChart);async function a(e){try{await r({name:e})}catch{}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Ze()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Ue()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-grid`,children:[(0,X.jsx)(Zt,{selected:e===null,title:O(),subtitle:Me(),tokens:null,mode:t,onSelect:()=>void a(null)}),(n??[]).map(n=>{let r=n.via===`common`?i():n.via===`owner`?le():Ce({group:n.via.group});return(0,X.jsx)(Zt,{selected:e===n.key,title:n.name,subtitle:r,tokens:n.tokens,mode:t,onSelect:()=>void a(n.key),onExport:()=>Gt(n.name,n.tokens)},n.key)})]}),n!==void 0&&n.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:be()}):null]})}function $t(){let e=h(D.charts.importChart),[t,n]=(0,J.useState)(``),[r,i]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,f]=(0,J.useState)(!1),[p,m]=(0,J.useState)(!1);async function g(e){let t=e.target.files?.[0];if(e.target.value=``,t){s(null),f(!1);try{i(await t.text())}catch{s(x())}}}async function v(){if(s(null),f(!1),t.trim()===``){s(u());return}let a;try{a=JSON.parse(r)}catch{s(x());return}m(!0);try{await e({name:t.trim(),tokens:a}),f(!0),n(``),i(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{m(!1)}}return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:_()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:d()})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:oe()}),(0,X.jsx)(V,{value:t,onChange:e=>n(e.target.value),placeholder:ie(),maxLength:60})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:re()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:r,onChange:e=>i(e.target.value),placeholder:ze(),rows:8,spellCheck:!1})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(q,{className:`size-4`}),a(),(0,X.jsx)(`input`,{type:`file`,accept:`application/json,.json`,className:`oc-chart-import__file-input`,onChange:e=>void g(e)})]})}),(0,X.jsx)(j,{size:`sm`,disabled:p,onClick:()=>void v(),children:Be()})]}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null,c?(0,X.jsx)(`p`,{className:`oc-chart-import__ok`,children:l()}):null]})]})}function en({chart:e}){let t=he(D.charts.setChartLogo),n=h(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 d(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 f({mode:e}){let t=s(e),n=s(e===`light`?`dark`:`light`);return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slot`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-mode`,children:e===`light`?ct():at()}),(0,X.jsx)(`span`,{className:`oc-chart-mine__logo-preview`,"data-mode":e,"data-empty":t?void 0:`1`,children:t?(0,X.jsx)(`img`,{src:t,alt:``}):null}),(0,X.jsx)(j,{variant:`outline`,size:`sm`,asChild:!0,children:(0,X.jsxs)(`label`,{className:`oc-chart-import__file`,children:[(0,X.jsx)(q,{className:`size-4`}),t?Fe():we(),(0,X.jsx)(`input`,{type:`file`,accept:`image/*`,className:`oc-chart-import__file-input`,onChange:t=>void l(e,t)})]})}),!t&&n?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void d(e),children:He()}):null,t?(0,X.jsx)(j,{variant:`ghost`,size:`sm`,disabled:r,onClick:()=>void u(e),children:Ie()}):null]})}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:De()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__logo-slots`,children:[(0,X.jsx)(f,{mode:`light`}),(0,X.jsx)(f,{mode:`dark`})]}),r?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Je()}):null,a?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:a}):null]})}function tn({chart:e}){let t=b(D.me.getMe,{host:H}),n=h(D.charts.addChartDomain),r=h(D.charts.removeChartDomain),[i,a]=(0,J.useState)(``),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1);if(t?.role!==`admin`)return null;let u=e.domains??[];async function d(){let t=i.trim();if(t!==``){s(null),l(!0);try{await n({chartKey:e.key,domain:t}),a(``)}catch(e){s(e instanceof Error?e.message:String(e))}finally{l(!1)}}}async function f(t){s(null);try{await r({chartKey:e.key,domain:t})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:tt()}),(0,X.jsxs)(`div`,{className:`oc-chart-mine__domains-body`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__groups`,children:u.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Qe()}):u.map(e=>(0,X.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":We({domain:e}),onClick:()=>void f(e),children:(0,X.jsx)(A,{className:`size-3`})})]},e))}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(V,{value:i,onChange:e=>a(e.target.value),placeholder:Ee(),className:`oc-chart-mine__domains-input`,onKeyDown:e=>{e.key===`Enter`&&d()}}),(0,X.jsx)(j,{variant:`outline`,size:`sm`,disabled:c,onClick:()=>void d(),children:Re()})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:qe()}),o?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:o}):null]})]})}function $(e){let t={...e};return delete t.bpm,JSON.stringify(t,null,2)}function nn({chart:e}){let t=h(D.charts.updateChart),n=h(D.charts.deleteChart),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(e.name),[c,l]=(0,J.useState)(()=>$(e.tokens)),[u,d]=(0,J.useState)(e.tokens.bpm??0),[f,p]=(0,J.useState)(null),[m,g]=(0,J.useState)(!1);function _(){s(e.name),l($(e.tokens)),d(e.tokens.bpm??0),p(null),a(!0)}async function v(){if(e.chartId===void 0)return;p(null);let n;try{n=JSON.parse(c)}catch{p(x());return}if(n&&typeof n==`object`&&!Array.isArray(n)){let e=n;u>0?e.bpm=u:delete e.bpm}g(!0);try{await t({chartId:e.chartId,name:o.trim(),tokens:n}),a(!1)}catch(e){p(e instanceof Error?e.message:String(e))}finally{g(!1)}}async function y(){if(e.chartId!==void 0&&window.confirm(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-mine__row`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-mine__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__name`,children:e.name}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:i?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(j,{variant:`outline`,size:`sm`,onClick:_,children:de()}),(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void y(),children:st()})]})})]}),i?(0,X.jsxs)(`div`,{className:`oc-chart-mine__editor`,children:[(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:r()}),(0,X.jsx)(V,{value:o,onChange:e=>s(e.target.value),maxLength:60})]}),(0,X.jsxs)(`div`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:w()}),(0,X.jsxs)(`div`,{className:`oc-chart-bpm`,children:[(0,X.jsx)(`input`,{type:`range`,className:`oc-chart-bpm__slider`,min:0,max:90,step:5,value:u,onChange:e=>d(Number(e.target.value)),"aria-label":w()}),(0,X.jsx)(`span`,{className:`oc-chart-bpm__value`,children:u===0?$e():`${u} BPM`})]}),(0,X.jsx)(`span`,{className:`oc-show__desc`,children:Ge()})]}),(0,X.jsxs)(`label`,{className:`oc-chart-import__field`,children:[(0,X.jsx)(`span`,{className:`oc-chart-import__label`,children:ce()}),(0,X.jsx)(`textarea`,{className:`oc-chart-import__textarea`,value:c,onChange:e=>l(e.target.value),rows:10,spellCheck:!1})]}),f?(0,X.jsx)(`p`,{className:`oc-chart-import__error`,children:f}):null,(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{size:`sm`,disabled:m,onClick:()=>void v(),children:nt()}),(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>a(!1),children:Ne()})]})]}):null,(0,X.jsx)(en,{chart:e}),(0,X.jsx)(tn,{chart:e})]})}function rn(){let e=b(D.charts.listMyCharts),t=(e??[]).filter(e=>e.via===`owner`);return(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:fe()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ot()})]}),e!==void 0&&t.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:s()}):(0,X.jsx)(`div`,{className:`oc-chart-mine-list`,children:t.map(e=>(0,X.jsx)(nn,{chart:e},e.key))})]})}function an({chart:e,groups:t}){let n=h(D.charts.addChartToGroupPool),r=h(D.charts.removeChartFromGroupPool),i=e.restrictedToGroups,a=e.poolGroups,s=new Set((a??[]).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,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(P,{variant:i?`secondary`:`outline`,className:`oc-chart-avail__state`,children:i?g():e.kind===`custom`&&e.scope===`personal`?E():me()}),e.isGlobalDefault?(0,X.jsx)(P,{variant:`default`,children:ge()}):null]}),(0,X.jsxs)(`div`,{className:`oc-chart-avail__groups`,children:[(0,X.jsx)(`span`,{className:`oc-chart-mine__groups-label`,children:lt()}),(a??[]).map(e=>(0,X.jsxs)(P,{variant:`secondary`,className:`oc-chart-avail__chip`,children:[e.name,(0,X.jsx)(`button`,{type:`button`,className:`oc-chart-avail__chip-x`,"aria-label":ne({group:e.name}),onClick:()=>void u(e.groupId),children:(0,X.jsx)(A,{className:`size-3`})})]},e.groupId)),c.length>0?(0,X.jsxs)(R,{value:``,onValueChange:e=>void l(e),children:[(0,X.jsx)(M,{size:`sm`,className:`w-56`,children:(0,X.jsx)(B,{placeholder:ue()})}),(0,X.jsx)(z,{children:c.map(e=>(0,X.jsx)(L,{value:e._id,children:e.name},e._id))})]}):t.length===0?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:o()}):null]})]})}function on({chart:e}){let t=h(D.charts.promoteChartToCommon),n=h(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(S()))try{await n({chartId:e.chartId})}catch{}}return(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsxs)(`div`,{className:`oc-chart-avail__head`,children:[(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name}),(0,X.jsx)(P,{variant:e.scope===`common`?`outline`:`secondary`,children:e.scope===`common`?ee():E()}),e.ownerLabel?(0,X.jsx)(`span`,{className:`oc-show__desc`,children:v({owner:e.ownerLabel})}):null]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[e.scope===`personal`?(0,X.jsx)(j,{variant:`outline`,size:`sm`,onClick:()=>void r(),children:p()}):null,(0,X.jsx)(j,{variant:`ghost`,size:`sm`,onClick:()=>void i(),children:_e()})]})]})}function sn({defaultThemeMode:e,defaultLocale:t,defaultChartKey:n}){let r=h(D.admin.setDefaultThemeMode),i=h(D.admin.setDefaultLocale),a=h(D.charts.setDefaultChart),o=b(D.charts.listChartsAdmin),s=b(D.groups.listGroups,{}),c=e??`system`,l=t??`fr`;return(0,X.jsxs)(`div`,{className:`oc-appearance-admin`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h2`,{className:`oc-show__title`,children:Te()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Le()})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Se()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:y()})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{variant:n===null?`default`:`outline`,size:`sm`,onClick:()=>void a({name:null}),children:O()}),pt.map(e=>(0,X.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key)),(o??[]).filter(e=>e.kind===`custom`&&e.scope===`common`).map(e=>(0,X.jsx)(j,{variant:n===e.key?`default`:`outline`,size:`sm`,onClick:()=>void a({name:e.key}),children:e.name},e.key))]})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:te()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>!(e.kind===`custom`&&e.scope===`common`)).map(e=>(0,X.jsx)(an,{chart:e,groups:s??[]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:m()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:ve()})]}),(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:(o??[]).filter(e=>e.kind===`builtin`||e.scope===`common`).map(e=>(0,X.jsxs)(`div`,{className:`oc-chart-avail`,children:[(0,X.jsx)(`div`,{className:`oc-chart-avail__head`,children:(0,X.jsx)(`span`,{className:`oc-chart-avail__name`,children:e.name})}),(0,X.jsx)(tn,{chart:e})]},e.key))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:ye()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:xe()})]}),(()=>{let e=(o??[]).filter(e=>e.kind===`custom`);return e.length===0?(0,X.jsx)(`p`,{className:`oc-show__desc`,children:pe()}):(0,X.jsx)(`div`,{className:`oc-chart-avail-list`,children:e.map(e=>(0,X.jsx)(on,{chart:e},e.key))})})()]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ae()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:rt()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:[`light`,`dark`,`system`].map(e=>(0,X.jsx)(j,{variant:c===e?`default`:`outline`,size:`sm`,onClick:()=>void r({mode:e}),children:Jt(e)},e))})]}),(0,X.jsxs)(`section`,{className:`oc-show__section`,children:[(0,X.jsxs)(`div`,{className:`oc-show__heading`,children:[(0,X.jsx)(`h3`,{className:`oc-show__title`,children:Ve()}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:Oe()})]}),(0,X.jsx)(`div`,{className:`oc-show__row`,children:_t().map(e=>(0,X.jsx)(j,{variant:l===e.value?`default`:`outline`,size:`sm`,onClick:()=>void i({locale:e.value}),children:e.label},e.value))}),(0,X.jsx)(`p`,{className:`oc-show__desc`,children:et()})]})]})}function cn(){let e=b(D.me.getMe,{host:H}),t=ft(e?.resolvedThemeMode);return(0,X.jsxs)(`div`,{className:`oc-appearance`,children:[(0,X.jsx)(Qt,{selectedKey:e?.chartKey??null,resolvedMode:t}),(0,X.jsx)($t,{}),(0,X.jsx)(rn,{}),e?.role===`admin`?(0,X.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)(Z),[c,l]=(0,J.useState)(Z),[u,d]=(0,J.useState)(Kt),f=i!==``||o!==Z||c!==Z;function p(){a(``),s(Z),l(Z),d(Kt)}return(0,X.jsxs)(`div`,{className:`oc-show`,children:[(0,X.jsx)(cn,{}),(0,X.jsxs)(`details`,{className:`oc-show__ref`,children:[(0,X.jsx)(`summary`,{className:`oc-show__title`,children:Ke()}),(0,X.jsxs)(Q,{title:`Buttons`,description:`Variants`,children:[(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(j,{variant:`outline`,children:`Outline`}),(0,X.jsx)(j,{variant:`ghost`,children:`Ghost`}),(0,X.jsx)(j,{variant:`destructive`,children:`Destructive`}),(0,X.jsx)(j,{variant:`link`,children:`Link`})]}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(j,{size:`sm`,children:`Small`}),(0,X.jsx)(j,{children:`Default`}),(0,X.jsx)(j,{size:`lg`,children:`Large`}),(0,X.jsx)(j,{size:`icon`,"aria-label":`more`,children:(0,X.jsx)(N,{})}),(0,X.jsx)(j,{disabled:!0,children:`Disabled`})]})]}),(0,X.jsx)(Q,{title:`Badges`,children:(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(P,{children:`Default`}),(0,X.jsx)(P,{variant:`secondary`,children:`Secondary`}),(0,X.jsx)(P,{variant:`outline`,children:`Outline`}),(0,X.jsx)(P,{variant:`destructive`,children:`Destructive`})]})}),(0,X.jsx)(Q,{title:`Inputs & selection`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(V,{placeholder:`Text input…`}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsxs)(R,{value:n,onValueChange:r,children:[(0,X.jsx)(M,{className:`w-56`,children:(0,X.jsx)(B,{placeholder:`Select…`})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(L,{value:`per-user`,children:`per-user (chacun son agent)`}),(0,X.jsx)(L,{value:`shared`,children:`shared (agent commun)`})]})]}),(0,X.jsxs)(`label`,{className:`oc-show__check`,children:[(0,X.jsx)(U,{checked:e,onCheckedChange:e=>t(!!e)}),`Checkbox`]})]})]})}),(0,X.jsx)(Q,{title:`Filtres & plage temporelle`,description:`Barre réutilisable (recherche debouncée + selects rapides à largeur auto + plage façon Grafana) et constructeur de filtre avancé. Câblée dans Users, Groups, Comptes de service, Traces, Anomalies, Audit et KPI.`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsxs)(Ot,{q:i,onQChange:a,searchPlaceholder:`Rechercher (kind, principal, rôle, route…)`,timeRange:u,onTimeRangeChange:d,onReset:p,canReset:f,children:[(0,X.jsxs)(R,{value:o,onValueChange:s,children:[(0,X.jsx)(M,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(L,{value:Z,children:`Toutes directions`}),(0,X.jsx)(L,{value:`inbound`,children:`inbound`}),(0,X.jsx)(L,{value:`outbound`,children:`outbound`}),(0,X.jsx)(L,{value:`internal`,children:`internal`})]})]}),(0,X.jsxs)(R,{value:c,onValueChange:l,children:[(0,X.jsx)(M,{size:`sm`,children:(0,X.jsx)(B,{})}),(0,X.jsxs)(z,{children:[(0,X.jsx)(L,{value:Z,children:`Toutes sévérités`}),(0,X.jsx)(L,{value:`info`,children:`info`}),(0,X.jsx)(L,{value:`warn`,children:`warn`}),(0,X.jsx)(L,{value:`critical`,children:`critical`})]})]})]}),(0,X.jsx)(kt,{fields:qt,onChange:()=>{}}),(0,X.jsxs)(`div`,{className:`oc-show__row`,children:[(0,X.jsx)(`span`,{className:`oc-show__desc`,children:`Sélecteur de plage seul :`}),(0,X.jsx)(Dt,{value:u,onChange:d})]})]})}),(0,X.jsx)(Q,{title:`Dropdown menu`,description:`Row actions / kebab`,children:(0,X.jsxs)(ht,{children:[(0,X.jsx)(mt,{asChild:!0,children:(0,X.jsx)(j,{variant:`outline`,size:`icon`,"aria-label":`Open menu`,children:(0,X.jsx)(N,{})})}),(0,X.jsxs)(gt,{align:`start`,children:[(0,X.jsx)(dt,{children:`Actions`}),(0,X.jsx)(F,{}),(0,X.jsx)(I,{children:`Edit`}),(0,X.jsx)(I,{children:`Duplicate`}),(0,X.jsx)(F,{}),(0,X.jsx)(I,{variant:`destructive`,children:`Delete`})]})]})}),(0,X.jsx)(Q,{title:`Card`,children:(0,X.jsxs)(Ct,{className:`w-80`,children:[(0,X.jsxs)(vt,{children:[(0,X.jsx)(xt,{children:`Instance`}),(0,X.jsx)(St,{children:`Non-secret metadata only.`})]}),(0,X.jsx)(bt,{className:`text-sm text-muted-foreground`,children:`ws://gateway.example.org:18789`}),(0,X.jsxs)(yt,{className:`gap-2`,children:[(0,X.jsx)(j,{size:`sm`,children:`Save`}),(0,X.jsx)(j,{size:`sm`,variant:`ghost`,children:`Cancel`})]})]})}),(0,X.jsx)(Q,{title:`Table`,children:(0,X.jsxs)(Et,{children:[(0,X.jsx)(wt,{children:(0,X.jsxs)(G,{children:[(0,X.jsx)(W,{className:`w-8`,children:(0,X.jsx)(U,{"aria-label":`select all`})}),(0,X.jsx)(W,{children:`Name`}),(0,X.jsx)(W,{children:`Mode`}),(0,X.jsx)(W,{className:`text-right`,children:`Status`}),(0,X.jsx)(W,{className:`w-8`})]})}),(0,X.jsx)(Tt,{children:[{n:`admins`,m:`per-user`,s:`active`},{n:`family`,m:`shared`,s:`active`}].map(e=>(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{children:(0,X.jsx)(U,{"aria-label":`select ${e.n}`})}),(0,X.jsx)(K,{className:`font-medium`,children:e.n}),(0,X.jsx)(K,{children:(0,X.jsx)(P,{variant:`secondary`,children:e.m})}),(0,X.jsx)(K,{className:`text-right`,children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-muted-foreground`,children:[(0,X.jsx)(k,{className:`size-3.5`}),` `,e.s]})}),(0,X.jsx)(K,{children:(0,X.jsx)(j,{variant:`ghost`,size:`icon`,"aria-label":`row actions`,children:(0,X.jsx)(N,{})})})]},e.n))})]})}),(0,X.jsx)(Q,{title:`App fragments`,description:`Chat-specific components`,children:(0,X.jsxs)(`div`,{className:`oc-show__row oc-show__row--col`,children:[(0,X.jsx)(`div`,{className:`oc-msg oc-msg--assistant`,children:(0,X.jsx)(`div`,{className:`oc-msg__body`,children:`Assistant message bubble.`})}),(0,X.jsx)(`div`,{className:`oc-tool oc-tool--completed`,children:(0,X.jsxs)(`div`,{className:`oc-tool__header`,children:[(0,X.jsx)(`span`,{className:`oc-tool__icon`,children:`✓`}),(0,X.jsx)(`span`,{className:`oc-tool__name`,children:`write-file`}),(0,X.jsx)(`span`,{className:`oc-tool__phase`,children:`completed`})]})}),(0,X.jsxs)(`div`,{className:`oc-run-status oc-run-status--streaming`,children:[(0,X.jsx)(`span`,{className:`oc-run-status__dot`}),(0,X.jsx)(`span`,{className:`oc-run-status__label`,children:`Running`})]})]})})]})]})}export{ln as ThemeShowroom};
@@ -1 +0,0 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$n as r,At as i,Bn as a,Bt as o,Fn as s,Ft as c,GR as l,Gn as ee,Hn as u,Ht as d,In as f,It as p,Jn as m,KR as h,Kn as g,LD as _,LR as v,Ln as y,Nt as te,Ot as ne,Pt as re,Qn as b,Rn as x,Td as S,UR as ie,Un as C,Ut as w,Vn as T,Vt as ae,Wn as oe,Xn as se,Xt as ce,Yn as le,Zn as E,ar as ue,er as D,eu as de,gt as fe,ir as pe,jt as O,kt as me,nr as k,nu as A,qn as j,rr as M,t as N,tr as P,zR as F,zn as I,zt as L}from"./api-BASu8PYC.js";import{i as R,n as z,r as he,t as B}from"./tabs-DkJ2Ivbq.js";import{t as V}from"./button-_UzA03A_.js";import{$ as H,$t as U,Et as W,Fn as ge,Jt as _e,Nn as ve,Pn as ye,Q as G,Qt as K,X as q,Xt as be,Yt as xe,Z as J,Zt as Se,en as Ce,et as Y,gn as we,nn as Te,q as Ee,ut as X}from"./index-D02RwoOe.js";/* empty css */var Z=t(e(),1),Q=n(),De=[[`auto`,()=>b()],[`fr-FR`,()=>w()],[`en-US`,()=>d()],[`en-GB`,()=>ae()],[`de-DE`,()=>o()],[`es-ES`,()=>L()]],Oe=[[`0.75`,()=>se()],[`1`,()=>le()],[`1.25`,()=>m()],[`1.5`,()=>j()]],$=0;function ke({instance:e}){let t=l(N.admin.upsertInstanceConfig),n=e.config??{},a={enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0},[o,s]=(0,Z.useState)(a),[c,d]=(0,Z.useState)(`idle`),[f,p]=(0,Z.useState)(!1),[m,h]=(0,Z.useState)(!1),_=ie(N.voice.gatewayTtsPreview);(0,Z.useEffect)(()=>{s({enabled:n.voiceEnabled===!0,engine:n.voiceEngine===`gateway`?`gateway`:`browser`,lang:typeof n.voiceLang==`string`?n.voiceLang:`auto`,rate:typeof n.voiceRate==`number`?String(n.voiceRate):`1`,autoRead:n.voiceAutoRead===!0}),d(`idle`)},[e._id]);let v=o.enabled!==a.enabled||o.engine!==a.engine||o.lang!==a.lang||o.rate!==a.rate||o.autoRead!==a.autoRead;async function y(){d(`saving`);try{let n={...e.config??{}};n.voiceEnabled=o.enabled,o.engine===`gateway`?n.voiceEngine=`gateway`:delete n.voiceEngine,o.lang===`auto`?delete n.voiceLang:n.voiceLang=o.lang;let r=Number.parseFloat(o.rate);!Number.isFinite(r)||r===1?delete n.voiceRate:n.voiceRate=r,o.autoRead?n.voiceAutoRead=!0:delete n.voiceAutoRead,await t({instanceId:e._id,config:n}),d(`idle`)}catch{d(`error`)}}return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(W,{variant:`secondary`,children:e.kind===`hermes`?`Hermes`:`OpenClaw`})]}),(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:o.enabled,onCheckedChange:e=>s({...o,enabled:e===!0}),"aria-label":D()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:D()})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:O()}),(0,Q.jsxs)(q,{value:o.engine,onValueChange:e=>s({...o,engine:e}),disabled:!o.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":O(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsxs)(J,{children:[(0,Q.jsx)(G,{value:`browser`,children:i()}),e.kind===`hermes`?null:(0,Q.jsx)(G,{value:`gateway`,children:me()})]})]})]}),o.engine===`gateway`?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ne()}):null,o.engine===`gateway`?null:(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:r()}),(0,Q.jsxs)(q,{value:o.lang,onValueChange:e=>s({...o,lang:e}),disabled:!o.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":r(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsx)(J,{children:De.map(([e,t])=>(0,Q.jsx)(G,{value:e,children:t()},e))})]})]}),(0,Q.jsxs)(`div`,{className:`oc-voice__row`,children:[(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:E()}),(0,Q.jsxs)(q,{value:o.rate,onValueChange:e=>s({...o,rate:e}),disabled:!o.enabled,children:[(0,Q.jsx)(H,{size:`sm`,"aria-label":E(),children:(0,Q.jsx)(Y,{})}),(0,Q.jsx)(J,{children:Oe.map(([e,t])=>(0,Q.jsx)(G,{value:e,children:t()},e))})]})]}),o.engine===`gateway`?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:o.autoRead,onCheckedChange:e=>s({...o,autoRead:e===!0}),disabled:!o.enabled,"aria-label":g()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:g()})]}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ee()})]}),(0,Q.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,Q.jsx)(V,{size:`sm`,disabled:!v||c===`saving`,onClick:()=>void y(),children:c===`saving`?S():A()}),(0,Q.jsx)(V,{variant:`outline`,size:`sm`,disabled:!o.enabled||f,onClick:()=>{let t=Number.parseFloat(o.rate)||1,n=++$;if(h(!1),U(),K(),o.engine!==`gateway`){Se(u(),{lang:be(o.lang,F()),rate:t});return}p(!0),_({instanceName:e.name,text:u()}).then(({mime:e,audioBase64:r})=>{n===$&&xe(r,e,{rate:t})}).catch(()=>{n===$&&h(!0)}).finally(()=>p(!1))},children:f?S():oe()}),(0,Q.jsx)(V,{variant:`ghost`,size:`sm`,onClick:()=>{$++,p(!1),U(),K()},children:C()})]}),c===`error`||m?(0,Q.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:m?fe():de()}):null]})}function Ae({stt:e}){let t=h(N.me.getMe,{host:Ee}),n=l(N.admin.setFeatureEnabled),r=t?.ui?.featuresEnabled?.voiceInput===!0,i=t?.role===`admin`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:a()}),(0,Q.jsx)(W,{variant:e?`secondary`:`outline`,children:e?f():s()}),(0,Q.jsx)(W,{variant:r?`secondary`:`destructive`,children:r?c():re()})]}),i?(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:e=>void n({key:`voiceInput`,enabled:e===!0}),"aria-label":p()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:p()})]}):null,(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:I()})]})}function je(){let e=h(N.admin.listInstances,{}),t=(0,Z.useMemo)(()=>Ce(),[]),n=(0,Z.useMemo)(()=>_e(),[]),{section:r}=ge({from:`/settings/voice`}),i=ye({from:`/settings/voice`});return(0,Q.jsxs)(`div`,{className:`oc-admin__tab oc-voice`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:ue()}),(0,Q.jsxs)(`div`,{className:`oc-voice__support`,children:[(0,Q.jsx)(W,{variant:t?`secondary`:`destructive`,children:t?pe():M()}),(0,Q.jsx)(W,{variant:n?`secondary`:`destructive`,children:n?k():P()})]}),(0,Q.jsxs)(B,{value:r,onValueChange:e=>void i({search:{section:e},replace:!0}),children:[(0,Q.jsxs)(he,{className:`w-full`,children:[(0,Q.jsxs)(R,{value:`readaloud`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(Te,{size:13,"aria-hidden":!0}),te()]}),(0,Q.jsxs)(R,{value:`dictation`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(we,{size:13,"aria-hidden":!0}),a()]}),(0,Q.jsxs)(R,{value:`talk`,className:`flex-1 gap-1.5`,children:[(0,Q.jsx)(ve,{size:13,"aria-hidden":!0}),x()]})]}),(0,Q.jsx)(z,{value:`readaloud`,children:e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):e.map(e=>(0,Q.jsx)(ke,{instance:e},e._id))}),(0,Q.jsx)(z,{value:`dictation`,children:(0,Q.jsx)(Ae,{stt:n})}),(0,Q.jsxs)(z,{value:`talk`,children:[(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsx)(`header`,{className:`oc-voice__cardhead`,children:(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:x()})}),(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:y()})]}),e===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):e.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:T()}):e.map(e=>(0,Q.jsx)(Me,{instance:e},e._id))]})]})]})}function Me({instance:e}){let t=l(N.admin.upsertInstanceConfig),n=e.config??{},r=n.talkEnabled===!0,i=e.kind===`hermes`;return(0,Q.jsxs)(`section`,{className:`oc-voice__card`,children:[(0,Q.jsxs)(`header`,{className:`oc-voice__cardhead`,children:[(0,Q.jsx)(`span`,{className:`oc-voice__instance`,children:e.name}),(0,Q.jsx)(W,{variant:`secondary`,children:i?`Hermes`:`OpenClaw`})]}),i?(0,Q.jsx)(`p`,{className:`oc-cdefaults__help`,children:ce()}):(0,Q.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,Q.jsx)(X,{checked:r,onCheckedChange:r=>{let i={...n};r===!0?i.talkEnabled=!0:delete i.talkEnabled,t({instanceId:e._id,config:i})},"aria-label":_()}),(0,Q.jsx)(`span`,{className:`oc-cdefaults__label`,children:_()})]})]})}export{je as VoiceTab};