@xopcai/xopc 0.0.141 → 0.0.142

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 (171) 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/{agent-avatar-dicebear-BRTCpm3t.js → agent-avatar-dicebear-BawPxiu5.js} +1 -1
  4. package/dist/gateway/static/root/assets/agents-CyvCIHnB.js +2 -0
  5. package/dist/gateway/static/root/assets/{app-management-settings-panel-DaMMZBAT.js → app-management-settings-panel-81xd1p9R.js} +1 -1
  6. package/dist/gateway/static/root/assets/{appearance-settings-BXHThPyM.js → appearance-settings-DYeQsYU8.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-B4omjLxa.js → apps-page-DK_Vx6nl.js} +1 -1
  8. package/dist/gateway/static/root/assets/{archive-plugin-izB-4N4L.js → archive-plugin-D_oa7oti.js} +1 -1
  9. package/dist/gateway/static/root/assets/{attachment-load-CJihXa5y.js → attachment-load-Cd-bwI2N.js} +1 -1
  10. package/dist/gateway/static/root/assets/{automation-suggestion-card-fgtj5Gek.js → automation-suggestion-card-B1LV3YYv.js} +1 -1
  11. package/dist/gateway/static/root/assets/automations-page-fzrovqhv.js +4 -0
  12. package/dist/gateway/static/root/assets/{binary-plugins-D3VUeG8s.js → binary-plugins-O8svLKWw.js} +1 -1
  13. package/dist/gateway/static/root/assets/{block-editor-KnA0sLI3.js → block-editor-Dhj5f4Bx.js} +47 -47
  14. package/dist/gateway/static/root/assets/browser-settings-page-BDn-n-UB.js +8 -0
  15. package/dist/gateway/static/root/assets/{capability-presets-api-D8rRNhc6.js → capability-presets-api-dJy1Eqgx.js} +1 -1
  16. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-sCHojZr4.js → capability-presets-settings-panel-Co5ipo_Q.js} +1 -1
  17. package/dist/gateway/static/root/assets/{channel-recipient-api-BWgqwC5h.js → channel-recipient-api-Bfuhp2ty.js} +1 -1
  18. package/dist/gateway/static/root/assets/channels-settings-BWlpaxg9.js +1 -0
  19. package/dist/gateway/static/root/assets/channels-status-swr-D_jkIZLV.js +1 -0
  20. package/dist/gateway/static/root/assets/connectors-page-BcekbW4q.js +2 -0
  21. package/dist/gateway/static/root/assets/{desktop-pet-CzdqX001.js → desktop-pet-DFMfIb5F.js} +1 -1
  22. package/dist/gateway/static/root/assets/{desktop-pet-settings-DqqUPC7G.js → desktop-pet-settings-BJCUuL8Y.js} +1 -1
  23. package/dist/gateway/static/root/assets/{directory-picker-path-field-PzlO5tSM.js → directory-picker-path-field-BrYt1gAr.js} +1 -1
  24. package/dist/gateway/static/root/assets/{dreaming-settings-BmL54kQq.js → dreaming-settings-BN1Z2mIo.js} +3 -3
  25. package/dist/gateway/static/root/assets/{extension-debug-page-DcW8Ie3r.js → extension-debug-page-Bh630pLD.js} +1 -1
  26. package/dist/gateway/static/root/assets/{extension-page-DT5cpace.js → extension-page-B-1KxvVy.js} +1 -1
  27. package/dist/gateway/static/root/assets/{extension-settings-page-CbMk4GhQ.js → extension-settings-page-BF9NACI3.js} +1 -1
  28. package/dist/gateway/static/root/assets/{fetch-06q5eCMA.js → fetch-B1WtuprY.js} +1 -1
  29. package/dist/gateway/static/root/assets/{gateway-config-api-4VXUJtLz.js → gateway-config-api-De2N821l.js} +1 -1
  30. package/dist/gateway/static/root/assets/{gateway-settings-CdghmKHJ.js → gateway-settings-DN9sNREz.js} +1 -1
  31. package/dist/gateway/static/root/assets/{gateway-startup-retry-2f7_vsv7.js → gateway-startup-retry-nEujFSDj.js} +1 -1
  32. package/dist/gateway/static/root/assets/goal-create-dialog-BpoQW8cD.js +1 -0
  33. package/dist/gateway/static/root/assets/goal-detail-page-CBRSPd0b.js +4 -0
  34. package/dist/gateway/static/root/assets/{goals-config-api-BpuQTufF.js → goals-config-api-DUy3eEse.js} +1 -1
  35. package/dist/gateway/static/root/assets/goals-page-BCcBi407.js +2 -0
  36. package/dist/gateway/static/root/assets/{goals-settings-CW1NwxvV.js → goals-settings-pkTXzXkh.js} +1 -1
  37. package/dist/gateway/static/root/assets/{heartbeat-settings-C86k5tff.js → heartbeat-settings-ezsufgLQ.js} +1 -1
  38. package/dist/gateway/static/root/assets/{index-ehajXmqL.js → index-DcUaXYeb.js} +65 -65
  39. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-CVIwwM15.js +1 -0
  40. package/dist/gateway/static/root/assets/logs-page-DQtTRXtj.js +7 -0
  41. package/dist/gateway/static/root/assets/{markdown-split-zS4KLNAf.js → markdown-split-B_6us9j7.js} +1 -1
  42. package/dist/gateway/static/root/assets/{media-plugins-_BgNJ9_7.js → media-plugins-D_fryIyj.js} +1 -1
  43. package/dist/gateway/static/root/assets/messages-BXNELNBa.js +3 -0
  44. package/dist/gateway/static/root/assets/models-hub-panel-BP2M9n6Q.js +2 -0
  45. package/dist/gateway/static/root/assets/notes-page-CspveYaO.js +1 -0
  46. package/dist/gateway/static/root/assets/notes-workbench-BHwzJ0OC.js +2 -0
  47. package/dist/gateway/static/root/assets/{page-tabs-B7sGQkgU.js → page-tabs-D_8jGlqx.js} +1 -1
  48. package/dist/gateway/static/root/assets/{preview-open-alternatives-D1ri4s_O.js → preview-open-alternatives-BBLMK8Mp.js} +1 -1
  49. package/dist/gateway/static/root/assets/project-detail-page-Dy3rsobs.js +1 -0
  50. package/dist/gateway/static/root/assets/projects-page-CWKpPE0L.js +1 -0
  51. package/dist/gateway/static/root/assets/remote-access-hub-CqNRyXEo.js +1 -0
  52. package/dist/gateway/static/root/assets/{save-bar-controls-BClrOinh.js → save-bar-controls-DVS3FR5r.js} +1 -1
  53. package/dist/gateway/static/root/assets/{schedule-field-CL7YTwLV.js → schedule-field-D6vKd6-T.js} +1 -1
  54. package/dist/gateway/static/root/assets/{schema-form-ww4PiIje.js → schema-form-BPy4lbIh.js} +1 -1
  55. package/dist/gateway/static/root/assets/sessions-page-MEME7ivF.js +1 -0
  56. package/dist/gateway/static/root/assets/settings-advanced-gate-JVd0qaSF.js +1 -0
  57. package/dist/gateway/static/root/assets/{settings-collapsible-section-D9gEEVm2.js → settings-collapsible-section-WzdikxPt.js} +1 -1
  58. package/dist/gateway/static/root/assets/{settings-form-section-DGeEoBkb.js → settings-form-section-CvfzhBV-.js} +1 -1
  59. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BXUeMR37.js → settings-loading-skeleton-BxR-Ulhi.js} +1 -1
  60. package/dist/gateway/static/root/assets/{settings-page-C5G2klUB.js → settings-page-DYEbB1EV.js} +1 -1
  61. package/dist/gateway/static/root/assets/{settings-page-layout-CEepfbCa.js → settings-page-layout-CKefvbYi.js} +1 -1
  62. package/dist/gateway/static/root/assets/{setup-status-panel-oQ8OLnw3.js → setup-status-panel-dWN8BJ3z.js} +1 -1
  63. package/dist/gateway/static/root/assets/{share-preview-page-CXtDHMSi.js → share-preview-page-D8foINzP.js} +1 -1
  64. package/dist/gateway/static/root/assets/shares-settings-Tgbv1s7G.js +1 -0
  65. package/dist/gateway/static/root/assets/skill-reload-api-D_YK0b_Z.js +1 -0
  66. package/dist/gateway/static/root/assets/skills-page-DGytfoZK.js +2 -0
  67. package/dist/gateway/static/root/assets/{system-settings-panel-W6MBJXrr.js → system-settings-panel-BokgAgf7.js} +1 -1
  68. package/dist/gateway/static/root/assets/{typed-models-lib-BkODXN7T.js → typed-models-lib-BwHlNL3L.js} +1 -1
  69. package/dist/gateway/static/root/assets/{use-channel-catalog-CTbwLZXc.js → use-channel-catalog-DR11ap3A.js} +1 -1
  70. package/dist/gateway/static/root/assets/{user-profile-settings-panel-CeC308-E.js → user-profile-settings-panel-8YtygcJp.js} +1 -1
  71. package/dist/gateway/static/root/assets/{utils-ZxrKHxyb.js → utils-BKUWB-TT.js} +1 -1
  72. package/dist/gateway/static/root/assets/voice-api-key-field-BVH71EFf.js +1 -0
  73. package/dist/gateway/static/root/assets/work-item-detail-page-JeTE7XNM.js +1 -0
  74. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CL_rnAUB.js +3 -0
  75. package/dist/gateway/static/root/assets/{workflow-start-dialog-CtLTtNUB.js → workflow-start-dialog-_u8Uc1ze.js} +1 -1
  76. package/dist/gateway/static/root/assets/workflows-page-ixgk_y1l.js +18 -0
  77. package/dist/gateway/static/root/index.html +4 -4
  78. package/dist/package.js +1 -1
  79. package/dist/src/agent/embedded/session-runner.js +5 -5
  80. package/dist/src/agent/embedded/session-runner.js.map +1 -1
  81. package/dist/src/agent/embedded/xopc-auth-storage.d.ts +4 -3
  82. package/dist/src/agent/embedded/xopc-auth-storage.js +6 -6
  83. package/dist/src/agent/embedded/xopc-auth-storage.js.map +1 -1
  84. package/dist/src/agent/embedded/xopc-stream-bridge.js +1 -0
  85. package/dist/src/agent/embedded/xopc-stream-bridge.js.map +1 -1
  86. package/dist/src/agent/goals/checklist-judge.js +3 -3
  87. package/dist/src/agent/goals/checklist-judge.js.map +1 -1
  88. package/dist/src/agent/goals/judge.js +2 -2
  89. package/dist/src/agent/goals/judge.js.map +1 -1
  90. package/dist/src/agent/image/understanding/pi-ai-provider.js +2 -2
  91. package/dist/src/agent/image/understanding/pi-ai-provider.js.map +1 -1
  92. package/dist/src/agent/memory/compaction.js +2 -2
  93. package/dist/src/agent/memory/compaction.js.map +1 -1
  94. package/dist/src/agent/service/btw-query.d.ts +4 -0
  95. package/dist/src/agent/service/btw-query.js +94 -13
  96. package/dist/src/agent/service/btw-query.js.map +1 -1
  97. package/dist/src/agent/session/session-inspector.js +9 -1
  98. package/dist/src/agent/session/session-inspector.js.map +1 -1
  99. package/dist/src/agent/tools/session-search-tool.js +2 -2
  100. package/dist/src/agent/tools/session-search-tool.js.map +1 -1
  101. package/dist/src/agent/tools/web-extract.js +2 -2
  102. package/dist/src/agent/tools/web-extract.js.map +1 -1
  103. package/dist/src/ai-assist/text-assist.d.ts +2 -1
  104. package/dist/src/ai-assist/text-assist.js +10 -23
  105. package/dist/src/ai-assist/text-assist.js.map +1 -1
  106. package/dist/src/auth/credentials.js +5 -2
  107. package/dist/src/auth/credentials.js.map +1 -1
  108. package/dist/src/auth/oauth/github-copilot.d.ts +3 -4
  109. package/dist/src/auth/oauth/github-copilot.js +66 -2
  110. package/dist/src/auth/oauth/github-copilot.js.map +1 -0
  111. package/dist/src/auth/oauth/index.js +2 -2
  112. package/dist/src/automations/draft/automation-draft-service.js +3 -3
  113. package/dist/src/automations/draft/automation-draft-service.js.map +1 -1
  114. package/dist/src/chat-commands/builtins/review.js +22 -5
  115. package/dist/src/chat-commands/builtins/review.js.map +1 -1
  116. package/dist/src/chat-commands/types.d.ts +4 -0
  117. package/dist/src/gateway/hono/routes/models.js +1 -0
  118. package/dist/src/gateway/hono/routes/models.js.map +1 -1
  119. package/dist/src/gateway/hono/routes/voice.js +2 -2
  120. package/dist/src/gateway/hono/routes/voice.js.map +1 -1
  121. package/dist/src/goals/goal-contract-draft.js +2 -2
  122. package/dist/src/goals/goal-contract-draft.js.map +1 -1
  123. package/dist/src/goals/goal-evidence-review.js +2 -2
  124. package/dist/src/goals/goal-evidence-review.js.map +1 -1
  125. package/dist/src/notes/service.js +2 -2
  126. package/dist/src/notes/service.js.map +1 -1
  127. package/dist/src/providers/constants.d.ts +2 -0
  128. package/dist/src/providers/constants.js +11 -0
  129. package/dist/src/providers/constants.js.map +1 -0
  130. package/dist/src/providers/extension-stream-bridge.js +1 -0
  131. package/dist/src/providers/extension-stream-bridge.js.map +1 -1
  132. package/dist/src/providers/index.d.ts +3 -3
  133. package/dist/src/providers/index.js +5 -4
  134. package/dist/src/providers/index.js.map +1 -1
  135. package/dist/src/providers/model-call.d.ts +17 -0
  136. package/dist/src/providers/model-call.js +60 -0
  137. package/dist/src/providers/model-call.js.map +1 -0
  138. package/dist/src/session/session-title.js +2 -2
  139. package/dist/src/session/session-title.js.map +1 -1
  140. package/dist/src/voice/tts/summarize.js +2 -2
  141. package/dist/src/voice/tts/summarize.js.map +1 -1
  142. package/dist/src/workflows/draft/workflow-draft-service.js +2 -2
  143. package/dist/src/workflows/draft/workflow-draft-service.js.map +1 -1
  144. package/package.json +5 -5
  145. package/dist/gateway/static/root/assets/agents-Bd863Akz.js +0 -2
  146. package/dist/gateway/static/root/assets/automations-page-Dz2mgjIR.js +0 -4
  147. package/dist/gateway/static/root/assets/browser-settings-page-DZZz5v_i.js +0 -8
  148. package/dist/gateway/static/root/assets/channels-settings-UyVSnf9s.js +0 -1
  149. package/dist/gateway/static/root/assets/channels-status-swr-CB5FzcLf.js +0 -1
  150. package/dist/gateway/static/root/assets/connectors-page-BzhHiUO4.js +0 -2
  151. package/dist/gateway/static/root/assets/goal-create-dialog-CAlsM9MP.js +0 -1
  152. package/dist/gateway/static/root/assets/goal-detail-page-CLPa4F2y.js +0 -4
  153. package/dist/gateway/static/root/assets/goals-page-B2VpdzfH.js +0 -2
  154. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-8xwKEhui.js +0 -1
  155. package/dist/gateway/static/root/assets/logs-page-C_BMONOO.js +0 -7
  156. package/dist/gateway/static/root/assets/messages-B-8CqAeX.js +0 -3
  157. package/dist/gateway/static/root/assets/models-hub-panel-Do_cwNjF.js +0 -2
  158. package/dist/gateway/static/root/assets/notes-page-5IdlPHaX.js +0 -1
  159. package/dist/gateway/static/root/assets/notes-workbench-0KsRZJIZ.js +0 -2
  160. package/dist/gateway/static/root/assets/project-detail-page-Dk2zB1gy.js +0 -1
  161. package/dist/gateway/static/root/assets/projects-page-CJQntm2G.js +0 -1
  162. package/dist/gateway/static/root/assets/remote-access-hub-CHeZZg7O.js +0 -1
  163. package/dist/gateway/static/root/assets/sessions-page-9Hb_r0AG.js +0 -1
  164. package/dist/gateway/static/root/assets/settings-advanced-gate-PmzVFvAv.js +0 -1
  165. package/dist/gateway/static/root/assets/shares-settings-BlNoairj.js +0 -1
  166. package/dist/gateway/static/root/assets/skill-reload-api-BYV5x1KO.js +0 -1
  167. package/dist/gateway/static/root/assets/skills-page-ClBcKQZP.js +0 -2
  168. package/dist/gateway/static/root/assets/voice-api-key-field-BE57S-nS.js +0 -1
  169. package/dist/gateway/static/root/assets/work-item-detail-page-Di1ww5Aa.js +0 -1
  170. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CzK84i-B.js +0 -3
  171. package/dist/gateway/static/root/assets/workflows-page-CZFZdua9.js +0 -18
