@xopcai/xopc 0.0.214 → 0.0.217

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 (190) hide show
  1. package/README.md +4 -4
  2. package/README.zh-CN.md +4 -4
  3. package/dist/browser-ext/manifest.json +1 -1
  4. package/dist/extensions/telegram/xopc.extension.json +1 -1
  5. package/dist/gateway/static/root/assets/{activity-store-k-mNF_Dq.js → activity-store-D6trMTyZ.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B5VyiQ_K.js → agent-avatar-dicebear-CAQdFrcu.js} +1 -1
  7. package/dist/gateway/static/root/assets/agents-C6q_vDzP.js +68 -0
  8. package/dist/gateway/static/root/assets/{api-BjN2udFQ.js → api-B9pZAyMB.js} +1 -1
  9. package/dist/gateway/static/root/assets/app-management-settings-panel-DRsTwFbF.js +1 -0
  10. package/dist/gateway/static/root/assets/{appearance-settings-Bvvzgp00.js → appearance-settings-B99NaPTf.js} +1 -1
  11. package/dist/gateway/static/root/assets/apps-page-Dx66anqa.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-DjGVsAgd.js → archive-plugin-BF0q7N24.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-BCuUeuuO.js → attachment-load-D1qmjGDo.js} +1 -1
  14. package/dist/gateway/static/root/assets/{automations-page-Doof8nA6.js → automations-page-Ccu4yRFa.js} +1 -1
  15. package/dist/gateway/static/root/assets/automations-workspace-CHbA8d-P.js +6 -0
  16. package/dist/gateway/static/root/assets/{binary-plugins-B7WFf-lc.js → binary-plugins-DooqxEZz.js} +1 -1
  17. package/dist/gateway/static/root/assets/{block-editor-CVwIwyUT.js → block-editor-Dqg9kvb9.js} +47 -47
  18. package/dist/gateway/static/root/assets/browser-settings-page-CpRc-9Jy.js +8 -0
  19. package/dist/gateway/static/root/assets/{browser-workflow-inputs-Coz8pWzP.js → browser-workflow-inputs-CsIh8ySc.js} +1 -1
  20. package/dist/gateway/static/root/assets/{browser-workflows-page-8a3hnSXE.js → browser-workflows-page-BXQFxT0p.js} +2 -2
  21. package/dist/gateway/static/root/assets/capabilities-settings-panel-C89FGECN.js +7 -0
  22. package/dist/gateway/static/root/assets/{capability-presets-api-BF3G84qe.js → capability-presets-api-BX9U0FRh.js} +1 -1
  23. package/dist/gateway/static/root/assets/{capability-presets-settings-panel-DkjsA_Yn.js → capability-presets-settings-panel-XT6WEz9E.js} +2 -2
  24. package/dist/gateway/static/root/assets/{channel-recipient-api-8Uz95P40.js → channel-recipient-api-CUBTQ0Bz.js} +1 -1
  25. package/dist/gateway/static/root/assets/channels-settings-DhKk1oNT.js +1 -0
  26. package/dist/gateway/static/root/assets/channels-status-swr-CiwOOoVL.js +1 -0
  27. package/dist/gateway/static/root/assets/{chat-terminal-dock-BYds3un1.js → chat-terminal-dock-CTbkTsc2.js} +2 -2
  28. package/dist/gateway/static/root/assets/circle-check-C23XjkUj.js +1 -0
  29. package/dist/gateway/static/root/assets/connectors-page-BDn3HTzX.js +2 -0
  30. package/dist/gateway/static/root/assets/{cron-expression-DjBh0ZL4.js → cron-expression-XzPZhzVM.js} +1 -1
  31. package/dist/gateway/static/root/assets/{date-picker-3cIzKCZU.js → date-picker-BmZjs4Bq.js} +1 -1
  32. package/dist/gateway/static/root/assets/{dependency-picker-VZFStrz_.js → dependency-picker-ndtb88_T.js} +1 -1
  33. package/dist/gateway/static/root/assets/{desktop-pet-CRNQ4CKZ.js → desktop-pet-DZjW-7Tw.js} +1 -1
  34. package/dist/gateway/static/root/assets/desktop-pet-settings-C7BLs783.js +1 -0
  35. package/dist/gateway/static/root/assets/{directory-picker-path-field-Dbq9_c33.js → directory-picker-path-field-BWiap88p.js} +1 -1
  36. package/dist/gateway/static/root/assets/electron-env-DH5wF8X8.js +1 -0
  37. package/dist/gateway/static/root/assets/{extension-debug-page-CSFZfcz5.js → extension-debug-page-D7APnE3n.js} +1 -1
  38. package/dist/gateway/static/root/assets/{extension-page-W8vZ3Nl0.js → extension-page-BhV5hz70.js} +1 -1
  39. package/dist/gateway/static/root/assets/{extension-settings-page-D5zYR65b.js → extension-settings-page-BhbcGuiJ.js} +1 -1
  40. package/dist/gateway/static/root/assets/{gateway-config-api-BnA56bxn.js → gateway-config-api-CUt9bIpL.js} +1 -1
  41. package/dist/gateway/static/root/assets/{gateway-config-swr-l2w9ecXl.js → gateway-config-swr-BTH9HVUk.js} +1 -1
  42. package/dist/gateway/static/root/assets/{gateway-settings-CCOOGd8A.js → gateway-settings-RafSECLG.js} +1 -1
  43. package/dist/gateway/static/root/assets/{gateway-startup-retry-XUzMGmLZ.js → gateway-startup-retry-DAEk_tnd.js} +1 -1
  44. package/dist/gateway/static/root/assets/heartbeat-settings-CwVPlPLB.js +1 -0
  45. package/dist/gateway/static/root/assets/home-page-CbdBcCwC.js +1 -0
  46. package/dist/gateway/static/root/assets/{image-generation-api-CDoOrDMq.js → image-generation-api-HqcQrSed.js} +1 -1
  47. package/dist/gateway/static/root/assets/index-AbNnQyKk.css +2 -0
  48. package/dist/gateway/static/root/assets/index-CMLkr37Y.js +108 -0
  49. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-BG6lShzn.js +1 -0
  50. package/dist/gateway/static/root/assets/local-app-workbench-page-DdaPtQ5M.js +2 -0
  51. package/dist/gateway/static/root/assets/{local-apps-page-CuwtmiCt.js → local-apps-page-vaz8ewe2.js} +1 -1
  52. package/dist/gateway/static/root/assets/{locale-store-BIOMAhmR.js → locale-store-De8wYkd7.js} +1 -1
  53. package/dist/gateway/static/root/assets/{logs-page-Vq-wDYVv.js → logs-page-CjxMHTQO.js} +2 -2
  54. package/dist/gateway/static/root/assets/{management-settings-gQwyJgL4.js → management-settings-tqTGCHt0.js} +1 -1
  55. package/dist/gateway/static/root/assets/{markdown-split-DLSvtLDY.js → markdown-split-BGx8Aao0.js} +1 -1
  56. package/dist/gateway/static/root/assets/{markdown-view-BMDQYc6E.js → markdown-view-ybRARsPs.js} +1 -1
  57. package/dist/gateway/static/root/assets/{media-plugins-DFdpMglM.js → media-plugins-xbM-SSP5.js} +1 -1
  58. package/dist/gateway/static/root/assets/messages-VI9m1xJl.js +3 -0
  59. package/dist/gateway/static/root/assets/{notes-api-lKPk0Voa.js → notes-api-D9CCwyWK.js} +1 -1
  60. package/dist/gateway/static/root/assets/{notes-page-BBhONbU4.js → notes-page-CMNBbg6g.js} +1 -1
  61. package/dist/gateway/static/root/assets/notes-workbench-V9C-8vSn.js +4 -0
  62. package/dist/gateway/static/root/assets/{page-tabs-DoQq4tt6.js → page-tabs-e99j9S9K.js} +1 -1
  63. package/dist/gateway/static/root/assets/preview-open-alternatives-DW9MDOva.js +1 -0
  64. package/dist/gateway/static/root/assets/{product-open-page-ClyG8t4A.js → product-open-page-CZdzgPZW.js} +1 -1
  65. package/dist/gateway/static/root/assets/project-detail-page-DHmAUggu.js +1 -0
  66. package/dist/gateway/static/root/assets/projects-page-D0EiN69Y.js +1 -0
  67. package/dist/gateway/static/root/assets/{registry-api-BFwvRxBn.js → registry-api-DYmKEwiG.js} +1 -1
  68. package/dist/gateway/static/root/assets/remote-access-hub-BuAVFk2O.js +1 -0
  69. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DdTZPRU5.js → runtime-tools-settings-panel-DQ12tLCL.js} +2 -2
  70. package/dist/gateway/static/root/assets/{schema-form-C3Q03Hyv.js → schema-form-DNCDIkqC.js} +1 -1
  71. package/dist/gateway/static/root/assets/sessions-page-hzlTfgOl.js +1 -0
  72. package/dist/gateway/static/root/assets/settings-advanced-gate-BlCoA_9h.js +1 -0
  73. package/dist/gateway/static/root/assets/{settings-form-section-DdrNtxul.js → settings-form-section-z0JH53Fu.js} +1 -1
  74. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BFvEfK7v.js → settings-loading-skeleton-xgo41cfo.js} +1 -1
  75. package/dist/gateway/static/root/assets/{settings-page-B8iNNrLN.js → settings-page-8astk_1U.js} +1 -1
  76. package/dist/gateway/static/root/assets/setup-status-panel-fZQfoJAk.js +1 -0
  77. package/dist/gateway/static/root/assets/{share-preview-page-CrsscJs3.js → share-preview-page-BBZV4AGy.js} +1 -1
  78. package/dist/gateway/static/root/assets/shares-settings-B5dPMq3Y.js +1 -0
  79. package/dist/gateway/static/root/assets/skill-reload-api-i1PGf1V2.js +1 -0
  80. package/dist/gateway/static/root/assets/skills-page-BSN2VaqR.js +2 -0
  81. package/dist/gateway/static/root/assets/{skills-page.utils-CIcb0h3E.js → skills-page.utils-HmoDhJVh.js} +1 -1
  82. package/dist/gateway/static/root/assets/system-settings-panel-CSibO8vj.js +1 -0
  83. package/dist/gateway/static/root/assets/tab-completion-input-B-VsxKhC.js +1 -0
  84. package/dist/gateway/static/root/assets/task-detail-page-HCKZ11E8.js +1 -0
  85. package/dist/gateway/static/root/assets/{theme-store-BrbF9cgL.js → theme-store-STx6jo38.js} +1 -1
  86. package/dist/gateway/static/root/assets/{typed-models-lib-Peglr65V.js → typed-models-lib-zrYg51t3.js} +1 -1
  87. package/dist/gateway/static/root/assets/{use-autosave-C10PZ1OV.js → use-autosave-CqFVx92z.js} +1 -1
  88. package/dist/gateway/static/root/assets/user-context-page-CqG56cDS.js +1 -0
  89. package/dist/gateway/static/root/assets/voice-api-key-field-pYDiKKMo.js +1 -0
  90. package/dist/gateway/static/root/assets/{work-discovery-overlay-BI4wbLTm.js → work-discovery-overlay-LJLw9zf0.js} +1 -1
  91. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CfmwGYkr.js → workflow-run-setup-panel-D0WhQ3kI.js} +2 -2
  92. package/dist/gateway/static/root/assets/workflows-page-DQAJzV5w.js +5 -0
  93. package/dist/gateway/static/root/index.html +13 -11
  94. package/dist/package.js +1 -1
  95. package/dist/packages/realtime-client/src/index.js +17 -2
  96. package/dist/src/agent/agent-manager.js +4 -4
  97. package/dist/src/agent/embedded/model-runtime.js +1 -1
  98. package/dist/src/agent/embedded/run-for-session.js +1 -1
  99. package/dist/src/agent/image/tool-model-config.js +1 -1
  100. package/dist/src/agent/ipc/inbox.js +1 -1
  101. package/dist/src/agent/memory/create-memory-manager.js +1 -1
  102. package/dist/src/agent/service.js +2 -2
  103. package/dist/src/agent/session/session-inspector.js +1 -1
  104. package/dist/src/agent/skills/hub-lock.js +1 -1
  105. package/dist/src/agent/tasks/task-judge-service.js +3 -3
  106. package/dist/src/agent-runtime/index.js +1 -1
  107. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  108. package/dist/src/ai-assist/text-assist.js +1 -1
  109. package/dist/src/auth/credentials.js +2 -2
  110. package/dist/src/auth/profiles/store.js +1 -1
  111. package/dist/src/auth/sync-provider-auth.js +2 -2
  112. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  113. package/dist/src/cli/commands/agent.js +2 -2
  114. package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
  115. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  116. package/dist/src/cli/commands/models.js +2 -2
  117. package/dist/src/cli/commands/onboard.js +1 -1
  118. package/dist/src/cli/commands/profile.js +1 -1
  119. package/dist/src/cli/commands/tunnel.js +1 -1
  120. package/dist/src/cli/commands/update.js +1 -1
  121. package/dist/src/cli/extension-cli-register.js +1 -1
  122. package/dist/src/config/agent-profile.js +1 -1
  123. package/dist/src/config/index.js +5 -5
  124. package/dist/src/config/loader.js +1 -1
  125. package/dist/src/config/models-json.js +1 -1
  126. package/dist/src/extensions/lockfile.js +1 -1
  127. package/dist/src/gateway/agents-admin.js +2 -2
  128. package/dist/src/gateway/file-path-classifier.js +1 -1
  129. package/dist/src/gateway/heartbeat/service.js +1 -1
  130. package/dist/src/gateway/hono/lib/config-payload.js +1 -1
  131. package/dist/src/gateway/hono/lib/static-ui.js +1 -0
  132. package/dist/src/gateway/hono/oauth-async.d.ts +4 -0
  133. package/dist/src/gateway/hono/oauth-async.js +24 -1
  134. package/dist/src/gateway/hono/oauth.js +14 -1
  135. package/dist/src/gateway/hono/routes/config.js +3 -0
  136. package/dist/src/gateway/hono/routes/models.js +1 -1
  137. package/dist/src/gateway/hono/routes/public-gateway.js +16 -0
  138. package/dist/src/gateway/hono/routes/voice.js +1 -1
  139. package/dist/src/gateway/run-loop.js +1 -1
  140. package/dist/src/gateway/service/config-coordinator.js +1 -1
  141. package/dist/src/gateway/service.js +4 -6
  142. package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +41 -0
  143. package/dist/src/gateway/xopc-cloud-capability-setup.js +142 -0
  144. package/dist/src/heartbeat/index.js +1 -1
  145. package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
  146. package/dist/src/providers/index.js +2 -2
  147. package/dist/src/providers/model-registry.js +1 -1
  148. package/dist/src/providers/register-runtime-providers.js +1 -1
  149. package/dist/src/tui/tui-startup-resources.js +1 -1
  150. package/dist/src/tui/tui.js +1 -1
  151. package/dist/src/voice/language-profile.d.ts +0 -2
  152. package/dist/src/voice/language-profile.js +2 -30
  153. package/dist/src/voice/local/provider-switch.d.ts +4 -0
  154. package/dist/src/voice/local/provider-switch.js +36 -0
  155. package/dist/src/workflows/service/workflow-run-service.js +1 -1
  156. package/package.json +3 -3
  157. package/dist/gateway/static/root/assets/agents-DM2l0hCI.js +0 -68
  158. package/dist/gateway/static/root/assets/app-management-settings-panel-Bbul18ij.js +0 -1
  159. package/dist/gateway/static/root/assets/apps-page-BWd2KUkp.js +0 -1
  160. package/dist/gateway/static/root/assets/automations-workspace-B2eTpWQN.js +0 -6
  161. package/dist/gateway/static/root/assets/browser-settings-page-D6ua52QD.js +0 -8
  162. package/dist/gateway/static/root/assets/capabilities-settings-panel-DfTpgo4L.js +0 -7
  163. package/dist/gateway/static/root/assets/channels-settings-Cv3pT5iN.js +0 -1
  164. package/dist/gateway/static/root/assets/channels-status-swr-NfU9X-P5.js +0 -1
  165. package/dist/gateway/static/root/assets/connectors-api-Cj4deNtI.js +0 -1
  166. package/dist/gateway/static/root/assets/connectors-page-CL6PMerr.js +0 -2
  167. package/dist/gateway/static/root/assets/desktop-pet-settings-CJBeLcbV.js +0 -1
  168. package/dist/gateway/static/root/assets/heartbeat-settings-AutxO-ec.js +0 -1
  169. package/dist/gateway/static/root/assets/home-page-BMpQAeHr.js +0 -1
  170. package/dist/gateway/static/root/assets/index-BIBAmAjw.js +0 -108
  171. package/dist/gateway/static/root/assets/index-DQzjgIkQ.css +0 -2
  172. package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-Bcc08kso.js +0 -1
  173. package/dist/gateway/static/root/assets/local-app-workbench-page-ctXGGgj1.js +0 -2
  174. package/dist/gateway/static/root/assets/messages-CbbZKEfO.js +0 -3
  175. package/dist/gateway/static/root/assets/notes-workbench-CCFrzDRT.js +0 -4
  176. package/dist/gateway/static/root/assets/preview-open-alternatives-BtJkAYOs.js +0 -1
  177. package/dist/gateway/static/root/assets/project-detail-page-CVeA23NS.js +0 -1
  178. package/dist/gateway/static/root/assets/projects-page-DFj-bwa5.js +0 -1
  179. package/dist/gateway/static/root/assets/remote-access-hub-BgIrBYNz.js +0 -1
  180. package/dist/gateway/static/root/assets/sessions-page-wfBSuhmo.js +0 -1
  181. package/dist/gateway/static/root/assets/settings-advanced-gate-4zV9nthi.js +0 -1
  182. package/dist/gateway/static/root/assets/setup-status-panel-DEBPLh04.js +0 -1
  183. package/dist/gateway/static/root/assets/shares-settings-Cpd3s8-P.js +0 -1
  184. package/dist/gateway/static/root/assets/skill-reload-api-BrDL4HAN.js +0 -1
  185. package/dist/gateway/static/root/assets/skills-page-B1sTkjZH.js +0 -2
  186. package/dist/gateway/static/root/assets/system-settings-panel-MAl91hH_.js +0 -1
  187. package/dist/gateway/static/root/assets/task-detail-page-C5wgYuvF.js +0 -1
  188. package/dist/gateway/static/root/assets/user-context-page-DsAfqOJy.js +0 -1
  189. package/dist/gateway/static/root/assets/voice-api-key-field-bdYmX3ph.js +0 -1
  190. package/dist/gateway/static/root/assets/workflows-page-D7tjtD97.js +0 -5
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/jszip.min-DT31yWkU.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
2
- 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"./preload-helper-zJ_50EbN.js";import{c as a,l as o,p as s}from"./chunk-KS7C4IRE-BaASWQor.js";import{t as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./external-link-DjqjBmc3.js";import{t as u}from"./markdown-view-BMDQYc6E.js";import{t as d}from"./loader-circle-CifKLtgG.js";import{t as f}from"./plus-Q2yW6OE7.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./cn-JdwAhgNB.js";import{t as h}from"./button-CSEbl4zT.js";import{t as g}from"./messages-CbbZKEfO.js";import{l as _,n as v}from"./locale-store-BIOMAhmR.js";import{a as y,n as b,o as x,r as S,s as C,t as w}from"./dist-BPoKqzeH.js";import{t as T}from"./config-reload-event-Bjh2zoKp.js";import{$c as E,Ca as D,Fn as O,Jo as k,Oi as A,Ro as j,Sa as M,_o as N,ac as P,kc as F,mi as I,nl as L,rl as R,tl as z,us as B,zo as V}from"./index-BIBAmAjw.js";import{t as H}from"./page-tabs-DoQq4tt6.js";import{t as U}from"./skill-reload-api-BrDL4HAN.js";import{_ as W,a as G,c as ee,d as K,f as q,g as J,h as te,i as ne,l as re,m as ie,n as ae,o as oe,p as se,r as Y,s as ce,t as le,u as ue}from"./skills-page.utils-CIcb0h3E.js";var X=n(),Z=e(t(),1),Q=r(),de=(0,Z.memo)(function(e){let t=(0,X.c)(23),{loading:n,onReloadClick:r,searchQuery:i,setSearchQuery:a,mainTab:o,sk:s,setPendingFile:c,setInstallOpen:l}=e,u;t[0]!==n||t[1]!==r||t[2]!==s.reloadDiskAria||t[3]!==s.reloadRuntime?(u=(0,Q.jsx)(A,{className:`size-9 shrink-0 p-0`,loading:n,label:s.reloadDiskAria,title:s.reloadRuntime,onClick:r}),t[0]=n,t[1]=r,t[2]=s.reloadDiskAria,t[3]=s.reloadRuntime,t[4]=u):u=t[4];let d;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(B,{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[5]=d):d=t[5];let p;t[6]===a?p=t[7]:(p=e=>a(e.target.value),t[6]=a,t[7]=p);let m=o===`marketplace`?s.marketplaceSearchPackages:s.searchPlaceholder,g;t[8]!==i||t[9]!==p||t[10]!==m?(g=(0,Q.jsxs)(`label`,{className:`relative flex min-h-9 min-w-0 max-w-sm cursor-text items-center rounded-pill border border-edge bg-surface-base py-1.5 pl-9 pr-3 shadow-surface dark:bg-surface-hover/40 sm:max-w-md`,children:[d,(0,Q.jsx)(`input`,{type:`search`,enterKeyHint:`search`,value:i,onChange:p,placeholder:m,autoComplete:`off`,spellCheck:!1,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[8]=i,t[9]=p,t[10]=m,t[11]=g):g=t[11];let _;t[12]!==l||t[13]!==c?(_=()=>{c(null),l(!0)},t[12]=l,t[13]=c,t[14]=_):_=t[14];let v;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(f,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[15]=v):v=t[15];let y;t[16]!==s.installCta||t[17]!==_?(y=(0,Q.jsxs)(h,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,onClick:_,children:[v,s.installCta]}),t[16]=s.installCta,t[17]=_,t[18]=y):y=t[18];let b;return t[19]!==u||t[20]!==g||t[21]!==y?(b=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[u,g,y]}),t[19]=u,t[20]=g,t[21]=y,t[22]=b):b=t[22],b}),fe=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function pe(){let e=(0,X.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:m(`h-4 min-w-0 flex-1`,fe)}),e[0]=t):t=e[0];let n,r,i;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[t,(0,Q.jsxs)(`div`,{className:`flex shrink-0 gap-1`,children:[(0,Q.jsx)(`div`,{className:m(`size-8 shrink-0 rounded-lg`,fe)}),(0,Q.jsx)(`div`,{className:m(`h-8 w-[4.5rem] shrink-0 rounded-lg`,fe)})]})]}),r=(0,Q.jsx)(`div`,{className:m(`h-3 w-full`,fe)}),i=(0,Q.jsx)(`div`,{className:m(`h-3 w-[92%]`,fe)}),e[1]=n,e[2]=r,e[3]=i):(n=e[1],r=e[2],i=e[3]);let a;return e[4]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`div`,{className:`flex h-full min-h-[10.5rem] flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,"aria-hidden":!0,children:(0,Q.jsx)(`div`,{className:`flex min-h-0 flex-1 items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[n,r,i,(0,Q.jsxs)(`div`,{className:`mt-auto space-y-1 pt-0.5`,children:[(0,Q.jsx)(`div`,{className:m(`h-3 w-full`,fe)}),(0,Q.jsx)(`div`,{className:m(`h-2.5 w-4/5`,fe)})]})]})})}),e[4]=a):a=e[4],a}function me(){let e=(0,X.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(pe,{}),e[0]=t):t=e[0],t}var he=new Set([`installed`,`marketplace`]),ge=new Set([`all`,`builtin`,`installed`,`global`,`workspace`,`extra`]),_e=new Set([`all`,`enabled`,`disabled`]),ve=`mprov`,ye=[`s0`,`s1`,`s2`,`s3`,`s4`,`s5`],be=[`business`,`creative`,`documents`,`engineering`,`tools`];function xe(e){let t=(0,X.c)(27),{sk:n,loading:r,catalog:i,filteredCatalog:a,builtinCategories:o,builtinCategoryFilter:s,setBuiltinCategoryFilter:c,catalogDisplayRows:l,catalogStatusFilter:u,resolveSkillEnabled:d,categoryLabel:f,sourceLabel:p,openSkillDetail:g,onSkillToggle:_,onUseSkillInChat:v,usingSkillInChatName:y,togglingSkillName:b}=e;if(r){let e=n.loading,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=ye.map(Se),t[0]=r):r=t[0];let i;return t[1]===n.loading?i=t[2]:(i=(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":e,children:r}),t[1]=n.loading,t[2]=i),i}if(i.length===0){let e;return t[3]===n.empty?e=t[4]:(e=(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.empty}),t[3]=n.empty,t[4]=e),e}if(a.length===0){let e;return t[5]===n.noSearchResults?e=t[6]:(e=(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:n.noSearchResults}),t[5]=n.noSearchResults,t[6]=e),e}let x;t[7]!==o||t[8]!==s||t[9]!==f||t[10]!==c||t[11]!==n?(x=o.length>1?(0,Q.jsx)(H,{items:[{id:``,label:n.marketplaceCategoryAll},...o.map(e=>({id:e,label:f(e),title:f(e)}))],activeTab:s,onChange:c,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-builtin-category-tab`,className:`gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):null,t[7]=o,t[8]=s,t[9]=f,t[10]=c,t[11]=n,t[12]=x):x=t[12];let S;t[13]!==l||t[14]!==u||t[15]!==_||t[16]!==v||t[17]!==g||t[18]!==d||t[19]!==n||t[20]!==p||t[21]!==b||t[22]!==y?(S=l.length===0?(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:u===`disabled`?n.noDisabledSkills:n.noSearchResults}):(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,children:l.map(e=>{let t=d(e);return(0,Q.jsxs)(`article`,{className:m(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface transition-colors`,t?`hover:bg-surface-hover`:`bg-amber-50/30 hover:bg-amber-50/50 dark:bg-amber-950/20`),children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:m(`min-w-0 flex-1 cursor-pointer rounded-lg text-left outline-none`,N.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:()=>void g(e),children:(0,Q.jsx)(`h3`,{id:`catalog-skill-title-${e.directoryId}`,className:`truncate text-[15px] font-semibold leading-8 tracking-tight text-fg`,children:e.name})}),t?(0,Q.jsx)(h,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:y===e.name||b===e.name,onClick:()=>void v({name:e.name,source:`catalog`}),children:y===e.name?n.previewUseInChatBusy:n.previewUseInChat}):(0,Q.jsx)(h,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:b===e.name,onClick:()=>void _(e.name,!0),children:b===e.name?n.uploading:n.detailModalEnable})]}),(0,Q.jsx)(`button`,{type:`button`,className:m(`mt-2 flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,N.focusRingPanel),"aria-labelledby":`catalog-skill-title-${e.directoryId}`,onClick:()=>void g(e),children:(0,Q.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1.5 text-[11px] text-fg-subtle`,children:[(0,Q.jsx)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:p(e)}),(0,Q.jsxs)(`span`,{className:m(`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 font-medium`,t?`border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:`border-amber-500/30 bg-amber-500/10 text-amber-800 dark:text-amber-200`),children:[t?(0,Q.jsx)(E,{className:`size-3`,"aria-hidden":!0}):(0,Q.jsx)(z,{className:`size-3`,"aria-hidden":!0}),t?n.statusEnabled:n.statusDisabled]}),e.managed?(0,Q.jsxs)(`span`,{className:`rounded-md bg-surface-hover/60 px-2 py-0.5 dark:bg-surface-active/50`,children:[n.col.managed,`: `,n.yes]}):null,e.hub?(0,Q.jsxs)(`span`,{className:`max-w-full break-all rounded-md bg-surface-hover/60 px-2 py-0.5 font-mono text-[10px] leading-snug dark:bg-surface-active/50 line-clamp-2`,title:`${e.hub.source}${e.hub.ref?`\nref: ${e.hub.ref}`:``}\nupdated: ${e.hub.updatedAt}`,children:[n.hubRemote,` ·`,` `,e.hub.kind===`git`?n.hubKindGit:n.hubKindArchive,` ·`,` `,e.hub.source.length>48?`${e.hub.source.slice(0,48)}…`:e.hub.source]}):null]})]})})})]},`${e.directoryId}-${e.path}`)})}),t[13]=l,t[14]=u,t[15]=_,t[16]=v,t[17]=g,t[18]=d,t[19]=n,t[20]=p,t[21]=b,t[22]=y,t[23]=S):S=t[23];let C;return t[24]!==x||t[25]!==S?(C=(0,Q.jsxs)(Q.Fragment,{children:[x,S]}),t[24]=x,t[25]=S,t[26]=C):C=t[26],C}function Se(e){return(0,Q.jsx)(me,{},e)}function Ce(e){let t=(0,X.c)(32),{sk:n,confirmOpen:r,setConfirmOpen:i,confirmId:a,setConfirmId:o,runDelete:s}=e,c;t[0]!==o||t[1]!==i?(c=e=>{i(e),e||o(null)},t[0]=o,t[1]=i,t[2]=c):c=t[2];let l;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Q.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[3]=l):l=t[3];let u;t[4]===n.deleteTitle?u=t[5]:(u=(0,Q.jsx)(C,{className:`text-base font-semibold text-fg`,children:n.deleteTitle}),t[4]=n.deleteTitle,t[5]=u);let d;t[6]!==a||t[7]!==n.deleteMessage?(d=a?Y(n.deleteMessage,{id:a}):``,t[6]=a,t[7]=n.deleteMessage,t[8]=d):d=t[8];let f;t[9]===d?f=t[10]:(f=(0,Q.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:d}),t[9]=d,t[10]=f);let p;t[11]===i?p=t[12]:(p=()=>i(!1),t[11]=i,t[12]=p);let m;t[13]!==n.cancel||t[14]!==p?(m=(0,Q.jsx)(h,{type:`button`,variant:`secondary`,onClick:p,children:n.cancel}),t[13]=n.cancel,t[14]=p,t[15]=m):m=t[15];let g;t[16]===s?g=t[17]:(g=()=>void s(),t[16]=s,t[17]=g);let _;t[18]!==n.deleteConfirm||t[19]!==g?(_=(0,Q.jsx)(h,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:g,children:n.deleteConfirm}),t[18]=n.deleteConfirm,t[19]=g,t[20]=_):_=t[20];let v;t[21]!==m||t[22]!==_?(v=(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[m,_]}),t[21]=m,t[22]=_,t[23]=v):v=t[23];let b;t[24]!==v||t[25]!==u||t[26]!==f?(b=(0,Q.jsxs)(x,{children:[l,(0,Q.jsxs)(S,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] w-[min(100%-2rem,24rem)] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-edge bg-surface-panel p-4 shadow-popover dark:border-edge`,children:[u,f,v]})]}),t[24]=v,t[25]=u,t[26]=f,t[27]=b):b=t[27];let T;return t[28]!==r||t[29]!==c||t[30]!==b?(T=(0,Q.jsx)(w,{open:r,onOpenChange:c,children:b}),t[28]=r,t[29]=c,t[30]=b,t[31]=T):T=t[31],T}function we(e){let t=(0,X.c)(7),{label:n,children:r}=e;if(r==null||r===!1)return null;let i;t[0]===n?i=t[1]:(i=(0,Q.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:n}),t[0]=n,t[1]=i);let a;t[2]===r?a=t[3]:(a=(0,Q.jsx)(`div`,{className:`mt-1.5 min-w-0 text-sm text-fg`,children:r}),t[2]=r,t[3]=a);let o;return t[4]!==i||t[5]!==a?(o=(0,Q.jsxs)(`div`,{className:`mt-3 border-t border-edge-subtle pt-3 dark:border-edge/60`,children:[i,a]}),t[4]=i,t[5]=a,t[6]=o):o=t[6],o}function Te(e){let t=(0,X.c)(118),{preview:n,sk:r}=e,i=n.metadata,a=n.toolConditions,o=!!a&&(a.requiresTools.length>0||a.requiresToolsets.length>0||a.fallbackForTools.length>0||a.fallbackForToolsets.length>0),s=i.requires,c=s&&((s.bins?.length??0)>0||(s.env?.length??0)>0||(s.anyBins?.length??0)>0),l,d,f,p,h,g,_,v,y,b,x,S,C,w,T;if(t[0]!==a||t[1]!==c||t[2]!==o||t[3]!==i.emoji||t[4]!==i.homepage||t[5]!==i.install||t[6]!==i.os||t[7]!==n.description||t[8]!==n.disableModelInvocation||t[9]!==n.requiredEnvVarNames||t[10]!==s||t[11]!==r.detailEnvVarsLabel||t[12]!==r.detailHomepageLabel||t[13]!==r.detailInstallLabel||t[14]!==r.detailNotInjectedNote||t[15]!==r.detailPlatformsLabel||t[16]!==r.detailRequiresAnyBins||t[17]!==r.detailRequiresBins||t[18]!==r.detailRequiresEnv||t[19]!==r.detailRequiresLabel||t[20]!==r.detailSummaryHeading||t[21]!==r.detailToolGatingLabel||t[22]!==r.detailToolsFallbackList||t[23]!==r.detailToolsRequiresList||t[24]!==r.detailToolsetsFallbackList||t[25]!==r.detailToolsetsRequiresList){let e=i.install?.filter(Oe)??[],u=n.requiredEnvVarNames?.filter(De)??[];_=`space-y-6`,h=`skill-detail-summary-heading`,t[41]===r.detailSummaryHeading?g=t[42]:(g=(0,Q.jsx)(`h3`,{id:`skill-detail-summary-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailSummaryHeading}),t[41]=r.detailSummaryHeading,t[42]=g),y=`rounded-xl border border-edge bg-surface-base px-4 py-3 dark:bg-surface-hover/25`,t[43]===i.emoji?b=t[44]:(b=i.emoji?.trim()?(0,Q.jsx)(`p`,{className:`text-2xl leading-none`,"aria-hidden":!0,children:i.emoji.trim()}):null,t[43]=i.emoji,t[44]=b);let E;t[45]===i.emoji?E=t[46]:(E=i.emoji?.trim()?`mt-2`:``,t[45]=i.emoji,t[46]=E);let D;t[47]===E?D=t[48]:(D=m(`text-sm leading-relaxed text-fg`,E),t[47]=E,t[48]=D),t[49]!==n.description||t[50]!==D?(x=(0,Q.jsx)(`p`,{className:D,children:n.description}),t[49]=n.description,t[50]=D,t[51]=x):x=t[51],t[52]!==n.disableModelInvocation||t[53]!==r.detailNotInjectedNote?(S=n.disableModelInvocation?(0,Q.jsx)(`p`,{className:`mt-3 rounded-lg border border-amber-200/80 bg-amber-50/90 px-3 py-2 text-xs leading-snug text-amber-950 dark:border-amber-900/50 dark:bg-amber-950/40 dark:text-amber-100`,children:r.detailNotInjectedNote}):null,t[52]=n.disableModelInvocation,t[53]=r.detailNotInjectedNote,t[54]=S):S=t[54];let O;t[55]===i.homepage?O=t[56]:(O=i.homepage?.trim()?(0,Q.jsx)(`a`,{href:i.homepage.trim(),target:`_blank`,rel:`noopener noreferrer`,className:`break-all text-accent underline-offset-2 hover:underline`,children:i.homepage.trim()}):null,t[55]=i.homepage,t[56]=O),t[57]!==r.detailHomepageLabel||t[58]!==O?(C=(0,Q.jsx)(we,{label:r.detailHomepageLabel,children:O}),t[57]=r.detailHomepageLabel,t[58]=O,t[59]=C):C=t[59];let k;t[60]===i.os?k=t[61]:(k=i.os&&i.os.length>0?(0,Q.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:i.os.join(`, `)}):null,t[60]=i.os,t[61]=k),t[62]!==r.detailPlatformsLabel||t[63]!==k?(w=(0,Q.jsx)(we,{label:r.detailPlatformsLabel,children:k}),t[62]=r.detailPlatformsLabel,t[63]=k,t[64]=w):w=t[64];let A;t[65]!==c||t[66]!==s||t[67]!==r.detailRequiresAnyBins||t[68]!==r.detailRequiresBins||t[69]!==r.detailRequiresEnv?(A=c&&s?(0,Q.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[s.bins&&s.bins.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresBins,`: `]}),s.bins.join(`, `)]}):null,s.env&&s.env.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresEnv,`: `]}),(0,Q.jsx)(`span`,{className:`font-mono text-xs`,children:s.env.join(`, `)})]}):null,s.anyBins&&s.anyBins.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`text-fg`,children:[r.detailRequiresAnyBins,`: `]}),s.anyBins.join(`, `)]}):null]}):null,t[65]=c,t[66]=s,t[67]=r.detailRequiresAnyBins,t[68]=r.detailRequiresBins,t[69]=r.detailRequiresEnv,t[70]=A):A=t[70],t[71]!==r.detailRequiresLabel||t[72]!==A?(T=(0,Q.jsx)(we,{label:r.detailRequiresLabel,children:A}),t[71]=r.detailRequiresLabel,t[72]=A,t[73]=T):T=t[73];let j=e.length>0?(0,Q.jsx)(`ul`,{className:`list-inside list-decimal space-y-1.5 text-sm text-fg-muted`,children:e.map(Ee)}):null;t[74]!==r.detailInstallLabel||t[75]!==j?(f=(0,Q.jsx)(we,{label:r.detailInstallLabel,children:j}),t[74]=r.detailInstallLabel,t[75]=j,t[76]=f):f=t[76];let M;t[77]!==a||t[78]!==o||t[79]!==r.detailToolsFallbackList||t[80]!==r.detailToolsRequiresList||t[81]!==r.detailToolsetsFallbackList||t[82]!==r.detailToolsetsRequiresList?(M=o&&a?(0,Q.jsxs)(`ul`,{className:`mt-1 space-y-2 text-sm text-fg-muted`,children:[a.requiresTools.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsRequiresList,`: `]}),a.requiresTools.join(`, `)]}):null,a.requiresToolsets.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsRequiresList,`: `]}),a.requiresToolsets.join(`, `)]}):null,a.fallbackForTools.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsFallbackList,`: `]}),a.fallbackForTools.join(`, `)]}):null,a.fallbackForToolsets.length>0?(0,Q.jsxs)(`li`,{children:[(0,Q.jsxs)(`span`,{className:`font-medium text-fg`,children:[r.detailToolsetsFallbackList,`: `]}),a.fallbackForToolsets.join(`, `)]}):null]}):null,t[77]=a,t[78]=o,t[79]=r.detailToolsFallbackList,t[80]=r.detailToolsRequiresList,t[81]=r.detailToolsetsFallbackList,t[82]=r.detailToolsetsRequiresList,t[83]=M):M=t[83],t[84]!==r.detailToolGatingLabel||t[85]!==M?(p=(0,Q.jsx)(we,{label:r.detailToolGatingLabel,children:M}),t[84]=r.detailToolGatingLabel,t[85]=M,t[86]=p):p=t[86],l=we,d=r.detailEnvVarsLabel,v=u.length>0?(0,Q.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:u.join(`, `)}):null,t[0]=a,t[1]=c,t[2]=o,t[3]=i.emoji,t[4]=i.homepage,t[5]=i.install,t[6]=i.os,t[7]=n.description,t[8]=n.disableModelInvocation,t[9]=n.requiredEnvVarNames,t[10]=s,t[11]=r.detailEnvVarsLabel,t[12]=r.detailHomepageLabel,t[13]=r.detailInstallLabel,t[14]=r.detailNotInjectedNote,t[15]=r.detailPlatformsLabel,t[16]=r.detailRequiresAnyBins,t[17]=r.detailRequiresBins,t[18]=r.detailRequiresEnv,t[19]=r.detailRequiresLabel,t[20]=r.detailSummaryHeading,t[21]=r.detailToolGatingLabel,t[22]=r.detailToolsFallbackList,t[23]=r.detailToolsRequiresList,t[24]=r.detailToolsetsFallbackList,t[25]=r.detailToolsetsRequiresList,t[26]=l,t[27]=d,t[28]=f,t[29]=p,t[30]=h,t[31]=g,t[32]=_,t[33]=v,t[34]=y,t[35]=b,t[36]=x,t[37]=S,t[38]=C,t[39]=w,t[40]=T}else l=t[26],d=t[27],f=t[28],p=t[29],h=t[30],g=t[31],_=t[32],v=t[33],y=t[34],b=t[35],x=t[36],S=t[37],C=t[38],w=t[39],T=t[40];let E;t[87]!==l||t[88]!==d||t[89]!==v?(E=(0,Q.jsx)(l,{label:d,children:v}),t[87]=l,t[88]=d,t[89]=v,t[90]=E):E=t[90];let D;t[91]!==f||t[92]!==p||t[93]!==E||t[94]!==y||t[95]!==b||t[96]!==x||t[97]!==S||t[98]!==C||t[99]!==w||t[100]!==T?(D=(0,Q.jsxs)(`div`,{className:y,children:[b,x,S,C,w,T,f,p,E]}),t[91]=f,t[92]=p,t[93]=E,t[94]=y,t[95]=b,t[96]=x,t[97]=S,t[98]=C,t[99]=w,t[100]=T,t[101]=D):D=t[101];let O;t[102]!==h||t[103]!==g||t[104]!==D?(O=(0,Q.jsxs)(`section`,{"aria-labelledby":h,children:[g,D]}),t[102]=h,t[103]=g,t[104]=D,t[105]=O):O=t[105];let k;t[106]===r.detailInstructionsHeading?k=t[107]:(k=(0,Q.jsx)(`h3`,{id:`skill-detail-instructions-heading`,className:`mb-2 text-xs font-semibold uppercase tracking-wide text-fg-muted`,children:r.detailInstructionsHeading}),t[106]=r.detailInstructionsHeading,t[107]=k);let A;t[108]!==n.bodyMarkdown||t[109]!==r.detailNoInstructionsBody?(A=n.bodyMarkdown.trim()?(0,Q.jsx)(`div`,{className:`markdown-content min-w-0 break-words`,children:(0,Q.jsx)(u,{content:n.bodyMarkdown})}):(0,Q.jsx)(`p`,{className:`text-sm italic text-fg-muted`,children:r.detailNoInstructionsBody}),t[108]=n.bodyMarkdown,t[109]=r.detailNoInstructionsBody,t[110]=A):A=t[110];let j;t[111]!==k||t[112]!==A?(j=(0,Q.jsxs)(`section`,{"aria-labelledby":`skill-detail-instructions-heading`,children:[k,A]}),t[111]=k,t[112]=A,t[113]=j):j=t[113];let M;return t[114]!==_||t[115]!==O||t[116]!==j?(M=(0,Q.jsxs)(`div`,{className:_,children:[O,j]}),t[114]=_,t[115]=O,t[116]=j,t[117]=M):M=t[117],M}function Ee(e,t){return(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,Q.jsx)(`span`,{className:`text-fg`,children:ae(e)})},e.id||`${e.kind}-${t}`)}function De(e){return e.trim()}function Oe(e){return e&&typeof e.kind==`string`}var ke=[{id:`s0`,width:`w-[92%]`},{id:`s1`,width:`w-full`},{id:`s2`,width:`w-4/5`},{id:`s3`,width:`w-[92%]`},{id:`s4`,width:`w-full`},{id:`s5`,width:`w-4/5`},{id:`s6`,width:`w-[92%]`},{id:`s7`,width:`w-full`},{id:`s8`,width:`w-4/5`},{id:`s9`,width:`w-[92%]`}];function Ae(e){let t=(0,X.c)(81),{sk:n,detailOpen:r,setDetailOpen:i,detailSource:a,setDetailSource:o,detailTitle:s,setDetailTitle:c,detailCatalogPreview:u,setDetailCatalogPreview:d,detailMarketplacePreview:f,setDetailMarketplacePreview:g,detailLoading:_,detailError:v,setDetailError:T,detailEnabled:E,detailDirectoryId:D,detailManaged:O,detailExternalUrl:k,usingSkillInChatName:A,installingMarketName:M,togglingSkillName:F,isSkillInstalledByName:I,onUseSkillInChat:L,onMarketInstall:R,onSkillToggle:z,setConfirmId:B,setConfirmOpen:H}=e,U;t[0]!==d||t[1]!==T||t[2]!==g||t[3]!==i||t[4]!==o||t[5]!==c?(U=e=>{i(e),e||(o(`catalog`),d(null),g(null),T(null),c(``))},t[0]=d,t[1]=T,t[2]=g,t[3]=i,t[4]=o,t[5]=c,t[6]=U):U=t[6];let W;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=W):W=t[7];let G;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(G=m(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] flex h-[min(88vh,44rem)] max-h-[min(92vh,56rem)] w-[min(100%-2rem,min(92vw,56rem))]`,`-translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-float dark:border-edge`),t[8]=G):G=t[8];let ee=s||`?`,K;t[9]===ee?K=t[10]:(K=(0,Q.jsx)(ce,{name:ee}),t[9]=ee,t[10]=K);let q=s||`—`,J;t[11]===q?J=t[12]:(J=(0,Q.jsx)(C,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:q}),t[11]=q,t[12]=J);let te;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(te=m(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,N.focusRingPanel),t[13]=te):te=t[13];let ne;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,Q.jsx)(p,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[14]=ne):ne=t[14];let re;t[15]===n.detailCloseAria?re=t[16]:(re=(0,Q.jsx)(b,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:te,"aria-label":n.detailCloseAria,children:ne})}),t[15]=n.detailCloseAria,t[16]=re);let ie;t[17]!==K||t[18]!==J||t[19]!==re?(ie=(0,Q.jsxs)(`div`,{className:`group flex min-h-[3.25rem] shrink-0 items-center gap-3 border-b border-edge px-4 py-3`,children:[K,J,re]}),t[17]=K,t[18]=J,t[19]=re,t[20]=ie):ie=t[20];let ae;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ae=(0,Q.jsx)(P,{className:`mt-0.5 size-4 shrink-0 text-blue-600 dark:text-blue-400`,strokeWidth:1.75,"aria-hidden":!0}),t[21]=ae):ae=t[21];let oe=a===`store`&&f?n.detailModalBanner:a===`store`?n.detailModalBannerStore:n.detailModalBanner,se;t[22]===oe?se=t[23]:(se=(0,Q.jsxs)(`div`,{className:`flex min-h-[3.25rem] shrink-0 items-start gap-2 border-b border-blue-200/80 bg-blue-50/95 px-4 py-2.5 text-sm text-fg dark:border-blue-900/50 dark:bg-blue-950/45`,children:[ae,(0,Q.jsx)(`p`,{className:`min-w-0 leading-relaxed`,children:oe})]}),t[22]=oe,t[23]=se);let Y;t[24]!==u||t[25]!==E||t[26]!==v||t[27]!==_||t[28]!==f||t[29]!==a||t[30]!==n?(Y=(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto p-4`,children:_?(0,Q.jsx)(`div`,{className:`flex h-full min-h-[14rem] flex-col gap-2.5 py-1`,"aria-busy":`true`,"aria-label":n.loading,children:ke.map(je)}):v?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:v}):a===`catalog`&&u?(0,Q.jsxs)(Q.Fragment,{children:[E?null:(0,Q.jsxs)(`div`,{className:`mb-4 flex items-start gap-2 rounded-xl border border-amber-200 bg-amber-50 px-3 py-2.5 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-100`,children:[(0,Q.jsx)(j,{className:`mt-0.5 size-4 shrink-0 text-amber-600 dark:text-amber-300`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`p`,{className:`leading-relaxed`,children:n.detailDisabledNotice})]}),(0,Q.jsx)(Te,{preview:u,sk:n})]}):a===`store`&&f?(0,Q.jsx)(Te,{preview:f,sk:n}):(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n.detailLoadFailed})}),t[24]=u,t[25]=E,t[26]=v,t[27]=_,t[28]=f,t[29]=a,t[30]=n,t[31]=Y):Y=t[31];let le;t[32]!==k||t[33]!==a||t[34]!==n.marketplaceOpenExternal||t[35]!==n.marketplaceOpenExternalAria?(le=a===`store`&&k?(0,Q.jsxs)(`a`,{href:k,target:`_blank`,rel:`noopener noreferrer`,className:m(`inline-flex h-9 items-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 text-sm font-medium text-fg-muted`,`hover:bg-surface-hover hover:text-fg dark:border-edge`,N.focusRingPanel),"aria-label":n.marketplaceOpenExternalAria,title:n.marketplaceOpenExternal,children:[(0,Q.jsx)(l,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:n.marketplaceOpenExternal})]}):null,t[32]=k,t[33]=a,t[34]=n.marketplaceOpenExternal,t[35]=n.marketplaceOpenExternalAria,t[36]=le):le=t[36];let ue;t[37]!==D||t[38]!==O||t[39]!==a||t[40]!==B||t[41]!==H||t[42]!==n.delete?(ue=a===`catalog`&&O&&D?(0,Q.jsxs)(h,{type:`button`,variant:`ghost`,className:`gap-1.5 text-red-600 hover:bg-red-50 hover:text-red-700 dark:text-red-400 dark:hover:bg-red-950/40 dark:hover:text-red-300`,onClick:()=>{B(D),H(!0)},children:[(0,Q.jsx)(V,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),n.delete]}):null,t[37]=D,t[38]=O,t[39]=a,t[40]=B,t[41]=H,t[42]=n.delete,t[43]=ue):ue=t[43];let Z;t[44]!==le||t[45]!==ue?(Z=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[le,ue]}),t[44]=le,t[45]=ue,t[46]=Z):Z=t[46];let de;t[47]!==E||t[48]!==_||t[49]!==a||t[50]!==s||t[51]!==M||t[52]!==I||t[53]!==R||t[54]!==z||t[55]!==L||t[56]!==i||t[57]!==n.cancel||t[58]!==n.detailModalDisable||t[59]!==n.detailModalEnable||t[60]!==n.marketplaceInstall||t[61]!==n.marketplaceReinstall||t[62]!==n.previewUseInChat||t[63]!==n.previewUseInChatBusy||t[64]!==n.uploading||t[65]!==n.useRequiresEnabled||t[66]!==F||t[67]!==A?(de=(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:a===`store`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(h,{type:`button`,variant:`ghost`,onClick:()=>i(!1),children:n.cancel}),(0,Q.jsx)(h,{type:`button`,variant:`secondary`,disabled:!s||_||A===s||M===s,onClick:()=>void L(),children:A===s?n.previewUseInChatBusy:n.previewUseInChat}),(0,Q.jsx)(h,{type:`button`,variant:I(s)?`secondary`:`primary`,disabled:!s||M===s,onClick:()=>{s&&R(s,{useDetailProvider:!0})},children:M===s?n.uploading:I(s)?n.marketplaceReinstall:n.marketplaceInstall})]}):(0,Q.jsxs)(Q.Fragment,{children:[E?(0,Q.jsx)(h,{type:`button`,variant:`secondary`,disabled:!s||F===s,onClick:()=>{s&&z(s,!1)},children:F===s?n.uploading:n.detailModalDisable}):(0,Q.jsx)(h,{type:`button`,variant:`primary`,disabled:!s||F===s,onClick:()=>{s&&z(s,!0)},children:F===s?n.uploading:n.detailModalEnable}),(0,Q.jsx)(h,{type:`button`,variant:`secondary`,disabled:!s||!E||_||A===s||F===s,title:E?void 0:n.useRequiresEnabled,onClick:()=>void L(),children:A===s?n.previewUseInChatBusy:n.previewUseInChat})]})}),t[47]=E,t[48]=_,t[49]=a,t[50]=s,t[51]=M,t[52]=I,t[53]=R,t[54]=z,t[55]=L,t[56]=i,t[57]=n.cancel,t[58]=n.detailModalDisable,t[59]=n.detailModalEnable,t[60]=n.marketplaceInstall,t[61]=n.marketplaceReinstall,t[62]=n.previewUseInChat,t[63]=n.previewUseInChatBusy,t[64]=n.uploading,t[65]=n.useRequiresEnabled,t[66]=F,t[67]=A,t[68]=de):de=t[68];let fe;t[69]!==Z||t[70]!==de?(fe=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-edge px-4 py-3`,children:[Z,de]}),t[69]=Z,t[70]=de,t[71]=fe):fe=t[71];let pe;t[72]!==ie||t[73]!==se||t[74]!==Y||t[75]!==fe?(pe=(0,Q.jsxs)(x,{children:[W,(0,Q.jsxs)(S,{className:G,children:[ie,se,Y,fe]})]}),t[72]=ie,t[73]=se,t[74]=Y,t[75]=fe,t[76]=pe):pe=t[76];let me;return t[77]!==r||t[78]!==U||t[79]!==pe?(me=(0,Q.jsx)(w,{open:r,onOpenChange:U,children:pe}),t[77]=r,t[78]=U,t[79]=pe,t[80]=me):me=t[80],me}function je(e){return(0,Q.jsx)(`div`,{className:m(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,e.width)},e.id)}function Me(e){let t=(0,X.c)(67),{sk:n,installOpen:r,setInstallOpen:i,pendingFile:a,setPendingFile:o,dropActive:s,setDropActive:c,uploading:l,onModalDragOver:u,onModalDragLeave:d,onModalDrop:f,onFileInputChange:h,onInstallSubmit:g}=e,_;t[0]!==c||t[1]!==i||t[2]!==o?(_=e=>{i(e),e||(o(null),c(!1))},t[0]=c,t[1]=i,t[2]=o,t[3]=_):_=t[3];let v;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Q.jsx)(y,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[4]=v):v=t[4];let T;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(T=m(`xopc-dialog-content fixed left-1/2 top-1/2 z-[60] max-h-[min(100vh-2rem,44rem)] w-[min(100%-2rem,min(92vw,48rem))] -translate-x-1/2 -translate-y-1/2 overflow-y-auto`,`rounded-2xl border border-edge bg-surface-panel p-6 shadow-float dark:border-edge`),t[5]=T):T=t[5];let E;t[6]===n.installModalTitle?E=t[7]:(E=(0,Q.jsx)(C,{className:`text-base font-semibold text-fg`,children:n.installModalTitle}),t[6]=n.installModalTitle,t[7]=E);let D;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(D=m(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,N.focusRingPanel),t[8]=D):D=t[8];let O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(p,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=O):O=t[9];let k;t[10]===n.installClose?k=t[11]:(k=(0,Q.jsx)(`span`,{className:`sr-only`,children:n.installClose}),t[10]=n.installClose,t[11]=k);let A;t[12]!==n.installClose||t[13]!==k?(A=(0,Q.jsx)(b,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:D,"aria-label":n.installClose,children:[O,k]})}),t[12]=n.installClose,t[13]=k,t[14]=A):A=t[14];let j;t[15]!==E||t[16]!==A?(j=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[E,A]}),t[15]=E,t[16]=A,t[17]=j):j=t[17];let M=s?`border-accent bg-accent-soft/60 dark:bg-blue-950/40`:`border-edge bg-surface-base dark:bg-surface-hover/30`,P;t[18]===M?P=t[19]:(P=m(`mt-4 flex min-h-[11rem] cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed px-6 py-12 text-center transition-colors`,M),t[18]=M,t[19]=P);let I;t[20]!==h||t[21]!==n.installModalDropHint||t[22]!==l?(I=(0,Q.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":n.installModalDropHint,disabled:l,onChange:h}),t[20]=h,t[21]=n.installModalDropHint,t[22]=l,t[23]=I):I=t[23];let L;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(L=(0,Q.jsx)(F,{className:`size-12 text-fg-subtle`,strokeWidth:1.25,"aria-hidden":!0}),t[24]=L):L=t[24];let R;t[25]===n.installModalDropHint?R=t[26]:(R=(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.installModalDropHint}),t[25]=n.installModalDropHint,t[26]=R);let z;t[27]===a?z=t[28]:(z=a?(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:a.name}):null,t[27]=a,t[28]=z);let B;t[29]!==d||t[30]!==u||t[31]!==f||t[32]!==P||t[33]!==I||t[34]!==R||t[35]!==z?(B=(0,Q.jsxs)(`label`,{className:P,onDragLeave:d,onDragOver:u,onDrop:f,children:[I,L,R,z]}),t[29]=d,t[30]=u,t[31]=f,t[32]=P,t[33]=I,t[34]=R,t[35]=z,t[36]=B):B=t[36];let V;t[37]===n.installModalReqTitle?V=t[38]:(V=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.installModalReqTitle}),t[37]=n.installModalReqTitle,t[38]=V);let H;t[39]===n.installModalReq1?H=t[40]:(H=(0,Q.jsx)(`li`,{children:n.installModalReq1}),t[39]=n.installModalReq1,t[40]=H);let U;t[41]===n.installModalReq2?U=t[42]:(U=(0,Q.jsx)(`li`,{children:n.installModalReq2}),t[41]=n.installModalReq2,t[42]=U);let W;t[43]!==H||t[44]!==U?(W=(0,Q.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[H,U]}),t[43]=H,t[44]=U,t[45]=W):W=t[45];let G;t[46]!==V||t[47]!==W?(G=(0,Q.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[V,W]}),t[46]=V,t[47]=W,t[48]=G):G=t[48];let ee=!a||l,K=!a||l?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-white hover:bg-accent-hover`,q;t[49]===K?q=t[50]:(q=m(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,K,N.focusRingPanel),t[49]=K,t[50]=q);let J;t[51]===g?J=t[52]:(J=()=>void g(),t[51]=g,t[52]=J);let te=l?n.uploading:n.installAction,ne;t[53]!==ee||t[54]!==q||t[55]!==J||t[56]!==te?(ne=(0,Q.jsx)(`button`,{type:`button`,disabled:ee,className:q,onClick:J,children:te}),t[53]=ee,t[54]=q,t[55]=J,t[56]=te,t[57]=ne):ne=t[57];let re;t[58]!==B||t[59]!==G||t[60]!==ne||t[61]!==j?(re=(0,Q.jsxs)(x,{children:[v,(0,Q.jsxs)(S,{className:T,children:[j,B,G,ne]})]}),t[58]=B,t[59]=G,t[60]=ne,t[61]=j,t[62]=re):re=t[62];let ie;return t[63]!==r||t[64]!==_||t[65]!==re?(ie=(0,Q.jsx)(w,{open:r,onOpenChange:_,children:re}),t[63]=r,t[64]=_,t[65]=re,t[66]=ie):ie=t[66],ie}function Ne(e){let t=(0,X.c)(68),{sk:n,mpCategories:r,mpCategoriesLoading:i,mpCategoriesError:a,mpPayload:o,mpLoading:s,mpError:c,marketCategoryId:l,setMarketCategoryId:u,marketPage:f,setMarketPage:p,isSkillInstalledByName:g,openMarketplaceDetail:_,onMarketInstall:v,installingMarketName:y,onUseSkillInChat:b,usingSkillInChatName:x,searchInputActive:S,searchQuery:C,setSearchQuery:w,registeredProviders:T,marketBrowseProvider:D,setMarketBrowseProvider:O}=e,A=!S,j,M,P;if(t[0]!==y||t[1]!==g||t[2]!==D||t[3]!==l||t[4]!==f||t[5]!==r||t[6]!==a||t[7]!==i||t[8]!==c||t[9]!==s||t[10]!==o||t[11]!==v||t[12]!==b||t[13]!==_||t[14]!==T||t[15]!==S||t[16]!==C||t[17]!==O||t[18]!==u||t[19]!==p||t[20]!==w||t[21]!==A||t[22]!==n.loading||t[23]!==n.marketplaceAuthor||t[24]!==n.marketplaceCategoriesAria||t[25]!==n.marketplaceCategoryAll||t[26]!==n.marketplaceDownloads||t[27]!==n.marketplaceEmpty||t[28]!==n.marketplaceEmptySearch||t[29]!==n.marketplaceEmptySearchClear||t[30]!==n.marketplaceEmptySearchTryProvider||t[31]!==n.marketplaceInstall||t[32]!==n.marketplaceInstalled||t[33]!==n.marketplacePageNext||t[34]!==n.marketplacePagePrev||t[35]!==n.marketplacePageStatus||t[36]!==n.marketplaceVersion||t[37]!==n.previewUseInChat||t[38]!==n.previewUseInChatBusy||t[39]!==n.uploading||t[40]!==x){let e;t[44]===D?e=t[45]:(e=e=>e.id!==D,t[44]=D,t[45]=e);let F=T.filter(e),I=C.trim(),z;t[46]===n.marketplaceCategoryAll?z=t[47]:(z={id:``,label:n.marketplaceCategoryAll},t[46]=n.marketplaceCategoryAll,t[47]=z);let B;t[48]!==r||t[49]!==z?(B=[z,...r.map(Re)],t[48]=r,t[49]=z,t[50]=B):B=t[50];let V=B,U;t[51]===r?U=t[52]:(U=new Map(r.map(Le)),t[51]=r,t[52]=U);let W=U;t[53]!==V||t[54]!==l||t[55]!==r.length||t[56]!==i||t[57]!==u||t[58]!==A||t[59]!==n.marketplaceCategoriesAria?(j=A?r.length>0?(0,Q.jsx)(H,{items:V,activeTab:l,onChange:u,ariaLabel:n.marketplaceCategoriesAria,tabIdPrefix:`skills-marketplace-category-tab`,className:`min-h-[2.75rem] items-center gap-2 pt-0.5 [scrollbar-width:thin]`,buttonClassName:`max-w-[14rem] truncate rounded-full border px-3 py-1.5 text-xs`,selectedClassName:`border-fg bg-fg text-surface-panel dark:border-fg dark:bg-fg dark:text-surface-base`,unselectedClassName:`border-edge bg-surface-panel text-fg-muted hover:border-edge-strong hover:text-fg dark:border-edge dark:bg-surface-hover/40`}):i?(0,Q.jsx)(`div`,{className:`-mx-1 flex min-h-[2.75rem] items-center gap-2 overflow-x-auto px-1 pb-1 pt-0.5 [scrollbar-width:thin]`,"aria-hidden":!0,children:[`p0`,`p1`,`p2`,`p3`,`p4`].map(Ie)}):null:null,t[53]=V,t[54]=l,t[55]=r.length,t[56]=i,t[57]=u,t[58]=A,t[59]=n.marketplaceCategoriesAria,t[60]=j):j=t[60],t[61]!==a||t[62]!==A?(M=A&&a?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:a}):null,t[61]=a,t[62]=A,t[63]=M):M=t[63],P=!o&&!c?(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,"aria-busy":`true`,"aria-label":n.loading,children:ye.map(Fe)}):c&&!o?(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:c}):o?(0,Q.jsxs)(`div`,{className:`relative`,children:[s?(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-[1] flex justify-center bg-surface-panel/40 pt-[min(28vh,7.5rem)] backdrop-blur-[1px] motion-reduce:backdrop-blur-none dark:bg-surface-base/35`,"aria-busy":`true`,"aria-label":n.loading,children:(0,Q.jsx)(d,{className:`size-8 shrink-0 animate-spin text-accent motion-reduce:animate-none`,strokeWidth:2,"aria-hidden":!0})}):null,o.items.length===0?(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 rounded-2xl border border-dashed border-edge py-12 text-center text-sm text-fg-muted`,children:[(0,Q.jsx)(`p`,{className:`px-4`,children:S&&I?Y(n.marketplaceEmptySearch,{query:I}):n.marketplaceEmpty}),S?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[F.map(e=>(0,Q.jsx)(h,{type:`button`,variant:`secondary`,className:`h-8 px-3 text-xs`,onClick:()=>O(e.id),children:Y(n.marketplaceEmptySearchTryProvider,{provider:e.displayName})},e.id)),(0,Q.jsx)(h,{type:`button`,variant:`ghost`,className:`h-8 px-3 text-xs`,onClick:()=>w(``),children:n.marketplaceEmptySearchClear})]}):null]}):(0,Q.jsx)(`div`,{className:m(`grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3`,s&&`pointer-events-none opacity-[0.52] motion-reduce:opacity-100`),children:o.items.map(e=>{let t=ne(e,e.providerId??D),r=g(t),i=e.category??e.categories?.[0],a=i?W.get(i)??i:null;return(0,Q.jsxs)(`article`,{className:m(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-colors hover:bg-surface-hover`),children:[(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`button`,{type:`button`,className:m(`min-w-0 flex-1 rounded-lg text-left outline-none`,N.focusRingPanel),onClick:()=>void _(t,e.name,e.providerId??void 0),children:(0,Q.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name})}),r?(0,Q.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 rounded-full border border-emerald-500/30 bg-emerald-500/10 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:text-emerald-300`,children:[(0,Q.jsx)(E,{className:`size-3`,"aria-hidden":!0}),n.marketplaceInstalled]}):(0,Q.jsx)(h,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||y===t,onClick:()=>void v(t,{providerOverride:e.providerId??null}),children:y===t?n.uploading:n.marketplaceInstall})]}),(0,Q.jsx)(`button`,{type:`button`,className:m(`mt-2 flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,N.focusRingPanel),"aria-labelledby":`mp-skill-title-${e.id}`,onClick:()=>void _(t,e.name,e.providerId??void 0),children:(0,Q.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,Q.jsx)(`p`,{className:`line-clamp-2 text-sm leading-relaxed text-fg-muted`,title:e.description?e.description:void 0,children:e.description||`—`}),a?(0,Q.jsx)(`span`,{className:`w-fit max-w-full truncate rounded-full bg-surface-subtle px-2 py-0.5 text-[10px] font-medium text-fg-muted`,children:a}):null,(0,Q.jsxs)(`div`,{className:`mt-auto min-h-[2.625rem] space-y-1 text-[11px] leading-snug text-fg-muted`,children:[(0,Q.jsxs)(`p`,{className:`line-clamp-1`,title:`${n.marketplaceAuthor}: ${e.author.username} · ${n.marketplaceDownloads}: ${e.downloads}${e.stars!=null&&e.stars>0?` · ★${e.stars}`:``}${r?` · ${n.marketplaceInstalled}`:``}`,children:[(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:n.marketplaceAuthor}),` `,(0,Q.jsx)(`span`,{className:`text-fg`,children:e.author.username}),(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,Q.jsxs)(`span`,{children:[n.marketplaceDownloads,`: `,e.downloads]}),e.stars!=null&&e.stars>0?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-fg-subtle`,children:` · `}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-fg-muted`,children:[(0,Q.jsx)(k,{className:`size-3 shrink-0 text-amber-600 dark:text-amber-400`,strokeWidth:2,"aria-hidden":!0}),e.stars]})]}):null]}),e.latestVersion?(0,Q.jsxs)(`p`,{className:`line-clamp-1 min-h-[1.125rem] font-mono text-[10px] text-fg-subtle`,title:`${n.marketplaceVersion}: ${e.latestVersion}`,children:[n.marketplaceVersion,`: `,e.latestVersion]}):null]})]})})}),r?(0,Q.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:(0,Q.jsx)(h,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||x===t,onClick:()=>void b({name:t,source:`store`,providerOverride:e.providerId??null}),children:x===t?n.previewUseInChatBusy:n.previewUseInChat})}):null]},e.id)})}),o.items.length>0?(0,Q.jsxs)(`div`,{className:`mt-3 flex flex-col items-center justify-between gap-3 sm:flex-row`,children:[(0,Q.jsx)(`p`,{className:`text-center text-xs text-fg-muted sm:text-left`,children:Y(n.marketplacePageStatus,{page:o.meta.page,totalPages:o.meta.totalPages,total:o.meta.total})}),o.meta.totalPages>1?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||f<=1,"aria-label":n.marketplacePagePrev,onClick:()=>p(Pe),children:[(0,Q.jsx)(R,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePagePrev})]}),(0,Q.jsxs)(h,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||f>=o.meta.totalPages,"aria-label":n.marketplacePageNext,onClick:()=>p(e=>Math.min(o.meta.totalPages,e+1)),children:[(0,Q.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:n.marketplacePageNext}),(0,Q.jsx)(L,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})]})]}):null]}):null]}):null,t[0]=y,t[1]=g,t[2]=D,t[3]=l,t[4]=f,t[5]=r,t[6]=a,t[7]=i,t[8]=c,t[9]=s,t[10]=o,t[11]=v,t[12]=b,t[13]=_,t[14]=T,t[15]=S,t[16]=C,t[17]=O,t[18]=u,t[19]=p,t[20]=w,t[21]=A,t[22]=n.loading,t[23]=n.marketplaceAuthor,t[24]=n.marketplaceCategoriesAria,t[25]=n.marketplaceCategoryAll,t[26]=n.marketplaceDownloads,t[27]=n.marketplaceEmpty,t[28]=n.marketplaceEmptySearch,t[29]=n.marketplaceEmptySearchClear,t[30]=n.marketplaceEmptySearchTryProvider,t[31]=n.marketplaceInstall,t[32]=n.marketplaceInstalled,t[33]=n.marketplacePageNext,t[34]=n.marketplacePagePrev,t[35]=n.marketplacePageStatus,t[36]=n.marketplaceVersion,t[37]=n.previewUseInChat,t[38]=n.previewUseInChatBusy,t[39]=n.uploading,t[40]=x,t[41]=j,t[42]=M,t[43]=P}else j=t[41],M=t[42],P=t[43];let F;return t[64]!==j||t[65]!==M||t[66]!==P?(F=(0,Q.jsxs)(Q.Fragment,{children:[j,M,P]}),t[64]=j,t[65]=M,t[66]=P,t[67]=F):F=t[67],F}function Pe(e){return Math.max(1,e-1)}function Fe(e){return(0,Q.jsx)(pe,{},e)}function Ie(e){return(0,Q.jsx)(`div`,{className:`h-8 w-[4.5rem] shrink-0 animate-pulse rounded-full bg-surface-hover motion-reduce:animate-none dark:bg-surface-active/50`},e)}function Le(e){return[e.id,e.label]}function Re(e){return{id:e.id,label:e.label,title:e.label}}function ze(e){let t=(0,X.c)(130),{vm:n}=e,{sk:r,hasToken:i,error:a,actionFeedback:o,skillDiagnostics:s,mainTab:l,setMainTab:u,sourceFilter:d,setSourceFilter:f,builtinTabStats:p,userTabStats:h,catalogDisabledCount:g,catalogStatusFilter:_,setCatalogStatusFilter:v,marketSort:y,setMarketSort:b,marketBrowseProvider:x,setMarketBrowseProvider:S,registeredProviders:C,inSettingsShell:w,searchInputActive:T,resultTab:E,setResultTab:D,aggregatedTabCounts:O,aggregatedProviderStatus:k}=n,A,j,M,N,P,F,I,L;if(t[0]!==o||t[1]!==k||t[2]!==O||t[3]!==p||t[4]!==a||t[5]!==i||t[6]!==C||t[7]!==r.diagnosticsHint||t[8]!==r.diagnosticsTitle||t[9]!==r.marketplaceLoadFailed||t[10]!==r.marketplaceResultsTabAll||t[11]!==r.needToken||t[12]!==r.tabDiscover||t[13]!==r.tabInstalled||t[14]!==s||t[15]!==h||t[16]!==n){L=Symbol.for(`react.early_return_sentinel`);bb0:{let e=le(s);if(!i){let e;t[25]===n?e=t[26]:(e=(0,Q.jsx)(Ue,{vm:n}),t[25]=n,t[26]=e);let i;t[27]===r.needToken?i=t[28]:(i=(0,Q.jsx)(`div`,{className:`w-full px-3 py-16 text-center text-sm text-fg-muted sm:px-5 xl:px-6`,children:r.needToken}),t[27]=r.needToken,t[28]=i);let a;t[29]!==e||t[30]!==i?(a=(0,Q.jsxs)(Q.Fragment,{children:[e,i]}),t[29]=e,t[30]=i,t[31]=a):a=t[31],L=a;break bb0}let c=p.total+h.total,l;t[32]!==c||t[33]!==r.tabInstalled?(l={id:`installed`,label:r.tabInstalled,count:c},t[32]=c,t[33]=r.tabInstalled,t[34]=l):l=t[34];let u;t[35]===r.tabDiscover?u=t[36]:(u={id:`marketplace`,label:r.tabDiscover},t[35]=r.tabDiscover,t[36]=u);let d;t[37]!==l||t[38]!==u?(d=[l,u],t[37]=l,t[38]=u,t[39]=d):d=t[39],A=d;let f;t[40]===C?f=t[41]:(f=[`all`,...C.map(He)],t[40]=C,t[41]=f);let g=f,_;t[42]!==k||t[43]!==O||t[44]!==C||t[45]!==r.marketplaceLoadFailed||t[46]!==r.marketplaceResultsTabAll||t[47]!==g?(_=g.map(e=>{let t=e===`all`?r.marketplaceResultsTabAll:C.find(t=>t.id===e)?.displayName??e,n=O[e]??0,i=e===`all`?null:k[e];return{id:e,label:t,title:i===`error`?`${t} · ${r.marketplaceLoadFailed}`:void 0,suffix:i===`loading`?(0,Q.jsx)(`span`,{className:`inline-block size-1.5 animate-pulse rounded-full bg-fg-muted/60 motion-reduce:animate-none`,"aria-hidden":!0}):i===`error`?(0,Q.jsx)(`span`,{className:`inline-block size-1.5 rounded-full bg-red-500`,"aria-hidden":!0}):(0,Q.jsx)(`span`,{className:`tabular-nums opacity-70`,children:n})}}),t[42]=k,t[43]=O,t[44]=C,t[45]=r.marketplaceLoadFailed,t[46]=r.marketplaceResultsTabAll,t[47]=g,t[48]=_):_=t[48],j=_,t[49]===n?I=t[50]:(I=(0,Q.jsx)(Ue,{vm:n}),t[49]=n,t[50]=I),F=`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,M=`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,t[51]!==o||t[52]!==a?(N=o?(0,Q.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:m(`rounded-xl border px-3 py-2 text-sm`,o.kind===`success`?`border-emerald-200 bg-emerald-50 text-emerald-800 dark:border-emerald-900/40 dark:bg-emerald-950/40 dark:text-emerald-200`:`border-red-200 bg-red-50 text-red-800 dark:border-red-900/50 dark:bg-red-950/40 dark:text-red-200`),children:o.message}):a?(0,Q.jsx)(`div`,{className:`rounded-xl border border-edge bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-edge dark:bg-red-950/40 dark:text-red-300`,role:`alert`,children:a}):null,t[51]=o,t[52]=a,t[53]=N):N=t[53],P=e.length>0?(0,Q.jsxs)(`div`,{className:`rounded-xl border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-900 dark:border-amber-900/50 dark:bg-amber-950/30 dark:text-amber-200`,role:`status`,children:[(0,Q.jsx)(`div`,{className:`font-medium`,children:Y(r.diagnosticsTitle,{count:e.length})}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs opacity-80`,children:r.diagnosticsHint}),(0,Q.jsx)(`ul`,{className:`mt-1 space-y-1`,children:e.slice(0,3).map(Ve)})]}):null}t[0]=o,t[1]=k,t[2]=O,t[3]=p,t[4]=a,t[5]=i,t[6]=C,t[7]=r.diagnosticsHint,t[8]=r.diagnosticsTitle,t[9]=r.marketplaceLoadFailed,t[10]=r.marketplaceResultsTabAll,t[11]=r.needToken,t[12]=r.tabDiscover,t[13]=r.tabInstalled,t[14]=s,t[15]=h,t[16]=n,t[17]=A,t[18]=j,t[19]=M,t[20]=N,t[21]=P,t[22]=F,t[23]=I,t[24]=L}else A=t[17],j=t[18],M=t[19],N=t[20],P=t[21],F=t[22],I=t[23],L=t[24];if(L!==Symbol.for(`react.early_return_sentinel`))return L;let R;t[54]!==w||t[55]!==n.loading||t[56]!==n.mainTab||t[57]!==n.onReloadClick||t[58]!==n.searchQuery||t[59]!==n.setInstallOpen||t[60]!==n.setPendingFile||t[61]!==n.setSearchQuery||t[62]!==n.sk?(R=w?(0,Q.jsx)(`div`,{className:`flex flex-col gap-3 border-b border-edge-subtle pb-4 dark:border-edge-subtle sm:flex-row sm:flex-wrap sm:items-center sm:justify-end`,children:(0,Q.jsx)(de,{loading:n.loading,onReloadClick:n.onReloadClick,searchQuery:n.searchQuery,setSearchQuery:n.setSearchQuery,mainTab:n.mainTab,sk:n.sk,setPendingFile:n.setPendingFile,setInstallOpen:n.setInstallOpen})}):null,t[54]=w,t[55]=n.loading,t[56]=n.mainTab,t[57]=n.onReloadClick,t[58]=n.searchQuery,t[59]=n.setInstallOpen,t[60]=n.setPendingFile,t[61]=n.setSearchQuery,t[62]=n.sk,t[63]=R):R=t[63];let z;t[64]!==l||t[65]!==A||t[66]!==u||t[67]!==r.skillsNavAria?(z=(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,Q.jsx)(H,{items:A,activeTab:l,onChange:u,ariaLabel:r.skillsNavAria,tabIdPrefix:`skills-tab`,panelIdPrefix:`skills-panel`,className:`flex-wrap`})}),t[64]=l,t[65]=A,t[66]=u,t[67]=r.skillsNavAria,t[68]=z):z=t[68];let B;t[69]!==g||t[70]!==_||t[71]!==l||t[72]!==x||t[73]!==y||t[74]!==C||t[75]!==E||t[76]!==j||t[77]!==T||t[78]!==v||t[79]!==S||t[80]!==b||t[81]!==D||t[82]!==f||t[83]!==r.discoverHeading||t[84]!==r.discoverHint||t[85]!==r.filterAll||t[86]!==r.filterDisabledOnly||t[87]!==r.filterEnabled||t[88]!==r.filterExtra||t[89]!==r.filterGlobal||t[90]!==r.filterInstalled||t[91]!==r.filterWorkspace||t[92]!==r.installedHeading||t[93]!==r.installedHint||t[94]!==r.marketplaceBrowseSwitchAria||t[95]!==r.marketplaceResultsTabsAria||t[96]!==r.marketplaceSortDownloads||t[97]!==r.marketplaceSortLabel||t[98]!==r.marketplaceSortNewest||t[99]!==r.sourceFilterAria||t[100]!==r.statusFilterAria||t[101]!==r.tabBuiltin||t[102]!==d?(B=l===`installed`?(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.installedHeading}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.installedHint})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[(0,Q.jsx)(c,{value:d,placeholder:r.filterAll,ariaLabel:r.sourceFilterAria,options:[{value:`all`,label:r.filterAll},{value:`builtin`,label:r.tabBuiltin},{value:`installed`,label:r.filterInstalled},{value:`workspace`,label:r.filterWorkspace},{value:`global`,label:r.filterGlobal},{value:`extra`,label:r.filterExtra}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>f(e)}),(0,Q.jsx)(c,{value:_,placeholder:r.filterAll,ariaLabel:r.statusFilterAria,options:[{value:`all`,label:r.filterAll},{value:`enabled`,label:r.filterEnabled},{value:`disabled`,label:Y(r.filterDisabledOnly,{count:g})}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>v(e)})]})]})}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(`h2`,{className:`text-balance text-sm font-semibold text-fg`,children:r.discoverHeading}),(0,Q.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:r.discoverHint})]}),(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-wrap gap-2 sm:justify-end`,children:[T?null:(0,Q.jsx)(c,{value:x??``,placeholder:r.marketplaceBrowseSwitchAria,ariaLabel:r.marketplaceBrowseSwitchAria,options:C.map(Be),allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:S}),(0,Q.jsx)(c,{value:y,placeholder:r.marketplaceSortLabel,ariaLabel:r.marketplaceSortLabel,options:[{value:`downloads`,label:r.marketplaceSortDownloads},{value:`newest`,label:r.marketplaceSortNewest}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>b(e)})]})]}),T?(0,Q.jsx)(H,{items:j,activeTab:E,onChange:D,ariaLabel:r.marketplaceResultsTabsAria,tabIdPrefix:`skills-marketplace-results-tab`,panelIdPrefix:`skills-marketplace-results-panel`,className:`min-h-9 gap-1 overflow-x-auto rounded-lg border border-edge bg-surface-panel p-0.5 shadow-surface`,buttonClassName:`rounded-md px-2.5 py-1.5 text-xs`,selectedClassName:`bg-fg text-surface-panel dark:bg-fg dark:text-surface-base`,unselectedClassName:`text-fg-muted hover:text-fg`}):null]}),t[69]=g,t[70]=_,t[71]=l,t[72]=x,t[73]=y,t[74]=C,t[75]=E,t[76]=j,t[77]=T,t[78]=v,t[79]=S,t[80]=b,t[81]=D,t[82]=f,t[83]=r.discoverHeading,t[84]=r.discoverHint,t[85]=r.filterAll,t[86]=r.filterDisabledOnly,t[87]=r.filterEnabled,t[88]=r.filterExtra,t[89]=r.filterGlobal,t[90]=r.filterInstalled,t[91]=r.filterWorkspace,t[92]=r.installedHeading,t[93]=r.installedHint,t[94]=r.marketplaceBrowseSwitchAria,t[95]=r.marketplaceResultsTabsAria,t[96]=r.marketplaceSortDownloads,t[97]=r.marketplaceSortLabel,t[98]=r.marketplaceSortNewest,t[99]=r.sourceFilterAria,t[100]=r.statusFilterAria,t[101]=r.tabBuiltin,t[102]=d,t[103]=B):B=t[103];let V;t[104]!==l||t[105]!==n?(V=l===`marketplace`?(0,Q.jsx)(Ne,{...n}):(0,Q.jsx)(xe,{...n}),t[104]=l,t[105]=n,t[106]=V):V=t[106];let U;t[107]!==V||t[108]!==z||t[109]!==B?(U=(0,Q.jsxs)(`section`,{className:`flex flex-col gap-5`,children:[z,B,V]}),t[107]=V,t[108]=z,t[109]=B,t[110]=U):U=t[110];let W;t[111]!==M||t[112]!==U||t[113]!==N||t[114]!==P||t[115]!==R?(W=(0,Q.jsxs)(`div`,{className:M,children:[N,P,R,U]}),t[111]=M,t[112]=U,t[113]=N,t[114]=P,t[115]=R,t[116]=W):W=t[116];let G,ee,K;t[117]===n?(G=t[118],ee=t[119],K=t[120]):(G=(0,Q.jsx)(Ae,{...n}),ee=(0,Q.jsx)(Me,{...n}),K=(0,Q.jsx)(Ce,{...n}),t[117]=n,t[118]=G,t[119]=ee,t[120]=K);let q;t[121]!==W||t[122]!==G||t[123]!==ee||t[124]!==K||t[125]!==F?(q=(0,Q.jsxs)(`div`,{className:F,children:[W,G,ee,K]}),t[121]=W,t[122]=G,t[123]=ee,t[124]=K,t[125]=F,t[126]=q):q=t[126];let J;return t[127]!==q||t[128]!==I?(J=(0,Q.jsxs)(Q.Fragment,{children:[I,q]}),t[127]=q,t[128]=I,t[129]=J):J=t[129],J}function Be(e){return{value:e.id,label:e.displayName}}function Ve(e,t){return(0,Q.jsxs)(`li`,{className:`truncate`,children:[e.type,`: `,e.message]},`${e.path??e.skillName??`diagnostic`}-${t}`)}function He(e){return e.id}function Ue(e){let t=(0,X.c)(17),{vm:n}=e,{sk:r,hasToken:i,loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,setPendingFile:u,setInstallOpen:d,inSettingsShell:f}=n,p=D(Ge),m=D(We),h;t[0]!==a||t[1]!==l||t[2]!==o||t[3]!==s||t[4]!==d||t[5]!==u||t[6]!==c||t[7]!==r?(h=(0,Q.jsx)(de,{loading:a,onReloadClick:o,searchQuery:s,setSearchQuery:c,mainTab:l,sk:r,setPendingFile:u,setInstallOpen:d}),t[0]=a,t[1]=l,t[2]=o,t[3]=s,t[4]=d,t[5]=u,t[6]=c,t[7]=r,t[8]=h):h=t[8];let g=h,_,v;return t[9]!==m||t[10]!==i||t[11]!==f||t[12]!==p||t[13]!==r.title||t[14]!==g?(_=()=>!i||f?(m(),()=>m()):(p({startExtra:null,main:(0,Q.jsx)(`div`,{className:`min-w-0`,children:(0,Q.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r.title})}),end:g}),()=>m()),v=[m,i,f,p,g,r.title],t[9]=m,t[10]=i,t[11]=f,t[12]=p,t[13]=r.title,t[14]=g,t[15]=_,t[16]=v):(_=t[15],v=t[16]),(0,Z.useLayoutEffect)(_,v),null}function We(e){return e.clearPageHeader}function Ge(e){return e.setPageHeader}async function Ke(t){let n=t.name.toLowerCase();if(n.endsWith(`.zip`))return t;if(n.endsWith(`skill.md`)){let n=(await i(async()=>{let{default:t}=await import(`./jszip.min-DT31yWkU.js`).then(t=>e(t.default,1));return{default:t}},__vite__mapDeps([0,1]))).default,r=new n;r.file(`SKILL.md`,await t.arrayBuffer());let a=await r.generateAsync({type:`blob`,compression:`DEFLATE`}),o=t.name.replace(/\.md$/i,``).replace(/\s+/g,`-`)||`skill`;return new File([a],`${o}.zip`,{type:`application/zip`})}throw Error(`invalid`)}function qe(){let e=v(e=>e.language),t=g(e).skills,n=!!_(e=>e.token),r=o(),[i,c]=s(),l=i.get(`mprov`)?.trim()||null,[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(null),[m,h]=(0,Z.useState)(!1),y=i.get(`q`)??``,b=i.get(`tab`),x=i.get(`source`),S=i.get(`status`),C=he.has(b)?b:`installed`,w=b===`builtin`?`builtin`:b===`user`?`installed`:null,E=ge.has(x)?x:w??`all`,D=_e.has(S)?S:`all`,[k,A]=(0,Z.useState)(y),[j]=I(k,250),N=j.trim(),P=k.trim().length>0,F=N.length>0,[L,R]=(0,Z.useState)(null),[z,B]=(0,Z.useState)(C),[V,H]=(0,Z.useState)(E),[ne,ae]=(0,Z.useState)(``),[Y,ce]=(0,Z.useState)(D),[le,X]=(0,Z.useState)(!1),[Q,de]=(0,Z.useState)(null),[fe,pe]=(0,Z.useState)(!1),[me,ye]=(0,Z.useState)(!1),[xe,Se]=(0,Z.useState)(null),[Ce,we]=(0,Z.useState)(null),[Te,Ee]=(0,Z.useState)({}),[De,Oe]=(0,Z.useState)(!1),[ke,Ae]=(0,Z.useState)(`catalog`),[je,Me]=(0,Z.useState)(``),[Ne,Pe]=(0,Z.useState)(null),[Fe,Ie]=(0,Z.useState)(null),[Le,Re]=(0,Z.useState)(!1),[ze,Be]=(0,Z.useState)(null),[Ve,He]=(0,Z.useState)(`downloads`),[Ue,We]=(0,Z.useState)(1),[Ge,qe]=(0,Z.useState)(null),[Je,Ye]=(0,Z.useState)(null),[Xe,Ze]=(0,Z.useState)(``),[$,Qe]=(0,Z.useState)(()=>l),[$e,et]=(0,Z.useState)(0),[tt,nt]=(0,Z.useState)(0),[rt,it]=(0,Z.useState)([]),at=(0,Z.useRef)(null),ot=(0,Z.useRef)(l),st=(0,Z.useRef)(null),ct=(0,Z.useRef)(``),lt=(0,Z.useRef)(null),ut=(0,Z.useRef)(!1),[dt,ft]=(0,Z.useState)({query:``,byProvider:{}}),[pt,mt]=(0,Z.useState)(`all`),ht=(0,Z.useRef)(0),gt=(0,Z.useRef)(N);gt.current!==N&&(gt.current=N,mt(e=>e===`all`?e:`all`));let _t=M(()=>O().then(e=>(it(e.diagnostics??[]),e.catalog.map(oe))),[n,tt],{enabled:n,initial:[],errorData:[]}),{data:vt,loading:yt,setData:bt}=_t,xt=M(async()=>{try{let{providers:e,current:t}=await q();return{providers:e.map(e=>({id:e.id,displayName:e.displayName})),current:t}}catch{try{return{providers:[],current:(await K()).provider}}catch{return{providers:[],current:`store`}}}},[n,$e],{enabled:n,initial:{providers:[],current:null}}),St=u||yt,Ct=xt.data.providers;(0,Z.useEffect)(()=>{let e=e=>{if(T(e.detail)===`skills`){if(ut.current){ut.current=!1;return}nt(e=>e+1)}else et(e=>e+1)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[]);let wt=i.toString(),Tt=(0,Z.useRef)(wt);if(Tt.current!==wt){Tt.current=wt;let e=i.get(`q`)??``,t=i.get(`tab`),n=i.get(`source`),r=i.get(`status`),a=he.has(t)?t:`installed`,o=t===`builtin`?`builtin`:t===`user`?`installed`:null,s=ge.has(n)?n:o??`all`,c=_e.has(r)?r:`all`;A(t=>t===e?t:e),B(e=>e===a?e:a),H(e=>e===s?e:s),ce(e=>e===c?e:c);let l=i.get(`mcat`)??``;Ze(a===`marketplace`?e=>e===l?e:l:``)}let Et=(0,Z.useRef)(n);!n&&Et.current&&(Qe(null),at.current=null),Et.current=n,n&&l&&ot.current!==l&&(ot.current=l,Qe(l)),n&&l==null&&xt.data.current&&xt.data.current!==st.current&&(st.current=xt.data.current,Qe(e=>e??xt.data.current));let Dt=`${N}|${Ve}|${z}|${Xe}|${$??``}|${pt}`;ct.current!==Dt&&(ct.current=Dt,We(1)),z===`marketplace`&&$&&lt.current!=null&&lt.current!==$&&Ze(``),lt.current=$;let Ot=M(()=>se({page:Ue,pageSize:20,sort:Ve,category:Xe.trim()||void 0,provider:$}),[n,z,Xe,Ue,Ve,F,$],{enabled:n&&z===`marketplace`&&!!$&&!F,initial:null,errorData:null});(0,Z.useEffect)(()=>{if(!n||!F||z!==`marketplace`||Ct.length===0)return;let e=++ht.current,r={};for(let e of Ct)r[e.id]={status:`loading`,rows:[]};ft({query:N,byProvider:r});let i=[],a=[];for(let n of Ct){let r=new AbortController;i.push(r);let o=window.setTimeout(()=>{r.abort(new DOMException(`Adapter timed out`,`TimeoutError`))},8e3);a.push(o),se({provider:n.id,q:N,page:1,pageSize:40,sort:Ve,signal:r.signal}).then(t=>{if(window.clearTimeout(o),e!==ht.current)return;let r=t.items.map(e=>({...e,providerId:n.id}));ft(e=>({...e,byProvider:{...e.byProvider,[n.id]:{status:`ok`,rows:r}}}))}).catch(r=>{if(window.clearTimeout(o),e!==ht.current)return;let i=r instanceof DOMException&&(r.name===`TimeoutError`||r.name===`AbortError`)?t.marketplaceLoadFailed:r instanceof Error?r.message:t.marketplaceLoadFailed;ft(e=>({...e,byProvider:{...e.byProvider,[n.id]:{status:`error`,rows:[],error:i}}}))})}return()=>{for(let e of a)window.clearTimeout(e);for(let e of i)e.abort()}},[n,z,F,N,Ct,Ve,t.marketplaceLoadFailed]);let kt=M(()=>re({provider:$,locale:e}).then(e=>e.items),[n,z,$,e],{enabled:n&&z===`marketplace`&&!!$,initial:[],errorData:[]}),At=(0,Z.useMemo)(()=>{if(!F||dt.query!==N)return[];let e=Ct.map(e=>({id:e.id,rows:[...dt.byProvider[e.id]?.rows??[]]})),t=[];for(;e.some(e=>e.rows.length>0);)for(let n of e)n.rows.length>0&&t.push(n.rows.shift());let n=new Map;for(let e of t){let t=[(e.id??``).toLowerCase().trim(),(e.name??``).toLowerCase().trim(),(e.author?.username??``).toLowerCase().trim()].join(`|`),r=n.get(t);if(!r){n.set(t,{...e,additionalSources:[]});continue}if(e.providerId&&e.providerId!==r.providerId){let t=r.additionalSources??[];t.some(t=>t.providerId===e.providerId)||(t.push({providerId:e.providerId,sourceLabel:e.sourceLabel}),r.additionalSources=t)}}return Array.from(n.values())},[F,N,dt,Ct]),jt=(0,Z.useMemo)(()=>{if(!F)return{};let e={all:At.length};for(let t of Ct)e[t.id]=At.filter(e=>e.providerId===t.id||(e.additionalSources??[]).some(e=>e.providerId===t.id)).length;return e},[F,At,Ct]),Mt=(0,Z.useMemo)(()=>F?pt===`all`?At:At.filter(e=>e.providerId===pt||(e.additionalSources??[]).some(e=>e.providerId===pt)):[],[F,At,pt]),Nt=(0,Z.useMemo)(()=>{if(!F)return{};let e={};for(let t of Ct)e[t.id]=dt.byProvider[t.id]?.status??`loading`;return e},[F,dt,Ct]),Pt=(0,Z.useMemo)(()=>Object.values(Nt).some(e=>e===`loading`),[Nt]),Ft=(0,Z.useMemo)(()=>{if(!F)return!1;let e=Object.values(Nt);return e.length>0&&e.every(e=>e===`error`)},[F,Nt]),It=(0,Z.useMemo)(()=>{if(!F||At.length===0&&Pt)return null;let e=Mt.length,t=(Ue-1)*20;return{items:Mt.slice(t,t+20),meta:{page:Ue,pageSize:20,total:e,totalPages:Math.max(1,Math.ceil(e/20))},provider:pt}},[F,At,Pt,Mt,Ue,pt]),Lt=z===`marketplace`?P?F?It:null:Ot.data:null,Rt=z===`marketplace`?P?F?Pt:!0:Ot.loading:!1,zt=F?Ft?t.marketplaceLoadFailed:null:Ot.error instanceof Error?Ot.error.message:Ot.error?t.marketplaceLoadFailed:null,Bt=z===`marketplace`?kt.data:[],Vt=z===`marketplace`?kt.loading:!1,Ht=kt.error instanceof Error?kt.error.message:kt.error?t.marketplaceCategoriesFailed:null;Xe.trim()&&Bt.length>0&&!Bt.some(e=>e.id===Xe)&&Ze(``);let Ut=(0,Z.useCallback)(async e=>{let n=e?.silent===!0;n||d(!0),p(null);try{let e=await O();return it(e.diagnostics??[]),bt(e.catalog.map(oe)),{ok:!0}}catch(e){let n=e instanceof Error?e.message:t.loadFailed;return p(n),{ok:!1,message:n}}finally{n||d(!1)}},[bt,t.loadFailed]),Wt=!u&&_t.error?_t.error instanceof Error?_t.error.message:t.loadFailed:null,Gt=f??Wt;(0,Z.useEffect)(()=>{c(e=>{let t=new URLSearchParams(e);return N?t.set(`q`,N):t.delete(`q`),z===`marketplace`?t.set(`tab`,z):t.delete(`tab`),V===`all`?t.delete(`source`):t.set(`source`,V),z===`installed`&&Y!==`all`?t.set(`status`,Y):t.delete(`status`),z===`marketplace`&&Xe.trim()?t.set(`mcat`,Xe.trim()):t.delete(`mcat`),z===`marketplace`&&$?t.set(ve,$):t.delete(ve),t.toString()===e.toString()?e:t},{replace:!0})},[z,Xe,$,N,Y,c,V]);let Kt=(0,Z.useCallback)((e,t,n=5e3)=>{R({kind:e,message:t}),window.setTimeout(()=>R(null),n)},[]),qt=(0,Z.useCallback)(e=>{let n=e.availability;if(!n)return t.installSuccess;let r=n.skillName||n.skillId;if(!n.loaded)return`Skill "${r}" installed, but it was not loaded. Check skill diagnostics.`;if(n.diagnostics.length>0)return`Skill "${r}" installed with ${n.diagnostics.length} diagnostic(s).`;if(n.enabled===!1)return`Skill "${r}" installed but disabled. Enable it before use.`;if(n.availableForDefaultAgent===!1){let e=n.unavailableReason||`unavailable`;return`Skill "${r}" installed but unavailable for agent "${n.defaultAgentId}" (${e}).`}return`Skill "${r}" installed and ready.`},[t.installSuccess]),Jt=(0,Z.useCallback)(async e=>{Ae(`catalog`),Oe(!0),Me(e.name),Pe(null),Ie(null),Be(null),Re(!0);try{let t=await ie(e.name);Pe(t),Me(t.name)}catch(e){Pe(null),Be(e instanceof Error?e.message:t.detailLoadFailed)}finally{Re(!1)}},[t.detailLoadFailed]),Yt=(0,Z.useCallback)(async e=>{let n=e.trim();if(n){Ae(`catalog`),Oe(!0),Me(n),Pe(null),Ie(null),Be(null),Re(!0);try{let e=await ie(n);Pe(e),Me(e.name)}catch(e){Pe(null),Be(e instanceof Error?e.message:t.detailLoadFailed)}finally{Re(!1)}}},[t.detailLoadFailed]),Xt=(0,Z.useCallback)(async(e,n,r)=>{let i=r?.trim()||$;if(i){at.current=i,Ae(`store`),Oe(!0),Me(n?.trim()||e),Pe(null),Ie(null),Be(null),Re(!0);try{let t=await ue(e,{provider:i});Me(t.name),Ie(t.skillDocPreview)}catch(e){Ie(null),Be(e instanceof Error?e.message:t.detailLoadFailed)}finally{Re(!1)}}},[$,t.detailLoadFailed]),Zt=(0,Z.useCallback)(async(e,n)=>{we(e),Ee(t=>({...t,[e]:n})),R(null);try{return await J(e,n),await Ut({silent:!0}),!0}catch(n){return Ee(t=>{let{[e]:n,...r}=t;return r}),Kt(`error`,n instanceof Error?n.message:t.skillToggleFailed),!1}finally{we(null),Ee(t=>{let{[e]:n,...r}=t;return r})}},[Ut,Kt,t.skillToggleFailed]),Qt=(0,Z.useCallback)(async()=>{R(null),d(!0),p(null);try{await U()}catch(e){p(e instanceof Error?e.message:t.reloadFailed),d(!1);return}await Ut()},[Ut,t.reloadFailed]),$t=(0,Z.useMemo)(()=>{let e=k.trim().toLowerCase();return e?vt.filter(t=>[t.name,t.description,t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):vt},[vt,k]),en=(0,Z.useMemo)(()=>{let e=vt.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>Te[e.name]??e.enabled).length}},[vt,Te]),tn=(0,Z.useMemo)(()=>{let e=vt.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>Te[e.name]??e.enabled).length}},[vt,Te]),nn=(0,Z.useMemo)(()=>je?vt.find(e=>e.name===je):void 0,[vt,je]),rn=nn==null?!0:Te[je]??nn.enabled,an=nn?.directoryId??null,on=nn?.managed??!1,sn=(0,Z.useMemo)(()=>ke!==`store`||!je?null:G(at.current??$,je),[ke,je,$]),cn=(0,Z.useMemo)(()=>{let e=$t;return z===`installed`&&V!==`all`&&(e=V===`installed`?e.filter(e=>e.source!==`builtin`):e.filter(e=>e.source===V)),e},[$t,z,V]),ln=(0,Z.useMemo)(()=>{let e=new Set,t=[];for(let n of cn){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=be.indexOf(e),r=be.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[cn]),un=(0,Z.useCallback)(e=>t.categoryLabel?.[e]||e,[t.categoryLabel]),dn=(0,Z.useMemo)(()=>ne?cn.filter(e=>e.category===ne):cn,[cn,ne]);(0,Z.useEffect)(()=>{ae(``)},[V]);let fn=(0,Z.useCallback)(e=>Te[e.name]??e.enabled,[Te]),pn=(0,Z.useMemo)(()=>dn.filter(e=>!fn(e)).length,[dn,fn]),mn=(0,Z.useMemo)(()=>{let e=dn;return Y===`disabled`&&(e=e.filter(e=>!fn(e))),Y===`enabled`&&(e=e.filter(e=>fn(e))),[...e].toSorted((e,t)=>{let n=fn(e);return n===fn(t)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})},[dn,Y,fn]),hn=async e=>{R(null),h(!0),p(null);try{let n;try{n=await Ke(e)}catch{p(t.invalidFile),Kt(`error`,t.invalidFile);return}let r=await W(n,{overwrite:!0});ut.current=!0,await Ut(),Kt(`success`,qt(r)),X(!1),de(null),B(`installed`),H(`installed`),await Yt(r.availability?.skillName||r.skillId)}catch(e){p(e instanceof Error?e.message:t.uploadFailed),Kt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{h(!1)}},gn=()=>{Q&&hn(Q)},_n=e=>{let t=e.target.files?.[0];e.target.value=``,t&&de(t)},vn=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(pe(!0),e.dataTransfer.dropEffect=`copy`)},yn=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||pe(!1)},bn=e=>{e.preventDefault(),e.stopPropagation(),pe(!1);let t=e.dataTransfer?.files?.[0];t&&de(t)},xn=e=>{if(e.origin===`agents-global`)return t.source.agentsGlobal;if(e.origin===`agents-workspace`)return t.source.agentsWorkspace;switch(e.source){case`builtin`:return t.source.builtin;case`workspace`:return t.source.workspace;case`global`:return t.source.global;case`extra`:return t.source.extra;default:return e.source}},Sn=async()=>{let e=xe,n=De&&ke===`catalog`&&an===e;if(ye(!1),Se(null),e){R(null);try{await ee(e),ut.current=!0,await Ut(),n&&(Oe(!1),Ae(`catalog`),Me(``),Pe(null),Ie(null),Be(null))}catch(e){p(e instanceof Error?e.message:t.deleteFailed)}}},Cn=(0,Z.useCallback)(e=>vt.some(t=>t.name===e),[vt]),wn=(0,Z.useCallback)(async e=>{let n=(e?.name??je).trim();if(!n)return;let i=e?.source??ke;if(i===`catalog`){let e=vt.find(e=>e.name===n);if(e&&!(Te[e.name]??e.enabled))return}R(null);let a=i===`store`&&!Cn(n);Ye(n);try{if(a){let t=e?.providerOverride?.trim()||at.current||$;await te({name:n,overwrite:!1,...t?{provider:t}:{}}),ut.current=!0,await Ut({silent:!0})}Oe(!1),r(`/chat/new?skill=${encodeURIComponent(n)}`)}catch(e){Kt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{Ye(null)}},[vt,je,ke,Te,Cn,Ut,r,Kt,t.uploadFailed,$]),Tn=(0,Z.useCallback)(async(e,n)=>{let r=Cn(e);if(!(r&&!window.confirm(t.marketplaceReinstallConfirm))){R(null),qe(e);try{let t=n?.providerOverride?.trim()||(n?.useDetailProvider?at.current??$:$),i=await te({name:e,overwrite:r,...t?{provider:t}:{}});ut.current=!0,await Ut({silent:!0}),Kt(`success`,qt(i)),B(`installed`),H(`installed`),await Yt(i.availability?.skillName||i.skillId||e)}catch(e){Kt(`error`,e instanceof Error?e.message:t.uploadFailed)}finally{qe(null)}}},[Cn,qt,Ut,$,Yt,Kt,t.marketplaceReinstallConfirm,t.uploadFailed]),{pathname:En}=a();return{sk:t,hasToken:n,catalog:vt,loading:St,error:Gt,uploading:m,searchQuery:k,setSearchQuery:A,actionFeedback:L,skillDiagnostics:rt,mainTab:z,setMainTab:B,sourceFilter:V,setSourceFilter:H,builtinCategoryFilter:ne,setBuiltinCategoryFilter:ae,installOpen:le,setInstallOpen:X,pendingFile:Q,setPendingFile:de,dropActive:fe,setDropActive:pe,confirmOpen:me,setConfirmOpen:ye,confirmId:xe,setConfirmId:Se,togglingSkillName:Ce,enabledOverride:Te,detailOpen:De,setDetailOpen:Oe,detailSource:ke,setDetailSource:Ae,detailTitle:je,setDetailTitle:Me,detailCatalogPreview:Ne,setDetailCatalogPreview:Pe,detailMarketplacePreview:Fe,setDetailMarketplacePreview:Ie,detailLoading:Le,detailError:ze,setDetailError:Be,marketSort:Ve,setMarketSort:He,marketPage:Ue,setMarketPage:We,mpLoading:Rt,mpError:zt,mpPayload:Lt,searchActive:F,searchInputActive:P,resultTab:pt,setResultTab:mt,aggregatedTabCounts:jt,aggregatedProviderStatus:Nt,aggregatedAllFailed:Ft,installingMarketName:Ge,usingSkillInChatName:Je,onUseSkillInChat:wn,marketCategoryId:Xe,setMarketCategoryId:Ze,mpCategories:Bt,mpCategoriesError:Ht,mpCategoriesLoading:Vt,marketBrowseProvider:$,setMarketBrowseProvider:Qe,registeredProviders:Ct,builtinTabStats:en,userTabStats:tn,detailEnabled:rn,detailDirectoryId:an,detailManaged:on,detailExternalUrl:sn,filteredCatalog:cn,builtinCategories:ln,categoryFilteredCatalog:dn,catalogDisplayRows:mn,catalogDisabledCount:pn,catalogStatusFilter:Y,setCatalogStatusFilter:ce,resolveSkillEnabled:fn,inSettingsShell:En.startsWith(`/settings/`),categoryLabel:un,onReloadClick:Qt,openSkillDetail:Jt,openMarketplaceDetail:Xt,onSkillToggle:Zt,onInstallSubmit:gn,onFileInputChange:_n,onModalDragOver:vn,onModalDragLeave:yn,onModalDrop:bn,sourceLabel:xn,runDelete:Sn,onMarketInstall:Tn,isSkillInstalledByName:Cn}}function Je(){let e=(0,X.c)(2),t=qe(),n;return e[0]===t?n=e[1]:(n=(0,Q.jsx)(ze,{vm:t}),e[0]=t,e[1]=n),n}export{Je as SkillsPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./external-link-DjqjBmc3.js";import{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-CbbZKEfO.js";import{n as o}from"./locale-store-BIOMAhmR.js";import{Xr as s,_o as c,cn as l,gl as u,ln as d,ms as f,ns as p,on as m,ro as h,sn as g}from"./index-BIBAmAjw.js";import{n as _,r as v}from"./settings-page-layout-BRQNel6r.js";import{r as y,t as b}from"./settings-form-section-DdrNtxul.js";var x=e(t(),1);async function S(e,t){let n=window.electronAPI?.system;if(!h()||!n?.requestNotifications)return`unsupported`;let r=await n.requestNotifications();if(r.status!==`granted`)return r.task===`opened-settings`||r.status===`denied`?`denied`:`default`;await n.setBehavior({notifyEnabled:!0});let i=await n.showEndpointNotification({title:e,body:t});return i.ok||await n.setBehavior({notifyEnabled:!1}),i.ok?`enabled`:`default`}var C=n();function w(){let e=a(o(e=>e.language)).systemSettings.browserNotify,[t,n]=(0,x.useState)(l),[r,i]=(0,x.useState)(null),[s,c]=(0,x.useState)(!1),f=async t=>{if(!t){n(d({enabled:!1})),i(null);return}c(!0);try{let t=await m();if(t!==`granted`){i(t===`unsupported`?e.unsupported:e.denied);return}n(d({enabled:!0})),i(await g(e.testTitle,e.testBody)?e.testShown:e.failed)}finally{c(!1)}},p=e=>{n(d(e))};return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:e.pageTitle}),(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(u,{className:`size-4 text-accent`,strokeWidth:1.75}),e.title]}),(0,C.jsx)(`p`,{className:`mb-4 text-sm text-fg-muted`,children:e.description}),(0,C.jsx)(`div`,{className:`space-y-2`,children:[[`enabled`,e.enabled,e.enabledDesc],[`completed`,e.completed,e.completedDesc],[`failed`,e.failedRuns,e.failedRunsDesc]].map(([e,n,r])=>(0,C.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:[(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:n}),(0,C.jsx)(`span`,{className:`block text-xs text-fg-muted`,children:r})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:s||e!==`enabled`&&!t.enabled,checked:t[e],onChange:t=>{e===`enabled`?f(t.target.checked):p({[e]:t.target.checked})}})]},e))}),r?(0,C.jsx)(`p`,{className:`mt-3 text-sm text-fg-muted`,role:`status`,children:r}):null,(0,C.jsx)(`p`,{className:`mt-4 text-xs text-fg-muted`,children:e.limitation})]})]})}async function T(){if(typeof navigator>`u`||!navigator.mediaDevices?.getUserMedia)return!1;try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop();return!0}catch{return!1}}function E(e,t,n){return e.task===`opened-settings`?n.openedSettings:e.status===`granted`&&t?e.task===`already-granted`?n.alreadyGranted:n.granted:t?e.status===`denied`?n.denied:n.prompted:n.rendererDenied}function D(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:t.denied}function O(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}function k(e,t){return e.task===`opened-settings`?t.openedSettings:e.status===`granted`?e.task===`already-granted`?t.alreadyGranted:t.granted:e.status===`denied`?t.denied:t.prompted}var A=new Set([`microphone`,`accessibility`,`notifications`,`screen`]);function j(e,t,n){return t===`granted`?!1:e===`accessibility`&&(n===`darwin`||n===`win32`||n===`linux`)||e===`screen`&&(n===`darwin`||n===`win32`)||A.has(e)?t===`unknown`:!1}function M(e,t,n){return e===`accessibility`?!1:e===`screen`&&n===`linux`?!0:A.has(e)?t===`denied`:!0}var N=[{key:`fullDisk`,pane:`fullDisk`,platforms:[`darwin`]},{key:`screen`,pane:`screen`},{key:`microphone`,pane:`microphone`},{key:`accessibility`,pane:`accessibility`},{key:`automation`,pane:`automation`},{key:`notifications`,pane:`notifications`},{key:`location`,pane:`location`}];function P(e){return e===`linux`?N:N.filter(t=>!t.platforms||t.platforms.includes(e))}function F(e,t){let n=a(e).systemSettings.status;return t===`granted`?{label:n.granted,className:`text-emerald-600 dark:text-emerald-400`}:t===`denied`?{label:n.denied,className:`text-amber-600 dark:text-amber-400`}:{label:n.unknown,className:`text-fg-muted`}}function I(e,t,n){let r=a(e).systemSettings.permUnknown?.[t];return r?n===`darwin`&&r.darwin?r.darwin:n===`win32`&&r.win32?r.win32:n===`linux`&&r.linux?r.linux:null:null}var L={behavior:null,perms:null,loadError:null,permFeedback:null,permBusy:!1,refreshing:!1};function R(){let e=o(e=>e.language),t=a(e).systemSettings,[n,l]=(0,x.useReducer)(s,L),{behavior:u,perms:d,loadError:m,permFeedback:g,permBusy:A,refreshing:N}=n,R=typeof window<`u`?window.electronAPI?.system:void 0,z=(0,x.useCallback)(async e=>{if(R){l({type:`patch`,patch:{loadError:null}});try{l({type:`patch`,patch:{behavior:await R.getBehavior(),perms:await R.getPermissions({probe:e?.showRefreshFeedback}),...e?.showRefreshFeedback?{permFeedback:t.refreshDone}:{}}})}catch(t){l({type:`patch`,patch:{loadError:t instanceof Error?t.message:String(t),...e?.showRefreshFeedback?{permFeedback:null}:{}}})}}},[R,t.refreshDone]),B=(0,x.useCallback)(async()=>{if(!(N||A)){l({type:`patch`,patch:{refreshing:!0}});try{await z({showRefreshFeedback:!0})}finally{l({type:`patch`,patch:{refreshing:!1}})}}},[z,A,N]);if((0,x.useEffect)(()=>{let e=new Set([t.refreshDone,t.openSettingsDone,t.openSettingsFailed,t.desktopNotify.testShown]);if(!g||!e.has(g))return;let n=window.setTimeout(()=>{l({type:`patch`,patch:{permFeedback:null}})},3e3);return()=>window.clearTimeout(n)},[g,t.openSettingsDone,t.openSettingsFailed,t.refreshDone,t.desktopNotify.testShown]),(0,x.useEffect)(()=>{h()&&R&&z()},[R,z]),!h()||!R)return(0,C.jsx)(w,{});let V=async e=>{try{let{behavior:t}=await R.setBehavior(e);l({type:`patch`,patch:{behavior:t}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},H=async e=>{if(!e){await V({notifyEnabled:!1});return}l({type:`patch`,patch:{permBusy:!0,permFeedback:null}});try{let e=await S(t.desktopNotify.testTitle,t.desktopNotify.testBody);if(e===`unsupported`){l({type:`patch`,patch:{permFeedback:t.notificationsFeedback.unsupported}});return}if(e===`denied`){l({type:`patch`,patch:{permFeedback:t.desktopNotify.denied}});return}if(e==="default"){l({type:`patch`,patch:{permFeedback:t.notificationsFeedback.default}});return}await V({notifyEnabled:!0}),l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:t.desktopNotify.testShown}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},U=async e=>{l({type:`patch`,patch:{permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{(await R.openPrivacy(e)).ok?l({type:`patch`,patch:{permFeedback:t.openSettingsDone}}):l({type:`patch`,patch:{permFeedback:t.openSettingsFailed}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}},W=async()=>{l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestMicrophone(),n=await T();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:E(e,n,t.permFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}},G=async()=>{if(R.requestAccessibility){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestAccessibility();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:D(e,t.accessibilityFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},K=async()=>{if(R.requestNotifications){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestNotifications();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:O(e,t.notificationsFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},q=async()=>{if(R.requestScreen){l({type:`patch`,patch:{permBusy:!0,permFeedback:null}}),l({type:`patch`,patch:{loadError:null}});try{let e=await R.requestScreen();l({type:`patch`,patch:{perms:await R.getPermissions()}}),l({type:`patch`,patch:{permFeedback:k(e,t.screenFeedback)}})}catch(e){l({type:`patch`,patch:{loadError:e instanceof Error?e.message:String(e)}})}finally{l({type:`patch`,patch:{permBusy:!1}})}}},J=u?u.platform===`win32`?t.permissionsHintWin:u.platform===`linux`?t.permissionsHintLinux:u.platform===`darwin`?t.permissionsHintDarwin:t.permissionsHint:t.permissionsHint;return(0,C.jsxs)(v,{gap:`gap-6`,children:[(0,C.jsx)(_,{title:t.title}),m?(0,C.jsx)(`p`,{className:`text-sm text-amber-600 dark:text-amber-400`,role:`alert`,children:m}):null,g?(0,C.jsx)(`p`,{className:i(`text-sm`,g===t.refreshDone||g===t.openSettingsDone||g===t.permFeedback.granted||g===t.permFeedback.alreadyGranted||g===t.accessibilityFeedback.granted||g===t.accessibilityFeedback.alreadyGranted||g===t.notificationsFeedback.granted||g===t.notificationsFeedback.alreadyGranted||g===t.screenFeedback.granted||g===t.screenFeedback.alreadyGranted||g===t.desktopNotify.testShown?`text-emerald-600 dark:text-emerald-400`:`text-fg-muted`),role:`status`,"aria-live":`polite`,children:g}):null,(0,C.jsxs)(b,{children:[(0,C.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,C.jsx)(p,{className:`size-4 text-accent`,strokeWidth:1.75}),t.behaviorGroup]}),(0,C.jsxs)(`div`,{className:`space-y-2`,children:[(0,C.jsxs)(`div`,{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:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.openAtLogin}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.openAtLoginDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.openAtLogin,onChange:e=>{V({openAtLogin:e.target.checked})}})]}),(0,C.jsxs)(`div`,{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:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.keepAwake}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.keepAwakeDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.keepAwakePreferred,onChange:e=>{V({keepAwakePreferred:e.target.checked})}})]}),(0,C.jsxs)(`div`,{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:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifyDesktop}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifyDesktopDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u||A,checked:!!u?.notifyEnabled,onChange:e=>{H(e.target.checked)}})]}),(0,C.jsxs)(`div`,{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:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:t.toggles.notifySound}),(0,C.jsx)(`p`,{className:`text-xs text-fg-muted`,children:t.toggles.notifySoundDesc})]}),(0,C.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,disabled:!u,checked:!!u?.notifySoundEnabled,onChange:e=>{V({notifySoundEnabled:e.target.checked})}})]})]})]}),u&&d?(0,C.jsxs)(`section`,{className:y(),children:[(0,C.jsxs)(`div`,{className:`mb-4 flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.permissionsTitle}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:J}),u.platform===`darwin`&&!u.packaged?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-amber-600 dark:text-amber-400`,children:t.permissionsHintDevDarwin}):null]}),(0,C.jsxs)(`button`,{type:`button`,disabled:N||A,"aria-busy":N,className:i(`mt-2 inline-flex max-w-full items-center justify-center gap-1.5 rounded-lg border border-edge bg-surface-panel px-3 py-1.5 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:opacity-50 sm:mt-0`,c.press),onClick:()=>void B(),children:[(0,C.jsx)(f,{className:i(`size-3.5`,N&&`animate-spin`),strokeWidth:1.75,"aria-hidden":!0}),N?t.refreshing:t.refresh]})]}),(0,C.jsx)(`ul`,{className:`space-y-3`,children:P(u.platform).map(({key:n,pane:a})=>{let o=F(e,d[n]),s=t.perm[n],l=d[n]===`unknown`?I(e,n,u.platform):null;return s?(0,C.jsxs)(`li`,{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,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:s.title}),(0,C.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:s.desc}),(0,C.jsx)(`p`,{className:`mt-1 text-xs font-medium ${o.className}`,children:o.label}),l?(0,C.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:l}):null]}),(0,C.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[n===`notifications`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void K(),children:t.requestAccess}):null,n===`microphone`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void W(),children:t.requestAccess}):null,n===`accessibility`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void G(),children:t.requestAccess}):null,n===`screen`&&j(n,d[n],u.platform)?(0,C.jsx)(`button`,{type:`button`,disabled:A,className:i(`inline-flex items-center gap-1 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover disabled:opacity-50`,c.press),onClick:()=>void q(),children:t.requestAccess}):null,M(n,d[n],u.platform)?(0,C.jsxs)(`button`,{type:`button`,className:i(`inline-flex items-center gap-1.5 rounded-lg border border-edge bg-surface-base px-2.5 py-1.5 text-xs font-medium text-fg hover:bg-surface-hover`,c.press),onClick:()=>void U(a),children:[t.openSettings,(0,C.jsx)(r,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0})]}):null]})]},n):null})})]}):null]})}export{R as SystemSettingsPanel};
@@ -1 +0,0 @@
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,p as a,t as o}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as s,r as c}from"./popover-select-BzdnTy3h.js";import{t as l}from"./external-link-DjqjBmc3.js";import{f as u,t as d,u as f}from"./markdown-view-BMDQYc6E.js";import{t as p}from"./x-B_N4OPjy.js";import{t as m}from"./cn-JdwAhgNB.js";import{t as h}from"./button-CSEbl4zT.js";import{l as g,n as _}from"./locale-store-BIOMAhmR.js";import{i as v,n as ee,o as te,r as ne,s as re,t as y}from"./dist-BPoKqzeH.js";import{$c as ie,$r as ae,Ca as b,Gc as x,H as S,I as oe,J as C,Ji as w,K as se,Kc as T,Os as ce,P as le,Rs as E,Sl as ue,Ss as D,X as O,Z as de,bc as fe,ca as k,ei as A,in as pe,ir as j,jc as me,la as M,n as N,nn as he,nr as ge,nt as _e,or as P,rn as F,rr as I,sr as ve,tr as L,xc as ye,zr as be}from"./index-BIBAmAjw.js";import{t as xe}from"./date-picker-3cIzKCZU.js";import{t as R}from"./dependency-picker-VZFStrz_.js";var z=e(t(),1),B=n();function Se(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Ce(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}var V=r();function we(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已完成`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Completed`})[e]}function Te(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,V.jsx)(M,{className:`h-32 rounded-2xl`}),(0,V.jsx)(M,{className:`h-52 rounded-2xl`}),(0,V.jsx)(M,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Ee(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function De(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Oe=[`backlog`,`ready`,`active`,`review`,`closed`],ke=[`low`,`normal`,`high`,`critical`],Ae=(0,z.memo)(function(e){let t=(0,B.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:l,label:u,onChange:d}=e,f;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(f=e=>e!==n&&(e===`closed`?!a:n===`closed`?!o:!i),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=f):f=t[4];let p=f,m;t[5]===u?m=t[6]:(m=(0,V.jsx)(`span`,{children:u}),t[5]=u,t[6]=m);let h;t[7]===d?h=t[8]:(h=e=>d(e.target.value),t[7]=d,t[8]=h);let g;t[9]!==l||t[10]!==p?(g=Oe.map(e=>(0,V.jsx)(c,{value:e,disabled:p(e),children:we(e,l)},e)),t[9]=l,t[10]=p,t[11]=g):g=t[11];let _;t[12]!==r||t[13]!==h||t[14]!==g||t[15]!==n?(_=(0,V.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:h,children:g}),t[12]=r,t[13]=h,t[14]=g,t[15]=n,t[16]=_):_=t[16];let v;return t[17]!==m||t[18]!==_?(v=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[m,_]}),t[17]=m,t[18]=_,t[19]=v):v=t[19],v}),je=(0,z.memo)(function(e){let t=(0,B.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,l;t[0]===i?l=t[1]:(l=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=l);let u;t[2]===o?u=t[3]:(u=e=>o(e.target.value),t[2]=o,t[3]=u);let d;t[4]===a?d=t[5]:(d=ke.map(e=>(0,V.jsx)(c,{value:e,children:a[e]},e)),t[4]=a,t[5]=d);let f;t[6]!==r||t[7]!==u||t[8]!==d||t[9]!==n?(f=(0,V.jsx)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:u,children:d}),t[6]=r,t[7]=u,t[8]=d,t[9]=n,t[10]=f):f=t[10];let p;return t[11]!==l||t[12]!==f?(p=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[l,f]}),t[11]=l,t[12]=f,t[13]=p):p=t[13],p}),Me=(0,z.memo)(function(e){let t=(0,B.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,V.jsx)(xe,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Ne=(0,z.memo)(function(e){let t=(0,B.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:l}=e,u;t[0]===i?u=t[1]:(u=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=u);let d;t[2]===l?d=t[3]:(d=e=>l(e.target.value),t[2]=l,t[3]=d);let f;t[4]===a?f=t[5]:(f=(0,V.jsx)(c,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=f);let p;t[6]===o?p=t[7]:(p=o.map(Ye),t[6]=o,t[7]=p);let m;t[8]!==r||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==n?(m=(0,V.jsxs)(s,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:d,children:[f,p]}),t[8]=r,t[9]=d,t[10]=f,t[11]=p,t[12]=n,t[13]=m):m=t[13];let h;return t[14]!==u||t[15]!==m?(h=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[u,m]}),t[14]=u,t[15]=m,t[16]=h):h=t[16],h}),Pe=(0,z.memo)(function(e){let t=(0,B.c)(8),{candidates:n,selected:r,disabled:i,labels:a,onChange:o}=e,s;t[0]===r?s=t[1]:(s=r.map(Xe),t[0]=r,t[1]=s);let c;return t[2]!==n||t[3]!==i||t[4]!==a||t[5]!==o||t[6]!==s?(c=(0,V.jsx)(R,{borderless:!0,candidates:n,selectedIds:s,disabled:i,onChange:o,labels:a}),t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c):c=t[7],c},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Fe=`xopc.taskDetail.chatPanelPercent`,Ie=42;function Le(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?Ie:Math.min(r,Math.max(n,e))}function Re(){try{let e=Number(window.localStorage.getItem(Fe));return Number.isFinite(e)&&e>=30&&e<=60?e:Ie}catch{return Ie}}function ze(e){return e.task.phase===`closed`?e.task.resolution===`done`?`completed`:`ended`:e.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`)?`needsUser`:e.operationalState===`idle`?e.task.phase===`backlog`?`captured`:e.task.phase===`ready`?`ready`:e.task.phase===`review`?`review`:`paused`:e.operationalState}function H(e){let t=(0,B.c)(9),{items:n,empty:r,verificationByCriterion:i}=e;if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let a;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>{let t=i?.get(e)??`unverified`;return(0,V.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,V.jsx)(t===`passed`?ie:t===`failed`?T:x,{className:t===`passed`?`mt-1 size-4 shrink-0 text-success`:t===`failed`?`mt-1 size-4 shrink-0 text-danger`:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,V.jsx)(`span`,{children:e})]},e)},t[5]=i,t[6]=e),a=n.map(e),t[2]=n,t[3]=i,t[4]=a}else a=t[4];let o;return t[7]===a?o=t[8]:(o=(0,V.jsx)(`ul`,{className:`space-y-2`,children:a}),t[7]=a,t[8]=o),o}function U({taskId:e,presentation:t,backgroundPath:n}){let[r]=a(),i=_(e=>e.language),s=g(e=>e.token),c=(0,z.useMemo)(()=>de(i),[i]),p=b(e=>e.setPageHeader),v=b(e=>e.clearPageHeader),ee=A(e=>e.open),te=A(e=>e.sessionKeyOverride),ne=A(e=>e.openForSession),re=ve(e=>e.setOpen),{data:y,error:ae,mutate:x,lastChange:T,conversationLoading:pe,conversationError:M}=le(e),[xe,R]=(0,z.useState)(null),[B,we]=(0,z.useState)(()=>new Set),[Oe,ke]=(0,z.useState)([]),[U,Be]=(0,z.useState)(null),[Ve,He]=(0,z.useState)([]),[Ue,W]=(0,z.useState)(!1),[We,Ge]=(0,z.useState)(``),[Ke,G]=(0,z.useState)(!1),[qe,Je]=(0,z.useState)(``),[K,Ye]=(0,z.useState)(Re),[Xe,Ze]=(0,z.useState)(!1),Qe=(0,z.useRef)(null),$e=(0,z.useRef)(!1),et=(0,z.useRef)(!1),tt=(0,z.useRef)(``),nt=(0,z.useRef)(null),rt=(0,z.useRef)(null),it=(0,z.useRef)(null),at=(0,z.useRef)(y),[ot,q]=(0,z.useState)(null),[st,ct]=(0,z.useState)(null),lt=(0,z.useMemo)(()=>({link:c.linkDependencies,linked:c.linkedDependencies,searchPlaceholder:c.dependencySearchPlaceholder,noMatches:c.noDependencyMatches,noCandidates:c.noDependencyCandidates,remove:c.removeDependency}),[c.dependencySearchPlaceholder,c.linkDependencies,c.linkedDependencies,c.noDependencyCandidates,c.noDependencyMatches,c.removeDependency]),ut=y?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,dt=(0,z.useMemo)(()=>f(r.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[r]);at.current=y;let J=(0,z.useCallback)((e,t)=>{we(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,z.useEffect)(()=>{R(null),q(null),W(!1),G(!1),ct(null)},[e]),(0,z.useEffect)(()=>{let e=!0;return k().then(t=>{e&&He(t.items)}).catch(()=>void 0),()=>{e=!1}},[s]),(0,z.useEffect)(()=>{if(!T||T.source===`user`)return;ct(T);let e=window.setTimeout(()=>ct(null),3500);return()=>window.clearTimeout(e)},[T]),(0,z.useEffect)(()=>{let t=y?.task.projectId,n=y?.dependencies??[];if(!t){it.current=null,Be(null),ke(n);return}it.current!==t&&(it.current=t,Be(null));let r=!0;return w(t).then(t=>{if(!r)return;Be(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});ke([...i.values()])}).catch(()=>{r&&ke(n)}),()=>{r=!1}},[ut,y?.task.projectId,e]);let Y=(0,z.useCallback)(async(t,n=`command`)=>{let r=at.current;if(r){J(n,!0),R(null);try{await x(await oe(e,t,r.task.version),{revalidate:!1})}catch{R(c.actionFailed)}finally{J(n,!1)}}},[c.actionFailed,x,J,e]),X=(0,z.useCallback)(async(t,n)=>{let r=at.current;if(!r)return!1;n&&J(n,!0),R(null);try{return await x(C(e,t,r.task.version),{optimisticData:Ce(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return R(c.actionFailed),!1}finally{n&&J(n,!1)}},[c.actionFailed,x,J,e]),ft=async()=>{if(!y)return;if($e.current){$e.current=!1;return}let e=We.trim(),t=nt.current;if(Se(t,y.task.version,y.task.title,e)){q(`title`);return}if(!e||e===y.task.title){Ge(y.task.title),W(!1);return}await X({title:e})&&(q(null),W(!1))},pt=async()=>{if(!y)return;if(et.current){et.current=!1;return}let e=qe.trim(),t=rt.current;if(Se(t,y.task.version,y.task.body??``,e)){q(`description`);return}if(qe===tt.current||e===(y.task.body??``).trim()){G(!1);return}await X({body:e||null})&&(q(null),G(!1))},mt=(0,z.useCallback)(async e=>{let t=at.current;if(!(!t||e===t.task.phase)){if(t.task.phase===`closed`){await Y({type:`reopen`,phase:e===`closed`?`ready`:e},`phase`);return}if(e===`closed`){await Y({type:`close`,resolution:`done`},`phase`);return}await Y({type:`move`,phase:e},`phase`)}},[Y]),ht=(0,z.useCallback)(e=>{X({priority:e},`priority`)},[X]),gt=(0,z.useCallback)(e=>{X({dueAt:De(e)},`dueAt`)},[X]),_t=(0,z.useCallback)(e=>{Ye(e);try{window.localStorage.setItem(Fe,String(e))}catch{}},[]),vt=(0,z.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=Qe.current?.clientWidth??0;_t(Le(e.key===`Home`?Ie:K+(e.key===`ArrowLeft`?2:-2),t))},[K,_t]),yt=(0,z.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=Qe.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),Ze(!0);let i=K,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Le((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}Ze(!1),_t(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[K,_t]),bt=(0,z.useCallback)(async t=>{let n=at.current;if(n){J(`dependencies`,!0),R(null);try{await x(await O(e,t,n.task.version),{revalidate:!1})}catch{R(c.dependencyUpdateFailed)}finally{J(`dependencies`,!1)}}},[c.dependencyUpdateFailed,x,J,e]),xt=(0,z.useCallback)(async t=>{let n=at.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){J(`delegateAgentId`,!0),R(null);try{await x(await S(e,t,n.task.version),{revalidate:!1})}catch{R(c.actionFailed)}finally{J(`delegateAgentId`,!1)}}},[c.actionFailed,x,J,e]);if((0,z.useLayoutEffect)(()=>{if(t!==`modal`)return p({startExtra:(0,V.jsx)(o,{to:dt,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":c.backToWork,children:(0,V.jsx)(ue,{className:`size-4`})}),main:y?(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:U?`${U} / ${c.taskLabel}`:c.taskLabel}),(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c.detailStatuses[ze(y)]})]}):null,end:null}),v},[v,c.backToWork,c.detailStatuses,c.taskLabel,y,t,U,dt,p]),ae&&!y)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:c.taskNotFound});if(!y)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,V.jsx)(Te,{})});let St=y.waits[0],Ct=St?.kind===`paused`?St:void 0,Z=y.receipts[0],wt=c.detailStatuses[ze(y)],Tt=c.detailStatusDescriptions[ze(y)],Et=y.task.body?.trim()||y.task.contract?.objective.trim(),Dt=new Map(Z?.verification.checks.map(e=>[e.criterion,e.status])),Ot=y.allowedCommands.includes(`mark_ready`),kt=y.allowedCommands.includes(`start`),At=y.allowedCommands.includes(`add_wait`),jt=y.task.phase===`review`&&y.allowedCommands.includes(`close`),Mt=y.allowedCommands.includes(`reopen`),Q=y.conversation.activeSessionKey,Nt=y.conversation.currentExecutorAgentId??y.task.delegateAgentId??y.task.ownerId,Pt=Ve.find(e=>e.id===Nt),Ft=!!(Q&&ee&&te===Q),It=y.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`),Lt=y.task.contract?.acceptanceCriteria??[],Rt=Lt.filter(e=>Dt.get(e)===`passed`).length,zt=y.task.contract?.expectedOutputs??[],Bt=y.task.contract?.constraints??[],Vt=y.task.contract?.approvalRequired??[],Ht=y.task.contract?.assumptions??[],Ut=y.task.contract?.risks??[],$=(...e)=>!!st?.changedFields.some(t=>e.includes(t)),Wt=e=>t===`modal`&&n?F(n,e):u(`/tasks/${e}`,dt),Gt=y.allowedCommands.includes(`move`),Kt=B.has(`command`),qt=(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[Ot?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`mark_ready`}),children:[(0,V.jsx)(D,{className:`size-4`}),c.scheduleTask]}):null,Ct?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`resolve_wait`,waitId:Ct.id}),children:[(0,V.jsx)(D,{className:`size-4`}),c.resumeTask]}):null,!St&&kt&&Nt?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`start`,executor:{kind:`agent`,agentId:Nt}}),children:[(0,V.jsx)(D,{className:`size-4`}),c.runTask]}):null,jt?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`close`,resolution:`done`}),children:[(0,V.jsx)(ie,{className:`size-4`}),c.approveTask]}):null,Mt?(0,V.jsxs)(h,{variant:`primary`,disabled:Kt,onClick:()=>void Y({type:`reopen`,phase:`ready`}),children:[(0,V.jsx)(D,{className:`size-4`}),c.reopenTask]}):null,!St&&At?(0,V.jsxs)(h,{variant:`secondary`,className:`border-0 bg-surface-hover shadow-none`,disabled:Kt,onClick:()=>void Y({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,V.jsx)(ce,{className:`size-4`}),c.pauseTask]}):null,y.task.phase===`closed`?null:(0,V.jsxs)(j,{children:[(0,V.jsx)(P,{asChild:!0,children:(0,V.jsx)(h,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:Kt,"aria-label":c.moreActions,children:(0,V.jsx)(me,{className:`size-4`,"aria-hidden":!0})})}),(0,V.jsx)(I,{children:(0,V.jsx)(L,{align:`end`,sideOffset:6,className:`z-[100] min-w-40 rounded-lg border border-edge bg-surface-panel p-1 shadow-popover`,children:(0,V.jsx)(ge,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void Y({type:`close`,resolution:`cancelled`}),children:c.cancelTask})})})]})]});return(0,V.jsxs)(`div`,{ref:Qe,className:`${t===`modal`?`flex h-full min-h-0 flex-col lg:flex-row`:`flex min-h-[calc(100dvh-8rem)] flex-col overflow-hidden lg:flex-row`} ${Xe?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${K}%`},children:[(0,V.jsxs)(`section`,{className:`task-detail-scroll min-w-0 flex-1 overflow-y-auto overscroll-contain p-5 sm:p-6`,children:[(0,V.jsxs)(`header`,{className:m(`px-4 pb-5`,$(`title`)&&`task-detail-live-update`),children:[(0,V.jsx)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[U?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(ye,{className:`size-3.5`,"aria-hidden":!0}),U]}):null,(0,V.jsx)(`span`,{children:`/`}),(0,V.jsx)(`span`,{children:c.taskLabel}),st?(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:st.source===`agent`?i===`zh`?`Agent 刚刚更新`:`Updated by Agent`:i===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Ue?(0,V.jsx)(`input`,{autoFocus:!0,"data-task-inline-editor":!0,value:We,onChange:e=>Ge(e.target.value),onBlur:()=>void ft(),onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),$e.current=!0,Ge(y.task.title),W(!1),queueMicrotask(()=>{$e.current=!1}))},className:`mt-3 w-full max-w-3xl rounded-lg bg-surface-hover px-3 py-2 text-2xl font-semibold leading-8 text-fg outline-none ring-2 ring-accent/30 focus:ring-accent/60`}):(0,V.jsx)(`button`,{type:`button`,className:`mt-3 block max-w-3xl rounded-lg text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{nt.current={value:y.task.title,version:y.task.version},q(null),Ge(y.task.title),W(!0)},children:(0,V.jsx)(`h1`,{className:`text-2xl font-semibold leading-8 text-fg`,children:y.task.title})}),ot===`title`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Ge(y.task.title),q(null),W(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({title:We.trim()}).then(e=>{e&&(q(null),W(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]})}),xe?(0,V.jsx)(`p`,{className:`mt-3 text-sm text-danger`,children:xe}):null]}),(0,V.jsxs)(`div`,{className:`mt-5 flex flex-col gap-5`,children:[(0,V.jsxs)(`main`,{className:`order-2 min-w-0 space-y-5`,children:[(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`body`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDescription}),Ke?(0,V.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:qe,onChange:e=>Je(e.target.value),onBlur:()=>void pt(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),et.current=!0,Je(y.task.body??y.task.contract?.objective??``),G(!1),queueMicrotask(()=>{et.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,V.jsx)(`button`,{type:`button`,className:`-mx-1 mt-2 block w-[calc(100%+0.5rem)] rounded-lg px-1 py-1 text-left outline-none hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=y.task.body??y.task.contract?.objective??``;tt.current=e,rt.current={value:y.task.body??``,version:y.task.version},q(null),Je(e),G(!0)},children:(0,V.jsx)(`span`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg-muted`,children:Et&&Et!==y.task.title?Et:c.noTaskDescription})}),ot===`description`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:i===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{Je(y.task.body??``),q(null),G(!1)},children:i===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void X({body:qe.trim()||null}).then(e=>{e&&(q(null),G(!1))}),children:i===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),y.attention.length>0?(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-warning/10 p-4`,$(`attention`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h3`,{className:`font-medium text-fg`,children:It?c.needsAttention:c.waitingStatus}),(0,V.jsx)(`ul`,{className:`mt-3 space-y-2 text-sm text-fg-muted`,children:y.attention.map((e,t)=>(0,V.jsx)(`li`,{children:e.summary},`${e.kind}-${t}`))})]}):null,(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`contract`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskDefinition}),(0,V.jsxs)(`div`,{className:`mt-5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.successDefinition}),Lt.length>0?(0,V.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:c.criteriaProgress.replace(`{{verified}}`,String(Rt)).replace(`{{total}}`,String(Lt.length))}):null]}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Lt,empty:c.noDefinition,verificationByCriterion:Dt})})]}),zt.length>0?(0,V.jsxs)(`div`,{className:`mt-5 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:c.expectedOutputs}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:zt,empty:c.noDefinition})})]}):null,Bt.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.constraints}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Bt,empty:c.noDefinition})})]}):null,Vt.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.approvalRequired}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Vt,empty:c.noDefinition})})]}):null,Ht.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextAssumptions}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Ht,empty:c.noDefinition})})]}):null,Ut.length>0?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg`,children:c.contextRisks}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(H,{items:Ut,empty:c.noDefinition})})]}):null]}),Z?(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`runs`,`receipts`)&&`task-detail-live-update`),children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.latestResult}),(0,V.jsx)(d,{content:Z.summary,compact:!0,className:`mt-2 text-sm leading-6 text-fg`,openHttpLinksInNewTab:!0})]}),(0,V.jsxs)(`span`,{className:`rounded-full bg-surface-hover px-2.5 py-1 text-xs text-fg-muted`,children:[c.receiptStatuses[Z.status],` · `,c.verificationStatuses[Z.verification.status]]})]}),Z.remainingWork.length>0?(0,V.jsxs)(`div`,{className:`mt-4`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:c.remainingWork}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(H,{items:Z.remainingWork,empty:c.noRemainingWork})})]}):null,Z.nextAction?(0,V.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3`,children:[(0,V.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:c.nextAction}),(0,V.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Z.nextAction})]}):null,(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2`,children:[(0,V.jsx)(h,{className:`border-0 bg-surface-hover px-2 py-1 text-xs shadow-none`,variant:`secondary`,onClick:()=>void se(Z.runId,`helpful`),children:c.doneWell}),(0,V.jsx)(h,{className:`px-2 py-1 text-xs`,variant:`ghost`,onClick:()=>void se(Z.runId,`not_helpful`),children:c.needsFix}),Z.evidence.filter(e=>e.uri).map(e=>(0,V.jsxs)(`a`,{className:`ml-auto inline-flex items-center gap-1 text-xs text-accent hover:underline`,href:e.uri,children:[(0,V.jsx)(l,{className:`size-3`}),e.title]},`${e.title}-${e.uri}`))]}),y.receipts.length>1?(0,V.jsxs)(`details`,{className:`mt-4 rounded-lg bg-surface-hover p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted`,children:c.executionHistory.replace(`{{count}}`,String(y.receipts.length-1))}),(0,V.jsx)(`div`,{className:`mt-3 space-y-3`,children:y.receipts.slice(1).map(e=>(0,V.jsx)(`article`,{className:`rounded-lg bg-surface-active p-3`,children:(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,V.jsx)(`p`,{className:`text-sm text-fg`,children:e.summary}),(0,V.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:c.receiptStatuses[e.status]})]})},e.runId))})]}):null]}):null,y.context.length>0?(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`context`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.contextUsed}),(0,V.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:y.context.map(e=>(0,V.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[c.contextRoleLabels[e.role],` · `,c.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,V.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,V.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,V.jsxs)(`aside`,{className:`order-1 min-w-0 space-y-4`,children:[(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-subtle p-4`,$(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskProperties}),(0,V.jsxs)(`div`,{className:`mt-4 grid gap-4 sm:grid-cols-2`,children:[(0,V.jsx)(Ae,{value:y.task.phase,disabled:B.has(`phase`),canMove:Gt,canApprove:jt,canReopen:Mt,language:i,label:c.taskPhase,onChange:mt}),(0,V.jsx)(je,{value:y.task.priority,disabled:B.has(`priority`),label:c.priority,labels:c.priorityLabels,onChange:ht}),(0,V.jsx)(Me,{value:Ee(y.task.dueAt),disabled:B.has(`dueAt`),label:c.dueDate,onChange:gt}),(0,V.jsx)(Ne,{value:y.conversation.currentExecutorAgentId??``,disabled:B.has(`delegateAgentId`),label:c.executorLabel,unassignedLabel:c.unassigned,agents:Ve,onChange:xt}),U?(0,V.jsxs)(`div`,{className:`grid gap-1 text-xs text-fg-muted`,children:[(0,V.jsx)(`span`,{children:c.projectLabel}),(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-lg bg-surface-hover px-3 py-2 text-sm text-fg`,children:[(0,V.jsx)(ye,{className:`size-3.5`}),U]})]}):null]}),(0,V.jsxs)(`div`,{className:`mt-4 rounded-lg bg-surface-hover p-3 text-xs leading-5 text-fg-subtle`,children:[(0,V.jsx)(`p`,{children:wt}),(0,V.jsx)(`p`,{children:Tt}),(0,V.jsx)(`p`,{className:`mt-2`,children:c.updatedAt.replace(`{{date}}`,be(y.task.updatedAt,i))})]})]}),(0,V.jsxs)(`section`,{className:m(`rounded-xl bg-surface-panel p-4`,$(`dependencies`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`font-medium text-fg`,children:c.taskRelations}),(0,V.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependencies}),(0,V.jsx)(Pe,{candidates:Oe,selected:y.dependencies,disabled:B.has(`dependencies`),labels:lt,onChange:bt})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:c.dependents}),y.dependents.length>0?(0,V.jsx)(`div`,{className:`space-y-1.5`,children:y.dependents.map(e=>(0,V.jsx)(o,{to:Wt(e.id),className:`block rounded-lg bg-surface-hover p-2.5 text-sm text-accent hover:underline`,children:e.title},e.id))}):(0,V.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:c.noDependents})]})]})]})]})]})]}),(0,V.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":i===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(K),tabIndex:0,onPointerDown:yt,onKeyDown:vt,onDoubleClick:()=>_t(Ie),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${Xe?`bg-surface-hover`:``}`,children:(0,V.jsx)(`div`,{className:`my-3 w-px rounded-full bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,V.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:shrink-0`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-between gap-3 bg-surface-subtle px-4 py-3.5`,children:[(0,V.jsx)(`div`,{className:`min-w-0`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[Nt?(0,V.jsx)(_e,{agentId:Nt,avatar:Pt?.avatar,size:28,className:`shrink-0`}):null,(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:i===`zh`?`Agent 执行与对话`:`Agent execution and chat`}),(0,V.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-fg-muted`,children:[Pt?.name??Nt??c.unassigned,` · `,wt]})]})]})}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-2`,children:[qt,Q&&t!==`modal`?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(h,{type:`button`,variant:`ghost`,className:m(`h-8 shrink-0 px-2 text-xs`,Ft&&`bg-surface-hover text-fg`),"aria-label":i===`zh`?`项目文件`:`Project files`,"aria-pressed":Ft,onClick:()=>{re(Q,!1),ne(Q)},children:[(0,V.jsx)(fe,{className:`size-3.5`,"aria-hidden":!0}),i===`zh`?`文件`:`Files`]}),(0,V.jsx)(h,{asChild:!0,variant:`ghost`,className:`h-8 shrink-0 px-2 text-xs`,children:(0,V.jsxs)(o,{to:he(e),children:[(0,V.jsx)(l,{className:`size-3.5`}),i===`zh`?`全屏`:`Full screen`]})})]}):null]})]}),Q?(0,V.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,V.jsx)(N,{embedded:!0,sessionKey:Q,taskId:e})}):pe?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(E,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):M?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(E,{className:`mx-auto size-8 text-danger`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:M instanceof Error?M.message:String(M)})]})}):(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(E,{className:`mx-auto size-8 text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:i===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:i===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]})}function Be(){let e=(0,B.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,V.jsx)(U,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function Ve(e){let t=(0,B.c)(54),{taskId:n,backgroundPath:r,onClose:i}=e,a=_(K),{data:s}=le(n),c=s?.conversation.activeSessionKey??null,u=A(Je),d=A(qe),f=A(G),h=A(Ke),g=ve(Ge),ie=ae(We),b=ae(W),x=u?d:0,S;t[0]!==i||t[1]!==b?(S=e=>{e||(b(null),i())},t[0]=i,t[1]=b,t[2]=S):S=t[2];let oe=a===`zh`?`关闭任务详情`:`Close task details`,C;t[3]!==i||t[4]!==b?(C=()=>{b(null),i()},t[3]=i,t[4]=b,t[5]=C):C=t[5];let w;t[6]!==oe||t[7]!==C?(w=(0,V.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45 backdrop-blur-[1px]`,"aria-label":oe,onClick:C}),t[6]=oe,t[7]=C,t[8]=w):w=t[8];let se=u?`true`:`false`,T=`${x/2}px`,ce=`${x}px`,E;t[9]!==T||t[10]!==ce?(E={"--task-detail-workspace-offset":T,"--task-detail-workspace-width":ce},t[9]=T,t[10]=ce,t[11]=E):E=t[11];let ue=E,D=a===`zh`?`任务详情`:`Task details`,O;t[12]===D?O=t[13]:(O=(0,V.jsx)(re,{className:`font-medium text-fg`,children:D}),t[12]=D,t[13]=O);let de=a===`zh`?`查看并操作任务详情`:`View and manage task details`,k;t[14]===de?k=t[15]:(k=(0,V.jsx)(v,{className:`sr-only`,children:de}),t[14]=de,t[15]=k);let j;t[16]!==c||t[17]!==a||t[18]!==h||t[19]!==g||t[20]!==n||t[21]!==u||t[22]!==f?(j=c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,className:m(`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,u&&f===c&&`bg-surface-hover text-fg`),"aria-label":a===`zh`?`项目文件`:`Project files`,title:a===`zh`?`项目文件`:`Project files`,"aria-pressed":u&&f===c,onClick:()=>{g(c,!1),h(c)},children:(0,V.jsx)(fe,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(o,{to:he(n),className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":a===`zh`?`全屏打开对话`:`Open chat full screen`,title:a===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,V.jsx)(l,{className:`size-4`,"aria-hidden":!0})})]}):null,t[16]=c,t[17]=a,t[18]=h,t[19]=g,t[20]=n,t[21]=u,t[22]=f,t[23]=j):j=t[23];let me=a===`zh`?`关闭任务详情`:`Close task details`,M;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,V.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t[24]=M):M=t[24];let N;t[25]===me?N=t[26]:(N=(0,V.jsx)(ee,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":me,children:M}),t[25]=me,t[26]=N);let ge;t[27]!==j||t[28]!==N?(ge=(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[j,N]}),t[27]=j,t[28]=N,t[29]=ge):ge=t[29];let _e;t[30]!==O||t[31]!==k||t[32]!==ge?(_e=(0,V.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[O,k,ge]}),t[30]=O,t[31]=k,t[32]=ge,t[33]=_e):_e=t[33];let P;t[34]!==r||t[35]!==n?(P=(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(U,{taskId:n,presentation:`modal`,backgroundPath:r})}),t[34]=r,t[35]=n,t[36]=P):P=t[36];let F;t[37]!==_e||t[38]!==P||t[39]!==se||t[40]!==ue?(F=(0,V.jsxs)(ne,{className:`task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl bg-surface-base shadow-float focus:outline-none`,"data-workspace-panel-open":se,style:ue,onEscapeKeyDown:Ue,onInteractOutside:He,children:[_e,P]}),t[37]=_e,t[38]=P,t[39]=se,t[40]=ue,t[41]=F):F=t[41];let I;t[42]!==ie||t[43]!==u||t[44]!==d||t[45]!==f?(I=ie?(0,V.jsx)(`div`,{className:`fixed inset-y-0 left-0 z-[100] flex min-h-0 min-w-0 overflow-hidden bg-surface-panel transition-[right] duration-200 ease-out motion-reduce:transition-none`,style:{right:u?d:0},children:(0,V.jsx)(pe,{allowOutsideChat:!0,sessionKey:f??void 0})}):null,t[42]=ie,t[43]=u,t[44]=d,t[45]=f,t[46]=I):I=t[46];let L;t[47]!==F||t[48]!==I||t[49]!==w?(L=(0,V.jsxs)(te,{children:[w,F,I]}),t[47]=F,t[48]=I,t[49]=w,t[50]=L):L=t[50];let ye;return t[51]!==S||t[52]!==L?(ye=(0,V.jsx)(y,{modal:!1,open:!0,onOpenChange:S,children:L}),t[51]=S,t[52]=L,t[53]=ye):ye=t[53],ye}function He(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Ue(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function W(e){return e.setPath}function We(e){return e.path}function Ge(e){return e.setOpen}function Ke(e){return e.openForSession}function G(e){return e.sessionKeyOverride}function qe(e){return e.widthPx}function Je(e){return e.open}function K(e){return e.language}function Ye(e){return(0,V.jsx)(c,{value:e.id,children:e.name||e.id},e.id)}function Xe(e){return e.id}export{Ve as TaskDetailModal,Be as TaskDetailPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{p as i,t as a}from"./chunk-KS7C4IRE-BaASWQor.js";import{n as o,r as s}from"./popover-select-BzdnTy3h.js";import{t as c}from"./external-link-DjqjBmc3.js";import{t as l}from"./loader-circle-CifKLtgG.js";import{t as u}from"./plus-Q2yW6OE7.js";import{t as d}from"./x-B_N4OPjy.js";import{t as f}from"./button-CSEbl4zT.js";import{n as p}from"./locale-store-BIOMAhmR.js";import{a as m,i as h,n as g,o as _,r as v,s as y,t as b}from"./dist-BPoKqzeH.js";import{i as x}from"./vendor-swr-BIWyz7Rc.js";import{$o as S,Aa as C,Ba as w,Ca as T,Da as E,Ea as D,Es as O,Fa as k,Ha as A,Ia as j,La as M,Ma as N,Na as P,No as F,Oa as I,Pa as L,Pc as R,Ps as z,Ra as B,Ta as V,Ua as H,Va as U,Vs as W,bl as G,cl as K,hc as q,is as ee,ja as J,ka as Y,la as X,nl as te,qc as ne,rl as re,sl as ie,ss as ae,za as oe,zo as se}from"./index-BIBAmAjw.js";import{n as ce,t as le}from"./use-autosave-C10PZ1OV.js";import{t as ue}from"./page-tabs-DoQq4tt6.js";import{I as de,a as fe,i as pe}from"./connectors-api-Cj4deNtI.js";var Z=n(),Q=e(t(),1),$=r(),me=new Set([`profile`,`understanding`,`collaboration`,`sources`,`dreaming`,`privacy`]),he=`w-full rounded-xl border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/60 focus:ring-2 focus:ring-accent/20`,ge={en:{title:`You`,subtitle:`A living portrait, shaped together by you and xopc.`,profile:`Your portrait`,understanding:`Shared understanding`,collaboration:`Working together`,sources:`Sources`,dreaming:`Background review`,privacy:`Privacy`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`This is how xopc currently understands you. It grows through your conversations and work — and you always have the final say.`,maintainedTogether:`Shaped together`,youDecide:`You decide what stays`,editProfile:`Edit basics`,talkAboutMe:`Add through conversation`,roleMissing:`Add what you do`,direction:`What matters now`,directionEmpty:`Add a direction so xopc can help keep important work moving.`,portraitUnderstanding:`What xopc understands`,portraitUnderstandingHint:`Confirmed context xopc can use across conversations.`,portraitRules:`How we work together`,portraitRulesHint:`The agreements xopc should follow when helping you.`,reviewWaiting:`waiting for your review`,seeAll:`See all`,addFirstUnderstanding:`Nothing confirmed yet. Tell xopc what matters to you, or review a suggestion when one appears.`,addFirstRule:`No working agreements yet. Add one to make collaboration feel more like yours.`,portraitControl:`How this portrait evolves`,portraitControlHint:`Manage where understanding comes from, how it is reviewed, and what is never retained.`,portraitLearn:`Learn how this portrait is formed`,advanced:`Portrait controls`,backToPortrait:`Back to your portrait`,controlSourcesHint:`See which conversations, connections, and explicit details shape xopc’s understanding.`,controlReviewHint:`Choose how xopc proposes updates and which changes require your confirmation.`,controlPrivacyHint:`Set the boundaries for sensitive content and long-term retention.`,controlTrust:`Inferred understanding is never activated automatically. You can review, correct, or remove it at any time.`,profileHint:`Facts you provide directly. These are available across conversations.`,done:`Done`,required:`This field cannot be empty.`,callName:`What should xopc call you?`,callNamePlaceholder:`For example: Alex, Joyce, or Dr. Chen`,role:`Your role`,rolePlaceholder:`For example: product designer, founder, or engineer`,primaryGoal:`What are you mainly trying to achieve?`,primaryGoalPlaceholder:`The outcome you want xopc to optimize for`,pronouns:`Pronouns (optional)`,pronounsPlaceholder:`For example: she/her, he/him, they/them`,timezone:`Timezone`,locale:`Language / locale`,detect:`Use this device`,understoodHint:`Reviewable beliefs learned from your conversations and work. Inferences stay pending until confirmed.`,addUnderstanding:`Add understanding`,statement:`What should xopc understand?`,kind:`Type`,add:`Add`,cancel:`Cancel`,active:`Active`,review:`Needs review`,confirm:`Confirm`,reject:`Wrong`,edit:`Edit`,delete:`Delete`,confirmDelete:`Delete now`,rulesHint:`Explicit instructions for how xopc should collaborate with you. Rules outrank inferred understanding.`,addRule:`Add rule`,ruleStatement:`How should xopc work with you?`,category:`Category`,disable:`Disable`,enable:`Enable`,emptyUnderstanding:`Nothing here yet. Tell xopc something explicitly, or confirm a suggestion after it learns one.`,qualityTitle:`Learning quality`,qualityActive:`Confirmed`,qualityPending:`Pending review`,qualityAcceptance:`30-day acceptance`,qualityRecall:`Helpful recall`,qualitySourceCoverage:`Source coverage`,qualityBootstrapTime:`Median first sync`,qualityNoData:`Not enough feedback yet`,emptyRules:`No working agreements yet.`,sourceExplicit:`You said this directly`,sourceInferred:`Inferred — may be wrong`,sourceObserved:`Observed across prior work`,sourcesHint:`Review every granted source, its access mode, retention, and last collection. Revoking stops future learning.`,manageSources:`Connect another source`,authorizedSources:`Authorized sources`,connectorsTitle:`Connectors`,openConnector:`Open connector`,noSources:`No sources are authorized.`,noConnectors:`No connectors are installed.`,connected:`Connected`,unavailable:`Needs attention`,revoke:`Revoke source`,revokeHint:`Revoke this source and remove its derived understanding`,confirmRevoke:`Confirm revoke`,revoking:`Revoking…`,revokeDone:`Source revoked and derived understanding removed.`,refresh:`Update`,refreshing:`Updating…`,refreshStarted:`Update started.`,actionFailed:`Action failed`,once:`One-time`,continuous:`Continuous`,localOnly:`Local only`,derivedOnly:`Derived understanding only`,focuses:`Current focuses`,focusHint:`Candidate focuses never activate until you confirm them.`,activate:`Activate`,pause:`Pause`,complete:`Complete`,noFocuses:`No focus candidates yet.`,focusCandidate:`Suggested`,focusActive:`Active`,focusPaused:`Paused`,focusCompleted:`Completed`,confidence:`Confidence`,confidenceHigh:`High`,confidenceMedium:`Medium`,confidenceLow:`Low`,contentReadTitle:`Optional deeper reading`,contentReadHint:`Metadata identified these recent items. Select up to 5 to explicitly allow one bounded content read; nothing is opened automatically.`,readSelected:`Read selected`,reading:`Reading…`,contentReadDone:`Selected content was read and indexed.`,dreamingHint:`A deterministic daily review checks expiry, contradictory evidence, and corroborated candidates. It never auto-activates an inference.`,mode:`Background review`,on:`On — propose for review`,off:`Off`,reviewTime:`Daily review time`,evidenceThreshold:`Supporting evidence required`,scanLimit:`Maximum items per run`,lastRun:`Last review`,neverRun:`Not run yet`,runCompleted:`Completed`,runFailed:`Failed`,runRunning:`Running`,runItems:`items`,privacyHint:`Choose how generic memory providers handle sensitive content. Structured user understanding applies stricter rules of its own.`,sensitivePolicy:`Sensitive memory writes`,policyDeny:`Do not store`,policyConfirm:`Ask before storing`,policyAllow:`Store when relevant`,privacyWarning:`Secret and regulated content is never stored as structured user understanding, regardless of this setting.`,error:`Could not load your context.`,retry:`Try again`},zh:{title:`你`,subtitle:`一份由你和 xopc 共同塑造、持续生长的画像。`,profile:`你的画像`,understanding:`共同理解`,collaboration:`协作方式`,sources:`数据来源`,dreaming:`后台复核`,privacy:`隐私`,portraitEyebrow:`YOU × XOPC`,portraitIntro:`这是 xopc 此刻对你的理解。它会在对话与共事中逐渐丰富,而你始终拥有最终决定权。`,maintainedTogether:`由你与 xopc 共同维护`,youDecide:`你决定什么被保留`,editProfile:`编辑基本信息`,talkAboutMe:`在对话中补充`,roleMissing:`补充你的角色`,direction:`此刻重要的事`,directionEmpty:`写下你此刻的方向,让 xopc 帮你持续推动真正重要的事。`,portraitUnderstanding:`xopc 对你的理解`,portraitUnderstandingHint:`已经确认、可以在不同对话中帮助你的上下文。`,portraitRules:`我们如何一起工作`,portraitRulesHint:`xopc 在帮助你时应该遵循的约定。`,reviewWaiting:`条等待你确认`,seeAll:`查看全部`,addFirstUnderstanding:`还没有已确认的理解。你可以直接告诉 xopc 什么对你重要,或在它形成建议后确认。`,addFirstRule:`还没有协作约定。添加后,xopc 会更像你熟悉的搭档。`,portraitControl:`这份画像如何更新`,portraitControlHint:`管理理解从哪里来、如何复核,以及哪些内容永远不会被保留。`,portraitLearn:`了解这份画像如何形成`,advanced:`画像管理`,backToPortrait:`返回你的画像`,controlSourcesHint:`查看哪些对话、连接与明确告知的内容塑造了 xopc 的理解。`,controlReviewHint:`决定 xopc 如何提出更新,以及哪些变化需要你确认。`,controlPrivacyHint:`设定敏感内容与长期保留的边界。`,controlTrust:`推断出的理解不会自动生效。你可以随时复核、修正或删除。`,profileHint:`由你直接提供的事实,会在不同对话中使用。`,done:`完成`,required:`此项不能为空。`,callName:`希望 xopc 如何称呼你?`,callNamePlaceholder:`例如:Mic、Joyce、张老师`,role:`你的角色`,rolePlaceholder:`例如:产品设计师、创业者、工程师`,primaryGoal:`你目前最想达成什么?`,primaryGoalPlaceholder:`希望 xopc 优先帮助你实现的结果`,pronouns:`代词(可选)`,pronounsPlaceholder:`例如:she/her、he/him、they/them`,timezone:`时区`,locale:`语言 / 地区`,detect:`使用本机时区`,understoodHint:`从对话和工作中形成、可复核的理解。推断内容在你确认前保持待审核。`,addUnderstanding:`添加理解`,statement:`希望 xopc 了解什么?`,kind:`类型`,add:`添加`,cancel:`取消`,active:`使用中`,review:`待审核`,confirm:`确认`,reject:`不正确`,edit:`编辑`,delete:`删除`,confirmDelete:`确认删除`,rulesHint:`你明确设定的协作方式。协作约定的优先级高于推断出的理解。`,addRule:`添加约定`,ruleStatement:`希望 xopc 如何与你协作?`,category:`类别`,disable:`停用`,enable:`启用`,emptyUnderstanding:`还没有内容。你可以直接告诉 xopc,或在它学到建议后进行确认。`,emptyRules:`还没有协作约定。`,qualityTitle:`学习质量`,qualityActive:`已确认`,qualityPending:`待审核`,qualityAcceptance:`30 天采纳率`,qualityRecall:`有效召回`,qualitySourceCoverage:`来源覆盖率`,qualityBootstrapTime:`首次同步中位耗时`,qualityNoData:`反馈数据还不足`,sourceExplicit:`由你直接告知`,sourceInferred:`推断内容,可能有误`,sourceObserved:`从过往工作中观察到`,sourcesHint:`查看每项授权的访问方式、保留策略和最近采集时间;撤销后将停止后续学习。`,manageSources:`连接其他来源`,authorizedSources:`已授权数据来源`,connectorsTitle:`连接器`,openConnector:`打开连接器`,noSources:`尚未授权任何来源。`,noConnectors:`尚未安装连接器。`,connected:`已连接`,unavailable:`需要处理`,revoke:`撤销来源`,revokeHint:`撤销此来源并删除由它产生的理解`,confirmRevoke:`确认撤销`,revoking:`正在撤销…`,revokeDone:`已撤销来源并删除派生理解。`,refresh:`更新`,refreshing:`正在更新…`,refreshStarted:`更新任务已开始。`,actionFailed:`操作失败`,once:`仅一次`,continuous:`持续更新`,localOnly:`仅本地处理`,derivedOnly:`仅保留派生理解`,focuses:`当前关注`,focusHint:`候选关注不会自动生效,只有你确认后才会启用。`,activate:`启用`,pause:`暂停`,complete:`完成`,noFocuses:`还没有候选关注。`,focusCandidate:`待确认`,focusActive:`进行中`,focusPaused:`已暂停`,focusCompleted:`已完成`,confidence:`置信度`,confidenceHigh:`高`,confidenceMedium:`中`,confidenceLow:`低`,contentReadTitle:`可选的深入读取`,contentReadHint:`元数据识别出这些近期条目。你可以选择最多 5 项,明确授权一次有界正文读取;系统不会自动打开内容。`,readSelected:`读取所选内容`,reading:`正在读取…`,contentReadDone:`已读取并索引所选内容。`,dreamingHint:`每天进行一次确定性复核,检查过期、矛盾证据和得到佐证的候选理解;推断内容不会自动生效。`,mode:`后台复核`,on:`开启并生成待审核项`,off:`关闭`,reviewTime:`每日复核时间`,evidenceThreshold:`所需支持证据数`,scanLimit:`每次最多检查`,lastRun:`最近一次复核`,neverRun:`尚未运行`,runCompleted:`已完成`,runFailed:`失败`,runRunning:`运行中`,runItems:`项`,privacyHint:`选择通用记忆服务如何处理敏感内容;结构化用户理解有独立且更严格的规则。`,sensitivePolicy:`敏感记忆写入`,policyDeny:`不保存`,policyConfirm:`保存前询问`,policyAllow:`相关时允许保存`,privacyWarning:`无论这里如何设置,秘密和受监管内容都不会保存为结构化用户理解。`,error:`无法加载用户上下文。`,retry:`重试`}},_e={preference:{en:`Preference`,zh:`偏好`},boundary:{en:`Boundary`,zh:`边界`},relationship:{en:`Relationship`,zh:`关系`},routine:{en:`Routine`,zh:`习惯`},current_state:{en:`Current state`,zh:`当前状态`},long_term_goal:{en:`Long-term goal`,zh:`长期目标`},project_context:{en:`Project context`,zh:`项目背景`},task_lesson:{en:`Task lesson`,zh:`任务经验`},derived_insight:{en:`Insight`,zh:`洞察`}},ve={communication:{en:`Communication`,zh:`沟通`},execution:{en:`Execution`,zh:`执行`},boundary:{en:`Boundary`,zh:`边界`},routine:{en:`Routine`,zh:`习惯`},proactive:{en:`Proactive help`,zh:`主动协助`}};function ye(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-4 sm:p-5`,children:n}),t[0]=n,t[1]=r),r}function be(e){let t=(0,Z.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge px-5 py-10 text-center text-sm text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function xe(e){let t=(0,Z.c)(33),{open:n,onOpenChange:r,title:i,description:a,submitLabel:o,cancelLabel:s,submitDisabled:c,onSubmit:l,children:u}=e,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=p):p=t[0];let x;t[1]===i?x=t[2]:(x=(0,$.jsx)(y,{className:`text-base font-semibold text-fg`,children:i}),t[1]=i,t[2]=x);let S;t[3]===a?S=t[4]:(S=(0,$.jsx)(h,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a}),t[3]=a,t[4]=S);let C;t[5]!==x||t[6]!==S?(C=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[x,S]}),t[5]=x,t[6]=S,t[7]=C):C=t[7];let w;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(d,{className:`size-4`}),t[8]=w):w=t[8];let T;t[9]===s?T=t[10]:(T=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":s,children:w})}),t[9]=s,t[10]=T);let E;t[11]!==C||t[12]!==T?(E=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4`,children:[C,T]}),t[11]=C,t[12]=T,t[13]=E):E=t[13];let D;t[14]===u?D=t[15]:(D=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:u}),t[14]=u,t[15]=D);let O;t[16]===s?O=t[17]:(O=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{type:`button`,children:s})}),t[16]=s,t[17]=O);let k;t[18]!==c||t[19]!==o?(k=(0,$.jsx)(f,{type:`submit`,variant:`primary`,disabled:c,children:o}),t[18]=c,t[19]=o,t[20]=k):k=t[20];let A;t[21]!==k||t[22]!==O?(A=(0,$.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-3`,children:[O,k]}),t[21]=k,t[22]=O,t[23]=A):A=t[23];let j;t[24]!==l||t[25]!==A||t[26]!==E||t[27]!==D?(j=(0,$.jsxs)(_,{children:[p,(0,$.jsx)(v,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(30rem,calc(100vh-2rem))] w-[min(36rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`form`,{className:`flex h-full min-h-0 flex-col`,onSubmit:l,children:[E,D,A]})})]}),t[24]=l,t[25]=A,t[26]=E,t[27]=D,t[28]=j):j=t[28];let M;return t[29]!==r||t[30]!==n||t[31]!==j?(M=(0,$.jsx)(b,{open:n,onOpenChange:r,children:j}),t[29]=r,t[30]=n,t[31]=j,t[32]=M):M=t[32],M}function Se(e){return JSON.stringify(e)}function Ce(e){let t=(0,Z.c)(10),[n,r]=(0,Q.useState)(e),i;t[0]===e?i=t[1]:(i=Se(e),t[0]=e,t[1]=i);let a=(0,Q.useRef)(i),o;t[2]===e?o=t[3]:(o=Se(e),t[2]=e,t[3]=o);let s=o,c,l;t[4]!==e||t[5]!==s?(c=()=>{if(s===a.current)return;let t=a.current;a.current=s,r(n=>Se(n)===t?e:n)},l=[e,s],t[4]=e,t[5]=s,t[6]=c,t[7]=l):(c=t[6],l=t[7]),(0,Q.useEffect)(c,l);let u;return t[8]===n?u=t[9]:(u=[n,r],t[8]=n,t[9]=u),u}function we(e){return{callName:e.callName,role:e.role,primaryGoal:e.primaryGoal,pronouns:e.pronouns,timezone:e.timezone,locale:e.locale}}function Te(){let e=(0,Z.c)(68),t=p(ke),n=ge[t],[r,a]=i(),o;if(e[0]!==r){let t=r.get(`tab`);o=t&&me.has(t)?t:`profile`,e[0]=r,e[1]=o}else o=e[1];let s=o,c=T(Oe),l=T(De),{data:u,error:d,isLoading:m,mutate:h}=x(`/api/you`,P),g;e[2]!==l||e[3]!==c||e[4]!==n.subtitle||e[5]!==n.title?(g=()=>(c({startExtra:null,main:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h1`,{className:`text-base font-semibold text-fg`,children:n.title}),(0,$.jsx)(`p`,{className:`hidden text-xs text-fg-muted sm:block`,children:n.subtitle})]}),end:null}),l),e[2]=l,e[3]=c,e[4]=n.subtitle,e[5]=n.title,e[6]=g):g=e[6];let _;if(e[7]!==l||e[8]!==c||e[9]!==n?(_=[l,c,n],e[7]=l,e[8]=c,e[9]=n,e[10]=_):_=e[10],(0,Q.useEffect)(g,_),m){let t;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`div`,{className:`space-y-4 p-4 sm:p-6`,children:[(0,$.jsx)(X,{className:`h-10 w-96 max-w-full`}),(0,$.jsx)(X,{className:`h-72 rounded-2xl`})]}),e[11]=t):t=e[11],t}if(d||!u){let t;e[12]===h?t=e[13]:(t=()=>void h(),e[12]=h,e[13]=t);let r;e[14]!==n.retry||e[15]!==t?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:t,children:n.retry}),e[14]=n.retry,e[15]=t,e[16]=r):r=e[16];let i;return e[17]!==n.error||e[18]!==r?(i=(0,$.jsx)(`div`,{className:`p-6`,children:(0,$.jsxs)(be,{children:[n.error,` `,r]})}),e[17]=n.error,e[18]=r,e[19]=i):i=e[19],i}let v=s===`sources`||s===`dreaming`||s===`privacy`,y;e[20]!==v||e[21]!==u||e[22]!==a||e[23]!==n.advanced||e[24]!==n.backToPortrait||e[25]!==n.collaboration||e[26]!==n.profile||e[27]!==n.title||e[28]!==n.understanding||e[29]!==s?(y=v?(0,$.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge pb-4`,children:[(0,$.jsxs)(f,{variant:`ghost`,className:`-ml-2`,onClick:()=>a({tab:`profile`}),children:[(0,$.jsx)(re,{className:`size-4`}),n.backToPortrait]}),(0,$.jsx)(`span`,{className:`h-4 w-px bg-edge`,"aria-hidden":`true`}),(0,$.jsx)(`span`,{className:`text-sm font-medium text-fg-muted`,children:n.advanced})]}):(0,$.jsx)(ue,{ariaLabel:n.title,activeTab:s,onChange:e=>a({tab:e}),items:[{id:`profile`,label:n.profile,icon:ne},{id:`understanding`,label:n.understanding,icon:K,count:u.understandings.filter(Ee).length||void 0},{id:`collaboration`,label:n.collaboration,icon:q}]}),e[20]=v,e[21]=u,e[22]=a,e[23]=n.advanced,e[24]=n.backToPortrait,e[25]=n.collaboration,e[26]=n.profile,e[27]=n.title,e[28]=n.understanding,e[29]=s,e[30]=y):y=e[30];let b;e[31]!==u||e[32]!==t||e[33]!==h||e[34]!==a||e[35]!==n||e[36]!==s?(b=s===`profile`?(0,$.jsx)(Ae,{data:u,language:t,t:n,onNavigate:e=>a({tab:e}),onProfileChanged:e=>h(t=>t&&{...t,profile:e},{revalidate:!1})}):null,e[31]=u,e[32]=t,e[33]=h,e[34]=a,e[35]=n,e[36]=s,e[37]=b):b=e[37];let S;e[38]!==u||e[39]!==t||e[40]!==h||e[41]!==n||e[42]!==s?(S=s===`understanding`?(0,$.jsx)(ze,{items:u.understandings,quality:u.quality,language:t,t:n,onChanged:e=>e?h(t=>t&&{...t,understandings:t.understandings.map(t=>t.id===e.id?e:t)},{revalidate:!0}):h()}):null,e[38]=u,e[39]=t,e[40]=h,e[41]=n,e[42]=s,e[43]=S):S=e[43];let C;e[44]!==u||e[45]!==t||e[46]!==h||e[47]!==n||e[48]!==s?(C=s===`collaboration`?(0,$.jsx)(qe,{rules:u.rules,language:t,t:n,onChanged:()=>h()}):null,e[44]=u,e[45]=t,e[46]=h,e[47]=n,e[48]=s,e[49]=C):C=e[49];let w;e[50]!==n||e[51]!==s?(w=s===`sources`?(0,$.jsx)(Xe,{t:n}):null,e[50]=n,e[51]=s,e[52]=w):w=e[52];let E;e[53]!==u||e[54]!==n||e[55]!==s?(E=s===`dreaming`?(0,$.jsx)(Ze,{lastRun:u.consolidation?.lastRun??null,t:n}):null,e[53]=u,e[54]=n,e[55]=s,e[56]=E):E=e[56];let D;e[57]!==n||e[58]!==s?(D=s===`privacy`?(0,$.jsx)($e,{t:n}):null,e[57]=n,e[58]=s,e[59]=D):D=e[59];let O;return e[60]!==y||e[61]!==b||e[62]!==S||e[63]!==C||e[64]!==w||e[65]!==E||e[66]!==D?(O=(0,$.jsxs)(`div`,{className:`mx-auto w-full max-w-6xl space-y-5 p-4 sm:p-6 lg:py-8`,children:[y,b,S,C,w,E,D]}),e[60]=y,e[61]=b,e[62]=S,e[63]=C,e[64]=w,e[65]=E,e[66]=D,e[67]=O):O=e[67],O}function Ee(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function De(e){return e.clearPageHeader}function Oe(e){return e.setPageHeader}function ke(e){return e.language}function Ae(e){let t=(0,Z.c)(176),{data:n,language:r,t:i,onNavigate:o,onProfileChanged:s}=e,[c,l]=(0,Q.useState)(!1),[u,d]=(0,Q.useState)(!1),p,m,h,g,_,v,y,b,x,C;if(t[0]!==n.profile.callName||t[1]!==n.profile.primaryGoal||t[2]!==n.profile.role||t[3]!==n.rules||t[4]!==n.understandings||t[5]!==r||t[6]!==o||t[7]!==i.addFirstRule||t[8]!==i.addFirstUnderstanding||t[9]!==i.advanced||t[10]!==i.direction||t[11]!==i.directionEmpty||t[12]!==i.editProfile||t[13]!==i.maintainedTogether||t[14]!==i.portraitEyebrow||t[15]!==i.portraitIntro||t[16]!==i.portraitRules||t[17]!==i.portraitRulesHint||t[18]!==i.portraitUnderstanding||t[19]!==i.portraitUnderstandingHint||t[20]!==i.reviewWaiting||t[21]!==i.roleMissing||t[22]!==i.seeAll||t[23]!==i.talkAboutMe||t[24]!==i.youDecide){let e=n.understandings.filter(Ne),s;t[35]===n.understandings?s=t[36]:(s=n.understandings.filter(Me),t[35]=n.understandings,t[36]=s);let c=s,u=n.rules.filter(je),w,T;t[37]!==n.profile.callName||t[38]!==r?(w=n.profile.callName.trim()||(r===`zh`?`你`:`You`),T=[...w][0]?.toLocaleUpperCase()??`Y`,t[37]=n.profile.callName,t[38]=r,t[39]=w,t[40]=T):(w=t[39],T=t[40]);let E=T;x=`space-y-5`;let D;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(`div`,{className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-accent/40 to-transparent`,"aria-hidden":`true`}),t[41]=D):D=t[41];let O;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(S,{className:`size-3.5`}),t[42]=O):O=t[42];let k;t[43]===i.portraitEyebrow?k=t[44]:(k=(0,$.jsxs)(`div`,{className:`mb-7 flex items-center gap-2 text-[11px] font-semibold tracking-[0.18em] text-accent`,children:[O,i.portraitEyebrow]}),t[43]=i.portraitEyebrow,t[44]=k);let A;t[45]===E?A=t[46]:(A=(0,$.jsx)(`div`,{className:`flex size-16 shrink-0 items-center justify-center rounded-2xl border border-edge bg-surface-muted text-2xl font-semibold text-fg sm:size-20 sm:text-3xl`,children:E}),t[45]=E,t[46]=A);let j;t[47]===w?j=t[48]:(j=(0,$.jsx)(`h2`,{className:`truncate text-2xl font-semibold tracking-tight text-fg sm:text-3xl`,children:w}),t[47]=w,t[48]=j);let M;t[49]===Symbol.for(`react.memo_cache_sentinel`)?(M=()=>l(!0),t[49]=M):M=t[49];let N;t[50]!==n.profile.role||t[51]!==i.roleMissing?(N=n.profile.role.trim()||i.roleMissing,t[50]=n.profile.role,t[51]=i.roleMissing,t[52]=N):N=t[52];let P;t[53]===N?P=t[54]:(P=(0,$.jsx)(`button`,{className:`mt-1 text-left text-sm text-fg-muted transition-colors hover:text-accent`,onClick:M,children:N}),t[53]=N,t[54]=P);let I;t[55]!==j||t[56]!==P?(I=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[j,P]}),t[55]=j,t[56]=P,t[57]=I):I=t[57];let L;t[58]!==A||t[59]!==I?(L=(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[A,I]}),t[58]=A,t[59]=I,t[60]=L):L=t[60];let R;t[61]===i.portraitIntro?R=t[62]:(R=(0,$.jsx)(`p`,{className:`mt-7 max-w-2xl text-base leading-7 text-fg-muted`,children:i.portraitIntro}),t[61]=i.portraitIntro,t[62]=R);let z;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-success`}),t[63]=z):z=t[63];let B;t[64]===i.maintainedTogether?B=t[65]:(B=(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[z,i.maintainedTogether]}),t[64]=i.maintainedTogether,t[65]=B);let V,H;t[66]===Symbol.for(`react.memo_cache_sentinel`)?(V=()=>d(!0),H=(0,$.jsx)(ee,{className:`size-3.5`}),t[66]=V,t[67]=H):(V=t[66],H=t[67]);let U;t[68]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),t[68]=U):U=t[68];let J;t[69]===i.advanced?J=t[70]:(J=(0,$.jsx)(`span`,{className:`font-medium text-accent`,children:i.advanced}),t[69]=i.advanced,t[70]=J);let Y;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,$.jsx)(te,{className:`size-3`}),t[71]=Y):Y=t[71];let X;t[72]!==i.youDecide||t[73]!==J?(X=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1.5 rounded-md transition-colors hover:text-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,onClick:V,children:[H,i.youDecide,U,J,Y]}),t[72]=i.youDecide,t[73]=J,t[74]=X):X=t[74];let ne;t[75]!==B||t[76]!==X?(ne=(0,$.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center gap-x-5 gap-y-2 text-xs text-fg-subtle`,children:[B,X]}),t[75]=B,t[76]=X,t[77]=ne):ne=t[77];let re;t[78]!==k||t[79]!==L||t[80]!==R||t[81]!==ne?(re=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[k,L,R,ne]}),t[78]=k,t[79]=L,t[80]=R,t[81]=ne,t[82]=re):re=t[82];let ie;t[83]===i.direction?ie=t[84]:(ie=(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.12em] text-fg-subtle`,children:i.direction}),t[83]=i.direction,t[84]=ie);let ae=`mt-4 text-base leading-7 ${n.profile.primaryGoal.trim()?`text-fg`:`text-fg-muted`}`,oe;t[85]!==n.profile.primaryGoal||t[86]!==i.directionEmpty?(oe=n.profile.primaryGoal.trim()||i.directionEmpty,t[85]=n.profile.primaryGoal,t[86]=i.directionEmpty,t[87]=oe):oe=t[87];let se;t[88]!==ae||t[89]!==oe?(se=(0,$.jsx)(`p`,{className:ae,children:oe}),t[88]=ae,t[89]=oe,t[90]=se):se=t[90];let ce;t[91]!==ie||t[92]!==se?(ce=(0,$.jsxs)(`div`,{children:[ie,se]}),t[91]=ie,t[92]=se,t[93]=ce):ce=t[93];let le;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(le=(0,$.jsx)(W,{className:`size-4`}),t[94]=le):le=t[94];let ue;t[95]===i.talkAboutMe?ue=t[96]:(ue=(0,$.jsx)(f,{variant:`primary`,asChild:!0,children:(0,$.jsxs)(a,{to:`/chat/new`,children:[le,i.talkAboutMe]})}),t[95]=i.talkAboutMe,t[96]=ue);let de,fe;t[97]===Symbol.for(`react.memo_cache_sentinel`)?(de=()=>l(!0),fe=(0,$.jsx)(F,{className:`size-4`}),t[97]=de,t[98]=fe):(de=t[97],fe=t[98]);let pe;t[99]===i.editProfile?pe=t[100]:(pe=(0,$.jsxs)(f,{onClick:de,children:[fe,i.editProfile]}),t[99]=i.editProfile,t[100]=pe);let Z;t[101]!==ue||t[102]!==pe?(Z=(0,$.jsxs)(`div`,{className:`mt-8 flex flex-wrap gap-2`,children:[ue,pe]}),t[101]=ue,t[102]=pe,t[103]=Z):Z=t[103];let Q;t[104]!==ce||t[105]!==Z?(Q=(0,$.jsxs)(`div`,{className:`flex flex-col justify-between rounded-2xl border border-edge bg-surface-base/70 p-5 sm:p-6`,children:[ce,Z]}),t[104]=ce,t[105]=Z,t[106]=Q):Q=t[106],t[107]!==re||t[108]!==Q?(C=(0,$.jsxs)(`section`,{className:`relative overflow-hidden rounded-3xl border border-edge bg-surface-panel`,children:[D,(0,$.jsxs)(`div`,{className:`grid gap-8 px-5 py-7 sm:px-8 sm:py-9 lg:grid-cols-[minmax(0,1fr)_20rem] lg:gap-12 lg:px-10 lg:py-11`,children:[re,Q]})]}),t[107]=re,t[108]=Q,t[109]=C):C=t[109],y=`grid gap-5 lg:grid-cols-2`;let me;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsx)(K,{className:`size-4`}),t[110]=me):me=t[110];let he;t[111]===o?he=t[112]:(he=()=>o(`understanding`),t[111]=o,t[112]=he);let ge;t[113]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,$.jsx)(te,{className:`size-3.5`}),t[113]=ge):ge=t[113];let ye;t[114]!==i.seeAll||t[115]!==he?(ye=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:he,children:[i.seeAll,ge]}),t[114]=i.seeAll,t[115]=he,t[116]=ye):ye=t[116];let be;t[117]!==o||t[118]!==c.length||t[119]!==i.reviewWaiting?(be=c.length?(0,$.jsxs)(`button`,{className:`mb-4 flex w-full items-center justify-between rounded-xl border border-accent/20 bg-accent-soft px-3 py-2.5 text-left text-xs text-accent transition-colors hover:border-accent/40`,onClick:()=>o(`understanding`),children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(S,{className:`mr-1.5 inline size-3.5`}),c.length,` `,i.reviewWaiting]}),(0,$.jsx)(G,{className:`size-3.5`})]}):null,t[117]=o,t[118]=c.length,t[119]=i.reviewWaiting,t[120]=be):be=t[120];let xe=e.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:e.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`group flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-accent/70`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:_e[e.kind][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstUnderstanding});t[121]!==i.portraitUnderstanding||t[122]!==i.portraitUnderstandingHint||t[123]!==ye||t[124]!==be||t[125]!==xe?(b=(0,$.jsxs)(Pe,{icon:me,title:i.portraitUnderstanding,description:i.portraitUnderstandingHint,action:ye,children:[be,xe]}),t[121]=i.portraitUnderstanding,t[122]=i.portraitUnderstandingHint,t[123]=ye,t[124]=be,t[125]=xe,t[126]=b):b=t[126],p=Pe,t[127]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,$.jsx)(q,{className:`size-4`}),t[127]=m):m=t[127],h=i.portraitRules,g=i.portraitRulesHint;let Se;t[128]===o?Se=t[129]:(Se=()=>o(`collaboration`),t[128]=o,t[129]=Se);let Ce;t[130]===Symbol.for(`react.memo_cache_sentinel`)?(Ce=(0,$.jsx)(te,{className:`size-3.5`}),t[130]=Ce):Ce=t[130],t[131]!==i.seeAll||t[132]!==Se?(_=(0,$.jsxs)(`button`,{className:`inline-flex items-center gap-1 text-xs font-medium text-accent hover:underline`,onClick:Se,children:[i.seeAll,Ce]}),t[131]=i.seeAll,t[132]=Se,t[133]=_):_=t[133],v=u.length?(0,$.jsx)(`div`,{className:`space-y-1`,children:u.slice(0,4).map(e=>(0,$.jsxs)(`div`,{className:`flex gap-3 rounded-xl px-2 py-2.5 transition-colors hover:bg-surface-hover`,children:[(0,$.jsx)(`span`,{className:`mt-2 size-1.5 shrink-0 rounded-full bg-fg-subtle`}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-0.5 text-[11px] text-fg-subtle`,children:ve[e.category][r]})]})]},e.id))}):(0,$.jsx)(`p`,{className:`py-5 text-sm leading-6 text-fg-muted`,children:i.addFirstRule}),t[0]=n.profile.callName,t[1]=n.profile.primaryGoal,t[2]=n.profile.role,t[3]=n.rules,t[4]=n.understandings,t[5]=r,t[6]=o,t[7]=i.addFirstRule,t[8]=i.addFirstUnderstanding,t[9]=i.advanced,t[10]=i.direction,t[11]=i.directionEmpty,t[12]=i.editProfile,t[13]=i.maintainedTogether,t[14]=i.portraitEyebrow,t[15]=i.portraitIntro,t[16]=i.portraitRules,t[17]=i.portraitRulesHint,t[18]=i.portraitUnderstanding,t[19]=i.portraitUnderstandingHint,t[20]=i.reviewWaiting,t[21]=i.roleMissing,t[22]=i.seeAll,t[23]=i.talkAboutMe,t[24]=i.youDecide,t[25]=p,t[26]=m,t[27]=h,t[28]=g,t[29]=_,t[30]=v,t[31]=y,t[32]=b,t[33]=x,t[34]=C}else p=t[25],m=t[26],h=t[27],g=t[28],_=t[29],v=t[30],y=t[31],b=t[32],x=t[33],C=t[34];let w;t[134]!==p||t[135]!==m||t[136]!==h||t[137]!==g||t[138]!==_||t[139]!==v?(w=(0,$.jsx)(p,{icon:m,title:h,description:g,action:_,children:v}),t[134]=p,t[135]=m,t[136]=h,t[137]=g,t[138]=_,t[139]=v,t[140]=w):w=t[140];let T;t[141]!==w||t[142]!==y||t[143]!==b?(T=(0,$.jsxs)(`div`,{className:y,children:[b,w]}),t[141]=w,t[142]=y,t[143]=b,t[144]=T):T=t[144];let E;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(E=()=>d(!0),t[145]=E):E=t[145];let D;t[146]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:(0,$.jsx)(ae,{className:`size-4`})}),t[146]=D):D=t[146];let O;t[147]===i.portraitLearn?O=t[148]:(O=(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:i.portraitLearn}),t[147]=i.portraitLearn,t[148]=O);let k;t[149]===i.portraitControlHint?k=t[150]:(k=(0,$.jsx)(`span`,{className:`mt-0.5 block text-xs leading-5 text-fg-muted`,children:i.portraitControlHint}),t[149]=i.portraitControlHint,t[150]=k);let A;t[151]!==O||t[152]!==k?(A=(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[O,k]}),t[151]=O,t[152]=k,t[153]=A):A=t[153];let j;t[154]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(te,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`}),t[154]=j):j=t[154];let M;t[155]===A?M=t[156]:(M=(0,$.jsxs)(`button`,{className:`group flex w-full items-center gap-4 rounded-2xl border border-edge bg-surface-panel px-5 py-4 text-left transition-colors hover:bg-surface-hover sm:px-6`,onClick:E,children:[D,A,j]}),t[155]=A,t[156]=M);let N;t[157]!==n.profile||t[158]!==c||t[159]!==r||t[160]!==s||t[161]!==i?(N=(0,$.jsx)(Ie,{open:c,onOpenChange:l,profile:n.profile,language:r,t:i,onChanged:s}),t[157]=n.profile,t[158]=c,t[159]=r,t[160]=s,t[161]=i,t[162]=N):N=t[162];let P;t[163]===o?P=t[164]:(P=e=>{d(!1),o(e)},t[163]=o,t[164]=P);let I;t[165]!==u||t[166]!==i||t[167]!==P?(I=(0,$.jsx)(Fe,{open:u,onOpenChange:d,t:i,onNavigate:P}),t[165]=u,t[166]=i,t[167]=P,t[168]=I):I=t[168];let L;return t[169]!==T||t[170]!==M||t[171]!==N||t[172]!==I||t[173]!==x||t[174]!==C?(L=(0,$.jsxs)(`div`,{className:x,children:[C,T,M,N,I]}),t[169]=T,t[170]=M,t[171]=N,t[172]=I,t[173]=x,t[174]=C,t[175]=L):L=t[175],L}function je(e){return e.status===`active`}function Me(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Ne(e){return e.status===`active`}function Pe(e){let t=(0,Z.c)(20),{icon:n,title:r,description:i,action:a,children:o}=e,s;t[0]===n?s=t[1]:(s=(0,$.jsx)(`span`,{className:`mt-0.5 flex size-8 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted`,children:n}),t[0]=n,t[1]=s);let c;t[2]===r?c=t[3]:(c=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r}),t[2]=r,t[3]=c);let l;t[4]!==a||t[5]!==c?(l=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[c,a]}),t[4]=a,t[5]=c,t[6]=l):l=t[6];let u;t[7]===i?u=t[8]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:i}),t[7]=i,t[8]=u);let d;t[9]!==l||t[10]!==u?(d=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11];let f;t[12]!==s||t[13]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[s,d]}),t[12]=s,t[13]=d,t[14]=f):f=t[14];let p;t[15]===o?p=t[16]:(p=(0,$.jsx)(`div`,{className:`mt-4 border-t border-edge pt-3`,children:o}),t[15]=o,t[16]=p);let m;return t[17]!==f||t[18]!==p?(m=(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge bg-surface-panel p-5 sm:p-6`,children:[f,p]}),t[17]=f,t[18]=p,t[19]=m):m=t[19],m}function Fe(e){let t=(0,Z.c)(47),{open:n,onOpenChange:r,t:i,onNavigate:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,$.jsx)(ie,{className:`size-4`}),t[0]=o):o=t[0];let s;t[1]!==i.controlSourcesHint||t[2]!==i.sources?(s={tab:`sources`,icon:o,label:i.sources,description:i.controlSourcesHint},t[1]=i.controlSourcesHint,t[2]=i.sources,t[3]=s):s=t[3];let c;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(z,{className:`size-4`}),t[4]=c):c=t[4];let l;t[5]!==i.controlReviewHint||t[6]!==i.dreaming?(l={tab:`dreaming`,icon:c,label:i.dreaming,description:i.controlReviewHint},t[5]=i.controlReviewHint,t[6]=i.dreaming,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,$.jsx)(ee,{className:`size-4`}),t[8]=u):u=t[8];let p;t[9]!==i.controlPrivacyHint||t[10]!==i.privacy?(p={tab:`privacy`,icon:u,label:i.privacy,description:i.controlPrivacyHint},t[9]=i.controlPrivacyHint,t[10]=i.privacy,t[11]=p):p=t[11];let x;t[12]!==s||t[13]!==l||t[14]!==p?(x=[s,l,p],t[12]=s,t[13]=l,t[14]=p,t[15]=x):x=t[15];let S=x,C;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[16]=C):C=t[16];let w;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(`div`,{className:`mb-3 flex size-9 items-center justify-center rounded-xl bg-accent-soft text-accent`,children:(0,$.jsx)(ae,{className:`size-4`})}),t[17]=w):w=t[17];let T;t[18]===i.portraitControl?T=t[19]:(T=(0,$.jsx)(y,{className:`text-lg font-semibold tracking-tight text-fg`,children:i.portraitControl}),t[18]=i.portraitControl,t[19]=T);let E;t[20]===i.portraitControlHint?E=t[21]:(E=(0,$.jsx)(h,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:i.portraitControlHint}),t[20]=i.portraitControlHint,t[21]=E);let D;t[22]!==T||t[23]!==E?(D=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[w,T,E]}),t[22]=T,t[23]=E,t[24]=D):D=t[24];let O;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(d,{className:`size-4`}),t[25]=O):O=t[25];let k;t[26]===i.cancel?k=t[27]:(k=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":i.cancel,children:O})}),t[26]=i.cancel,t[27]=k);let A;t[28]!==D||t[29]!==k?(A=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-5 sm:px-6 sm:py-6`,children:[D,k]}),t[28]=D,t[29]=k,t[30]=A):A=t[30];let j;t[31]!==S||t[32]!==a?(j=(0,$.jsx)(`div`,{className:`space-y-3`,children:S.map(e=>(0,$.jsxs)(`button`,{className:`group flex w-full items-start gap-4 rounded-2xl border border-edge bg-surface-base p-4 text-left transition-colors hover:border-edge-strong hover:bg-surface-hover`,onClick:()=>a(e.tab),children:[(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-surface-muted text-fg-muted transition-colors group-hover:text-accent`,children:e.icon}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.label}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.description})]}),(0,$.jsx)(te,{className:`mt-2.5 size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},e.tab))}),t[31]=S,t[32]=a,t[33]=j):j=t[33];let M;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(ee,{className:`mt-0.5 size-4 shrink-0 text-success`}),t[34]=M):M=t[34];let N;t[35]===i.controlTrust?N=t[36]:(N=(0,$.jsxs)(`div`,{className:`mt-6 flex gap-3 rounded-2xl bg-surface-muted p-4`,children:[M,(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:i.controlTrust})]}),t[35]=i.controlTrust,t[36]=N);let P;t[37]!==j||t[38]!==N?(P=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-4 sm:p-6`,children:[j,N]}),t[37]=j,t[38]=N,t[39]=P):P=t[39];let F;t[40]!==A||t[41]!==P?(F=(0,$.jsxs)(_,{children:[C,(0,$.jsx)(v,{className:`fixed inset-y-0 right-0 z-[90] h-full w-[min(30rem,100vw)] overflow-hidden border-l border-edge bg-surface-panel shadow-popover outline-none sm:rounded-l-2xl`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[A,P]})})]}),t[40]=A,t[41]=P,t[42]=F):F=t[42];let I;return t[43]!==r||t[44]!==n||t[45]!==F?(I=(0,$.jsx)(b,{open:n,onOpenChange:r,children:F}),t[43]=r,t[44]=n,t[45]=F,t[46]=I):I=t[46],I}function Ie(e){let t=(0,Z.c)(26),{open:n,onOpenChange:r,profile:i,language:a,t:o,onChanged:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(m,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),t[0]=c):c=t[0];let l;t[1]===o.editProfile?l=t[2]:(l=(0,$.jsx)(y,{className:`text-base font-semibold text-fg`,children:o.editProfile}),t[1]=o.editProfile,t[2]=l);let u;t[3]===o.profileHint?u=t[4]:(u=(0,$.jsx)(h,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:o.profileHint}),t[3]=o.profileHint,t[4]=u);let p;t[5]!==l||t[6]!==u?(p=(0,$.jsxs)(`div`,{children:[l,u]}),t[5]=l,t[6]=u,t[7]=p):p=t[7];let x;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(d,{className:`size-4`}),t[8]=x):x=t[8];let S;t[9]===o.cancel?S=t[10]:(S=(0,$.jsx)(g,{asChild:!0,children:(0,$.jsx)(f,{variant:`ghost`,className:`size-8 shrink-0 p-0`,"aria-label":o.cancel,children:x})}),t[9]=o.cancel,t[10]=S);let C;t[11]!==p||t[12]!==S?(C=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge px-5 py-4 sm:px-6`,children:[p,S]}),t[11]=p,t[12]=S,t[13]=C):C=t[13];let w;t[14]!==a||t[15]!==s||t[16]!==i||t[17]!==o?(w=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-5 sm:p-6`,children:(0,$.jsx)(Le,{profile:i,language:a,t:o,onChanged:s,bare:!0})}),t[14]=a,t[15]=s,t[16]=i,t[17]=o,t[18]=w):w=t[18];let T;t[19]!==C||t[20]!==w?(T=(0,$.jsxs)(_,{children:[c,(0,$.jsx)(v,{className:`fixed left-1/2 top-1/2 z-[90] h-[min(42rem,calc(100vh-2rem))] w-[min(44rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,children:(0,$.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[C,w]})})]}),t[19]=C,t[20]=w,t[21]=T):T=t[21];let E;return t[22]!==r||t[23]!==n||t[24]!==T?(E=(0,$.jsx)(b,{open:n,onOpenChange:r,children:T}),t[22]=r,t[23]=n,t[24]=T,t[25]=E):E=t[25],E}function Le(e){let t=(0,Z.c)(80),{profile:n,language:r,t:i,onChanged:a,bare:o}=e,s=o===void 0?!1:o,c;t[0]===n?c=t[1]:(c=we(n),t[0]=n,t[1]=c);let l=c,[u,d]=Ce(l),p;t[2]===u?p=t[3]:(p=Se(u),t[2]=u,t[3]=p);let m;t[4]===l?m=t[5]:(m=Se(l),t[4]=l,t[5]=m);let h=p!==m,g;t[6]!==a||t[7]!==n?(g=async e=>{await a((await H({...e,accessibility:n.accessibility})).profile)},t[6]=a,t[7]=n,t[8]=g):g=t[8];let _;t[9]!==u||t[10]!==h||t[11]!==g?(_={value:u,dirty:h,delayMs:500,onSave:g},t[9]=u,t[10]=h,t[11]=g,t[12]=_):_=t[12];let v=le(_),y;t[13]!==u||t[14]!==d?(y=(e,t,n)=>(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:t}),(0,$.jsx)(`input`,{className:he,placeholder:n,value:u[e],onChange:t=>d(n=>({...n,[e]:t.target.value}))})]}),t[13]=u,t[14]=d,t[15]=y):y=t[15];let b=y,x=v.onBlurCapture,S;t[16]!==b||t[17]!==i.callName||t[18]!==i.callNamePlaceholder?(S=b(`callName`,i.callName,i.callNamePlaceholder),t[16]=b,t[17]=i.callName,t[18]=i.callNamePlaceholder,t[19]=S):S=t[19];let C;t[20]!==b||t[21]!==i.role||t[22]!==i.rolePlaceholder?(C=b(`role`,i.role,i.rolePlaceholder),t[20]=b,t[21]=i.role,t[22]=i.rolePlaceholder,t[23]=C):C=t[23];let w;t[24]===i.primaryGoal?w=t[25]:(w=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.primaryGoal}),t[24]=i.primaryGoal,t[25]=w);let T;t[26]===d?T=t[27]:(T=e=>d(t=>({...t,primaryGoal:e.target.value})),t[26]=d,t[27]=T);let E;t[28]!==u.primaryGoal||t[29]!==i.primaryGoalPlaceholder||t[30]!==T?(E=(0,$.jsx)(`textarea`,{className:he,rows:3,placeholder:i.primaryGoalPlaceholder,value:u.primaryGoal,onChange:T}),t[28]=u.primaryGoal,t[29]=i.primaryGoalPlaceholder,t[30]=T,t[31]=E):E=t[31];let D;t[32]!==w||t[33]!==E?(D=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[w,E]}),t[32]=w,t[33]=E,t[34]=D):D=t[34];let O;t[35]!==b||t[36]!==r||t[37]!==i.pronouns||t[38]!==i.pronounsPlaceholder?(O=r===`en`?b(`pronouns`,i.pronouns,i.pronounsPlaceholder):null,t[35]=b,t[36]=r,t[37]=i.pronouns,t[38]=i.pronounsPlaceholder,t[39]=O):O=t[39];let k;t[40]===i.timezone?k=t[41]:(k=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[40]=i.timezone,t[41]=k);let A;t[42]===d?A=t[43]:(A=e=>d(t=>({...t,timezone:e.target.value})),t[42]=d,t[43]=A);let j;t[44]!==u.timezone||t[45]!==A?(j=(0,$.jsx)(`input`,{className:`${he} min-w-0 flex-1`,value:u.timezone,onChange:A}),t[44]=u.timezone,t[45]=A,t[46]=j):j=t[46];let M;t[47]===d?M=t[48]:(M=()=>d(Re),t[47]=d,t[48]=M);let N;t[49]!==i.detect||t[50]!==M?(N=(0,$.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:M,children:i.detect}),t[49]=i.detect,t[50]=M,t[51]=N):N=t[51];let P;t[52]!==j||t[53]!==N?(P=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[j,N]}),t[52]=j,t[53]=N,t[54]=P):P=t[54];let F;t[55]!==k||t[56]!==P?(F=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[k,P]}),t[55]=k,t[56]=P,t[57]=F):F=t[57];let I;t[58]!==b||t[59]!==i.locale?(I=b(`locale`,i.locale),t[58]=b,t[59]=i.locale,t[60]=I):I=t[60];let L;t[61]!==S||t[62]!==C||t[63]!==D||t[64]!==O||t[65]!==F||t[66]!==I?(L=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[S,C,D,O,F,I]}),t[61]=S,t[62]=C,t[63]=D,t[64]=O,t[65]=F,t[66]=I,t[67]=L):L=t[67];let R;t[68]!==v.error||t[69]!==v.status?(R=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ce,{status:v.status,error:v.error})}),t[68]=v.error,t[69]=v.status,t[70]=R):R=t[70];let z;t[71]!==v.onBlurCapture||t[72]!==L||t[73]!==R?(z=(0,$.jsxs)(`div`,{onBlurCapture:x,children:[L,R]}),t[71]=v.onBlurCapture,t[72]=L,t[73]=R,t[74]=z):z=t[74];let B=z;if(s)return B;let V;t[75]===i.profileHint?V=t[76]:(V=(0,$.jsx)(`p`,{className:`mb-5 text-sm leading-6 text-fg-muted`,children:i.profileHint}),t[75]=i.profileHint,t[76]=V);let U;return t[77]!==B||t[78]!==V?(U=(0,$.jsxs)(ye,{children:[V,B]}),t[77]=B,t[78]=V,t[79]=U):U=t[79],U}function Re(e){return{...e,timezone:C()}}function ze(e){let t=(0,Z.c)(78),{items:n,quality:r,language:i,t:a,onChanged:c}=e,[l,d]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(``),[h,g]=(0,Q.useState)(`preference`),_;t[0]===n?_=t[1]:(_=n.filter(Ve),t[0]=n,t[1]=_);let v=_,y;t[2]===n?y=t[3]:(y=n.filter(Be),t[2]=n,t[3]=y);let b=y,x;t[4]!==h||t[5]!==c||t[6]!==p?(x=async e=>{e.preventDefault(),p.trim()&&(await D({statement:p,kind:h}),m(``),d(!1),await c())},t[4]=h,t[5]=c,t[6]=p,t[7]=x):x=t[7];let S=x,C;t[8]===a.understoodHint?C=t[9]:(C=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:a.understoodHint}),t[8]=a.understoodHint,t[9]=C);let w,T;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(w=()=>d(!0),T=(0,$.jsx)(u,{className:`size-4`}),t[10]=w,t[11]=T):(w=t[10],T=t[11]);let E;t[12]===a.addUnderstanding?E=t[13]:(E=(0,$.jsxs)(f,{variant:`primary`,onClick:w,children:[T,a.addUnderstanding]}),t[12]=a.addUnderstanding,t[13]=E);let O;t[14]!==C||t[15]!==E?(O=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[C,E]}),t[14]=C,t[15]=E,t[16]=O):O=t[16];let k=a.addUnderstanding,A=a.understoodHint,j=a.add,M=a.cancel,N;t[17]===p?N=t[18]:(N=p.trim(),t[17]=p,t[18]=N);let P=!N,F;t[19]===a.statement?F=t[20]:(F=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.statement}),t[19]=a.statement,t[20]=F);let I;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(I=e=>m(e.target.value),t[21]=I):I=t[21];let L;t[22]!==p||t[23]!==a.statement?(L=(0,$.jsx)(`textarea`,{autoFocus:!0,className:he,rows:4,placeholder:a.statement,value:p,onChange:I}),t[22]=p,t[23]=a.statement,t[24]=L):L=t[24];let R;t[25]!==F||t[26]!==L?(R=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[F,L]}),t[25]=F,t[26]=L,t[27]=R):R=t[27];let z;t[28]===a.kind?z=t[29]:(z=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:a.kind}),t[28]=a.kind,t[29]=z);let B,V;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(B=e=>g(e.target.value),V=Object.entries(_e),t[30]=B,t[31]=V):(B=t[30],V=t[31]);let H;t[32]===i?H=t[33]:(H=V.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[i]},t)}),t[32]=i,t[33]=H);let U;t[34]!==h||t[35]!==H?(U=(0,$.jsx)(o,{value:h,onChange:B,children:H}),t[34]=h,t[35]=H,t[36]=U):U=t[36];let W;t[37]!==z||t[38]!==U?(W=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[z,U]}),t[37]=z,t[38]=U,t[39]=W):W=t[39];let G;t[40]!==l||t[41]!==S||t[42]!==a.add||t[43]!==a.addUnderstanding||t[44]!==a.cancel||t[45]!==a.understoodHint||t[46]!==P||t[47]!==R||t[48]!==W?(G=(0,$.jsxs)(xe,{open:l,onOpenChange:d,title:k,description:A,submitLabel:j,cancelLabel:M,submitDisabled:P,onSubmit:S,children:[R,W]}),t[40]=l,t[41]=S,t[42]=a.add,t[43]=a.addUnderstanding,t[44]=a.cancel,t[45]=a.understoodHint,t[46]=P,t[47]=R,t[48]=W,t[49]=G):G=t[49];let K;t[50]!==r||t[51]!==a?(K=(0,$.jsx)(He,{quality:r,t:a}),t[50]=r,t[51]=a,t[52]=K):K=t[52];let q;t[53]===a?q=t[54]:(q=(0,$.jsx)(Ge,{t:a}),t[53]=a,t[54]=q);let ee;t[55]!==i||t[56]!==c||t[57]!==b||t[58]!==a?(ee=b.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.review,` · `,b.length]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:b.map(e=>(0,$.jsx)(We,{item:e,language:i,t:a,onChanged:c},e.id))})]}):null,t[55]=i,t[56]=c,t[57]=b,t[58]=a,t[59]=ee):ee=t[59];let J;t[60]!==v.length||t[61]!==a.active?(J=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[a.active,` · `,v.length]}),t[60]=v.length,t[61]=a.active,t[62]=J):J=t[62];let Y;t[63]!==v||t[64]!==i||t[65]!==c||t[66]!==a?(Y=v.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:v.map(e=>(0,$.jsx)(We,{item:e,language:i,t:a,onChanged:c},e.id))}):(0,$.jsx)(be,{children:a.emptyUnderstanding}),t[63]=v,t[64]=i,t[65]=c,t[66]=a,t[67]=Y):Y=t[67];let X;t[68]!==J||t[69]!==Y?(X=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[J,Y]}),t[68]=J,t[69]=Y,t[70]=X):X=t[70];let te;return t[71]!==G||t[72]!==K||t[73]!==q||t[74]!==ee||t[75]!==X||t[76]!==O?(te=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[O,G,K,q,ee,X]}),t[71]=G,t[72]=K,t[73]=q,t[74]=ee,t[75]=X,t[76]=O,t[77]=te):te=t[77],te}function Be(e){return[`candidate`,`needs_review`,`stale`].includes(e.status)}function Ve(e){return e.status===`active`}function He(e){let t=(0,Z.c)(46),{quality:n,t:r}=e,i;t[0]===r.qualityNoData?i=t[1]:(i=e=>e==null?r.qualityNoData:`${Math.round(e*100)}%`,t[0]=r.qualityNoData,t[1]=i);let a=i,o=r.qualityActive,s=String(n.records.active),c;t[2]!==r.qualityActive||t[3]!==s?(c=[o,s],t[2]=r.qualityActive,t[3]=s,t[4]=c):c=t[4];let l=r.qualityPending,u=String(n.records.candidate+n.records.needsReview),d;t[5]!==r.qualityPending||t[6]!==u?(d=[l,u],t[5]=r.qualityPending,t[6]=u,t[7]=d):d=t[7];let f=r.qualityAcceptance,p;t[8]!==n.decisions.acceptanceRate||t[9]!==a?(p=a(n.decisions.acceptanceRate),t[8]=n.decisions.acceptanceRate,t[9]=a,t[10]=p):p=t[10];let m;t[11]!==r.qualityAcceptance||t[12]!==p?(m=[f,p],t[11]=r.qualityAcceptance,t[12]=p,t[13]=m):m=t[13];let h=r.qualityRecall,g;t[14]!==n.recall.helpfulRate||t[15]!==a?(g=a(n.recall.helpfulRate),t[14]=n.recall.helpfulRate,t[15]=a,t[16]=g):g=t[16];let _;t[17]!==r.qualityRecall||t[18]!==g?(_=[h,g],t[17]=r.qualityRecall,t[18]=g,t[19]=_):_=t[19];let v=r.qualitySourceCoverage,y;t[20]!==n.quickUnderstanding.sourceCoverage||t[21]!==a?(y=a(n.quickUnderstanding.sourceCoverage),t[20]=n.quickUnderstanding.sourceCoverage,t[21]=a,t[22]=y):y=t[22];let b;t[23]!==r.qualitySourceCoverage||t[24]!==y?(b=[v,y],t[23]=r.qualitySourceCoverage,t[24]=y,t[25]=b):b=t[25];let x;t[26]!==n.quickUnderstanding.medianBootstrapDurationMs||t[27]!==r.qualityNoData?(x=n.quickUnderstanding.medianBootstrapDurationMs==null?r.qualityNoData:`${(n.quickUnderstanding.medianBootstrapDurationMs/1e3).toFixed(1)}s`,t[26]=n.quickUnderstanding.medianBootstrapDurationMs,t[27]=r.qualityNoData,t[28]=x):x=t[28];let S;t[29]!==r.qualityBootstrapTime||t[30]!==x?(S=[r.qualityBootstrapTime,x],t[29]=r.qualityBootstrapTime,t[30]=x,t[31]=S):S=t[31];let C;t[32]!==m||t[33]!==_||t[34]!==b||t[35]!==S||t[36]!==c||t[37]!==d?(C=[c,d,m,_,b,S],t[32]=m,t[33]=_,t[34]=b,t[35]=S,t[36]=c,t[37]=d,t[38]=C):C=t[38];let w=C,T;t[39]===r.qualityTitle?T=t[40]:(T=(0,$.jsx)(`h2`,{className:`text-xs font-medium text-fg-muted`,children:r.qualityTitle}),t[39]=r.qualityTitle,t[40]=T);let E;t[41]===w?E=t[42]:(E=w.map(Ue),t[41]=w,t[42]=E);let D;return t[43]!==T||t[44]!==E?(D=(0,$.jsxs)(`section`,{className:`flex flex-wrap items-center gap-x-5 gap-y-2 rounded-xl bg-surface-muted px-3 py-2.5`,children:[T,E]}),t[43]=T,t[44]=E,t[45]=D):D=t[45],D}function Ue(e){let[t,n]=e;return(0,$.jsxs)(`div`,{className:`flex items-baseline gap-1.5 text-xs`,children:[(0,$.jsx)(`span`,{className:`text-fg-subtle`,children:t}),(0,$.jsx)(`span`,{className:`font-semibold text-fg`,children:n})]},t)}function We(e){let t=(0,Z.c)(60),{item:n,language:r,t:i,onChanged:a}=e,[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),[u,d]=Ce(n.statement),p=u!==n.statement,m;t[0]===i.required?m=t[1]:(m=e=>e.trim()?null:i.required,t[0]=i.required,t[1]=m);let h;t[2]!==n.id||t[3]!==a?(h=async e=>{await a((await w(n.id,{statement:e})).understanding)},t[2]=n.id,t[3]=a,t[4]=h):h=t[4];let g;t[5]!==u||t[6]!==o||t[7]!==p||t[8]!==m||t[9]!==h?(g={value:u,dirty:p,enabled:o,delayMs:500,validate:m,onSave:h},t[5]=u,t[6]=o,t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let _=le(g),v;t[11]!==u||t[12]!==o||t[13]!==d?(v=o?(0,$.jsx)(`textarea`,{autoFocus:!0,className:he,value:u,onChange:e=>d(e.target.value),rows:3}):(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:u}),t[11]=u,t[12]=o,t[13]=d,t[14]=v):v=t[14];let y=_e[n.kind][r],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{children:y}),t[15]=y,t[16]=b);let x;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(`span`,{children:`·`}),t[17]=x):x=t[17];let S=n.explicitness===`explicit`?i.sourceExplicit:n.explicitness===`observed`?i.sourceObserved:i.sourceInferred,C;t[18]===S?C=t[19]:(C=(0,$.jsx)(`span`,{children:S}),t[18]=S,t[19]=C);let T;t[20]!==C||t[21]!==b?(T=(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[b,x,C]}),t[20]=C,t[21]=b,t[22]=T):T=t[22];let E;t[23]!==T||t[24]!==v?(E=(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[v,T]}),t[23]=T,t[24]=v,t[25]=E):E=t[25];let D;t[26]!==_||t[27]!==o||t[28]!==i.done||t[29]!==i.edit?(D=o?(0,$.jsx)(f,{variant:`ghost`,onClick:()=>{_.flush(),s(!1)},children:i.done}):(0,$.jsxs)(f,{variant:`ghost`,onClick:()=>s(!0),children:[(0,$.jsx)(O,{className:`size-3.5`}),i.edit]}),t[26]=_,t[27]=o,t[28]=i.done,t[29]=i.edit,t[30]=D):D=t[30];let k;t[31]!==n.id||t[32]!==n.status||t[33]!==a||t[34]!==i.confirm||t[35]!==i.reject?(k=n.status===`active`?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await a((await w(n.id,{status:`active`})).understanding)},children:i.confirm}),(0,$.jsx)(f,{onClick:async()=>{await a((await w(n.id,{status:`rejected`})).understanding)},children:i.reject})]}),t[31]=n.id,t[32]=n.status,t[33]=a,t[34]=i.confirm,t[35]=i.reject,t[36]=k):k=t[36];let A;t[37]!==c||t[38]!==n.id||t[39]!==a?(A=async()=>{if(!c){l(!0);return}await I(n.id),l(!1),await a()},t[37]=c,t[38]=n.id,t[39]=a,t[40]=A):A=t[40];let j;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(se,{className:`size-3.5`}),t[41]=j):j=t[41];let M=c?i.confirmDelete:i.delete,N;t[42]!==A||t[43]!==M?(N=(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:A,children:[j,M]}),t[42]=A,t[43]=M,t[44]=N):N=t[44];let P;t[45]!==D||t[46]!==k||t[47]!==N?(P=(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[D,k,N]}),t[45]=D,t[46]=k,t[47]=N,t[48]=P):P=t[48];let F;t[49]!==E||t[50]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-start sm:gap-4`,children:[E,P]}),t[49]=E,t[50]=P,t[51]=F):F=t[51];let L;t[52]!==_.error||t[53]!==_.status||t[54]!==o?(L=o||_.status!==`idle`?(0,$.jsx)(ce,{className:`mt-2`,status:_.status,error:_.error}):null,t[52]=_.error,t[53]=_.status,t[54]=o,t[55]=L):L=t[55];let R;return t[56]!==_.onBlurCapture||t[57]!==F||t[58]!==L?(R=(0,$.jsx)(`article`,{className:`px-4 py-3 sm:px-5`,children:(0,$.jsxs)(`div`,{onBlurCapture:_.onBlurCapture,children:[F,L]})}),t[56]=_.onBlurCapture,t[57]=F,t[58]=L,t[59]=R):R=t[59],R}function Ge(e){let t=(0,Z.c)(35),{t:n}=e,{data:r,error:i,isLoading:a,mutate:o}=x(`you-focuses`,k),[s,c]=(0,Q.useState)(null);if(a){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(X,{className:`h-40 rounded-2xl`}),t[0]=e):e=t[0],e}if(i){let e;return t[1]===n.error?e=t[2]:(e=(0,$.jsx)(be,{children:n.error}),t[1]=n.error,t[2]=e),e}let l;if(t[3]!==r||t[4]!==s||t[5]!==o||t[6]!==n.activate||t[7]!==n.complete||t[8]!==n.confidence||t[9]!==n.confidenceHigh||t[10]!==n.confidenceLow||t[11]!==n.confidenceMedium||t[12]!==n.confirmDelete||t[13]!==n.delete||t[14]!==n.focusActive||t[15]!==n.focusCandidate||t[16]!==n.focusCompleted||t[17]!==n.focusHint||t[18]!==n.focusPaused||t[19]!==n.focuses||t[20]!==n.noFocuses||t[21]!==n.pause||t[22]!==n.reject){let e=(r??[]).filter(Ke),i;t[24]!==n.focusActive||t[25]!==n.focusCandidate||t[26]!==n.focusCompleted||t[27]!==n.focusPaused?(i=e=>e===`candidate`?n.focusCandidate:e===`active`?n.focusActive:e===`paused`?n.focusPaused:n.focusCompleted,t[24]=n.focusActive,t[25]=n.focusCandidate,t[26]=n.focusCompleted,t[27]=n.focusPaused,t[28]=i):i=t[28];let a=i,u;t[29]!==n.confidenceHigh||t[30]!==n.confidenceLow||t[31]!==n.confidenceMedium?(u=e=>e>=.85?n.confidenceHigh:e>=.65?n.confidenceMedium:n.confidenceLow,t[29]=n.confidenceHigh,t[30]=n.confidenceLow,t[31]=n.confidenceMedium,t[32]=u):u=t[32];let d=u,p;t[33]===n.focusHint?p=t[34]:(p=(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.focusHint}),t[33]=n.focusHint,t[34]=p),l=(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[n.focuses,` · `,e.length]}),p]}),e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-[11px] text-fg-muted`,children:a(e.status)}),(0,$.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[n.confidence,` · `,d(e.confidence)]})]}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:e.summary})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap gap-1 sm:justify-end`,children:[e.status===`active`?(0,$.jsx)(f,{onClick:async()=>{await A(e.id,`paused`),await o()},children:n.pause}):(0,$.jsx)(f,{variant:`primary`,onClick:async()=>{await A(e.id,`active`),await o()},children:n.activate}),(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await A(e.id,`completed`),await o()},children:n.complete}),e.status===`candidate`?(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{await A(e.id,`rejected`),await o()},children:n.reject}):null,(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(s!==e.id){c(e.id);return}await Y(e.id),c(null),await o()},children:[(0,$.jsx)(se,{className:`size-3.5`}),s===e.id?n.confirmDelete:n.delete]})]})]},e.id))}):(0,$.jsx)(be,{children:n.noFocuses})]}),t[3]=r,t[4]=s,t[5]=o,t[6]=n.activate,t[7]=n.complete,t[8]=n.confidence,t[9]=n.confidenceHigh,t[10]=n.confidenceLow,t[11]=n.confidenceMedium,t[12]=n.confirmDelete,t[13]=n.delete,t[14]=n.focusActive,t[15]=n.focusCandidate,t[16]=n.focusCompleted,t[17]=n.focusHint,t[18]=n.focusPaused,t[19]=n.focuses,t[20]=n.noFocuses,t[21]=n.pause,t[22]=n.reject,t[23]=l}else l=t[23];return l}function Ke(e){return e.status!==`rejected`}function qe(e){let t=(0,Z.c)(80),{rules:n,language:r,t:i,onChanged:a}=e,[c,l]=(0,Q.useState)(!1),[d,p]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(`communication`),[g,_]=(0,Q.useState)(null),v,y,b,x,S,C;if(t[0]!==c||t[1]!==m||t[2]!==g||t[3]!==r||t[4]!==a||t[5]!==n||t[6]!==d||t[7]!==i.add||t[8]!==i.addRule||t[9]!==i.cancel||t[10]!==i.category||t[11]!==i.collaboration||t[12]!==i.confirmDelete||t[13]!==i.delete||t[14]!==i.disable||t[15]!==i.emptyRules||t[16]!==i.enable||t[17]!==i.ruleStatement||t[18]!==i.rulesHint){let e=n.filter(Je),w;t[25]!==m||t[26]!==a||t[27]!==d?(w=async e=>{e.preventDefault(),d.trim()&&(await V({statement:d,category:m}),p(``),l(!1),await a())},t[25]=m,t[26]=a,t[27]=d,t[28]=w):w=t[28];let T=w;x=`space-y-5`;let D;t[29]===i.rulesHint?D=t[30]:(D=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:i.rulesHint}),t[29]=i.rulesHint,t[30]=D);let O,k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>l(!0),O=(0,$.jsx)(u,{className:`size-4`}),t[31]=O,t[32]=k):(O=t[31],k=t[32]);let A;t[33]===i.addRule?A=t[34]:(A=(0,$.jsxs)(f,{variant:`primary`,onClick:k,children:[O,i.addRule]}),t[33]=i.addRule,t[34]=A),t[35]!==A||t[36]!==D?(S=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[D,A]}),t[35]=A,t[36]=D,t[37]=S):S=t[37];let j=i.addRule,M=i.rulesHint,N=i.add,P=i.cancel,F;t[38]===d?F=t[39]:(F=d.trim(),t[38]=d,t[39]=F);let I=!F,L;t[40]===i.ruleStatement?L=t[41]:(L=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.ruleStatement}),t[40]=i.ruleStatement,t[41]=L);let R;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(R=e=>p(e.target.value),t[42]=R):R=t[42];let z;t[43]!==d||t[44]!==i.ruleStatement?(z=(0,$.jsx)(`textarea`,{autoFocus:!0,className:he,rows:4,placeholder:i.ruleStatement,value:d,onChange:R}),t[43]=d,t[44]=i.ruleStatement,t[45]=z):z=t[45];let B;t[46]!==L||t[47]!==z?(B=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[L,z]}),t[46]=L,t[47]=z,t[48]=B):B=t[48];let H;t[49]===i.category?H=t[50]:(H=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.category}),t[49]=i.category,t[50]=H);let U,W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(U=e=>h(e.target.value),W=Object.entries(ve),t[51]=U,t[52]=W):(U=t[51],W=t[52]);let G;t[53]===r?G=t[54]:(G=W.map(e=>{let[t,n]=e;return(0,$.jsx)(s,{value:t,children:n[r]},t)}),t[53]=r,t[54]=G);let K;t[55]!==m||t[56]!==G?(K=(0,$.jsx)(o,{value:m,onChange:U,children:G}),t[55]=m,t[56]=G,t[57]=K):K=t[57];let q;t[58]!==H||t[59]!==K?(q=(0,$.jsxs)(`label`,{className:`block space-y-1.5 text-sm`,children:[H,K]}),t[58]=H,t[59]=K,t[60]=q):q=t[60],t[61]!==c||t[62]!==T||t[63]!==i.add||t[64]!==i.addRule||t[65]!==i.cancel||t[66]!==i.rulesHint||t[67]!==I||t[68]!==B||t[69]!==q?(C=(0,$.jsxs)(xe,{open:c,onOpenChange:l,title:j,description:M,submitLabel:N,cancelLabel:P,submitDisabled:I,onSubmit:T,children:[B,q]}),t[61]=c,t[62]=T,t[63]=i.add,t[64]=i.addRule,t[65]=i.cancel,t[66]=i.rulesHint,t[67]=I,t[68]=B,t[69]=q,t[70]=C):C=t[70],v=`space-y-2`,y=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[i.collaboration,` · `,e.length]}),b=e.length?(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:e.map(e=>(0,$.jsxs)(`article`,{className:`flex flex-col gap-2 px-4 py-3 sm:flex-row sm:items-start sm:gap-4 sm:px-5`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 ${e.status===`disabled`?`text-fg-subtle line-through`:`text-fg`}`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-2 text-[11px] text-fg-subtle`,children:[(0,$.jsx)(`span`,{children:ve[e.category][r]}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[`P`,e.priority]}),e.status===`disabled`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`span`,{children:i.disable})]}):null]})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-1 sm:justify-end`,children:[(0,$.jsx)(f,{variant:`ghost`,onClick:async()=>{await oe(e.id,{status:e.status===`active`?`disabled`:`active`}),await a()},children:e.status===`active`?i.disable:i.enable}),(0,$.jsxs)(f,{variant:`ghost`,className:`text-danger`,onClick:async()=>{if(g!==e.id){_(e.id);return}await E(e.id),_(null),await a()},children:[(0,$.jsx)(se,{className:`size-3.5`}),g===e.id?i.confirmDelete:i.delete]})]})]},e.id))}):(0,$.jsx)(be,{children:i.emptyRules}),t[0]=c,t[1]=m,t[2]=g,t[3]=r,t[4]=a,t[5]=n,t[6]=d,t[7]=i.add,t[8]=i.addRule,t[9]=i.cancel,t[10]=i.category,t[11]=i.collaboration,t[12]=i.confirmDelete,t[13]=i.delete,t[14]=i.disable,t[15]=i.emptyRules,t[16]=i.enable,t[17]=i.ruleStatement,t[18]=i.rulesHint,t[19]=v,t[20]=y,t[21]=b,t[22]=x,t[23]=S,t[24]=C}else v=t[19],y=t[20],b=t[21],x=t[22],S=t[23],C=t[24];let w;t[71]!==v||t[72]!==y||t[73]!==b?(w=(0,$.jsxs)(`section`,{className:v,children:[y,b]}),t[71]=v,t[72]=y,t[73]=b,t[74]=w):w=t[74];let T;return t[75]!==x||t[76]!==S||t[77]!==C||t[78]!==w?(T=(0,$.jsxs)(`div`,{className:x,children:[S,C,w]}),t[75]=x,t[76]=S,t[77]=C,t[78]=w,t[79]=T):T=t[79],T}function Je(e){return e.status!==`archived`}async function Ye(){let[e,t,n]=await Promise.all([N(),fe(),pe()]);return{grants:e,connectors:t,catalog:n}}function Xe({t:e}){let{data:t,error:n,isLoading:r,mutate:i}=x(`you-understanding-sources`,Ye),{data:o=[],mutate:s}=x(`you-connected-content-candidates`,J),[u,d]=(0,Q.useState)(null),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)([]),[_,v]=(0,Q.useState)(!1),[y,b]=(0,Q.useState)(null);if(r)return(0,$.jsx)(X,{className:`h-64 rounded-2xl`});if(n)return(0,$.jsxs)(be,{children:[e.error,` `,(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:()=>void i(),children:e.retry})]});let S=t?.grants??[],C=t?.connectors??[],w=new Map((t?.catalog??[]).map(e=>[e.id,e])),T=e=>{let t=e.displayName.trim().toLocaleLowerCase(),n=C.find(e=>e.displayName.trim().toLocaleLowerCase()===t);return n?w.get(n.connectorId):[...w.values()].find(n=>n.displayName.trim().toLocaleLowerCase()===t||e.sourceKey.toLocaleLowerCase().includes(n.id.toLocaleLowerCase()))},E=t=>`${e.actionFailed}: ${t instanceof Error?t.message:String(t)}`,D=async t=>{b(null),m(null),d({grantId:t.id,kind:`refresh`});try{await M(t.id),await i().catch(()=>void 0),b({tone:`success`,message:`${t.displayName}: ${e.refreshStarted}`})}catch(e){b({tone:`error`,message:E(e)})}finally{d(null)}},O=async t=>{if(p!==t.id){m(t.id),b(null);return}d({grantId:t.id,kind:`revoke`});try{await B(t.id),await i().catch(()=>void 0),m(null),b({tone:`success`,message:`${t.displayName}: ${e.revokeDone}`})}catch(e){b({tone:`error`,message:E(e)})}finally{d(null)}},k=async()=>{if(h.length){v(!0),b(null);try{let t=await j(h);t.result.failed.length?b({tone:`error`,message:t.result.failed.map(e=>e.error).join(`; `)}):b({tone:`success`,message:e.contentReadDone}),g([]),await s()}catch(e){b({tone:`error`,message:E(e)})}finally{v(!1)}}};return(0,$.jsxs)(`div`,{className:`space-y-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:e.sourcesHint}),(0,$.jsx)(f,{asChild:!0,variant:`primary`,children:(0,$.jsxs)(a,{to:`/connectors?understanding=1&returnTo=%2Fyou%3Ftab%3Dsources`,children:[e.manageSources,(0,$.jsx)(c,{className:`size-4`})]})})]}),y?(0,$.jsx)(`p`,{role:`status`,"aria-live":`polite`,className:`rounded-xl px-3 py-2 text-sm ${y.tone===`success`?`bg-success-soft text-success`:`bg-danger/10 text-danger`}`,children:y.message}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.authorizedSources,` · `,S.length]}),S.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:S.map(t=>{let n=T(t);return(0,$.jsxs)(`article`,{className:`flex min-h-28 items-start gap-3 rounded-2xl border border-edge bg-surface-panel p-4`,children:[n?(0,$.jsx)(de,{connector:n,size:`sm`}):(0,$.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-lg border border-edge bg-surface-base`,children:(0,$.jsx)(R,{className:`size-4 text-fg-muted`})}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs leading-5 text-fg-subtle`,children:[t.accessMode===`continuous`?e.continuous:e.once,` · `,t.processingPolicy===`local_only`?e.localOnly:t.retentionPolicy===`derived_only`?e.derivedOnly:t.retentionPolicy]}),t.lastCollectedAt?(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:new Date(t.lastCollectedAt).toLocaleString()}):null]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-1`,children:[t.accessMode===`continuous`?(0,$.jsx)(f,{variant:`ghost`,disabled:u!==null,"aria-busy":u?.grantId===t.id&&u.kind===`refresh`,onClick:()=>void D(t),children:u?.grantId===t.id&&u.kind===`refresh`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.refreshing]}):e.refresh}):null,(0,$.jsx)(f,{variant:`ghost`,className:`text-danger`,title:e.revokeHint,"aria-label":`${e.revoke}: ${t.displayName}`,disabled:u!==null,"aria-busy":u?.grantId===t.id&&u.kind===`revoke`,onClick:()=>void O(t),children:u?.grantId===t.id&&u.kind===`revoke`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.revoking]}):p===t.id?e.confirmRevoke:e.revoke})]})]},t.id)})}):(0,$.jsx)(be,{children:e.noSources})]}),o.length?(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:e.contentReadTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-xs leading-5 text-fg-muted`,children:e.contentReadHint})]}),(0,$.jsx)(f,{variant:`primary`,disabled:!h.length||_,onClick:()=>void k(),children:_?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(l,{className:`size-4 animate-spin`}),e.reading]}):`${e.readSelected} · ${h.length}`})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-2xl border border-edge bg-surface-panel`,children:o.map(e=>{let t=h.includes(e.sourceItemId),n=h.length>=5&&!t;return(0,$.jsxs)(`label`,{className:`flex items-center gap-3 px-4 py-3 ${n?`opacity-50`:`cursor-pointer hover:bg-surface-hover`}`,children:[(0,$.jsx)(`input`,{type:`checkbox`,className:`size-4 rounded border-edge accent-[var(--color-accent)]`,checked:t,disabled:n||_,onChange:t=>g(n=>t.target.checked?[...n,e.sourceItemId]:n.filter(t=>t!==e.sourceItemId))}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:e.title}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[e.toolkit===`gmail`?`Gmail`:`Google Drive`,e.occurredAt?` · ${new Date(e.occurredAt).toLocaleDateString()}`:``]})]})]},e.sourceItemId)})})]}):null,(0,$.jsxs)(`section`,{className:`space-y-2`,children:[(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[e.connectorsTitle,` · `,C.length]}),C.length?(0,$.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:C.map(t=>{let n=t.enabled&&(t.status===`connected`||t.connectionStatus===`connected`||t.authStatus===`connected`),r=w.get(t.connectorId);return(0,$.jsxs)(a,{to:`/connectors?tab=connected&instance=${encodeURIComponent(t.instanceId)}`,"aria-label":`${e.openConnector}: ${t.displayName}`,className:`group flex min-h-24 items-center gap-3 rounded-2xl border border-edge bg-surface-panel p-4 transition-colors hover:border-edge-strong hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,children:[(0,$.jsx)(de,{connector:r??{displayName:t.displayName}}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:t.displayName}),(0,$.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:t.connectorId})]}),(0,$.jsx)(`span`,{className:`shrink-0 rounded-full px-2 py-1 text-xs ${n?`bg-success-soft text-success`:`bg-warning-soft text-warning`}`,children:n?e.connected:e.unavailable}),(0,$.jsx)(te,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`})]},t.instanceId)})}):(0,$.jsx)(be,{children:e.noConnectors})]})]})}function Ze(e){let t=(0,Z.c)(112),{lastRun:n,t:r}=e,{data:i,error:a,isLoading:c,mutate:l}=x(`you-context-settings`,L),u=i?.dreaming??null,[d,p]=Ce(u),m;t[0]!==d||t[1]!==u?(m=d&&u&&Se(d)!==Se(u),t[0]=d,t[1]=u,t[2]=m):m=t[2];let h=!!m,g;t[3]===l?g=t[4]:(g=async e=>{await U({dreaming:e}),await l()},t[3]=l,t[4]=g);let _;t[5]!==d||t[6]!==h||t[7]!==g?(_={value:d,dirty:h,delayMs:500,onSave:g},t[5]=d,t[6]=h,t[7]=g,t[8]=_):_=t[8];let v=le(_);if(a){let e;t[9]===l?e=t[10]:(e=()=>void l(),t[9]=l,t[10]=e);let n;t[11]!==r.retry||t[12]!==e?(n=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:r.retry}),t[11]=r.retry,t[12]=e,t[13]=n):n=t[13];let i;return t[14]!==r.error||t[15]!==n?(i=(0,$.jsxs)(be,{children:[r.error,` `,n]}),t[14]=r.error,t[15]=n,t[16]=i):i=t[16],i}if(c||!d){let e;return t[17]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(X,{className:`h-72 rounded-2xl`}),t[17]=e):e=t[17],e}let y=n?.status===`completed`?r.runCompleted:n?.status===`failed`?r.runFailed:r.runRunning,b;t[18]===r.dreamingHint?b=t[19]:(b=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:r.dreamingHint}),t[18]=r.dreamingHint,t[19]=b);let S=v.onBlurCapture,w;t[20]===r.mode?w=t[21]:(w=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.mode}),t[20]=r.mode,t[21]=w);let T;t[22]===p?T=t[23]:(T=e=>p(t=>t&&{...t,mode:e.target.value}),t[22]=p,t[23]=T);let E;t[24]===r.on?E=t[25]:(E=(0,$.jsx)(s,{value:`review`,children:r.on}),t[24]=r.on,t[25]=E);let D;t[26]===r.off?D=t[27]:(D=(0,$.jsx)(s,{value:`off`,children:r.off}),t[26]=r.off,t[27]=D);let O;t[28]!==d.mode||t[29]!==D||t[30]!==T||t[31]!==E?(O=(0,$.jsxs)(o,{value:d.mode,onChange:T,children:[E,D]}),t[28]=d.mode,t[29]=D,t[30]=T,t[31]=E,t[32]=O):O=t[32];let k;t[33]!==O||t[34]!==w?(k=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[w,O]}),t[33]=O,t[34]=w,t[35]=k):k=t[35];let A;t[36]===r.reviewTime?A=t[37]:(A=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.reviewTime}),t[36]=r.reviewTime,t[37]=A);let j;t[38]===p?j=t[39]:(j=e=>p(t=>t&&{...t,schedule:{time:e.target.value}}),t[38]=p,t[39]=j);let M;t[40]!==d.schedule.time||t[41]!==j?(M=(0,$.jsx)(`input`,{type:`time`,className:he,value:d.schedule.time,onChange:j}),t[40]=d.schedule.time,t[41]=j,t[42]=M):M=t[42];let N;t[43]!==A||t[44]!==M?(N=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[A,M]}),t[43]=A,t[44]=M,t[45]=N):N=t[45];let P;t[46]===r.timezone?P=t[47]:(P=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.timezone}),t[46]=r.timezone,t[47]=P);let F=d.timezone??``,I;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(I=C(),t[48]=I):I=t[48];let R;t[49]===p?R=t[50]:(R=e=>p(t=>t&&{...t,timezone:e.target.value||void 0}),t[49]=p,t[50]=R);let z;t[51]!==F||t[52]!==R?(z=(0,$.jsx)(`input`,{className:`${he} min-w-0 flex-1`,value:F,placeholder:I,onChange:R}),t[51]=F,t[52]=R,t[53]=z):z=t[53];let B;t[54]===p?B=t[55]:(B=()=>p(Qe),t[54]=p,t[55]=B);let V;t[56]!==r.detect||t[57]!==B?(V=(0,$.jsx)(f,{className:`shrink-0 whitespace-nowrap`,onClick:B,children:r.detect}),t[56]=r.detect,t[57]=B,t[58]=V):V=t[58];let H;t[59]!==z||t[60]!==V?(H=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[z,V]}),t[59]=z,t[60]=V,t[61]=H):H=t[61];let W;t[62]!==P||t[63]!==H?(W=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm sm:col-span-2`,children:[P,H]}),t[62]=P,t[63]=H,t[64]=W):W=t[64];let G;t[65]===r.evidenceThreshold?G=t[66]:(G=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.evidenceThreshold}),t[65]=r.evidenceThreshold,t[66]=G);let K;t[67]===p?K=t[68]:(K=e=>p(t=>t&&{...t,minEvidenceSources:Number(e.target.value)}),t[67]=p,t[68]=K);let q;t[69]!==d.minEvidenceSources||t[70]!==K?(q=(0,$.jsx)(`input`,{type:`number`,min:2,max:10,className:he,value:d.minEvidenceSources,onChange:K}),t[69]=d.minEvidenceSources,t[70]=K,t[71]=q):q=t[71];let ee;t[72]!==G||t[73]!==q?(ee=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[G,q]}),t[72]=G,t[73]=q,t[74]=ee):ee=t[74];let J;t[75]===r.scanLimit?J=t[76]:(J=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:r.scanLimit}),t[75]=r.scanLimit,t[76]=J);let Y;t[77]===p?Y=t[78]:(Y=e=>p(t=>t&&{...t,limit:Number(e.target.value)}),t[77]=p,t[78]=Y);let te;t[79]!==d.limit||t[80]!==Y?(te=(0,$.jsx)(`input`,{type:`number`,min:1,max:2e3,className:he,value:d.limit,onChange:Y}),t[79]=d.limit,t[80]=Y,t[81]=te):te=t[81];let ne;t[82]!==J||t[83]!==te?(ne=(0,$.jsxs)(`label`,{className:`space-y-1.5 text-sm`,children:[J,te]}),t[82]=J,t[83]=te,t[84]=ne):ne=t[84];let re;t[85]!==k||t[86]!==N||t[87]!==W||t[88]!==ee||t[89]!==ne?(re=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[k,N,W,ee,ne]}),t[85]=k,t[86]=N,t[87]=W,t[88]=ee,t[89]=ne,t[90]=re):re=t[90];let ie;t[91]!==v.error||t[92]!==v.status?(ie=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ce,{status:v.status,error:v.error})}),t[91]=v.error,t[92]=v.status,t[93]=ie):ie=t[93];let ae;t[94]!==v.onBlurCapture||t[95]!==re||t[96]!==ie?(ae=(0,$.jsx)(ye,{children:(0,$.jsxs)(`div`,{onBlurCapture:S,children:[re,ie]})}),t[94]=v.onBlurCapture,t[95]=re,t[96]=ie,t[97]=ae):ae=t[97];let oe;t[98]===r.lastRun?oe=t[99]:(oe=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.lastRun}),t[98]=r.lastRun,t[99]=oe);let se;t[100]!==n||t[101]!==y||t[102]!==r.neverRun||t[103]!==r.runItems?(se=n?(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-sm text-fg-muted`,children:[(0,$.jsx)(`span`,{children:y}),(0,$.jsx)(`span`,{children:`·`}),(0,$.jsx)(`time`,{children:new Date(n.startedAt).toLocaleString()}),typeof n.metrics.scanned==`number`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{children:`·`}),(0,$.jsxs)(`span`,{children:[String(n.metrics.scanned),` `,r.runItems]})]}):null]}):(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:r.neverRun}),t[100]=n,t[101]=y,t[102]=r.neverRun,t[103]=r.runItems,t[104]=se):se=t[104];let ue;t[105]!==oe||t[106]!==se?(ue=(0,$.jsxs)(ye,{children:[oe,se]}),t[105]=oe,t[106]=se,t[107]=ue):ue=t[107];let de;return t[108]!==ae||t[109]!==ue||t[110]!==b?(de=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[b,ae,ue]}),t[108]=ae,t[109]=ue,t[110]=b,t[111]=de):de=t[111],de}function Qe(e){return e&&{...e,timezone:C()}}function $e(e){let t=(0,Z.c)(49),{t:n}=e,{data:r,error:i,isLoading:a,mutate:c}=x(`you-context-settings`,L),l=r?.privacy.sensitiveWritePolicy??null,[u,d]=Ce(l),f=!!(u&&l&&u!==l),p;t[0]===c?p=t[1]:(p=async e=>{await U({privacy:{sensitiveWritePolicy:e}}),await c()},t[0]=c,t[1]=p);let m;t[2]!==u||t[3]!==f||t[4]!==p?(m={value:u,dirty:f,delayMs:350,onSave:p},t[2]=u,t[3]=f,t[4]=p,t[5]=m):m=t[5];let h=le(m);if(i){let e;t[6]===c?e=t[7]:(e=()=>void c(),t[6]=c,t[7]=e);let r;t[8]!==n.retry||t[9]!==e?(r=(0,$.jsx)(`button`,{className:`text-accent hover:underline`,onClick:e,children:n.retry}),t[8]=n.retry,t[9]=e,t[10]=r):r=t[10];let i;return t[11]!==n.error||t[12]!==r?(i=(0,$.jsxs)(be,{children:[n.error,` `,r]}),t[11]=n.error,t[12]=r,t[13]=i):i=t[13],i}if(a||!u){let e;return t[14]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,$.jsx)(X,{className:`h-56 rounded-2xl`}),t[14]=e):e=t[14],e}let g;t[15]===n.privacyHint?g=t[16]:(g=(0,$.jsx)(`p`,{className:`max-w-2xl text-sm leading-6 text-fg-muted`,children:n.privacyHint}),t[15]=n.privacyHint,t[16]=g);let _;t[17]===n.sensitivePolicy?_=t[18]:(_=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:n.sensitivePolicy}),t[17]=n.sensitivePolicy,t[18]=_);let v;t[19]===d?v=t[20]:(v=e=>d(e.target.value),t[19]=d,t[20]=v);let y;t[21]===n.policyDeny?y=t[22]:(y=(0,$.jsx)(s,{value:`deny`,children:n.policyDeny}),t[21]=n.policyDeny,t[22]=y);let b;t[23]===n.policyConfirm?b=t[24]:(b=(0,$.jsx)(s,{value:`confirm`,children:n.policyConfirm}),t[23]=n.policyConfirm,t[24]=b);let S;t[25]===n.policyAllow?S=t[26]:(S=(0,$.jsx)(s,{value:`allow`,children:n.policyAllow}),t[25]=n.policyAllow,t[26]=S);let C;t[27]!==u||t[28]!==v||t[29]!==y||t[30]!==b||t[31]!==S?(C=(0,$.jsxs)(o,{value:u,onChange:v,children:[y,b,S]}),t[27]=u,t[28]=v,t[29]=y,t[30]=b,t[31]=S,t[32]=C):C=t[32];let w;t[33]!==C||t[34]!==_?(w=(0,$.jsxs)(`label`,{className:`block max-w-xl space-y-1.5 text-sm`,children:[_,C]}),t[33]=C,t[34]=_,t[35]=w):w=t[35];let T;t[36]===n.privacyWarning?T=t[37]:(T=(0,$.jsx)(`p`,{className:`mt-3 max-w-2xl text-xs leading-5 text-fg-subtle`,children:n.privacyWarning}),t[36]=n.privacyWarning,t[37]=T);let E;t[38]!==h.error||t[39]!==h.status?(E=(0,$.jsx)(`div`,{className:`mt-5 flex justify-end`,children:(0,$.jsx)(ce,{status:h.status,error:h.error})}),t[38]=h.error,t[39]=h.status,t[40]=E):E=t[40];let D;t[41]!==h.onBlurCapture||t[42]!==w||t[43]!==T||t[44]!==E?(D=(0,$.jsx)(ye,{children:(0,$.jsxs)(`div`,{onBlurCapture:h.onBlurCapture,children:[w,T,E]})}),t[41]=h.onBlurCapture,t[42]=w,t[43]=T,t[44]=E,t[45]=D):D=t[45];let O;return t[46]!==D||t[47]!==g?(O=(0,$.jsxs)(`div`,{className:`space-y-5`,children:[g,D]}),t[46]=D,t[47]=g,t[48]=O):O=t[48],O}export{Te as UserContextPage};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-aKtaBQYM.js";import{a as e,n as t,t as n}from"./vendor-react-BOUWij0V.js";import{t as r}from"./cn-JdwAhgNB.js";import{r as i,s as a}from"./locale-store-BIOMAhmR.js";import{n as o}from"./gateway-config-swr-l2w9ecXl.js";import{mo as s}from"./index-BIBAmAjw.js";e();var c=t();async function l(e,t){return(await a(i(`/api/voice/tts-voices?${new URLSearchParams({provider:e,model:t}).toString()}`))).payload?.voices??[]}function u(){return{enabled:!0,provider:`xopc-local`,providers:{"xopc-local":{model:`sensevoice-small`},alibaba:{model:`qwen-audio-3.0-asr-flash`},openai:{model:`gpt-4o-mini-transcribe`},groq:{model:`whisper-large-v3-turbo`}},fallback:{enabled:!1,order:[`xopc-local`]}}}function d(){return{enabled:!0,provider:`edge`,trigger:`inbound`,maxTextLength:512,timeoutMs:6e4,providers:{alibaba:{model:`qwen-tts`,voice:`Cherry`},openai:{model:`tts-1`,voice:`alloy`},edge:{voice:`zh-CN-XiaoxiaoNeural`,lang:`zh-CN`},minimax:{model:`speech-2.8-hd`,voice:`male-qn-qingse`},"tts-local-cli":{command:``,outputFormat:`wav`}}}}function f(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function p(e){return typeof e==`string`&&e.trim().length>0?e.trim():`xopc-local`}function m(e){let t=u();if(!f(e))return t;let n=p(e.provider),r=t.fallback??{enabled:!1,order:[`xopc-local`]};if(f(e.fallback)){let t=Array.isArray(e.fallback.order)?e.fallback.order.filter(e=>typeof e==`string`&&e.trim().length>0):r.order;r={enabled:typeof e.fallback.enabled==`boolean`?e.fallback.enabled:r.enabled,order:t.length?t:r.order}}let i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,providers:i,fallback:r}}function h(e){return typeof e==`string`&&e.trim().length>0?e.trim():`edge`}function g(e){let t=d();if(!f(e))return t;let n=h(e.provider),r=e.trigger===`off`||e.trigger===`always`||e.trigger===`inbound`||e.trigger===`tagged`?e.trigger:`inbound`,i={...t.providers??{},...f(e.providers)?Object.fromEntries(Object.entries(e.providers).map(([e,t])=>[e,f(t)?{...t}:{}])):{}};return{enabled:!!e.enabled,provider:n,trigger:r,maxTextLength:typeof e.maxTextLength==`number`&&Number.isFinite(e.maxTextLength)?e.maxTextLength:t.maxTextLength,timeoutMs:typeof e.timeoutMs==`number`&&Number.isFinite(e.timeoutMs)?e.timeoutMs:t.timeoutMs,providers:i}}function _(e){return{...e}}function v(e){return{...e}}function y(e){let t=f(e)?e:{},n=f(t.voice)?t.voice:{},r=f(n.input)?n.input:{},i=f(r.refinement)?r.refinement:{},a=i.mode===`punctuation`||i.mode===`light`||i.mode===`custom`?i.mode:`off`;return{stt:m(t.stt),tts:g(t.tts),voice:{languageMode:n.languageMode===`manual`?`manual`:`auto`,language:n.language===`zh`?`zh`:`en`,input:{refinement:{mode:a,...typeof i.model==`string`&&i.model.trim()?{model:i.model.trim()}:{},...typeof i.customInstruction==`string`?{customInstruction:i.customInstruction}:{}}}}}}async function b(){return y((await a(i(`/api/config`))).payload?.config??{})}async function x(e){await a(i(`/api/config`),{method:`PATCH`,body:JSON.stringify({stt:_(e.stt),tts:v(e.tts),voice:e.voice})}),e.voice.languageMode===`auto`&&await a(i(`/api/voice/language`),{method:`POST`,body:JSON.stringify({language:e.voice.language})}),typeof window<`u`&&window.dispatchEvent(new Event(`voice-config-changed`)),o()}async function S(){let e=await a(i(`/api/voice/models`));if(!e.payload?.models)throw Error(`Missing voice models payload`);return e.payload.models}async function C(){let e=await a(i(`/api/voice/providers`));if(!e.payload?.providers)throw Error(`Missing voice providers payload`);return e.payload}async function w(){let e=await a(i(`/api/voice/stt-providers`));if(!e.payload?.providers)throw Error(`Missing STT providers payload`);return e.payload}async function T(){let e=await a(i(`/api/voice/local/status`));if(!e.payload)throw Error(`Missing local voice status payload`);return e.payload}async function E(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}/install`),{method:`POST`,body:`{}`})}async function D(e){await a(i(`/api/voice/local/models/${encodeURIComponent(e)}`),{method:`DELETE`})}async function O(e){let t=await a(i(`/api/voice/tts-test`),{method:`POST`,body:JSON.stringify(e)});if(t.ok===!1){let e=typeof t.error==`string`?t.error:t.error?.message;throw Error(e||`TTS test failed`)}if(!t.payload||typeof t.payload.audio!=`string`||!t.payload.audio.trim())throw Error(`TTS test returned no audio. Check the selected voice engine and try again.`);return t.payload}async function k(e){let t=await a(i(`/api/voice/reveal-api-key`),{method:`POST`,body:JSON.stringify(e)});if(!t.payload)throw Error(`Missing reveal payload`);return t.payload}var A=n();function j(e){let t=(0,c.c)(15),{kind:n,providerId:i,fieldId:a,value:o,onChange:l,labels:u,placeholder:d,className:f}=e,p=d===void 0?`sk-...`:d,m;t[0]!==n||t[1]!==i?(m=()=>k({kind:n,provider:i}).then(M),t[0]=n,t[1]=i,t[2]=m):m=t[2];let h=m,g;t[3]===f?g=t[4]:(g=r(`flex min-w-0 flex-col gap-1.5`,f),t[3]=f,t[4]=g);let _;t[5]!==a||t[6]!==u||t[7]!==l||t[8]!==p||t[9]!==h||t[10]!==o?(_=(0,A.jsx)(s,{id:a,value:o,onChange:l,placeholder:p,labels:u,reveal:h,loadFailedLabel:u.loadFailed,maskedHelp:u.maskedHelp,notInConfigFile:u.notInConfigFile,inputClassName:`text-xs`}),t[5]=a,t[6]=u,t[7]=l,t[8]=p,t[9]=h,t[10]=o,t[11]=_):_=t[11];let v;return t[12]!==g||t[13]!==_?(v=(0,A.jsx)(`div`,{className:g,children:_}),t[12]=g,t[13]=_,t[14]=v):v=t[14],v}function M(e){return e.apiKey??null}export{C as a,E as c,D as d,O as f,S as i,y as l,T as n,b as o,l as r,w as s,j as t,x as u};