@xopcai/xopc 0.0.166 → 0.0.167

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 (136) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/feishu/src/outbound/media-load.js +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{activity-store-DkALQFJT.js → activity-store-DjEDu38T.js} +1 -1
  5. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Tr2hgn4j.js → agent-avatar-dicebear-DQULz7qY.js} +1 -1
  6. package/dist/gateway/static/root/assets/agents-CnzkBgKC.js +2 -0
  7. package/dist/gateway/static/root/assets/{api-DPIXEcIq.js → api-DwVCuPOb.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-D7Nrbhez.js → app-management-settings-panel-DOjWALVF.js} +1 -1
  9. package/dist/gateway/static/root/assets/{appearance-settings-DNNbABFj.js → appearance-settings-C31COUIC.js} +1 -1
  10. package/dist/gateway/static/root/assets/{apps-page-0zXIeywq.js → apps-page-lSC486eu.js} +1 -1
  11. package/dist/gateway/static/root/assets/{archive-plugin-CizqFy4G.js → archive-plugin-DQPvLqfx.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-DU8KjTua.js → attachment-load-DwT1x1rc.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automation-suggestion-card-3pqyIveW.js → automation-suggestion-card-ByYBiiMR.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-DSz3xDsi.js → automations-page-iZTnc1YZ.js} +1 -1
  15. package/dist/gateway/static/root/assets/{binary-plugins-CipUnsOr.js → binary-plugins-CRXiHoZS.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-XoEq6qiv.js → block-editor-CHO6ILiz.js} +1 -1
  17. package/dist/gateway/static/root/assets/{browser-settings-page-COYvq3y5.js → browser-settings-page-C-OOPZcJ.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-workflow-inputs-DRH995XI.js → browser-workflow-inputs-3UaarfXS.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-workflows-page-65edjhpz.js → browser-workflows-page-BFaa-N_D.js} +1 -1
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-BayH0Uom.js +7 -0
  21. package/dist/gateway/static/root/assets/capability-presets-api-DdCHSzcA.js +1 -0
  22. package/dist/gateway/static/root/assets/capability-presets-settings-panel-JlhjAhT7.js +2 -0
  23. package/dist/gateway/static/root/assets/{channel-recipient-api-B5rLegwk.js → channel-recipient-api-BOkLI89e.js} +1 -1
  24. package/dist/gateway/static/root/assets/{channels-settings-D8nH0mve.js → channels-settings-C-Spmwr5.js} +1 -1
  25. package/dist/gateway/static/root/assets/channels-status-swr-ZrqadU60.js +1 -0
  26. package/dist/gateway/static/root/assets/{connector-logo-n4Hg41iD.js → connector-logo-CbcC0T6i.js} +1 -1
  27. package/dist/gateway/static/root/assets/{connectors-page-jvRWZn3Y.js → connectors-page-DpDmJ3Nx.js} +1 -1
  28. package/dist/gateway/static/root/assets/{desktop-pet-D4OzBOwm.js → desktop-pet-CR7RGQff.js} +1 -1
  29. package/dist/gateway/static/root/assets/{desktop-pet-settings-CDGezbaf.js → desktop-pet-settings-BudmCcPE.js} +1 -1
  30. package/dist/gateway/static/root/assets/{directory-picker-path-field-DmL4AUXQ.js → directory-picker-path-field-BLG2Oe6z.js} +1 -1
  31. package/dist/gateway/static/root/assets/{dreaming-settings-ClUcBKnd.js → dreaming-settings-BwBGC0SG.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-DsV_KUDM.js → extension-debug-page-Pr65_hLC.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-DJv_G1jY.js → extension-page-BuJDcoKn.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-settings-page-DUAlJ4CU.js → extension-settings-page-B3802tn5.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-config-api-SVYgzqv7.js → gateway-config-api-D-NVkfts.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-settings-YL6f2C_F.js → gateway-settings-DIdsKVXv.js} +1 -1
  37. package/dist/gateway/static/root/assets/{gateway-startup-retry-ulwTJovP.js → gateway-startup-retry-qnEmj-vL.js} +1 -1
  38. package/dist/gateway/static/root/assets/{goal-create-dialog-CJJe-4Co.js → goal-create-dialog-51j_DxgV.js} +1 -1
  39. package/dist/gateway/static/root/assets/{goal-detail-page-Da9VMWRd.js → goal-detail-page-CeqMr5GF.js} +1 -1
  40. package/dist/gateway/static/root/assets/{goals-config-api-st_Itxa9.js → goals-config-api-BkVBh7ct.js} +1 -1
  41. package/dist/gateway/static/root/assets/{goals-page-B6pC7PYZ.js → goals-page-lf3oM4Xa.js} +1 -1
  42. package/dist/gateway/static/root/assets/{goals-settings-BEZePZ5m.js → goals-settings-Cg7MJLvx.js} +1 -1
  43. package/dist/gateway/static/root/assets/{heartbeat-settings-DpeD9GQ9.js → heartbeat-settings-BV3kJOcX.js} +1 -1
  44. package/dist/gateway/static/root/assets/{index-BhQMnKH1.js → index-B24B26og.js} +9 -9
  45. package/dist/gateway/static/root/assets/index-DfE2j0g8.css +1 -0
  46. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-B9K5rTZZ.js +1 -0
  47. package/dist/gateway/static/root/assets/{local-app-workbench-page-Ctia6lSG.js → local-app-workbench-page-ehzr9CBG.js} +1 -1
  48. package/dist/gateway/static/root/assets/{local-apps-page-DWF9rpWQ.js → local-apps-page-BBx6mfAD.js} +1 -1
  49. package/dist/gateway/static/root/assets/locale-store-tnRLWdx2.js +1 -0
  50. package/dist/gateway/static/root/assets/{logs-page-D3gL6vHX.js → logs-page-xuwEkusZ.js} +1 -1
  51. package/dist/gateway/static/root/assets/{markdown-split-BuduJ0Ev.js → markdown-split-DRDddIt8.js} +1 -1
  52. package/dist/gateway/static/root/assets/{media-plugins-CLASZjhT.js → media-plugins-Dn3hxhOV.js} +1 -1
  53. package/dist/gateway/static/root/assets/{messages-C96Zjb0V.js → messages-B1EG4gdu.js} +2 -4
  54. package/dist/gateway/static/root/assets/{notes-page-ve3XiBDF.js → notes-page-BtKHSb4z.js} +1 -1
  55. package/dist/gateway/static/root/assets/{notes-workbench-oHU532lp.js → notes-workbench-DXGXn5XF.js} +2 -2
  56. package/dist/gateway/static/root/assets/{page-tabs-DU85jn98.js → page-tabs-P2BEd1D8.js} +1 -1
  57. package/dist/gateway/static/root/assets/{preview-open-alternatives-CtchTuRQ.js → preview-open-alternatives-DrkjmW0F.js} +1 -1
  58. package/dist/gateway/static/root/assets/{product-open-page-DFT6Fx6y.js → product-open-page-CGzMEowb.js} +1 -1
  59. package/dist/gateway/static/root/assets/{project-detail-page-Ceu0NoC1.js → project-detail-page-IiE2ddWb.js} +1 -1
  60. package/dist/gateway/static/root/assets/{projects-page-CdpqOmO8.js → projects-page-DGOVhaYI.js} +1 -1
  61. package/dist/gateway/static/root/assets/{remote-access-hub-D1NKLyiR.js → remote-access-hub-l_y_Shgl.js} +1 -1
  62. package/dist/gateway/static/root/assets/{save-bar-controls-CmcrHpMc.js → save-bar-controls-BkGrufxl.js} +1 -1
  63. package/dist/gateway/static/root/assets/{schedule-field-DmIkP6JV.js → schedule-field-A8tDpL-9.js} +1 -1
  64. package/dist/gateway/static/root/assets/{schema-form-Dkk9blN0.js → schema-form-N6_hDWgx.js} +1 -1
  65. package/dist/gateway/static/root/assets/{sessions-page-CMj_JaOk.js → sessions-page-CAX4ipPv.js} +1 -1
  66. package/dist/gateway/static/root/assets/settings-advanced-gate-eVlH9brU.js +1 -0
  67. package/dist/gateway/static/root/assets/{settings-form-section-CuQzWvg5.js → settings-form-section-Bb6yYt5f.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-loading-skeleton-C5FNbyej.js → settings-loading-skeleton-Q_Vh6HEl.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-page-a-A2yTGE.js → settings-page-CjOtQpbR.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-page-layout-MuXpamWD.js → settings-page-layout-CtESNNdx.js} +1 -1
  71. package/dist/gateway/static/root/assets/{setup-status-panel-BUdh8FKY.js → setup-status-panel-CGxHXgJB.js} +1 -1
  72. package/dist/gateway/static/root/assets/{share-preview-page-BfzzmTgg.js → share-preview-page-C65IsFmd.js} +1 -1
  73. package/dist/gateway/static/root/assets/{shares-settings-8a9qnLF8.js → shares-settings-Ct3fcbHr.js} +1 -1
  74. package/dist/gateway/static/root/assets/skill-reload-api-ElA5kabh.js +1 -0
  75. package/dist/gateway/static/root/assets/{skills-page-CmHj-CKY.js → skills-page-FeieOEn3.js} +1 -1
  76. package/dist/gateway/static/root/assets/{system-settings-panel-CyhRkWMi.js → system-settings-panel-CdUl2I0D.js} +1 -1
  77. package/dist/gateway/static/root/assets/{theme-store-D37XLD_C.js → theme-store-H9T49Iar.js} +1 -1
  78. package/dist/gateway/static/root/assets/{time-picker-WEPp3HrB.js → time-picker-EkhqT3fS.js} +1 -1
  79. package/dist/gateway/static/root/assets/{typed-models-lib-Bi1uoxFR.js → typed-models-lib-5xRRUE9Y.js} +1 -1
  80. package/dist/gateway/static/root/assets/{use-channel-catalog-DBh0dOC9.js → use-channel-catalog-UACJTyH0.js} +1 -1
  81. package/dist/gateway/static/root/assets/{user-context-page-BObEyiim.js → user-context-page-DHiRvd4i.js} +1 -1
  82. package/dist/gateway/static/root/assets/{voice-api-key-field-Gvgodhec.js → voice-api-key-field-Bql0SPCp.js} +1 -1
  83. package/dist/gateway/static/root/assets/{work-discovery-page-BHnjvGH1.js → work-discovery-page-BcmZux7y.js} +1 -1
  84. package/dist/gateway/static/root/assets/{work-item-detail-page-CQ8ybkxx.js → work-item-detail-page-D94Q5zVD.js} +1 -1
  85. package/dist/gateway/static/root/assets/{work-page-D_U_En23.js → work-page-DdFBMDcB.js} +1 -1
  86. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-B-Sk6gFn.js → workflow-run-setup-panel-Dow7ZztR.js} +1 -1
  87. package/dist/gateway/static/root/assets/{workflows-page-DT0pzfkz.js → workflows-page-wOVSoduy.js} +1 -1
  88. package/dist/gateway/static/root/index.html +8 -8
  89. package/dist/package.js +1 -1
  90. package/dist/src/agent/image/generation/custom-openai-images-provider.d.ts +7 -0
  91. package/dist/src/agent/image/generation/custom-openai-images-provider.js +81 -0
  92. package/dist/src/agent/image/generation/{openai-compatible-image-provider.d.ts → openai-images-provider.d.ts} +10 -31
  93. package/dist/src/agent/image/generation/{openai-compatible-image-provider.js → openai-images-provider.js} +36 -23
  94. package/dist/src/agent/image/generation/provider-registry.d.ts +2 -0
  95. package/dist/src/agent/image/generation/provider-registry.js +50 -4
  96. package/dist/src/agent/image/generation/providers/openai.js +2 -2
  97. package/dist/src/agent/image/generation/runtime.js +5 -1
  98. package/dist/src/agent/image/generation/types.d.ts +11 -0
  99. package/dist/src/cli/commands/channels.js +1 -1
  100. package/dist/src/cli/commands/connectors.js +1 -1
  101. package/dist/src/cli/commands/doctor/checks/image-providers.d.ts +2 -0
  102. package/dist/src/cli/commands/doctor/checks/image-providers.js +68 -0
  103. package/dist/src/cli/commands/doctor/flow.js +2 -0
  104. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  105. package/dist/src/cli/commands/models.js +1 -1
  106. package/dist/src/cli/commands/onboard.js +1 -1
  107. package/dist/src/config/index.js +2 -2
  108. package/dist/src/config/models-json.d.ts +325 -0
  109. package/dist/src/config/models-json.js +139 -4
  110. package/dist/src/extensions/sdk/index.js +1 -1
  111. package/dist/src/gateway/custom-image-providers.d.ts +89 -0
  112. package/dist/src/gateway/custom-image-providers.js +59 -0
  113. package/dist/src/gateway/heartbeat/service.js +1 -1
  114. package/dist/src/gateway/hono/routes/models.js +182 -1
  115. package/dist/src/gateway/hono/routes/workflows.js +1 -1
  116. package/dist/src/gateway/image-generation-setup.js +7 -1
  117. package/dist/src/gateway/service/config-coordinator.js +2 -0
  118. package/dist/src/gateway/service.js +2 -2
  119. package/dist/src/heartbeat/index.js +1 -1
  120. package/dist/src/media-shared/http/index.d.ts +1 -1
  121. package/dist/src/media-shared/http/index.js +2 -2
  122. package/dist/src/media-shared/http/provider-http.d.ts +2 -0
  123. package/dist/src/media-shared/http/provider-http.js +43 -4
  124. package/dist/src/providers/model-reference-auditor.d.ts +1 -0
  125. package/dist/src/providers/model-reference-auditor.js +23 -13
  126. package/package.json +2 -2
  127. package/dist/gateway/static/root/assets/agents-DZ69tC4K.js +0 -2
  128. package/dist/gateway/static/root/assets/capabilities-settings-panel-LOQyfdsM.js +0 -2
  129. package/dist/gateway/static/root/assets/capability-presets-api-XL4h7dCK.js +0 -1
  130. package/dist/gateway/static/root/assets/capability-presets-settings-panel-KPJFkt1h.js +0 -2
  131. package/dist/gateway/static/root/assets/channels-status-swr-DZZq0upi.js +0 -1
  132. package/dist/gateway/static/root/assets/index-BXtJvaQl.css +0 -1
  133. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-fhssr2-J.js +0 -1
  134. package/dist/gateway/static/root/assets/locale-store-C_ax27uc.js +0 -1
  135. package/dist/gateway/static/root/assets/settings-advanced-gate-DR9Q2ZyF.js +0 -1
  136. package/dist/gateway/static/root/assets/skill-reload-api-da5gLCer.js +0 -1
