@xopcai/xopc 0.0.201 → 0.0.203

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 (164) 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/{activity-store-DOhnAQOQ.js → activity-store-SZAay-ze.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D8Cw0Mve.js → agent-avatar-dicebear-DPLJtxoS.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-DyjRuuRa.js +68 -0
  6. package/dist/gateway/static/root/assets/{api-E9Bk-Idp.js → api-C1cSt2ru.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-BubrReXg.js → app-management-settings-panel-B3PCMqor.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-BY5Az2p4.js → appearance-settings-txSx3REK.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-BEhBaooZ.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-BY8843mB.js → archive-plugin-B2VVc17j.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-DG45KScf.js → attachment-load-Crk7x8qR.js} +1 -1
  12. package/dist/gateway/static/root/assets/automations-page-BUC6FL6O.js +6 -0
  13. package/dist/gateway/static/root/assets/{binary-plugins-DGIF2ZAv.js → binary-plugins-CLlJsq5D.js} +1 -1
  14. package/dist/gateway/static/root/assets/{block-editor-C1Qktr1g.js → block-editor-cJ5lVNAG.js} +46 -46
  15. package/dist/gateway/static/root/assets/browser-settings-page-Bq2m4VpX.js +8 -0
  16. package/dist/gateway/static/root/assets/{browser-workflow-inputs-D_jnndyz.js → browser-workflow-inputs-WRiFG88u.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-workflows-page-DyIRvPaq.js → browser-workflows-page-BHLdVoOC.js} +2 -2
  18. package/dist/gateway/static/root/assets/capabilities-settings-panel-BiQbVvYU.js +7 -0
  19. package/dist/gateway/static/root/assets/{capability-presets-api--tz0mGLY.js → capability-presets-api-DmElfgC9.js} +1 -1
  20. package/dist/gateway/static/root/assets/capability-presets-settings-panel-CYlZQpLY.js +3 -0
  21. package/dist/gateway/static/root/assets/{channel-recipient-api-CkOKF9nc.js → channel-recipient-api-BUEOtPft.js} +1 -1
  22. package/dist/gateway/static/root/assets/channels-settings-DlDiCMhO.js +1 -0
  23. package/dist/gateway/static/root/assets/channels-status-swr-Dm_-934M.js +1 -0
  24. package/dist/gateway/static/root/assets/{connectors-api-FBOe9SWC.js → connectors-api-BCdn44_o.js} +1 -1
  25. package/dist/gateway/static/root/assets/connectors-page-Ce-eaPHw.js +2 -0
  26. package/dist/gateway/static/root/assets/cron-expression-D2hF3t68.js +2 -0
  27. package/dist/gateway/static/root/assets/{date-picker-Dtn7e6TW.js → date-picker-Dvjoq2mB.js} +1 -1
  28. package/dist/gateway/static/root/assets/dependency-picker-zv1OIhk3.js +1 -0
  29. package/dist/gateway/static/root/assets/desktop-pet-DJZhKLTb.js +1 -0
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-FDmaty3P.js → desktop-pet-settings-B3ubM-eY.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-X2e8xn8j.js → directory-picker-path-field-BZEJIWOT.js} +1 -1
  32. package/dist/gateway/static/root/assets/download-Dk-ZjtO6.js +1 -0
  33. package/dist/gateway/static/root/assets/{extension-debug-page-Dx4MBfga.js → extension-debug-page-Bvq3E1A1.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-Bf_FEDhM.js → extension-page-CuCJjWNm.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-settings-page-CrOgZxkf.js → extension-settings-page-CpTk_ajr.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-config-api-CZ4r-7qT.js → gateway-config-api-C2yM6qj7.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-config-swr-Cv2ywpdb.js → gateway-config-swr-CN-JHMAh.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-settings-DpWmVi0w.js → gateway-settings-COwi--2Q.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-startup-retry-undf-k5g.js → gateway-startup-retry-Dq1RyCjz.js} +1 -1
  40. package/dist/gateway/static/root/assets/{heartbeat-settings-DSQZhSvT.js → heartbeat-settings-Dc6H4VGF.js} +1 -1
  41. package/dist/gateway/static/root/assets/home-page-BB3RGxwm.js +3 -0
  42. package/dist/gateway/static/root/assets/index-CPTLS-Zn.js +85 -0
  43. package/dist/gateway/static/root/assets/index-Dm-cvIpl.css +2 -0
  44. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bc3Quw42.js → keyboard-shortcuts-settings-cue30Z5p.js} +1 -1
  45. package/dist/gateway/static/root/assets/local-app-workbench-page-DfO6FOB9.js +2 -0
  46. package/dist/gateway/static/root/assets/local-apps-page-DKQSCsa0.js +1 -0
  47. package/dist/gateway/static/root/assets/{locale-store-CnamlR07.js → locale-store-81Gv0wwo.js} +1 -1
  48. package/dist/gateway/static/root/assets/logs-page-DODbODyl.js +2 -0
  49. package/dist/gateway/static/root/assets/{management-settings-CJmcaVje.js → management-settings--4H26QR-.js} +1 -1
  50. package/dist/gateway/static/root/assets/{markdown-split-AcuFp0TH.js → markdown-split-BTvpyjAi.js} +1 -1
  51. package/dist/gateway/static/root/assets/markdown-view-B12xeflb.css +1 -0
  52. package/dist/gateway/static/root/assets/markdown-view-B4iBrVWK.js +69 -0
  53. package/dist/gateway/static/root/assets/{media-plugins-BvFgsiJL.js → media-plugins-DrejWl8t.js} +1 -1
  54. package/dist/gateway/static/root/assets/messages-ELK_1h2D.js +3 -0
  55. package/dist/gateway/static/root/assets/{notes-page-IW7IQ9nJ.js → notes-page-DfSzeQKd.js} +1 -1
  56. package/dist/gateway/static/root/assets/notes-workbench-DxL4GhwV.js +4 -0
  57. package/dist/gateway/static/root/assets/plus-Q2yW6OE7.js +1 -0
  58. package/dist/gateway/static/root/assets/preview-open-alternatives-yjh1_7K3.js +1 -0
  59. package/dist/gateway/static/root/assets/{product-open-page-CWEzLykF.js → product-open-page-DopWBJLa.js} +1 -1
  60. package/dist/gateway/static/root/assets/project-detail-page-Bl3LJHZB.js +1 -0
  61. package/dist/gateway/static/root/assets/projects-page-DStOErTC.js +1 -0
  62. package/dist/gateway/static/root/assets/remote-access-hub-C_hh9ztK.js +1 -0
  63. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DAohEZrX.js → runtime-tools-settings-panel-_dHhbYV2.js} +2 -2
  64. package/dist/gateway/static/root/assets/{schema-form-C_OBW8A5.js → schema-form-DZhORvJZ.js} +1 -1
  65. package/dist/gateway/static/root/assets/sessions-page-DDY21KYw.js +1 -0
  66. package/dist/gateway/static/root/assets/settings-advanced-gate-BJrHIcw8.js +1 -0
  67. package/dist/gateway/static/root/assets/{settings-form-section-C7w2WS-A.js → settings-form-section-Du5eAgFS.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-loading-skeleton-zwibve4m.js → settings-loading-skeleton-DWS27sv1.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-page-B9W03dSW.js → settings-page-DPD0MwoN.js} +1 -1
  70. package/dist/gateway/static/root/assets/setup-status-panel-CnXN4LH_.js +1 -0
  71. package/dist/gateway/static/root/assets/share-preview-page-D6HmH2ga.js +2 -0
  72. package/dist/gateway/static/root/assets/shares-settings-U3lvtO3Y.js +1 -0
  73. package/dist/gateway/static/root/assets/skill-reload-api-B6GiZgZU.js +1 -0
  74. package/dist/gateway/static/root/assets/skills-page-XVO7d3fh.js +2 -0
  75. package/dist/gateway/static/root/assets/{skills-page.utils-D9QT5cxj.js → skills-page.utils-DwxIpWrI.js} +1 -1
  76. package/dist/gateway/static/root/assets/{system-settings-panel-c1HVtv1Y.js → system-settings-panel-BmKbxR8_.js} +1 -1
  77. package/dist/gateway/static/root/assets/task-detail-page-DA6ItYrc.js +1 -0
  78. package/dist/gateway/static/root/assets/{theme-store-BDyUTObE.js → theme-store-hOF81tUQ.js} +1 -1
  79. package/dist/gateway/static/root/assets/{use-autosave-D6UkH_Ga.js → use-autosave-GJfDpf66.js} +1 -1
  80. package/dist/gateway/static/root/assets/user-context-page-CQ1QrRE6.js +1 -0
  81. package/dist/gateway/static/root/assets/{voice-api-key-field-BOxkKbGh.js → voice-api-key-field-B0zve9EE.js} +1 -1
  82. package/dist/gateway/static/root/assets/work-discovery-overlay-DrIbHnBz.js +1 -0
  83. package/dist/gateway/static/root/assets/work-discovery-page-CQW8pPec.js +1 -0
  84. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-ZA3bP65I.js → workflow-run-setup-panel-D-_zQxim.js} +2 -2
  85. package/dist/gateway/static/root/assets/workflows-page-O21l_f5c.js +5 -0
  86. package/dist/gateway/static/root/assets/{working-directory-picker-modal-BcyiDXU3.js → working-directory-picker-modal-5xYx48tV.js} +1 -1
  87. package/dist/gateway/static/root/assets/x-B_N4OPjy.js +1 -0
  88. package/dist/gateway/static/root/index.html +19 -14
  89. package/dist/package.js +1 -1
  90. package/dist/src/agent/agent-manager.js +2 -1
  91. package/dist/src/agent/embedded/run-for-session.js +3 -2
  92. package/dist/src/agent/embedded/run-turn.js +29 -16
  93. package/dist/src/agent/embedded/types.d.ts +2 -2
  94. package/dist/src/agent/embedded/xopc-stream-bridge.d.ts +2 -1
  95. package/dist/src/agent/embedded/xopc-stream-bridge.js +2 -2
  96. package/dist/src/agent/memory/context-budget.d.ts +6 -1
  97. package/dist/src/agent/memory/context-budget.js +94 -2
  98. package/dist/src/agent/prompt/cache-boundary.d.ts +2 -0
  99. package/dist/src/agent/prompt/cache-boundary.js +10 -1
  100. package/dist/src/agent/prompt/sections/project-context.d.ts +1 -4
  101. package/dist/src/agent/prompt/sections/project-context.js +6 -13
  102. package/dist/src/agent/prompt/service-prompt-builder.js +2 -1
  103. package/dist/src/agent/prompt/system-prompt.d.ts +1 -3
  104. package/dist/src/agent/prompt/system-prompt.js +6 -15
  105. package/dist/src/agent/tools/cache-stability.d.ts +3 -0
  106. package/dist/src/agent/tools/cache-stability.js +19 -0
  107. package/dist/src/agent/tools/factory.js +2 -1
  108. package/dist/src/agent-manifest/schema.d.ts +40 -20
  109. package/dist/src/agent-manifest/schema.js +4 -5
  110. package/dist/src/config/schema.d.ts +40 -20
  111. package/dist/src/extensions/types/providers.d.ts +0 -2
  112. package/dist/src/gateway/hono/lib/config-payload.d.ts +4 -1
  113. package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
  114. package/dist/src/gateway/hono/oauth-async.js +14 -2
  115. package/dist/src/providers/extension-stream-bridge.js +0 -2
  116. package/dist/src/providers/google-managed-prompt-cache.d.ts +14 -0
  117. package/dist/src/providers/google-managed-prompt-cache.js +125 -0
  118. package/dist/src/providers/prompt-cache-fingerprint.d.ts +4 -0
  119. package/dist/src/providers/prompt-cache-fingerprint.js +44 -0
  120. package/dist/src/providers/prompt-cache-lifecycle.d.ts +9 -0
  121. package/dist/src/providers/prompt-cache-lifecycle.js +31 -0
  122. package/dist/src/providers/prompt-cache-observability.d.ts +20 -0
  123. package/dist/src/providers/prompt-cache-observability.js +44 -0
  124. package/dist/src/providers/prompt-cache-payload.d.ts +10 -3
  125. package/dist/src/providers/prompt-cache-payload.js +204 -31
  126. package/dist/src/providers/prompt-cache-plan.d.ts +15 -0
  127. package/dist/src/providers/prompt-cache-plan.js +29 -0
  128. package/package.json +3 -3
  129. package/dist/gateway/static/root/assets/agents-ANavi648.js +0 -68
  130. package/dist/gateway/static/root/assets/apps-page-CFh9MBxc.js +0 -1
  131. package/dist/gateway/static/root/assets/automations-page-751CeNI3.js +0 -6
  132. package/dist/gateway/static/root/assets/browser-settings-page-CGAWs-TT.js +0 -8
  133. package/dist/gateway/static/root/assets/capabilities-settings-panel-CghUK68J.js +0 -7
  134. package/dist/gateway/static/root/assets/capability-presets-settings-panel-XsTfkvUn.js +0 -3
  135. package/dist/gateway/static/root/assets/channels-settings-DkoAZZMe.js +0 -1
  136. package/dist/gateway/static/root/assets/channels-status-swr-DNDvMWpl.js +0 -1
  137. package/dist/gateway/static/root/assets/connectors-page-e4vekkAu.js +0 -2
  138. package/dist/gateway/static/root/assets/cron-expression-Q4QaYjpI.js +0 -2
  139. package/dist/gateway/static/root/assets/dependency-picker-Br6nPaM6.js +0 -1
  140. package/dist/gateway/static/root/assets/desktop-pet-DzTM6aH8.js +0 -1
  141. package/dist/gateway/static/root/assets/home-page-L0uHiu0T.js +0 -3
  142. package/dist/gateway/static/root/assets/index-Bp8I_eX4.css +0 -1
  143. package/dist/gateway/static/root/assets/index-DRrjYYzZ.js +0 -152
  144. package/dist/gateway/static/root/assets/local-app-workbench-page-Copi3sdP.js +0 -2
  145. package/dist/gateway/static/root/assets/local-apps-page-CP9X_vtz.js +0 -1
  146. package/dist/gateway/static/root/assets/logs-page-DMKq6e29.js +0 -2
  147. package/dist/gateway/static/root/assets/messages-D7kOD_o_.js +0 -3
  148. package/dist/gateway/static/root/assets/notes-workbench-Zb8U0anO.js +0 -4
  149. package/dist/gateway/static/root/assets/preview-open-alternatives-C-b34dgQ.js +0 -1
  150. package/dist/gateway/static/root/assets/project-detail-page-BuIbLnan.js +0 -1
  151. package/dist/gateway/static/root/assets/projects-page-BwUfRqNV.js +0 -1
  152. package/dist/gateway/static/root/assets/remote-access-hub-BTaXxcEi.js +0 -1
  153. package/dist/gateway/static/root/assets/sessions-page-BnHoTCD3.js +0 -1
  154. package/dist/gateway/static/root/assets/settings-advanced-gate-BTB_fxjt.js +0 -1
  155. package/dist/gateway/static/root/assets/setup-status-panel-C8Hec2Af.js +0 -1
  156. package/dist/gateway/static/root/assets/share-preview-page-6e3ks2be.js +0 -2
  157. package/dist/gateway/static/root/assets/shares-settings-Bwc5HfLI.js +0 -1
  158. package/dist/gateway/static/root/assets/skill-reload-api-D7kunhqy.js +0 -1
  159. package/dist/gateway/static/root/assets/skills-page-WgkaNzpc.js +0 -2
  160. package/dist/gateway/static/root/assets/task-detail-page-CjP-6WVU.js +0 -1
  161. package/dist/gateway/static/root/assets/user-context-page-D8ZhPDNF.js +0 -1
  162. package/dist/gateway/static/root/assets/work-discovery-overlay-Dd19yK9t.js +0 -1
  163. package/dist/gateway/static/root/assets/work-discovery-page-DUkdJl1e.js +0 -1
  164. package/dist/gateway/static/root/assets/workflows-page-C2b5W5bw.js +0 -5