@@ -0,0 +1,2 @@
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-BXNELNBa.js";import{a as o,n as s,o as c}from"./fetch-B1WtuprY.js";import{n as l}from"./locale-store-Ba72bFmP.js";import{i as u}from"./theme-store-Bt6vAkSB.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$n as f,Al as p,At as m,Bi as h,Bo as g,Bt as _,C as v,Co as y,Dl as b,Do as x,Es as S,Ga as C,Gs as w,Ha as T,Hi as E,Ii as D,Ja as O,Ka as k,Kt as A,Li as j,Lo as M,Mc as N,Ml as P,Mo as F,Ms as I,Mt as L,Nc as ee,No as te,Qn as R,Ri as z,Rt as B,Sc as ne,Sl as V,So as re,Ua as ie,Ui as H,Uo as U,Ut as W,Vc as G,Vi as K,Wa as ae,Wi as oe,Wo as se,Wt as ce,Xa as le,Ya as ue,Zn as de,ai as fe,ar as pe,as as me,ba as q,bs as he,co as ge,cr as _e,da as ve,dl as ye,do as be,dr as xe,eo as Se,er as Ce,fo as J,hl as we,ii as Te,io as Ee,ir as De,jl as Oe,jo as ke,ko as Y,ll as Ae,lo as je,lr as Me,mo as Ne,mr as Pe,n as Fe,nc as Ie,ni as Le,nr as Re,oi as ze,oo as Be,or as X,pl as Ve,po as He,pr as Ue,ps as We,qa as Ge,r as Ke,ri as qe,rr as Je,rs as Ye,sc as Xe,si as Ze,so as Qe,tc as $e,ti as et,tr as tt,ts as nt,ui as rt,uo as it,ur as at,w as ot,wc as st,ya as ct,yl as lt,zi as ut,zo as dt}from"./index-DcUaXYeb.js";import{t as ft}from"./markdown-editor-jD1LPiP-.js";import{n as pt,t as mt}from"./settings-page-layout-CKefvbYi.js";import{r as ht,t as gt}from"./settings-loading-skeleton-BxR-Ulhi.js";import{n as _t,t as vt}from"./settings-form-section-CvfzhBV-.js";import{t as yt}from"./page-tabs-D_8jGlqx.js";import{n as bt}from"./agent-avatar-dicebear-BawPxiu5.js";import{n as xt,r as St,t as Ct}from"./channel-recipient-api-Bfuhp2ty.js";import{n as wt,r as Tt,t as Et}from"./utils-BKUWB-TT.js";import{a as Dt,i as Ot,n as kt,o as At,t as jt}from"./typed-models-lib-BwHlNL3L.js";import{a as Mt,o as Nt,r as Pt,s as Ft}from"./capability-presets-api-dJy1Eqgx.js";import{t as It}from"./directory-picker-path-field-BrYt1gAr.js";var Z=n(),Q=r();function Lt(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,busy:a,deletePurge:o,deleteTarget:s,deleteConfirmText:c,onDeleteConfirmTextChange:l,onConfirm:u,onCancel:d,a:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(k,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let m;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(m=i(`fixed left-1/2 top-1/2 z-[81] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover`,`dark:border-edge`),t[1]=m):m=t[1];let h=o?f.purgeDisk:f.removeFromConfig,g;t[2]===h?g=t[3]:(g=(0,Q.jsx)(ue,{className:`text-base font-semibold text-fg`,children:h}),t[2]=h,t[3]=g);let _=o?f.confirmDeletePurge:f.confirmDelete,v;t[4]===_?v=t[5]:(v=(0,Q.jsx)(C,{className:`mt-2 whitespace-pre-wrap text-sm leading-relaxed text-fg-muted`,children:_}),t[4]=_,t[5]=v);let y;t[6]!==f.purgeConfirmHint||t[7]!==f.purgeConfirmLabel||t[8]!==f.purgeConfirmPlaceholder||t[9]!==c||t[10]!==o||t[11]!==s||t[12]!==l?(y=o&&s?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:f.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:f.purgeConfirmPlaceholder.replace(`{{agentId}}`,s.id),value:c,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:f.purgeConfirmHint.replace(`{{agentId}}`,s.id)})]}):null,t[6]=f.purgeConfirmHint,t[7]=f.purgeConfirmLabel,t[8]=f.purgeConfirmPlaceholder,t[9]=c,t[10]=o,t[11]=s,t[12]=l,t[13]=y):y=t[13];let b;t[14]!==f.createModalCancel||t[15]!==a||t[16]!==d?(b=(0,Q.jsx)(Y,{type:`button`,variant:`ghost`,disabled:a,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=a,t[16]=d,t[17]=b):b=t[17];let x=o?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,S;t[18]!==a||t[19]!==c||t[20]!==o||t[21]!==s?(S=a||!s||o&&c.trim().toLowerCase()!==s.id.toLowerCase(),t[18]=a,t[19]=c,t[20]=o,t[21]=s,t[22]=S):S=t[22];let w=o?f.purgeDisk:f.removeFromConfig,T;t[23]!==u||t[24]!==S||t[25]!==w||t[26]!==x?(T=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:x,disabled:S,onClick:u,children:w}),t[23]=u,t[24]=S,t[25]=w,t[26]=x,t[27]=T):T=t[27];let E;t[28]!==T||t[29]!==b?(E=(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center justify-end gap-2 border-t border-edge-subtle/60 pt-3`,children:[b,T]}),t[28]=T,t[29]=b,t[30]=E):E=t[30];let D;t[31]!==E||t[32]!==g||t[33]!==v||t[34]!==y?(D=(0,Q.jsxs)(Ge,{children:[p,(0,Q.jsxs)(ae,{className:m,onOpenAutoFocus:Rt,children:[g,v,y,E]})]}),t[31]=E,t[32]=g,t[33]=v,t[34]=y,t[35]=D):D=t[35];let A;return t[36]!==r||t[37]!==n||t[38]!==D?(A=(0,Q.jsx)(O,{open:n,onOpenChange:r,children:D}),t[36]=r,t[37]=n,t[38]=D,t[39]=A):A=t[39],A}function Rt(e){return e.preventDefault()}var $=e(t(),1),zt=[{id:`overview`,labelKey:`navOverview`,icon:ne},{id:`behavior`,labelKey:`navBehavior`,icon:Ye},{id:`tools`,labelKey:`navTools`,icon:te},{id:`skills`,labelKey:`navSkills`,icon:ke},{id:`memory`,labelKey:`navMemory`,icon:ye},{id:`connections`,labelKey:`navConnections`,icon:Ae},{id:`config`,labelKey:`navConfig`,icon:me},{id:`dangerZone`,labelKey:`navDangerZone`,icon:U}];function Bt(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:a}=e,o;t[0]!==a||t[1]!==r?(o=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>a(e),className:i(`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors`,y.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c=n.editorNavAria,l;t[3]!==n||t[4]!==s?(l=zt.map(e=>{let{id:t,labelKey:r,icon:i}=e;return s(t,n[r],i)}),t[3]=n,t[4]=s,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:l}),t[6]=l,t[7]=u);let d;return t[8]!==n.editorNavAria||t[9]!==u?(d=(0,Q.jsx)(`nav`,{className:`flex w-full flex-col gap-1`,"aria-label":c,children:u}),t[8]=n.editorNavAria,t[9]=u,t[10]=d):d=t[10],d}function Vt(e){let t=(0,Z.c)(45),{open:n,onOpenChange:r,a,title:o,subtitle:s,panel:c,onPanelChange:l,onFooterSave:u,footerSaveDisabled:d,footerSavedFlash:f,showFooter:p,busy:m,children:h}=e,g=p===void 0?!0:p,[_,v]=(0,$.useState)(null),y;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(k,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,je)}),t[0]=y):y=t[0];let b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=i(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,ge,`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]=b):b=t[1];let x;t[2]===o?x=t[3]:(x=(0,Q.jsx)(ue,{className:`text-base font-semibold leading-snug text-fg`,children:o}),t[2]=o,t[3]=x);let S;t[4]===s?S=t[5]:(S=(0,Q.jsx)(C,{className:`mt-1 font-mono text-xs text-fg-muted`,children:s}),t[4]=s,t[5]=S);let w;t[6]!==x||t[7]!==S?(w=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[x,S]}),t[6]=x,t[7]=S,t[8]=w):w=t[8];let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=i(re,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=T):T=t[9];let E;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[10]=E):E=t[10];let D;t[11]===a.closeDialogAria?D=t[12]:(D=(0,Q.jsx)(ie,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:T,"aria-label":a.closeDialogAria,children:E})}),t[11]=a.closeDialogAria,t[12]=D);let A;t[13]!==w||t[14]!==D?(A=(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:[w,D]}),t[13]=w,t[14]=D,t[15]=A):A=t[15];let j;t[16]!==a||t[17]!==l||t[18]!==c?(j=(0,Q.jsx)(`div`,{className:`shrink-0 border-b border-edge-subtle px-4 py-3 dark:border-edge sm:flex sm:w-56 sm:shrink-0 sm:flex-col sm:overflow-y-auto sm:border-b-0 sm:border-r sm:px-0 sm:py-4 sm:pl-4 sm:pr-3`,children:(0,Q.jsx)(Bt,{a,panel:c,onPanelChange:l})}),t[16]=a,t[17]=l,t[18]=c,t[19]=j):j=t[19];let M;t[20]===h?M=t[21]:(M=(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden p-4 sm:pl-2 sm:pr-5`,children:h}),t[20]=h,t[21]=M);let N;t[22]!==a.footerSaveNotApplicable||t[23]!==a.personaSaved||t[24]!==a.save||t[25]!==m||t[26]!==d||t[27]!==f||t[28]!==u||t[29]!==g?(N=g?(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-1 border-t border-edge-subtle px-4 py-3 dark:border-edge sm:flex-row sm:items-center sm:justify-end sm:gap-3`,children:[f?(0,Q.jsxs)(`p`,{className:`order-2 text-center text-xs font-medium text-green-600 sm:order-1 sm:mr-auto sm:text-left dark:text-green-400`,children:[`✓ `,a.personaSaved]}):d?(0,Q.jsx)(`p`,{className:`order-2 text-center text-xs text-fg-muted sm:order-1 sm:mr-auto sm:text-left`,children:a.footerSaveNotApplicable}):null,(0,Q.jsx)(Y,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:m||d,onClick:()=>void u(),children:a.save})]}):null,t[22]=a.footerSaveNotApplicable,t[23]=a.personaSaved,t[24]=a.save,t[25]=m,t[26]=d,t[27]=f,t[28]=u,t[29]=g,t[30]=N):N=t[30];let P;t[31]!==M||t[32]!==N?(P=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[M,N]}),t[31]=M,t[32]=N,t[33]=P):P=t[33];let I;t[34]!==j||t[35]!==P?(I=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[j,P]}),t[34]=j,t[35]=P,t[36]=I):I=t[36];let L;t[37]!==_||t[38]!==I||t[39]!==A?(L=(0,Q.jsxs)(Ge,{children:[y,(0,Q.jsx)(ae,{ref:v,className:b,onOpenAutoFocus:Ht,children:(0,Q.jsxs)(Qe,{layer:`modal`,portalContainer:_,children:[A,I]})})]}),t[37]=_,t[38]=I,t[39]=A,t[40]=L):L=t[40];let ee;return t[41]!==r||t[42]!==n||t[43]!==L?(ee=(0,Q.jsx)(O,{open:n,onOpenChange:r,children:L}),t[41]=r,t[42]=n,t[43]=L,t[44]=ee):ee=t[44],ee}function Ht(e){return e.preventDefault()}var Ut=e=>s(e);function Wt(e){return!e||e.total<=0?null:Math.round(e.helpful/e.total*100)}function Gt(e){let t=Wt(e);return t==null?`border-edge bg-surface-panel text-fg-muted`:t>=70?`border-success/30 bg-success-soft text-fg`:t>=40?`border-warning/40 bg-warning-soft text-fg`:`border-danger/30 bg-danger-soft text-fg`}function Kt(e){return e==null?`—`:`${Math.round(e*100)}%`}function qt(){let e=(0,Z.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsxs)(`article`,{className:`px-4 py-3`,"aria-hidden":`true`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(q,{className:`h-3 w-16`}),(0,Q.jsx)(q,{className:`h-3 w-20`}),(0,Q.jsx)(q,{className:`h-3 w-24`})]}),(0,Q.jsx)(q,{className:`mt-3 h-4 w-full`}),(0,Q.jsx)(q,{className:`mt-2 h-4 w-5/6`}),(0,Q.jsx)(q,{className:`mt-2 h-4 w-2/3`})]}),e[0]=t):t=e[0],t}function Jt({embedded:e=!1,agentId:t}){let n=a(l(e=>e.language)).agentsSettings.memoryPanel,[r,i]=(0,$.useState)(``),[o,u]=(0,$.useState)(``),[f,p]=(0,$.useState)(``),[m,h]=(0,$.useState)({}),g=t?`&agentId=${encodeURIComponent(t)}`:``,_=t?`?agentId=${encodeURIComponent(t)}`:``,[v,y]=(0,$.useState)({searchStrategy:`fanout`,writeStrategy:`local-first`,allowExternalWrites:!1,allowedProviderIds:[],autoWriteKinds:[]}),[b,x]=(0,$.useState)({crossAgentSharing:`deny`,sensitiveWritePolicy:`confirm`}),{data:S,isLoading:C}=d(c(`/api/memory/providers`),Ut),{data:w,isLoading:T,mutate:E}=d(c(`/api/memory/records?status=active&limit=80${g}`),Ut),{data:D,isLoading:O,mutate:k}=d(c(`/api/memory/records?status=candidate&limit=80${g}`),Ut),{data:A,isLoading:j}=d(c(`/api/memory/signals?limit=50${g}`),Ut),{data:M,isLoading:N,mutate:P}=d(c(`/api/memory/traces?limit=80${g}`),Ut),{data:F,isLoading:I}=d(c(`/api/memory/feedback-summary?limit=1000${g}`),Ut),{data:L,isLoading:ee,mutate:te}=d(c(`/api/memory/config${t?`?agentId=${encodeURIComponent(t)}`:``}`),Ut),{data:R,isLoading:z,mutate:B}=d(c(`/api/memory/understanding/quality${t?`?agentId=${encodeURIComponent(t)}`:``}`),Ut),{data:ne,isLoading:V}=d(o?c(`/api/memory/search${_}`):null,e=>s(e,{method:`POST`,body:JSON.stringify({query:o,maxResults:20,...t?{agentId:t}:{}})})),re=ne?.results.map(e=>({...e.record,score:e.score}))??w?.records??[],ie=S?.providers.length??0,H=w?.records.length??0,U=D?.records.length??0,W=A?.signals.length??0,G=M?.traces.length??0,K=F?.summaries??[],ae=C||T||O||j||N||I||z||ee,oe=(0,$.useMemo)(()=>new Map(K.map(e=>[e.recordId,e])),[K]),se=K.reduce((e,t)=>e+t.total,0),ce=K.reduce((e,t)=>e+t.helpful,0),le=se>0?Math.round(ce/se*100):null,ue=(0,$.useMemo)(()=>[{label:n.providers,value:ie},{label:n.records,value:H},{label:n.inbox,value:U},{label:n.signals,value:W},{label:n.traceEvents,value:G},{label:n.recallQuality,value:le==null?`—`:`${le}%`}],[U,le,ie,H,W,n.inbox,n.providers,n.recallQuality,n.records,n.signals,n.traceEvents,G]);(0,$.useEffect)(()=>{let e=L?.memory.providerRouting;e&&y({searchStrategy:e.searchStrategy??`fanout`,writeStrategy:e.writeStrategy??`local-first`,allowExternalWrites:e.allowExternalWrites??!1,allowedProviderIds:e.allowedProviderIds??[],autoWriteKinds:e.autoWriteKinds??[]})},[L]),(0,$.useEffect)(()=>{let e=L?.memory.privacy;x({crossAgentSharing:e?.crossAgentSharing??`deny`,sensitiveWritePolicy:e?.sensitiveWritePolicy??`confirm`})},[L]);async function de(){if(L){p(n.saving);try{await s(c(`/api/memory/config`),{method:`PATCH`,body:JSON.stringify({agentId:L.agentId,memory:{...L.memory,privacy:b,providerRouting:v}})}),await te(),p(n.saved)}catch(e){p(e instanceof Error?e.message:n.saveFailed)}}}async function fe(e){h(t=>({...t,[e]:n.testing}));try{let t=(await s(c(`/api/memory/providers/${encodeURIComponent(e)}/test`),{method:`POST`})).checks.find(e=>!e.ok);h(r=>({...r,[e]:t?`${t.name}: ${t.message??n.checkFailed}`:n.testPassed})),P()}catch(t){h(r=>({...r,[e]:t instanceof Error?t.message:n.testFailed}))}}async function pe(e,t){await s(c(`/api/memory/records/${encodeURIComponent(e)}${_}`),{method:`PATCH`,body:JSON.stringify({status:t})}),await Promise.all([k(),E(),B()])}return(0,Q.jsxs)(`div`,{className:e?`flex min-h-0 w-full flex-1 flex-col gap-5 overflow-y-auto overscroll-contain pr-1`:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[e?null:(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:n.title}),(0,Q.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:n.subtitle})]}),(0,Q.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2 lg:grid-cols-6`,children:ue.map(e=>(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:e.label}),ae?(0,Q.jsx)(q,{className:`mt-2 h-7 w-16`}):(0,Q.jsx)(`div`,{className:`mt-1 text-2xl font-semibold text-fg`,children:e.value})]},e.label))}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.understandingQuality}),(0,Q.jsx)(`div`,{className:`mt-0.5 max-w-[70ch] text-xs leading-5 text-fg-muted`,children:n.understandingQualityHint})]}),z?(0,Q.jsx)(q,{className:`h-6 w-36 rounded-full`}):R?(0,Q.jsxs)(`span`,{className:`rounded-full px-2.5 py-1 text-xs font-medium ${R.cadence.slowed?`bg-warning-soft text-fg`:`bg-surface-hover text-fg-muted`}`,children:[R.cadence.slowed?n.cadenceSlowed:n.cadenceNormal,` · `,R.cadence.effectiveIntervalTurns,` `,n.turns]}):null]}),(0,Q.jsx)(`div`,{className:`grid gap-px bg-edge sm:grid-cols-2 lg:grid-cols-4`,children:z?Array.from({length:4}).map((e,t)=>(0,Q.jsxs)(`div`,{className:`bg-surface-panel px-4 py-4`,children:[(0,Q.jsx)(q,{className:`h-3 w-24`}),(0,Q.jsx)(q,{className:`mt-3 h-7 w-16`}),(0,Q.jsx)(q,{className:`mt-2 h-3 w-32`})]},t)):R?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`bg-surface-panel px-4 py-4`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:n.candidateAcceptance}),(0,Q.jsx)(`div`,{className:`mt-1 text-xl font-semibold text-fg`,children:Kt(R.metrics.decisions.acceptanceRate)}),(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-fg-subtle`,children:[R.metrics.decisions.total,` `,n.decisions]})]}),(0,Q.jsxs)(`div`,{className:`bg-surface-panel px-4 py-4`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:n.understandingRecallHelpful}),(0,Q.jsx)(`div`,{className:`mt-1 text-xl font-semibold text-fg`,children:Kt(R.metrics.recall.helpfulRate)}),(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-fg-subtle`,children:[R.metrics.recall.total,` `,n.feedback]})]}),(0,Q.jsxs)(`div`,{className:`bg-surface-panel px-4 py-4`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:n.pendingCandidates}),(0,Q.jsx)(`div`,{className:`mt-1 text-xl font-semibold text-fg`,children:R.metrics.records.candidate}),(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-fg-subtle`,children:[R.metrics.records.agingCandidates,` `,n.agingCandidates]})]}),(0,Q.jsxs)(`div`,{className:`bg-surface-panel px-4 py-4`,children:[(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:n.generatedCandidates}),(0,Q.jsx)(`div`,{className:`mt-1 text-xl font-semibold text-fg`,children:R.metrics.candidates.created}),(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-fg-subtle`,children:[R.metrics.windowDays,` `,n.dayWindow]})]})]}):(0,Q.jsx)(`div`,{className:`bg-surface-panel px-4 py-6 text-sm text-fg-muted sm:col-span-2 lg:col-span-4`,children:n.understandingQualityUnavailable})})]}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.memoryPolicy}),(0,Q.jsxs)(`div`,{className:`grid gap-3 p-4 md:grid-cols-2`,children:[(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.crossAgentSharing,(0,Q.jsxs)(Ee,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:b.crossAgentSharing,onChange:e=>x(t=>({...t,crossAgentSharing:e.target.value})),children:[(0,Q.jsx)(Be,{value:`deny`,children:n.crossAgentDeny}),(0,Q.jsx)(Be,{value:`readOnly`,children:n.crossAgentReadOnly}),(0,Q.jsx)(Be,{value:`allow`,children:n.crossAgentAllow})]})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.sensitiveWritePolicy,(0,Q.jsxs)(Ee,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:b.sensitiveWritePolicy,onChange:e=>x(t=>({...t,sensitiveWritePolicy:e.target.value})),children:[(0,Q.jsx)(Be,{value:`deny`,children:n.policyDeny}),(0,Q.jsx)(Be,{value:`confirm`,children:n.policyConfirm}),(0,Q.jsx)(Be,{value:`allow`,children:n.policyAllow})]})]}),(0,Q.jsx)(`p`,{className:`max-w-[72ch] text-xs leading-5 text-fg-muted md:col-span-2`,children:b.crossAgentSharing===`deny`?n.crossAgentDenyHelp:b.crossAgentSharing===`readOnly`?n.crossAgentReadOnlyHelp:n.crossAgentAllowHelp}),(0,Q.jsx)(`div`,{className:`border-t border-edge pt-3 text-xs font-medium text-fg-muted md:col-span-2`,children:n.providerPolicy}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.searchStrategy,(0,Q.jsx)(Ee,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:v.searchStrategy,onChange:e=>y(t=>({...t,searchStrategy:e.target.value})),children:[`fanout`,`local-first`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(Be,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`text-xs font-medium text-fg-muted`,children:[n.writeStrategy,(0,Q.jsx)(Ee,{className:`mt-1 min-h-10 w-full rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg`,value:v.writeStrategy,onChange:e=>y(t=>({...t,writeStrategy:e.target.value})),children:[`local-first`,`write-through`,`external-first`,`local-only`,`external-only`].map(e=>(0,Q.jsx)(Be,{value:e,children:e},e))})]}),(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-fg md:col-span-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:v.allowExternalWrites,onChange:e=>y(t=>({...t,allowExternalWrites:e.target.checked}))}),n.allowExternalWrites]}),(0,Q.jsxs)(`div`,{className:`md:col-span-2`,children:[(0,Q.jsx)(`div`,{className:`mb-2 text-xs font-medium text-fg-muted`,children:n.writableProviders}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:C?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(q,{className:`h-10 w-28 rounded-md`},t)):(S?.providers??[]).filter(e=>!e.capabilities.local).map(e=>(0,Q.jsxs)(`label`,{className:`flex items-center gap-2 rounded-md border border-edge px-3 py-2 text-sm text-fg`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:v.allowedProviderIds?.includes(e.id)??!1,onChange:t=>y(n=>({...n,allowedProviderIds:t.target.checked?[...n.allowedProviderIds??[],e.id]:(n.allowedProviderIds??[]).filter(t=>t!==e.id)}))}),e.displayName]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-3 md:col-span-2`,children:[(0,Q.jsx)(Y,{type:`button`,variant:`primary`,onClick:de,children:n.savePolicy}),f?(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:f}):null]})]})]}),(0,Q.jsxs)(`section`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-edge px-4 py-3`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:n.inbox}),(0,Q.jsx)(`div`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.inboxHint})]}),(0,Q.jsx)(`div`,{className:`text-xs text-fg-muted`,children:U})]}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[O?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(qt,{},t)):(D?.records??[]).map(e=>(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),(0,Q.jsx)(`span`,{children:e.sensitivity??`normal`}),(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.confidence==null?null:(0,Q.jsxs)(`span`,{children:[Math.round(e.confidence*100),`%`]})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),e.evidence?.[0]?.sourceText?(0,Q.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.evidence[0].sourceText}):null,(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Y,{type:`button`,variant:`primary`,onClick:()=>pe(e.id,`active`),children:n.approve}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,onClick:()=>pe(e.id,`rejected`),children:n.reject}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,onClick:()=>pe(e.id,`needs_review`),children:n.needsReview})]})]},e.id)),!O&&U===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noInbox}):null]})]}),(0,Q.jsxs)(`form`,{className:`flex gap-2`,onSubmit:e=>{e.preventDefault(),u(r.trim())},children:[(0,Q.jsx)(`input`,{className:`min-h-10 flex-1 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent`,value:r,onChange:e=>i(e.target.value),placeholder:n.searchPlaceholder}),(0,Q.jsx)(Y,{className:`min-h-10 rounded-md px-4`,type:`submit`,variant:`primary`,children:n.search})]}),(0,Q.jsxs)(`section`,{className:`grid gap-4 lg:grid-cols-[minmax(0,1fr)_20rem]`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:o?`${n.searchResults}${V?`…`:``}`:n.recentRecords}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[V||T&&!o?Array.from({length:5}).map((e,t)=>(0,Q.jsx)(qt,{},t)):re.map(e=>{let t=oe.get(e.id),r=Wt(t);return(0,Q.jsxs)(`article`,{className:`px-4 py-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:e.kind}),e.status?(0,Q.jsx)(`span`,{children:e.status}):null,e.sensitivity?(0,Q.jsx)(`span`,{children:e.sensitivity}):null,(0,Q.jsx)(`span`,{children:e.source.provider??`local`}),e.source.path?(0,Q.jsx)(`span`,{children:e.source.path}):null,(0,Q.jsx)(`span`,{className:`rounded-full border px-2 py-0.5 ${Gt(t)}`,children:r==null?n.noRecallFeedback:`${n.recallQuality} ${r}% · ${t?.total??0}`})]}),(0,Q.jsx)(`p`,{className:`mt-2 whitespace-pre-wrap text-sm leading-6 text-fg`,children:e.content}),t?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap gap-2 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`span`,{children:[n.helpful,`: `,t.helpful]}),(0,Q.jsxs)(`span`,{children:[n.notHelpful,`: `,t.notHelpful]}),t.mixed?(0,Q.jsxs)(`span`,{children:[n.mixed,`: `,t.mixed]}):null,t.irrelevant?(0,Q.jsxs)(`span`,{children:[n.irrelevant,`: `,t.irrelevant]}):null]}):null]},e.id)}),!T&&!V&&re.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecords}):null]})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.providers}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:C?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(qt,{},t)):(S?.providers??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3`,children:[(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:e.displayName}),(0,Q.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[e.id,` · `,e.available?n.available:n.unavailable]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center gap-2`,children:[(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,onClick:()=>fe(e.id),children:n.test}),m[e.id]?(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:m[e.id]}):null]})]},e.id))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.recallQuality}),(0,Q.jsxs)(`div`,{className:`divide-y divide-edge`,children:[I?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(qt,{},t)):K.slice(0,8).map(e=>{let t=(w?.records??[]).find(t=>t.id===e.recordId),r=Wt(e);return(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`div`,{className:`min-w-0 font-medium text-fg`,children:t?.kind??n.record}),(0,Q.jsxs)(`span`,{className:`shrink-0 rounded-full border px-2 py-0.5 ${Gt(e)}`,children:[r??0,`%`]})]}),(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-fg-muted`,children:t?.content??e.recordId}),(0,Q.jsxs)(`div`,{className:`mt-2`,children:[e.helpful,` `,n.helpful,` · `,e.notHelpful,` `,n.notHelpful,` · `,e.total,` `,n.feedback]})]},e.recordId)}),!I&&K.length===0?(0,Q.jsx)(`div`,{className:`px-4 py-8 text-sm text-fg-muted`,children:n.noRecallFeedback}):null]})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.signals}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:j?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(qt,{},t)):(A?.signals??[]).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsx)(`div`,{className:`font-medium text-fg`,children:e.source}),(0,Q.jsxs)(`div`,{children:[e.providerId??`local`,` · `,new Date(e.createdAt).toLocaleString()]})]},e.signalId))})]}),(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-panel shadow-surface`,children:[(0,Q.jsx)(`div`,{className:`border-b border-edge px-4 py-3 text-sm font-semibold text-fg`,children:n.trace}),(0,Q.jsx)(`div`,{className:`divide-y divide-edge`,children:N?Array.from({length:3}).map((e,t)=>(0,Q.jsx)(qt,{},t)):(M?.traces??[]).slice(0,20).map(e=>(0,Q.jsxs)(`div`,{className:`px-4 py-3 text-xs text-fg-muted`,children:[(0,Q.jsxs)(`div`,{className:`font-medium text-fg`,children:[e.phase,` · `,e.providerId]}),(0,Q.jsxs)(`div`,{children:[e.resultCount??0,` `,(e.resultCount??0)===1?n.result:n.results,` · `,e.durationMs,` ms`]}),e.skippedReason?(0,Q.jsxs)(`div`,{children:[n.skipped,`: `,e.skippedReason]}):null,e.error?(0,Q.jsx)(`div`,{className:`text-danger`,children:e.error}):null]},e.traceId))})]})]})]})]})}function Yt(e){let t=(0,Z.c)(28),{label:n,mode:r,value:a,inheritedFrom:o,inheritLabel:s,overrideLabel:c,onClick:l}=e,u;t[0]===n?u=t[1]:(u=(0,Q.jsx)(`p`,{className:`text-xs font-medium uppercase tracking-wide text-fg-subtle`,children:n}),t[0]=n,t[1]=u);let d=a||`—`,f;t[2]===d?f=t[3]:(f=(0,Q.jsx)(`p`,{className:`mt-1 truncate text-sm font-medium text-fg`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==o||t[5]!==r?(p=r===`inherit`&&o?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:o}):null,t[4]=o,t[5]=r,t[6]=p):p=t[6];let m;t[7]!==u||t[8]!==f||t[9]!==p?(m=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[u,f,p]}),t[7]=u,t[8]=f,t[9]=p,t[10]=m):m=t[10];let h=r===`inherit`?`bg-surface-hover text-fg-muted`:`bg-accent-soft text-accent-fg`,g;t[11]===h?g=t[12]:(g=i(`mt-2 inline-flex shrink-0 self-start rounded-full px-2.5 py-0.5 text-xs font-medium sm:mt-0`,h),t[11]=h,t[12]=g);let _=r===`inherit`?s:c,v;t[13]!==g||t[14]!==_?(v=(0,Q.jsx)(`span`,{className:g,children:_}),t[13]=g,t[14]=_,t[15]=v):v=t[15];let y;t[16]!==m||t[17]!==v?(y=(0,Q.jsxs)(Q.Fragment,{children:[m,v]}),t[16]=m,t[17]=v,t[18]=y):y=t[18];let b=y,x=l?`w-full text-left transition-colors hover:bg-surface-hover/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 active:scale-[0.995] motion-reduce:active:scale-100`:void 0,S;t[19]===x?S=t[20]:(S=i(`flex flex-col gap-1 rounded-xl bg-surface-panel/80 px-4 py-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,x),t[19]=x,t[20]=S);let C=S;if(l){let e;return t[21]!==C||t[22]!==b||t[23]!==l?(e=(0,Q.jsx)(`button`,{type:`button`,className:C,onClick:l,children:b}),t[21]=C,t[22]=b,t[23]=l,t[24]=e):e=t[24],e}let w;return t[25]!==C||t[26]!==b?(w=(0,Q.jsx)(`div`,{className:C,children:b}),t[25]=C,t[26]=b,t[27]=w):w=t[27],w}function Xt(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:Ie,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)(Yt,{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)(Yt,{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 Zt(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Qt(e){let t=(0,Z.c)(5),{source:n}=e,r;if(t[0]!==n){let e=n.startsWith(`preset:`),a=n.startsWith(`agent:`);r=i(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e&&`bg-accent/10 text-accent`,a&&`bg-surface-base text-fg-muted`,!e&&!a&&`bg-surface-panel text-fg-subtle`),t[0]=n,t[1]=r}else r=t[1];let a;return t[2]!==n||t[3]!==r?(a=(0,Q.jsx)(`span`,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=a):a=t[4],a}function $t(e){let t=(0,Z.c)(13),n;t[0]===e.name?n=t[1]:(n=(0,Q.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs font-medium text-fg`,children:e.name}),t[0]=e.name,t[1]=n);let r=e.monoValue&&`font-mono text-xs`,a;t[2]===r?a=t[3]:(a=i(`min-w-0 truncate text-sm text-fg`,r),t[2]=r,t[3]=a);let o;t[4]!==e.value||t[5]!==a?(o=(0,Q.jsx)(`div`,{className:a,children:e.value}),t[4]=e.value,t[5]=a,t[6]=o):o=t[6];let s;t[7]===e.source?s=t[8]:(s=(0,Q.jsx)(Qt,{source:e.source}),t[7]=e.source,t[8]=s);let c;return t[9]!==n||t[10]!==o||t[11]!==s?(c=(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:grid-cols-[minmax(0,10rem)_minmax(0,1fr)_auto] sm:items-center`,children:[n,o,s]}),t[9]=n,t[10]=o,t[11]=s,t[12]=c):c=t[12],c}function en(e,t){return e&&e.length>0?e.join(`, `):t}function tn(e){let t=(0,Z.c)(30),{a:n,selected:r}=e,i;t[0]===r.id?i=t[1]:(i=r.id?[`agent-effective-manifest`,r.id]:null,t[0]=r.id,t[1]=i);let a;t[2]===r.id?a=t[3]:(a=()=>De(r.id),t[2]=r.id,t[3]=a);let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o={revalidateOnFocus:!1},t[4]=o):o=t[4];let{data:s,error:c,isLoading:l}=d(i,a,o),u=s?.manifest,f;t[5]!==s?.presetChain||t[6]!==u?.extends?(f=s?.presetChain??u?.extends??[],t[5]=s?.presetChain,t[6]=u?.extends,t[7]=f):f=t[7];let p=f,m;if(t[8]!==n.effectiveBoundariesTitle||t[9]!==n.effectiveEmpty||t[10]!==n.effectiveError||t[11]!==n.effectiveHint||t[12]!==n.effectiveLoading||t[13]!==n.effectiveMemoryTitle||t[14]!==n.effectiveModelsTitle||t[15]!==n.effectiveNoPresets||t[16]!==n.effectiveNoToolPolicies||t[17]!==n.effectivePresetChain||t[18]!==n.effectiveSkillsTitle||t[19]!==n.effectiveTitle||t[20]!==n.effectiveToolsTitle||t[21]!==s?.sources||t[22]!==c||t[23]!==l||t[24]!==u||t[25]!==p){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(rn),i=Object.entries(u?.tools?.builtin??{}).sort(nn),a=u?.skills,o=u?.memory,d=u?.boundaries,f;t[27]!==n.effectiveHint||t[28]!==n.effectiveTitle?(f=(0,Q.jsx)(_t,{icon:$e,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[27]=n.effectiveHint,t[28]=n.effectiveTitle,t[29]=f):f=t[29],m=(0,Q.jsxs)(vt,{children:[f,l?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveLoading}):c?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c instanceof Error?c.message:n.effectiveError}):u?(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectivePresetChain}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 text-sm text-fg shadow-surface`,children:p.length?p.join(` -> `):n.effectiveNoPresets})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveModelsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)($t,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Zt(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)($t,{name:n,value:r.model,monoValue:!0,source:Zt(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)($t,{name:n,value:r.mode,source:Zt(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)($t,{name:`mode`,value:a?.mode??`all`,source:Zt(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)($t,{name:`allow`,value:en(a.allow,`—`),source:Zt(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)($t,{name:`deny`,value:en(a.deny,`—`),source:Zt(e,[`skills.deny`,`skills`])}):null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveMemoryTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)($t,{name:`mode`,value:o?.mode??`off`,source:Zt(e,[`memory.mode`,`memory`])}),(0,Q.jsx)($t,{name:`sources`,value:en(o?.sources,`—`),source:Zt(e,[`memory.sources`,`memory`])})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveBoundariesTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)($t,{name:`requiresConfirmation`,value:en(d?.requiresConfirmation,`—`),source:Zt(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)($t,{name:`forbidden`,value:en(d?.forbidden,`—`),source:Zt(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)($t,{name:`escalation`,value:en(d?.escalation,`—`),source:Zt(e,[`boundaries.escalation`,`boundaries`])})]})]})]})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveEmpty})]}),t[8]=n.effectiveBoundariesTitle,t[9]=n.effectiveEmpty,t[10]=n.effectiveError,t[11]=n.effectiveHint,t[12]=n.effectiveLoading,t[13]=n.effectiveMemoryTitle,t[14]=n.effectiveModelsTitle,t[15]=n.effectiveNoPresets,t[16]=n.effectiveNoToolPolicies,t[17]=n.effectivePresetChain,t[18]=n.effectiveSkillsTitle,t[19]=n.effectiveTitle,t[20]=n.effectiveToolsTitle,t[21]=s?.sources,t[22]=c,t[23]=l,t[24]=u,t[25]=p,t[26]=m}else m=t[26];return m}function nn(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function rn(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function an(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 on(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 sn(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)(on,{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)(on,{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)(on,{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)(cn,{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)(ln,{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)(fn,{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 cn(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)(an,{children:(0,Q.jsx)(Xt,{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 ln(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(dn)),t[0]=a,t[1]=u);let d=u,f;t[2]!==n.capabilityPresetsGlobalDefault||t[3]!==n.capabilityPresetsGlobalDefaultHint||t[4]!==l||t[5]!==d?(f=d.get(l)??{id:l,name:n.capabilityPresetsGlobalDefault,description:n.capabilityPresetsGlobalDefaultHint},t[2]=n.capabilityPresetsGlobalDefault,t[3]=n.capabilityPresetsGlobalDefaultHint,t[4]=l,t[5]=d,t[6]=f):f=t[6];let p=f,m,h,g,_,v;if(t[7]!==n.capabilityPresetAdd||t[8]!==n.capabilityPresetMoveDown||t[9]!==n.capabilityPresetMoveUp||t[10]!==n.capabilityPresetRemove||t[11]!==n.capabilityPresetsEmptyAdditional||t[12]!==n.capabilityPresetsGlobalDefault||t[13]!==n.capabilityPresetsGlobalDefaultHint||t[14]!==n.capabilityPresetsHint||t[15]!==n.capabilityPresetsManage||t[16]!==n.capabilityPresetsTitle||t[17]!==i||t[18]!==a||t[19]!==l||t[20]!==p.description||t[21]!==p.id||t[22]!==p.name||t[23]!==c||t[24]!==s||t[25]!==d||t[26]!==r.extends){let e;t[32]===l?e=t[33]:(e=e=>e!==l,t[32]=l,t[33]=e);let o=r.extends.filter(e),u=a.map(un).filter(e=>e!==l&&!o.includes(e)),f=u[0]??``;h=an,m=vt;let y;t[34]===c?y=t[35]:(y=()=>c(``),t[34]=c,t[35]=y);let b;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),t[36]=b):b=t[36];let x;t[37]!==n.capabilityPresetsManage||t[38]!==i||t[39]!==y?(x=(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:i,onClick:y,children:[b,n.capabilityPresetsManage]}),t[37]=n.capabilityPresetsManage,t[38]=i,t[39]=y,t[40]=x):x=t[40],t[41]!==n.capabilityPresetsHint||t[42]!==n.capabilityPresetsTitle||t[43]!==x?(g=(0,Q.jsx)(_t,{icon:Ye,title:n.capabilityPresetsTitle,subtitle:n.capabilityPresetsHint,trailing:x}),t[41]=n.capabilityPresetsHint,t[42]=n.capabilityPresetsTitle,t[43]=x,t[44]=g):g=t[44];let C;t[45]!==p.id||t[46]!==c?(C=()=>c(p.id),t[45]=p.id,t[46]=c,t[47]=C):C=t[47];let w=p.name||n.capabilityPresetsGlobalDefault,T;t[48]===w?T=t[49]:(T=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:w}),t[48]=w,t[49]=T);let E;t[50]===n.capabilityPresetsGlobalDefault?E=t[51]:(E=(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]=E);let D;t[52]!==T||t[53]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[T,E]}),t[52]=T,t[53]=E,t[54]=D):D=t[54];let O;t[55]===p.id?O=t[56]:(O=(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:p.id}),t[55]=p.id,t[56]=O);let k=p.description||n.capabilityPresetsGlobalDefaultHint,A;t[57]===k?A=t[58]:(A=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:k}),t[57]=k,t[58]=A);let j;t[59]!==C||t[60]!==D||t[61]!==O||t[62]!==A?(j=(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:C,children:[D,O,A]})}),t[59]=C,t[60]=D,t[61]=O,t[62]=A,t[63]=j):j=t[63],_=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[j,o.length>0?o.map((e,t)=>{let r=d.get(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r?.name??e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:e}),r?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:r.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(Y,{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)(lt,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(Y,{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)(V,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(Y,{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)(se,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 px-3 py-3 text-sm text-fg-muted shadow-surface`,children:n.capabilityPresetsEmptyAdditional})]}),v=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)(Ee,{className:`min-w-0 flex-1 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:border-edge-strong focus:outline-none`,disabled:i,defaultValue:f,children:u.map(e=>(0,Q.jsx)(Be,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:i||!f,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||f;t&&s([...o,t])},children:[(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0}),n.capabilityPresetAdd]})]}):null,t[7]=n.capabilityPresetAdd,t[8]=n.capabilityPresetMoveDown,t[9]=n.capabilityPresetMoveUp,t[10]=n.capabilityPresetRemove,t[11]=n.capabilityPresetsEmptyAdditional,t[12]=n.capabilityPresetsGlobalDefault,t[13]=n.capabilityPresetsGlobalDefaultHint,t[14]=n.capabilityPresetsHint,t[15]=n.capabilityPresetsManage,t[16]=n.capabilityPresetsTitle,t[17]=i,t[18]=a,t[19]=l,t[20]=p.description,t[21]=p.id,t[22]=p.name,t[23]=c,t[24]=s,t[25]=d,t[26]=r.extends,t[27]=m,t[28]=h,t[29]=g,t[30]=_,t[31]=v}else m=t[27],h=t[28],g=t[29],_=t[30],v=t[31];let y;t[64]!==m||t[65]!==g||t[66]!==_||t[67]!==v?(y=(0,Q.jsxs)(m,{children:[g,_,v]}),t[64]=m,t[65]=g,t[66]=_,t[67]=v,t[68]=y):y=t[68];let b;return t[69]!==h||t[70]!==y?(b=(0,Q.jsx)(h,{children:y}),t[69]=h,t[70]=y,t[71]=b):b=t[71],b}function un(e){return e.id}function dn(e){return[e.id,e]}function fn(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(an,{children:(0,Q.jsx)(tn,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function pn(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)(an,{children:r.id===`main`?(0,Q.jsx)(vt,{children:(0,Q.jsx)(_t,{icon:U,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:U,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)(Y,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(se,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-100 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/50`,disabled:i,onClick:()=>void a(!0),children:n.purgeDisk})]})]})]})}),t[0]=n.dangerZoneBody,t[1]=n.dangerZoneHint,t[2]=n.dangerZoneMainUnavailable,t[3]=n.dangerZoneTitle,t[4]=n.purgeDisk,t[5]=n.removeFromConfig,t[6]=i,t[7]=a,t[8]=r.id,t[9]=o):o=t[9],o}var mn=i(x,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function hn(e){let t=(0,Z.c)(59),{a:n,busy:r,bindingsLoading:a,agentBindings:o,onRemoveBinding:s,onAddBinding:c,channelStatuses:l,channelsStatusLoading:u,useManualChannel:d,newBindChannel:f,setNewBindChannel:p,bindSessionChats:m,sessionsLoading:h,newBindSessionIdx:g,setNewBindSessionIdx:_,newBindCustomPeer:v,setNewBindCustomPeer:y,onRefreshSessions:b,lastActiveLabels:x,selectRecipient:S}=e,C=!u&&(d||l.length>0),w;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(w=(0,Q.jsx)(_t,{className:`shrink-0`,icon:Ie,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=w):w=t[2];let T;t[3]!==n.channelsNone||t[4]!==n.removeBinding||t[5]!==o||t[6]!==a||t[7]!==r||t[8]!==s?(T=a?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map(gn)}):o.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:o.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:Tt(e.match)}),(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void s(e),children:n.removeBinding})]},`${e.match.channel}-${Tt(e.match)}`))}),t[3]=n.channelsNone,t[4]=n.removeBinding,t[5]=o,t[6]=a,t[7]=r,t[8]=s,t[9]=T):T=t[9];let E;t[10]!==n.channelLabel||t[11]!==n.channelsDisabledSuffix||t[12]!==n.channelsManualChannelHint||t[13]!==l||t[14]!==u||t[15]!==f||t[16]!==p||t[17]!==y||t[18]!==_||t[19]!==d?(E=u?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(q,{className:`h-4 w-24`}),(0,Q.jsx)(q,{className:`h-10 w-full rounded-lg`})]}):d?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(`input`,{className:Et(),value:f,onChange:e=>p(e.target.value),placeholder:`telegram`,autoComplete:`off`}),(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsManualChannelHint})]}):(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelLabel}),(0,Q.jsx)(Ee,{className:i(Et(),`py-2`),value:f,onChange:e=>{p(e.target.value),_(null),y(``)},children:l.map(e=>(0,Q.jsxs)(Be,{value:e.name,disabled:!e.enabled,children:[e.name,` `,e.enabled?``:n.channelsDisabledSuffix]},e.name))})]}),t[10]=n.channelLabel,t[11]=n.channelsDisabledSuffix,t[12]=n.channelsManualChannelHint,t[13]=l,t[14]=u,t[15]=f,t[16]=p,t[17]=y,t[18]=_,t[19]=d,t[20]=E):E=t[20];let D;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]!==m||t[31]!==r||t[32]!==x||t[33]!==f||t[34]!==v||t[35]!==g||t[36]!==b||t[37]!==S||t[38]!==h||t[39]!==y||t[40]!==_||t[41]!==C?(D=C&&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)(Y,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||h||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>b(),children:[(0,Q.jsx)(he,{className:i(`size-3.5`,h&&`animate-spin`),strokeWidth:1.75}),n.channelsRefreshSessions]})]}),h&&m.length===0?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(q,{className:`h-4 w-32`}),(0,Q.jsx)(q,{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)(Ee,{className:i(Et(),`py-2`),value:g==null?``:String(g),disabled:r||!f.trim()||!!v.trim(),onChange:e=>{let t=e.target.value;_(t===``?null:Number(t))},children:[(0,Q.jsx)(Be,{value:``,children:n.channelsPeerAny}),m.map((e,t)=>(0,Q.jsx)(Be,{value:String(t),children:Ct(e,x)},`${e.channel}-${e.chatId}`))]})]}),m.length===0&&f.trim()&&!h?(0,Q.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.channelsNoSessionsHint}):null,(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.peerIdLabel}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-stretch sm:gap-2`,children:[(0,Q.jsx)(`input`,{type:`text`,className:i(Et(),`min-w-0 w-full sm:flex-1`),value:v,onChange:e=>{y(e.target.value),e.target.value.trim()&&_(null)},placeholder:n.channelsCustomPeerPlaceholder,autoComplete:`off`}),(0,Q.jsxs)(Ee,{className:mn,value:v,onChange:e=>{let t=e.target.value;y(t||``),_(null)},children:[(0,Q.jsx)(Be,{value:``,children:S}),m.map(e=>(0,Q.jsx)(Be,{value:e.chatId,children:Ct(e,x)},`${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]=m,t[31]=r,t[32]=x,t[33]=f,t[34]=v,t[35]=g,t[36]=b,t[37]=S,t[38]=h,t[39]=y,t[40]=_,t[41]=C,t[42]=D):D=t[42];let O;t[43]!==r||t[44]!==u||t[45]!==f?(O=r||!f.trim()||u,t[43]=r,t[44]=u,t[45]=f,t[46]=O):O=t[46];let k;t[47]!==n.addBinding||t[48]!==O?(k=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(Y,{type:`submit`,disabled:O,children:n.addBinding})}),t[47]=n.addBinding,t[48]=O,t[49]=k):k=t[49];let A;t[50]!==c||t[51]!==E||t[52]!==D||t[53]!==k?(A=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:c,children:[E,D,k]}),t[50]=c,t[51]=E,t[52]=D,t[53]=k,t[54]=A):A=t[54];let j;return t[55]!==w||t[56]!==T||t[57]!==A?(j=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[w,T,A]}),t[55]=w,t[56]=T,t[57]=A,t[58]=j):j=t[58],j}function gn(e,t){return(0,Q.jsx)(q,{className:`h-10 rounded-lg`},t)}function _n(e){let t=(0,Z.c)(32),{a:n,filesLoading:r,files:a,activeFile:o,setActiveFile:s,filesViewMode:c,setFilesViewMode:l,fileDraft:d,setFileDraft:f,fileSaving:p,profileFileLoading:m,profileEditorNonce:h,onTryInChat:g}=e,_=u(vn),v;t[0]!==n.missing||t[1]!==a?.files?(v=a?.files.map(e=>({id:e.name,label:e.missing?`${e.name} (${n.missing})`:e.name,title:e.name}))??[],t[0]=n.missing,t[1]=a?.files,t[2]=v):v=t[2];let b=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.filesLoading||t[8]!==n.filesMarkdownEdit||t[9]!==n.filesMarkdownPreview||t[10]!==n.filesNavAria||t[11]!==n.filesSavingStatus||t[12]!==n.pickFile||t[13]!==n.tryInChat||t[14]!==o||t[15]!==d||t[16]!==p||t[17]!==b||t[18]!==a||t[19]!==r||t[20]!==c||t[21]!==_||t[22]!==g||t[23]!==h||t[24]!==m||t[25]!==s||t[26]!==f||t[27]!==l?(S=r?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesLoading}):a?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(yt,{items:b,activeTab:o??``,onChange:s,ariaLabel:n.filesNavAria,tabIdPrefix:`agent-files-tab`,panelIdPrefix:`agent-files-panel`,className:`shrink-0 flex-wrap`,buttonClassName:`font-mono text-xs whitespace-nowrap`}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:o?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,y.press,c===`edit`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`edit`),children:[(0,Q.jsx)(nt,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownEdit]}),(0,Q.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,y.press,c===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`preview`),children:[(0,Q.jsx)(N,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[p?(0,Q.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Q.jsx)(`span`,{children:n.filesAutoSaveHint}),g?(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(w,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),c===`edit`?(0,Q.jsx)(`div`,{className:i(Et(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ft,{initialContent:d,onChange:f,isDark:_,className:`min-h-0 flex-1`},`${o??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:i(Et(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(rt,{content:d,className:`text-sm`})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[5]=n.filesAutoSaveHint,t[6]=n.filesEmpty,t[7]=n.filesLoading,t[8]=n.filesMarkdownEdit,t[9]=n.filesMarkdownPreview,t[10]=n.filesNavAria,t[11]=n.filesSavingStatus,t[12]=n.pickFile,t[13]=n.tryInChat,t[14]=o,t[15]=d,t[16]=p,t[17]=b,t[18]=a,t[19]=r,t[20]=c,t[21]=_,t[22]=g,t[23]=h,t[24]=m,t[25]=s,t[26]=f,t[27]=l,t[28]=S):S=t[28];let C;return t[29]!==x||t[30]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[x,S]}),t[29]=x,t[30]=S,t[31]=C):C=t[31],C}function vn(e){return e.resolved===`dark`}function yn(e){let t=(0,Z.c)(68),{a:n,chat:r,selected:i,busy:a,modelRows:o,setModelRows:s,onSaveModels:c,onClearModelsEntry:l,hideInlineSave:u}=e,d;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(d=(0,Q.jsx)(_t,{className:`shrink-0`,icon:Xe,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=d):d=t[2];let f;t[3]===n.modelsPresetLabel?f=t[4]:(f=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[3]=n.modelsPresetLabel,t[4]=f);let p;t[5]===i.typedModels.preset?p=t[6]:(p=kt(i.typedModels.preset),t[5]=i.typedModels.preset,t[6]=p);let m;t[7]!==f||t[8]!==p?(m=(0,Q.jsxs)(`div`,{children:[f,` `,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===n.modelsEffectiveLabel?h=t[11]:(h=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=h);let g;t[12]===i.typedModels.effective?g=t[13]:(g=kt(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=g);let _;t[14]!==h||t[15]!==g?(_=(0,Q.jsxs)(`div`,{children:[h,` `,g]}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;t[17]!==m||t[18]!==_?(v=(0,Q.jsxs)(`div`,{className:`mb-4 grid gap-2 rounded-lg bg-surface-panel/60 p-3 text-xs text-fg-muted shadow-surface`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19];let y;t[20]!==n.addTypedModel||t[21]!==n.addTypedModelPurpose||t[22]!==n.removeTypedModel||t[23]!==n.typedModelAddFallback||t[24]!==n.typedModelCustomTitle||t[25]!==n.typedModelDefaultBadge||t[26]!==n.typedModelDescriptionLabel||t[27]!==n.typedModelDescriptionPlaceholder||t[28]!==n.typedModelFallbackEmptyHint||t[29]!==n.typedModelFallbackModelsLabel||t[30]!==n.typedModelFallbackPlaceholder||t[31]!==n.typedModelIdLabel||t[32]!==n.typedModelIdPlaceholder||t[33]!==n.typedModelNoCustomRoles||t[34]!==n.typedModelPrimaryModelLabel||t[35]!==n.typedModelRecommendedTitle||t[36]!==n.typedModelRemoveFallback||t[37]!==n.typedModelRoleDescriptions||t[38]!==n.typedModelRoleNames||t[39]!==n.typedModelVisionAutoHint||t[40]!==n.typedModelVisionBadge?(y={id:n.typedModelIdLabel,description:n.typedModelDescriptionLabel,primaryModel:n.typedModelPrimaryModelLabel,fallbackModels:n.typedModelFallbackModelsLabel,addFallback:n.typedModelAddFallback,removeFallback:n.typedModelRemoveFallback,fallbackPlaceholder:n.typedModelFallbackPlaceholder,fallbackEmptyHint:n.typedModelFallbackEmptyHint,add:n.addTypedModel,remove:n.removeTypedModel,recommendedTitle:n.typedModelRecommendedTitle,customTitle:n.typedModelCustomTitle,defaultBadge:n.typedModelDefaultBadge,visionBadge:n.typedModelVisionBadge,visionAutoHint:n.typedModelVisionAutoHint,addPurpose:n.addTypedModelPurpose,noCustomRoles:n.typedModelNoCustomRoles,idPlaceholder:n.typedModelIdPlaceholder,descriptionPlaceholder:n.typedModelDescriptionPlaceholder,roleNames:n.typedModelRoleNames,roleDescriptions:n.typedModelRoleDescriptions},t[20]=n.addTypedModel,t[21]=n.addTypedModelPurpose,t[22]=n.removeTypedModel,t[23]=n.typedModelAddFallback,t[24]=n.typedModelCustomTitle,t[25]=n.typedModelDefaultBadge,t[26]=n.typedModelDescriptionLabel,t[27]=n.typedModelDescriptionPlaceholder,t[28]=n.typedModelFallbackEmptyHint,t[29]=n.typedModelFallbackModelsLabel,t[30]=n.typedModelFallbackPlaceholder,t[31]=n.typedModelIdLabel,t[32]=n.typedModelIdPlaceholder,t[33]=n.typedModelNoCustomRoles,t[34]=n.typedModelPrimaryModelLabel,t[35]=n.typedModelRecommendedTitle,t[36]=n.typedModelRemoveFallback,t[37]=n.typedModelRoleDescriptions,t[38]=n.typedModelRoleNames,t[39]=n.typedModelVisionAutoHint,t[40]=n.typedModelVisionBadge,t[41]=y):y=t[41];let b;t[42]!==a||t[43]!==r||t[44]!==o||t[45]!==i.typedModels.defaultRole||t[46]!==s||t[47]!==y?(b=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Ft,{rows:o,onChange:s,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:y})}),t[42]=a,t[43]=r,t[44]=o,t[45]=i.typedModels.defaultRole,t[46]=s,t[47]=y,t[48]=b):b=t[48];let x;t[49]!==n.modelsSave||t[50]!==a||t[51]!==u||t[52]!==c?(x=u?null:(0,Q.jsx)(Y,{type:`button`,disabled:a,onClick:()=>void c(),children:n.modelsSave}),t[49]=n.modelsSave,t[50]=a,t[51]=u,t[52]=c,t[53]=x):x=t[53];let S;t[54]===l?S=t[55]:(S=()=>void l(),t[54]=l,t[55]=S);let C;t[56]!==n.modelsResetInherit||t[57]!==a||t[58]!==S?(C=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:a,onClick:S,children:n.modelsResetInherit}),t[56]=n.modelsResetInherit,t[57]=a,t[58]=S,t[59]=C):C=t[59];let w;t[60]!==x||t[61]!==C?(w=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[x,C]}),t[60]=x,t[61]=C,t[62]=w):w=t[62];let T;return t[63]!==d||t[64]!==w||t[65]!==v||t[66]!==b?(T=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[d,v,b,w]}),t[63]=d,t[64]=w,t[65]=v,t[66]=b,t[67]=T):T=t[67],T}function bn(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 xn(e){let{agentId:t,value:n,onChange:r,a,id:o}=e,s=(0,$.useRef)(null),[c,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=(0,$.useMemo)(()=>{let e=H(n.trim());return e&&E(e.styleId)?e.styleId:ut[0]??`adventurer`},[n]),_=(0,$.useCallback)(async(e,n)=>{try{await Ce(t)}catch{}r(K(e,n)),p(!1)},[t,r]),v=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){d(null),l(!0);try{await Pe(t,n),oe(t),r(h)}catch(e){let t=e instanceof Error?e.message:``;d(t===`avatar_too_large`?a.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?a.avatarInvalidImage:a.avatarUploadFailed)}finally{l(!1)}}},[a,t,r]),b=(e,t)=>{let r=H(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...o?{id:o}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:a.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:s,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void v(e)}),(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:c,onClick:()=>s.current?.click(),children:[(0,Q.jsx)(g,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),c?a.avatarUploading:a.avatarUploadCustom]})]})]}),u?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,children:u}):null,(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ut.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void _(e,z[0]??t),className:i(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,y.press,m===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:bn(e,a)},e))}),(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[z.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void _(m,e),className:i(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,y.press,b(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(He,{open:f,onOpenChange:p,children:[(0,Q.jsx)(Ne,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:i(`flex size-12 shrink-0 items-center justify-center rounded-xl border border-edge-subtle bg-surface-base text-xs font-medium text-fg-muted hover:border-edge hover:text-fg`,y.press),children:a.avatarMore})}),(0,Q.jsx)(J,{children:(0,Q.jsxs)(be,{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:bn(m,a)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:j.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void _(m,e),className:i(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,y.press,b(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:bt(m,e,88),alt:``,width:40,height:40,className:`size-10 rounded-full object-cover`,draggable:!1})},e))})]})})]})]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.personaAvatar}),(0,Q.jsx)(D,{agentId:t,avatar:n,size:40}),n.trim()&&!H(n.trim())&&n.trim()!==`xopc:custom`?(0,Q.jsx)(`span`,{className:`truncate font-mono text-[10px] text-fg-muted`,title:n,children:n}):null]})]})]})}function Sn(e){let t=(0,Z.c)(206),{a:n,chat:r,selected:a,busy:o,editName:s,setEditName:c,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:h,editModel:g,setEditModel:v,onSetDefault:b,onSetTuiDefault:x,isTuiDefault:S,isTuiDefaultInherited:T,onSaveAgentEdits:E,hideInlineSave:A,profileMarkdownLoading:j,profileDraft:P,updateIdentity:L,handleSoulTemplateChange:ee,handleSoulContentChange:te,setAvatarDialogOpen:R,toggleSoulPreviewMode:z,onTryInChat:ne}=e,V=l(Tn),H=u(wn),U;t[0]===P?.identity?U=t[1]:(U=P?.identity??{name:``,description:``,language:``,creature:``,emoji:``,avatar:``},t[0]=P?.identity,t[1]=U);let W=U,K=P?.soulTemplate??`professional`,oe=P?.soulCustomContent??``,se=P?.soulEditorNonce??0,ce=P?.soulPreviewMode??!1,le=P?.avatarDialogOpen??!1,de;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(de=Et(),t[2]=de):de=t[2];let fe=de,pe;t[3]===V?pe=t[4]:(pe=(e,t)=>V===`zh`?t:e,t[3]=V,t[4]=pe);let me=pe;if(!a){let e;return t[5]===n.selectAgentHint?e=t[6]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[5]=n.selectAgentHint,t[6]=e),e}let q;t[7]!==W.avatar||t[8]!==a.id?(q=(0,Q.jsx)(D,{agentId:a.id,avatar:W.avatar,size:36,className:`size-9 rounded-lg`}),t[7]=W.avatar,t[8]=a.id,t[9]=q):q=t[9];let he;t[10]===R?he=t[11]:(he=()=>R(!0),t[10]=R,t[11]=he);let _e;t[12]!==n.avatarOpenSettingsAria||t[13]!==he?(_e={onClick:he,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[12]=n.avatarOpenSettingsAria,t[13]=he,t[14]=_e):_e=t[14];let ve;t[15]!==n.globalDefaultBadge||t[16]!==n.tuiDefaultBadge||t[17]!==n.tuiDefaultInheritedBadge||t[18]!==S||t[19]!==T||t[20]!==a.isDefault?(ve=a.isDefault||S?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[a.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,S?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:T?n.tuiDefaultInheritedBadge:n.tuiDefaultBadge}):null]}):null,t[15]=n.globalDefaultBadge,t[16]=n.tuiDefaultBadge,t[17]=n.tuiDefaultInheritedBadge,t[18]=S,t[19]=T,t[20]=a.isDefault,t[21]=ve):ve=t[21];let ye;t[22]!==n.setDefault||t[23]!==n.setTuiDefault||t[24]!==o||t[25]!==S||t[26]!==b||t[27]!==x||t[28]!==a.isDefault?(ye=!a.isDefault||!S?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[a.isDefault?null:(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:()=>void b(),children:n.setDefault}),S?null:(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`text-xs`,disabled:o,onClick:()=>void x(),children:n.setTuiDefault})]}):null,t[22]=n.setDefault,t[23]=n.setTuiDefault,t[24]=o,t[25]=S,t[26]=b,t[27]=x,t[28]=a.isDefault,t[29]=ye):ye=t[29];let be;t[30]!==n.personaSectionIdentity||t[31]!==n.personaSectionIdentityHint||t[32]!==q||t[33]!==_e||t[34]!==ve||t[35]!==ye?(be=(0,Q.jsx)(_t,{icon:Ye,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:q,iconInteractive:_e,titleAccessory:ve,trailing:ye}),t[30]=n.personaSectionIdentity,t[31]=n.personaSectionIdentityHint,t[32]=q,t[33]=_e,t[34]=ve,t[35]=ye,t[36]=be):be=t[36];let xe;t[37]===Symbol.for(`react.memo_cache_sentinel`)?(xe=(0,Q.jsx)(k,{className:i(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,je)}),t[37]=xe):xe=t[37];let Se;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(Se=i(`fixed left-1/2 top-1/2 w-[min(calc(100vw-2rem),26rem)] max-h-[min(90dvh,36rem)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,ge),t[38]=Se):Se=t[38];let Ce;t[39]===n.avatarPickerTitle?Ce=t[40]:(Ce=(0,Q.jsx)(ue,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[39]=n.avatarPickerTitle,t[40]=Ce);let J;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(J=i(re,`shrink-0 p-1.5 hover:bg-surface-base`),t[41]=J):J=t[41];let we;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(we=(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[42]=we):we=t[42];let Te;t[43]===n.closeDialogAria?Te=t[44]:(Te=(0,Q.jsx)(ie,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:J,"aria-label":n.closeDialogAria,children:we})}),t[43]=n.closeDialogAria,t[44]=Te);let De;t[45]!==Ce||t[46]!==Te?(De=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[Ce,Te]}),t[45]=Ce,t[46]=Te,t[47]=De):De=t[47];let Oe;t[48]===n.avatarRowHint?Oe=t[49]:(Oe=(0,Q.jsx)(C,{className:`sr-only`,children:n.avatarRowHint}),t[48]=n.avatarRowHint,t[49]=Oe);let ke;t[50]===L?ke=t[51]:(ke=e=>L({avatar:e}),t[50]=L,t[51]=ke);let Ae;t[52]!==n||t[53]!==W.avatar||t[54]!==a.id||t[55]!==ke?(Ae=(0,Q.jsx)(xn,{agentId:a.id,value:W.avatar,onChange:ke,a:n}),t[52]=n,t[53]=W.avatar,t[54]=a.id,t[55]=ke,t[56]=Ae):Ae=t[56];let Me;t[57]!==De||t[58]!==Oe||t[59]!==Ae?(Me=(0,Q.jsxs)(Ge,{children:[xe,(0,Q.jsxs)(ae,{className:Se,onOpenAutoFocus:Cn,children:[De,Oe,Ae]})]}),t[57]=De,t[58]=Oe,t[59]=Ae,t[60]=Me):Me=t[60];let Ne;t[61]!==le||t[62]!==R||t[63]!==Me?(Ne=(0,Q.jsx)(O,{open:le,onOpenChange:R,children:Me}),t[61]=le,t[62]=R,t[63]=Me,t[64]=Ne):Ne=t[64];let Pe;t[65]===n.displayName?Pe=t[66]:(Pe=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[65]=n.displayName,t[66]=Pe);let Fe;t[67]!==c||t[68]!==L?(Fe=e=>{c(e.target.value),L({name:e.target.value})},t[67]=c,t[68]=L,t[69]=Fe):Fe=t[69];let Ie;t[70]!==n.personaNamePlaceholder||t[71]!==s||t[72]!==Fe?(Ie=(0,Q.jsx)(`input`,{className:fe,value:s,onChange:Fe,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[70]=n.personaNamePlaceholder,t[71]=s,t[72]=Fe,t[73]=Ie):Ie=t[73];let Le;t[74]!==Pe||t[75]!==Ie?(Le=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Pe,Ie]}),t[74]=Pe,t[75]=Ie,t[76]=Le):Le=t[76];let Re;t[77]===n.personaEmoji?Re=t[78]:(Re=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[77]=n.personaEmoji,t[78]=Re);let ze;t[79]===L?ze=t[80]:(ze=e=>L({emoji:e.target.value}),t[79]=L,t[80]=ze);let X;t[81]!==n.personaEmojiPlaceholder||t[82]!==W.emoji||t[83]!==ze?(X=(0,Q.jsx)(`input`,{className:fe,value:W.emoji,onChange:ze,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[81]=n.personaEmojiPlaceholder,t[82]=W.emoji,t[83]=ze,t[84]=X):X=t[84];let Ve;t[85]!==Re||t[86]!==X?(Ve=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[Re,X]}),t[85]=Re,t[86]=X,t[87]=Ve):Ve=t[87];let He;t[88]===n.agentDescription?He=t[89]:(He=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[88]=n.agentDescription,t[89]=He);let Ue;t[90]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=i(fe,`min-h-16 resize-y text-sm leading-relaxed`),t[90]=Ue):Ue=t[90];let We;t[91]!==f||t[92]!==L?(We=e=>{f(e.target.value),L({description:e.target.value})},t[91]=f,t[92]=L,t[93]=We):We=t[93];let Ke;t[94]!==n.agentDescriptionPlaceholder||t[95]!==d||t[96]!==We?(Ke=(0,Q.jsx)(`textarea`,{className:Ue,value:d,onChange:We,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[94]=n.agentDescriptionPlaceholder,t[95]=d,t[96]=We,t[97]=Ke):Ke=t[97];let qe;t[98]!==He||t[99]!==Ke?(qe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[He,Ke]}),t[98]=He,t[99]=Ke,t[100]=qe):qe=t[100];let Je;t[101]===n.personaCreature?Je=t[102]:(Je=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[101]=n.personaCreature,t[102]=Je);let Xe;t[103]===W.creature?Xe=t[104]:(Xe=B.some(e=>e.value===W.creature)?W.creature:`__custom__`,t[103]=W.creature,t[104]=Xe);let Ze;t[105]===L?Ze=t[106]:(Ze=e=>{if(e.target.value===`__custom__`){L({creature:``});return}L({creature:e.target.value})},t[105]=L,t[106]=Ze);let Qe;t[107]===me?Qe=t[108]:(Qe=B.map(e=>(0,Q.jsx)(Be,{value:e.value,children:me(e.labelEn,e.labelZh)},e.value)),t[107]=me,t[108]=Qe);let $e;t[109]===me?$e=t[110]:($e=me(`Custom…`,`自定义…`),t[109]=me,t[110]=$e);let et;t[111]===$e?et=t[112]:(et=(0,Q.jsx)(Be,{value:`__custom__`,children:$e}),t[111]=$e,t[112]=et);let tt;t[113]!==Xe||t[114]!==Ze||t[115]!==Qe||t[116]!==et?(tt=(0,Q.jsxs)(Ee,{className:fe,value:Xe,onChange:Ze,children:[Qe,et]}),t[113]=Xe,t[114]=Ze,t[115]=Qe,t[116]=et,t[117]=tt):tt=t[117];let nt;t[118]!==n.personaCreaturePlaceholder||t[119]!==W.creature||t[120]!==L?(nt=B.some(e=>e.value===W.creature)?null:(0,Q.jsx)(`input`,{className:i(fe,`mt-1 text-xs`),value:W.creature,onChange:e=>L({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[118]=n.personaCreaturePlaceholder,t[119]=W.creature,t[120]=L,t[121]=nt):nt=t[121];let it;t[122]!==Je||t[123]!==tt||t[124]!==nt?(it=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[Je,tt,nt]}),t[122]=Je,t[123]=tt,t[124]=nt,t[125]=it):it=t[125];let at;t[126]!==Le||t[127]!==Ve||t[128]!==qe||t[129]!==it?(at=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[Le,Ve,qe,it]}),t[126]=Le,t[127]=Ve,t[128]=qe,t[129]=it,t[130]=at):at=t[130];let ot;t[131]!==Ne||t[132]!==at||t[133]!==be?(ot=(0,Q.jsxs)(vt,{children:[be,Ne,at]}),t[131]=Ne,t[132]=at,t[133]=be,t[134]=ot):ot=t[134];let st;t[135]!==n.editAgent||t[136]!==n.editAgentHint?(st=(0,Q.jsx)(_t,{icon:G,title:n.editAgent,subtitle:n.editAgentHint}),t[135]=n.editAgent,t[136]=n.editAgentHint,t[137]=st):st=t[137];let ct;t[138]===n.modelPrimary?ct=t[139]:(ct=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelPrimary}),t[138]=n.modelPrimary,t[139]=ct);let lt;t[140]===v?lt=t[141]:(lt=e=>v(e),t[140]=v,t[141]=lt);let ut;t[142]!==o||t[143]!==r.modelNoMatches||t[144]!==r.modelPlaceholder||t[145]!==r.modelSearchPlaceholder||t[146]!==g||t[147]!==lt?(ut=(0,Q.jsx)(m,{className:`min-w-0 flex-1`,value:g,disabled:o,placeholder:r.modelPlaceholder,searchPlaceholder:r.modelSearchPlaceholder,noMatches:r.modelNoMatches,onChange:lt}),t[142]=o,t[143]=r.modelNoMatches,t[144]=r.modelPlaceholder,t[145]=r.modelSearchPlaceholder,t[146]=g,t[147]=lt,t[148]=ut):ut=t[148];let dt;t[149]!==n.modelClear||t[150]!==o||t[151]!==g||t[152]!==v?(dt=g.trim()?(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>v(``),children:n.modelClear}):null,t[149]=n.modelClear,t[150]=o,t[151]=g,t[152]=v,t[153]=dt):dt=t[153];let pt;t[154]!==ut||t[155]!==dt?(pt=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[ut,dt]}),t[154]=ut,t[155]=dt,t[156]=pt):pt=t[156];let mt;t[157]!==ct||t[158]!==pt?(mt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ct,pt]}),t[157]=ct,t[158]=pt,t[159]=mt):mt=t[159];let gt;t[160]===n.workspacePath?gt=t[161]:(gt=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[160]=n.workspacePath,t[161]=gt);let yt=r.workingDirectory,bt=r.workingDirectory.notSet,xt;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(xt=i(fe,`font-mono text-xs`),t[162]=xt):xt=t[162];let St;t[163]!==o||t[164]!==r.workingDirectory||t[165]!==p||t[166]!==h?(St=(0,Q.jsx)(It,{value:p,onChange:h,disabled:o,wd:yt,placeholder:bt,inputClassName:xt}),t[163]=o,t[164]=r.workingDirectory,t[165]=p,t[166]=h,t[167]=St):St=t[167];let Ct;t[168]!==gt||t[169]!==St?(Ct=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[gt,St]}),t[168]=gt,t[169]=St,t[170]=Ct):Ct=t[170];let wt;t[171]!==mt||t[172]!==Ct?(wt=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[mt,Ct]}),t[171]=mt,t[172]=Ct,t[173]=wt):wt=t[173];let Tt;t[174]!==n.save||t[175]!==n.tryInChat||t[176]!==o||t[177]!==A||t[178]!==E||t[179]!==ne?(Tt=A?null:(0,Q.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,Q.jsx)(Y,{type:`button`,disabled:o,onClick:()=>void E(),children:n.save}),ne?(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:o,onClick:ne,children:[(0,Q.jsx)(w,{className:`mr-1.5 size-4`,"aria-hidden":!0}),n.tryInChat]}):null]}),t[174]=n.save,t[175]=n.tryInChat,t[176]=o,t[177]=A,t[178]=E,t[179]=ne,t[180]=Tt):Tt=t[180];let Dt;t[181]!==st||t[182]!==wt||t[183]!==Tt?(Dt=(0,Q.jsxs)(vt,{children:[st,wt,Tt]}),t[181]=st,t[182]=wt,t[183]=Tt,t[184]=Dt):Dt=t[184];let Ot;t[185]!==n.personaSectionSoul||t[186]!==n.personaSectionSoulHint||t[187]!==n.personaSoulCustomEdit||t[188]!==n.personaSoulEdit||t[189]!==n.personaSoulPreview||t[190]!==n.personaSoulTemplate||t[191]!==te||t[192]!==ee||t[193]!==H||t[194]!==me||t[195]!==j||t[196]!==oe||t[197]!==se||t[198]!==ce||t[199]!==K||t[200]!==z?(Ot=j?(0,Q.jsx)(ht,{rows:2}):(0,Q.jsxs)(vt,{children:[(0,Q.jsx)(_t,{icon:M,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-2 sm:grid-cols-4`,children:_.map(e=>(0,Q.jsxs)(`button`,{type:`button`,className:i(`flex flex-col items-center gap-1.5 rounded-xl border-2 p-3 text-center transition-all`,y.pressCard,K===e.id?`border-accent bg-accent-soft/40 shadow-sm`:`border-edge hover:border-accent/40 hover:bg-surface-hover`),onClick:()=>ee(e.id),children:[(0,Q.jsx)(`span`,{className:`text-xl`,children:e.emoji}),(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:me(e.labelEn,e.labelZh)})]},e.id))})]}),K===`custom`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulCustomEdit}),(0,Q.jsx)(`button`,{type:`button`,className:i(re,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),title:ce?n.personaSoulEdit:n.personaSoulPreview,"aria-label":ce?n.personaSoulEdit:n.personaSoulPreview,onClick:z,children:ce?(0,Q.jsx)(I,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(N,{className:`size-4`,"aria-hidden":!0})})]}),(0,Q.jsx)(`div`,{className:i(fe,`flex min-h-64 flex-col overflow-hidden p-0`),children:ce?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(rt,{content:oe})}):(0,Q.jsx)(ft,{initialContent:oe,onChange:te,isDark:H,className:`min-h-0 flex-1`},`soul-${se}`)})]}):null]}),t[185]=n.personaSectionSoul,t[186]=n.personaSectionSoulHint,t[187]=n.personaSoulCustomEdit,t[188]=n.personaSoulEdit,t[189]=n.personaSoulPreview,t[190]=n.personaSoulTemplate,t[191]=te,t[192]=ee,t[193]=H,t[194]=me,t[195]=j,t[196]=oe,t[197]=se,t[198]=ce,t[199]=K,t[200]=z,t[201]=Ot):Ot=t[201];let kt;return t[202]!==ot||t[203]!==Dt||t[204]!==Ot?(kt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[ot,Dt,Ot]}),t[202]=ot,t[203]=Dt,t[204]=Ot,t[205]=kt):kt=t[205],kt}function Cn(e){return e.preventDefault()}function wn(e){return e.resolved===`dark`}function Tn(e){return e.language}function En(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 Dn(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 On(e){let t=(0,Z.c)(121),{a:n,selected:r,defaultModel:i,defaultWorkspace:a,isTuiDefault:o,isTuiDefaultInherited:s,busy:c,onSetDefault:l,onSetTuiDefault:u,onTryInChat:d}=e,f;t[0]!==n||t[1]!==r?(f=R(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=de(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,b=r.model?.primary?.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,x=r.workspace?.trim()&&r.workspace.trim()!==a.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,S=r.tools.effectiveDisable.length,C=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)(D,{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 O;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(O=r.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,t[19]=n.globalDefaultBadge,t[20]=r.isDefault,t[21]=O):O=t[21];let k;t[22]!==n.tuiDefaultBadge||t[23]!==n.tuiDefaultInheritedBadge||t[24]!==o||t[25]!==s?(k=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]=k):k=t[26];let A;t[27]!==E||t[28]!==O||t[29]!==k?(A=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[E,O,k]}),t[27]=E,t[28]=O,t[29]=k,t[30]=A):A=t[30];let j;t[31]===r.id?j=t[32]:(j=(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,children:r.id}),t[31]=r.id,t[32]=j);let M;t[33]!==j||t[34]!==A?(M=(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[A,j]}),t[33]=j,t[34]=A,t[35]=M):M=t[35];let N;t[36]!==M||t[37]!==T?(N=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[T,M]}),t[36]=M,t[37]=T,t[38]=N):N=t[38];let P;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(P=d?(0,Q.jsxs)(Y,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(w,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=P):P=t[42];let F;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(F=r.isDefault?null:(0,Q.jsx)(Y,{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]=F):F=t[47];let I;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(I=o?null:(0,Q.jsx)(Y,{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]=I):I=t[52];let L;t[53]!==P||t[54]!==F||t[55]!==I?(L=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[P,F,I]}),t[53]=P,t[54]=F,t[55]=I,t[56]=L):L=t[56];let ee;t[57]!==N||t[58]!==L?(ee=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[N,L]}),t[57]=N,t[58]=L,t[59]=ee):ee=t[59];let z;t[60]===h?z=t[61]:(z=(0,Q.jsx)(`p`,{className:`w-full text-sm leading-6 text-fg-muted`,children:h}),t[60]=h,t[61]=z);let B;t[62]!==ee||t[63]!==z?(B=(0,Q.jsx)(vt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[ee,z]})}),t[62]=ee,t[63]=z,t[64]=B):B=t[64];let ne;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(ne=(0,Q.jsx)(_t,{icon:Ye,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=ne):ne=t[67];let V;t[68]!==n.modelPrimary||t[69]!==b||t[70]!==_?(V=(0,Q.jsx)(En,{label:n.modelPrimary,value:_,badge:b,mono:!0}),t[68]=n.modelPrimary,t[69]=b,t[70]=_,t[71]=V):V=t[71];let re;t[72]!==n.workspacePath||t[73]!==x||t[74]!==y?(re=(0,Q.jsx)(En,{label:n.workspacePath,value:y,badge:x,mono:!0}),t[72]=n.workspacePath,t[73]=x,t[74]=y,t[75]=re):re=t[75];let ie;t[76]!==V||t[77]!==re?(ie=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[V,re]}),t[76]=V,t[77]=re,t[78]=ie):ie=t[78];let H;t[79]!==ne||t[80]!==ie?(H=(0,Q.jsxs)(vt,{children:[ne,ie]}),t[79]=ne,t[80]=ie,t[81]=H):H=t[81];let U;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(U=(0,Q.jsx)(_t,{icon:Ve,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=U):U=t[84];let W;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==S?(W=S>0?n.listToolsDisabledCount.replace(`{{count}}`,String(S)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=S,t[88]=W):W=t[88];let G;t[89]!==n.listToolsLabel||t[90]!==W?(G=(0,Q.jsx)(Dn,{icon:te,label:n.listToolsLabel,value:W}),t[89]=n.listToolsLabel,t[90]=W,t[91]=G):G=t[91];let K;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==C?(K=C?n.listSkillsCount.replace(`{{count}}`,String(C)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=C,t[95]=K):K=t[95];let ae;t[96]!==n.listSkillsLabel||t[97]!==K?(ae=(0,Q.jsx)(Dn,{icon:Ye,label:n.listSkillsLabel,value:K}),t[96]=n.listSkillsLabel,t[97]=K,t[98]=ae):ae=t[98];let oe;t[99]!==n.memoryTitle||t[100]!==n.overviewMemoryManaged?(oe=(0,Q.jsx)(Dn,{icon:ye,label:n.memoryTitle,value:n.overviewMemoryManaged}),t[99]=n.memoryTitle,t[100]=n.overviewMemoryManaged,t[101]=oe):oe=t[101];let se;t[102]!==n.connectionsTitle||t[103]!==n.overviewConnectionsManaged?(se=(0,Q.jsx)(Dn,{icon:Ae,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[102]=n.connectionsTitle,t[103]=n.overviewConnectionsManaged,t[104]=se):se=t[104];let ce;t[105]!==n.listWorkspaceLabel||t[106]!==y?(ce=(0,Q.jsx)(Dn,{icon:st,label:n.listWorkspaceLabel,value:y}),t[105]=n.listWorkspaceLabel,t[106]=y,t[107]=ce):ce=t[107];let le;t[108]!==G||t[109]!==ae||t[110]!==oe||t[111]!==se||t[112]!==ce?(le=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[G,ae,oe,se,ce]}),t[108]=G,t[109]=ae,t[110]=oe,t[111]=se,t[112]=ce,t[113]=le):le=t[113];let ue;t[114]!==U||t[115]!==le?(ue=(0,Q.jsxs)(vt,{children:[U,le]}),t[114]=U,t[115]=le,t[116]=ue):ue=t[116];let fe;return t[117]!==B||t[118]!==H||t[119]!==ue?(fe=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[B,H,ue]}),t[117]=B,t[118]=H,t[119]=ue,t[120]=fe):fe=t[120],fe}function kn(e){let t=(0,Z.c)(65),{a:n,selected:r,busy:a,skillsCatalogLoading:o,catalogForPick:s,skillsInherit:c,setSkillsInherit:l,skillsPick:u,setSkillsPick:d,onSaveSkills:f,hideInlineSave:p}=e,m;t[0]===r.skills.effectiveAllowlist?m=t[1]:(m=function(e){let t=r.skills.effectiveAllowlist;return t===void 0?!0:t.length===0?!1:t.includes(e)},t[0]=r.skills.effectiveAllowlist,t[1]=m);let h=m,g;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(g=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(An)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=g):g=t[4];let _=g,v;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(v=(0,Q.jsx)(_t,{className:`shrink-0`,icon:we,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=v):v=t[7];let y;t[8]===l?y=t[9]:(y=()=>l(!0),t[8]=l,t[9]=y);let x;t[10]!==n.skillsInherit||t[11]!==a||t[12]!==y?(x=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:a,onClick:y,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=a,t[12]=y,t[13]=x):x=t[13];let S;t[14]!==_||t[15]!==l||t[16]!==d?(S=()=>{l(!1),d(_())},t[14]=_,t[15]=l,t[16]=d,t[17]=S):S=t[17];let C;t[18]!==n.skillsCustomize||t[19]!==a||t[20]!==S?(C=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:a,onClick:S,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=a,t[20]=S,t[21]=C):C=t[21];let w;t[22]!==x||t[23]!==C?(w=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[x,C]}),t[22]=x,t[23]=C,t[24]=w):w=t[24];let T;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(T=Se(`skills`),t[25]=T):T=t[25];let E;t[26]===n.skillsLibraryLink?E=t[27]:(E=(0,Q.jsx)(b,{to:T,className:`shrink-0 text-xs font-medium text-accent-fg hover:underline`,children:n.skillsLibraryLink}),t[26]=n.skillsLibraryLink,t[27]=E);let D;t[28]!==w||t[29]!==E?(D=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3`,children:[w,E]}),t[28]=w,t[29]=E,t[30]=D):D=t[30];let O;t[31]===r.skills.preset?O=t[32]:(O=r.skills.preset.length?r.skills.preset.join(`, `):`—`,t[31]=r.skills.preset,t[32]=O);let k;t[33]!==n.skillsPresetLabel||t[34]!==O?(k=(0,Q.jsxs)(`p`,{className:`mt-2 shrink-0 text-xs text-fg-muted`,children:[n.skillsPresetLabel,` `,O]}),t[33]=n.skillsPresetLabel,t[34]=O,t[35]=k):k=t[35];let A;t[36]!==n.skillsInherit||t[37]!==r.skills.effectiveAllowlist||t[38]!==c?(A=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):c?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=c,t[39]=A):A=t[39];let j;t[40]!==n.skillsEffectiveLabel||t[41]!==A?(j=(0,Q.jsxs)(`p`,{className:`shrink-0 text-xs text-fg-muted`,children:[n.skillsEffectiveLabel,` `,A]}),t[40]=n.skillsEffectiveLabel,t[41]=A,t[42]=j):j=t[42];let M;t[43]!==n.skillsEmptyCatalog||t[44]!==n.skillsNoDescription||t[45]!==a||t[46]!==s||t[47]!==h||t[48]!==d||t[49]!==o||t[50]!==c||t[51]!==u?(M=o?(0,Q.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(gt,{rows:4})}):s.length===0?(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.skillsEmptyCatalog}):(0,Q.jsx)(`div`,{className:i(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,c&&`opacity-50`),children:(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5 text-sm`,children:s.map(e=>{let t=e.name||e.directoryId,r=c?h(t):u.has(t),o=typeof e.description==`string`?e.description.trim():``,s=o||n.skillsNoDescription;return(0,Q.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,Q.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:r,disabled:c||a,onChange:()=>{d(e=>{let n=new Set(e);return r?n.delete(t):n.add(t),n})},"aria-label":t}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-hidden`,children:[(0,Q.jsx)(`div`,{className:`truncate font-mono text-xs font-medium text-fg`,title:t,children:t}),(0,Q.jsx)(`p`,{className:i(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!o&&`italic text-fg-subtle`),title:s,children:s})]})]})},t)})})}),t[43]=n.skillsEmptyCatalog,t[44]=n.skillsNoDescription,t[45]=a,t[46]=s,t[47]=h,t[48]=d,t[49]=o,t[50]=c,t[51]=u,t[52]=M):M=t[52];let N;t[53]!==n.skillsSave||t[54]!==a||t[55]!==p||t[56]!==f?(N=p?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(Y,{type:`button`,disabled:a,onClick:()=>void f(),children:n.skillsSave})}),t[53]=n.skillsSave,t[54]=a,t[55]=p,t[56]=f,t[57]=N):N=t[57];let P;return t[58]!==D||t[59]!==k||t[60]!==j||t[61]!==M||t[62]!==N||t[63]!==v?(P=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[v,D,k,j,M,N]}),t[58]=D,t[59]=k,t[60]=j,t[61]=M,t[62]=N,t[63]=v,t[64]=P):P=t[64],P}function An(e){return e.name||e.directoryId}var jn=[`write_file`,`apply_patch`,`exec_command`],Mn=[`exec_command`,`image_generate`,`extensions`],Nn=[`send_message`,`send_media`];function Pn(e){let t=(0,Z.c)(87),{mode:n,builtinToolIds:r,loading:a,disableSet:o,onDisableSetChange:s,defaultsDisableSet:c,unknownDisabledIds:l,getToolDescription:u,getGroupTitle:d,labels:f,quickActionsDisabled:p}=e,m;t[0]===l?m=t[1]:(m=l===void 0?[]:l,t[0]=l,t[1]=m);let h=m,g=p===void 0?!1:p,_;t[2]===r?_=t[3]:(_=new Set(r),t[2]=r,t[3]=_);let v=_,y;t[4]===c?y=t[5]:(y=c??new Set,t[4]=c,t[5]=y);let b=y,x;t[6]!==b||t[7]!==o||t[8]!==n||t[9]!==s?(x=(e,t)=>{if(n===`agentEntry`&&t&&b.has(e))return;let r=new Set(o);t?r.delete(e):r.add(e),s(r)},t[6]=b,t[7]=o,t[8]=n,t[9]=s,t[10]=x):x=t[10];let S=x,C;t[11]!==v||t[12]!==s?(C=e=>{let t=new Set;for(let n of e)v.has(n)&&t.add(n);s(t)},t[11]=v,t[12]=s,t[13]=C):C=t[13];let w=C,T;t[14]===s?T=t[15]:(T=()=>{s(new Set)},t[14]=s,t[15]=T);let E=T,D;t[16]!==r||t[17]!==s||t[18]!==h?(D=()=>{s(new Set([...r,...h]))},t[16]=r,t[17]=s,t[18]=h,t[19]=D):D=t[19];let O=D,k;t[20]===r?k=t[21]:(k=Nt(r),t[20]=r,t[21]=k);let A=k,j;if(t[22]!==v||t[23]!==A||t[24]!==n||t[25]!==h){if(j=[],n===`defaults`&&h.length>0){let e;t[27]===h?e=t[28]:(e=h.toSorted(In),t[27]=h,t[28]=e);let n;t[29]===e?n=t[30]:(n={key:`unknown`,ids:e},t[29]=e,t[30]=n),j.push(n)}for(let e of Mt){let t=e.toolIds.filter(e=>v.has(e));t.length>0&&j.push({key:e.key,ids:[...t]})}if(A.length>0){let e;t[31]===A?e=t[32]:(e={key:`misc`,ids:A},t[31]=A,t[32]=e),j.push(e)}t[22]=v,t[23]=A,t[24]=n,t[25]=h,t[26]=j}else j=t[26];let M=j,N=M.some(Fn),P=g||a,F;t[33]===f.quickActionsLabel?F=t[34]:(F=(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:f.quickActionsLabel}),t[33]=f.quickActionsLabel,t[34]=F);let I=P||r.length===0&&h.length===0,L;t[35]!==E||t[36]!==f.quickEnableAll||t[37]!==I?(L=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:At,disabled:I,onClick:E,children:f.quickEnableAll}),t[35]=E,t[36]=f.quickEnableAll,t[37]=I,t[38]=L):L=t[38];let ee=P||r.length===0&&h.length===0,te;t[39]!==O||t[40]!==f.quickDisableAll||t[41]!==ee?(te=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:At,disabled:ee,onClick:O,children:f.quickDisableAll}),t[39]=O,t[40]=f.quickDisableAll,t[41]=ee,t[42]=te):te=t[42];let R=P||r.length===0,z;t[43]===w?z=t[44]:(z=()=>w(jn),t[43]=w,t[44]=z);let B;t[45]!==f.quickReadOnlyWorkspace||t[46]!==R||t[47]!==z?(B=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:At,disabled:R,onClick:z,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=R,t[47]=z,t[48]=B):B=t[48];let ne=P||r.length===0,V;t[49]===w?V=t[50]:(V=()=>w(Mn),t[49]=w,t[50]=V);let re;t[51]!==f.quickHighRiskOff||t[52]!==ne||t[53]!==V?(re=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:At,disabled:ne,onClick:V,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=ne,t[53]=V,t[54]=re):re=t[54];let ie=P||r.length===0,H;t[55]===w?H=t[56]:(H=()=>w(Nn),t[55]=w,t[56]=H);let U;t[57]!==f.quickNoOutbound||t[58]!==ie||t[59]!==H?(U=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:At,disabled:ie,onClick:H,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=ie,t[59]=H,t[60]=U):U=t[60];let W;t[61]!==L||t[62]!==te||t[63]!==B||t[64]!==re||t[65]!==U?(W=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[L,te,B,re,U]}),t[61]=L,t[62]=te,t[63]=B,t[64]=re,t[65]=U,t[66]=W):W=t[66];let G;t[67]!==F||t[68]!==W?(G=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[F,W]}),t[67]=F,t[68]=W,t[69]=G):G=t[69];let K;t[70]!==b||t[71]!==o||t[72]!==d||t[73]!==u||t[74]!==M||t[75]!==N||t[76]!==f.emptyBuiltin||t[77]!==f.lockedByDefaults||t[78]!==f.notInBuiltin||t[79]!==a||t[80]!==n||t[81]!==P||t[82]!==S?(K=a?(0,Q.jsx)(gt,{rows:4}):N?(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:M.map(e=>{let{key:t,ids:r}=e;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:d(t)}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>{let r=n===`defaults`&&t===`unknown`,a=n===`agentEntry`&&b.has(e),s=o.has(e),c=a?!1:!s,l=u(e);return(0,Q.jsx)(`li`,{className:i(`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,r&&`bg-surface-panel/50`,a&&`opacity-60`),children:(0,Q.jsxs)(`label`,{className:i(`flex gap-3 text-sm`,a?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:c,disabled:a||P,onChange:()=>S(e,!c)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs font-medium text-fg`,children:e}),r?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.notInBuiltin,`)`]}):null,a?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.lockedByDefaults,`)`]}):null]}),l?(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:l}):null]})]})},e)})})]},t)})})}):(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:f.emptyBuiltin}),t[70]=b,t[71]=o,t[72]=d,t[73]=u,t[74]=M,t[75]=N,t[76]=f.emptyBuiltin,t[77]=f.lockedByDefaults,t[78]=f.notInBuiltin,t[79]=a,t[80]=n,t[81]=P,t[82]=S,t[83]=K):K=t[83];let ae;return t[84]!==G||t[85]!==K?(ae=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[G,K]}),t[84]=G,t[85]=K,t[86]=ae):ae=t[86],ae}function Fn(e){return e.ids.length>0}function In(e,t){return e.localeCompare(t)}function Ln(e){let t=(0,Z.c)(51),{a:n,data:r,selected:i,busy:o,toolEntryDisable:s,setToolEntryDisable:c,onSaveTools:u,onClearToolsEntry:d,hideInlineSave:f}=e,p=l(zn),m;t[0]===p?m=t[1]:(m=a(p),t[0]=p,t[1]=m);let h=m.agentSettings.advanced,g;t[2]===i.tools.presetDenied?g=t[3]:(g=new Set(i.tools.presetDenied.flatMap(Rn)),t[2]=i.tools.presetDenied,t[3]=g);let _=g,v;t[4]===c?v=t[5]:(v=e=>{c(e)},t[4]=c,t[5]=v);let y=v,b=n.toolsDisableGroups,x;t[6]===b?x=t[7]:(x=e=>b[e],t[6]=b,t[7]=x);let S=x,C;t[8]===n.toolDescriptions?C=t[9]:(C=e=>e in n.toolDescriptions?n.toolDescriptions[e]:``,t[8]=n.toolDescriptions,t[9]=C);let w=C,T;t[10]!==n.toolsHint||t[11]!==n.toolsTitle?(T=(0,Q.jsx)(_t,{className:`shrink-0`,icon:te,title:n.toolsTitle,subtitle:n.toolsHint}),t[10]=n.toolsHint,t[11]=n.toolsTitle,t[12]=T):T=t[12];let E;t[13]!==n.toolsLockedByPreset||t[14]!==h.toolsDisableEmptyBuiltin||t[15]!==h.toolsDisableLoadingBuiltin||t[16]!==h.toolsDisableNotInBuiltin||t[17]!==h.toolsDisableQuickActionsLabel||t[18]!==h.toolsDisableQuickDisableAll||t[19]!==h.toolsDisableQuickEnableAll||t[20]!==h.toolsDisableQuickHighRiskOff||t[21]!==h.toolsDisableQuickNoOutbound||t[22]!==h.toolsDisableQuickReadOnlyWorkspace?(E={loadingBuiltin:h.toolsDisableLoadingBuiltin,emptyBuiltin:h.toolsDisableEmptyBuiltin,quickActionsLabel:h.toolsDisableQuickActionsLabel,quickEnableAll:h.toolsDisableQuickEnableAll,quickDisableAll:h.toolsDisableQuickDisableAll,quickReadOnlyWorkspace:h.toolsDisableQuickReadOnlyWorkspace,quickHighRiskOff:h.toolsDisableQuickHighRiskOff,quickNoOutbound:h.toolsDisableQuickNoOutbound,notInBuiltin:h.toolsDisableNotInBuiltin,lockedByDefaults:n.toolsLockedByPreset},t[13]=n.toolsLockedByPreset,t[14]=h.toolsDisableEmptyBuiltin,t[15]=h.toolsDisableLoadingBuiltin,t[16]=h.toolsDisableNotInBuiltin,t[17]=h.toolsDisableQuickActionsLabel,t[18]=h.toolsDisableQuickDisableAll,t[19]=h.toolsDisableQuickEnableAll,t[20]=h.toolsDisableQuickHighRiskOff,t[21]=h.toolsDisableQuickNoOutbound,t[22]=h.toolsDisableQuickReadOnlyWorkspace,t[23]=E):E=t[23];let D;t[24]!==o||t[25]!==r.builtinToolIds||t[26]!==S||t[27]!==w||t[28]!==y||t[29]!==_||t[30]!==E||t[31]!==s?(D=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Pn,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:s,onDisableSetChange:y,defaultsDisableSet:_,getToolDescription:w,getGroupTitle:S,quickActionsDisabled:o,labels:E})}),t[24]=o,t[25]=r.builtinToolIds,t[26]=S,t[27]=w,t[28]=y,t[29]=_,t[30]=E,t[31]=s,t[32]=D):D=t[32];let O;t[33]!==n.toolsSave||t[34]!==o||t[35]!==f||t[36]!==u?(O=f?null:(0,Q.jsx)(Y,{type:`button`,disabled:o,onClick:()=>void u(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=o,t[35]=f,t[36]=u,t[37]=O):O=t[37];let k;t[38]===d?k=t[39]:(k=()=>void d(),t[38]=d,t[39]=k);let A;t[40]!==n.toolsClearEntry||t[41]!==o||t[42]!==k?(A=(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:o,onClick:k,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=o,t[42]=k,t[43]=A):A=t[43];let j;t[44]!==A||t[45]!==O?(j=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[O,A]}),t[44]=A,t[45]=O,t[46]=j):j=t[46];let M;return t[47]!==j||t[48]!==T||t[49]!==D?(M=(0,Q.jsxs)(vt,{className:`flex min-h-0 flex-1 flex-col`,children:[T,D,j]}),t[47]=j,t[48]=T,t[49]=D,t[50]=M):M=t[50],M}function Rn(e){let t=String(e).trim();return t?[t]:[]}function zn(e){return e.language}function Bn(e){let t=(0,Z.c)(128),{a:n,chat:r,cCron:i,selected:a,panel:o,data:s,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,defaultModel:_,defaultWorkspace:v,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,onDelete:w,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O,overviewProfile:k,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:L,fileSaving:ee,profileFileLoading:te,profileEditorNonce:R,toolEntryDisable:z,setToolEntryDisable:B,onSaveTools:ne,onClearToolsEntry:V,modelRows:re,setModelRows:ie,onSaveModels:H,onClearModelsEntry:U,skillsCatalogLoading:W,catalogForPick:G,skillsInherit:K,setSkillsInherit:ae,skillsPick:oe,setSkillsPick:se,onSaveSkills:ce,bindingsLoading:le,agentBindings:ue,bindChannelStatuses:de,bindChannelsLoading:fe,useManualChannel:pe,newBindChannel:me,setNewBindChannel:q,bindSessionChats:he,bindSessionsLoading:ge,newBindSessionIdx:_e,setNewBindSessionIdx:ve,newBindCustomPeer:ye,setNewBindCustomPeer:be,refreshBindSessions:xe,onRemoveBinding:Se,onAddBinding:Ce,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)(On,{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===`behavior`){let e;t[13]!==n||t[14]!==c||t[15]!==r||t[16]!==d||t[17]!==h||t[18]!==l||t[19]!==p||t[20]!==x||t[21]!==S||t[22]!==C||t[23]!==y||t[24]!==b||t[25]!==J||t[26]!==k.draft||t[27]!==k.handleSoulContentChange||t[28]!==k.handleSoulTemplateChange||t[29]!==k.profileMarkdownLoading||t[30]!==k.setAvatarDialogOpen||t[31]!==k.toggleSoulPreviewMode||t[32]!==k.updateIdentity||t[33]!==a||t[34]!==f||t[35]!==g||t[36]!==u||t[37]!==m?(e=(0,Q.jsx)(Sn,{a:n,chat:r,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,editWorkspace:p,setEditWorkspace:m,editModel:h,setEditModel:g,onSetDefault:y,onSetTuiDefault:b,isTuiDefault:x,isTuiDefaultInherited:S,onSaveAgentEdits:C,hideInlineSave:!0,profileMarkdownLoading:k.profileMarkdownLoading,profileDraft:k.draft,updateIdentity:k.updateIdentity,handleSoulTemplateChange:k.handleSoulTemplateChange,handleSoulContentChange:k.handleSoulContentChange,setAvatarDialogOpen:k.setAvatarDialogOpen,toggleSoulPreviewMode:k.toggleSoulPreviewMode,onTryInChat:J}),t[13]=n,t[14]=c,t[15]=r,t[16]=d,t[17]=h,t[18]=l,t[19]=p,t[20]=x,t[21]=S,t[22]=C,t[23]=y,t[24]=b,t[25]=J,t[26]=k.draft,t[27]=k.handleSoulContentChange,t[28]=k.handleSoulTemplateChange,t[29]=k.profileMarkdownLoading,t[30]=k.setAvatarDialogOpen,t[31]=k.toggleSoulPreviewMode,t[32]=k.updateIdentity,t[33]=a,t[34]=f,t[35]=g,t[36]=u,t[37]=m,t[38]=e):e=t[38];let i;t[39]!==n||t[40]!==c||t[41]!==r||t[42]!==re||t[43]!==U||t[44]!==H||t[45]!==a||t[46]!==ie?(i=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(yn,{a:n,chat:r,selected:a,busy:c,modelRows:re,setModelRows:ie,onSaveModels:H,onClearModelsEntry:U})}),t[39]=n,t[40]=c,t[41]=r,t[42]=re,t[43]=U,t[44]=H,t[45]=a,t[46]=ie,t[47]=i):i=t[47];let o;t[48]!==n||t[49]!==M||t[50]!==I||t[51]!==ee||t[52]!==j||t[53]!==A||t[54]!==P||t[55]!==J||t[56]!==R||t[57]!==te||t[58]!==N||t[59]!==L||t[60]!==F?(o=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(_n,{a:n,filesLoading:A,files:j,activeFile:M,setActiveFile:N,filesViewMode:P,setFilesViewMode:F,fileDraft:I,setFileDraft:L,fileSaving:ee,profileFileLoading:te,profileEditorNonce:R,onTryInChat:J})}),t[48]=n,t[49]=M,t[50]=I,t[51]=ee,t[52]=j,t[53]=A,t[54]=P,t[55]=J,t[56]=R,t[57]=te,t[58]=N,t[59]=L,t[60]=F,t[61]=o):o=t[61];let s;return t[62]!==e||t[63]!==i||t[64]!==o?(s=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[e,i,o]}),t[62]=e,t[63]=i,t[64]=o,t[65]=s):s=t[65],s}if(o===`tools`){let e;return t[66]!==n||t[67]!==c||t[68]!==s||t[69]!==V||t[70]!==ne||t[71]!==a||t[72]!==B||t[73]!==z?(e=(0,Q.jsx)(Ln,{a:n,data:s,selected:a,busy:c,toolEntryDisable:z,setToolEntryDisable:B,onSaveTools:ne,onClearToolsEntry:V}),t[66]=n,t[67]=c,t[68]=s,t[69]=V,t[70]=ne,t[71]=a,t[72]=B,t[73]=z,t[74]=e):e=t[74],e}if(o===`skills`){let e;return t[75]!==n||t[76]!==c||t[77]!==G||t[78]!==ce||t[79]!==a||t[80]!==ae||t[81]!==se||t[82]!==W||t[83]!==K||t[84]!==oe?(e=(0,Q.jsx)(kn,{a:n,selected:a,busy:c,skillsCatalogLoading:W,catalogForPick:G,skillsInherit:K,setSkillsInherit:ae,skillsPick:oe,setSkillsPick:se,onSaveSkills:ce}),t[75]=n,t[76]=c,t[77]=G,t[78]=ce,t[79]=a,t[80]=ae,t[81]=se,t[82]=W,t[83]=K,t[84]=oe,t[85]=e):e=t[85],e}if(o===`memory`){let e;return t[86]===a.id?e=t[87]:(e=(0,Q.jsx)(Jt,{embedded:!0,agentId:a.id}),t[86]=a.id,t[87]=e),e}if(o===`connections`){let e;return t[88]!==n||t[89]!==ue||t[90]!==de||t[91]!==fe||t[92]!==he||t[93]!==ge||t[94]!==le||t[95]!==c||t[96]!==i.lastActiveLabels||t[97]!==i.selectRecipient||t[98]!==me||t[99]!==ye||t[100]!==_e||t[101]!==Ce||t[102]!==Se||t[103]!==xe||t[104]!==q||t[105]!==be||t[106]!==ve||t[107]!==pe?(e=(0,Q.jsx)(hn,{a:n,busy:c,bindingsLoading:le,agentBindings:ue,channelStatuses:de,channelsStatusLoading:fe,useManualChannel:pe,newBindChannel:me,setNewBindChannel:q,bindSessionChats:he,sessionsLoading:ge,newBindSessionIdx:_e,setNewBindSessionIdx:ve,newBindCustomPeer:ye,setNewBindCustomPeer:be,onRefreshSessions:xe,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:Se,onAddBinding:Ce}),t[88]=n,t[89]=ue,t[90]=de,t[91]=fe,t[92]=he,t[93]=ge,t[94]=le,t[95]=c,t[96]=i.lastActiveLabels,t[97]=i.selectRecipient,t[98]=me,t[99]=ye,t[100]=_e,t[101]=Ce,t[102]=Se,t[103]=xe,t[104]=q,t[105]=be,t[106]=ve,t[107]=pe,t[108]=e):e=t[108],e}if(o===`config`){let e;return t[109]!==n||t[110]!==c||t[111]!==T||t[112]!==_||t[113]!==E||t[114]!==v||t[115]!==h||t[116]!==p||t[117]!==O||t[118]!==D||t[119]!==a?(e=(0,Q.jsx)(sn,{a:n,selected:a,busy:c,defaultModel:_,defaultWorkspace:v,agentModel:h,agentWorkspace:p,capabilityPresets:T,defaultPresetId:E,onUpdateAgentExtends:D,onOpenCapabilityPreset:O}),t[109]=n,t[110]=c,t[111]=T,t[112]=_,t[113]=E,t[114]=v,t[115]=h,t[116]=p,t[117]=O,t[118]=D,t[119]=a,t[120]=e):e=t[120],e}if(o===`dangerZone`){let e;return t[121]!==n||t[122]!==c||t[123]!==w||t[124]!==a?(e=(0,Q.jsx)(pn,{a:n,selected:a,busy:c,onDelete:w}),t[121]=n,t[122]=c,t[123]=w,t[124]=a,t[125]=e):e=t[125],e}let we;return t[126]===n.selectAgentHint?we=t[127]:(we=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[126]=n.selectAgentHint,t[127]=we),we}function Vn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=R(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=de(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function Hn(e,t){return e.replace(`{{count}}`,String(t))}function Un(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Hn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Hn(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function Wn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Hn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Hn(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function Gn(e){let t=(0,Z.c)(11),{text:n,children:r,className:a}=e,o;t[0]!==r||t[1]!==a||t[2]!==n?(o=(0,Q.jsx)(ze,{asChild:!0,children:(0,Q.jsx)(`span`,{className:a,title:n,children:r})}),t[0]=r,t[1]=a,t[2]=n,t[3]=o):o=t[3];let s;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(s=i(`max-w-[min(28rem,calc(100vw-2rem))] rounded-lg border border-edge bg-surface-panel px-2.5 py-2`,`text-left text-xs leading-snug text-fg shadow-popover`,it),t[4]=s):s=t[4];let c;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(et,{className:`fill-surface-panel`}),t[5]=c):c=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(qe,{children:(0,Q.jsxs)(Le,{side:`top`,align:`start`,sideOffset:6,className:s,children:[n,c]})}),t[6]=n,t[7]=l);let u;return t[8]!==o||t[9]!==l?(u=(0,Q.jsx)(Te,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(fe,{children:[o,l]})}),t[8]=o,t[9]=l,t[10]=u):u=t[10],u}function Kn(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:a,tuiDefaultAgentId:o,tuiDefaultInherited:s,searchQuery:c,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,m,h,g;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==a||t[4]!==u||t[5]!==l||t[6]!==c||t[7]!==o||t[8]!==s){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Vn(r,c,n),_=r.length>0&&e.length===0&&c.trim().length>0;if(r.length===0){let e;t[14]===n.listNoAgentsYet?e=t[15]:(e=(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),g=e;break bb0}m=`flex flex-col gap-4`,t[16]!==n||t[17]!==_?(h=_?(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listEmpty}):null,t[16]=n,t[17]=_,t[18]=h):h=t[18],f=`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`;let v;t[19]!==n||t[20]!==d||t[21]!==a||t[22]!==u||t[23]!==l||t[24]!==o||t[25]!==s?(v=e=>{let t=R(e,n),r=e.id,c=de(e,n),f=Un(e,n),p=Wn(e,n),m=e.id===a||e.isDefault,h=e.id===o,g=h&&s,_=h&&!s;return(0,Q.jsx)(`li`,{className:`h-full min-h-0`,children:(0,Q.jsxs)(`article`,{role:`button`,tabIndex:d?-1:0,"aria-disabled":d,"aria-label":`${t} ${r}`,onClick:()=>{d||l(e.id)},onKeyDown:t=>{d||t.key!==`Enter`&&t.key!==` `||(t.preventDefault(),l(e.id))},className:i(`flex min-h-[15.5rem] cursor-pointer flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-[background-color,transform,box-shadow] duration-150 ease-out`,`hover:bg-surface-hover/45`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-base`,`aria-disabled:pointer-events-none aria-disabled:cursor-not-allowed aria-disabled:opacity-60`,y.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)(D,{agentId:e.id,avatar:e.avatar,size:48,className:`size-full`})}),(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`truncate text-base font-semibold text-fg`,children:t}),(0,Q.jsx)(`p`,{className:`mt-1 truncate font-mono text-xs text-fg-muted`,title:r,children:r})]})]}),(0,Q.jsxs)(`div`,{className:`flex max-w-[9rem] shrink-0 flex-wrap justify-end gap-1.5`,children:[m?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,_?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultBadge}):null,g?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg`,children:n.tuiDefaultInheritedBadge}):null,!m&&!h?(0,Q.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs font-medium text-fg-muted`,children:n.listCustomBadge}):null]})]}),(0,Q.jsxs)(`div`,{className:`mt-5 min-h-[6.25rem] text-left`,children:[(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-base px-3 py-3`,children:(0,Q.jsx)(`p`,{className:i(`line-clamp-2 text-sm leading-5`,c?`text-fg`:`text-fg-muted`),title:c||void 0,children:c||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(qn)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(Y,{type:`button`,variant:`secondary`,disabled:d,onClick:t=>{t.stopPropagation(),u(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(w,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=a,t[22]=u,t[23]=l,t[24]=o,t[25]=s,t[26]=v):v=t[26],p=e.map(v)}t[0]=n,t[1]=r,t[2]=d,t[3]=a,t[4]=u,t[5]=l,t[6]=c,t[7]=o,t[8]=s,t[9]=f,t[10]=p,t[11]=m,t[12]=h,t[13]=g}else f=t[9],p=t[10],m=t[11],h=t[12],g=t[13];if(g!==Symbol.for(`react.early_return_sentinel`))return g;let _;t[27]!==f||t[28]!==p?(_=(0,Q.jsx)(`ul`,{className:f,children:p}),t[27]=f,t[28]=p,t[29]=_):_=t[29];let v;return t[30]!==m||t[31]!==h||t[32]!==_?(v=(0,Q.jsxs)(`div`,{className:m,children:[h,_]}),t[30]=m,t[31]=h,t[32]=_,t[33]=v):v=t[33],v}function qn(e){return(0,Q.jsx)(Gn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Jn(e){let t=(0,Z.c)(131),{open:n,onOpenChange:r,a,chat:o,busy:s,modalError:c,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:f,setCreateAgentId:p,createDescription:h,setCreateDescription:g,createWorkspace:_,setCreateWorkspace:v,createModel:y,setCreateModel:b,onCreate:x,onSuggestWorkspace:S,agents:w,duplicateSourceId:T,onSelectDuplicateSource:E}=e,[D,A]=(0,$.useState)(null),j;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(k,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim`,je)}),t[0]=j):j=t[0];let M;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(M=i(`xopc-dialog-content fixed left-1/2 top-1/2 max-h-[min(90vh,640px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,ge,`overflow-y-auto rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=M):M=t[1];let N;t[2]===a.addAgent?N=t[3]:(N=(0,Q.jsx)(ue,{className:`text-base font-semibold text-fg`,children:a.addAgent}),t[2]=a.addAgent,t[3]=N);let P;t[4]===a.addAgentHint?P=t[5]:(P=(0,Q.jsx)(C,{className:`mt-0.5 text-xs text-fg-muted`,children:a.addAgentHint}),t[4]=a.addAgentHint,t[5]=P);let I;t[6]!==N||t[7]!==P?(I=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[N,P]}),t[6]=N,t[7]=P,t[8]=I):I=t[8];let L;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(L=i(re,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=L):L=t[9];let ee;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(F,{className:`size-4`,"aria-hidden":!0}),t[10]=ee):ee=t[10];let te;t[11]===a.closeDialogAria?te=t[12]:(te=(0,Q.jsx)(ie,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:L,"aria-label":a.closeDialogAria,children:ee})}),t[11]=a.closeDialogAria,t[12]=te);let z;t[13]!==I||t[14]!==te?(z=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[I,te]}),t[13]=I,t[14]=te,t[15]=z):z=t[15];let B;t[16]!==a||t[17]!==w||t[18]!==T||t[19]!==E?(B=w.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.copyFromExistingAgent}),(0,Q.jsxs)(Ee,{className:i(Et(),`bg-surface-panel`),value:T??``,onChange:e=>E(e.target.value||null),children:[(0,Q.jsx)(Be,{value:``,children:a.copyFromExistingAgentNone}),w.map(e=>(0,Q.jsxs)(Be,{value:e.id,children:[R(e,a),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.duplicateAgentHint})]}):null,t[16]=a,t[17]=w,t[18]=T,t[19]=E,t[20]=B):B=t[20];let ne;t[21]===c?ne=t[22]:(ne=c?(0,Q.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:c}):null,t[21]=c,t[22]=ne);let V;t[23]!==a.newAgentLabel||t[24]!==l?(V=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.newAgentLabel,` (`,l,`)`]}),t[23]=a.newAgentLabel,t[24]=l,t[25]=V):V=t[25];let H;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(H=Et(),t[26]=H):H=t[26];let U;t[27]===d?U=t[28]:(U=e=>d(e.target.value),t[27]=d,t[28]=U);let W;t[29]===S?W=t[30]:(W=()=>S(),t[29]=S,t[30]=W);let G;t[31]!==u||t[32]!==U||t[33]!==W?(G=(0,Q.jsx)(`input`,{className:H,value:u,onChange:U,onBlur:W,required:!0,autoComplete:`off`}),t[31]=u,t[32]=U,t[33]=W,t[34]=G):G=t[34];let K;t[35]!==V||t[36]!==G?(K=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[V,G]}),t[35]=V,t[36]=G,t[37]=K):K=t[37];let oe;t[38]===a.newAgentIdOptional?oe=t[39]:(oe=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newAgentIdOptional}),t[38]=a.newAgentIdOptional,t[39]=oe);let se;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(se=i(Et(),`font-mono text-xs`),t[40]=se):se=t[40];let ce;t[41]===p?ce=t[42]:(ce=e=>p(e.target.value),t[41]=p,t[42]=ce);let le;t[43]===S?le=t[44]:(le=()=>S(),t[43]=S,t[44]=le);let de;t[45]!==a.newAgentIdPlaceholder||t[46]!==a.newAgentIdRules||t[47]!==f||t[48]!==ce||t[49]!==le?(de=(0,Q.jsx)(`input`,{className:se,value:f,onChange:ce,onBlur:le,placeholder:a.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:a.newAgentIdRules}),t[45]=a.newAgentIdPlaceholder,t[46]=a.newAgentIdRules,t[47]=f,t[48]=ce,t[49]=le,t[50]=de):de=t[50];let fe;t[51]===a.newAgentIdRules?fe=t[52]:(fe=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:a.newAgentIdRules}),t[51]=a.newAgentIdRules,t[52]=fe);let pe;t[53]!==oe||t[54]!==de||t[55]!==fe?(pe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[oe,de,fe]}),t[53]=oe,t[54]=de,t[55]=fe,t[56]=pe):pe=t[56];let me;t[57]!==a.agentDescription||t[58]!==l?(me=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[a.agentDescription,` (`,l,`)`]}),t[57]=a.agentDescription,t[58]=l,t[59]=me):me=t[59];let q;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(q=i(Et(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[60]=q):q=t[60];let he;t[61]===g?he=t[62]:(he=e=>g(e.target.value),t[61]=g,t[62]=he);let _e;t[63]!==a.agentDescriptionPlaceholder||t[64]!==h||t[65]!==he?(_e=(0,Q.jsx)(`textarea`,{className:q,value:h,onChange:he,placeholder:a.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[63]=a.agentDescriptionPlaceholder,t[64]=h,t[65]=he,t[66]=_e):_e=t[66];let ve;t[67]!==me||t[68]!==_e?(ve=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[me,_e]}),t[67]=me,t[68]=_e,t[69]=ve):ve=t[69];let ye;t[70]===a.newWorkspace?ye=t[71]:(ye=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newWorkspace}),t[70]=a.newWorkspace,t[71]=ye);let be;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(be=i(Et(),`font-mono text-xs`),t[72]=be):be=t[72];let xe;t[73]===v?xe=t[74]:(xe=e=>v(e.target.value),t[73]=v,t[74]=xe);let Se;t[75]!==_||t[76]!==xe?(Se=(0,Q.jsx)(`input`,{className:be,value:_,onChange:xe,required:!0,autoComplete:`off`}),t[75]=_,t[76]=xe,t[77]=Se):Se=t[77];let Ce;t[78]!==ye||t[79]!==Se?(Ce=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ye,Se]}),t[78]=ye,t[79]=Se,t[80]=Ce):Ce=t[80];let J;t[81]===a.newModelOptional?J=t[82]:(J=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:a.newModelOptional}),t[81]=a.newModelOptional,t[82]=J);let we;t[83]===b?we=t[84]:(we=e=>b(e),t[83]=b,t[84]=we);let Te;t[85]!==s||t[86]!==o.modelNoMatches||t[87]!==o.modelPlaceholder||t[88]!==o.modelSearchPlaceholder||t[89]!==y||t[90]!==we?(Te=(0,Q.jsx)(m,{className:`min-w-0 flex-1`,value:y,disabled:s,placeholder:o.modelPlaceholder,searchPlaceholder:o.modelSearchPlaceholder,noMatches:o.modelNoMatches,onChange:we}),t[85]=s,t[86]=o.modelNoMatches,t[87]=o.modelPlaceholder,t[88]=o.modelSearchPlaceholder,t[89]=y,t[90]=we,t[91]=Te):Te=t[91];let De;t[92]!==a.modelClear||t[93]!==s||t[94]!==y||t[95]!==b?(De=y.trim()?(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:s,onClick:()=>b(``),children:a.modelClear}):null,t[92]=a.modelClear,t[93]=s,t[94]=y,t[95]=b,t[96]=De):De=t[96];let Oe;t[97]!==Te||t[98]!==De?(Oe=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[Te,De]}),t[97]=Te,t[98]=De,t[99]=Oe):Oe=t[99];let ke;t[100]!==J||t[101]!==Oe?(ke=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[J,Oe]}),t[100]=J,t[101]=Oe,t[102]=ke):ke=t[102];let Ae;t[103]!==a.createModalCancel||t[104]!==s?(Ae=(0,Q.jsx)(ie,{asChild:!0,children:(0,Q.jsx)(Y,{type:`button`,variant:`secondary`,disabled:s,children:a.createModalCancel})}),t[103]=a.createModalCancel,t[104]=s,t[105]=Ae):Ae=t[105];let Me;t[106]===Symbol.for(`react.memo_cache_sentinel`)?(Me=(0,Q.jsx)(dt,{className:`mr-1 size-4`,"aria-hidden":!0}),t[106]=Me):Me=t[106];let Ne;t[107]!==a.create||t[108]!==s?(Ne=(0,Q.jsxs)(Y,{type:`submit`,disabled:s,children:[Me,a.create]}),t[107]=a.create,t[108]=s,t[109]=Ne):Ne=t[109];let Pe;t[110]!==Ae||t[111]!==Ne?(Pe=(0,Q.jsxs)(`div`,{className:`mt-1 flex justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Ae,Ne]}),t[110]=Ae,t[111]=Ne,t[112]=Pe):Pe=t[112];let Fe;t[113]!==x||t[114]!==ne||t[115]!==K||t[116]!==pe||t[117]!==ve||t[118]!==Ce||t[119]!==ke||t[120]!==Pe||t[121]!==B?(Fe=(0,Q.jsxs)(`form`,{className:`grid gap-3`,onSubmit:x,children:[B,ne,K,pe,ve,Ce,ke,Pe]}),t[113]=x,t[114]=ne,t[115]=K,t[116]=pe,t[117]=ve,t[118]=Ce,t[119]=ke,t[120]=Pe,t[121]=B,t[122]=Fe):Fe=t[122];let Ie;t[123]!==D||t[124]!==Fe||t[125]!==z?(Ie=(0,Q.jsxs)(Ge,{children:[j,(0,Q.jsx)(ae,{ref:A,className:M,onOpenAutoFocus:Yn,children:(0,Q.jsxs)(Qe,{layer:`modal`,portalContainer:D,children:[z,Fe]})})]}),t[123]=D,t[124]=Fe,t[125]=z,t[126]=Ie):Ie=t[126];let Le;return t[127]!==r||t[128]!==n||t[129]!==Ie?(Le=(0,Q.jsx)(O,{open:n,onOpenChange:r,children:Ie}),t[127]=r,t[128]=n,t[129]=Ie,t[130]=Le):Le=t[130],Le}function Yn(e){return e.preventDefault()}var Xn=`~/.xopc/workspace`;function Zn(e){let t=e.trim();return t?`${Xn}/${v(t)}`:``}function Qn(e){let t=(0,Z.c)(18),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o}=e,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(We,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===a?c=t[2]:(c=e=>a(e.target.value),t[1]=a,t[2]=c);let l;t[3]!==n.listSearchPlaceholder||t[4]!==i||t[5]!==c?(l=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[s,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:c,placeholder:n.listSearchPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-label":n.listSearchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[3]=n.listSearchPlaceholder,t[4]=i,t[5]=c,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=()=>o(),t[7]=o,t[8]=u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(S,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=d):d=t[9];let f;t[10]!==n.addAgent||t[11]!==n.addAgentAria||t[12]!==r||t[13]!==u?(f=(0,Q.jsxs)(Y,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:u,children:[d,n.addAgent]}),t[10]=n.addAgent,t[11]=n.addAgentAria,t[12]=r,t[13]=u,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==f?(p=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[l,f]}),t[15]=l,t[16]=f,t[17]=p):p=t[17],p}function $n(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function er(e){let{agentId:t,enabled:n,saveRef:r}=e,i=T(async()=>{if(!t)return null;let[e,n]=await Promise.all([Re(t,`IDENTITY.md`).catch(()=>``),Re(t,`SOUL.md`).catch(()=>``)]),r=ce(e);return{identity:r,soulTemplate:W(n),soulCustomContent:n,identityBaseline:JSON.stringify(r),soulBaseline:n}},[t],{enabled:n&&!!t,initial:null,errorData:null}),a=i.data,o=i.loading,s=(0,$.useRef)(!1),[c,l]=(0,$.useState)(null),u=t??``,d=(0,$.useRef)(u);d.current!==u&&(d.current=u,s.current=!1,l(null));let f=c??(a?$n(a):null),p=(0,$.useMemo)(()=>f?JSON.stringify(f.identity)!==f.identityBaseline||f.soulCustomContent!==f.soulBaseline:!1,[f]),m=(0,$.useRef)(t);m.current=t;let h=(0,$.useCallback)(e=>{s.current=!0,l(t=>{let n=t??(a?$n(a):null);return n?e(n):null})},[a]),g=(0,$.useCallback)(e=>{h(t=>({...t,identity:{...t.identity,...e}}))},[h]),v=(0,$.useCallback)(e=>{h(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=_.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[h]),y=(0,$.useCallback)(e=>{h(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[h]),b=(0,$.useCallback)(e=>{h(t=>({...t,avatarDialogOpen:e}))},[h]),x=(0,$.useCallback)(()=>{h(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[h]),S=(0,$.useCallback)(async()=>{let e=m.current;!e||!f||(await Promise.all([xe(e,`IDENTITY.md`,A(f.identity)),xe(e,`SOUL.md`,f.soulCustomContent)]),s.current=!1,l(e=>{let t=e??f;return{...t,identityBaseline:JSON.stringify(t.identity),soulBaseline:t.soulCustomContent}}))},[f]);return(0,$.useLayoutEffect)(()=>{if(r)return r.current=S,()=>{r.current=null}},[S,r]),{profileMarkdownLoading:o,draft:f,dirty:p,updateIdentity:g,handleSoulTemplateChange:v,handleSoulContentChange:y,setAvatarDialogOpen:b,toggleSoulPreviewMode:x}}var tr={draft:``,editorNonce:0,loadedKey:``};function nr(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 rr(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=T(()=>n?Je(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`behavior`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,$.useState)(null),[p,m]=(0,$.useReducer)(nr,tr),[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 E=(0,$.useRef)(null),D=(0,$.useRef)(``),O=(0,$.useRef)(``),k=(0,$.useRef)(``),A=(0,$.useRef)(()=>{}),j=T(()=>d&&n?Re(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),M=j.loading,N=Ze(async()=>{let e=C.current,t=w.current;if(!e||!t||`${e}:${t}`!==D.current)return;let n=S.current;if(n!==O.current){g(!0),o(null);try{await xe(e,t,n),O.current=n,l(n=>!n||n.agentId!==e?n:{...n,files:n.files.map(e=>e.name===t?{...e,missing:!1}:e)})}catch(e){o(e instanceof Error?e.message:a)}finally{g(!1)}}},800);A.current=N.flush,(0,$.useEffect)(()=>()=>{A.current()},[]);let P=(0,$.useRef)(t);P.current!==t&&(P.current===`behavior`&&A.current(),P.current=t);let F=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{F!==k.current&&(A.current(),k.current=F)},[F]),(0,$.useEffect)(()=>{if(!F){m({type:`clear`});return}M||(D.current=F,O.current=j.data,m({type:`load`,key:F,content:j.data}))},[F,M,j.data]);let I=(0,$.useRef)({activeFile:d,selectedId:n});return(I.current.activeFile!==d||I.current.selectedId!==n)&&(I.current={activeFile:d,selectedId:n},v(`edit`)),{files:c,setFiles:l,filesLoading:u,activeFile:d,setActiveFile:(0,$.useCallback)(e=>{A.current(),f(e)},[]),fileDraft:b,setFileDraft:(0,$.useCallback)(e=>{m({type:`setDraft`,value:typeof e==`function`?e(S.current):e}),N()},[N]),fileSaving:h,filesViewMode:_,setFilesViewMode:v,profileFileLoading:M,profileEditorNonce:x,overviewSaveProfileMarkdownRef:E,saveProfileMarkdownDebounced:N}}function ir(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=T(()=>xt(),[t,n],{enabled:m,initial:[],errorData:[]}),g=h.data,_=h.loading,v=(0,$.useMemo)(()=>_||g.length===0?``:g[0]?.name??``,[g,_]),[y,b]=(0,$.useState)(``),x=(0,$.useRef)(v);t===`connections`&&!_&&v&&x.current!==v&&(!y||!g.some(e=>e.name===y))&&(x.current=v,b(v)),x.current=v;let S=y.trim(),C=m&&S.length>0,w=T(()=>St(S),[t,n,S],{enabled:C,initial:[],errorData:[]}),E=w.data,D=w.loading,O=w.setData,[k,A]=(0,$.useState)(null),[j,M]=(0,$.useState)(``),N=(0,$.useRef)(S);N.current!==S&&(N.current=S,A(null));let P=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),F=(0,$.useCallback)(()=>{let e=y.trim();e&&St(e).then(e=>{O(e),A(t=>t!=null&&t<e.length?t:null)}).catch(()=>{O([]),A(null)})},[y,O]),I=!_&&g.length===0,L=t===`connections`&&n&&i,ee=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await Me(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:P,allBindings:p,bindChannelStatuses:g,bindChannelsLoading:_,bindSessionChats:E,bindSessionsLoading:D,bindingsLoading:L,newBindChannel:y,setNewBindChannel:b,newBindSessionIdx:k,setNewBindSessionIdx:A,newBindCustomPeer:j,setNewBindCustomPeer:M,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!y.trim())return;let t=wt(y,j,k,E),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await Me(n),l.current=!0,d(n),A(null),M(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,E,y,j,k,o,a,s,c]),onRemoveBinding:ee,refreshBindSessions:F,useManualChannel:I}}function ar(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(cr)};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}=T(sr,s,d),m;n[10]===f?m=n[11]:(m=f.filter(or),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 or(e){return e.enabled!==!1}function sr(){return X()}function cr(e){return e+1}function lr(e){return ar(e.panel===`skills`,e.hasToken)}function ur(e){return new Set(e.tools.entryDisable)}function dr(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function fr(e){let{panel:t,selected:n}=e,r=`${t}:${n?.id??``}`,i=(0,$.useRef)(r),[a,o]=(0,$.useState)(()=>new Set),[s,c]=(0,$.useState)(()=>new Set),[l,u]=(0,$.useState)(!0),[d,f]=(0,$.useState)(()=>[]);if(i.current!==r){if(i.current=r,n&&t===`tools`&&o(ur(n)),n&&t===`skills`){let e=dr(n);u(e.inherit),c(e.pick)}n&&t===`behavior`&&f(Ot(n.typedModels.effective))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:f}}function pr(e,t){let n=e.typedModels.defaultRole;return{defaultRole:n,roles:{[n]:{model:t}}}}function mr(e){let t=Ot(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Ot(e.typedModels.effective)}function hr(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 gr(){let e=l(e=>e.language),t=a(e),n=t.agentsSettings,[r,i]=(0,$.useState)(!1),[s,c]=(0,$.useState)(null),[u,m]=(0,$.useState)(!1),[h,g]=(0,$.useState)(``),_=t.cron,v=t.chat,y=!!o(e=>e.token),[b,x]=P(),S=p(),{agentId:C}=Oe(),w=le(e=>e.setPageHeader),T=le(e=>e.clearPageHeader),{data:E,error:D,isLoading:O,mutate:k}=d(y?`settings-gateway-agents`:null,pe,{revalidateOnFocus:!1}),{data:A,mutate:j}=d(y?`settings-capability-presets`:null,Pt,{revalidateOnFocus:!1}),M=ct(y),{data:N}=M,F=(0,$.useMemo)(()=>_e(N?.payload?.config??{}),[N]),I=E??null,ee=(0,$.useMemo)(()=>I?I.agents.find(e=>e.id===I.defaultId)??I.agents[0]??null:null,[I]),te=!!(y&&O),[z,B]=(0,$.useState)(null),ne=D instanceof Error?D.message:D?n.loadError:null,V=z??ne,[re,ie]=(0,$.useState)(null),[H,U]=(0,$.useState)(`overview`),[W,G]=(0,$.useState)(``),[K,ae]=(0,$.useState)(``),[oe,se]=(0,$.useState)(``),[ce,ue]=(0,$.useState)(``),[fe,me]=(0,$.useState)(``),[q,he]=(0,$.useState)(null),[ge,ye]=(0,$.useState)(!1),be=(0,$.useRef)(``),[xe,Se]=(0,$.useState)(null),[Ce,J]=(0,$.useState)(!1),[we,Te]=(0,$.useState)(``),[Ee,De]=(0,$.useState)(``),[ke,Y]=(0,$.useState)(``),[Ae,je]=(0,$.useState)(``),[Me,Ne]=(0,$.useState)(``),[Pe,Ie]=(0,$.useState)(``),Le=(0,$.useRef)(null),[Re,ze]=(0,$.useState)(!1),Be=(0,$.useRef)({data:null,routeAgentId:void 0});I&&(I!==Be.current.data||C!==Be.current.routeAgentId)&&(Be.current={data:I,routeAgentId:C},C&&I.agents.some(e=>e.id===C)?ie(C):ie(e=>e&&I.agents.some(t=>t.id===e)?e:I.defaultId)),(0,$.useEffect)(()=>{!I||!C||I.agents.some(e=>e.id===C)||S(Fe,{replace:!0})},[I,C,S]),(0,$.useEffect)(()=>{C&&U(`overview`)},[C]),(0,$.useEffect)(()=>{b.get(`panel`)===`defaults`&&S(C?Ke(C):Fe,{replace:!0,state:{[L]:C?Ke(C):Fe}})},[b,C,S]),(0,$.useEffect)(()=>{if(b.get(`focus`)!==`avatar`||!C||(U(`overview`),te||!I?.agents.some(e=>e.id===C)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),x(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[b,C,te,I,x]);let X=(0,$.useMemo)(()=>I?.agents.find(e=>e.id===re)??null,[I,re]),Ve=(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]),He=(0,$.useMemo)(()=>!I||Ve&&I.agents.some(e=>e.id===Ve)?Ve:I.defaultId||I.agents[0]?.id||Ve,[I,Ve]),We=!!(I&&Ve&&!I.agents.some(e=>e.id===Ve));(0,$.useEffect)(()=>{De(We?``:Ve)},[Ve,We]);let Ge=(0,$.useRef)(null),qe=X?X.id:null;X&&Ge.current!==qe?(Ge.current=qe,Y(X.workspace),je(X.model?.primary??``),Ne(R(X,a(e).agentsSettings)),Ie(de(X,a(e).agentsSettings))):!X&&Ge.current!==null&&(Ge.current=null,Y(``),je(``),Ne(``),Ie(``));let Je=er({agentId:X?.id??null,enabled:H===`behavior`&&!!X,saveRef:Le}),Ye=rr({panel:H,selectedId:re,hasToken:y,dataAgentsLength:I?.agents.length,saveErrorMessage:n.saveError,setError:B}),Xe=fr({panel:H,selected:X}),Ze=ir({panel:H,hasToken:y,bindingsFromConfig:F,gatewayCfgLoading:N===void 0,selected:X,saveErrorMessage:n.saveError,setBusy:J,setError:B}),Qe=lr({panel:H,hasToken:y}),$e=(0,$.useCallback)(()=>{let e=Zn(K.trim()||W);ue(t=>t===``||t===be.current?(be.current=e,e):t)},[K,W]),et=(0,$.useCallback)(()=>{be.current=``,G(``),ae(``),se(``),ue(``),me(``),he(null),Se(null),ye(!0)},[]),nt=(0,$.useCallback)(e=>{let t=new Set(I?.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,I]),rt=(0,$.useCallback)(e=>{if(Se(e),!e)return;let t=I?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=nt(t.id),o=t.description??``;be.current=``,G(i),ae(a),se(o),ue(t.workspace),me(t.model?.primary??``),he(null)},[n.duplicateName,I,nt]),it=(0,$.useCallback)(e=>{rt(e),ye(!0)},[rt]),st=(0,$.useMemo)(()=>(0,Q.jsx)(Qn,{a:n,busy:Ce,listSearchQuery:we,onListSearchQueryChange:Te,onAddAgent:()=>et()}),[n,Ce,we,et]);(0,$.useLayoutEffect)(()=>y?(w({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title})}),end:st}),()=>T()):(T(),()=>T()),[n.title,st,T,y,w]);async function lt(t){t.preventDefault();let r=W.trim();if(!r)return;let i=ot(K,r);if(i.ok===!1){he(i.error);return}let a=ce.trim()||Zn(K.trim()||r);if(a){J(!0),he(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${oe.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
2
+ `),{createdAgentId:n,...i}=await f({workspace:a,...K.trim()?{id:K.trim()}:{},...fe.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:fe.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...xe?{cloneFrom:xe}:{}});k(i,{revalidate:!1}),G(``),ae(``),se(``),ue(``),me(``),he(null),ye(!1),ie(n),S(Ke(n))}catch(e){he(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function ut(){if(X){J(!0),B(null);try{k(await Ue(X.id,{workspace:ke.trim()||void 0,...Ae.trim()?{models:pr(X,Ae.trim())}:{}}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function dt(e){J(!0),B(null);try{k(await Ue(e.id,{setDefault:!0}),{revalidate:!1}),ie(e.id)}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function ft(){let e=Ee.trim().toLowerCase();if(e&&!I?.agents.some(t=>t.id===e)){B(n.tuiDefaultAgentInvalid);return}J(!0),B(null);try{await at(e||null),await M.mutate()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function pt(e){J(!0),B(null);try{await at(e.id),De(e.id),await M.mutate()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function mt(){J(!0),B(null);try{await at(null),De(``),await M.mutate()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function ht(e,t){J(!0),B(null);try{let n=await tt(e.id,t);k(n,{revalidate:!1}),ie(n.defaultId),U(`overview`),C===e.id&&S(Fe,{replace:!0}),i(!1),c(null),g(``)}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}function gt(e,t){e.id!==`main`&&(c(e),m(t),g(``),i(!0))}async function _t(){if(X){J(!0),B(null);try{k(await Ue(X.id,{tools:{builtin:hr(Xe.toolEntryDisable)}}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function vt(){if(X){J(!0),B(null);try{k(await Ue(X.id,{tools:null}),{revalidate:!1}),Xe.setToolEntryDisable(new Set)}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function yt(){if(!X)return;let e=Dt(Xe.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){B(e);return}J(!0),B(null);try{k(await Ue(X.id,{models:{roles:jt(Xe.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function bt(){if(!X)return;let e=mr(X),t=jt(e);if(!t?.roles?.[X.typedModels.defaultRole]){B(n.typedModelsInvalidModel);return}J(!0),B(null);try{k(await Ue(X.id,{models:{defaultRole:X.typedModels.defaultRole,roles:t.roles}}),{revalidate:!1}),Xe.setModelRows(e)}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function xt(){if(X){J(!0),B(null);try{k(await Ue(X.id,{skills:Xe.skillsInherit?null:[...Xe.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function St(e){if(X){J(!0),B(null);try{k(await Ue(X.id,{extends:e}),{revalidate:!1}),j()}catch(e){B(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}let Ct=H!==`behavior`,wt=(()=>{if(!X||H!==`behavior`)return!1;let e=X.workspace,t=X.model?.primary??``;return ke.trim()!==e||Ae.trim()!==t})(),Tt=(()=>{if(Ct||!X)return!1;switch(H){case`behavior`:return wt||Je.dirty;default:return!0}})(),Et=Ct||!Tt;function Ot(){ze(!0),setTimeout(()=>ze(!1),2e3)}async function kt(){switch(H){case`behavior`:await Promise.all([ut(),Le.current?.()??Promise.resolve()]),Ot();break;default:break}}function At(e){e||S(Fe)}let Mt=X?Me.trim()||R(X,n):C??``,Nt=X?.id??C??``,Ft=(0,$.useCallback)(async()=>{if(X){await kt(),Ye.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(ve,X.id)}catch{}S(`/chat/new`,{state:{agentId:X.id,fromAgentEditor:!0}})}},[X,kt,Ye.saveProfileMarkdownDebounced,S]),It={a:n,chat:v,cCron:_,selected:X,panel:H,data:I,busy:Ce,editName:Me,setEditName:Ne,editDescription:Pe,setEditDescription:Ie,editWorkspace:ke,setEditWorkspace:Y,editModel:Ae,setEditModel:je,defaultModel:ee?.model?.primary??``,defaultWorkspace:ee?.workspace??``,onSetDefault:()=>{X&&dt(X)},onSetTuiDefault:()=>{X&&pt(X)},isTuiDefault:!!(X&&X.id===He),isTuiDefaultInherited:!!(X&&X.id===He&&(!Ve||We)),onSaveAgentEdits:()=>void ut(),onDelete:e=>{X&&gt(X,e)},onTryInChat:()=>void Ft(),capabilityPresets:A?.presets??[],defaultPresetId:A?.defaultPresetId,onUpdateAgentExtends:e=>void St(e),onOpenCapabilityPreset:e=>{S(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewSaveProfileMarkdownRef:Le,overviewProfile:Je,filesLoading:Ye.filesLoading,files:Ye.files,activeFile:Ye.activeFile,setActiveFile:Ye.setActiveFile,filesViewMode:Ye.filesViewMode,setFilesViewMode:Ye.setFilesViewMode,fileDraft:Ye.fileDraft,setFileDraft:Ye.setFileDraft,fileSaving:Ye.fileSaving,profileFileLoading:Ye.profileFileLoading,profileEditorNonce:Ye.profileEditorNonce,toolEntryDisable:Xe.toolEntryDisable,setToolEntryDisable:Xe.setToolEntryDisable,onSaveTools:()=>void _t(),onClearToolsEntry:()=>void vt(),modelRows:Xe.modelRows,setModelRows:Xe.setModelRows,onSaveModels:()=>void yt(),onClearModelsEntry:()=>void bt(),skillsCatalogLoading:Qe.skillsCatalogLoading,catalogForPick:Qe.catalogForPick,skillsInherit:Xe.skillsInherit,setSkillsInherit:Xe.setSkillsInherit,skillsPick:Xe.skillsPick,setSkillsPick:Xe.setSkillsPick,onSaveSkills:()=>void xt(),bindingsLoading:Ze.bindingsLoading,agentBindings:Ze.agentBindings,bindChannelStatuses:Ze.bindChannelStatuses,bindChannelsLoading:Ze.bindChannelsLoading,useManualChannel:Ze.useManualChannel,newBindChannel:Ze.newBindChannel,setNewBindChannel:Ze.setNewBindChannel,bindSessionChats:Ze.bindSessionChats,bindSessionsLoading:Ze.bindSessionsLoading,newBindSessionIdx:Ze.newBindSessionIdx,setNewBindSessionIdx:Ze.setNewBindSessionIdx,newBindCustomPeer:Ze.newBindCustomPeer,setNewBindCustomPeer:Ze.setNewBindCustomPeer,refreshBindSessions:Ze.refreshBindSessions,onRemoveBinding:e=>void Ze.onRemoveBinding(e),onAddBinding:Ze.onAddBinding};return{hasToken:y,a:n,chat:v,language:e,data:I,savedTuiDefaultAgentId:Ve,effectiveTuiDefaultAgentId:He,tuiDefaultAgentDraft:Ee,setTuiDefaultAgentDraft:De,tuiDefaultAgentUnavailable:We,onSaveTuiDefaultAgent:ft,onSetTuiDefaultAgent:pt,onClearTuiDefaultAgent:mt,onSetDefaultAgent:dt,loading:te,displayError:V,navigate:S,routeAgentId:C,busy:Ce,listSearchQuery:we,openAddAgentModal:et,openDuplicateAgentModal:it,duplicateSourceId:xe,onSelectDuplicateSource:rt,panel:H,setPanel:U,modalTitle:Mt,modalSubtitle:Nt,footerSaveDisabled:Et,savedFlash:Re,handleModalFooterSave:kt,onAgentModalOpenChange:At,addAgentModalOpen:ge,setAddAgentModalOpen:ye,createWorkspaceSuggestedRef:be,createModalError:q,setCreateModalError:he,createDisplayName:W,setCreateDisplayName:G,createAgentId:K,setCreateAgentId:ae,createDescription:oe,setCreateDescription:se,createWorkspace:ce,setCreateWorkspace:ue,createModel:fe,setCreateModel:me,onCreate:lt,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:$e,deleteDialogOpen:r,setDeleteDialogOpen:i,deletePurge:u,deleteTarget:s,setDeleteTarget:c,deleteConfirmText:h,setDeleteConfirmText:g,performDelete:ht,editorPanelProps:It}}function _r(){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)(q,{className:`h-5 w-40`}),(0,Q.jsx)(q,{className:`h-3 w-64 max-w-full`})]}),(0,Q.jsx)(q,{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(vr)})]}),e[1]=n):n=e[1],n}function vr(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)(q,{className:`size-11 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(q,{className:`h-4 w-2/3`}),(0,Q.jsx)(q,{className:`mt-2 h-3 w-24`})]})]}),(0,Q.jsx)(q,{className:`mt-4 h-3 w-full`}),(0,Q.jsx)(q,{className:`mt-2 h-3 w-4/5`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(q,{className:`h-6 w-16 rounded-full`}),(0,Q.jsx)(q,{className:`h-6 w-20 rounded-full`})]})]},t)}function yr(){let e=gr();return e.hasToken?(0,Q.jsxs)(mt,{gap:`gap-6`,padding:`px-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[e.displayError?(0,Q.jsx)(`div`,{className:`rounded-lg bg-red-500/10 px-3 py-2 text-sm text-red-700 shadow-surface dark:text-red-300`,children:e.displayError}):null,e.loading?(0,Q.jsx)(_r,{}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(Kn,{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(Ke(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(ve,n)}catch{}e.navigate(`/chat/new`,{state:{agentId:n}})},busy:e.busy})}):null,e.routeAgentId&&e.hasToken?(0,Q.jsx)(Vt,{open:!!e.routeAgentId,onOpenChange:e.onAgentModalOpenChange,a:e.a,title:e.modalTitle,subtitle:e.modalSubtitle,panel:e.panel,onPanelChange:e.setPanel,onFooterSave:()=>void e.handleModalFooterSave(),footerSaveDisabled:e.footerSaveDisabled,footerSavedFlash:e.savedFlash,showFooter:e.panel===`behavior`,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(_r,{}):(0,Q.jsx)(Bn,{...e.editorPanelProps})}):null,(0,Q.jsx)(Jn,{open:e.addAgentModalOpen,onOpenChange:t=>{e.setAddAgentModalOpen(t),t||(e.createWorkspaceSuggestedRef.current=``,e.setCreateDisplayName(``),e.setCreateAgentId(``),e.setCreateDescription(``),e.setCreateWorkspace(``),e.setCreateModel(``),e.setCreateModalError(null),e.onSelectDuplicateSource(null))},a:e.a,chat:e.chat,busy:e.busy,modalError:e.createModalError,profileLanguageLabel:e.currentLanguageLabel,createDisplayName:e.createDisplayName,setCreateDisplayName:e.setCreateDisplayName,createAgentId:e.createAgentId,setCreateAgentId:e.setCreateAgentId,createDescription:e.createDescription,setCreateDescription:e.setCreateDescription,createWorkspace:e.createWorkspace,setCreateWorkspace:e.setCreateWorkspace,createModel:e.createModel,setCreateModel:e.setCreateModel,onCreate:e.onCreate,onSuggestWorkspace:()=>e.applyCreateWorkspaceSuggestion(),agents:e.data?.agents??[],duplicateSourceId:e.duplicateSourceId,onSelectDuplicateSource:e.onSelectDuplicateSource}),(0,Q.jsx)(Lt,{open:e.deleteDialogOpen,onOpenChange:t=>{e.setDeleteDialogOpen(t),t||(e.setDeleteTarget(null),e.setDeleteConfirmText(``))},busy:e.busy,deletePurge:e.deletePurge,deleteTarget:e.deleteTarget,deleteConfirmText:e.deleteConfirmText,onDeleteConfirmTextChange:e.setDeleteConfirmText,onConfirm:()=>{e.deleteTarget&&e.performDelete(e.deleteTarget,e.deletePurge)},onCancel:()=>e.setDeleteDialogOpen(!1),a:e.a})]}):(0,Q.jsxs)(mt,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,className:`min-h-full bg-surface-panel`,children:[(0,Q.jsx)(pt,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{yr as AgentsSettingsPanel};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-B-8CqAeX.js";import{n as o,o as s}from"./fetch-06q5eCMA.js";import{n as c}from"./locale-store-Ba72bFmP.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{Dt as u,Eo as d,Ga as f,Ha as p,Ic as m,Ja as h,Ka as g,Ps as _,Ua as v,Va as y,Wa as b,_a as x,ao as S,bo as C,go as w,oo as T}from"./index-ehajXmqL.js";import{n as E,t as D}from"./settings-page-layout-CEepfbCa.js";import{r as O}from"./settings-loading-skeleton-BXUeMR37.js";import{r as k,t as A}from"./settings-form-section-DGeEoBkb.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,M.useReducer)(u,L),{info:o,loadError:s,actionError:c,copiedField:l,clearDialogOpen:h,clearConfirmChecked:x,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await w(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(s)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:s});if(!o)return(0,N.jsx)(O,{rows:2});let H=!o.packaged,U=j||o.pendingUpdate||H,W=!H&&o.uninstallMode!==`unsupported`,G=I(o,t),K=x&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(_,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,c?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,o.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(o.appPath,`app`),children:[(0,N.jsx)(m,{className:`size-3`,"aria-hidden":!0}),l===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,C.press),onClick:()=>void z(o.dataPath,`data`),children:[(0,N.jsx)(m,{className:`size-3`,"aria-hidden":!0}),l===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(o.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,C.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(f,{open:h,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(b,{children:[(0,N.jsx)(v,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,T)}),(0,N.jsxs)(y,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,S,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(g,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(p,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:x,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(d,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(d,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j||!K,onClick:()=>void B(),children:t.confirmClear})]})]})]})}),W?(0,N.jsx)(f,{open:D,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(b,{children:[(0,N.jsx)(v,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,T)}),(0,N.jsxs)(y,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,S,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(g,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(p,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(d,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(d,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await o(s(`/api/migrations/status`))).payload}async function B(){await o(s(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=l(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function u(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(x,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(x,{className:`mt-2 h-4 w-64 max-w-full`})]});if(n)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:e.checkFailed})]});let f=t?.items??[],p=f.filter(e=>e.status===`conflict`||e.status===`error`),m=f.filter(e=>e.safety===`auto`&&e.status===`planned`),h=p.length>0||f.some(e=>e.safety!==`auto`);return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:f.length===0?e.upToDate:h?e.manualAttention:e.safeRepairs.replace(`{{count}}`,String(m.length))})]}),m.length>0&&!h?(0,N.jsx)(d,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void u(),disabled:a,children:a?e.applying:e.apply}):null]}),f.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:f.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=c(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!h()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
1
+ import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-BQ_8x0bT.js";import{t as a}from"./messages-BXNELNBa.js";import{n as o,o as s}from"./fetch-B1WtuprY.js";import{n as c}from"./locale-store-Ba72bFmP.js";import{i as l}from"./vendor-swr-BIWyz7Rc.js";import{Co as u,Dt as d,Ga as f,Ja as p,Ka as m,Ls as h,Wa as g,Ya as _,Za as v,ba as y,co as b,ko as x,lo as S,qa as C,yo as w,zc as T}from"./index-DcUaXYeb.js";import{n as E,t as D}from"./settings-page-layout-CKefvbYi.js";import{r as O}from"./settings-loading-skeleton-BxR-Ulhi.js";import{r as k,t as A}from"./settings-form-section-CvfzhBV-.js";var j=n(),M=e(t(),1),N=r();function P(e,t){return e==null?t:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function F(e,t){return e===`PENDING_UPDATE`?t.pendingUpdate??t.generic:e===`UNINSTALLER_NOT_FOUND`?t.uninstallerNotFound??t.generic:e===`NOT_PACKAGED`?t.notPackaged??t.generic:t.generic}function I(e,t){if(e.platform===`darwin`)return t.uninstallDescDarwin;if(e.platform===`win32`)return t.uninstallDescWin;if(e.platform===`linux`){if(e.linuxPackageKind===`appimage`)return t.uninstallDescLinuxAppImage;if(e.linuxPackageKind===`deb`){let n=e.linuxDebPackageName??`xopc`;return t.uninstallDescLinuxDeb.replace(/\{\{package\}\}/g,n)}return t.uninstallDescLinuxUnknown}return t.uninstallDescLinuxUnknown}var L={info:null,loadError:null,actionError:null,copiedField:null,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``,uninstallDialogOpen:!1,removeUserDataOnUninstall:!1,busy:!1};function R({api:e,messages:t,embedded:n=!0}){let[r,a]=(0,M.useReducer)(d,L),{info:o,loadError:s,actionError:c,copiedField:l,clearDialogOpen:v,clearConfirmChecked:y,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){a({type:`patch`,patch:{loadError:null}});try{a({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){a({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await w(e)){a({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>a({type:`patch`,patch:{copiedField:null}}),2e3);return}a({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){a({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||a({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){a({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{a({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(s)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:s});if(!o)return(0,N.jsx)(O,{rows:2});let H=!o.packaged,U=j||o.pendingUpdate||H,W=!H&&o.uninstallMode!==`unsupported`,G=I(o,t),K=y&&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)(h,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,c?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c}):null,H?(0,N.jsxs)(`div`,{className:`mb-4 rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,children:[(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.devOnlyTitle}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.devOnlyBody})]}):null,o.pendingUpdate?(0,N.jsx)(`p`,{className:`mb-3 rounded-xl border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-xs text-amber-800 dark:text-amber-200`,children:t.pendingUpdateBlocked}):null,(0,N.jsxs)(`dl`,{className:`space-y-3 text-sm`,children:[(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.appPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.appPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,u.press),onClick:()=>void z(o.appPath,`app`),children:[(0,N.jsx)(T,{className:`size-3`,"aria-hidden":!0}),l===`app`?t.copied:t.copyPath]})]})]}),(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,children:[(0,N.jsx)(`dt`,{className:`text-xs font-medium text-fg-muted`,children:t.dataPath}),(0,N.jsxs)(`dd`,{className:`mt-1 flex items-start justify-between gap-2`,children:[(0,N.jsx)(`code`,{className:`break-all text-xs text-fg`,children:o.dataPath}),(0,N.jsxs)(`button`,{type:`button`,className:i(`inline-flex shrink-0 items-center gap-1 rounded-lg border border-edge px-2 py-1 text-xs text-fg hover:bg-surface-hover`,u.press),onClick:()=>void z(o.dataPath,`data`),children:[(0,N.jsx)(T,{className:`size-3`,"aria-hidden":!0}),l===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(o.dataSizeBytes,t.dataSizeUnknown)]}),(0,N.jsx)(`p`,{className:`mt-2 text-xs leading-relaxed text-amber-800 dark:text-amber-200`,children:t.sharedDataWarning})]})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-3`,children:[(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.clearData}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.clearDataDesc})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-danger/40 bg-danger px-3 py-1.5 text-sm font-medium text-white hover:bg-danger/90 disabled:opacity-50`,u.press),onClick:()=>{a({type:`patch`,patch:{clearConfirmChecked:!1,clearConfirmText:``,clearDialogOpen:!0}})},children:t.clearData})]}),W?(0,N.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-xl bg-surface-panel/70 p-3 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.uninstall}),(0,N.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:G})]}),(0,N.jsx)(`button`,{type:`button`,disabled:U,className:i(`inline-flex shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base px-3 py-1.5 text-sm font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,u.press),onClick:()=>{a({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(p,{open:v,onOpenChange:e=>{e||a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(C,{children:[(0,N.jsx)(m,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(g,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(_,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(f,{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:y,onChange:e=>a({type:`patch`,patch:{clearConfirmChecked:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.clearDataConfirmCheckbox})]}),(0,N.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[(0,N.jsx)(`label`,{className:`block text-sm font-medium text-fg`,htmlFor:`clear-data-confirm`,children:t.clearDataConfirmLabel}),(0,N.jsx)(`input`,{id:`clear-data-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:i(`w-full rounded-md border border-edge bg-surface-panel px-3 py-1.5 font-mono text-xs text-fg`,`placeholder:text-fg-subtle`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2 focus-visible:ring-offset-surface-panel`,`dark:border-edge`),placeholder:t.clearDataConfirmPhrase,value:E,onChange:e=>a({type:`patch`,patch:{clearConfirmText:e.target.value}})}),(0,N.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.clearDataConfirmHint})]}),(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(x,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{a({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(x,{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)(p,{open:D,onOpenChange:e=>{e||a({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(C,{children:[(0,N.jsx)(m,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(g,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,b,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-popover outline-none dark:border-edge`),onOpenAutoFocus:e=>e.preventDefault(),children:[(0,N.jsx)(_,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(f,{className:`mt-2 text-sm text-fg-muted`,children:G}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:k,onChange:e=>a({type:`patch`,patch:{removeUserDataOnUninstall:e.target.checked}})}),(0,N.jsx)(`span`,{children:t.removeUserDataCheckbox})]}),k?(0,N.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.clearDataConfirmDesc}):null,(0,N.jsxs)(`div`,{className:`mt-6 flex justify-end gap-2`,children:[(0,N.jsx)(x,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>a({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(x,{type:`button`,variant:`secondary`,className:`border-danger/40 bg-danger text-white hover:bg-danger/90 dark:border-danger/40`,disabled:j,onClick:()=>void V(),children:t.confirmUninstall})]})]})]})}):null]})}async function z(){return(await o(s(`/api/migrations/status`))).payload}async function B(){await o(s(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=l(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function u(){o(!0),c(null);try{await B(),await i(),window.dispatchEvent(new CustomEvent(`config-reload`))}catch(e){c(e instanceof Error?e.message:String(e))}finally{o(!1)}}if(r)return(0,N.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,"aria-busy":`true`,children:[(0,N.jsx)(y,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(y,{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)(x,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void u(),disabled:a,children:a?e.applying:e.apply}):null]}),d.length>0?(0,N.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,N.jsxs)(`div`,{className:`rounded-xl bg-surface-base px-3 py-2`,children:[(0,N.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,N.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,N.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5 text-[11px] uppercase tracking-wide text-fg-muted`,children:e.status})]}),(0,N.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:e.message})]},e.id))}):null,s?(0,N.jsx)(`p`,{className:`mt-3 text-sm text-red-500`,children:s}):null]})}function H(){let e=(0,j.c)(28),t=c(U),n;e[0]===t?n=e[1]:(n=a(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,o=typeof window<`u`?window.electronAPI?.system:void 0;if(!v()||!o){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let s;e[18]===i.title?s=e[19]:(s=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=s);let l;e[20]===i.migrations?l=e[21]:(l=(0,N.jsx)(V,{messages:i.migrations}),e[20]=i.migrations,e[21]=l);let u;e[22]===i?u=e[23]:(u=(0,N.jsx)(R,{api:o,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==s||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[s,l,u]}),e[24]=s,e[25]=l,e[26]=u,e[27]=d):d=e[27],d}function U(e){return e.language}export{H as AppManagementSettingsPanel};
@@ -1 +1 @@
1
- import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-B-8CqAeX.js";import{n as i}from"./locale-store-Ba72bFmP.js";import{i as a}from"./theme-store-Bt6vAkSB.js";import{$a as o,bo as s,ot as c}from"./index-ehajXmqL.js";import{n as l,t as u}from"./settings-page-layout-CEepfbCa.js";import{t as d}from"./settings-advanced-gate-PmzVFvAv.js";var f=e(),p=t();function m(){return n(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var h={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function g(e){let t=(0,f.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,p.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,p.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let m;t[12]===o?m=t[13]:(m=(0,p.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,p.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,m,h]}),t[16]=c,t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,p.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function _(e){let t=(0,f.c)(8),{scheme:n}=e,{light:r,dark:i}=h[n],a;t[0]===r?a=t[1]:(a=(0,p.jsx)(g,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,p.jsx)(g,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,p.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var v=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function y(){let e=(0,f.c)(18),t=i(S),o;e[0]===t?o=e[1]:(o=r(t),e[0]=t,e[1]=o);let c=o.appearanceSettings,l=a(x),u=a(b),d;e[2]===c.colorSchemeTitle?d=e[3]:(d=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:c.colorSchemeTitle}),e[2]=c.colorSchemeTitle,e[3]=d);let m;e[4]===c.colorSchemeDescription?m=e[5]:(m=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.colorSchemeDescription}),e[4]=c.colorSchemeDescription,e[5]=m);let h;e[6]!==d||e[7]!==m?(h=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),e[6]=d,e[7]=m,e[8]=h):h=e[8];let g;e[9]!==c||e[10]!==l||e[11]!==u?(g=v.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>u(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,s.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,p.jsx)(_,{scheme:t}),(0,p.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:c[r]})]},t)}),e[9]=c,e[10]=l,e[11]=u,e[12]=g):g=e[12];let y;e[13]===g?y=e[14]:(y=(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:g}),e[13]=g,e[14]=y);let C;return e[15]!==h||e[16]!==y?(C=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 px-3 py-3.5 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=c(T),s=c(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===s?_=e[17]:(_=e=>s(e.target.checked),e[16]=s,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,s;e[2]!==a.pageTitle||e[3]!==a.subtitle?(s=(0,p.jsx)(l,{title:a.pageTitle,subtitle:a.subtitle}),e[2]=a.pageTitle,e[3]=a.subtitle,e[4]=s):s=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=m(),e[5]=c):c=e[5];let h;e[6]===a.languageTitle?h=e[7]:(h=(0,p.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[6]=a.languageTitle,e[7]=h);let g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,p.jsx)(o,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:c,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[9]=h,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=m(),e[11]=v):v=e[11];let b;e[12]===a.themeTitle?b=e[13]:(b=(0,p.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[12]=a.themeTitle,e[13]=b);let x,S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(o,{variant:`page`,sections:[`theme`,`font`]}),S=(0,p.jsx)(y,{}),e[14]=x,e[15]=S):(x=e[14],S=e[15]);let w;e[16]===b?w=e[17]:(w=(0,p.jsxs)(`section`,{className:v,"aria-labelledby":`pref-appearance-heading`,children:[b,x,S]}),e[16]=b,e[17]=w);let T;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(),e[18]=T):T=e[18];let E;e[19]===a.developerGroupTitle?E=e[20]:(E=(0,p.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[19]=a.developerGroupTitle,e[20]=E);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,p.jsx)(C,{}),e[21]=D):D=e[21];let k;e[22]===E?k=e[23]:(k=(0,p.jsx)(d,{children:(0,p.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[E,D]})}),e[22]=E,e[23]=k);let A;return e[24]!==s||e[25]!==w||e[26]!==k||e[27]!==_?(A=(0,p.jsxs)(u,{gap:`gap-6`,children:[s,_,w,k]}),e[24]=s,e[25]=w,e[26]=k,e[27]=_,e[28]=A):A=e[28],A}function O(e){return e.language}export{D as AppearanceSettingsPanel};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-BQ_8x0bT.js";import{t as r}from"./messages-BXNELNBa.js";import{n as i}from"./locale-store-Ba72bFmP.js";import{i as a}from"./theme-store-Bt6vAkSB.js";import{Co as o,no as s,ot as c}from"./index-DcUaXYeb.js";import{n as l,t as u}from"./settings-page-layout-CKefvbYi.js";import{t as d}from"./settings-advanced-gate-JVd0qaSF.js";var f=e(),p=t();function m(){return n(`rounded-xl bg-surface-base px-4 py-1 sm:px-5`)}var h={default:{light:{canvas:`#ffffff`,panel:`#fafafa`,accent:`#3a6bff`,fg:`#111111`,muted:`#ececec`},dark:{canvas:`#0a0a0a`,panel:`#121212`,accent:`#3a6bff`,fg:`#f5f5f5`,muted:`#222222`}},emerald:{light:{canvas:`#f0fdf4`,panel:`#ffffff`,accent:`#059669`,fg:`#052e16`,muted:`#86efac`},dark:{canvas:`#000000`,panel:`#0a0a0a`,accent:`#10b981`,fg:`#d1fae5`,muted:`#134e2a`}},mono:{light:{canvas:`#ffffff`,panel:`#f5f5f5`,accent:`#111111`,fg:`#111111`,muted:`#e5e7eb`},dark:{canvas:`#101010`,panel:`#1a1a1a`,accent:`#737373`,fg:`#fafafa`,muted:`#333333`}},clay:{light:{canvas:`#fffaf0`,panel:`#ffffff`,accent:`#1a3a3a`,fg:`#0a0a0a`,muted:`#e5e5e5`},dark:{canvas:`#0a1a1a`,panel:`#1a2a2a`,accent:`#ffb084`,fg:`#fffaf0`,muted:`#2a3a3a`}}};function g(e){let t=(0,f.c)(24),{canvas:n,panel:r,accent:i,fg:a,muted:o}=e,s;t[0]===n?s=t[1]:(s={backgroundColor:n},t[0]=n,t[1]=s);let c;t[2]!==o||t[3]!==r?(c={backgroundColor:r,borderColor:o},t[2]=o,t[3]=r,t[4]=c):c=t[4];let l;t[5]===i?l=t[6]:(l=(0,p.jsx)(`div`,{className:`size-1 shrink-0 rounded-full`,style:{backgroundColor:i}}),t[5]=i,t[6]=l);let u;t[7]===a?u=t[8]:(u=(0,p.jsx)(`div`,{className:`h-1 min-w-0 flex-1 rounded-full`,style:{backgroundColor:a,opacity:.85}}),t[7]=a,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,p.jsxs)(`div`,{className:`flex items-center gap-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let m;t[12]===o?m=t[13]:(m=(0,p.jsx)(`div`,{className:`h-1 w-2/3 max-w-[70%] rounded-full`,style:{backgroundColor:o}}),t[12]=o,t[13]=m);let h;t[14]===o?h=t[15]:(h=(0,p.jsx)(`div`,{className:`size-1/2 max-w-[55%] rounded-full`,style:{backgroundColor:o}}),t[14]=o,t[15]=h);let g;t[16]!==c||t[17]!==d||t[18]!==m||t[19]!==h?(g=(0,p.jsxs)(`div`,{className:`flex flex-col gap-0.5 rounded-sm border p-1`,style:c,children:[d,m,h]}),t[16]=c,t[17]=d,t[18]=m,t[19]=h,t[20]=g):g=t[20];let _;return t[21]!==s||t[22]!==g?(_=(0,p.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col justify-center gap-1 p-1.5`,style:s,children:g}),t[21]=s,t[22]=g,t[23]=_):_=t[23],_}function _(e){let t=(0,f.c)(8),{scheme:n}=e,{light:r,dark:i}=h[n],a;t[0]===r?a=t[1]:(a=(0,p.jsx)(g,{...r}),t[0]=r,t[1]=a);let o;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,p.jsx)(`div`,{className:`w-px shrink-0 bg-black/12 dark:bg-white/12`,"aria-hidden":!0}),t[2]=o):o=t[2];let s;t[3]===i?s=t[4]:(s=(0,p.jsx)(g,{...i}),t[3]=i,t[4]=s);let c;return t[5]!==a||t[6]!==s?(c=(0,p.jsxs)(`div`,{className:`flex h-11 w-full overflow-hidden rounded-md border border-edge-subtle`,children:[a,o,s]}),t[5]=a,t[6]=s,t[7]=c):c=t[7],c}var v=[{value:`default`,labelKey:`colorSchemeDefault`},{value:`emerald`,labelKey:`colorSchemeLightGreen`},{value:`mono`,labelKey:`colorSchemeModernMono`},{value:`clay`,labelKey:`colorSchemeClay`}];function y(){let e=(0,f.c)(18),t=i(S),s;e[0]===t?s=e[1]:(s=r(t),e[0]=t,e[1]=s);let c=s.appearanceSettings,l=a(x),u=a(b),d;e[2]===c.colorSchemeTitle?d=e[3]:(d=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:c.colorSchemeTitle}),e[2]=c.colorSchemeTitle,e[3]=d);let m;e[4]===c.colorSchemeDescription?m=e[5]:(m=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:c.colorSchemeDescription}),e[4]=c.colorSchemeDescription,e[5]=m);let h;e[6]!==d||e[7]!==m?(h=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[d,m]}),e[6]=d,e[7]=m,e[8]=h):h=e[8];let g;e[9]!==c||e[10]!==l||e[11]!==u?(g=v.map(e=>{let{value:t,labelKey:r}=e,i=l===t;return(0,p.jsxs)(`button`,{type:`button`,"aria-pressed":i,onClick:()=>u(t),className:n(`flex flex-col gap-2 rounded-xl border-2 p-2.5 text-left transition-[border-color,box-shadow,transform] duration-150`,o.pressCard,i?`border-accent shadow-[0_0_0_1px_var(--color-accent)]`:`border-edge-subtle hover:border-edge`),children:[(0,p.jsx)(_,{scheme:t}),(0,p.jsx)(`span`,{className:n(`text-xs font-medium leading-none`,i?`text-accent-fg`:`text-fg-muted`),children:c[r]})]},t)}),e[9]=c,e[10]=l,e[11]=u,e[12]=g):g=e[12];let y;e[13]===g?y=e[14]:(y=(0,p.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:g}),e[13]=g,e[14]=y);let C;return e[15]!==h||e[16]!==y?(C=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/50 px-3 py-3.5 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=c(T),s=c(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===s?_=e[17]:(_=e=>s(e.target.checked),e[16]=s,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o;e[2]!==a.pageTitle||e[3]!==a.subtitle?(o=(0,p.jsx)(l,{title:a.pageTitle,subtitle:a.subtitle}),e[2]=a.pageTitle,e[3]=a.subtitle,e[4]=o):o=e[4];let c;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=m(),e[5]=c):c=e[5];let h;e[6]===a.languageTitle?h=e[7]:(h=(0,p.jsx)(`h2`,{id:`pref-language-heading`,className:`sr-only`,children:a.languageTitle}),e[6]=a.languageTitle,e[7]=h);let g;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,p.jsx)(s,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:c,"aria-labelledby":`pref-language-heading`,children:[h,g]}),e[9]=h,e[10]=_);let v;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(v=m(),e[11]=v):v=e[11];let b;e[12]===a.themeTitle?b=e[13]:(b=(0,p.jsx)(`h2`,{id:`pref-appearance-heading`,className:`sr-only`,children:a.themeTitle}),e[12]=a.themeTitle,e[13]=b);let x,S;e[14]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,p.jsx)(s,{variant:`page`,sections:[`theme`,`font`]}),S=(0,p.jsx)(y,{}),e[14]=x,e[15]=S):(x=e[14],S=e[15]);let w;e[16]===b?w=e[17]:(w=(0,p.jsxs)(`section`,{className:v,"aria-labelledby":`pref-appearance-heading`,children:[b,x,S]}),e[16]=b,e[17]=w);let T;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(),e[18]=T):T=e[18];let E;e[19]===a.developerGroupTitle?E=e[20]:(E=(0,p.jsx)(`h2`,{id:`pref-developer-heading`,className:`sr-only`,children:a.developerGroupTitle}),e[19]=a.developerGroupTitle,e[20]=E);let D;e[21]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,p.jsx)(C,{}),e[21]=D):D=e[21];let k;e[22]===E?k=e[23]:(k=(0,p.jsx)(d,{children:(0,p.jsxs)(`section`,{className:T,"aria-labelledby":`pref-developer-heading`,children:[E,D]})}),e[22]=E,e[23]=k);let A;return e[24]!==o||e[25]!==w||e[26]!==k||e[27]!==_?(A=(0,p.jsxs)(u,{gap:`gap-6`,children:[o,_,w,k]}),e[24]=o,e[25]=w,e[26]=k,e[27]=_,e[28]=A):A=e[28],A}function O(e){return e.language}export{D as AppearanceSettingsPanel};