@lacneu/atrium 0.104.0 → 0.104.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 (142) hide show
  1. package/dist/assets/AccessTab-D8xdWzT5.js +1 -0
  2. package/dist/assets/{AdminSettings-BdVeeUB1.js → AdminSettings-CtNcFhMz.js} +1 -1
  3. package/dist/assets/{AdvancedFilter-B4QfxxEB.js → AdvancedFilter-Cod8SSd6.js} +1 -1
  4. package/dist/assets/AgentFilesTab-Dfkkm3Fw.js +3 -0
  5. package/dist/assets/AnomaliesTab-DlZ5M2UC.js +1 -0
  6. package/dist/assets/AuditTab-Dh6gO6j5.js +1 -0
  7. package/dist/assets/BridgeTab-Bnu9R5N4.js +1 -0
  8. package/dist/assets/ChatDefaultsTab-CxmayDqi.js +1 -0
  9. package/dist/assets/{ConfirmDialog-BmOX8o6F.js → ConfirmDialog-B7k0wvSi.js} +1 -1
  10. package/dist/assets/{DataTableShell-BTk71L7O.js → DataTableShell-DvtkASQG.js} +1 -1
  11. package/dist/assets/DeletedChatsTab-CnaK-AH0.js +1 -0
  12. package/dist/assets/{DetailChips-BU-SQfjj.js → DetailChips-DDAtgnjA.js} +1 -1
  13. package/dist/assets/EntitySheet-DRzkWKlH.js +1 -0
  14. package/dist/assets/FeedbacksTab-D4LKaB_2.js +1 -0
  15. package/dist/assets/{FieldLabel-Wb5bwK7r.js → FieldLabel-imj_Z0rZ.js} +1 -1
  16. package/dist/assets/FilesTab-D3XWSI2t.js +1 -0
  17. package/dist/assets/{FilterBar-D2w0wWnm.js → FilterBar-DCCuFxDn.js} +1 -1
  18. package/dist/assets/GroupsTab-DbayDYbZ.js +1 -0
  19. package/dist/assets/InstancesTab-031fn2Jt.js +1 -0
  20. package/dist/assets/IntegrationsTab-1whhDsmk.js +1 -0
  21. package/dist/assets/KnobRow-D6kXWvVI.js +1 -0
  22. package/dist/assets/KpiTab-2Vk6EtCf.js +1 -0
  23. package/dist/assets/PreferencesTab-B5h49bYq.js +1 -0
  24. package/dist/assets/ProjectPage-BNKL-iOz.js +1 -0
  25. package/dist/assets/PromptInjectionsTab-Bmn1iSpB.js +4 -0
  26. package/dist/assets/RolesTab-DHxLatAl.js +1 -0
  27. package/dist/assets/ScheduledTab-NHSyQ677.js +1 -0
  28. package/dist/assets/ServiceAccountsTab-CKV8crhK.js +1 -0
  29. package/dist/assets/SubAgentReportsTab-BWfXOTck.js +1 -0
  30. package/dist/assets/ThemeShowroom-Do9I3hrR.js +1 -0
  31. package/dist/assets/{TimeRangePicker-BvcqBpnq.js → TimeRangePicker-BZtw1JkM.js} +1 -1
  32. package/dist/assets/{TimezoneCombobox-BUC66FuM.js → TimezoneCombobox-CeRN4N3z.js} +1 -1
  33. package/dist/assets/TracesTab-BNWFPad2.js +1 -0
  34. package/dist/assets/TrashTab-D5irFeF0.js +1 -0
  35. package/dist/assets/UsersTab-CHs3CRev.js +1 -0
  36. package/dist/assets/VoiceTab-DRvjgMdZ.js +1 -0
  37. package/dist/assets/{alert-dialog-BwvaE8oD.js → alert-dialog-BcJMHbhI.js} +1 -1
  38. package/dist/assets/{api-jG5Fwsg4.js → api-CWqdeSbN.js} +5 -5
  39. package/dist/assets/{badge-CSm2xaYH.js → badge-ChMMFtuW.js} +1 -1
  40. package/dist/assets/{button-sV7hIR3f.js → button-C_rIPtCv.js} +1 -1
  41. package/dist/assets/{card-i1bbFYFv.js → card-BV8NO76j.js} +1 -1
  42. package/dist/assets/check-DdmANHSb.js +1 -0
  43. package/dist/assets/{checkbox-U99HMqP3.js → checkbox-DPxJTQjc.js} +1 -1
  44. package/dist/assets/chevron-left-ByEQraEh.js +1 -0
  45. package/dist/assets/chevron-right-DMqzlhWH.js +1 -0
  46. package/dist/assets/chevron-up-B3KYmtzo.js +1 -0
  47. package/dist/assets/chevrons-up-down-CITEfz7_.js +1 -0
  48. package/dist/assets/{compatView-Cqu0P9sx.js → compatView-Cz5KNXa-.js} +1 -1
  49. package/dist/assets/convexApi-G20_TNBS.js +1 -0
  50. package/dist/assets/{copy-BIRdG3Nl.js → copy-DbstFM9Q.js} +1 -1
  51. package/dist/assets/{cronDescribe-D9eP5CDy.js → cronDescribe-CkiSvbCK.js} +1 -1
  52. package/dist/assets/{deliveryRecorder-DEtCAEff.js → deliveryRecorder-B_kVKMkR.js} +1 -1
  53. package/dist/assets/{dialog-Bpoyy7pR.js → dialog-CPAskUwF.js} +1 -1
  54. package/dist/assets/dispatchErrorInfo-7H2cJGwt.js +1 -0
  55. package/dist/assets/{dist-D7Oplune.js → dist-BjZo0sql.js} +1 -1
  56. package/dist/assets/{dist-ChYvHRlL.js → dist-Bu9sqVcp.js} +1 -1
  57. package/dist/assets/{dist-t45SSvfU.js → dist-CYh9BuQS.js} +1 -1
  58. package/dist/assets/{dist-Bxf4XoMW.js → dist-CzmY6YrA.js} +1 -1
  59. package/dist/assets/{dist-B9q2nlqC.js → dist-Uf18yR_a.js} +1 -1
  60. package/dist/assets/{download-DQYw1N-_.js → download-BaebAe6Z.js} +1 -1
  61. package/dist/assets/{dropdown-menu-yCbwljS-.js → dropdown-menu-BVKVjups.js} +1 -1
  62. package/dist/assets/{eye-CZuTJsZX.js → eye-LggiM6Z5.js} +1 -1
  63. package/dist/assets/{format-BQaxlN43.js → format-AQELUhPa.js} +1 -1
  64. package/dist/assets/{groupManageView-BcbLXWZ4.js → groupManageView-DC3eSLA1.js} +1 -1
  65. package/dist/assets/index-DLjKxzJ_.css +1 -0
  66. package/dist/assets/index-Dq26_OeV.js +158 -0
  67. package/dist/assets/{input-DReDYsos.js → input-CSZu-bVE.js} +1 -1
  68. package/dist/assets/{list-kKcfLqpz.js → list-obbqPBzD.js} +1 -1
  69. package/dist/assets/loader-circle-BqKiW3X9.js +1 -0
  70. package/dist/assets/{lock-DJQnxN_w.js → lock-BlVhOk85.js} +1 -1
  71. package/dist/assets/{pencil-C_IJUeJn.js → pencil-K7SBkvHL.js} +1 -1
  72. package/dist/assets/plus-DTL4K-j9.js +1 -0
  73. package/dist/assets/{popover-BcL-AsC2.js → popover-C-Y_Yoco.js} +1 -1
  74. package/dist/assets/roleDescriptions-DHny6e80.js +1 -0
  75. package/dist/assets/rotate-ccw-CvefWwHW.js +1 -0
  76. package/dist/assets/{search-CGco_tlI.js → search-Dz6sLH0-.js} +1 -1
  77. package/dist/assets/{select-DGKgMOlh.js → select-CjcMQhwm.js} +1 -1
  78. package/dist/assets/{server-ClLFUY_D.js → server-DcInl3Nh.js} +1 -1
  79. package/dist/assets/{speech-DO_eJ8Aq.js → speech-ehUcmGCg.js} +1 -1
  80. package/dist/assets/{star-B6yMf_Hc.js → star-5ysDlx3k.js} +1 -1
  81. package/dist/assets/{switch-D-QGMGm7.js → switch--NPD3Vp0.js} +1 -1
  82. package/dist/assets/{table-CIrFKiPM.js → table-rRR3TpMc.js} +1 -1
  83. package/dist/assets/{tabs-BWfAdnjK.js → tabs-B8emuY1B.js} +1 -1
  84. package/dist/assets/toast-C_YfUacM.js +1 -0
  85. package/dist/assets/{tooltip-CobtYK4c.js → tooltip-Ct0TGxtk.js} +1 -1
  86. package/dist/assets/{trash-2-UxV-pTWt.js → trash-2-xhtrhYsd.js} +1 -1
  87. package/dist/assets/trashPage-3suR6eIy.js +1 -0
  88. package/dist/assets/trashView-CwUC01r_.js +1 -0
  89. package/dist/assets/{triangle-alert-BMryltpr.js → triangle-alert-DoL9TI6v.js} +1 -1
  90. package/dist/assets/{usageView-CKi8uUZb.js → usageView-BuRtXekW.js} +1 -1
  91. package/dist/assets/{useChart-BE4pYQJh.js → useChart-bV4rotdu.js} +1 -1
  92. package/dist/assets/{useFontScale-DCa0acMC.js → useFontScale-DiSkEM6I.js} +1 -1
  93. package/dist/assets/{useStartNewChat-BatYRWH7.js → useStartNewChat-8wVLrYnZ.js} +2 -2
  94. package/dist/assets/{use_paginated_query-imV3AXlW.js → use_paginated_query-CebdO_HQ.js} +1 -1
  95. package/dist/assets/{users-CBI99oGw.js → users-CRbE186D.js} +1 -1
  96. package/dist/assets/x-CcIT4ync.js +1 -0
  97. package/dist/index.html +54 -54
  98. package/package.json +1 -1
  99. package/dist/assets/AccessTab-Bk4_F0iH.js +0 -1
  100. package/dist/assets/AgentFilesTab-Dlm2lBii.js +0 -3
  101. package/dist/assets/AnomaliesTab-D_QuI8BU.js +0 -1
  102. package/dist/assets/AuditTab-DOfKzC0D.js +0 -1
  103. package/dist/assets/BridgeTab-OC_GNU22.js +0 -1
  104. package/dist/assets/ChatDefaultsTab-BeTKiTFl.js +0 -1
  105. package/dist/assets/DeletedChatsTab-BCD6pwBJ.js +0 -1
  106. package/dist/assets/EntitySheet-BXEY6TCb.js +0 -1
  107. package/dist/assets/FeedbacksTab-Ch0Og-WD.js +0 -1
  108. package/dist/assets/FilesTab-C6xs9TIo.js +0 -1
  109. package/dist/assets/GroupsTab-Dktghl12.js +0 -1
  110. package/dist/assets/InstancesTab-B_jY-L5V.js +0 -1
  111. package/dist/assets/IntegrationsTab-CA10qkLR.js +0 -1
  112. package/dist/assets/KnobRow-DsPgcIxU.js +0 -1
  113. package/dist/assets/KpiTab-DN2VV-KL.js +0 -1
  114. package/dist/assets/PreferencesTab-DCUtb7jt.js +0 -1
  115. package/dist/assets/ProjectPage-CZbKzufX.js +0 -1
  116. package/dist/assets/PromptInjectionsTab-D-qkRO-x.js +0 -4
  117. package/dist/assets/RolesTab-B-kY1GSh.js +0 -1
  118. package/dist/assets/ScheduledTab-C3lqr_Wn.js +0 -1
  119. package/dist/assets/ServiceAccountsTab-4Tcuxr0L.js +0 -1
  120. package/dist/assets/SubAgentReportsTab-BvaMpkUp.js +0 -1
  121. package/dist/assets/ThemeShowroom-BNUhcoUx.js +0 -1
  122. package/dist/assets/TracesTab-CmHSn4oj.js +0 -1
  123. package/dist/assets/TrashTab-CCNS2Ybn.js +0 -1
  124. package/dist/assets/UsersTab-B-H2pRkF.js +0 -1
  125. package/dist/assets/VoiceTab-C4f9SFZl.js +0 -1
  126. package/dist/assets/check-MG02lA-U.js +0 -1
  127. package/dist/assets/chevron-left-cmPkj5_M.js +0 -1
  128. package/dist/assets/chevron-right-DbysoSJS.js +0 -1
  129. package/dist/assets/chevron-up-DQBDpk9Z.js +0 -1
  130. package/dist/assets/chevrons-up-down-3woN2nFd.js +0 -1
  131. package/dist/assets/convexApi-DeaVGrsr.js +0 -1
  132. package/dist/assets/dispatchErrorInfo-DBq1hdag.js +0 -1
  133. package/dist/assets/index-CHdY282S.css +0 -1
  134. package/dist/assets/index-CVhaNoJz.js +0 -158
  135. package/dist/assets/loader-circle-_HV4tchJ.js +0 -1
  136. package/dist/assets/plus-A35Qzur2.js +0 -1
  137. package/dist/assets/roleDescriptions-D-rhX1-Q.js +0 -1
  138. package/dist/assets/rotate-ccw-XgdDTtI8.js +0 -1
  139. package/dist/assets/toast-daONdZpX.js +0 -1
  140. package/dist/assets/trashPage-CFUn9bkp.js +0 -1
  141. package/dist/assets/trashView-CrjCfgVT.js +0 -1
  142. package/dist/assets/x-TiVTngrx.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$S as r,QS as i,XS as a,YS as o,ZS as s,aC as c,bQ as l,cC as u,eC as d,iC as f,lC as p,lQ as m,nC as h,oC as g,rC as _,sC as v,t as y,tC as b}from"./api-CWqdeSbN.js";import{a as x,i as S,n as C,r as w,t as T}from"./select-CjcMQhwm.js";import"./convexApi-G20_TNBS.js";import{t as E}from"./badge-ChMMFtuW.js";var D=t(e(),1);function O(e){return e===`user`?r():e===`all`?i():s({group:e.group})}function k(e){return e===`common`?a():e===`owner`?o():s({group:e.group})}var A=n();function j(e){return e.name||e.email||e.userId.slice(0,8)}function M(){let e=l(y.admin.listUsers,{}),[t,n]=(0,D.useState)(``),r=l(y.introspect.introspectUser,t?{userId:t}:`skip`);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:p()}),(0,A.jsxs)(T,{value:t,onValueChange:n,children:[(0,A.jsx)(S,{size:`sm`,"aria-label":u(),children:(0,A.jsx)(x,{placeholder:u()})}),(0,A.jsx)(C,{children:(e??[]).map(e=>(0,A.jsx)(w,{value:e.userId,children:j(e)},e._id))})]}),t===``?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:v()}):r===void 0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:m()}):(0,A.jsxs)(`div`,{className:`oc-introspect`,children:[(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:g()}),(0,A.jsxs)(`div`,{className:`oc-introspect__id`,children:[(0,A.jsx)(`strong`,{children:r.user.label}),(0,A.jsx)(E,{variant:`secondary`,children:r.role})]})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:c()}),r.groups.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.groups.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e.name},e.groupId))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:f()}),r.agents.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.agents.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.displayName||e.agentId}),e.isDefault?(0,A.jsx)(E,{variant:`default`,children:d()}):null,(0,A.jsx)(E,{variant:`outline`,children:O(e.via)}),(0,A.jsx)(E,{variant:`secondary`,children:e.state})]},`${e.instanceName} ${e.agentId}`))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:_()}),r.charts.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`ul`,{className:`oc-introspect__list`,children:r.charts.map(e=>(0,A.jsxs)(`li`,{className:`oc-introspect__row`,children:[(0,A.jsx)(`span`,{className:`oc-introspect__name`,children:e.name}),(0,A.jsx)(E,{variant:`outline`,children:k(e.via)})]},e.key))})]}),(0,A.jsxs)(`section`,{className:`oc-introspect__section`,children:[(0,A.jsx)(`h3`,{className:`oc-introspect__title`,children:h()}),r.permissions.length===0?(0,A.jsx)(`p`,{className:`oc-admin__hint`,children:b()}):(0,A.jsx)(`div`,{className:`oc-introspect__chips`,children:r.permissions.map(e=>(0,A.jsx)(E,{variant:`secondary`,children:e},e))})]})]})]})}export{M as AccessTab};
