@xopcai/xopc 0.0.134 → 0.0.136

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 (215) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/Combination-HAlzriaz.js +41 -0
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-mQ4lbZRf.js → agent-avatar-dicebear-CER17NHM.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-Bv5R-N8Q.js +2 -0
  6. package/dist/gateway/static/root/assets/{app-management-settings-panel-Bj2YJiQe.js → app-management-settings-panel-B3Ap_wpX.js} +1 -1
  7. package/dist/gateway/static/root/assets/{appearance-settings-B93olV5Z.js → appearance-settings-3kBO22Xd.js} +1 -1
  8. package/dist/gateway/static/root/assets/apps-page-BHYbGQcZ.js +1 -0
  9. package/dist/gateway/static/root/assets/{archive-plugin-D_yymKFJ.js → archive-plugin-D_vGeNB8.js} +1 -1
  10. package/dist/gateway/static/root/assets/{attachment-load-kfyH3HV-.js → attachment-load-hWV_8pHL.js} +1 -1
  11. package/dist/gateway/static/root/assets/{automation-suggestion-card-DyGBB2WH.js → automation-suggestion-card-DVKmVTIo.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-BCTXpOBp.js +4 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-BX1AXf98.js → binary-plugins-BuXIeSPc.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-D-WEVNHU.js → block-editor-C1m0u-UU.js} +39 -39
  15. package/dist/gateway/static/root/assets/browser-settings-page-ChUF08V5.js +8 -0
  16. package/dist/gateway/static/root/assets/capability-presets-api-B7WWYaEh.js +1 -0
  17. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-CHExb90z.js → capability-presets-settings-panel-D_Bh1PnA.js} +1 -1
  18. package/dist/gateway/static/root/assets/{channel-recipient-api-RANYrzfa.js → channel-recipient-api-sV06LCht.js} +1 -1
  19. package/dist/gateway/static/root/assets/channels-settings-BI2ChQc7.js +1 -0
  20. package/dist/gateway/static/root/assets/channels-status-swr-MY4Xh4fM.js +1 -0
  21. package/dist/gateway/static/root/assets/connectors-page-qgvEp09M.js +2 -0
  22. package/dist/gateway/static/root/assets/desktop-pet-BxMJlvb-.js +1 -0
  23. package/dist/gateway/static/root/assets/{desktop-pet-settings-C3JDiXSu.js → desktop-pet-settings-DCvpDImn.js} +1 -1
  24. package/dist/gateway/static/root/assets/{directory-picker-path-field-MT71cjgl.js → directory-picker-path-field-D1nxs9PA.js} +1 -1
  25. package/dist/gateway/static/root/assets/dist-Mys7eFJ5.js +1 -0
  26. package/dist/gateway/static/root/assets/{dreaming-settings-Cfx_Qg4R.js → dreaming-settings-EAWkpOgw.js} +3 -3
  27. package/dist/gateway/static/root/assets/{extension-debug-page-Wp23cLkf.js → extension-debug-page-LUQ8dE8z.js} +1 -1
  28. package/dist/gateway/static/root/assets/{extension-page-B5HRNtVY.js → extension-page-B_mnhoRd.js} +1 -1
  29. package/dist/gateway/static/root/assets/{extension-settings-page-zPfMpsYi.js → extension-settings-page-BWQsGmvW.js} +1 -1
  30. package/dist/gateway/static/root/assets/{fetch-6HXXdO77.js → fetch-BWXmBizE.js} +1 -1
  31. package/dist/gateway/static/root/assets/{gateway-config-api-CsS_3Ii6.js → gateway-config-api-M9bzPASf.js} +1 -1
  32. package/dist/gateway/static/root/assets/{gateway-settings-DOxh0hei.js → gateway-settings-CbgtpprN.js} +1 -1
  33. package/dist/gateway/static/root/assets/{gateway-startup-retry-BE1M9fH_.js → gateway-startup-retry-BALL91S7.js} +1 -1
  34. package/dist/gateway/static/root/assets/goal-create-dialog-CbP4t9aM.js +1 -0
  35. package/dist/gateway/static/root/assets/goal-detail-page-DlwI-MZZ.js +4 -0
  36. package/dist/gateway/static/root/assets/{goals-config-api--3Vzceq-.js → goals-config-api-BBhFVzBS.js} +1 -1
  37. package/dist/gateway/static/root/assets/goals-page-D26r7knp.js +2 -0
  38. package/dist/gateway/static/root/assets/{goals-settings-Dg_hQNVC.js → goals-settings-DdmVG_TR.js} +1 -1
  39. package/dist/gateway/static/root/assets/{heartbeat-settings-CecoDTZJ.js → heartbeat-settings-DZW2Xq-U.js} +1 -1
  40. package/dist/gateway/static/root/assets/index-CPwVzi9x.css +1 -0
  41. package/dist/gateway/static/root/assets/index-DZOm5_ex.js +262 -0
  42. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BWMLAFxf.js → keyboard-shortcuts-settings-1IWd88-T.js} +1 -1
  43. package/dist/gateway/static/root/assets/logs-page-DxoKJO7-.js +7 -0
  44. package/dist/gateway/static/root/assets/{markdown-split-5tvDwUMS.js → markdown-split-BtdBj32h.js} +1 -1
  45. package/dist/gateway/static/root/assets/{media-plugins-RSjPG4B0.js → media-plugins-CpoPj3s8.js} +1 -1
  46. package/dist/gateway/static/root/assets/messages-CQ_k8RHj.js +3 -0
  47. package/dist/gateway/static/root/assets/models-hub-panel-D1Rp__dV.js +2 -0
  48. package/dist/gateway/static/root/assets/notes-page-CgR1bO2W.js +1 -0
  49. package/dist/gateway/static/root/assets/notes-workbench-ozsnmDTV.js +2 -0
  50. package/dist/gateway/static/root/assets/{page-tabs-DYNWfN6S.js → page-tabs-CVLqCfQB.js} +1 -1
  51. package/dist/gateway/static/root/assets/{preview-open-alternatives-B50PdIc8.js → preview-open-alternatives-CKUXJk2t.js} +1 -1
  52. package/dist/gateway/static/root/assets/project-detail-page-B4dqFAQF.js +1 -0
  53. package/dist/gateway/static/root/assets/projects-page-DlRGXv4a.js +1 -0
  54. package/dist/gateway/static/root/assets/remote-access-hub-rZEYQMZV.js +1 -0
  55. package/dist/gateway/static/root/assets/{save-bar-controls-DggNb0SF.js → save-bar-controls-BtGni268.js} +1 -1
  56. package/dist/gateway/static/root/assets/{schedule-field-T4ti2C8S.js → schedule-field-BDGzKVWn.js} +1 -1
  57. package/dist/gateway/static/root/assets/{schema-form-D6wGEfEa.js → schema-form-DQJsKMCE.js} +1 -1
  58. package/dist/gateway/static/root/assets/sessions-page-DxGoCGU8.js +1 -0
  59. package/dist/gateway/static/root/assets/settings-advanced-gate-4e8ZQwxr.js +1 -0
  60. package/dist/gateway/static/root/assets/{settings-collapsible-section-Cgd_aLBV.js → settings-collapsible-section-c8XGd4-8.js} +1 -1
  61. package/dist/gateway/static/root/assets/{settings-form-section-DnDrLMWZ.js → settings-form-section-By0YiDWo.js} +1 -1
  62. package/dist/gateway/static/root/assets/{settings-loading-skeleton-A2OshMK8.js → settings-loading-skeleton-SYCPY-WM.js} +1 -1
  63. package/dist/gateway/static/root/assets/{settings-page-CXMK9Vb3.js → settings-page-D9NwvnBt.js} +1 -1
  64. package/dist/gateway/static/root/assets/{settings-page-layout-Da_LNPDS.js → settings-page-layout-CrICyGob.js} +1 -1
  65. package/dist/gateway/static/root/assets/setup-status-panel-IjK-hDxf.js +1 -0
  66. package/dist/gateway/static/root/assets/{share-preview-page-BGZV-PCJ.js → share-preview-page-Dfnk9M_m.js} +1 -1
  67. package/dist/gateway/static/root/assets/shares-settings-vQiRBra7.js +1 -0
  68. package/dist/gateway/static/root/assets/skill-reload-api-BIWv778A.js +1 -0
  69. package/dist/gateway/static/root/assets/skills-page-CruV215G.js +2 -0
  70. package/dist/gateway/static/root/assets/{system-settings-panel-D8uzXP0Y.js → system-settings-panel-BBVbSDFD.js} +1 -1
  71. package/dist/gateway/static/root/assets/{typed-models-lib-DQxv2BHa.js → typed-models-lib-CwFayhxu.js} +1 -1
  72. package/dist/gateway/static/root/assets/{use-channel-catalog-BCBfSoHx.js → use-channel-catalog-BKtHOM50.js} +1 -1
  73. package/dist/gateway/static/root/assets/{user-profile-settings-panel-DkZSHsIs.js → user-profile-settings-panel-_KDWzagh.js} +1 -1
  74. package/dist/gateway/static/root/assets/{utils-ivGpUrZi.js → utils-BiUjIHb4.js} +1 -1
  75. package/dist/gateway/static/root/assets/voice-api-key-field-agJqlm4o.js +1 -0
  76. package/dist/gateway/static/root/assets/work-item-detail-page-Bdw4ATCb.js +1 -0
  77. package/dist/gateway/static/root/assets/workflow-run-setup-panel-D-Dy6mTy.js +3 -0
  78. package/dist/gateway/static/root/assets/workflow-start-dialog-GammZ2GK.js +1 -0
  79. package/dist/gateway/static/root/assets/workflows-page-Cw5zrqti.js +18 -0
  80. package/dist/gateway/static/root/index.html +7 -8
  81. package/dist/package.js +1 -1
  82. package/dist/src/agent/image/inbound-image-handling.d.ts +1 -0
  83. package/dist/src/agent/image/inbound-image-handling.js +4 -1
  84. package/dist/src/agent/image/inbound-image-handling.js.map +1 -1
  85. package/dist/src/agent/image/tool-model-config.d.ts +18 -2
  86. package/dist/src/agent/image/tool-model-config.js +100 -14
  87. package/dist/src/agent/image/tool-model-config.js.map +1 -1
  88. package/dist/src/agent/image/vision-detection.js +4 -23
  89. package/dist/src/agent/image/vision-detection.js.map +1 -1
  90. package/dist/src/agent/inbound/attachment-pipeline.js +3 -0
  91. package/dist/src/agent/inbound/attachment-pipeline.js.map +1 -1
  92. package/dist/src/agent/messaging/command-handler.d.ts +5 -2
  93. package/dist/src/agent/messaging/command-handler.js +4 -3
  94. package/dist/src/agent/messaging/command-handler.js.map +1 -1
  95. package/dist/src/agent/service/btw-query.d.ts +2 -0
  96. package/dist/src/agent/service/btw-query.js +4 -2
  97. package/dist/src/agent/service/btw-query.js.map +1 -1
  98. package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -0
  99. package/dist/src/agent/service/direct-turn-helpers.js +1 -1
  100. package/dist/src/agent/service/direct-turn-helpers.js.map +1 -1
  101. package/dist/src/agent/service/process-direct-streaming.js +58 -1
  102. package/dist/src/agent/service/process-direct-streaming.js.map +1 -1
  103. package/dist/src/agent/service.js +1 -1
  104. package/dist/src/agent/service.js.map +1 -1
  105. package/dist/src/agent/session/session-inspector.d.ts +2 -1
  106. package/dist/src/agent/session/session-inspector.js +5 -3
  107. package/dist/src/agent/session/session-inspector.js.map +1 -1
  108. package/dist/src/agent/tools/factory.js +2 -1
  109. package/dist/src/agent/tools/factory.js.map +1 -1
  110. package/dist/src/agent/tools/image-tool.d.ts +1 -0
  111. package/dist/src/agent/tools/image-tool.js +4 -1
  112. package/dist/src/agent/tools/image-tool.js.map +1 -1
  113. package/dist/src/chat-commands/builtins/review.js +94 -7
  114. package/dist/src/chat-commands/builtins/review.js.map +1 -1
  115. package/dist/src/chat-commands/context.d.ts +5 -3
  116. package/dist/src/chat-commands/context.js +5 -2
  117. package/dist/src/chat-commands/context.js.map +1 -1
  118. package/dist/src/chat-commands/index.d.ts +1 -1
  119. package/dist/src/chat-commands/index.js.map +1 -1
  120. package/dist/src/chat-commands/types.d.ts +12 -1
  121. package/dist/src/config/agent-profile.js +1 -1
  122. package/dist/src/gateway/agents-admin.d.ts +5 -0
  123. package/dist/src/gateway/agents-admin.js +6 -1
  124. package/dist/src/gateway/agents-admin.js.map +1 -1
  125. package/dist/src/gateway/hono/routes/models.js +2 -1
  126. package/dist/src/gateway/hono/routes/models.js.map +1 -1
  127. package/dist/src/gateway/hono/routes/projects.js +88 -0
  128. package/dist/src/gateway/hono/routes/projects.js.map +1 -1
  129. package/dist/src/gateway/hono/routes/sessions.js +2 -1
  130. package/dist/src/gateway/hono/routes/sessions.js.map +1 -1
  131. package/dist/src/gateway/hono/routes/workflows.js +1 -0
  132. package/dist/src/gateway/hono/routes/workflows.js.map +1 -1
  133. package/dist/src/gateway/image-capabilities.d.ts +7 -1
  134. package/dist/src/gateway/image-capabilities.js +16 -3
  135. package/dist/src/gateway/image-capabilities.js.map +1 -1
  136. package/dist/src/gateway/service/sessions-api.d.ts +1 -0
  137. package/dist/src/gateway/service/sessions-api.js.map +1 -1
  138. package/dist/src/gateway/service.js +3 -3
  139. package/dist/src/projects/project-loop.js +2 -2
  140. package/dist/src/projects/project-loop.js.map +1 -1
  141. package/dist/src/review/review-types.js +2 -1
  142. package/dist/src/review/review-types.js.map +1 -1
  143. package/dist/src/session/client-history.d.ts +1 -0
  144. package/dist/src/session/client-history.js +56 -0
  145. package/dist/src/session/client-history.js.map +1 -1
  146. package/dist/src/session/index.js +1 -1
  147. package/dist/src/session/manager.d.ts +1 -0
  148. package/dist/src/session/manager.js.map +1 -1
  149. package/dist/src/session/store.d.ts +1 -0
  150. package/dist/src/session/store.js +30 -1
  151. package/dist/src/session/store.js.map +1 -1
  152. package/dist/src/tui/backends/embedded-backend.js +1 -1
  153. package/dist/src/tui/components/assistant-message.js +10 -3
  154. package/dist/src/tui/components/assistant-message.js.map +1 -1
  155. package/dist/src/tui/components/bash-execution.d.ts +4 -0
  156. package/dist/src/tui/components/bash-execution.js +15 -7
  157. package/dist/src/tui/components/bash-execution.js.map +1 -1
  158. package/dist/src/tui/tool-summary.js +9 -3
  159. package/dist/src/tui/tool-summary.js.map +1 -1
  160. package/dist/src/tui/tui-submit.d.ts +3 -0
  161. package/dist/src/tui/tui-submit.js +24 -1
  162. package/dist/src/tui/tui-submit.js.map +1 -1
  163. package/dist/src/tui/tui.js +29 -2
  164. package/dist/src/tui/tui.js.map +1 -1
  165. package/dist/src/work-items/index.d.ts +1 -0
  166. package/dist/src/work-items/index.js +2 -1
  167. package/dist/src/work-items/work-item-workflow-judge.d.ts +8 -0
  168. package/dist/src/work-items/work-item-workflow-judge.js +50 -0
  169. package/dist/src/work-items/work-item-workflow-judge.js.map +1 -0
  170. package/dist/src/workflows/domain/run.d.ts +17 -0
  171. package/dist/src/workflows/domain/run.js.map +1 -1
  172. package/dist/src/workflows/service/workflow-run-service.d.ts +3 -0
  173. package/dist/src/workflows/service/workflow-run-service.js +67 -0
  174. package/dist/src/workflows/service/workflow-run-service.js.map +1 -1
  175. package/dist/src/workflows/service/workflow-run-service.types.d.ts +4 -1
  176. package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
  177. package/dist/src/workflows/service/workflow-session-bridge.js +45 -0
  178. package/dist/src/workflows/service/workflow-session-bridge.js.map +1 -1
  179. package/package.json +1 -1
  180. package/dist/gateway/static/root/assets/Combination-BzaXOLd9.js +0 -41
  181. package/dist/gateway/static/root/assets/agents-BP0iRtiu.js +0 -2
  182. package/dist/gateway/static/root/assets/apps-page-12_2SDFq.js +0 -1
  183. package/dist/gateway/static/root/assets/automations-page-V-tw6y1o.js +0 -4
  184. package/dist/gateway/static/root/assets/browser-settings-page-aMPnxWXi.js +0 -8
  185. package/dist/gateway/static/root/assets/capability-presets-api-CsaY2Z8B.js +0 -1
  186. package/dist/gateway/static/root/assets/channels-settings-N8NujD--.js +0 -1
  187. package/dist/gateway/static/root/assets/channels-status-swr-BG_j4Ci-.js +0 -1
  188. package/dist/gateway/static/root/assets/connectors-page-zBJbFgnK.js +0 -2
  189. package/dist/gateway/static/root/assets/desktop-pet-DfA-hVlt.js +0 -1
  190. package/dist/gateway/static/root/assets/dist-CkobR7mk.js +0 -1
  191. package/dist/gateway/static/root/assets/dist-DokQNVMQ.js +0 -1
  192. package/dist/gateway/static/root/assets/goal-create-dialog-BOWSTGB-.js +0 -1
  193. package/dist/gateway/static/root/assets/goal-detail-page-CCLgkqj1.js +0 -4
  194. package/dist/gateway/static/root/assets/goals-page-CsfIp8Vl.js +0 -2
  195. package/dist/gateway/static/root/assets/index-BOme955B.js +0 -262
  196. package/dist/gateway/static/root/assets/index-DXUkWmeK.css +0 -1
  197. package/dist/gateway/static/root/assets/logs-page-CW7AMYhN.js +0 -7
  198. package/dist/gateway/static/root/assets/messages-DR9ODkb8.js +0 -3
  199. package/dist/gateway/static/root/assets/models-hub-panel-mKfeyGVq.js +0 -2
  200. package/dist/gateway/static/root/assets/notes-page-DYw5zPeJ.js +0 -1
  201. package/dist/gateway/static/root/assets/notes-workbench-SPdKpvSN.js +0 -2
  202. package/dist/gateway/static/root/assets/project-detail-page-D3yP4K3k.js +0 -1
  203. package/dist/gateway/static/root/assets/projects-page-B6EV45NR.js +0 -1
  204. package/dist/gateway/static/root/assets/remote-access-hub-9foX60FQ.js +0 -1
  205. package/dist/gateway/static/root/assets/sessions-page-BReBhxWd.js +0 -1
  206. package/dist/gateway/static/root/assets/settings-advanced-gate-DNDBN4nT.js +0 -1
  207. package/dist/gateway/static/root/assets/setup-status-panel-C8UtBMJ_.js +0 -1
  208. package/dist/gateway/static/root/assets/shares-settings-xXAMKlc7.js +0 -1
  209. package/dist/gateway/static/root/assets/skill-reload-api-CurjHfEM.js +0 -1
  210. package/dist/gateway/static/root/assets/skills-page-BRR7NQkL.js +0 -2
  211. package/dist/gateway/static/root/assets/voice-api-key-field-DCiECZN1.js +0 -1
  212. package/dist/gateway/static/root/assets/work-item-detail-page-DAel5CHH.js +0 -1
  213. package/dist/gateway/static/root/assets/workflow-run-setup-panel-2w0zj9eJ.js +0 -3
  214. package/dist/gateway/static/root/assets/workflow-start-dialog-B5xdDFV-.js +0 -1
  215. package/dist/gateway/static/root/assets/workflows-page-DRhiSwuU.js +0 -18
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CQ_k8RHj.js";import{a as o,n as s,o as c}from"./fetch-BWXmBizE.js";import{n as l}from"./locale-store-Ba72bFmP.js";import{i as u}from"./theme-store-Bt6vAkSB.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,$r as p,$s as m,Ac as h,Ao as g,At as _,Ba as v,Bi as y,Bo as b,C as x,Cs as S,Dl as C,Eo as w,Fi as T,Ft as E,Ga as D,Ha as O,Hs as k,Ii as A,Io as j,Jn as M,Ka as N,Li as P,Lo as F,Mt as I,Ni as ee,Nt as L,Ol as te,Oo as R,Pi as z,Po as ne,Qn as re,Qo as ie,Qr as B,Qs as V,Rc as H,Ri as U,Rt as W,Ua as ae,Va as oe,Vi as G,Vo as K,Vt as se,Wa as ce,Xn as le,Yn as ue,Za as q,Zn as de,_a as J,_s as fe,ao as pe,ar as me,bo as he,ca as ge,cl as _e,co as ve,cr as ye,do as be,dr as xe,ei as Y,er as Se,es as Ce,fl as we,ga as Te,gl as Ee,ic as De,ii as Oe,io as ke,kc as Ae,kl as je,ko as Me,ks as Ne,lo as Pe,n as Fe,ni as Ie,nr as Le,ns as Re,ol as ze,oo as Be,or as Ve,qa as He,r as Ue,ri as X,ro as We,rr as Ge,si as Ke,so as qe,sr as Je,ti as Ye,to as Xe,tr as Ze,ul as Qe,uo as $e,ur as et,us as tt,w as nt,wl as rt,wo as it,xc as at,yc as ot,yl as st,yo as ct,za as lt,zi as ut,zt as dt}from"./index-DZOm5_ex.js";import{t as ft}from"./markdown-editor-jD1LPiP-.js";import{n as pt,t as mt}from"./settings-page-layout-CrICyGob.js";import{r as ht,t as gt}from"./settings-loading-skeleton-SYCPY-WM.js";import{n as _t,t as vt}from"./settings-form-section-By0YiDWo.js";import{t as yt}from"./page-tabs-CVLqCfQB.js";import{n as bt}from"./agent-avatar-dicebear-CER17NHM.js";import{n as xt,r as St,t as Ct}from"./channel-recipient-api-sV06LCht.js";import{n as wt,r as Tt,t as Et}from"./utils-BiUjIHb4.js";import{a as Dt,i as Ot,n as kt,o as At,t as jt}from"./typed-models-lib-CwFayhxu.js";import{a as Mt,o as Nt,r as Pt,s as Ft}from"./capability-presets-api-B7WWYaEh.js";import{t as It}from"./directory-picker-path-field-D1nxs9PA.js";var Z=n(),Q=r();function Lt(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,busy:a,deletePurge:o,deleteTarget:s,deleteConfirmText:c,onDeleteConfirmTextChange:l,onConfirm:u,onCancel:d,a:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(ae,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=i(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),t[1]=m):m=t[1];let h=o?f.purgeDisk:f.removeFromConfig,g;t[2]===h?g=t[3]:(g=(0,Q.jsx)(N,{className:`text-base font-semibold text-fg`,children:h}),t[2]=h,t[3]=g);let _=o?f.confirmDeletePurge:f.confirmDelete,v;t[4]===_?v=t[5]:(v=(0,Q.jsx)(O,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==f.purgeConfirmHint||t[7]!==f.purgeConfirmLabel||t[8]!==f.purgeConfirmPlaceholder||t[9]!==c||t[10]!==o||t[11]!==s||t[12]!==l?(y=o&&s?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:f.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:f.purgeConfirmPlaceholder.replace(`{{agentId}}`,s.id),value:c,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:f.purgeConfirmHint.replace(`{{agentId}}`,s.id)})]}):null,t[6]=f.purgeConfirmHint,t[7]=f.purgeConfirmLabel,t[8]=f.purgeConfirmPlaceholder,t[9]=c,t[10]=o,t[11]=s,t[12]=l,t[13]=y):y=t[13];let b;t[14]!==f.createModalCancel||t[15]!==a||t[16]!==d?(b=(0,Q.jsx)(w,{type:`button`,variant:`ghost`,disabled:a,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=a,t[16]=d,t[17]=b):b=t[17];let x=o?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,S;t[18]!==a||t[19]!==c||t[20]!==o||t[21]!==s?(S=a||!s||o&&c.trim().toLowerCase()!==s.id.toLowerCase(),t[18]=a,t[19]=c,t[20]=o,t[21]=s,t[22]=S):S=t[22];let C=o?f.purgeDisk:f.removeFromConfig,T;t[23]!==u||t[24]!==S||t[25]!==C||t[26]!==x?(T=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:x,disabled:S,onClick:u,children:C}),t[23]=u,t[24]=S,t[25]=C,t[26]=x,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==b?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[b,T]}),t[28]=T,t[29]=b,t[30]=E):E=t[30];let k;t[31]!==E||t[32]!==g||t[33]!==v||t[34]!==y?(k=(0,Q.jsxs)(ce,{children:[p,(0,Q.jsxs)(oe,{className:m,onOpenAutoFocus:Rt,children:[g,v,y,E]})]}),t[31]=E,t[32]=g,t[33]=v,t[34]=y,t[35]=k):k=t[35];let A;return t[36]!==r||t[37]!==n||t[38]!==k?(A=(0,Q.jsx)(D,{open:n,onOpenChange:r,children:k}),t[36]=r,t[37]=n,t[38]=k,t[39]=A):A=t[39],A}function Rt(e){return e.preventDefault()}var $=e(t(),1),zt=[{id:`overview`,labelKey:`navOverview`,icon:ot},{id:`behavior`,labelKey:`navBehavior`,icon:Ce},{id:`tools`,labelKey:`navTools`,icon:g},{id:`skills`,labelKey:`navSkills`,icon:R},{id:`memory`,labelKey:`navMemory`,icon:_e},{id:`connections`,labelKey:`navConnections`,icon:ze},{id:`config`,labelKey:`navConfig`,icon:Re},{id:`dangerZone`,labelKey:`navDangerZone`,icon:b}];function Bt(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:a}=e,o;t[0]!==a||t[1]!==r?(o=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:i(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,he.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c=n.editorNavAria,l;t[3]!==n||t[4]!==s?(l=zt.map(e=>{let{id:t,labelKey:r,icon:i}=e;return s(t,n[r],i)}),t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l}),t[6]=l,t[7]=u);let d;return t[8]!==n.editorNavAria||t[9]!==u?(d=(0,Q.jsx)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":c,children:u}),t[8]=n.editorNavAria,t[9]=u,t[10]=d):d=t[10],d}function Vt(e){let t=(0,Z.c)(45),{open:n,onOpenChange:r,a,title:o,subtitle:s,panel:c,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,showFooter:p,busy:m,children:h}=e,g=p===void 0?!0:p,[_,y]=(0,$.useState)(null),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(ae,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Be)}),t[0]=b):b=t[0];let x;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(x=i(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,pe,`inset-4 h-[calc(100dvh-2rem)] max-h-[calc(100dvh-2rem)] min-h-0`,`sm:inset-auto sm:left-1/2 sm:top-1/2 sm:h-[min(88vh,48rem)] sm:max-h-[min(88vh,48rem)] sm:min-h-[32rem] sm:w-[min(100%-2rem,58rem)] sm:-translate-x-1/2 sm:-translate-y-1/2`),t[1]=x):x=t[1];let S;t[2]===o?S=t[3]:(S=(0,Q.jsx)(N,{className:`text-base font-semibold leading-snug text-fg`,children:o}),t[2]=o,t[3]=S);let C;t[4]===s?C=t[5]:(C=(0,Q.jsx)(O,{className:`mt-1 font-mono text-xs text-fg-muted`,children:s}),t[4]=s,t[5]=C);let T;t[6]!==S||t[7]!==C?(T=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[S,C]}),t[6]=S,t[7]=C,t[8]=T):T=t[8];let E;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(E=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=E):E=t[9];let k;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),t[10]=k):k=t[10];let A;t[11]===a.closeDialogAria?A=t[12]:(A=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:E,"aria-label":a.closeDialogAria,children:k})}),t[11]=a.closeDialogAria,t[12]=A);let j;t[13]!==T||t[14]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-2 border-b border-edge-subtle px-4 pb-3 pt-4 dark:border-edge`,children:[T,A]}),t[13]=T,t[14]=A,t[15]=j):j=t[15];let M;t[16]!==a||t[17]!==l||t[18]!==c?(M=(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,Q.jsx)(Bt,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=M):M=t[19];let P;t[20]===h?P=t[21]:(P=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:h}),t[20]=h,t[21]=P);let F;t[22]!==a.footerSaveNotApplicable||t[23]!==a.personaSaved||t[24]!==a.save||t[25]!==m||t[26]!==d||t[27]!==f||t[28]!==u||t[29]!==g?(F=g?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[f?(0,Q.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,a.personaSaved]}):d?(0,Q.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:a.footerSaveNotApplicable}):null,(0,Q.jsx)(w,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:m||d,onClick:()=>void u(),children:a.save})]}):null,t[22]=a.footerSaveNotApplicable,t[23]=a.personaSaved,t[24]=a.save,t[25]=m,t[26]=d,t[27]=f,t[28]=u,t[29]=g,t[30]=F):F=t[30];let I;t[31]!==P||t[32]!==F?(I=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[P,F]}),t[31]=P,t[32]=F,t[33]=I):I=t[33];let ee;t[34]!==M||t[35]!==I?(ee=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[M,I]}),t[34]=M,t[35]=I,t[36]=ee):ee=t[36];let L;t[37]!==_||t[38]!==ee||t[39]!==j?(L=(0,Q.jsxs)(ce,{children:[b,(0,Q.jsx)(oe,{ref:y,className:x,onOpenAutoFocus:Ht,children:(0,Q.jsxs)(ke,{layer:`modal`,portalContainer:_,children:[j,ee]})})]}),t[37]=_,t[38]=ee,t[39]=j,t[40]=L):L=t[40];let te;return t[41]!==r||t[42]!==n||t[43]!==L?(te=(0,Q.jsx)(D,{open:n,onOpenChange:r,children:L}),t[41]=r,t[42]=n,t[43]=L,t[44]=te):te=t[44],te}function Ht(e){return e.preventDefault()}var Ut=e=>s(e);function Wt(e){return!e||e.total<=0?null:Math.round(e.helpful/e.total*100)}function Gt(e){let t=Wt(e);return t==null?`border-edge bg-surface-panel text-fg-muted`:t>=70?`border-success/30 bg-success-soft text-fg`:t>=40?`border-warning/40 bg-warning-soft text-fg`:`border-danger/30 bg-danger-soft text-fg`}function Kt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`article`,{className:`px-4 py-3`,"aria-hidden":`true`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(J,{className:`h-3 w-16`}),(0,Q.jsx)(J,{className:`h-3 w-20`}),(0,Q.jsx)(J,{className:`h-3 w-24`})]}),(0,Q.jsx)(J,{className:`mt-3 h-4 w-full`}),(0,Q.jsx)(J,{className:`mt-2 h-4 w-5/6`}),(0,Q.jsx)(J,{className:`mt-2 h-4 w-2/3`})]}),e[0]=t):t=e[0],t}function qt({embedded:e=!1,agentId:t}){let n=a(l(e=>e.language)).agentsSettings.memoryPanel,[r,i]=(0,$.useState)(``),[o,u]=(0,$.useState)(``),[f,p]=(0,$.useState)(``),[m,h]=(0,$.useState)({}),[g,_]=(0,$.useState)({searchStrategy:`fanout`,writeStrategy:`local-first`,allowExternalWrites:!1,allowedProviderIds:[],autoWriteKinds:[]}),{data:v,isLoading:y}=d(c(`/api/memory/providers`),Ut),{data:b,isLoading:x,mutate:S}=d(c(`/api/memory/records?status=active&limit=80`),Ut),{data:C,isLoading:T,mutate:E}=d(c(`/api/memory/records?status=candidate&limit=80`),Ut),{data:D,isLoading:O}=d(c(`/api/memory/signals?limit=50`),Ut),{data:k,isLoading:A,mutate:j}=d(c(`/api/memory/traces?limit=80`),Ut),{data:M,isLoading:N}=d(c(`/api/memory/feedback-summary?limit=1000`),Ut),{data:P,isLoading:F,mutate:I}=d(c(`/api/memory/config${t?`?agentId=${encodeURIComponent(t)}`:``}`),Ut),{data:ee,isLoading:L}=d(o?c(`/api/memory/search`):null,e=>s(e,{method:`POST`,body:JSON.stringify({query:o,maxResults:20})})),te=ee?.results.map(e=>({...e.record,score:e.score}))??b?.records??[],R=v?.providers.length??0,z=b?.records.length??0,ne=C?.records.length??0,re=D?.signals.length??0,ie=k?.traces.length??0,B=M?.summaries??[],V=y||x||T||O||A||N||F,H=(0,$.useMemo)(()=>new Map(B.map(e=>[e.recordId,e])),[B]),U=B.reduce((e,t)=>e+t.total,0),W=B.reduce((e,t)=>e+t.helpful,0),ae=U>0?Math.round(W/U*100):null,oe=(0,$.useMemo)(()=>[{label:n.providers,value:R},{label:n.records,value:z},{label:n.inbox,value:ne},{label:n.signals,value:re},{label:n.traceEvents,value:ie},{label:n.recallQuality,value:ae==null?`—`:`${ae}%`}],[ne,ae,R,z,re,n.inbox,n.providers,n.recallQuality,n.records,n.signals,n.traceEvents,ie]);(0,$.useEffect)(()=>{let e=P?.memory.providerRouting;e&&_({searchStrategy:e.searchStrategy??`fanout`,writeStrategy:e.writeStrategy??`local-first`,allowExternalWrites:e.allowExternalWrites??!1,allowedProviderIds:e.allowedProviderIds??[],autoWriteKinds:e.autoWriteKinds??[]})},[P]);async function G(){if(P){p(n.saving);try{await s(c(`/api/memory/config`),{method:`PATCH`,body:JSON.stringify({agentId:P.agentId,memory:{...P.memory,providerRouting:g}})}),await I(),p(n.saved)}catch(e){p(e instanceof Error?e.message:n.saveFailed)}}}async function K(e){h(t=>({...t,[e]:n.testing}));try{let t=(await s(c(`/api/memory/providers/${encodeURIComponent(e)}/test`),{method:`POST`})).checks.find(e=>!e.ok);h(r=>({...r,[e]:t?`${t.name}: ${t.message??n.checkFailed}`:n.testPassed})),j()}catch(t){h(r=>({...r,[e]:t instanceof Error?t.message:n.testFailed}))}}async function se(e,t){await s(c(`/api/memory/records/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({status:t})}),await Promise.all([E(),S()])}return(0,Q.jsxs)(`div`,{className:e?`flex min-h-0 w-full flex-1 flex-col gap-5 overflow-y-auto overscroll-contain pr-1`:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[e?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:n.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-6`,children:oe.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:e.label}),V?(0,Q.jsx)(J,{className:`mt-2 h-7 w-16`}):(0,Q.jsx)(`div`,{className:`mt-1 text-2xl font-semibold text-fg`,children:e.value})]},e.label))}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providerPolicy}),(0,Q.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.searchStrategy,(0,Q.jsx)(Xe,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:g.searchStrategy,onChange:e=>_(t=>({...t,searchStrategy:e.target.value})),children:[`fanout`,`local-first`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(We,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.writeStrategy,(0,Q.jsx)(Xe,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:g.writeStrategy,onChange:e=>_(t=>({...t,writeStrategy:e.target.value})),children:[`local-first`,`write-through`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(We,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg md:col-span-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:g.allowExternalWrites,onChange:e=>_(t=>({...t,allowExternalWrites:e.target.checked}))}),n.allowExternalWrites]}),(0,Q.jsxs)(`div`,{className:`md:col-span-2`,children:[(0,Q.jsx)(`div`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:n.writableProviders}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:y?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(J,{className:`h-10 w-28 rounded-md`},t)):(v?.providers??[]).filter(e=>!e.capabilities.local).map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3 py-2 text-sm text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:g.allowedProviderIds?.includes(e.id)??!1,onChange:t=>_(n=>({...n,allowedProviderIds:t.target.checked?[...n.allowedProviderIds??[],e.id]:(n.allowedProviderIds??[]).filter(t=>t!==e.id)}))}),e.displayName]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 md:col-span-2`,children:[(0,Q.jsx)(w,{type:`button`,variant:`primary`,onClick:G,children:n.savePolicy}),f?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:f}):null]})]})]}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.inbox}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.inboxHint})]}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:ne})]}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[T?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(C?.records??[]).map(e=>(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.sensitivity??`normal`}),(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.confidence==null?null:(0,Q.jsxs)(`span`,{children:[Math.round(e.confidence*100),`%`]})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),e.evidence?.[0]?.sourceText?(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.evidence[0].sourceText}):null,(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(w,{type:`button`,variant:`primary`,onClick:()=>se(e.id,`active`),children:n.approve}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>se(e.id,`rejected`),children:n.reject}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>se(e.id,`needs_review`),children:n.needsReview})]})]},e.id)),!T&&ne===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noInbox}):null]})]}),(0,Q.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),u(r.trim())},children:[(0,Q.jsx)(`input`,{className:`min-h-10 flex-1 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:e=>i(e.target.value),placeholder:n.searchPlaceholder}),(0,Q.jsx)(w,{className:`min-h-10 rounded-md px-4`,type:`submit`,variant:`primary`,children:n.search})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_20rem]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:o?`${n.searchResults}${L?`…`:``}`:n.recentRecords}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[L||x&&!o?Array.from({length:5}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):te.map(e=>{let t=H.get(e.id),r=Wt(t);return(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),e.status?(0,Q.jsx)(`span`,{children:e.status}):null,e.sensitivity?(0,Q.jsx)(`span`,{children:e.sensitivity}):null,(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.source.path?(0,Q.jsx)(`span`,{children:e.source.path}):null,(0,Q.jsx)(`span`,{className:`rounded-full border px-2 py-0.5 ${Gt(t)}`,children:r==null?n.noRecallFeedback:`${n.recallQuality} ${r}% · ${t?.total??0}`})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),t?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{children:[n.helpful,`: `,t.helpful]}),(0,Q.jsxs)(`span`,{children:[n.notHelpful,`: `,t.notHelpful]}),t.mixed?(0,Q.jsxs)(`span`,{children:[n.mixed,`: `,t.mixed]}):null,t.irrelevant?(0,Q.jsxs)(`span`,{children:[n.irrelevant,`: `,t.irrelevant]}):null]}):null]},e.id)}),!x&&!L&&te.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecords}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providers}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:y?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(v?.providers??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[e.id,` · `,e.available?n.available:n.unavailable]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,Q.jsx)(w,{type:`button`,variant:`secondary`,onClick:()=>K(e.id),children:n.test}),m[e.id]?(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:m[e.id]}):null]})]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.recallQuality}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[N?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):B.slice(0,8).map(e=>{let t=(b?.records??[]).find(t=>t.id===e.recordId),r=Wt(e);return(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 font-medium text-fg`,children:t?.kind??n.record}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 ${Gt(e)}`,children:[r??0,`%`]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-fg-muted`,children:t?.content??e.recordId}),(0,Q.jsxs)(`div`,{className:`mt-2`,children:[e.helpful,` `,n.helpful,` · `,e.notHelpful,` `,n.notHelpful,` · `,e.total,` `,n.feedback]})]},e.recordId)}),!N&&B.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecallFeedback}):null]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.signals}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:O?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(D?.signals??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-fg`,children:e.source}),(0,Q.jsxs)(`div`,{children:[e.providerId??`local`,` · `,new Date(e.createdAt).toLocaleString()]})]},e.signalId))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.trace}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:A?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(Kt,{},t)):(k?.traces??[]).slice(0,20).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`font-medium text-fg`,children:[e.phase,` · `,e.providerId]}),(0,Q.jsxs)(`div`,{children:[e.resultCount??0,` `,(e.resultCount??0)===1?n.result:n.results,` · `,e.durationMs,` ms`]}),e.skippedReason?(0,Q.jsxs)(`div`,{children:[n.skipped,`: `,e.skippedReason]}):null,e.error?(0,Q.jsx)(`div`,{className:`text-danger`,children:e.error}):null]},e.traceId))})]})]})]})]})}function Jt(e){let t=(0,Z.c)(28),{label:n,mode:r,value:a,inheritedFrom:o,inheritLabel:s,overrideLabel:c,onClick:l}=e,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=u);let d=a||`—`,f;t[2]===d?f=t[3]:(f=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==o||t[5]!==r?(p=r===`inherit`&&o?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:o}):null,t[4]=o,t[5]=r,t[6]=p):p=t[6];let m;t[7]!==u||t[8]!==f||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[u,f,p]}),t[7]=u,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,g;t[11]===h?g=t[12]:(g=i(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,h),t[11]=h,t[12]=g);let _=r===`inherit`?s:c,v;t[13]!==g||t[14]!==_?(v=(0,Q.jsx)(`span`,{className:g,children:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==m||t[17]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[m,v]}),t[16]=m,t[17]=v,t[18]=y):y=t[18];let b=y,x=l?`w-full text-left transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 active:scale-[0.995] motion-reduce:active:scale-100`:void 0,S;t[19]===x?S=t[20]:(S=i(`flex flex-col gap-1 rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,x),t[19]=x,t[20]=S);let C=S;if(l){let e;return t[21]!==C||t[22]!==b||t[23]!==l?(e=(0,Q.jsx)(`button`,{type:`button`,className:C,onClick:l,children:b}),t[21]=C,t[22]=b,t[23]=l,t[24]=e):e=t[24],e}let w;return t[25]!==C||t[26]!==b?(w=(0,Q.jsx)(`div`,{className:C,children:b}),t[25]=C,t[26]=b,t[27]=w):w=t[27],w}function Yt(e){let t=(0,Z.c)(38),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditModelStrategy:s,onEditWorkspace:c}=e,l=n.inheritance,u;t[0]===a?u=t[1]:(u=a.trim(),t[0]=a,t[1]=u);let d=!u,f;t[2]!==o||t[3]!==i?(f=!o.trim()||i.trim().length>0&&o.trim()===i.trim(),t[2]=o,t[3]=i,t[4]=f):f=t[4];let p=f,h=d?r||l.unset:a,g=p?i||l.unset:o,_;t[5]!==l.subtitle||t[6]!==l.title?(_=(0,Q.jsx)(_t,{icon:m,title:l.title,subtitle:l.subtitle}),t[5]=l.subtitle,t[6]=l.title,t[7]=_):_=t[7];let v=d?`inherit`:`override`,y;t[8]!==r||t[9]!==l.inheritsValue||t[10]!==d?(y=d&&r?l.inheritsValue.replace(`{{value}}`,r):void 0,t[8]=r,t[9]=l.inheritsValue,t[10]=d,t[11]=y):y=t[11];let b;t[12]!==h||t[13]!==l.badgeInherit||t[14]!==l.badgeOverride||t[15]!==l.modelLabel||t[16]!==s||t[17]!==v||t[18]!==y?(b=(0,Q.jsx)(Jt,{label:l.modelLabel,mode:v,value:h,inheritedFrom:y,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:s}),t[12]=h,t[13]=l.badgeInherit,t[14]=l.badgeOverride,t[15]=l.modelLabel,t[16]=s,t[17]=v,t[18]=y,t[19]=b):b=t[19];let x=p?`inherit`:`override`,S;t[20]!==i||t[21]!==l.inheritsValue||t[22]!==p?(S=p&&i?l.inheritsValue.replace(`{{value}}`,i):void 0,t[20]=i,t[21]=l.inheritsValue,t[22]=p,t[23]=S):S=t[23];let C;t[24]!==g||t[25]!==l.badgeInherit||t[26]!==l.badgeOverride||t[27]!==l.workspaceLabel||t[28]!==c||t[29]!==x||t[30]!==S?(C=(0,Q.jsx)(Jt,{label:l.workspaceLabel,mode:x,value:g,inheritedFrom:S,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:c}),t[24]=g,t[25]=l.badgeInherit,t[26]=l.badgeOverride,t[27]=l.workspaceLabel,t[28]=c,t[29]=x,t[30]=S,t[31]=C):C=t[31];let w;t[32]!==b||t[33]!==C?(w=(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[b,C]}),t[32]=b,t[33]=C,t[34]=w):w=t[34];let T;return t[35]!==_||t[36]!==w?(T=(0,Q.jsxs)(vt,{children:[_,w]}),t[35]=_,t[36]=w,t[37]=T):T=t[37],T}function Xt(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Zt(e){let t=(0,Z.c)(5),{source:n}=e,r;if(t[0]!==n){let e=n.startsWith(`preset:`),a=n.startsWith(`agent:`);r=i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e&&`bg-accent/10 text-accent`,a&&`bg-surface-base text-fg-muted`,!e&&!a&&`bg-surface-panel text-fg-subtle`),t[0]=n,t[1]=r}else r=t[1];let a;return t[2]!==n||t[3]!==r?(a=(0,Q.jsx)(`span`,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=a):a=t[4],a}function Qt(e){let t=(0,Z.c)(13),n;t[0]===e.name?n=t[1]:(n=(0,Q.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs font-medium text-fg`,children:e.name}),t[0]=e.name,t[1]=n);let r=e.monoValue&&`font-mono text-xs`,a;t[2]===r?a=t[3]:(a=i(`min-w-0 truncate text-sm text-fg`,r),t[2]=r,t[3]=a);let o;t[4]!==e.value||t[5]!==a?(o=(0,Q.jsx)(`div`,{className:a,children:e.value}),t[4]=e.value,t[5]=a,t[6]=o):o=t[6];let s;t[7]===e.source?s=t[8]:(s=(0,Q.jsx)(Zt,{source:e.source}),t[7]=e.source,t[8]=s);let c;return t[9]!==n||t[10]!==o||t[11]!==s?(c=(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:grid-cols-[minmax(0,10rem)_minmax(0,1fr)_auto] sm:items-center`,children:[n,o,s]}),t[9]=n,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function $t(e,t){return e&&e.length>0?e.join(`, `):t}function en(e){let t=(0,Z.c)(30),{a:n,selected:r}=e,i;t[0]===r.id?i=t[1]:(i=r.id?[`agent-effective-manifest`,r.id]:null,t[0]=r.id,t[1]=i);let a;t[2]===r.id?a=t[3]:(a=()=>Ze(r.id),t[2]=r.id,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[4]=o):o=t[4];let{data:s,error:c,isLoading:l}=d(i,a,o),u=s?.manifest,f;t[5]!==s?.presetChain||t[6]!==u?.extends?(f=s?.presetChain??u?.extends??[],t[5]=s?.presetChain,t[6]=u?.extends,t[7]=f):f=t[7];let p=f,m;if(t[8]!==n.effectiveBoundariesTitle||t[9]!==n.effectiveEmpty||t[10]!==n.effectiveError||t[11]!==n.effectiveHint||t[12]!==n.effectiveLoading||t[13]!==n.effectiveMemoryTitle||t[14]!==n.effectiveModelsTitle||t[15]!==n.effectiveNoPresets||t[16]!==n.effectiveNoToolPolicies||t[17]!==n.effectivePresetChain||t[18]!==n.effectiveSkillsTitle||t[19]!==n.effectiveTitle||t[20]!==n.effectiveToolsTitle||t[21]!==s?.sources||t[22]!==c||t[23]!==l||t[24]!==u||t[25]!==p){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(nn),i=Object.entries(u?.tools?.builtin??{}).sort(tn),a=u?.skills,o=u?.memory,d=u?.boundaries,f;t[27]!==n.effectiveHint||t[28]!==n.effectiveTitle?(f=(0,Q.jsx)(_t,{icon:V,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[27]=n.effectiveHint,t[28]=n.effectiveTitle,t[29]=f):f=t[29],m=(0,Q.jsxs)(vt,{children:[f,l?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveLoading}):c?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c instanceof Error?c.message:n.effectiveError}):u?(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectivePresetChain}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 text-sm text-fg shadow-surface`,children:p.length?p.join(` -> `):n.effectiveNoPresets})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveModelsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Xt(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(Qt,{name:n,value:r.model,monoValue:!0,source:Xt(e,[`models.roles.${n}.model`,`models.roles.${n}`])},n)})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveToolsTitle}),i.length>0?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map(t=>{let[n,r]=t;return(0,Q.jsx)(Qt,{name:n,value:r.mode,source:Xt(e,[`tools.builtin.${n}.mode`,`tools.builtin.${n}`])},n)})}):(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted shadow-surface`,children:n.effectiveNoToolPolicies})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveSkillsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`mode`,value:a?.mode??`all`,source:Xt(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(Qt,{name:`allow`,value:$t(a.allow,`—`),source:Xt(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(Qt,{name:`deny`,value:$t(a.deny,`—`),source:Xt(e,[`skills.deny`,`skills`])}):null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveMemoryTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`mode`,value:o?.mode??`off`,source:Xt(e,[`memory.mode`,`memory`])}),(0,Q.jsx)(Qt,{name:`sources`,value:$t(o?.sources,`—`),source:Xt(e,[`memory.sources`,`memory`])})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveBoundariesTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Qt,{name:`requiresConfirmation`,value:$t(d?.requiresConfirmation,`—`),source:Xt(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(Qt,{name:`forbidden`,value:$t(d?.forbidden,`—`),source:Xt(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(Qt,{name:`escalation`,value:$t(d?.escalation,`—`),source:Xt(e,[`boundaries.escalation`,`boundaries`])})]})]})]})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveEmpty})]}),t[8]=n.effectiveBoundariesTitle,t[9]=n.effectiveEmpty,t[10]=n.effectiveError,t[11]=n.effectiveHint,t[12]=n.effectiveLoading,t[13]=n.effectiveMemoryTitle,t[14]=n.effectiveModelsTitle,t[15]=n.effectiveNoPresets,t[16]=n.effectiveNoToolPolicies,t[17]=n.effectivePresetChain,t[18]=n.effectiveSkillsTitle,t[19]=n.effectiveTitle,t[20]=n.effectiveToolsTitle,t[21]=s?.sources,t[22]=c,t[23]=l,t[24]=u,t[25]=p,t[26]=m}else m=t[26];return m}function tn(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function nn(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function rn(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain pr-1`,children:(0,Q.jsx)(`div`,{className:`mx-auto flex w-full max-w-3xl flex-col gap-5 pb-6`,children:n})}),t[0]=n,t[1]=r),r}function an(e){let t=(0,Z.c)(4),{active:n,children:r,onClick:i}=e,a=n?`rounded-md bg-accent-soft px-3 py-1.5 text-sm font-medium text-accent-fg`:`rounded-md px-3 py-1.5 text-sm font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,o;return t[0]!==r||t[1]!==i||t[2]!==a?(o=(0,Q.jsx)(`button`,{type:`button`,onClick:i,className:a,children:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=o):o=t[3],o}function on(e){let t=(0,Z.c)(41),{a:n,selected:r,busy:i,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}=e,[p,m]=(0,$.useState)(`sources`),h=p===`sources`,g;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>m(`sources`),t[0]=g):g=t[0];let _;t[1]!==n.configSubtabSources||t[2]!==h?(_=(0,Q.jsx)(an,{active:h,onClick:g,children:n.configSubtabSources}),t[1]=n.configSubtabSources,t[2]=h,t[3]=_):_=t[3];let v=p===`shared`,y;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>m(`shared`),t[4]=y):y=t[4];let b;t[5]!==n.configSubtabShared||t[6]!==v?(b=(0,Q.jsx)(an,{active:v,onClick:y,children:n.configSubtabShared}),t[5]=n.configSubtabShared,t[6]=v,t[7]=b):b=t[7];let x=p===`effective`,S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>m(`effective`),t[8]=S):S=t[8];let C;t[9]!==n.configSubtabEffective||t[10]!==x?(C=(0,Q.jsx)(an,{active:x,onClick:S,children:n.configSubtabEffective}),t[9]=n.configSubtabEffective,t[10]=x,t[11]=C):C=t[11];let w;t[12]!==_||t[13]!==b||t[14]!==C?(w=(0,Q.jsx)(`div`,{className:`shrink-0 rounded-lg border border-edge bg-surface-panel p-1`,children:(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[_,b,C]})}),t[12]=_,t[13]=b,t[14]=C,t[15]=w):w=t[15];let T;t[16]!==n||t[17]!==s||t[18]!==c||t[19]!==a||t[20]!==o||t[21]!==p?(T=p===`sources`?(0,Q.jsx)(sn,{a:n,defaultModel:a,defaultWorkspace:o,agentModel:s,agentWorkspace:c}):null,t[16]=n,t[17]=s,t[18]=c,t[19]=a,t[20]=o,t[21]=p,t[22]=T):T=t[22];let E;t[23]!==n||t[24]!==i||t[25]!==l||t[26]!==u||t[27]!==f||t[28]!==d||t[29]!==r||t[30]!==p?(E=p===`shared`?(0,Q.jsx)(cn,{a:n,selected:r,busy:i,capabilityPresets:l,defaultPresetId:u,onUpdateAgentExtends:d,onOpenCapabilityPreset:f}):null,t[23]=n,t[24]=i,t[25]=l,t[26]=u,t[27]=f,t[28]=d,t[29]=r,t[30]=p,t[31]=E):E=t[31];let D;t[32]!==n||t[33]!==r||t[34]!==p?(D=p===`effective`?(0,Q.jsx)(dn,{a:n,selected:r}):null,t[32]=n,t[33]=r,t[34]=p,t[35]=D):D=t[35];let O;return t[36]!==w||t[37]!==T||t[38]!==E||t[39]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[w,T,E,D]}),t[36]=w,t[37]=T,t[38]=E,t[39]=D,t[40]=O):O=t[40],O}function sn(e){let t=(0,Z.c)(7),{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s}=e,c;return t[0]!==n||t[1]!==a||t[2]!==o||t[3]!==r||t[4]!==i||t[5]!==s?(c=(0,Q.jsx)(rn,{children:(0,Q.jsx)(Yt,{a:n,defaultModel:r,defaultWorkspace:i,agentModel:a,agentWorkspace:o,onEditWorkspace:s})}),t[0]=n,t[1]=a,t[2]=o,t[3]=r,t[4]=i,t[5]=s,t[6]=c):c=t[6],c}function cn(e){let t=(0,Z.c)(72),{a:n,selected:r,busy:i,capabilityPresets:a,defaultPresetId:o,onUpdateAgentExtends:s,onOpenCapabilityPreset:c}=e,l=o===void 0?`default`:o,u;t[0]===a?u=t[1]:(u=new Map(a.map(un)),t[0]=a,t[1]=u);let d=u,f;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(f=d.get(l)??{id:l,name:n.capabilityPresetsGlobalDefault,description:n.capabilityPresetsGlobalDefaultHint},t[2]=n.capabilityPresetsGlobalDefault,t[3]=n.capabilityPresetsGlobalDefaultHint,t[4]=l,t[5]=d,t[6]=f):f=t[6];let p=f,m,g,_,v,y;if(t[7]!==n.capabilityPresetAdd||t[8]!==n.capabilityPresetMoveDown||t[9]!==n.capabilityPresetMoveUp||t[10]!==n.capabilityPresetRemove||t[11]!==n.capabilityPresetsEmptyAdditional||t[12]!==n.capabilityPresetsGlobalDefault||t[13]!==n.capabilityPresetsGlobalDefaultHint||t[14]!==n.capabilityPresetsHint||t[15]!==n.capabilityPresetsManage||t[16]!==n.capabilityPresetsTitle||t[17]!==i||t[18]!==a||t[19]!==l||t[20]!==p.description||t[21]!==p.id||t[22]!==p.name||t[23]!==c||t[24]!==s||t[25]!==d||t[26]!==r.extends){let e;t[32]===l?e=t[33]:(e=e=>e!==l,t[32]=l,t[33]=e);let o=r.extends.filter(e),u=a.map(ln).filter(e=>e!==l&&!o.includes(e)),f=u[0]??``;g=rn,m=vt;let b;t[34]===c?b=t[35]:(b=()=>c(``),t[34]=c,t[35]=b);let x;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t[36]=x):x=t[36];let C;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==b?(C=(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:b,children:[x,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=b,t[40]=C):C=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==C?(_=(0,Q.jsx)(_t,{icon:Ce,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:C}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=C,t[44]=_):_=t[44];let T;t[45]!==p.id||t[46]!==c?(T=()=>c(p.id),t[45]=p.id,t[46]=c,t[47]=T):T=t[47];let E=p.name||n.capabilityPresetsGlobalDefault,D;t[48]===E?D=t[49]:(D=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:E}),t[48]=E,t[49]=D);let O;t[50]===n.capabilityPresetsGlobalDefault?O=t[51]:(O=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:n.capabilityPresetsGlobalDefault}),t[50]=n.capabilityPresetsGlobalDefault,t[51]=O);let k;t[52]!==D||t[53]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[D,O]}),t[52]=D,t[53]=O,t[54]=k):k=t[54];let A;t[55]===p.id?A=t[56]:(A=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:p.id}),t[55]=p.id,t[56]=A);let j=p.description||n.capabilityPresetsGlobalDefaultHint,M;t[57]===j?M=t[58]:(M=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:j}),t[57]=j,t[58]=M);let N;t[59]!==T||t[60]!==k||t[61]!==A||t[62]!==M?(N=(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-accent-soft/20 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:T,children:[k,A,M]})}),t[59]=T,t[60]=k,t[61]=A,t[62]=M,t[63]=N):N=t[63],v=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[N,o.length>0?o.map((e,t)=>{let r=d.get(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r?.name??e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:e}),r?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:r.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===0,"aria-label":n.capabilityPresetMoveUp,onClick:()=>{let e=[...o],[n,r]=[e[t],e[t-1]];e[t-1]=n,e[t]=r,s(e)},children:(0,Q.jsx)(Ee,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===o.length-1,"aria-label":n.capabilityPresetMoveDown,onClick:()=>{let e=[...o],[n,r]=[e[t+1],e[t]];e[t]=n,e[t+1]=r,s(e)},children:(0,Q.jsx)(st,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i,"aria-label":n.capabilityPresetRemove,onClick:()=>s(o.filter(t=>t!==e)),children:(0,Q.jsx)(K,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 px-3 py-3 text-sm text-fg-muted shadow-surface`,children:n.capabilityPresetsEmptyAdditional})]}),y=u.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,Q.jsx)(Xe,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,disabled:i,defaultValue:f,children:u.map(e=>(0,Q.jsx)(We,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:i||!f,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||f;t&&s([...o,t])},children:[(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0}),n.capabilityPresetAdd]})]}):null,t[7]=n.capabilityPresetAdd,t[8]=n.capabilityPresetMoveDown,t[9]=n.capabilityPresetMoveUp,t[10]=n.capabilityPresetRemove,t[11]=n.capabilityPresetsEmptyAdditional,t[12]=n.capabilityPresetsGlobalDefault,t[13]=n.capabilityPresetsGlobalDefaultHint,t[14]=n.capabilityPresetsHint,t[15]=n.capabilityPresetsManage,t[16]=n.capabilityPresetsTitle,t[17]=i,t[18]=a,t[19]=l,t[20]=p.description,t[21]=p.id,t[22]=p.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=m,t[28]=g,t[29]=_,t[30]=v,t[31]=y}else m=t[27],g=t[28],_=t[29],v=t[30],y=t[31];let b;t[64]!==m||t[65]!==_||t[66]!==v||t[67]!==y?(b=(0,Q.jsxs)(m,{children:[_,v,y]}),t[64]=m,t[65]=_,t[66]=v,t[67]=y,t[68]=b):b=t[68];let x;return t[69]!==g||t[70]!==b?(x=(0,Q.jsx)(g,{children:b}),t[69]=g,t[70]=b,t[71]=x):x=t[71],x}function ln(e){return e.id}function un(e){return[e.id,e]}function dn(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(rn,{children:(0,Q.jsx)(en,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function fn(e){let t=(0,Z.c)(10),{a:n,selected:r,busy:i,onDelete:a}=e,o;return t[0]!==n.dangerZoneBody||t[1]!==n.dangerZoneHint||t[2]!==n.dangerZoneMainUnavailable||t[3]!==n.dangerZoneTitle||t[4]!==n.purgeDisk||t[5]!==n.removeFromConfig||t[6]!==i||t[7]!==a||t[8]!==r.id?(o=(0,Q.jsx)(rn,{children:r.id===`main`?(0,Q.jsx)(vt,{children:(0,Q.jsx)(_t,{icon:b,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(vt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(_t,{icon:b,title:n.dangerZoneTitle,subtitle:n.dangerZoneHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`max-w-xl text-sm text-red-800 dark:text-red-200`,children:n.dangerZoneBody}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(K,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-100 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/50`,disabled:i,onClick:()=>void a(!0),children:n.purgeDisk})]})]})]})}),t[0]=n.dangerZoneBody,t[1]=n.dangerZoneHint,t[2]=n.dangerZoneMainUnavailable,t[3]=n.dangerZoneTitle,t[4]=n.purgeDisk,t[5]=n.removeFromConfig,t[6]=i,t[7]=a,t[8]=r.id,t[9]=o):o=t[9],o}var pn=i(it,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function mn(e){let t=(0,Z.c)(59),{a:n,busy:r,bindingsLoading:a,agentBindings:o,onRemoveBinding:s,onAddBinding:c,channelStatuses:l,channelsStatusLoading:u,useManualChannel:d,newBindChannel:f,setNewBindChannel:p,bindSessionChats:h,sessionsLoading:g,newBindSessionIdx:_,setNewBindSessionIdx:v,newBindCustomPeer:y,setNewBindCustomPeer:b,onRefreshSessions:x,lastActiveLabels:S,selectRecipient:C}=e,T=!u&&(d||l.length>0),E;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(E=(0,Q.jsx)(_t,{className:`shrink-0`,icon:m,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=E):E=t[2];let D;t[3]!==n.channelsNone||t[4]!==n.removeBinding||t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s?(D=a?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map(hn)}):o.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:o.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:Tt(e.match)}),(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void s(e),children:n.removeBinding})]},`${e.match.channel}-${Tt(e.match)}`))}),t[3]=n.channelsNone,t[4]=n.removeBinding,t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=D):D=t[9];let O;t[10]!==n.channelLabel||t[11]!==n.channelsDisabledSuffix||t[12]!==n.channelsManualChannelHint||t[13]!==l||t[14]!==u||t[15]!==f||t[16]!==p||t[17]!==b||t[18]!==v||t[19]!==d?(O=u?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(J,{className:`h-4 w-24`}),(0,Q.jsx)(J,{className:`h-10 w-full rounded-lg`})]}):d?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`input`,{className:Et(),value:f,onChange:e=>p(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(Xe,{className:i(Et(),`py-2`),value:f,onChange:e=>{p(e.target.value),v(null),b(``)},children:l.map(e=>(0,Q.jsxs)(We,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[10]=n.channelLabel,t[11]=n.channelsDisabledSuffix,t[12]=n.channelsManualChannelHint,t[13]=l,t[14]=u,t[15]=f,t[16]=p,t[17]=b,t[18]=v,t[19]=d,t[20]=O):O=t[20];let k;t[21]!==n.channelsCustomPeerHint||t[22]!==n.channelsCustomPeerPlaceholder||t[23]!==n.channelsNoSessionsHint||t[24]!==n.channelsPeerAny||t[25]!==n.channelsPeerFromSessions||t[26]!==n.channelsRefreshSessions||t[27]!==n.channelsRefreshSessionsHint||t[28]!==n.channelsSessionLabel||t[29]!==n.peerIdLabel||t[30]!==h||t[31]!==r||t[32]!==S||t[33]!==f||t[34]!==y||t[35]!==_||t[36]!==x||t[37]!==C||t[38]!==g||t[39]!==b||t[40]!==v||t[41]!==T?(k=T&&f.trim()?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,Q.jsxs)(w,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||g||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>x(),children:[(0,Q.jsx)(fe,{className:i(`size-3.5`,g&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),g&&h.length===0?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(J,{className:`h-4 w-32`}),(0,Q.jsx)(J,{className:`h-10 w-full rounded-lg`})]}):null,(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsPeerFromSessions}),(0,Q.jsxs)(Xe,{className:i(Et(),`py-2`),value:_==null?``:String(_),disabled:r||!f.trim()||!!y.trim(),onChange:e=>{let t=e.target.value;v(t===``?null:Number(t))},children:[(0,Q.jsx)(We,{value:``,children:n.channelsPeerAny}),h.map((e,t)=>(0,Q.jsx)(We,{value:String(t),children:Ct(e,S)},`${e.channel}-${e.chatId}`))]})]}),h.length===0&&f.trim()&&!g?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,className:i(Et(),`min-w-0 w-full sm:flex-1`),value:y,onChange:e=>{b(e.target.value),e.target.value.trim()&&v(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(Xe,{className:pn,value:y,onChange:e=>{let t=e.target.value;b(t||``),v(null)},children:[(0,Q.jsx)(We,{value:``,children:C}),h.map(e=>(0,Q.jsx)(We,{value:e.chatId,children:Ct(e,S)},`${e.channel}-${e.chatId}`))]})]}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsCustomPeerHint})]})]}):null,t[21]=n.channelsCustomPeerHint,t[22]=n.channelsCustomPeerPlaceholder,t[23]=n.channelsNoSessionsHint,t[24]=n.channelsPeerAny,t[25]=n.channelsPeerFromSessions,t[26]=n.channelsRefreshSessions,t[27]=n.channelsRefreshSessionsHint,t[28]=n.channelsSessionLabel,t[29]=n.peerIdLabel,t[30]=h,t[31]=r,t[32]=S,t[33]=f,t[34]=y,t[35]=_,t[36]=x,t[37]=C,t[38]=g,t[39]=b,t[40]=v,t[41]=T,t[42]=k):k=t[42];let A;t[43]!==r||t[44]!==u||t[45]!==f?(A=r||!f.trim()||u,t[43]=r,t[44]=u,t[45]=f,t[46]=A):A=t[46];let j;t[47]!==n.addBinding||t[48]!==A?(j=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(w,{type:`submit`,disabled:A,children:n.addBinding})}),t[47]=n.addBinding,t[48]=A,t[49]=j):j=t[49];let M;t[50]!==c||t[51]!==O||t[52]!==k||t[53]!==j?(M=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:c,children:[O,k,j]}),t[50]=c,t[51]=O,t[52]=k,t[53]=j,t[54]=M):M=t[54];let N;return t[55]!==E||t[56]!==D||t[57]!==M?(N=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[E,D,M]}),t[55]=E,t[56]=D,t[57]=M,t[58]=N):N=t[58],N}function hn(e,t){return(0,Q.jsx)(J,{className:`h-10 rounded-lg`},t)}function gn(e){let t=(0,Z.c)(32),{a:n,filesLoading:r,files:a,activeFile:o,setActiveFile:s,filesViewMode:c,setFilesViewMode:l,fileDraft:d,setFileDraft:f,fileSaving:p,profileFileLoading:m,profileEditorNonce:h,onTryInChat:g}=e,_=u(_n),v;t[0]!==n.missing||t[1]!==a?.files?(v=a?.files.map(e=>({id:e.name,label:e.missing?`${e.name} (${n.missing})`:e.name,title:e.name}))??[],t[0]=n.missing,t[1]=a?.files,t[2]=v):v=t[2];let y=v,b;t[3]===n.filesHint?b=t[4]:(b=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[3]=n.filesHint,t[4]=b);let x;t[5]!==n.filesAutoSaveHint||t[6]!==n.filesEmpty||t[7]!==n.filesLoading||t[8]!==n.filesMarkdownEdit||t[9]!==n.filesMarkdownPreview||t[10]!==n.filesNavAria||t[11]!==n.filesSavingStatus||t[12]!==n.pickFile||t[13]!==n.tryInChat||t[14]!==o||t[15]!==d||t[16]!==p||t[17]!==y||t[18]!==a||t[19]!==r||t[20]!==c||t[21]!==_||t[22]!==g||t[23]!==h||t[24]!==m||t[25]!==s||t[26]!==f||t[27]!==l?(x=r?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):a?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(yt,{items:y,activeTab:o??``,onChange:s,ariaLabel:n.filesNavAria,tabIdPrefix:`agent-files-tab`,panelIdPrefix:`agent-files-panel`,className:`shrink-0 flex-wrap`,buttonClassName:`font-mono text-xs whitespace-nowrap`}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,he.press,c===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`edit`),children:[(0,Q.jsx)(ie,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,he.press,c===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`preview`),children:[(0,Q.jsx)(Ae,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[p?(0,Q.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Q.jsx)(`span`,{children:n.filesAutoSaveHint}),g?(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(k,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),c===`edit`?(0,Q.jsx)(`div`,{className:i(Et(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ft,{initialContent:d,onChange:f,isDark:_,className:`min-h-0 flex-1`},`${o??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:i(Et(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(Ke,{content:d,className:`text-sm`})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[5]=n.filesAutoSaveHint,t[6]=n.filesEmpty,t[7]=n.filesLoading,t[8]=n.filesMarkdownEdit,t[9]=n.filesMarkdownPreview,t[10]=n.filesNavAria,t[11]=n.filesSavingStatus,t[12]=n.pickFile,t[13]=n.tryInChat,t[14]=o,t[15]=d,t[16]=p,t[17]=y,t[18]=a,t[19]=r,t[20]=c,t[21]=_,t[22]=g,t[23]=h,t[24]=m,t[25]=s,t[26]=f,t[27]=l,t[28]=x):x=t[28];let S;return t[29]!==b||t[30]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[b,x]}),t[29]=b,t[30]=x,t[31]=S):S=t[31],S}function _n(e){return e.resolved===`dark`}function vn(e){let t=(0,Z.c)(68),{a:n,chat:r,selected:i,busy:a,modelRows:o,setModelRows:s,onSaveModels:c,onClearModelsEntry:l,hideInlineSave:u}=e,d;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(d=(0,Q.jsx)(_t,{className:`shrink-0`,icon:De,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=d):d=t[2];let f;t[3]===n.modelsPresetLabel?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[3]=n.modelsPresetLabel,t[4]=f);let p;t[5]===i.typedModels.preset?p=t[6]:(p=kt(i.typedModels.preset),t[5]=i.typedModels.preset,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,Q.jsxs)(`div`,{children:[f,` `,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===n.modelsEffectiveLabel?h=t[11]:(h=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=h);let g;t[12]===i.typedModels.effective?g=t[13]:(g=kt(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=g);let _;t[14]!==h||t[15]!==g?(_=(0,Q.jsxs)(`div`,{children:[h,` `,g]}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==m||t[18]!==_?(v=(0,Q.jsxs)(`div`,{className:`mb-4 grid gap-2 rounded-lg bg-surface-panel/60 p-3 text-xs text-fg-muted shadow-surface`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==n.addTypedModel||t[21]!==n.addTypedModelPurpose||t[22]!==n.removeTypedModel||t[23]!==n.typedModelAddFallback||t[24]!==n.typedModelCustomTitle||t[25]!==n.typedModelDefaultBadge||t[26]!==n.typedModelDescriptionLabel||t[27]!==n.typedModelDescriptionPlaceholder||t[28]!==n.typedModelFallbackEmptyHint||t[29]!==n.typedModelFallbackModelsLabel||t[30]!==n.typedModelFallbackPlaceholder||t[31]!==n.typedModelIdLabel||t[32]!==n.typedModelIdPlaceholder||t[33]!==n.typedModelNoCustomRoles||t[34]!==n.typedModelPrimaryModelLabel||t[35]!==n.typedModelRecommendedTitle||t[36]!==n.typedModelRemoveFallback||t[37]!==n.typedModelRoleDescriptions||t[38]!==n.typedModelRoleNames||t[39]!==n.typedModelVisionAutoHint||t[40]!==n.typedModelVisionBadge?(y={id:n.typedModelIdLabel,description:n.typedModelDescriptionLabel,primaryModel:n.typedModelPrimaryModelLabel,fallbackModels:n.typedModelFallbackModelsLabel,addFallback:n.typedModelAddFallback,removeFallback:n.typedModelRemoveFallback,fallbackPlaceholder:n.typedModelFallbackPlaceholder,fallbackEmptyHint:n.typedModelFallbackEmptyHint,add:n.addTypedModel,remove:n.removeTypedModel,recommendedTitle:n.typedModelRecommendedTitle,customTitle:n.typedModelCustomTitle,defaultBadge:n.typedModelDefaultBadge,visionBadge:n.typedModelVisionBadge,visionAutoHint:n.typedModelVisionAutoHint,addPurpose:n.addTypedModelPurpose,noCustomRoles:n.typedModelNoCustomRoles,idPlaceholder:n.typedModelIdPlaceholder,descriptionPlaceholder:n.typedModelDescriptionPlaceholder,roleNames:n.typedModelRoleNames,roleDescriptions:n.typedModelRoleDescriptions},t[20]=n.addTypedModel,t[21]=n.addTypedModelPurpose,t[22]=n.removeTypedModel,t[23]=n.typedModelAddFallback,t[24]=n.typedModelCustomTitle,t[25]=n.typedModelDefaultBadge,t[26]=n.typedModelDescriptionLabel,t[27]=n.typedModelDescriptionPlaceholder,t[28]=n.typedModelFallbackEmptyHint,t[29]=n.typedModelFallbackModelsLabel,t[30]=n.typedModelFallbackPlaceholder,t[31]=n.typedModelIdLabel,t[32]=n.typedModelIdPlaceholder,t[33]=n.typedModelNoCustomRoles,t[34]=n.typedModelPrimaryModelLabel,t[35]=n.typedModelRecommendedTitle,t[36]=n.typedModelRemoveFallback,t[37]=n.typedModelRoleDescriptions,t[38]=n.typedModelRoleNames,t[39]=n.typedModelVisionAutoHint,t[40]=n.typedModelVisionBadge,t[41]=y):y=t[41];let b;t[42]!==a||t[43]!==r||t[44]!==o||t[45]!==i.typedModels.defaultRole||t[46]!==s||t[47]!==y?(b=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Ft,{rows:o,onChange:s,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:y})}),t[42]=a,t[43]=r,t[44]=o,t[45]=i.typedModels.defaultRole,t[46]=s,t[47]=y,t[48]=b):b=t[48];let x;t[49]!==n.modelsSave||t[50]!==a||t[51]!==u||t[52]!==c?(x=u?null:(0,Q.jsx)(w,{type:`button`,disabled:a,onClick:()=>void c(),children:n.modelsSave}),t[49]=n.modelsSave,t[50]=a,t[51]=u,t[52]=c,t[53]=x):x=t[53];let S;t[54]===l?S=t[55]:(S=()=>void l(),t[54]=l,t[55]=S);let C;t[56]!==n.modelsResetInherit||t[57]!==a||t[58]!==S?(C=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:a,onClick:S,children:n.modelsResetInherit}),t[56]=n.modelsResetInherit,t[57]=a,t[58]=S,t[59]=C):C=t[59];let T;t[60]!==x||t[61]!==C?(T=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[x,C]}),t[60]=x,t[61]=C,t[62]=T):T=t[62];let E;return t[63]!==d||t[64]!==T||t[65]!==v||t[66]!==b?(E=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[d,v,b,T]}),t[63]=d,t[64]=T,t[65]=v,t[66]=b,t[67]=E):E=t[67],E}function yn(e,t){switch(e){case`adventurer`:return t.avatarStyleAdventurer;case`bottts`:return t.avatarStyleRobot;case`lorelei`:return t.avatarStyleLorelei;case`thumbs`:return t.avatarStyleThumbs;case`fun-emoji`:return t.avatarStyleFunEmoji;default:return e}}function bn(e){let{agentId:t,value:n,onChange:r,a,id:o}=e,s=(0,$.useRef)(null),[c,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=(0,$.useMemo)(()=>{let e=y(n.trim());return e&&ut(e.styleId)?e.styleId:A[0]??`adventurer`},[n]),h=(0,$.useCallback)(async(e,n)=>{try{await de(t)}catch{}r(U(e,n)),p(!1)},[t,r]),g=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){d(null),l(!0);try{await xe(t,n),G(t),r(P)}catch(e){let t=e instanceof Error?e.message:``;d(t===`avatar_too_large`?a.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?a.avatarInvalidImage:a.avatarUploadFailed)}finally{l(!1)}}},[a,t,r]),_=(e,t)=>{let r=y(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...o?{id:o}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:s,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void g(e)}),(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:c,onClick:()=>s.current?.click(),children:[(0,Q.jsx)(F,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),c?a.avatarUploading:a.avatarUploadCustom]})]})]}),u?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:u}):null,(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:A.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void h(e,T[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,he.press,m===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:yn(e,a)},e))}),(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[T.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,he.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)($e,{open:f,onOpenChange:p,children:[(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:i(`flex size-12 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`,he.press),children:a.avatarMore})}),(0,Q.jsx)(Pe,{children:(0,Q.jsxs)(ve,{className:`z-[80] max-h-72 w-[min(22rem,calc(100vw-2rem))] overflow-y-auto rounded-xl border border-edge-subtle bg-surface-panel p-3 shadow-lg`,sideOffset:6,align:`end`,children:[(0,Q.jsx)(`p`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:yn(m,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:z.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,he.press,_(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.personaAvatar}),(0,Q.jsx)(ee,{agentId:t,avatar:n,size:40}),n.trim()&&!y(n.trim())&&n.trim()!==`xopc:custom`?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}function xn(e){let t=(0,Z.c)(206),{a:n,chat:r,selected:a,busy:o,editName:s,setEditName:c,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:T,profileMarkdownLoading:A,profileDraft:j,updateIdentity:M,handleSoulTemplateChange:P,handleSoulContentChange:F,setAvatarDialogOpen:I,toggleSoulPreviewMode:te,onTryInChat:R}=e,z=l(wn),re=u(Cn),ie;t[0]===j?.identity?ie=t[1]:(ie=j?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=j?.identity,t[1]=ie);let B=ie,V=j?.soulTemplate??`professional`,U=j?.soulCustomContent??``,W=j?.soulEditorNonce??0,G=j?.soulPreviewMode??!1,K=j?.avatarDialogOpen??!1,se;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(se=Et(),t[2]=se):se=t[2];let le=se,ue;t[3]===z?ue=t[4]:(ue=(e,t)=>z===`zh`?t:e,t[3]=z,t[4]=ue);let q=ue;if(!a){let e;return t[5]===n.selectAgentHint?e=t[6]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[5]=n.selectAgentHint,t[6]=e),e}let de;t[7]!==B.avatar||t[8]!==a.id?(de=(0,Q.jsx)(ee,{agentId:a.id,avatar:B.avatar,size:36,className:`size-9 rounded-lg`}),t[7]=B.avatar,t[8]=a.id,t[9]=de):de=t[9];let J;t[10]===I?J=t[11]:(J=()=>I(!0),t[10]=I,t[11]=J);let fe;t[12]!==n.avatarOpenSettingsAria||t[13]!==J?(fe={onClick:J,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[12]=n.avatarOpenSettingsAria,t[13]=J,t[14]=fe):fe=t[14];let me;t[15]!==n.globalDefaultBadge||t[16]!==n.tuiDefaultBadge||t[17]!==n.tuiDefaultInheritedBadge||t[18]!==x||t[19]!==S||t[20]!==a.isDefault?(me=a.isDefault||x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[a.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,x?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:S?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null]}):null,t[15]=n.globalDefaultBadge,t[16]=n.tuiDefaultBadge,t[17]=n.tuiDefaultInheritedBadge,t[18]=x,t[19]=S,t[20]=a.isDefault,t[21]=me):me=t[21];let ge;t[22]!==n.setDefault||t[23]!==n.setTuiDefault||t[24]!==o||t[25]!==x||t[26]!==y||t[27]!==b||t[28]!==a.isDefault?(ge=!a.isDefault||!x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[a.isDefault?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:()=>void y(),children:n.setDefault}),x?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:()=>void b(),children:n.setTuiDefault})]}):null,t[22]=n.setDefault,t[23]=n.setTuiDefault,t[24]=o,t[25]=x,t[26]=y,t[27]=b,t[28]=a.isDefault,t[29]=ge):ge=t[29];let _e;t[30]!==n.personaSectionIdentity||t[31]!==n.personaSectionIdentityHint||t[32]!==de||t[33]!==fe||t[34]!==me||t[35]!==ge?(_e=(0,Q.jsx)(_t,{icon:Ce,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:de,iconInteractive:fe,titleAccessory:me,trailing:ge}),t[30]=n.personaSectionIdentity,t[31]=n.personaSectionIdentityHint,t[32]=de,t[33]=fe,t[34]=me,t[35]=ge,t[36]=_e):_e=t[36];let ve;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(ve=(0,Q.jsx)(ae,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,Be)}),t[37]=ve):ve=t[37];let ye;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(ye=i(`fixed left-1/2 top-1/2 w-[min(calc(100vw-2rem),26rem)] max-h-[min(90dvh,36rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,pe),t[38]=ye):ye=t[38];let be;t[39]===n.avatarPickerTitle?be=t[40]:(be=(0,Q.jsx)(N,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[39]=n.avatarPickerTitle,t[40]=be);let xe;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(xe=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[41]=xe):xe=t[41];let Y;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),t[42]=Y):Y=t[42];let Se;t[43]===n.closeDialogAria?Se=t[44]:(Se=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:xe,"aria-label":n.closeDialogAria,children:Y})}),t[43]=n.closeDialogAria,t[44]=Se);let we;t[45]!==be||t[46]!==Se?(we=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[be,Se]}),t[45]=be,t[46]=Se,t[47]=we):we=t[47];let Te;t[48]===n.avatarRowHint?Te=t[49]:(Te=(0,Q.jsx)(O,{className:`sr-only`,children:n.avatarRowHint}),t[48]=n.avatarRowHint,t[49]=Te);let Ee;t[50]===M?Ee=t[51]:(Ee=e=>M({avatar:e}),t[50]=M,t[51]=Ee);let De;t[52]!==n||t[53]!==B.avatar||t[54]!==a.id||t[55]!==Ee?(De=(0,Q.jsx)(bn,{agentId:a.id,value:B.avatar,onChange:Ee,a:n}),t[52]=n,t[53]=B.avatar,t[54]=a.id,t[55]=Ee,t[56]=De):De=t[56];let Oe;t[57]!==we||t[58]!==Te||t[59]!==De?(Oe=(0,Q.jsxs)(ce,{children:[ve,(0,Q.jsxs)(oe,{className:ye,onOpenAutoFocus:Sn,children:[we,Te,De]})]}),t[57]=we,t[58]=Te,t[59]=De,t[60]=Oe):Oe=t[60];let ke;t[61]!==K||t[62]!==I||t[63]!==Oe?(ke=(0,Q.jsx)(D,{open:K,onOpenChange:I,children:Oe}),t[61]=K,t[62]=I,t[63]=Oe,t[64]=ke):ke=t[64];let je;t[65]===n.displayName?je=t[66]:(je=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[65]=n.displayName,t[66]=je);let Pe;t[67]!==c||t[68]!==M?(Pe=e=>{c(e.target.value),M({name:e.target.value})},t[67]=c,t[68]=M,t[69]=Pe):Pe=t[69];let Fe;t[70]!==n.personaNamePlaceholder||t[71]!==s||t[72]!==Pe?(Fe=(0,Q.jsx)(`input`,{className:le,value:s,onChange:Pe,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[70]=n.personaNamePlaceholder,t[71]=s,t[72]=Pe,t[73]=Fe):Fe=t[73];let Ie;t[74]!==je||t[75]!==Fe?(Ie=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[je,Fe]}),t[74]=je,t[75]=Fe,t[76]=Ie):Ie=t[76];let Le;t[77]===n.personaEmoji?Le=t[78]:(Le=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[77]=n.personaEmoji,t[78]=Le);let Re;t[79]===M?Re=t[80]:(Re=e=>M({emoji:e.target.value}),t[79]=M,t[80]=Re);let ze;t[81]!==n.personaEmojiPlaceholder||t[82]!==B.emoji||t[83]!==Re?(ze=(0,Q.jsx)(`input`,{className:le,value:B.emoji,onChange:Re,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[81]=n.personaEmojiPlaceholder,t[82]=B.emoji,t[83]=Re,t[84]=ze):ze=t[84];let Ve;t[85]!==Le||t[86]!==ze?(Ve=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Le,ze]}),t[85]=Le,t[86]=ze,t[87]=Ve):Ve=t[87];let He;t[88]===n.agentDescription?He=t[89]:(He=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[88]=n.agentDescription,t[89]=He);let Ue;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=i(le,`min-h-16 resize-y text-sm leading-relaxed`),t[90]=Ue):Ue=t[90];let X;t[91]!==f||t[92]!==M?(X=e=>{f(e.target.value),M({description:e.target.value})},t[91]=f,t[92]=M,t[93]=X):X=t[93];let Ge;t[94]!==n.agentDescriptionPlaceholder||t[95]!==d||t[96]!==X?(Ge=(0,Q.jsx)(`textarea`,{className:Ue,value:d,onChange:X,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[94]=n.agentDescriptionPlaceholder,t[95]=d,t[96]=X,t[97]=Ge):Ge=t[97];let qe;t[98]!==He||t[99]!==Ge?(qe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[He,Ge]}),t[98]=He,t[99]=Ge,t[100]=qe):qe=t[100];let Je;t[101]===n.personaCreature?Je=t[102]:(Je=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[101]=n.personaCreature,t[102]=Je);let Ye;t[103]===B.creature?Ye=t[104]:(Ye=L.some(e=>e.value===B.creature)?B.creature:`__custom__`,t[103]=B.creature,t[104]=Ye);let Ze;t[105]===M?Ze=t[106]:(Ze=e=>{if(e.target.value===`__custom__`){M({creature:``});return}M({creature:e.target.value})},t[105]=M,t[106]=Ze);let Qe;t[107]===q?Qe=t[108]:(Qe=L.map(e=>(0,Q.jsx)(We,{value:e.value,children:q(e.labelEn,e.labelZh)},e.value)),t[107]=q,t[108]=Qe);let $e;t[109]===q?$e=t[110]:($e=q(`Custom…`,`自定义…`),t[109]=q,t[110]=$e);let et;t[111]===$e?et=t[112]:(et=(0,Q.jsx)(We,{value:`__custom__`,children:$e}),t[111]=$e,t[112]=et);let tt;t[113]!==Ye||t[114]!==Ze||t[115]!==Qe||t[116]!==et?(tt=(0,Q.jsxs)(Xe,{className:le,value:Ye,onChange:Ze,children:[Qe,et]}),t[113]=Ye,t[114]=Ze,t[115]=Qe,t[116]=et,t[117]=tt):tt=t[117];let nt;t[118]!==n.personaCreaturePlaceholder||t[119]!==B.creature||t[120]!==M?(nt=L.some(e=>e.value===B.creature)?null:(0,Q.jsx)(`input`,{className:i(le,`mt-1 text-xs`),value:B.creature,onChange:e=>M({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[118]=n.personaCreaturePlaceholder,t[119]=B.creature,t[120]=M,t[121]=nt):nt=t[121];let rt;t[122]!==Je||t[123]!==tt||t[124]!==nt?(rt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[Je,tt,nt]}),t[122]=Je,t[123]=tt,t[124]=nt,t[125]=rt):rt=t[125];let it;t[126]!==Ie||t[127]!==Ve||t[128]!==qe||t[129]!==rt?(it=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[Ie,Ve,qe,rt]}),t[126]=Ie,t[127]=Ve,t[128]=qe,t[129]=rt,t[130]=it):it=t[130];let at;t[131]!==ke||t[132]!==it||t[133]!==_e?(at=(0,Q.jsxs)(vt,{children:[_e,ke,it]}),t[131]=ke,t[132]=it,t[133]=_e,t[134]=at):at=t[134];let ot;t[135]!==n.editAgent||t[136]!==n.editAgentHint?(ot=(0,Q.jsx)(_t,{icon:H,title:n.editAgent,subtitle:n.editAgentHint}),t[135]=n.editAgent,t[136]=n.editAgentHint,t[137]=ot):ot=t[137];let st;t[138]===n.modelPrimary?st=t[139]:(st=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[138]=n.modelPrimary,t[139]=st);let lt;t[140]===g?lt=t[141]:(lt=e=>g(e),t[140]=g,t[141]=lt);let ut;t[142]!==o||t[143]!==r.modelNoMatches||t[144]!==r.modelPlaceholder||t[145]!==r.modelSearchPlaceholder||t[146]!==h||t[147]!==lt?(ut=(0,Q.jsx)(_,{className:`min-w-0 flex-1`,value:h,disabled:o,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:lt}),t[142]=o,t[143]=r.modelNoMatches,t[144]=r.modelPlaceholder,t[145]=r.modelSearchPlaceholder,t[146]=h,t[147]=lt,t[148]=ut):ut=t[148];let dt;t[149]!==n.modelClear||t[150]!==o||t[151]!==h||t[152]!==g?(dt=h.trim()?(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>g(``),children:n.modelClear}):null,t[149]=n.modelClear,t[150]=o,t[151]=h,t[152]=g,t[153]=dt):dt=t[153];let pt;t[154]!==ut||t[155]!==dt?(pt=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[ut,dt]}),t[154]=ut,t[155]=dt,t[156]=pt):pt=t[156];let mt;t[157]!==st||t[158]!==pt?(mt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[st,pt]}),t[157]=st,t[158]=pt,t[159]=mt):mt=t[159];let gt;t[160]===n.workspacePath?gt=t[161]:(gt=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[160]=n.workspacePath,t[161]=gt);let yt=r.workingDirectory,bt=r.workingDirectory.notSet,xt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(xt=i(le,`font-mono text-xs`),t[162]=xt):xt=t[162];let St;t[163]!==o||t[164]!==r.workingDirectory||t[165]!==p||t[166]!==m?(St=(0,Q.jsx)(It,{value:p,onChange:m,disabled:o,wd:yt,placeholder:bt,inputClassName:xt}),t[163]=o,t[164]=r.workingDirectory,t[165]=p,t[166]=m,t[167]=St):St=t[167];let Ct;t[168]!==gt||t[169]!==St?(Ct=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[gt,St]}),t[168]=gt,t[169]=St,t[170]=Ct):Ct=t[170];let wt;t[171]!==mt||t[172]!==Ct?(wt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[mt,Ct]}),t[171]=mt,t[172]=Ct,t[173]=wt):wt=t[173];let Tt;t[174]!==n.save||t[175]!==n.tryInChat||t[176]!==o||t[177]!==T||t[178]!==C||t[179]!==R?(Tt=T?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(w,{type:`button`,disabled:o,onClick:()=>void C(),children:n.save}),R?(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:o,onClick:R,children:[(0,Q.jsx)(k,{className:`mr-1.5 size-4`,"aria-hidden":!0}),n.tryInChat]}):null]}),t[174]=n.save,t[175]=n.tryInChat,t[176]=o,t[177]=T,t[178]=C,t[179]=R,t[180]=Tt):Tt=t[180];let Dt;t[181]!==ot||t[182]!==wt||t[183]!==Tt?(Dt=(0,Q.jsxs)(vt,{children:[ot,wt,Tt]}),t[181]=ot,t[182]=wt,t[183]=Tt,t[184]=Dt):Dt=t[184];let Ot;t[185]!==n.personaSectionSoul||t[186]!==n.personaSectionSoulHint||t[187]!==n.personaSoulCustomEdit||t[188]!==n.personaSoulEdit||t[189]!==n.personaSoulPreview||t[190]!==n.personaSoulTemplate||t[191]!==F||t[192]!==P||t[193]!==re||t[194]!==q||t[195]!==A||t[196]!==U||t[197]!==W||t[198]!==G||t[199]!==V||t[200]!==te?(Ot=A?(0,Q.jsx)(ht,{rows:2}):(0,Q.jsxs)(vt,{children:[(0,Q.jsx)(_t,{icon:ne,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:E.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:i(`flex flex-col items-center gap-1.5 rounded-xl border-2 p-3 text-center transition-all`,he.pressCard,V===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>P(e.id),children:[(0,Q.jsx)(`span`,{className:`text-xl`,children:e.emoji}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:q(e.labelEn,e.labelZh)})]},e.id))})]}),V===`custom`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulCustomEdit}),(0,Q.jsx)(`button`,{type:`button`,className:i(ct,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:G?n.personaSoulEdit:n.personaSoulPreview,"aria-label":G?n.personaSoulEdit:n.personaSoulPreview,onClick:te,children:G?(0,Q.jsx)(Ne,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(Ae,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(le,`flex min-h-64 flex-col overflow-hidden p-0`),children:G?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(Ke,{content:U})}):(0,Q.jsx)(ft,{initialContent:U,onChange:F,isDark:re,className:`min-h-0 flex-1`},`soul-${W}`)})]}):null]}),t[185]=n.personaSectionSoul,t[186]=n.personaSectionSoulHint,t[187]=n.personaSoulCustomEdit,t[188]=n.personaSoulEdit,t[189]=n.personaSoulPreview,t[190]=n.personaSoulTemplate,t[191]=F,t[192]=P,t[193]=re,t[194]=q,t[195]=A,t[196]=U,t[197]=W,t[198]=G,t[199]=V,t[200]=te,t[201]=Ot):Ot=t[201];let kt;return t[202]!==at||t[203]!==Dt||t[204]!==Ot?(kt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[at,Dt,Ot]}),t[202]=at,t[203]=Dt,t[204]=Ot,t[205]=kt):kt=t[205],kt}function Sn(e){return e.preventDefault()}function Cn(e){return e.resolved===`dark`}function wn(e){return e.language}function Tn(e){let t=(0,Z.c)(13),{label:n,value:r,badge:i,mono:a}=e,o;t[0]===n?o=t[1]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=o);let s;t[2]===i?s=t[3]:(s=(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:i}),t[2]=i,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l=a?`mt-2 truncate font-mono text-xs text-fg`:`mt-2 truncate text-sm font-medium text-fg`,u;t[7]!==l||t[8]!==r?(u=(0,Q.jsx)(`p`,{className:l,children:r}),t[7]=l,t[8]=r,t[9]=u):u=t[9];let d;return t[10]!==c||t[11]!==u?(d=(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface`,children:[c,u]}),t[10]=c,t[11]=u,t[12]=d):d=t[12],d}function En(e){let t=(0,Z.c)(12),{icon:n,label:r,value:i}=e,a;t[0]===n?a=t[1]:(a=(0,Q.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg bg-surface-hover text-fg-muted`,children:(0,Q.jsx)(n,{className:`size-4`,strokeWidth:1.8,"aria-hidden":!0})}),t[0]=n,t[1]=a);let o;t[2]===r?o=t[3]:(o=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:r}),t[2]=r,t[3]=o);let s;t[4]===i?s=t[5]:(s=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:i}),t[4]=i,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;return t[9]!==a||t[10]!==c?(l=(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface`,children:[a,c]}),t[9]=a,t[10]=c,t[11]=l):l=t[11],l}function Dn(e){let t=(0,Z.c)(121),{a:n,selected:r,defaultModel:i,defaultWorkspace:a,isTuiDefault:o,isTuiDefaultInherited:s,busy:c,onSetDefault:l,onSetTuiDefault:u,onTryInChat:d}=e,f;t[0]!==n||t[1]!==r?(f=ue(r,n),t[0]=n,t[1]=r,t[2]=f):f=t[2];let p=f,m;t[3]!==n||t[4]!==r?(m=M(r,n)||n.listNoDescription,t[3]=n,t[4]=r,t[5]=m):m=t[5];let h=m,_;t[6]!==n.listUnsetValue||t[7]!==i||t[8]!==r.model?.primary?(_=r.model?.primary?.trim()||i||n.listUnsetValue,t[6]=n.listUnsetValue,t[7]=i,t[8]=r.model?.primary,t[9]=_):_=t[9];let v=_,y;t[10]!==n.listUnsetValue||t[11]!==a||t[12]!==r.workspace?(y=r.workspace?.trim()||a||n.listUnsetValue,t[10]=n.listUnsetValue,t[11]=a,t[12]=r.workspace,t[13]=y):y=t[13];let b=y,x=r.model?.primary?.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,S=r.workspace?.trim()&&r.workspace.trim()!==a.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,C=r.tools.effectiveDisable.length,T=r.skills.effectiveAllowlist?.length,E;t[14]!==r.avatar||t[15]!==r.id?(E=(0,Q.jsx)(`div`,{className:`flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base ring-1 ring-edge-subtle/50`,children:(0,Q.jsx)(ee,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=E):E=t[16];let D;t[17]===p?D=t[18]:(D=(0,Q.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:p}),t[17]=p,t[18]=D);let O;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(O=r.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,t[19]=n.globalDefaultBadge,t[20]=r.isDefault,t[21]=O):O=t[21];let A;t[22]!==n.tuiDefaultBadge||t[23]!==n.tuiDefaultInheritedBadge||t[24]!==o||t[25]!==s?(A=o?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:s?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null,t[22]=n.tuiDefaultBadge,t[23]=n.tuiDefaultInheritedBadge,t[24]=o,t[25]=s,t[26]=A):A=t[26];let j;t[27]!==D||t[28]!==O||t[29]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[D,O,A]}),t[27]=D,t[28]=O,t[29]=A,t[30]=j):j=t[30];let N;t[31]===r.id?N=t[32]:(N=(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r.id}),t[31]=r.id,t[32]=N);let P;t[33]!==N||t[34]!==j?(P=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[j,N]}),t[33]=N,t[34]=j,t[35]=P):P=t[35];let F;t[36]!==P||t[37]!==E?(F=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[E,P]}),t[36]=P,t[37]=E,t[38]=F):F=t[38];let I;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(I=d?(0,Q.jsxs)(w,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(k,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=I):I=t[42];let L;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(L=r.isDefault?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:c,onClick:l,children:n.setDefault}),t[43]=n.setDefault,t[44]=c,t[45]=l,t[46]=r.isDefault,t[47]=L):L=t[47];let te;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(te=o?null:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:c,onClick:u,children:n.setTuiDefault}),t[48]=n.setTuiDefault,t[49]=c,t[50]=o,t[51]=u,t[52]=te):te=t[52];let R;t[53]!==I||t[54]!==L||t[55]!==te?(R=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[I,L,te]}),t[53]=I,t[54]=L,t[55]=te,t[56]=R):R=t[56];let z;t[57]!==F||t[58]!==R?(z=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[F,R]}),t[57]=F,t[58]=R,t[59]=z):z=t[59];let ne;t[60]===h?ne=t[61]:(ne=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:h}),t[60]=h,t[61]=ne);let re;t[62]!==z||t[63]!==ne?(re=(0,Q.jsx)(vt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[z,ne]})}),t[62]=z,t[63]=ne,t[64]=re):re=t[64];let ie;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(ie=(0,Q.jsx)(_t,{icon:Ce,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=ie):ie=t[67];let B;t[68]!==n.modelPrimary||t[69]!==x||t[70]!==v?(B=(0,Q.jsx)(Tn,{label:n.modelPrimary,value:v,badge:x,mono:!0}),t[68]=n.modelPrimary,t[69]=x,t[70]=v,t[71]=B):B=t[71];let V;t[72]!==n.workspacePath||t[73]!==S||t[74]!==b?(V=(0,Q.jsx)(Tn,{label:n.workspacePath,value:b,badge:S,mono:!0}),t[72]=n.workspacePath,t[73]=S,t[74]=b,t[75]=V):V=t[75];let H;t[76]!==B||t[77]!==V?(H=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[B,V]}),t[76]=B,t[77]=V,t[78]=H):H=t[78];let U;t[79]!==ie||t[80]!==H?(U=(0,Q.jsxs)(vt,{children:[ie,H]}),t[79]=ie,t[80]=H,t[81]=U):U=t[81];let W;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(W=(0,Q.jsx)(_t,{icon:Qe,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=W):W=t[84];let ae;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==C?(ae=C>0?n.listToolsDisabledCount.replace(`{{count}}`,String(C)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=C,t[88]=ae):ae=t[88];let oe;t[89]!==n.listToolsLabel||t[90]!==ae?(oe=(0,Q.jsx)(En,{icon:g,label:n.listToolsLabel,value:ae}),t[89]=n.listToolsLabel,t[90]=ae,t[91]=oe):oe=t[91];let G;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==T?(G=T?n.listSkillsCount.replace(`{{count}}`,String(T)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=T,t[95]=G):G=t[95];let K;t[96]!==n.listSkillsLabel||t[97]!==G?(K=(0,Q.jsx)(En,{icon:Ce,label:n.listSkillsLabel,value:G}),t[96]=n.listSkillsLabel,t[97]=G,t[98]=K):K=t[98];let se;t[99]!==n.memoryTitle||t[100]!==n.overviewMemoryManaged?(se=(0,Q.jsx)(En,{icon:_e,label:n.memoryTitle,value:n.overviewMemoryManaged}),t[99]=n.memoryTitle,t[100]=n.overviewMemoryManaged,t[101]=se):se=t[101];let ce;t[102]!==n.connectionsTitle||t[103]!==n.overviewConnectionsManaged?(ce=(0,Q.jsx)(En,{icon:ze,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[102]=n.connectionsTitle,t[103]=n.overviewConnectionsManaged,t[104]=ce):ce=t[104];let le;t[105]!==n.listWorkspaceLabel||t[106]!==b?(le=(0,Q.jsx)(En,{icon:at,label:n.listWorkspaceLabel,value:b}),t[105]=n.listWorkspaceLabel,t[106]=b,t[107]=le):le=t[107];let q;t[108]!==oe||t[109]!==K||t[110]!==se||t[111]!==ce||t[112]!==le?(q=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[oe,K,se,ce,le]}),t[108]=oe,t[109]=K,t[110]=se,t[111]=ce,t[112]=le,t[113]=q):q=t[113];let de;t[114]!==W||t[115]!==q?(de=(0,Q.jsxs)(vt,{children:[W,q]}),t[114]=W,t[115]=q,t[116]=de):de=t[116];let J;return t[117]!==re||t[118]!==U||t[119]!==de?(J=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[re,U,de]}),t[117]=re,t[118]=U,t[119]=de,t[120]=J):J=t[120],J}function On(e){let t=(0,Z.c)(65),{a:n,selected:r,busy:a,skillsCatalogLoading:o,catalogForPick:s,skillsInherit:c,setSkillsInherit:l,skillsPick:u,setSkillsPick:d,onSaveSkills:f,hideInlineSave:p}=e,m;t[0]===r.skills.effectiveAllowlist?m=t[1]:(m=function(e){let t=r.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)},t[0]=r.skills.effectiveAllowlist,t[1]=m);let h=m,g;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(g=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(kn)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=g):g=t[4];let _=g,v;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(v=(0,Q.jsx)(_t,{className:`shrink-0`,icon:we,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=v):v=t[7];let y;t[8]===l?y=t[9]:(y=()=>l(!0),t[8]=l,t[9]=y);let b;t[10]!==n.skillsInherit||t[11]!==a||t[12]!==y?(b=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:a,onClick:y,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=a,t[12]=y,t[13]=b):b=t[13];let x;t[14]!==_||t[15]!==l||t[16]!==d?(x=()=>{l(!1),d(_())},t[14]=_,t[15]=l,t[16]=d,t[17]=x):x=t[17];let S;t[18]!==n.skillsCustomize||t[19]!==a||t[20]!==x?(S=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:a,onClick:x,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=a,t[20]=x,t[21]=S):S=t[21];let C;t[22]!==b||t[23]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[b,S]}),t[22]=b,t[23]=S,t[24]=C):C=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=q(`skills`),t[25]=T):T=t[25];let E;t[26]===n.skillsLibraryLink?E=t[27]:(E=(0,Q.jsx)(rt,{to:T,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=E);let D;t[28]!==C||t[29]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[C,E]}),t[28]=C,t[29]=E,t[30]=D):D=t[30];let O;t[31]===r.skills.preset?O=t[32]:(O=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=O);let k;t[33]!==n.skillsPresetLabel||t[34]!==O?(k=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,O]}),t[33]=n.skillsPresetLabel,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(A=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):c?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=c,t[39]=A):A=t[39];let j;t[40]!==n.skillsEffectiveLabel||t[41]!==A?(j=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,A]}),t[40]=n.skillsEffectiveLabel,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n.skillsEmptyCatalog||t[44]!==n.skillsNoDescription||t[45]!==a||t[46]!==s||t[47]!==h||t[48]!==d||t[49]!==o||t[50]!==c||t[51]!==u?(M=o?(0,Q.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(gt,{rows:4})}):s.length===0?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Q.jsx)(`div`,{className:i(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,c&&`opacity-50`),children:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:s.map(e=>{let t=e.name||e.directoryId,r=c?h(t):u.has(t),o=typeof e.description==`string`?e.description.trim():``,s=o||n.skillsNoDescription;return(0,Q.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,Q.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:r,disabled:c||a,onChange:()=>{d(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n})},"aria-label":t}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,Q.jsx)(`p`,{className:i(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!o&&`italic text-fg-subtle`),title:s,children:s})]})]})},t)})})}),t[43]=n.skillsEmptyCatalog,t[44]=n.skillsNoDescription,t[45]=a,t[46]=s,t[47]=h,t[48]=d,t[49]=o,t[50]=c,t[51]=u,t[52]=M):M=t[52];let N;t[53]!==n.skillsSave||t[54]!==a||t[55]!==p||t[56]!==f?(N=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(w,{type:`button`,disabled:a,onClick:()=>void f(),children:n.skillsSave})}),t[53]=n.skillsSave,t[54]=a,t[55]=p,t[56]=f,t[57]=N):N=t[57];let P;return t[58]!==D||t[59]!==k||t[60]!==j||t[61]!==M||t[62]!==N||t[63]!==v?(P=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[v,D,k,j,M,N]}),t[58]=D,t[59]=k,t[60]=j,t[61]=M,t[62]=N,t[63]=v,t[64]=P):P=t[64],P}function kn(e){return e.name||e.directoryId}var An=[`write_file`,`apply_patch`,`exec_command`],jn=[`exec_command`,`image_generate`,`extensions`],Mn=[`send_message`,`send_media`];function Nn(e){let t=(0,Z.c)(87),{mode:n,builtinToolIds:r,loading:a,disableSet:o,onDisableSetChange:s,defaultsDisableSet:c,unknownDisabledIds:l,getToolDescription:u,getGroupTitle:d,labels:f,quickActionsDisabled:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=p===void 0?!1:p,_;t[2]===r?_=t[3]:(_=new Set(r),t[2]=r,t[3]=_);let v=_,y;t[4]===c?y=t[5]:(y=c??new Set,t[4]=c,t[5]=y);let b=y,x;t[6]!==b||t[7]!==o||t[8]!==n||t[9]!==s?(x=(e,t)=>{if(n===`agentEntry`&&t&&b.has(e))return;let r=new Set(o);t?r.delete(e):r.add(e),s(r)},t[6]=b,t[7]=o,t[8]=n,t[9]=s,t[10]=x):x=t[10];let S=x,C;t[11]!==v||t[12]!==s?(C=e=>{let t=new Set;for(let n of e)v.has(n)&&t.add(n);s(t)},t[11]=v,t[12]=s,t[13]=C):C=t[13];let T=C,E;t[14]===s?E=t[15]:(E=()=>{s(new Set)},t[14]=s,t[15]=E);let D=E,O;t[16]!==r||t[17]!==s||t[18]!==h?(O=()=>{s(new Set([...r,...h]))},t[16]=r,t[17]=s,t[18]=h,t[19]=O):O=t[19];let k=O,A;t[20]===r?A=t[21]:(A=Nt(r),t[20]=r,t[21]=A);let j=A,M;if(t[22]!==v||t[23]!==j||t[24]!==n||t[25]!==h){if(M=[],n===`defaults`&&h.length>0){let e;t[27]===h?e=t[28]:(e=h.toSorted(Fn),t[27]=h,t[28]=e);let n;t[29]===e?n=t[30]:(n={key:`unknown`,ids:e},t[29]=e,t[30]=n),M.push(n)}for(let e of Mt){let t=e.toolIds.filter(e=>v.has(e));t.length>0&&M.push({key:e.key,ids:[...t]})}if(j.length>0){let e;t[31]===j?e=t[32]:(e={key:`misc`,ids:j},t[31]=j,t[32]=e),M.push(e)}t[22]=v,t[23]=j,t[24]=n,t[25]=h,t[26]=M}else M=t[26];let N=M,P=N.some(Pn),F=g||a,I;t[33]===f.quickActionsLabel?I=t[34]:(I=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:f.quickActionsLabel}),t[33]=f.quickActionsLabel,t[34]=I);let ee=F||r.length===0&&h.length===0,L;t[35]!==D||t[36]!==f.quickEnableAll||t[37]!==ee?(L=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:ee,onClick:D,children:f.quickEnableAll}),t[35]=D,t[36]=f.quickEnableAll,t[37]=ee,t[38]=L):L=t[38];let te=F||r.length===0&&h.length===0,R;t[39]!==k||t[40]!==f.quickDisableAll||t[41]!==te?(R=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:te,onClick:k,children:f.quickDisableAll}),t[39]=k,t[40]=f.quickDisableAll,t[41]=te,t[42]=R):R=t[42];let z=F||r.length===0,ne;t[43]===T?ne=t[44]:(ne=()=>T(An),t[43]=T,t[44]=ne);let re;t[45]!==f.quickReadOnlyWorkspace||t[46]!==z||t[47]!==ne?(re=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:z,onClick:ne,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=z,t[47]=ne,t[48]=re):re=t[48];let ie=F||r.length===0,B;t[49]===T?B=t[50]:(B=()=>T(jn),t[49]=T,t[50]=B);let V;t[51]!==f.quickHighRiskOff||t[52]!==ie||t[53]!==B?(V=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:ie,onClick:B,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=ie,t[53]=B,t[54]=V):V=t[54];let H=F||r.length===0,U;t[55]===T?U=t[56]:(U=()=>T(Mn),t[55]=T,t[56]=U);let W;t[57]!==f.quickNoOutbound||t[58]!==H||t[59]!==U?(W=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:At,disabled:H,onClick:U,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=H,t[59]=U,t[60]=W):W=t[60];let ae;t[61]!==L||t[62]!==R||t[63]!==re||t[64]!==V||t[65]!==W?(ae=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[L,R,re,V,W]}),t[61]=L,t[62]=R,t[63]=re,t[64]=V,t[65]=W,t[66]=ae):ae=t[66];let oe;t[67]!==I||t[68]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[I,ae]}),t[67]=I,t[68]=ae,t[69]=oe):oe=t[69];let G;t[70]!==b||t[71]!==o||t[72]!==d||t[73]!==u||t[74]!==N||t[75]!==P||t[76]!==f.emptyBuiltin||t[77]!==f.lockedByDefaults||t[78]!==f.notInBuiltin||t[79]!==a||t[80]!==n||t[81]!==F||t[82]!==S?(G=a?(0,Q.jsx)(gt,{rows:4}):P?(0,Q.jsx)(`div`,{className:`max-h-[min(50vh,22rem)] overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-5 pr-1`,children:N.map(e=>{let{key:t,ids:r}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:d(t)}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>{let r=n===`defaults`&&t===`unknown`,a=n===`agentEntry`&&b.has(e),s=o.has(e),c=a?!1:!s,l=u(e);return(0,Q.jsx)(`li`,{className:i(`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,r&&`bg-surface-panel/50`,a&&`opacity-60`),children:(0,Q.jsxs)(`label`,{className:i(`flex gap-3 text-sm`,a?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:c,disabled:a||F,onChange:()=>S(e,!c)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs font-medium text-fg`,children:e}),r?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.notInBuiltin,`)`]}):null,a?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.lockedByDefaults,`)`]}):null]}),l?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:l}):null]})]})},e)})})]},t)})})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.emptyBuiltin}),t[70]=b,t[71]=o,t[72]=d,t[73]=u,t[74]=N,t[75]=P,t[76]=f.emptyBuiltin,t[77]=f.lockedByDefaults,t[78]=f.notInBuiltin,t[79]=a,t[80]=n,t[81]=F,t[82]=S,t[83]=G):G=t[83];let K;return t[84]!==oe||t[85]!==G?(K=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[oe,G]}),t[84]=oe,t[85]=G,t[86]=K):K=t[86],K}function Pn(e){return e.ids.length>0}function Fn(e,t){return e.localeCompare(t)}function In(e){let t=(0,Z.c)(51),{a:n,data:r,selected:i,busy:o,toolEntryDisable:s,setToolEntryDisable:c,onSaveTools:u,onClearToolsEntry:d,hideInlineSave:f}=e,p=l(Rn),m;t[0]===p?m=t[1]:(m=a(p),t[0]=p,t[1]=m);let h=m.agentSettings.advanced,_;t[2]===i.tools.presetDenied?_=t[3]:(_=new Set(i.tools.presetDenied.flatMap(Ln)),t[2]=i.tools.presetDenied,t[3]=_);let v=_,y;t[4]===c?y=t[5]:(y=e=>{c(e)},t[4]=c,t[5]=y);let b=y,x=n.toolsDisableGroups,S;t[6]===x?S=t[7]:(S=e=>x[e],t[6]=x,t[7]=S);let C=S,T;t[8]===n.toolDescriptions?T=t[9]:(T=e=>e in n.toolDescriptions?n.toolDescriptions[e]:``,t[8]=n.toolDescriptions,t[9]=T);let E=T,D;t[10]!==n.toolsHint||t[11]!==n.toolsTitle?(D=(0,Q.jsx)(_t,{className:`shrink-0`,icon:g,title:n.toolsTitle,subtitle:n.toolsHint}),t[10]=n.toolsHint,t[11]=n.toolsTitle,t[12]=D):D=t[12];let O;t[13]!==n.toolsLockedByPreset||t[14]!==h.toolsDisableEmptyBuiltin||t[15]!==h.toolsDisableLoadingBuiltin||t[16]!==h.toolsDisableNotInBuiltin||t[17]!==h.toolsDisableQuickActionsLabel||t[18]!==h.toolsDisableQuickDisableAll||t[19]!==h.toolsDisableQuickEnableAll||t[20]!==h.toolsDisableQuickHighRiskOff||t[21]!==h.toolsDisableQuickNoOutbound||t[22]!==h.toolsDisableQuickReadOnlyWorkspace?(O={loadingBuiltin:h.toolsDisableLoadingBuiltin,emptyBuiltin:h.toolsDisableEmptyBuiltin,quickActionsLabel:h.toolsDisableQuickActionsLabel,quickEnableAll:h.toolsDisableQuickEnableAll,quickDisableAll:h.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:h.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:h.toolsDisableQuickHighRiskOff,quickNoOutbound:h.toolsDisableQuickNoOutbound,notInBuiltin:h.toolsDisableNotInBuiltin,lockedByDefaults:n.toolsLockedByPreset},t[13]=n.toolsLockedByPreset,t[14]=h.toolsDisableEmptyBuiltin,t[15]=h.toolsDisableLoadingBuiltin,t[16]=h.toolsDisableNotInBuiltin,t[17]=h.toolsDisableQuickActionsLabel,t[18]=h.toolsDisableQuickDisableAll,t[19]=h.toolsDisableQuickEnableAll,t[20]=h.toolsDisableQuickHighRiskOff,t[21]=h.toolsDisableQuickNoOutbound,t[22]=h.toolsDisableQuickReadOnlyWorkspace,t[23]=O):O=t[23];let k;t[24]!==o||t[25]!==r.builtinToolIds||t[26]!==C||t[27]!==E||t[28]!==b||t[29]!==v||t[30]!==O||t[31]!==s?(k=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Nn,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:s,onDisableSetChange:b,defaultsDisableSet:v,getToolDescription:E,getGroupTitle:C,quickActionsDisabled:o,labels:O})}),t[24]=o,t[25]=r.builtinToolIds,t[26]=C,t[27]=E,t[28]=b,t[29]=v,t[30]=O,t[31]=s,t[32]=k):k=t[32];let A;t[33]!==n.toolsSave||t[34]!==o||t[35]!==f||t[36]!==u?(A=f?null:(0,Q.jsx)(w,{type:`button`,disabled:o,onClick:()=>void u(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=o,t[35]=f,t[36]=u,t[37]=A):A=t[37];let j;t[38]===d?j=t[39]:(j=()=>void d(),t[38]=d,t[39]=j);let M;t[40]!==n.toolsClearEntry||t[41]!==o||t[42]!==j?(M=(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:o,onClick:j,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=o,t[42]=j,t[43]=M):M=t[43];let N;t[44]!==M||t[45]!==A?(N=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[A,M]}),t[44]=M,t[45]=A,t[46]=N):N=t[46];let P;return t[47]!==N||t[48]!==D||t[49]!==k?(P=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[D,k,N]}),t[47]=N,t[48]=D,t[49]=k,t[50]=P):P=t[50],P}function Ln(e){let t=String(e).trim();return t?[t]:[]}function Rn(e){return e.language}function zn(e){let t=(0,Z.c)(128),{a:n,chat:r,cCron:i,selected:a,panel:o,data:s,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,onDelete:w,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O,overviewProfile:k,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:ee,fileSaving:L,profileFileLoading:te,profileEditorNonce:R,toolEntryDisable:z,setToolEntryDisable:ne,onSaveTools:re,onClearToolsEntry:ie,modelRows:B,setModelRows:V,onSaveModels:H,onClearModelsEntry:U,skillsCatalogLoading:W,catalogForPick:ae,skillsInherit:oe,setSkillsInherit:G,skillsPick:K,setSkillsPick:se,onSaveSkills:ce,bindingsLoading:le,agentBindings:ue,bindChannelStatuses:q,bindChannelsLoading:de,useManualChannel:J,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,bindSessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:_e,newBindCustomPeer:ve,setNewBindCustomPeer:ye,refreshBindSessions:be,onRemoveBinding:xe,onAddBinding:Y,onTryInChat:Se}=e;if(!a){let e;return t[0]===n.selectAgentHint?e=t[1]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[0]=n.selectAgentHint,t[1]=e),e}if(o===`overview`){let e;return t[2]!==n||t[3]!==c||t[4]!==_||t[5]!==v||t[6]!==x||t[7]!==S||t[8]!==y||t[9]!==b||t[10]!==Se||t[11]!==a?(e=(0,Q.jsx)(Dn,{a:n,selected:a,defaultModel:_,defaultWorkspace:v,isTuiDefault:x,isTuiDefaultInherited:S,busy:c,onSetDefault:y,onSetTuiDefault:b,onTryInChat:Se}),t[2]=n,t[3]=c,t[4]=_,t[5]=v,t[6]=x,t[7]=S,t[8]=y,t[9]=b,t[10]=Se,t[11]=a,t[12]=e):e=t[12],e}if(o===`behavior`){let e;t[13]!==n||t[14]!==c||t[15]!==r||t[16]!==d||t[17]!==h||t[18]!==l||t[19]!==p||t[20]!==x||t[21]!==S||t[22]!==C||t[23]!==y||t[24]!==b||t[25]!==Se||t[26]!==k.draft||t[27]!==k.handleSoulContentChange||t[28]!==k.handleSoulTemplateChange||t[29]!==k.profileMarkdownLoading||t[30]!==k.setAvatarDialogOpen||t[31]!==k.toggleSoulPreviewMode||t[32]!==k.updateIdentity||t[33]!==a||t[34]!==f||t[35]!==g||t[36]!==u||t[37]!==m?(e=(0,Q.jsx)(xn,{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:!0,profileMarkdownLoading:k.profileMarkdownLoading,profileDraft:k.draft,updateIdentity:k.updateIdentity,handleSoulTemplateChange:k.handleSoulTemplateChange,handleSoulContentChange:k.handleSoulContentChange,setAvatarDialogOpen:k.setAvatarDialogOpen,toggleSoulPreviewMode:k.toggleSoulPreviewMode,onTryInChat:Se}),t[13]=n,t[14]=c,t[15]=r,t[16]=d,t[17]=h,t[18]=l,t[19]=p,t[20]=x,t[21]=S,t[22]=C,t[23]=y,t[24]=b,t[25]=Se,t[26]=k.draft,t[27]=k.handleSoulContentChange,t[28]=k.handleSoulTemplateChange,t[29]=k.profileMarkdownLoading,t[30]=k.setAvatarDialogOpen,t[31]=k.toggleSoulPreviewMode,t[32]=k.updateIdentity,t[33]=a,t[34]=f,t[35]=g,t[36]=u,t[37]=m,t[38]=e):e=t[38];let i;t[39]!==n||t[40]!==c||t[41]!==r||t[42]!==B||t[43]!==U||t[44]!==H||t[45]!==a||t[46]!==V?(i=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(vn,{a:n,chat:r,selected:a,busy:c,modelRows:B,setModelRows:V,onSaveModels:H,onClearModelsEntry:U})}),t[39]=n,t[40]=c,t[41]=r,t[42]=B,t[43]=U,t[44]=H,t[45]=a,t[46]=V,t[47]=i):i=t[47];let o;t[48]!==n||t[49]!==M||t[50]!==I||t[51]!==L||t[52]!==j||t[53]!==A||t[54]!==P||t[55]!==Se||t[56]!==R||t[57]!==te||t[58]!==N||t[59]!==ee||t[60]!==F?(o=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(gn,{a:n,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:ee,fileSaving:L,profileFileLoading:te,profileEditorNonce:R,onTryInChat:Se})}),t[48]=n,t[49]=M,t[50]=I,t[51]=L,t[52]=j,t[53]=A,t[54]=P,t[55]=Se,t[56]=R,t[57]=te,t[58]=N,t[59]=ee,t[60]=F,t[61]=o):o=t[61];let s;return t[62]!==e||t[63]!==i||t[64]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[e,i,o]}),t[62]=e,t[63]=i,t[64]=o,t[65]=s):s=t[65],s}if(o===`tools`){let e;return t[66]!==n||t[67]!==c||t[68]!==s||t[69]!==ie||t[70]!==re||t[71]!==a||t[72]!==ne||t[73]!==z?(e=(0,Q.jsx)(In,{a:n,data:s,selected:a,busy:c,toolEntryDisable:z,setToolEntryDisable:ne,onSaveTools:re,onClearToolsEntry:ie}),t[66]=n,t[67]=c,t[68]=s,t[69]=ie,t[70]=re,t[71]=a,t[72]=ne,t[73]=z,t[74]=e):e=t[74],e}if(o===`skills`){let e;return t[75]!==n||t[76]!==c||t[77]!==ae||t[78]!==ce||t[79]!==a||t[80]!==G||t[81]!==se||t[82]!==W||t[83]!==oe||t[84]!==K?(e=(0,Q.jsx)(On,{a:n,selected:a,busy:c,skillsCatalogLoading:W,catalogForPick:ae,skillsInherit:oe,setSkillsInherit:G,skillsPick:K,setSkillsPick:se,onSaveSkills:ce}),t[75]=n,t[76]=c,t[77]=ae,t[78]=ce,t[79]=a,t[80]=G,t[81]=se,t[82]=W,t[83]=oe,t[84]=K,t[85]=e):e=t[85],e}if(o===`memory`){let e;return t[86]===a.id?e=t[87]:(e=(0,Q.jsx)(qt,{embedded:!0,agentId:a.id}),t[86]=a.id,t[87]=e),e}if(o===`connections`){let e;return t[88]!==n||t[89]!==ue||t[90]!==q||t[91]!==de||t[92]!==me||t[93]!==he||t[94]!==le||t[95]!==c||t[96]!==i.lastActiveLabels||t[97]!==i.selectRecipient||t[98]!==fe||t[99]!==ve||t[100]!==ge||t[101]!==Y||t[102]!==xe||t[103]!==be||t[104]!==pe||t[105]!==ye||t[106]!==_e||t[107]!==J?(e=(0,Q.jsx)(mn,{a:n,busy:c,bindingsLoading:le,agentBindings:ue,channelStatuses:q,channelsStatusLoading:de,useManualChannel:J,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,sessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:_e,newBindCustomPeer:ve,setNewBindCustomPeer:ye,onRefreshSessions:be,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:xe,onAddBinding:Y}),t[88]=n,t[89]=ue,t[90]=q,t[91]=de,t[92]=me,t[93]=he,t[94]=le,t[95]=c,t[96]=i.lastActiveLabels,t[97]=i.selectRecipient,t[98]=fe,t[99]=ve,t[100]=ge,t[101]=Y,t[102]=xe,t[103]=be,t[104]=pe,t[105]=ye,t[106]=_e,t[107]=J,t[108]=e):e=t[108],e}if(o===`config`){let e;return t[109]!==n||t[110]!==c||t[111]!==T||t[112]!==_||t[113]!==E||t[114]!==v||t[115]!==h||t[116]!==p||t[117]!==O||t[118]!==D||t[119]!==a?(e=(0,Q.jsx)(on,{a:n,selected:a,busy:c,defaultModel:_,defaultWorkspace:v,agentModel:h,agentWorkspace:p,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O}),t[109]=n,t[110]=c,t[111]=T,t[112]=_,t[113]=E,t[114]=v,t[115]=h,t[116]=p,t[117]=O,t[118]=D,t[119]=a,t[120]=e):e=t[120],e}if(o===`dangerZone`){let e;return t[121]!==n||t[122]!==c||t[123]!==w||t[124]!==a?(e=(0,Q.jsx)(fn,{a:n,selected:a,busy:c,onDelete:w}),t[121]=n,t[122]=c,t[123]=w,t[124]=a,t[125]=e):e=t[125],e}let Ce;return t[126]===n.selectAgentHint?Ce=t[127]:(Ce=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[126]=n.selectAgentHint,t[127]=Ce),Ce}function Bn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=ue(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=M(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function Vn(e,t){return e.replace(`{{count}}`,String(t))}function Hn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Vn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Vn(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Un(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Vn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Vn(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function Wn(e){let t=(0,Z.c)(11),{text:n,children:r,className:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==n?(o=(0,Q.jsx)(X,{asChild:!0,children:(0,Q.jsx)(`span`,{className:a,title:n,children:r})}),t[0]=r,t[1]=a,t[2]=n,t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(`max-w-[min(28rem,calc(100vw-2rem))] rounded-lg border border-edge bg-surface-panel px-2.5 py-2`,`text-left text-xs leading-snug text-fg shadow-popover`,qe),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(B,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(Y,{children:(0,Q.jsxs)(p,{side:`top`,align:`start`,sideOffset:6,className:s,children:[n,c]})}),t[6]=n,t[7]=l);let u;return t[8]!==o||t[9]!==l?(u=(0,Q.jsx)(Ye,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(Ie,{children:[o,l]})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function Gn(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:a,tuiDefaultAgentId:o,tuiDefaultInherited:s,searchQuery:c,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,m,h,g;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==a||t[4]!==u||t[5]!==l||t[6]!==c||t[7]!==o||t[8]!==s){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Bn(r,c,n),_=r.length>0&&e.length===0&&c.trim().length>0;if(r.length===0){let e;t[14]===n.listNoAgentsYet?e=t[15]:(e=(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),g=e;break bb0}m=`flex flex-col gap-4`,t[16]!==n||t[17]!==_?(h=_?(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listEmpty}):null,t[16]=n,t[17]=_,t[18]=h):h=t[18],f=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let v;t[19]!==n||t[20]!==d||t[21]!==a||t[22]!==u||t[23]!==l||t[24]!==o||t[25]!==s?(v=e=>{let t=ue(e,n),r=e.id,c=M(e,n),f=Hn(e,n),p=Un(e,n),m=e.id===a||e.isDefault,h=e.id===o,g=h&&s,_=h&&!s;return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:d?-1:0,"aria-disabled":d,"aria-label":`${t} ${r}`,onClick:()=>{d||l(e.id)},onKeyDown:t=>{d||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.id))},className:i(`flex min-h-[15.5rem] cursor-pointer flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-[background-color,transform,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/45`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60`,he.pressCard),children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3 text-left`,children:[(0,Q.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base text-fg ring-1 ring-edge-subtle/40`,"aria-hidden":!0,children:(0,Q.jsx)(ee,{agentId:e.id,avatar:e.avatar,size:48,className:`size-full`})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),(0,Q.jsxs)(`div`,{className:`flex max-w-[9rem] shrink-0 flex-wrap justify-end gap-1.5`,children:[m?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,_?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultBadge}):null,g?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultInheritedBadge}):null,!m&&!h?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:n.listCustomBadge}):null]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 min-h-[6.25rem] text-left`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-base px-3 py-3`,children:(0,Q.jsx)(`p`,{className:i(`line-clamp-2 text-sm leading-5`,c?`text-fg`:`text-fg-muted`),title:c||void 0,children:c||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(Kn)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(w,{type:`button`,variant:`secondary`,disabled:d,onClick:t=>{t.stopPropagation(),u(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(k,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=a,t[22]=u,t[23]=l,t[24]=o,t[25]=s,t[26]=v):v=t[26],p=e.map(v)}t[0]=n,t[1]=r,t[2]=d,t[3]=a,t[4]=u,t[5]=l,t[6]=c,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[27]!==f||t[28]!==p?(_=(0,Q.jsx)(`ul`,{className:f,children:p}),t[27]=f,t[28]=p,t[29]=_):_=t[29];let v;return t[30]!==m||t[31]!==h||t[32]!==_?(v=(0,Q.jsxs)(`div`,{className:m,children:[h,_]}),t[30]=m,t[31]=h,t[32]=_,t[33]=v):v=t[33],v}function Kn(e){return(0,Q.jsx)(Wn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function qn(e){let t=(0,Z.c)(131),{open:n,onOpenChange:r,a,chat:o,busy:s,modalError:c,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:f,setCreateAgentId:p,createDescription:m,setCreateDescription:h,createWorkspace:g,setCreateWorkspace:y,createModel:b,setCreateModel:x,onCreate:S,onSuggestWorkspace:C,agents:T,duplicateSourceId:E,onSelectDuplicateSource:k}=e,[A,M]=(0,$.useState)(null),P;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Q.jsx)(ae,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Be)}),t[0]=P):P=t[0];let F;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(F=i(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,640px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,pe,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=F):F=t[1];let I;t[2]===a.addAgent?I=t[3]:(I=(0,Q.jsx)(N,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=I);let ee;t[4]===a.addAgentHint?ee=t[5]:(ee=(0,Q.jsx)(O,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=ee);let L;t[6]!==I||t[7]!==ee?(L=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[I,ee]}),t[6]=I,t[7]=ee,t[8]=L):L=t[8];let te;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(te=i(ct,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=te):te=t[9];let R;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(R=(0,Q.jsx)(Me,{className:`size-4`,"aria-hidden":!0}),t[10]=R):R=t[10];let z;t[11]===a.closeDialogAria?z=t[12]:(z=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:te,"aria-label":a.closeDialogAria,children:R})}),t[11]=a.closeDialogAria,t[12]=z);let ne;t[13]!==L||t[14]!==z?(ne=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[L,z]}),t[13]=L,t[14]=z,t[15]=ne):ne=t[15];let re;t[16]!==a||t[17]!==T||t[18]!==E||t[19]!==k?(re=T.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.copyFromExistingAgent}),(0,Q.jsxs)(Xe,{className:i(Et(),`bg-surface-panel`),value:E??``,onChange:e=>k(e.target.value||null),children:[(0,Q.jsx)(We,{value:``,children:a.copyFromExistingAgentNone}),T.map(e=>(0,Q.jsxs)(We,{value:e.id,children:[ue(e,a),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.duplicateAgentHint})]}):null,t[16]=a,t[17]=T,t[18]=E,t[19]=k,t[20]=re):re=t[20];let ie;t[21]===c?ie=t[22]:(ie=c?(0,Q.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:c}):null,t[21]=c,t[22]=ie);let B;t[23]!==a.newAgentLabel||t[24]!==l?(B=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=B):B=t[25];let V;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(V=Et(),t[26]=V):V=t[26];let H;t[27]===d?H=t[28]:(H=e=>d(e.target.value),t[27]=d,t[28]=H);let U;t[29]===C?U=t[30]:(U=()=>C(),t[29]=C,t[30]=U);let W;t[31]!==u||t[32]!==H||t[33]!==U?(W=(0,Q.jsx)(`input`,{className:V,value:u,onChange:H,onBlur:U,required:!0,autoComplete:`off`}),t[31]=u,t[32]=H,t[33]=U,t[34]=W):W=t[34];let G;t[35]!==B||t[36]!==W?(G=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[B,W]}),t[35]=B,t[36]=W,t[37]=G):G=t[37];let K;t[38]===a.newAgentIdOptional?K=t[39]:(K=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=K);let se;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(se=i(Et(),`font-mono text-xs`),t[40]=se):se=t[40];let le;t[41]===p?le=t[42]:(le=e=>p(e.target.value),t[41]=p,t[42]=le);let q;t[43]===C?q=t[44]:(q=()=>C(),t[43]=C,t[44]=q);let de;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==f||t[48]!==le||t[49]!==q?(de=(0,Q.jsx)(`input`,{className:se,value:f,onChange:le,onBlur:q,placeholder:a.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:a.newAgentIdRules}),t[45]=a.newAgentIdPlaceholder,t[46]=a.newAgentIdRules,t[47]=f,t[48]=le,t[49]=q,t[50]=de):de=t[50];let J;t[51]===a.newAgentIdRules?J=t[52]:(J=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.newAgentIdRules}),t[51]=a.newAgentIdRules,t[52]=J);let fe;t[53]!==K||t[54]!==de||t[55]!==J?(fe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[K,de,J]}),t[53]=K,t[54]=de,t[55]=J,t[56]=fe):fe=t[56];let me;t[57]!==a.agentDescription||t[58]!==l?(me=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=me):me=t[59];let he;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(he=i(Et(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=he):he=t[60];let ge;t[61]===h?ge=t[62]:(ge=e=>h(e.target.value),t[61]=h,t[62]=ge);let _e;t[63]!==a.agentDescriptionPlaceholder||t[64]!==m||t[65]!==ge?(_e=(0,Q.jsx)(`textarea`,{className:he,value:m,onChange:ge,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=m,t[65]=ge,t[66]=_e):_e=t[66];let ve;t[67]!==me||t[68]!==_e?(ve=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[me,_e]}),t[67]=me,t[68]=_e,t[69]=ve):ve=t[69];let ye;t[70]===a.newWorkspace?ye=t[71]:(ye=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=ye);let be;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(be=i(Et(),`font-mono text-xs`),t[72]=be):be=t[72];let xe;t[73]===y?xe=t[74]:(xe=e=>y(e.target.value),t[73]=y,t[74]=xe);let Y;t[75]!==g||t[76]!==xe?(Y=(0,Q.jsx)(`input`,{className:be,value:g,onChange:xe,required:!0,autoComplete:`off`}),t[75]=g,t[76]=xe,t[77]=Y):Y=t[77];let Se;t[78]!==ye||t[79]!==Y?(Se=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ye,Y]}),t[78]=ye,t[79]=Y,t[80]=Se):Se=t[80];let Ce;t[81]===a.newModelOptional?Ce=t[82]:(Ce=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=Ce);let we;t[83]===x?we=t[84]:(we=e=>x(e),t[83]=x,t[84]=we);let Te;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==b||t[90]!==we?(Te=(0,Q.jsx)(_,{className:`min-w-0 flex-1`,value:b,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:we}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=b,t[90]=we,t[91]=Te):Te=t[91];let Ee;t[92]!==a.modelClear||t[93]!==s||t[94]!==b||t[95]!==x?(Ee=b.trim()?(0,Q.jsx)(w,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:s,onClick:()=>x(``),children:a.modelClear}):null,t[92]=a.modelClear,t[93]=s,t[94]=b,t[95]=x,t[96]=Ee):Ee=t[96];let De;t[97]!==Te||t[98]!==Ee?(De=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[Te,Ee]}),t[97]=Te,t[98]=Ee,t[99]=De):De=t[99];let Oe;t[100]!==Ce||t[101]!==De?(Oe=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[Ce,De]}),t[100]=Ce,t[101]=De,t[102]=Oe):Oe=t[102];let Ae;t[103]!==a.createModalCancel||t[104]!==s?(Ae=(0,Q.jsx)(v,{asChild:!0,children:(0,Q.jsx)(w,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=Ae):Ae=t[105];let je;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,Q.jsx)(j,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=je):je=t[106];let Ne;t[107]!==a.create||t[108]!==s?(Ne=(0,Q.jsxs)(w,{type:`submit`,disabled:s,children:[je,a.create]}),t[107]=a.create,t[108]=s,t[109]=Ne):Ne=t[109];let Pe;t[110]!==Ae||t[111]!==Ne?(Pe=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Ae,Ne]}),t[110]=Ae,t[111]=Ne,t[112]=Pe):Pe=t[112];let Fe;t[113]!==S||t[114]!==ie||t[115]!==G||t[116]!==fe||t[117]!==ve||t[118]!==Se||t[119]!==Oe||t[120]!==Pe||t[121]!==re?(Fe=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:S,children:[re,ie,G,fe,ve,Se,Oe,Pe]}),t[113]=S,t[114]=ie,t[115]=G,t[116]=fe,t[117]=ve,t[118]=Se,t[119]=Oe,t[120]=Pe,t[121]=re,t[122]=Fe):Fe=t[122];let Ie;t[123]!==A||t[124]!==Fe||t[125]!==ne?(Ie=(0,Q.jsxs)(ce,{children:[P,(0,Q.jsx)(oe,{ref:M,className:F,onOpenAutoFocus:Jn,children:(0,Q.jsxs)(ke,{layer:`modal`,portalContainer:A,children:[ne,Fe]})})]}),t[123]=A,t[124]=Fe,t[125]=ne,t[126]=Ie):Ie=t[126];let Le;return t[127]!==r||t[128]!==n||t[129]!==Ie?(Le=(0,Q.jsx)(D,{open:n,onOpenChange:r,children:Ie}),t[127]=r,t[128]=n,t[129]=Ie,t[130]=Le):Le=t[130],Le}function Jn(e){return e.preventDefault()}var Yn=`~/.xopc/workspace`;function Xn(e){let t=e.trim();return t?`${Yn}/${x(t)}`:``}function Zn(e){let t=(0,Z.c)(18),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(tt,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e.target.value),t[1]=a,t[2]=c);let l;t[3]!==n.listSearchPlaceholder||t[4]!==i||t[5]!==c?(l=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[s,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:c,placeholder:n.listSearchPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-label":n.listSearchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[3]=n.listSearchPlaceholder,t[4]=i,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=()=>o(),t[7]=o,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(S,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=d):d=t[9];let f;t[10]!==n.addAgent||t[11]!==n.addAgentAria||t[12]!==r||t[13]!==u?(f=(0,Q.jsxs)(w,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:u,children:[d,n.addAgent]}),t[10]=n.addAgent,t[11]=n.addAgentAria,t[12]=r,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function Qn(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function $n(e){let{agentId:t,enabled:n,saveRef:r}=e,i=lt(async()=>{if(!t)return null;let[e,n]=await Promise.all([f(t,`IDENTITY.md`).catch(()=>``),f(t,`SOUL.md`).catch(()=>``)]),r=dt(e);return{identity:r,soulTemplate:W(n),soulCustomContent:n,identityBaseline:JSON.stringify(r),soulBaseline:n}},[t],{enabled:n&&!!t,initial:null,errorData:null}),a=i.data,o=i.loading,s=(0,$.useRef)(!1),[c,l]=(0,$.useState)(null),u=t??``,d=(0,$.useRef)(u);d.current!==u&&(d.current=u,s.current=!1,l(null));let p=c??(a?Qn(a):null),m=(0,$.useMemo)(()=>p?JSON.stringify(p.identity)!==p.identityBaseline||p.soulCustomContent!==p.soulBaseline:!1,[p]),h=(0,$.useRef)(t);h.current=t;let g=(0,$.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?Qn(a):null);return n?e(n):null})},[a]),_=(0,$.useCallback)(e=>{g(t=>({...t,identity:{...t.identity,...e}}))},[g]),v=(0,$.useCallback)(e=>{g(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=E.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[g]),y=(0,$.useCallback)(e=>{g(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[g]),b=(0,$.useCallback)(e=>{g(t=>({...t,avatarDialogOpen:e}))},[g]),x=(0,$.useCallback)(()=>{g(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[g]),S=(0,$.useCallback)(async()=>{let e=h.current;!e||!p||(await Promise.all([ye(e,`IDENTITY.md`,se(p.identity)),ye(e,`SOUL.md`,p.soulCustomContent)]),s.current=!1,l(e=>{let t=e??p;return{...t,identityBaseline:JSON.stringify(t.identity),soulBaseline:t.soulCustomContent}}))},[p]);return(0,$.useLayoutEffect)(()=>{if(r)return r.current=S,()=>{r.current=null}},[S,r]),{profileMarkdownLoading:o,draft:p,dirty:m,updateIdentity:_,handleSoulTemplateChange:v,handleSoulContentChange:y,setAvatarDialogOpen:b,toggleSoulPreviewMode:x}}var er={draft:``,editorNonce:0,loadedKey:``};function tr(e,t){switch(t.type){case`load`:return{draft:t.content,editorNonce:e.editorNonce+1,loadedKey:t.key};case`setDraft`:return{...e,draft:t.value};case`clear`:return{draft:``,editorNonce:e.editorNonce,loadedKey:``};case`resetViewMode`:return e}}function nr(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=lt(()=>n?Se(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`behavior`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,p]=(0,$.useState)(null),[m,h]=(0,$.useReducer)(tr,er),[g,_]=(0,$.useState)(!1),[v,y]=(0,$.useState)(`edit`),b=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==b.current&&(b.current=n,p(null))},[n]),(0,$.useEffect)(()=>{if(c&&c.files.length>0&&!d){let e=c.files.find(e=>e.name===`AGENTS.md`);p(e?e.name:c.files[0].name)}},[c,d]);let x=m.draft,S=m.editorNonce,C=(0,$.useRef)(x);C.current=x;let w=(0,$.useRef)(n);w.current=n;let T=(0,$.useRef)(d);T.current=d;let E=(0,$.useRef)(null),D=(0,$.useRef)(``),O=(0,$.useRef)(``),k=(0,$.useRef)(``),A=(0,$.useRef)(()=>{}),j=lt(()=>d&&n?f(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),M=j.loading,N=Oe(async()=>{let e=w.current,t=T.current;if(!e||!t||`${e}:${t}`!==D.current)return;let n=C.current;if(n!==O.current){_(!0),o(null);try{await ye(e,t,n),O.current=n,l(n=>!n||n.agentId!==e?n:{...n,files:n.files.map(e=>e.name===t?{...e,missing:!1}:e)})}catch(e){o(e instanceof Error?e.message:a)}finally{_(!1)}}},800);A.current=N.flush,(0,$.useEffect)(()=>()=>{A.current()},[]);let P=(0,$.useRef)(t);P.current!==t&&(P.current===`behavior`&&A.current(),P.current=t);let F=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{F!==k.current&&(A.current(),k.current=F)},[F]),(0,$.useEffect)(()=>{if(!F){h({type:`clear`});return}M||(D.current=F,O.current=j.data,h({type:`load`,key:F,content:j.data}))},[F,M,j.data]);let I=(0,$.useRef)({activeFile:d,selectedId:n});return(I.current.activeFile!==d||I.current.selectedId!==n)&&(I.current={activeFile:d,selectedId:n},y(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{A.current(),p(e)},[]),fileDraft:x,setFileDraft:(0,$.useCallback)(e=>{h({type:`setDraft`,value:typeof e==`function`?e(C.current):e}),N()},[N]),fileSaving:g,filesViewMode:v,setFilesViewMode:y,profileFileLoading:M,profileEditorNonce:S,overviewSaveProfileMarkdownRef:E,saveProfileMarkdownDebounced:N}}function rr(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,$.useRef)(!1),[u,d]=(0,$.useState)(null),f=(0,$.useRef)(r);t===`connections`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`connections`&&n,h=lt(()=>xt(),[t,n],{enabled:m,initial:[],errorData:[]}),g=h.data,_=h.loading,v=(0,$.useMemo)(()=>_||g.length===0?``:g[0]?.name??``,[g,_]),[y,b]=(0,$.useState)(``),x=(0,$.useRef)(v);t===`connections`&&!_&&v&&x.current!==v&&(!y||!g.some(e=>e.name===y))&&(x.current=v,b(v)),x.current=v;let S=y.trim(),C=m&&S.length>0,w=lt(()=>St(S),[t,n,S],{enabled:C,initial:[],errorData:[]}),T=w.data,E=w.loading,D=w.setData,[O,k]=(0,$.useState)(null),[A,j]=(0,$.useState)(``),M=(0,$.useRef)(S);M.current!==S&&(M.current=S,k(null));let N=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),P=(0,$.useCallback)(()=>{let e=y.trim();e&&St(e).then(e=>{D(e),k(t=>t!=null&&t<e.length?t:null)}).catch(()=>{D([]),k(null)})},[y,D]),F=!_&&g.length===0,I=t===`connections`&&n&&i,ee=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await Ve(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:N,allBindings:p,bindChannelStatuses:g,bindChannelsLoading:_,bindSessionChats:T,bindSessionsLoading:E,bindingsLoading:I,newBindChannel:y,setNewBindChannel:b,newBindSessionIdx:O,setNewBindSessionIdx:k,newBindCustomPeer:A,setNewBindCustomPeer:j,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!y.trim())return;let t=wt(y,A,O,T),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await Ve(n),l.current=!0,d(n),k(null),j(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,T,y,A,O,o,a,s,c]),onRemoveBinding:ee,refreshBindSessions:P,useManualChannel:F}}function ir(e,t){let n=(0,Z.c)(16),[r,i]=(0,$.useState)(0),a,o;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=e=>{let t=e.detail;t&&typeof t==`object`&&`section`in t&&t.section===`skills`&&i(sr)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},o=[],n[0]=a,n[1]=o):(a=n[0],o=n[1]),(0,$.useEffect)(a,o);let s;n[2]!==r||n[3]!==e||n[4]!==t?(s=[e,t,r],n[2]=r,n[3]=e,n[4]=t,n[5]=s):s=n[5];let c=e&&t,l;n[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=[],n[6]=l):l=n[6];let u;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(u=[],n[7]=u):u=n[7];let d;n[8]===c?d=n[9]:(d={enabled:c,initial:l,errorData:u},n[8]=c,n[9]=d);let{data:f,loading:p}=lt(or,s,d),m;n[10]===f?m=n[11]:(m=f.filter(ar),n[10]=f,n[11]=m);let h=m,g;return n[12]!==h||n[13]!==f||n[14]!==p?(g={catalogForPick:h,skillCatalog:f,skillsCatalogLoading:p},n[12]=h,n[13]=f,n[14]=p,n[15]=g):g=n[15],g}function ar(e){return e.enabled!==!1}function or(){return Ge()}function sr(e){return e+1}function cr(e){return ir(e.panel===`skills`,e.hasToken)}function lr(e){return new Set(e.tools.entryDisable)}function ur(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function dr(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,$.useRef)(r),[a,o]=(0,$.useState)(()=>new Set),[s,c]=(0,$.useState)(()=>new Set),[l,u]=(0,$.useState)(!0),[d,f]=(0,$.useState)(()=>[]);if(i.current!==r){if(i.current=r,n&&t===`tools`&&o(lr(n)),n&&t===`skills`){let e=ur(n);u(e.inherit),c(e.pick)}n&&t===`behavior`&&f(Ot(n.typedModels.effective))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:f}}function fr(e,t){let n=e.typedModels.defaultRole;return{defaultRole:n,roles:{[n]:{model:t}}}}function pr(e){let t=Ot(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Ot(e.typedModels.effective)}function mr(e){return Object.fromEntries(Array.from(e).map(e=>e.trim()).filter(Boolean).toSorted((e,t)=>e.localeCompare(t)).map(e=>[e,{mode:`deny`}]))}function hr(){let e=l(e=>e.language),t=a(e),n=t.agentsSettings,[r,i]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null),[u,f]=(0,$.useState)(!1),[p,m]=(0,$.useState)(``),h=t.cron,g=t.chat,_=!!o(e=>e.token),[v,y]=je(),b=C(),{agentId:x}=te(),S=He(e=>e.setPageHeader),w=He(e=>e.clearPageHeader),{data:T,error:E,isLoading:D,mutate:O}=d(_?`settings-gateway-agents`:null,Le,{revalidateOnFocus:!1}),{data:k,mutate:A}=d(_?`settings-capability-presets`:null,Pt,{revalidateOnFocus:!1}),j=Te(_),{data:N}=j,P=(0,$.useMemo)(()=>me(N?.payload?.config??{}),[N]),F=T??null,ee=(0,$.useMemo)(()=>F?F.agents.find(e=>e.id===F.defaultId)??F.agents[0]??null:null,[F]),L=!!(_&&D),[R,z]=(0,$.useState)(null),ne=E instanceof Error?E.message:E?n.loadError:null,ie=R??ne,[B,V]=(0,$.useState)(null),[H,U]=(0,$.useState)(`overview`),[W,ae]=(0,$.useState)(``),[oe,G]=(0,$.useState)(``),[K,se]=(0,$.useState)(``),[ce,q]=(0,$.useState)(``),[de,J]=(0,$.useState)(``),[fe,pe]=(0,$.useState)(null),[he,_e]=(0,$.useState)(!1),ve=(0,$.useRef)(``),[ye,be]=(0,$.useState)(null),[xe,Y]=(0,$.useState)(!1),[Se,Ce]=(0,$.useState)(``),[we,Ee]=(0,$.useState)(``),[De,Oe]=(0,$.useState)(``),[ke,Ae]=(0,$.useState)(``),[Me,Ne]=(0,$.useState)(``),[Pe,Ie]=(0,$.useState)(``),Re=(0,$.useRef)(null),[ze,Be]=(0,$.useState)(!1),Ve=(0,$.useRef)({data:null,routeAgentId:void 0});F&&(F!==Ve.current.data||x!==Ve.current.routeAgentId)&&(Ve.current={data:F,routeAgentId:x},x&&F.agents.some(e=>e.id===x)?V(x):V(e=>e&&F.agents.some(t=>t.id===e)?e:F.defaultId)),(0,$.useEffect)(()=>{!F||!x||F.agents.some(e=>e.id===x)||b(Fe,{replace:!0})},[F,x,b]),(0,$.useEffect)(()=>{x&&U(`overview`)},[x]),(0,$.useEffect)(()=>{v.get(`panel`)===`defaults`&&b(x?Ue(x):Fe,{replace:!0,state:{[I]:x?Ue(x):Fe}})},[v,x,b]),(0,$.useEffect)(()=>{if(v.get(`focus`)!==`avatar`||!x||(U(`overview`),L||!F?.agents.some(e=>e.id===x)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),y(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[v,x,L,F,y]);let X=(0,$.useMemo)(()=>F?.agents.find(e=>e.id===B)??null,[F,B]),We=(0,$.useMemo)(()=>{let e=N?.payload?.config;if(!e||typeof e!=`object`||Array.isArray(e))return``;let t=e.tui;if(!t||typeof t!=`object`||Array.isArray(t))return``;let n=t.defaultAgent;return typeof n==`string`?n.trim().toLowerCase():``},[N]),Ge=(0,$.useMemo)(()=>!F||We&&F.agents.some(e=>e.id===We)?We:F.defaultId||F.agents[0]?.id||We,[F,We]),Ke=!!(F&&We&&!F.agents.some(e=>e.id===We));(0,$.useEffect)(()=>{Ee(Ke?``:We)},[We,Ke]);let qe=(0,$.useRef)(null),Ye=X?X.id:null;X&&qe.current!==Ye?(qe.current=Ye,Oe(X.workspace),Ae(X.model?.primary??``),Ne(ue(X,a(e).agentsSettings)),Ie(M(X,a(e).agentsSettings))):!X&&qe.current!==null&&(qe.current=null,Oe(``),Ae(``),Ne(``),Ie(``));let Xe=$n({agentId:X?.id??null,enabled:H===`behavior`&&!!X,saveRef:Re}),Ze=nr({panel:H,selectedId:B,hasToken:_,dataAgentsLength:F?.agents.length,saveErrorMessage:n.saveError,setError:z}),Qe=dr({panel:H,selected:X}),$e=rr({panel:H,hasToken:_,bindingsFromConfig:P,gatewayCfgLoading:N===void 0,selected:X,saveErrorMessage:n.saveError,setBusy:Y,setError:z}),tt=cr({panel:H,hasToken:_}),rt=(0,$.useCallback)(()=>{let e=Xn(oe.trim()||W);q(t=>t===``||t===ve.current?(ve.current=e,e):t)},[oe,W]),it=(0,$.useCallback)(()=>{ve.current=``,ae(``),G(``),se(``),q(``),J(``),pe(null),be(null),_e(!0)},[]),at=(0,$.useCallback)(e=>{let t=new Set(F?.agents.map(e=>e.id.toLowerCase())??[]),r=e.trim();if(!t.has(r.toLowerCase()))return r;let i=`${r}${n.duplicateIdSuffix}`;if(!t.has(i.toLowerCase()))return i;for(let e=2;e<1e3;e+=1){let n=`${i}-${e}`;if(!t.has(n.toLowerCase()))return n}return i},[n.duplicateIdSuffix,F]),ot=(0,$.useCallback)(e=>{if(be(e),!e)return;let t=F?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=at(t.id),o=t.description??``;ve.current=``,ae(i),G(a),se(o),q(t.workspace),J(t.model?.primary??``),pe(null)},[n.duplicateName,F,at]),st=(0,$.useCallback)(e=>{ot(e),_e(!0)},[ot]),ct=(0,$.useMemo)(()=>(0,Q.jsx)(Zn,{a:n,busy:xe,listSearchQuery:Se,onListSearchQueryChange:Ce,onAddAgent:()=>it()}),[n,xe,Se,it]);(0,$.useLayoutEffect)(()=>_?(S({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title})}),end:ct}),()=>w()):(w(),()=>w()),[n.title,ct,w,_,S]);async function lt(t){t.preventDefault();let r=W.trim();if(!r)return;let i=nt(oe,r);if(i.ok===!1){pe(i.error);return}let a=ce.trim()||Xn(oe.trim()||r);if(a){Y(!0),pe(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${K.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
2
+ `),{createdAgentId:n,...i}=await le({workspace:a,...oe.trim()?{id:oe.trim()}:{},...de.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:de.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...ye?{cloneFrom:ye}:{}});O(i,{revalidate:!1}),ae(``),G(``),se(``),q(``),J(``),pe(null),_e(!1),V(n),b(Ue(n))}catch(e){pe(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function ut(){if(X){Y(!0),z(null);try{O(await et(X.id,{workspace:De.trim()||void 0,...ke.trim()?{models:fr(X,ke.trim())}:{}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function dt(e){Y(!0),z(null);try{O(await et(e.id,{setDefault:!0}),{revalidate:!1}),V(e.id)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function ft(){let e=we.trim().toLowerCase();if(e&&!F?.agents.some(t=>t.id===e)){z(n.tuiDefaultAgentInvalid);return}Y(!0),z(null);try{await Je(e||null),await j.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function pt(e){Y(!0),z(null);try{await Je(e.id),Ee(e.id),await j.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function mt(){Y(!0),z(null);try{await Je(null),Ee(``),await j.mutate()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function ht(e,t){Y(!0),z(null);try{let n=await re(e.id,t);O(n,{revalidate:!1}),V(n.defaultId),U(`overview`),x===e.id&&b(Fe,{replace:!0}),i(!1),c(null),m(``)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}function gt(e,t){e.id!==`main`&&(c(e),f(t),m(``),i(!0))}async function _t(){if(X){Y(!0),z(null);try{O(await et(X.id,{tools:{builtin:mr(Qe.toolEntryDisable)}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function vt(){if(X){Y(!0),z(null);try{O(await et(X.id,{tools:null}),{revalidate:!1}),Qe.setToolEntryDisable(new Set)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function yt(){if(!X)return;let e=Dt(Qe.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){z(e);return}Y(!0),z(null);try{O(await et(X.id,{models:{roles:jt(Qe.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function bt(){if(!X)return;let e=pr(X),t=jt(e);if(!t?.roles?.[X.typedModels.defaultRole]){z(n.typedModelsInvalidModel);return}Y(!0),z(null);try{O(await et(X.id,{models:{defaultRole:X.typedModels.defaultRole,roles:t.roles}}),{revalidate:!1}),Qe.setModelRows(e)}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}async function xt(){if(X){Y(!0),z(null);try{O(await et(X.id,{skills:Qe.skillsInherit?null:[...Qe.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}async function St(e){if(X){Y(!0),z(null);try{O(await et(X.id,{extends:e}),{revalidate:!1}),A()}catch(e){z(e instanceof Error?e.message:n.saveError)}finally{Y(!1)}}}let Ct=H!==`behavior`,wt=(()=>{if(!X||H!==`behavior`)return!1;let e=X.workspace,t=X.model?.primary??``;return De.trim()!==e||ke.trim()!==t})(),Tt=(()=>{if(Ct||!X)return!1;switch(H){case`behavior`:return wt||Xe.dirty;default:return!0}})(),Et=Ct||!Tt;function Ot(){Be(!0),setTimeout(()=>Be(!1),2e3)}async function kt(){switch(H){case`behavior`:await Promise.all([ut(),Re.current?.()??Promise.resolve()]),Ot();break;default:break}}function At(e){e||b(Fe)}let Mt=X?Me.trim()||ue(X,n):x??``,Nt=X?.id??x??``,Ft=(0,$.useCallback)(async()=>{if(X){await kt(),Ze.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(ge,X.id)}catch{}b(`/chat/new`,{state:{agentId:X.id,fromAgentEditor:!0}})}},[X,kt,Ze.saveProfileMarkdownDebounced,b]),It={a:n,chat:g,cCron:h,selected:X,panel:H,data:F,busy:xe,editName:Me,setEditName:Ne,editDescription:Pe,setEditDescription:Ie,editWorkspace:De,setEditWorkspace:Oe,editModel:ke,setEditModel:Ae,defaultModel:ee?.model?.primary??``,defaultWorkspace:ee?.workspace??``,onSetDefault:()=>{X&&dt(X)},onSetTuiDefault:()=>{X&&pt(X)},isTuiDefault:!!(X&&X.id===Ge),isTuiDefaultInherited:!!(X&&X.id===Ge&&(!We||Ke)),onSaveAgentEdits:()=>void ut(),onDelete:e=>{X&&gt(X,e)},onTryInChat:()=>void Ft(),capabilityPresets:k?.presets??[],defaultPresetId:k?.defaultPresetId,onUpdateAgentExtends:e=>void St(e),onOpenCapabilityPreset:e=>{b(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewSaveProfileMarkdownRef:Re,overviewProfile:Xe,filesLoading:Ze.filesLoading,files:Ze.files,activeFile:Ze.activeFile,setActiveFile:Ze.setActiveFile,filesViewMode:Ze.filesViewMode,setFilesViewMode:Ze.setFilesViewMode,fileDraft:Ze.fileDraft,setFileDraft:Ze.setFileDraft,fileSaving:Ze.fileSaving,profileFileLoading:Ze.profileFileLoading,profileEditorNonce:Ze.profileEditorNonce,toolEntryDisable:Qe.toolEntryDisable,setToolEntryDisable:Qe.setToolEntryDisable,onSaveTools:()=>void _t(),onClearToolsEntry:()=>void vt(),modelRows:Qe.modelRows,setModelRows:Qe.setModelRows,onSaveModels:()=>void yt(),onClearModelsEntry:()=>void bt(),skillsCatalogLoading:tt.skillsCatalogLoading,catalogForPick:tt.catalogForPick,skillsInherit:Qe.skillsInherit,setSkillsInherit:Qe.setSkillsInherit,skillsPick:Qe.skillsPick,setSkillsPick:Qe.setSkillsPick,onSaveSkills:()=>void xt(),bindingsLoading:$e.bindingsLoading,agentBindings:$e.agentBindings,bindChannelStatuses:$e.bindChannelStatuses,bindChannelsLoading:$e.bindChannelsLoading,useManualChannel:$e.useManualChannel,newBindChannel:$e.newBindChannel,setNewBindChannel:$e.setNewBindChannel,bindSessionChats:$e.bindSessionChats,bindSessionsLoading:$e.bindSessionsLoading,newBindSessionIdx:$e.newBindSessionIdx,setNewBindSessionIdx:$e.setNewBindSessionIdx,newBindCustomPeer:$e.newBindCustomPeer,setNewBindCustomPeer:$e.setNewBindCustomPeer,refreshBindSessions:$e.refreshBindSessions,onRemoveBinding:e=>void $e.onRemoveBinding(e),onAddBinding:$e.onAddBinding};return{hasToken:_,a:n,chat:g,language:e,data:F,savedTuiDefaultAgentId:We,effectiveTuiDefaultAgentId:Ge,tuiDefaultAgentDraft:we,setTuiDefaultAgentDraft:Ee,tuiDefaultAgentUnavailable:Ke,onSaveTuiDefaultAgent:ft,onSetTuiDefaultAgent:pt,onClearTuiDefaultAgent:mt,onSetDefaultAgent:dt,loading:L,displayError:ie,navigate:b,routeAgentId:x,busy:xe,listSearchQuery:Se,openAddAgentModal:it,openDuplicateAgentModal:st,duplicateSourceId:ye,onSelectDuplicateSource:ot,panel:H,setPanel:U,modalTitle:Mt,modalSubtitle:Nt,footerSaveDisabled:Et,savedFlash:ze,handleModalFooterSave:kt,onAgentModalOpenChange:At,addAgentModalOpen:he,setAddAgentModalOpen:_e,createWorkspaceSuggestedRef:ve,createModalError:fe,setCreateModalError:pe,createDisplayName:W,setCreateDisplayName:ae,createAgentId:oe,setCreateAgentId:G,createDescription:K,setCreateDescription:se,createWorkspace:ce,setCreateWorkspace:q,createModel:de,setCreateModel:J,onCreate:lt,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:rt,deleteDialogOpen:r,setDeleteDialogOpen:i,deletePurge:u,deleteTarget:s,setDeleteTarget:c,deleteConfirmText:p,setDeleteConfirmText:m,performDelete:ht,editorPanelProps:It}}function gr(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(J,{className:`h-5 w-40`}),(0,Q.jsx)(J,{className:`h-3 w-64 max-w-full`})]}),(0,Q.jsx)(J,{className:`h-9 w-28 rounded-lg`})]}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`grid gap-4`,"aria-hidden":`true`,children:[t,(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 xl:grid-cols-3`,children:Array.from({length:6}).map(_r)})]}),e[1]=n):n=e[1],n}function _r(e,t){return(0,Q.jsxs)(`div`,{className:`rounded-xl bg-surface-base p-4 shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(J,{className:`size-11 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(J,{className:`h-4 w-2/3`}),(0,Q.jsx)(J,{className:`mt-2 h-3 w-24`})]})]}),(0,Q.jsx)(J,{className:`mt-4 h-3 w-full`}),(0,Q.jsx)(J,{className:`mt-2 h-3 w-4/5`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(J,{className:`h-6 w-16 rounded-full`}),(0,Q.jsx)(J,{className:`h-6 w-20 rounded-full`})]})]},t)}function vr(){let e=hr();return e.hasToken?(0,Q.jsxs)(mt,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[e.displayError?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 shadow-surface dark:text-red-300`,children:e.displayError}):null,e.loading?(0,Q.jsx)(gr,{}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(Gn,{a:e.a,agents:e.data.agents,defaultAgentId:e.data.defaultId,tuiDefaultAgentId:e.effectiveTuiDefaultAgentId,tuiDefaultInherited:!e.savedTuiDefaultAgentId||e.tuiDefaultAgentUnavailable,searchQuery:e.listSearchQuery,onOpenAgent:t=>e.navigate(Ue(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(ge,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Vt,{open:!!e.routeAgentId,onOpenChange:e.onAgentModalOpenChange,a:e.a,title:e.modalTitle,subtitle:e.modalSubtitle,panel:e.panel,onPanelChange:e.setPanel,onFooterSave:()=>void e.handleModalFooterSave(),footerSaveDisabled:e.footerSaveDisabled,footerSavedFlash:e.savedFlash,showFooter:e.panel===`behavior`,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(gr,{}):(0,Q.jsx)(zn,{...e.editorPanelProps})}):null,(0,Q.jsx)(qn,{open:e.addAgentModalOpen,onOpenChange:t=>{e.setAddAgentModalOpen(t),t||(e.createWorkspaceSuggestedRef.current=``,e.setCreateDisplayName(``),e.setCreateAgentId(``),e.setCreateDescription(``),e.setCreateWorkspace(``),e.setCreateModel(``),e.setCreateModalError(null),e.onSelectDuplicateSource(null))},a:e.a,chat:e.chat,busy:e.busy,modalError:e.createModalError,profileLanguageLabel:e.currentLanguageLabel,createDisplayName:e.createDisplayName,setCreateDisplayName:e.setCreateDisplayName,createAgentId:e.createAgentId,setCreateAgentId:e.setCreateAgentId,createDescription:e.createDescription,setCreateDescription:e.setCreateDescription,createWorkspace:e.createWorkspace,setCreateWorkspace:e.setCreateWorkspace,createModel:e.createModel,setCreateModel:e.setCreateModel,onCreate:e.onCreate,onSuggestWorkspace:()=>e.applyCreateWorkspaceSuggestion(),agents:e.data?.agents??[],duplicateSourceId:e.duplicateSourceId,onSelectDuplicateSource:e.onSelectDuplicateSource}),(0,Q.jsx)(Lt,{open:e.deleteDialogOpen,onOpenChange:t=>{e.setDeleteDialogOpen(t),t||(e.setDeleteTarget(null),e.setDeleteConfirmText(``))},busy:e.busy,deletePurge:e.deletePurge,deleteTarget:e.deleteTarget,deleteConfirmText:e.deleteConfirmText,onDeleteConfirmTextChange:e.setDeleteConfirmText,onConfirm:()=>{e.deleteTarget&&e.performDelete(e.deleteTarget,e.deletePurge)},onCancel:()=>e.setDeleteDialogOpen(!1),a:e.a})]}):(0,Q.jsxs)(mt,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[(0,Q.jsx)(pt,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{vr as AgentsSettingsPanel};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-DR9ODkb8.js";import{n as o,o as s}from"./fetch-6HXXdO77.js";import{n as c}from"./locale-store-Ba72bFmP.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{Ba as u,Ha as d,Ka as f,Nc as p,Tt as m,Ua as h,Va as g,Wa as _,ha as v,io as y,js as b,mo as x,ro as S,vo as C,wo as w,za as T}from"./index-BOme955B.js";import{n as E,t as D}from"./settings-page-layout-Da_LNPDS.js";import{r as O}from"./settings-loading-skeleton-A2OshMK8.js";import{r as k,t as A}from"./settings-form-section-DnDrLMWZ.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,M.useReducer)(m,L),{info:o,loadError:s,actionError:c,copiedField:l,clearDialogOpen:f,clearConfirmChecked:v,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await x(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(s)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:s});if(!o)return(0,N.jsx)(O,{rows:2});let H=!o.packaged,U=j||o.pendingUpdate||H,W=!H&&o.uninstallMode!==`unsupported`,G=I(o,t),K=v&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(b,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,c?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,o.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(o.appPath,`app`),children:[(0,N.jsx)(p,{className:`size-3`,"aria-hidden":!0}),l===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(o.dataPath,`data`),children:[(0,N.jsx)(p,{className:`size-3`,"aria-hidden":!0}),l===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(o.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(h,{open:f,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(d,{children:[(0,N.jsx)(g,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,y)}),(0,N.jsxs)(T,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,S,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(_,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(u,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:v,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(w,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(w,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(h,{open:D,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(d,{children:[(0,N.jsx)(g,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,y)}),(0,N.jsxs)(T,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,S,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(_,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(u,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(w,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(w,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await o(s(`/api/migrations/status`))).payload}async function B(){await o(s(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=l(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function u(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(v,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(v,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let d=t?.items??[],f=d.filter(e=>e.status===`conflict`||e.status===`error`),p=d.filter(e=>e.safety===`auto`&&e.status===`planned`),m=f.length>0||d.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:d.length===0?e.upToDate:m?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(p.length))})]}),p.length>0&&!m?(0,N.jsx)(w,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void u(),disabled:a,children:a?e.applying:e.apply}):null]}),d.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=c(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!f()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CQ_k8RHj.js";import{n as o,o as s}from"./fetch-BWXmBizE.js";import{n as c}from"./locale-store-Ba72bFmP.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{Dt as u,Eo as d,Ga as f,Ha as p,Ic as m,Ja as h,Ka as g,Ps as _,Ua as v,Va as y,Wa as b,_a as x,ao as S,bo as C,go as w,oo as T}from"./index-DZOm5_ex.js";import{n as E,t as D}from"./settings-page-layout-CrICyGob.js";import{r as O}from"./settings-loading-skeleton-SYCPY-WM.js";import{r as k,t as A}from"./settings-form-section-By0YiDWo.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,M.useReducer)(u,L),{info:o,loadError:s,actionError:c,copiedField:l,clearDialogOpen:h,clearConfirmChecked:x,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await w(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(s)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:s});if(!o)return(0,N.jsx)(O,{rows:2});let H=!o.packaged,U=j||o.pendingUpdate||H,W=!H&&o.uninstallMode!==`unsupported`,G=I(o,t),K=x&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(_,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,c?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,o.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(o.appPath,`app`),children:[(0,N.jsx)(m,{className:`size-3`,"aria-hidden":!0}),l===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(o.dataPath,`data`),children:[(0,N.jsx)(m,{className:`size-3`,"aria-hidden":!0}),l===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(o.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(f,{open:h,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(b,{children:[(0,N.jsx)(v,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,T)}),(0,N.jsxs)(y,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,S,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(g,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(p,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:x,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(d,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(d,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(f,{open:D,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(b,{children:[(0,N.jsx)(v,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,T)}),(0,N.jsxs)(y,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,S,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(g,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(p,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(d,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(d,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await o(s(`/api/migrations/status`))).payload}async function B(){await o(s(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=l(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function u(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(x,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(x,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let f=t?.items??[],p=f.filter(e=>e.status===`conflict`||e.status===`error`),m=f.filter(e=>e.safety===`auto`&&e.status===`planned`),h=p.length>0||f.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:f.length===0?e.upToDate:h?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(m.length))})]}),m.length>0&&!h?(0,N.jsx)(d,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void u(),disabled:a,children:a?e.applying:e.apply}):null]}),f.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:f.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=c(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!h()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-DR9ODkb8.js";import{n as i}from"./locale-store-Ba72bFmP.js";import{i as a}from"./theme-store-Bt6vAkSB.js";import{Za as o,it as s,vo as c}from"./index-BOme955B.js";import{n as l,t as u}from"./settings-page-layout-Da_LNPDS.js";import{t as d}from"./settings-advanced-gate-DNDBN4nT.js";var f=e(),p=t();function m(){return n(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var h={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function g(e){let t=(0,f.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,p.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,p.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let m;t[12]===o?m=t[13]:(m=(0,p.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,p.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,m,h]}),t[16]=c,t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,p.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function _(e){let t=(0,f.c)(8),{scheme:n}=e,{light:r,dark:i}=h[n],a;t[0]===r?a=t[1]:(a=(0,p.jsx)(g,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,p.jsx)(g,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,p.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var v=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function y(){let e=(0,f.c)(18),t=i(S),o;e[0]===t?o=e[1]:(o=r(t),e[0]=t,e[1]=o);let s=o.appearanceSettings,l=a(x),u=a(b),d;e[2]===s.colorSchemeTitle?d=e[3]:(d=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:s.colorSchemeTitle}),e[2]=s.colorSchemeTitle,e[3]=d);let m;e[4]===s.colorSchemeDescription?m=e[5]:(m=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.colorSchemeDescription}),e[4]=s.colorSchemeDescription,e[5]=m);let h;e[6]!==d||e[7]!==m?(h=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),e[6]=d,e[7]=m,e[8]=h):h=e[8];let g;e[9]!==s||e[10]!==l||e[11]!==u?(g=v.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>u(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,c.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,p.jsx)(_,{scheme:t}),(0,p.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:s[r]})]},t)}),e[9]=s,e[10]=l,e[11]=u,e[12]=g):g=e[12];let y;e[13]===g?y=e[14]:(y=(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:g}),e[13]=g,e[14]=y);let C;return e[15]!==h||e[16]!==y?(C=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 px-3 py-3.5 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=s(T),c=s(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===c?_=e[17]:(_=e=>c(e.target.checked),e[16]=c,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,s;e[2]!==a.pageTitle||e[3]!==a.subtitle?(s=(0,p.jsx)(l,{title:a.pageTitle,subtitle:a.subtitle}),e[2]=a.pageTitle,e[3]=a.subtitle,e[4]=s):s=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=m(),e[5]=c):c=e[5];let h;e[6]===a.languageTitle?h=e[7]:(h=(0,p.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[6]=a.languageTitle,e[7]=h);let g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,p.jsx)(o,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:c,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[9]=h,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=m(),e[11]=v):v=e[11];let b;e[12]===a.themeTitle?b=e[13]:(b=(0,p.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[12]=a.themeTitle,e[13]=b);let x,S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(o,{variant:`page`,sections:[`theme`,`font`]}),S=(0,p.jsx)(y,{}),e[14]=x,e[15]=S):(x=e[14],S=e[15]);let w;e[16]===b?w=e[17]:(w=(0,p.jsxs)(`section`,{className:v,"aria-labelledby":`pref-appearance-heading`,children:[b,x,S]}),e[16]=b,e[17]=w);let T;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(),e[18]=T):T=e[18];let E;e[19]===a.developerGroupTitle?E=e[20]:(E=(0,p.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[19]=a.developerGroupTitle,e[20]=E);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,p.jsx)(C,{}),e[21]=D):D=e[21];let k;e[22]===E?k=e[23]:(k=(0,p.jsx)(d,{children:(0,p.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[E,D]})}),e[22]=E,e[23]=k);let A;return e[24]!==s||e[25]!==w||e[26]!==k||e[27]!==_?(A=(0,p.jsxs)(u,{gap:`gap-6`,children:[s,_,w,k]}),e[24]=s,e[25]=w,e[26]=k,e[27]=_,e[28]=A):A=e[28],A}function O(e){return e.language}export{D as AppearanceSettingsPanel};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-CQ_k8RHj.js";import{n as i}from"./locale-store-Ba72bFmP.js";import{i as a}from"./theme-store-Bt6vAkSB.js";import{$a as o,bo as s,ot as c}from"./index-DZOm5_ex.js";import{n as l,t as u}from"./settings-page-layout-CrICyGob.js";import{t as d}from"./settings-advanced-gate-4e8ZQwxr.js";var f=e(),p=t();function m(){return n(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var h={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function g(e){let t=(0,f.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,p.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,p.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let m;t[12]===o?m=t[13]:(m=(0,p.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,p.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,m,h]}),t[16]=c,t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,p.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function _(e){let t=(0,f.c)(8),{scheme:n}=e,{light:r,dark:i}=h[n],a;t[0]===r?a=t[1]:(a=(0,p.jsx)(g,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,p.jsx)(g,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,p.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var v=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function y(){let e=(0,f.c)(18),t=i(S),o;e[0]===t?o=e[1]:(o=r(t),e[0]=t,e[1]=o);let c=o.appearanceSettings,l=a(x),u=a(b),d;e[2]===c.colorSchemeTitle?d=e[3]:(d=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:c.colorSchemeTitle}),e[2]=c.colorSchemeTitle,e[3]=d);let m;e[4]===c.colorSchemeDescription?m=e[5]:(m=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.colorSchemeDescription}),e[4]=c.colorSchemeDescription,e[5]=m);let h;e[6]!==d||e[7]!==m?(h=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),e[6]=d,e[7]=m,e[8]=h):h=e[8];let g;e[9]!==c||e[10]!==l||e[11]!==u?(g=v.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>u(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,s.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,p.jsx)(_,{scheme:t}),(0,p.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:c[r]})]},t)}),e[9]=c,e[10]=l,e[11]=u,e[12]=g):g=e[12];let y;e[13]===g?y=e[14]:(y=(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:g}),e[13]=g,e[14]=y);let C;return e[15]!==h||e[16]!==y?(C=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 px-3 py-3.5 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=c(T),s=c(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===s?_=e[17]:(_=e=>s(e.target.checked),e[16]=s,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,s;e[2]!==a.pageTitle||e[3]!==a.subtitle?(s=(0,p.jsx)(l,{title:a.pageTitle,subtitle:a.subtitle}),e[2]=a.pageTitle,e[3]=a.subtitle,e[4]=s):s=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=m(),e[5]=c):c=e[5];let h;e[6]===a.languageTitle?h=e[7]:(h=(0,p.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[6]=a.languageTitle,e[7]=h);let g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,p.jsx)(o,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:c,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[9]=h,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=m(),e[11]=v):v=e[11];let b;e[12]===a.themeTitle?b=e[13]:(b=(0,p.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[12]=a.themeTitle,e[13]=b);let x,S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(o,{variant:`page`,sections:[`theme`,`font`]}),S=(0,p.jsx)(y,{}),e[14]=x,e[15]=S):(x=e[14],S=e[15]);let w;e[16]===b?w=e[17]:(w=(0,p.jsxs)(`section`,{className:v,"aria-labelledby":`pref-appearance-heading`,children:[b,x,S]}),e[16]=b,e[17]=w);let T;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(),e[18]=T):T=e[18];let E;e[19]===a.developerGroupTitle?E=e[20]:(E=(0,p.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[19]=a.developerGroupTitle,e[20]=E);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,p.jsx)(C,{}),e[21]=D):D=e[21];let k;e[22]===E?k=e[23]:(k=(0,p.jsx)(d,{children:(0,p.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[E,D]})}),e[22]=E,e[23]=k);let A;return e[24]!==s||e[25]!==w||e[26]!==k||e[27]!==_?(A=(0,p.jsxs)(u,{gap:`gap-6`,children:[s,_,w,k]}),e[24]=s,e[25]=w,e[26]=k,e[27]=_,e[28]=A):A=e[28],A}function O(e){return e.language}export{D as AppearanceSettingsPanel};
@@ -0,0 +1 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-CQ_k8RHj.js";import{a as o,n as s,o as c,t as l}from"./fetch-BWXmBizE.js";import{n as u}from"./locale-store-Ba72bFmP.js";import{a as d,i as f}from"./vendor-swr-BIWyz7Rc.js";import{Ac as p,Ca as m,Cs as h,Dt as g,Eo as _,Ga as v,Ha as y,Ka as b,Ks as x,Ps as S,Sa as C,Ua as w,Va as T,Vo as E,Wa as D,al as O,ba as k,el as A,kl as j,ko as M,os as N,qa as P,qn as F,si as ee,us as I,vl as L,wl as R,xa as z,ya as B}from"./index-DZOm5_ex.js";import{t as V}from"./page-tabs-CVLqCfQB.js";var H=e(t(),1),U=n();function W(e){return e===`builtin`||e===`user`?e:`marketplace`}async function G(e){try{let t=await e.json();if(typeof t.error==`string`)return t.error;if(t.error&&typeof t.error==`object`&&typeof t.error.message==`string`)return t.error.message;if(typeof t.message==`string`)return t.message}catch{}return e.statusText||`HTTP ${e.status}`}async function te(e){let t=await l(c(`/api/marketplace/packages/${encodeURIComponent(e.trim())}`),{cache:`no-store`});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.id)throw Error(n.error??`Invalid response`);return n.payload}async function K(e){let t=await l(c(`/api/marketplace/install`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload?.extensionId)throw Error(n.error??`Invalid response`);return n.payload}async function q(e){let t=await l(c(`/api/extensions/bundled/activation`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e.extensionId.trim(),enabled:e.enabled})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error?.message??`Invalid response`);return n.payload}async function J(e){let t=await l(c(`/api/marketplace/uninstall`),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({extensionId:e})});if(!t.ok)throw Error(await G(t));let n=await t.json();if(!n.ok||!n.payload)throw Error(n.error??`Invalid response`);return n.payload}var Y=r();function X(e,t){let n=e.find(e=>e.id===t);return n?n.source===`bundled`?`bundled`:`user`:`absent`}var ne={q:``,debounced:``,detailPkg:null,rowBusy:null,actionError:null,restartHint:null};function re({className:e}){let t=a(u(e=>e.language)).extensionsPage,n=o(e=>!!e.token),r=k(),{mutate:l}=d(),[p,m]=(0,H.useReducer)(g,ne),{q:h,debounced:_,detailPkg:v,rowBusy:y,actionError:b,restartHint:C}=p,w=n?`marketplace-${_}`:null;(0,H.useEffect)(()=>{let e=window.setTimeout(()=>m({type:`patch`,patch:{debounced:h.trim()}}),300);return()=>window.clearTimeout(e)},[h]);let{data:T,isLoading:D,error:O}=f(w,async()=>s(_.length>0?c(`/api/marketplace?q=${encodeURIComponent(_)}`):c(`/api/marketplace`)),{revalidateOnFocus:!1}),j=(0,H.useCallback)(()=>{l(`gateway-extensions-list`),F()},[l]),M=(0,H.useCallback)(async(e,n)=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let r=await K({name:e,overwrite:n});j(),r.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceInstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceInstallFailed,t.marketplaceRestartHint,j]),N=(0,H.useCallback)(async e=>{m({type:`patch`,patch:{actionError:null,restartHint:null,rowBusy:e}});try{let n=await J(e);j(),n.requiresGatewayRestart&&m({type:`patch`,patch:{restartHint:t.marketplaceRestartHint}})}catch(e){throw m({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.marketplaceUninstallFailed}}),e}finally{m({type:`patch`,patch:{rowBusy:null}})}},[t.marketplaceRestartHint,t.marketplaceUninstallFailed,j]),P=T?.extensions??[];return(0,Y.jsxs)(`div`,{className:i(`flex flex-col gap-4`,e),children:[(0,Y.jsxs)(`div`,{className:`relative`,children:[(0,Y.jsx)(I,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:h,onChange:e=>m({type:`patch`,patch:{q:e.target.value}}),placeholder:t.marketplaceSearchPlaceholder,className:`ui-input h-10 w-full rounded-lg border border-edge bg-surface-base pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted`})]}),O?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:O instanceof Error?O.message:t.marketplaceLoadFailed}):null,b?(0,Y.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:b}):null,C?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:C}):null,D&&!T?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):(0,Y.jsx)(`ul`,{className:`flex flex-col gap-3`,children:P.length===0?(0,Y.jsx)(`li`,{className:`text-sm text-fg-muted`,children:t.marketplaceEmpty}):P.map(e=>{let n=X(r,e.id),a=y===e.id;return(0,Y.jsx)(`li`,{className:`list-none`,children:(0,Y.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-label":`${e.name}, ${t.marketplaceDetailTitle}`,onClick:()=>m({type:`patch`,patch:{detailPkg:e.id}}),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),m({type:`patch`,patch:{detailPkg:e.id}}))},className:i(`flex w-full cursor-pointer flex-wrap items-start gap-3 rounded-xl bg-surface-panel p-4 text-left shadow-surface`,`transition-[transform,background-color,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/40`,`active:scale-[0.992] active:bg-surface-hover/55`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:hover:bg-surface-hover/25 dark:active:bg-surface-hover/35`),children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Y.jsx)(`h3`,{className:`font-semibold text-fg`,children:e.name}),e.verified?(0,Y.jsx)(A,{className:`size-4 shrink-0 text-emerald-600 dark:text-emerald-400`,strokeWidth:1.75,"aria-label":`Verified`}):null,e.version?(0,Y.jsx)(`span`,{className:`text-xs text-fg-muted`,children:e.version}):null]}),e.description?(0,Y.jsx)(`p`,{className:`mt-1 line-clamp-2 text-sm text-fg-muted`,children:e.description}):null,(0,Y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:(e.categories??[]).map(e=>(0,Y.jsx)(`span`,{className:`rounded-md border border-edge bg-surface-panel px-2 py-0.5 text-[11px] text-fg-muted`,children:e},e))}),(0,Y.jsxs)(`p`,{className:`mt-2 flex items-center gap-1.5 text-xs text-fg-muted`,children:[(0,Y.jsx)(S,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:e.npmPackage})]})]}),(0,Y.jsx)(`div`,{role:`group`,className:`flex shrink-0 flex-col items-end gap-2 sm:min-w-[9rem]`,onClick:e=>e.stopPropagation(),onKeyDown:e=>e.stopPropagation(),children:n===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-2 py-1 text-[11px] font-medium text-fg-muted`,children:t.marketplaceBuiltin}):n===`user`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{className:`text-[11px] font-medium text-fg-muted`,children:t.marketplaceInstalled}),(0,Y.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{window.confirm(t.marketplaceUninstallConfirm)&&N(e.id).catch(()=>{})},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-xs font-medium text-fg`,`transition-colors active:scale-[0.98] active:bg-surface-hover/80`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,Y.jsx)(x,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):(0,Y.jsx)(E,{className:`size-3.5`,strokeWidth:2,"aria-hidden":!0}),t.marketplaceUninstall]})]}):(0,Y.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>{M(e.id,!1).catch(()=>{})},className:i(`inline-flex w-full items-center justify-center rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white`,`shadow-surface transition-[transform,background-color] active:scale-[0.98]`,`hover:bg-accent-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`disabled:pointer-events-none disabled:opacity-50`),children:[a?(0,Y.jsx)(x,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,t.marketplaceInstall]})})]})},e.id)})}),v?(0,Y.jsx)(ie,{packageName:v,copy:t,extensions:r,onClose:()=>m({type:`patch`,patch:{detailPkg:null}}),onInstall:M,onUninstall:N}):null]})}function ie(e){let t=(0,U.c)(61),{packageName:n,copy:r,extensions:a,onClose:s,onInstall:c,onUninstall:l}=e,[u,d]=(0,H.useState)(!1),p=o(ce)?`ext-mp-detail-${n}`:null,m;t[0]===n?m=t[1]:(m=async()=>te(n),t[0]=n,t[1]=m);let h;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(h={revalidateOnFocus:!1},t[2]=h):h=t[2];let{data:g,error:_,isLoading:y}=f(p,m,h),S;t[3]!==a||t[4]!==n?(S=X(a,n),t[3]=a,t[4]=n,t[5]=S):S=t[5];let C=S,O=C===`user`,k;t[6]!==r.marketplaceNoReadme||t[7]!==g?(k=g?.readme?.trim()||(g?.description?.trim()?`### ${g.name}\n\n${g.description}`:`*${r.marketplaceNoReadme}*`),t[6]=r.marketplaceNoReadme,t[7]=g,t[8]=k):k=t[8];let A=k,j;t[9]===s?j=t[10]:(j=e=>!e&&s(),t[9]=s,t[10]=j);let N;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Y.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[11]=N):N=t[11];let P;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Y.jsx)(L,{className:`size-5`}),t[12]=P):P=t[12];let F;t[13]!==r.detailBack||t[14]!==s?(F=(0,Y.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailBack,children:P}),t[13]=r.detailBack,t[14]=s,t[15]=F):F=t[15];let I;t[16]===r.marketplaceDetailTitle?I=t[17]:(I=(0,Y.jsx)(b,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:r.marketplaceDetailTitle}),t[16]=r.marketplaceDetailTitle,t[17]=I);let z;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Y.jsx)(M,{className:`size-5`}),t[18]=z):z=t[18];let B;t[19]!==r.detailClose||t[20]!==s?(B=(0,Y.jsx)(`button`,{type:`button`,onClick:s,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":r.detailClose,children:z}),t[19]=r.detailClose,t[20]=s,t[21]=B):B=t[21];let V;t[22]!==B||t[23]!==F||t[24]!==I?(V=(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[F,I,B]}),t[22]=B,t[23]=F,t[24]=I,t[25]=V):V=t[25];let W;t[26]!==r.marketplaceAuthor||t[27]!==r.marketplaceDetailLoadFailed||t[28]!==r.marketplaceDetailReadmeHeading||t[29]!==r.marketplaceDownloads||t[30]!==r.marketplaceVersion||t[31]!==g||t[32]!==_||t[33]!==y||t[34]!==A?(W=y&&!g?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:`…`}):_?(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:r.marketplaceDetailLoadFailed}):g?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:g.name}),(0,Y.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:(0,Y.jsx)(`code`,{className:`rounded bg-surface-panel px-1 py-0.5`,children:g.id})}),(0,Y.jsxs)(`dl`,{className:`mt-3 grid gap-2 text-xs text-fg-muted sm:grid-cols-2`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceAuthor}),(0,Y.jsx)(`dd`,{children:g.author.username})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceVersion}),(0,Y.jsx)(`dd`,{children:g.latestVersion.version})]}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`dt`,{className:`font-medium text-fg`,children:r.marketplaceDownloads}),(0,Y.jsx)(`dd`,{children:g.downloads})]})]}),g.readme?.trim()?(0,Y.jsx)(`h4`,{className:`mb-2 mt-6 text-sm font-semibold text-fg`,children:r.marketplaceDetailReadmeHeading}):null,(0,Y.jsx)(`div`,{className:`markdown-content min-w-0 break-words text-sm`,children:(0,Y.jsx)(ee,{content:A})})]}):null,t[26]=r.marketplaceAuthor,t[27]=r.marketplaceDetailLoadFailed,t[28]=r.marketplaceDetailReadmeHeading,t[29]=r.marketplaceDownloads,t[30]=r.marketplaceVersion,t[31]=g,t[32]=_,t[33]=y,t[34]=A,t[35]=W):W=t[35];let G;t[36]===W?G=t[37]:(G=(0,Y.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:W}),t[36]=W,t[37]=G);let K;t[38]!==u||t[39]!==r.marketplaceBuiltinGoBuiltin||t[40]!==r.marketplaceBuiltinManageHint||t[41]!==r.marketplaceInstall||t[42]!==r.marketplaceReinstall||t[43]!==r.marketplaceReinstallConfirm||t[44]!==r.marketplaceUninstall||t[45]!==r.marketplaceUninstallConfirm||t[46]!==g||t[47]!==C||t[48]!==s||t[49]!==c||t[50]!==l||t[51]!==n||t[52]!==O?(K=g?(0,Y.jsx)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:C===`bundled`?(0,Y.jsxs)(`div`,{className:`flex w-full flex-col items-stretch gap-2`,children:[(0,Y.jsx)(`p`,{className:`text-sm leading-relaxed text-fg-muted`,children:r.marketplaceBuiltinManageHint}),(0,Y.jsx)(R,{to:`/extensions?tab=builtin`,onClick:s,className:`inline-flex w-fit items-center justify-center rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:r.marketplaceBuiltinGoBuiltin})]}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{O&&!window.confirm(r.marketplaceReinstallConfirm)||(d(!0),c(n,O).catch(oe).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium`,`bg-accent text-white shadow-surface hover:bg-accent-hover`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`disabled:pointer-events-none disabled:opacity-50`),children:[u?(0,Y.jsx)(x,{className:`size-4 animate-spin`,"aria-hidden":!0}):null,O?r.marketplaceReinstall:r.marketplaceInstall]}),O?(0,Y.jsxs)(`button`,{type:`button`,disabled:u,onClick:()=>{window.confirm(r.marketplaceUninstallConfirm)&&(d(!0),l(n).then(()=>s()).catch(ae).finally(()=>d(!1)))},className:i(`inline-flex items-center justify-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`disabled:pointer-events-none disabled:opacity-50`),children:[(0,Y.jsx)(E,{className:`size-4 shrink-0`,"aria-hidden":!0}),r.marketplaceUninstall]}):null]})}):null,t[38]=u,t[39]=r.marketplaceBuiltinGoBuiltin,t[40]=r.marketplaceBuiltinManageHint,t[41]=r.marketplaceInstall,t[42]=r.marketplaceReinstall,t[43]=r.marketplaceReinstallConfirm,t[44]=r.marketplaceUninstall,t[45]=r.marketplaceUninstallConfirm,t[46]=g,t[47]=C,t[48]=s,t[49]=c,t[50]=l,t[51]=n,t[52]=O,t[53]=K):K=t[53];let q;t[54]!==V||t[55]!==G||t[56]!==K?(q=(0,Y.jsxs)(D,{children:[N,(0,Y.jsxs)(T,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:se,children:[V,G,K]})]}),t[54]=V,t[55]=G,t[56]=K,t[57]=q):q=t[57];let J;return t[58]!==q||t[59]!==j?(J=(0,Y.jsx)(v,{defaultOpen:!0,onOpenChange:j,children:q}),t[58]=q,t[59]=j,t[60]=J):J=t[60],J}function ae(){}function oe(){}function se(e){return e.preventDefault()}function ce(e){return!!e.token}function le(){let e=u(e=>e.language),t=a(e),n=P(e=>e.setPageHeader),r=P(e=>e.clearPageHeader),i=k(),o=z(),[s,c]=j(),l=W(s.get(`tab`)),d=s.get(`q`)??``,[f,p]=(0,H.useState)(l),[m,h]=(0,H.useState)(d),[g,_]=(0,H.useState)(null),v=s.toString(),y=(0,H.useRef)(v);if(y.current!==v){y.current=v;let e=W(s.get(`tab`)),t=s.get(`q`)??``;p(t=>t===e?t:e),h(e=>e===t?e:t)}(0,H.useEffect)(()=>{c(e=>{let t=new URLSearchParams(e),n=m.trim();return n?t.set(`q`,n):t.delete(`q`),f===`marketplace`?t.delete(`tab`):t.set(`tab`,f),t.toString()===e.toString()?e:t},{replace:!0})},[f,m,c]);let b=(0,H.useMemo)(()=>i.filter(e=>e.source===`bundled`),[i]),x=(0,H.useMemo)(()=>i.filter(e=>e.source!==`bundled`),[i]),S=f===`builtin`?b:x,C=(0,H.useMemo)(()=>{let t=m.trim().toLowerCase(),n=S;return t&&(n=n.filter(e=>(e.name??``).toLowerCase().includes(t)||e.id.toLowerCase().includes(t)||(e.description??``).toLowerCase().includes(t))),n.toSorted((t,n)=>t.hasUi===n.hasUi?(t.name||t.id).localeCompare(n.name||n.id,e):t.hasUi?-1:1)},[S,m,e]);if((0,H.useEffect)(()=>{_(e=>{if(!e)return e;let t=i.find(t=>t.id===e.id);return t?Z(e)===Z(t)&&e.active===t.active?e:t:null})},[i]),(0,H.useLayoutEffect)(()=>(n({startExtra:null,main:(0,Y.jsx)(`div`,{className:`min-w-0`,children:(0,Y.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.extensionsPage.title})}),end:null}),()=>r()),[r,t.extensionsPage.title,n]),o&&f!==`marketplace`)return(0,Y.jsx)(me,{});let w=f!==`marketplace`&&S.length>0;return(0,Y.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[(0,Y.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[(0,Y.jsxs)(`div`,{className:`mb-5 flex flex-col gap-3 rounded-xl border border-edge-subtle bg-surface-base px-3 py-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Y.jsx)(V,{items:[{id:`marketplace`,label:t.extensionsPage.tabMarketplace},{id:`builtin`,label:t.extensionsPage.tabBuiltin,count:b.length},{id:`user`,label:t.extensionsPage.tabUser,count:x.length}],activeTab:f,onChange:p,ariaLabel:t.extensionsPage.extensionsNavAria,tabIdPrefix:`extensions-tab`,panelIdPrefix:`extensions-panel`,className:`flex-wrap`}),w?(0,Y.jsxs)(`div`,{className:`relative w-full min-w-0 sm:max-w-xs`,children:[(0,Y.jsx)(I,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-muted`,"aria-hidden":!0}),(0,Y.jsx)(`input`,{type:`search`,value:m,onChange:e=>h(e.target.value),placeholder:t.extensionsPage.searchPlaceholder,className:`w-full rounded-lg border border-edge bg-surface-base py-2 pl-9 pr-3 text-sm text-fg placeholder:text-fg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,autoComplete:`off`})]}):null]}),f===`marketplace`?(0,Y.jsx)(re,{}):f===`builtin`&&b.length===0?(0,Y.jsx)(ge,{message:t.extensionsPage.emptyBuiltin}):f===`user`&&x.length===0?(0,Y.jsx)(ge,{message:t.extensionsPage.emptyUser}):C.length===0?(0,Y.jsx)(`p`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-3 py-8 text-center text-sm text-fg-muted shadow-surface sm:px-5 xl:px-6`,children:t.extensionsPage.noSearchResults}):(0,Y.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:C.map(e=>(0,Y.jsx)(fe,{extension:e,copy:t.extensionsPage,showSourceBadge:f===`user`,onOpen:()=>_(e)},e.id))})]}),g?(0,Y.jsx)(pe,{extension:g,copy:t.extensionsPage,onClose:()=>_(null)},g.id):null]})}function Z(e){return e.activationEligible??e.active}function Q(e,t){return e.source===`bundled`?t.providerBundled:e.source===`global`?t.providerGlobal:e.source===`workspace`?t.providerWorkspace:t.providerOther}function ue(e,t){return e.source===`global`?t.badgeSourceGlobal:e.source===`workspace`?t.badgeSourceWorkspace:t.badgeSourceOther}function de(e,t){let n=Z(e);return n&&e.active?t.runStateLive:n&&!e.active?t.runStatePendingOn:!n&&e.active?t.runStatePendingOff:t.runStateOff}function fe(e){let t=(0,U.c)(45),{extension:n,copy:r,showSourceBadge:a,onOpen:o}=e,s;t[0]===n?s=t[1]:(s=Z(n),t[0]=n,t[1]=s);let c=s,l=n.hasUi?r.cardTooltipHasUi:r.cardTooltipNoUi,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=i(`group flex w-full flex-col rounded-xl border border-edge-subtle bg-surface-base p-4 text-left shadow-surface transition-colors`,`hover:bg-surface-hover/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,`dark:hover:bg-surface-hover/25`),t[2]=u):u=t[2];let d=n.name||n.id,f;t[3]===d?f=t[4]:(f=d.charAt(0).toUpperCase(),t[3]=d,t[4]=f);let p;t[5]===f?p=t[6]:(p=(0,Y.jsx)(`div`,{className:`flex size-12 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-base font-semibold text-accent-fg`,"aria-hidden":!0,children:f}),t[5]=f,t[6]=p);let m;t[7]===n.name?m=t[8]:(m=(0,Y.jsx)(`h2`,{className:`truncate text-sm font-semibold text-fg`,children:n.name}),t[7]=n.name,t[8]=m);let g;t[9]===n.version?g=t[10]:(g=n.version?(0,Y.jsxs)(`span`,{className:`text-[11px] text-fg-muted`,children:[`v`,n.version]}):null,t[9]=n.version,t[10]=g);let _;t[11]!==m||t[12]!==g?(_=(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[m,g]}),t[11]=m,t[12]=g,t[13]=_):_=t[13];let v;t[14]!==r.statusEnabled||t[15]!==c?(v=c?(0,Y.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[(0,Y.jsx)(O,{className:`size-3`,strokeWidth:2.5,"aria-hidden":!0}),r.statusEnabled]}):(0,Y.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full border-2 border-accent text-accent`,"aria-hidden":!0,children:(0,Y.jsx)(h,{className:`size-4`,strokeWidth:2.5})}),t[14]=r.statusEnabled,t[15]=c,t[16]=v):v=t[16];let y;t[17]!==_||t[18]!==v?(y=(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[_,v]}),t[17]=_,t[18]=v,t[19]=y):y=t[19];let b;t[20]!==r.cardNoDescription||t[21]!==n.description?(b=n.description?.trim()||r.cardNoDescription,t[20]=r.cardNoDescription,t[21]=n.description,t[22]=b):b=t[22];let x;t[23]===b?x=t[24]:(x=(0,Y.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-relaxed text-fg-muted`,children:b}),t[23]=b,t[24]=x);let S=n.hasUi?r.badgeKindUi:r.badgeKindBackend,C;t[25]!==S||t[26]!==l?(C=(0,Y.jsx)(`span`,{title:l,className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:S}),t[25]=S,t[26]=l,t[27]=C):C=t[27];let w;t[28]!==r||t[29]!==n||t[30]!==a?(w=n.source===`bundled`?(0,Y.jsx)(`span`,{className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:r.badgeBundled}):a?(0,Y.jsx)(`span`,{title:Q(n,r),className:`rounded-md bg-surface-hover px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-fg-muted`,children:ue(n,r)}):null,t[28]=r,t[29]=n,t[30]=a,t[31]=w):w=t[31];let T;t[32]!==C||t[33]!==w?(T=(0,Y.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:[C,w]}),t[32]=C,t[33]=w,t[34]=T):T=t[34];let E;t[35]!==y||t[36]!==x||t[37]!==T?(E=(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[y,x,T]}),t[35]=y,t[36]=x,t[37]=T,t[38]=E):E=t[38];let D;t[39]!==E||t[40]!==p?(D=(0,Y.jsxs)(`div`,{className:`flex gap-3`,children:[p,E]}),t[39]=E,t[40]=p,t[41]=D):D=t[41];let k;return t[42]!==o||t[43]!==D?(k=(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:u,children:D}),t[42]=o,t[43]=D,t[44]=k):k=t[44],k}function pe({extension:e,copy:t,onClose:n}){let{mutate:r}=d(),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(null),[l,u]=(0,H.useState)(!1),f=e.activationEligible===!0,h=(0,H.useCallback)(async()=>{if(e.source===`bundled`){c(null),u(!1),o(!0);try{let{requiresGatewayRestart:t}=await q({extensionId:e.id,enabled:!f});await r(`gateway-extensions-list`),F(),u(t)}catch(e){c(e instanceof Error?e.message:t.builtinToggleFailed)}finally{o(!1)}}},[f,t.builtinToggleFailed,e.id,e.source,r]),g=e.ui?.contributions?.pages??[],S=e.ui?.contributions?.settingsPanels??[],E=e.ui?.contributions?.chatWidgets??[],O=e.ui?.contributions?.sidebarPanels??[],k=g.find(e=>e.showInNav)??g[0],A=S[0],j=k?B(e.id,k):null,P=A?`/settings/ext/${e.id}/${A.id}`:e.hasConfigSchema||C(e)?`/settings/ext/${e.id}`:null;return(0,Y.jsx)(v,{defaultOpen:!0,onOpenChange:e=>!e&&n(),children:(0,Y.jsxs)(D,{children:[(0,Y.jsx)(w,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),(0,Y.jsxs)(T,{className:`fixed left-1/2 top-1/2 z-[131] flex max-h-[min(90vh,44rem)] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailBack,children:(0,Y.jsx)(L,{className:`size-5`})}),(0,Y.jsx)(b,{className:`min-w-0 flex-1 truncate text-center text-sm font-semibold text-fg`,children:t.detailTitle}),(0,Y.jsxs)(y,{className:`sr-only`,children:[e.name,` (`,e.id,`)`]}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":t.detailClose,children:(0,Y.jsx)(M,{className:`size-5`})})]}),(0,Y.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4`,children:[(0,Y.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl bg-accent-soft text-xl font-semibold text-accent-fg`,"aria-hidden":!0,children:(e.name||e.id).charAt(0).toUpperCase()}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`h3`,{className:`text-lg font-semibold text-fg`,children:e.name}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-sm text-fg-muted`,children:[t.detailProviderPrefix,` `,Q(e,t)]}),e.version?(0,Y.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[`v`,e.version]}):null]})]}),(0,Y.jsx)(`p`,{className:`mt-5 text-sm leading-relaxed text-fg`,children:e.description?.trim()||t.detailNoDescription}),e.hasUi?null:(0,Y.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:t.backendOnlyHint}),(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:de(e,t)}),e.source===`bundled`?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.builtinConfigHint}),(0,Y.jsxs)(`div`,{className:`mt-3 rounded-lg bg-surface-hover/40 p-3 shadow-surface dark:bg-surface-hover/20`,children:[(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:t.builtinRuntimeToggle}),(0,Y.jsx)(_,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>void h(),className:`shrink-0 py-1.5 text-xs`,children:a?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(x,{className:`mr-1.5 size-3.5 shrink-0 animate-spin`,"aria-hidden":!0}),t.builtinToggleBusy]}):f?t.builtinToggleDisable:t.builtinToggleEnable})]}),s?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-rose-600 dark:text-rose-400`,children:s}):null,l?(0,Y.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.builtinToggleRestartHint}):null]})]}):(0,Y.jsx)(`p`,{className:`mt-4 rounded-lg bg-surface-hover/40 px-3 py-2 text-xs text-fg-muted shadow-surface dark:bg-surface-hover/20`,children:t.cliManageHint}),e.hasUi&&(g.length>0||S.length>0||E.length>0)?(0,Y.jsxs)(`section`,{className:`mt-8`,children:[(0,Y.jsx)(`h4`,{className:`mb-3 text-sm font-semibold text-fg`,children:t.detailSectionFeatures}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,Y.jsx)($,{template:t.badgePages,count:g.length,hidden:g.length===0}),(0,Y.jsx)($,{template:t.badgeSettings,count:S.length,hidden:S.length===0}),(0,Y.jsx)($,{template:t.badgeWidgets,count:E.length,hidden:E.length===0}),(0,Y.jsx)($,{template:t.badgeSidebar,count:O.length,hidden:O.length===0})]})]}):null,m(e)&&(j||P)?(0,Y.jsxs)(`div`,{className:`mt-6 flex flex-wrap gap-2 border-t border-edge-subtle pt-4`,children:[j?(0,Y.jsxs)(R,{to:j,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(p,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.open]}):null,P?(0,Y.jsxs)(R,{to:P,onClick:n,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge px-3 py-2 text-sm font-medium text-fg`,`hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),children:[(0,Y.jsx)(N,{className:`size-4 shrink-0 opacity-80`,"aria-hidden":!0}),t.openSettings]}):null]}):null,(0,Y.jsx)(`p`,{className:`mt-6 text-[11px] leading-relaxed text-fg-muted`,children:t.restartNote})]})]})]})})}function $(e){let t=(0,U.c)(6),{template:n,count:r,hidden:i}=e;if(i||r===0)return null;let a;if(t[0]!==r||t[1]!==n){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\{\{count\}\}/g,t[3]=e):e=t[3],a=n.replace(e,String(r)),t[0]=r,t[1]=n,t[2]=a}else a=t[2];let o;return t[4]===a?o=t[5]:(o=(0,Y.jsx)(`span`,{className:`inline-flex items-center rounded-md bg-surface-hover px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:a}),t[4]=a,t[5]=o),o}function me(){let e=(0,U.c)(5),t,n,r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Y.jsx)(`div`,{className:`mb-6 h-8 w-40 max-w-full animate-pulse rounded-md bg-surface-hover`}),n=(0,Y.jsx)(`div`,{className:`mb-2 h-4 w-full max-w-md animate-pulse rounded bg-surface-hover`}),r=(0,Y.jsx)(`div`,{className:`mb-5 h-9 w-full max-w-lg animate-pulse rounded-full bg-surface-hover`}),e[0]=t,e[1]=n,e[2]=r):(t=e[0],n=e[1],r=e[2]);let i;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(i=[`ap0`,`ap1`,`ap2`,`ap3`,`ap4`,`ap5`],e[3]=i):i=e[3];let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Y.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:(0,Y.jsxs)(`div`,{className:`w-full px-3 py-8 sm:px-5 xl:px-6`,children:[t,n,r,(0,Y.jsx)(`div`,{className:`mt-6 grid gap-4 sm:grid-cols-2 lg:grid-cols-3`,children:i.map(he)})]})}),e[4]=a):a=e[4],a}function he(e){return(0,Y.jsx)(`div`,{className:`h-36 animate-pulse rounded-xl border border-edge-subtle bg-surface-base shadow-surface`},e)}function ge(e){let t=(0,U.c)(2),{message:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Y.jsx)(`div`,{className:`flex min-h-[min(40vh,16rem)] flex-col items-center justify-center rounded-xl border border-edge-subtle bg-surface-base px-4 py-12 text-center shadow-surface`,children:(0,Y.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n})}),t[0]=n,t[1]=r),r}export{le as ExtensionsPage};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-DR9ODkb8.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-B50PdIc8.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./messages-CQ_k8RHj.js";import{t as a}from"./jszip.min-DT31yWkU.js";import{t as o}from"./preview-open-alternatives-CKUXJk2t.js";var s=n(),c=e(a(),1),l=e(t(),1),u=r();function d(e){let t=(0,s.c)(17),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=[],t[0]=n):n=t[0];let[r,a]=(0,l.useState)(n),[d,m]=(0,l.useState)(null),h,g;if(t[1]===e.binaryBuffer?(h=t[2],g=t[3]):(h=()=>{if(!e.binaryBuffer)return;let t=!1;return c.default.loadAsync(e.binaryBuffer).then(e=>{t||a(Object.values(e.files).slice(0,500).map(p))}).catch(e=>{t||m(e instanceof Error?e.message:String(e))}),()=>{t=!0}},g=[e.binaryBuffer],t[1]=e.binaryBuffer,t[2]=h,t[3]=g),(0,l.useEffect)(h,g),d){let n;t[4]===e.language?n=t[5]:(n=i(e.language),t[4]=e.language,t[5]=n);let r=n,a;t[6]!==r.chat.attachmentPreviewDownloadFull||t[7]!==r.chat.attachmentPreviewOpenElsewhereHint||t[8]!==e.actions.onDownload?(a=(0,u.jsx)(o,{message:r.chat.attachmentPreviewOpenElsewhereHint,downloadLabel:r.chat.attachmentPreviewDownloadFull,onDownload:e.actions.onDownload}),t[6]=r.chat.attachmentPreviewDownloadFull,t[7]=r.chat.attachmentPreviewOpenElsewhereHint,t[8]=e.actions.onDownload,t[9]=a):a=t[9];let s;t[10]===d?s=t[11]:(s=(0,u.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:d}),t[10]=d,t[11]=s);let c;return t[12]!==a||t[13]!==s?(c=(0,u.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:[a,s]}),t[12]=a,t[13]=s,t[14]=c):c=t[14],c}let _;return t[15]===r?_=t[16]:(_=(0,u.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto p-4`,children:(0,u.jsx)(`div`,{className:`overflow-hidden rounded-lg border border-edge bg-surface-panel`,children:r.length===0?(0,u.jsx)(`p`,{className:`p-4 text-sm text-fg-muted`,children:`Loading archive...`}):(0,u.jsx)(`table`,{className:`w-full text-left text-xs`,children:(0,u.jsx)(`tbody`,{children:r.map(f)})})})}),t[15]=r,t[16]=_),_}function f(e){return(0,u.jsxs)(`tr`,{className:`border-b border-edge-subtle last:border-b-0 dark:border-edge`,children:[(0,u.jsx)(`td`,{className:`max-w-0 truncate px-3 py-2 font-mono text-fg`,title:e.name,children:e.dir?`${e.name}/`:e.name}),(0,u.jsx)(`td`,{className:`w-24 px-3 py-2 text-right text-fg-muted`,children:e.dir?``:m(e.size)})]},e.name)}function p(e){return{name:e.name,dir:e.dir,size:e.dir?0:e._data?.uncompressedSize??0}}function m(e){return e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1048576).toFixed(1)} MB`}export{d as ArchivePreviewPluginView};
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-RnGYy9bC.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-zJ_50EbN.js","assets/excel-worksheet-utils-EyvwNT4X.js"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./preload-helper-zJ_50EbN.js";import{ua as t}from"./index-BOme955B.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};
2
+ import{t as e}from"./preload-helper-zJ_50EbN.js";import{fa as t}from"./index-DZOm5_ex.js";async function n(n,r){let i,a=r||`unnamed`,o=`application/octet-stream`,s=0;if(typeof n==`string`){let e=await fetch(n);if(!e.ok)throw Error(`Failed to fetch file`);if(i=await e.arrayBuffer(),s=i.byteLength,o=e.headers.get(`content-type`)||o,!r){let e=n.split(`/`);a=e[e.length-1]||`document`}}else if(n instanceof File)i=await n.arrayBuffer(),s=n.size,o=n.type||o,a=r||n.name;else if(n instanceof Blob)i=await n.arrayBuffer(),s=n.size,o=n.type||o;else if(n instanceof ArrayBuffer)i=n,s=n.byteLength;else throw Error(`Invalid source type`);let c=new Uint8Array(i),l=``,u=32768;for(let e=0;e<c.length;e+=u){let t=c.slice(e,e+u);l+=String.fromCharCode(...t)}let d=btoa(l),f=`${a}_${Date.now()}_${Math.random()}`;if(o===`application/pdf`||a.toLowerCase().endsWith(`.pdf`)){let{processPdf:t}=await e(async()=>{let{processPdf:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPdf:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n,preview:r}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/pdf`,size:s,content:d,extractedText:n,preview:r}}if(o===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||a.toLowerCase().endsWith(`.docx`)){let{processDocx:t}=await e(async()=>{let{processDocx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processDocx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.wordprocessingml.document`,size:s,content:d,extractedText:n}}if(o===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||a.toLowerCase().endsWith(`.pptx`)){let{processPptx:t}=await e(async()=>{let{processPptx:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processPptx:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:`application/vnd.openxmlformats-officedocument.presentationml.presentation`,size:s,content:d,extractedText:n}}if([`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,`application/vnd.ms-excel`].includes(o)||a.toLowerCase().endsWith(`.xlsx`)||a.toLowerCase().endsWith(`.xls`)){let{processExcel:t}=await e(async()=>{let{processExcel:e}=await import(`./attachment-process-heavy-RnGYy9bC.js`);return{processExcel:e}},__vite__mapDeps([0,1,2,3])),{extractedText:n}=await t(i,a);return{id:f,type:`document`,name:a,mimeType:o&&o.startsWith(`application/vnd`)?o:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`,size:s,content:d,extractedText:n}}if(o?.startsWith(`image/`))return{id:f,type:`image`,name:a,mimeType:o,size:s,content:d,preview:d};if(o?.startsWith(`audio/`))return{id:f,type:`voice`,name:a,mimeType:o,size:s,content:d};if(t(a,o??``)){let e=new TextDecoder().decode(i);return{id:f,type:`document`,name:a,mimeType:o?.startsWith(`text/`)?o:`text/plain`,size:s,content:d,extractedText:e}}throw Error(`Unsupported file type: ${o}`)}export{n as loadAttachment};