@@ -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{d as i,l as a,t as o,u as s}from"./chunk-KS7C4IRE-uQ0fehio.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-B1EG4gdu.js";import{l as u,n as d}from"./locale-store-tnRLWdx2.js";import{i as f}from"./theme-store-H9T49Iar.js";import{i as p}from"./vendor-swr-BIWyz7Rc.js";import{Ac as m,Bi as h,Br as g,Ca as _,Cu as v,Da as y,Ds as b,Ea as x,Ec as S,Es as C,Eu as w,Gl as T,Go as E,Gr as D,Gs as O,H as k,Hi as A,Hr as j,Hs as M,Ir as N,Is as P,It as F,Iu as I,Ja as L,Jo as ee,Jr as R,Js as z,Kl as B,Ko as te,Kr as ne,Lr as re,Ls as ie,Ms as ae,Mu as V,Nc as H,Nl as U,Ns as W,Ou as G,Qc as K,Ri as q,Rl as oe,Rr as se,Rt as ce,Sa as le,Ta as ue,To as de,Ui as fe,Ul as pe,Uo as me,Ur as he,V as ge,Vi as _e,Vr as ve,Wi as ye,Wo as be,Wr as xe,Ws as Se,Xn as Ce,Xr as we,Yo as Te,Yr as Ee,Ys as De,Zn as Oe,Zr as ke,_l as Ae,_n as J,_s as je,ba as Me,cs as Ne,dc as Pe,dl as Fe,dn as Ie,es as Le,gc as Re,gn as ze,gs as Be,hs as Ve,js as He,lc as Ue,ls as We,ms as Ge,n as Ke,no as qe,ns as Je,os as Y,pn as Ye,ps as Xe,qi as Ze,qo as Qe,qr as $e,r as et,ro as tt,sc as nt,ul as X,vn as rt,vs as it,wa as at,wo as ot,xa as st,xu as ct,ya as lt,yc as ut,ys as dt,zc as ft,zi as pt,zr as mt}from"./index-B24B26og.js";import{t as ht}from"./markdown-editor-BvUebh3C.js";import{n as gt,r as _t}from"./settings-page-layout-CtESNNdx.js";import{r as vt,t as yt}from"./settings-loading-skeleton-Q_Vh6HEl.js";import{n as bt,t as xt}from"./settings-form-section-Bb6yYt5f.js";import{t as St}from"./page-tabs-P2BEd1D8.js";import{n as Ct}from"./agent-avatar-dicebear-DQULz7qY.js";import{a as wt,o as Tt,r as Et}from"./capability-presets-api-DdCHSzcA.js";import{a as Dt,i as Ot,n as kt,o as At,s as jt,t as Mt}from"./typed-models-lib-5xRRUE9Y.js";import{n as Nt,r as Pt,t as Ft}from"./channel-recipient-api-BOkLI89e.js";import{t as It}from"./directory-picker-path-field-BLG2Oe6z.js";var Z=n(),Q=r();function Lt(e){let t=(0,Z.c)(40),{open:n,onOpenChange:r,busy:i,deletePurge:a,deleteTarget:o,deleteConfirmText:s,onDeleteConfirmTextChange:l,onConfirm:u,onCancel:d,a:f}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(Qe,{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=c(`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=a?f.purgeDisk:f.removeFromConfig,g;t[2]===h?g=t[3]:(g=(0,Q.jsx)(Te,{className:`text-base font-semibold text-fg`,children:h}),t[2]=h,t[3]=g);let _=a?f.confirmDeletePurge:f.confirmDelete,v;t[4]===_?v=t[5]:(v=(0,Q.jsx)(te,{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]!==s||t[10]!==a||t[11]!==o||t[12]!==l?(y=a&&o?(0,Q.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Q.jsx)(`label`,{className:`mb-2 block text-sm font-medium text-fg`,htmlFor:`agent-delete-confirm`,children:f.purgeConfirmLabel}),(0,Q.jsx)(`input`,{id:`agent-delete-confirm`,type:`text`,autoComplete:`off`,spellCheck:!1,className:c(`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}}`,o.id),value:s,onChange:e=>l(e.target.value)}),(0,Q.jsx)(`p`,{className:`pt-0.5 text-xs text-fg-muted`,children:f.purgeConfirmHint.replace(`{{agentId}}`,o.id)})]}):null,t[6]=f.purgeConfirmHint,t[7]=f.purgeConfirmLabel,t[8]=f.purgeConfirmPlaceholder,t[9]=s,t[10]=a,t[11]=o,t[12]=l,t[13]=y):y=t[13];let b;t[14]!==f.createModalCancel||t[15]!==i||t[16]!==d?(b=(0,Q.jsx)(W,{type:`button`,variant:`ghost`,disabled:i,onClick:d,children:f.createModalCancel}),t[14]=f.createModalCancel,t[15]=i,t[16]=d,t[17]=b):b=t[17];let x=a?`border-red-200 text-red-700 hover:bg-red-50 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/40`:void 0,S;t[18]!==i||t[19]!==s||t[20]!==a||t[21]!==o?(S=i||!o||a&&s.trim().toLowerCase()!==o.id.toLowerCase(),t[18]=i,t[19]=s,t[20]=a,t[21]=o,t[22]=S):S=t[22];let C=a?f.purgeDisk:f.removeFromConfig,w;t[23]!==u||t[24]!==S||t[25]!==C||t[26]!==x?(w=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:x,disabled:S,onClick:u,children:C}),t[23]=u,t[24]=S,t[25]=C,t[26]=x,t[27]=w):w=t[27];let T;t[28]!==w||t[29]!==b?(T=(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,w]}),t[28]=w,t[29]=b,t[30]=T):T=t[30];let D;t[31]!==T||t[32]!==g||t[33]!==v||t[34]!==y?(D=(0,Q.jsxs)(ee,{children:[p,(0,Q.jsxs)(E,{className:m,onOpenAutoFocus:Rt,children:[g,v,y,T]})]}),t[31]=T,t[32]=g,t[33]=v,t[34]=y,t[35]=D):D=t[35];let O;return t[36]!==r||t[37]!==n||t[38]!==D?(O=(0,Q.jsx)(me,{open:n,onOpenChange:r,children:D}),t[36]=r,t[37]=n,t[38]=D,t[39]=O):O=t[39],O}function Rt(e){return e.preventDefault()}var $=e(t(),1),zt=[{id:`overview`,labelKey:`navOverview`,icon:U},{id:`profile`,labelKey:`navProfile`,icon:Ue},{id:`capabilities`,labelKey:`navCapabilities`,icon:w},{id:`runtime`,labelKey:`navRuntime`,icon:Re},{id:`connections`,labelKey:`navConnections`,icon:ct},{id:`advanced`,labelKey:`navAdvanced`,icon:Pe},{id:`dangerZone`,labelKey:`navDangerZone`,icon:z}];function Bt(e){let t=(0,Z.c)(11),{a:n,panel:r,onPanelChange:i}=e,a;t[0]!==i||t[1]!==r?(a=(e,t,n)=>(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>i(e),className:c(`flex w-auto shrink-0 items-center gap-2.5 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors sm:w-full`,b.press,r===e?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover hover:text-fg`),children:[(0,Q.jsx)(n,{className:`size-4 shrink-0 opacity-90`,strokeWidth:2,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]},e),t[0]=i,t[1]=r,t[2]=a):a=t[2];let o=a,s=n.editorNavAria,l;t[3]!==n||t[4]!==o?(l=zt.map(e=>{let{id:t,labelKey:r,icon:i}=e;return o(t,n[r],i)}),t[3]=n,t[4]=o,t[5]=l):l=t[5];let u;t[6]===l?u=t[7]:(u=(0,Q.jsx)(`div`,{className:`flex gap-1 pb-1 sm:flex-col sm:gap-0.5 sm:pb-0`,children:l}),t[6]=l,t[7]=u);let d;return t[8]!==n.editorNavAria||t[9]!==u?(d=(0,Q.jsx)(`nav`,{className:`w-full overflow-x-auto sm:overflow-visible`,"aria-label":s,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:i,title:a,subtitle:o,panel:s,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)(Qe,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Ge)}),t[0]=y):y=t[0];let b;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(b=c(`xopc-dialog-content fixed flex flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover dark:border-edge`,Xe,`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]===a?x=t[3]:(x=(0,Q.jsx)(Te,{className:`text-base font-semibold leading-snug text-fg`,children:a}),t[2]=a,t[3]=x);let S;t[4]===o?S=t[5]:(S=(0,Q.jsx)(te,{className:`mt-1 font-mono text-xs text-fg-muted`,children:o}),t[4]=o,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=c(C,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=T):T=t[9];let D;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[10]=D):D=t[10];let O;t[11]===i.closeDialogAria?O=t[12]:(O=(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:T,"aria-label":i.closeDialogAria,children:D})}),t[11]=i.closeDialogAria,t[12]=O);let k;t[13]!==w||t[14]!==O?(k=(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,O]}),t[13]=w,t[14]=O,t[15]=k):k=t[15];let A;t[16]!==i||t[17]!==l||t[18]!==s?(A=(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:i,panel:s,onPanelChange:l})}),t[16]=i,t[17]=l,t[18]=s,t[19]=A):A=t[19];let j;t[20]===h?j=t[21]:(j=(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]=j);let M;t[22]!==i.footerSaveNotApplicable||t[23]!==i.personaSaved||t[24]!==i.save||t[25]!==m||t[26]!==d||t[27]!==f||t[28]!==u||t[29]!==g?(M=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:[`✓ `,i.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:i.footerSaveNotApplicable}):null,(0,Q.jsx)(W,{type:`button`,className:`order-1 w-full sm:order-2 sm:w-auto`,disabled:m||d,onClick:()=>void u(),children:i.save})]}):null,t[22]=i.footerSaveNotApplicable,t[23]=i.personaSaved,t[24]=i.save,t[25]=m,t[26]=d,t[27]=f,t[28]=u,t[29]=g,t[30]=M):M=t[30];let N;t[31]!==j||t[32]!==M?(N=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col overflow-hidden`,children:[j,M]}),t[31]=j,t[32]=M,t[33]=N):N=t[33];let F;t[34]!==A||t[35]!==N?(F=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col sm:flex-row sm:overflow-hidden`,children:[A,N]}),t[34]=A,t[35]=N,t[36]=F):F=t[36];let I;t[37]!==_||t[38]!==F||t[39]!==k?(I=(0,Q.jsxs)(ee,{children:[y,(0,Q.jsx)(E,{ref:v,className:b,onOpenAutoFocus:Ht,children:(0,Q.jsxs)(We,{layer:`modal`,portalContainer:_,children:[k,F]})})]}),t[37]=_,t[38]=F,t[39]=k,t[40]=I):I=t[40];let L;return t[41]!==r||t[42]!==n||t[43]!==I?(L=(0,Q.jsx)(me,{open:n,onOpenChange:r,children:I}),t[41]=r,t[42]=n,t[43]=I,t[44]=L):L=t[44],L}function Ht(e){return e.preventDefault()}function Ut(e){let t=(0,Z.c)(28),{label:n,mode:r,value:i,inheritedFrom:a,inheritLabel:o,overrideLabel:s,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=i||`—`,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]!==a||t[5]!==r?(p=r===`inherit`&&a?(0,Q.jsx)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:a}):null,t[4]=a,t[5]=r,t[6]=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=c(`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`?o:s,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=c(`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 Wt(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)(bt,{icon:Fe,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)(Ut,{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)(Ut,{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)(xt,{children:[g,C]}),t[35]=g,t[36]=C,t[37]=w):w=t[37],w}function Gt(e,t){for(let n of t){let t=e[n];if(t)return t}return`default`}function Kt(e){let t=(0,Z.c)(5),{source:n}=e,r;if(t[0]!==n){let e=n.startsWith(`preset:`),i=n.startsWith(`agent:`);r=c(`shrink-0 rounded-full px-2 py-0.5 text-[11px] font-medium`,e&&`bg-accent/10 text-accent`,i&&`bg-surface-base text-fg-muted`,!e&&!i&&`bg-surface-panel text-fg-subtle`),t[0]=n,t[1]=r}else r=t[1];let i;return t[2]!==n||t[3]!==r?(i=(0,Q.jsx)(`span`,{className:r,children:n}),t[2]=n,t[3]=r,t[4]=i):i=t[4],i}function qt(e){let t=(0,Z.c)(13),n;t[0]===e.name?n=t[1]:(n=(0,Q.jsx)(`div`,{className:`min-w-0 truncate font-mono text-xs font-medium text-fg`,children:e.name}),t[0]=e.name,t[1]=n);let r=e.monoValue&&`font-mono text-xs`,i;t[2]===r?i=t[3]:(i=c(`min-w-0 truncate text-sm text-fg`,r),t[2]=r,t[3]=i);let a;t[4]!==e.value||t[5]!==i?(a=(0,Q.jsx)(`div`,{className:i,children:e.value}),t[4]=e.value,t[5]=i,t[6]=a):a=t[6];let o;t[7]===e.source?o=t[8]:(o=(0,Q.jsx)(Kt,{source:e.source}),t[7]=e.source,t[8]=o);let s;return t[9]!==n||t[10]!==a||t[11]!==o?(s=(0,Q.jsxs)(`div`,{className:`grid gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:grid-cols-[minmax(0,10rem)_minmax(0,1fr)_auto] sm:items-center`,children:[n,a,o]}),t[9]=n,t[10]=a,t[11]=o,t[12]=s):s=t[12],s}function Jt(e,t){return e&&e.length>0?e.join(`, `):t}function Yt(e){let t=(0,Z.c)(29),{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=()=>he(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}=p(i,a,o),u=s?.manifest,d;t[5]!==s?.presetChain||t[6]!==u?.extends?(d=s?.presetChain??u?.extends??[],t[5]=s?.presetChain,t[6]=u?.extends,t[7]=d):d=t[7];let f=d,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.effectiveModelsTitle||t[14]!==n.effectiveNoPresets||t[15]!==n.effectiveNoToolPolicies||t[16]!==n.effectivePresetChain||t[17]!==n.effectiveSkillsTitle||t[18]!==n.effectiveTitle||t[19]!==n.effectiveToolsTitle||t[20]!==s?.sources||t[21]!==c||t[22]!==l||t[23]!==u||t[24]!==f){let e=s?.sources??{},r=Object.entries(u?.models?.roles??{}).sort(Zt),i=Object.entries(u?.tools?.builtin??{}).sort(Xt),a=u?.skills,o=u?.boundaries,d;t[26]!==n.effectiveHint||t[27]!==n.effectiveTitle?(d=(0,Q.jsx)(bt,{icon:X,title:n.effectiveTitle,subtitle:n.effectiveHint}),t[26]=n.effectiveHint,t[27]=n.effectiveTitle,t[28]=d):d=t[28],m=(0,Q.jsxs)(xt,{children:[d,l?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.effectiveLoading}):c?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:c instanceof Error?c.message:n.effectiveError}):u?(0,Q.jsx)(`div`,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectivePresetChain}),(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2 text-sm text-fg shadow-surface`,children:f.length?f.join(` -> `):n.effectiveNoPresets})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveModelsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(qt,{name:`defaultRole`,value:u.models?.defaultRole??`—`,source:Gt(e,[`models.defaultRole`])}),r.map(t=>{let[n,r]=t;return(0,Q.jsx)(qt,{name:n,value:r.model,monoValue:!0,source:Gt(e,[`models.roles.${n}.model`,`models.roles.${n}`])},n)})]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveToolsTitle}),i.length>0?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:i.map(t=>{let[n,r]=t;return(0,Q.jsx)(qt,{name:n,value:r.mode,source:Gt(e,[`tools.builtin.${n}.mode`,`tools.builtin.${n}`])},n)})}):(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted shadow-surface`,children:n.effectiveNoToolPolicies})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveSkillsTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(qt,{name:`mode`,value:a?.mode??`all`,source:Gt(e,[`skills.mode`,`skills`])}),a?.mode===`allowlist`?(0,Q.jsx)(qt,{name:`allow`,value:Jt(a.allow,`—`),source:Gt(e,[`skills.allow`,`skills`])}):null,a?.mode===`denylist`?(0,Q.jsx)(qt,{name:`deny`,value:Jt(a.deny,`—`),source:Gt(e,[`skills.deny`,`skills`])}):null]})]}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h4`,{className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n.effectiveBoundariesTitle}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(qt,{name:`requiresConfirmation`,value:Jt(o?.requiresConfirmation,`—`),source:Gt(e,[`boundaries.requiresConfirmation`,`boundaries`])}),(0,Q.jsx)(qt,{name:`forbidden`,value:Jt(o?.forbidden,`—`),source:Gt(e,[`boundaries.forbidden`,`boundaries`])}),(0,Q.jsx)(qt,{name:`escalation`,value:Jt(o?.escalation,`—`),source:Gt(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.effectiveModelsTitle,t[14]=n.effectiveNoPresets,t[15]=n.effectiveNoToolPolicies,t[16]=n.effectivePresetChain,t[17]=n.effectiveSkillsTitle,t[18]=n.effectiveTitle,t[19]=n.effectiveToolsTitle,t[20]=s?.sources,t[21]=c,t[22]=l,t[23]=u,t[24]=f,t[25]=m}else m=t[25];return m}function Xt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Zt(e,t){let[n]=e,[r]=t;return n.localeCompare(r)}function Qt(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 $t(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 en(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)($t,{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)($t,{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)($t,{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)(tn,{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)(nn,{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)(on,{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 tn(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)(Qt,{children:(0,Q.jsx)(Wt,{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 nn(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(an)),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(rn).filter(e=>e!==l&&!o.includes(e)),f=u[0]??``;h=Qt,m=xt;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)(B,{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)(W,{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)(bt,{icon:Ue,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 S;t[45]!==p.id||t[46]!==c?(S=()=>c(p.id),t[45]=p.id,t[46]=c,t[47]=S):S=t[47];let C=p.name||n.capabilityPresetsGlobalDefault,w;t[48]===C?w=t[49]:(w=(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:C}),t[48]=C,t[49]=w);let T;t[50]===n.capabilityPresetsGlobalDefault?T=t[51]:(T=(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]=T);let E;t[52]!==w||t[53]!==T?(E=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[w,T]}),t[52]=w,t[53]=T,t[54]=E):E=t[54];let D;t[55]===p.id?D=t[56]:(D=(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]=D);let O=p.description||n.capabilityPresetsGlobalDefaultHint,k;t[57]===O?k=t[58]:(k=(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:O}),t[57]=O,t[58]=k);let A;t[59]!==S||t[60]!==E||t[61]!==D||t[62]!==k?(A=(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:S,children:[E,D,k]})}),t[59]=S,t[60]=E,t[61]=D,t[62]=k,t[63]=A):A=t[63],_=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[A,o.length>0?o.map((e,t)=>{let r=d.get(e);return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-lg bg-surface-panel/80 px-3 py-2 shadow-surface sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:`min-w-0 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:()=>c(e),children:[(0,Q.jsx)(`div`,{className:`truncate text-sm font-medium text-fg`,children:r?.name??e}),(0,Q.jsx)(`div`,{className:`mt-0.5 truncate font-mono text-[11px] text-fg-muted`,children:e}),r?.description?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:r.description}):null]}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1.5`,children:[(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===0,"aria-label":n.capabilityPresetMoveUp,onClick:()=>{let e=[...o],[n,r]=[e[t],e[t-1]];e[t-1]=n,e[t]=r,s(e)},children:(0,Q.jsx)(V,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i||t===o.length-1,"aria-label":n.capabilityPresetMoveDown,onClick:()=>{let e=[...o],[n,r]=[e[t+1],e[t]];e[t]=n,e[t+1]=r,s(e)},children:(0,Q.jsx)(I,{className:`size-3.5`,"aria-hidden":!0})}),(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`size-8 rounded-lg p-0`,disabled:i,"aria-label":n.capabilityPresetRemove,onClick:()=>s(o.filter(t=>t!==e)),children:(0,Q.jsx)(De,{className:`size-3.5`,"aria-hidden":!0})})]})]},e)}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 p-3 text-sm text-fg-muted shadow-surface`,children:n.capabilityPresetsEmptyAdditional})]}),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)(Y,{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)(Ne,{value:e,children:d.get(e)?.name??e},e))}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:i||!f,onClick:e=>{let t=e.currentTarget.parentElement?.querySelector(`select`)?.value||f;t&&s([...o,t])},children:[(0,Q.jsx)(H,{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 rn(e){return e.id}function an(e){return[e.id,e]}function on(e){let t=(0,Z.c)(3),{a:n,selected:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,Q.jsx)(Qt,{children:(0,Q.jsx)(Yt,{a:n,selected:r})}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function sn(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)(Qt,{children:r.id===`main`?(0,Q.jsx)(xt,{children:(0,Q.jsx)(bt,{icon:z,title:n.dangerZoneTitle,subtitle:n.dangerZoneMainUnavailable})}):(0,Q.jsxs)(xt,{className:`border border-red-200/70 bg-red-50/60 dark:border-red-900/50 dark:bg-red-950/25`,children:[(0,Q.jsx)(bt,{icon:z,title:n.dangerZoneTitle,subtitle:n.dangerZoneHint}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Q.jsx)(`p`,{className:`max-w-xl text-sm text-red-800 dark:text-red-200`,children:n.dangerZoneBody}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>void a(!1),children:[(0,Q.jsx)(De,{className:`mr-1 size-4`,"aria-hidden":!0}),n.removeFromConfig]}),(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`border-red-200 text-red-700 hover:bg-red-100 dark:border-red-900/60 dark:text-red-300 dark:hover:bg-red-950/50`,disabled:i,onClick:()=>void a(!0),children:n.purgeDisk})]})]})]})}),t[0]=n.dangerZoneBody,t[1]=n.dangerZoneHint,t[2]=n.dangerZoneMainUnavailable,t[3]=n.dangerZoneTitle,t[4]=n.purgeDisk,t[5]=n.removeFromConfig,t[6]=i,t[7]=a,t[8]=r.id,t[9]=o):o=t[9],o}function cn(){return c(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,ae,`dark:border-edge`)}function ln(e){return[e.channel,e.accountId,e.peerKind,e.peerId].filter(e=>typeof e==`string`&&e.length>0).join(` · `)||e.channel}function un(e,t,n,r){let i=e.trim(),a=t.trim();if(a)return{channel:i,peerId:a};if(n!=null){let e=r[n];if(!e)return{channel:i};let t={channel:i};e.accountId?.trim()&&(t.accountId=e.accountId.trim()),e.peerKind?.trim()&&(t.peerKind=e.peerKind.trim());let a=e.peerId?.trim()||e.chatId?.trim();return a&&(t.peerId=a),t}return{channel:i}}function dn(e){let t=(0,Z.c)(31),{a:n,filesLoading:r,files:i,activeFile:a,setActiveFile:o,filesViewMode:s,setFilesViewMode:l,fileDraft:u,setFileDraft:d,fileSaving:p,profileFileLoading:m,profileEditorNonce:h,onTryInChat:g}=e,_=f(fn),v;t[0]!==n.missing||t[1]!==i?.files?(v=i?.files.map(e=>({id:e.name,label:e.missing?`${e.name} (${n.missing})`:e.name,title:e.name}))??[],t[0]=n.missing,t[1]=i?.files,t[2]=v):v=t[2];let y=v,x;t[3]===n.filesHint?x=t[4]:(x=(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesHint}),t[3]=n.filesHint,t[4]=x);let S;t[5]!==n.filesAutoSaveHint||t[6]!==n.filesEmpty||t[7]!==n.filesMarkdownEdit||t[8]!==n.filesMarkdownPreview||t[9]!==n.filesNavAria||t[10]!==n.filesSavingStatus||t[11]!==n.pickFile||t[12]!==n.tryInChat||t[13]!==a||t[14]!==u||t[15]!==p||t[16]!==y||t[17]!==i||t[18]!==r||t[19]!==s||t[20]!==_||t[21]!==g||t[22]!==h||t[23]!==m||t[24]!==o||t[25]!==d||t[26]!==l?(S=r?(0,Q.jsx)(yt,{rows:3}):i?(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-hidden`,children:[(0,Q.jsx)(St,{items:y,activeTab:a??``,onChange:o,ariaLabel:n.filesNavAria,tabIdPrefix:`agent-files-tab`,panelIdPrefix:`agent-files-panel`,className:`shrink-0 flex-wrap`,buttonClassName:`font-mono text-xs whitespace-nowrap`}),(0,Q.jsx)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col gap-2 overflow-hidden`,children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsxs)(`div`,{className:`inline-flex rounded-lg border border-edge bg-surface-panel p-0.5`,role:`group`,"aria-label":`${n.filesMarkdownEdit} / ${n.filesMarkdownPreview}`,children:[(0,Q.jsxs)(`button`,{type:`button`,className:c(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,b.press,s===`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:c(`inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5 text-xs font-medium`,b.press,s===`preview`?`bg-accent-soft text-accent-fg`:`text-fg-muted hover:bg-surface-hover`),onClick:()=>l(`preview`),children:[(0,Q.jsx)(T,{className:`size-3.5 shrink-0`,"aria-hidden":!0}),n.filesMarkdownPreview]})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[p?(0,Q.jsx)(`span`,{children:n.filesSavingStatus}):null,(0,Q.jsx)(`span`,{children:n.filesAutoSaveHint}),g?(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,className:`ml-auto text-xs`,onClick:g,children:[(0,Q.jsx)(K,{className:`mr-1 size-3.5`,"aria-hidden":!0}),n.tryInChat]}):null]})]}),s===`edit`?(0,Q.jsx)(`div`,{className:c(cn(),`flex min-h-0 flex-1 flex-col overflow-hidden p-0`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(ht,{initialContent:u,onChange:d,isDark:_,className:`min-h-0 flex-1`},`${a??`file`}-${h}`)}):(0,Q.jsx)(`div`,{className:c(cn(),`min-h-0 flex-1 overflow-y-auto text-sm`,m&&`pointer-events-none opacity-60`),children:(0,Q.jsx)(Ze,{content:u,className:`text-sm`})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.pickFile})})]}):(0,Q.jsx)(`p`,{className:`shrink-0 text-sm text-fg-muted`,children:n.filesEmpty}),t[5]=n.filesAutoSaveHint,t[6]=n.filesEmpty,t[7]=n.filesMarkdownEdit,t[8]=n.filesMarkdownPreview,t[9]=n.filesNavAria,t[10]=n.filesSavingStatus,t[11]=n.pickFile,t[12]=n.tryInChat,t[13]=a,t[14]=u,t[15]=p,t[16]=y,t[17]=i,t[18]=r,t[19]=s,t[20]=_,t[21]=g,t[22]=h,t[23]=m,t[24]=o,t[25]=d,t[26]=l,t[27]=S):S=t[27];let C;return t[28]!==x||t[29]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[x,S]}),t[28]=x,t[29]=S,t[30]=C):C=t[30],C}function fn(e){return e.resolved===`dark`}function pn(e){let t=(0,Z.c)(44),[n,r]=(0,$.useState)(`files`),{a:i}=e,a;t[0]===i.advancedHint?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`mb-3 max-w-[70ch] text-sm leading-6 text-fg-muted`,children:i.advancedHint}),t[0]=i.advancedHint,t[1]=a);let o;t[2]===i.advancedFilesTab?o=t[3]:(o={id:`files`,label:i.advancedFilesTab,icon:pe},t[2]=i.advancedFilesTab,t[3]=o);let s;t[4]===i.advancedConfigTab?s=t[5]:(s={id:`config`,label:i.advancedConfigTab,icon:Pe},t[4]=i.advancedConfigTab,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=[o,s],t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]!==i.advancedNavAria||t[10]!==n||t[11]!==c?(l=(0,Q.jsx)(St,{items:c,activeTab:n,onChange:r,ariaLabel:i.advancedNavAria,tabIdPrefix:`agent-advanced-tab`,panelIdPrefix:`agent-advanced-panel`}),t[9]=i.advancedNavAria,t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;t[13]!==a||t[14]!==l?(u=(0,Q.jsxs)(`div`,{className:`shrink-0`,children:[a,l]}),t[13]=a,t[14]=l,t[15]=u):u=t[15];let d;t[16]!==i||t[17]!==n||t[18]!==e.activeFile||t[19]!==e.agentModel||t[20]!==e.agentWorkspace||t[21]!==e.busy||t[22]!==e.capabilityPresets||t[23]!==e.defaultModel||t[24]!==e.defaultPresetId||t[25]!==e.defaultWorkspace||t[26]!==e.fileDraft||t[27]!==e.fileSaving||t[28]!==e.files||t[29]!==e.filesLoading||t[30]!==e.filesViewMode||t[31]!==e.onOpenCapabilityPreset||t[32]!==e.onTryInChat||t[33]!==e.onUpdateAgentExtends||t[34]!==e.profileEditorNonce||t[35]!==e.profileFileLoading||t[36]!==e.selected||t[37]!==e.setActiveFile||t[38]!==e.setFileDraft||t[39]!==e.setFilesViewMode?(d=n===`files`?(0,Q.jsx)(dn,{a:i,filesLoading:e.filesLoading,files:e.files,activeFile:e.activeFile,setActiveFile:e.setActiveFile,filesViewMode:e.filesViewMode,setFilesViewMode:e.setFilesViewMode,fileDraft:e.fileDraft,setFileDraft:e.setFileDraft,fileSaving:e.fileSaving,profileFileLoading:e.profileFileLoading,profileEditorNonce:e.profileEditorNonce,onTryInChat:e.onTryInChat}):(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3`,children:[(0,Q.jsx)(`p`,{className:`shrink-0 rounded-lg border border-edge-subtle bg-surface-panel px-3 py-2 text-xs leading-5 text-fg-muted`,children:i.advancedRuntimeCoverageHint}),(0,Q.jsx)(en,{a:i,selected:e.selected,busy:e.busy,defaultModel:e.defaultModel,defaultWorkspace:e.defaultWorkspace,agentModel:e.agentModel,agentWorkspace:e.agentWorkspace,capabilityPresets:e.capabilityPresets,defaultPresetId:e.defaultPresetId,onUpdateAgentExtends:e.onUpdateAgentExtends,onOpenCapabilityPreset:e.onOpenCapabilityPreset})]}),t[16]=i,t[17]=n,t[18]=e.activeFile,t[19]=e.agentModel,t[20]=e.agentWorkspace,t[21]=e.busy,t[22]=e.capabilityPresets,t[23]=e.defaultModel,t[24]=e.defaultPresetId,t[25]=e.defaultWorkspace,t[26]=e.fileDraft,t[27]=e.fileSaving,t[28]=e.files,t[29]=e.filesLoading,t[30]=e.filesViewMode,t[31]=e.onOpenCapabilityPreset,t[32]=e.onTryInChat,t[33]=e.onUpdateAgentExtends,t[34]=e.profileEditorNonce,t[35]=e.profileFileLoading,t[36]=e.selected,t[37]=e.setActiveFile,t[38]=e.setFileDraft,t[39]=e.setFilesViewMode,t[40]=d):d=t[40];let f;return t[41]!==u||t[42]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[u,d]}),t[41]=u,t[42]=d,t[43]=f):f=t[43],f}function mn(e){let t=(0,Z.c)(65),{a:n,selected:r,busy:i,skillsCatalogLoading:a,catalogForPick:s,skillsInherit:l,setSkillsInherit:u,skillsPick:d,setSkillsPick:f,onSaveSkills:p,hideInlineSave:m}=e,h;t[0]===r.skills.effectiveAllowlist?h=t[1]:(h=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]=h);let g=h,_;t[2]!==s||t[3]!==r.skills.effectiveAllowlist?(_=function(){let e=r.skills.effectiveAllowlist;return e===void 0?new Set(s.map(hn)):new Set(e)},t[2]=s,t[3]=r.skills.effectiveAllowlist,t[4]=_):_=t[4];let v=_,y;t[5]!==n.skillsHint||t[6]!==n.skillsTitle?(y=(0,Q.jsx)(bt,{className:`shrink-0`,icon:G,title:n.skillsTitle,subtitle:n.skillsHint}),t[5]=n.skillsHint,t[6]=n.skillsTitle,t[7]=y):y=t[7];let b;t[8]===u?b=t[9]:(b=()=>u(!0),t[8]=u,t[9]=b);let x;t[10]!==n.skillsInherit||t[11]!==i||t[12]!==b?(x=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:i,onClick:b,children:n.skillsInherit}),t[10]=n.skillsInherit,t[11]=i,t[12]=b,t[13]=x):x=t[13];let S;t[14]!==v||t[15]!==u||t[16]!==f?(S=()=>{u(!1),f(v())},t[14]=v,t[15]=u,t[16]=f,t[17]=S):S=t[17];let C;t[18]!==n.skillsCustomize||t[19]!==i||t[20]!==S?(C=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:i,onClick:S,children:n.skillsCustomize}),t[18]=n.skillsCustomize,t[19]=i,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=Je(`skills`),t[25]=T):T=t[25];let E;t[26]===n.skillsLibraryLink?E=t[27]:(E=(0,Q.jsx)(o,{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]!==l?(A=r.skills.effectiveAllowlist?.length?r.skills.effectiveAllowlist.join(`, `):l?n.skillsInherit:`—`,t[36]=n.skillsInherit,t[37]=r.skills.effectiveAllowlist,t[38]=l,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]!==i||t[46]!==s||t[47]!==g||t[48]!==f||t[49]!==a||t[50]!==l||t[51]!==d?(M=a?(0,Q.jsx)(`div`,{className:`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,children:(0,Q.jsx)(vt,{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:c(`mt-3 min-h-0 flex-1 overflow-y-auto overscroll-contain pr-0.5`,l&&`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=l?g(t):d.has(t),a=typeof e.description==`string`?e.description.trim():``,o=a||n.skillsNoDescription;return(0,Q.jsx)(`li`,{className:`h-16 shrink-0 overflow-hidden rounded-xl bg-surface-panel/70 px-3 shadow-surface`,children:(0,Q.jsxs)(`label`,{className:`flex h-full cursor-pointer items-center gap-3 text-sm`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`shrink-0 rounded border-edge`,checked:r,disabled:l||i,onChange:()=>{f(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:c(`mt-0.5 truncate text-xs leading-tight text-fg-muted`,!a&&`italic text-fg-subtle`),title:o,children:o})]})]})},t)})})}),t[43]=n.skillsEmptyCatalog,t[44]=n.skillsNoDescription,t[45]=i,t[46]=s,t[47]=g,t[48]=f,t[49]=a,t[50]=l,t[51]=d,t[52]=M):M=t[52];let N;t[53]!==n.skillsSave||t[54]!==i||t[55]!==m||t[56]!==p?(N=m?null:(0,Q.jsx)(`div`,{className:`mt-4 shrink-0`,children:(0,Q.jsx)(W,{type:`button`,disabled:i,onClick:()=>void p(),children:n.skillsSave})}),t[53]=n.skillsSave,t[54]=i,t[55]=m,t[56]=p,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]!==y?(P=(0,Q.jsxs)(xt,{className:`flex min-h-0 flex-1 flex-col`,children:[y,D,k,j,M,N]}),t[58]=D,t[59]=k,t[60]=j,t[61]=M,t[62]=N,t[63]=y,t[64]=P):P=t[64],P}function hn(e){return e.name||e.directoryId}var gn=[`write_file`,`apply_patch`,`exec_command`],_n=[`exec_command`,`image_generate`,`extensions`],vn=[`send_message`,`send_media`];function yn(e){let t=(0,Z.c)(87),{mode:n,builtinToolIds:r,loading:i,disableSet:a,onDisableSetChange:o,defaultsDisableSet:s,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]===s?y=t[5]:(y=s??new Set,t[4]=s,t[5]=y);let b=y,x;t[6]!==b||t[7]!==a||t[8]!==n||t[9]!==o?(x=(e,t)=>{if(n===`agentEntry`&&t&&b.has(e))return;let r=new Set(a);t?r.delete(e):r.add(e),o(r)},t[6]=b,t[7]=a,t[8]=n,t[9]=o,t[10]=x):x=t[10];let S=x,C;t[11]!==v||t[12]!==o?(C=e=>{let t=new Set;for(let n of e)v.has(n)&&t.add(n);o(t)},t[11]=v,t[12]=o,t[13]=C):C=t[13];let w=C,T;t[14]===o?T=t[15]:(T=()=>{o(new Set)},t[14]=o,t[15]=T);let E=T,D;t[16]!==r||t[17]!==o||t[18]!==h?(D=()=>{o(new Set([...r,...h]))},t[16]=r,t[17]=o,t[18]=h,t[19]=D):D=t[19];let O=D,k;t[20]===r?k=t[21]:(k=Tt(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(xn),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 wt){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(bn),P=g||i,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)(W,{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,R;t[39]!==O||t[40]!==f.quickDisableAll||t[41]!==ee?(R=(0,Q.jsx)(W,{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]=R):R=t[42];let z=P||r.length===0,B;t[43]===w?B=t[44]:(B=()=>w(gn),t[43]=w,t[44]=B);let te;t[45]!==f.quickReadOnlyWorkspace||t[46]!==z||t[47]!==B?(te=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:At,disabled:z,onClick:B,children:f.quickReadOnlyWorkspace}),t[45]=f.quickReadOnlyWorkspace,t[46]=z,t[47]=B,t[48]=te):te=t[48];let ne=P||r.length===0,re;t[49]===w?re=t[50]:(re=()=>w(_n),t[49]=w,t[50]=re);let ie;t[51]!==f.quickHighRiskOff||t[52]!==ne||t[53]!==re?(ie=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:At,disabled:ne,onClick:re,children:f.quickHighRiskOff}),t[51]=f.quickHighRiskOff,t[52]=ne,t[53]=re,t[54]=ie):ie=t[54];let ae=P||r.length===0,V;t[55]===w?V=t[56]:(V=()=>w(vn),t[55]=w,t[56]=V);let H;t[57]!==f.quickNoOutbound||t[58]!==ae||t[59]!==V?(H=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:At,disabled:ae,onClick:V,children:f.quickNoOutbound}),t[57]=f.quickNoOutbound,t[58]=ae,t[59]=V,t[60]=H):H=t[60];let U;t[61]!==L||t[62]!==R||t[63]!==te||t[64]!==ie||t[65]!==H?(U=(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[L,R,te,ie,H]}),t[61]=L,t[62]=R,t[63]=te,t[64]=ie,t[65]=H,t[66]=U):U=t[66];let G;t[67]!==F||t[68]!==U?(G=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[F,U]}),t[67]=F,t[68]=U,t[69]=G):G=t[69];let K;t[70]!==b||t[71]!==a||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]!==i||t[80]!==n||t[81]!==P||t[82]!==S?(K=i?(0,Q.jsx)(vt,{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`,i=n===`agentEntry`&&b.has(e),o=a.has(e),s=i?!1:!o,l=u(e);return(0,Q.jsx)(`li`,{className:c(`rounded-xl bg-surface-panel/70 px-3 py-2.5 shadow-surface`,r&&`bg-surface-panel/50`,i&&`opacity-60`),children:(0,Q.jsxs)(`label`,{className:c(`flex gap-3 text-sm`,i?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-1 shrink-0 rounded border-edge`,checked:s,disabled:i||P,onChange:()=>S(e,!s)}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-0.5`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs font-medium text-fg`,children:e}),r?(0,Q.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[`(`,f.notInBuiltin,`)`]}):null,i?(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]=a,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]=i,t[80]=n,t[81]=P,t[82]=S,t[83]=K):K=t[83];let q;return t[84]!==G||t[85]!==K?(q=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[G,K]}),t[84]=G,t[85]=K,t[86]=q):q=t[86],q}function bn(e){return e.ids.length>0}function xn(e,t){return e.localeCompare(t)}function Sn(e){let t=(0,Z.c)(51),{a:n,data:r,selected:i,busy:a,toolEntryDisable:o,setToolEntryDisable:s,onSaveTools:c,onClearToolsEntry:u,hideInlineSave:f}=e,p=d(wn),m;t[0]===p?m=t[1]:(m=l(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(Cn)),t[2]=i.tools.presetDenied,t[3]=g);let _=g,v;t[4]===s?v=t[5]:(v=e=>{s(e)},t[4]=s,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)(bt,{className:`shrink-0`,icon:ie,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]!==a||t[25]!==r.builtinToolIds||t[26]!==S||t[27]!==w||t[28]!==y||t[29]!==_||t[30]!==E||t[31]!==o?(D=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(yn,{mode:`agentEntry`,builtinToolIds:r.builtinToolIds,loading:!1,disableSet:o,onDisableSetChange:y,defaultsDisableSet:_,getToolDescription:w,getGroupTitle:S,quickActionsDisabled:a,labels:E})}),t[24]=a,t[25]=r.builtinToolIds,t[26]=S,t[27]=w,t[28]=y,t[29]=_,t[30]=E,t[31]=o,t[32]=D):D=t[32];let O;t[33]!==n.toolsSave||t[34]!==a||t[35]!==f||t[36]!==c?(O=f?null:(0,Q.jsx)(W,{type:`button`,disabled:a,onClick:()=>void c(),children:n.toolsSave}),t[33]=n.toolsSave,t[34]=a,t[35]=f,t[36]=c,t[37]=O):O=t[37];let k;t[38]===u?k=t[39]:(k=()=>void u(),t[38]=u,t[39]=k);let A;t[40]!==n.toolsClearEntry||t[41]!==a||t[42]!==k?(A=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:a,onClick:k,children:n.toolsClearEntry}),t[40]=n.toolsClearEntry,t[41]=a,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)(xt,{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 Cn(e){let t=String(e).trim();return t?[t]:[]}function wn(e){return e.language}function Tn(e){let t=(0,Z.c)(36),[n,r]=(0,$.useState)(`tools`),{a:i}=e,a;t[0]===i.capabilitiesHint?a=t[1]:(a=(0,Q.jsx)(`p`,{className:`mb-3 max-w-[70ch] text-sm leading-6 text-fg-muted`,children:i.capabilitiesHint}),t[0]=i.capabilitiesHint,t[1]=a);let o;t[2]===i.capabilitiesToolsTab?o=t[3]:(o={id:`tools`,label:i.capabilitiesToolsTab,icon:ie},t[2]=i.capabilitiesToolsTab,t[3]=o);let s;t[4]===i.capabilitiesSkillsTab?s=t[5]:(s={id:`skills`,label:i.capabilitiesSkillsTab,icon:m},t[4]=i.capabilitiesSkillsTab,t[5]=s);let c;t[6]!==o||t[7]!==s?(c=[o,s],t[6]=o,t[7]=s,t[8]=c):c=t[8];let l;t[9]!==i.capabilitiesNavAria||t[10]!==n||t[11]!==c?(l=(0,Q.jsx)(St,{items:c,activeTab:n,onChange:r,ariaLabel:i.capabilitiesNavAria,tabIdPrefix:`agent-capabilities-tab`,panelIdPrefix:`agent-capabilities-panel`}),t[9]=i.capabilitiesNavAria,t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;t[13]!==a||t[14]!==l?(u=(0,Q.jsxs)(`div`,{className:`shrink-0`,children:[a,l]}),t[13]=a,t[14]=l,t[15]=u):u=t[15];let d;t[16]!==i||t[17]!==n||t[18]!==e.busy||t[19]!==e.catalogForPick||t[20]!==e.data||t[21]!==e.onClearToolsEntry||t[22]!==e.onSaveSkills||t[23]!==e.onSaveTools||t[24]!==e.selected||t[25]!==e.setSkillsInherit||t[26]!==e.setSkillsPick||t[27]!==e.setToolEntryDisable||t[28]!==e.skillsCatalogLoading||t[29]!==e.skillsInherit||t[30]!==e.skillsPick||t[31]!==e.toolEntryDisable?(d=n===`tools`?(0,Q.jsx)(Sn,{a:i,data:e.data,selected:e.selected,busy:e.busy,toolEntryDisable:e.toolEntryDisable,setToolEntryDisable:e.setToolEntryDisable,onSaveTools:e.onSaveTools,onClearToolsEntry:e.onClearToolsEntry}):(0,Q.jsx)(mn,{a:i,selected:e.selected,busy:e.busy,skillsCatalogLoading:e.skillsCatalogLoading,catalogForPick:e.catalogForPick,skillsInherit:e.skillsInherit,setSkillsInherit:e.setSkillsInherit,skillsPick:e.skillsPick,setSkillsPick:e.setSkillsPick,onSaveSkills:e.onSaveSkills}),t[16]=i,t[17]=n,t[18]=e.busy,t[19]=e.catalogForPick,t[20]=e.data,t[21]=e.onClearToolsEntry,t[22]=e.onSaveSkills,t[23]=e.onSaveTools,t[24]=e.selected,t[25]=e.setSkillsInherit,t[26]=e.setSkillsPick,t[27]=e.setToolEntryDisable,t[28]=e.skillsCatalogLoading,t[29]=e.skillsInherit,t[30]=e.skillsPick,t[31]=e.toolEntryDisable,t[32]=d):d=t[32];let f;return t[33]!==u||t[34]!==d?(f=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 overflow-hidden`,children:[u,d]}),t[33]=u,t[34]=d,t[35]=f):f=t[35],f}var En=c(He,`w-full text-xs sm:w-auto sm:min-w-[11rem] sm:max-w-[17rem] sm:shrink-0`);function Dn(e){let t=(0,Z.c)(59),{a:n,busy:r,bindingsLoading:i,agentBindings:a,onRemoveBinding:o,onAddBinding:s,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:C}=e,w=!u&&(d||l.length>0),T;t[0]!==n.channelsHint||t[1]!==n.channelsTitle?(T=(0,Q.jsx)(bt,{className:`shrink-0`,icon:Fe,title:n.channelsTitle,subtitle:n.channelsHint}),t[0]=n.channelsHint,t[1]=n.channelsTitle,t[2]=T):T=t[2];let E;t[3]!==n.channelsNone||t[4]!==n.removeBinding||t[5]!==a||t[6]!==i||t[7]!==r||t[8]!==o?(E=i?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map(On)}):a.length===0?(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.channelsNone}):(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2 text-sm`,children:a.map(e=>(0,Q.jsxs)(`li`,{className:`flex flex-wrap items-center justify-between gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2`,children:[(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:ln(e.match)}),(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:r,onClick:()=>void o(e),children:n.removeBinding})]},`${e.match.channel}-${ln(e.match)}`))}),t[3]=n.channelsNone,t[4]=n.removeBinding,t[5]=a,t[6]=i,t[7]=r,t[8]=o,t[9]=E):E=t[9];let D;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?(D=u?(0,Q.jsxs)(`div`,{className:`space-y-2`,"aria-busy":`true`,children:[(0,Q.jsx)(tt,{className:`h-4 w-24`}),(0,Q.jsx)(tt,{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:cn(),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)(Y,{className:c(cn(),`py-2`),value:f,onChange:e=>{p(e.target.value),_(null),y(``)},children:l.map(e=>(0,Q.jsxs)(Ne,{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]=D):D=t[20];let O;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]!==C||t[38]!==h||t[39]!==y||t[40]!==_||t[41]!==w?(O=w&&f.trim()?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-edge-subtle pt-3 text-sm`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:n.channelsSessionLabel}),(0,Q.jsxs)(W,{type:`button`,variant:`ghost`,className:`h-7 gap-1 px-2 text-xs`,disabled:r||h||!f.trim(),title:n.channelsRefreshSessionsHint,onClick:()=>b(),children:[(0,Q.jsx)(S,{className:c(`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)(tt,{className:`h-4 w-32`}),(0,Q.jsx)(tt,{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)(Y,{className:c(cn(),`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)(Ne,{value:``,children:n.channelsPeerAny}),m.map((e,t)=>(0,Q.jsx)(Ne,{value:String(t),children:Ft(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:c(cn(),`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)(Y,{className:En,value:v,onChange:e=>{let t=e.target.value;y(t||``),_(null)},children:[(0,Q.jsx)(Ne,{value:``,children:C}),m.map(e=>(0,Q.jsx)(Ne,{value:e.chatId,children:Ft(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]=C,t[38]=h,t[39]=y,t[40]=_,t[41]=w,t[42]=O):O=t[42];let k;t[43]!==r||t[44]!==u||t[45]!==f?(k=r||!f.trim()||u,t[43]=r,t[44]=u,t[45]=f,t[46]=k):k=t[46];let A;t[47]!==n.addBinding||t[48]!==k?(A=(0,Q.jsx)(`div`,{children:(0,Q.jsx)(W,{type:`submit`,disabled:k,children:n.addBinding})}),t[47]=n.addBinding,t[48]=k,t[49]=A):A=t[49];let j;t[50]!==s||t[51]!==D||t[52]!==O||t[53]!==A?(j=(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:s,children:[D,O,A]}),t[50]=s,t[51]=D,t[52]=O,t[53]=A,t[54]=j):j=t[54];let M;return t[55]!==T||t[56]!==E||t[57]!==j?(M=(0,Q.jsxs)(xt,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto`,children:[T,E,j]}),t[55]=T,t[56]=E,t[57]=j,t[58]=M):M=t[58],M}function On(e,t){return(0,Q.jsx)(tt,{className:`h-10 rounded-lg`},t)}function kn(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 An(e){let{agentId:t,value:n,onChange:r,a:i,id:a}=e,o=(0,$.useRef)(null),[s,l]=(0,$.useState)(!1),[u,d]=(0,$.useState)(null),[f,p]=(0,$.useState)(!1),m=(0,$.useMemo)(()=>{let e=x(n.trim());return e&&ue(e.styleId)?e.styleId:le[0]??`adventurer`},[n]),h=(0,$.useCallback)(async(e,n)=>{try{await mt(t)}catch{}r(at(e,n)),p(!1)},[t,r]),g=(0,$.useCallback)(async e=>{let n=e.target.files?.[0];if(e.target.value=``,n){d(null),l(!0);try{await ke(t,n),y(t),r(_)}catch(e){let t=e instanceof Error?e.message:``;d(t===`avatar_too_large`?i.avatarTooLarge:t===`unsupported_image_type`||t===`empty_file`?i.avatarInvalidImage:i.avatarUploadFailed)}finally{l(!1)}}},[i,t,r]),v=(e,t)=>{let r=x(n.trim());return!!(r&&r.styleId===e&&r.seed===t)};return(0,Q.jsxs)(`div`,{...a?{id:a}:{},className:`flex flex-col gap-3 sm:col-span-2`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:i.avatarPickerTitle}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`input`,{ref:o,type:`file`,accept:`image/png,image/jpeg,image/webp,.png,.jpg,.jpeg,.webp`,className:`hidden`,onChange:e=>void g(e)}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,className:`gap-1.5 px-2.5 py-1.5 text-xs`,disabled:s,onClick:()=>o.current?.click(),children:[(0,Q.jsx)(O,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),s?i.avatarUploading:i.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:le.map(e=>(0,Q.jsx)(`button`,{type:`button`,onClick:()=>void h(e,st[0]??t),className:c(`rounded-full border px-3 py-1.5 text-xs font-medium transition-colors`,b.press,m===e?`border-fg bg-fg text-surface-base`:`border-edge-subtle bg-surface-panel text-fg hover:border-edge`),children:kn(e,i)},e))}),(0,Q.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-panel/50 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[st.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:c(`flex size-12 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,b.press,v(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:Ct(m,e,96),alt:``,width:44,height:44,className:`size-11 rounded-full object-cover`,draggable:!1})},e)),(0,Q.jsxs)(it,{open:f,onOpenChange:p,children:[(0,Q.jsx)(dt,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:c(`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`,b.press),children:i.avatarMore})}),(0,Q.jsx)(je,{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:kn(m,i)}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Me.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e,onClick:()=>void h(m,e),className:c(`flex size-11 shrink-0 items-center justify-center rounded-full border-2 transition-colors`,b.press,v(m,e)?`border-accent ring-2 ring-accent/30`:`border-transparent hover:border-edge`),children:(0,Q.jsx)(`img`,{src:Ct(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:i.personaAvatar}),(0,Q.jsx)(lt,{agentId:t,avatar:n,size:40}),n.trim()&&!x(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 jn(e){let t=(0,Z.c)(180),{a:n,selected:r,busy:i,editName:a,setEditName:s,editDescription:l,setEditDescription:u,profileMarkdownLoading:p,profileDraft:m,updateIdentity:h,handleSoulTemplateChange:g,handleSoulContentChange:_,setAvatarDialogOpen:y,toggleSoulPreviewMode:b}=e,x=d(Pn),S=f(Nn),w;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(w=cn(),t[0]=w):w=t[0];let D=w,O;t[1]===x?O=t[2]:(O=(e,t)=>x===`zh`?t:e,t[1]=x,t[2]=O);let k=O;if(!r){let e;return t[3]===n.selectAgentHint?e=t[4]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[3]=n.selectAgentHint,t[4]=e),e}if(p||!m){let e;return t[5]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(yt,{rows:4}),t[5]=e):e=t[5],e}let A=m.identity,j=m.soulTemplate,N=m.soulCustomContent,F=m.soulEditorNonce,I=m.soulPreviewMode,L=m.avatarDialogOpen,R;t[6]!==A.avatar||t[7]!==r.id?(R=(0,Q.jsx)(lt,{agentId:r.id,avatar:A.avatar,size:36,className:`size-9 rounded-lg`}),t[6]=A.avatar,t[7]=r.id,t[8]=R):R=t[8];let z;t[9]===y?z=t[10]:(z=()=>y(!0),t[9]=y,t[10]=z);let ne;t[11]!==n.avatarOpenSettingsAria||t[12]!==z?(ne={onClick:z,ariaLabel:n.avatarOpenSettingsAria,id:`agent-avatar-settings`},t[11]=n.avatarOpenSettingsAria,t[12]=z,t[13]=ne):ne=t[13];let re;t[14]!==n.personaSectionIdentity||t[15]!==n.personaSectionIdentityHint||t[16]!==R||t[17]!==ne?(re=(0,Q.jsx)(bt,{icon:Ue,title:n.personaSectionIdentity,subtitle:n.personaSectionIdentityHint,iconLeading:R,iconInteractive:ne}),t[14]=n.personaSectionIdentity,t[15]=n.personaSectionIdentityHint,t[16]=R,t[17]=ne,t[18]=re):re=t[18];let ie;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(Qe,{className:c(`fixed inset-0 bg-scrim backdrop-blur-[2px]`,Ge)}),t[19]=ie):ie=t[19];let ae;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ae=c(`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`,Xe),t[20]=ae):ae=t[20];let V;t[21]===n.avatarPickerTitle?V=t[22]:(V=(0,Q.jsx)(Te,{className:`text-base font-semibold text-fg`,children:n.avatarPickerTitle}),t[21]=n.avatarPickerTitle,t[22]=V);let H;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(H=c(C,`shrink-0 p-1.5 hover:bg-surface-base`),t[23]=H):H=t[23];let U;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[24]=U):U=t[24];let W;t[25]===n.closeDialogAria?W=t[26]:(W=(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:H,"aria-label":n.closeDialogAria,children:U})}),t[25]=n.closeDialogAria,t[26]=W);let G;t[27]!==W||t[28]!==V?(G=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[V,W]}),t[27]=W,t[28]=V,t[29]=G):G=t[29];let K;t[30]===n.avatarRowHint?K=t[31]:(K=(0,Q.jsx)(te,{className:`sr-only`,children:n.avatarRowHint}),t[30]=n.avatarRowHint,t[31]=K);let q;t[32]===h?q=t[33]:(q=e=>h({avatar:e}),t[32]=h,t[33]=q);let oe;t[34]!==n||t[35]!==A.avatar||t[36]!==r.id||t[37]!==q?(oe=(0,Q.jsx)(An,{agentId:r.id,value:A.avatar,onChange:q,a:n}),t[34]=n,t[35]=A.avatar,t[36]=r.id,t[37]=q,t[38]=oe):oe=t[38];let se;t[39]!==G||t[40]!==K||t[41]!==oe?(se=(0,Q.jsxs)(ee,{children:[ie,(0,Q.jsxs)(E,{className:ae,onOpenAutoFocus:Mn,children:[G,K,oe]})]}),t[39]=G,t[40]=K,t[41]=oe,t[42]=se):se=t[42];let ce;t[43]!==L||t[44]!==y||t[45]!==se?(ce=(0,Q.jsx)(me,{open:L,onOpenChange:y,children:se}),t[43]=L,t[44]=y,t[45]=se,t[46]=ce):ce=t[46];let le;t[47]===n.displayName?le=t[48]:(le=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.displayName}),t[47]=n.displayName,t[48]=le);let ue;t[49]!==s||t[50]!==h?(ue=e=>{s(e.target.value),h({name:e.target.value})},t[49]=s,t[50]=h,t[51]=ue):ue=t[51];let de;t[52]!==n.personaNamePlaceholder||t[53]!==a||t[54]!==ue?(de=(0,Q.jsx)(`input`,{className:D,value:a,onChange:ue,placeholder:n.personaNamePlaceholder,autoComplete:`off`}),t[52]=n.personaNamePlaceholder,t[53]=a,t[54]=ue,t[55]=de):de=t[55];let fe;t[56]!==le||t[57]!==de?(fe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[le,de]}),t[56]=le,t[57]=de,t[58]=fe):fe=t[58];let pe;t[59]===n.personaEmoji?pe=t[60]:(pe=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaEmoji}),t[59]=n.personaEmoji,t[60]=pe);let he;t[61]===h?he=t[62]:(he=e=>h({emoji:e.target.value}),t[61]=h,t[62]=he);let ge;t[63]!==n.personaEmojiPlaceholder||t[64]!==A.emoji||t[65]!==he?(ge=(0,Q.jsx)(`input`,{className:D,value:A.emoji,onChange:he,placeholder:n.personaEmojiPlaceholder,autoComplete:`off`}),t[63]=n.personaEmojiPlaceholder,t[64]=A.emoji,t[65]=he,t[66]=ge):ge=t[66];let _e;t[67]!==pe||t[68]!==ge?(_e=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[pe,ge]}),t[67]=pe,t[68]=ge,t[69]=_e):_e=t[69];let ve;t[70]===n.agentDescription?ve=t[71]:(ve=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.agentDescription}),t[70]=n.agentDescription,t[71]=ve);let ye;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(ye=c(D,`min-h-16 resize-y text-sm leading-relaxed`),t[72]=ye):ye=t[72];let xe;t[73]!==u||t[74]!==h?(xe=e=>{u(e.target.value),h({description:e.target.value})},t[73]=u,t[74]=h,t[75]=xe):xe=t[75];let Se;t[76]!==n.agentDescriptionPlaceholder||t[77]!==l||t[78]!==xe?(Se=(0,Q.jsx)(`textarea`,{className:ye,value:l,onChange:xe,placeholder:n.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[76]=n.agentDescriptionPlaceholder,t[77]=l,t[78]=xe,t[79]=Se):Se=t[79];let Ce;t[80]!==ve||t[81]!==Se?(Ce=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ve,Se]}),t[80]=ve,t[81]=Se,t[82]=Ce):Ce=t[82];let we;t[83]===n.personaCreature?we=t[84]:(we=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.personaCreature}),t[83]=n.personaCreature,t[84]=we);let Ee=Ie.some(e=>e.value===A.creature)?A.creature:`__custom__`,De;t[85]===h?De=t[86]:(De=e=>{if(e.target.value===`__custom__`){h({creature:``});return}h({creature:e.target.value})},t[85]=h,t[86]=De);let Oe;t[87]===k?Oe=t[88]:(Oe=Ie.map(e=>(0,Q.jsx)(Ne,{value:e.value,children:k(e.labelEn,e.labelZh)},e.value)),t[87]=k,t[88]=Oe);let ke;t[89]===k?ke=t[90]:(ke=k(`Custom…`,`自定义…`),t[89]=k,t[90]=ke);let Ae;t[91]===ke?Ae=t[92]:(Ae=(0,Q.jsx)(Ne,{value:`__custom__`,children:ke}),t[91]=ke,t[92]=Ae);let J;t[93]!==Ee||t[94]!==De||t[95]!==Oe||t[96]!==Ae?(J=(0,Q.jsxs)(Y,{className:D,value:Ee,onChange:De,children:[Oe,Ae]}),t[93]=Ee,t[94]=De,t[95]=Oe,t[96]=Ae,t[97]=J):J=t[97];let je;t[98]!==n.personaCreaturePlaceholder||t[99]!==A.creature||t[100]!==h?(je=Ie.some(e=>e.value===A.creature)?null:(0,Q.jsx)(`input`,{className:c(D,`mt-1 text-xs`),value:A.creature,onChange:e=>h({creature:e.target.value}),placeholder:n.personaCreaturePlaceholder,autoComplete:`off`}),t[98]=n.personaCreaturePlaceholder,t[99]=A.creature,t[100]=h,t[101]=je):je=t[101];let Me;t[102]!==we||t[103]!==J||t[104]!==je?(Me=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[we,J,je]}),t[102]=we,t[103]=J,t[104]=je,t[105]=Me):Me=t[105];let Pe;t[106]!==fe||t[107]!==_e||t[108]!==Ce||t[109]!==Me?(Pe=(0,Q.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[fe,_e,Ce,Me]}),t[106]=fe,t[107]=_e,t[108]=Ce,t[109]=Me,t[110]=Pe):Pe=t[110];let Fe;t[111]!==ce||t[112]!==Pe||t[113]!==re?(Fe=(0,Q.jsxs)(xt,{children:[re,ce,Pe]}),t[111]=ce,t[112]=Pe,t[113]=re,t[114]=Fe):Fe=t[114];let Le;t[115]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,Q.jsx)(v,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),t[115]=Le):Le=t[115];let Re;t[116]===n.sharedUserContextTitle?Re=t[117]:(Re=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.sharedUserContextTitle}),t[116]=n.sharedUserContextTitle,t[117]=Re);let ze;t[118]===n.sharedUserContextHint?ze=t[119]:(ze=(0,Q.jsx)(`p`,{className:`mt-0.5 max-w-[68ch] text-xs leading-5 text-fg-muted`,children:n.sharedUserContextHint}),t[118]=n.sharedUserContextHint,t[119]=ze);let Be;t[120]!==Re||t[121]!==ze?(Be=(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[Re,ze]}),t[120]=Re,t[121]=ze,t[122]=Be):Be=t[122];let Ve;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,Q.jsx)(B,{className:`size-3`,"aria-hidden":!0}),t[123]=Ve):Ve=t[123];let He;t[124]===n.sharedUserContextLink?He=t[125]:(He=(0,Q.jsxs)(o,{to:`/you`,className:`inline-flex shrink-0 items-center gap-1 text-xs font-medium text-accent-fg hover:underline`,children:[n.sharedUserContextLink,Ve]}),t[124]=n.sharedUserContextLink,t[125]=He);let We;t[126]!==Be||t[127]!==He?(We=(0,Q.jsxs)(`div`,{className:`flex items-start gap-3 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3`,children:[Le,Be,He]}),t[126]=Be,t[127]=He,t[128]=We):We=t[128];let Ke;t[129]!==n.personaSectionSoul||t[130]!==n.personaSectionSoulHint?(Ke=(0,Q.jsx)(bt,{icon:M,title:n.personaSectionSoul,subtitle:n.personaSectionSoulHint}),t[129]=n.personaSectionSoul,t[130]=n.personaSectionSoulHint,t[131]=Ke):Ke=t[131];let qe;t[132]===n.personaSoulTemplate?qe=t[133]:(qe=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaSoulTemplate}),t[132]=n.personaSoulTemplate,t[133]=qe);let Je;t[134]===g?Je=t[135]:(Je=e=>g(e.target.value),t[134]=g,t[135]=Je);let $e;t[136]===k?$e=t[137]:($e=Ye.map(e=>(0,Q.jsxs)(Ne,{value:e.id,children:[e.emoji,` `,k(e.labelEn,e.labelZh)]},e.id)),t[136]=k,t[137]=$e);let et;t[138]!==i||t[139]!==j||t[140]!==Je||t[141]!==$e?(et=(0,Q.jsx)(Y,{className:D,value:j,onChange:Je,disabled:i,children:$e}),t[138]=i,t[139]=j,t[140]=Je,t[141]=$e,t[142]=et):et=t[142];let tt;t[143]===n.personaTemplateHint?tt=t[144]:(tt=(0,Q.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:n.personaTemplateHint}),t[143]=n.personaTemplateHint,t[144]=tt);let nt;t[145]!==qe||t[146]!==et||t[147]!==tt?(nt=(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:max-w-sm`,children:[qe,et,tt]}),t[145]=qe,t[146]=et,t[147]=tt,t[148]=nt):nt=t[148];let X;t[149]===n.personaBehaviorEditorLabel?X=t[150]:(X=(0,Q.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:n.personaBehaviorEditorLabel}),t[149]=n.personaBehaviorEditorLabel,t[150]=X);let rt;t[151]===Symbol.for(`react.memo_cache_sentinel`)?(rt=c(C,`inline-flex size-9 shrink-0 items-center justify-center rounded-md p-0 hover:bg-surface-hover`),t[151]=rt):rt=t[151];let it=I?n.personaSoulEdit:n.personaSoulPreview,at=I?n.personaSoulEdit:n.personaSoulPreview,ot;t[152]===I?ot=t[153]:(ot=I?(0,Q.jsx)(ft,{className:`size-4`,"aria-hidden":!0}):(0,Q.jsx)(T,{className:`size-4`,"aria-hidden":!0}),t[152]=I,t[153]=ot);let st;t[154]!==it||t[155]!==at||t[156]!==ot||t[157]!==b?(st=(0,Q.jsx)(`button`,{type:`button`,className:rt,title:it,"aria-label":at,onClick:b,children:ot}),t[154]=it,t[155]=at,t[156]=ot,t[157]=b,t[158]=st):st=t[158];let ct;t[159]!==X||t[160]!==st?(ct=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[X,st]}),t[159]=X,t[160]=st,t[161]=ct):ct=t[161];let ut;t[162]===Symbol.for(`react.memo_cache_sentinel`)?(ut=c(D,`flex min-h-64 flex-col overflow-hidden p-0`),t[162]=ut):ut=t[162];let dt;t[163]!==_||t[164]!==S||t[165]!==N||t[166]!==F||t[167]!==I?(dt=(0,Q.jsx)(`div`,{className:ut,children:I?(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Q.jsx)(Ze,{content:N})}):(0,Q.jsx)(ht,{initialContent:N,onChange:_,isDark:S,className:`min-h-0 flex-1`},`soul-${F}`)}),t[163]=_,t[164]=S,t[165]=N,t[166]=F,t[167]=I,t[168]=dt):dt=t[168];let pt;t[169]!==ct||t[170]!==dt?(pt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[ct,dt]}),t[169]=ct,t[170]=dt,t[171]=pt):pt=t[171];let mt;t[172]!==Ke||t[173]!==nt||t[174]!==pt?(mt=(0,Q.jsxs)(xt,{children:[Ke,nt,pt]}),t[172]=Ke,t[173]=nt,t[174]=pt,t[175]=mt):mt=t[175];let gt;return t[176]!==Fe||t[177]!==We||t[178]!==mt?(gt=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[Fe,We,mt]}),t[176]=Fe,t[177]=We,t[178]=mt,t[179]=gt):gt=t[179],gt}function Mn(e){return e.preventDefault()}function Nn(e){return e.resolved===`dark`}function Pn(e){return e.language}function Fn(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 In(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 Ln(e){let t=(0,Z.c)(117),{a:n,selected:r,defaultModel:i,defaultWorkspace:a,isTuiDefault:o,isTuiDefaultInherited:s,busy:c,onSetDefault:l,onSetTuiDefault:u,onTryInChat:d}=e,f;t[0]!==n||t[1]!==r?(f=re(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=N(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,y;t[10]!==n.listUnsetValue||t[11]!==a||t[12]!==r.workspace?(y=r.workspace?.trim()||a||n.listUnsetValue,t[10]=n.listUnsetValue,t[11]=a,t[12]=r.workspace,t[13]=y):y=t[13];let b=y,x=r.model?.primary?.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,S=r.workspace?.trim()&&r.workspace.trim()!==a.trim()?n.inheritance.badgeOverride:n.inheritance.badgeInherit,C=r.tools.effectiveDisable.length,T=r.skills.effectiveAllowlist?.length,E;t[14]!==r.avatar||t[15]!==r.id?(E=(0,Q.jsx)(`div`,{className:`flex size-14 shrink-0 items-center justify-center overflow-hidden rounded-2xl bg-surface-base ring-1 ring-edge-subtle/50`,children:(0,Q.jsx)(lt,{agentId:r.id,avatar:r.avatar,size:56,className:`size-full`})}),t[14]=r.avatar,t[15]=r.id,t[16]=E):E=t[16];let D;t[17]===p?D=t[18]:(D=(0,Q.jsx)(`h2`,{className:`truncate text-lg font-semibold text-fg`,children:p}),t[17]=p,t[18]=D);let O;t[19]!==n.globalDefaultBadge||t[20]!==r.isDefault?(O=r.isDefault?(0,Q.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-xs font-medium text-accent`,children:n.globalDefaultBadge}):null,t[19]=n.globalDefaultBadge,t[20]=r.isDefault,t[21]=O):O=t[21];let 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]!==D||t[28]!==O||t[29]!==k?(A=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:[D,O,k]}),t[27]=D,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 P;t[36]!==M||t[37]!==E?(P=(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[E,M]}),t[36]=M,t[37]=E,t[38]=P):P=t[38];let F;t[39]!==n.tryInChat||t[40]!==c||t[41]!==d?(F=d?(0,Q.jsxs)(W,{type:`button`,disabled:c,onClick:d,children:[(0,Q.jsx)(K,{className:`size-4`,"aria-hidden":!0}),n.tryInChat]}):null,t[39]=n.tryInChat,t[40]=c,t[41]=d,t[42]=F):F=t[42];let I;t[43]!==n.setDefault||t[44]!==c||t[45]!==l||t[46]!==r.isDefault?(I=r.isDefault?null:(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:c,onClick:l,children:n.setDefault}),t[43]=n.setDefault,t[44]=c,t[45]=l,t[46]=r.isDefault,t[47]=I):I=t[47];let L;t[48]!==n.setTuiDefault||t[49]!==c||t[50]!==o||t[51]!==u?(L=o?null:(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:c,onClick:u,children:n.setTuiDefault}),t[48]=n.setTuiDefault,t[49]=c,t[50]=o,t[51]=u,t[52]=L):L=t[52];let ee;t[53]!==F||t[54]!==I||t[55]!==L?(ee=(0,Q.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-2`,children:[F,I,L]}),t[53]=F,t[54]=I,t[55]=L,t[56]=ee):ee=t[56];let R;t[57]!==P||t[58]!==ee?(R=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between`,children:[P,ee]}),t[57]=P,t[58]=ee,t[59]=R):R=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]!==R||t[63]!==z?(B=(0,Q.jsx)(xt,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[R,z]})}),t[62]=R,t[63]=z,t[64]=B):B=t[64];let te;t[65]!==n.overviewRuntimeHint||t[66]!==n.overviewRuntimeTitle?(te=(0,Q.jsx)(bt,{icon:Ue,title:n.overviewRuntimeTitle,subtitle:n.overviewRuntimeHint}),t[65]=n.overviewRuntimeHint,t[66]=n.overviewRuntimeTitle,t[67]=te):te=t[67];let ne;t[68]!==n.modelPrimary||t[69]!==x||t[70]!==_?(ne=(0,Q.jsx)(Fn,{label:n.modelPrimary,value:_,badge:x,mono:!0}),t[68]=n.modelPrimary,t[69]=x,t[70]=_,t[71]=ne):ne=t[71];let ae;t[72]!==n.workspacePath||t[73]!==S||t[74]!==b?(ae=(0,Q.jsx)(Fn,{label:n.workspacePath,value:b,badge:S,mono:!0}),t[72]=n.workspacePath,t[73]=S,t[74]=b,t[75]=ae):ae=t[75];let V;t[76]!==ne||t[77]!==ae?(V=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[ne,ae]}),t[76]=ne,t[77]=ae,t[78]=V):V=t[78];let H;t[79]!==te||t[80]!==V?(H=(0,Q.jsxs)(xt,{children:[te,V]}),t[79]=te,t[80]=V,t[81]=H):H=t[81];let U;t[82]!==n.overviewCapabilitiesHint||t[83]!==n.overviewCapabilitiesTitle?(U=(0,Q.jsx)(bt,{icon:w,title:n.overviewCapabilitiesTitle,subtitle:n.overviewCapabilitiesHint}),t[82]=n.overviewCapabilitiesHint,t[83]=n.overviewCapabilitiesTitle,t[84]=U):U=t[84];let G;t[85]!==n.listToolsAllEnabled||t[86]!==n.listToolsDisabledCount||t[87]!==C?(G=C>0?n.listToolsDisabledCount.replace(`{{count}}`,String(C)):n.listToolsAllEnabled,t[85]=n.listToolsAllEnabled,t[86]=n.listToolsDisabledCount,t[87]=C,t[88]=G):G=t[88];let q;t[89]!==n.listToolsLabel||t[90]!==G?(q=(0,Q.jsx)(In,{icon:ie,label:n.listToolsLabel,value:G}),t[89]=n.listToolsLabel,t[90]=G,t[91]=q):q=t[91];let oe;t[92]!==n.listInheritedValue||t[93]!==n.listSkillsCount||t[94]!==T?(oe=T?n.listSkillsCount.replace(`{{count}}`,String(T)):n.listInheritedValue,t[92]=n.listInheritedValue,t[93]=n.listSkillsCount,t[94]=T,t[95]=oe):oe=t[95];let se;t[96]!==n.listSkillsLabel||t[97]!==oe?(se=(0,Q.jsx)(In,{icon:Ue,label:n.listSkillsLabel,value:oe}),t[96]=n.listSkillsLabel,t[97]=oe,t[98]=se):se=t[98];let ce;t[99]!==n.connectionsTitle||t[100]!==n.overviewConnectionsManaged?(ce=(0,Q.jsx)(In,{icon:ct,label:n.connectionsTitle,value:n.overviewConnectionsManaged}),t[99]=n.connectionsTitle,t[100]=n.overviewConnectionsManaged,t[101]=ce):ce=t[101];let le;t[102]!==n.overviewSharedMemoryLabel||t[103]!==n.overviewSharedMemoryValue?(le=(0,Q.jsx)(In,{icon:v,label:n.overviewSharedMemoryLabel,value:n.overviewSharedMemoryValue}),t[102]=n.overviewSharedMemoryLabel,t[103]=n.overviewSharedMemoryValue,t[104]=le):le=t[104];let ue;t[105]!==q||t[106]!==se||t[107]!==ce||t[108]!==le?(ue=(0,Q.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[q,se,ce,le]}),t[105]=q,t[106]=se,t[107]=ce,t[108]=le,t[109]=ue):ue=t[109];let de;t[110]!==U||t[111]!==ue?(de=(0,Q.jsxs)(xt,{children:[U,ue]}),t[110]=U,t[111]=ue,t[112]=de):de=t[112];let fe;return t[113]!==B||t[114]!==H||t[115]!==de?(fe=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-5 overflow-y-auto`,children:[B,H,de]}),t[113]=B,t[114]=H,t[115]=de,t[116]=fe):fe=t[116],fe}var Rn=[`deep`,`fast`,`cheap`,`code`,`review`];function zn(e){return Rn.includes(e)}function Bn(e){let{rows:t,onChange:n,disabled:r,defaultRole:i,chat:a,labels:o}=e,{data:s=[]}=p(Ce,Oe,{revalidateOnFocus:!1}),c=(0,$.useMemo)(()=>new Set(s.filter(e=>e.vision===!0).map(e=>e.id)),[s]),l=(0,$.useRef)([]),u=(0,$.useRef)(0);for(;l.current.length<t.length;)l.current.push(`typed-model-row-${u.current++}`);l.current.length>t.length&&(l.current.length=t.length);let d=(e,r)=>{n(t.map((t,n)=>n===e?{...t,...r}:t))},f=(e,n,r)=>{let i=t[e];if(!i)return;let a=[...i.fallbacks??[]];a[n]=r,d(e,{fallbacks:a})},m=e=>{let n=t[e];n&&d(e,{fallbacks:[...n.fallbacks??[],``]})},h=(e,n)=>{let r=t[e];r&&d(e,{fallbacks:(r.fallbacks??[]).filter((e,t)=>t!==n)})},g=e=>{l.current.splice(e,1),n(t.filter((t,n)=>n!==e))},_=e=>{l.current.push(`typed-model-row-${u.current++}`),n([...t,e])},v=t.find(e=>e.model.trim())?.model??``,y=t.map((e,t)=>({row:e,index:t})),b=Rn.map(e=>y.find(t=>t.row.id===e)).filter(e=>!!e),x=y.filter(e=>!zn(e.row.id)),S=Rn.filter(e=>!t.some(t=>t.id===e)),C=(e,t)=>{let{row:n,index:s}=e,u=n.id===i,p=[n.model,...n.fallbacks??[]].some(e=>c.has(e.trim())),_=zn(n.id)?o.roleNames[n.id]:o.id,v=zn(n.id)?o.roleDescriptions[n.id]:``;return(0,Q.jsxs)(`div`,{className:`grid gap-3 rounded-lg bg-surface-panel/70 p-3 shadow-surface lg:grid-cols-[minmax(0,11rem)_minmax(0,1fr)_auto] lg:items-start`,children:[t.recommended?(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:_}),u?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full border border-accent/25 bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:o.defaultBadge}):null,p?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full border border-accent/25 bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:o.visionBadge}):null]}),(0,Q.jsx)(`div`,{className:`mt-1 truncate font-mono text-[11px] text-fg-subtle`,children:n.id}),v?(0,Q.jsx)(`div`,{className:`mt-1 line-clamp-2 text-xs text-fg-muted`,children:v}):null]}):(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[(0,Q.jsx)(`span`,{children:o.id}),p?(0,Q.jsx)(`span`,{className:`shrink-0 rounded-full border border-accent/25 bg-accent/10 px-2 py-0.5 text-[11px] font-medium text-accent`,children:o.visionBadge}):null]}),(0,Q.jsx)(`input`,{type:`text`,className:jt(),value:n.id,disabled:r,placeholder:o.idPlaceholder,"aria-label":o.id,onChange:e=>d(s,{id:e.target.value.toLowerCase()})})]}),(0,Q.jsxs)(`div`,{className:`grid min-w-0 gap-2`,children:[(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:o.primaryModel}),(0,Q.jsx)(F,{value:n.model,disabled:r,placeholder:a.modelPlaceholder,searchPlaceholder:a.modelSearchPlaceholder,noMatches:a.modelNoMatches,className:`w-full max-w-none`,contentAlign:`start`,onChange:e=>d(s,{model:e})}),p?(0,Q.jsx)(`div`,{className:`text-xs leading-relaxed text-fg-muted`,children:o.visionAutoHint}):null]}),(0,Q.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:o.fallbackModels}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,className:`h-7 gap-1 px-2 text-xs`,disabled:r,onClick:()=>m(s),children:[(0,Q.jsx)(H,{className:`size-3.5`,strokeWidth:1.75}),o.addFallback]})]}),(n.fallbacks??[]).length>0?(0,Q.jsx)(`div`,{className:`grid gap-1.5`,children:(n.fallbacks??[]).map((e,t)=>(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-2`,children:[(0,Q.jsx)(F,{value:e,disabled:r,placeholder:o.fallbackPlaceholder,searchPlaceholder:a.modelSearchPlaceholder,noMatches:a.modelNoMatches,className:`w-full max-w-none`,contentAlign:`start`,onChange:e=>f(s,t,e)}),(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`shrink-0 px-2`,disabled:r,"aria-label":o.removeFallback,onClick:()=>h(s,t),children:(0,Q.jsx)(De,{className:`size-4`,strokeWidth:1.75})})]},`${l.current[s]??s}-fallback-${t}`))}):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-xs text-fg-muted shadow-surface`,children:o.fallbackEmptyHint})]}),(0,Q.jsx)(`input`,{type:`text`,className:jt(),value:n.description,disabled:r,placeholder:o.descriptionPlaceholder,"aria-label":o.description,onChange:e=>d(s,{description:e.target.value})})]}),(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`shrink-0 sm:mt-0`,disabled:r||u,"aria-label":o.remove,onClick:()=>g(s),children:(0,Q.jsx)(De,{className:`size-4`,strokeWidth:1.75})})]},l.current[s]??`typed-model-row-${s}`)};return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-fg-muted`,children:o.recommendedTitle}),b.map(e=>C(e,{recommended:!0})),S.length>0?(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-2 pt-1`,children:S.map(e=>(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,className:`h-8 gap-1.5 rounded-lg px-2.5 text-xs`,disabled:r,onClick:()=>_({id:e,description:o.roleDescriptions[e],model:v,fallbacks:[]}),children:[(0,Q.jsx)(H,{className:`size-3.5 shrink-0`,strokeWidth:1.75}),o.addPurpose.replace(`{name}`,o.roleNames[e])]},e))}):null]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(`div`,{className:`text-xs font-medium uppercase tracking-wide text-fg-muted`,children:o.customTitle}),x.length>0?x.map(e=>C(e,{recommended:!1})):(0,Q.jsx)(`div`,{className:`rounded-lg bg-surface-panel/60 px-3 py-2 text-sm text-fg-muted shadow-surface`,children:o.noCustomRoles})]}),(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,className:`w-fit gap-1.5`,disabled:r,onClick:()=>_({id:``,description:``,model:v,fallbacks:[]}),children:[(0,Q.jsx)(H,{className:`size-4 shrink-0`,strokeWidth:1.75}),o.add]})]})}function Vn(e){let t=(0,Z.c)(73),{a:n,chat:r,selected:i,busy:a,modelRows:s,setModelRows:c,onSaveModels:l,onClearModelsEntry:u,hideInlineSave:d}=e,f;t[0]!==n.modelsTabHint||t[1]!==n.modelsTabTitle?(f=(0,Q.jsx)(bt,{className:`shrink-0`,icon:Ae,title:n.modelsTabTitle,subtitle:n.modelsTabHint}),t[0]=n.modelsTabHint,t[1]=n.modelsTabTitle,t[2]=f):f=t[2];let p;t[3]===n.modelsPresetLabel?p=t[4]:(p=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsPresetLabel}),t[3]=n.modelsPresetLabel,t[4]=p);let m;t[5]===i.typedModels.preset?m=t[6]:(m=kt(i.typedModels.preset),t[5]=i.typedModels.preset,t[6]=m);let h;t[7]!==p||t[8]!==m?(h=(0,Q.jsxs)(`div`,{children:[p,` `,m]}),t[7]=p,t[8]=m,t[9]=h):h=t[9];let g;t[10]===n.modelsEffectiveLabel?g=t[11]:(g=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.modelsEffectiveLabel}),t[10]=n.modelsEffectiveLabel,t[11]=g);let _;t[12]===i.typedModels.effective?_=t[13]:(_=kt(i.typedModels.effective),t[12]=i.typedModels.effective,t[13]=_);let v;t[14]!==g||t[15]!==_?(v=(0,Q.jsxs)(`div`,{children:[g,` `,_]}),t[14]=g,t[15]=_,t[16]=v):v=t[16];let y;t[17]!==h||t[18]!==v?(y=(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:[h,v]}),t[17]=h,t[18]=v,t[19]=y):y=t[19];let b;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?(b={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]=b):b=t[41];let x;t[42]!==a||t[43]!==r||t[44]!==s||t[45]!==i.typedModels.defaultRole||t[46]!==c||t[47]!==b?(x=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto overscroll-contain`,children:(0,Q.jsx)(Bn,{rows:s,onChange:c,disabled:a,defaultRole:i.typedModels.defaultRole,chat:r,labels:b})}),t[42]=a,t[43]=r,t[44]=s,t[45]=i.typedModels.defaultRole,t[46]=c,t[47]=b,t[48]=x):x=t[48];let S;t[49]!==n.modelsSave||t[50]!==a||t[51]!==d||t[52]!==l?(S=d?null:(0,Q.jsx)(W,{type:`button`,disabled:a,onClick:()=>void l(),children:n.modelsSave}),t[49]=n.modelsSave,t[50]=a,t[51]=d,t[52]=l,t[53]=S):S=t[53];let C;t[54]===u?C=t[55]:(C=()=>void u(),t[54]=u,t[55]=C);let w;t[56]!==n.modelsResetInherit||t[57]!==a||t[58]!==C?(w=(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:a,onClick:C,children:n.modelsResetInherit}),t[56]=n.modelsResetInherit,t[57]=a,t[58]=C,t[59]=w):w=t[59];let T,E;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(T=Le(`models`),E=(0,Q.jsx)(Re,{className:`size-4`,"aria-hidden":!0}),t[60]=T,t[61]=E):(T=t[60],E=t[61]);let D;t[62]===n.modelsDefaultsLink?D=t[63]:(D=(0,Q.jsx)(W,{asChild:!0,variant:`ghost`,children:(0,Q.jsxs)(o,{to:T,children:[E,n.modelsDefaultsLink]})}),t[62]=n.modelsDefaultsLink,t[63]=D);let O;t[64]!==S||t[65]!==w||t[66]!==D?(O=(0,Q.jsxs)(`div`,{className:`mt-4 flex shrink-0 flex-wrap gap-2`,children:[S,w,D]}),t[64]=S,t[65]=w,t[66]=D,t[67]=O):O=t[67];let k;return t[68]!==f||t[69]!==O||t[70]!==y||t[71]!==x?(k=(0,Q.jsxs)(xt,{className:`flex min-h-0 flex-1 flex-col`,children:[f,y,x,O]}),t[68]=f,t[69]=O,t[70]=y,t[71]=x,t[72]=k):k=t[72],k}function Hn(e){let t=(0,Z.c)(29),{a:n,chat:r,selected:i,busy:a,editWorkspace:o,setEditWorkspace:s,modelRows:l,setModelRows:u,onSaveModels:d,onClearModelsEntry:f}=e,p;t[0]!==n.runtimeWorkspaceHint||t[1]!==n.runtimeWorkspaceTitle?(p=(0,Q.jsx)(bt,{icon:oe,title:n.runtimeWorkspaceTitle,subtitle:n.runtimeWorkspaceHint}),t[0]=n.runtimeWorkspaceHint,t[1]=n.runtimeWorkspaceTitle,t[2]=p):p=t[2];let m;t[3]===n.workspacePath?m=t[4]:(m=(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n.workspacePath}),t[3]=n.workspacePath,t[4]=m);let h=r.workingDirectory,g;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=c(cn(),`font-mono text-xs`),t[5]=g):g=t[5];let _;t[6]!==a||t[7]!==r.workingDirectory||t[8]!==o||t[9]!==s?(_=(0,Q.jsx)(It,{value:o,onChange:s,disabled:a,wd:h,inputClassName:g}),t[6]=a,t[7]=r.workingDirectory,t[8]=o,t[9]=s,t[10]=_):_=t[10];let v;t[11]!==m||t[12]!==_?(v=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[m,_]}),t[11]=m,t[12]=_,t[13]=v):v=t[13];let y;t[14]!==p||t[15]!==v?(y=(0,Q.jsxs)(xt,{children:[p,v]}),t[14]=p,t[15]=v,t[16]=y):y=t[16];let b;t[17]!==n||t[18]!==a||t[19]!==r||t[20]!==l||t[21]!==f||t[22]!==d||t[23]!==i||t[24]!==u?(b=(0,Q.jsx)(`section`,{className:`min-h-[34rem]`,children:(0,Q.jsx)(Vn,{a:n,chat:r,selected:i,busy:a,modelRows:l,setModelRows:u,onSaveModels:d,onClearModelsEntry:f,hideInlineSave:!0})}),t[17]=n,t[18]=a,t[19]=r,t[20]=l,t[21]=f,t[22]=d,t[23]=i,t[24]=u,t[25]=b):b=t[25];let x;return t[26]!==y||t[27]!==b?(x=(0,Q.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-6 overflow-y-auto`,children:[y,b]}),t[26]=y,t[27]=b,t[28]=x):x=t[28],x}function Un(e){let t=(0,Z.c)(107),{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,defaultModel:g,defaultWorkspace:_,onSetDefault:v,onSetTuiDefault:y,isTuiDefault:b,isTuiDefaultInherited:x,onDelete:S,capabilityPresets:C,defaultPresetId:w,onUpdateAgentExtends:T,onOpenCapabilityPreset:E,overviewProfile:D,filesLoading:O,files:k,activeFile:A,setActiveFile:j,filesViewMode:M,setFilesViewMode:N,fileDraft:P,setFileDraft:F,fileSaving:I,profileFileLoading:L,profileEditorNonce:ee,toolEntryDisable:R,setToolEntryDisable:z,onSaveTools:B,onClearToolsEntry:te,modelRows:ne,setModelRows:re,onSaveModels:ie,onClearModelsEntry:ae,skillsCatalogLoading:V,catalogForPick:H,skillsInherit:U,setSkillsInherit:W,skillsPick:G,setSkillsPick:K,onSaveSkills:q,bindingsLoading:oe,agentBindings:se,bindChannelStatuses:ce,bindChannelsLoading:le,useManualChannel:ue,newBindChannel:de,setNewBindChannel:fe,bindSessionChats:pe,bindSessionsLoading:me,newBindSessionIdx:he,setNewBindSessionIdx:ge,newBindCustomPeer:_e,setNewBindCustomPeer:ve,refreshBindSessions:ye,onRemoveBinding:be,onAddBinding:xe,onTryInChat:Se}=e;if(!a){let e;return t[0]===n.selectAgentHint?e=t[1]:(e=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[0]=n.selectAgentHint,t[1]=e),e}if(o===`overview`){let e;return t[2]!==n||t[3]!==c||t[4]!==g||t[5]!==_||t[6]!==b||t[7]!==x||t[8]!==v||t[9]!==y||t[10]!==Se||t[11]!==a?(e=(0,Q.jsx)(Ln,{a:n,selected:a,defaultModel:g,defaultWorkspace:_,isTuiDefault:b,isTuiDefaultInherited:x,busy:c,onSetDefault:v,onSetTuiDefault:y,onTryInChat:Se}),t[2]=n,t[3]=c,t[4]=g,t[5]=_,t[6]=b,t[7]=x,t[8]=v,t[9]=y,t[10]=Se,t[11]=a,t[12]=e):e=t[12],e}if(o===`profile`){let e;return t[13]!==n||t[14]!==c||t[15]!==d||t[16]!==l||t[17]!==D.draft||t[18]!==D.handleSoulContentChange||t[19]!==D.handleSoulTemplateChange||t[20]!==D.profileMarkdownLoading||t[21]!==D.setAvatarDialogOpen||t[22]!==D.toggleSoulPreviewMode||t[23]!==D.updateIdentity||t[24]!==a||t[25]!==f||t[26]!==u?(e=(0,Q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:(0,Q.jsx)(jn,{a:n,selected:a,busy:c,editName:l,setEditName:u,editDescription:d,setEditDescription:f,profileMarkdownLoading:D.profileMarkdownLoading,profileDraft:D.draft,updateIdentity:D.updateIdentity,handleSoulTemplateChange:D.handleSoulTemplateChange,handleSoulContentChange:D.handleSoulContentChange,setAvatarDialogOpen:D.setAvatarDialogOpen,toggleSoulPreviewMode:D.toggleSoulPreviewMode})}),t[13]=n,t[14]=c,t[15]=d,t[16]=l,t[17]=D.draft,t[18]=D.handleSoulContentChange,t[19]=D.handleSoulTemplateChange,t[20]=D.profileMarkdownLoading,t[21]=D.setAvatarDialogOpen,t[22]=D.toggleSoulPreviewMode,t[23]=D.updateIdentity,t[24]=a,t[25]=f,t[26]=u,t[27]=e):e=t[27],e}if(o===`capabilities`){let e;return t[28]!==n||t[29]!==c||t[30]!==H||t[31]!==s||t[32]!==te||t[33]!==q||t[34]!==B||t[35]!==a||t[36]!==W||t[37]!==K||t[38]!==z||t[39]!==V||t[40]!==U||t[41]!==G||t[42]!==R?(e=(0,Q.jsx)(Tn,{a:n,data:s,selected:a,busy:c,toolEntryDisable:R,setToolEntryDisable:z,onSaveTools:B,onClearToolsEntry:te,skillsCatalogLoading:V,catalogForPick:H,skillsInherit:U,setSkillsInherit:W,skillsPick:G,setSkillsPick:K,onSaveSkills:q}),t[28]=n,t[29]=c,t[30]=H,t[31]=s,t[32]=te,t[33]=q,t[34]=B,t[35]=a,t[36]=W,t[37]=K,t[38]=z,t[39]=V,t[40]=U,t[41]=G,t[42]=R,t[43]=e):e=t[43],e}if(o===`runtime`){let e;return t[44]!==n||t[45]!==c||t[46]!==r||t[47]!==p||t[48]!==ne||t[49]!==ae||t[50]!==ie||t[51]!==a||t[52]!==m||t[53]!==re?(e=(0,Q.jsx)(Hn,{a:n,chat:r,selected:a,busy:c,editWorkspace:p,setEditWorkspace:m,modelRows:ne,setModelRows:re,onSaveModels:ie,onClearModelsEntry:ae}),t[44]=n,t[45]=c,t[46]=r,t[47]=p,t[48]=ne,t[49]=ae,t[50]=ie,t[51]=a,t[52]=m,t[53]=re,t[54]=e):e=t[54],e}if(o===`connections`){let e;return t[55]!==n||t[56]!==se||t[57]!==ce||t[58]!==le||t[59]!==pe||t[60]!==me||t[61]!==oe||t[62]!==c||t[63]!==i.lastActiveLabels||t[64]!==i.selectRecipient||t[65]!==de||t[66]!==_e||t[67]!==he||t[68]!==xe||t[69]!==be||t[70]!==ye||t[71]!==fe||t[72]!==ve||t[73]!==ge||t[74]!==ue?(e=(0,Q.jsx)(Dn,{a:n,busy:c,bindingsLoading:oe,agentBindings:se,channelStatuses:ce,channelsStatusLoading:le,useManualChannel:ue,newBindChannel:de,setNewBindChannel:fe,bindSessionChats:pe,sessionsLoading:me,newBindSessionIdx:he,setNewBindSessionIdx:ge,newBindCustomPeer:_e,setNewBindCustomPeer:ve,onRefreshSessions:ye,lastActiveLabels:i.lastActiveLabels,selectRecipient:i.selectRecipient,onRemoveBinding:be,onAddBinding:xe}),t[55]=n,t[56]=se,t[57]=ce,t[58]=le,t[59]=pe,t[60]=me,t[61]=oe,t[62]=c,t[63]=i.lastActiveLabels,t[64]=i.selectRecipient,t[65]=de,t[66]=_e,t[67]=he,t[68]=xe,t[69]=be,t[70]=ye,t[71]=fe,t[72]=ve,t[73]=ge,t[74]=ue,t[75]=e):e=t[75],e}if(o===`advanced`){let e;return t[76]!==n||t[77]!==A||t[78]!==c||t[79]!==C||t[80]!==g||t[81]!==w||t[82]!==_||t[83]!==h||t[84]!==p||t[85]!==P||t[86]!==I||t[87]!==k||t[88]!==O||t[89]!==M||t[90]!==E||t[91]!==Se||t[92]!==T||t[93]!==ee||t[94]!==L||t[95]!==a||t[96]!==j||t[97]!==F||t[98]!==N?(e=(0,Q.jsx)(pn,{a:n,selected:a,busy:c,defaultModel:g,defaultWorkspace:_,agentModel:h,agentWorkspace:p,capabilityPresets:C,defaultPresetId:w,onUpdateAgentExtends:T,onOpenCapabilityPreset:E,filesLoading:O,files:k,activeFile:A,setActiveFile:j,filesViewMode:M,setFilesViewMode:N,fileDraft:P,setFileDraft:F,fileSaving:I,profileFileLoading:L,profileEditorNonce:ee,onTryInChat:Se}),t[76]=n,t[77]=A,t[78]=c,t[79]=C,t[80]=g,t[81]=w,t[82]=_,t[83]=h,t[84]=p,t[85]=P,t[86]=I,t[87]=k,t[88]=O,t[89]=M,t[90]=E,t[91]=Se,t[92]=T,t[93]=ee,t[94]=L,t[95]=a,t[96]=j,t[97]=F,t[98]=N,t[99]=e):e=t[99],e}if(o===`dangerZone`){let e;return t[100]!==n||t[101]!==c||t[102]!==S||t[103]!==a?(e=(0,Q.jsx)(sn,{a:n,selected:a,busy:c,onDelete:S}),t[100]=n,t[101]=c,t[102]=S,t[103]=a,t[104]=e):e=t[104],e}let Ce;return t[105]===n.selectAgentHint?Ce=t[106]:(Ce=(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.selectAgentHint}),t[105]=n.selectAgentHint,t[106]=Ce),Ce}function Wn(e,t,n){let r=t.trim().toLowerCase();return r?e.filter(e=>{let t=re(e,n).toLowerCase(),i=e.id.toLowerCase(),a=e.workspace.toLowerCase(),o=N(e,n).toLowerCase();return t.includes(r)||i.includes(r)||a.includes(r)||o.includes(r)}):e}function Gn(e,t){return e.replace(`{{count}}`,String(t))}function Kn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Gn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Gn(t.listSkillsCount,r):t.listInheritedValue;return`${t.listToolsLabel} ${i} · ${t.listSkillsLabel} ${a}`}function qn(e,t){let n=e.tools.effectiveDisable.length,r=e.skills.effectiveAllowlist?.length??0,i=n>0?Gn(t.listToolsDisabledCount,n):t.listToolsAllEnabled,a=r>0?Gn(t.listSkillsCount,r):t.listInheritedValue;return[`${t.listToolsLabel} ${i}`,`${t.listSkillsLabel} ${a}`]}function Jn(e){let t=(0,Z.c)(11),{text:n,children:r,className:i}=e,a;t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(fe,{asChild:!0,children:(0,Q.jsx)(`span`,{className:i,title:n,children:r})}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3];let o;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(o=c(`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`,Ve),t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(q,{className:`fill-surface-panel`}),t[5]=s):s=t[5];let l;t[6]===n?l=t[7]:(l=(0,Q.jsx)(h,{children:(0,Q.jsxs)(pt,{side:`top`,align:`start`,sideOffset:6,className:o,children:[n,s]})}),t[6]=n,t[7]=l);let u;return t[8]!==a||t[9]!==l?(u=(0,Q.jsx)(_e,{delayDuration:300,skipDelayDuration:100,children:(0,Q.jsxs)(A,{children:[a,l]})}),t[8]=a,t[9]=l,t[10]=u):u=t[10],u}function Yn(e){let t=(0,Z.c)(34),{a:n,agents:r,defaultAgentId:i,tuiDefaultAgentId:a,tuiDefaultInherited:o,searchQuery:s,onOpenAgent:l,onChatWithAgent:u,busy:d}=e,f,p,m,h,g;if(t[0]!==n||t[1]!==r||t[2]!==d||t[3]!==i||t[4]!==u||t[5]!==l||t[6]!==s||t[7]!==a||t[8]!==o){g=Symbol.for(`react.early_return_sentinel`);bb0:{let e=Wn(r,s,n),_=r.length>0&&e.length===0&&s.trim().length>0;if(r.length===0){let e;t[14]===n.listNoAgentsYet?e=t[15]:(e=(0,Q.jsx)(`p`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:n.listNoAgentsYet}),t[14]=n.listNoAgentsYet,t[15]=e),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]!==i||t[22]!==u||t[23]!==l||t[24]!==a||t[25]!==o?(v=e=>{let t=re(e,n),r=e.id,s=N(e,n),f=Kn(e,n),p=qn(e,n),m=e.id===i||e.isDefault,h=e.id===a,g=h&&o,_=h&&!o;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:c(`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`,b.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)(lt,{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 p-3`,children:(0,Q.jsx)(`p`,{className:c(`line-clamp-2 text-sm leading-5`,s?`text-fg`:`text-fg-muted`),title:s||void 0,children:s||n.listNoDescription})}),(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap gap-1.5`,title:f,children:p.map(Xn)})]}),(0,Q.jsx)(`div`,{className:`mt-auto pt-4`,children:(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,disabled:d,onClick:t=>{t.stopPropagation(),u(e.id)},className:`w-full rounded-2xl py-2.5`,children:[(0,Q.jsx)(K,{className:`size-4 shrink-0`,strokeWidth:2,"aria-hidden":!0}),n.listChatWithAgent]})})]})},e.id)},t[19]=n,t[20]=d,t[21]=i,t[22]=u,t[23]=l,t[24]=a,t[25]=o,t[26]=v):v=t[26],p=e.map(v)}t[0]=n,t[1]=r,t[2]=d,t[3]=i,t[4]=u,t[5]=l,t[6]=s,t[7]=a,t[8]=o,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 Xn(e){return(0,Q.jsx)(Jn,{text:e,className:`rounded-full bg-surface-hover px-2 py-0.5 text-xs text-fg-muted`,children:e},e)}function Zn(e){let t=(0,Z.c)(163),{open:n,onOpenChange:r,a:i,chat:a,busy:o,modalError:s,profileLanguageLabel:l,createDisplayName:u,setCreateDisplayName:d,createAgentId:f,setCreateAgentId:p,createDescription:m,setCreateDescription:h,createWorkspace:g,setCreateWorkspace:_,createModel:v,setCreateModel:y,onCreate:b,onSuggestWorkspace:x,agents:S,duplicateSourceId:w,onSelectDuplicateSource:T,capabilityPlans:D,defaultPresetId:O,selectedCapabilityPlanIds:k,onSelectedCapabilityPlanIdsChange:A}=e,[j,M]=(0,$.useState)(null),N;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(Qe,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim`,Ge)}),t[0]=N):N=t[0];let I;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(I=c(`xopc-dialog-content fixed left-1/2 top-1/2 flex h-[min(90vh,680px)] w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2 flex-col`,Xe,`overflow-hidden rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`),t[1]=I):I=t[1];let L;t[2]===i.addAgent?L=t[3]:(L=(0,Q.jsx)(Te,{className:`text-base font-semibold text-fg`,children:i.addAgent}),t[2]=i.addAgent,t[3]=L);let R;t[4]===i.addAgentHint?R=t[5]:(R=(0,Q.jsx)(te,{className:`mt-0.5 text-xs text-fg-muted`,children:i.addAgentHint}),t[4]=i.addAgentHint,t[5]=R);let z;t[6]!==L||t[7]!==R?(z=(0,Q.jsxs)(`div`,{className:`min-w-0 pr-2`,children:[L,R]}),t[6]=L,t[7]=R,t[8]=z):z=t[8];let B;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(B=c(C,`shrink-0 p-1.5 hover:bg-surface-base`),t[9]=B):B=t[9];let ne;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(P,{className:`size-4`,"aria-hidden":!0}),t[10]=ne):ne=t[10];let ie;t[11]===i.closeDialogAria?ie=t[12]:(ie=(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:B,"aria-label":i.closeDialogAria,children:ne})}),t[11]=i.closeDialogAria,t[12]=ie);let ae;t[13]!==z||t[14]!==ie?(ae=(0,Q.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-2`,children:[z,ie]}),t[13]=z,t[14]=ie,t[15]=ae):ae=t[15];let V;t[16]!==i||t[17]!==S||t[18]!==w||t[19]!==T?(V=S.length>0?(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.copyFromExistingAgent}),(0,Q.jsxs)(Y,{className:c(cn(),`bg-surface-panel`),value:w??``,onChange:e=>T(e.target.value||null),children:[(0,Q.jsx)(Ne,{value:``,children:i.copyFromExistingAgentNone}),S.map(e=>(0,Q.jsxs)(Ne,{value:e.id,children:[re(e,i),` · `,e.id]},e.id))]}),(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.duplicateAgentHint})]}):null,t[16]=i,t[17]=S,t[18]=w,t[19]=T,t[20]=V):V=t[20];let H;t[21]===i.createCapabilityPlansTitle?H=t[22]:(H=(0,Q.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:i.createCapabilityPlansTitle}),t[21]=i.createCapabilityPlansTitle,t[22]=H);let U;t[23]===i.createCapabilityPlansHint?U=t[24]:(U=(0,Q.jsx)(`p`,{className:`mt-1 text-xs leading-relaxed text-fg-muted`,children:i.createCapabilityPlansHint}),t[23]=i.createCapabilityPlansHint,t[24]=U);let G;t[25]!==i.capabilityPresetsGlobalDefault||t[26]!==D||t[27]!==O?(G=D.find(e=>e.id===O)?.name??i.capabilityPresetsGlobalDefault,t[25]=i.capabilityPresetsGlobalDefault,t[26]=D,t[27]=O,t[28]=G):G=t[28];let K;t[29]===G?K=t[30]:(K=(0,Q.jsx)(`div`,{className:`mt-2 rounded-md bg-accent/5 px-2.5 py-2 text-xs text-fg-muted`,children:G}),t[29]=G,t[30]=K);let q;if(t[31]!==o||t[32]!==D||t[33]!==O||t[34]!==A||t[35]!==k){let e;t[37]===O?e=t[38]:(e=e=>e.id!==O,t[37]=O,t[38]=e);let n;t[39]!==o||t[40]!==A||t[41]!==k?(n=e=>{let t=k.includes(e.id);return(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-md bg-surface-panel px-2.5 py-2`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 shrink-0 rounded border-edge`,checked:t,disabled:o,onChange:()=>A(t?k.filter(t=>t!==e.id):[...k,e.id])}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.name}),e.description?(0,Q.jsx)(`span`,{className:`mt-0.5 line-clamp-2 block text-xs text-fg-muted`,children:e.description}):null]})]},e.id)},t[39]=o,t[40]=A,t[41]=k,t[42]=n):n=t[42],q=D.filter(e).map(n),t[31]=o,t[32]=D,t[33]=O,t[34]=A,t[35]=k,t[36]=q}else q=t[36];let oe;t[43]===q?oe=t[44]:(oe=(0,Q.jsx)(`div`,{className:`mt-2 grid gap-2`,children:q}),t[43]=q,t[44]=oe);let se;t[45]!==H||t[46]!==U||t[47]!==K||t[48]!==oe?(se=(0,Q.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base p-3 dark:border-edge`,children:[H,U,K,oe]}),t[45]=H,t[46]=U,t[47]=K,t[48]=oe,t[49]=se):se=t[49];let ce;t[50]===s?ce=t[51]:(ce=s?(0,Q.jsx)(`div`,{role:`alert`,className:`rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`,children:s}):null,t[50]=s,t[51]=ce);let le;t[52]!==i.newAgentLabel||t[53]!==l?(le=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[i.newAgentLabel,` (`,l,`)`]}),t[52]=i.newAgentLabel,t[53]=l,t[54]=le):le=t[54];let ue;t[55]===Symbol.for(`react.memo_cache_sentinel`)?(ue=cn(),t[55]=ue):ue=t[55];let de;t[56]===d?de=t[57]:(de=e=>d(e.target.value),t[56]=d,t[57]=de);let fe;t[58]===x?fe=t[59]:(fe=()=>x(),t[58]=x,t[59]=fe);let pe;t[60]!==u||t[61]!==de||t[62]!==fe?(pe=(0,Q.jsx)(`input`,{className:ue,value:u,onChange:de,onBlur:fe,required:!0,autoComplete:`off`}),t[60]=u,t[61]=de,t[62]=fe,t[63]=pe):pe=t[63];let he;t[64]!==le||t[65]!==pe?(he=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[le,pe]}),t[64]=le,t[65]=pe,t[66]=he):he=t[66];let ge;t[67]===i.newAgentIdOptional?ge=t[68]:(ge=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newAgentIdOptional}),t[67]=i.newAgentIdOptional,t[68]=ge);let _e;t[69]===Symbol.for(`react.memo_cache_sentinel`)?(_e=c(cn(),`font-mono text-xs`),t[69]=_e):_e=t[69];let ve;t[70]===p?ve=t[71]:(ve=e=>p(e.target.value),t[70]=p,t[71]=ve);let ye;t[72]===x?ye=t[73]:(ye=()=>x(),t[72]=x,t[73]=ye);let xe;t[74]!==i.newAgentIdPlaceholder||t[75]!==i.newAgentIdRules||t[76]!==f||t[77]!==ve||t[78]!==ye?(xe=(0,Q.jsx)(`input`,{className:_e,value:f,onChange:ve,onBlur:ye,placeholder:i.newAgentIdPlaceholder,autoComplete:`off`,spellCheck:!1,maxLength:64,pattern:`[A-Za-z0-9][A-Za-z0-9_-]{0,63}`,title:i.newAgentIdRules}),t[74]=i.newAgentIdPlaceholder,t[75]=i.newAgentIdRules,t[76]=f,t[77]=ve,t[78]=ye,t[79]=xe):xe=t[79];let Ce;t[80]===i.newAgentIdRules?Ce=t[81]:(Ce=(0,Q.jsx)(`span`,{className:`text-xs text-fg-muted`,children:i.newAgentIdRules}),t[80]=i.newAgentIdRules,t[81]=Ce);let we;t[82]!==ge||t[83]!==xe||t[84]!==Ce?(we=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[ge,xe,Ce]}),t[82]=ge,t[83]=xe,t[84]=Ce,t[85]=we):we=t[85];let Ee;t[86]!==i.agentDescription||t[87]!==l?(Ee=(0,Q.jsxs)(`span`,{className:`text-fg-muted`,children:[i.agentDescription,` (`,l,`)`]}),t[86]=i.agentDescription,t[87]=l,t[88]=Ee):Ee=t[88];let De;t[89]===Symbol.for(`react.memo_cache_sentinel`)?(De=c(cn(),`min-h-18 resize-y font-sans text-sm leading-relaxed`),t[89]=De):De=t[89];let Oe;t[90]===h?Oe=t[91]:(Oe=e=>h(e.target.value),t[90]=h,t[91]=Oe);let ke;t[92]!==i.agentDescriptionPlaceholder||t[93]!==m||t[94]!==Oe?(ke=(0,Q.jsx)(`textarea`,{className:De,value:m,onChange:Oe,placeholder:i.agentDescriptionPlaceholder,maxLength:4e3,rows:3,spellCheck:!0}),t[92]=i.agentDescriptionPlaceholder,t[93]=m,t[94]=Oe,t[95]=ke):ke=t[95];let Ae;t[96]!==Ee||t[97]!==ke?(Ae=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[Ee,ke]}),t[96]=Ee,t[97]=ke,t[98]=Ae):Ae=t[98];let J;t[99]===i.newWorkspace?J=t[100]:(J=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newWorkspace}),t[99]=i.newWorkspace,t[100]=J);let je;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(je=c(cn(),`font-mono text-xs`),t[101]=je):je=t[101];let Me;t[102]===_?Me=t[103]:(Me=e=>_(e.target.value),t[102]=_,t[103]=Me);let Pe;t[104]!==g||t[105]!==Me?(Pe=(0,Q.jsx)(`input`,{className:je,value:g,onChange:Me,required:!0,autoComplete:`off`}),t[104]=g,t[105]=Me,t[106]=Pe):Pe=t[106];let Fe;t[107]!==J||t[108]!==Pe?(Fe=(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1 text-sm`,children:[J,Pe]}),t[107]=J,t[108]=Pe,t[109]=Fe):Fe=t[109];let Ie;t[110]===i.newModelOptional?Ie=t[111]:(Ie=(0,Q.jsx)(`span`,{className:`text-fg-muted`,children:i.newModelOptional}),t[110]=i.newModelOptional,t[111]=Ie);let Le;t[112]===y?Le=t[113]:(Le=e=>y(e),t[112]=y,t[113]=Le);let Re;t[114]!==o||t[115]!==a.modelNoMatches||t[116]!==a.modelPlaceholder||t[117]!==a.modelSearchPlaceholder||t[118]!==v||t[119]!==Le?(Re=(0,Q.jsx)(F,{className:`min-w-0 flex-1`,value:v,disabled:o,placeholder:a.modelPlaceholder,searchPlaceholder:a.modelSearchPlaceholder,noMatches:a.modelNoMatches,onChange:Le}),t[114]=o,t[115]=a.modelNoMatches,t[116]=a.modelPlaceholder,t[117]=a.modelSearchPlaceholder,t[118]=v,t[119]=Le,t[120]=Re):Re=t[120];let ze;t[121]!==i.modelClear||t[122]!==o||t[123]!==v||t[124]!==y?(ze=v.trim()?(0,Q.jsx)(W,{type:`button`,variant:`secondary`,className:`shrink-0`,disabled:o,onClick:()=>y(``),children:i.modelClear}):null,t[121]=i.modelClear,t[122]=o,t[123]=v,t[124]=y,t[125]=ze):ze=t[125];let Be;t[126]!==Re||t[127]!==ze?(Be=(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[Re,ze]}),t[126]=Re,t[127]=ze,t[128]=Be):Be=t[128];let Ve;t[129]!==Ie||t[130]!==Be?(Ve=(0,Q.jsxs)(`div`,{className:`flex flex-col gap-1 text-sm`,children:[Ie,Be]}),t[129]=Ie,t[130]=Be,t[131]=Ve):Ve=t[131];let He;t[132]!==se||t[133]!==ce||t[134]!==he||t[135]!==we||t[136]!==Ae||t[137]!==Fe||t[138]!==Ve||t[139]!==V?(He=(0,Q.jsxs)(`div`,{className:`grid min-h-0 flex-1 gap-3 overflow-y-auto pr-1`,children:[V,se,ce,he,we,Ae,Fe,Ve]}),t[132]=se,t[133]=ce,t[134]=he,t[135]=we,t[136]=Ae,t[137]=Fe,t[138]=Ve,t[139]=V,t[140]=He):He=t[140];let Ue;t[141]!==i.createModalCancel||t[142]!==o?(Ue=(0,Q.jsx)(be,{asChild:!0,children:(0,Q.jsx)(W,{type:`button`,variant:`secondary`,disabled:o,children:i.createModalCancel})}),t[141]=i.createModalCancel,t[142]=o,t[143]=Ue):Ue=t[143];let Ke;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(Ke=(0,Q.jsx)(Se,{className:`mr-1 size-4`,"aria-hidden":!0}),t[144]=Ke):Ke=t[144];let qe;t[145]!==i.create||t[146]!==o?(qe=(0,Q.jsxs)(W,{type:`submit`,disabled:o,children:[Ke,i.create]}),t[145]=i.create,t[146]=o,t[147]=qe):qe=t[147];let Je;t[148]!==Ue||t[149]!==qe?(Je=(0,Q.jsxs)(`div`,{className:`mt-3 flex shrink-0 justify-end gap-2 border-t border-edge-subtle pt-3 dark:border-edge`,children:[Ue,qe]}),t[148]=Ue,t[149]=qe,t[150]=Je):Je=t[150];let Ye;t[151]!==b||t[152]!==He||t[153]!==Je?(Ye=(0,Q.jsxs)(`form`,{className:`flex min-h-0 flex-1 flex-col`,onSubmit:b,children:[He,Je]}),t[151]=b,t[152]=He,t[153]=Je,t[154]=Ye):Ye=t[154];let Ze;t[155]!==j||t[156]!==Ye||t[157]!==ae?(Ze=(0,Q.jsxs)(ee,{children:[N,(0,Q.jsx)(E,{ref:M,className:I,onOpenAutoFocus:Qn,children:(0,Q.jsxs)(We,{layer:`modal`,portalContainer:j,children:[ae,Ye]})})]}),t[155]=j,t[156]=Ye,t[157]=ae,t[158]=Ze):Ze=t[158];let $e;return t[159]!==r||t[160]!==n||t[161]!==Ze?($e=(0,Q.jsx)(me,{open:n,onOpenChange:r,children:Ze}),t[159]=r,t[160]=n,t[161]=Ze,t[162]=$e):$e=t[162],$e}function Qn(e){return e.preventDefault()}var $n=`~/.xopc/workspace`;function er(e){let t=e.trim();return t?`${$n}/${ge(t)}`:``}function tr(e){let t=(0,Z.c)(26),{a:n,busy:r,listSearchQuery:i,onListSearchQueryChange:a,onAddAgent:o,onManageCapabilityPresets:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(ut,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-disabled`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=c):c=t[0];let l;t[1]===a?l=t[2]:(l=e=>a(e.target.value),t[1]=a,t[2]=l);let u;t[3]!==n.listSearchPlaceholder||t[4]!==i||t[5]!==l?(u=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill bg-surface-panel py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[c,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:l,placeholder:n.listSearchPlaceholder,autoComplete:`off`,spellCheck:!1,"aria-label":n.listSearchPlaceholder,className:`min-w-0 flex-1 appearance-none border-0 bg-transparent py-0.5 text-sm leading-normal text-fg caret-current placeholder:text-fg-disabled focus:border-0 focus:shadow-none focus:outline-none focus:ring-0 focus-visible:outline-none`})]}),t[3]=n.listSearchPlaceholder,t[4]=i,t[5]=l,t[6]=u):u=t[6];let d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(Ae,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[7]=d):d=t[7];let f;t[8]===n.capabilityPresetsManage?f=t[9]:(f=(0,Q.jsx)(`span`,{className:`hidden xl:inline`,children:n.capabilityPresetsManage}),t[8]=n.capabilityPresetsManage,t[9]=f);let p;t[10]!==n.capabilityPresetsManage||t[11]!==s||t[12]!==f?(p=(0,Q.jsxs)(W,{type:`button`,variant:`secondary`,className:`shrink-0 gap-2`,"aria-label":n.capabilityPresetsManage,onClick:s,children:[d,f]}),t[10]=n.capabilityPresetsManage,t[11]=s,t[12]=f,t[13]=p):p=t[13];let m;t[14]===o?m=t[15]:(m=()=>o(),t[14]=o,t[15]=m);let h;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(H,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[16]=h):h=t[16];let g;t[17]!==n.addAgent||t[18]!==n.addAgentAria||t[19]!==r||t[20]!==m?(g=(0,Q.jsxs)(W,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,"aria-label":n.addAgentAria,disabled:r,onClick:m,children:[h,n.addAgent]}),t[17]=n.addAgent,t[18]=n.addAgentAria,t[19]=r,t[20]=m,t[21]=g):g=t[21];let _;return t[22]!==u||t[23]!==p||t[24]!==g?(_=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[u,p,g]}),t[22]=u,t[23]=p,t[24]=g,t[25]=_):_=t[25],_}function nr(e){return{...e,soulEditorNonce:0,soulPreviewMode:!1,avatarDialogOpen:!1}}function rr(e){let{agentId:t,enabled:n,saveRef:r}=e,i=ot(async()=>{if(!t)return null;let[e,n]=await Promise.all([ve(t,`IDENTITY.md`).catch(()=>``),ve(t,`SOUL.md`).catch(()=>``)]),r=J(e);return{identity:r,soulTemplate:ze(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?nr(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?nr(a):null);return n?e(n):null})},[a]),g=(0,$.useCallback)(e=>{h(t=>({...t,identity:{...t.identity,...e}}))},[h]),_=(0,$.useCallback)(e=>{h(t=>{if(e===`custom`)return{...t,soulTemplate:`custom`};let n=Ye.find(t=>t.id===e);return n?.content?{...t,soulTemplate:e,soulCustomContent:n.content,soulEditorNonce:t.soulEditorNonce+1}:{...t,soulTemplate:e}})},[h]),v=(0,$.useCallback)(e=>{h(t=>({...t,soulCustomContent:e,soulTemplate:`custom`}))},[h]),y=(0,$.useCallback)(e=>{h(t=>({...t,avatarDialogOpen:e}))},[h]),b=(0,$.useCallback)(()=>{h(e=>({...e,soulPreviewMode:!e.soulPreviewMode}))},[h]),x=(0,$.useCallback)(async()=>{let e=m.current;!e||!f||(await Promise.all([Ee(e,`IDENTITY.md`,rt(f.identity)),Ee(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=x,()=>{r.current=null}},[x,r]),{profileMarkdownLoading:o,draft:f,dirty:p,updateIdentity:g,handleSoulTemplateChange:_,handleSoulContentChange:v,setAvatarDialogOpen:y,toggleSoulPreviewMode:b}}var ir={draft:``,editorNonce:0,loadedKey:``};function ar(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 or(e){let{panel:t,selectedId:n,hasToken:r,dataAgentsLength:i,saveErrorMessage:a,setError:o}=e,s=ot(()=>n?j(n):Promise.resolve(null),[t,n,r,i],{enabled:t===`advanced`&&!!n&&r,initial:null,errorData:null}),c=s.data,l=s.setData,u=s.loading,[d,f]=(0,$.useState)(null),[p,m]=(0,$.useReducer)(ar,ir),[h,g]=(0,$.useState)(!1),[_,v]=(0,$.useState)(`edit`),y=(0,$.useRef)(n);(0,$.useEffect)(()=>{n!==y.current&&(y.current=n,f(null))},[n]),(0,$.useEffect)(()=>{if(c&&c.files.length>0&&!d){let e=c.files.find(e=>e.name===`AGENTS.md`);f(e?e.name:c.files[0].name)}},[c,d]);let b=p.draft,x=p.editorNonce,S=(0,$.useRef)(b);S.current=b;let C=(0,$.useRef)(n);C.current=n;let w=(0,$.useRef)(d);w.current=d;let T=(0,$.useRef)(null),E=(0,$.useRef)(``),D=(0,$.useRef)(``),O=(0,$.useRef)(``),k=(0,$.useRef)(()=>{}),A=ot(()=>d&&n?ve(n,d).catch(()=>``):Promise.resolve(``),[d,n,r],{enabled:!!(d&&n&&r),initial:``,errorData:``}),M=A.loading,N=ye(async()=>{let e=C.current,t=w.current;if(!e||!t||`${e}:${t}`!==E.current)return;let n=S.current;if(n!==D.current){g(!0),o(null);try{await Ee(e,t,n),D.current=n,l(n=>!n||n.agentId!==e?n:{...n,files:n.files.map(e=>e.name===t?{...e,missing:!1}:e)})}catch(e){o(e instanceof Error?e.message:a)}finally{g(!1)}}},800);k.current=N.flush,(0,$.useEffect)(()=>()=>{k.current()},[]);let P=(0,$.useRef)(t);P.current!==t&&(P.current===`advanced`&&k.current(),P.current=t);let F=d&&n?`${n}:${d}`:``;(0,$.useEffect)(()=>{F!==O.current&&(k.current(),O.current=F)},[F]),(0,$.useEffect)(()=>{if(!F){m({type:`clear`});return}M||(E.current=F,D.current=A.data,m({type:`load`,key:F,content:A.data}))},[F,M,A.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=>{k.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:T,saveProfileMarkdownDebounced:N}}function sr(e){let{panel:t,hasToken:n,bindingsFromConfig:r,gatewayCfgLoading:i,selected:a,saveErrorMessage:o,setBusy:s,setError:c}=e,l=(0,$.useRef)(!1),[u,d]=(0,$.useState)(null),f=(0,$.useRef)(r);t===`connections`&&n&&!l.current&&f.current!==r&&(f.current=r,d(r));let p=u??r,m=t===`connections`&&n,h=ot(()=>Nt(),[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=ot(()=>Pt(S),[t,n,S],{enabled:C,initial:[],errorData:[]}),T=w.data,E=w.loading,D=w.setData,[O,k]=(0,$.useState)(null),[A,j]=(0,$.useState)(``),M=(0,$.useRef)(S);M.current!==S&&(M.current=S,k(null));let N=(0,$.useMemo)(()=>a?p.filter(e=>e.agentId.toLowerCase()===a.id.toLowerCase()):[],[p,a?.id]),P=(0,$.useCallback)(()=>{let e=y.trim();e&&Pt(e).then(e=>{D(e),k(t=>t!=null&&t<e.length?t:null)}).catch(()=>{D([]),k(null)})},[y,D]),F=!_&&g.length===0,I=t===`connections`&&n&&i,L=(0,$.useCallback)(async e=>{s(!0),c(null);try{let t=p.filter(t=>t!==e);await $e(t),l.current=!0,d(t)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,o,s,c]);return{agentBindings:N,allBindings:p,bindChannelStatuses:g,bindChannelsLoading:_,bindSessionChats:T,bindSessionsLoading:E,bindingsLoading:I,newBindChannel:y,setNewBindChannel:b,newBindSessionIdx:O,setNewBindSessionIdx:k,newBindCustomPeer:A,setNewBindCustomPeer:j,onAddBinding:(0,$.useCallback)(async e=>{if(e.preventDefault(),!a||!y.trim())return;let t=un(y,A,O,T),n=[...p,{agentId:a.id,priority:100,enabled:!0,match:t}];s(!0),c(null);try{await $e(n),l.current=!0,d(n),k(null),j(``)}catch(e){c(e instanceof Error?e.message:o)}finally{s(!1)}},[p,T,y,A,O,o,a,s,c]),onRemoveBinding:L,refreshBindSessions:P,useManualChannel:F}}function cr(e,t){let n=(0,Z.c)(16),[r,i]=(0,$.useState)(0),a,o;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=()=>{let e=e=>{let t=e.detail;t&&typeof t==`object`&&`section`in t&&t.section===`skills`&&i(dr)};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}=ot(ur,s,d),m;n[10]===f?m=n[11]:(m=f.filter(lr),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 lr(e){return e.enabled!==!1}function ur(){return D()}function dr(e){return e+1}function fr(e){return cr(e.panel===`capabilities`,e.hasToken)}function pr(e){return new Set(e.tools.entryDisable)}function mr(e){return e.skills.entry===void 0?{inherit:!0,pick:new Set(e.skills.effectiveAllowlist??[])}:{inherit:!1,pick:new Set(e.skills.entry??[])}}function hr(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)(()=>[]),[p,m]=(0,$.useState)(!1);if(i.current!==r){if(i.current=r,n&&t===`capabilities`){o(pr(n));let e=mr(n);u(e.inherit),c(e.pick)}n&&t===`runtime`&&(f(Ot(n.typedModels.effective)),m(!1))}return{toolEntryDisable:a,setToolEntryDisable:o,skillsPick:s,setSkillsPick:c,skillsInherit:l,setSkillsInherit:u,modelRows:d,setModelRows:e=>{m(!1),f(e)},replaceModelRows:f,modelsResetRequested:p,setModelsResetRequested:m}}function gr(e){let t=Ot(e.typedModels.preset);return t.some(t=>t.id===e.typedModels.defaultRole)?t:Ot(e.typedModels.effective)}function _r(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 vr(){let e=d(e=>e.language),t=l(e),n=t.agentsSettings,[r,o]=(0,$.useState)(!1),[c,f]=(0,$.useState)(null),[m,h]=(0,$.useState)(!1),[_,v]=(0,$.useState)(``),y=t.cron,b=t.chat,x=!!u(e=>e.token),[S,C]=i(),w=a(),{agentId:T}=s(),E=de(e=>e.setPageHeader),D=de(e=>e.clearPageHeader),{data:O,error:A,isLoading:j,mutate:M}=p(x?`settings-gateway-agents`:null,xe,{revalidateOnFocus:!1}),{data:P,mutate:F}=p(x?`settings-capability-presets`:null,Et,{revalidateOnFocus:!1}),I=qe(x),{data:ee}=I,z=(0,$.useMemo)(()=>ne(ee?.payload?.config??{}),[ee]),B=O??null,te=(0,$.useMemo)(()=>B?B.agents.find(e=>e.id===B.defaultId)??B.agents[0]??null:null,[B]),ie=!!(x&&j),[ae,V]=(0,$.useState)(null),H=A instanceof Error?A.message:A?n.loadError:null,U=ae??H,[W,G]=(0,$.useState)(null),[K,q]=(0,$.useState)(`overview`),[oe,le]=(0,$.useState)(``),[ue,fe]=(0,$.useState)(``),[pe,me]=(0,$.useState)(``),[he,ge]=(0,$.useState)(``),[_e,ve]=(0,$.useState)(``),[ye,be]=(0,$.useState)(null),[Se,Ce]=(0,$.useState)(!1),Te=(0,$.useRef)(``),[Ee,De]=(0,$.useState)(null),[Oe,ke]=(0,$.useState)([]),[Ae,J]=(0,$.useState)(!1),[je,Me]=(0,$.useState)(``),[Ne,Pe]=(0,$.useState)(``),[Fe,Ie]=(0,$.useState)(``),[Le,Re]=(0,$.useState)(``),[ze,Be]=(0,$.useState)(``),[Ve,He]=(0,$.useState)(``),Ue=(0,$.useRef)(null),[We,Ge]=(0,$.useState)(!1),Je=(0,$.useRef)({data:null,routeAgentId:void 0});B&&(B!==Je.current.data||T!==Je.current.routeAgentId)&&(Je.current={data:B,routeAgentId:T},T&&B.agents.some(e=>e.id===T)?G(T):G(e=>e&&B.agents.some(t=>t.id===e)?e:B.defaultId)),(0,$.useEffect)(()=>{!B||!T||B.agents.some(e=>e.id===T)||w(Ke,{replace:!0})},[B,T,w]),(0,$.useEffect)(()=>{T&&q(`overview`)},[T]),(0,$.useEffect)(()=>{S.get(`panel`)===`defaults`&&w(T?et(T):Ke,{replace:!0,state:{[ce]:T?et(T):Ke}})},[S,T,w]),(0,$.useEffect)(()=>{if(S.get(`focus`)!==`avatar`||!T||(q(`profile`),ie||!B?.agents.some(e=>e.id===T)))return;let e=window.setTimeout(()=>{document.getElementById(`agent-avatar-settings`)?.scrollIntoView({behavior:`smooth`,block:`center`}),C(e=>{let t=new URLSearchParams(e);return t.delete(`focus`),t},{replace:!0})},220);return()=>window.clearTimeout(e)},[S,T,ie,B,C]);let Y=(0,$.useMemo)(()=>B?.agents.find(e=>e.id===W)??null,[B,W]),Ye=(0,$.useMemo)(()=>{let e=ee?.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():``},[ee]),Xe=(0,$.useMemo)(()=>!B||Ye&&B.agents.some(e=>e.id===Ye)?Ye:B.defaultId||B.agents[0]?.id||Ye,[B,Ye]),Ze=!!(B&&Ye&&!B.agents.some(e=>e.id===Ye));(0,$.useEffect)(()=>{Pe(Ze?``:Ye)},[Ye,Ze]);let Qe=(0,$.useRef)(null),$e=Y?Y.id:null;Y&&Qe.current!==$e?(Qe.current=$e,Ie(Y.workspace),Re(Y.model?.primary??``),Be(re(Y,l(e).agentsSettings)),He(N(Y,l(e).agentsSettings))):!Y&&Qe.current!==null&&(Qe.current=null,Ie(``),Re(``),Be(``),He(``));let tt=rr({agentId:Y?.id??null,enabled:K===`profile`&&!!Y,saveRef:Ue}),nt=or({panel:K,selectedId:W,hasToken:x,dataAgentsLength:B?.agents.length,saveErrorMessage:n.saveError,setError:V}),X=hr({panel:K,selected:Y}),rt=sr({panel:K,hasToken:x,bindingsFromConfig:z,gatewayCfgLoading:ee===void 0,selected:Y,saveErrorMessage:n.saveError,setBusy:J,setError:V}),it=fr({panel:K,hasToken:x}),at=(0,$.useCallback)(()=>{let e=er(ue.trim()||oe);ge(t=>t===``||t===Te.current?(Te.current=e,e):t)},[ue,oe]),ot=(0,$.useCallback)(()=>{Te.current=``,le(``),fe(``),me(``),ge(``),ve(``),be(null),De(null),ke([]),Ce(!0)},[]),st=(0,$.useCallback)(e=>{let t=new Set(B?.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,B]),ct=(0,$.useCallback)(e=>{if(De(e),!e){ke([]);return}let t=B?.agents.find(t=>t.id===e);if(!t)return;let r=t.name?.trim()??t.id,i=n.duplicateName.replace(`{{name}}`,r),a=st(t.id),o=t.description??``;Te.current=``,le(i),fe(a),me(o),ge(t.workspace),ve(t.model?.primary??``),ke([...t.extends]),be(null)},[n.duplicateName,B,st]),lt=(0,$.useCallback)(e=>{ct(e),Ce(!0)},[ct]),ut=(0,$.useMemo)(()=>(0,Q.jsx)(tr,{a:n,busy:Ae,listSearchQuery:je,onListSearchQueryChange:Me,onAddAgent:()=>ot(),onManageCapabilityPresets:()=>w(`/settings/capability-presets`)}),[n,Ae,je,w,ot]);(0,$.useLayoutEffect)(()=>x?(E({startExtra:null,main:(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,Q.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.subtitle})]}),end:ut}),()=>D()):(D(),()=>D()),[n.subtitle,n.title,ut,D,x,E]);async function dt(t){t.preventDefault();let r=oe.trim();if(!r)return;let i=k(ue,r);if(i.ok===!1){be(i.error);return}let a=he.trim()||er(ue.trim()||r);if(a){J(!0),be(null);try{let t=[`# IDENTITY.md - Who Am I?`,``,`- **Name:** ${r}`,`- **Description:** ${pe.trim()}`,`- **Language:** ${e}`,`- **Creature:** assistant`,`- **Emoji:**`,`- **Avatar:**`,``].join(`
2
+ `),{createdAgentId:n,...i}=await se({workspace:a,...ue.trim()?{id:ue.trim()}:{},..._e.trim()?{models:{defaultRole:`deep`,roles:{deep:{model:_e.trim()}}}}:{},profileFiles:{"IDENTITY.md":t},...Ee?{cloneFrom:Ee}:{},extends:Oe});M(i,{revalidate:!1}),le(``),fe(``),me(``),ge(``),ve(``),be(null),Ce(!1),G(n),w(et(n))}catch(e){be(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function ft(e){J(!0),V(null);try{M(await we(e.id,{setDefault:!0}),{revalidate:!1}),G(e.id)}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function pt(){let e=Ne.trim().toLowerCase();if(e&&!B?.agents.some(t=>t.id===e)){V(n.tuiDefaultAgentInvalid);return}J(!0),V(null);try{await R(e||null),await I.mutate()}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function mt(e){J(!0),V(null);try{await R(e.id),Pe(e.id),await I.mutate()}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function ht(){J(!0),V(null);try{await R(null),Pe(``),await I.mutate()}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function gt(e,t){J(!0),V(null);try{let n=await g(e.id,t);M(n,{revalidate:!1}),G(n.defaultId),q(`overview`),T===e.id&&w(Ke,{replace:!0}),o(!1),f(null),v(``)}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}function _t(e,t){e.id!==`main`&&(f(e),h(t),v(``),o(!0))}async function vt(){if(Y){J(!0),V(null);try{M(await we(Y.id,{tools:{builtin:_r(X.toolEntryDisable)}}),{revalidate:!1})}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function yt(){if(Y){J(!0),V(null);try{M(await we(Y.id,{tools:null}),{revalidate:!1}),X.setToolEntryDisable(new Set)}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function bt(){if(!Y)return;let e=Dt(X.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e){V(e);return}J(!0),V(null);try{M(await we(Y.id,{models:{roles:Mt(X.modelRows)?.roles??{}}}),{revalidate:!1})}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}async function xt(){if(!Y)return!1;let e=Dt(X.modelRows,{invalidId:n.typedModelsInvalidId,duplicateId:n.typedModelsDuplicateId,invalidModel:n.typedModelsInvalidModel});if(e)return V(e),!1;J(!0),V(null);try{let e=Mt(Ot(Y.typedModels.effective))?.roles??{},t=Mt(X.modelRows)?.roles??{},n=JSON.stringify(t)!==JSON.stringify(e);return M(await we(Y.id,{workspace:Fe.trim()||void 0,...X.modelsResetRequested?{models:null}:n?{models:{roles:t}}:{}}),{revalidate:!1}),X.setModelsResetRequested(!1),!0}catch(e){return V(e instanceof Error?e.message:n.saveError),!1}finally{J(!1)}}function St(){if(!Y)return;let e=gr(Y);V(null),X.replaceModelRows(e),X.setModelsResetRequested(!0)}async function Ct(){if(Y){J(!0),V(null);try{M(await we(Y.id,{skills:X.skillsInherit?null:[...X.skillsPick].toSorted((e,t)=>e.localeCompare(t))}),{revalidate:!1})}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}async function wt(e){if(Y){J(!0),V(null);try{M(await we(Y.id,{extends:e}),{revalidate:!1}),F()}catch(e){V(e instanceof Error?e.message:n.saveError)}finally{J(!1)}}}let Tt=K!==`profile`&&K!==`runtime`,kt=(()=>{if(!Y||K!==`runtime`)return!1;let e=Mt(Ot(Y.typedModels.effective))?.roles??{},t=Mt(X.modelRows)?.roles??{};return X.modelsResetRequested||Fe.trim()!==Y.workspace||JSON.stringify(t)!==JSON.stringify(e)})(),At=(()=>{if(Tt||!Y)return!1;switch(K){case`profile`:return tt.dirty;case`runtime`:return kt;default:return!0}})(),jt=Tt||!At;function Nt(){Ge(!0),setTimeout(()=>Ge(!1),2e3)}async function Pt(){switch(K){case`profile`:J(!0),V(null);try{return await(Ue.current?.()??Promise.resolve()),await M(),Nt(),!0}catch(e){return V(e instanceof Error?e.message:n.saveError),!1}finally{J(!1)}case`runtime`:return await xt()?(Nt(),!0):!1;default:return!0}}function Ft(e){e||w(Ke)}let It=Y?ze.trim()||re(Y,n):T??``,Z=Y?.id??T??``,Lt=(0,$.useCallback)(async()=>{if(Y&&await Pt()){nt.saveProfileMarkdownDebounced.flush();try{globalThis.localStorage?.setItem(L,Y.id)}catch{}w(`/chat/new`,{state:{agentId:Y.id,fromAgentEditor:!0}})}},[Y,Pt,nt.saveProfileMarkdownDebounced,w]),Rt={a:n,chat:b,cCron:y,selected:Y,panel:K,data:B,busy:Ae,editName:ze,setEditName:Be,editDescription:Ve,setEditDescription:He,editWorkspace:Fe,setEditWorkspace:Ie,editModel:Le,defaultModel:te?.model?.primary??``,defaultWorkspace:te?.workspace??``,onSetDefault:()=>{Y&&ft(Y)},onSetTuiDefault:()=>{Y&&mt(Y)},isTuiDefault:!!(Y&&Y.id===Xe),isTuiDefaultInherited:!!(Y&&Y.id===Xe&&(!Ye||Ze)),onDelete:e=>{Y&&_t(Y,e)},onTryInChat:()=>void Lt(),capabilityPresets:P?.presets??[],defaultPresetId:P?.defaultPresetId,onUpdateAgentExtends:e=>void wt(e),onOpenCapabilityPreset:e=>{w(e?`/settings/capability-presets?preset=${encodeURIComponent(e)}`:`/settings/capability-presets`)},overviewProfile:tt,filesLoading:nt.filesLoading,files:nt.files,activeFile:nt.activeFile,setActiveFile:nt.setActiveFile,filesViewMode:nt.filesViewMode,setFilesViewMode:nt.setFilesViewMode,fileDraft:nt.fileDraft,setFileDraft:nt.setFileDraft,fileSaving:nt.fileSaving,profileFileLoading:nt.profileFileLoading,profileEditorNonce:nt.profileEditorNonce,toolEntryDisable:X.toolEntryDisable,setToolEntryDisable:X.setToolEntryDisable,onSaveTools:()=>void vt(),onClearToolsEntry:()=>void yt(),modelRows:X.modelRows,setModelRows:X.setModelRows,onSaveModels:()=>void bt(),onClearModelsEntry:St,skillsCatalogLoading:it.skillsCatalogLoading,catalogForPick:it.catalogForPick,skillsInherit:X.skillsInherit,setSkillsInherit:X.setSkillsInherit,skillsPick:X.skillsPick,setSkillsPick:X.setSkillsPick,onSaveSkills:()=>void Ct(),bindingsLoading:rt.bindingsLoading,agentBindings:rt.agentBindings,bindChannelStatuses:rt.bindChannelStatuses,bindChannelsLoading:rt.bindChannelsLoading,useManualChannel:rt.useManualChannel,newBindChannel:rt.newBindChannel,setNewBindChannel:rt.setNewBindChannel,bindSessionChats:rt.bindSessionChats,bindSessionsLoading:rt.bindSessionsLoading,newBindSessionIdx:rt.newBindSessionIdx,setNewBindSessionIdx:rt.setNewBindSessionIdx,newBindCustomPeer:rt.newBindCustomPeer,setNewBindCustomPeer:rt.setNewBindCustomPeer,refreshBindSessions:rt.refreshBindSessions,onRemoveBinding:e=>void rt.onRemoveBinding(e),onAddBinding:rt.onAddBinding};return{hasToken:x,a:n,chat:b,language:e,data:B,savedTuiDefaultAgentId:Ye,effectiveTuiDefaultAgentId:Xe,tuiDefaultAgentDraft:Ne,setTuiDefaultAgentDraft:Pe,tuiDefaultAgentUnavailable:Ze,onSaveTuiDefaultAgent:pt,onSetTuiDefaultAgent:mt,onClearTuiDefaultAgent:ht,onSetDefaultAgent:ft,loading:ie,displayError:U,navigate:w,routeAgentId:T,busy:Ae,listSearchQuery:je,openAddAgentModal:ot,openDuplicateAgentModal:lt,duplicateSourceId:Ee,createPresetIds:Oe,setCreatePresetIds:ke,onSelectDuplicateSource:ct,panel:K,setPanel:q,modalTitle:It,modalSubtitle:Z,footerSaveDisabled:jt,savedFlash:We,handleModalFooterSave:Pt,onAgentModalOpenChange:Ft,addAgentModalOpen:Se,setAddAgentModalOpen:Ce,createWorkspaceSuggestedRef:Te,createModalError:ye,setCreateModalError:be,createDisplayName:oe,setCreateDisplayName:le,createAgentId:ue,setCreateAgentId:fe,createDescription:pe,setCreateDescription:me,createWorkspace:he,setCreateWorkspace:ge,createModel:_e,setCreateModel:ve,onCreate:dt,currentLanguageLabel:e===`zh`?`中文`:`English`,applyCreateWorkspaceSuggestion:at,deleteDialogOpen:r,setDeleteDialogOpen:o,deletePurge:m,deleteTarget:c,setDeleteTarget:f,deleteConfirmText:_,setDeleteConfirmText:v,performDelete:gt,editorPanelProps:Rt}}function yr(){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)(tt,{className:`h-5 w-40`}),(0,Q.jsx)(tt,{className:`h-3 w-64 max-w-full`})]}),(0,Q.jsx)(tt,{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(br)})]}),e[1]=n):n=e[1],n}function br(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)(tt,{className:`size-11 rounded-xl`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(tt,{className:`h-4 w-2/3`}),(0,Q.jsx)(tt,{className:`mt-2 h-3 w-24`})]})]}),(0,Q.jsx)(tt,{className:`mt-4 h-3 w-full`}),(0,Q.jsx)(tt,{className:`mt-2 h-3 w-4/5`}),(0,Q.jsxs)(`div`,{className:`mt-4 flex gap-2`,children:[(0,Q.jsx)(tt,{className:`h-6 w-16 rounded-full`}),(0,Q.jsx)(tt,{className:`h-6 w-20 rounded-full`})]})]},t)}function xr(){let e=vr();return e.hasToken?(0,Q.jsxs)(_t,{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)(yr,{}):e.data?(0,Q.jsx)(`div`,{className:`flex flex-col gap-4`,children:(0,Q.jsx)(Yn,{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(et(t)),onChatWithAgent:t=>{let n=t.trim().toLowerCase();try{globalThis.localStorage?.setItem(L,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===`profile`||e.panel===`runtime`,busy:e.busy,children:e.loading||!e.data?(0,Q.jsx)(yr,{}):(0,Q.jsx)(Un,{...e.editorPanelProps})}):null,(0,Q.jsx)(Zn,{open:e.addAgentModalOpen,onOpenChange:t=>{e.setAddAgentModalOpen(t),t||(e.createWorkspaceSuggestedRef.current=``,e.setCreateDisplayName(``),e.setCreateAgentId(``),e.setCreateDescription(``),e.setCreateWorkspace(``),e.setCreateModel(``),e.setCreateModalError(null),e.onSelectDuplicateSource(null),e.setCreatePresetIds([]))},a:e.a,chat:e.chat,busy:e.busy,modalError:e.createModalError,profileLanguageLabel:e.currentLanguageLabel,createDisplayName:e.createDisplayName,setCreateDisplayName:e.setCreateDisplayName,createAgentId:e.createAgentId,setCreateAgentId:e.setCreateAgentId,createDescription:e.createDescription,setCreateDescription:e.setCreateDescription,createWorkspace:e.createWorkspace,setCreateWorkspace:e.setCreateWorkspace,createModel:e.createModel,setCreateModel:e.setCreateModel,onCreate:e.onCreate,onSuggestWorkspace:()=>e.applyCreateWorkspaceSuggestion(),agents:e.data?.agents??[],duplicateSourceId:e.duplicateSourceId,onSelectDuplicateSource:e.onSelectDuplicateSource,capabilityPlans:e.editorPanelProps.capabilityPresets,defaultPresetId:e.editorPanelProps.defaultPresetId??`default`,selectedCapabilityPlanIds:e.createPresetIds,onSelectedCapabilityPlanIdsChange:e.setCreatePresetIds}),(0,Q.jsx)(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)(_t,{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)(gt,{title:e.a.title}),(0,Q.jsx)(`p`,{className:`text-sm text-fg-muted`,children:e.a.needToken})]})}export{xr as AgentsSettingsPanel};
@@ -1 +1 @@
1
- import{r as e,s as t}from"./locale-store-C_ax27uc.js";async function n(){return(await t(e(`/api/local-apps`))).apps}async function r(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function a(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function o(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function s(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function c(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function l(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function u(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{a,u as c,n as i,i as l,r as n,c as o,s as r,l as s,o as t};
1
+ import{r as e,s as t}from"./locale-store-tnRLWdx2.js";async function n(){return(await t(e(`/api/local-apps`))).apps}async function r(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}`))).app}async function i(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/validate`),{method:`POST`})).validation}async function a(n,r,i){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/acceptance-runs`),{method:`POST`,body:JSON.stringify({sourceHash:r,...i})})).acceptance}async function o(n){return(await t(e(`/api/local-apps`),{method:`POST`,body:JSON.stringify(n)})).app}async function s(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`POST`})).app}async function c(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/releases/${encodeURIComponent(r)}/rollback`),{method:`POST`})).app}async function l(n,r){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/${r?`enable`:`disable`}`),{method:`POST`})).app}async function u(n){return(await t(e(`/api/local-apps/${encodeURIComponent(n)}/install`),{method:`DELETE`})).app}export{a,u as c,n as i,i as l,r as n,c as o,s as r,l as s,o as t};
@@ -1 +1 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-C96Zjb0V.js";import{n as s,r as c,s as l}from"./locale-store-C_ax27uc.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$l as d,Ds as f,Go as p,Jo as m,Ko as h,Ns as g,Nt as _,Uo as v,Wc as y,Xo as b,Yo as x,ms as S,ps as C,qo as w,ro as T}from"./index-BhQMnKH1.js";import{n as E,r as D}from"./settings-page-layout-MuXpamWD.js";import{t as O}from"./settings-loading-skeleton-C5FNbyej.js";import{r as k,t as A}from"./settings-form-section-CuQzWvg5.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,o]=(0,M.useReducer)(_,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:b,clearConfirmChecked:T,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=T&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(y,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):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,s.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:s.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`,f.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(d,{className:`size-3`,"aria-hidden":!0}),u===`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:s.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`,f.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(d,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.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`,f.press),onClick:()=>{o({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`,f.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(v,{open:b,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(w,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,C,`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)(x,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(h,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:T,onChange:e=>o({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=>o({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)(g,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(g,{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)(v,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(w,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,C,`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)(x,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(h,{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=>o({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)(g,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(g,{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 l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){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)(T,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(T,{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)(g,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),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=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!b()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);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:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,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-JdwAhgNB.js";import{t as a}from"./copy-to-clipboard-HOJ79TWv.js";import{t as o}from"./messages-B1EG4gdu.js";import{n as s,r as c,s as l}from"./locale-store-tnRLWdx2.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$l as d,Ds as f,Go as p,Jo as m,Ko as h,Ns as g,Nt as _,Uo as v,Wc as y,Xo as b,Yo as x,ms as S,ps as C,qo as w,ro as T}from"./index-B24B26og.js";import{n as E,r as D}from"./settings-page-layout-CtESNNdx.js";import{t as O}from"./settings-loading-skeleton-Q_Vh6HEl.js";import{r as k,t as A}from"./settings-form-section-Bb6yYt5f.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,o]=(0,M.useReducer)(_,L),{info:s,loadError:c,actionError:l,copiedField:u,clearDialogOpen:b,clearConfirmChecked:T,clearConfirmText:E,uninstallDialogOpen:D,removeUserDataOnUninstall:k,busy:j}=r,R=(0,M.useCallback)(async()=>{if(e?.getUninstallInfo){o({type:`patch`,patch:{loadError:null}});try{o({type:`patch`,patch:{info:await e.getUninstallInfo()}})}catch(e){o({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}}},[e]);(0,M.useEffect)(()=>{R()},[R]);let z=async(e,n)=>{if(await a(e)){o({type:`patch`,patch:{actionError:null,copiedField:n}}),window.setTimeout(()=>o({type:`patch`,patch:{copiedField:null}}),2e3);return}o({type:`patch`,patch:{actionError:t.copyFailed}})},B=async()=>{if(e?.clearUserData){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.clearUserData();n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})}}},V=async()=>{if(e?.uninstallApp){o({type:`patch`,patch:{busy:!0,actionError:null}});try{let n=await e.uninstallApp({removeUserData:k});n.ok||o({type:`patch`,patch:{actionError:F(n.error,t.errors)}})}catch(e){o({type:`patch`,patch:{actionError:e instanceof Error?e.message:t.errors.generic}})}finally{o({type:`patch`,patch:{busy:!1,uninstallDialogOpen:!1}})}}};if(c)return(0,N.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:c});if(!s)return(0,N.jsx)(O,{rows:2});let H=!s.packaged,U=j||s.pendingUpdate||H,W=!H&&s.uninstallMode!==`unsupported`,G=I(s,t),K=T&&E.trim()===t.clearDataConfirmPhrase;return(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(A,{children:[n?(0,N.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,N.jsx)(y,{className:`size-4 text-accent`,strokeWidth:1.75}),t.title]}):null,l?(0,N.jsx)(`p`,{className:`mb-3 text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:l}):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,s.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:s.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`,f.press),onClick:()=>void z(s.appPath,`app`),children:[(0,N.jsx)(d,{className:`size-3`,"aria-hidden":!0}),u===`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:s.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`,f.press),onClick:()=>void z(s.dataPath,`data`),children:[(0,N.jsx)(d,{className:`size-3`,"aria-hidden":!0}),u===`data`?t.copied:t.copyPath]})]}),(0,N.jsxs)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:[t.dataSize,`: `,P(s.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`,f.press),onClick:()=>{o({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`,f.press),onClick:()=>{o({type:`patch`,patch:{removeUserDataOnUninstall:!1,uninstallDialogOpen:!0}})},children:t.uninstall})]}):null]})]}),(0,N.jsx)(v,{open:b,onOpenChange:e=>{e||o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(w,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,C,`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)(x,{className:`text-base font-semibold text-fg`,children:t.clearDataConfirmTitle}),(0,N.jsx)(h,{className:`mt-2 text-sm text-fg-muted`,children:t.clearDataConfirmDesc}),(0,N.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 text-sm text-fg`,children:[(0,N.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox mt-0.5`,checked:T,onChange:e=>o({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=>o({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)(g,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>{o({type:`patch`,patch:{clearDialogOpen:!1,clearConfirmChecked:!1,clearConfirmText:``}})},children:t.cancel}),(0,N.jsx)(g,{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)(v,{open:D,onOpenChange:e=>{e||o({type:`patch`,patch:{uninstallDialogOpen:!1}})},children:(0,N.jsxs)(m,{children:[(0,N.jsx)(w,{className:i(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,S)}),(0,N.jsxs)(p,{className:i(`fixed left-1/2 top-1/2 w-[min(100%-2rem,28rem)] -translate-x-1/2 -translate-y-1/2`,C,`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)(x,{className:`text-base font-semibold text-fg`,children:t.uninstallConfirmTitle}),(0,N.jsx)(h,{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=>o({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)(g,{type:`button`,variant:`secondary`,disabled:j,onClick:()=>o({type:`patch`,patch:{uninstallDialogOpen:!1}}),children:t.cancel}),(0,N.jsx)(g,{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 l(c(`/api/migrations/status`))).payload}async function B(){await l(c(`/api/migrations/apply`),{method:`POST`,body:`{}`})}function V({messages:e}){let{data:t,error:n,isLoading:r,mutate:i}=u(`settings-migration-status`,z,{refreshInterval:0,revalidateOnFocus:!1}),[a,o]=(0,M.useState)(!1),[s,c]=(0,M.useState)(null);async function l(){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)(T,{className:`h-5 w-40 max-w-full`}),(0,N.jsx)(T,{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)(g,{type:`button`,variant:`primary`,className:`px-3 py-1.5 text-xs`,onClick:()=>void l(),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=s(U),n;e[0]===t?n=e[1]:(n=o(t),e[0]=t,e[1]=n);let r=n.systemSettings,i=r.desktopApp,a=typeof window<`u`?window.electronAPI?.system:void 0;if(!b()||!a){let t;e[2]===i.title?t=e[3]:(t=(0,N.jsx)(E,{title:i.title}),e[2]=i.title,e[3]=t);let n;e[4]===i.migrations?n=e[5]:(n=(0,N.jsx)(V,{messages:i.migrations}),e[4]=i.migrations,e[5]=n);let a;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(a=k(),e[6]=a):a=e[6];let o;e[7]===r.desktopOnlyTitle?o=e[8]:(o=(0,N.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.desktopOnlyTitle}),e[7]=r.desktopOnlyTitle,e[8]=o);let s;e[9]===r.desktopOnlyBody?s=e[10]:(s=(0,N.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:r.desktopOnlyBody}),e[9]=r.desktopOnlyBody,e[10]=s);let c;e[11]!==o||e[12]!==s?(c=(0,N.jsxs)(`div`,{className:a,children:[o,s]}),e[11]=o,e[12]=s,e[13]=c):c=e[13];let l;return e[14]!==t||e[15]!==n||e[16]!==c?(l=(0,N.jsxs)(D,{gap:`gap-3`,children:[t,n,c]}),e[14]=t,e[15]=n,e[16]=c,e[17]=l):l=e[17],l}let c;e[18]===i.title?c=e[19]:(c=(0,N.jsx)(E,{title:i.title}),e[18]=i.title,e[19]=c);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:a,messages:i,embedded:!1}),e[22]=i,e[23]=u);let d;return e[24]!==c||e[25]!==l||e[26]!==u?(d=(0,N.jsxs)(D,{gap:`gap-6`,children:[c,l,u]}),e[24]=c,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-JdwAhgNB.js";import{t as r}from"./messages-C96Zjb0V.js";import{n as i}from"./locale-store-C_ax27uc.js";import{i as a}from"./theme-store-D37XLD_C.js";import{Ds as o,Dt as s,is as c}from"./index-BhQMnKH1.js";import{n as l,r as u}from"./settings-page-layout-MuXpamWD.js";import{t as d}from"./settings-advanced-gate-DR9Q2ZyF.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 p-3.5 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=s(T),c=s(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===c?_=e[17]:(_=e=>c(e.target.checked),e[16]=c,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,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 s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=m(),e[5]=s):s=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)(c,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:s,"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)(c,{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};
1
+ import{n as e,t}from"./vendor-react-BOUWij0V.js";import{t as n}from"./cn-JdwAhgNB.js";import{t as r}from"./messages-B1EG4gdu.js";import{n as i}from"./locale-store-tnRLWdx2.js";import{i as a}from"./theme-store-H9T49Iar.js";import{Ds as o,Dt as s,is as c}from"./index-B24B26og.js";import{n as l,r as u}from"./settings-page-layout-CtESNNdx.js";import{t as d}from"./settings-advanced-gate-eVlH9brU.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 p-3.5 sm:py-4`,children:[h,y]}),e[15]=h,e[16]=y,e[17]=C):C=e[17],C}function b(e){return e.setColorScheme}function x(e){return e.colorScheme}function S(e){return e.language}function C(){let e=(0,f.c)(27),t=i(E),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,o=s(T),c=s(w),l;e[2]===a.developerGroupTitle?l=e[3]:(l=(0,p.jsx)(`div`,{className:`text-sm font-semibold text-fg`,children:a.developerGroupTitle}),e[2]=a.developerGroupTitle,e[3]=l);let u;e[4]===a.developerGroupDescription?u=e[5]:(u=(0,p.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:a.developerGroupDescription}),e[4]=a.developerGroupDescription,e[5]=u);let d;e[6]!==l||e[7]!==u?(d=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[l,u]}),e[6]=l,e[7]=u,e[8]=d):d=e[8];let m;e[9]===a.showRawToolDataTitle?m=e[10]:(m=(0,p.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:a.showRawToolDataTitle}),e[9]=a.showRawToolDataTitle,e[10]=m);let h;e[11]===a.showRawToolDataDescription?h=e[12]:(h=(0,p.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.showRawToolDataDescription}),e[11]=a.showRawToolDataDescription,e[12]=h);let g;e[13]!==m||e[14]!==h?(g=(0,p.jsxs)(`div`,{className:`min-w-0`,children:[m,h]}),e[13]=m,e[14]=h,e[15]=g):g=e[15];let _;e[16]===c?_=e[17]:(_=e=>c(e.target.checked),e[16]=c,e[17]=_);let v;e[18]!==o||e[19]!==_?(v=(0,p.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:o,onChange:_}),e[18]=o,e[19]=_,e[20]=v):v=e[20];let y;e[21]!==g||e[22]!==v?(y=(0,p.jsxs)(`label`,{className:`flex items-center justify-between gap-3 rounded-xl bg-surface-hover/50 px-3 py-2.5 dark:bg-surface-hover/35`,children:[g,v]}),e[21]=g,e[22]=v,e[23]=y):y=e[23];let b;return e[24]!==d||e[25]!==y?(b=(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 py-3.5 sm:py-4`,children:[d,y]}),e[24]=d,e[25]=y,e[26]=b):b=e[26],b}function w(e){return e.setShowRawToolData}function T(e){return e.showRawToolData}function E(e){return e.language}function D(){let e=(0,f.c)(29),t=i(O),n;e[0]===t?n=e[1]:(n=r(t),e[0]=t,e[1]=n);let a=n.appearanceSettings,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 s;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=m(),e[5]=s):s=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)(c,{variant:`page`,sections:[`language`]}),e[8]=g):g=e[8];let _;e[9]===h?_=e[10]:(_=(0,p.jsxs)(`section`,{className:s,"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)(c,{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};