@@ -1 +1 @@
1
- import{$D as e,KX as t,MJ as n,Ny as r,QD as i,Rg as a,_C as o,ad as s,bC as c,cC as l,dC as u,eQ as d,fC as f,gC as p,hC as m,kZ as h,lC as g,mC as _,ny as v,pC as y,pj as b,uC as x,vC as S,yC as C}from"./api-jG5Fwsg4.js";var w=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`,`trash`,`deletedChats`],T=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`,`trash`,`deletedChats`],E={users:()=>c(),groups:()=>g(),instances:()=>C(),bridge:()=>S(),injections:()=>b(),serviceAccounts:()=>o(),roles:()=>p(),access:()=>l(),traces:()=>m(),kpi:()=>_(),anomalies:()=>y(),files:()=>h(),scheduled:()=>t(),agentFiles:()=>r(),preferences:()=>d(),integrations:()=>f(),theme:()=>n(),chatDefaults:()=>v(),audit:()=>u(),feedbacks:()=>x(),subagentReports:()=>a(),voice:()=>s(),trash:()=>e(),deletedChats:()=>i()},D={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`,trash:`admin.manage`,deletedChats:`chats.read`},O=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function k(e){let t=new Set(e);return w.filter(e=>t.has(D[e]))}function A(e){return`/settings/${e}`}function j(e){let t=e.split(`/`)[2];return w.includes(t)?t:void 0}var M={uiprefs:`preferences`};export{E as a,j as c,w as i,k as l,T as n,D as o,M as r,A as s,O as t};
1
+ import{Bg as e,Fy as t,JX as n,PJ as r,SC as i,_C as a,bC as o,dC as s,eO as c,fC as l,gC as u,hC as d,hj as f,iy as p,jZ as m,mC as h,nQ as g,pC as _,sd as v,tO as y,uC as b,vC as x,xC as S,yC as C}from"./api-CWqdeSbN.js";var w=[`users`,`groups`,`instances`,`bridge`,`injections`,`serviceAccounts`,`roles`,`access`,`traces`,`kpi`,`anomalies`,`files`,`scheduled`,`agentFiles`,`preferences`,`integrations`,`theme`,`chatDefaults`,`audit`,`feedbacks`,`subagentReports`,`voice`,`trash`,`deletedChats`],T=[`groups`,`access`,`roles`,`integrations`,`instances`,`injections`,`theme`,`feedbacks`,`subagentReports`,`files`,`scheduled`,`agentFiles`,`preferences`,`chatDefaults`,`trash`,`deletedChats`],E={users:()=>i(),groups:()=>s(),instances:()=>S(),bridge:()=>o(),injections:()=>f(),serviceAccounts:()=>C(),roles:()=>x(),access:()=>b(),traces:()=>a(),kpi:()=>u(),anomalies:()=>d(),files:()=>m(),scheduled:()=>n(),agentFiles:()=>t(),preferences:()=>g(),integrations:()=>h(),theme:()=>r(),chatDefaults:()=>p(),audit:()=>_(),feedbacks:()=>l(),subagentReports:()=>e(),voice:()=>v(),trash:()=>y(),deletedChats:()=>c()},D={users:`admin.manage`,groups:`groups.manage`,instances:`admin.manage`,bridge:`bridge.read`,injections:`admin.manage`,serviceAccounts:`admin.manage`,roles:`admin.manage`,access:`admin.manage`,traces:`traces.read`,kpi:`kpi.read`,anomalies:`anomalies.read`,files:`chats.read`,scheduled:`chats.read`,agentFiles:`agents.files.read`,preferences:`chats.read`,integrations:`admin.manage`,theme:`chats.read`,chatDefaults:`admin.manage`,audit:`admin.manage`,feedbacks:`admin.manage`,subagentReports:`admin.manage`,voice:`admin.manage`,trash:`admin.manage`,deletedChats:`chats.read`},O=[`traces`,`kpi`,`anomalies`,`bridge`,`agentFiles`,`groups`];function k(e){let t=new Set(e);return w.filter(e=>t.has(D[e]))}function A(e){return`/settings/${e}`}function j(e){let t=e.split(`/`)[2];return w.includes(t)?t:void 0}var M={uiprefs:`preferences`};export{E as a,j as c,w as i,k as l,T as n,D as o,M as r,A as s,O as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,MT as i,NT as a,OT as o,PT as s,jT as c,kT as l}from"./api-jG5Fwsg4.js";import{r as u}from"./dist-Bxf4XoMW.js";import{t as d}from"./plus-A35Qzur2.js";import{t as f}from"./x-TiVTngrx.js";import{a as p,i as m,n as h,r as g,t as _}from"./select-DGKgMOlh.js";import{t as v}from"./button-sV7hIR3f.js";import{t as y}from"./input-DReDYsos.js";import{r as b}from"./TimeRangePicker-BvcqBpnq.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:s()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let s=(0,x.useRef)(t),w=!!(s.current&&s.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(s.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),a(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:i()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:c()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(_,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:r()}),(0,S.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),onClick:()=>P(t.id),children:(0,S.jsx)(f,{})})]},t.id))}),(0,S.jsxs)(v,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(d,{}),o()]})]}):null]})}export{D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AT as r,FT as i,IT as a,MT as o,NT as s,PT as c,jT as l}from"./api-CWqdeSbN.js";import{r as u}from"./dist-CzmY6YrA.js";import{t as d}from"./plus-DTL4K-j9.js";import{t as f}from"./x-CcIT4ync.js";import{a as p,i as m,n as h,r as g,t as _}from"./select-CjcMQhwm.js";import{t as v}from"./button-C_rIPtCv.js";import{t as y}from"./input-CSZu-bVE.js";import{r as b}from"./TimeRangePicker-BZtw1JkM.js";var x=t(e(),1),S=n(),C=[{value:`eq`,label:`=`},{value:`neq`,label:`≠`},{value:`contains`,label:a()},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`}],w=1;function T(){return{id:w++,field:``,op:`eq`,value:``}}function E(e){return e.map(e=>({id:w++,field:e.field,op:e.op,value:String(e.value)}))}function D({fields:e,seed:t,onChange:n}){let a=(0,x.useRef)(t),w=!!(a.current&&a.current.length>0),[D,O]=(0,x.useState)(w),[k,A]=(0,x.useState)(()=>w?E(a.current):[]);function j(e){n(e.filter(e=>e.field!==``&&e.value!==``).map(e=>({field:e.field,op:e.op,value:b(e.value)})))}function M(e,t){let n=k.map(n=>n.id===e?{...n,...t}:n);A(n),j(n)}function N(){A(e=>[...e,T()])}function P(e){let t=k.filter(t=>t.id!==e);A(t),j(t)}let F=k.filter(e=>e.field!==``&&e.value!==``).length;return(0,S.jsxs)(`div`,{className:`oc-advfilter`,children:[(0,S.jsxs)(`button`,{type:`button`,className:`oc-advfilter__toggle`,"aria-expanded":D,onClick:()=>O(e=>!e),children:[(0,S.jsx)(u,{className:`oc-advfilter__chevron`+(D?` is-open`:``),"aria-hidden":!0}),i(),F>0?(0,S.jsx)(`span`,{className:`oc-advfilter__count`,children:F}):null]}),D?(0,S.jsxs)(`div`,{className:`oc-advfilter__body`,children:[k.length===0?(0,S.jsx)(`p`,{className:`oc-admin__hint`,children:c()}):(0,S.jsx)(`ul`,{className:`oc-advfilter__rows`,children:k.map(t=>(0,S.jsxs)(`li`,{className:`oc-advfilter__row`,children:[(0,S.jsxs)(_,{value:t.field||void 0,onValueChange:e=>M(t.id,{field:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-40`,children:(0,S.jsx)(p,{placeholder:s()})}),(0,S.jsx)(h,{children:e.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsxs)(_,{value:t.op,onValueChange:e=>M(t.id,{op:e}),children:[(0,S.jsx)(m,{size:`sm`,className:`w-28`,children:(0,S.jsx)(p,{})}),(0,S.jsx)(h,{children:C.map(e=>(0,S.jsx)(g,{value:e.value,children:e.label},e.value))})]}),(0,S.jsx)(y,{className:`oc-advfilter__value`,value:t.value,onChange:e=>M(t.id,{value:e.target.value}),placeholder:o()}),(0,S.jsx)(v,{variant:`ghost`,size:`icon-sm`,"aria-label":l(),onClick:()=>P(t.id),children:(0,S.jsx)(f,{})})]},t.id))}),(0,S.jsxs)(v,{variant:`outline`,size:`sm`,className:`oc-advfilter__add`,onClick:N,children:[(0,S.jsx)(d,{}),r()]})]}):null]})}export{D as t};
@@ -0,0 +1,3 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$f as r,$p as i,Ay as a,Bp as o,Cy as s,Dy as c,Ey as l,Fp as u,Gp as d,Hp as f,Ip as p,Jp as m,Kp as h,Lp as g,My as _,Np as v,Ny as y,Oy as b,Pp as x,Py as S,Qf as C,Qp as w,Rp as T,Sy as E,Ty as D,Up as O,Vp as k,Wp as ee,Xp as te,Yp as A,Zp as j,_Q as M,_y as N,ay as P,bQ as F,bb as I,by as ne,cy as re,dy as ie,ep as ae,fQ as L,fy as R,gy as z,hy as B,ip as oe,jy as se,ky as ce,lQ as V,ly as le,my as H,np as U,oy as W,py as ue,qp as de,rp as fe,sy as pe,t as G,tp as me,uy as he,vU as ge,vb as _e,vy as ve,wy as ye,xy as be,yQ as xe,yc as Se,yy as Ce,zp as we}from"./api-CWqdeSbN.js";import{t as K}from"./triangle-alert-DoL9TI6v.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./select-CjcMQhwm.js";import{a as Ae,c as je,i as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le}from"./alert-dialog-BcJMHbhI.js";import{t as q}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{r as J}from"./toast-C_YfUacM.js";import{t as Re}from"./badge-ChMMFtuW.js";import{a as ze,i as Y,n as Be,o as Ve,r as He,t as Ue}from"./dialog-CPAskUwF.js";import{t as We}from"./appHost-CH3EGcJw.js";import{n as Ge}from"./capabilities-CASxhKEd.js";import{r as Ke,t as qe}from"./measureClone-CHN0WNEY.js";import{n as Je,t as Ye}from"./curation-CQksaIbm.js";import{a as Xe}from"./compatView-Cz5KNXa-.js";/* empty css */var X=t(e(),1),Ze=2e4,Qe=6e4;function $e(e){return typeof e!=`number`||e<=0?0:Math.round(e/Ze*100)}function et(e){return e<=0?0:Math.round(e/Qe*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 tt(e){return e.reduce((e,t)=>e+(typeof t.size==`number`&&t.size>0?t.size:0),0)}var nt=3;function rt(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<nt&&a.push(e)):t>0&&(i+=t,o.length<nt&&o.push(e));return{added:r,removed:i,sampleAdded:a,sampleRemoved:o}}function it(e){return(e instanceof Error?e.message:String(e)).includes(`DASHBOARD_NOT_DEPLOYED`)}function at(e){return e instanceof Error?e.message.includes(`conflict:`):String(e).includes(`conflict:`)}var Q=n(),$=e=>`${e.instanceName}::${e.agentId}`;function ot(){let e=F(G.me.getMe,{host:We}),t=e?.role===`admin`,n=(e?.permissions??[]).includes(`bridge.read`),r=F(G.admin.listInstances,e!==void 0&&t?{}:`skip`),[i,o]=(0,X.useState)(null);(0,X.useEffect)(()=>{!t||!r||r.length===0||(!i||!r.some(e=>e.name===i))&&o(r[0].name)},[t,r,i]);let u=F(G.agents.listAgentsForInstance,t&&i?{instanceName:i}:`skip`),d=F(G.agents.listMyAgents,e!==void 0&&!t?{}:`skip`),f=(0,X.useMemo)(()=>{if(e!==void 0){if(t)return i===null||u===void 0?r!==void 0&&r.length===0?[]:void 0:u.agents.map(e=>({instanceName:i,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,i,u,r,d]),[p,h]=(0,X.useState)(null);(0,X.useEffect)(()=>{!f||f.length===0||(!p||!f.some(e=>$(e)===p))&&h($(f[0]))},[f,p]);let g=f?.find(e=>$(e)===p)??null,v=M(G.agentFiles.listAgentFiles),[x,C]=(0,X.useState)({status:`idle`}),w=g?.instanceName??null,T=g?.agentId??null,O=F(G.compat.forInstance,n&&w!==null?{instanceName:w}:`skip`),k=n&&w!==null?Ge(O,`agentFiles`):null,ee=k===null?!1:k===`loading`?null:k.blocked,j=(0,X.useCallback)(async()=>{if(!(w===null||T===null)){C({status:`loading`});try{let e=await v({instanceName:w,agentId:T});C({status:`done`,files:e.files})}catch(e){C({status:`error`,dashboardAbsent:it(e)})}}},[v,w,T]);(0,X.useEffect)(()=>{ee===!1&&j()},[j,ee]);let[N,P]=(0,X.useState)(null),I=F(G.agentFileCuration.listCurations,t&&w!==null&&T!==null?{instanceName:w,agentId:T}:`skip`),ne=F(G.agentFileCuration.curationSettings,t&&w!==null?{instanceName:w}:`skip`),re=M(G.agentFileCuration.requestCuration),[ie,ae]=(0,X.useState)(null),[R,z]=(0,X.useState)(null),{toast:B}=J(),oe=(0,X.useMemo)(()=>{let e=new Map;for(let t of I??[])e.has(t.name)||e.set(t.name,t);return e},[I]),le=(0,X.useCallback)(async e=>{if(!(w===null||T===null)){ae(e);try{let t=await re({instanceName:w,agentId:T,name:e,trigger:`manual`});t.ok?B({title:te(),variant:`success`}):B({title:A({reason:t.reason??`unknown`}),variant:`error`})}catch{B({title:m(),variant:`error`})}finally{ae(null)}}},[re,w,T,B]),H=L(),U=(0,X.useMemo)(()=>new Intl.NumberFormat(H,{maximumFractionDigits:0}),[H]),W=(0,X.useRef)(null),ue=Ke(()=>{let e=W.current;if(e===null)return null;let[t]=qe(e,[e=>e.setAttribute(`data-layout`,`line`)],`oc-afiles__measure`);return{available:e.clientWidth,required:[t]}},()=>[W.current],[x,H,t]);return e===void 0||f===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):(0,Q.jsxs)(`div`,{className:`oc-afiles`,children:[(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,Q.jsxs)(`div`,{className:`oc-afiles__picker`,children:[t&&(r?.length??0)>1?(0,Q.jsxs)(ke,{value:i??``,onValueChange:e=>o(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":y(),children:(0,Q.jsx)(Te,{})}),(0,Q.jsx)(De,{children:(r??[]).map(e=>(0,Q.jsx)(Oe,{value:e.name,children:e.name},e.name))})]}):null,f.length>0?(0,Q.jsxs)(ke,{value:p??``,onValueChange:e=>h(e),children:[(0,Q.jsx)(Ee,{size:`sm`,"aria-label":_(),children:(0,Q.jsx)(Te,{})}),(0,Q.jsx)(De,{children:f.map(e=>(0,Q.jsx)(Oe,{value:$(e),children:e.label},$(e)))})]}):(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:se()})]}),g===null?null:k===`loading`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):k!==null&&k.blocked?(0,Q.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,Q.jsx)(K,{size:14,"aria-hidden":!0}),` `,Xe(k.gatewayVersion,k.provider)]}):x.status===`loading`||x.status===`idle`?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):x.status===`error`?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[x.dashboardAbsent?Se():ce(),` `,!x.dashboardAbsent&&(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void j(),children:_e()})]}):x.files.length===0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{ref:W,className:`oc-afiles__list`,"data-layout":ue===0?`line`:`two-level`,children:x.files.map(e=>{let n=$e(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)(Re,{variant:`outline`,children:b()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`oc-afiles__size`,children:c({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:l({pct:U.format(n)})}),r?(0,Q.jsx)(K,{size:14,className:`oc-afiles__warn`,"aria-label":D()}):(0,Q.jsx)(`span`,{className:`oc-afiles__warn-slot`,"aria-hidden":!0})]}),(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__open`,onClick:()=>P(e),children:t?s():E()}),t&&!e.missing?(0,Q.jsx)(st,{curatable:Ye.includes(e.name),size:e.size??0,budget:ne?.budgetChars??null,enabled:ne?.enabled??!1,curation:oe.get(e.name)??null,inFlight:ie===e.name,onCurate:()=>void le(e.name),onReview:e=>z(e)}):null]},e.name)})}),(0,Q.jsx)(`p`,{className:`oc-afiles__budget`,children:ye({used:Z(tt(x.files),H),total:Z(Qe,H),pct:U.format(et(tt(x.files)))})})]}),N&&g?(0,Q.jsx)(ct,{instanceName:g.instanceName,agentId:g.agentId,name:N.name,isAdmin:t,onClose:()=>P(null),onSaved:()=>void j()}):null,R?(0,Q.jsx)(lt,{curationId:R,onClose:()=>z(null),onApplied:()=>{z(null),j()}}):null]})}function st({curatable:e,size:t,budget:n,enabled:r,curation:a,inFlight:o,onCurate:s,onReview:c}){return a?.status===`proposed`?(0,Q.jsx)(q,{variant:`default`,size:`sm`,className:`oc-afiles__curate`,onClick:()=>c(a._id),children:w()}):o||a?.status===`dispatched`||a?.status===`applying`?(0,Q.jsx)(Re,{variant:`outline`,className:`oc-afiles__curate-status`,children:j()}):e&&r&&n!==null&&Je(t,n)?(0,Q.jsx)(q,{variant:`outline`,size:`sm`,className:`oc-afiles__curate`,onClick:s,children:i()}):null}function ct({instanceName:e,agentId:t,name:n,isAdmin:r,onClose:i,onSaved:a}){let o=M(G.agentFiles.getAgentFile),s=M(G.agentFiles.setAgentFile),c=J(),[l,u]=(0,X.useState)(null),[d,f]=(0,X.useState)(!1),[p,m]=(0,X.useState)(``),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(!1),[y,b]=(0,X.useState)(!1),[x,S]=(0,X.useState)(!1),C=(0,X.useCallback)(async r=>{f(!1);try{let i=await o({instanceName:e,agentId:t,name:n});u({content:i.content,updatedAtMs:i.updatedAtMs}),r||m(i.content),b(!1)}catch{f(!0)}},[o,e,t,n]);(0,X.useEffect)(()=>{C(!1)},[C]);async function w(){if(l!==null){v(!0),S(!1);try{await s({instanceName:e,agentId:t,name:n,content:p,baseUpdatedAtMs:l.updatedAtMs??void 0}),c.success(B({name:n})),a(),await C(!1)}catch(e){at(e)?b(!0):S(!0)}finally{v(!1)}}}let T=l!==null&&p!==l.content,E=(0,X.useMemo)(()=>l===null?null:rt(l.content,p),[l,p]),D=p.length>Ze,O=L(),k=(0,X.useMemo)(()=>new Intl.NumberFormat(O),[O]);return(0,Q.jsx)(Ue,{open:!0,onOpenChange:e=>!e&&i(),children:(0,Q.jsxs)(Be,{className:`oc-afiles__editor`,children:[(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(Ve,{children:be({name:n})}),(0,Q.jsxs)(He,{children:[ne({agent:t,instance:e}),r?null:(0,Q.jsxs)(Q.Fragment,{children:[` · `,Ce()]})]})]}),d?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[ue(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void C(!1),children:_e()})]}):l===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`textarea`,{className:`oc-afiles__source`,value:p,readOnly:!r,spellCheck:!1,onChange:e=>m(e.target.value),"aria-label":be({name:n})}),(0,Q.jsx)(`p`,{className:`oc-afiles__hint`,children:ve()}),y?(0,Q.jsxs)(`p`,{className:`oc-afiles__error`,role:`alert`,children:[R(),` `,(0,Q.jsx)(q,{variant:`outline`,size:`sm`,onClick:()=>void C(!0),children:ie()})]}):null,x?(0,Q.jsx)(`p`,{className:`oc-afiles__error`,role:`alert`,children:H()}):null,(0,Q.jsxs)(Y,{className:`oc-afiles__editor-foot flex-row`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__count${D?` is-over`:``}`,children:N({count:k.format(p.length),max:k.format(Ze)})}),r?(0,Q.jsx)(q,{size:`sm`,disabled:!T||_||y,onClick:()=>g(!0),children:_?I():z()}):null]})]}),(0,Q.jsx)(Le,{open:h,onOpenChange:g,children:(0,Q.jsxs)(Me,{children:[(0,Q.jsxs)(Ie,{children:[(0,Q.jsx)(je,{children:he({name:n})}),(0,Q.jsx)(Ae,{children:le({agent:t})})]}),E?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__diff-counts`,children:re({added:E.added,removed:E.removed})}),E.sampleAdded.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:pe()}),E.sampleAdded.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-add`,children:e||` `},t))]}):null,E.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__diff-block`,children:[(0,Q.jsx)(`span`,{className:`oc-afiles__diff-label`,children:W()}),E.sampleRemoved.map((e,t)=>(0,Q.jsx)(`code`,{className:`oc-afiles__diff-line is-del`,children:e||` `},t))]}):null]}):null,(0,Q.jsxs)(Pe,{children:[(0,Q.jsx)(Fe,{children:ge()}),(0,Q.jsx)(Ne,{onClick:()=>void w(),children:P()})]})]})})]})})}function lt({curationId:e,onClose:t,onApplied:n}){let i=F(G.agentFileCuration.getProposal,{curationId:e}),a=M(G.agentFileCuration.approveCuration),s=xe(G.agentFileCuration.rejectCuration),{toast:c}=J(),[l,_]=(0,X.useState)(null),[y,b]=(0,X.useState)(!1),[S,w]=(0,X.useState)(``),E=L(),D=(0,X.useMemo)(()=>i?rt(i.beforeContent,i.proposedContent):null,[i]);async function te(){_(`approve`);try{let t=await a({curationId:e});t.ok?(c({title:de(),variant:`success`}),n()):c({title:t.reason===`conflict`?d():ee({reason:t.reason??`unknown`}),variant:`error`})}catch{c({title:m(),variant:`error`})}finally{_(null)}}async function A(n){_(`reject`);try{let i=S.trim();(await s({curationId:e,...i?{comment:i}:{},relaunch:n})).ok?c({title:n?r():h(),variant:`success`}):c({title:k(),variant:`error`}),t()}catch{c({title:m(),variant:`error`})}finally{_(null)}}return(0,Q.jsx)(Ue,{open:!0,onOpenChange:e=>e?void 0:t(),children:(0,Q.jsxs)(Be,{className:`oc-afiles__review`,children:[(0,Q.jsxs)(ze,{children:[(0,Q.jsx)(Ve,{children:i?O({name:i.name}):V()}),(0,Q.jsx)(He,{children:f()})]}),i===void 0?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:V()}):i===null?(0,Q.jsx)(`p`,{className:`oc-admin__hint`,children:k()}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`p`,{className:`oc-afiles__review-sizes`,children:[o({before:Z(i.beforeSize,E),after:Z(i.proposedSize,E)}),i.overBudget?(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(K,{size:13,"aria-hidden":!0}),` `,we()]}):null]}),D?(0,Q.jsx)(`p`,{className:`oc-afiles__review-diff`,children:T({added:D.added,removed:D.removed})}):null,i.feedback?(0,Q.jsx)(`p`,{className:`oc-afiles__review-feedback`,children:C({feedback:i.feedback})}):null,D&&D.sampleRemoved.length>0?(0,Q.jsxs)(`div`,{className:`oc-afiles__review-removed`,children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:v()}),(0,Q.jsx)(`ul`,{children:D.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:x()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.beforeContent})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:`oc-afiles__review-label`,children:g()}),(0,Q.jsx)(`pre`,{className:`oc-afiles__review-pre`,children:i.proposedContent})]})]})]}),y?(0,Q.jsxs)(`div`,{className:`oc-afiles__reject-form`,children:[(0,Q.jsx)(`label`,{className:`oc-afiles__review-label`,htmlFor:`curation-reject-comment`,children:oe()}),(0,Q.jsx)(`textarea`,{id:`curation-reject-comment`,className:`oc-afiles__reject-textarea`,rows:3,placeholder:fe(),value:S,onChange:e=>w(e.target.value)})]}):null,y?(0,Q.jsxs)(Y,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`ghost`,onClick:()=>b(!1),disabled:l!==null,children:U()}),(0,Q.jsx)(q,{variant:`outline`,onClick:()=>void A(!1),disabled:l!==null,children:l===`reject`?I():me()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void A(!0),disabled:l!==null,children:l===`reject`?I():ae()})]}):(0,Q.jsxs)(Y,{className:`oc-afiles__review-actions`,children:[(0,Q.jsx)(q,{variant:`outline`,onClick:()=>b(!0),disabled:l!==null||i==null,children:p()}),(0,Q.jsx)(q,{variant:`default`,onClick:()=>void te(),disabled:l!==null||i==null,children:l===`approve`?I():u()})]})]})})}export{ot as AgentFilesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{AP as r,BP as i,CP as a,DP as ee,EP as o,FP as te,GP as s,HP as ne,IP as re,JP as c,KP as l,LP as u,MP as ie,NP as ae,OP as oe,PP as se,RP as ce,SP as le,TP as ue,UP as de,VP as fe,WP as pe,YP as d,_P as me,aP as f,bP as he,bQ as p,cP as ge,dP as m,eP as h,fP as g,gP as _e,hP as ve,iP as _,jP as ye,kP as be,lP as xe,mP as Se,nP as v,oP as y,pP as Ce,qP as b,rP as x,sP as S,t as C,tP as w,uP as T,vP as E,wP as D,xP as O,yP as k,yQ as A,zP as we}from"./api-CWqdeSbN.js";import{n as Te,t as j}from"./useNavigate-D3GIoxyW.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CjcMQhwm.js";import"./convexApi-G20_TNBS.js";import{r as Ee}from"./toast-C_YfUacM.js";import{t as L}from"./badge-ChMMFtuW.js";import{n as R}from"./format-AQELUhPa.js";import{a as z,n as B,o as V,t as H}from"./dialog-CPAskUwF.js";import{c as U,o as De}from"./searchSchemas-Dm-Qg010.js";import{t as Oe}from"./appHost-CH3EGcJw.js";import{n as ke}from"./ConfirmDialog-B7k0wvSi.js";import{n as Ae}from"./TimeRangePicker-BZtw1JkM.js";import{t as je}from"./FilterBar-DCCuFxDn.js";import{t as Me}from"./DataTableShell-DvtkASQG.js";import{t as W}from"./dispatchErrorInfo-7H2cJGwt.js";var G=t(e(),1),K=new Set([`openclaw.dispatch_failures`,`assistant.announce_errors`]),q=new Set([`assistant.cause.provider_auth_revoked`,`assistant.cause.provider_permission_denied`,`assistant.cause.provider_auth_failed`]);function J(e){let t=q.has(e.kind);if(!K.has(e.kind)&&!t||!e.evidence)return{};try{let n=JSON.parse(e.evidence);if(t){let e=Array.isArray(n.agents)?n.agents.filter(e=>typeof e==`string`):[],t=Array.isArray(n.providers)?n.providers.filter(e=>typeof e==`string`):[],r=e.length===1?e[0]:void 0;return{dominantCode:n.cause,sampleCorrelationId:n.sampleCorrelationId,context:{...r===void 0?{}:{agentId:r.slice(r.lastIndexOf(`/`)+1)},...t.length===1?{provider:t[0]}:{}}}}return{dominantCode:n.dominantCode,sampleCorrelationId:n.sampleCorrelationId}}catch{return{}}}var Y=n(),X=`__all__`,Ne=[{value:`open`},{value:`acknowledged`},{value:`resolved`}];function Pe(e){return e===`open`?d():e===`acknowledged`?c():b()}var Fe=[`info`,`warn`,`critical`],Ie=[`detector`,`agent`,`user`],Le={kind:`relative`,from:`now-30d`,to:`now`},Re=200,Z=`all`;function Q(){let e=Te({from:`/settings/anomalies`}),t=j({from:`/settings/anomalies`}),n=e.q??``,c=e.status===Z?X:e.status,d=e.severity??X,f=e.kind??X,[h,_]=(0,G.useState)(X),v=De(e.from,e.to),{from:y,to:b}=Ae(v),x=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),S=e=>void t({search:t=>({...t,status:e===X?Z:e})}),w=e=>void t({search:t=>({...t,severity:e===X?void 0:e})}),z=e=>void t({search:t=>({...t,kind:e===X?void 0:e})}),B=e=>void t({search:t=>({...t,...U(e)})}),V=ke(),H=Ee(),W=A(C.anomalies.resolveAnomaly),K=(p(C.me.getMe,{host:Oe})?.permissions??[]).includes(`admin.manage`),q=p(C.anomalies.listAnomalies,{limit:Re,filter:{q:n||void 0,from:y,to:b,anomalyStatus:c===X?void 0:c,severity:d===X?void 0:d,source:h===X?void 0:h,kind:f===X?void 0:f}}),J=(0,G.useMemo)(()=>{let e=new Set;for(let t of q??[])e.add(t.kind);return[...e].sort()},[q]),Q=n!==``||c!==`open`||d!==X||h!==X||f!==X||v.kind!==`relative`||v.from!==Le.from;function $(){_(X),t({search:{status:`open`},replace:!0})}async function We(e){if(await V({title:l(),description:(0,Y.jsxs)(Y.Fragment,{children:[s(),` `,(0,Y.jsx)(`span`,{className:`font-mono`,children:e.kind}),` `,pe(),` `,(0,Y.jsx)(`strong`,{children:de()}),`.`,` `,ne()]}),confirmLabel:fe()}))try{await W({anomalyId:e._id,status:`resolved`}),H.success(i(),e.kind)}catch(e){H.error(we(),e)}}async function Ge(e){try{await W({anomalyId:e._id,status:`acknowledged`}),H.success(ce(),e.kind)}catch(e){H.error(u(),e)}}return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{className:`oc-admin__hint`,children:[re(),` `,(0,Y.jsx)(`strong`,{children:te()}),` `,se(),` `,(0,Y.jsx)(`strong`,{children:ae()}),` `,ie(),` `,(0,Y.jsx)(`strong`,{children:ye()}),` `,r(),` `,(0,Y.jsx)(`span`,{className:`oc-filter__window`,children:be()})]}),(0,Y.jsxs)(je,{q:n,onQChange:x,searchPlaceholder:oe(),timeRange:v,onTimeRangeChange:B,onReset:$,canReset:Q,children:[(0,Y.jsxs)(I,{value:c,onValueChange:S,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(M,{})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:ee()}),Ne.map(e=>(0,Y.jsx)(F,{value:e.value,children:Pe(e.value)},e.value))]})]}),(0,Y.jsxs)(I,{value:d,onValueChange:w,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(M,{placeholder:o()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:le()}),Fe.map(e=>(0,Y.jsx)(F,{value:e,children:e},e))]})]}),(0,Y.jsxs)(I,{value:h,onValueChange:_,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-32`,children:(0,Y.jsx)(M,{placeholder:O()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:he()}),Ie.map(e=>(0,Y.jsx)(F,{value:e,children:e},e))]})]}),(0,Y.jsxs)(I,{value:f,onValueChange:z,children:[(0,Y.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Y.jsx)(M,{placeholder:k()})}),(0,Y.jsxs)(P,{children:[(0,Y.jsx)(F,{value:X,children:E()}),J.map(e=>(0,Y.jsx)(F,{value:e,children:e},e))]})]})]}),(0,Y.jsx)(Me,{title:me(),rows:q,emptyHint:c===`open`?_e():ve(),rowActions:e=>K&&e.status===`open`?[{label:Se(),onSelect:()=>void We(e)},{label:Ce(),onSelect:()=>void Ge(e)}]:[],columns:[{header:g(),cell:e=>(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:R(e.at)}),sort:e=>e.at},{header:k(),cell:e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.kind}),sort:e=>e.kind},{header:ue(),cell:e=>e.occurrenceCount!==null&&e.occurrenceCount>1?(0,Y.jsx)(`span`,{className:`oc-traces__time`,title:e.firstAt===null?void 0:a({when:R(e.firstAt)}),children:D({count:String(e.occurrenceCount)})}):(0,Y.jsx)(`span`,{className:`oc-traces__time`,children:`—`}),sort:e=>e.occurrenceCount??0},{header:o(),cell:e=>(0,Y.jsx)(Ve,{severity:e.severity}),sort:e=>e.severity===`critical`?2:+(e.severity===`warn`)},{header:m(),cell:e=>(0,Y.jsx)(He,{status:e.status}),sort:e=>e.status===`resolved`?2:+(e.status===`acknowledged`)},{header:O(),cell:e=>(0,Y.jsx)(L,{variant:`outline`,children:e.source}),sort:e=>e.source},{header:T(),cell:e=>(0,Y.jsxs)(`div`,{className:`oc-anomaly__msgcell`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__msg`,children:e.message}),(0,Y.jsx)(Be,{row:e})]}),sort:e=>e.message},{header:xe(),cell:e=>(0,Y.jsx)(ze,{row:e}),sort:e=>e.evidence??null},{header:ge(),cell:e=>e.correlationId?(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:Ue(e.correlationId)}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`}),sort:e=>e.correlationId}]})]})}function $(e){if(e.kind!==`subagent.failure`||!e.evidence)return{};try{let t=JSON.parse(e.evidence);return{failedCount:t.failedCount,totalCount:t.totalCount,errorCategories:t.errorCategories}}catch{return{}}}function ze({row:e}){let t=j();if(e.kind===`subagent.failure`){let n=$(e);return(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsx)(`div`,{className:`oc-anomaly__cause-head`,children:[...new Set(n.errorCategories??[])].map(e=>(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e},e))}),e.correlationId?(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{q:e.correlationId,limit:100}}),children:[`↗ `,S()]}):null]})}let n=J(e);if(!n.dominantCode){let e=n.sampleCorrelationId;return e?(0,Y.jsx)(`div`,{className:`oc-anomaly__cause`,children:(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:e,limit:100}}),children:[`↗ `,S()]})}):(0,Y.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}let r=W(n.dominantCode,n.context),i=n.sampleCorrelationId;return(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause`,children:[(0,Y.jsxs)(`div`,{className:`oc-anomaly__cause-head`,children:[(0,Y.jsx)(`span`,{className:`oc-anomaly__cause-label`,children:r.label}),(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:n.dominantCode})]}),(0,Y.jsx)(`p`,{className:`oc-anomaly__cause-hint`,children:r.hint}),i?(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>void t({to:`/settings/traces`,search:{correlationId:i,limit:100}}),children:[`↗ `,S()]}):null]})}function Be({row:e}){let[t,n]=(0,G.useState)(!1),r=p(C.anomalies.getAnomalyAttachments,t?{anomalyId:e._id}:`skip`);return!e.attachments||e.attachments.length===0?null:(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,className:`oc-anomaly__drill`,onClick:()=>n(!0),children:[y(),e.attachments.length>1?` (${e.attachments.length})`:``]}),(0,Y.jsx)(H,{open:t,onOpenChange:n,children:(0,Y.jsxs)(B,{className:`oc-anomaly__attachments-dialog`,children:[(0,Y.jsx)(z,{children:(0,Y.jsx)(V,{children:f()})}),r===void 0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:_()}):r.length===0?(0,Y.jsx)(`p`,{className:`oc-traces__muted`,children:x()}):(0,Y.jsx)(`div`,{className:`oc-anomaly__attachments`,children:r.map(e=>(0,Y.jsxs)(`section`,{className:`oc-anomaly__attachment`,children:[(0,Y.jsx)(`h4`,{className:`oc-anomaly__attachment-name`,children:(0,Y.jsx)(`code`,{className:`oc-traces__mono`,children:e.name})}),(0,Y.jsx)(`pre`,{className:`oc-anomaly__attachment-content`,children:e.content})]},e.name))})]})})]})}function Ve({severity:e}){return(0,Y.jsx)(`span`,{className:`oc-anomaly__sev oc-anomaly__sev--${e}`,children:e})}function He({status:e}){return e===`open`?(0,Y.jsx)(L,{variant:`destructive`,children:v()}):e===`acknowledged`?(0,Y.jsx)(L,{variant:`secondary`,children:w()}):(0,Y.jsx)(L,{variant:`outline`,children:h()})}function Ue(e){return e.length>8?e.slice(0,8):e}export{Q as AnomaliesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$F as r,GF as i,Gd as a,HF as o,JF as s,Jd as c,KF as l,Kd as u,QF as d,UF as f,Ud as p,VF as m,WF as h,Wd as g,XF as _,YF as v,ZF as y,bQ as b,eI as x,qF as S,qd as C,t as w,tI as T}from"./api-CWqdeSbN.js";import{n as E,t as D}from"./useNavigate-D3GIoxyW.js";import{a as O,i as k,n as A,r as j,t as M}from"./select-CjcMQhwm.js";import"./convexApi-G20_TNBS.js";import{n as N}from"./format-AQELUhPa.js";import{c as P,o as F,s as I,t as L,u as R}from"./searchSchemas-Dm-Qg010.js";import{n as ee}from"./TimeRangePicker-BZtw1JkM.js";import{t as z}from"./FilterBar-DCCuFxDn.js";import{t as B}from"./AdvancedFilter-Cod8SSd6.js";import{t as V}from"./DataTableShell-DvtkASQG.js";var H=t(e(),1),U=n(),W={kind:`relative`,from:L,to:`now`},G=`__all__`,K=[{value:`action`,label:c()},{value:`realLabel`,label:C()},{value:`targetLabel`,label:u()},{value:`impersonated`,label:a()},{value:`resource`,label:g()},{value:`resourceId`,label:p()}];function q(){let e=E({from:`/settings/audit`}),t=D({from:`/settings/audit`}),n=e.q??``,a=e.action??G,c=e.impersonated??G,u=e.resource??G,p=F(e.from,e.to),g=(0,H.useMemo)(()=>R(e.adv),[e.adv]),{from:C,to:L}=ee(p),q=e=>void t({search:t=>({...t,q:e||void 0}),replace:!0}),J=e=>void t({search:t=>({...t,action:e===G?void 0:e})}),Y=e=>void t({search:t=>({...t,impersonated:e===G?void 0:e})}),X=e=>void t({search:t=>({...t,resource:e===G?void 0:e})}),Z=e=>void t({search:t=>({...t,...P(e)})}),Q=e=>void t({search:t=>({...t,adv:I(e)}),replace:!0}),$=b(w.admin.listAudit,{filter:{q:n||void 0,from:C,to:L,action:a===G?void 0:a,resource:u===G?void 0:u,impersonated:c===G?void 0:c===`yes`,advanced:g.length>0?g:void 0}}),te=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])e.add(t.action);return[...e].sort()},[$]),ne=(0,H.useMemo)(()=>{let e=new Set;for(let t of $??[])t.resource&&e.add(t.resource);return[...e].sort()},[$]),re=n!==``||a!==G||c!==G||u!==G||g.length>0||p.kind!==`relative`||p.from!==W.from;function ie(){t({search:{},replace:!0})}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`p`,{className:`oc-admin__hint`,children:[T(),` `,(0,U.jsx)(`span`,{className:`oc-filter__window`,children:x()})]}),(0,U.jsxs)(z,{q:n,onQChange:q,searchPlaceholder:r(),timeRange:p,onTimeRangeChange:Z,onReset:ie,canReset:re,children:[(0,U.jsxs)(M,{value:a,onValueChange:J,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:d()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:y()}),te.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]}),(0,U.jsxs)(M,{value:c,onValueChange:Y,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:_()}),(0,U.jsx)(j,{value:`yes`,children:v()}),(0,U.jsx)(j,{value:`no`,children:s()})]})]}),(0,U.jsxs)(M,{value:u,onValueChange:X,children:[(0,U.jsx)(k,{size:`sm`,className:`w-40`,children:(0,U.jsx)(O,{placeholder:S()})}),(0,U.jsxs)(A,{children:[(0,U.jsx)(j,{value:G,children:l()}),ne.map(e=>(0,U.jsx)(j,{value:e,children:e},e))]})]})]}),(0,U.jsx)(B,{fields:K,seed:g,onChange:Q}),(0,U.jsx)(V,{title:i(),rows:$,emptyHint:h(),columns:[{header:f(),cell:e=>N(e.at),sort:e=>e.at},{header:d(),cell:e=>e.action,sort:e=>e.action},{header:o(),cell:e=>e.realLabel,sort:e=>e.realLabel},{header:m(),cell:e=>e.targetLabel??`—`,sort:e=>e.targetLabel??null},{header:S(),cell:e=>e.resource?e.resource+(e.resourceId?` · ${e.resourceId.slice(0,8)}`:``):`—`,sort:e=>e.resource??null}]})]})}export{q as AuditTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$A as r,AA as i,Av as a,BA as o,Bj as s,Bv as c,CA as l,DA as u,EA as d,FA as f,GA as p,Gj as m,Gv as h,HA as g,Hj as ee,Hv as _,IA as v,Ij as te,Iv as y,JA as b,Jv as ne,KA as re,Kj as ie,Kv as ae,LA as oe,Lj as se,Lv as ce,MA as le,NA as ue,OA as de,PA as fe,QA as pe,RA as me,Rv as he,SA as ge,TA as _e,UA as ve,Uj as ye,Uv as x,VA as be,Vj as xe,Vv as Se,WA as Ce,Wj as we,Wv as Te,XA as Ee,Xj as De,Xo as Oe,YA as ke,Yj as Ae,ZA as je,_A as S,_Q as Me,_d as Ne,aj as Pe,bA as Fe,bQ as C,bc as Ie,cj as Le,dd as Re,dj as ze,ej as Be,fd as Ve,fj as He,gA as Ue,ij as We,jA as Ge,k as w,kA as Ke,lj as qe,md as Je,mj as Ye,nj as Xe,oj as Ze,pd as Qe,pj as $e,qA as et,qj as tt,qv as nt,rj as rt,sj as it,t as T,tj as at,ud as ot,uj as st,vA as E,wA as ct,xA as lt,yA as ut,yQ as dt,zA as ft,zv as pt}from"./api-CWqdeSbN.js";import{i as mt,n as D,o as ht,r as gt,s as _t}from"./FieldLabel-imj_Z0rZ.js";import{n as vt,t as O}from"./useNavigate-D3GIoxyW.js";import{r as k}from"./dist-CzmY6YrA.js";import{t as yt}from"./chevron-right-DMqzlhWH.js";import{t as bt}from"./chevron-up-B3KYmtzo.js";import{t as xt}from"./chevrons-up-down-CITEfz7_.js";import{n as St,t as Ct}from"./usageView-BuRtXekW.js";import{t as wt}from"./loader-circle-BqKiW3X9.js";import{t as Tt}from"./checkbox-DPxJTQjc.js";import{t as A}from"./server-DcInl3Nh.js";import{t as j}from"./triangle-alert-DoL9TI6v.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CjcMQhwm.js";import{n as Et,r as Dt,t as Ot}from"./popover-C-Y_Yoco.js";import{i as kt,n as At,r as jt,t as Mt}from"./tabs-B8emuY1B.js";import{t as L}from"./button-C_rIPtCv.js";import{t as R}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as Nt}from"./toast-C_YfUacM.js";import{t as z}from"./badge-ChMMFtuW.js";import{a as B,n as Pt}from"./format-AQELUhPa.js";import{a as Ft,n as It,o as Lt,r as Rt,t as zt}from"./dialog-CPAskUwF.js";import{t as Bt}from"./appHost-CH3EGcJw.js";import{r as Vt}from"./locales-CPjguROj.js";import{a as Ht,i as V,n as Ut,o as H,r as U,t as Wt}from"./table-rRR3TpMc.js";import{t as Gt}from"./FilterBar-DCCuFxDn.js";import{c as Kt,i as qt,n as Jt,o as Yt,r as Xt,s as Zt,t as Qt}from"./compatView-Cz5KNXa-.js";import{t as W}from"./dispatchErrorInfo-7H2cJGwt.js";var $t=w(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),en=w(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),G=t(e(),1);function tn(e){return e.filter(e=>e.state===`error`)}function nn(e){return e.reachable&&tn(e.targets).length===0}function rn(e){return nn(e)?(e.unreachableInstances??[]).length>0?`gateways_unreachable`:`ok`:`error`}function an(e){return e.state===`error`&&e.lastErrorCode!==null}function on(e){return!!e.lastDownstreamRejectCode}function sn(e){return!!e.lastLocalRefusalCode}function cn(e){return an(e)||on(e)||sn(e)}function K(e){return e.kind??`openclaw`}function ln(e){return[...e].sort((e,t)=>e===`openclaw`?-1:t===`openclaw`?1:e.localeCompare(t))}function un(e,t,n){let r=new Map;for(let e of t)e.instanceName&&r.set(e.instanceName,e.provider);for(let e of n)r.set(e.name,K(e));let i=e=>(e.instanceName?r.get(e.instanceName):void 0)??`openclaw`,a=new Set;for(let e of n)a.add(K(e));for(let e of t)a.add(e.provider);for(let t of e)a.add(i(t));return ln(a).map(r=>({key:r,connections:e.filter(e=>i(e)===r),compatTargets:t.filter(e=>e.provider===r),instances:n.filter(e=>K(e)===r)}))}function q(e){return e===`openclaw`?`OpenClaw`:e===`hermes`?`Hermes`:e.charAt(0).toUpperCase()+e.slice(1)}var J=`__all__`,dn={q:``,state:J,instance:J,version:J},Y={connected:0,error:1,idle:2};function fn(e){return e.q.trim()!==``||e.state!==`__all__`||e.instance!==`__all__`||e.version!==`__all__`}function pn(e,t){let n=t.q.trim().toLowerCase();return e.filter(e=>!(n&&!`${e.targetLabel} ${e.gatewayHost}`.toLowerCase().includes(n)||t.state!==`__all__`&&e.state!==t.state||t.instance!==`__all__`&&(e.instanceName??``)!==t.instance||t.version!==`__all__`&&(e.gatewayVersion??``)!==t.version))}function X(e,t){return e.localeCompare(t,void 0,{numeric:!0,sensitivity:`base`})}function mn(e,t){return e===`version`?t.gatewayVersion===null:e===`lastOk`&&t.lastOkAt===null}function hn(e,t,n){switch(e){case`state`:return(Y[t.state]??99)-(Y[n.state]??99);case`instance`:return X(t.instanceLabel??t.instanceName??``,n.instanceLabel??n.instanceName??``);case`host`:return X(t.gatewayHost,n.gatewayHost);case`version`:{let e=t.gatewayVersion,r=n.gatewayVersion;return Zt(e,r)??X(e,r)}case`lastOk`:return t.lastOkAt-n.lastOkAt;default:return X(t.targetLabel,n.targetLabel)}}function gn(e,t){if(!t)return e;let n=t.dir===`asc`?1:-1;return[...e].sort((e,r)=>{let i=mn(t.key,e),a=mn(t.key,r);return i&&a?0:i?1:a?-1:n*hn(t.key,e,r)})}function _n(e){let t=new Set;for(let n of e)t.add(n.state);return[...t].sort((e,t)=>(Y[e]??99)-(Y[t]??99))}function vn(e){let t=new Map;for(let n of e)n.instanceName!==null&&(t.has(n.instanceName)||t.set(n.instanceName,n.instanceLabel??n.instanceName));return[...t.entries()].map(([e,t])=>({name:e,label:t})).sort((e,t)=>X(e.label,t.label))}function yn(e){let t=new Set;for(let n of e)n.gatewayVersion!==null&&t.add(n.gatewayVersion);return[...t].sort((e,t)=>Zt(e,t)??X(e,t))}var Z=n();function bn({connections:e,displayByInstance:t}){let[n,r]=(0,G.useState)(dn),[a,o]=(0,G.useState)(null),s=(0,G.useMemo)(()=>e.map((e,n)=>({_id:`${e.key}:${e.canonical}/${e.agentId}:${n}`,targetLabel:`${e.canonical}/${e.agentId}`,state:e.state,instanceName:e.instanceName??null,instanceLabel:e.instanceName?t.get(e.instanceName)??e.instanceName:null,gatewayHost:e.gatewayHost,gatewayVersion:e.gatewayVersion??null,okCount:e.okCount,errorCount:e.errorCount+(e.downstreamRejectCount??0)+(e.localRefusalCount??0),attempts:e.attempts,lastOkAt:e.lastOkAt??null,lastErrorCode:e.lastErrorCode??null,lastErrorAt:e.lastErrorAt??null,lastDownstreamRejectCode:e.lastDownstreamRejectCode??null,lastDownstreamRejectAt:e.lastDownstreamRejectAt??null,lastLocalRefusalCode:e.lastLocalRefusalCode??null,lastLocalRefusalAt:e.lastLocalRefusalAt??null})),[e,t]),c=(0,G.useMemo)(()=>_n(s),[s]),f=(0,G.useMemo)(()=>vn(s),[s]),p=(0,G.useMemo)(()=>yn(s),[s]),m=(0,G.useMemo)(()=>gn(pn(s,n),a),[s,n,a]);function h(e){o(t=>t?.key===e?t.dir===`asc`?{key:e,dir:`desc`}:null:{key:e,dir:`asc`})}return e.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:fe()}):(0,Z.jsxs)(`div`,{className:`oc-conn`,children:[(0,Z.jsxs)(Gt,{q:n.q,onQChange:e=>r(t=>({...t,q:e})),searchPlaceholder:Ge(),onReset:()=>r(dn),canReset:fn(n),children:[(0,Z.jsxs)(I,{value:n.state,onValueChange:e=>r(t=>({...t,state:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:Ke()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),c.map(e=>(0,Z.jsx)(F,{value:e,children:Sn(e)},e))]})]}),(0,Z.jsxs)(I,{value:n.instance,onValueChange:e=>r(t=>({...t,instance:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-40`,children:(0,Z.jsx)(M,{placeholder:de()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),f.map(e=>(0,Z.jsx)(F,{value:e.name,children:e.label},e.name))]})]}),(0,Z.jsxs)(I,{value:n.version,onValueChange:e=>r(t=>({...t,version:e})),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-36`,children:(0,Z.jsx)(M,{placeholder:u()})}),(0,Z.jsxs)(P,{children:[(0,Z.jsx)(F,{value:J,children:i()}),p.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))]})]})]}),m.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:d()}):(0,Z.jsxs)(Wt,{className:`oc-conn__table`,children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(Q,{label:_e(),sortKey:`target`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:ct(),sortKey:`state`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:l(),sortKey:`instance`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:ge(),sortKey:`host`,sort:a,onSort:h}),(0,Z.jsx)(Q,{label:lt(),sortKey:`version`,sort:a,onSort:h}),(0,Z.jsx)(V,{children:Fe()}),(0,Z.jsx)(Q,{label:ut(),sortKey:`lastOk`,sort:a,onSort:h})]})}),(0,Z.jsx)(Ut,{children:m.map(e=>(0,Z.jsx)(xn,{r:e},e._id))})]})]})}function Q({label:e,sortKey:t,sort:n,onSort:r}){let i=n?.key===t,a=i?n.dir:null;return(0,Z.jsx)(V,{"aria-sort":i?a===`asc`?`ascending`:`descending`:`none`,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-conn__sort`,onClick:()=>r(t),children:[e,i?a===`asc`?(0,Z.jsx)(bt,{size:13,"aria-hidden":!0}):(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(xt,{size:13,"aria-hidden":!0,className:`oc-conn__sort-idle`})]})})}function xn({r:e}){let t=an(e)?W(e.lastErrorCode):null,n=on(e)?W(e.lastDownstreamRejectCode):null,r=sn(e)?W(e.lastLocalRefusalCode):null;return(0,Z.jsxs)(G.Fragment,{children:[(0,Z.jsxs)(H,{className:`oc-conn__row oc-conn__row--${e.state}`,children:[(0,Z.jsx)(U,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.targetLabel})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(Cn,{state:e.state})}),(0,Z.jsx)(U,{children:e.instanceLabel?(0,Z.jsx)(`span`,{className:`oc-bridge-target__instance`,children:e.instanceLabel}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-bridge-target__host`,children:e.gatewayHost})}),(0,Z.jsx)(U,{children:e.gatewayVersion?(0,Z.jsx)(`span`,{className:`oc-bridge-target__version`,children:e.gatewayVersion}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})}),(0,Z.jsx)(U,{children:(0,Z.jsx)(`span`,{className:`oc-conn__stats`,children:ue({ok:e.okCount,errors:e.errorCount,attempts:e.attempts})})}),(0,Z.jsx)(U,{children:e.lastOkAt?(0,Z.jsx)(`span`,{className:`oc-traces__mono`,children:B(e.lastOkAt)}):(0,Z.jsx)(`span`,{className:`oc-traces__muted`,children:`—`})})]}),cn(e)?(0,Z.jsx)(H,{className:`oc-conn__detail-row`,children:(0,Z.jsxs)(U,{colSpan:7,className:`oc-conn__detail-cell`,children:[t?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__error`,children:[(0,Z.jsx)(`strong`,{children:t.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastErrorCode}),e.lastErrorAt?` · ${B(e.lastErrorAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:t.hint})]}):null,r?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[Oe({label:r.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastLocalRefusalCode}),e.lastLocalRefusalAt?` · ${B(e.lastLocalRefusalAt)}`:``,(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:r.hint})]}):null,n?(0,Z.jsxs)(`div`,{className:`oc-bridge-target__downstream`,children:[le({label:n.label}),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.lastDownstreamRejectCode}),e.lastDownstreamRejectAt?` · ${B(e.lastDownstreamRejectAt)}`:``]}):null]})}):null]})}function Sn(e){return e===`connected`?E():e===`error`?S():Ue()}function Cn({state:e}){return e===`connected`?(0,Z.jsx)(z,{variant:`secondary`,children:E()}):e===`error`?(0,Z.jsx)(z,{variant:`destructive`,children:S()}):(0,Z.jsx)(z,{variant:`outline`,children:Ue()})}function wn(){return C(T.bridgeHealth.getBridgeHealth,{})}function Tn(){let e=wn(),t=C(T.compat.getBridgeCompat,{}),n=C(T.me.getMe,{host:Bt})?.role===`admin`,i=C(T.admin.listInstances,n?{}:`skip`),o=C(T.agents.usageForInstances,n?{}:`skip`),s=O(),c=()=>void s({to:`/settings/anomalies`,search:{status:`open`}}),l=un(e?e.targets:[],t?t.targets:[],i??[]),{section:u}=vt({from:`/settings/bridge`}),d=O({from:`/settings/bridge`}),f=t?.compat??null,p=t===void 0?`loading`:t===null?`nodata`:`ready`,m=f!==null&&Xt(f,`hermes`)&&!l.some(e=>e.key===`hermes`);return(0,Z.jsxs)(`div`,{className:`oc-bridge`,children:[(0,Z.jsx)(En,{health:e,compat:t,onSeeAnomalies:c}),(0,Z.jsx)(`p`,{className:`oc-admin__hint oc-bridge__caption`,children:Be()}),o&&o.length>0?(0,Z.jsxs)(`section`,{className:`oc-bridge__usage`,children:[(0,Z.jsx)(`h3`,{className:`oc-bridge__usage-title`,children:r()}),(0,Z.jsxs)(Wt,{children:[(0,Z.jsx)(Ht,{children:(0,Z.jsxs)(H,{children:[(0,Z.jsx)(V,{children:Je()}),(0,Z.jsx)(V,{children:Qe()}),(0,Z.jsx)(V,{children:Ve()}),(0,Z.jsx)(V,{children:Re()}),(0,Z.jsx)(V,{children:ot()})]})}),(0,Z.jsx)(Ut,{children:o.flatMap(e=>{let t=Ct(e.usage,Date.now());return t?t.windows.map((t,n)=>(0,Z.jsxs)(H,{children:[(0,Z.jsx)(U,{className:`font-medium`,children:n===0?e.instanceName:``}),(0,Z.jsx)(U,{children:t.provider}),(0,Z.jsx)(U,{children:t.label}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(z,{variant:t.percentLeft<=10?`destructive`:t.percentLeft<=25?`outline`:`secondary`,children:[t.percentLeft,`%`]})}),(0,Z.jsx)(U,{className:`text-muted-foreground`,children:t.resetText??`—`})]},`${e.instanceName}:${t.provider}:${t.label}`)):[]})})]})]}):null,l.length>0?(0,Z.jsxs)(Mt,{value:l.some(e=>e.key===u)?u:l[0]?.key??`openclaw`,onValueChange:e=>void d({search:{section:e},replace:!0}),children:[(0,Z.jsx)(jt,{className:`w-full`,children:l.map(e=>(0,Z.jsxs)(kt,{value:e.key,className:`flex-1 gap-1.5`,children:[(0,Z.jsx)(A,{size:13,"aria-hidden":!0}),q(e.key)]},e.key))}),l.map(e=>(0,Z.jsx)(At,{value:e.key,children:(0,Z.jsx)(Dn,{providerKey:e.key,connections:e.connections,instances:e.instances,manifest:f,compatStatus:p,compatReachable:t?.reachable??!0,protocol:e.key===`openclaw`?t?.protocol??null:null})},e.key))]}):null,m?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:a()}):null]})}function En({health:e,compat:t,onSeeAnomalies:n}){let r=t!=null&&t.buildVersion!=null&&t.bridgeVersion!=null&&t.buildVersion!==t.bridgeVersion,i=t?.buildRevision&&t.buildRevision!==`unknown`?t.buildRevision.slice(0,7):null,a=t&&t!==null?(0,Z.jsxs)(`span`,{className:`oc-bridge-card__ver`,children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(t.bridgeVersion)}),i?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsxs)(`code`,{className:`oc-traces__mono`,title:ae(),children:[`(`,i,`)`]})]}):null,r?(0,Z.jsxs)(`strong`,{className:`oc-bridge-card__mismatch`,children:[` `,h({build:t.buildVersion??`?`})]}):null,` · `,Te(),` `,(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:t.protocolVersion===null?x():String(t.protocolVersion)})]}):null;if(e===void 0)return(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()});if(e===null)return(0,Z.jsx)(`div`,{className:`oc-bridge-card oc-bridge-card--idle`,children:Ce()});let s=tn(e.targets),c=!e.reachable,l=rn(e),u=e.unreachableInstances??[],d=l===`ok`?`ok`:l===`gateways_unreachable`?`warn`:`error`,f=Pt(e.checkedAt),m=e.startedAt==null?null:Pt(e.startedAt);return(0,Z.jsxs)(`div`,{className:`oc-bridge-card oc-bridge-card--${d}`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__icon`,"aria-hidden":!0,children:l===`ok`?(0,Z.jsx)(St,{size:22}):c||l===`gateways_unreachable`?(0,Z.jsx)(en,{size:22}):(0,Z.jsx)(j,{size:22})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__body`,children:[(0,Z.jsx)(`div`,{className:`oc-bridge-card__title`,children:l===`ok`?ve():l===`gateways_unreachable`?ft({count:u.length}):c?g():be({count:s.length})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-card__meta`,children:[(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)($t,{size:12,"aria-hidden":!0}),` `,o({time:f})]}),m?(0,Z.jsx)(`span`,{children:oe({time:m})}):null,a]}),l===`gateways_unreachable`?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:me({names:u.join(`, `)})}):null,c?(0,Z.jsx)(`p`,{className:`oc-bridge-card__hint`,children:W(e.lastError===`not_configured`?`NOT_CONFIGURED`:`BRIDGE_UNREACHABLE`).hint}):null]}),(0,Z.jsx)(`button`,{type:`button`,className:`oc-bridgebar__drill`,onClick:n,children:v()})]})}function Dn({providerKey:e,connections:t,instances:n,manifest:r,compatStatus:i,compatReachable:a,protocol:o}){let s=r?Kt(r,e):null,c=new Map;for(let e of n)c.set(e.name,e.displayName??e.name);let l=[],u=new Set;for(let n of t){if(!n.instanceName||u.has(n.instanceName))continue;u.add(n.instanceName);let t=n.gatewayVersion??null;l.push({instanceName:n.instanceName,displayName:c.get(n.instanceName)??n.instanceName,version:t,state:Jt(t,e,r)})}let d=Qt(l.map(e=>e.state)),[p,m]=(0,G.useState)(!1);return(0,Z.jsxs)(`section`,{className:`oc-bridge-provider`,children:[(0,Z.jsxs)(`header`,{className:`oc-bridge-provider__head`,children:[(0,Z.jsx)(A,{size:15,"aria-hidden":!0,className:`oc-bridge-provider__icon`}),(0,Z.jsx)(`span`,{className:`oc-bridge-provider__name`,children:q(e)}),d?(0,Z.jsx)(z,{variant:d===`beyond`||d===`defective`||d===`unsupported`?`destructive`:`secondary`,children:qt(d)}):null]}),(0,Z.jsx)(`h4`,{className:`oc-bridge-provider__sub`,children:ne()}),(0,Z.jsx)(kn,{providerName:q(e),support:s,compatStatus:i,compatReachable:a,manifest:r,instanceRows:l}),o?(0,Z.jsx)(On,{protocol:o}):null,(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":p,onClick:()=>m(e=>!e),children:[p?(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(yt,{size:13,"aria-hidden":!0}),f({count:t.length})]}),p?(0,Z.jsx)(bn,{connections:t,displayByInstance:c}):null]})}function On({protocol:e}){let[t,n]=(0,G.useState)(!1),r=e.coverage,i=e.drift??[],a=(e.driftOverflow??0)+(e.driftTruncated??0);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`h4`,{className:`oc-bridge-provider__sub`,children:[pe(),i.length>0?(0,Z.jsx)(z,{variant:`destructive`,children:Ee({count:i.length})}):a>0?(0,Z.jsx)(z,{variant:`destructive`,children:ke()}):(0,Z.jsx)(z,{variant:`secondary`,children:je()})]}),(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[b({version:e.vendoredVersion}),r?` · `+et({handled:r.handled,ignored:r.ignored,gaps:r.gaps}):null]}),a>0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Ie({overflow:e.driftOverflow??0,truncated:e.driftTruncated??0})}):null,i.length>0?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:i.map(e=>(0,Z.jsxs)(`li`,{children:[(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e.shape}),` × `,e.count]},e.shape))}):null,r&&r.gapList.length>0?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`button`,{type:`button`,className:`oc-bridge-provider__sub oc-bridge-provider__sub--toggle`,"aria-expanded":t,onClick:()=>n(e=>!e),children:[t?(0,Z.jsx)(k,{size:13,"aria-hidden":!0}):(0,Z.jsx)(yt,{size:13,"aria-hidden":!0}),re({count:r.gapList.length})]}),t?(0,Z.jsx)(`ul`,{className:`oc-bridge-protocol__list`,role:`list`,children:r.gapList.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:e})},e))}):null]}):null]})}function kn({support:e,compatStatus:t,compatReachable:n,manifest:r,instanceRows:i,providerName:a}){return t===`loading`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:p()}):t===`nodata`?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}):(0,Z.jsxs)(`div`,{className:`oc-compat`,children:[n?null:(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:_()}),r===null?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:Se()}):(0,Z.jsxs)(`div`,{className:`oc-compat__support`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__label`,children:Ne({provider:a})}),e&&e.range!==null?(0,Z.jsx)(`span`,{children:c({min:e.range.min,max:e.range.maxValidated})}):(0,Z.jsx)(`span`,{children:x()}),e?(0,Z.jsx)(Mn,{versions:e.validatedVersions}):null]}),i.length===0?(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:y()}):(0,Z.jsx)(`div`,{className:`oc-compat__targets`,children:i.map(e=>(0,Z.jsxs)(`div`,{className:`oc-compat__target`,children:[(0,Z.jsx)(`span`,{className:`oc-compat__instance`,children:e.displayName}),(0,Z.jsx)(`code`,{className:`oc-traces__mono`,children:Yt(e.version)}),(0,Z.jsx)(z,{variant:e.state===`supported`?`secondary`:e.state===`beyond`||e.state===`defective`||e.state===`unsupported`?`destructive`:`outline`,children:qt(e.state)})]},e.instanceName))})]})}function An({instance:e,onClose:t}){return(0,Z.jsx)(zt,{open:!0,onOpenChange:e=>!e&&t(),children:(0,Z.jsxs)(It,{className:`oc-bridge-config-dialog`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Z.jsxs)(Ft,{children:[(0,Z.jsx)(Lt,{children:De({instance:e.displayName??e.name})}),(0,Z.jsx)(Rt,{children:Ae()})]}),(0,Z.jsx)(jn,{instance:e,onClose:t})]})})}function $({label:e,result:t}){return t?t.checked?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row `+(t.ok?`oc-bridge-config__check-row--ok`:`oc-bridge-config__check-row--err`),children:[t.ok?(0,Z.jsx)(St,{"aria-hidden":!0}):(0,Z.jsx)(j,{"aria-hidden":!0}),(0,Z.jsxs)(`span`,{children:[e,` — `,t.ok?We():t.detail]})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--skip`,children:[e,` — `,rt()]}):null}function jn({instance:e,onClose:t}){let n=dt(T.admin.upsertInstanceConfig),r=Me(T.bridge.validateMediaPaths),i=Nt(),a=Vt(e.config?.contentLocale,void 0),[o,c]=(0,G.useState)(()=>mt(e.config??{},a)),[l,u]=(0,G.useState)(!1),[d,f]=(0,G.useState)(!1),[p,h]=(0,G.useState)(null),g=o.inboundMediaMode===`shared-fs`,_=o.mediaMode===`shared-fs`,v=g||_;async function y(){f(!0),h(null);try{h(await r({instanceName:e.name,inboundMediaMode:o.inboundMediaMode,mediaMode:o.mediaMode}))}catch(e){i.error(Le(),e)}finally{f(!1)}}async function b(){u(!0);try{let r=e.config??{};await n({instanceId:e._id,config:gt(o,r,a)}),t()}catch(e){i.error(ee(),e)}finally{u(!1)}}return(0,Z.jsx)(`div`,{className:`oc-bridge-config`,children:(0,Z.jsxs)(`div`,{className:`oc-bridge-config__form`,children:[(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:tt(),help:xe()}),(0,Z.jsxs)(I,{value:o.mediaMode,onValueChange:e=>c({...o,mediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(P,{children:_t.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:ie(),help:s()}),(0,Z.jsxs)(I,{value:o.inboundMediaMode,onValueChange:e=>c({...o,inboundMediaMode:e}),children:[(0,Z.jsx)(N,{size:`sm`,className:`w-full`,children:(0,Z.jsx)(M,{})}),(0,Z.jsx)(P,{children:ht.map(e=>(0,Z.jsx)(F,{value:e,children:e},e))})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:m(),help:se()}),(0,Z.jsx)(R,{type:`number`,min:1,max:4096,className:`w-full`,value:o.mediaMaxMb,onChange:e=>c({...o,mediaMaxMb:Math.trunc(Number(e.target.value)||0)})})]})]}),v&&(0,Z.jsxs)(`div`,{className:`oc-bridge-config__grid`,children:[g&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:Ye(),help:$e()}),(0,Z.jsx)(R,{className:`w-full`,spellCheck:!1,value:o.inboundAgentMount,onChange:e=>c({...o,inboundAgentMount:e.target.value})})]}),_&&(0,Z.jsxs)(`label`,{className:`oc-field`,children:[(0,Z.jsx)(D,{label:He(),help:ze()}),(0,Z.jsx)(R,{className:`w-full`,spellCheck:!1,value:o.outboundAgentMount,onChange:e=>c({...o,outboundAgentMount:e.target.value})})]})]}),(0,Z.jsxs)(`label`,{className:`oc-field--row`,children:[(0,Z.jsx)(Tt,{checked:o.rehydration,onCheckedChange:e=>c({...o,rehydration:e===!0})}),(0,Z.jsx)(D,{label:we(),help:te()})]}),v&&p!==null&&(0,Z.jsx)(`div`,{className:`oc-bridge-config__check`,children:p.reachable?!p.inbound&&!p.outbound?(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(j,{"aria-hidden":!0}),at({reason:p.reason??`?`})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)($,{label:Ze(),result:p.inbound}),(0,Z.jsx)($,{label:Pe(),result:p.outbound}),(0,Z.jsx)(`p`,{className:`oc-admin__hint`,children:it()})]}):(0,Z.jsxs)(`p`,{className:`oc-bridge-config__check-row oc-bridge-config__check-row--err`,children:[(0,Z.jsx)(j,{"aria-hidden":!0}),Xe()]})}),(0,Z.jsxs)(`div`,{className:`oc-bridge-config__actions`,children:[v&&(0,Z.jsxs)(L,{variant:`outline`,size:`sm`,onClick:()=>void y(),disabled:d,children:[d?(0,Z.jsx)(wt,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,d?qe():st()]}),(0,Z.jsx)(L,{size:`sm`,onClick:()=>void b(),disabled:l,children:ye()})]})]})})}function Mn({versions:e}){if(e.length===0)return null;let t=[...e].reverse();return(0,Z.jsxs)(Ot,{children:[(0,Z.jsx)(Dt,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:`oc-compat__versions-btn`,children:[e.length===1?pt():he({count:e.length}),(0,Z.jsx)(k,{size:13,"aria-hidden":!0})]})}),(0,Z.jsxs)(Et,{className:`oc-compat__versions-pop`,align:`start`,children:[(0,Z.jsx)(`p`,{className:`oc-compat__versions-title`,children:ce()}),(0,Z.jsx)(`div`,{className:`oc-compat__versions-list`,children:t.map(e=>(0,Z.jsx)(z,{variant:`secondary`,children:e},e))})]})]})}export{Tn as BridgeTab,An as InstanceConfigDialog};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$ as r,$v as i,An as a,B as o,Cn as s,Dn as c,En as l,F as u,G as d,H as f,I as p,J as m,Jj as h,K as g,L as _,Mn as v,Nn as y,Ny as b,On as x,P as ee,Pn as S,Q as te,Qv as C,R as w,Sn as ne,Tn as T,U as E,V as D,W as re,X as ie,Xv as O,Y as ae,Yv as k,Z as oe,Zv as A,_Q as se,_n as ce,ah as le,bQ as j,bb as M,bn as ue,ch as de,dn as fe,et as pe,ey as me,fn as he,gd as ge,gn as _e,hn as ve,ih as ye,jn as be,k as xe,kn as Se,lQ as N,lh as Ce,ln as we,mb as Te,mn as Ee,nh as De,nt as Oe,ny as ke,oh as Ae,pb as je,pn as Me,q as Ne,rh as Pe,rt as Fe,ry as Ie,sh as Le,t as P,th as Re,ty as ze,uh as Be,un as Ve,vb as He,vn as Ue,wn as We,xn as Ge,yQ as F,yn as Ke,z as qe}from"./api-CWqdeSbN.js";import{t as Je}from"./use_paginated_query-CebdO_HQ.js";import{t as Ye}from"./loader-circle-BqKiW3X9.js";import{t as I}from"./checkbox-DPxJTQjc.js";import{t as Xe}from"./plus-DTL4K-j9.js";import{t as Ze}from"./triangle-alert-DoL9TI6v.js";import{a as L,i as R,n as z,r as B,t as V}from"./select-CjcMQhwm.js";import{n as Qe,r as $e,t as et}from"./popover-C-Y_Yoco.js";import{t as H}from"./button-C_rIPtCv.js";import{t as U}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{a as tt,t as W}from"./KnobRow-D6kXWvVI.js";import{n as nt}from"./capabilities-CASxhKEd.js";import{a as rt}from"./compatView-Cz5KNXa-.js";/* empty css */import{t as it}from"./switch--NPD3Vp0.js";var at=xe(`undo-2`,[[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}],[`path`,{d:`M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11`,key:`f3b9sd`}]]),G=t(e(),1),ot=[`off`,`minimal`,`low`,`medium`,`high`,`xhigh`];function st(e){let t=typeof e==`object`&&e?e:{},n=t.defaults!==null&&typeof t.defaults==`object`?t.defaults:{},r=n.thinkingDefault??t.thinkingDefault,i=n.fastModeDefault??t.fastModeDefault;return{thinkingDefault:typeof r==`string`?r:null,fastModeDefault:typeof i==`boolean`?i:null}}var ct=[`auto`,`hybrid`,`tool`,`off`];function lt(e){switch(e){case`auto`:return be();case`hybrid`:return a();case`tool`:return Se();default:return x()}}function K(e){return{injection:e.injection??`auto`,defaultSources:e.defaultSources,...e.config?{config:e.config}:{}}}function ut(e){return typeof e==`string`&&ct.includes(e)}function q(e){return{injection:ut(e.injection)?e.injection:`auto`,sources:e.defaultSources.filter(t=>e.sources.some(e=>e.id===t))}}function dt(e,t){let n=new Set(e);return n.size===new Set(t).size&&t.every(e=>n.has(e))}function ft(e,t,n){let r=n?e.defaultWriteRefused===`scope_refused`?s():pt(e)?Me():null:We(),i=q(e),a=t.injection!==i.injection||!dt(t.sources,i.sources),o=new Set(e.sources.map(e=>e.id)),c=t.sources.length>0&&t.sources.length<=16&&t.sources.every(e=>o.has(e));return{readOnlyReason:r,dirty:a,valid:c,invalidReason:c?null:l()}}function pt(e){return(e.contract??1)<2&&e.ownAllowlist===!1}function mt(e,t,n){let r=t.sources.includes(n)?t.sources.filter(e=>e!==n):[...t.sources,n];return{...t,sources:e.sources.map(e=>e.id).filter(e=>r.includes(e))}}function ht(e){return e.ok?null:e.code===`scope_refused`?s():e.code===`stale_default`?ne():e.code===`write_unknown`||e.code===`not_confirmed`?Ke():e.code===`not_applied`?Ue():e.code===`default_too_large`?fe():e.code===`allowlist_too_large`?he():e.code===`plugin_too_old`?Me():e.code===`source_not_allowed`?Ee():e.code===`plugin_config_lag`?ve():e.code===`knowledge_unavailable`&&e.reason===`plugin_absent`?T():Ge({code:e.code})}function gt(e,t){let n=K(e),r=K(t);if(n.injection!==r.injection||!dt(n.defaultSources,r.defaultSources))return!0;let i=n.config,a=r.config;return i===void 0||a===void 0?i!==a:i.injection!==a.injection||!((e,t)=>e===null||t===null?e===t:e.length===t.length&&e.every((e,n)=>e===t[n]))(i.sources,a.sources)}var J=n();function _t({instanceName:e,row:t,supported:n}){let r=se(P.knowledge.setAgentKnowledgeDefault),[i,a]=(0,G.useState)(t),[o,s]=(0,G.useState)(()=>q(t)),[l,u]=(0,G.useState)(`idle`),[d,f]=(0,G.useState)(null),[p,m]=(0,G.useState)(!1),h=e=>{a(e),s(q(e)),f(null)},g=gt(i,t);(0,G.useEffect)(()=>{p&&g&&(m(!1),h(t))},[p,g]);let _=ft(i,o,n),y=_.readOnlyReason===null;async function b(){u(`saving`),f(null);try{let n=ht(await r({instanceName:e,agentId:t.agentId,injection:o.injection,sources:o.sources,expected:K(i)}));f(n),u(n===null?`done`:`idle`),n===null&&m(!0)}catch(e){f(ht({ok:!1,code:String(e?.message??`error`).slice(0,60)})),u(`idle`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,"data-knowledge-agent":t.agentId,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:t.agentId}),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsxs)(V,{value:o.injection,onValueChange:e=>{ut(e)&&s({...o,injection:e})},disabled:!y,children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":v(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:ct.map(e=>(0,J.jsx)(B,{value:e,children:lt(e)},e))})]})}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:c()}),t.sources.map(e=>(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:y?`pointer`:`default`},title:e.description||void 0,children:[(0,J.jsx)(I,{checked:o.sources.includes(e.id),onCheckedChange:()=>s(mt(t,o,e.id)),disabled:!y,"aria-label":e.label,"data-knowledge-default-source":e.id}),(0,J.jsx)(`span`,{children:e.label})]},e.id)),g&&!p?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[Ve(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>h(t),children:we()})]}):null,t.overridesAllowed?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ue()}),y?(0,J.jsx)(`div`,{className:`oc-cdefaults__inline`,children:(0,J.jsx)(H,{size:`sm`,disabled:!_.dirty||!_.valid||l===`saving`,onClick:()=>void b(),children:l===`saving`?M():A()})}):(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:_.readOnlyReason}),y&&_.dirty&&_.invalidReason!==null?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:_.invalidReason}):null,l===`done`&&d===null?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,d===null?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:d})]})]})}function vt({instanceName:e}){let t=j(P.knowledge.knowledgeAdminInstance,{instanceName:e}),{results:n,status:r,loadMore:i}=Je(P.knowledge.agentKnowledgePage,{instanceName:e},{initialNumItems:50});return t===void 0||t.provider!==`openclaw`||n.length===0&&r!==`CanLoadMore`?null:(0,J.jsxs)(`section`,{className:`oc-cdefaults__row`,"aria-label":S(),children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:S()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:y()}),t.supported?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:We()}),n.map(n=>(0,J.jsx)(_t,{instanceName:e,row:n,supported:t.supported},n.agentId)),r===`CanLoadMore`||r===`LoadingMore`?(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:ce({shown:n.length})}),(0,J.jsx)(H,{variant:`outline`,size:`sm`,disabled:r===`LoadingMore`,onClick:()=>i(50),"data-knowledge-load-more":!0,children:_e()})]}):null]})}function Y(e){return e.displayName??e.agentId}function yt(e){return e.displayName!==null&&e.displayName.toLowerCase()!==e.agentId.toLowerCase()}function X(e){return e.normalize(`NFD`).replace(/\p{Diacritic}/gu,``).toLowerCase().trim()}function bt(e,t){let n=X(t);return n===``||X(Y(e)).includes(n)||X(e.agentId).includes(n)}var xt=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function Z(e,t){return xt.compare(Y(e),Y(t))||xt.compare(e.agentId,t.agentId)}function St(e,t){return e.filter(e=>e.showReasoningDefault!==null).sort(Z).map(e=>({agent:e,show:e.showReasoningDefault,sameAsDefault:e.showReasoningDefault===t}))}function Ct(e,t){return wt(e.length)?e.filter(e=>bt(e.agent,t)):[...e]}function wt(e){return e>8}function Q(e,t){let n=e.filter(e=>e.showReasoningDefault===null&&e.presentInLastOk!==!1&&bt(e,t));return[...n.filter(e=>e.enabled).sort(Z),...n.filter(e=>!e.enabled).sort(Z)]}function Tt(e){return!e}function Et(e,t){return t===null?-1:e.findIndex(e=>e.agentId===t)}function Dt(e,t){return t===null?e[0]??null:e.find(e=>e.agentId===t)??null}function Ot(e,t,n){if(n===0)return-1;switch(t){case`ArrowDown`:return e<0?0:Math.min(e+1,n-1);case`ArrowUp`:return e<=0?0:e-1;case`Home`:return 0;case`End`:return n-1;default:return Math.min(e,n-1)}}var $=e=>e?Fe():Oe();function kt(e,t){return e===null||e.kind!==t.kind?!1:e.kind===`instance`||t.kind===`agent`&&e.agentId===t.agentId}function At({instanceName:e}){let t=j(P.agents.listAgentsForInstance,{instanceName:e}),n=F(P.agents.setInstanceReasoningDefault),i=F(P.agents.setAgentReasoningDefault),[a,s]=(0,G.useState)(null),[c,l]=(0,G.useState)(null),[d,f]=(0,G.useState)(``),[h,v]=(0,G.useState)(``),y=(0,G.useRef)(null),b=(0,G.useId)(),x=t?.showReasoningDefault===!0,S=t?.agents??[],C=(0,G.useMemo)(()=>St(S,x),[S,x]),w=Ct(C,h),ne=Q(S,``).length>0;async function T(e,t,n){s(e),l(null),f(``);try{return await t(),f(n),!0}catch{return l(e),!1}finally{s(t=>t===e?null:t)}}let E=t=>void T({kind:`instance`},()=>n({instanceName:e,show:t}),_({value:$(t)})),D=(t,n,r)=>T({kind:`agent`,agentId:t.agentId},()=>i({instanceName:e,agentId:t.agentId,show:n}),r);async function re(e){await D(e,null,ee({agent:Y(e)}))&&y.current?.focus()}let O=a!==null;return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row oc-rdefaults`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:pe()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:r()}),t===void 0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):S.length===0?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:te()}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__default`,children:[(0,J.jsx)(`label`,{htmlFor:b,className:`oc-rdefaults__default-label`,children:oe()}),(0,J.jsx)(`span`,{className:`oc-rdefaults__state`,"aria-hidden":!0,children:a?.kind===`instance`?(0,J.jsx)(Ye,{size:14,className:`oc-rdefaults__spin`}):$(x)}),(0,J.jsx)(it,{id:b,checked:x,disabled:O,"aria-busy":a?.kind===`instance`,onCheckedChange:E})]}),c?.kind===`instance`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsxs)(`div`,{className:`oc-rdefaults__exhead`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__exlabel`,children:ie({count:C.length})}),(0,J.jsx)(jt,{agents:S,instanceDefault:x,disabled:!ne,triggerRef:y,onPick:e=>{let t=Tt(x);D(e,t,p({agent:Y(e),value:$(t)}))}})]}),C.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ae()}):(0,J.jsxs)(J.Fragment,{children:[wt(C.length)?(0,J.jsx)(U,{type:`search`,value:h,onChange:e=>v(e.target.value),placeholder:o(),"aria-label":o(),className:`oc-rdefaults__filter`}):null,w.length===0?(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:qe()}):(0,J.jsx)(`ul`,{className:`oc-rdefaults__list`,"aria-label":ie({count:C.length}),children:w.map(({agent:e,show:t,sameAsDefault:n})=>{let r=Y(e),i={kind:`agent`,agentId:e.agentId};return(0,J.jsxs)(`li`,{className:`oc-rdefaults__item`,children:[(0,J.jsxs)(`div`,{className:`oc-rdefaults__who`,children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:r}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,n?(0,J.jsx)(`span`,{className:`oc-rdefaults__same`,children:m()}):null]}),(0,J.jsxs)(`div`,{className:`oc-rdefaults__ctl`,children:[kt(a,i)?(0,J.jsx)(Ye,{size:14,className:`oc-rdefaults__spin`,"aria-label":M()}):null,(0,J.jsx)(W,{field:`showReasoning`,ariaLabel:Ne({agent:r}),options:[{id:`on`,label:Fe()},{id:`off`,label:Oe()}],value:t?`on`:`off`,onChange:t=>void D(e,t===`on`,u({agent:r,value:$(t===`on`)})),disabled:O}),(0,J.jsx)(H,{variant:`ghost`,size:`icon`,disabled:O,"aria-label":g({agent:r}),title:g({agent:r}),onClick:()=>void re(e),children:(0,J.jsx)(at,{"aria-hidden":!0})})]}),kt(c,i)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error oc-rdefaults__rowerror`,role:`alert`,children:k()}):null]},e.agentId)})})]}),c?.kind===`agent`&&!C.some(e=>e.agent.agentId===c.agentId)?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null]}),(0,J.jsx)(`p`,{className:`oc-sr-only`,"aria-live":`polite`,"aria-atomic":`true`,children:d})]})}function jt({agents:e,instanceDefault:t,disabled:n,triggerRef:r,onPick:i}){let[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(``),[l,u]=(0,G.useState)(null),p=(0,G.useId)(),m=(0,G.useRef)(null),h=Q(e,s),g=Et(h,l),_=Q(e,``).length===0,v=e=>`${p}-opt-${e}`;function y(){o(!1),c(``),u(null)}function b(e){u(e>=0?h[e].agentId:null),e>=0&&m.current?.querySelector(`#${CSS.escape(v(e))}`)?.scrollIntoView({block:`nearest`})}function x(e){if(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Home`||e.key===`End`)e.preventDefault(),b(Ot(g,e.key,h.length));else if(e.key===`Enter`){e.preventDefault();let t=Dt(h,l);t===null?u(null):(y(),i(t))}}return(0,J.jsxs)(et,{open:a,onOpenChange:e=>e?o(!0):y(),children:[(0,J.jsx)($e,{asChild:!0,children:(0,J.jsxs)(H,{ref:r,variant:`outline`,size:`sm`,disabled:n,children:[(0,J.jsx)(Xe,{"aria-hidden":!0}),d()]})}),(0,J.jsxs)(Qe,{align:`end`,className:`oc-rdefaults__pop p-0`,children:[(0,J.jsx)(`p`,{className:`oc-rdefaults__pophint`,children:re({value:$(Tt(t))})}),(0,J.jsx)(U,{autoFocus:!0,type:`search`,role:`combobox`,"aria-expanded":!0,"aria-controls":p,"aria-autocomplete":`list`,"aria-activedescendant":g>=0&&g<h.length?v(g):void 0,"aria-label":E(),placeholder:E(),value:s,onChange:e=>{c(e.target.value),u(null)},onKeyDown:x,className:`oc-rdefaults__search`}),(0,J.jsx)(`div`,{id:p,ref:m,role:`listbox`,"aria-label":d(),className:`oc-rdefaults__options`,children:h.length===0?(0,J.jsx)(`p`,{className:`oc-rdefaults__empty`,children:_?D():f()}):h.map((e,t)=>(0,J.jsxs)(`div`,{id:v(t),role:`option`,"aria-selected":t===g,className:`oc-rdefaults__opt${e.enabled?``:` is-disabled`}${t===g?` is-active`:``}`,onMouseEnter:()=>u(e.agentId),onMouseDown:e=>e.preventDefault(),onClick:()=>{y(),i(e)},children:[(0,J.jsx)(`span`,{className:`oc-rdefaults__name`,children:Y(e)}),yt(e)?(0,J.jsx)(`span`,{className:`oc-rdefaults__id`,children:e.agentId}):null,e.enabled?null:(0,J.jsx)(`span`,{className:`oc-rdefaults__badge`,children:w()})]},e.agentId))})]})]})}function Mt({instance:e}){let t=F(P.admin.upsertInstanceConfig),n=j(P.agents.listAgentsForInstance,{instanceName:e.name}),r=typeof e.config?.converterAgentId==`string`?e.config.converterAgentId:``,[i,a]=(0,G.useState)(r),[o,s]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(r),s(`idle`)},[e._id,r]);let c=`__none__`,l=i!==r;async function u(){s(`saving`);try{let n={...e.config??{}};i===``||i===c?delete n.converterAgentId:n.converterAgentId=i,await t({instanceId:e._id,config:n}),s(`done`)}catch{s(`error`)}}let d=n?.agents??[];return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Le()}),(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ae()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsxs)(V,{value:i===``?c:i,onValueChange:e=>a(e===c?``:e),children:[(0,J.jsx)(R,{className:`oc-cdefaults__select`,"aria-label":Le(),children:(0,J.jsx)(L,{placeholder:le()})}),(0,J.jsxs)(z,{children:[(0,J.jsx)(B,{value:c,children:le()}),d.map(e=>(0,J.jsx)(B,{value:e.agentId,children:e.displayName?`${e.displayName} (${e.agentId})`:e.agentId},e.agentId))]})]}),(0,J.jsx)(H,{size:`sm`,disabled:!l||o===`saving`,onClick:()=>void u(),children:o===`saving`?M():A()})]}),o===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,o===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null]})}function Nt({instance:e}){let t=F(P.admin.upsertInstanceConfig),n=e.config?.curationEnabled===!0,r=typeof e.config?.curationBudgetChars==`number`?e.config.curationBudgetChars:null,[i,a]=(0,G.useState)(n),[o,s]=(0,G.useState)(r===null?``:String(r)),[c,l]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{a(n),s(r===null?``:String(r)),l(`idle`)},[e._id,n,r]);let u=o.trim(),d=u===``?null:/^\d+$/.test(u)?Number.parseInt(u,10):NaN,f=!i||d===null||Number.isInteger(d)&&d>=4e3&&d<=6e4,p=i!==n||(d??null)!==r;async function m(){l(`saving`);try{let n={...e.config??{}};n.curationEnabled=i,!i||d===null||Number.isNaN(d)?delete n.curationBudgetChars:n.curationBudgetChars=d,await t({instanceId:e._id,config:n}),l(`done`)}catch{l(`error`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsxs)(`label`,{className:`oc-cdefaults__inline`,style:{cursor:`pointer`},children:[(0,J.jsx)(I,{checked:i,onCheckedChange:e=>a(e===!0),"aria-label":de()}),(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:de()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(U,{type:`number`,min:4e3,max:6e4,step:1e3,placeholder:`20000`,value:o,onChange:e=>s(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!f,"aria-label":ye(),disabled:!i}),(0,J.jsx)(H,{size:`sm`,disabled:!p||!f||c===`saving`,onClick:()=>void m(),children:c===`saving`?M():A()})]}),f?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Pe()}),c===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,c===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:De()})]})}function Pt({instance:e}){let t=F(P.admin.upsertInstanceConfig),n=typeof e.config?.summarizeThresholdChars==`number`?e.config.summarizeThresholdChars:null,[r,i]=(0,G.useState)(n===null?``:String(n)),[a,o]=(0,G.useState)(`idle`);(0,G.useEffect)(()=>{i(n===null?``:String(n)),o(`idle`)},[e._id,n]);let s=r.trim(),c=s===``?null:/^\d+$/.test(s)?Number.parseInt(s,10):NaN,l=c===null||Number.isInteger(c)&&c>=1e3&&c<=2e5,u=(c??null)!==n;async function d(){o(`saving`);try{let n={...e.config??{}};c===null?delete n.summarizeThresholdChars:n.summarizeThresholdChars=c,await t({instanceId:e._id,config:n}),o(`done`)}catch{o(`error`)}}return(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:Be()}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__inline`,children:[(0,J.jsx)(U,{type:`number`,min:1e3,max:2e5,step:1e3,placeholder:`8000`,value:r,onChange:e=>i(e.target.value),className:`oc-cdefaults__number`,"aria-invalid":!l}),(0,J.jsx)(H,{size:`sm`,disabled:!u||!l||a===`saving`,onClick:()=>void d(),children:a===`saving`?M():A()})]}),l?null:(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:Re()}),a===`done`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:O()}):null,a===`error`?(0,J.jsx)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:k()}):null,(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:Ce()})]})}function Ft(){let e=se(P.agentFiles.getChatDefaults),[t,n]=(0,G.useState)({status:`loading`}),r=j(P.admin.listInstances,{}),[a,o]=(0,G.useState)(null);(0,G.useEffect)(()=>{!r||r.length===0||(!a||!r.some(e=>e.name===a))&&o(r[0].name)},[r,a]);let s=(r?.length??0)>1,c=r!==void 0&&r.length===0,l=j(P.compat.forInstance,a?{instanceName:a}:`skip`),u=a?nt(l,`configDefaults`):`loading`,d=u===`loading`?null:u.blocked,f=(0,G.useMemo)(()=>s&&a?{instanceName:a}:{},[s,a]),p=(0,G.useRef)(0),m=(0,G.useCallback)(async()=>{let t=++p.current;n({status:`loading`});try{let r=st(await e(f));if(p.current!==t)return;n({status:`done`,current:r})}catch{if(p.current!==t)return;n({status:`error`})}},[e,f]);(0,G.useEffect)(()=>{d===!1&&(s&&!a||m())},[m,d,s,a]);let g=t.status===`done`?t.current:null,_=(0,G.useMemo)(()=>ot.map(e=>({id:e,label:tt(e)})),[]),v=(0,G.useMemo)(()=>[{id:`fast`,label:Te()},{id:`standard`,label:je()}],[]);return(0,J.jsxs)(`div`,{className:`oc-cdefaults`,children:[(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:Ie()}),s&&a?(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:b()}),(0,J.jsxs)(V,{value:a,onValueChange:e=>o(e),children:[(0,J.jsx)(R,{size:`sm`,"aria-label":b(),children:(0,J.jsx)(L,{})}),(0,J.jsx)(z,{children:(r??[]).map(e=>(0,J.jsx)(B,{value:e.name,children:e.name},e.name))})]})]}):null,c?(0,J.jsx)(`p`,{className:`oc-admin__hint`,role:`status`,children:h()}):u===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):u.blocked?(0,J.jsxs)(`p`,{className:`oc-compat__blocked`,role:`status`,children:[(0,J.jsx)(Ze,{size:14,"aria-hidden":!0}),` `,rt(u.gatewayVersion,u.provider)]}):t.status===`loading`?(0,J.jsx)(`p`,{className:`oc-admin__hint`,children:N()}):t.status===`error`?(0,J.jsxs)(`p`,{className:`oc-cdefaults__error`,role:`alert`,children:[C(),` `,(0,J.jsx)(H,{variant:`outline`,size:`sm`,onClick:()=>void m(),children:He()})]}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:ke()}),(0,J.jsx)(W,{field:`thinkingLevel`,options:_,value:g?.thinkingDefault??null,onChange:()=>{},disabled:!0,ariaLabel:ke()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:ze()})]}),(0,J.jsxs)(`div`,{className:`oc-cdefaults__row`,children:[(0,J.jsx)(`span`,{className:`oc-cdefaults__label`,children:me()}),(0,J.jsx)(W,{field:`fastMode`,options:v,value:g===null||g.fastModeDefault===null?null:g.fastModeDefault?`fast`:`standard`,onChange:()=>{},disabled:!0,ariaLabel:me()}),(0,J.jsx)(`p`,{className:`oc-cdefaults__help`,children:i()})]}),(0,J.jsx)(`p`,{className:`oc-cdefaults__note`,children:ge()})]}),(()=>{let e=r?.find(e=>e.name===(a??r[0]?.name));return e?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pt,{instance:e}),(0,J.jsx)(Nt,{instance:e}),(0,J.jsx)(Mt,{instance:e}),(0,J.jsx)(At,{instanceName:e.name}),(0,J.jsx)(vt,{instanceName:e.name})]}):null})()]})}export{Ft as ChatDefaultsTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bf as r,Hf as i,Lf as a,Rf as o,Vf as s,zf as c}from"./api-jG5Fwsg4.js";import{a as l,c as u,i as d,o as f,r as p,s as m,t as h}from"./alert-dialog-BwvaE8oD.js";import{t as g}from"./button-sV7hIR3f.js";import{t as _}from"./input-DReDYsos.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-Bpoyy7pR.js";var w=t(e(),1),T=n(),E=w.createContext(null);function D({children:e}){let[t,n]=w.useState(null),D=w.useRef(null),O=w.useRef(null),[k,A]=w.useState(``),j=w.useCallback(e=>{let t=D.current;D.current=null,n(null),t&&t(e)},[]),M=w.useMemo(()=>({confirm:e=>new Promise(t=>{D.current=t,A(``),n({kind:`confirm`,opts:e})}),prompt:e=>new Promise(t=>{D.current=t,A(e.defaultValue??``),n({kind:`prompt`,opts:e})})}),[]),N=t?.kind===`confirm`,P=t?.kind===`prompt`,F=t?.kind===`confirm`?t.opts.confirmWord:void 0,I=!F||k.trim().toLowerCase()===F.trim().toLowerCase(),L=k.trim().length>0||t?.kind===`prompt`&&t.opts.allowEmpty===!0,R=e=>{e.preventDefault(),requestAnimationFrame(()=>O.current?.focus())};return(0,T.jsxs)(E.Provider,{value:M,children:[e,(0,T.jsx)(h,{open:N,onOpenChange:e=>{e||j(!1)},children:N?(0,T.jsxs)(d,{onOpenAutoFocus:F?R:void 0,returnFocus:t.opts.returnFocus,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(u,{children:t.opts.title}),t.opts.description?(0,T.jsx)(l,{children:t.opts.description}):null]}),F?(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[c(),` `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:a({word:F})}),` `,o()]}),(0,T.jsx)(_,{ref:O,value:k,placeholder:F,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I&&(e.preventDefault(),j(!0))}})]}):null,(0,T.jsxs)(f,{children:[(0,T.jsx)(p,{onClick:()=>j(!1),children:t.opts.cancelLabel??i()}),(0,T.jsx)(g,{variant:t.opts.destructive?`destructive`:`default`,disabled:!I,onClick:()=>j(!0),children:t.opts.confirmLabel??s()})]})]}):null}),(0,T.jsx)(C,{open:P,onOpenChange:e=>{e||j(null)},children:P?(0,T.jsxs)(b,{onOpenAutoFocus:R,returnFocus:t.opts.returnFocus,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(v,{children:[(0,T.jsx)(x,{children:t.opts.title}),t.opts.description?(0,T.jsx)(S,{children:t.opts.description}):null]}),(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[t.opts.label?(0,T.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.opts.label}):null,(0,T.jsx)(_,{ref:O,value:k,placeholder:t.opts.placeholder,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&L&&(e.preventDefault(),j(k.trim()))}})]}),(0,T.jsxs)(y,{children:[(0,T.jsx)(g,{variant:`outline`,onClick:()=>j(null),children:t.opts.cancelLabel??i()}),(0,T.jsx)(g,{disabled:!L,onClick:()=>j(k.trim()),children:t.opts.confirmLabel??r()})]})]}):null})]})}function O(){let e=w.useContext(E);if(!e)throw Error(`useConfirm/usePrompt must be used within <DialogsProvider>`);return e}function k(){return O().confirm}function A(){return O().prompt}export{k as n,A as r,D as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bf as r,Hf as i,Uf as a,Vf as o,Wf as s,zf as c}from"./api-CWqdeSbN.js";import{a as l,c as u,i as d,o as f,r as p,s as m,t as h}from"./alert-dialog-BcJMHbhI.js";import{t as g}from"./button-C_rIPtCv.js";import{t as _}from"./input-CSZu-bVE.js";import{a as v,i as y,n as b,o as x,r as S,t as C}from"./dialog-CPAskUwF.js";var w=t(e(),1),T=n(),E=w.createContext(null);function D({children:e}){let[t,n]=w.useState(null),D=w.useRef(null),O=w.useRef(null),[k,A]=w.useState(``),j=w.useCallback(e=>{let t=D.current;D.current=null,n(null),t&&t(e)},[]),M=w.useMemo(()=>({confirm:e=>new Promise(t=>{D.current=t,A(``),n({kind:`confirm`,opts:e})}),prompt:e=>new Promise(t=>{D.current=t,A(e.defaultValue??``),n({kind:`prompt`,opts:e})})}),[]),N=t?.kind===`confirm`,P=t?.kind===`prompt`,F=t?.kind===`confirm`?t.opts.confirmWord:void 0,I=!F||k.trim().toLowerCase()===F.trim().toLowerCase(),L=k.trim().length>0||t?.kind===`prompt`&&t.opts.allowEmpty===!0,R=e=>{e.preventDefault(),requestAnimationFrame(()=>O.current?.focus())};return(0,T.jsxs)(E.Provider,{value:M,children:[e,(0,T.jsx)(h,{open:N,onOpenChange:e=>{e||j(!1)},children:N?(0,T.jsxs)(d,{onOpenAutoFocus:F?R:void 0,returnFocus:t.opts.returnFocus,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(m,{children:[(0,T.jsx)(u,{children:t.opts.title}),t.opts.description?(0,T.jsx)(l,{children:t.opts.description}):null]}),F?(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,T.jsxs)(`span`,{className:`text-sm text-muted-foreground`,children:[o(),` `,(0,T.jsx)(`span`,{className:`font-medium text-foreground`,children:c({word:F})}),` `,r()]}),(0,T.jsx)(_,{ref:O,value:k,placeholder:F,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&I&&(e.preventDefault(),j(!0))}})]}):null,(0,T.jsxs)(f,{children:[(0,T.jsx)(p,{onClick:()=>j(!1),children:t.opts.cancelLabel??s()}),(0,T.jsx)(g,{variant:t.opts.destructive?`destructive`:`default`,disabled:!I,onClick:()=>j(!0),children:t.opts.confirmLabel??a()})]})]}):null}),(0,T.jsx)(C,{open:P,onOpenChange:e=>{e||j(null)},children:P?(0,T.jsxs)(b,{onOpenAutoFocus:R,returnFocus:t.opts.returnFocus,...t.opts.description?{}:{"aria-describedby":void 0},children:[(0,T.jsxs)(v,{children:[(0,T.jsx)(x,{children:t.opts.title}),t.opts.description?(0,T.jsx)(S,{children:t.opts.description}):null]}),(0,T.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[t.opts.label?(0,T.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:t.opts.label}):null,(0,T.jsx)(_,{ref:O,value:k,placeholder:t.opts.placeholder,autoComplete:`off`,onChange:e=>A(e.target.value),onKeyDown:e=>{e.key===`Enter`&&L&&(e.preventDefault(),j(k.trim()))}})]}),(0,T.jsxs)(y,{children:[(0,T.jsx)(g,{variant:`outline`,onClick:()=>j(null),children:t.opts.cancelLabel??s()}),(0,T.jsx)(g,{disabled:!L,onClick:()=>j(k.trim()),children:t.opts.confirmLabel??i()})]})]}):null})]})}function O(){let e=w.useContext(E);if(!e)throw Error(`useConfirm/usePrompt must be used within <DialogsProvider>`);return e}function k(){return O().confirm}function A(){return O().prompt}export{k as n,A as r,D as t};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Bw as r,Gw as i,Hw as a,Kw as o,Uw as s,Vw as c,Ww as l,uQ as u}from"./api-jG5Fwsg4.js";import{r as d}from"./dist-Bxf4XoMW.js";import{t as f}from"./chevron-up-DQBDpk9Z.js";import{t as p}from"./chevrons-up-down-3woN2nFd.js";import{c as m,g as h,n as g,r as _,s as v,t as y}from"./dropdown-menu-yCbwljS-.js";import{t as b}from"./checkbox-U99HMqP3.js";import{t as x}from"./plus-A35Qzur2.js";import{t as S}from"./trash-2-UxV-pTWt.js";import{t as C}from"./button-sV7hIR3f.js";import{a as w,i as T,n as E,o as D,r as O,t as k}from"./table-CIrFKiPM.js";import{t as A}from"./useTableLayout-Cmwnuzxb.js";var j=t(e(),1);function M(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function N(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=M(i,a);return n===`asc`?c:-c})}var P=n();function F({title:e,rows:t,columns:n,rowActions:M,onAdd:F,addLabel:I=o(),bulkActions:L,emptyHint:R=i(),isExpanded:z,renderExpanded:B}){let[V,H]=(0,j.useState)(new Set),U=(0,j.useRef)(null),[W,G]=(0,j.useState)(null),K=t??[],q=W?n[W.index]:void 0,J=W&&q?.sort?N(K,q.sort,W.dir):K;function Y(e){G(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let X=+!!L+n.length+ +!!M,Z=K.length>0&&V.size===K.length,Q=V.size>0&&!Z,$=A(U,[t,W?.index,W?.dir,n.length,!!L,!!M,u()]);function ee(){H(Z?new Set:new Set(K.map(e=>e._id)))}function te(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsxs)(`div`,{className:`oc-dt`,children:[(0,P.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,P.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,P.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[V.size>0&&L?L.map(e=>(0,P.jsxs)(C,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...V]),H(new Set)},children:[e.variant===`destructive`?(0,P.jsx)(S,{}):null,e.label,` (`,V.size,`)`]},e.label)):null,F?(0,P.jsxs)(C,{size:`sm`,onClick:F,children:[(0,P.jsx)(x,{}),` `,I]}):null]})]}),t===void 0?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:l()}):K.length===0?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:R}):(0,P.jsx)(`div`,{ref:U,className:`oc-tablefit`,"data-layout":$,children:(0,P.jsxs)(k,{children:[(0,P.jsx)(w,{children:(0,P.jsxs)(D,{children:[L?(0,P.jsx)(T,{className:`oc-dt__check w-8`,children:(0,P.jsx)(b,{"aria-label":s(),checked:Z?!0:Q?`indeterminate`:!1,onCheckedChange:ee})}):null,n.map((e,t)=>{let n=W?.index===t;return e.sort?(0,P.jsx)(T,{className:e.className,"aria-sort":n?W.dir===`asc`?`ascending`:`descending`:`none`,children:(0,P.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>Y(t),"aria-label":r({column:e.header}),children:[e.header,n?W.dir===`asc`?(0,P.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,P.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,P.jsx)(p,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,P.jsx)(T,{className:e.className,children:e.header},e.header)}),M?(0,P.jsx)(T,{className:`w-8`}):null]})}),(0,P.jsx)(E,{children:J.map(e=>{let t=M?.(e)??[],r=z?.(e)??!1;return(0,P.jsxs)(j.Fragment,{children:[(0,P.jsxs)(D,{className:`oc-reveal-host group/row`,children:[L?(0,P.jsx)(O,{className:`oc-dt__check`,children:(0,P.jsx)(b,{"aria-label":a(),checked:V.has(e._id),onCheckedChange:()=>te(e._id)})}):null,n.map((t,n)=>(0,P.jsx)(O,{className:n===0?`oc-dt__lead ${t.className??``}`:t.className,"data-label":t.header,children:t.cell(e)},t.header)),M?(0,P.jsx)(O,{className:`oc-dt__actions`,children:t.length>0?(0,P.jsxs)(y,{children:[(0,P.jsx)(m,{asChild:!0,children:(0,P.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":c(),className:`oc-reveal oc-hit`,children:(0,P.jsx)(h,{})})}),(0,P.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,P.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,P.jsx)(v,{}):null,(0,P.jsx)(_,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&B?(0,P.jsx)(D,{className:`oc-dt__expansion`,children:(0,P.jsx)(O,{colSpan:X,className:`oc-dt__expansion-cell`,children:B(e)})}):null]},e._id)})})]})})]})}export{F as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Gw as r,Hw as i,Jw as a,Kw as o,Uw as s,Ww as c,fQ as l,qw as u}from"./api-CWqdeSbN.js";import{r as d}from"./dist-CzmY6YrA.js";import{t as f}from"./chevron-up-B3KYmtzo.js";import{t as p}from"./chevrons-up-down-CITEfz7_.js";import{c as m,g as h,n as g,r as _,s as v,t as y}from"./dropdown-menu-BVKVjups.js";import{t as b}from"./checkbox-DPxJTQjc.js";import{t as x}from"./plus-DTL4K-j9.js";import{t as S}from"./trash-2-xhtrhYsd.js";import{t as C}from"./button-C_rIPtCv.js";import{a as w,i as T,n as E,o as D,r as O,t as k}from"./table-rRR3TpMc.js";import{t as A}from"./useTableLayout-Cmwnuzxb.js";var j=t(e(),1);function M(e,t){return typeof e==`number`&&typeof t==`number`?e-t:typeof e==`boolean`&&typeof t==`boolean`?!!e-+!!t:String(e).localeCompare(String(t),void 0,{numeric:!0,sensitivity:`base`})}function N(e,t,n){return[...e].sort((e,r)=>{let i=t(e),a=t(r),o=i==null,s=a==null;if(o||s)return o&&s?0:o?1:-1;let c=M(i,a);return n===`asc`?c:-c})}var P=n();function F({title:e,rows:t,columns:n,rowActions:M,onAdd:F,addLabel:I=a(),bulkActions:L,emptyHint:R=u(),isExpanded:z,renderExpanded:B}){let[V,H]=(0,j.useState)(new Set),U=(0,j.useRef)(null),[W,G]=(0,j.useState)(null),K=t??[],q=W?n[W.index]:void 0,J=W&&q?.sort?N(K,q.sort,W.dir):K;function Y(e){G(t=>!t||t.index!==e?{index:e,dir:`asc`}:t.dir===`asc`?{index:e,dir:`desc`}:null)}let X=+!!L+n.length+ +!!M,Z=K.length>0&&V.size===K.length,Q=V.size>0&&!Z,$=A(U,[t,W?.index,W?.dir,n.length,!!L,!!M,l()]);function ee(){H(Z?new Set:new Set(K.map(e=>e._id)))}function te(e){H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}return(0,P.jsxs)(`div`,{className:`oc-dt`,children:[(0,P.jsxs)(`div`,{className:`oc-dt__bar`,children:[(0,P.jsx)(`h2`,{className:`oc-dt__title`,children:e}),(0,P.jsxs)(`div`,{className:`oc-dt__bar-actions`,children:[V.size>0&&L?L.map(e=>(0,P.jsxs)(C,{size:`sm`,variant:e.variant===`destructive`?`destructive`:`outline`,onClick:()=>{e.onSelect([...V]),H(new Set)},children:[e.variant===`destructive`?(0,P.jsx)(S,{}):null,e.label,` (`,V.size,`)`]},e.label)):null,F?(0,P.jsxs)(C,{size:`sm`,onClick:F,children:[(0,P.jsx)(x,{}),` `,I]}):null]})]}),t===void 0?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:o()}):K.length===0?(0,P.jsx)(`p`,{className:`oc-admin__hint`,children:R}):(0,P.jsx)(`div`,{ref:U,className:`oc-tablefit`,"data-layout":$,children:(0,P.jsxs)(k,{children:[(0,P.jsx)(w,{children:(0,P.jsxs)(D,{children:[L?(0,P.jsx)(T,{className:`oc-dt__check w-8`,children:(0,P.jsx)(b,{"aria-label":r(),checked:Z?!0:Q?`indeterminate`:!1,onCheckedChange:ee})}):null,n.map((e,t)=>{let n=W?.index===t;return e.sort?(0,P.jsx)(T,{className:e.className,"aria-sort":n?W.dir===`asc`?`ascending`:`descending`:`none`,children:(0,P.jsxs)(`button`,{type:`button`,className:`oc-dt__sort`,onClick:()=>Y(t),"aria-label":i({column:e.header}),children:[e.header,n?W.dir===`asc`?(0,P.jsx)(f,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,P.jsx)(d,{className:`oc-dt__sort-icon`,"aria-hidden":!0}):(0,P.jsx)(p,{className:`oc-dt__sort-icon oc-dt__sort-icon--idle`,"aria-hidden":!0})]})},e.header):(0,P.jsx)(T,{className:e.className,children:e.header},e.header)}),M?(0,P.jsx)(T,{className:`w-8`}):null]})}),(0,P.jsx)(E,{children:J.map(e=>{let t=M?.(e)??[],r=z?.(e)??!1;return(0,P.jsxs)(j.Fragment,{children:[(0,P.jsxs)(D,{className:`oc-reveal-host group/row`,children:[L?(0,P.jsx)(O,{className:`oc-dt__check`,children:(0,P.jsx)(b,{"aria-label":c(),checked:V.has(e._id),onCheckedChange:()=>te(e._id)})}):null,n.map((t,n)=>(0,P.jsx)(O,{className:n===0?`oc-dt__lead ${t.className??``}`:t.className,"data-label":t.header,children:t.cell(e)},t.header)),M?(0,P.jsx)(O,{className:`oc-dt__actions`,children:t.length>0?(0,P.jsxs)(y,{children:[(0,P.jsx)(m,{asChild:!0,children:(0,P.jsx)(C,{variant:`ghost`,size:`icon-sm`,"aria-label":s(),className:`oc-reveal oc-hit`,children:(0,P.jsx)(h,{})})}),(0,P.jsx)(g,{align:`end`,children:t.map((t,n)=>(0,P.jsxs)(`div`,{children:[t.variant===`destructive`&&n>0?(0,P.jsx)(v,{}):null,(0,P.jsx)(_,{variant:t.variant,onSelect:()=>t.onSelect(e),children:t.label})]},t.label))})]}):null}):null]}),r&&B?(0,P.jsx)(D,{className:`oc-dt__expansion`,children:(0,P.jsx)(O,{colSpan:X,className:`oc-dt__expansion-cell`,children:B(e)})}):null]},e._id)})})]})})]})}export{F as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{HM as t,aO as n,hO as r,mO as i,oO as a,sO as o,t as s,yQ as c}from"./api-CWqdeSbN.js";import{t as l}from"./use_paginated_query-CebdO_HQ.js";import{t as u}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{n as d}from"./ConfirmDialog-B7k0wvSi.js";import{r as f}from"./trashView-CwUC01r_.js";import{n as p,t as m}from"./trashPage-3suR6eIy.js";var h=e();function g(){let{results:e,status:g,loadMore:_}=l(s.trash.listMyTrash,{},{initialNumItems:50}),v=f(),y=c(s.trash.restoreChat),b=c(s.trash.purgeChat),x=c(s.trash.emptyTrash),S=d();return(0,h.jsxs)(`div`,{className:`oc-trash__body`,children:[(0,h.jsxs)(`div`,{className:`oc-trash__head`,children:[(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:r({days:v})}),e.length>0?(0,h.jsx)(u,{variant:`destructive`,size:`sm`,onClick:async()=>{await S({title:a(),description:n(),confirmLabel:o(),destructive:!0})&&await x({})},children:o()}):null]}),g===`LoadingFirstPage`?(0,h.jsx)(`p`,{className:`oc-trash__hint`,children:t()}):e.length===0?(0,h.jsx)(`p`,{className:`oc-trash__empty`,children:i()}):(0,h.jsx)(m,{items:e,onRestore:e=>y({chatId:e}),onPurge:e=>b({chatId:e})}),(0,h.jsx)(p,{status:g,loadMore:_})]})}export{g as DeletedChatsTab};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{t}from"./badge-CSm2xaYH.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{t}from"./badge-ChMMFtuW.js";var n=e();function r({icon:e,total:r,items:i}){if(r===0)return(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip oc-group-chip--empty gap-1`,children:[e,`0`]});let a=r-i.length;return(0,n.jsxs)(`div`,{className:`oc-group-detail`,children:[i.map((e,r)=>(0,n.jsxs)(t,{variant:e.highlight?`secondary`:`outline`,className:`oc-group-chip gap-1`,title:e.label,children:[e.marker,(0,n.jsx)(`span`,{className:`oc-group-chip__txt`,children:e.label})]},r)),a>0?(0,n.jsxs)(t,{variant:`outline`,className:`oc-group-chip`,children:[`+`,a]}):null]})}export{r as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Cb as r,Ff as i,If as a,i as o,o as s}from"./api-CWqdeSbN.js";import{t as c}from"./loader-circle-BqKiW3X9.js";import{t as l}from"./x-CcIT4ync.js";import{a as u,i as d,n as f,o as p,r as m,s as h,t as g}from"./dist-Uf18yR_a.js";import{t as _}from"./button-C_rIPtCv.js";var v=t(e(),1),y=n();function b({...e}){return(0,y.jsx)(p,{"data-slot":`sheet`,...e})}function x({...e}){return(0,y.jsx)(g,{"data-slot":`sheet-close`,...e})}function S({...e}){return(0,y.jsx)(u,{"data-slot":`sheet-portal`,...e})}function C({className:e,...t}){return(0,y.jsx)(d,{"data-slot":`sheet-overlay`,className:s(`fixed inset-0 z-50 bg-black/10 duration-100 supports-backdrop-filter:backdrop-blur-xs data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0`,e),...t})}function w({className:e,overlayClassName:t,children:n,side:i=`right`,showCloseButton:a=!0,returnFocus:c,...u}){let d=o(`dialog`,c);return(0,y.jsxs)(S,{children:[(0,y.jsx)(C,{className:t}),(0,y.jsxs)(f,{"data-slot":`sheet-content`,"data-side":i,className:s(`fixed z-50 flex flex-col gap-4 overflow-y-auto bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:border-r data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:border-l data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-[side=bottom]:data-open:slide-in-from-bottom-10 data-[side=left]:data-open:slide-in-from-left-10 data-[side=right]:data-open:slide-in-from-right-10 data-[side=top]:data-open:slide-in-from-top-10 data-closed:animate-out data-closed:fade-out-0 data-[side=bottom]:data-closed:slide-out-to-bottom-10 data-[side=left]:data-closed:slide-out-to-left-10 data-[side=right]:data-closed:slide-out-to-right-10 data-[side=top]:data-closed:slide-out-to-top-10`,e),...u,ref:d.ref,onCloseAutoFocus:d.onCloseAutoFocus,children:[n,a&&(0,y.jsx)(g,{"data-slot":`sheet-close`,asChild:!0,children:(0,y.jsxs)(_,{variant:`ghost`,className:`absolute top-3 right-3`,size:`icon-sm`,children:[(0,y.jsx)(l,{}),(0,y.jsx)(`span`,{className:`sr-only`,children:r()})]})})]})]})}function T({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`sheet-header`,className:s(`flex flex-col gap-0.5 p-4`,e),...t})}function E({className:e,...t}){return(0,y.jsx)(`div`,{"data-slot":`sheet-footer`,className:s(`mt-auto flex flex-col gap-2 p-4`,e),...t})}function D({className:e,...t}){return(0,y.jsx)(h,{"data-slot":`sheet-title`,className:s(`font-heading text-base font-medium text-foreground`,e),...t})}function O({className:e,...t}){return(0,y.jsx)(m,{"data-slot":`sheet-description`,className:s(`text-sm text-muted-foreground`,e),...t})}function k({open:e,onOpenChange:t,title:n,description:r,children:o,onSubmit:s,submitLabel:l,submitting:u=!1,canSubmit:d=!0}){let[f,p]=(0,v.useState)(!1),m=u||f;async function h(){if(!(!d||m))try{p(!0),await s()}finally{p(!1)}}return(0,y.jsx)(b,{open:e,onOpenChange:t,children:(0,y.jsxs)(w,{side:`right`,className:`oc-entity-sheet sm:max-w-none gap-0 p-0`,children:[(0,y.jsxs)(T,{className:`border-b px-6 py-4`,children:[(0,y.jsx)(D,{children:n}),r?(0,y.jsx)(O,{children:r}):null]}),(0,y.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:e=>{e.preventDefault(),h()},children:[(0,y.jsx)(`div`,{className:`oc-sheet__body flex-1 overflow-y-auto px-6 py-4`,children:o}),(0,y.jsxs)(E,{className:`border-t px-6 py-4`,children:[(0,y.jsxs)(_,{type:`submit`,disabled:!d||m,children:[m?(0,y.jsx)(c,{className:`size-4 animate-spin`}):null,l??a()]}),(0,y.jsx)(_,{type:`button`,variant:`ghost`,onClick:()=>t(!1),children:i()})]})]})]})})}export{O as a,D as c,w as i,b as n,E as o,x as r,T as s,k as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$R as r,AR as i,BR as a,Cz as o,DR as s,Dz as c,ER as l,Ez as u,FR as d,GR as f,HR as p,IR as m,JR as ee,KR as te,LR as ne,MR as re,NR as ie,OR as ae,PR as oe,QR as h,RR as se,Sz as g,TR as _,Tz as v,UR as y,VR as b,WR as x,XR as S,YR as C,ZR as w,_z as T,am as E,az as D,bQ as O,bz as k,cz as A,dz as j,ez as M,fz as N,gz as P,hz as F,iz as I,jR as L,kR as R,lz as z,mz as B,nz as ce,oz as V,pz as H,qR as U,rm as W,rz as G,sz as K,t as q,tz as le,uz as ue,vz as de,wz as fe,xz as pe,yQ as J,yz as me,zR as he}from"./api-CWqdeSbN.js";import{t as ge}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{n as _e}from"./format-AQELUhPa.js";import{n as Y}from"./ConfirmDialog-B7k0wvSi.js";import{t as ve}from"./DataTableShell-DvtkASQG.js";var X=t(e(),1),Z=n(),ye={altered_words:()=>c(),incorrect:()=>u(),incoherence:()=>v(),formatting:()=>fe(),latency:()=>o(),api_error:()=>g(),other:()=>pe()},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:me()}):e===!1?(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:de()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:`—`}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:k()})}function be({data:e,reference:t,closeReason:n}){let i=e.snapshot,a=J(q.feedback.respondToFeedback),[o,s]=(0,X.useState)(e.thread),[c,l]=(0,X.useState)(``),[u,d]=(0,X.useState)(!1);async function p(){let t=c.trim();if(!(!t||u)){d(!0);try{await a({feedbackId:e._id,text:t}),s(e=>[...e,{authorRole:`admin`,text:t,at:Date.now()}]),l(``)}finally{d(!1)}}}let m=[];try{m=i.contextJson?JSON.parse(i.contextJson):[]}catch{m=[]}return(0,Z.jsxs)(`div`,{className:`oc-fbadmin__detail`,children:[(0,Z.jsxs)(`div`,{className:`oc-fbadmin__row`,children:[(0,Z.jsx)($,{matches:i.displayedMatchesStored,sourceWasOpen:i.clientInfo?.sourceWasOpen??!1}),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__meta`,children:[Q(e.category),` · `,i.messageRole,i.isRegeneration?` · ${T()}`:``,i.openclawModel?` · ${i.openclawModel}`:``,i.openclawRuntime?` (${i.openclawRuntime})`:``]}),t?(0,Z.jsx)(`code`,{className:`oc-fbadmin__ref`,style:{userSelect:`all`,marginLeft:`auto`},title:f(),children:t}):null]}),e.comment?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:P()}),(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:L()}),(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:F()}),o.length>0?(0,Z.jsx)(`div`,{className:`oc-fbadmin__thread`,children:o.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`?B():e.authorRole===`agent`?e.authorLabel??E():H()}),(0,Z.jsx)(`span`,{className:`oc-notif__msg-text`,children:e.text})]},t))}):(0,Z.jsx)(`p`,{className:`oc-fbadmin__meta`,children:N()}),(0,Z.jsx)(`textarea`,{className:`oc-feedback__textarea`,placeholder:j(),value:c,maxLength:2e3,rows:3,onChange:e=>l(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 p(),disabled:!c.trim()||u,children:u?ue():z()})})]}),(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:A()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.messageText||K()})]}),i.clientInfo?.sourceWasOpen&&i.displayedText!==void 0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:V()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.displayedText||K()})]}):null,i.promptText?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:D()}),(0,Z.jsx)(`pre`,{className:`oc-msg__source-pre`,children:i.promptText})]}):null,m.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:I({count:i.contextCount??m.length,truncated:i.contextTruncated?G():``})}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__ctx`,children:m.map((e,t)=>(0,Z.jsxs)(`div`,{className:`oc-fbadmin__ctx-turn`,children:[(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-role`,children:e.role}),(0,Z.jsx)(`span`,{className:`oc-fbadmin__ctx-text`,children:e.text})]},t))})]}):null,i.outboxAvailable?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:ce()}),(0,Z.jsxs)(`pre`,{className:`oc-msg__source-pre`,children:[i.outboxText??``,i.outboxStatus?`\n[status: ${i.outboxStatus}]`:``]})]}):null,i.clientInfo?.extensionsDetected&&i.clientInfo.extensionsDetected.length>0?(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:le()}),(0,Z.jsx)(`div`,{className:`oc-fbadmin__row`,children:i.clientInfo.extensionsDetected.map(e=>(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-warn`,children:e},e))})]}):null,(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h4`,{className:`oc-fbadmin__h`,children:M()}),(0,Z.jsxs)(`p`,{className:`oc-fbadmin__env`,children:[[i.clientInfo?.language,i.clientInfo?.timezone,i.clientInfo?.theme?r({theme:i.clientInfo.theme}):null,i.runId?`run ${i.runId.slice(0,12)}…`:null].filter(Boolean).join(` · `)||`—`,i.clientInfo?.plugins&&i.clientInfo.plugins.length>0?(0,Z.jsxs)(`span`,{className:`oc-fbadmin__plugins`,children:[h(),` `,i.clientInfo.plugins.join(`, `),(0,Z.jsxs)(`span`,{className:`oc-fbadmin__note`,children:[` `,w()]})]}):null,i.clientInfo?.userAgent?(0,Z.jsx)(`span`,{className:`oc-fbadmin__ua`,children:i.clientInfo.userAgent}):null]})]})]})}function xe(){let e=O(q.feedback.listForAdmin,{}),t=J(q.feedback.readSnapshot),n=J(q.feedback.deleteFeedback),r=Y(),[o,c]=(0,X.useState)(null),[u,f]=(0,X.useState)({});async function h(e){if(o===e._id){c(null);return}if(!u[e._id]){let n=await t({feedbackId:e._id});f(t=>({...t,[e._id]:n}))}c(e._id)}async function g(e){await r({title:s(),description:l(),confirmLabel:_(),destructive:!0})&&(await n({feedbackId:e._id}),o===e._id&&c(null))}return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{className:`oc-admin__hint`,children:[S(),` `,(0,Z.jsx)(`strong`,{children:C()}),` `,ee()]}),(0,Z.jsx)(ve,{title:U(),rows:e,emptyHint:te(),isExpanded:e=>o===e._id&&!!u[e._id],renderExpanded:e=>u[e._id]?(0,Z.jsx)(be,{data:u[e._id],reference:e.reference,closeReason:e.userCloseReason}):null,columns:[{header:x(),cell:e=>_e(e.at),sort:e=>e.at},{header:y(),cell:e=>Q(e.category),sort:e=>Q(e.category)},{header:p(),cell:e=>e.messageRole===`user`?b():a(),sort:e=>e.messageRole},{header:he(),cell:e=>(e.reporterEmail||e.reporterName||`—`)+(e.impersonated&&e.realOperatorEmail?` ${se({operator:e.realOperatorEmail})}`:``),sort:e=>e.reporterEmail||e.reporterName||null},{header:ne(),cell:e=>(0,Z.jsx)($,{matches:e.displayedMatchesStored,sourceWasOpen:e.sourceWasOpen}),sort:e=>e.displayedMatchesStored===!1?0:e.displayedMatchesStored===!0?1:2},{header:m(),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:oe()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill`,children:ie()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-ok`,title:e.resolvedBy??void 0,children:W()}):(0,Z.jsx)(`span`,{className:`oc-fbadmin__pill is-closed`,children:re()}),sort:e=>e.userClosedAt==null?e.resolvedAt==null?+!!e.answered:2:3}],rowActions:e=>[{label:o===e._id?i():R(),onSelect:()=>void h(e)},{label:ae(),onSelect:()=>void g(e),variant:`destructive`}]})]})}export{xe as FeedbacksTab};
@@ -1 +1 @@
1
- import{r as e}from"./bundle-mjs-C73ZY4La.js";import{TQ as t,k as n}from"./api-jG5Fwsg4.js";import{c as r,i,l as a,n as o,r as s,s as c,t as l}from"./tooltip-CobtYK4c.js";import{n as u,r as d,t as f}from"./popover-BcL-AsC2.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var p=Object.defineProperty,m=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h=(e,t,n)=>m(e,typeof t==`symbol`?t:t+``,n),g=`https://docs.convex.dev/error#undefined-validator`;function _(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${g} for details.`)}var v=class{constructor({isOptional:e}){h(this,`type`),h(this,`fieldPaths`),h(this,`isOptional`),h(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},y=class e extends v{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),h(this,`tableName`),h(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},b=class e extends v{constructor(){super(...arguments),h(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends v{constructor(){super(...arguments),h(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends v{constructor(){super(...arguments),h(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends v{constructor(){super(...arguments),h(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},w=class e extends v{constructor(){super(...arguments),h(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},T=class e extends v{constructor(){super(...arguments),h(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},E=class e extends v{constructor(){super(...arguments),h(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},D=class e extends v{constructor({isOptional:e,fields:t}){super({isOptional:e}),h(this,`fields`),h(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&_(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},O=class e extends v{constructor({isOptional:e,value:t}){if(super({isOptional:e}),h(this,`value`),h(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:t(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},k=class e extends v{constructor({isOptional:e,element:t}){super({isOptional:e}),h(this,`element`),h(this,`kind`,`array`),t===void 0&&_(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},A=class e extends v{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),h(this,`key`),h(this,`value`),h(this,`kind`,`record`),t===void 0&&_(`v.record()`,`key`),n===void 0&&_(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},j=class e extends v{constructor({isOptional:e,members:t}){super({isOptional:e}),h(this,`members`),h(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&_(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},M={id:e=>new y({isOptional:`required`,tableName:e}),null:()=>new T({isOptional:`required`}),number:()=>new b({isOptional:`required`}),float64:()=>new b({isOptional:`required`}),bigint:()=>new x({isOptional:`required`}),int64:()=>new x({isOptional:`required`}),boolean:()=>new S({isOptional:`required`}),string:()=>new w({isOptional:`required`}),bytes:()=>new C({isOptional:`required`}),literal:e=>new O({isOptional:`required`,value:e}),array:e=>new k({isOptional:`required`,element:e}),object:e=>new D({isOptional:`required`,fields:e}),record:(e,t)=>new A({isOptional:`required`,key:e,value:t}),union:(...e)=>new j({isOptional:`required`,members:e}),any:()=>new E({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>M.union(e,M.null())},N=n(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),P=[`gateway-http`,`shared-fs`,`off`],F=[`inline`,`shared-fs`],I=[`reactive`,`sse`],L=`reactive`;M.object({mediaMode:M.optional(M.union(M.literal(`gateway-http`),M.literal(`shared-fs`),M.literal(`off`))),inboundMediaMode:M.optional(M.union(M.literal(`inline`),M.literal(`shared-fs`))),rehydration:M.optional(M.boolean()),mediaMaxMb:M.optional(M.number()),attachmentFixAttested:M.optional(M.boolean()),summarizeThresholdChars:M.optional(M.number()),curationEnabled:M.optional(M.boolean()),curationBudgetChars:M.optional(M.number()),converterAgentId:M.optional(M.string()),voiceEnabled:M.optional(M.boolean()),talkEnabled:M.optional(M.boolean()),widgetsEnabled:M.optional(M.boolean()),widgetPromptConfirm:M.optional(M.boolean()),voiceEngine:M.optional(M.union(M.literal(`browser`),M.literal(`gateway`))),voiceLang:M.optional(M.string()),voiceRate:M.optional(M.number()),voiceAutoRead:M.optional(M.boolean()),contentLocale:M.optional(M.string()),inboundAgentMount:M.optional(M.string()),outboundAgentMount:M.optional(M.string()),transcriptProjection:M.optional(M.union(M.literal(`off`),M.literal(`shadow`),M.literal(`on`))),promptInjections:M.optional(M.record(M.string(),M.object({enabled:M.optional(M.boolean()),template:M.optional(M.string())})))});var R={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function z(e,t){let n={};for(let i of a){let a=e?.[i];n[i]={enabled:a?.enabled??!0,template:typeof a?.template==`string`&&a.template.length>0?a.template:r[i].defaultTemplate[t]}}return n}function B(e,t){let n={};for(let i of a){let a=r[i],o=e[i];if(!o)continue;let s={};a.togglable&&o.enabled===!1&&(s.enabled=!1);let c=o.template.trim();c.length>0&&c!==a.defaultTemplate[t]&&(s.template=c),(s.enabled!==void 0||s.template!==void 0)&&(n[i]=s)}return n}function V(e,t){return{mediaMode:e.mediaMode??R.mediaMode,inboundMediaMode:e.inboundMediaMode??R.inboundMediaMode,rehydration:e.rehydration??R.rehydration,mediaMaxMb:e.mediaMaxMb??R.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??R.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??R.outboundAgentMount,promptInjections:z(e.promptInjections,t)}}var H=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function U(e,t,n){let r={},i=n=>{(e[n]!==R[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=B(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of H){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var W=e();function G({text:e}){return c()?(0,W.jsxs)(f,{children:[(0,W.jsx)(d,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`oc-field__help oc-hit`,"aria-label":e,children:(0,W.jsx)(N,{"aria-hidden":!0})})}),(0,W.jsx)(u,{className:`oc-fieldhelp w-auto p-3 text-sm text-pretty`,children:e})]}):(0,W.jsx)(s,{delayDuration:150,children:(0,W.jsxs)(l,{children:[(0,W.jsx)(i,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,W.jsx)(N,{"aria-hidden":!0})})}),(0,W.jsx)(o,{className:`max-w-xs text-pretty`,children:e})]})})}function K({label:e,help:t}){return(0,W.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,W.jsx)(G,{text:t})]})}export{L as a,I as c,V as i,K as n,F as o,U as r,P as s,G as t};
1
+ import{r as e}from"./bundle-mjs-C73ZY4La.js";import{DQ as t,k as n}from"./api-CWqdeSbN.js";import{c as r,i,l as a,n as o,r as s,s as c,t as l}from"./tooltip-Ct0TGxtk.js";import{n as u,r as d,t as f}from"./popover-C-Y_Yoco.js";import"./locales-CPjguROj.js";import"./curation-CQksaIbm.js";var p=Object.defineProperty,m=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h=(e,t,n)=>m(e,typeof t==`symbol`?t:t+``,n),g=`https://docs.convex.dev/error#undefined-validator`;function _(e,t){let n=t===void 0?``:` for field "${t}"`;throw Error(`A validator is undefined${n} in ${e}. This is often caused by circular imports. See ${g} for details.`)}var v=class{constructor({isOptional:e}){h(this,`type`),h(this,`fieldPaths`),h(this,`isOptional`),h(this,`isConvexValidator`),this.isOptional=e,this.isConvexValidator=!0}},y=class e extends v{constructor({isOptional:e,tableName:t}){if(super({isOptional:e}),h(this,`tableName`),h(this,`kind`,`id`),typeof t!=`string`)throw Error(`v.id(tableName) requires a string`);this.tableName=t}get json(){return{type:`id`,tableName:this.tableName}}asOptional(){return new e({isOptional:`optional`,tableName:this.tableName})}},b=class e extends v{constructor(){super(...arguments),h(this,`kind`,`float64`)}get json(){return{type:`number`}}asOptional(){return new e({isOptional:`optional`})}},x=class e extends v{constructor(){super(...arguments),h(this,`kind`,`int64`)}get json(){return{type:`bigint`}}asOptional(){return new e({isOptional:`optional`})}},S=class e extends v{constructor(){super(...arguments),h(this,`kind`,`boolean`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},C=class e extends v{constructor(){super(...arguments),h(this,`kind`,`bytes`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},w=class e extends v{constructor(){super(...arguments),h(this,`kind`,`string`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},T=class e extends v{constructor(){super(...arguments),h(this,`kind`,`null`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},E=class e extends v{constructor(){super(...arguments),h(this,`kind`,`any`)}get json(){return{type:this.kind}}asOptional(){return new e({isOptional:`optional`})}},D=class e extends v{constructor({isOptional:e,fields:t}){super({isOptional:e}),h(this,`fields`),h(this,`kind`,`object`),globalThis.Object.entries(t).forEach(([e,t])=>{if(t===void 0&&_(`v.object()`,e),!t.isConvexValidator)throw Error(`v.object() entries must be validators`)}),this.fields=t}get json(){return{type:this.kind,value:globalThis.Object.fromEntries(globalThis.Object.entries(this.fields).map(([e,t])=>[e,{fieldType:t.json,optional:t.isOptional===`optional`}]))}}asOptional(){return new e({isOptional:`optional`,fields:this.fields})}omit(...t){let n={...this.fields};for(let e of t)delete n[e];return new e({isOptional:this.isOptional,fields:n})}pick(...t){let n={};for(let e of t)n[e]=this.fields[e];return new e({isOptional:this.isOptional,fields:n})}partial(){let t={};for(let[e,n]of globalThis.Object.entries(this.fields))t[e]=n.asOptional();return new e({isOptional:this.isOptional,fields:t})}extend(t){return new e({isOptional:this.isOptional,fields:{...this.fields,...t}})}},O=class e extends v{constructor({isOptional:e,value:t}){if(super({isOptional:e}),h(this,`value`),h(this,`kind`,`literal`),typeof t!=`string`&&typeof t!=`boolean`&&typeof t!=`number`&&typeof t!=`bigint`)throw Error(`v.literal(value) must be a string, number, or boolean`);this.value=t}get json(){return{type:this.kind,value:t(this.value)}}asOptional(){return new e({isOptional:`optional`,value:this.value})}},k=class e extends v{constructor({isOptional:e,element:t}){super({isOptional:e}),h(this,`element`),h(this,`kind`,`array`),t===void 0&&_(`v.array()`),this.element=t}get json(){return{type:this.kind,value:this.element.json}}asOptional(){return new e({isOptional:`optional`,element:this.element})}},A=class e extends v{constructor({isOptional:e,key:t,value:n}){if(super({isOptional:e}),h(this,`key`),h(this,`value`),h(this,`kind`,`record`),t===void 0&&_(`v.record()`,`key`),n===void 0&&_(`v.record()`,`value`),t.isOptional===`optional`)throw Error(`Record validator cannot have optional keys`);if(n.isOptional===`optional`)throw Error(`Record validator cannot have optional values`);if(!t.isConvexValidator||!n.isConvexValidator)throw Error(`Key and value of v.record() but be validators`);this.key=t,this.value=n}get json(){return{type:this.kind,keys:this.key.json,values:{fieldType:this.value.json,optional:!1}}}asOptional(){return new e({isOptional:`optional`,key:this.key,value:this.value})}},j=class e extends v{constructor({isOptional:e,members:t}){super({isOptional:e}),h(this,`members`),h(this,`kind`,`union`),t.forEach((e,t)=>{if(e===void 0&&_(`v.union()`,`member at index ${t}`),!e.isConvexValidator)throw Error(`All members of v.union() must be validators`)}),this.members=t}get json(){return{type:this.kind,value:this.members.map(e=>e.json)}}asOptional(){return new e({isOptional:`optional`,members:this.members})}},M={id:e=>new y({isOptional:`required`,tableName:e}),null:()=>new T({isOptional:`required`}),number:()=>new b({isOptional:`required`}),float64:()=>new b({isOptional:`required`}),bigint:()=>new x({isOptional:`required`}),int64:()=>new x({isOptional:`required`}),boolean:()=>new S({isOptional:`required`}),string:()=>new w({isOptional:`required`}),bytes:()=>new C({isOptional:`required`}),literal:e=>new O({isOptional:`required`,value:e}),array:e=>new k({isOptional:`required`,element:e}),object:e=>new D({isOptional:`required`,fields:e}),record:(e,t)=>new A({isOptional:`required`,key:e,value:t}),union:(...e)=>new j({isOptional:`required`,members:e}),any:()=>new E({isOptional:`required`}),optional:e=>e.asOptional(),nullable:e=>M.union(e,M.null())},N=n(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),P=[`gateway-http`,`shared-fs`,`off`],F=[`inline`,`shared-fs`],I=[`reactive`,`sse`],L=`reactive`;M.object({mediaMode:M.optional(M.union(M.literal(`gateway-http`),M.literal(`shared-fs`),M.literal(`off`))),inboundMediaMode:M.optional(M.union(M.literal(`inline`),M.literal(`shared-fs`))),rehydration:M.optional(M.boolean()),mediaMaxMb:M.optional(M.number()),attachmentFixAttested:M.optional(M.boolean()),summarizeThresholdChars:M.optional(M.number()),curationEnabled:M.optional(M.boolean()),curationBudgetChars:M.optional(M.number()),converterAgentId:M.optional(M.string()),voiceEnabled:M.optional(M.boolean()),talkEnabled:M.optional(M.boolean()),widgetsEnabled:M.optional(M.boolean()),widgetPromptConfirm:M.optional(M.boolean()),voiceEngine:M.optional(M.union(M.literal(`browser`),M.literal(`gateway`))),voiceLang:M.optional(M.string()),voiceRate:M.optional(M.number()),voiceAutoRead:M.optional(M.boolean()),contentLocale:M.optional(M.string()),inboundAgentMount:M.optional(M.string()),outboundAgentMount:M.optional(M.string()),transcriptProjection:M.optional(M.union(M.literal(`off`),M.literal(`shadow`),M.literal(`on`))),promptInjections:M.optional(M.record(M.string(),M.object({enabled:M.optional(M.boolean()),template:M.optional(M.string())})))});var R={mediaMode:`gateway-http`,inboundMediaMode:`inline`,rehydration:!0,mediaMaxMb:1024,inboundAgentMount:`/home/node/.openclaw/media/inbound`,outboundAgentMount:`/home/node/.openclaw/media/outbound`};function z(e,t){let n={};for(let i of a){let a=e?.[i];n[i]={enabled:a?.enabled??!0,template:typeof a?.template==`string`&&a.template.length>0?a.template:r[i].defaultTemplate[t]}}return n}function B(e,t){let n={};for(let i of a){let a=r[i],o=e[i];if(!o)continue;let s={};a.togglable&&o.enabled===!1&&(s.enabled=!1);let c=o.template.trim();c.length>0&&c!==a.defaultTemplate[t]&&(s.template=c),(s.enabled!==void 0||s.template!==void 0)&&(n[i]=s)}return n}function V(e,t){return{mediaMode:e.mediaMode??R.mediaMode,inboundMediaMode:e.inboundMediaMode??R.inboundMediaMode,rehydration:e.rehydration??R.rehydration,mediaMaxMb:e.mediaMaxMb??R.mediaMaxMb,inboundAgentMount:e.inboundAgentMount??R.inboundAgentMount,outboundAgentMount:e.outboundAgentMount??R.outboundAgentMount,promptInjections:z(e.promptInjections,t)}}var H=[`attachmentFixAttested`,`summarizeThresholdChars`,`curationEnabled`,`curationBudgetChars`,`contentLocale`,`converterAgentId`,`voiceEnabled`,`talkEnabled`,`voiceEngine`,`voiceLang`,`voiceRate`,`voiceAutoRead`,`widgetsEnabled`,`widgetPromptConfirm`];function U(e,t,n){let r={},i=n=>{(e[n]!==R[n]||t[n]!==void 0)&&(r[n]=e[n])};i(`mediaMode`),i(`inboundMediaMode`),i(`rehydration`),i(`mediaMaxMb`),i(`inboundAgentMount`),i(`outboundAgentMount`);let a=B(e.promptInjections,n);Object.keys(a).length>0&&(r.promptInjections=a);let o=t;for(let e of H){let t=o[e];(typeof t==`number`||typeof t==`boolean`||typeof t==`string`)&&(r[e]=t)}return r}var W=e();function G({text:e}){return c()?(0,W.jsxs)(f,{children:[(0,W.jsx)(d,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`oc-field__help oc-hit`,"aria-label":e,children:(0,W.jsx)(N,{"aria-hidden":!0})})}),(0,W.jsx)(u,{className:`oc-fieldhelp w-auto p-3 text-sm text-pretty`,children:e})]}):(0,W.jsx)(s,{delayDuration:150,children:(0,W.jsxs)(l,{children:[(0,W.jsx)(i,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:`oc-field__help`,"aria-label":e,onClick:e=>e.preventDefault(),children:(0,W.jsx)(N,{"aria-hidden":!0})})}),(0,W.jsx)(o,{className:`max-w-xs text-pretty`,children:e})]})})}function K({label:e,help:t}){return(0,W.jsxs)(`span`,{className:`oc-field__label`,children:[e,(0,W.jsx)(G,{text:t})]})}export{L as a,I as c,V as i,K as n,F as o,U as r,P as s,G as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$X as ee,AZ as te,CZ as r,DZ as i,EZ as a,OZ as ne,QX as re,SZ as ie,TZ as ae,XX as oe,YX as o,ZX as s,_Z as c,aZ as l,bQ as se,bZ as ce,cZ as le,cm as ue,dZ as de,eZ as fe,fQ as pe,fZ as me,gZ as u,hZ as d,iZ as he,kZ as ge,lQ as _e,lZ as ve,lm as f,mZ as p,nZ as ye,oZ as be,pZ as m,rZ as h,sZ as xe,t as g,tZ as Se,uZ as _,vU as v,vZ as y,wZ as b,xZ as x,yQ as S,yZ as C}from"./api-CWqdeSbN.js";import{c as w,g as T,n as E,r as D,t as O}from"./dropdown-menu-BVKVjups.js";import{t as k}from"./download-BaebAe6Z.js";import{t as A}from"./checkbox-DPxJTQjc.js";import{t as j}from"./rotate-ccw-CvefWwHW.js";import{t as Ce}from"./trash-2-xhtrhYsd.js";import{a as M,i as N,n as P,r as F,t as I}from"./select-CjcMQhwm.js";import{a as we,c as Te,i as Ee,n as De,o as Oe,r as ke,s as Ae,t as je}from"./alert-dialog-BcJMHbhI.js";import{t as L}from"./button-C_rIPtCv.js";import"./convexApi-G20_TNBS.js";import{r as Me}from"./toast-C_YfUacM.js";import{t as R}from"./badge-ChMMFtuW.js";import{a as Ne,i as z,n as Pe,o as B,r as V,t as Fe}from"./table-rRR3TpMc.js";var H=t(e(),1),U=n(),W=`all`;function G(e){switch(e){case`image`:return C();case`audio`:return y();case`video`:return c();case`pdf`:return u();case`document`:return d();case`archive`:return p();default:return m()}}function K(){let[e,t]=(0,H.useState)(W),[n,c]=(0,H.useState)(W),[u,d]=(0,H.useState)(W),[p,m]=(0,H.useState)(W),[y,C]=(0,H.useState)(!1),[K,q]=(0,H.useState)(null),J=S(g.files.softDelete),Y=Me();function Ie(){t(W),c(W),d(W),m(W)}async function Le(){let e=K;if(q(null),e)try{await J({fileId:e.id}),Y.success(ye())}catch(e){Y.error(Se(),e)}}let X=se(g.files.listMine,{direction:e===W?void 0:e,chatId:n===W?void 0:n,instanceName:u===W?void 0:u,category:p===W?void 0:p,includeAutoGenerated:y||void 0}),Re=(0,H.useMemo)(()=>new Intl.DateTimeFormat(pe(),{dateStyle:`medium`,timeStyle:`short`}),[]);if(X===void 0)return(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:_e()});let{files:Z,facets:Q,truncated:ze,cap:Be}=X,$=e!==W||n!==W||u!==W||p!==W;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:te()}),(0,U.jsxs)(`div`,{className:`oc-files__filters`,style:{display:`flex`,flexWrap:`wrap`,gap:8,margin:`12px 0`},children:[(0,U.jsxs)(I,{value:e,onValueChange:t,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":ge(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(F,{value:W,children:ne()}),(0,U.jsx)(F,{value:`inbound`,children:i()}),(0,U.jsx)(F,{value:`outbound`,children:a()})]})]}),(0,U.jsxs)(I,{value:n,onValueChange:c,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":ae(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(F,{value:W,children:b()}),Q.chats.map(e=>(0,U.jsx)(F,{value:e.id,children:e.title},e.id))]})]}),Q.multiProvider?(0,U.jsxs)(I,{value:u,onValueChange:d,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":r(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(F,{value:W,children:ie()}),Q.instances.map(e=>(0,U.jsx)(F,{value:e,children:e},e))]})]}):null,(0,U.jsxs)(I,{value:p,onValueChange:m,children:[(0,U.jsx)(N,{size:`sm`,"aria-label":x(),children:(0,U.jsx)(M,{})}),(0,U.jsxs)(P,{children:[(0,U.jsx)(F,{value:W,children:ce()}),Q.categories.map(e=>(0,U.jsx)(F,{value:e,children:G(e)},e))]})]}),(0,U.jsxs)(`label`,{className:`oc-files__autogen`,children:[(0,U.jsx)(A,{checked:y,onCheckedChange:e=>C(e===!0),"aria-label":f()}),(0,U.jsx)(`span`,{children:f()})]}),$?(0,U.jsxs)(L,{variant:`ghost`,size:`sm`,onClick:Ie,style:{display:`inline-flex`,alignItems:`center`,gap:4,marginLeft:`auto`},children:[(0,U.jsx)(j,{size:14,"aria-hidden":!0}),l()]}):null]}),Z.length===0?(0,U.jsx)(`p`,{className:`oc-admin__hint`,children:$?oe():s()}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(Fe,{children:[(0,U.jsx)(Ne,{children:(0,U.jsxs)(B,{children:[(0,U.jsx)(z,{children:me()}),(0,U.jsx)(z,{children:de()}),(0,U.jsx)(z,{children:_()}),(0,U.jsx)(z,{children:ve()}),(0,U.jsx)(z,{children:le()}),(0,U.jsx)(z,{className:`text-right`,children:xe()})]})}),(0,U.jsx)(Pe,{children:Z.map(e=>(0,U.jsxs)(B,{children:[(0,U.jsxs)(V,{className:`font-medium`,style:{maxWidth:280,overflow:`hidden`,textOverflow:`ellipsis`},title:e.filename,children:[e.filename,e.origin===`pasted`?(0,U.jsx)(R,{variant:`outline`,style:{marginLeft:6},children:ue()}):null]}),(0,U.jsx)(V,{title:e.mimeType,children:G(e.category)}),(0,U.jsx)(V,{children:(0,U.jsx)(R,{variant:`secondary`,children:e.direction===`inbound`?i():a()})}),(0,U.jsx)(V,{style:{maxWidth:220,overflow:`hidden`,textOverflow:`ellipsis`},title:e.chatTitle,children:e.chatTitle}),(0,U.jsx)(V,{className:`whitespace-nowrap text-muted-foreground`,children:Re.format(e.createdAt)}),(0,U.jsx)(V,{className:`text-right`,children:(0,U.jsxs)(O,{children:[(0,U.jsx)(w,{asChild:!0,children:(0,U.jsx)(L,{variant:`ghost`,size:`icon`,"aria-label":he(),children:(0,U.jsx)(T,{size:16})})}),(0,U.jsxs)(E,{align:`end`,children:[e.url?(0,U.jsx)(D,{asChild:!0,children:(0,U.jsxs)(`a`,{href:e.url,download:e.filename,target:`_blank`,rel:`noopener noreferrer`,children:[(0,U.jsx)(k,{size:14}),be()]})}):(0,U.jsxs)(D,{disabled:!0,children:[(0,U.jsx)(k,{size:14}),re()]}),(0,U.jsxs)(D,{variant:`destructive`,onSelect:()=>q({id:e._id,filename:e.filename}),children:[(0,U.jsx)(Ce,{size:14}),h()]})]})]})})]},e._id))})]}),ze?(0,U.jsx)(`p`,{className:`oc-admin__hint`,style:{marginTop:8},children:o({cap:Be})}):null]}),(0,U.jsx)(je,{open:K!==null,onOpenChange:e=>!e&&q(null),children:(0,U.jsxs)(Ee,{children:[(0,U.jsxs)(Ae,{children:[(0,U.jsx)(Te,{children:fe()}),(0,U.jsx)(we,{children:ee()})]}),(0,U.jsxs)(Oe,{children:[(0,U.jsx)(ke,{children:v()}),(0,U.jsx)(De,{onClick:()=>void Le(),children:h()})]})]})})]})}export{K as FilesTab};
@@ -1 +1 @@
1
- import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Jw as r,qw as i}from"./api-jG5Fwsg4.js";import{t as a}from"./search-CGco_tlI.js";import{t as o}from"./rotate-ccw-XgdDTtI8.js";import{t as s}from"./button-sV7hIR3f.js";import{t as c}from"./input-DReDYsos.js";import{t as l}from"./TimeRangePicker-BvcqBpnq.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(a,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(s,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),i()]})]})}export{p as t};
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Xw as r,Yw as i}from"./api-CWqdeSbN.js";import{t as a}from"./search-Dz6sLH0-.js";import{t as o}from"./rotate-ccw-CvefWwHW.js";import{t as s}from"./button-C_rIPtCv.js";import{t as c}from"./input-CSZu-bVE.js";import{t as l}from"./TimeRangePicker-BZtw1JkM.js";var u=t(e(),1),d=n(),f=250;function p({q:e,onQChange:t,searchPlaceholder:n=r(),children:p,timeRange:m,onTimeRangeChange:h,onReset:g,canReset:_=!0}){let[v,y]=(0,u.useState)(e);(0,u.useEffect)(()=>{y(e)},[e]);let b=(0,u.useRef)(null);function x(e){y(e),b.current!==null&&window.clearTimeout(b.current),b.current=window.setTimeout(()=>t(e),f)}(0,u.useEffect)(()=>()=>{b.current!==null&&window.clearTimeout(b.current)},[]);function S(){b.current!==null&&window.clearTimeout(b.current),g()}return(0,d.jsxs)(`div`,{className:`oc-filterbar`,children:[(0,d.jsxs)(`div`,{className:`oc-filterbar__search`,children:[(0,d.jsx)(a,{className:`oc-filterbar__search-icon`,"aria-hidden":!0}),(0,d.jsx)(c,{value:v,onChange:e=>x(e.target.value),placeholder:n,"aria-label":n})]}),p?(0,d.jsx)(`div`,{className:`oc-filterbar__quick`,children:p}):null,m&&h?(0,d.jsx)(l,{value:m,onChange:h}):null,(0,d.jsxs)(s,{variant:`ghost`,size:`sm`,className:`oc-filterbar__reset`,onClick:S,disabled:!_,children:[(0,d.jsx)(o,{}),i()]})]})}export{p as t};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$b as r,$x as i,AS as a,BS as o,Bx as s,CS as c,Cx as l,DS as u,Dx as d,ES as f,Ex as p,FS as m,Fb as h,Fx as g,GS as _,Gb as v,Gx as y,HS as b,Hx as x,IS as S,Ib as C,Ix as w,JS as T,Jb as E,Jx as D,KS as O,Kb as k,Kx as A,LS as j,Lb as ee,Lx as te,MS as M,Mx as ne,NS as N,Nx as re,OS as ie,PS as P,Px as ae,Qb as F,Qx as oe,RS as se,Rb as ce,Rx as le,SS as ue,Sx as de,TS as fe,Tx as pe,US as me,Ux as he,VS as ge,Vx as I,WS as _e,Wb as ve,Wx as L,Xb as ye,Xx as be,Yb as xe,Yx as Se,Zb as Ce,Zx as we,_S as Te,_x as Ee,aS as De,ax as Oe,bQ as R,bS as ke,bx as Ae,cS as je,cx as Me,dS as Ne,dx as Pe,eS as Fe,ex as Ie,fS as Le,fx as Re,gS as ze,gx as Be,hx as Ve,iS as He,ix as Ue,jS as We,jx as Ge,k as Ke,kS as qe,lS as Je,lx as Ye,mx as Xe,nS as Ze,nx as Qe,oS as $e,ox as et,px as tt,qS as nt,qb as rt,qx as it,rS as at,rx as ot,sS as st,sx as ct,t as z,tS as lt,tx as ut,uS as B,ux as dt,vS as ft,vx as pt,wS as mt,wx as ht,xS as gt,xx as _t,yQ as V,yS as H,yx as vt,zS as yt,zx as bt}from"./api-CWqdeSbN.js";import{t as xt}from"./chevron-left-ByEQraEh.js";import{t as St}from"./chevron-right-DMqzlhWH.js";import{t as U}from"./checkbox-DPxJTQjc.js";import{t as Ct}from"./server-DcInl3Nh.js";import{i as wt,n as Tt,r as Et,t as Dt}from"./users-CRbE186D.js";import{t as W}from"./star-5ysDlx3k.js";import{t as Ot}from"./x-CcIT4ync.js";import{a as kt,i as At,n as jt,r as Mt,t as Nt}from"./select-CjcMQhwm.js";import{i as Pt,n as Ft,r as It,t as Lt}from"./tabs-B8emuY1B.js";import{t as G}from"./button-C_rIPtCv.js";import{t as K}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as q}from"./toast-C_YfUacM.js";import{t as J}from"./badge-ChMMFtuW.js";import{a as Rt,n as zt,o as Bt,r as Vt,t as Ht}from"./dialog-CPAskUwF.js";import{t as Ut}from"./appHost-CH3EGcJw.js";import{n as Wt}from"./ConfirmDialog-B7k0wvSi.js";import{t as Gt}from"./EntitySheet-DRzkWKlH.js";import{a as Y,c as Kt,d as qt,f as Jt,i as Yt,l as Xt,n as Zt,o as Qt,r as $t,t as X,u as en}from"./groupManageView-DC3eSLA1.js";import{t as tn}from"./FilterBar-DCCuFxDn.js";import{t as nn}from"./DataTableShell-DvtkASQG.js";import{t as Z}from"./DetailChips-DDAtgnjA.js";var rn=Ke(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Q=t(e(),1),$=n(),an={name:``,description:``};function on(){let e=R(z.groups.listGroups,{}),t=R(z.me.getMe,{host:Ut})?.role===`admin`,n=V(z.groups.createGroup),r=V(z.groups.updateGroup),i=V(z.groups.deleteGroup),s=Wt(),c=q(),[l,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(an),[v,y]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(``),E=(0,Q.useMemo)(()=>{if(!e)return e;let t=C.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,C]);function D(){p(null),g(an),d(!0)}function k(e){p(e),g({name:e.name,description:e.description??``}),d(!0)}async function A(){try{f?await r({groupId:f._id,name:h.name,description:h.description}):await n({name:h.name,description:h.description||void 0}),g(an),p(null),d(!1)}catch(e){c.error(he(),e)}}async function ee(e){if(await s({title:qe({name:e.name}),description:ie(),confirmWord:e.name,confirmLabel:u(),cancelLabel:m(),destructive:!0}))try{await i({groupId:e._id})}catch(e){c.error(x(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-admin__hint`,children:nt()}),t?(0,$.jsx)(pn,{}):null,(0,$.jsx)(tn,{q:C,onQChange:w,onReset:()=>w(``),canReset:C!==``,searchPlaceholder:o()}),(0,$.jsx)(nn,{title:T(),rows:E,addLabel:O(),onAdd:t?D:void 0,emptyHint:_(),columns:[{header:_e(),cell:e=>e.name,sort:e=>e.name},{header:me(),cell:e=>(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Z,{icon:(0,$.jsx)(Dt,{size:12,"aria-hidden":!0}),total:e.memberCount,items:e.members.map(e=>({label:e.label,marker:e.manager?(0,$.jsx)(wt,{size:11,"aria-hidden":!0}):null,highlight:e.manager}))}),e.pendingInviteCount>0?(0,$.jsx)(J,{variant:`secondary`,children:Ge({count:String(e.pendingInviteCount)})}):null]}),sort:e=>e.memberCount},{header:b(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(Ct,{size:12,"aria-hidden":!0}),total:e.agentCount,items:e.agents.map(e=>({label:e}))}),sort:e=>e.agentCount},{header:ge(),cell:e=>(0,$.jsx)(Z,{icon:(0,$.jsx)(rn,{size:12,"aria-hidden":!0}),total:e.chartCount,items:e.charts.map(e=>({label:e.name,marker:e.isDefault?(0,$.jsx)(W,{size:11,fill:`currentColor`,"aria-hidden":!0}):null,highlight:e.isDefault}))}),sort:e=>e.chartCount}],rowActions:e=>[{label:yt(),onSelect:()=>y({groupId:e._id,name:e.name})},...t?[{label:se(),onSelect:()=>k(e)},{label:j(),variant:`destructive`,onSelect:()=>void ee(e)}]:[]]}),(0,$.jsx)(Gt,{open:l,onOpenChange:d,title:f?N():P(),description:M(),canSubmit:!!h.name.trim(),onSubmit:A,submitLabel:S(),children:(0,$.jsxs)(`div`,{className:`oc-form`,children:[(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:We()}),(0,$.jsx)(K,{value:h.name,onChange:e=>g({...h,name:e.target.value})})]}),(0,$.jsxs)(`label`,{className:`oc-field`,children:[(0,$.jsx)(`span`,{className:`oc-field__label`,children:a()}),(0,$.jsx)(K,{value:h.description,onChange:e=>g({...h,description:e.target.value})})]})]})}),(0,$.jsx)(ln,{groupId:v?.groupId??null,groupName:v?.name??``,open:v!==null,onOpenChange:e=>{e||y(null)}})]})}var sn=8;function cn({page:e,pageCount:t,onPage:n}){return t<=1?null:(0,$.jsxs)(`div`,{className:`oc-access__pager`,children:[(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:e<=1,onClick:()=>n(e-1),children:[(0,$.jsx)(xt,{size:14,"aria-hidden":!0}),ft()]}),(0,$.jsxs)(`span`,{className:`oc-access__pageinfo`,"aria-label":ze({page:e,pages:t}),children:[e,` / `,t]}),(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,disabled:e>=t,onClick:()=>n(e+1),children:[Te(),(0,$.jsx)(St,{size:14,"aria-hidden":!0})]})]})}function ln({groupId:e,groupName:t,open:n,onOpenChange:r}){let i=R(z.groups.getGroup,n&&e?{groupId:e}:`skip`),a=i?.viewerIsAdmin===!0,o=R(z.groups.listAssignableInstances,n&&e?{groupId:e}:`skip`),s=R(z.groups.listAssignableUsers,n&&a?{}:`skip`),u=V(z.groups.addMember),d=V(z.groups.removeMember),p=V(z.groups.bulkSetMembers),m=V(z.groups.setGroupManager),h=q(),[g,_]=(0,Q.useState)(``),[v,b]=(0,Q.useState)(``),[x,S]=(0,Q.useState)(`members`),[C,w]=(0,Q.useState)(1),[T,E]=(0,Q.useState)(null),[D,O]=(0,Q.useState)(new Set),k=(0,Q.useRef)(null),j=(0,Q.useMemo)(()=>new Set((i?.members??[]).map(e=>e.userId)),[i]),ee=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.manager).map(e=>e.userId)),[i]),te=(0,Q.useMemo)(()=>new Set((i?.members??[]).filter(e=>e.restricted).map(e=>e.userId)),[i]),M=(0,Q.useMemo)(()=>new Set((i?.agents??[]).map(e=>X(e.instanceName,e.agentId))),[i]),ne=(0,Q.useMemo)(()=>{let e=(i?.agents??[]).find(e=>e.isDefault);return e?X(e.instanceName,e.agentId):null},[i]);(0,Q.useEffect)(()=>{_(``),b(``),S(`members`),w(1),E(null),k.current=null},[n,e]),(0,Q.useEffect)(()=>{w(1)},[g]),(0,Q.useEffect)(()=>{n&&i&&e&&k.current!==e&&(k.current=e,O(new Set((i.members??[]).map(e=>e.userId))))},[n,i,e]);let N=(0,Q.useMemo)(()=>s?Yt(s,g,D):[],[s,g,D]);async function re(t,n){if(e)try{n?await d({groupId:e,userId:t}):await u({groupId:e,userId:t})}catch(e){h.error(I(),Y(e))}}async function ie(t,n){if(e)try{await m({groupId:e,userId:t,manager:!n})}catch(e){h.error(y(),e)}}let P=qt(N,e=>j.has(e.userId)),ae=N.filter(e=>j.has(e.userId)).length,F=Xt(N,C,sn);async function oe(){if(!e||N.length===0)return;let t=N.map(e=>e.userId);try{await p({groupId:e,userIds:t,member:P!==`all`})}catch(e){h.error(I(),Y(e))}}let se=(e,t)=>(0,$.jsxs)(G,{type:`button`,variant:`ghost`,size:`sm`,className:`h-7`,"aria-label":de({user:t}),title:de({user:t}),onClick:()=>E({userId:e,label:t}),children:[(0,$.jsx)(Et,{size:13,"aria-hidden":!0}),l()]});return(0,$.jsx)(Ht,{open:n,onOpenChange:r,children:(0,$.jsxs)(zt,{className:`oc-access`,children:[(0,$.jsxs)(Rt,{children:[(0,$.jsx)(Bt,{children:f({name:t})}),(0,$.jsx)(Vt,{children:i&&!a?bt():fe()})]}),(0,$.jsxs)(Lt,{value:x,onValueChange:S,className:`oc-access__tabs`,children:[(0,$.jsxs)(It,{className:`w-full`,children:[(0,$.jsxs)(Pt,{value:`members`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Dt,{size:13,"aria-hidden":!0}),mt(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:j.size}):null]}),(0,$.jsxs)(Pt,{value:`agents`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(Ct,{size:13,"aria-hidden":!0}),ue(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:M.size}):null]}),(0,$.jsxs)(Pt,{value:`charts`,className:`flex-1 gap-1.5`,children:[(0,$.jsx)(rn,{size:13,"aria-hidden":!0}),Ze(),i?(0,$.jsx)(J,{variant:`secondary`,className:`oc-access__tabcount`,children:i.chartCount}):null]})]}),(0,$.jsx)(Ft,{value:`members`,children:i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):a?s===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):s.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:je()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:g,onChange:e=>_(e.target.value),placeholder:c(),className:`oc-access__search`}),N.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ke()}):(0,$.jsxs)($.Fragment,{children:[N.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(U,{checked:P===`all`||P===`some`&&`indeterminate`,onCheckedChange:()=>void oe(),"aria-label":H()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:H()}),(0,$.jsxs)(J,{variant:`outline`,className:`oc-access__count`,children:[ae,` / `,N.length]})]}):null,(0,$.jsx)(`div`,{className:`oc-access__list`,children:F.pageItems.map(e=>{let t=j.has(e.userId),n=Jt(e),r=ee.has(e.userId);return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:t,onCheckedChange:()=>void re(e.userId,t),"aria-label":Le({user:n.primary})}),(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:n.primary,children:n.primary}),n.secondary?(0,$.jsx)(`span`,{className:`oc-access__sub`,title:n.secondary,children:n.secondary}):null]}),t&&te.has(e.userId)?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:_t()}):null,(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:en(e.role)}),t?se(e.userId,n.primary):null,(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:t?(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,className:`shrink-0 oc-access__mgr${r?` oc-access__mgr--on`:``}`,"aria-pressed":r,"aria-label":r?A():it(),title:r?A():it(),onClick:()=>void ie(e.userId,r),children:(0,$.jsx)(wt,{size:15,"aria-hidden":!0})}):null})]},e._id)})}),(0,$.jsx)(cn,{page:F.page,pageCount:F.pageCount,onPage:w})]})]}):e?(0,$.jsx)(un,{groupId:e,members:i.members,agentsButton:se}):null}),(0,$.jsxs)(Ft,{value:`agents`,children:[i&&!a?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Re()}):null,o===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):o.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:st()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(K,{value:v,onChange:e=>b(e.target.value),placeholder:gt(),className:`oc-access__search`}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:o.map(t=>(0,$.jsx)(fn,{groupId:e,instanceName:t.name,kind:t.kind??`openclaw`,assigned:M,defaultKey:ne,viewerIsAdmin:a,query:v},`${e}-${t._id}`))})]})]}),(0,$.jsx)(Ft,{value:`charts`,children:(0,$.jsx)(mn,{groupId:e})})]}),(0,$.jsx)(dn,{groupId:e,member:T,onOpenChange:e=>{e||E(null)}})]})})}function un({groupId:e,members:t,agentsButton:n}){let r=R(z.groupInvites.listGroupInviteRequests,{groupId:e}),i=V(z.groupInvites.requestGroupInvite),a=V(z.groups.removeMember),o=Wt(),s=q(),[c,l]=(0,Q.useState)(``),[u,f]=(0,Q.useState)(1),h=Xt(t,u,sn);async function _(t){t.preventDefault();let n=c.trim();if(n)try{await i({groupId:e,email:n}),l(``),s.success(ae())}catch(e){s.error(re(),e)}}async function v(t,n){if(await o({title:d({user:n}),description:pe({user:n}),confirmLabel:ht(),cancelLabel:m(),destructive:!0}))try{await a({groupId:e,userId:t})}catch(e){s.error(I(),Y(e))}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`form`,{className:`oc-access__invite`,onSubmit:e=>void _(e),children:[(0,$.jsx)(K,{type:`email`,value:c,onChange:e=>l(e.target.value),placeholder:w(),"aria-label":le()}),(0,$.jsxs)(G,{type:`submit`,size:`sm`,disabled:!c.trim(),children:[(0,$.jsx)(Tt,{size:14,"aria-hidden":!0}),g()]})]}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:te()}),t.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Ae()}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:h.pageItems.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.label,children:e.label}),e.restricted?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:_t()}):null,n(e.userId,e.label),(0,$.jsx)(`span`,{className:`oc-access__mgrslot`,children:e.manager?(0,$.jsx)(`span`,{className:`oc-access__mgr oc-access__mgr--on`,role:`img`,"aria-label":D(),title:D(),children:(0,$.jsx)(wt,{size:15,"aria-hidden":!0})}):null}),(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`icon-sm`,disabled:e.manager||e.lastGroup,"aria-label":d({user:e.label}),title:e.manager?p():e.lastGroup?ve():d({user:e.label}),onClick:()=>void v(e.userId,e.label),children:(0,$.jsx)(Ot,{size:14,"aria-hidden":!0})})]},e.userId))}),(0,$.jsx)(cn,{page:h.page,pageCount:h.pageCount,onPage:f})]}),r!==void 0&&r.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:ne()}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:r.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,$.jsx)(J,{variant:e.status===`pending`?`secondary`:`outline`,className:`oc-access__role`,children:Qt(e.status)})]},e._id))})]}):null]})}function dn({groupId:e,member:t,onOpenChange:n}){let i=R(z.groups.getMemberAgentSettings,e&&t?{groupId:e,userId:t.userId}:`skip`),a=V(z.groups.setMemberAgents),o=V(z.groups.setMemberDefaultAgent),s=q();async function c(e){try{await e()}catch(e){s.error(v(),e)}}let l=i?.agents??[],u=new Map(l.map(e=>[X(e.instanceName,e.agentId),e])),d=[...u.keys()],f=new Set(l.filter(e=>e.allowed).map(e=>X(e.instanceName,e.agentId)));function p(n){if(!e||!t||!i)return;let r=Kt(d,f,i.restricted,n).map(e=>{let t=u.get(e);return{instanceName:t.instanceName,agentId:t.agentId}});c(()=>a({groupId:e,userId:t.userId,agents:r}))}return(0,$.jsx)(Ht,{open:t!==null,onOpenChange:n,children:(0,$.jsxs)(zt,{className:`oc-access`,children:[(0,$.jsxs)(Rt,{children:[(0,$.jsx)(Bt,{children:Ie({user:t?.label??``})}),(0,$.jsx)(Vt,{children:r()})]}),i===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()}):i===null||l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:k()}):(0,$.jsxs)($.Fragment,{children:[i.settable?null:(0,$.jsx)(`p`,{className:`oc-access__hint`,children:h()}),i.adminNarrowed?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:ce()}):null,i.restrictedByAdmin&&!i.viewerIsAdmin?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:C()}):null,(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,children:i.restricted?Ce():F()}),i.restricted?(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,disabled:!i.settable||i.restrictedByAdmin&&!i.viewerIsAdmin,onClick:()=>e&&t?void c(()=>a({groupId:e,userId:t.userId,agents:null})):void 0,children:ye()}):null]}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:l.map(n=>{let r=X(n.instanceName,n.agentId),a=n.displayName??n.agentId;return(0,$.jsxs)(`div`,{className:`oc-access__row oc-reveal-host`,children:[(0,$.jsx)(U,{checked:n.allowed,disabled:!i.settable||i.restrictedByAdmin&&!i.viewerIsAdmin&&!n.allowed,onCheckedChange:()=>p(r),"aria-label":xe({name:a})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:a,children:a}),n.limitedByAdmin?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:ee()}):null,n.state===`deleted`?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:at()}):null,n.allowed?n.isMemberDefault?(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,disabled:!i.settable,"aria-label":E(),title:E(),onClick:()=>e&&t?void c(()=>o({groupId:e,userId:t.userId,agent:null})):void 0,children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault oc-reveal oc-hit`,disabled:!i.settable,"aria-label":rt(),title:rt(),onClick:()=>e&&t?void c(()=>o({groupId:e,userId:t.userId,agent:{instanceName:n.instanceName,agentId:n.agentId}})):void 0,children:(0,$.jsx)(W,{size:14})}):null]},r)})})]})]})})}function fn({groupId:e,instanceName:t,kind:n,assigned:r,defaultKey:i,viewerIsAdmin:a,query:o}){let c=R(z.groups.listAssignableAgents,e?{instanceName:t,groupId:e}:`skip`),l=V(z.groups.assignAgentToGroup),u=V(z.groups.removeAgentFromGroup),d=V(z.groups.bulkSetGroupAgents),f=V(z.groups.claimAgentForGroup),p=V(z.groups.setGroupDefaultAgent),m=q(),[h,g]=(0,Q.useState)(1);if((0,Q.useEffect)(()=>{g(1)},[o]),!e)return null;let _=$t(c?.agents??[],o),v=c?.discovery&&!c.discovery.lastPollOk,y=e=>Zt({assigned:r.has(X(t,e.agentId)),claimable:e.claimable,reservedForGroup:e.reservedForGroup,enabled:e.enabled,present:e.presentInLastOk!==!1},a),b=_.filter(e=>y(e)!==`claim`),x=_.filter(e=>y(e)===`claim`);if(o.trim()&&_.length===0)return null;let S=b.filter(e=>y(e)===`toggle`&&e.presentInLastOk!==!1&&e.enabled!==!1),C=qt(S,e=>r.has(X(t,e.agentId))),w=Xt(b,h,sn);async function T(n,r){try{r?await u({groupId:e,instanceName:t,agentId:n}):await l({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(s(),Y(e))}}async function E(){if(S.length===0)return;let n=S.map(e=>e.agentId);try{await d({groupId:e,instanceName:t,agentIds:n,assigned:C!==`all`})}catch(e){m.error(s(),Y(e))}}async function D(n){try{await f({groupId:e,instanceName:t,agentId:n})}catch(e){m.error(ct(),e)}}async function O(n){try{await p({groupId:e,agent:n===null?null:{instanceName:t,agentId:n}})}catch(e){m.error(ut(),e)}}let k=e=>e.reservedForGroup?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:et()}):e.reserved?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:e.reservedGroupName===null?Ue():Oe({group:e.reservedGroupName})}):null;return(0,$.jsxs)(`div`,{className:`oc-access__group`,children:[(0,$.jsxs)(`div`,{className:`oc-access__instance`,children:[(0,$.jsx)(Ct,{size:13,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:t}),(0,$.jsx)(J,{variant:`outline`,className:`oc-access__kind`,children:n}),v?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__stale`,children:He()}):null]}),c===void 0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Je()}):_.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:v?De():$e()}):(0,$.jsxs)($.Fragment,{children:[S.length>1?(0,$.jsxs)(`div`,{className:`oc-access__row oc-access__selectall`,children:[(0,$.jsx)(U,{checked:C===`all`||C===`some`&&`indeterminate`,onCheckedChange:()=>void E(),"aria-label":H()}),(0,$.jsx)(`span`,{className:`oc-access__label`,children:H()})]}):null,w.pageItems.map(e=>{let n=X(t,e.agentId),a=r.has(n),o=e.presentInLastOk===!1,s=y(e)===`locked`;return(0,$.jsxs)(`div`,{className:`oc-access__row oc-reveal-host${s?` is-disabled`:``}`,children:[(0,$.jsx)(U,{checked:a,disabled:s&&!a,onCheckedChange:()=>void T(e.agentId,a),"aria-label":Ne({name:e.displayName??e.agentId})}),(0,$.jsxs)(`span`,{className:`oc-access__label`,title:e.displayName??e.agentId,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,k(e),o?(0,$.jsx)(J,{variant:`outline`,className:`oc-access__gone`,children:at()}):null,a?i===n?(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__fav`,"aria-label":ot(),title:ot(),onClick:()=>void O(null),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,size:`icon-sm`,variant:`ghost`,className:`oc-access__setdefault oc-reveal oc-hit`,"aria-label":Qe(),title:Qe(),onClick:()=>void O(e.agentId),children:(0,$.jsx)(W,{size:14})}):null]},e.agentId)}),(0,$.jsx)(cn,{page:w.page,pageCount:w.pageCount,onPage:g}),x.length>0?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`oc-access__subhead`,children:Pe()}),(0,$.jsx)(`p`,{className:`oc-access__hint`,children:dt()}),x.map(e=>{let t=e.displayName??e.agentId;return(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsxs)(`span`,{className:`oc-access__label`,title:t,children:[e.emoji?`${e.emoji} `:``,t]}),e.model?(0,$.jsx)(`span`,{className:`oc-access__model`,children:e.model}):null,(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,"aria-label":Me({name:t}),onClick:()=>void D(e.agentId),children:Ye()})]},e.agentId)})]}):null]})]})}function pn(){let e=R(z.groupInvites.listPendingInviteRequests,{}),t=V(z.groupInvites.decideGroupInvite),n=q();if(e===void 0||e.length===0)return null;async function r(e,r){try{await t({requestId:e,approve:r})}catch(e){n.error(tt(),e)}}return(0,$.jsxs)(`section`,{className:`oc-invites`,"aria-label":vt(),children:[(0,$.jsxs)(`h3`,{className:`oc-invites__title`,children:[(0,$.jsx)(Tt,{size:14,"aria-hidden":!0}),vt(),(0,$.jsx)(J,{variant:`secondary`,children:e.length})]}),(0,$.jsx)(`div`,{className:`oc-access__list`,children:e.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsxs)(`span`,{className:`oc-access__who`,children:[(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.email,children:e.email}),(0,$.jsxs)(`span`,{className:`oc-access__sub`,children:[e.groupName??`?`,` ·`,` `,pt({by:e.requestedBy})]})]}),e.account===`ready`?null:(0,$.jsx)(J,{variant:`outline`,className:`oc-access__role`,children:e.account===`none`?Ve():Xe()}),(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`outline`,className:`h-7`,disabled:e.account!==`ready`,onClick:()=>void r(e._id,!0),children:Ee()}),(0,$.jsx)(G,{type:`button`,size:`sm`,variant:`ghost`,className:`h-7`,onClick:()=>void r(e._id,!1),children:Be()})]},e._id))})]})}function mn({groupId:e}){let t=R(z.charts.listGroupChartSelection,e?{groupId:e}:`skip`),n=V(z.charts.assignChartToGroup),r=V(z.charts.removeChartFromGroup),a=V(z.charts.setGroupDefaultChart),o=V(z.charts.addChartToGroupPool),s=V(z.charts.removeChartFromGroupPool),c=q();if(!e)return null;if(t===void 0)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:B()});let{pool:l,addable:u,canManagePool:d}=t;if(l.length===0&&!d)return(0,$.jsx)(`p`,{className:`oc-access__hint`,children:lt()});async function f(t,i){try{i?await r({groupId:e,chartKey:t}):await n({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function p(t){try{await a({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function m(t){try{await o({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}async function h(t){try{await s({groupId:e,chartKey:t})}catch(e){c.error(L(),e)}}return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`oc-access__list`,children:l.map(e=>(0,$.jsxs)(`div`,{className:`oc-access__row`,children:[(0,$.jsx)(U,{checked:e.selected,onCheckedChange:()=>void f(e.chartKey,e.selected),"aria-label":we({name:e.name})}),(0,$.jsx)(`span`,{className:`oc-access__label`,title:e.name,children:e.name}),e.selected?e.isDefault?(0,$.jsx)(`span`,{className:`oc-access__fav`,role:`img`,"aria-label":be(),title:be(),children:(0,$.jsx)(W,{size:14,fill:`currentColor`})}):(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,onClick:()=>void p(e.chartKey),children:Se()}):null,d?(0,$.jsx)(G,{type:`button`,variant:`ghost`,size:`sm`,"aria-label":oe({name:e.name}),title:oe({name:e.name}),onClick:()=>void h(e.chartKey),children:(0,$.jsx)(Ot,{size:14,"aria-hidden":!0})}):null]},e.chartKey))}),d?u.length>0?(0,$.jsxs)(Nt,{value:``,onValueChange:e=>void m(e),children:[(0,$.jsx)(At,{size:`sm`,className:`oc-access__search`,children:(0,$.jsx)(kt,{placeholder:i()})}),(0,$.jsx)(jt,{children:u.map(e=>(0,$.jsx)(Mt,{value:e.chartKey,children:e.name},e.chartKey))})]}):l.length===0?(0,$.jsx)(`p`,{className:`oc-access__hint`,children:Fe()}):null:null]})}export{on as GroupsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{$I as r,AI as i,AL as a,BI as o,BL as s,Bt as c,CI as l,CL as u,Cr as d,Cs as f,DI as p,DL as m,Dh as h,EI as g,EL as _,Eh as v,FI as y,FL as ee,GI as b,GL as x,HI as S,HL as te,Ht as ne,II as C,IL as re,It as ie,JI as w,JL as ae,KI as T,KL as oe,LI as E,LL as D,Lt as se,MI as O,ML as ce,Mb as le,NI as ue,NL as de,Nb as fe,OI as pe,OL as me,Oh as he,PI as ge,PL as _e,Pb as ve,QI as ye,RI as be,RL as xe,Rj as Se,Rt as Ce,SI as we,SL as Te,Sr as Ee,Ss as De,TI as Oe,TL as ke,Th as Ae,Tr as je,Ts as Me,UI as Ne,UL as Pe,Ut as Fe,VI as Ie,VL as Le,Vt as Re,WI as ze,WL as Be,Wt as Ve,XI as He,XL as Ue,YI as We,YL as Ge,ZI as Ke,ZL as qe,_I as Je,_L as Ye,_Q as k,_r as Xe,_s as Ze,aI as Qe,aL as $e,bI as et,bL as tt,bQ as A,bd as nt,br as rt,bs as it,cI as at,cL as ot,dI as st,dL as ct,ds as lt,eL as ut,fG as dt,fI as ft,fL as pt,fs as mt,gI as ht,gL as gt,gr as _t,gs as vt,hI as yt,hL as bt,hs as xt,iI as St,iL as Ct,jL as wt,kI as Tt,kL as Et,lI as Dt,lL as Ot,ls as kt,mI as At,mL as jt,ms as Mt,nI as Nt,nL as Pt,oI as Ft,oL as It,pG as Lt,pI as Rt,pL as j,ps as zt,qI as Bt,qL as Vt,rI as Ht,rL as M,sI as Ut,sL as N,t as P,tL as Wt,uI as Gt,uL as Kt,us as qt,vI as Jt,vL as Yt,vr as Xt,vs as Zt,wI as Qt,wL as $t,wr as en,ws as tn,xI as nn,xL as rn,xd as an,xr as on,xs as sn,yI as cn,yL as ln,yQ as F,yd as un,yr as dn,ys as fn,zI as pn,zL as mn,zj as hn,zt as gn}from"./api-CWqdeSbN.js";import{a as _n,c as vn}from"./FieldLabel-imj_Z0rZ.js";import{t as yn}from"./checkbox-DPxJTQjc.js";import{a as I,i as L,n as R,r as z,t as B}from"./select-CjcMQhwm.js";import{n as bn,r as xn,t as Sn}from"./popover-C-Y_Yoco.js";import{t as V}from"./button-C_rIPtCv.js";import{t as H}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{r as U}from"./toast-C_YfUacM.js";import{t as W}from"./badge-ChMMFtuW.js";import{a as G,n as K,o as q,r as Cn,t as wn}from"./dialog-CPAskUwF.js";import{n as Tn}from"./ConfirmDialog-B7k0wvSi.js";import{t as En}from"./EntitySheet-DRzkWKlH.js";import{a as Dn}from"./groupManageView-DC3eSLA1.js";import{t as On}from"./DataTableShell-DvtkASQG.js";import{InstanceConfigDialog as kn}from"./BridgeTab-Bnu9R5N4.js";var J=t(e(),1),Y=[`conversational`,`documentary`,`summarizer`,`curator`],An=new Set(Y),jn=`conversational`;function Mn(e){let t=new Set((e??[]).filter(e=>An.has(e)));return t.size===0?[jn]:Y.filter(e=>t.has(e))}var X=n(),Z={name:``,gatewayUrl:``,bridgeUrl:``,displayName:``,kind:`openclaw`,transport:`ws`,gatewayVersion:``,gatewayHttpUrl:``,authMode:`token`,personScopes:`capped`,identitySource:`canonical`,participantIdentity:`owner`,managePermissionModes:!1,systemIdentity:``,streamTransport:_n,widgetsEnabled:!0,widgetPromptConfirm:!1},Nn={openclaw:[`token`,`deviceIdentity`],hermes:[`apiKey`]};function Pn(e){return{name:e.name,gatewayUrl:e.gatewayUrl,bridgeUrl:e.bridgeUrl??``,displayName:e.displayName??``,kind:e.kind??`openclaw`,transport:e.transport??`ws`,gatewayVersion:e.gatewayVersion??``,gatewayHttpUrl:e.gatewayHttpUrl??``,authMode:e.authMode??`token`,personScopes:e.personScopes??`capped`,identitySource:e.identitySource??`canonical`,participantIdentity:e.participantIdentity??`owner`,managePermissionModes:e.managePermissionModes===!0,systemIdentity:e.systemIdentity??``,streamTransport:e.streamTransport??`reactive`,widgetsEnabled:e.config?.widgetsEnabled!==!1,widgetPromptConfirm:e.config?.widgetPromptConfirm===!0}}function Fn(){let e=A(P.admin.listInstances,{}),t=A(P.agents.listAllInstanceAgents,{}),n=F(P.admin.upsertInstance),r=F(P.widgets.setInstanceWidgets),i=F(P.admin.deleteInstance),o=U(),[l,p]=(0,J.useState)(!1),[h,g]=(0,J.useState)(Z),[v,y]=(0,J.useState)(null),[b,S]=(0,J.useState)(null),[C,w]=(0,J.useState)(null),[T,E]=(0,J.useState)(null);async function O(){try{let t=await n({instanceId:T??void 0,name:h.name,gatewayUrl:h.gatewayUrl,bridgeUrl:h.bridgeUrl||void 0,displayName:h.displayName||void 0,kind:h.kind,transport:h.kind===`hermes`?h.transport:void 0,gatewayVersion:h.gatewayVersion||void 0,gatewayHttpUrl:h.gatewayHttpUrl||void 0,...h.kind===`openclaw`?{authMode:h.authMode,personScopes:h.personScopes,identitySource:h.identitySource,participantIdentity:h.participantIdentity,managePermissionModes:h.managePermissionModes,systemIdentity:h.systemIdentity||void 0}:{},streamTransport:h.streamTransport}),i=T===null?null:e?.find(e=>e._id===T),a=i?.config?.widgetsEnabled!==!1,o=i?.config?.widgetPromptConfirm===!0;h.kind===`openclaw`&&(h.widgetsEnabled!==a||h.widgetPromptConfirm!==o)&&await r({instanceId:t,enabled:h.widgetsEnabled,promptConfirm:h.widgetPromptConfirm}),g(Z),E(null),p(!1)}catch(e){o.error(Ge(),e)}}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`oc-admin__hint`,children:[ae(),(0,X.jsx)(`strong`,{children:Vt()}),oe()]}),(0,X.jsx)(On,{title:x(),rows:e,addLabel:Be(),onAdd:()=>{E(null),g(Z),p(!0)},emptyHint:Pe(),columns:[{header:te(),cell:e=>e.name,sort:e=>e.name},{header:Le(),cell:e=>(0,X.jsx)(W,{variant:`outline`,children:e.kind??`openclaw`}),sort:e=>e.kind??`openclaw`},{header:s(),cell:e=>e.gatewayUrl,sort:e=>e.gatewayUrl},{header:mn(),cell:e=>e.displayName??`—`,sort:e=>e.displayName??null},{header:qe(),cell:e=>{let n=(t?.[e.name]??[]).filter(e=>e.presentInLastOk!==!1&&e.enabled);if(n.length===0)return(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:`—`});let r=t=>e.defaultAgentId===t;return(0,X.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:[...n].sort((e,t)=>Number(r(t.agentId))-Number(r(e.agentId))).map(e=>(0,X.jsxs)(W,{variant:r(e.agentId)?`default`:`outline`,title:r(e.agentId)?Dt():void 0,children:[e.emoji?`${e.emoji} `:``,e.displayName??e.agentId]},e.agentId))})}}],rowActions:e=>[{label:ee(),onSelect:()=>{E(e._id),g(Pn(e)),p(!0)}},{label:Ue(),onSelect:()=>y(e.name)},{label:tt(),onSelect:()=>w(e)},{label:xe(),onSelect:()=>S(e)},{label:D(),variant:`destructive`,onSelect:()=>void i({instanceId:e._id})}],bulkActions:[{label:D(),variant:`destructive`,onSelect:e=>e.forEach(e=>void i({instanceId:e}))}]}),(0,X.jsx)(En,{open:l,onOpenChange:p,title:T?_e():re(),description:ce(),canSubmit:!!(h.name&&h.gatewayUrl),onSubmit:O,submitLabel:wt(),children:(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsxs)($,{label:a(),children:[(0,X.jsx)(H,{value:h.name,disabled:T!==null,onChange:e=>g({...h,name:e.target.value})}),T?(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:de()}):null]}),(0,X.jsx)($,{label:Et(),children:(0,X.jsxs)(B,{value:h.kind,onValueChange:e=>g({...h,kind:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`openclaw`,children:`OpenClaw`}),(0,X.jsx)(z,{value:`hermes`,children:`Hermes`})]})]})}),h.kind===`hermes`?(0,X.jsx)($,{label:an(),children:(0,X.jsxs)(B,{value:h.transport,onValueChange:e=>g({...h,transport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`ws`,children:nt()}),(0,X.jsx)(z,{value:`rest`,children:un()})]})]})}):null,(0,X.jsx)($,{label:me(),children:(0,X.jsx)(H,{value:h.gatewayUrl,onChange:e=>g({...h,gatewayUrl:e.target.value})})}),(0,X.jsx)($,{label:m(),children:(0,X.jsx)(H,{value:h.bridgeUrl,placeholder:_(),onChange:e=>g({...h,bridgeUrl:e.target.value})})}),(0,X.jsx)($,{label:ke(),children:(0,X.jsx)(H,{value:h.displayName,onChange:e=>g({...h,displayName:e.target.value})})}),(0,X.jsxs)($,{label:hn(),children:[(0,X.jsxs)(B,{value:h.streamTransport,onValueChange:e=>g({...h,streamTransport:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsx)(R,{children:vn.map(e=>(0,X.jsx)(z,{value:e,children:e},e))})]}),(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:Se()})]}),(0,X.jsx)($,{label:$t(),children:(0,X.jsx)(H,{value:h.gatewayVersion,placeholder:u(),onChange:e=>g({...h,gatewayVersion:e.target.value})})}),h.kind===`openclaw`?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)($,{label:xt(),children:[(0,X.jsxs)(B,{value:h.authMode,onValueChange:e=>g({...h,authMode:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`token`,children:Mt()}),(0,X.jsx)(z,{value:`trusted-proxy`,children:zt()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.authMode===`trusted-proxy`?lt():mt()})]}),h.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:Me(),children:[(0,X.jsxs)(B,{value:h.personScopes,onValueChange:e=>g({...h,personScopes:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`capped`,children:tn()}),(0,X.jsx)(z,{value:`full`,children:f()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.personScopes===`full`?sn():De()})]}):null,h.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:it(),children:[(0,X.jsxs)(B,{value:h.identitySource,onValueChange:e=>g({...h,identitySource:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`canonical`,children:fn()}),(0,X.jsx)(z,{value:`email`,children:Zt()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.identitySource===`email`?vt():Ze()})]}):null,h.authMode===`trusted-proxy`?(0,X.jsxs)($,{label:je(),children:[(0,X.jsxs)(B,{value:h.participantIdentity,onValueChange:e=>g({...h,participantIdentity:e}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`owner`,children:en()}),(0,X.jsx)(z,{value:`self`,children:d()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.participantIdentity===`self`?_t():Ee()})]}):null,h.kind===`openclaw`?(0,X.jsxs)($,{label:on(),children:[(0,X.jsxs)(B,{value:h.managePermissionModes?`on`:`off`,onValueChange:e=>g({...h,managePermissionModes:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`off`,children:rt()}),(0,X.jsx)(z,{value:`on`,children:dn()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.managePermissionModes?Xe():Xt()})]}):null,h.kind===`openclaw`?(0,X.jsxs)($,{label:Ve(),children:[(0,X.jsxs)(B,{value:h.widgetsEnabled?`on`:`off`,onValueChange:e=>g({...h,widgetsEnabled:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`on`,children:Fe()}),(0,X.jsx)(z,{value:`off`,children:ne()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:h.widgetsEnabled?Re():c()})]}):null,h.kind===`openclaw`&&h.widgetsEnabled?(0,X.jsxs)($,{label:gn(),children:[(0,X.jsxs)(B,{value:h.widgetPromptConfirm?`on`:`off`,onValueChange:e=>g({...h,widgetPromptConfirm:e===`on`}),children:[(0,X.jsx)(L,{size:`sm`,className:`w-full`,children:(0,X.jsx)(I,{})}),(0,X.jsxs)(R,{children:[(0,X.jsx)(z,{value:`off`,children:Ce()}),(0,X.jsx)(z,{value:`on`,children:se()})]})]}),(0,X.jsx)(`p`,{className:`oc-field__hint`,children:ie()})]}):null,h.authMode===`trusted-proxy`?(0,X.jsx)($,{label:qt(),children:(0,X.jsx)(H,{value:h.systemIdentity,placeholder:kt(),onChange:e=>g({...h,systemIdentity:e.target.value})})}):null]}):null,(0,X.jsx)($,{label:Te(),children:(0,X.jsx)(H,{value:h.gatewayHttpUrl,placeholder:rn(),onChange:e=>g({...h,gatewayHttpUrl:e.target.value})})})]})}),(0,X.jsx)(Wn,{instanceName:v,open:v!==null,onOpenChange:e=>{e||y(null)}}),b?(0,X.jsx)(kn,{instance:b,onClose:()=>S(null)},b._id):null,C?(0,X.jsx)(In,{instance:C,onClose:()=>w(null)},C._id):null]})}function In({instance:e,onClose:t}){let n=A(P.instanceSecrets.listInstanceSecretStatus,{}),r=Nn[e.kind??`openclaw`],i=(0,J.useMemo)(()=>{let t={};for(let r of n??[])r.instanceId===e._id&&(t[r.field]=r.updatedAt);return t},[n,e._id]);return(0,X.jsx)(wn,{open:!0,onOpenChange:e=>!e&&t(),children:(0,X.jsxs)(K,{onOpenAutoFocus:e=>e.preventDefault(),children:[(0,X.jsxs)(G,{children:[(0,X.jsx)(q,{children:ln({instance:e.displayName??e.name})}),(0,X.jsx)(Cn,{children:Yt()})]}),(0,X.jsx)(`div`,{className:`oc-form`,children:r.map(t=>(0,X.jsx)(zn,{instanceId:e._id,field:t,updatedAt:i[t]??null},t))}),(0,X.jsx)(`div`,{className:`oc-bridgesecret`,children:(0,X.jsx)(Rn,{instance:e})}),(0,X.jsx)(Ln,{instance:e})]})})}function Ln({instance:e}){let t=k(P.instanceSync.forceInstanceSync),n=U(),[i,a]=(0,J.useState)(!1);async function o(){if(!i){a(!0);try{switch((await t({instanceId:e._id})).status){case`synced`:n.success(ye());break;case`no_agents`:n.success(He());break;case`no_bridge_url`:n.error(We());break;case`deploy_misconfigured`:n.error(w());break;case`unauthorized`:n.error(T());break;case`not_served`:n.error(b());break;default:n.error(Bt());break}}catch(e){n.error(Ke(),e)}finally{a(!1)}}}return(0,X.jsxs)(`div`,{className:`oc-form`,children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:ze()}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void o(),disabled:i,children:i?r():ut()})})]})}function Rn({instance:e}){let t=A(P.bridgeAuth.listBridgeAuthStatus,{}),n=k(P.bridgeAuth.mintBridgeSecret),r=F(P.bridgeAuth.revokeBridgeSecret),i=U(),[a,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(!1),f=(t??[]).find(t=>t.instanceId===e._id),p=f!==void 0;async function m(){if(!a){s(!0);try{let t=await n({instanceId:e._id});l(t.plaintext),d(!1)}catch(e){i.error(E(),e)}finally{s(!1)}}}async function h(){if(!a){s(!0);try{await r({instanceId:e._id}),l(null),i.success(be())}catch(e){i.error(E(),e)}finally{s(!1)}}}async function g(){if(c)try{await navigator.clipboard.writeText(c),d(!0)}catch{}}return(0,X.jsxs)($,{label:Ne(),children:[(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:S()}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(W,{variant:p?`outline`:`secondary`,children:p?`${jt()} · ${f.prefix}…${f.lastFour}`:j()}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void m(),disabled:a,children:p?o():Ie()}),p?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void h(),disabled:a,children:pn()}):null]})]}),c?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`oc-sa__minted-warning`,children:C()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:c}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void g(),children:u?Lt():dt()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{l(null),d(!1)},children:y()})]}):null]})}function zn({instanceId:e,field:t,updatedAt:n}){let r=k(P.instanceSecrets.setInstanceSecret),i=F(P.instanceSecrets.clearInstanceSecret),a=k(P.deviceIdentity.generateDeviceIdentity),o=U(),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(!1),h=n!==null,g=t===`deviceIdentity`,_=t===`token`?Ye():t===`deviceIdentity`?gt():bt();async function v(){if(!(!s.trim()||l)){u(!0);try{await r({instanceId:e,field:t,plaintext:s}),c(``),f(null),m(!1),o.success(ot())}catch(e){o.error(N(),e)}finally{u(!1)}}}async function ee(){if(!l){u(!0);try{await i({instanceId:e,field:t}),f(null),m(!1),o.success(It())}catch(e){o.error(N(),e)}finally{u(!1)}}}async function b(){if(!l){u(!0);try{let t=await a({instanceId:e});f(t),m(!1),o.success(M())}catch(e){o.error(Wt(),e)}finally{u(!1)}}}let x=d?`openclaw devices approve ${d.id}`:``;async function S(){if(x)try{await navigator.clipboard.writeText(x),m(!0)}catch{}}return(0,X.jsxs)($,{label:_,children:[g?(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Ct()}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(W,{variant:h?`outline`:`secondary`,children:h?jt():j()}),(0,X.jsx)(H,{type:`password`,autoComplete:`off`,className:`flex-1 min-w-32`,value:s,placeholder:h?ct():pt(),onChange:e=>c(e.target.value)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{size:`sm`,onClick:()=>void v(),disabled:l||s.trim().length===0,children:Kt()}),g?(0,X.jsx)(V,{size:`sm`,variant:`outline`,onClick:()=>void b(),disabled:l,children:$e()}):null,h?(0,X.jsx)(V,{size:`sm`,variant:`destructive`,onClick:()=>void ee(),disabled:l,children:Ot()}):null]})]}),d?(0,X.jsxs)(`div`,{className:`oc-bridgesecret__reveal`,children:[(0,X.jsx)(`p`,{className:`text-sm font-medium`,children:M()}),(0,X.jsx)(`p`,{className:`oc-admin__hint`,children:Pt()}),(0,X.jsxs)(`div`,{className:`oc-sa__minted-box`,children:[(0,X.jsx)(`code`,{className:`oc-sa__minted-plain`,children:x}),(0,X.jsx)(V,{variant:`outline`,size:`sm`,onClick:()=>void S(),children:p?Lt():dt()})]}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,onClick:()=>{f(null),m(!1)},children:y()})]}):null]})}var Bn={conversational:Qt,documentary:we,summarizer:he,curator:v},Vn={conversational:l,documentary:nn,summarizer:h,curator:Ae},Hn=e=>(Bn[e]??(()=>e))(),Q=e=>(Vn[e]??(()=>``))();function Un({agentId:e,types:t,onToggle:n}){return(0,X.jsxs)(`div`,{className:`oc-agentcard__types`,children:[(0,X.jsx)(`span`,{className:`oc-agentcard__types-label`,children:pe()}),t.map(e=>(0,X.jsx)(W,{variant:`secondary`,className:`oc-agenttype__chip`,title:Q(e),children:(0,X.jsx)(`span`,{className:`oc-agenttype__label`,children:Hn(e)})},e)),(0,X.jsxs)(Sn,{children:[(0,X.jsx)(xn,{asChild:!0,children:(0,X.jsx)(V,{type:`button`,variant:`outline`,size:`sm`,className:`h-7`,children:p()})}),(0,X.jsxs)(bn,{align:`start`,className:`oc-agenttypes-pop`,children:[(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__title`,children:g()}),(0,X.jsx)(`p`,{className:`oc-agenttypes-pop__hint`,children:Oe()}),(0,X.jsx)(`div`,{className:`oc-agenttypes-pop__list`,children:Y.map(r=>{let i=`agtype-${e}-${r}`;return(0,X.jsxs)(`div`,{className:`oc-agenttypes-pop__item`,children:[(0,X.jsx)(yn,{id:i,checked:t.includes(r),onCheckedChange:()=>n(r)}),(0,X.jsxs)(`label`,{htmlFor:i,className:`oc-agenttypes-pop__text`,children:[(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__name`,children:Hn(r)}),(0,X.jsx)(`span`,{className:`oc-agenttypes-pop__desc`,children:Q(r)})]})]},r)})})]})]})]})}function Wn({instanceName:e,open:t,onOpenChange:n}){let r=A(P.agents.listAgentsForInstance,t&&e?{instanceName:e}:`skip`),i=F(P.agents.setAgentEnabled).withOptimisticUpdate((e,{instanceName:t,agentId:n,enabled:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});i&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,enabled:r}:e)})}),a=F(P.agents.setInstanceDefaultAgent).withOptimisticUpdate((e,{instanceName:t,agentId:n})=>{let r=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});r&&e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...r,defaultAgentId:n})}),o=F(P.agents.setAgentTypes).withOptimisticUpdate((e,{instanceName:t,agentId:n,types:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=Mn(r);e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,types:a}:e)})}),s=F(P.agents.setAgentDescription).withOptimisticUpdate((e,{instanceName:t,agentId:n,description:r})=>{let i=e.getQuery(P.agents.listAgentsForInstance,{instanceName:t});if(!i)return;let a=r.trim();e.setQuery(P.agents.listAgentsForInstance,{instanceName:t},{...i,agents:i.agents.map(e=>e.agentId===n?{...e,description:a.length===0?null:a}:e)})}),c=F(P.agents.removeInstanceAgent),l=F(P.agents.setAgentReservation),u=A(P.groups.listGroupLabels,t?{}:`skip`),d=Tn(),f=U();async function p(t,n){if(e&&await d({title:Qe({name:n}),description:St(),confirmLabel:Ft()}))try{await l({instanceName:e,agentId:t,groupId:null})}catch(e){f.error(O(),Dn(e))}}async function m(t,n,r){if(!e)return;let i=(u??[]).find(e=>e._id===r)?.name??`?`;if(await d({title:ve({name:n,group:i}),description:fe({group:i}),confirmLabel:le()}))try{await l({instanceName:e,agentId:t,groupId:r})}catch(e){f.error(O(),Dn(e))}}async function h(t,n){if(e)try{await i({instanceName:e,agentId:t,enabled:n})}catch(e){f.error(O(),e)}}async function g(t){if(e)try{await a({instanceName:e,agentId:t})}catch(e){f.error(O(),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(O(),e)}}async function v(t,n){if(e&&await d({title:Jt({name:n}),description:Je(),confirmLabel:ht(),destructive:!0}))try{await c({instanceName:e,agentId:t}),f.success(yt())}catch(e){f.error(O(),e)}}return(0,X.jsx)(wn,{open:t,onOpenChange:n,children:(0,X.jsxs)(K,{className:`oc-access`,children:[(0,X.jsxs)(G,{children:[(0,X.jsx)(q,{children:ge({name:e??``})}),(0,X.jsx)(Cn,{children:ue()})]}),r===void 0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:At()}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`oc-access__poll`,children:r.discovery===null?Rt():r.discovery.lastPollOk?ft():st({error:r.discovery.error??`?`})}),r.agents.length===0?(0,X.jsx)(`p`,{className:`oc-access__hint`,children:Gt()}):(0,X.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,X.jsxs)(`div`,{className:`oc-agentcard`+(t.enabled?``:` oc-agentcard--off`),children:[(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(yn,{checked:t.enabled,disabled:n,"aria-label":a,onCheckedChange:e=>void h(t.agentId,e===!0)}),(0,X.jsxs)(`div`,{className:`oc-agentcard__main`,children:[(0,X.jsxs)(`span`,{className:`oc-agentcard__name`,title:a,children:[t.emoji?`${t.emoji} `:``,a]}),t.model?(0,X.jsx)(`span`,{className:`oc-access__model`,children:t.model}):null,t.reserved?(0,X.jsx)(W,{variant:`outline`,children:t.reserved.groupName===null?Ut():at({group:t.reserved.groupName})}):null,n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(W,{variant:`outline`,className:`oc-access__gone`,children:Nt()}),(0,X.jsx)(V,{size:`sm`,variant:`ghost`,className:`h-7 text-destructive`,onClick:()=>void v(t.agentId,a),children:cn()})]}):i?(0,X.jsx)(W,{variant:`default`,children:Dt()}):(0,X.jsx)(V,{size:`sm`,variant:`outline`,className:`h-7`,disabled:!t.enabled||t.reserved!==null,onClick:()=>void g(t.agentId),children:et()})]})]}),t.reserved?(0,X.jsxs)(`div`,{className:`oc-agentcard__head`,children:[(0,X.jsx)(V,{size:`sm`,variant:`outline`,className:`h-7`,onClick:()=>void p(t.agentId,a),children:Ft()}),(0,X.jsxs)(B,{value:``,onValueChange:e=>void m(t.agentId,a,e),children:[(0,X.jsx)(L,{size:`sm`,className:`h-7`,children:(0,X.jsx)(I,{placeholder:Ht()})}),(0,X.jsx)(R,{children:(u??[]).filter(e=>e._id!==t.reserved?.groupId).map(e=>(0,X.jsx)(z,{value:e._id,children:e.name},e._id))})]})]}):null,t.enabled?(0,X.jsx)(Un,{agentId:t.agentId,types:o,onToggle:e=>void _(t.agentId,e,o)}):null,t.enabled?(0,X.jsx)(Gn,{value:t.description??``,onSave:async n=>{if(e)try{await s({instanceName:e,agentId:t.agentId,description:n})}catch(e){f.error(O(),e)}}}):null]},t.agentId)})})]})]})})}function Gn({value:e,onSave:t}){let[n,r]=(0,J.useState)(e);(0,J.useEffect)(()=>{r(e)},[e]);let a=()=>{n.trim()!==e.trim()&&t(n)};return(0,X.jsx)(H,{className:`oc-agentcard__desc`,value:n,maxLength:280,placeholder:i(),"aria-label":Tt(),onChange:e=>r(e.target.value),onBlur:a,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),a())}})}function $({label:e,children:t}){return(0,X.jsxs)(`label`,{className:`oc-field`,children:[(0,X.jsx)(`span`,{className:`oc-field__label`,children:e}),t]})}export{Fn as InstancesTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{Az as r,Bz as i,Fz as a,Gg as o,Hg as s,Hz as c,Iz as l,Jg as u,Kg as d,Lz as f,Mz as p,Nz as m,Pz as h,Rz as g,Ug as _,Vg as v,Vz as y,Wg as b,Yg as x,_Q as S,bQ as C,jz as w,kz as T,qg as E,t as D,yQ as O,zz as k}from"./api-CWqdeSbN.js";import{t as A}from"./checkbox-DPxJTQjc.js";import"./select-CjcMQhwm.js";import{t as j}from"./button-C_rIPtCv.js";import{t as M}from"./input-CSZu-bVE.js";import"./convexApi-G20_TNBS.js";import{t as N}from"./badge-ChMMFtuW.js";var P=t(e(),1),F=n();function I(){let e=C(D.integrations.status.status,{}),t=O(D.admin.setIntegrationConfig),[n,o]=(0,P.useState)(null);if((0,P.useEffect)(()=>{e&&n===null&&o(e.config)},[e,n]),!e||!n)return(0,F.jsx)(`p`,{className:`oc-admin__hint`,children:c()});let s=n,d=(e,t,n)=>o({...s,[e]:{...s[e],[t]:n}}),_=(e,n)=>void t({[e]:n});return(0,F.jsxs)(F.Fragment,{children:[(0,F.jsxs)(`p`,{className:`oc-admin__hint`,children:[y(),` `,(0,F.jsx)(`strong`,{children:i()}),` `,k()]}),(0,F.jsxs)(L,{title:`Langfuse`,status:e.langfuse.configured?e.langfuse.enabled?(0,F.jsx)(N,{variant:`secondary`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:l()}),note:a(),children:[(0,F.jsx)(R,{label:m(),children:(0,F.jsx)(M,{value:s.langfuse.host??``,placeholder:e.langfuse.effectiveHost,onChange:e=>d(`langfuse`,`host`,e.target.value),onBlur:()=>_(`langfuse`,{host:s.langfuse.host??``})})}),(0,F.jsx)(z,{label:T(),checked:s.langfuse.enabled??!0,onChange:e=>{d(`langfuse`,`enabled`,e),_(`langfuse`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`Opik`,status:e.opik.configured?e.opik.enabled?(0,F.jsx)(N,{variant:`secondary`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:l()}),note:h(),children:[(0,F.jsx)(R,{label:p(),children:(0,F.jsx)(M,{value:s.opik.baseUrl??``,placeholder:e.opik.effectiveBaseUrl,onChange:e=>d(`opik`,`baseUrl`,e.target.value),onBlur:()=>_(`opik`,{baseUrl:s.opik.baseUrl??``})})}),(0,F.jsx)(R,{label:w(),children:(0,F.jsx)(M,{value:s.opik.workspace??``,placeholder:e.opik.effectiveWorkspace||r(),onChange:e=>d(`opik`,`workspace`,e.target.value),onBlur:()=>_(`opik`,{workspace:s.opik.workspace??``})})}),(0,F.jsx)(z,{label:T(),checked:s.opik.enabled??!0,onChange:e=>{d(`opik`,`enabled`,e),_(`opik`,{enabled:e})}})]}),(0,F.jsxs)(L,{title:`OpenTelemetry (OTLP)`,status:e.otlp.configured?e.otlp.enabled?(0,F.jsx)(N,{variant:`secondary`,children:g()}):(0,F.jsx)(N,{variant:`outline`,children:f()}):(0,F.jsx)(N,{variant:`outline`,children:x()}),note:u(),children:[(0,F.jsx)(R,{label:E(),children:(0,F.jsx)(M,{value:s.otlp.endpoint??``,placeholder:e.otlp.effectiveEndpoint||`https://otlp.example.com/v1/traces`,onChange:e=>d(`otlp`,`endpoint`,e.target.value),onBlur:()=>_(`otlp`,{endpoint:s.otlp.endpoint??``})})}),(0,F.jsx)(B,{headersSet:e.otlp.headersSet}),(0,F.jsx)(z,{label:T(),checked:s.otlp.enabled??!0,onChange:e=>{d(`otlp`,`enabled`,e),_(`otlp`,{enabled:e})}})]})]})}function L({title:e,status:t,note:n,children:r}){return(0,F.jsxs)(`section`,{className:`oc-int__section`,children:[(0,F.jsxs)(`div`,{className:`oc-int__section-head`,children:[(0,F.jsx)(`h3`,{className:`oc-uipa__h`,children:e}),t]}),n?(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:n}):null,(0,F.jsx)(`div`,{className:`oc-int__fields`,children:r})]})}function R({label:e,children:t}){return(0,F.jsxs)(`label`,{className:`oc-int__field`,children:[(0,F.jsx)(`span`,{className:`oc-int__field-label`,children:e}),t]})}function z({label:e,checked:t,onChange:n}){return(0,F.jsxs)(`label`,{className:`oc-int__toggle`,children:[(0,F.jsx)(A,{checked:t,onCheckedChange:e=>n(e===!0)}),(0,F.jsx)(`span`,{children:e})]})}function B({headersSet:e}){let t=S(D.integrations.otlpSecret.setOtlpHeaders),n=O(D.integrations.otlpSecret.clearOtlpHeaders),[r,i]=(0,P.useState)(``),[a,c]=(0,P.useState)(null),[l,u]=(0,P.useState)(!1),f=async()=>{u(!0),c(null);try{await t({headersJson:r}),i(``)}catch(e){c(e instanceof Error?e.message:String(e))}finally{u(!1)}};return(0,F.jsxs)(R,{label:d(),children:[(0,F.jsx)(M,{value:r,placeholder:e?o():b(),onChange:e=>i(e.target.value)}),(0,F.jsxs)(`div`,{className:`oc-int__otlp-headers-actions`,children:[(0,F.jsx)(j,{size:`sm`,disabled:l||r.trim().length===0,onClick:()=>void f(),children:_()}),e?(0,F.jsx)(j,{variant:`ghost`,size:`sm`,disabled:l,onClick:()=>void n({}),children:s()}):null]}),a?(0,F.jsx)(`p`,{className:`oc-int__otlp-headers-error`,children:a}):null,(0,F.jsx)(`p`,{className:`oc-uipa__note`,children:v()})]})}export{I as IntegrationsTab};
@@ -0,0 +1 @@
1
+ import{a as e,l as t,r as n}from"./bundle-mjs-C73ZY4La.js";import{A as r,BW as i,Jy as a,M as o,N as s,Qy as c,Sb as l,Yy as u,_b as d,bQ as f,bb as p,eb as m,gb as h,hb as g,it as _,j as v,mb as y,nt as b,pb as x,qy as S,rt as C,t as w,tt as T,vb as E,xb as D,yQ as O,yb as ee}from"./api-CWqdeSbN.js";import{t as te}from"./loader-circle-BqKiW3X9.js";import{t as ne}from"./rotate-ccw-CvefWwHW.js";import"./convexApi-G20_TNBS.js";import{r as re,t as ie}from"./capabilities-CASxhKEd.js";var k=t(e(),1),A={thinkingLevel:`segmented`,model:`list`,fastMode:`segmented`,showReasoning:`segmented`};function j(e,t){return A[e]===`segmented`&&t<=5?`segmented`:`list`}function M(e,t){return e!=null&&e[t]!==void 0}var N=[`inherit`,`fast`,`standard`];function P(e){return e==null||e.fastMode===void 0?`inherit`:e.fastMode?`fast`:`standard`}function F(e){return e===`inherit`?g():e===`fast`?y():x()}function I(e){return e===`inherit`?null:e===`fast`}function L(e){return e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function R(e){return e.length?e[0].toUpperCase()+e.slice(1):e}var z={off:`Off`,minimal:`Min`,low:`Low`,medium:`Med`,high:`High`,xhigh:`XHigh`};function B(e,t){return z[e]??t}function V(e){return H(e).used}function H(e){if(!e)return{used:null,source:`unknown`};let t=e.contextTokens,n=e=>e==null||t&&e>t?null:e;if(e.estimatedPromptTokens!=null)return{used:e.estimatedPromptTokens,source:`budget_estimate`};let r=n(e.activeTokens);if(r!=null)return{used:r,source:`last_call_usage`};if(e.totalTokensFresh===!1)return{used:null,source:`unknown`};let i=n(e.totalTokens);return i==null?{used:null,source:`unknown`}:{used:i,source:`last_call_usage`}}function U(e){return e?e.promptBudgetBeforeReserve!=null&&e.promptBudgetBeforeReserve>0?e.promptBudgetBeforeReserve:e.contextTokens!=null&&e.contextTokens>0?e.contextTokens:null:null}function W(e){if(!e)return null;if(e.sessionOverfull===!0)return`compaction_failed`;let t=V(e),n=U(e);return t!=null&&n!=null&&t>n?`estimate_exceeds_budget`:null}function ae(e){return H(e).source}function G(e,t){return e==null||!t||t<=0?null:Math.round(e/t*100)}function K(e,t){let n=G(e,t);return n===null?null:m({pct:n,used:L(e),total:L(t)})}function q(e){return c({level:e??`full`})}function J(e,t){let n=typeof e==`number`,r=typeof t==`number`;return n&&r?u({cost:e.toFixed(2),tokens:L(t)}):n?a({cost:e.toFixed(2)}):r?S({tokens:L(t)}):null}function oe(e){let t=e.filter(e=>typeof e==`string`&&e.length>0);return t.length>0?t.join(` · `):null}function se(e,t=5){let n=e?.contextPercent;if(typeof n!=`number`||!Number.isFinite(n))return null;let r=V(e),i=U(e);if(r===null||i===null)return null;let a=G(r,i);if(a===null)return null;let o=Math.abs(n-a);return o<=t?null:{gateway:n,derived:a,delta:o}}function ce(e,t){let n=t?C():b();return e===`agent`?{inheritedLabel:s(),resetLabel:v({value:n})}:e===`instance`?{inheritedLabel:o(),resetLabel:r({value:n})}:{}}function Y(e,t){let n=f(w.compat.forChat,e===null?`skip`:{chatId:e,...t?{routedAgent:t}:{}}),r=n==null?null:n.capabilities;return{can:(0,k.useCallback)(e=>ie(r,e),[r]),resolved:r!==null,loading:n===void 0,gatewayVersion:n?.gatewayVersion??null,provider:n?.provider??null,beyondValidated:n?.versionBeyondValidated===!0}}var X=n();function Z(e){let t=O(w.chats.setSessionKnob),[n,r]=(0,k.useState)(null),[i,a]=(0,k.useState)(null);return{apply:(0,k.useCallback)(async(n,i)=>{r(n),a(null);let o={chatId:e};n===`fastMode`?o.fastMode=i:n===`showReasoning`?o.showReasoning=i:o[n]=i;try{await t(o)}catch{a({field:n,value:i})}finally{r(null)}},[e,t]),pending:n,error:i}}function Q({label:e,overridden:t,onReset:n,pending:r,error:i,onRetry:a,help:o,children:s,resettable:c=!0,inheritedLabel:u,resetLabel:d}){return(0,X.jsxs)(`div`,{className:`oc-spanel__row${t?` is-overridden`:``}`,children:[(0,X.jsxs)(`div`,{className:`oc-spanel__rowhead`,children:[(0,X.jsx)(`span`,{className:`oc-spanel__label`,children:e}),r?(0,X.jsx)(te,{size:13,className:`oc-spanel__spin`,"aria-label":p()}):t?c?(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__reset`,title:d??D(),"aria-label":d??D(),onClick:n,children:(0,X.jsx)(ne,{size:12,"aria-hidden":!0})}):null:(0,X.jsx)(`span`,{className:`oc-spanel__badge`,children:u??l()})]}),(0,X.jsx)(`div`,{className:`oc-spanel__ctl`,children:s}),o?(0,X.jsx)(`p`,{className:`oc-spanel__help`,children:o}):null,i?(0,X.jsxs)(`p`,{className:`oc-spanel__error`,role:`alert`,children:[ee(),(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__retry`,onClick:a,children:E()})]}):null]})}function le({options:e,value:t,onChange:n,ariaLabel:r,disabled:i}){return(0,X.jsx)(`div`,{className:`oc-spanel__seg`,role:`group`,"aria-label":r,children:e.map(e=>(0,X.jsx)(`button`,{type:`button`,className:`oc-spanel__seg-btn${t===e.id?` is-active`:``}`,"aria-pressed":t===e.id,title:e.title??e.label,"aria-label":e.title??e.label,disabled:i,onClick:()=>{e.id!==t&&n(e.id)},children:e.label},e.id))})}function ue({options:e,value:t,onChange:n,disabled:r,ariaLabel:i}){let a=t===null||e.some(e=>e.id===t);return(0,X.jsxs)(`select`,{className:`oc-spanel__select`,value:t??``,disabled:r,"aria-label":i,onChange:e=>{e.target.value&&e.target.value!==t&&n(e.target.value)},children:[t===null?(0,X.jsx)(`option`,{value:``,disabled:!0,children:`—`}):null,a?null:(0,X.jsx)(`option`,{value:t,children:t}),e.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id))]})}function $({field:e,options:t,value:n,onChange:r,disabled:i,ariaLabel:a}){return j(e,t.length)===`list`?(0,X.jsx)(ue,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a}):(0,X.jsx)(le,{options:t,value:n,onChange:r,disabled:i,ariaLabel:a})}function de({chatId:e,sm:t,settings:n}){let{apply:r,pending:a,error:o}=Z(e),{can:s}=Y(e),c=a!==null,l=(0,k.useCallback)(()=>{o&&r(o.field,o.value)},[r,o]),u=t?.thinkingLevels??[],f=t?.availableModels??[],p=P(n),m=re(s,{hasModels:f.length>0,hasLevels:u.length>0,described:t!==null});return(0,X.jsxs)(X.Fragment,{children:[m.model?(0,X.jsx)(Q,{label:i(),overridden:M(n,`model`),onReset:()=>void r(`model`,null),pending:a===`model`,error:o?.field===`model`,onRetry:l,resettable:m.reset,children:(0,X.jsx)($,{field:`model`,options:f,value:t?.model??null,onChange:e=>void r(`model`,e),disabled:c,ariaLabel:i()})}):null,m.thinking?(0,X.jsx)(Q,{label:d(),overridden:M(n,`thinkingLevel`),onReset:()=>void r(`thinkingLevel`,null),pending:a===`thinkingLevel`,error:o?.field===`thinkingLevel`,onRetry:l,resettable:m.reset,children:(0,X.jsx)($,{field:`thinkingLevel`,ariaLabel:d(),options:u.map(e=>({id:e.id,label:B(e.id,R(e.label)),title:R(e.label)})),value:t?.thinkingLevel??null,onChange:e=>void r(`thinkingLevel`,e),disabled:c})}):null,(0,X.jsx)(fe,{chatId:e,overridden:M(n,`showReasoning`),onApply:e=>void r(`showReasoning`,e),pending:a===`showReasoning`,error:o?.field===`showReasoning`,onRetry:l,disabled:c}),m.speed?(0,X.jsx)(Q,{label:h(),overridden:M(n,`fastMode`),onReset:()=>void r(`fastMode`,null),pending:a===`fastMode`,error:o?.field===`fastMode`,onRetry:l,resettable:m.reset,children:(0,X.jsx)($,{field:`fastMode`,ariaLabel:h(),options:N.map(e=>({id:e,label:F(e)})),value:p,onChange:e=>void r(`fastMode`,I(e)),disabled:c})}):null]})}function fe({chatId:e,overridden:t,onApply:n,pending:r,error:i,onRetry:a,disabled:o}){let s=f(w.messages.getSessionMeta,{chatId:e}),c=s?.showReasoning===!0,{inheritedLabel:l,resetLabel:u}=ce(s?.showReasoningDefaultSource,s?.showReasoningDefault===!0);return(0,X.jsx)(Q,{label:_(),overridden:t,inheritedLabel:l,resetLabel:u,onReset:()=>n(null),pending:r,error:i,onRetry:a,help:T(),children:(0,X.jsx)($,{field:`showReasoning`,ariaLabel:_(),options:[{id:`on`,label:C()},{id:`off`,label:b()}],value:s==null?null:c?`on`:`off`,onChange:e=>n(e===`on`),disabled:o})})}export{R as a,G as c,J as d,V as f,q as g,M as h,oe as i,se as l,L as m,de as n,K as o,U as p,Y as r,W as s,$ as t,ae as u};