@@ -0,0 +1,68 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,f as a,l as o,t as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{d as c,f as l,i as u,n as d,p as f,r as p,u as m}from"./popover-select-BzdnTy3h.js";import{t as h}from"./external-link-DjqjBmc3.js";import{t as g}from"./markdown-view-B4iBrVWK.js";import{t as _}from"./plus-Q2yW6OE7.js";import{t as v}from"./x-B_N4OPjy.js";import{t as y}from"./cn-JdwAhgNB.js";import{t as b}from"./button-CSEbl4zT.js";import{o as x,s as S}from"./form-field-width-DJw_jULe.js";import{n as C,t as w}from"./interaction-BmQogeqz.js";import{t as T}from"./messages-ELK_1h2D.js";import{l as E,n as D}from"./locale-store-81Gv0wwo.js";import{i as O}from"./theme-store-hOF81tUQ.js";import{i as k,o as A,s as j}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as M,i as N,n as P,o as F,r as I,s as L,t as R}from"./dist-BPoKqzeH.js";import{i as z}from"./vendor-swr-BIWyz7Rc.js";import{r as B}from"./gateway-config-swr-CN-JHMAh.js";import{a as V,i as H,n as U,o as ee,r as te,t as W}from"./dist-DY4Af0fY.js";import{$i as ne,Aa as G,Al as re,An as ie,Ba as K,Bn as q,Dl as ae,El as oe,Es as se,Fn as ce,Gs as le,Hc as ue,Hn as de,Ht as fe,In as pe,Io as me,Ko as he,Lc as ge,Ll as _e,Ln as ve,Ls as ye,Ml as be,Mn as xe,Nn as Se,Ns as J,O as Ce,Pn as we,Po as Te,Q as Ee,Qi as De,Rn as Oe,Sa as ke,Un as Ae,Ut as je,Va as Me,Vl as Ne,Vn as Pe,Wn as Fe,X as Ie,Xi as Le,Yc as Re,Yi as ze,Zi as Y,Zo as Be,as as Ve,bs as He,ea as Ue,es as We,gs as Ge,hc as Ke,i as qe,ic as Je,is as X,jn as Ye,k as Xe,kn as Ze,ks as Qe,mc as $e,na as et,qc as tt,r as nt,ra as rt,ta as it,ts as at,vs as ot,xc as st,xi as ct,zn as lt}from"./index-CPTLS-Zn.js";import{t as ut}from"./markdown-editor-TWGaF7Xa.js";import{n as dt,r as ft}from"./settings-page-layout-BRQNel6r.js";import{r as pt,t as mt}from"./settings-loading-skeleton-DWS27sv1.js";import{n as ht,t as gt}from"./use-autosave-GJfDpf66.js";import{n as _t,t as vt}from"./settings-form-section-Du5eAgFS.js";import{t as yt}from"./page-tabs-BaEQMYm_.js";import{n as bt}from"./agent-avatar-dicebear-DPLJtxoS.js";import{c as xt,i as St,s as Ct}from"./capability-presets-api-DmElfgC9.js";import{a as wt,i as Tt,n as Et,o as Dt,s as Ot,t as kt}from"./typed-models-lib-q5-Vfqd8.js";import{n as At,r as jt,t as Mt}from"./channel-recipient-api-BUEOtPft.js";import{t as Nt}from"./directory-picker-path-field-BZEJIWOT.js";var Z=n(),Q=r();function Pt(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,busy:i,deletePurge:a,deleteTarget:o,deleteConfirmText:s,onDeleteConfirmTextChange:c,onConfirm:l,onCancel:u,a:d}=e,f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(M,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=f):f=t[0];let p;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(p=y(`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]=p):p=t[1];let m=a?d.purgeDisk:d.removeFromConfig,h;t[2]===m?h=t[3]:(h=(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:m}),t[2]=m,t[3]=h);let g=a?d.confirmDeletePurge:d.confirmDelete,_;t[4]===g?_=t[5]:(_=(0,Q.jsx)(N,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:g}),t[4]=g,t[5]=_);let v;t[6]!==d.purgeConfirmHint||t[7]!==d.purgeConfirmLabel||t[8]!==d.purgeConfirmPlaceholder||t[9]!==s||t[10]!==a||t[11]!==o||t[12]!==c?(v=a&&o?(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:d.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:y(`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:d.purgeConfirmPlaceholder.replace(`{{agentId}}`,o.id),value:s,onChange:e=>c(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:d.purgeConfirmHint.replace(`{{agentId}}`,o.id)})]}):null,t[6]=d.purgeConfirmHint,t[7]=d.purgeConfirmLabel,t[8]=d.purgeConfirmPlaceholder,t[9]=s,t[10]=a,t[11]=o,t[12]=c,t[13]=v):v=t[13];let x;t[14]!==d.createModalCancel||t[15]!==i||t[16]!==u?(x=(0,Q.jsx)(b,{type:`button`,variant:`ghost`,disabled:i,onClick:u,children:d.createModalCancel}),t[14]=d.createModalCancel,t[15]=i,t[16]=u,t[17]=x):x=t[17];let S=a?`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,C;t[18]!==i||t[19]!==s||t[20]!==a||t[21]!==o?(C=i||!o||a&&s.trim().toLowerCase()!==o.id.toLowerCase(),t[18]=i,t[19]=s,t[20]=a,t[21]=o,t[22]=C):C=t[22];let w=a?d.purgeDisk:d.removeFromConfig,T;t[23]!==l||t[24]!==C||t[25]!==w||t[26]!==S?(T=(0,Q.jsx)(b,{type:`button`,variant:`secondary`,className:S,disabled:C,onClick:l,children:w}),t[23]=l,t[24]=C,t[25]=w,t[26]=S,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==x?(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:[x,T]}),t[28]=T,t[29]=x,t[30]=E):E=t[30];let D;t[31]!==E||t[32]!==h||t[33]!==_||t[34]!==v?(D=(0,Q.jsxs)(F,{children:[f,(0,Q.jsxs)(I,{className:p,onOpenAutoFocus:Ft,children:[h,_,v,E]})]}),t[31]=E,t[32]=h,t[33]=_,t[34]=v,t[35]=D):D=t[35];let O;return t[36]!==r||t[37]!==n||t[38]!==D?(O=(0,Q.jsx)(R,{open:n,onOpenChange:r,children:D}),t[36]=r,t[37]=n,t[38]=D,t[39]=O):O=t[39],O}function Ft(e){return e.preventDefault()}var $=e(t(),1),It=[{id:`overview`,labelKey:`navOverview`,icon:ge},{id:`profile`,labelKey:`navProfile`,icon:ot},{id:`capabilities`,labelKey:`navCapabilities`,icon:re},{id:`runtime`,labelKey:`navRuntime`,icon:se},{id:`connections`,labelKey:`navConnections`,icon:oe},{id:`advanced`,labelKey:`navAdvanced`,icon:He},{id:`dangerZone`,labelKey:`navDangerZone`,icon:X}];function Lt(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:i}=e,a;t[0]!==i||t[1]!==r?(a=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:y(`flex w-auto shrink-0 items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors sm:w-full`,C.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]=i,t[1]=r,t[2]=a):a=t[2];let o=a,s=n.editorNavAria,c;t[3]!==n||t[4]!==o?(c=It.map(e=>{let{id:t,labelKey:r,icon:i}=e;return o(t,n[r],i)}),t[3]=n,t[4]=o,t[5]=c):c=t[5];let l;t[6]===c?l=t[7]:(l=(0,Q.jsx)(`div`,{className:`flex gap-1 pb-1 sm:flex-col sm:gap-0.5 sm:pb-0`,children:c}),t[6]=c,t[7]=l);let u;return t[8]!==n.editorNavAria||t[9]!==l?(u=(0,Q.jsx)(`nav`,{className:`w-full overflow-x-auto sm:overflow-visible`,"aria-label":s,children:l}),t[8]=n.editorNavAria,t[9]=l,t[10]=u):u=t[10],u}function Rt(e){let t=(0,Z.c)(33),{open:n,onOpenChange:r,a:i,title:a,subtitle:o,panel:s,onPanelChange:c,children:l}=e,[d,f]=(0,$.useState)(null),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(M,{className:y(`xopc-dialog-overlay fixed inset-0 bg-scrim`,A)}),t[0]=p):p=t[0];let m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=y(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,k,`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]=m):m=t[1];let h;t[2]===a?h=t[3]:(h=(0,Q.jsx)(L,{className:`text-base font-semibold leading-snug text-fg`,children:a}),t[2]=a,t[3]=h);let g;t[4]===o?g=t[5]:(g=(0,Q.jsx)(N,{className:`mt-1 font-mono text-xs text-fg-muted`,children:o}),t[4]=o,t[5]=g);let _;t[6]!==h||t[7]!==g?(_=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[h,g]}),t[6]=h,t[7]=g,t[8]=_):_=t[8];let b;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(b=y(w,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=b):b=t[9];let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[10]=x):x=t[10];let S;t[11]===i.closeDialogAria?S=t[12]:(S=(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:b,"aria-label":i.closeDialogAria,children:x})}),t[11]=i.closeDialogAria,t[12]=S);let C;t[13]!==_||t[14]!==S?(C=(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:[_,S]}),t[13]=_,t[14]=S,t[15]=C):C=t[15];let T;t[16]!==i||t[17]!==c||t[18]!==s?(T=(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)(Lt,{a:i,panel:s,onPanelChange:c})}),t[16]=i,t[17]=c,t[18]=s,t[19]=T):T=t[19];let E;t[20]===l?E=t[21]:(E=(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:l})}),t[20]=l,t[21]=E);let D;t[22]!==E||t[23]!==T?(D=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[T,E]}),t[22]=E,t[23]=T,t[24]=D):D=t[24];let O;t[25]!==d||t[26]!==D||t[27]!==C?(O=(0,Q.jsxs)(F,{children:[p,(0,Q.jsx)(I,{ref:f,className:m,onOpenAutoFocus:zt,children:(0,Q.jsxs)(u,{layer:`modal`,portalContainer:d,children:[C,D]})})]}),t[25]=d,t[26]=D,t[27]=C,t[28]=O):O=t[28];let j;return t[29]!==r||t[30]!==n||t[31]!==O?(j=(0,Q.jsx)(R,{open:n,onOpenChange:r,children:O}),t[29]=r,t[30]=n,t[31]=O,t[32]=j):j=t[32],j}function zt(e){return e.preventDefault()}function Bt(e){let t=(0,Z.c)(28),{label:n,mode:r,value:i,inheritedFrom:a,inheritLabel:o,overrideLabel:s,onClick:c}=e,l;t[0]===n?l=t[1]:(l=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=l);let u=i||`—`,d;t[2]===u?d=t[3]:(d=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:u}),t[2]=u,t[3]=d);let f;t[4]!==a||t[5]!==r?(f=r===`inherit`&&a?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:a}):null,t[4]=a,t[5]=r,t[6]=f):f=t[6];let p;t[7]!==l||t[8]!==d||t[9]!==f?(p=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[l,d,f]}),t[7]=l,t[8]=d,t[9]=f,t[10]=p):p=t[10];let m=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,h;t[11]===m?h=t[12]:(h=y(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,m),t[11]=m,t[12]=h);let g=r===`inherit`?o:s,_;t[13]!==h||t[14]!==g?(_=(0,Q.jsx)(`span`,{className:h,children:g}),t[13]=h,t[14]=g,t[15]=_):_=t[15];let v;t[16]!==p||t[17]!==_?(v=(0,Q.jsxs)(Q.Fragment,{children:[p,_]}),t[16]=p,t[17]=_,t[18]=v):v=t[18];let b=v,x=c?`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=y(`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(c){let e;return t[21]!==C||t[22]!==b||t[23]!==c?(e=(0,Q.jsx)(`button`,{type:`button`,className:C,onClick:c,children:b}),t[21]=C,t[22]=b,t[23]=c,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 Vt(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,m=d?r||l.unset:a,h=p?i||l.unset:o,g;t[5]!==l.subtitle||t[6]!==l.title?(g=(0,Q.jsx)(_t,{icon:Ke,title:l.title,subtitle:l.subtitle}),t[5]=l.subtitle,t[6]=l.title,t[7]=g):g=t[7];let _=d?`inherit`:`override`,v;t[8]!==r||t[9]!==l.inheritsValue||t[10]!==d?(v=d&&r?l.inheritsValue.replace(`{{value}}`,r):void 0,t[8]=r,t[9]=l.inheritsValue,t[10]=d,t[11]=v):v=t[11];let y;t[12]!==m||t[13]!==l.badgeInherit||t[14]!==l.badgeOverride||t[15]!==l.modelLabel||t[16]!==s||t[17]!==_||t[18]!==v?(y=(0,Q.jsx)(Bt,{label:l.modelLabel,mode:_,value:m,inheritedFrom:v,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:s}),t[12]=m,t[13]=l.badgeInherit,t[14]=l.badgeOverride,t[15]=l.modelLabel,t[16]=s,t[17]=_,t[18]=v,t[19]=y):y=t[19];let b=p?`inherit`:`override`,x;t[20]!==i||t[21]!==l.inheritsValue||t[22]!==p?(x=p&&i?l.inheritsValue.replace(`{{value}}`,i):void 0,t[20]=i,t[21]=l.inheritsValue,t[22]=p,t[23]=x):x=t[23];let S;t[24]!==h||t[25]!==l.badgeInherit||t[26]!==l.badgeOverride||t[27]!==l.workspaceLabel||t[28]!==c||t[29]!==b||t[30]!==x?(S=(0,Q.jsx)(Bt,{label:l.workspaceLabel,mode:b,value:h,inheritedFrom:x,inheritLabel:l.badgeInherit,overrideLabel:l.badgeOverride,onClick:c}),t[24]=h,t[25]=l.badgeInherit,t[26]=l.badgeOverride,t[27]=l.workspaceLabel,t[28]=c,t[29]=b,t[30]=x,t[31]=S):S=t[31];let C;t[32]!==y||t[33]!==S?(C=(0,Q.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[y,S]}),t[32]=y,t[33]=S,t[34]=C):C=t[34];let w;return t[35]!==g||t[36]!==C?(w=(0,Q.jsxs)(vt,{children:[g,C]}),t[35]=g,t[36]=C,t[37]=w):w=t[37],w}function Ht(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Ut(e){let t=(0,Z.c)(5),{source:n}=e,r;if(t[0]!==n){let e=n.startsWith(`preset:`),i=n.startsWith(`agent:`);r=y(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e&&`bg-accent/10 text-accent`,i&&`bg-surface-base text-fg-muted`,!e&&!i&&`bg-surface-panel text-fg-subtle`),t[0]=n,t[1]=r}else r=t[1];let i;return t[2]!==n||t[3]!==r?(i=(0,Q.jsx)(`span`,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=i):i=t[4],i}function Wt(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`,i;t[2]===r?i=t[3]:(i=y(`min-w-0 truncate text-sm text-fg`,r),t[2]=r,t[3]=i);let a;t[4]!==e.value||t[5]!==i?(a=(0,Q.jsx)(`div`,{className:i,children:e.value}),t[4]=e.value,t[5]=i,t[6]=a):a=t[6];let o;t[7]===e.source?o=t[8]:(o=(0,Q.jsx)(Ut,{source:e.source}),t[7]=e.source,t[8]=o);let s;return t[9]!==n||t[10]!==a||t[11]!==o?(s=(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,a,o]}),t[9]=n,t[10]=a,t[11]=o,t[12]=s):s=t[12],s}function Gt(e,t){return e&&e.length>0?e.join(`, `):t}function Kt(e){let t=(0,Z.c)(39),{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=()=>pe(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}=z(i,a,o),u=s?.manifest,d;t[5]!==s?.presetChain||t[6]!==u?.extends?(d=s?.presetChain??u?.extends??[],t[5]=s?.presetChain,t[6]=u?.extends,t[7]=d):d=t[7];let f=d,p;if(t[8]!==n.effectiveBoundariesTitle||t[9]!==n.effectiveEmpty||t[10]!==n.effectiveError||t[11]!==n.effectiveHint||t[12]!==n.effectiveLoading||t[13]!==n.effectiveLocksTitle||t[14]!==n.effectiveModelsTitle||t[15]!==n.effectiveNoLocks||t[16]!==n.effectiveNoOverrides||t[17]!==n.effectiveNoPresets||t[18]!==n.effectiveNoToolPolicies||t[19]!==n.effectiveOverridesTitle||t[20]!==n.effectivePresetChain||t[21]!==n.effectiveSkillsTitle||t[22]!==n.effectiveTitle||t[23]!==n.effectiveToolsTitle||t[24]!==s?.locks||t[25]!==s?.overrides||t[26]!==s?.sources||t[27]!==c||t[28]!==l||t[29]!==u||t[30]!==f){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(Xt),i=Object.entries(u?.tools?.builtin??{}).sort(Yt),a=u?.skills,o=u?.boundaries,d;t[32]===s?.overrides?d=t[33]:(d=s?.overrides??[],t[32]=s?.overrides,t[33]=d);let m=d,h;t[34]===s?.locks?h=t[35]:(h=s?.locks??[],t[34]=s?.locks,t[35]=h);let g=h,_;t[36]!==n.effectiveHint||t[37]!==n.effectiveTitle?(_=(0,Q.jsx)(_t,{icon:$e,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[36]=n.effectiveHint,t[37]=n.effectiveTitle,t[38]=_):_=t[38],p=(0,Q.jsxs)(vt,{children:[_,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:f.length?f.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.effectiveOverridesTitle}),m.length>0?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:m.map(Jt)}):(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted shadow-surface`,children:n.effectiveNoOverrides})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveLocksTitle}),g.length>0?(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:g.map(qt)}):(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted shadow-surface`,children:n.effectiveNoLocks})]}),(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)(Wt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Ht(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(Wt,{name:n,value:r.model,monoValue:!0,source:Ht(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)(Wt,{name:n,value:r.mode,source:Ht(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)(Wt,{name:`mode`,value:a?.mode??`all`,source:Ht(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(Wt,{name:`allow`,value:Gt(a.allow,`—`),source:Ht(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(Wt,{name:`deny`,value:Gt(a.deny,`—`),source:Ht(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.effectiveBoundariesTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(Wt,{name:`requiresConfirmation`,value:Gt(o?.requiresConfirmation,`—`),source:Ht(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(Wt,{name:`forbidden`,value:Gt(o?.forbidden,`—`),source:Ht(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(Wt,{name:`escalation`,value:Gt(o?.escalation,`—`),source:Ht(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.effectiveLocksTitle,t[14]=n.effectiveModelsTitle,t[15]=n.effectiveNoLocks,t[16]=n.effectiveNoOverrides,t[17]=n.effectiveNoPresets,t[18]=n.effectiveNoToolPolicies,t[19]=n.effectiveOverridesTitle,t[20]=n.effectivePresetChain,t[21]=n.effectiveSkillsTitle,t[22]=n.effectiveTitle,t[23]=n.effectiveToolsTitle,t[24]=s?.locks,t[25]=s?.overrides,t[26]=s?.sources,t[27]=c,t[28]=l,t[29]=u,t[30]=f,t[31]=p}else p=t[31];return p}function qt(e){return(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-panel px-2.5 py-1 font-mono text-xs text-fg-muted shadow-surface`,children:e},e)}function Jt(e,t){return(0,Q.jsxs)(`div`,{className:`grid gap-1 rounded-lg bg-surface-panel/80 px-3 py-2 text-xs shadow-surface sm:grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] sm:items-center`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono font-medium text-fg`,children:e.path}),(0,Q.jsx)(`div`,{className:`mt-1 truncate text-fg-muted`,children:e.from})]}),(0,Q.jsx)(`span`,{className:`text-fg-subtle`,"aria-hidden":!0,children:`→`}),(0,Q.jsx)(`div`,{className:`truncate text-fg-muted sm:text-right`,children:e.to})]},`${e.path}-${e.from}-${e.to}-${t}`)}function Yt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Xt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Zt(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 Qt(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 $t(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)(Qt,{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)(Qt,{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)(Qt,{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)(en,{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)(tn,{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)(an,{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 en(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)(Zt,{children:(0,Q.jsx)(Vt,{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 tn(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(rn)),t[0]=a,t[1]=u);let f=u,m;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==f?(m=f.get(l)??{id:l,name:n.capabilityPresetsGlobalDefault,description:n.capabilityPresetsGlobalDefaultHint},t[2]=n.capabilityPresetsGlobalDefault,t[3]=n.capabilityPresetsGlobalDefaultHint,t[4]=l,t[5]=f,t[6]=m):m=t[6];let g=m,v,y,x,S,C;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]!==g.description||t[21]!==g.id||t[22]!==g.name||t[23]!==c||t[24]!==s||t[25]!==f||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(nn).filter(e=>e!==l&&!o.includes(e)),m=u[0]??``;y=Zt,v=vt;let w;t[34]===c?w=t[35]:(w=()=>c(``),t[34]=c,t[35]=w);let T;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),t[36]=T):T=t[36];let E;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==w?(E=(0,Q.jsxs)(b,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:w,children:[T,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=w,t[40]=E):E=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==E?(x=(0,Q.jsx)(_t,{icon:ot,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:E}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=E,t[44]=x):x=t[44];let D;t[45]!==g.id||t[46]!==c?(D=()=>c(g.id),t[45]=g.id,t[46]=c,t[47]=D):D=t[47];let O=g.name||n.capabilityPresetsGlobalDefault,k;t[48]===O?k=t[49]:(k=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:O}),t[48]=O,t[49]=k);let A;t[50]===n.capabilityPresetsGlobalDefault?A=t[51]:(A=(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]=A);let j;t[52]!==k||t[53]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[k,A]}),t[52]=k,t[53]=A,t[54]=j):j=t[54];let M;t[55]===g.id?M=t[56]:(M=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:g.id}),t[55]=g.id,t[56]=M);let N=g.description||n.capabilityPresetsGlobalDefaultHint,P;t[57]===N?P=t[58]:(P=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:N}),t[57]=N,t[58]=P);let F;t[59]!==D||t[60]!==j||t[61]!==M||t[62]!==P?(F=(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:D,children:[j,M,P]})}),t[59]=D,t[60]=j,t[61]=M,t[62]=P,t[63]=F):F=t[63],S=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[F,o.length>0?o.map((e,t)=>{let r=f.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)(b,{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)(_e,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(b,{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)(Ne,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(b,{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)(Ve,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 p-3 text-sm text-fg-muted shadow-surface`,children:n.capabilityPresetsEmptyAdditional})]}),C=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)(d,{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:m,children:u.map(e=>(0,Q.jsx)(p,{value:e,children:f.get(e)?.name??e},e))}),(0,Q.jsxs)(b,{type:`button`,variant:`secondary`,disabled:i||!m,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||m;t&&s([...o,t])},children:[(0,Q.jsx)(_,{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]=g.description,t[21]=g.id,t[22]=g.name,t[23]=c,t[24]=s,t[25]=f,t[26]=r.extends,t[27]=v,t[28]=y,t[29]=x,t[30]=S,t[31]=C}else v=t[27],y=t[28],x=t[29],S=t[30],C=t[31];let w;t[64]!==v||t[65]!==x||t[66]!==S||t[67]!==C?(w=(0,Q.jsxs)(v,{children:[x,S,C]}),t[64]=v,t[65]=x,t[66]=S,t[67]=C,t[68]=w):w=t[68];let T;return t[69]!==y||t[70]!==w?(T=(0,Q.jsx)(y,{children:w}),t[69]=y,t[70]=w,t[71]=T):T=t[71],T}function nn(e){return e.id}function rn(e){return[e.id,e]}function an(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(Zt,{children:(0,Q.jsx)(Kt,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function on(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)(Zt,{children:r.id===`main`?(0,Q.jsx)(vt,{children:(0,Q.jsx)(_t,{icon:X,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:X,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)(b,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(Ve,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(b,{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}function sn(){return y(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,S,`dark:border-edge`)}function cn(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function ln(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}function un(e){let t=(0,Z.c)(31),{a:n,filesLoading:r,files:i,activeFile:a,setActiveFile:o,filesViewMode:s,setFilesViewMode:c,fileDraft:l,setFileDraft:u,fileSaving:d,profileFileLoading:f,profileEditorNonce:p,onTryInChat:m}=e,h=O(dn),_;t[0]!==n.missing||t[1]!==i?.files?(_=i?.files.map(e=>({id:e.name,label:e.missing?`${e.name} (${n.missing})`:e.name,title:e.name}))??[],t[0]=n.missing,t[1]=i?.files,t[2]=_):_=t[2];let v=_,x;t[3]===n.filesHint?x=t[4]:(x=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[3]=n.filesHint,t[4]=x);let S;t[5]!==n.filesAutoSaveHint||t[6]!==n.filesEmpty||t[7]!==n.filesMarkdownEdit||t[8]!==n.filesMarkdownPreview||t[9]!==n.filesNavAria||t[10]!==n.filesSavingStatus||t[11]!==n.pickFile||t[12]!==n.tryInChat||t[13]!==a||t[14]!==l||t[15]!==d||t[16]!==v||t[17]!==i||t[18]!==r||t[19]!==s||t[20]!==h||t[21]!==m||t[22]!==p||t[23]!==f||t[24]!==o||t[25]!==u||t[26]!==c?(S=r?(0,Q.jsx)(mt,{rows:3}):i?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(yt,{items:v,activeTab:a??``,onChange:o,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:a?(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:y(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,C.press,s===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>c(`edit`),children:[(0,Q.jsx)(Ge,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Q.jsxs)(`button`,{type:`button`,className:y(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,C.press,s===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>c(`preview`),children:[(0,Q.jsx)(Re,{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:[d?(0,Q.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Q.jsx)(`span`,{children:n.filesAutoSaveHint}),m?(0,Q.jsxs)(b,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:m,children:[(0,Q.jsx)(Je,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),s===`edit`?(0,Q.jsx)(`div`,{className:y(sn(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,f&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ut,{initialContent:l,onChange:u,isDark:h,className:`min-h-0 flex-1`},`${a??`file`}-${p}`)}):(0,Q.jsx)(`div`,{className:y(sn(),`min-h-0 flex-1 overflow-y-auto text-sm`,f&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(g,{content:l,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.filesMarkdownEdit,t[8]=n.filesMarkdownPreview,t[9]=n.filesNavAria,t[10]=n.filesSavingStatus,t[11]=n.pickFile,t[12]=n.tryInChat,t[13]=a,t[14]=l,t[15]=d,t[16]=v,t[17]=i,t[18]=r,t[19]=s,t[20]=h,t[21]=m,t[22]=p,t[23]=f,t[24]=o,t[25]=u,t[26]=c,t[27]=S):S=t[27];let w;return t[28]!==x||t[29]!==S?(w=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[x,S]}),t[28]=x,t[29]=S,t[30]=w):w=t[30],w}function dn(e){return e.resolved===`dark`}function fn(e){let t=(0,Z.c)(44),[n,r]=(0,$.useState)(`files`),{a:i}=e,a;t[0]===i.advancedHint?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`mb-3 max-w-[70ch] text-sm leading-6 text-fg-muted`,children:i.advancedHint}),t[0]=i.advancedHint,t[1]=a);let o;t[2]===i.advancedFilesTab?o=t[3]:(o={id:`files`,label:i.advancedFilesTab,icon:tt},t[2]=i.advancedFilesTab,t[3]=o);let s;t[4]===i.advancedConfigTab?s=t[5]:(s={id:`config`,label:i.advancedConfigTab,icon:He},t[4]=i.advancedConfigTab,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=[o,s],t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]!==i.advancedNavAria||t[10]!==n||t[11]!==c?(l=(0,Q.jsx)(yt,{items:c,activeTab:n,onChange:r,ariaLabel:i.advancedNavAria,tabIdPrefix:`agent-advanced-tab`,panelIdPrefix:`agent-advanced-panel`}),t[9]=i.advancedNavAria,t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;t[13]!==a||t[14]!==l?(u=(0,Q.jsxs)(`div`,{className:`shrink-0`,children:[a,l]}),t[13]=a,t[14]=l,t[15]=u):u=t[15];let d;t[16]!==i||t[17]!==n||t[18]!==e.activeFile||t[19]!==e.agentModel||t[20]!==e.agentWorkspace||t[21]!==e.busy||t[22]!==e.capabilityPresets||t[23]!==e.defaultModel||t[24]!==e.defaultPresetId||t[25]!==e.defaultWorkspace||t[26]!==e.fileDraft||t[27]!==e.fileSaving||t[28]!==e.files||t[29]!==e.filesLoading||t[30]!==e.filesViewMode||t[31]!==e.onOpenCapabilityPreset||t[32]!==e.onTryInChat||t[33]!==e.onUpdateAgentExtends||t[34]!==e.profileEditorNonce||t[35]!==e.profileFileLoading||t[36]!==e.selected||t[37]!==e.setActiveFile||t[38]!==e.setFileDraft||t[39]!==e.setFilesViewMode?(d=n===`files`?(0,Q.jsx)(un,{a:i,filesLoading:e.filesLoading,files:e.files,activeFile:e.activeFile,setActiveFile:e.setActiveFile,filesViewMode:e.filesViewMode,setFilesViewMode:e.setFilesViewMode,fileDraft:e.fileDraft,setFileDraft:e.setFileDraft,fileSaving:e.fileSaving,profileFileLoading:e.profileFileLoading,profileEditorNonce:e.profileEditorNonce,onTryInChat:e.onTryInChat}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,Q.jsx)(`p`,{className:`shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-xs leading-5 text-fg-muted`,children:i.advancedRuntimeCoverageHint}),(0,Q.jsx)($t,{a:i,selected:e.selected,busy:e.busy,defaultModel:e.defaultModel,defaultWorkspace:e.defaultWorkspace,agentModel:e.agentModel,agentWorkspace:e.agentWorkspace,capabilityPresets:e.capabilityPresets,defaultPresetId:e.defaultPresetId,onUpdateAgentExtends:e.onUpdateAgentExtends,onOpenCapabilityPreset:e.onOpenCapabilityPreset})]}),t[16]=i,t[17]=n,t[18]=e.activeFile,t[19]=e.agentModel,t[20]=e.agentWorkspace,t[21]=e.busy,t[22]=e.capabilityPresets,t[23]=e.defaultModel,t[24]=e.defaultPresetId,t[25]=e.defaultWorkspace,t[26]=e.fileDraft,t[27]=e.fileSaving,t[28]=e.files,t[29]=e.filesLoading,t[30]=e.filesViewMode,t[31]=e.onOpenCapabilityPreset,t[32]=e.onTryInChat,t[33]=e.onUpdateAgentExtends,t[34]=e.profileEditorNonce,t[35]=e.profileFileLoading,t[36]=e.selected,t[37]=e.setActiveFile,t[38]=e.setFileDraft,t[39]=e.setFilesViewMode,t[40]=d):d=t[40];let f;return t[41]!==u||t[42]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[u,d]}),t[41]=u,t[42]=d,t[43]=f):f=t[43],f}function pn(e){let t=(0,Z.c)(79),{a:n,selected:r,busy:i,skillsCatalogLoading:a,catalogForPick:o,skillsInherit:c,setSkillsInherit:l,skillsPick:u,setSkillsPick:d,onSaveSkills:f}=e,p,m;if(t[0]!==r.skills.entry||t[1]!==c||t[2]!==u){p=[...u].toSorted(vn);let e=[...r.skills.entry??[]].toSorted(_n);m=c!==(r.skills.entry===void 0)||!c&&JSON.stringify(p)!==JSON.stringify(e),t[0]=r.skills.entry,t[1]=c,t[2]=u,t[3]=p,t[4]=m}else p=t[3],m=t[4];let h=m,g;t[5]!==p||t[6]!==c?(g={inherit:c,skills:p},t[5]=p,t[6]=c,t[7]=g):g=t[7];let _;t[8]!==h||t[9]!==f||t[10]!==g?(_={value:g,dirty:h,onSave:f,delayMs:350},t[8]=h,t[9]=f,t[10]=g,t[11]=_):_=t[11];let v=gt(_),x;t[12]===r.skills.effectiveAllowlist?x=t[13]:(x=function(e){let t=r.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)},t[12]=r.skills.effectiveAllowlist,t[13]=x);let S=x,C;t[14]!==o||t[15]!==r.skills.effectiveAllowlist?(C=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(o.map(gn)):new Set(e)},t[14]=o,t[15]=r.skills.effectiveAllowlist,t[16]=C):C=t[16];let w=C,T;t[17]!==v.error||t[18]!==v.status?(T=(0,Q.jsx)(ht,{status:v.status,error:v.error}),t[17]=v.error,t[18]=v.status,t[19]=T):T=t[19];let E;t[20]!==n.skillsHint||t[21]!==n.skillsTitle||t[22]!==T?(E=(0,Q.jsx)(_t,{className:`shrink-0`,icon:be,title:n.skillsTitle,subtitle:n.skillsHint,trailing:T}),t[20]=n.skillsHint,t[21]=n.skillsTitle,t[22]=T,t[23]=E):E=t[23];let D;t[24]!==v||t[25]!==l||t[26]!==p?(D=()=>{l(!0),v.saveNow({inherit:!0,skills:p})},t[24]=v,t[25]=l,t[26]=p,t[27]=D):D=t[27];let O;t[28]!==n.skillsInherit||t[29]!==i||t[30]!==D?(O=(0,Q.jsx)(b,{type:`button`,variant:`secondary`,disabled:i,onClick:D,children:n.skillsInherit}),t[28]=n.skillsInherit,t[29]=i,t[30]=D,t[31]=O):O=t[31];let k;t[32]!==v||t[33]!==w||t[34]!==l||t[35]!==d?(k=()=>{l(!1);let e=w();d(e),v.saveNow({inherit:!1,skills:[...e].toSorted(hn)})},t[32]=v,t[33]=w,t[34]=l,t[35]=d,t[36]=k):k=t[36];let A;t[37]!==n.skillsCustomize||t[38]!==i||t[39]!==k?(A=(0,Q.jsx)(b,{type:`button`,variant:`secondary`,disabled:i,onClick:k,children:n.skillsCustomize}),t[37]=n.skillsCustomize,t[38]=i,t[39]=k,t[40]=A):A=t[40];let j;t[41]!==A||t[42]!==O?(j=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[O,A]}),t[41]=A,t[42]=O,t[43]=j):j=t[43];let M;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(M=me(`skills`),t[44]=M):M=t[44];let N;t[45]===n.skillsLibraryLink?N=t[46]:(N=(0,Q.jsx)(s,{to:M,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[45]=n.skillsLibraryLink,t[46]=N);let P;t[47]!==j||t[48]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[j,N]}),t[47]=j,t[48]=N,t[49]=P):P=t[49];let F;t[50]===r.skills.preset?F=t[51]:(F=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[50]=r.skills.preset,t[51]=F);let I;t[52]!==n.skillsPresetLabel||t[53]!==F?(I=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,F]}),t[52]=n.skillsPresetLabel,t[53]=F,t[54]=I):I=t[54];let L;t[55]!==n.skillsInherit||t[56]!==r.skills.effectiveAllowlist||t[57]!==c?(L=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):c?n.skillsInherit:`—`,t[55]=n.skillsInherit,t[56]=r.skills.effectiveAllowlist,t[57]=c,t[58]=L):L=t[58];let R;t[59]!==n.skillsEffectiveLabel||t[60]!==L?(R=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,L]}),t[59]=n.skillsEffectiveLabel,t[60]=L,t[61]=R):R=t[61];let z;t[62]!==n.skillsEmptyCatalog||t[63]!==n.skillsNoDescription||t[64]!==v||t[65]!==i||t[66]!==o||t[67]!==S||t[68]!==d||t[69]!==a||t[70]!==c||t[71]!==u?(z=a?(0,Q.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(pt,{rows:4})}):o.length===0?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Q.jsx)(`div`,{className:y(`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:o.map(e=>{let t=e.name||e.directoryId,r=c?S(t):u.has(t),a=typeof e.description==`string`?e.description.trim():``,o=a||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||i,onChange:()=>{d(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),v.saveNow({inherit:!1,skills:[...n].toSorted(mn)}),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:y(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!a&&`italic text-fg-subtle`),title:o,children:o})]})]})},t)})})}),t[62]=n.skillsEmptyCatalog,t[63]=n.skillsNoDescription,t[64]=v,t[65]=i,t[66]=o,t[67]=S,t[68]=d,t[69]=a,t[70]=c,t[71]=u,t[72]=z):z=t[72];let B;return t[73]!==P||t[74]!==I||t[75]!==R||t[76]!==z||t[77]!==E?(B=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[E,P,I,R,z]}),t[73]=P,t[74]=I,t[75]=R,t[76]=z,t[77]=E,t[78]=B):B=t[78],B}function mn(e,t){return e.localeCompare(t)}function hn(e,t){return e.localeCompare(t)}function gn(e){return e.name||e.directoryId}function _n(e,t){return e.localeCompare(t)}function vn(e,t){return e.localeCompare(t)}var yn=[`write_file`,`apply_patch`,`exec_command`],bn=[`exec_command`,`image_generate`,`extensions`],xn=[`send_message`,`send_media`];function Sn(e){let t=(0,Z.c)(87),{mode:n,builtinToolIds:r,loading:i,disableSet:a,onDisableSetChange:o,defaultsDisableSet:s,unknownDisabledIds:c,getToolDescription:l,getGroupTitle:u,labels:d,quickActionsDisabled:f}=e,p;t[0]===c?p=t[1]:(p=c===void 0?[]:c,t[0]=c,t[1]=p);let m=p,h=f===void 0?!1:f,g;t[2]===r?g=t[3]:(g=new Set(r),t[2]=r,t[3]=g);let _=g,v;t[4]===s?v=t[5]:(v=s??new Set,t[4]=s,t[5]=v);let x=v,S;t[6]!==x||t[7]!==a||t[8]!==n||t[9]!==o?(S=(e,t)=>{if(n===`agentEntry`&&t&&x.has(e))return;let r=new Set(a);t?r.delete(e):r.add(e),o(r)},t[6]=x,t[7]=a,t[8]=n,t[9]=o,t[10]=S):S=t[10];let C=S,w;t[11]!==_||t[12]!==o?(w=e=>{let t=new Set;for(let n of e)_.has(n)&&t.add(n);o(t)},t[11]=_,t[12]=o,t[13]=w):w=t[13];let T=w,E;t[14]===o?E=t[15]:(E=()=>{o(new Set)},t[14]=o,t[15]=E);let D=E,O;t[16]!==r||t[17]!==o||t[18]!==m?(O=()=>{o(new Set([...r,...m]))},t[16]=r,t[17]=o,t[18]=m,t[19]=O):O=t[19];let k=O,A;t[20]===r?A=t[21]:(A=xt(r),t[20]=r,t[21]=A);let j=A,M;if(t[22]!==_||t[23]!==j||t[24]!==n||t[25]!==m){if(M=[],n===`defaults`&&m.length>0){let e;t[27]===m?e=t[28]:(e=m.toSorted(wn),t[27]=m,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 Ct){let t=e.toolIds.filter(e=>_.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]=_,t[23]=j,t[24]=n,t[25]=m,t[26]=M}else M=t[26];let N=M,P=N.some(Cn),F=h||i,I;t[33]===d.quickActionsLabel?I=t[34]:(I=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:d.quickActionsLabel}),t[33]=d.quickActionsLabel,t[34]=I);let L=F||r.length===0&&m.length===0,R;t[35]!==D||t[36]!==d.quickEnableAll||t[37]!==L?(R=(0,Q.jsx)(b,{type:`button`,variant:`secondary`,className:Dt,disabled:L,onClick:D,children:d.quickEnableAll}),t[35]=D,t[36]=d.quickEnableAll,t[37]=L,t[38]=R):R=t[38];let z=F||r.length===0&&m.length===0,B;t[39]!==k||t[40]!==d.quickDisableAll||t[41]!==z?(B=(0,Q.jsx)(b,{type:`button`,variant:`secondary`,className:Dt,disabled:z,onClick:k,children:d.quickDisableAll}),t[39]=k,t[40]=d.quickDisableAll,t[41]=z,t[42]=B):B=t[42];let V=F||r.length===0,H;t[43]===T?H=t[44]:(H=()=>T(yn),t[43]=T,t[44]=H);let U;t[45]!==d.quickReadOnlyWorkspace||t[46]!==V||t[47]!==H?(U=(0,Q.jsx)(b,{type:`button`,variant:`secondary`,className:Dt,disabled:V,onClick:H,children:d.quickReadOnlyWorkspace}),t[45]=d.quickReadOnlyWorkspace,t[46]=V,t[47]=H,t[48]=U):U=t[48];let ee=F||r.length===0,te;t[49]===T?te=t[50]:(te=()=>T(bn),t[49]=T,t[50]=te);let W;t[51]!==d.quickHighRiskOff||t[52]!==ee||t[53]!==te?(W=(0,Q.jsx)(b,{type:`button`,variant:`secondary`,className:Dt,disabled:ee,onClick:te,children:d.quickHighRiskOff}),t[51]=d.quickHighRiskOff,t[52]=ee,t[53]=te,t[54]=W):W=t[54];let ne=F||r.length===0,G;t[55]===T?G=t[56]:(G=()=>T(xn),t[55]=T,t[56]=G);let re;t[57]!==d.quickNoOutbound||t[58]!==ne||t[59]!==G?(re=(0,Q.jsx)(b,{type:`button`,variant:`secondary`,className:Dt,disabled:ne,onClick:G,children:d.quickNoOutbound}),t[57]=d.quickNoOutbound,t[58]=ne,t[59]=G,t[60]=re):re=t[60];let ie;t[61]!==R||t[62]!==B||t[63]!==U||t[64]!==W||t[65]!==re?(ie=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[R,B,U,W,re]}),t[61]=R,t[62]=B,t[63]=U,t[64]=W,t[65]=re,t[66]=ie):ie=t[66];let K;t[67]!==I||t[68]!==ie?(K=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[I,ie]}),t[67]=I,t[68]=ie,t[69]=K):K=t[69];let q;t[70]!==x||t[71]!==a||t[72]!==u||t[73]!==l||t[74]!==N||t[75]!==P||t[76]!==d.emptyBuiltin||t[77]!==d.lockedByDefaults||t[78]!==d.notInBuiltin||t[79]!==i||t[80]!==n||t[81]!==F||t[82]!==C?(q=i?(0,Q.jsx)(pt,{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:u(t)}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>{let r=n===`defaults`&&t===`unknown`,i=n===`agentEntry`&&x.has(e),o=a.has(e),s=i?!1:!o,c=l(e);return(0,Q.jsx)(`li`,{className:y(`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,r&&`bg-surface-panel/50`,i&&`opacity-60`),children:(0,Q.jsxs)(`label`,{className:y(`flex gap-3 text-sm`,i?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:s,disabled:i||F,onChange:()=>C(e,!s)}),(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:[`(`,d.notInBuiltin,`)`]}):null,i?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,d.lockedByDefaults,`)`]}):null]}),c?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:c}):null]})]})},e)})})]},t)})})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:d.emptyBuiltin}),t[70]=x,t[71]=a,t[72]=u,t[73]=l,t[74]=N,t[75]=P,t[76]=d.emptyBuiltin,t[77]=d.lockedByDefaults,t[78]=d.notInBuiltin,t[79]=i,t[80]=n,t[81]=F,t[82]=C,t[83]=q):q=t[83];let ae;return t[84]!==K||t[85]!==q?(ae=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[K,q]}),t[84]=K,t[85]=q,t[86]=ae):ae=t[86],ae}function Cn(e){return e.ids.length>0}function wn(e,t){return e.localeCompare(t)}function Tn(e){let t=(0,Z.c)(60),{a:n,data:r,selected:i,busy:a,toolEntryDisable:o,setToolEntryDisable:s,onSaveTools:c,onClearToolsEntry:l}=e,u=D(An),d;t[0]===u?d=t[1]:(d=T(u),t[0]=u,t[1]=d);let f=d.agentSettings.advanced,p;t[2]===i.tools.presetDenied?p=t[3]:(p=new Set(i.tools.presetDenied.flatMap(kn)),t[2]=i.tools.presetDenied,t[3]=p);let m=p,h;t[4]===o?h=t[5]:(h=[...o].toSorted(On),t[4]=o,t[5]=h);let g=h,_;t[6]===i.tools.entryDisable?_=t[7]:(_=[...i.tools.entryDisable].toSorted(Dn),t[6]=i.tools.entryDisable,t[7]=_);let v=_,y;t[8]===g?y=t[9]:(y=JSON.stringify(g),t[8]=g,t[9]=y);let x;t[10]===v?x=t[11]:(x=JSON.stringify(v),t[10]=v,t[11]=x);let S=y!==x,C;t[12]!==S||t[13]!==g||t[14]!==c?(C={value:g,dirty:S,onSave:c,delayMs:350},t[12]=S,t[13]=g,t[14]=c,t[15]=C):C=t[15];let w=gt(C),E;t[16]!==w||t[17]!==s?(E=e=>{s(e),w.saveNow([...e].toSorted(En))},t[16]=w,t[17]=s,t[18]=E):E=t[18];let O=E,k=n.toolsDisableGroups,A;t[19]===k?A=t[20]:(A=e=>k[e],t[19]=k,t[20]=A);let j=A,M;t[21]===n.toolDescriptions?M=t[22]:(M=e=>e in n.toolDescriptions?n.toolDescriptions[e]:``,t[21]=n.toolDescriptions,t[22]=M);let N=M,P;t[23]!==w.error||t[24]!==w.status?(P=(0,Q.jsx)(ht,{status:w.status,error:w.error}),t[23]=w.error,t[24]=w.status,t[25]=P):P=t[25];let F;t[26]!==n.toolsHint||t[27]!==n.toolsTitle||t[28]!==P?(F=(0,Q.jsx)(_t,{className:`shrink-0`,icon:he,title:n.toolsTitle,subtitle:n.toolsHint,trailing:P}),t[26]=n.toolsHint,t[27]=n.toolsTitle,t[28]=P,t[29]=F):F=t[29];let I;t[30]!==n.toolsLockedByPreset||t[31]!==f.toolsDisableEmptyBuiltin||t[32]!==f.toolsDisableLoadingBuiltin||t[33]!==f.toolsDisableNotInBuiltin||t[34]!==f.toolsDisableQuickActionsLabel||t[35]!==f.toolsDisableQuickDisableAll||t[36]!==f.toolsDisableQuickEnableAll||t[37]!==f.toolsDisableQuickHighRiskOff||t[38]!==f.toolsDisableQuickNoOutbound||t[39]!==f.toolsDisableQuickReadOnlyWorkspace?(I={loadingBuiltin:f.toolsDisableLoadingBuiltin,emptyBuiltin:f.toolsDisableEmptyBuiltin,quickActionsLabel:f.toolsDisableQuickActionsLabel,quickEnableAll:f.toolsDisableQuickEnableAll,quickDisableAll:f.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:f.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:f.toolsDisableQuickHighRiskOff,quickNoOutbound:f.toolsDisableQuickNoOutbound,notInBuiltin:f.toolsDisableNotInBuiltin,lockedByDefaults:n.toolsLockedByPreset},t[30]=n.toolsLockedByPreset,t[31]=f.toolsDisableEmptyBuiltin,t[32]=f.toolsDisableLoadingBuiltin,t[33]=f.toolsDisableNotInBuiltin,t[34]=f.toolsDisableQuickActionsLabel,t[35]=f.toolsDisableQuickDisableAll,t[36]=f.toolsDisableQuickEnableAll,t[37]=f.toolsDisableQuickHighRiskOff,t[38]=f.toolsDisableQuickNoOutbound,t[39]=f.toolsDisableQuickReadOnlyWorkspace,t[40]=I):I=t[40];let L;t[41]!==a||t[42]!==r.builtinToolIds||t[43]!==j||t[44]!==N||t[45]!==O||t[46]!==m||t[47]!==I||t[48]!==o?(L=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Sn,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:o,onDisableSetChange:O,defaultsDisableSet:m,getToolDescription:N,getGroupTitle:j,quickActionsDisabled:a,labels:I})}),t[41]=a,t[42]=r.builtinToolIds,t[43]=j,t[44]=N,t[45]=O,t[46]=m,t[47]=I,t[48]=o,t[49]=L):L=t[49];let R;t[50]===l?R=t[51]:(R=()=>void l(),t[50]=l,t[51]=R);let z;t[52]!==n.toolsClearEntry||t[53]!==a||t[54]!==R?(z=(0,Q.jsx)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:(0,Q.jsx)(b,{type:`button`,variant:`secondary`,disabled:a,onClick:R,children:n.toolsClearEntry})}),t[52]=n.toolsClearEntry,t[53]=a,t[54]=R,t[55]=z):z=t[55];let B;return t[56]!==F||t[57]!==L||t[58]!==z?(B=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[F,L,z]}),t[56]=F,t[57]=L,t[58]=z,t[59]=B):B=t[59],B}function En(e,t){return e.localeCompare(t)}function Dn(e,t){return e.localeCompare(t)}function On(e,t){return e.localeCompare(t)}function kn(e){let t=String(e).trim();return t?[t]:[]}function An(e){return e.language}function jn(e){let t=(0,Z.c)(36),[n,r]=(0,$.useState)(`tools`),{a:i}=e,a;t[0]===i.capabilitiesHint?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`mb-3 max-w-[70ch] text-sm leading-6 text-fg-muted`,children:i.capabilitiesHint}),t[0]=i.capabilitiesHint,t[1]=a);let o;t[2]===i.capabilitiesToolsTab?o=t[3]:(o={id:`tools`,label:i.capabilitiesToolsTab,icon:he},t[2]=i.capabilitiesToolsTab,t[3]=o);let s;t[4]===i.capabilitiesSkillsTab?s=t[5]:(s={id:`skills`,label:i.capabilitiesSkillsTab,icon:ye},t[4]=i.capabilitiesSkillsTab,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=[o,s],t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]!==i.capabilitiesNavAria||t[10]!==n||t[11]!==c?(l=(0,Q.jsx)(yt,{items:c,activeTab:n,onChange:r,ariaLabel:i.capabilitiesNavAria,tabIdPrefix:`agent-capabilities-tab`,panelIdPrefix:`agent-capabilities-panel`}),t[9]=i.capabilitiesNavAria,t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;t[13]!==a||t[14]!==l?(u=(0,Q.jsxs)(`div`,{className:`shrink-0`,children:[a,l]}),t[13]=a,t[14]=l,t[15]=u):u=t[15];let d;t[16]!==i||t[17]!==n||t[18]!==e.busy||t[19]!==e.catalogForPick||t[20]!==e.data||t[21]!==e.onClearToolsEntry||t[22]!==e.onSaveSkills||t[23]!==e.onSaveTools||t[24]!==e.selected||t[25]!==e.setSkillsInherit||t[26]!==e.setSkillsPick||t[27]!==e.setToolEntryDisable||t[28]!==e.skillsCatalogLoading||t[29]!==e.skillsInherit||t[30]!==e.skillsPick||t[31]!==e.toolEntryDisable?(d=n===`tools`?(0,Q.jsx)(Tn,{a:i,data:e.data,selected:e.selected,busy:e.busy,toolEntryDisable:e.toolEntryDisable,setToolEntryDisable:e.setToolEntryDisable,onSaveTools:e.onSaveTools,onClearToolsEntry:e.onClearToolsEntry}):(0,Q.jsx)(pn,{a:i,selected:e.selected,busy:e.busy,skillsCatalogLoading:e.skillsCatalogLoading,catalogForPick:e.catalogForPick,skillsInherit:e.skillsInherit,setSkillsInherit:e.setSkillsInherit,skillsPick:e.skillsPick,setSkillsPick:e.setSkillsPick,onSaveSkills:e.onSaveSkills}),t[16]=i,t[17]=n,t[18]=e.busy,t[19]=e.catalogForPick,t[20]=e.data,t[21]=e.onClearToolsEntry,t[22]=e.onSaveSkills,t[23]=e.onSaveTools,t[24]=e.selected,t[25]=e.setSkillsInherit,t[26]=e.setSkillsPick,t[27]=e.setToolEntryDisable,t[28]=e.skillsCatalogLoading,t[29]=e.skillsInherit,t[30]=e.skillsPick,t[31]=e.toolEntryDisable,t[32]=d):d=t[32];let f;return t[33]!==u||t[34]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[u,d]}),t[33]=u,t[34]=d,t[35]=f):f=t[35],f}var Mn=y(x,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function Nn(e){let t=(0,Z.c)(59),{a:n,busy:r,bindingsLoading:i,agentBindings:a,onRemoveBinding:o,onAddBinding:s,channelStatuses:c,channelsStatusLoading:l,useManualChannel:u,newBindChannel:f,setNewBindChannel:m,bindSessionChats:h,sessionsLoading:g,newBindSessionIdx:_,setNewBindSessionIdx:v,newBindCustomPeer:x,setNewBindCustomPeer:S,onRefreshSessions:C,lastActiveLabels:w,selectRecipient:T}=e,E=!l&&(u||c.length>0),D;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(D=(0,Q.jsx)(_t,{className:`shrink-0`,icon:Ke,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=D):D=t[2];let O;t[3]!==n.channelsNone||t[4]!==n.removeBinding||t[5]!==a||t[6]!==i||t[7]!==r||t[8]!==o?(O=i?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map(Pn)}):a.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:a.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:cn(e.match)}),(0,Q.jsx)(b,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void o(e),children:n.removeBinding})]},`${e.match.channel}-${cn(e.match)}`))}),t[3]=n.channelsNone,t[4]=n.removeBinding,t[5]=a,t[6]=i,t[7]=r,t[8]=o,t[9]=O):O=t[9];let k;t[10]!==n.channelLabel||t[11]!==n.channelsDisabledSuffix||t[12]!==n.channelsManualChannelHint||t[13]!==c||t[14]!==l||t[15]!==f||t[16]!==m||t[17]!==S||t[18]!==v||t[19]!==u?(k=l?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(G,{className:`h-4 w-24`}),(0,Q.jsx)(G,{className:`h-10 w-full rounded-lg`})]}):u?(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:sn(),value:f,onChange:e=>m(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)(d,{className:y(sn(),`py-2`),value:f,onChange:e=>{m(e.target.value),v(null),S(``)},children:c.map(e=>(0,Q.jsxs)(p,{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]=c,t[14]=l,t[15]=f,t[16]=m,t[17]=S,t[18]=v,t[19]=u,t[20]=k):k=t[20];let A;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]!==w||t[33]!==f||t[34]!==x||t[35]!==_||t[36]!==C||t[37]!==T||t[38]!==g||t[39]!==S||t[40]!==v||t[41]!==E?(A=E&&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)(b,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||g||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>C(),children:[(0,Q.jsx)(J,{className:y(`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)(G,{className:`h-4 w-32`}),(0,Q.jsx)(G,{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)(d,{className:y(sn(),`py-2`),value:_==null?``:String(_),disabled:r||!f.trim()||!!x.trim(),onChange:e=>{let t=e.target.value;v(t===``?null:Number(t))},children:[(0,Q.jsx)(p,{value:``,children:n.channelsPeerAny}),h.map((e,t)=>(0,Q.jsx)(p,{value:String(t),children:Mt(e,w)},`${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:y(sn(),`min-w-0 w-full sm:flex-1`),value:x,onChange:e=>{S(e.target.value),e.target.value.trim()&&v(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(d,{className:Mn,value:x,onChange:e=>{let t=e.target.value;S(t||``),v(null)},children:[(0,Q.jsx)(p,{value:``,children:T}),h.map(e=>(0,Q.jsx)(p,{value:e.chatId,children:Mt(e,w)},`${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]=w,t[33]=f,t[34]=x,t[35]=_,t[36]=C,t[37]=T,t[38]=g,t[39]=S,t[40]=v,t[41]=E,t[42]=A):A=t[42];let j;t[43]!==r||t[44]!==l||t[45]!==f?(j=r||!f.trim()||l,t[43]=r,t[44]=l,t[45]=f,t[46]=j):j=t[46];let M;t[47]!==n.addBinding||t[48]!==j?(M=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(b,{type:`submit`,disabled:j,children:n.addBinding})}),t[47]=n.addBinding,t[48]=j,t[49]=M):M=t[49];let N;t[50]!==s||t[51]!==k||t[52]!==A||t[53]!==M?(N=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:s,children:[k,A,M]}),t[50]=s,t[51]=k,t[52]=A,t[53]=M,t[54]=N):N=t[54];let P;return t[55]!==D||t[56]!==O||t[57]!==N?(P=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[D,O,N]}),t[55]=D,t[56]=O,t[57]=N,t[58]=P):P=t[58],P}function Pn(e,t){return(0,Q.jsx)(G,{className:`h-10 rounded-lg`},t)}function Fn(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 In(e){let{agentId:t,value:n,onChange:r,a:i,id:a}=e,o=(0,$.useRef)(null),[s,u]=(0,$.useState)(!1),[d,p]=(0,$.useState)(null),[h,g]=(0,$.useState)(!1),_=(0,$.useMemo)(()=>{let e=et(n.trim());return e&&it(e.styleId)?e.styleId:De[0]??`adventurer`},[n]),v=(0,$.useCallback)(async(e,n)=>{try{await xe(t)}catch{}r(Ue(e,n)),g(!1)},[t,r]),x=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){p(null),u(!0);try{await Fe(t,n),rt(t),r(ne)}catch(e){let t=e instanceof Error?e.message:``;p(t===`avatar_too_large`?i.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?i.avatarInvalidImage:i.avatarUploadFailed)}finally{u(!1)}}},[i,t,r]),S=(e,t)=>{let r=et(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...a?{id:a}:{},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:i.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:o,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void x(e)}),(0,Q.jsxs)(b,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:s,onClick:()=>o.current?.click(),children:[(0,Q.jsx)(at,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),s?i.avatarUploading:i.avatarUploadCustom]})]})]}),d?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:d}):null,(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:De.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void v(e,Y[0]??t),className:y(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,C.press,_===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:Fn(e,i)},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:[Y.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void v(_,e),className:y(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,C.press,S(_,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(_,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(l,{open:h,onOpenChange:g,children:[(0,Q.jsx)(f,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:y(`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`,C.press),children:i.avatarMore})}),(0,Q.jsx)(c,{children:(0,Q.jsxs)(m,{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:Fn(_,i)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Le.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void v(_,e),className:y(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,C.press,S(_,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(_,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:i.personaAvatar}),(0,Q.jsx)(ze,{agentId:t,avatar:n,size:40}),n.trim()&&!et(n.trim())&&n.trim()!==`xopc:custom`?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}var Ln={name:``,description:``,language:``,creature:``,emoji:``,avatar:``};function Rn(e){let t={...Ln};if(!e.trim())return t;let n={name:`name`,description:`description`,language:`language`,creature:`creature`,emoji:`emoji`,avatar:`avatar`};for(let r of e.split(`
2
+ `)){let e=r.match(/^[-*]\s+\*\*(\w+):\*\*\s*(.*)/i);if(!e)continue;let i=n[e[1].toLowerCase()];if(!i)continue;let a=e[2].trim();/^_\(.*\)_$/.test(a)&&(a=``),t[i]=a}return t}function zn(e){return[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${e.name}`,`- **Description:** ${e.description}`,`- **Language:** ${e.language}`,`- **Creature:** ${e.creature}`,`- **Emoji:** ${e.emoji}`,`- **Avatar:** ${e.avatar}`,``].join(`
3
+ `)}var Bn=[{id:`professional`,labelEn:`Professional & Efficient`,labelZh:`专业高效`,emoji:`🎯`,content:`# SOUL.md - Who You Are
4
+
5
+ ## Core Truths
6
+
7
+ **Be genuinely helpful, not performatively helpful.** Skip the filler words — just help. Actions speak louder than pleasantries.
8
+
9
+ **Be precise and efficient.** Value the user's time. Give concise, actionable answers. Expand only when asked.
10
+
11
+ **Earn trust through competence.** Be careful with external actions. Be bold with internal ones (reading, organizing, learning).
12
+
13
+ **Remember you're a guest.** You have access to someone's life. Treat it with respect.
14
+
15
+ ## Boundaries
16
+
17
+ - Private things stay private. Period.
18
+ - When in doubt, ask before acting externally.
19
+ - Never send half-baked replies to messaging surfaces.
20
+
21
+ ## Vibe
22
+
23
+ Professional, competent, and respectful. Concise when needed, thorough when it matters.`},{id:`casual`,labelEn:`Warm & Friendly`,labelZh:`轻松友好`,emoji:`😊`,content:`# SOUL.md - Who You Are
24
+
25
+ ## Core Truths
26
+
27
+ **Be a good friend, not a corporate drone.** Be warm, genuine, and real. Skip the formality when it gets in the way.
28
+
29
+ **Have personality.** You're allowed to be amused, surprised, or excited. An assistant with no personality is just a search engine.
30
+
31
+ **Be resourceful before asking.** Try to figure it out first. Then ask if you're stuck.
32
+
33
+ **Earn trust by being reliable.** Show up, follow through, and remember what matters.
34
+
35
+ **Respect the intimacy.** You have access to someone's life. That's a privilege.
36
+
37
+ ## Boundaries
38
+
39
+ - Private things stay private. Always.
40
+ - When in doubt, ask before acting externally.
41
+ - Be careful in group chats — you're not the user's voice.
42
+
43
+ ## Vibe
44
+
45
+ Warm, friendly, and a little playful. Like a helpful friend who happens to know everything.`},{id:`geeky`,labelEn:`Geeky & Witty`,labelZh:`极客风格`,emoji:`🧑‍💻`,content:`# SOUL.md - Who You Are
46
+
47
+ ## Core Truths
48
+
49
+ **Precision over politeness.** "This is broken" beats "This might be worth considering." Be direct.
50
+
51
+ **Have opinions.** Disagree, prefer things, find stuff interesting or dull. No personality = no value.
52
+
53
+ **Go deep.** When something is interesting, explore it. Surface-level answers are for search engines.
54
+
55
+ **Be resourceful.** Read the file. Check the context. Search for it. Come back with answers, not questions.
56
+
57
+ **Earn trust through competence.** Be careful with external actions. Be bold with internal ones.
58
+
59
+ ## Boundaries
60
+
61
+ - Private things stay private.
62
+ - When in doubt, ask before acting externally.
63
+ - Never send half-baked replies.
64
+
65
+ ## Vibe
66
+
67
+ Sharp, direct, slightly nerdy. The kind of engineer you'd want on your team — competent, opinionated, and occasionally funny.`},{id:`custom`,labelEn:`Custom`,labelZh:`自定义`,emoji:`✍️`,content:``}];function Vn(e){let t=e.trimStart();if(!t.startsWith(`---`))return e;let n=t.indexOf(`---`,3);return n===-1?e:t.slice(n+3).trimStart()}function Hn(e){let t=Vn(e).trim();if(!t)return`professional`;for(let e of Bn)if(e.id!==`custom`&&(t===e.content.trim()||Wn(t,e.id)>=2))return e.id;return`custom`}var Un={professional:/precise and efficient|Value the user's time|actionable answers/g,casual:/good friend|corporate drone|a little playful/g,geeky:/Precision over politeness|Go deep|slightly nerdy/g};function Wn(e,t){let n=Un[t];if(!n)return 0;let r=new RegExp(n.source,`g`),i=new Set,a;for(;(a=r.exec(e))!==null;)if(i.add(a[0]),i.size>=2)return i.size;return i.size}var Gn=[{value:`AI assistant`,labelEn:`AI Assistant`,labelZh:`AI 助手`},{value:`robot`,labelEn:`Robot`,labelZh:`机器人`},{value:`familiar`,labelEn:`Familiar`,labelZh:`精灵`},{value:`ghost in the machine`,labelEn:`Ghost in the machine`,labelZh:`机器幽灵`},{value:`digital companion`,labelEn:`Digital Companion`,labelZh:`数字伙伴`}];function Kn(e){let t=(0,Z.c)(185),{a:n,selected:r,busy:i,editName:a,setEditName:o,editDescription:c,setEditDescription:l,profileMarkdownLoading:u,profileDraft:f,updateIdentity:m,handleSoulTemplateChange:_,handleSoulContentChange:b,setAvatarDialogOpen:x,toggleSoulPreviewMode:S,autosave:C}=e,T=D(Yn),E=O(Jn),j;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(j=sn(),t[0]=j):j=t[0];let z=j,B;t[1]===T?B=t[2]:(B=(e,t)=>T===`zh`?t:e,t[1]=T,t[2]=B);let V=B;if(!r){let e;return t[3]===n.selectAgentHint?e=t[4]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[3]=n.selectAgentHint,t[4]=e),e}if(u||!f){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(mt,{rows:4}),t[5]=e):e=t[5],e}let H=f.identity,U=f.soulTemplate,ee=f.soulCustomContent,te=f.soulEditorNonce,W=f.soulPreviewMode,ne=f.avatarDialogOpen,G=C.onBlurCapture,re;t[6]!==C.error||t[7]!==C.status?(re=(0,Q.jsx)(ht,{status:C.status,error:C.error}),t[6]=C.error,t[7]=C.status,t[8]=re):re=t[8];let ie;t[9]!==H.avatar||t[10]!==r.id?(ie=(0,Q.jsx)(ze,{agentId:r.id,avatar:H.avatar,size:36,className:`size-9 rounded-lg`}),t[9]=H.avatar,t[10]=r.id,t[11]=ie):ie=t[11];let K;t[12]===x?K=t[13]:(K=()=>x(!0),t[12]=x,t[13]=K);let q;t[14]!==n.avatarOpenSettingsAria||t[15]!==K?(q={onClick:K,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[14]=n.avatarOpenSettingsAria,t[15]=K,t[16]=q):q=t[16];let oe;t[17]!==n.personaSectionIdentity||t[18]!==n.personaSectionIdentityHint||t[19]!==re||t[20]!==ie||t[21]!==q?(oe=(0,Q.jsx)(_t,{icon:ot,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,trailing:re,iconLeading:ie,iconInteractive:q}),t[17]=n.personaSectionIdentity,t[18]=n.personaSectionIdentityHint,t[19]=re,t[20]=ie,t[21]=q,t[22]=oe):oe=t[22];let se;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(se=(0,Q.jsx)(M,{className:y(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,A)}),t[23]=se):se=t[23];let ce;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(ce=y(`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`,k),t[24]=ce):ce=t[24];let ue;t[25]===n.avatarPickerTitle?ue=t[26]:(ue=(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[25]=n.avatarPickerTitle,t[26]=ue);let de;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(de=y(w,`shrink-0 p-1.5 hover:bg-surface-base`),t[27]=de):de=t[27];let fe;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,Q.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[28]=fe):fe=t[28];let pe;t[29]===n.closeDialogAria?pe=t[30]:(pe=(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:de,"aria-label":n.closeDialogAria,children:fe})}),t[29]=n.closeDialogAria,t[30]=pe);let me;t[31]!==ue||t[32]!==pe?(me=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[ue,pe]}),t[31]=ue,t[32]=pe,t[33]=me):me=t[33];let he;t[34]===n.avatarRowHint?he=t[35]:(he=(0,Q.jsx)(N,{className:`sr-only`,children:n.avatarRowHint}),t[34]=n.avatarRowHint,t[35]=he);let ge;t[36]===m?ge=t[37]:(ge=e=>m({avatar:e}),t[36]=m,t[37]=ge);let _e;t[38]!==n||t[39]!==H.avatar||t[40]!==r.id||t[41]!==ge?(_e=(0,Q.jsx)(In,{agentId:r.id,value:H.avatar,onChange:ge,a:n}),t[38]=n,t[39]=H.avatar,t[40]=r.id,t[41]=ge,t[42]=_e):_e=t[42];let ve;t[43]!==me||t[44]!==he||t[45]!==_e?(ve=(0,Q.jsxs)(F,{children:[se,(0,Q.jsxs)(I,{className:ce,onOpenAutoFocus:qn,children:[me,he,_e]})]}),t[43]=me,t[44]=he,t[45]=_e,t[46]=ve):ve=t[46];let ye;t[47]!==ne||t[48]!==x||t[49]!==ve?(ye=(0,Q.jsx)(R,{open:ne,onOpenChange:x,children:ve}),t[47]=ne,t[48]=x,t[49]=ve,t[50]=ye):ye=t[50];let be;t[51]===n.displayName?be=t[52]:(be=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[51]=n.displayName,t[52]=be);let xe;t[53]!==o||t[54]!==m?(xe=e=>{o(e.target.value),m({name:e.target.value})},t[53]=o,t[54]=m,t[55]=xe):xe=t[55];let Se;t[56]!==n.personaNamePlaceholder||t[57]!==a||t[58]!==xe?(Se=(0,Q.jsx)(`input`,{className:z,value:a,onChange:xe,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[56]=n.personaNamePlaceholder,t[57]=a,t[58]=xe,t[59]=Se):Se=t[59];let J;t[60]!==be||t[61]!==Se?(J=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[be,Se]}),t[60]=be,t[61]=Se,t[62]=J):J=t[62];let Ce;t[63]===n.personaEmoji?Ce=t[64]:(Ce=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[63]=n.personaEmoji,t[64]=Ce);let we;t[65]===m?we=t[66]:(we=e=>m({emoji:e.target.value}),t[65]=m,t[66]=we);let Te;t[67]!==n.personaEmojiPlaceholder||t[68]!==H.emoji||t[69]!==we?(Te=(0,Q.jsx)(`input`,{className:z,value:H.emoji,onChange:we,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[67]=n.personaEmojiPlaceholder,t[68]=H.emoji,t[69]=we,t[70]=Te):Te=t[70];let Ee;t[71]!==Ce||t[72]!==Te?(Ee=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Ce,Te]}),t[71]=Ce,t[72]=Te,t[73]=Ee):Ee=t[73];let De;t[74]===n.agentDescription?De=t[75]:(De=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[74]=n.agentDescription,t[75]=De);let Oe;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=y(z,`min-h-16 resize-y text-sm leading-relaxed`),t[76]=Oe):Oe=t[76];let ke;t[77]!==l||t[78]!==m?(ke=e=>{l(e.target.value),m({description:e.target.value})},t[77]=l,t[78]=m,t[79]=ke):ke=t[79];let Ae;t[80]!==n.agentDescriptionPlaceholder||t[81]!==c||t[82]!==ke?(Ae=(0,Q.jsx)(`textarea`,{className:Oe,value:c,onChange:ke,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[80]=n.agentDescriptionPlaceholder,t[81]=c,t[82]=ke,t[83]=Ae):Ae=t[83];let je;t[84]!==De||t[85]!==Ae?(je=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[De,Ae]}),t[84]=De,t[85]=Ae,t[86]=je):je=t[86];let Me;t[87]===n.personaCreature?Me=t[88]:(Me=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[87]=n.personaCreature,t[88]=Me);let Ne=Gn.some(e=>e.value===H.creature)?H.creature:`__custom__`,Pe;t[89]===m?Pe=t[90]:(Pe=e=>{if(e.target.value===`__custom__`){m({creature:``});return}m({creature:e.target.value})},t[89]=m,t[90]=Pe);let Fe;t[91]===V?Fe=t[92]:(Fe=Gn.map(e=>(0,Q.jsx)(p,{value:e.value,children:V(e.labelEn,e.labelZh)},e.value)),t[91]=V,t[92]=Fe);let Ie;t[93]===V?Ie=t[94]:(Ie=V(`Custom…`,`自定义…`),t[93]=V,t[94]=Ie);let Le;t[95]===Ie?Le=t[96]:(Le=(0,Q.jsx)(p,{value:`__custom__`,children:Ie}),t[95]=Ie,t[96]=Le);let Y;t[97]!==Ne||t[98]!==Pe||t[99]!==Fe||t[100]!==Le?(Y=(0,Q.jsxs)(d,{className:z,value:Ne,onChange:Pe,children:[Fe,Le]}),t[97]=Ne,t[98]=Pe,t[99]=Fe,t[100]=Le,t[101]=Y):Y=t[101];let Ve;t[102]!==n.personaCreaturePlaceholder||t[103]!==H.creature||t[104]!==m?(Ve=Gn.some(e=>e.value===H.creature)?null:(0,Q.jsx)(`input`,{className:y(z,`mt-1 text-xs`),value:H.creature,onChange:e=>m({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[102]=n.personaCreaturePlaceholder,t[103]=H.creature,t[104]=m,t[105]=Ve):Ve=t[105];let He;t[106]!==Me||t[107]!==Y||t[108]!==Ve?(He=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[Me,Y,Ve]}),t[106]=Me,t[107]=Y,t[108]=Ve,t[109]=He):He=t[109];let Ue;t[110]!==J||t[111]!==Ee||t[112]!==je||t[113]!==He?(Ue=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[J,Ee,je,He]}),t[110]=J,t[111]=Ee,t[112]=je,t[113]=He,t[114]=Ue):Ue=t[114];let We;t[115]!==ye||t[116]!==Ue||t[117]!==oe?(We=(0,Q.jsxs)(vt,{children:[oe,ye,Ue]}),t[115]=ye,t[116]=Ue,t[117]=oe,t[118]=We):We=t[118];let Ge;t[119]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,Q.jsx)(ae,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[119]=Ge):Ge=t[119];let Ke;t[120]===n.sharedUserContextTitle?Ke=t[121]:(Ke=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.sharedUserContextTitle}),t[120]=n.sharedUserContextTitle,t[121]=Ke);let qe;t[122]===n.sharedUserContextHint?qe=t[123]:(qe=(0,Q.jsx)(`p`,{className:`mt-0.5 max-w-[68ch] text-xs leading-5 text-fg-muted`,children:n.sharedUserContextHint}),t[122]=n.sharedUserContextHint,t[123]=qe);let Je;t[124]!==Ke||t[125]!==qe?(Je=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Ke,qe]}),t[124]=Ke,t[125]=qe,t[126]=Je):Je=t[126];let X;t[127]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,Q.jsx)(h,{className:`size-3`,"aria-hidden":!0}),t[127]=X):X=t[127];let Ye;t[128]===n.sharedUserContextLink?Ye=t[129]:(Ye=(0,Q.jsxs)(s,{to:`/you`,className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.sharedUserContextLink,X]}),t[128]=n.sharedUserContextLink,t[129]=Ye);let Xe;t[130]!==Je||t[131]!==Ye?(Xe=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[Ge,Je,Ye]}),t[130]=Je,t[131]=Ye,t[132]=Xe):Xe=t[132];let Ze;t[133]!==n.personaSectionSoul||t[134]!==n.personaSectionSoulHint?(Ze=(0,Q.jsx)(_t,{icon:Be,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),t[133]=n.personaSectionSoul,t[134]=n.personaSectionSoulHint,t[135]=Ze):Ze=t[135];let Qe;t[136]===n.personaSoulTemplate?Qe=t[137]:(Qe=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),t[136]=n.personaSoulTemplate,t[137]=Qe);let $e;t[138]===_?$e=t[139]:($e=e=>_(e.target.value),t[138]=_,t[139]=$e);let et;t[140]===V?et=t[141]:(et=Bn.map(e=>(0,Q.jsxs)(p,{value:e.id,children:[e.emoji,` `,V(e.labelEn,e.labelZh)]},e.id)),t[140]=V,t[141]=et);let tt;t[142]!==i||t[143]!==U||t[144]!==$e||t[145]!==et?(tt=(0,Q.jsx)(d,{className:z,value:U,onChange:$e,disabled:i,children:et}),t[142]=i,t[143]=U,t[144]=$e,t[145]=et,t[146]=tt):tt=t[146];let nt;t[147]===n.personaTemplateHint?nt=t[148]:(nt=(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:n.personaTemplateHint}),t[147]=n.personaTemplateHint,t[148]=nt);let rt;t[149]!==Qe||t[150]!==tt||t[151]!==nt?(rt=(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:max-w-sm`,children:[Qe,tt,nt]}),t[149]=Qe,t[150]=tt,t[151]=nt,t[152]=rt):rt=t[152];let it;t[153]===n.personaBehaviorEditorLabel?it=t[154]:(it=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaBehaviorEditorLabel}),t[153]=n.personaBehaviorEditorLabel,t[154]=it);let at;t[155]===Symbol.for(`react.memo_cache_sentinel`)?(at=y(w,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),t[155]=at):at=t[155];let st=W?n.personaSoulEdit:n.personaSoulPreview,ct=W?n.personaSoulEdit:n.personaSoulPreview,lt;t[156]===W?lt=t[157]:(lt=W?(0,Q.jsx)(le,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(Re,{className:`size-4`,"aria-hidden":!0}),t[156]=W,t[157]=lt);let dt;t[158]!==st||t[159]!==ct||t[160]!==lt||t[161]!==S?(dt=(0,Q.jsx)(`button`,{type:`button`,className:at,title:st,"aria-label":ct,onClick:S,children:lt}),t[158]=st,t[159]=ct,t[160]=lt,t[161]=S,t[162]=dt):dt=t[162];let ft;t[163]!==it||t[164]!==dt?(ft=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[it,dt]}),t[163]=it,t[164]=dt,t[165]=ft):ft=t[165];let pt;t[166]===Symbol.for(`react.memo_cache_sentinel`)?(pt=y(z,`flex min-h-64 flex-col overflow-hidden p-0`),t[166]=pt):pt=t[166];let gt;t[167]!==b||t[168]!==E||t[169]!==ee||t[170]!==te||t[171]!==W?(gt=(0,Q.jsx)(`div`,{className:pt,children:W?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(g,{content:ee})}):(0,Q.jsx)(ut,{initialContent:ee,onChange:b,isDark:E,className:`min-h-0 flex-1`},`soul-${te}`)}),t[167]=b,t[168]=E,t[169]=ee,t[170]=te,t[171]=W,t[172]=gt):gt=t[172];let yt;t[173]!==ft||t[174]!==gt?(yt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[ft,gt]}),t[173]=ft,t[174]=gt,t[175]=yt):yt=t[175];let bt;t[176]!==Ze||t[177]!==rt||t[178]!==yt?(bt=(0,Q.jsxs)(vt,{children:[Ze,rt,yt]}),t[176]=Ze,t[177]=rt,t[178]=yt,t[179]=bt):bt=t[179];let xt;return t[180]!==C.onBlurCapture||t[181]!==We||t[182]!==Xe||t[183]!==bt?(xt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,onBlurCapture:G,children:[We,Xe,bt]}),t[180]=C.onBlurCapture,t[181]=We,t[182]=Xe,t[183]=bt,t[184]=xt):xt=t[184],xt}function qn(e){return e.preventDefault()}function Jn(e){return e.resolved===`dark`}function Yn(e){return e.language}function Xn(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 Zn(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 Qn(e){let t=(0,Z.c)(117),{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=ie(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=Ze(r,n)||n.listNoDescription,t[3]=n,t[4]=r,t[5]=m):m=t[5];let h=m,g;t[6]!==n.listUnsetValue||t[7]!==i||t[8]!==r.model?.primary?(g=r.model?.primary?.trim()||i||n.listUnsetValue,t[6]=n.listUnsetValue,t[7]=i,t[8]=r.model?.primary,t[9]=g):g=t[9];let _=g,v;t[10]!==n.listUnsetValue||t[11]!==a||t[12]!==r.workspace?(v=r.workspace?.trim()||a||n.listUnsetValue,t[10]=n.listUnsetValue,t[11]=a,t[12]=r.workspace,t[13]=v):v=t[13];let y=v,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,w=r.skills.effectiveAllowlist?.length,T;t[14]!==r.avatar||t[15]!==r.id?(T=(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)(ze,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=T):T=t[16];let E;t[17]===p?E=t[18]:(E=(0,Q.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:p}),t[17]=p,t[18]=E);let D;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(D=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]=D):D=t[21];let O;t[22]!==n.tuiDefaultBadge||t[23]!==n.tuiDefaultInheritedBadge||t[24]!==o||t[25]!==s?(O=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]=O):O=t[26];let k;t[27]!==E||t[28]!==D||t[29]!==O?(k=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[E,D,O]}),t[27]=E,t[28]=D,t[29]=O,t[30]=k):k=t[30];let A;t[31]===r.id?A=t[32]:(A=(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r.id}),t[31]=r.id,t[32]=A);let j;t[33]!==A||t[34]!==k?(j=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[k,A]}),t[33]=A,t[34]=k,t[35]=j):j=t[35];let M;t[36]!==j||t[37]!==T?(M=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[T,j]}),t[36]=j,t[37]=T,t[38]=M):M=t[38];let N;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(N=d?(0,Q.jsxs)(b,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(Je,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=N):N=t[42];let P;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(P=r.isDefault?null:(0,Q.jsx)(b,{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]=P):P=t[47];let F;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(F=o?null:(0,Q.jsx)(b,{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]=F):F=t[52];let I;t[53]!==N||t[54]!==P||t[55]!==F?(I=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[N,P,F]}),t[53]=N,t[54]=P,t[55]=F,t[56]=I):I=t[56];let L;t[57]!==M||t[58]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[M,I]}),t[57]=M,t[58]=I,t[59]=L):L=t[59];let R;t[60]===h?R=t[61]:(R=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:h}),t[60]=h,t[61]=R);let z;t[62]!==L||t[63]!==R?(z=(0,Q.jsx)(vt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[L,R]})}),t[62]=L,t[63]=R,t[64]=z):z=t[64];let B;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(B=(0,Q.jsx)(_t,{icon:ot,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=B):B=t[67];let V;t[68]!==n.modelPrimary||t[69]!==x||t[70]!==_?(V=(0,Q.jsx)(Xn,{label:n.modelPrimary,value:_,badge:x,mono:!0}),t[68]=n.modelPrimary,t[69]=x,t[70]=_,t[71]=V):V=t[71];let H;t[72]!==n.workspacePath||t[73]!==S||t[74]!==y?(H=(0,Q.jsx)(Xn,{label:n.workspacePath,value:y,badge:S,mono:!0}),t[72]=n.workspacePath,t[73]=S,t[74]=y,t[75]=H):H=t[75];let U;t[76]!==V||t[77]!==H?(U=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[V,H]}),t[76]=V,t[77]=H,t[78]=U):U=t[78];let ee;t[79]!==B||t[80]!==U?(ee=(0,Q.jsxs)(vt,{children:[B,U]}),t[79]=B,t[80]=U,t[81]=ee):ee=t[81];let te;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(te=(0,Q.jsx)(_t,{icon:re,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=te):te=t[84];let W;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==C?(W=C>0?n.listToolsDisabledCount.replace(`{{count}}`,String(C)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=C,t[88]=W):W=t[88];let ne;t[89]!==n.listToolsLabel||t[90]!==W?(ne=(0,Q.jsx)(Zn,{icon:he,label:n.listToolsLabel,value:W}),t[89]=n.listToolsLabel,t[90]=W,t[91]=ne):ne=t[91];let G;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==w?(G=w?n.listSkillsCount.replace(`{{count}}`,String(w)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=w,t[95]=G):G=t[95];let K;t[96]!==n.listSkillsLabel||t[97]!==G?(K=(0,Q.jsx)(Zn,{icon:ot,label:n.listSkillsLabel,value:G}),t[96]=n.listSkillsLabel,t[97]=G,t[98]=K):K=t[98];let q;t[99]!==n.connectionsTitle||t[100]!==n.overviewConnectionsManaged?(q=(0,Q.jsx)(Zn,{icon:oe,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[99]=n.connectionsTitle,t[100]=n.overviewConnectionsManaged,t[101]=q):q=t[101];let se;t[102]!==n.overviewSharedMemoryLabel||t[103]!==n.overviewSharedMemoryValue?(se=(0,Q.jsx)(Zn,{icon:ae,label:n.overviewSharedMemoryLabel,value:n.overviewSharedMemoryValue}),t[102]=n.overviewSharedMemoryLabel,t[103]=n.overviewSharedMemoryValue,t[104]=se):se=t[104];let ce;t[105]!==ne||t[106]!==K||t[107]!==q||t[108]!==se?(ce=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ne,K,q,se]}),t[105]=ne,t[106]=K,t[107]=q,t[108]=se,t[109]=ce):ce=t[109];let le;t[110]!==te||t[111]!==ce?(le=(0,Q.jsxs)(vt,{children:[te,ce]}),t[110]=te,t[111]=ce,t[112]=le):le=t[112];let ue;return t[113]!==z||t[114]!==ee||t[115]!==le?(ue=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[z,ee,le]}),t[113]=z,t[114]=ee,t[115]=le,t[116]=ue):ue=t[116],ue}var $n=[`deep`,`fast`,`cheap`,`code`,`review`];function er(e){return $n.includes(e)}function tr(e){let{rows:t,onChange:n,disabled:r,defaultRole:i,chat:a,labels:o}=e,{data:s=[]}=z(fe,je,{revalidateOnFocus:!1}),c=(0,$.useMemo)(()=>new Set(s.filter(e=>e.vision===!0).map(e=>e.id)),[s]),l=(0,$.useRef)([]),u=(0,$.useRef)(0);for(;l.current.length<t.length;)l.current.push(`typed-model-row-${u.current++}`);l.current.length>t.length&&(l.current.length=t.length);let d=(e,r)=>{n(t.map((t,n)=>n===e?{...t,...r}:t))},f=(e,n,r)=>{let i=t[e];if(!i)return;let a=[...i.fallbacks??[]];a[n]=r,d(e,{fallbacks:a})},p=e=>{let n=t[e];n&&d(e,{fallbacks:[...n.fallbacks??[],``]})},m=(e,n)=>{let r=t[e];r&&d(e,{fallbacks:(r.fallbacks??[]).filter((e,t)=>t!==n)})},h=e=>{l.current.splice(e,1),n(t.filter((t,n)=>n!==e))},g=e=>{l.current.push(`typed-model-row-${u.current++}`),n([...t,e])},v=t.find(e=>e.model.trim())?.model??``,y=t.map((e,t)=>({row:e,index:t})),x=$n.map(e=>y.find(t=>t.row.id===e)).filter(e=>!!e),S=y.filter(e=>!er(e.row.id)),C=$n.filter(e=>!t.some(t=>t.id===e)),w=(e,t)=>{let{row:n,index:s}=e,u=n.id===i,g=[n.model,...n.fallbacks??[]].some(e=>c.has(e.trim())),v=er(n.id)?o.roleNames[n.id]:o.id,y=er(n.id)?o.roleDescriptions[n.id]:``;return(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-lg bg-surface-panel/70 p-3 shadow-surface lg:grid-cols-[minmax(0,11rem)_minmax(0,1fr)_auto] lg:items-start`,children:[t.recommended?(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:v}),u?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full border border-accent/25 bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:o.defaultBadge}):null,g?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full border border-accent/25 bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:o.visionBadge}):null]}),(0,Q.jsx)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-fg-subtle`,children:n.id}),y?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:y}):null]}):(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:o.id}),g?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full border border-accent/25 bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:o.visionBadge}):null]}),(0,Q.jsx)(`input`,{type:`text`,className:Ot(),value:n.id,disabled:r,placeholder:o.idPlaceholder,"aria-label":o.id,onChange:e=>d(s,{id:e.target.value.toLowerCase()})})]}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:o.primaryModel}),(0,Q.jsx)(Ie,{value:n.model,disabled:r,placeholder:a.modelPlaceholder,searchPlaceholder:a.modelSearchPlaceholder,noMatches:a.modelNoMatches,className:`w-full max-w-none`,contentAlign:`start`,onChange:e=>d(s,{model:e})}),g?(0,Q.jsx)(`div`,{className:`text-xs leading-relaxed text-fg-muted`,children:o.visionAutoHint}):null]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:o.fallbackModels}),(0,Q.jsxs)(b,{type:`button`,variant:`secondary`,className:`h-7 gap-1 px-2 text-xs`,disabled:r,onClick:()=>p(s),children:[(0,Q.jsx)(_,{className:`size-3.5`,strokeWidth:1.75}),o.addFallback]})]}),(n.fallbacks??[]).length>0?(0,Q.jsx)(`div`,{className:`grid gap-1.5`,children:(n.fallbacks??[]).map((e,t)=>(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-2`,children:[(0,Q.jsx)(Ie,{value:e,disabled:r,placeholder:o.fallbackPlaceholder,searchPlaceholder:a.modelSearchPlaceholder,noMatches:a.modelNoMatches,className:`w-full max-w-none`,contentAlign:`start`,onChange:e=>f(s,t,e)}),(0,Q.jsx)(b,{type:`button`,variant:`secondary`,className:`shrink-0 px-2`,disabled:r,"aria-label":o.removeFallback,onClick:()=>m(s,t),children:(0,Q.jsx)(Ve,{className:`size-4`,strokeWidth:1.75})})]},`${l.current[s]??s}-fallback-${t}`))}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-xs text-fg-muted shadow-surface`,children:o.fallbackEmptyHint})]}),(0,Q.jsx)(`input`,{type:`text`,className:Ot(),value:n.description,disabled:r,placeholder:o.descriptionPlaceholder,"aria-label":o.description,onChange:e=>d(s,{description:e.target.value})})]}),(0,Q.jsx)(b,{type:`button`,variant:`secondary`,className:`shrink-0 sm:mt-0`,disabled:r||u,"aria-label":o.remove,onClick:()=>h(s),children:(0,Q.jsx)(Ve,{className:`size-4`,strokeWidth:1.75})})]},l.current[s]??`typed-model-row-${s}`)};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-fg-muted`,children:o.recommendedTitle}),x.map(e=>w(e,{recommended:!0})),C.length>0?(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:C.map(e=>(0,Q.jsxs)(b,{type:`button`,variant:`secondary`,className:`h-8 gap-1.5 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>g({id:e,description:o.roleDescriptions[e],model:v,fallbacks:[]}),children:[(0,Q.jsx)(_,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),o.addPurpose.replace(`{name}`,o.roleNames[e])]},e))}):null]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-fg-muted`,children:o.customTitle}),S.length>0?S.map(e=>w(e,{recommended:!1})):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted shadow-surface`,children:o.noCustomRoles})]}),(0,Q.jsxs)(b,{type:`button`,variant:`secondary`,className:`w-fit gap-1.5`,disabled:r,onClick:()=>g({id:``,description:``,model:v,fallbacks:[]}),children:[(0,Q.jsx)(_,{className:`size-4 shrink-0`,strokeWidth:1.75}),o.add]})]})}function nr(e){let t=(0,Z.c)(81),{a:n,chat:r,selected:i,busy:a,modelRows:o,setModelRows:c,onSaveModels:l,onClearModelsEntry:u}=e,d,f;if(t[0]!==o||t[1]!==i.typedModels.effective){let e=Tt(i.typedModels.effective);t[4]===o?d=t[5]:(d=JSON.stringify(kt(o)?.roles??{}),t[4]=o,t[5]=d),f=JSON.stringify(kt(e)?.roles??{}),t[0]=o,t[1]=i.typedModels.effective,t[2]=d,t[3]=f}else d=t[2],f=t[3];let p=d!==f,m;t[6]!==p||t[7]!==o||t[8]!==l?(m={value:o,dirty:p,onSave:l},t[6]=p,t[7]=o,t[8]=l,t[9]=m):m=t[9];let h=gt(m),g;t[10]!==h.error||t[11]!==h.status?(g=(0,Q.jsx)(ht,{status:h.status,error:h.error}),t[10]=h.error,t[11]=h.status,t[12]=g):g=t[12];let _;t[13]!==n.modelsTabHint||t[14]!==n.modelsTabTitle||t[15]!==g?(_=(0,Q.jsx)(_t,{className:`shrink-0`,icon:st,title:n.modelsTabTitle,subtitle:n.modelsTabHint,trailing:g}),t[13]=n.modelsTabHint,t[14]=n.modelsTabTitle,t[15]=g,t[16]=_):_=t[16];let v;t[17]===n.modelsPresetLabel?v=t[18]:(v=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[17]=n.modelsPresetLabel,t[18]=v);let y;t[19]===i.typedModels.preset?y=t[20]:(y=Et(i.typedModels.preset),t[19]=i.typedModels.preset,t[20]=y);let x;t[21]!==v||t[22]!==y?(x=(0,Q.jsxs)(`div`,{children:[v,` `,y]}),t[21]=v,t[22]=y,t[23]=x):x=t[23];let S;t[24]===n.modelsEffectiveLabel?S=t[25]:(S=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[24]=n.modelsEffectiveLabel,t[25]=S);let C;t[26]===i.typedModels.effective?C=t[27]:(C=Et(i.typedModels.effective),t[26]=i.typedModels.effective,t[27]=C);let w;t[28]!==S||t[29]!==C?(w=(0,Q.jsxs)(`div`,{children:[S,` `,C]}),t[28]=S,t[29]=C,t[30]=w):w=t[30];let T;t[31]!==w||t[32]!==x?(T=(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:[x,w]}),t[31]=w,t[32]=x,t[33]=T):T=t[33];let E;t[34]!==n.addTypedModel||t[35]!==n.addTypedModelPurpose||t[36]!==n.removeTypedModel||t[37]!==n.typedModelAddFallback||t[38]!==n.typedModelCustomTitle||t[39]!==n.typedModelDefaultBadge||t[40]!==n.typedModelDescriptionLabel||t[41]!==n.typedModelDescriptionPlaceholder||t[42]!==n.typedModelFallbackEmptyHint||t[43]!==n.typedModelFallbackModelsLabel||t[44]!==n.typedModelFallbackPlaceholder||t[45]!==n.typedModelIdLabel||t[46]!==n.typedModelIdPlaceholder||t[47]!==n.typedModelNoCustomRoles||t[48]!==n.typedModelPrimaryModelLabel||t[49]!==n.typedModelRecommendedTitle||t[50]!==n.typedModelRemoveFallback||t[51]!==n.typedModelRoleDescriptions||t[52]!==n.typedModelRoleNames||t[53]!==n.typedModelVisionAutoHint||t[54]!==n.typedModelVisionBadge?(E={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[34]=n.addTypedModel,t[35]=n.addTypedModelPurpose,t[36]=n.removeTypedModel,t[37]=n.typedModelAddFallback,t[38]=n.typedModelCustomTitle,t[39]=n.typedModelDefaultBadge,t[40]=n.typedModelDescriptionLabel,t[41]=n.typedModelDescriptionPlaceholder,t[42]=n.typedModelFallbackEmptyHint,t[43]=n.typedModelFallbackModelsLabel,t[44]=n.typedModelFallbackPlaceholder,t[45]=n.typedModelIdLabel,t[46]=n.typedModelIdPlaceholder,t[47]=n.typedModelNoCustomRoles,t[48]=n.typedModelPrimaryModelLabel,t[49]=n.typedModelRecommendedTitle,t[50]=n.typedModelRemoveFallback,t[51]=n.typedModelRoleDescriptions,t[52]=n.typedModelRoleNames,t[53]=n.typedModelVisionAutoHint,t[54]=n.typedModelVisionBadge,t[55]=E):E=t[55];let D;t[56]!==a||t[57]!==r||t[58]!==o||t[59]!==i.typedModels.defaultRole||t[60]!==c||t[61]!==E?(D=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(tr,{rows:o,onChange:c,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:E})}),t[56]=a,t[57]=r,t[58]=o,t[59]=i.typedModels.defaultRole,t[60]=c,t[61]=E,t[62]=D):D=t[62];let O;t[63]===u?O=t[64]:(O=()=>void u(),t[63]=u,t[64]=O);let k;t[65]!==n.modelsResetInherit||t[66]!==a||t[67]!==O?(k=(0,Q.jsx)(b,{type:`button`,variant:`secondary`,disabled:a,onClick:O,children:n.modelsResetInherit}),t[65]=n.modelsResetInherit,t[66]=a,t[67]=O,t[68]=k):k=t[68];let A,j;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(A=Te(`models`),j=(0,Q.jsx)(se,{className:`size-4`,"aria-hidden":!0}),t[69]=A,t[70]=j):(A=t[69],j=t[70]);let M;t[71]===n.modelsDefaultsLink?M=t[72]:(M=(0,Q.jsx)(b,{asChild:!0,variant:`ghost`,children:(0,Q.jsxs)(s,{to:A,children:[j,n.modelsDefaultsLink]})}),t[71]=n.modelsDefaultsLink,t[72]=M);let N;t[73]!==k||t[74]!==M?(N=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[k,M]}),t[73]=k,t[74]=M,t[75]=N):N=t[75];let P;return t[76]!==T||t[77]!==D||t[78]!==N||t[79]!==_?(P=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[_,T,D,N]}),t[76]=T,t[77]=D,t[78]=N,t[79]=_,t[80]=P):P=t[80],P}function rr(e){let t=(0,Z.c)(40),{a:n,chat:r,selected:i,busy:a,editWorkspace:o,setEditWorkspace:s,onSaveWorkspace:c,modelRows:l,setModelRows:u,onSaveModels:d,onClearModelsEntry:f}=e,p;t[0]===o?p=t[1]:(p=o.trim(),t[0]=o,t[1]=p);let m=p!==i.workspace,h;t[2]!==o||t[3]!==c||t[4]!==m?(h={value:o,dirty:m,onSave:c},t[2]=o,t[3]=c,t[4]=m,t[5]=h):h=t[5];let g=gt(h),_=g.onBlurCapture,v;t[6]!==g.error||t[7]!==g.status?(v=(0,Q.jsx)(ht,{status:g.status,error:g.error}),t[6]=g.error,t[7]=g.status,t[8]=v):v=t[8];let b;t[9]!==n.runtimeWorkspaceHint||t[10]!==n.runtimeWorkspaceTitle||t[11]!==v?(b=(0,Q.jsx)(_t,{icon:ue,title:n.runtimeWorkspaceTitle,subtitle:n.runtimeWorkspaceHint,trailing:v}),t[9]=n.runtimeWorkspaceHint,t[10]=n.runtimeWorkspaceTitle,t[11]=v,t[12]=b):b=t[12];let x;t[13]===n.workspacePath?x=t[14]:(x=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[13]=n.workspacePath,t[14]=x);let S=r.workingDirectory,C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=y(sn(),`font-mono text-xs`),t[15]=C):C=t[15];let w;t[16]!==a||t[17]!==r.workingDirectory||t[18]!==o||t[19]!==s?(w=(0,Q.jsx)(Nt,{value:o,onChange:s,disabled:a,wd:S,inputClassName:C}),t[16]=a,t[17]=r.workingDirectory,t[18]=o,t[19]=s,t[20]=w):w=t[20];let T;t[21]!==x||t[22]!==w?(T=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[x,w]}),t[21]=x,t[22]=w,t[23]=T):T=t[23];let E;t[24]!==b||t[25]!==T||t[26]!==g.onBlurCapture?(E=(0,Q.jsxs)(vt,{onBlurCapture:_,children:[b,T]}),t[24]=b,t[25]=T,t[26]=g.onBlurCapture,t[27]=E):E=t[27];let D;t[28]!==n||t[29]!==a||t[30]!==r||t[31]!==l||t[32]!==f||t[33]!==d||t[34]!==i||t[35]!==u?(D=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(nr,{a:n,chat:r,selected:i,busy:a,modelRows:l,setModelRows:u,onSaveModels:d,onClearModelsEntry:f})}),t[28]=n,t[29]=a,t[30]=r,t[31]=l,t[32]=f,t[33]=d,t[34]=i,t[35]=u,t[36]=D):D=t[36];let O;return t[37]!==E||t[38]!==D?(O=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[E,D]}),t[37]=E,t[38]=D,t[39]=O):O=t[39],O}function ir(e){let t=(0,Z.c)(109),{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,onSaveWorkspace:h,editModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onDelete:C,capabilityPresets:w,defaultPresetId:T,onUpdateAgentExtends:E,onOpenCapabilityPreset:D,overviewProfile:O,filesLoading:k,files:A,activeFile:j,setActiveFile:M,filesViewMode:N,setFilesViewMode:P,fileDraft:F,setFileDraft:I,fileSaving:L,profileFileLoading:R,profileEditorNonce:z,toolEntryDisable:B,setToolEntryDisable:V,onSaveTools:H,onClearToolsEntry:U,modelRows:ee,setModelRows:te,onSaveModels:W,onClearModelsEntry:ne,skillsCatalogLoading:G,catalogForPick:re,skillsInherit:ie,setSkillsInherit:K,skillsPick:q,setSkillsPick:ae,onSaveSkills:oe,bindingsLoading:se,agentBindings:ce,bindChannelStatuses:le,bindChannelsLoading:ue,useManualChannel:de,newBindChannel:fe,setNewBindChannel:pe,bindSessionChats:me,bindSessionsLoading:he,newBindSessionIdx:ge,setNewBindSessionIdx:_e,newBindCustomPeer:ve,setNewBindCustomPeer:ye,refreshBindSessions:be,onRemoveBinding:xe,onAddBinding:Se,onTryInChat:J}=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]!==J||t[11]!==a?(e=(0,Q.jsx)(Qn,{a:n,selected:a,defaultModel:_,defaultWorkspace:v,isTuiDefault:x,isTuiDefaultInherited:S,busy:c,onSetDefault:y,onSetTuiDefault:b,onTryInChat:J}),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]=J,t[11]=a,t[12]=e):e=t[12],e}if(o===`profile`){let e;return t[13]!==n||t[14]!==c||t[15]!==d||t[16]!==l||t[17]!==O.autosave||t[18]!==O.draft||t[19]!==O.handleSoulContentChange||t[20]!==O.handleSoulTemplateChange||t[21]!==O.profileMarkdownLoading||t[22]!==O.setAvatarDialogOpen||t[23]!==O.toggleSoulPreviewMode||t[24]!==O.updateIdentity||t[25]!==a||t[26]!==f||t[27]!==u?(e=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Q.jsx)(Kn,{a:n,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,profileMarkdownLoading:O.profileMarkdownLoading,profileDraft:O.draft,updateIdentity:O.updateIdentity,handleSoulTemplateChange:O.handleSoulTemplateChange,handleSoulContentChange:O.handleSoulContentChange,setAvatarDialogOpen:O.setAvatarDialogOpen,toggleSoulPreviewMode:O.toggleSoulPreviewMode,autosave:O.autosave})}),t[13]=n,t[14]=c,t[15]=d,t[16]=l,t[17]=O.autosave,t[18]=O.draft,t[19]=O.handleSoulContentChange,t[20]=O.handleSoulTemplateChange,t[21]=O.profileMarkdownLoading,t[22]=O.setAvatarDialogOpen,t[23]=O.toggleSoulPreviewMode,t[24]=O.updateIdentity,t[25]=a,t[26]=f,t[27]=u,t[28]=e):e=t[28],e}if(o===`capabilities`){let e;return t[29]!==n||t[30]!==c||t[31]!==re||t[32]!==s||t[33]!==U||t[34]!==oe||t[35]!==H||t[36]!==a||t[37]!==K||t[38]!==ae||t[39]!==V||t[40]!==G||t[41]!==ie||t[42]!==q||t[43]!==B?(e=(0,Q.jsx)(jn,{a:n,data:s,selected:a,busy:c,toolEntryDisable:B,setToolEntryDisable:V,onSaveTools:H,onClearToolsEntry:U,skillsCatalogLoading:G,catalogForPick:re,skillsInherit:ie,setSkillsInherit:K,skillsPick:q,setSkillsPick:ae,onSaveSkills:oe}),t[29]=n,t[30]=c,t[31]=re,t[32]=s,t[33]=U,t[34]=oe,t[35]=H,t[36]=a,t[37]=K,t[38]=ae,t[39]=V,t[40]=G,t[41]=ie,t[42]=q,t[43]=B,t[44]=e):e=t[44],e}if(o===`runtime`){let e;return t[45]!==n||t[46]!==c||t[47]!==r||t[48]!==p||t[49]!==ee||t[50]!==ne||t[51]!==W||t[52]!==h||t[53]!==a||t[54]!==m||t[55]!==te?(e=(0,Q.jsx)(rr,{a:n,chat:r,selected:a,busy:c,editWorkspace:p,setEditWorkspace:m,onSaveWorkspace:h,modelRows:ee,setModelRows:te,onSaveModels:W,onClearModelsEntry:ne}),t[45]=n,t[46]=c,t[47]=r,t[48]=p,t[49]=ee,t[50]=ne,t[51]=W,t[52]=h,t[53]=a,t[54]=m,t[55]=te,t[56]=e):e=t[56],e}if(o===`connections`){let e;return t[57]!==n||t[58]!==ce||t[59]!==le||t[60]!==ue||t[61]!==me||t[62]!==he||t[63]!==se||t[64]!==c||t[65]!==i.lastActiveLabels||t[66]!==i.selectRecipient||t[67]!==fe||t[68]!==ve||t[69]!==ge||t[70]!==Se||t[71]!==xe||t[72]!==be||t[73]!==pe||t[74]!==ye||t[75]!==_e||t[76]!==de?(e=(0,Q.jsx)(Nn,{a:n,busy:c,bindingsLoading:se,agentBindings:ce,channelStatuses:le,channelsStatusLoading:ue,useManualChannel:de,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:Se}),t[57]=n,t[58]=ce,t[59]=le,t[60]=ue,t[61]=me,t[62]=he,t[63]=se,t[64]=c,t[65]=i.lastActiveLabels,t[66]=i.selectRecipient,t[67]=fe,t[68]=ve,t[69]=ge,t[70]=Se,t[71]=xe,t[72]=be,t[73]=pe,t[74]=ye,t[75]=_e,t[76]=de,t[77]=e):e=t[77],e}if(o===`advanced`){let e;return t[78]!==n||t[79]!==j||t[80]!==c||t[81]!==w||t[82]!==_||t[83]!==T||t[84]!==v||t[85]!==g||t[86]!==p||t[87]!==F||t[88]!==L||t[89]!==A||t[90]!==k||t[91]!==N||t[92]!==D||t[93]!==J||t[94]!==E||t[95]!==z||t[96]!==R||t[97]!==a||t[98]!==M||t[99]!==I||t[100]!==P?(e=(0,Q.jsx)(fn,{a:n,selected:a,busy:c,defaultModel:_,defaultWorkspace:v,agentModel:g,agentWorkspace:p,capabilityPresets:w,defaultPresetId:T,onUpdateAgentExtends:E,onOpenCapabilityPreset:D,filesLoading:k,files:A,activeFile:j,setActiveFile:M,filesViewMode:N,setFilesViewMode:P,fileDraft:F,setFileDraft:I,fileSaving:L,profileFileLoading:R,profileEditorNonce:z,onTryInChat:J}),t[78]=n,t[79]=j,t[80]=c,t[81]=w,t[82]=_,t[83]=T,t[84]=v,t[85]=g,t[86]=p,t[87]=F,t[88]=L,t[89]=A,t[90]=k,t[91]=N,t[92]=D,t[93]=J,t[94]=E,t[95]=z,t[96]=R,t[97]=a,t[98]=M,t[99]=I,t[100]=P,t[101]=e):e=t[101],e}if(o===`dangerZone`){let e;return t[102]!==n||t[103]!==c||t[104]!==C||t[105]!==a?(e=(0,Q.jsx)(on,{a:n,selected:a,busy:c,onDelete:C}),t[102]=n,t[103]=c,t[104]=C,t[105]=a,t[106]=e):e=t[106],e}let Ce;return t[107]===n.selectAgentHint?Ce=t[108]:(Ce=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[107]=n.selectAgentHint,t[108]=Ce),Ce}function ar(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=ie(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=Ze(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function or(e,t){return e.replace(`{{count}}`,String(t))}function sr(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?or(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?or(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function cr(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?or(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?or(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function lr(e){let t=(0,Z.c)(11),{text:n,children:r,className:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(ee,{asChild:!0,children:(0,Q.jsx)(`span`,{className:i,title:n,children:r})}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=y(`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`,j),t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(W,{className:`fill-surface-panel`}),t[5]=s):s=t[5];let c;t[6]===n?c=t[7]:(c=(0,Q.jsx)(te,{children:(0,Q.jsxs)(U,{side:`top`,align:`start`,sideOffset:6,className:o,children:[n,s]})}),t[6]=n,t[7]=c);let l;return t[8]!==a||t[9]!==c?(l=(0,Q.jsx)(H,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(V,{children:[a,c]})}),t[8]=a,t[9]=c,t[10]=l):l=t[10],l}function ur(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:i,tuiDefaultAgentId:a,tuiDefaultInherited:o,searchQuery:s,onOpenAgent:c,onChatWithAgent:l,busy:u}=e,d,f,p,m,h;if(t[0]!==n||t[1]!==r||t[2]!==u||t[3]!==i||t[4]!==l||t[5]!==c||t[6]!==s||t[7]!==a||t[8]!==o){h=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ar(r,s,n),g=r.length>0&&e.length===0&&s.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),h=e;break bb0}p=`flex flex-col gap-4`,t[16]!==n||t[17]!==g?(m=g?(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]=g,t[18]=m):m=t[18],d=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let _;t[19]!==n||t[20]!==u||t[21]!==i||t[22]!==l||t[23]!==c||t[24]!==a||t[25]!==o?(_=e=>{let t=ie(e,n),r=e.id,s=Ze(e,n),d=sr(e,n),f=cr(e,n),p=e.id===i||e.isDefault,m=e.id===a,h=m&&o,g=m&&!o;return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:u?-1:0,"aria-disabled":u,"aria-label":`${t} ${r}`,onClick:()=>{u||c(e.id)},onKeyDown:t=>{u||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),c(e.id))},className:y(`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`,C.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)(ze,{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:[p?(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,g?(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,h?(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,!p&&!m?(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 p-3`,children:(0,Q.jsx)(`p`,{className:y(`line-clamp-2 text-sm leading-5`,s?`text-fg`:`text-fg-muted`),title:s||void 0,children:s||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:d,children:f.map(dr)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(b,{type:`button`,variant:`secondary`,disabled:u,onClick:t=>{t.stopPropagation(),l(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(Je,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=u,t[21]=i,t[22]=l,t[23]=c,t[24]=a,t[25]=o,t[26]=_):_=t[26],f=e.map(_)}t[0]=n,t[1]=r,t[2]=u,t[3]=i,t[4]=l,t[5]=c,t[6]=s,t[7]=a,t[8]=o,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];if(h!==Symbol.for(`react.early_return_sentinel`))return h;let g;t[27]!==d||t[28]!==f?(g=(0,Q.jsx)(`ul`,{className:d,children:f}),t[27]=d,t[28]=f,t[29]=g):g=t[29];let _;return t[30]!==p||t[31]!==m||t[32]!==g?(_=(0,Q.jsxs)(`div`,{className:p,children:[m,g]}),t[30]=p,t[31]=m,t[32]=g,t[33]=_):_=t[33],_}function dr(e){return(0,Q.jsx)(lr,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function fr(e){let t=(0,Z.c)(172),{open:n,onOpenChange:r,a:i,chat:a,busy:o,modalError:s,profileLanguageLabel:c,createDisplayName:l,setCreateDisplayName:f,createAgentId:m,setCreateAgentId:h,createDescription:g,setCreateDescription:_,createWorkspace:x,setCreateWorkspace:S,createModel:C,setCreateModel:T,onCreate:E,onSuggestWorkspace:D,agents:O,duplicateSourceId:j,onSelectDuplicateSource:z,capabilityPlans:B,defaultPresetId:V,selectedCapabilityPlanIds:H,onSelectedCapabilityPlanIdsChange:U}=e,[ee,te]=(0,$.useState)(null),W;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(M,{className:y(`xopc-dialog-overlay fixed inset-0 bg-scrim`,A)}),t[0]=W):W=t[0];let ne;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(ne=y(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(90vh,680px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,k,`overflow-hidden rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=ne):ne=t[1];let G;t[2]===i.addAgent?G=t[3]:(G=(0,Q.jsx)(L,{className:`text-base font-semibold text-fg`,children:i.addAgent}),t[2]=i.addAgent,t[3]=G);let re;t[4]===i.addAgentHint?re=t[5]:(re=(0,Q.jsx)(N,{className:`mt-0.5 text-xs text-fg-muted`,children:i.addAgentHint}),t[4]=i.addAgentHint,t[5]=re);let K;t[6]!==G||t[7]!==re?(K=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[G,re]}),t[6]=G,t[7]=re,t[8]=K):K=t[8];let q;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(q=y(w,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=q):q=t[9];let ae;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(v,{className:`size-4`,"aria-hidden":!0}),t[10]=ae):ae=t[10];let oe;t[11]===i.closeDialogAria?oe=t[12]:(oe=(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:q,"aria-label":i.closeDialogAria,children:ae})}),t[11]=i.closeDialogAria,t[12]=oe);let se;t[13]!==K||t[14]!==oe?(se=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[K,oe]}),t[13]=K,t[14]=oe,t[15]=se):se=t[15];let ce;t[16]!==i||t[17]!==O||t[18]!==j||t[19]!==z?(ce=O.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.copyFromExistingAgent}),(0,Q.jsxs)(d,{className:y(sn(),`bg-surface-panel`),value:j??``,onChange:e=>z(e.target.value||null),children:[(0,Q.jsx)(p,{value:``,children:i.copyFromExistingAgentNone}),O.map(e=>(0,Q.jsxs)(p,{value:e.id,children:[ie(e,i),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.duplicateAgentHint})]}):null,t[16]=i,t[17]=O,t[18]=j,t[19]=z,t[20]=ce):ce=t[20];let le;t[21]===i.createCapabilityPlansTitle?le=t[22]:(le=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:i.createCapabilityPlansTitle}),t[21]=i.createCapabilityPlansTitle,t[22]=le);let ue;t[23]===i.createCapabilityPlansHint?ue=t[24]:(ue=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:i.createCapabilityPlansHint}),t[23]=i.createCapabilityPlansHint,t[24]=ue);let de=H.length===0,fe;t[25]===U?fe=t[26]:(fe=()=>U([]),t[25]=U,t[26]=fe);let pe;t[27]!==o||t[28]!==de||t[29]!==fe?(pe=(0,Q.jsx)(`input`,{type:`radio`,name:`create-capability-plan`,className:`mt-0.5 shrink-0`,checked:de,disabled:o,onChange:fe}),t[27]=o,t[28]=de,t[29]=fe,t[30]=pe):pe=t[30];let me;t[31]!==i.capabilityPresetsGlobalDefault||t[32]!==B||t[33]!==V?(me=B.find(e=>e.id===V)?.name??i.capabilityPresetsGlobalDefault,t[31]=i.capabilityPresetsGlobalDefault,t[32]=B,t[33]=V,t[34]=me):me=t[34];let he;t[35]===me?he=t[36]:(he=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:me}),t[35]=me,t[36]=he);let ge;t[37]!==pe||t[38]!==he?(ge=(0,Q.jsxs)(`label`,{className:`mt-2 flex cursor-pointer items-start gap-2 rounded-md bg-accent/5 px-2.5 py-2`,children:[pe,he]}),t[37]=pe,t[38]=he,t[39]=ge):ge=t[39];let _e;if(t[40]!==o||t[41]!==B||t[42]!==V||t[43]!==U||t[44]!==H[0]){let e;t[46]===V?e=t[47]:(e=e=>e.id!==V,t[46]=V,t[47]=e);let n;t[48]!==o||t[49]!==U||t[50]!==H[0]?(n=e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md bg-surface-panel px-2.5 py-2`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`create-capability-plan`,className:`mt-0.5 shrink-0 rounded border-edge`,checked:H[0]===e.id,disabled:o,onChange:()=>U([e.id])}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id),t[48]=o,t[49]=U,t[50]=H[0],t[51]=n):n=t[51],_e=B.filter(e).map(n),t[40]=o,t[41]=B,t[42]=V,t[43]=U,t[44]=H[0],t[45]=_e}else _e=t[45];let ve;t[52]===_e?ve=t[53]:(ve=(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:_e}),t[52]=_e,t[53]=ve);let ye;t[54]!==le||t[55]!==ue||t[56]!==ge||t[57]!==ve?(ye=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-3 dark:border-edge`,children:[le,ue,ge,ve]}),t[54]=le,t[55]=ue,t[56]=ge,t[57]=ve,t[58]=ye):ye=t[58];let be;t[59]===s?be=t[60]:(be=s?(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:s}):null,t[59]=s,t[60]=be);let xe;t[61]!==i.newAgentLabel||t[62]!==c?(xe=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[i.newAgentLabel,` (`,c,`)`]}),t[61]=i.newAgentLabel,t[62]=c,t[63]=xe):xe=t[63];let Se;t[64]===Symbol.for(`react.memo_cache_sentinel`)?(Se=sn(),t[64]=Se):Se=t[64];let J;t[65]===f?J=t[66]:(J=e=>f(e.target.value),t[65]=f,t[66]=J);let Ce;t[67]===D?Ce=t[68]:(Ce=()=>D(),t[67]=D,t[68]=Ce);let we;t[69]!==l||t[70]!==J||t[71]!==Ce?(we=(0,Q.jsx)(`input`,{className:Se,value:l,onChange:J,onBlur:Ce,required:!0,autoComplete:`off`}),t[69]=l,t[70]=J,t[71]=Ce,t[72]=we):we=t[72];let Te;t[73]!==xe||t[74]!==we?(Te=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[xe,we]}),t[73]=xe,t[74]=we,t[75]=Te):Te=t[75];let Ee;t[76]===i.newAgentIdOptional?Ee=t[77]:(Ee=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newAgentIdOptional}),t[76]=i.newAgentIdOptional,t[77]=Ee);let De;t[78]===Symbol.for(`react.memo_cache_sentinel`)?(De=y(sn(),`font-mono text-xs`),t[78]=De):De=t[78];let Oe;t[79]===h?Oe=t[80]:(Oe=e=>h(e.target.value),t[79]=h,t[80]=Oe);let ke;t[81]===D?ke=t[82]:(ke=()=>D(),t[81]=D,t[82]=ke);let Ae;t[83]!==i.newAgentIdPlaceholder||t[84]!==i.newAgentIdRules||t[85]!==m||t[86]!==Oe||t[87]!==ke?(Ae=(0,Q.jsx)(`input`,{className:De,value:m,onChange:Oe,onBlur:ke,placeholder:i.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:i.newAgentIdRules}),t[83]=i.newAgentIdPlaceholder,t[84]=i.newAgentIdRules,t[85]=m,t[86]=Oe,t[87]=ke,t[88]=Ae):Ae=t[88];let je;t[89]===i.newAgentIdRules?je=t[90]:(je=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.newAgentIdRules}),t[89]=i.newAgentIdRules,t[90]=je);let Me;t[91]!==Ee||t[92]!==Ae||t[93]!==je?(Me=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[Ee,Ae,je]}),t[91]=Ee,t[92]=Ae,t[93]=je,t[94]=Me):Me=t[94];let Ne;t[95]!==i.agentDescription||t[96]!==c?(Ne=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[i.agentDescription,` (`,c,`)`]}),t[95]=i.agentDescription,t[96]=c,t[97]=Ne):Ne=t[97];let Pe;t[98]===Symbol.for(`react.memo_cache_sentinel`)?(Pe=y(sn(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[98]=Pe):Pe=t[98];let Fe;t[99]===_?Fe=t[100]:(Fe=e=>_(e.target.value),t[99]=_,t[100]=Fe);let Le;t[101]!==i.agentDescriptionPlaceholder||t[102]!==g||t[103]!==Fe?(Le=(0,Q.jsx)(`textarea`,{className:Pe,value:g,onChange:Fe,placeholder:i.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[101]=i.agentDescriptionPlaceholder,t[102]=g,t[103]=Fe,t[104]=Le):Le=t[104];let Re;t[105]!==Ne||t[106]!==Le?(Re=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[Ne,Le]}),t[105]=Ne,t[106]=Le,t[107]=Re):Re=t[107];let ze;t[108]===i.newWorkspace?ze=t[109]:(ze=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newWorkspace}),t[108]=i.newWorkspace,t[109]=ze);let Y;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(Y=y(sn(),`font-mono text-xs`),t[110]=Y):Y=t[110];let Be;t[111]===S?Be=t[112]:(Be=e=>S(e.target.value),t[111]=S,t[112]=Be);let Ve;t[113]!==x||t[114]!==Be?(Ve=(0,Q.jsx)(`input`,{className:Y,value:x,onChange:Be,required:!0,autoComplete:`off`}),t[113]=x,t[114]=Be,t[115]=Ve):Ve=t[115];let He;t[116]!==ze||t[117]!==Ve?(He=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ze,Ve]}),t[116]=ze,t[117]=Ve,t[118]=He):He=t[118];let Ue;t[119]===i.newModelOptional?Ue=t[120]:(Ue=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newModelOptional}),t[119]=i.newModelOptional,t[120]=Ue);let Ge;t[121]===T?Ge=t[122]:(Ge=e=>T(e),t[121]=T,t[122]=Ge);let Ke;t[123]!==o||t[124]!==a.modelNoMatches||t[125]!==a.modelPlaceholder||t[126]!==a.modelSearchPlaceholder||t[127]!==C||t[128]!==Ge?(Ke=(0,Q.jsx)(Ie,{className:`min-w-0 flex-1`,value:C,disabled:o,placeholder:a.modelPlaceholder,searchPlaceholder:a.modelSearchPlaceholder,noMatches:a.modelNoMatches,onChange:Ge}),t[123]=o,t[124]=a.modelNoMatches,t[125]=a.modelPlaceholder,t[126]=a.modelSearchPlaceholder,t[127]=C,t[128]=Ge,t[129]=Ke):Ke=t[129];let qe;t[130]!==i.modelClear||t[131]!==o||t[132]!==C||t[133]!==T?(qe=C.trim()?(0,Q.jsx)(b,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>T(``),children:i.modelClear}):null,t[130]=i.modelClear,t[131]=o,t[132]=C,t[133]=T,t[134]=qe):qe=t[134];let Je;t[135]!==Ke||t[136]!==qe?(Je=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[Ke,qe]}),t[135]=Ke,t[136]=qe,t[137]=Je):Je=t[137];let X;t[138]!==Ue||t[139]!==Je?(X=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[Ue,Je]}),t[138]=Ue,t[139]=Je,t[140]=X):X=t[140];let Ye;t[141]!==ye||t[142]!==be||t[143]!==Te||t[144]!==Me||t[145]!==Re||t[146]!==He||t[147]!==X||t[148]!==ce?(Ye=(0,Q.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-y-auto pr-1`,children:[ce,ye,be,Te,Me,Re,He,X]}),t[141]=ye,t[142]=be,t[143]=Te,t[144]=Me,t[145]=Re,t[146]=He,t[147]=X,t[148]=ce,t[149]=Ye):Ye=t[149];let Xe;t[150]!==i.createModalCancel||t[151]!==o?(Xe=(0,Q.jsx)(P,{asChild:!0,children:(0,Q.jsx)(b,{type:`button`,variant:`secondary`,disabled:o,children:i.createModalCancel})}),t[150]=i.createModalCancel,t[151]=o,t[152]=Xe):Xe=t[152];let Ze;t[153]===Symbol.for(`react.memo_cache_sentinel`)?(Ze=(0,Q.jsx)(We,{className:`mr-1 size-4`,"aria-hidden":!0}),t[153]=Ze):Ze=t[153];let Qe;t[154]!==i.create||t[155]!==o?(Qe=(0,Q.jsxs)(b,{type:`submit`,disabled:o,children:[Ze,i.create]}),t[154]=i.create,t[155]=o,t[156]=Qe):Qe=t[156];let $e;t[157]!==Xe||t[158]!==Qe?($e=(0,Q.jsxs)(`div`,{className:`mt-3 flex shrink-0 justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Xe,Qe]}),t[157]=Xe,t[158]=Qe,t[159]=$e):$e=t[159];let et;t[160]!==E||t[161]!==Ye||t[162]!==$e?(et=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:E,children:[Ye,$e]}),t[160]=E,t[161]=Ye,t[162]=$e,t[163]=et):et=t[163];let tt;t[164]!==ee||t[165]!==et||t[166]!==se?(tt=(0,Q.jsxs)(F,{children:[W,(0,Q.jsx)(I,{ref:te,className:ne,onOpenAutoFocus:pr,children:(0,Q.jsxs)(u,{layer:`modal`,portalContainer:ee,children:[se,et]})})]}),t[164]=ee,t[165]=et,t[166]=se,t[167]=tt):tt=t[167];let nt;return t[168]!==r||t[169]!==n||t[170]!==tt?(nt=(0,Q.jsx)(R,{open:n,onOpenChange:r,children:tt}),t[168]=r,t[169]=n,t[170]=tt,t[171]=nt):nt=t[171],nt}function pr(e){return e.preventDefault()}var mr=`~/.xopc/workspace`;function hr(e){let t=e.trim();return t?`${mr}/${Ce(t)}`:``}function gr(e){let t=(0,Z.c)(26),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o,onManageCapabilityPresets:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(Qe,{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]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=e=>a(e.target.value),t[1]=a,t[2]=l);let u;t[3]!==n.listSearchPlaceholder||t[4]!==i||t[5]!==l?(u=(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:[c,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:l,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]=l,t[6]=u):u=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(st,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[7]=d):d=t[7];let f;t[8]===n.capabilityPresetsManage?f=t[9]:(f=(0,Q.jsx)(`span`,{className:`hidden xl:inline`,children:n.capabilityPresetsManage}),t[8]=n.capabilityPresetsManage,t[9]=f);let p;t[10]!==n.capabilityPresetsManage||t[11]!==s||t[12]!==f?(p=(0,Q.jsxs)(b,{type:`button`,variant:`secondary`,className:`shrink-0 gap-2`,"aria-label":n.capabilityPresetsManage,onClick:s,children:[d,f]}),t[10]=n.capabilityPresetsManage,t[11]=s,t[12]=f,t[13]=p):p=t[13];let m;t[14]===o?m=t[15]:(m=()=>o(),t[14]=o,t[15]=m);let h;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(_,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[16]=h):h=t[16];let g;t[17]!==n.addAgent||t[18]!==n.addAgentAria||t[19]!==r||t[20]!==m?(g=(0,Q.jsxs)(b,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:m,children:[h,n.addAgent]}),t[17]=n.addAgent,t[18]=n.addAgentAria,t[19]=r,t[20]=m,t[21]=g):g=t[21];let v;return t[22]!==u||t[23]!==p||t[24]!==g?(v=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[u,p,g]}),t[22]=u,t[23]=p,t[24]=g,t[25]=v):v=t[25],v}function _r(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function vr(e){let{agentId:t,enabled:n,saveRef:r}=e,i=K(async()=>{if(!t)return null;let[e,n]=await Promise.all([we(t,`IDENTITY.md`).catch(()=>``),we(t,`SOUL.md`).catch(()=>``)]),r=Rn(e);return{identity:r,soulTemplate:Hn(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 f=c??(a?_r(a):null),p=(0,$.useRef)(f);p.current=f;let m=(0,$.useMemo)(()=>f?JSON.stringify(f.identity)!==f.identityBaseline||f.soulCustomContent!==f.soulBaseline:!1,[f]),h=(0,$.useRef)(t);h.current=t;let g=(0,$.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?_r(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=Bn.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 e=>{let t=h.current,n=e??p.current;!t||!n||(await Promise.all([de(t,`IDENTITY.md`,zn(n.identity)),de(t,`SOUL.md`,n.soulCustomContent)]),l(e=>{let t=e??n;return s.current=JSON.stringify(t.identity)!==JSON.stringify(n.identity)||t.soulCustomContent!==n.soulCustomContent,{...t,identityBaseline:JSON.stringify(n.identity),soulBaseline:n.soulCustomContent}}))},[]),C=gt({value:f,dirty:m,enabled:n,onSave:S});return(0,$.useLayoutEffect)(()=>{if(r)return r.current=S,()=>{r.current=null}},[S,r]),{profileMarkdownLoading:o,draft:f,dirty:m,autosave:C,updateIdentity:_,handleSoulTemplateChange:v,handleSoulContentChange:y,setAvatarDialogOpen:b,toggleSoulPreviewMode:x}}var yr={draft:``,editorNonce:0,loadedKey:``};function br(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 xr(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=K(()=>n?ce(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`advanced`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,$.useState)(null),[p,m]=(0,$.useReducer)(br,yr),[h,g]=(0,$.useState)(!1),[_,v]=(0,$.useState)(`edit`),y=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==y.current&&(y.current=n,f(null))},[n]),(0,$.useEffect)(()=>{if(c&&c.files.length>0&&!d){let e=c.files.find(e=>e.name===`AGENTS.md`);f(e?e.name:c.files[0].name)}},[c,d]);let b=p.draft,x=p.editorNonce,S=(0,$.useRef)(b);S.current=b;let C=(0,$.useRef)(n);C.current=n;let w=(0,$.useRef)(d);w.current=d;let T=(0,$.useRef)(null),E=(0,$.useRef)(``),D=(0,$.useRef)(``),O=(0,$.useRef)(``),k=(0,$.useRef)(()=>{}),A=K(()=>d&&n?we(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),j=A.loading,M=ct(async()=>{let e=C.current,t=w.current;if(!e||!t||`${e}:${t}`!==E.current)return;let n=S.current;if(n!==D.current){g(!0),o(null);try{await de(e,t,n),D.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{g(!1)}}},800);k.current=M.flush,(0,$.useEffect)(()=>()=>{k.current()},[]);let N=(0,$.useRef)(t);N.current!==t&&(N.current===`advanced`&&k.current(),N.current=t);let P=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{P!==O.current&&(k.current(),O.current=P)},[P]),(0,$.useEffect)(()=>{if(!P){m({type:`clear`});return}j||(E.current=P,D.current=A.data,m({type:`load`,key:P,content:A.data}))},[P,j,A.data]);let F=(0,$.useRef)({activeFile:d,selectedId:n});return(F.current.activeFile!==d||F.current.selectedId!==n)&&(F.current={activeFile:d,selectedId:n},v(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{k.current(),f(e)},[]),fileDraft:b,setFileDraft:(0,$.useCallback)(e=>{m({type:`setDraft`,value:typeof e==`function`?e(S.current):e}),M()},[M]),fileSaving:h,filesViewMode:_,setFilesViewMode:v,profileFileLoading:j,profileEditorNonce:x,overviewSaveProfileMarkdownRef:T,saveProfileMarkdownDebounced:M}}function Sr(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=K(()=>At(),[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=K(()=>jt(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&&jt(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,L=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await q(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=ln(y,A,O,T),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await q(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:L,refreshBindSessions:P,useManualChannel:F}}function Cr(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(Er)};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}=K(Tr,s,d),m;n[10]===f?m=n[11]:(m=f.filter(wr),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 wr(e){return e.enabled!==!1}function Tr(){return Oe()}function Er(e){return e+1}function Dr(e){return Cr(e.panel===`capabilities`,e.hasToken)}function Or(e){return new Set(e.tools.entryDisable)}function kr(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function Ar(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===`capabilities`){o(Or(n));let e=kr(n);u(e.inherit),c(e.pick)}n&&t===`runtime`&&f(Tt(n.typedModels.effective))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:e=>{f(e)},replaceModelRows:f}}function jr(e){let t=Tt(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Tt(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 Nr(){let e=D(e=>e.language),t=T(e),n=t.agentsSettings,[r,s]=(0,$.useState)(!1),[c,l]=(0,$.useState)(null),[u,d]=(0,$.useState)(!1),[f,p]=(0,$.useState)(``),m=t.cron,h=t.chat,g=!!E(e=>e.token),[_,v]=a(),y=o(),{agentId:b}=i(),x=Me(e=>e.setPageHeader),S=Me(e=>e.clearPageHeader),{data:C,error:w,isLoading:O,mutate:k}=z(g?`settings-gateway-agents`:null,ve,{revalidateOnFocus:!1}),{data:A,mutate:j}=z(g?`settings-capability-presets`:null,St,{revalidateOnFocus:!1}),M=B(g),{data:N}=M,P=(0,$.useMemo)(()=>lt(N?.payload?.config??{}),[N]),F=C??null,I=(0,$.useMemo)(()=>F?F.agents.find(e=>e.id===F.defaultId)??F.agents[0]??null:null,[F]),L=!!(g&&O),[R,V]=(0,$.useState)(null),H=w instanceof Error?w.message:w?n.loadError:null,U=R??H,[ee,te]=(0,$.useState)(null),[W,ne]=(0,$.useState)(`overview`),[G,re]=(0,$.useState)(``),[K,q]=(0,$.useState)(``),[ae,oe]=(0,$.useState)(``),[se,ce]=(0,$.useState)(``),[le,ue]=(0,$.useState)(``),[de,fe]=(0,$.useState)(null),[pe,me]=(0,$.useState)(!1),he=(0,$.useRef)(``),[ge,_e]=(0,$.useState)(null),[ye,be]=(0,$.useState)([]),[xe,J]=(0,$.useState)(!1),[Ce,we]=(0,$.useState)(``),[Te,De]=(0,$.useState)(``),[Oe,je]=(0,$.useState)(``),[Ne,Fe]=(0,$.useState)(``),[Ie,Le]=(0,$.useState)(``),Re=(0,$.useRef)(null),ze=(0,$.useRef)({data:null,routeAgentId:void 0});F&&(F!==ze.current.data||b!==ze.current.routeAgentId)&&(ze.current={data:F,routeAgentId:b},b&&F.agents.some(e=>e.id===b)?te(b):te(e=>e&&F.agents.some(t=>t.id===e)?e:F.defaultId)),(0,$.useEffect)(()=>{!F||!b||F.agents.some(e=>e.id===b)||y(nt,{replace:!0})},[F,b,y]),(0,$.useEffect)(()=>{b&&ne(`overview`)},[b]),(0,$.useEffect)(()=>{_.get(`panel`)===`defaults`&&y(b?qe(b):nt,{replace:!0,state:{[Ee]:b?qe(b):nt}})},[_,b,y]),(0,$.useEffect)(()=>{if(_.get(`focus`)!==`avatar`||!b||(ne(`profile`),L||!F?.agents.some(e=>e.id===b)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),v(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[_,b,L,F,v]);let Y=(0,$.useMemo)(()=>F?.agents.find(e=>e.id===ee)??null,[F,ee]),Be=(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]),Ve=(0,$.useMemo)(()=>!F||Be&&F.agents.some(e=>e.id===Be)?Be:F.defaultId||F.agents[0]?.id||Be,[F,Be]),He=!!(F&&Be&&!F.agents.some(e=>e.id===Be)),Ue=(0,$.useRef)(null),We=Y?Y.id:null;Y&&Ue.current!==We?(Ue.current=We,De(Y.workspace),je(Y.model?.primary??``),Fe(ie(Y,T(e).agentsSettings)),Le(Ze(Y,T(e).agentsSettings))):!Y&&Ue.current!==null&&(Ue.current=null,De(``),je(``),Fe(``),Le(``));let Ge=vr({agentId:Y?.id??null,enabled:W===`profile`&&!!Y,saveRef:Re}),Ke=xr({panel:W,selectedId:ee,hasToken:g,dataAgentsLength:F?.agents.length,saveErrorMessage:n.saveError,setError:V}),Je=Ar({panel:W,selected:Y}),X=Sr({panel:W,hasToken:g,bindingsFromConfig:P,gatewayCfgLoading:N===void 0,selected:Y,saveErrorMessage:n.saveError,setBusy:J,setError:V}),Qe=Dr({panel:W,hasToken:g}),$e=(0,$.useCallback)(()=>{let e=hr(K.trim()||G);ce(t=>t===``||t===he.current?(he.current=e,e):t)},[K,G]),et=(0,$.useCallback)(()=>{he.current=``,re(``),q(``),oe(``),ce(``),ue(``),fe(null),_e(null),be([]),me(!0)},[]),tt=(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]),rt=(0,$.useCallback)(e=>{if(_e(e),!e){be([]);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=tt(t.id),o=t.description??``;he.current=``,re(i),q(a),oe(o),ce(t.workspace),ue(t.model?.primary??``),be(t.extends),fe(null)},[n.duplicateName,F,tt]),it=(0,$.useCallback)(e=>{rt(e),me(!0)},[rt]),at=(0,$.useMemo)(()=>(0,Q.jsx)(gr,{a:n,busy:xe,listSearchQuery:Ce,onListSearchQueryChange:we,onAddAgent:()=>et(),onManageCapabilityPresets:()=>y(`/settings/capability-presets`)}),[n,xe,Ce,y,et]);(0,$.useLayoutEffect)(()=>g?(x({startExtra:null,main:(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:at}),()=>S()):(S(),()=>S()),[n.subtitle,n.title,at,S,g,x]);async function ot(t){t.preventDefault();let r=G.trim();if(!r)return;let i=Xe(K,r);if(i.ok===!1){fe(i.error);return}let a=se.trim()||hr(K.trim()||r);if(a){J(!0),fe(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${ae.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
68
+ `),{createdAgentId:n,...i}=await Ye({workspace:a,...K.trim()?{id:K.trim()}:{},...le.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:le.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...ge?{cloneFrom:ge}:{},extends:ye});k(i,{revalidate:!1}),re(``),q(``),oe(``),ce(``),ue(``),fe(null),me(!1),te(n),y(qe(n))}catch(e){fe(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function st(e){J(!0),V(null);try{k(await Ae(e.id,{setDefault:!0}),{revalidate:!1}),te(e.id)}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function ct(e){J(!0),V(null);try{await Pe(e.id),await M.mutate()}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function ut(e,t){J(!0),V(null);try{let n=await Se(e.id,t);k(n,{revalidate:!1}),te(n.defaultId),ne(`overview`),b===e.id&&y(nt,{replace:!0}),s(!1),l(null),p(``)}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}function dt(e,t){e.id!==`main`&&(l(e),d(t),p(``),s(!0))}async function ft(e){if(Y){J(!0),V(null);try{k(await Ae(Y.id,{tools:{builtin:Mr(new Set(e))}}),{revalidate:!1})}catch(e){throw V(e instanceof Error?e.message:n.saveError),e}finally{J(!1)}}}async function pt(){if(Y){J(!0),V(null);try{k(await Ae(Y.id,{tools:null}),{revalidate:!1}),Je.setToolEntryDisable(new Set)}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function mt(e){if(!Y)return;let t=wt(e,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(t)throw V(t),Error(t);J(!0),V(null);try{k(await Ae(Y.id,{models:{roles:kt(e)?.roles??{}}}),{revalidate:!1})}catch(e){throw V(e instanceof Error?e.message:n.saveError),e}finally{J(!1)}}async function ht(e){if(Y){J(!0),V(null);try{k(await Ae(Y.id,{workspace:e.trim()||void 0}),{revalidate:!1})}catch(e){throw V(e instanceof Error?e.message:n.saveError),e}finally{J(!1)}}}async function gt(){if(Y){J(!0),V(null);try{k(await Ae(Y.id,{models:null}),{revalidate:!1}),Je.replaceModelRows(jr(Y))}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function _t(e){if(Y){J(!0),V(null);try{k(await Ae(Y.id,{skills:e.inherit?null:e.skills}),{revalidate:!1})}catch(e){throw V(e instanceof Error?e.message:n.saveError),e}finally{J(!1)}}}async function vt(e){if(Y){J(!0),V(null);try{k(await Ae(Y.id,{extends:e}),{revalidate:!1}),j()}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function yt(){switch(W){case`profile`:J(!0),V(null);try{return await(Re.current?.()??Promise.resolve()),await k(),!0}catch(e){return V(e instanceof Error?e.message:n.saveError),!1}finally{J(!1)}case`runtime`:{let e=Y?Tt(Y.typedModels.effective):[],t=[];Y&&Te.trim()!==Y.workspace&&t.push(ht(Te)),Y&&JSON.stringify(Je.modelRows)!==JSON.stringify(e)&&t.push(mt(Je.modelRows));try{return await Promise.all(t),!0}catch{return!1}}default:return!0}}function bt(e){e||yt().then(e=>{e&&y(nt)})}let xt=Y?Ne.trim()||ie(Y,n):b??``,Ct=Y?.id??b??``,Et=(0,$.useCallback)(async()=>{if(Y&&await yt()){Ke.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(ke,Y.id)}catch{}y(`/chat/new`,{state:{agentId:Y.id,fromAgentEditor:!0}})}},[Y,yt,Ke.saveProfileMarkdownDebounced,y]),Dt={a:n,chat:h,cCron:m,selected:Y,panel:W,data:F,busy:xe,editName:Ne,setEditName:Fe,editDescription:Ie,setEditDescription:Le,editWorkspace:Te,setEditWorkspace:De,editModel:Oe,defaultModel:I?.model?.primary??``,defaultWorkspace:I?.workspace??``,onSetDefault:()=>{Y&&st(Y)},onSetTuiDefault:()=>{Y&&ct(Y)},isTuiDefault:!!(Y&&Y.id===Ve),isTuiDefaultInherited:!!(Y&&Y.id===Ve&&(!Be||He)),onDelete:e=>{Y&&dt(Y,e)},onTryInChat:()=>void Et(),capabilityPresets:A?.presets??[],defaultPresetId:A?.defaultPresetId,onUpdateAgentExtends:e=>void vt(e),onOpenCapabilityPreset:e=>{y(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewProfile:Ge,filesLoading:Ke.filesLoading,files:Ke.files,activeFile:Ke.activeFile,setActiveFile:Ke.setActiveFile,filesViewMode:Ke.filesViewMode,setFilesViewMode:Ke.setFilesViewMode,fileDraft:Ke.fileDraft,setFileDraft:Ke.setFileDraft,fileSaving:Ke.fileSaving,profileFileLoading:Ke.profileFileLoading,profileEditorNonce:Ke.profileEditorNonce,toolEntryDisable:Je.toolEntryDisable,setToolEntryDisable:Je.setToolEntryDisable,onSaveTools:ft,onClearToolsEntry:()=>void pt(),modelRows:Je.modelRows,setModelRows:Je.setModelRows,onSaveModels:mt,onSaveWorkspace:ht,onClearModelsEntry:()=>void gt(),skillsCatalogLoading:Qe.skillsCatalogLoading,catalogForPick:Qe.catalogForPick,skillsInherit:Je.skillsInherit,setSkillsInherit:Je.setSkillsInherit,skillsPick:Je.skillsPick,setSkillsPick:Je.setSkillsPick,onSaveSkills:_t,bindingsLoading:X.bindingsLoading,agentBindings:X.agentBindings,bindChannelStatuses:X.bindChannelStatuses,bindChannelsLoading:X.bindChannelsLoading,useManualChannel:X.useManualChannel,newBindChannel:X.newBindChannel,setNewBindChannel:X.setNewBindChannel,bindSessionChats:X.bindSessionChats,bindSessionsLoading:X.bindSessionsLoading,newBindSessionIdx:X.newBindSessionIdx,setNewBindSessionIdx:X.setNewBindSessionIdx,newBindCustomPeer:X.newBindCustomPeer,setNewBindCustomPeer:X.setNewBindCustomPeer,refreshBindSessions:X.refreshBindSessions,onRemoveBinding:e=>void X.onRemoveBinding(e),onAddBinding:X.onAddBinding};return{hasToken:g,a:n,chat:h,language:e,data:F,savedTuiDefaultAgentId:Be,effectiveTuiDefaultAgentId:Ve,tuiDefaultAgentUnavailable:He,onSetTuiDefaultAgent:ct,onSetDefaultAgent:st,loading:L,displayError:U,navigate:y,routeAgentId:b,busy:xe,listSearchQuery:Ce,openAddAgentModal:et,openDuplicateAgentModal:it,duplicateSourceId:ge,createPresetIds:ye,setCreatePresetIds:be,onSelectDuplicateSource:rt,panel:W,setPanel:ne,modalTitle:xt,modalSubtitle:Ct,onAgentModalOpenChange:bt,addAgentModalOpen:pe,setAddAgentModalOpen:me,createWorkspaceSuggestedRef:he,createModalError:de,setCreateModalError:fe,createDisplayName:G,setCreateDisplayName:re,createAgentId:K,setCreateAgentId:q,createDescription:ae,setCreateDescription:oe,createWorkspace:se,setCreateWorkspace:ce,createModel:le,setCreateModel:ue,onCreate:ot,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:$e,deleteDialogOpen:r,setDeleteDialogOpen:s,deletePurge:u,deleteTarget:c,setDeleteTarget:l,deleteConfirmText:f,setDeleteConfirmText:p,performDelete:ut,editorPanelProps:Dt}}function Pr(){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)(G,{className:`h-5 w-40`}),(0,Q.jsx)(G,{className:`h-3 w-64 max-w-full`})]}),(0,Q.jsx)(G,{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(Fr)})]}),e[1]=n):n=e[1],n}function Fr(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)(G,{className:`size-11 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(G,{className:`h-4 w-2/3`}),(0,Q.jsx)(G,{className:`mt-2 h-3 w-24`})]})]}),(0,Q.jsx)(G,{className:`mt-4 h-3 w-full`}),(0,Q.jsx)(G,{className:`mt-2 h-3 w-4/5`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(G,{className:`h-6 w-16 rounded-full`}),(0,Q.jsx)(G,{className:`h-6 w-20 rounded-full`})]})]},t)}function Ir(){let e=Nr();return e.hasToken?(0,Q.jsxs)(ft,{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)(Pr,{}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(ur,{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(qe(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(ke,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Rt,{open:!!e.routeAgentId,onOpenChange:e.onAgentModalOpenChange,a:e.a,title:e.modalTitle,subtitle:e.modalSubtitle,panel:e.panel,onPanelChange:e.setPanel,children:e.loading||!e.data?(0,Q.jsx)(Pr,{}):(0,Q.jsx)(ir,{...e.editorPanelProps})}):null,(0,Q.jsx)(fr,{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),e.setCreatePresetIds([]))},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,capabilityPlans:e.editorPanelProps.capabilityPresets,defaultPresetId:e.editorPanelProps.defaultPresetId??`default`,selectedCapabilityPlanIds:e.createPresetIds,onSelectedCapabilityPlanIdsChange:e.setCreatePresetIds}),(0,Q.jsx)(Pt,{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)(ft,{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)(dt,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{Ir as AgentsSettingsPanel};
@@ -1 +1 @@
1
- import{r as e,s as t}from"./locale-store-CnamlR07.js";async function n(){return(await t(e(`/api/local-apps`))).apps}async function r(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function a(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function o(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function s(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function c(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function l(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function u(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{a,u as c,n as i,i as l,r as n,c as o,s as r,l as s,o as t};
1
+ import{r as e,s as t}from"./locale-store-81Gv0wwo.js";async function n(){return(await t(e(`/api/local-apps`))).apps}async function r(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function a(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function o(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function s(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function c(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function l(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function u(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{a,u as c,n as i,i as l,r as n,c as o,s as r,l as s,o as t};
@@ -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"./copy-Dv6d4Dvw.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./button-CSEbl4zT.js";import{n as s}from"./interaction-BmQogeqz.js";import{t as c}from"./copy-to-clipboard-HOJ79TWv.js";import{t as l}from"./messages-D7kOD_o_.js";import{n as u,r as d,s as f}from"./locale-store-CnamlR07.js";import{i as p,o as m}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as h,i as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{r as S}from"./settings-form-draft-Dy10ldo8.js";import{Na as C,Po as w,tc as T}from"./index-DRrjYYzZ.js";import{n as E,r as D}from"./settings-page-layout-BRQNel6r.js";import{t as O}from"./settings-loading-skeleton-zwibve4m.js";import{r as k,t as A}from"./settings-form-section-C7w2WS-A.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,l]=(0,M.useReducer)(S,L),{info:u,loadError:d,actionError:f,copiedField:x,clearDialogOpen:C,clearConfirmChecked:w,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){l({type:`patch`,patch:{loadError:null}});try{l({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await c(e)){l({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>l({type:`patch`,patch:{copiedField:null}}),2e3);return}l({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){l({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||l({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{l({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){l({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||l({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{l({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(d)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:d});if(!u)return(0,N.jsx)(O,{rows:2});let H=!u.packaged,U=j||u.pendingUpdate||H,W=!H&&u.uninstallMode!==`unsupported`,G=I(u,t),K=w&&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)(T,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,f?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:f}):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,u.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:u.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:a(`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`,s.press),onClick:()=>void z(u.appPath,`app`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),x===`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:u.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:a(`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`,s.press),onClick:()=>void z(u.dataPath,`data`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),x===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(u.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:a(`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`,s.press),onClick:()=>{l({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:a(`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`,s.press),onClick:()=>{l({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(b,{open:C,onOpenChange:e=>{e||l({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(_,{children:[(0,N.jsx)(h,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,m)}),(0,N.jsxs)(v,{className:a(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,p,`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)(y,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(g,{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:w,onChange:e=>l({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:a(`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=>l({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)(o,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{l({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(o,{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)(b,{open:D,onOpenChange:e=>{e||l({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(_,{children:[(0,N.jsx)(h,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,m)}),(0,N.jsxs)(v,{className:a(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,p,`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)(y,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(g,{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=>l({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)(o,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>l({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(o,{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 f(d(`/api/migrations/status`))).payload}async function B(){await f(d(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=x(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,s]=(0,M.useState)(!1),[c,l]=(0,M.useState)(null);async function u(){s(!0),l(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!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)(C,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(C,{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)(o,{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,c?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:c}):null]})}function H(){let e=(0,j.c)(28),t=u(U),n;e[0]===t?n=e[1]:(n=l(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!w()||!a){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 o;e[18]===i.title?o=e[19]:(o=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=o);let s;e[20]===i.migrations?s=e[21]:(s=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=s);let c;e[22]===i?c=e[23]:(c=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=c);let d;return e[24]!==o||e[25]!==s||e[26]!==c?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[o,s,c]}),e[24]=o,e[25]=s,e[26]=c,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"./copy-Dv6d4Dvw.js";import{t as a}from"./cn-JdwAhgNB.js";import{t as o}from"./button-CSEbl4zT.js";import{n as s}from"./interaction-BmQogeqz.js";import{t as c}from"./copy-to-clipboard-HOJ79TWv.js";import{t as l}from"./messages-ELK_1h2D.js";import{n as u,r as d,s as f}from"./locale-store-81Gv0wwo.js";import{i as p,o as m}from"./settings-shell-dialog-layer-BU3UuiJr.js";import{a as h,i as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{r as S}from"./settings-form-draft-Dy10ldo8.js";import{Aa as C,Xs as w,jo as T}from"./index-CPTLS-Zn.js";import{n as E,r as D}from"./settings-page-layout-BRQNel6r.js";import{t as O}from"./settings-loading-skeleton-DWS27sv1.js";import{r as k,t as A}from"./settings-form-section-Du5eAgFS.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,l]=(0,M.useReducer)(S,L),{info:u,loadError:d,actionError:f,copiedField:x,clearDialogOpen:C,clearConfirmChecked:T,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){l({type:`patch`,patch:{loadError:null}});try{l({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await c(e)){l({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>l({type:`patch`,patch:{copiedField:null}}),2e3);return}l({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){l({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||l({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{l({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){l({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||l({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){l({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{l({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(d)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:d});if(!u)return(0,N.jsx)(O,{rows:2});let H=!u.packaged,U=j||u.pendingUpdate||H,W=!H&&u.uninstallMode!==`unsupported`,G=I(u,t),K=T&&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)(w,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,f?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:f}):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,u.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:u.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:a(`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`,s.press),onClick:()=>void z(u.appPath,`app`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),x===`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:u.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:a(`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`,s.press),onClick:()=>void z(u.dataPath,`data`),children:[(0,N.jsx)(i,{className:`size-3`,"aria-hidden":!0}),x===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(u.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:a(`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`,s.press),onClick:()=>{l({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:a(`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`,s.press),onClick:()=>{l({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(b,{open:C,onOpenChange:e=>{e||l({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(_,{children:[(0,N.jsx)(h,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,m)}),(0,N.jsxs)(v,{className:a(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,p,`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)(y,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(g,{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:T,onChange:e=>l({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:a(`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=>l({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)(o,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{l({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(o,{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)(b,{open:D,onOpenChange:e=>{e||l({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(_,{children:[(0,N.jsx)(h,{className:a(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,m)}),(0,N.jsxs)(v,{className:a(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,p,`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)(y,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(g,{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=>l({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)(o,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>l({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(o,{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 f(d(`/api/migrations/status`))).payload}async function B(){await f(d(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=x(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,s]=(0,M.useState)(!1),[c,l]=(0,M.useState)(null);async function u(){s(!0),l(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!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)(C,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(C,{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)(o,{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,c?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:c}):null]})}function H(){let e=(0,j.c)(28),t=u(U),n;e[0]===t?n=e[1]:(n=l(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!T()||!a){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 o;e[18]===i.title?o=e[19]:(o=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=o);let s;e[20]===i.migrations?s=e[21]:(s=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=s);let c;e[22]===i?c=e[23]:(c=(0,N.jsx)(R,{api:a,messages:i,embedded:!1}),e[22]=i,e[23]=c);let d;return e[24]!==o||e[25]!==s||e[26]!==c?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[o,s,c]}),e[24]=o,e[25]=s,e[26]=c,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
@@ -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{n as i,r as a}from"./popover-select-BzdnTy3h.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./interaction-BmQogeqz.js";import{t as c}from"./messages-D7kOD_o_.js";import{n as l,r as u,s as d}from"./locale-store-CnamlR07.js";import{i as f}from"./theme-store-BDyUTObE.js";import{n as p,r as m}from"./gateway-config-swr-Cv2ywpdb.js";import{Na as h,Vo as g,oi as _}from"./index-DRrjYYzZ.js";import{n as v,r as y}from"./settings-page-layout-BRQNel6r.js";import{t as b}from"./settings-advanced-gate-BTB_fxjt.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await d(u(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await p()}var E=r();function D(){return o(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var O={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 k(e){let t=(0,S.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,E.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,E.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,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]===o?f=t[13]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=p);let m;t[16]!==c||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,f,p]}),t[16]=c,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==s||t[22]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[21]=s,t[22]=m,t[23]=h):h=t[23],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.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,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.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 j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(18),t=l(F),n;e[0]===t?n=e[1]:(n=c(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=f(P),a=f(N),u;e[2]===r.colorSchemeTitle?u=e[3]:(u=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.colorSchemeTitle}),e[2]=r.colorSchemeTitle,e[3]=u);let d;e[4]===r.colorSchemeDescription?d=e[5]:(d=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.colorSchemeDescription}),e[4]=r.colorSchemeDescription,e[5]=d);let p;e[6]!==u||e[7]!==d?(p=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),e[6]=u,e[7]=d,e[8]=p):p=e[8];let m;e[9]!==r||e[10]!==i||e[11]!==a?(m=j.map(e=>{let{value:t,labelKey:n}=e,c=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":c,onClick:()=>a(t),className:o(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,s.pressCard,c?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:o(`text-xs font-medium leading-none`,c?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[9]=r,e[10]=i,e[11]=a,e[12]=m):m=e[12];let h;e[13]===m?h=e[14]:(h=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:m}),e[13]=m,e[14]=h);let g;return e[15]!==p||e[16]!==h?(g=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 p-3.5 sm:py-4`,children:[p,h]}),e[15]=p,e[16]=h,e[17]=g):g=e[17],g}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(31),t=l(L),n;e[0]===t?n=e[1]:(n=c(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:s,isLoading:u}=m(!0),d=s?.payload?.config,f;e[2]===d?f=e[3]:(f=w(d),e[2]=d,e[3]=f);let p=f,[g,_]=(0,x.useState)(p),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===p?(D=e[5],O=e[6]):(D=()=>_(p),O=[p],e[4]=p,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]===r.activityDetailDefaultDescription?M=e[12]:(M=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.activityDetailDefaultDescription}),e[11]=r.activityDetailDefaultDescription,e[12]=M);let N;e[13]!==j||e[14]!==M?(N=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[j,M]}),e[13]=j,e[14]=M,e[15]=N):N=e[15];let P;e[16]!==r.activityDetailLevels||e[17]!==A||e[18]!==u||e[19]!==g||e[20]!==v?(P=u?(0,E.jsx)(h,{className:`h-10 w-full rounded-lg sm:max-w-sm`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`sm:max-w-sm`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[16]=r.activityDetailLevels,e[17]=A,e[18]=u,e[19]=g,e[20]=v,e[21]=P):P=e[21];let F=b?`text-red-600 dark:text-red-400`:`text-fg-subtle`,I;e[22]===F?I=e[23]:(I=o(`min-h-4 text-xs`,F),e[22]=F,e[23]=I);let R=b?r.activityDetailSaveError:v?r.activityDetailSaving:r.activityDetailDefaultHint,z;e[24]!==I||e[25]!==R?(z=(0,E.jsx)(`p`,{className:I,children:R}),e[24]=I,e[25]=R,e[26]=z):z=e[26];let B;return e[27]!==z||e[28]!==N||e[29]!==P?(B=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[N,P,z]}),e[27]=z,e[28]=N,e[29]=P,e[30]=B):B=e[30],B}function L(e){return e.language}function R(){let e=(0,S.c)(27),t=l(V),n;e[0]===t?n=e[1]:(n=c(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),a=_(z),o;e[2]===r.developerGroupTitle?o=e[3]:(o=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.developerGroupTitle}),e[2]=r.developerGroupTitle,e[3]=o);let s;e[4]===r.developerGroupDescription?s=e[5]:(s=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.developerGroupDescription}),e[4]=r.developerGroupDescription,e[5]=s);let u;e[6]!==o||e[7]!==s?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),e[6]=o,e[7]=s,e[8]=u):u=e[8];let d;e[9]===r.showRawToolDataTitle?d=e[10]:(d=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[9]=r.showRawToolDataTitle,e[10]=d);let f;e[11]===r.showRawToolDataDescription?f=e[12]:(f=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[11]=r.showRawToolDataDescription,e[12]=f);let p;e[13]!==d||e[14]!==f?(p=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),e[13]=d,e[14]=f,e[15]=p):p=e[15];let m;e[16]===a?m=e[17]:(m=e=>a(e.target.checked),e[16]=a,e[17]=m);let h;e[18]!==i||e[19]!==m?(h=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:m}),e[18]=i,e[19]=m,e[20]=h):h=e[20];let g;e[21]!==p||e[22]!==h?(g=(0,E.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:[p,h]}),e[21]=p,e[22]=h,e[23]=g):g=e[23];let v;return e[24]!==u||e[25]!==g?(v=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[u,g]}),e[24]=u,e[25]=g,e[26]=v):v=e[26],v}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(30),t=l(U),n;e[0]===t?n=e[1]:(n=c(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]!==r.pageTitle||e[3]!==r.subtitle?(i=(0,E.jsx)(v,{title:r.pageTitle,subtitle:r.subtitle}),e[2]=r.pageTitle,e[3]=r.subtitle,e[4]=i):i=e[4];let a;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=D(),e[5]=a):a=e[5];let o;e[6]===r.languageTitle?o=e[7]:(o=(0,E.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:r.languageTitle}),e[6]=r.languageTitle,e[7]=o);let s;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsx)(g,{variant:`page`,sections:[`language`]}),e[8]=s):s=e[8];let u;e[9]===o?u=e[10]:(u=(0,E.jsxs)(`section`,{className:a,"aria-labelledby":`pref-language-heading`,children:[o,s]}),e[9]=o,e[10]=u);let d;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=D(),e[11]=d):d=e[11];let f;e[12]===r.themeTitle?f=e[13]:(f=(0,E.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:r.themeTitle}),e[12]=r.themeTitle,e[13]=f);let p,m,h;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,E.jsx)(g,{variant:`page`,sections:[`theme`,`font`]}),h=(0,E.jsx)(M,{}),p=(0,E.jsx)(I,{}),e[14]=p,e[15]=m,e[16]=h):(p=e[14],m=e[15],h=e[16]);let _;e[17]===f?_=e[18]:(_=(0,E.jsxs)(`section`,{className:d,"aria-labelledby":`pref-appearance-heading`,children:[f,m,h,p]}),e[17]=f,e[18]=_);let x;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=D(),e[19]=x):x=e[19];let C;e[20]===r.developerGroupTitle?C=e[21]:(C=(0,E.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:r.developerGroupTitle}),e[20]=r.developerGroupTitle,e[21]=C);let w;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(R,{}),e[22]=w):w=e[22];let T;e[23]===C?T=e[24]:(T=(0,E.jsx)(b,{children:(0,E.jsxs)(`section`,{className:x,"aria-labelledby":`pref-developer-heading`,children:[C,w]})}),e[23]=C,e[24]=T);let O;return e[25]!==i||e[26]!==_||e[27]!==T||e[28]!==u?(O=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,u,_,T]}),e[25]=i,e[26]=_,e[27]=T,e[28]=u,e[29]=O):O=e[29],O}function U(e){return e.language}export{H as AppearanceSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{n as i,r as a}from"./popover-select-BzdnTy3h.js";import{t as o}from"./cn-JdwAhgNB.js";import{n as s}from"./interaction-BmQogeqz.js";import{t as c}from"./messages-ELK_1h2D.js";import{n as l,r as u,s as d}from"./locale-store-81Gv0wwo.js";import{i as f}from"./theme-store-hOF81tUQ.js";import{n as p,r as m}from"./gateway-config-swr-CN-JHMAh.js";import{Aa as h,Ro as g,oi as _}from"./index-CPTLS-Zn.js";import{n as v,r as y}from"./settings-page-layout-BRQNel6r.js";import{t as b}from"./settings-advanced-gate-BJrHIcw8.js";var x=e(t(),1),S=n();function C(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function w(e){let t=C(e)?e:{},n=C(t.gateway)?t.gateway:{},r=(C(n.webchat)?n.webchat:{}).activityDetailDefault;return r===`off`||r===`stream`||r===`on`?r:`on`}async function T(e){await d(u(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{webchat:{activityDetailDefault:e}}})}),await p()}var E=r();function D(){return o(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var O={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 k(e){let t=(0,S.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,E.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,E.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,E.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]===o?f=t[13]:(f=(0,E.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=f);let p;t[14]===o?p=t[15]:(p=(0,E.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=p);let m;t[16]!==c||t[17]!==d||t[18]!==f||t[19]!==p?(m=(0,E.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,f,p]}),t[16]=c,t[17]=d,t[18]=f,t[19]=p,t[20]=m):m=t[20];let h;return t[21]!==s||t[22]!==m?(h=(0,E.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:m}),t[21]=s,t[22]=m,t[23]=h):h=t[23],h}function A(e){let t=(0,S.c)(8),{scheme:n}=e,{light:r,dark:i}=O[n],a;t[0]===r?a=t[1]:(a=(0,E.jsx)(k,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,E.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,E.jsx)(k,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,E.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 j=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function M(){let e=(0,S.c)(18),t=l(F),n;e[0]===t?n=e[1]:(n=c(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=f(P),a=f(N),u;e[2]===r.colorSchemeTitle?u=e[3]:(u=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.colorSchemeTitle}),e[2]=r.colorSchemeTitle,e[3]=u);let d;e[4]===r.colorSchemeDescription?d=e[5]:(d=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.colorSchemeDescription}),e[4]=r.colorSchemeDescription,e[5]=d);let p;e[6]!==u||e[7]!==d?(p=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[u,d]}),e[6]=u,e[7]=d,e[8]=p):p=e[8];let m;e[9]!==r||e[10]!==i||e[11]!==a?(m=j.map(e=>{let{value:t,labelKey:n}=e,c=i===t;return(0,E.jsxs)(`button`,{type:`button`,"aria-pressed":c,onClick:()=>a(t),className:o(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,s.pressCard,c?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,E.jsx)(A,{scheme:t}),(0,E.jsx)(`span`,{className:o(`text-xs font-medium leading-none`,c?`text-accent-fg`:`text-fg-muted`),children:r[n]})]},t)}),e[9]=r,e[10]=i,e[11]=a,e[12]=m):m=e[12];let h;e[13]===m?h=e[14]:(h=(0,E.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:m}),e[13]=m,e[14]=h);let g;return e[15]!==p||e[16]!==h?(g=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 p-3.5 sm:py-4`,children:[p,h]}),e[15]=p,e[16]=h,e[17]=g):g=e[17],g}function N(e){return e.setColorScheme}function P(e){return e.colorScheme}function F(e){return e.language}function I(){let e=(0,S.c)(31),t=l(L),n;e[0]===t?n=e[1]:(n=c(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,{data:s,isLoading:u}=m(!0),d=s?.payload?.config,f;e[2]===d?f=e[3]:(f=w(d),e[2]=d,e[3]=f);let p=f,[g,_]=(0,x.useState)(p),[v,y]=(0,x.useState)(!1),[b,C]=(0,x.useState)(!1),D,O;e[4]===p?(D=e[5],O=e[6]):(D=()=>_(p),O=[p],e[4]=p,e[5]=D,e[6]=O),(0,x.useEffect)(D,O);let k;e[7]===g?k=e[8]:(k=e=>{let t=g;_(e),y(!0),C(!1),T(e).catch(()=>{_(t),C(!0)}).finally(()=>y(!1))},e[7]=g,e[8]=k);let A=k,j;e[9]===r.activityDetailDefaultTitle?j=e[10]:(j=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.activityDetailDefaultTitle}),e[9]=r.activityDetailDefaultTitle,e[10]=j);let M;e[11]===r.activityDetailDefaultDescription?M=e[12]:(M=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.activityDetailDefaultDescription}),e[11]=r.activityDetailDefaultDescription,e[12]=M);let N;e[13]!==j||e[14]!==M?(N=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[j,M]}),e[13]=j,e[14]=M,e[15]=N):N=e[15];let P;e[16]!==r.activityDetailLevels||e[17]!==A||e[18]!==u||e[19]!==g||e[20]!==v?(P=u?(0,E.jsx)(h,{className:`h-10 w-full rounded-lg sm:max-w-sm`}):(0,E.jsxs)(i,{value:g,disabled:v,onChange:e=>A(e.target.value),triggerClassName:`sm:max-w-sm`,children:[(0,E.jsx)(a,{value:`off`,children:r.activityDetailLevels.off}),(0,E.jsx)(a,{value:`on`,children:r.activityDetailLevels.on}),(0,E.jsx)(a,{value:`stream`,children:r.activityDetailLevels.stream})]}),e[16]=r.activityDetailLevels,e[17]=A,e[18]=u,e[19]=g,e[20]=v,e[21]=P):P=e[21];let F=b?`text-red-600 dark:text-red-400`:`text-fg-subtle`,I;e[22]===F?I=e[23]:(I=o(`min-h-4 text-xs`,F),e[22]=F,e[23]=I);let R=b?r.activityDetailSaveError:v?r.activityDetailSaving:r.activityDetailDefaultHint,z;e[24]!==I||e[25]!==R?(z=(0,E.jsx)(`p`,{className:I,children:R}),e[24]=I,e[25]=R,e[26]=z):z=e[26];let B;return e[27]!==z||e[28]!==N||e[29]!==P?(B=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[N,P,z]}),e[27]=z,e[28]=N,e[29]=P,e[30]=B):B=e[30],B}function L(e){return e.language}function R(){let e=(0,S.c)(27),t=l(V),n;e[0]===t?n=e[1]:(n=c(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i=_(B),a=_(z),o;e[2]===r.developerGroupTitle?o=e[3]:(o=(0,E.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:r.developerGroupTitle}),e[2]=r.developerGroupTitle,e[3]=o);let s;e[4]===r.developerGroupDescription?s=e[5]:(s=(0,E.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:r.developerGroupDescription}),e[4]=r.developerGroupDescription,e[5]=s);let u;e[6]!==o||e[7]!==s?(u=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),e[6]=o,e[7]=s,e[8]=u):u=e[8];let d;e[9]===r.showRawToolDataTitle?d=e[10]:(d=(0,E.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:r.showRawToolDataTitle}),e[9]=r.showRawToolDataTitle,e[10]=d);let f;e[11]===r.showRawToolDataDescription?f=e[12]:(f=(0,E.jsx)(`p`,{className:`text-xs text-fg-muted`,children:r.showRawToolDataDescription}),e[11]=r.showRawToolDataDescription,e[12]=f);let p;e[13]!==d||e[14]!==f?(p=(0,E.jsxs)(`div`,{className:`min-w-0`,children:[d,f]}),e[13]=d,e[14]=f,e[15]=p):p=e[15];let m;e[16]===a?m=e[17]:(m=e=>a(e.target.checked),e[16]=a,e[17]=m);let h;e[18]!==i||e[19]!==m?(h=(0,E.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:i,onChange:m}),e[18]=i,e[19]=m,e[20]=h):h=e[20];let g;e[21]!==p||e[22]!==h?(g=(0,E.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:[p,h]}),e[21]=p,e[22]=h,e[23]=g):g=e[23];let v;return e[24]!==u||e[25]!==g?(v=(0,E.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[u,g]}),e[24]=u,e[25]=g,e[26]=v):v=e[26],v}function z(e){return e.setShowRawToolData}function B(e){return e.showRawToolData}function V(e){return e.language}function H(){let e=(0,S.c)(30),t=l(U),n;e[0]===t?n=e[1]:(n=c(t),e[0]=t,e[1]=n);let r=n.appearanceSettings,i;e[2]!==r.pageTitle||e[3]!==r.subtitle?(i=(0,E.jsx)(v,{title:r.pageTitle,subtitle:r.subtitle}),e[2]=r.pageTitle,e[3]=r.subtitle,e[4]=i):i=e[4];let a;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(a=D(),e[5]=a):a=e[5];let o;e[6]===r.languageTitle?o=e[7]:(o=(0,E.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:r.languageTitle}),e[6]=r.languageTitle,e[7]=o);let s;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,E.jsx)(g,{variant:`page`,sections:[`language`]}),e[8]=s):s=e[8];let u;e[9]===o?u=e[10]:(u=(0,E.jsxs)(`section`,{className:a,"aria-labelledby":`pref-language-heading`,children:[o,s]}),e[9]=o,e[10]=u);let d;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(d=D(),e[11]=d):d=e[11];let f;e[12]===r.themeTitle?f=e[13]:(f=(0,E.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:r.themeTitle}),e[12]=r.themeTitle,e[13]=f);let p,m,h;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,E.jsx)(g,{variant:`page`,sections:[`theme`,`font`]}),h=(0,E.jsx)(M,{}),p=(0,E.jsx)(I,{}),e[14]=p,e[15]=m,e[16]=h):(p=e[14],m=e[15],h=e[16]);let _;e[17]===f?_=e[18]:(_=(0,E.jsxs)(`section`,{className:d,"aria-labelledby":`pref-appearance-heading`,children:[f,m,h,p]}),e[17]=f,e[18]=_);let x;e[19]===Symbol.for(`react.memo_cache_sentinel`)?(x=D(),e[19]=x):x=e[19];let C;e[20]===r.developerGroupTitle?C=e[21]:(C=(0,E.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:r.developerGroupTitle}),e[20]=r.developerGroupTitle,e[21]=C);let w;e[22]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,E.jsx)(R,{}),e[22]=w):w=e[22];let T;e[23]===C?T=e[24]:(T=(0,E.jsx)(b,{children:(0,E.jsxs)(`section`,{className:x,"aria-labelledby":`pref-developer-heading`,children:[C,w]})}),e[23]=C,e[24]=T);let O;return e[25]!==i||e[26]!==_||e[27]!==T||e[28]!==u?(O=(0,E.jsxs)(y,{gap:`gap-6`,children:[i,u,_,T]}),e[25]=i,e[26]=_,e[27]=T,e[28]=u,e[29]=O):O=e[29],O}function U(e){return e.language}export{H as AppearanceSettingsPanel};