@xopcai/xopc 0.0.189 → 0.0.190

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 (347) hide show
  1. package/README.md +0 -3
  2. package/README.zh-CN.md +0 -3
  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-DTFKTPs8.js → activity-store-DstnJCS5.js} +1 -1
  6. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DqO25Qe5.js → agent-avatar-dicebear-9vAbkroX.js} +1 -1
  7. package/dist/gateway/static/root/assets/agents-D1t4SfMQ.js +68 -0
  8. package/dist/gateway/static/root/assets/{api-DWeXfwVU.js → api-BTL9kayv.js} +1 -1
  9. package/dist/gateway/static/root/assets/{app-management-settings-panel-BRpV8PXG.js → app-management-settings-panel-DkFeIdBf.js} +1 -1
  10. package/dist/gateway/static/root/assets/{appearance-settings-3ntKM9nQ.js → appearance-settings-Bxs8Fpaj.js} +1 -1
  11. package/dist/gateway/static/root/assets/apps-page-Cgrgu5OW.js +1 -0
  12. package/dist/gateway/static/root/assets/{archive-plugin-Df7Ycj_7.js → archive-plugin-Ch2RmLCC.js} +1 -1
  13. package/dist/gateway/static/root/assets/{attachment-load-UHgfZYtj.js → attachment-load-BhMQM_Ky.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-page-CtJxstKh.js +6 -0
  15. package/dist/gateway/static/root/assets/{binary-plugins-BJah99wE.js → binary-plugins-D6CqlymH.js} +1 -1
  16. package/dist/gateway/static/root/assets/{block-editor-DNlY5KqF.js → block-editor-ClL6HEg9.js} +48 -48
  17. package/dist/gateway/static/root/assets/browser-settings-page-DW99iDmD.js +8 -0
  18. package/dist/gateway/static/root/assets/{browser-workflow-inputs-vyUfdzAd.js → browser-workflow-inputs-BYy48VhN.js} +1 -1
  19. package/dist/gateway/static/root/assets/{browser-workflows-page-C1cKZjx-.js → browser-workflows-page-zgLibuMH.js} +2 -2
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-CHUrT9EB.js +7 -0
  21. package/dist/gateway/static/root/assets/capability-presets-api-BB8t4Ja7.js +1 -0
  22. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Cycrv0YV.js +1 -0
  23. package/dist/gateway/static/root/assets/{channel-recipient-api-BGG2kpJB.js → channel-recipient-api-BThDGiO3.js} +1 -1
  24. package/dist/gateway/static/root/assets/channels-settings-V96gPUAU.js +1 -0
  25. package/dist/gateway/static/root/assets/channels-status-swr-Cz7SAAkm.js +1 -0
  26. package/dist/gateway/static/root/assets/connectors-api-DS9ED-EL.js +1 -0
  27. package/dist/gateway/static/root/assets/connectors-page-BhlyQoQI.js +2 -0
  28. package/dist/gateway/static/root/assets/cron-expression-CkgsvhtW.js +2 -0
  29. package/dist/gateway/static/root/assets/{desktop-pet-BUuBEJuP.js → desktop-pet-Cv8rGhYW.js} +1 -1
  30. package/dist/gateway/static/root/assets/{desktop-pet-settings-BGfVIJM3.js → desktop-pet-settings-CIeJdwfV.js} +1 -1
  31. package/dist/gateway/static/root/assets/{directory-picker-path-field-DrQFfHH_.js → directory-picker-path-field-D8jXEiAY.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-debug-page-CEnIFOX-.js → extension-debug-page-CCZ9u6TZ.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-page-CCqHbexs.js → extension-page-CV36ILRG.js} +1 -1
  34. package/dist/gateway/static/root/assets/extension-settings-page-IyQrSILY.js +1 -0
  35. package/dist/gateway/static/root/assets/{gateway-config-api-CgUE2Ii1.js → gateway-config-api-D4_r5iJM.js} +1 -1
  36. package/dist/gateway/static/root/assets/gateway-settings-CYlntpBH.js +1 -0
  37. package/dist/gateway/static/root/assets/{gateway-startup-retry-DxhKNiCF.js → gateway-startup-retry-EO9mKvzE.js} +1 -1
  38. package/dist/gateway/static/root/assets/heartbeat-settings-D4SyWob8.js +1 -0
  39. package/dist/gateway/static/root/assets/home-page-B2Kagoh8.js +3 -0
  40. package/dist/gateway/static/root/assets/{image-generation-api-DCFdc-HD.js → image-generation-api-Bu7PyVSh.js} +1 -1
  41. package/dist/gateway/static/root/assets/index-CYT5DOzr.js +150 -0
  42. package/dist/gateway/static/root/assets/index-D6e3tPL-.css +1 -0
  43. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-Bf2VLtXW.js → keyboard-shortcuts-settings-BMhCuVBZ.js} +1 -1
  44. package/dist/gateway/static/root/assets/local-app-workbench-page-BHYbFjqy.js +2 -0
  45. package/dist/gateway/static/root/assets/{local-apps-page-Ca1RuI13.js → local-apps-page-ijIe7_y2.js} +1 -1
  46. package/dist/gateway/static/root/assets/locale-store-deR2zRaE.js +1 -0
  47. package/dist/gateway/static/root/assets/logs-page-IIn8Tess.js +2 -0
  48. package/dist/gateway/static/root/assets/{management-settings-B3Eop1zn.js → management-settings--V_fovKD.js} +1 -1
  49. package/dist/gateway/static/root/assets/{markdown-split-BGOYjgnM.js → markdown-split-Dt9-in6W.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-CT0txyM4.js → media-plugins-B3pj_iO0.js} +1 -1
  51. package/dist/gateway/static/root/assets/messages-B4XqB8I6.js +3 -0
  52. package/dist/gateway/static/root/assets/{notes-page-DfKgAe78.js → notes-page-DZ366lIT.js} +1 -1
  53. package/dist/gateway/static/root/assets/notes-workbench-S2sBVOLw.js +4 -0
  54. package/dist/gateway/static/root/assets/{page-tabs-DNrbCgmC.js → page-tabs-C5ge434C.js} +1 -1
  55. package/dist/gateway/static/root/assets/{preview-open-alternatives-BTqViDOR.js → preview-open-alternatives-BFa9DgSV.js} +1 -1
  56. package/dist/gateway/static/root/assets/{product-open-page-C_2L4_Iu.js → product-open-page-Dc9CcWdu.js} +1 -1
  57. package/dist/gateway/static/root/assets/project-detail-page-BilzoCJ7.js +1 -0
  58. package/dist/gateway/static/root/assets/projects-page-BoQUyacP.js +1 -0
  59. package/dist/gateway/static/root/assets/remote-access-hub-DUyUaCRF.js +1 -0
  60. package/dist/gateway/static/root/assets/{schema-form-BFLfkDGG.js → schema-form-B84DckWe.js} +1 -1
  61. package/dist/gateway/static/root/assets/sessions-page-Dzxlq1F0.js +1 -0
  62. package/dist/gateway/static/root/assets/settings-advanced-gate-TzwlZxU6.js +1 -0
  63. package/dist/gateway/static/root/assets/settings-form-section-Dp9itvdy.js +1 -0
  64. package/dist/gateway/static/root/assets/{settings-loading-skeleton-C9a-EbTZ.js → settings-loading-skeleton-CCtlhoy7.js} +1 -1
  65. package/dist/gateway/static/root/assets/{settings-page-DI9qDH5x.js → settings-page-DQmMKf8r.js} +1 -1
  66. package/dist/gateway/static/root/assets/{settings-page-layout-D-LWQdI5.js → settings-page-layout-EQIOJa_L.js} +1 -1
  67. package/dist/gateway/static/root/assets/{setup-status-panel-CJwmPvgs.js → setup-status-panel-Cwi-SPja.js} +1 -1
  68. package/dist/gateway/static/root/assets/{share-preview-page-BKSMG9r5.js → share-preview-page-C4_B2jvf.js} +1 -1
  69. package/dist/gateway/static/root/assets/shares-settings-CkyuGlZK.js +1 -0
  70. package/dist/gateway/static/root/assets/skill-reload-api-BJCePQK5.js +1 -0
  71. package/dist/gateway/static/root/assets/skills-page-BYWLfmJi.js +2 -0
  72. package/dist/gateway/static/root/assets/{skills-page.utils-zsz2HIlZ.js → skills-page.utils-Jhm24i4h.js} +1 -1
  73. package/dist/gateway/static/root/assets/{system-settings-panel-IWNDBI1O.js → system-settings-panel-Dpx2ags2.js} +1 -1
  74. package/dist/gateway/static/root/assets/{task-detail-page-CgtK02kP.js → task-detail-page-DLAdxI6e.js} +1 -1
  75. package/dist/gateway/static/root/assets/{theme-store-BkJe7UDo.js → theme-store-DnBOcGXi.js} +1 -1
  76. package/dist/gateway/static/root/assets/{typed-models-lib-C07LGthO.js → typed-models-lib-DULmTHUB.js} +1 -1
  77. package/dist/gateway/static/root/assets/use-autosave-BrjVk5VH.js +1 -0
  78. package/dist/gateway/static/root/assets/user-context-page-9AAFpGAL.js +1 -0
  79. package/dist/gateway/static/root/assets/{voice-api-key-field-Boue1D46.js → voice-api-key-field-BISTPfq_.js} +1 -1
  80. package/dist/gateway/static/root/assets/{work-discovery-overlay-bbmvCmc8.js → work-discovery-overlay-Wr-uF7VA.js} +1 -1
  81. package/dist/gateway/static/root/assets/work-discovery-page-BWds95sL.js +1 -0
  82. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DlHv-GZC.js → workflow-run-setup-panel-DHqHP8_6.js} +2 -2
  83. package/dist/gateway/static/root/assets/workflows-page-0b4_DFHr.js +11 -0
  84. package/dist/gateway/static/root/index.html +7 -7
  85. package/dist/package.js +1 -1
  86. package/dist/packages/gateway-contract/src/tool-activity.js +0 -36
  87. package/dist/packages/realtime-client/src/index.js +105 -48
  88. package/dist/packages/realtime-protocol/src/index.js +6 -1
  89. package/dist/src/agent/agent-manager.d.ts +0 -1
  90. package/dist/src/agent/agent-manager.js +6 -13
  91. package/dist/src/agent/background-review/coordinator.js +1 -1
  92. package/dist/src/agent/background-review/run-background-review.js +5 -7
  93. package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +0 -1
  94. package/dist/src/agent/bootstrap/bootstrap-cache.js +3 -4
  95. package/dist/src/agent/bootstrap/bootstrap-files.d.ts +0 -4
  96. package/dist/src/agent/bootstrap/bootstrap-files.js +3 -4
  97. package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -4
  98. package/dist/src/agent/bootstrap/load-bootstrap-files.d.ts +0 -1
  99. package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -14
  100. package/dist/src/agent/bootstrap/types.d.ts +1 -1
  101. package/dist/src/agent/context/workspace-templates/SOUL.md +1 -1
  102. package/dist/src/agent/memory/builtin-provider.d.ts +2 -4
  103. package/dist/src/agent/memory/builtin-provider.js +35 -15
  104. package/dist/src/agent/memory/context/types.d.ts +3 -1
  105. package/dist/src/agent/memory/create-memory-manager.js +2 -0
  106. package/dist/src/agent/memory/index.d.ts +1 -1
  107. package/dist/src/agent/memory/index.js +1 -1
  108. package/dist/src/agent/memory/manager.d.ts +9 -1
  109. package/dist/src/agent/memory/manager.js +39 -9
  110. package/dist/src/agent/memory/memory-config.d.ts +1 -1
  111. package/dist/src/agent/memory/memory-config.js +1 -1
  112. package/dist/src/agent/memory/source-origin.js +0 -2
  113. package/dist/src/agent/memory/types.d.ts +5 -1
  114. package/dist/src/agent/memory/understanding/service.d.ts +10 -10
  115. package/dist/src/agent/memory/understanding/service.js +108 -176
  116. package/dist/src/agent/memory/understanding/types.d.ts +7 -8
  117. package/dist/src/agent/memory/user-context-coordinator.d.ts +2 -1
  118. package/dist/src/agent/memory/user-context-coordinator.js +27 -41
  119. package/dist/src/agent/orchestration/agent-orchestrator.js +4 -7
  120. package/dist/src/agent/prompt/sections/memory-skills.js +4 -4
  121. package/dist/src/agent/prompt/sections/tooling.js +0 -10
  122. package/dist/src/agent/prompt/service-prompt-builder.d.ts +0 -1
  123. package/dist/src/agent/prompt/service-prompt-builder.js +4 -33
  124. package/dist/src/agent/prompt/system-prompt.js +1 -2
  125. package/dist/src/agent/service/direct-turn-helpers.js +1 -1
  126. package/dist/src/agent/service.d.ts +1 -2
  127. package/dist/src/agent/service.js +4 -17
  128. package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +1 -1
  129. package/dist/src/agent/tools/dreaming-tool.d.ts +0 -2
  130. package/dist/src/agent/tools/dreaming-tool.js +13 -38
  131. package/dist/src/agent/tools/factory.d.ts +0 -3
  132. package/dist/src/agent/tools/factory.js +1 -10
  133. package/dist/src/agent/tools/index.d.ts +0 -1
  134. package/dist/src/agent/tools/index.js +1 -2
  135. package/dist/src/agent/tools/memory-tool.js +1 -1
  136. package/dist/src/agent/workspace-runtime/registry.d.ts +3 -5
  137. package/dist/src/agent/workspace-runtime/registry.js +2 -15
  138. package/dist/src/agent-manifest/schema.d.ts +17 -17
  139. package/dist/src/agent-runtime/index.js +1 -1
  140. package/dist/src/agent-runtime/memory-runtime.d.ts +2 -2
  141. package/dist/src/agent-runtime/runtime-profile.js +1 -1
  142. package/dist/src/automations/domain/validation.d.ts +28 -28
  143. package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -3
  144. package/dist/src/chat-commands/builtins/understanding.js +2 -5
  145. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  146. package/dist/src/cli/commands/init.js +3 -22
  147. package/dist/src/cli/templates.js +1 -1
  148. package/dist/src/config/index.js +3 -3
  149. package/dist/src/config/paths.d.ts +0 -5
  150. package/dist/src/config/paths.js +2 -11
  151. package/dist/src/config/schema.d.ts +24 -117
  152. package/dist/src/config/schema.js +9 -39
  153. package/dist/src/connectors/learning-coordinator.js +75 -3
  154. package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
  155. package/dist/src/gateway/agent-builtin-tools.js +0 -5
  156. package/dist/src/gateway/agents-admin.d.ts +0 -7
  157. package/dist/src/gateway/agents-admin.js +3 -32
  158. package/dist/src/gateway/dreaming-automation-reconciler.d.ts +3 -3
  159. package/dist/src/gateway/dreaming-automation-reconciler.js +48 -88
  160. package/dist/src/gateway/hono/lib/config-payload.d.ts +19 -7
  161. package/dist/src/gateway/hono/lib/config-payload.js +3 -1
  162. package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
  163. package/dist/src/gateway/hono/oauth-async.js +17 -2
  164. package/dist/src/gateway/hono/routes/agents.js +1 -33
  165. package/dist/src/gateway/hono/routes/config-patch/misc.js +17 -1
  166. package/dist/src/gateway/hono/routes/connectors.js +13 -12
  167. package/dist/src/gateway/hono/routes/index.js +2 -2
  168. package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -5
  169. package/dist/src/gateway/hono/routes/status.js +0 -7
  170. package/dist/src/gateway/hono/routes/understanding-sources.d.ts +3 -0
  171. package/dist/src/gateway/hono/routes/understanding-sources.js +203 -0
  172. package/dist/src/gateway/hono/routes/work-discovery.d.ts +2 -0
  173. package/dist/src/gateway/hono/routes/work-discovery.js +3 -134
  174. package/dist/src/gateway/hono/routes/you.d.ts +0 -22
  175. package/dist/src/gateway/hono/routes/you.js +234 -1118
  176. package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
  177. package/dist/src/gateway/service/run-gateway-agent.js +2 -4
  178. package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
  179. package/dist/src/knowledge/connected-understanding-pipeline.d.ts +2 -4
  180. package/dist/src/knowledge/connected-understanding-pipeline.js +31 -81
  181. package/dist/src/knowledge/index.js +2 -2
  182. package/dist/src/knowledge/people-graph.d.ts +22 -25
  183. package/dist/src/knowledge/people-graph.js +76 -43
  184. package/dist/src/proactive/execution/context.js +8 -13
  185. package/dist/src/realtime/broker.d.ts +1 -0
  186. package/dist/src/realtime/broker.js +19 -2
  187. package/dist/src/realtime/runtime.js +6 -1
  188. package/dist/src/storage/sqlite/connector-account-repository.js +0 -1
  189. package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +37 -0
  190. package/dist/src/storage/sqlite/context-consolidation-repository.js +64 -0
  191. package/dist/src/storage/sqlite/fts.d.ts +2 -0
  192. package/dist/src/storage/sqlite/fts.js +29 -1
  193. package/dist/src/storage/sqlite/index.d.ts +4 -6
  194. package/dist/src/storage/sqlite/index.js +5 -7
  195. package/dist/src/storage/sqlite/knowledge-repository.d.ts +9 -2
  196. package/dist/src/storage/sqlite/knowledge-repository.js +58 -10
  197. package/dist/src/storage/sqlite/memory-records-repository.d.ts +7 -56
  198. package/dist/src/storage/sqlite/memory-records-repository.js +68 -218
  199. package/dist/src/storage/sqlite/migrations/113_memory_evidence_single_source.sql +54 -0
  200. package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +193 -0
  201. package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +6 -0
  202. package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +38 -0
  203. package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +110 -0
  204. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  205. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  206. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  207. package/dist/src/storage/sqlite/schema.js +1 -1
  208. package/dist/src/storage/sqlite/schema.sql +0 -20
  209. package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +34 -0
  210. package/dist/src/storage/sqlite/user-context-quality-repository.js +74 -0
  211. package/dist/src/storage/sqlite/user-context-repository.d.ts +64 -0
  212. package/dist/src/storage/sqlite/user-context-repository.js +383 -0
  213. package/dist/src/tui/tool-summary.js +1 -7
  214. package/dist/src/tui/tui-startup-resources.js +1 -2
  215. package/dist/src/user-context/config.d.ts +17 -210
  216. package/dist/src/user-context/config.js +19 -85
  217. package/dist/src/user-context/consolidation.d.ts +26 -0
  218. package/dist/src/user-context/consolidation.js +115 -0
  219. package/dist/src/user-context/domain.d.ts +75 -0
  220. package/dist/src/user-context/domain.js +4 -0
  221. package/dist/src/user-context/manual-understanding.d.ts +7 -14
  222. package/dist/src/user-context/manual-understanding.js +19 -54
  223. package/dist/src/{agent/memory/context → user-context}/planner.d.ts +5 -6
  224. package/dist/src/user-context/planner.js +311 -0
  225. package/dist/src/user-context/relationship-continuity.d.ts +3 -6
  226. package/dist/src/user-context/relationship-continuity.js +39 -32
  227. package/dist/src/user-context/sources/catalog.d.ts +2 -0
  228. package/dist/src/user-context/sources/catalog.js +149 -0
  229. package/dist/src/user-context/sources/index.d.ts +3 -0
  230. package/dist/src/user-context/sources/index.js +3 -0
  231. package/dist/src/user-context/sources/repository.d.ts +40 -0
  232. package/dist/src/user-context/sources/repository.js +164 -0
  233. package/dist/src/user-context/sources/types.d.ts +83 -0
  234. package/dist/src/work-discovery/analyzer.d.ts +4 -3
  235. package/dist/src/work-discovery/analyzer.js +21 -16
  236. package/dist/src/work-discovery/incremental-repository.js +42 -40
  237. package/dist/src/work-discovery/index.js +3 -3
  238. package/dist/src/work-discovery/service.d.ts +7 -7
  239. package/dist/src/work-discovery/service.js +241 -190
  240. package/dist/src/work-discovery/source-repository.js +42 -53
  241. package/dist/src/work-discovery/types.d.ts +2 -14
  242. package/package.json +3 -8
  243. package/dist/gateway/static/root/assets/agents-BvdqdER9.js +0 -2
  244. package/dist/gateway/static/root/assets/apps-page-nKLsfy6C.js +0 -1
  245. package/dist/gateway/static/root/assets/automations-page-Dh5bdZiN.js +0 -6
  246. package/dist/gateway/static/root/assets/browser-settings-page-CRJ_nAuh.js +0 -8
  247. package/dist/gateway/static/root/assets/capabilities-settings-panel-DeQR5BZt.js +0 -7
  248. package/dist/gateway/static/root/assets/capability-presets-api-D7tkhDMv.js +0 -1
  249. package/dist/gateway/static/root/assets/capability-presets-settings-panel-D7uK3q1p.js +0 -1
  250. package/dist/gateway/static/root/assets/channels-settings-Bw6Dniyq.js +0 -1
  251. package/dist/gateway/static/root/assets/channels-status-swr-BrUTz4uU.js +0 -1
  252. package/dist/gateway/static/root/assets/connector-logo-8YU53RUT.js +0 -1
  253. package/dist/gateway/static/root/assets/connectors-page-k9tMiOL5.js +0 -2
  254. package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +0 -2
  255. package/dist/gateway/static/root/assets/extension-settings-page-DEZw_7zN.js +0 -1
  256. package/dist/gateway/static/root/assets/gateway-settings-Dg8qCiIp.js +0 -1
  257. package/dist/gateway/static/root/assets/heartbeat-settings-27tRzDEo.js +0 -1
  258. package/dist/gateway/static/root/assets/home-page-VA511kMr.js +0 -3
  259. package/dist/gateway/static/root/assets/index-BvR-i-m6.js +0 -216
  260. package/dist/gateway/static/root/assets/index-zybP34zk.css +0 -1
  261. package/dist/gateway/static/root/assets/local-app-workbench-page-CaJq4-wV.js +0 -2
  262. package/dist/gateway/static/root/assets/locale-store-DUW5YE3R.js +0 -1
  263. package/dist/gateway/static/root/assets/logs-page-BLTCg69e.js +0 -2
  264. package/dist/gateway/static/root/assets/messages-CMjnbdbn.js +0 -3
  265. package/dist/gateway/static/root/assets/notes-workbench-Bp1w9UM1.js +0 -4
  266. package/dist/gateway/static/root/assets/project-detail-page-CZmbPDQN.js +0 -1
  267. package/dist/gateway/static/root/assets/projects-page-D5pzqfm5.js +0 -1
  268. package/dist/gateway/static/root/assets/remote-access-hub-CC-XhVGI.js +0 -1
  269. package/dist/gateway/static/root/assets/segmented-styles-BL8oLBEp.js +0 -1
  270. package/dist/gateway/static/root/assets/sessions-page-B2eTLVDV.js +0 -1
  271. package/dist/gateway/static/root/assets/settings-advanced-gate-CRuZ_bl0.js +0 -1
  272. package/dist/gateway/static/root/assets/settings-form-section-C4GXGeA4.js +0 -1
  273. package/dist/gateway/static/root/assets/shares-settings-YzSDS4G_.js +0 -1
  274. package/dist/gateway/static/root/assets/skill-reload-api-CwOo8zZk.js +0 -1
  275. package/dist/gateway/static/root/assets/skills-page-xd1cgSGN.js +0 -2
  276. package/dist/gateway/static/root/assets/time-picker-CstQ___Y.js +0 -1
  277. package/dist/gateway/static/root/assets/use-save-bar-registration-CQYE0l6z.js +0 -1
  278. package/dist/gateway/static/root/assets/user-context-page-BnQAWS_B.js +0 -1
  279. package/dist/gateway/static/root/assets/work-discovery-page-CAszL1y8.js +0 -1
  280. package/dist/gateway/static/root/assets/workflows-page-DxGzo3-x.js +0 -11
  281. package/dist/src/agent/code-intelligence/binary.d.ts +0 -15
  282. package/dist/src/agent/code-intelligence/binary.js +0 -372
  283. package/dist/src/agent/code-intelligence/index.d.ts +0 -4
  284. package/dist/src/agent/code-intelligence/index.js +0 -4
  285. package/dist/src/agent/code-intelligence/runtime.d.ts +0 -34
  286. package/dist/src/agent/code-intelligence/runtime.js +0 -280
  287. package/dist/src/agent/code-intelligence/tool-gating.d.ts +0 -5
  288. package/dist/src/agent/code-intelligence/tool-gating.js +0 -6
  289. package/dist/src/agent/code-intelligence/tools.d.ts +0 -6
  290. package/dist/src/agent/code-intelligence/tools.js +0 -266
  291. package/dist/src/agent/code-intelligence/types.d.ts +0 -22
  292. package/dist/src/agent/memory/context/planner.js +0 -286
  293. package/dist/src/agent/memory/dreaming/config.d.ts +0 -48
  294. package/dist/src/agent/memory/dreaming/config.js +0 -98
  295. package/dist/src/agent/memory/dreaming/constants.d.ts +0 -12
  296. package/dist/src/agent/memory/dreaming/constants.js +0 -18
  297. package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +0 -19
  298. package/dist/src/agent/memory/dreaming/deep-promotion.js +0 -152
  299. package/dist/src/agent/memory/dreaming/light-sweep.d.ts +0 -16
  300. package/dist/src/agent/memory/dreaming/light-sweep.js +0 -115
  301. package/dist/src/agent/memory/dreaming/preview.d.ts +0 -23
  302. package/dist/src/agent/memory/dreaming/preview.js +0 -52
  303. package/dist/src/agent/memory/dreaming/promotion-lifecycle.d.ts +0 -16
  304. package/dist/src/agent/memory/dreaming/promotion-lifecycle.js +0 -44
  305. package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +0 -19
  306. package/dist/src/agent/memory/dreaming/rem-patterns.js +0 -150
  307. package/dist/src/agent/memory/dreaming/runner.d.ts +0 -10
  308. package/dist/src/agent/memory/dreaming/runner.js +0 -78
  309. package/dist/src/agent/memory/dreaming/schedule.d.ts +0 -23
  310. package/dist/src/agent/memory/dreaming/schedule.js +0 -38
  311. package/dist/src/agent/memory/dreaming/scope.d.ts +0 -11
  312. package/dist/src/agent/memory/dreaming/scope.js +0 -33
  313. package/dist/src/agent/memory/dreaming/utils.d.ts +0 -3
  314. package/dist/src/agent/memory/dreaming/utils.js +0 -31
  315. package/dist/src/gateway/hono/routes/memory.d.ts +0 -3
  316. package/dist/src/gateway/hono/routes/memory.js +0 -460
  317. package/dist/src/storage/sqlite/dreaming-repository.d.ts +0 -61
  318. package/dist/src/storage/sqlite/dreaming-repository.js +0 -88
  319. package/dist/src/storage/sqlite/memory-readiness-repository.d.ts +0 -7
  320. package/dist/src/storage/sqlite/memory-readiness-repository.js +0 -30
  321. package/dist/src/storage/sqlite/memory-reference-consent-repository.d.ts +0 -27
  322. package/dist/src/storage/sqlite/memory-reference-consent-repository.js +0 -107
  323. package/dist/src/storage/sqlite/user-claims-repository.d.ts +0 -101
  324. package/dist/src/storage/sqlite/user-claims-repository.js +0 -241
  325. package/dist/src/storage/sqlite/user-profile-setup-repository.d.ts +0 -3
  326. package/dist/src/storage/sqlite/user-profile-setup-repository.js +0 -32
  327. package/dist/src/user-context/actionableInsights.d.ts +0 -14
  328. package/dist/src/user-context/actionableInsights.js +0 -34
  329. package/dist/src/user-context/context-compiler.d.ts +0 -27
  330. package/dist/src/user-context/context-compiler.js +0 -48
  331. package/dist/src/user-context/import.d.ts +0 -12
  332. package/dist/src/user-context/import.js +0 -51
  333. package/dist/src/user-context/memory-episode-evaluator.d.ts +0 -32
  334. package/dist/src/user-context/memory-episode-evaluator.js +0 -35
  335. package/dist/src/user-context/memory-readiness.d.ts +0 -33
  336. package/dist/src/user-context/memory-readiness.js +0 -41
  337. package/dist/src/user-context/memory-use-audit.d.ts +0 -10
  338. package/dist/src/user-context/memory-use-audit.js +0 -26
  339. package/dist/src/user-context/personal-playbook.d.ts +0 -11
  340. package/dist/src/user-context/personal-playbook.js +0 -41
  341. package/dist/src/user-context/profile.d.ts +0 -37
  342. package/dist/src/user-context/profile.js +0 -163
  343. package/dist/src/user-context/projection.d.ts +0 -120
  344. package/dist/src/user-context/projection.js +0 -262
  345. package/dist/src/user-context/source-recommendations.d.ts +0 -13
  346. package/dist/src/user-context/source-recommendations.js +0 -85
  347. /package/dist/src/{agent/code-intelligence → user-context/sources}/types.js +0 -0
@@ -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,f as o,l as s}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-CMjnbdbn.js";import{l as u,n as d}from"./locale-store-DUW5YE3R.js";import{t as f}from"./config-reload-event-Bjh2zoKp.js";import{$r as p,As as m,Bl as h,Bo as g,Go as _,Ho as v,Ji as y,Ki as b,Ko as x,Ks as S,Ns as C,Oc as w,Qc as T,Rl as E,Vo as D,Wo as O,_c as k,ca as A,du as j,hl as M,hu as N,mo as P,mu as F,nc as I,ns as L,po as R,pu as z,qs as B,ws as ee}from"./index-BvR-i-m6.js";import{t as V}from"./page-tabs-DNrbCgmC.js";import{t as H}from"./skill-reload-api-CwOo8zZk.js";import{a as U,c as W,d as te,f as G,g as K,h as q,i as ne,l as J,m as Y,n as X,o as re,p as ie,r as ae,s as oe,t as se,u as ce}from"./skills-page.utils-zsz2HIlZ.js";var le=n(),Z=e(t(),1),Q=r(),ue=(0,Z.memo)(function(e){let t=(0,le.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)(k,{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 f;t[6]===a?f=t[7]:(f=e=>a(e.target.value),t[6]=a,t[7]=f);let p=o===`marketplace`?s.marketplaceSearchPackages:s.searchPlaceholder,h;t[8]!==i||t[9]!==f||t[10]!==p?(h=(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:f,placeholder:p,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]=f,t[10]=p,t[11]=h):h=t[11];let g;t[12]!==l||t[13]!==c?(g=()=>{c(null),l(!0)},t[12]=l,t[13]=c,t[14]=g):g=t[14];let _;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,Q.jsx)(w,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[15]=_):_=t[15];let v;t[16]!==s.installCta||t[17]!==g?(v=(0,Q.jsxs)(m,{type:`button`,variant:`primary`,className:`shrink-0 gap-2`,onClick:g,children:[_,s.installCta]}),t[16]=s.installCta,t[17]=g,t[18]=v):v=t[18];let y;return t[19]!==u||t[20]!==h||t[21]!==v?(y=(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center justify-end gap-2`,children:[u,h,v]}),t[19]=u,t[20]=h,t[21]=v,t[22]=y):y=t[22],y}),de=`animate-pulse motion-reduce:animate-none rounded-md bg-surface-hover dark:bg-surface-active/50`;function fe(){let e=(0,le.c)(5),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(`div`,{className:c(`h-4 min-w-0 flex-1`,de)}),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:c(`size-8 shrink-0 rounded-lg`,de)}),(0,Q.jsx)(`div`,{className:c(`h-8 w-[4.5rem] shrink-0 rounded-lg`,de)})]})]}),r=(0,Q.jsx)(`div`,{className:c(`h-3 w-full`,de)}),i=(0,Q.jsx)(`div`,{className:c(`h-3 w-[92%]`,de)}),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:c(`h-3 w-full`,de)}),(0,Q.jsx)(`div`,{className:c(`h-2.5 w-4/5`,de)})]})]})})}),e[4]=a):a=e[4],a}function pe(){let e=(0,le.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Q.jsx)(fe,{}),e[0]=t):t=e[0],t}var me=new Set([`installed`,`marketplace`]),he=new Set([`all`,`builtin`,`installed`,`global`,`workspace`,`extra`]),ge=new Set([`all`,`enabled`,`disabled`]),_e=`mprov`,ve=[`s0`,`s1`,`s2`,`s3`,`s4`,`s5`],ye=[`business`,`creative`,`documents`,`engineering`,`tools`];function be(e){let t=(0,le.c)(27),{sk:n,loading:r,catalog:i,filteredCatalog:a,builtinCategories:o,builtinCategoryFilter:s,setBuiltinCategoryFilter:l,catalogDisplayRows:u,catalogStatusFilter:d,resolveSkillEnabled:f,categoryLabel:p,sourceLabel:h,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=ve.map(xe),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]!==p||t[10]!==l||t[11]!==n?(x=o.length>1?(0,Q.jsx)(V,{items:[{id:``,label:n.marketplaceCategoryAll},...o.map(e=>({id:e,label:p(e),title:p(e)}))],activeTab:s,onChange:l,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]=p,t[10]=l,t[11]=n,t[12]=x):x=t[12];let S;t[13]!==u||t[14]!==d||t[15]!==_||t[16]!==v||t[17]!==g||t[18]!==f||t[19]!==n||t[20]!==h||t[21]!==b||t[22]!==y?(S=u.length===0?(0,Q.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge py-16 text-center text-sm text-fg-muted`,children:d===`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:u.map(e=>{let t=f(e);return(0,Q.jsxs)(`article`,{className:c(`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.jsx)(`button`,{type:`button`,className:c(`flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,ee.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.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`h3`,{id:`catalog-skill-title-${e.directoryId}`,className:`min-w-0 flex-1 truncate text-[15px] font-semibold leading-snug tracking-tight text-fg`,children:e.name}),(0,Q.jsxs)(`span`,{className:c(`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[11px] 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)(j,{className:`size-3`,"aria-hidden":!0}):(0,Q.jsx)(z,{className:`size-3`,"aria-hidden":!0}),t?n.statusEnabled:n.statusDisabled]})]}),(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:h(e)}),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]})]})})}),(0,Q.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:t?(0,Q.jsx)(m,{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)(m,{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})})]},`${e.directoryId}-${e.path}`)})}),t[13]=u,t[14]=d,t[15]=_,t[16]=v,t[17]=g,t[18]=f,t[19]=n,t[20]=h,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 xe(e){return(0,Q.jsx)(pe,{},e)}function Se(e){let t=(0,le.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)(O,{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)(x,{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?X(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 h;t[13]!==n.cancel||t[14]!==p?(h=(0,Q.jsx)(m,{type:`button`,variant:`secondary`,onClick:p,children:n.cancel}),t[13]=n.cancel,t[14]=p,t[15]=h):h=t[15];let y;t[16]===s?y=t[17]:(y=()=>void s(),t[16]=s,t[17]=y);let b;t[18]!==n.deleteConfirm||t[19]!==y?(b=(0,Q.jsx)(m,{type:`button`,variant:`primary`,className:`bg-red-600 hover:bg-red-700`,onClick:y,children:n.deleteConfirm}),t[18]=n.deleteConfirm,t[19]=y,t[20]=b):b=t[20];let S;t[21]!==h||t[22]!==b?(S=(0,Q.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[h,b]}),t[21]=h,t[22]=b,t[23]=S):S=t[23];let C;t[24]!==S||t[25]!==u||t[26]!==f?(C=(0,Q.jsxs)(_,{children:[l,(0,Q.jsxs)(v,{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,S]})]}),t[24]=S,t[25]=u,t[26]=f,t[27]=C):C=t[27];let w;return t[28]!==r||t[29]!==c||t[30]!==C?(w=(0,Q.jsx)(g,{open:r,onOpenChange:c,children:C}),t[28]=r,t[29]=c,t[30]=C,t[31]=w):w=t[31],w}function Ce(e){let t=(0,le.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 we(e){let t=(0,le.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,l=s&&((s.bins?.length??0)>0||(s.env?.length??0)>0||(s.anyBins?.length??0)>0),u,d,f,p,m,h,g,_,v,b,x,S,C,w,T;if(t[0]!==a||t[1]!==l||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(De)??[],y=n.requiredEnvVarNames?.filter(Ee)??[];g=`space-y-6`,m=`skill-detail-summary-heading`,t[41]===r.detailSummaryHeading?h=t[42]:(h=(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]=h),v=`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=c(`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)(Ce,{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)(Ce,{label:r.detailPlatformsLabel,children:k}),t[62]=r.detailPlatformsLabel,t[63]=k,t[64]=w):w=t[64];let A;t[65]!==l||t[66]!==s||t[67]!==r.detailRequiresAnyBins||t[68]!==r.detailRequiresBins||t[69]!==r.detailRequiresEnv?(A=l&&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]=l,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)(Ce,{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(Te)}):null;t[74]!==r.detailInstallLabel||t[75]!==j?(f=(0,Q.jsx)(Ce,{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)(Ce,{label:r.detailToolGatingLabel,children:M}),t[84]=r.detailToolGatingLabel,t[85]=M,t[86]=p):p=t[86],u=Ce,d=r.detailEnvVarsLabel,_=y.length>0?(0,Q.jsx)(`span`,{className:`font-mono text-xs text-fg-muted`,children:y.join(`, `)}):null,t[0]=a,t[1]=l,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]=u,t[27]=d,t[28]=f,t[29]=p,t[30]=m,t[31]=h,t[32]=g,t[33]=_,t[34]=v,t[35]=b,t[36]=x,t[37]=S,t[38]=C,t[39]=w,t[40]=T}else u=t[26],d=t[27],f=t[28],p=t[29],m=t[30],h=t[31],g=t[32],_=t[33],v=t[34],b=t[35],x=t[36],S=t[37],C=t[38],w=t[39],T=t[40];let E;t[87]!==u||t[88]!==d||t[89]!==_?(E=(0,Q.jsx)(u,{label:d,children:_}),t[87]=u,t[88]=d,t[89]=_,t[90]=E):E=t[90];let D;t[91]!==f||t[92]!==p||t[93]!==E||t[94]!==v||t[95]!==b||t[96]!==x||t[97]!==S||t[98]!==C||t[99]!==w||t[100]!==T?(D=(0,Q.jsxs)(`div`,{className:v,children:[b,x,S,C,w,T,f,p,E]}),t[91]=f,t[92]=p,t[93]=E,t[94]=v,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]!==m||t[103]!==h||t[104]!==D?(O=(0,Q.jsxs)(`section`,{"aria-labelledby":m,children:[h,D]}),t[102]=m,t[103]=h,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)(y,{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]!==g||t[115]!==O||t[116]!==j?(M=(0,Q.jsxs)(`div`,{className:g,children:[O,j]}),t[114]=g,t[115]=O,t[116]=j,t[117]=M):M=t[117],M}function Te(e,t){return(0,Q.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:(0,Q.jsx)(`span`,{className:`text-fg`,children:se(e)})},e.id||`${e.kind}-${t}`)}function Ee(e){return e.trim()}function De(e){return e&&typeof e.kind==`string`}var Oe=[{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 ke(e){let t=(0,le.c)(81),{sk:n,detailOpen:r,setDetailOpen:i,detailSource:a,setDetailSource:o,detailTitle:s,setDetailTitle:l,detailCatalogPreview:u,setDetailCatalogPreview:d,detailMarketplacePreview:f,setDetailMarketplacePreview:p,detailLoading:y,detailError:b,setDetailError:w,detailEnabled:T,detailDirectoryId:E,detailManaged:k,detailExternalUrl:A,usingSkillInChatName:j,installingMarketName:N,togglingSkillName:P,isSkillInstalledByName:F,onUseSkillInChat:I,onMarketInstall:L,onSkillToggle:R,setConfirmId:z,setConfirmOpen:V}=e,H;t[0]!==d||t[1]!==w||t[2]!==p||t[3]!==i||t[4]!==o||t[5]!==l?(H=e=>{i(e),e||(o(`catalog`),d(null),p(null),w(null),l(``))},t[0]=d,t[1]=w,t[2]=p,t[3]=i,t[4]=o,t[5]=l,t[6]=H):H=t[6];let U;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,Q.jsx)(O,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[7]=U):U=t[7];let W;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(W=c(`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]=W):W=t[8];let te=s||`?`,G;t[9]===te?G=t[10]:(G=(0,Q.jsx)(re,{name:te}),t[9]=te,t[10]=G);let K=s||`—`,q;t[11]===K?q=t[12]:(q=(0,Q.jsx)(x,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:K}),t[11]=K,t[12]=q);let ne;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(ne=c(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ee.focusRingPanel),t[13]=ne):ne=t[13];let J;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,Q.jsx)(C,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[14]=J):J=t[14];let Y;t[15]===n.detailCloseAria?Y=t[16]:(Y=(0,Q.jsx)(D,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:ne,"aria-label":n.detailCloseAria,children:J})}),t[15]=n.detailCloseAria,t[16]=Y);let X;t[17]!==G||t[18]!==q||t[19]!==Y?(X=(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:[G,q,Y]}),t[17]=G,t[18]=q,t[19]=Y,t[20]=X):X=t[20];let ie;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,Q.jsx)(M,{className:`mt-0.5 size-4 shrink-0 text-blue-600 dark:text-blue-400`,strokeWidth:1.75,"aria-hidden":!0}),t[21]=ie):ie=t[21];let ae=a===`store`&&f?n.detailModalBanner:a===`store`?n.detailModalBannerStore:n.detailModalBanner,oe;t[22]===ae?oe=t[23]:(oe=(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:[ie,(0,Q.jsx)(`p`,{className:`min-w-0 leading-relaxed`,children:ae})]}),t[22]=ae,t[23]=oe);let se;t[24]!==u||t[25]!==T||t[26]!==b||t[27]!==y||t[28]!==f||t[29]!==a||t[30]!==n?(se=(0,Q.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1 overflow-auto p-4`,children:y?(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:Oe.map(Ae)}):b?(0,Q.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:b}):a===`catalog`&&u?(0,Q.jsxs)(Q.Fragment,{children:[T?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)(S,{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)(we,{preview:u,sk:n})]}):a===`store`&&f?(0,Q.jsx)(we,{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]=T,t[26]=b,t[27]=y,t[28]=f,t[29]=a,t[30]=n,t[31]=se):se=t[31];let ce;t[32]!==A||t[33]!==a||t[34]!==n.marketplaceOpenExternal||t[35]!==n.marketplaceOpenExternalAria?(ce=a===`store`&&A?(0,Q.jsxs)(`a`,{href:A,target:`_blank`,rel:`noopener noreferrer`,className:c(`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`,ee.focusRingPanel),"aria-label":n.marketplaceOpenExternalAria,title:n.marketplaceOpenExternal,children:[(0,Q.jsx)(h,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{children:n.marketplaceOpenExternal})]}):null,t[32]=A,t[33]=a,t[34]=n.marketplaceOpenExternal,t[35]=n.marketplaceOpenExternalAria,t[36]=ce):ce=t[36];let Z;t[37]!==E||t[38]!==k||t[39]!==a||t[40]!==z||t[41]!==V||t[42]!==n.delete?(Z=a===`catalog`&&k&&E?(0,Q.jsxs)(m,{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:()=>{z(E),V(!0)},children:[(0,Q.jsx)(B,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),n.delete]}):null,t[37]=E,t[38]=k,t[39]=a,t[40]=z,t[41]=V,t[42]=n.delete,t[43]=Z):Z=t[43];let ue;t[44]!==ce||t[45]!==Z?(ue=(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[ce,Z]}),t[44]=ce,t[45]=Z,t[46]=ue):ue=t[46];let de;t[47]!==T||t[48]!==y||t[49]!==a||t[50]!==s||t[51]!==N||t[52]!==F||t[53]!==L||t[54]!==R||t[55]!==I||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]!==P||t[67]!==j?(de=(0,Q.jsx)(`div`,{className:`flex items-center gap-2`,children:a===`store`?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(m,{type:`button`,variant:`ghost`,onClick:()=>i(!1),children:n.cancel}),(0,Q.jsx)(m,{type:`button`,variant:`secondary`,disabled:!s||y||j===s||N===s,onClick:()=>void I(),children:j===s?n.previewUseInChatBusy:n.previewUseInChat}),(0,Q.jsx)(m,{type:`button`,variant:F(s)?`secondary`:`primary`,disabled:!s||N===s,onClick:()=>{s&&L(s,{useDetailProvider:!0})},children:N===s?n.uploading:F(s)?n.marketplaceReinstall:n.marketplaceInstall})]}):(0,Q.jsxs)(Q.Fragment,{children:[T?(0,Q.jsx)(m,{type:`button`,variant:`secondary`,disabled:!s||P===s,onClick:()=>{s&&R(s,!1)},children:P===s?n.uploading:n.detailModalDisable}):(0,Q.jsx)(m,{type:`button`,variant:`primary`,disabled:!s||P===s,onClick:()=>{s&&R(s,!0)},children:P===s?n.uploading:n.detailModalEnable}),(0,Q.jsx)(m,{type:`button`,variant:`secondary`,disabled:!s||!T||y||j===s||P===s,title:T?void 0:n.useRequiresEnabled,onClick:()=>void I(),children:j===s?n.previewUseInChatBusy:n.previewUseInChat})]})}),t[47]=T,t[48]=y,t[49]=a,t[50]=s,t[51]=N,t[52]=F,t[53]=L,t[54]=R,t[55]=I,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]=P,t[67]=j,t[68]=de):de=t[68];let fe;t[69]!==ue||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:[ue,de]}),t[69]=ue,t[70]=de,t[71]=fe):fe=t[71];let pe;t[72]!==X||t[73]!==oe||t[74]!==se||t[75]!==fe?(pe=(0,Q.jsxs)(_,{children:[U,(0,Q.jsxs)(v,{className:W,children:[X,oe,se,fe]})]}),t[72]=X,t[73]=oe,t[74]=se,t[75]=fe,t[76]=pe):pe=t[76];let me;return t[77]!==r||t[78]!==H||t[79]!==pe?(me=(0,Q.jsx)(g,{open:r,onOpenChange:H,children:pe}),t[77]=r,t[78]=H,t[79]=pe,t[80]=me):me=t[80],me}function Ae(e){return(0,Q.jsx)(`div`,{className:c(`h-4 animate-pulse rounded-md bg-surface-hover dark:bg-surface-active/50`,e.width)},e.id)}function je(e){let t=(0,le.c)(67),{sk:n,installOpen:r,setInstallOpen:i,pendingFile:a,setPendingFile:o,dropActive:s,setDropActive:l,uploading:u,onModalDragOver:d,onModalDragLeave:f,onModalDrop:p,onFileInputChange:m,onInstallSubmit:h}=e,y;t[0]!==l||t[1]!==i||t[2]!==o?(y=e=>{i(e),e||(o(null),l(!1))},t[0]=l,t[1]=i,t[2]=o,t[3]=y):y=t[3];let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(O,{className:`xopc-dialog-overlay fixed inset-0 z-[60] bg-scrim`}),t[4]=b):b=t[4];let S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=c(`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]=S):S=t[5];let w;t[6]===n.installModalTitle?w=t[7]:(w=(0,Q.jsx)(x,{className:`text-base font-semibold text-fg`,children:n.installModalTitle}),t[6]=n.installModalTitle,t[7]=w);let T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=c(`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,ee.focusRingPanel),t[8]=T):T=t[8];let k;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(C,{className:`size-5`,strokeWidth:1.75,"aria-hidden":!0}),t[9]=k):k=t[9];let A;t[10]===n.installClose?A=t[11]:(A=(0,Q.jsx)(`span`,{className:`sr-only`,children:n.installClose}),t[10]=n.installClose,t[11]=A);let j;t[12]!==n.installClose||t[13]!==A?(j=(0,Q.jsx)(D,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:T,"aria-label":n.installClose,children:[k,A]})}),t[12]=n.installClose,t[13]=A,t[14]=j):j=t[14];let M;t[15]!==w||t[16]!==j?(M=(0,Q.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[w,j]}),t[15]=w,t[16]=j,t[17]=M):M=t[17];let N=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]===N?P=t[19]:(P=c(`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`,N),t[18]=N,t[19]=P);let F;t[20]!==m||t[21]!==n.installModalDropHint||t[22]!==u?(F=(0,Q.jsx)(`input`,{type:`file`,accept:`.zip,.md,application/zip,text/markdown`,className:`sr-only`,"aria-label":n.installModalDropHint,disabled:u,onChange:m}),t[20]=m,t[21]=n.installModalDropHint,t[22]=u,t[23]=F):F=t[23];let I;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsx)(E,{className:`size-12 text-fg-subtle`,strokeWidth:1.25,"aria-hidden":!0}),t[24]=I):I=t[24];let L;t[25]===n.installModalDropHint?L=t[26]:(L=(0,Q.jsx)(`span`,{className:`text-sm text-fg-muted`,children:n.installModalDropHint}),t[25]=n.installModalDropHint,t[26]=L);let R;t[27]===a?R=t[28]:(R=a?(0,Q.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:a.name}):null,t[27]=a,t[28]=R);let z;t[29]!==f||t[30]!==d||t[31]!==p||t[32]!==P||t[33]!==F||t[34]!==L||t[35]!==R?(z=(0,Q.jsxs)(`label`,{className:P,onDragLeave:f,onDragOver:d,onDrop:p,children:[F,I,L,R]}),t[29]=f,t[30]=d,t[31]=p,t[32]=P,t[33]=F,t[34]=L,t[35]=R,t[36]=z):z=t[36];let B;t[37]===n.installModalReqTitle?B=t[38]:(B=(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:n.installModalReqTitle}),t[37]=n.installModalReqTitle,t[38]=B);let V;t[39]===n.installModalReq1?V=t[40]:(V=(0,Q.jsx)(`li`,{children:n.installModalReq1}),t[39]=n.installModalReq1,t[40]=V);let H;t[41]===n.installModalReq2?H=t[42]:(H=(0,Q.jsx)(`li`,{children:n.installModalReq2}),t[41]=n.installModalReq2,t[42]=H);let U;t[43]!==V||t[44]!==H?(U=(0,Q.jsxs)(`ul`,{className:`list-inside list-disc space-y-1 text-sm text-fg-muted`,children:[V,H]}),t[43]=V,t[44]=H,t[45]=U):U=t[45];let W;t[46]!==B||t[47]!==U?(W=(0,Q.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[B,U]}),t[46]=B,t[47]=U,t[48]=W):W=t[48];let te=!a||u,G=!a||u?`cursor-not-allowed bg-surface-active text-fg-disabled`:`bg-accent text-white hover:bg-accent-hover`,K;t[49]===G?K=t[50]:(K=c(`mt-6 flex w-full items-center justify-center rounded-xl py-3 text-sm font-semibold`,`transition-colors`,G,ee.focusRingPanel),t[49]=G,t[50]=K);let q;t[51]===h?q=t[52]:(q=()=>void h(),t[51]=h,t[52]=q);let ne=u?n.uploading:n.installAction,J;t[53]!==te||t[54]!==K||t[55]!==q||t[56]!==ne?(J=(0,Q.jsx)(`button`,{type:`button`,disabled:te,className:K,onClick:q,children:ne}),t[53]=te,t[54]=K,t[55]=q,t[56]=ne,t[57]=J):J=t[57];let Y;t[58]!==z||t[59]!==W||t[60]!==J||t[61]!==M?(Y=(0,Q.jsxs)(_,{children:[b,(0,Q.jsxs)(v,{className:S,children:[M,z,W,J]})]}),t[58]=z,t[59]=W,t[60]=J,t[61]=M,t[62]=Y):Y=t[62];let X;return t[63]!==r||t[64]!==y||t[65]!==Y?(X=(0,Q.jsx)(g,{open:r,onOpenChange:y,children:Y}),t[63]=r,t[64]=y,t[65]=Y,t[66]=X):X=t[66],X}function Me(e){let t=(0,le.c)(66),{sk:n,mpCategories:r,mpCategoriesLoading:i,mpCategoriesError:a,mpPayload:o,mpLoading:s,mpError:l,marketCategoryId:u,setMarketCategoryId:d,marketPage:f,setMarketPage:p,isSkillInstalledByName:h,openMarketplaceDetail:g,onMarketInstall:_,installingMarketName:v,onUseSkillInChat:y,usingSkillInChatName:b,searchInputActive:x,searchQuery:S,setSearchQuery:C,registeredProviders:w,marketBrowseProvider:E,setMarketBrowseProvider:D}=e,O=!x,k,A,M;if(t[0]!==v||t[1]!==h||t[2]!==E||t[3]!==u||t[4]!==f||t[5]!==r||t[6]!==a||t[7]!==i||t[8]!==l||t[9]!==s||t[10]!==o||t[11]!==_||t[12]!==y||t[13]!==g||t[14]!==w||t[15]!==x||t[16]!==S||t[17]!==D||t[18]!==d||t[19]!==p||t[20]!==C||t[21]!==O||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]!==b){let e;t[44]===E?e=t[45]:(e=e=>e.id!==E,t[44]=E,t[45]=e);let P=w.filter(e),L=S.trim(),R;t[46]===n.marketplaceCategoryAll?R=t[47]:(R={id:``,label:n.marketplaceCategoryAll},t[46]=n.marketplaceCategoryAll,t[47]=R);let z;t[48]!==r||t[49]!==R?(z=[R,...r.map(Ie)],t[48]=r,t[49]=R,t[50]=z):z=t[50];let B=z;t[51]!==B||t[52]!==u||t[53]!==r.length||t[54]!==i||t[55]!==d||t[56]!==O||t[57]!==n.marketplaceCategoriesAria?(k=O?r.length>0?(0,Q.jsx)(V,{items:B,activeTab:u,onChange:d,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(Fe)}):null:null,t[51]=B,t[52]=u,t[53]=r.length,t[54]=i,t[55]=d,t[56]=O,t[57]=n.marketplaceCategoriesAria,t[58]=k):k=t[58],t[59]!==a||t[60]!==O?(A=O&&a?(0,Q.jsx)(`p`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:a}):null,t[59]=a,t[60]=O,t[61]=A):A=t[61],M=!o&&!l?(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:ve.map(Pe)}):l&&!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:l}):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)(T,{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:x&&L?X(n.marketplaceEmptySearch,{query:L}):n.marketplaceEmpty}),x?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:[P.map(e=>(0,Q.jsx)(m,{type:`button`,variant:`secondary`,className:`h-8 px-3 text-xs`,onClick:()=>D(e.id),children:X(n.marketplaceEmptySearchTryProvider,{provider:e.displayName})},e.id)),(0,Q.jsx)(m,{type:`button`,variant:`ghost`,className:`h-8 px-3 text-xs`,onClick:()=>C(``),children:n.marketplaceEmptySearchClear})]}):null]}):(0,Q.jsx)(`div`,{className:c(`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=ae(e,e.providerId??E),r=h(t);return(0,Q.jsxs)(`article`,{className:c(`group flex h-full flex-col rounded-xl bg-surface-panel p-4 shadow-surface`,`transition-colors hover:bg-surface-hover`),children:[(0,Q.jsx)(`button`,{type:`button`,className:c(`flex min-h-0 w-full flex-1 cursor-pointer flex-col rounded-lg text-left outline-none`,ee.focusRingPanel),"aria-labelledby":`mp-skill-title-${e.id}`,onClick:()=>void g(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.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,Q.jsx)(`h3`,{id:`mp-skill-title-${e.id}`,className:`min-w-0 flex-1 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)(j,{className:`size-3`,"aria-hidden":!0}),n.marketplaceInstalled]}):null]}),(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:`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)(I,{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]})]})})}),(0,Q.jsx)(`div`,{role:`group`,className:`mt-3 flex items-center justify-end gap-1 border-t border-edge-subtle pt-3`,children:r?(0,Q.jsx)(m,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||b===t,onClick:()=>void y({name:t,source:`store`,providerOverride:e.providerId??null}),children:b===t?n.previewUseInChatBusy:n.previewUseInChat}):(0,Q.jsx)(m,{type:`button`,variant:`primary`,className:`h-8 shrink-0 whitespace-nowrap px-2.5 text-xs font-medium`,disabled:s||v===t,onClick:()=>void _(t,{providerOverride:e.providerId??null}),children:v===t?n.uploading:n.marketplaceInstall})})]},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:X(n.marketplacePageStatus,{page:o.meta.page,totalPages:o.meta.totalPages,total:o.meta.total})}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsxs)(m,{type:`button`,variant:`ghost`,className:`h-9 gap-1 px-2`,disabled:s||f<=1,"aria-label":n.marketplacePagePrev,onClick:()=>p(Ne),children:[(0,Q.jsx)(N,{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)(m,{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)(F,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})]})]})]}):null]}):null,t[0]=v,t[1]=h,t[2]=E,t[3]=u,t[4]=f,t[5]=r,t[6]=a,t[7]=i,t[8]=l,t[9]=s,t[10]=o,t[11]=_,t[12]=y,t[13]=g,t[14]=w,t[15]=x,t[16]=S,t[17]=D,t[18]=d,t[19]=p,t[20]=C,t[21]=O,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]=b,t[41]=k,t[42]=A,t[43]=M}else k=t[41],A=t[42],M=t[43];let P;return t[62]!==k||t[63]!==A||t[64]!==M?(P=(0,Q.jsxs)(Q.Fragment,{children:[k,A,M]}),t[62]=k,t[63]=A,t[64]=M,t[65]=P):P=t[65],P}function Ne(e){return Math.max(1,e-1)}function Pe(e){return(0,Q.jsx)(fe,{},e)}function Fe(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 Ie(e){return{id:e.id,label:e.label,title:e.label}}function Le(e){let t=(0,le.c)(118),{vm:n}=e,{sk:r,hasToken:i,error:a,actionFeedback:o,skillDiagnostics:s,mainTab:l,setMainTab:u,sourceFilter:d,setSourceFilter:f,builtinTabStats:p,userTabStats:m,catalogDisabledCount:h,catalogStatusFilter:g,setCatalogStatusFilter:_,marketSort:v,setMarketSort:y,marketBrowseProvider:b,setMarketBrowseProvider:x,registeredProviders:S,inSettingsShell:C,searchInputActive:w,resultTab:T,setResultTab:E,aggregatedTabCounts:D,aggregatedProviderStatus:O}=n;if(!i){let e;t[0]===n?e=t[1]:(e=(0,Q.jsx)(We,{vm:n}),t[0]=n,t[1]=e);let i;t[2]===r.needToken?i=t[3]:(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[2]=r.needToken,t[3]=i);let a;return t[4]!==e||t[5]!==i?(a=(0,Q.jsxs)(Q.Fragment,{children:[e,i]}),t[4]=e,t[5]=i,t[6]=a):a=t[6],a}let k=p.total+m.total,A=p.enabled+m.enabled,j=p.total+m.total-p.enabled-m.enabled,M;t[7]!==k||t[8]!==A||t[9]!==j||t[10]!==m.total?(M={total:k,ready:A,needsAttention:j,added:m.total},t[7]=k,t[8]=A,t[9]=j,t[10]=m.total,t[11]=M):M=t[11];let N=M,P;t[12]!==N.total||t[13]!==r.tabInstalled?(P={id:`installed`,label:r.tabInstalled,count:N.total},t[12]=N.total,t[13]=r.tabInstalled,t[14]=P):P=t[14];let F;t[15]===r.tabDiscover?F=t[16]:(F={id:`marketplace`,label:r.tabDiscover},t[15]=r.tabDiscover,t[16]=F);let I;t[17]!==P||t[18]!==F?(I=[P,F],t[17]=P,t[18]=F,t[19]=I):I=t[19];let R=I,z;t[20]===S?z=t[21]:(z=[`all`,...S.map(Ue)],t[20]=S,t[21]=z);let B=z,ee;t[22]!==O||t[23]!==D||t[24]!==S||t[25]!==r.marketplaceLoadFailed||t[26]!==r.marketplaceResultsTabAll||t[27]!==B?(ee=B.map(e=>{let t=e===`all`?r.marketplaceResultsTabAll:S.find(t=>t.id===e)?.displayName??e,n=D[e]??0,i=e===`all`?null:O[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[22]=O,t[23]=D,t[24]=S,t[25]=r.marketplaceLoadFailed,t[26]=r.marketplaceResultsTabAll,t[27]=B,t[28]=ee):ee=t[28];let H=ee,U;t[29]===n?U=t[30]:(U=(0,Q.jsx)(We,{vm:n}),t[29]=n,t[30]=U);let W;t[31]!==o||t[32]!==a?(W=o?(0,Q.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:c(`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[31]=o,t[32]=a,t[33]=W):W=t[33];let te;t[34]!==r.diagnosticsHint||t[35]!==r.diagnosticsTitle||t[36]!==s?(te=s.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:X(r.diagnosticsTitle,{count:s.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:s.slice(0,3).map(He)})]}):null,t[34]=r.diagnosticsHint,t[35]=r.diagnosticsTitle,t[36]=s,t[37]=te):te=t[37];let G;t[38]!==C||t[39]!==n.loading||t[40]!==n.mainTab||t[41]!==n.onReloadClick||t[42]!==n.searchQuery||t[43]!==n.setInstallOpen||t[44]!==n.setPendingFile||t[45]!==n.setSearchQuery||t[46]!==n.sk?(G=C?(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)(ue,{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[38]=C,t[39]=n.loading,t[40]=n.mainTab,t[41]=n.onReloadClick,t[42]=n.searchQuery,t[43]=n.setInstallOpen,t[44]=n.setPendingFile,t[45]=n.setSearchQuery,t[46]=n.sk,t[47]=G):G=t[47];let K;t[48]!==l||t[49]!==R||t[50]!==u||t[51]!==r.skillsNavAria?(K=(0,Q.jsx)(`div`,{className:`border-b border-edge-subtle pb-3 dark:border-edge-subtle`,children:(0,Q.jsx)(V,{items:R,activeTab:l,onChange:u,ariaLabel:r.skillsNavAria,tabIdPrefix:`skills-tab`,panelIdPrefix:`skills-panel`,className:`flex-wrap`})}),t[48]=l,t[49]=R,t[50]=u,t[51]=r.skillsNavAria,t[52]=K):K=t[52];let q;t[53]!==h||t[54]!==g||t[55]!==N.added||t[56]!==N.needsAttention||t[57]!==N.ready||t[58]!==l||t[59]!==b||t[60]!==v||t[61]!==S||t[62]!==T||t[63]!==H||t[64]!==w||t[65]!==_||t[66]!==x||t[67]!==y||t[68]!==E||t[69]!==f||t[70]!==r.discoverHeading||t[71]!==r.discoverHint||t[72]!==r.filterAll||t[73]!==r.filterDisabledOnly||t[74]!==r.filterEnabled||t[75]!==r.filterExtra||t[76]!==r.filterGlobal||t[77]!==r.filterInstalled||t[78]!==r.filterWorkspace||t[79]!==r.installedHeading||t[80]!==r.installedHint||t[81]!==r.marketplaceBrowseSwitchAria||t[82]!==r.marketplaceResultsTabsAria||t[83]!==r.marketplaceSortDownloads||t[84]!==r.marketplaceSortLabel||t[85]!==r.marketplaceSortNewest||t[86]!==r.sourceFilterAria||t[87]!==r.statusFilterAria||t[88]!==r.summaryAdded||t[89]!==r.summaryNeedsAttention||t[90]!==r.summaryReady||t[91]!==r.tabBuiltin||t[92]!==d?(q=l===`installed`?(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.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)(L,{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)(L,{value:g,placeholder:r.filterAll,ariaLabel:r.statusFilterAria,options:[{value:`all`,label:r.filterAll},{value:`enabled`,label:r.filterEnabled},{value:`disabled`,label:X(r.filterDisabledOnly,{count:h})}],allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:e=>_(e)})]})]}),(0,Q.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-3`,"aria-label":r.installedHeading,children:[(0,Q.jsxs)(`button`,{type:`button`,className:c(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,g===`enabled`&&`border-emerald-500/40 bg-emerald-500/5`),"aria-pressed":g===`enabled`,onClick:()=>_(Ve),children:[(0,Q.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-success`,children:N.ready}),(0,Q.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryReady})]}),(0,Q.jsxs)(`button`,{type:`button`,className:c(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,g===`disabled`&&`border-amber-500/50 bg-amber-500/5`),"aria-pressed":g===`disabled`,onClick:()=>_(Be),children:[(0,Q.jsx)(`div`,{className:c(`text-xl font-semibold tabular-nums`,N.needsAttention>0?`text-warning`:`text-fg`),children:N.needsAttention}),(0,Q.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryNeedsAttention})]}),(0,Q.jsxs)(`button`,{type:`button`,className:c(`rounded-xl border border-edge-subtle bg-surface-base p-3 text-left transition-colors hover:bg-surface-hover`,d===`installed`&&`border-accent/40 bg-accent/5`),"aria-pressed":d===`installed`,onClick:()=>f(ze),children:[(0,Q.jsx)(`div`,{className:`text-xl font-semibold tabular-nums text-fg`,children:N.added}),(0,Q.jsx)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:r.summaryAdded})]})]})]}):(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:[w?null:(0,Q.jsx)(L,{value:b??``,placeholder:r.marketplaceBrowseSwitchAria,ariaLabel:r.marketplaceBrowseSwitchAria,options:S.map(Re),allowEmpty:!1,triggerClassName:`h-9 w-auto min-w-[9rem] bg-surface-panel text-xs shadow-surface`,align:`end`,onChange:x}),(0,Q.jsx)(L,{value:v,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=>y(e)})]})]}),w?(0,Q.jsx)(V,{items:H,activeTab:T,onChange:E,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[53]=h,t[54]=g,t[55]=N.added,t[56]=N.needsAttention,t[57]=N.ready,t[58]=l,t[59]=b,t[60]=v,t[61]=S,t[62]=T,t[63]=H,t[64]=w,t[65]=_,t[66]=x,t[67]=y,t[68]=E,t[69]=f,t[70]=r.discoverHeading,t[71]=r.discoverHint,t[72]=r.filterAll,t[73]=r.filterDisabledOnly,t[74]=r.filterEnabled,t[75]=r.filterExtra,t[76]=r.filterGlobal,t[77]=r.filterInstalled,t[78]=r.filterWorkspace,t[79]=r.installedHeading,t[80]=r.installedHint,t[81]=r.marketplaceBrowseSwitchAria,t[82]=r.marketplaceResultsTabsAria,t[83]=r.marketplaceSortDownloads,t[84]=r.marketplaceSortLabel,t[85]=r.marketplaceSortNewest,t[86]=r.sourceFilterAria,t[87]=r.statusFilterAria,t[88]=r.summaryAdded,t[89]=r.summaryNeedsAttention,t[90]=r.summaryReady,t[91]=r.tabBuiltin,t[92]=d,t[93]=q):q=t[93];let ne;t[94]!==l||t[95]!==n?(ne=l===`marketplace`?(0,Q.jsx)(Me,{...n}):(0,Q.jsx)(be,{...n}),t[94]=l,t[95]=n,t[96]=ne):ne=t[96];let J;t[97]!==K||t[98]!==q||t[99]!==ne?(J=(0,Q.jsxs)(`section`,{className:`flex flex-col gap-5`,children:[K,q,ne]}),t[97]=K,t[98]=q,t[99]=ne,t[100]=J):J=t[100];let Y;t[101]!==W||t[102]!==te||t[103]!==G||t[104]!==J?(Y=(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-6 px-3 py-6 sm:px-5 xl:px-6`,children:[W,te,G,J]}),t[101]=W,t[102]=te,t[103]=G,t[104]=J,t[105]=Y):Y=t[105];let re,ie,ae;t[106]===n?(re=t[107],ie=t[108],ae=t[109]):(re=(0,Q.jsx)(ke,{...n}),ie=(0,Q.jsx)(je,{...n}),ae=(0,Q.jsx)(Se,{...n}),t[106]=n,t[107]=re,t[108]=ie,t[109]=ae);let oe;t[110]!==Y||t[111]!==re||t[112]!==ie||t[113]!==ae?(oe=(0,Q.jsxs)(`div`,{className:`flex min-h-0 min-w-0 flex-1 flex-col bg-surface-panel`,children:[Y,re,ie,ae]}),t[110]=Y,t[111]=re,t[112]=ie,t[113]=ae,t[114]=oe):oe=t[114];let se;return t[115]!==U||t[116]!==oe?(se=(0,Q.jsxs)(Q.Fragment,{children:[U,oe]}),t[115]=U,t[116]=oe,t[117]=se):se=t[117],se}function Re(e){return{value:e.id,label:e.displayName}}function ze(e){return e===`installed`?`all`:`installed`}function Be(e){return e===`disabled`?`all`:`disabled`}function Ve(e){return e===`enabled`?`all`:`enabled`}function He(e,t){return(0,Q.jsxs)(`li`,{className:`truncate`,children:[e.type,`: `,e.message]},`${e.path??e.skillName??`diagnostic`}-${t}`)}function Ue(e){return e.id}function We(e){let t=(0,le.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=P(Ke),m=P(Ge),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)(ue,{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 Ge(e){return e.clearPageHeader}function Ke(e){return e.setPageHeader}async function qe(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 Je(){let e=l(d(e=>e.language)).skills,t=!!u(e=>e.token),n=s(),[r,i]=o(),c=r.get(`mprov`)?.trim()||null,[m,h]=(0,Z.useState)(!1),[g,_]=(0,Z.useState)(null),[v,y]=(0,Z.useState)(!1),x=r.get(`q`)??``,S=r.get(`tab`),C=r.get(`source`),w=r.get(`status`),T=me.has(S)?S:`installed`,E=S===`builtin`?`builtin`:S===`user`?`installed`:null,D=he.has(C)?C:E??`all`,O=ge.has(w)?w:`all`,[k,A]=(0,Z.useState)(x),[j]=b(k,250),M=j.trim(),N=k.trim().length>0,P=M.length>0,[F,I]=(0,Z.useState)(null),[L,z]=(0,Z.useState)(T),[B,ee]=(0,Z.useState)(D),[V,X]=(0,Z.useState)(``),[re,ae]=(0,Z.useState)(O),[se,le]=(0,Z.useState)(!1),[Q,ue]=(0,Z.useState)(null),[de,fe]=(0,Z.useState)(!1),[pe,ve]=(0,Z.useState)(!1),[be,xe]=(0,Z.useState)(null),[Se,Ce]=(0,Z.useState)(null),[we,Te]=(0,Z.useState)({}),[Ee,De]=(0,Z.useState)(!1),[Oe,ke]=(0,Z.useState)(`catalog`),[Ae,je]=(0,Z.useState)(``),[Me,Ne]=(0,Z.useState)(null),[Pe,Fe]=(0,Z.useState)(null),[Ie,Le]=(0,Z.useState)(!1),[Re,ze]=(0,Z.useState)(null),[Be,Ve]=(0,Z.useState)(`downloads`),[He,Ue]=(0,Z.useState)(1),[We,Ge]=(0,Z.useState)(null),[Ke,Je]=(0,Z.useState)(null),[Ye,Xe]=(0,Z.useState)(``),[$,Ze]=(0,Z.useState)(()=>c),[Qe,$e]=(0,Z.useState)(0),[et,tt]=(0,Z.useState)(0),[nt,rt]=(0,Z.useState)([]),it=(0,Z.useRef)(null),at=(0,Z.useRef)(c),ot=(0,Z.useRef)(null),st=(0,Z.useRef)(``),ct=(0,Z.useRef)(null),lt=(0,Z.useRef)(!1),[ut,dt]=(0,Z.useState)({query:``,byProvider:{}}),[ft,pt]=(0,Z.useState)(`all`),mt=(0,Z.useRef)(0),ht=(0,Z.useRef)(M);ht.current!==M&&(ht.current=M,pt(e=>e===`all`?e:`all`));let gt=R(()=>p().then(e=>(rt(e.diagnostics??[]),e.catalog.map(U))),[t,et],{enabled:t,initial:[],errorData:[]}),{data:_t,loading:vt,setData:yt}=gt,bt=R(async()=>{try{let{providers:e,current:t}=await te();return{providers:e.map(e=>({id:e.id,displayName:e.displayName})),current:t}}catch{try{return{providers:[],current:(await ce()).provider}}catch{return{providers:[],current:`store`}}}},[t,Qe],{enabled:t,initial:{providers:[],current:null}}),xt=m||vt,St=bt.data.providers;(0,Z.useEffect)(()=>{let e=e=>{if(f(e.detail)===`skills`){if(lt.current){lt.current=!1;return}tt(e=>e+1)}else $e(e=>e+1)};return window.addEventListener(`config-reload`,e),()=>window.removeEventListener(`config-reload`,e)},[]);let Ct=r.toString(),wt=(0,Z.useRef)(Ct);if(wt.current!==Ct){wt.current=Ct;let e=r.get(`q`)??``,t=r.get(`tab`),n=r.get(`source`),i=r.get(`status`),a=me.has(t)?t:`installed`,o=t===`builtin`?`builtin`:t===`user`?`installed`:null,s=he.has(n)?n:o??`all`,c=ge.has(i)?i:`all`;A(t=>t===e?t:e),z(e=>e===a?e:a),ee(e=>e===s?e:s),ae(e=>e===c?e:c);let l=r.get(`mcat`)??``;Xe(a===`marketplace`?e=>e===l?e:l:``)}let Tt=(0,Z.useRef)(t);!t&&Tt.current&&(Ze(null),it.current=null),Tt.current=t,t&&c&&at.current!==c&&(at.current=c,Ze(c)),t&&c==null&&bt.data.current&&bt.data.current!==ot.current&&(ot.current=bt.data.current,Ze(e=>e??bt.data.current));let Et=`${M}|${Be}|${L}|${Ye}|${$??``}|${ft}`;st.current!==Et&&(st.current=Et,Ue(1)),L===`marketplace`&&$&&ct.current!=null&&ct.current!==$&&Xe(``),ct.current=$;let Dt=R(()=>G({page:He,pageSize:20,sort:Be,category:Ye.trim()||void 0,provider:$}),[t,L,Ye,He,Be,P,$],{enabled:t&&L===`marketplace`&&!!$&&!P,initial:null,errorData:null});(0,Z.useEffect)(()=>{if(!t||!P||L!==`marketplace`||St.length===0)return;let n=++mt.current,r={};for(let e of St)r[e.id]={status:`loading`,rows:[]};dt({query:M,byProvider:r});let i=[],a=[];for(let t of St){let r=new AbortController;i.push(r);let o=window.setTimeout(()=>{r.abort(new DOMException(`Adapter timed out`,`TimeoutError`))},8e3);a.push(o),G({provider:t.id,q:M,page:1,pageSize:40,sort:Be,signal:r.signal}).then(e=>{if(window.clearTimeout(o),n!==mt.current)return;let r=e.items.map(e=>({...e,providerId:t.id}));dt(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`ok`,rows:r}}}))}).catch(r=>{if(window.clearTimeout(o),n!==mt.current)return;let i=r instanceof DOMException&&(r.name===`TimeoutError`||r.name===`AbortError`)?e.marketplaceLoadFailed:r instanceof Error?r.message:e.marketplaceLoadFailed;dt(e=>({...e,byProvider:{...e.byProvider,[t.id]:{status:`error`,rows:[],error:i}}}))})}return()=>{for(let e of a)window.clearTimeout(e);for(let e of i)e.abort()}},[t,L,P,M,St,Be,e.marketplaceLoadFailed]);let Ot=R(()=>W({provider:$}).then(e=>e.items),[t,L,$],{enabled:t&&L===`marketplace`&&!!$,initial:[],errorData:[]}),kt=(0,Z.useMemo)(()=>{if(!P||ut.query!==M)return[];let e=St.map(e=>({id:e.id,rows:[...ut.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())},[P,M,ut,St]),At=(0,Z.useMemo)(()=>{if(!P)return{};let e={all:kt.length};for(let t of St)e[t.id]=kt.filter(e=>e.providerId===t.id||(e.additionalSources??[]).some(e=>e.providerId===t.id)).length;return e},[P,kt,St]),jt=(0,Z.useMemo)(()=>P?ft===`all`?kt:kt.filter(e=>e.providerId===ft||(e.additionalSources??[]).some(e=>e.providerId===ft)):[],[P,kt,ft]),Mt=(0,Z.useMemo)(()=>{if(!P)return{};let e={};for(let t of St)e[t.id]=ut.byProvider[t.id]?.status??`loading`;return e},[P,ut,St]),Nt=(0,Z.useMemo)(()=>Object.values(Mt).some(e=>e===`loading`),[Mt]),Pt=(0,Z.useMemo)(()=>{if(!P)return!1;let e=Object.values(Mt);return e.length>0&&e.every(e=>e===`error`)},[P,Mt]),Ft=(0,Z.useMemo)(()=>{if(!P||kt.length===0&&Nt)return null;let e=jt.length,t=(He-1)*20;return{items:jt.slice(t,t+20),meta:{page:He,pageSize:20,total:e,totalPages:Math.max(1,Math.ceil(e/20))},provider:ft}},[P,kt,Nt,jt,He,ft]),It=L===`marketplace`?N?P?Ft:null:Dt.data:null,Lt=L===`marketplace`?N?P?Nt:!0:Dt.loading:!1,Rt=P?Pt?e.marketplaceLoadFailed:null:Dt.error instanceof Error?Dt.error.message:Dt.error?e.marketplaceLoadFailed:null,zt=L===`marketplace`?Ot.data:[],Bt=L===`marketplace`?Ot.loading:!1,Vt=Ot.error instanceof Error?Ot.error.message:Ot.error?e.marketplaceCategoriesFailed:null;Ye.trim()&&zt.length>0&&!zt.some(e=>e.id===Ye)&&Xe(``);let Ht=(0,Z.useCallback)(async t=>{let n=t?.silent===!0;n||h(!0),_(null);try{let e=await p();return rt(e.diagnostics??[]),yt(e.catalog.map(U)),{ok:!0}}catch(t){let n=t instanceof Error?t.message:e.loadFailed;return _(n),{ok:!1,message:n}}finally{n||h(!1)}},[yt,e.loadFailed]),Ut=!m&&gt.error?gt.error instanceof Error?gt.error.message:e.loadFailed:null,Wt=g??Ut;(0,Z.useEffect)(()=>{i(e=>{let t=new URLSearchParams(e);return M?t.set(`q`,M):t.delete(`q`),L===`marketplace`?t.set(`tab`,L):t.delete(`tab`),B===`all`?t.delete(`source`):t.set(`source`,B),L===`installed`&&re!==`all`?t.set(`status`,re):t.delete(`status`),L===`marketplace`&&Ye.trim()?t.set(`mcat`,Ye.trim()):t.delete(`mcat`),L===`marketplace`&&$?t.set(_e,$):t.delete(_e),t.toString()===e.toString()?e:t},{replace:!0})},[L,Ye,$,M,re,i,B]);let Gt=(0,Z.useCallback)((e,t,n=5e3)=>{I({kind:e,message:t}),window.setTimeout(()=>I(null),n)},[]),Kt=(0,Z.useCallback)(t=>{let n=t.availability;if(!n)return e.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.`},[e.installSuccess]),qt=(0,Z.useCallback)(async t=>{ke(`catalog`),De(!0),je(t.name),Ne(null),Fe(null),ze(null),Le(!0);try{let e=await ie(t.name);Ne(e),je(e.name)}catch(t){Ne(null),ze(t instanceof Error?t.message:e.detailLoadFailed)}finally{Le(!1)}},[e.detailLoadFailed]),Jt=(0,Z.useCallback)(async t=>{let n=t.trim();if(n){ke(`catalog`),De(!0),je(n),Ne(null),Fe(null),ze(null),Le(!0);try{let e=await ie(n);Ne(e),je(e.name)}catch(t){Ne(null),ze(t instanceof Error?t.message:e.detailLoadFailed)}finally{Le(!1)}}},[e.detailLoadFailed]),Yt=(0,Z.useCallback)(async(t,n,r)=>{let i=r?.trim()||$;if(i){it.current=i,ke(`store`),De(!0),je(n?.trim()||t),Ne(null),Fe(null),ze(null),Le(!0);try{let e=await J(t,{provider:i});je(e.name),Fe(e.skillDocPreview)}catch(t){Fe(null),ze(t instanceof Error?t.message:e.detailLoadFailed)}finally{Le(!1)}}},[$,e.detailLoadFailed]),Xt=(0,Z.useCallback)(async(t,n)=>{Ce(t),Te(e=>({...e,[t]:n})),I(null);try{return await q(t,n),await Ht({silent:!0}),!0}catch(n){return Te(e=>{let{[t]:n,...r}=e;return r}),Gt(`error`,n instanceof Error?n.message:e.skillToggleFailed),!1}finally{Ce(null),Te(e=>{let{[t]:n,...r}=e;return r})}},[Ht,Gt,e.skillToggleFailed]),Zt=(0,Z.useCallback)(async()=>{I(null),h(!0),_(null);try{await H()}catch(t){_(t instanceof Error?t.message:e.reloadFailed),h(!1);return}await Ht()},[Ht,e.reloadFailed]),Qt=(0,Z.useMemo)(()=>{let e=k.trim().toLowerCase();return e?_t.filter(t=>[t.name,t.description,t.directoryId,t.path,t.source,t.hub?.source,t.hub?.ref].filter(Boolean).join(` `).toLowerCase().includes(e)):_t},[_t,k]),$t=(0,Z.useMemo)(()=>{let e=_t.filter(e=>e.source===`builtin`);return{total:e.length,enabled:e.filter(e=>we[e.name]??e.enabled).length}},[_t,we]),en=(0,Z.useMemo)(()=>{let e=_t.filter(e=>e.source!==`builtin`);return{total:e.length,enabled:e.filter(e=>we[e.name]??e.enabled).length}},[_t,we]),tn=(0,Z.useMemo)(()=>Ae?_t.find(e=>e.name===Ae):void 0,[_t,Ae]),nn=tn==null?!0:we[Ae]??tn.enabled,rn=tn?.directoryId??null,an=tn?.managed??!1,on=(0,Z.useMemo)(()=>Oe!==`store`||!Ae?null:ne(it.current??$,Ae),[Oe,Ae,$]),sn=(0,Z.useMemo)(()=>{let e=Qt;return L===`installed`&&B!==`all`&&(e=B===`installed`?e.filter(e=>e.source!==`builtin`):e.filter(e=>e.source===B)),e},[Qt,L,B]),cn=(0,Z.useMemo)(()=>{let e=new Set,t=[];for(let n of sn){let r=n.category;!r||e.has(r)||(e.add(r),t.push(r))}return t.sort((e,t)=>{let n=ye.indexOf(e),r=ye.indexOf(t);return n>=0&&r>=0?n-r:n>=0?-1:r>=0?1:e.localeCompare(t)})},[sn]),ln=(0,Z.useCallback)(t=>e.categoryLabel?.[t]||t,[e.categoryLabel]),un=(0,Z.useMemo)(()=>V?sn.filter(e=>e.category===V):sn,[sn,V]);(0,Z.useEffect)(()=>{X(``)},[B]);let dn=(0,Z.useCallback)(e=>we[e.name]??e.enabled,[we]),fn=(0,Z.useMemo)(()=>un.filter(e=>!dn(e)).length,[un,dn]),pn=(0,Z.useMemo)(()=>{let e=un;return re===`disabled`&&(e=e.filter(e=>!dn(e))),re===`enabled`&&(e=e.filter(e=>dn(e))),[...e].toSorted((e,t)=>{let n=dn(e);return n===dn(t)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})},[un,re,dn]),mn=async t=>{I(null),y(!0),_(null);try{let n;try{n=await qe(t)}catch{_(e.invalidFile),Gt(`error`,e.invalidFile);return}let r=await K(n,{overwrite:!0});lt.current=!0,await Ht(),Gt(`success`,Kt(r)),le(!1),ue(null),z(`installed`),ee(`installed`),await Jt(r.availability?.skillName||r.skillId)}catch(t){_(t instanceof Error?t.message:e.uploadFailed),Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{y(!1)}},hn=()=>{Q&&mn(Q)},gn=e=>{let t=e.target.files?.[0];e.target.value=``,t&&ue(t)},_n=e=>{e.preventDefault(),e.stopPropagation(),e.dataTransfer.types.includes(`Files`)&&(fe(!0),e.dataTransfer.dropEffect=`copy`)},vn=e=>{let t=e.currentTarget,n=e.relatedTarget;n&&t.contains(n)||fe(!1)},yn=e=>{e.preventDefault(),e.stopPropagation(),fe(!1);let t=e.dataTransfer?.files?.[0];t&&ue(t)},bn=t=>{if(t.origin===`agents-global`)return e.source.agentsGlobal;if(t.origin===`agents-workspace`)return e.source.agentsWorkspace;switch(t.source){case`builtin`:return e.source.builtin;case`workspace`:return e.source.workspace;case`global`:return e.source.global;case`extra`:return e.source.extra;default:return t.source}},xn=async()=>{let t=be,n=Ee&&Oe===`catalog`&&rn===t;if(ve(!1),xe(null),t){I(null);try{await oe(t),lt.current=!0,await Ht(),n&&(De(!1),ke(`catalog`),je(``),Ne(null),Fe(null),ze(null))}catch(t){_(t instanceof Error?t.message:e.deleteFailed)}}},Sn=(0,Z.useCallback)(e=>_t.some(t=>t.name===e),[_t]),Cn=(0,Z.useCallback)(async t=>{let r=(t?.name??Ae).trim();if(!r)return;let i=t?.source??Oe;if(i===`catalog`){let e=_t.find(e=>e.name===r);if(e&&!(we[e.name]??e.enabled))return}I(null);let a=i===`store`&&!Sn(r);Je(r);try{if(a){let e=t?.providerOverride?.trim()||it.current||$;await Y({name:r,overwrite:!1,...e?{provider:e}:{}}),lt.current=!0,await Ht({silent:!0})}De(!1),n(`/chat/new?skill=${encodeURIComponent(r)}`)}catch(t){Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{Je(null)}},[_t,Ae,Oe,we,Sn,Ht,n,Gt,e.uploadFailed,$]),wn=(0,Z.useCallback)(async(t,n)=>{let r=Sn(t);if(!(r&&!window.confirm(e.marketplaceReinstallConfirm))){I(null),Ge(t);try{let e=n?.providerOverride?.trim()||(n?.useDetailProvider?it.current??$:$),i=await Y({name:t,overwrite:r,...e?{provider:e}:{}});lt.current=!0,await Ht({silent:!0}),Gt(`success`,Kt(i)),z(`installed`),ee(`installed`),await Jt(i.availability?.skillName||i.skillId||t)}catch(t){Gt(`error`,t instanceof Error?t.message:e.uploadFailed)}finally{Ge(null)}}},[Sn,Kt,Ht,$,Jt,Gt,e.marketplaceReinstallConfirm,e.uploadFailed]),{pathname:Tn}=a();return{sk:e,hasToken:t,catalog:_t,loading:xt,error:Wt,uploading:v,searchQuery:k,setSearchQuery:A,actionFeedback:F,skillDiagnostics:nt,mainTab:L,setMainTab:z,sourceFilter:B,setSourceFilter:ee,builtinCategoryFilter:V,setBuiltinCategoryFilter:X,installOpen:se,setInstallOpen:le,pendingFile:Q,setPendingFile:ue,dropActive:de,setDropActive:fe,confirmOpen:pe,setConfirmOpen:ve,confirmId:be,setConfirmId:xe,togglingSkillName:Se,enabledOverride:we,detailOpen:Ee,setDetailOpen:De,detailSource:Oe,setDetailSource:ke,detailTitle:Ae,setDetailTitle:je,detailCatalogPreview:Me,setDetailCatalogPreview:Ne,detailMarketplacePreview:Pe,setDetailMarketplacePreview:Fe,detailLoading:Ie,detailError:Re,setDetailError:ze,marketSort:Be,setMarketSort:Ve,marketPage:He,setMarketPage:Ue,mpLoading:Lt,mpError:Rt,mpPayload:It,searchActive:P,searchInputActive:N,resultTab:ft,setResultTab:pt,aggregatedTabCounts:At,aggregatedProviderStatus:Mt,aggregatedAllFailed:Pt,installingMarketName:We,usingSkillInChatName:Ke,onUseSkillInChat:Cn,marketCategoryId:Ye,setMarketCategoryId:Xe,mpCategories:zt,mpCategoriesError:Vt,mpCategoriesLoading:Bt,marketBrowseProvider:$,setMarketBrowseProvider:Ze,registeredProviders:St,builtinTabStats:$t,userTabStats:en,detailEnabled:nn,detailDirectoryId:rn,detailManaged:an,detailExternalUrl:on,filteredCatalog:sn,builtinCategories:cn,categoryFilteredCatalog:un,catalogDisplayRows:pn,catalogDisabledCount:fn,catalogStatusFilter:re,setCatalogStatusFilter:ae,resolveSkillEnabled:dn,inSettingsShell:Tn.startsWith(`/settings/`),categoryLabel:ln,onReloadClick:Zt,openSkillDetail:qt,openMarketplaceDetail:Yt,onSkillToggle:Xt,onInstallSubmit:hn,onFileInputChange:gn,onModalDragOver:_n,onModalDragLeave:vn,onModalDrop:yn,sourceLabel:bn,runDelete:xn,onMarketInstall:wn,isSkillInstalledByName:Sn}}function Ye(){let e=(0,le.c)(2),t=Je(),n;return e[0]===t?n=e[1]:(n=(0,Q.jsx)(Le,{vm:t}),e[0]=t,e[1]=n),n}export{Ye as SkillsPage};
@@ -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{t as ee}from"./check-DUBLcKHA.js";import{t as i}from"./cn-JdwAhgNB.js";import{Ns as te,_s as a,cs as ne,eu as re,gs as ie,os as ae,ss as oe}from"./index-BvR-i-m6.js";var se=n(),o=e(t(),1),s=r(),ce=Array.from({length:24},(e,t)=>t);function le(e){let t=/^(\d{2}):(\d{2})$/.exec(e);if(!t)return null;let n=Number(t[1]),r=Number(t[2]);return n>23||r>59?null:{hour:n,minute:r}}function ue(){let e=new Date;return{hour:e.getHours(),minute:e.getMinutes()}}function c(e,t){return`${String(e).padStart(2,`0`)}:${String(t).padStart(2,`0`)}`}function l(e){let t=(0,se.c)(80),{value:n,onChange:r,disabled:l,allowEmpty:pe,clearLabel:u,ariaLabel:d,ariaLabelledBy:me,className:he,triggerClassName:ge,id:_e,name:f,minuteStep:ve}=e,p=pe===void 0?!1:pe,ye=ve===void 0?1:ve,m=le(n),be=m??ue(),[xe,Se]=(0,o.useState)(!1),[h,Ce]=(0,o.useState)(be.hour),[g,we]=(0,o.useState)(be.minute),_=(0,o.useRef)([]),Te=(0,o.useRef)([]),Ee=ae(),De=oe(),Oe=ne(Ee,De!==null),ke=Math.max(1,Math.min(60,Math.round(ye))),Ae=Array.from({length:Math.ceil(60/ke)},(e,t)=>t*ke).filter(fe),v;t[0]===r?v=t[1]:(v=(e,t,n)=>{let ee=n===void 0?!1:n;Ce(e),we(t),r(c(e,t)),ee&&Se(!1)},t[0]=r,t[1]=v);let y=v,je=de,b;t[2]===he?b=t[3]:(b=i(`relative min-w-0`,he),t[2]=he,t[3]=b);let x=a,S;t[4]===n?S=t[5]:(S=e=>{if(e){let e=le(n)??ue();Ce(e.hour),we(e.minute)}Se(e)},t[4]=n,t[5]=S);let C=p&&n&&`pr-9`,w=l&&`cursor-not-allowed opacity-50 hover:border-edge`,T;t[6]!==C||t[7]!==w||t[8]!==ge?(T=i(`box-border flex h-10 w-full min-w-0 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 text-left text-sm text-fg`,`transition-colors hover:border-edge-strong focus-visible:border-accent/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/20`,C,w,ge),t[6]=C,t[7]=w,t[8]=ge,t[9]=T):T=t[9];let E;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,s.jsx)(re,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":`true`}),t[10]=E):E=t[10];let D=!m&&`text-fg-subtle`,O;t[11]===D?O=t[12]:(O=i(`tabular-nums`,D),t[11]=D,t[12]=O);let k=m?c(m.hour,m.minute):`--:--`,A;t[13]!==O||t[14]!==k?(A=(0,s.jsx)(`span`,{className:O,children:k}),t[13]=O,t[14]=k,t[15]=A):A=t[15];let j;t[16]!==d||t[17]!==me||t[18]!==l||t[19]!==_e||t[20]!==A||t[21]!==T?(j=(0,s.jsx)(ie,{asChild:!0,children:(0,s.jsxs)(`button`,{id:_e,type:`button`,disabled:l,"aria-label":d,"aria-labelledby":me,"aria-haspopup":`listbox`,className:T,children:[E,A]})}),t[16]=d,t[17]=me,t[18]=l,t[19]=_e,t[20]=A,t[21]=T,t[22]=j):j=t[22];let M=a,N=De??void 0,P=a,F=i(Oe,`w-[18rem] overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-popover outline-none`),Me=e=>{e.preventDefault(),requestAnimationFrame(()=>_.current[h]?.focus())},I;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,s.jsx)(re,{className:`size-3.5`,"aria-hidden":`true`}),t[23]=I):I=t[23];let Ne=d??`HH:mm`,L;t[24]===Ne?L=t[25]:(L=(0,s.jsxs)(`span`,{className:`flex items-center gap-2 text-xs font-medium text-fg-muted`,children:[I,Ne]}),t[24]=Ne,t[25]=L);let R;t[26]!==h||t[27]!==g?(R=c(h,g),t[26]=h,t[27]=g,t[28]=R):R=t[28];let z;t[29]===R?z=t[30]:(z=(0,s.jsx)(`span`,{className:`font-mono text-base font-semibold tabular-nums text-fg`,children:R}),t[29]=R,t[30]=z);let B;t[31]!==L||t[32]!==z?(B=(0,s.jsxs)(`div`,{className:`flex items-center justify-between border-b border-edge-subtle bg-surface-subtle px-3 py-2.5`,children:[L,z]}),t[31]=L,t[32]=z,t[33]=B):B=t[33];let V;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,s.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`HH`}),t[34]=V):V=t[34];let Pe=`${d??`HH:mm`} HH`,Fe=ce.map((e,t)=>(0,s.jsx)(`button`,{ref:e=>{_.current[t]=e},type:`button`,role:`option`,"aria-selected":h===e,tabIndex:h===e?0:-1,className:i(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,h===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>y(e,g),onKeyDown:e=>je(e,ce,h,e=>y(e,g),_),children:String(e).padStart(2,`0`)},e)),H;t[35]!==Pe||t[36]!==Fe?(H=(0,s.jsxs)(`div`,{className:`pr-2`,children:[V,(0,s.jsx)(`div`,{role:`listbox`,"aria-label":Pe,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:Fe})]}),t[35]=Pe,t[36]=Fe,t[37]=H):H=t[37];let U;t[38]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,s.jsx)(`div`,{className:`px-1 pb-1.5 text-[11px] font-semibold tracking-wider text-fg-subtle`,children:`MM`}),t[38]=U):U=t[38];let Ie=`${d??`HH:mm`} MM`,W=Ae.map((e,t)=>(0,s.jsxs)(`button`,{ref:e=>{Te.current[t]=e},type:`button`,role:`option`,"aria-selected":g===e,tabIndex:g===e?0:-1,className:i(`relative flex h-8 items-center justify-center rounded-md text-xs tabular-nums text-fg-muted transition-colors`,`hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30`,g===e&&`bg-accent-soft font-semibold text-accent-fg`),onClick:()=>y(h,e,!0),onKeyDown:e=>je(e,Ae,g,e=>y(h,e),Te),children:[(0,s.jsx)(ee,{className:i(`absolute left-0.5 size-3`,g!==e&&`invisible`),"aria-hidden":`true`}),String(e).padStart(2,`0`)]},e)),G;t[39]!==Ie||t[40]!==W?(G=(0,s.jsx)(`div`,{role:`listbox`,"aria-label":Ie,className:`grid max-h-56 grid-cols-3 gap-1 overflow-y-auto pr-1`,children:W}),t[39]=Ie,t[40]=W,t[41]=G):G=t[41];let K;t[42]!==U||t[43]!==G?(K=(0,s.jsxs)(`div`,{className:`pl-2`,children:[U,G]}),t[42]=U,t[43]=G,t[44]=K):K=t[44];let q;t[45]!==H||t[46]!==K?(q=(0,s.jsxs)(`div`,{className:`grid grid-cols-2 divide-x divide-edge-subtle p-2`,children:[H,K]}),t[45]=H,t[46]=K,t[47]=q):q=t[47];let J;t[48]!==P.Content||t[49]!==F||t[50]!==Me||t[51]!==B||t[52]!==q?(J=(0,s.jsxs)(P.Content,{side:`bottom`,align:`start`,sideOffset:6,collisionPadding:12,className:F,onOpenAutoFocus:Me,children:[B,q]}),t[48]=P.Content,t[49]=F,t[50]=Me,t[51]=B,t[52]=q,t[53]=J):J=t[53];let Y;t[54]!==M.Portal||t[55]!==N||t[56]!==J?(Y=(0,s.jsx)(M.Portal,{container:N,children:J}),t[54]=M.Portal,t[55]=N,t[56]=J,t[57]=Y):Y=t[57];let X;t[58]!==xe||t[59]!==j||t[60]!==Y||t[61]!==x.Root||t[62]!==S?(X=(0,s.jsxs)(x.Root,{open:xe,onOpenChange:S,children:[j,Y]}),t[58]=xe,t[59]=j,t[60]=Y,t[61]=x.Root,t[62]=S,t[63]=X):X=t[63];let Z;t[64]!==p||t[65]!==d||t[66]!==u||t[67]!==l||t[68]!==r||t[69]!==n?(Z=p&&n?(0,s.jsx)(`button`,{type:`button`,disabled:l,"aria-label":u??d,title:u,className:`absolute right-1.5 top-1/2 flex size-7 -translate-y-1/2 items-center justify-center rounded-md text-fg-subtle hover:bg-surface-hover hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/30 disabled:pointer-events-none`,onClick:()=>r(``),children:(0,s.jsx)(te,{className:`size-3.5`,"aria-hidden":`true`})}):null,t[64]=p,t[65]=d,t[66]=u,t[67]=l,t[68]=r,t[69]=n,t[70]=Z):Z=t[70];let Q;t[71]!==l||t[72]!==f||t[73]!==n?(Q=f?(0,s.jsx)(`input`,{type:`hidden`,name:f,value:n,disabled:l}):null,t[71]=l,t[72]=f,t[73]=n,t[74]=Q):Q=t[74];let $;return t[75]!==b||t[76]!==X||t[77]!==Z||t[78]!==Q?($=(0,s.jsxs)(`div`,{className:b,children:[X,Z,Q]}),t[75]=b,t[76]=X,t[77]=Z,t[78]=Q,t[79]=$):$=t[79],$}function de(e,t,n,r,ee){let i=null,te=Math.max(0,t.indexOf(n));if((e.key===`ArrowDown`||e.key===`ArrowRight`)&&(i=(te+1)%t.length),(e.key===`ArrowUp`||e.key===`ArrowLeft`)&&(i=(te-1+t.length)%t.length),e.key===`Home`&&(i=0),e.key===`End`&&(i=t.length-1),i===null)return;e.preventDefault();let a=t[i];r(a),ee.current?.[i]?.focus()}function fe(e){return e<60}export{l as t};
@@ -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{t as i}from"./cn-JdwAhgNB.js";import{t as a}from"./messages-CMjnbdbn.js";import{n as o,p as s}from"./locale-store-DUW5YE3R.js";import{As as c,Qc as l}from"./index-BvR-i-m6.js";var u=e(t(),1),d=n();function f(e,t){let n=!1,r=0,i=t;for(let t of e.values())t.dirty&&(n=!0,r+=1),t.saving&&(i=!0);return{anyDirty:n,dirtyCount:r,anySaving:i}}var p=s((e,t)=>({sections:new Map,saveAllInFlight:!1,anyDirty:!1,dirtyCount:0,anySaving:!1,registerSection:t=>{e(e=>{let n=new Map(e.sections);return n.set(t.id,t),{sections:n,...f(n,e.saveAllInFlight)}})},unregisterSection:t=>{e(e=>{if(!e.sections.has(t))return e;let n=new Map(e.sections);return n.delete(t),{sections:n,...f(n,e.saveAllInFlight)}})},saveAll:async()=>{let n=Array.from(t().sections.values()).filter(e=>e.dirty);if(n.length===0)return{ok:!0,saved:0,failures:[]};e(e=>({saveAllInFlight:!0,...f(e.sections,!0)}));let r=[],i=0;try{let e=await Promise.all(n.map(async e=>{try{let t=await e.save();return{id:e.id,result:t}}catch(t){return{id:e.id,result:{ok:!1,error:t instanceof Error?t.message:String(t)}}}}));for(let{id:t,result:n}of e)n.ok?i+=1:r.push({id:t,error:n.error??`Save failed`})}finally{e(e=>({saveAllInFlight:!1,...f(e.sections,!1)}))}return{ok:r.length===0,saved:i,failures:r}},discardAll:()=>{for(let e of t().sections.values())e.dirty&&e.discard()}})),m=r();function h(){let e=(0,d.c)(26),t=a(o(x)).capabilitiesSettings.saveBar,n=p(b),r=p(y),s=p(v),f=p(_),h=p(g),S;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(S=[],e[0]=S):S=e[0];let[C,w]=(0,u.useState)(S),[T,E]=(0,u.useState)(!1);if(!n&&C.length===0&&!T)return null;let D;e[1]===f?D=e[2]:(D=async()=>{w([]),E(!1);let e=await f();e.ok&&e.saved>0?(E(!0),window.setTimeout(()=>E(!1),2500)):e.ok||w(e.failures)},e[1]=f,e[2]=D);let O=D,k;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(k=i(`sticky top-0 z-10 -mx-4 flex flex-col gap-2 border-b border-edge-subtle bg-surface-base/85 px-4 py-2 backdrop-blur`,`sm:flex-row sm:items-center sm:justify-between`),e[3]=k):k=e[3];let A=C.length>0?(0,m.jsx)(`span`,{className:`text-xs text-red-600 dark:text-red-400`,role:`alert`,children:t.failuresSummary.replace(`{{count}}`,String(C.length))}):null,j=!n||r,M;e[4]===h?M=e[5]:(M=()=>h(),e[4]=h,e[5]=M);let N;e[6]!==t.discardAll||e[7]!==j||e[8]!==M?(N=(0,m.jsx)(c,{type:`button`,variant:`secondary`,className:`px-2.5 py-1.5 text-xs`,disabled:j,onClick:M,children:t.discardAll}),e[6]=t.discardAll,e[7]=j,e[8]=M,e[9]=N):N=e[9];let P=!n||r,F;e[10]===O?F=e[11]:(F=()=>void O(),e[10]=O,e[11]=F);let I;e[12]===r?I=e[13]:(I=r?(0,m.jsx)(l,{className:`size-3.5 animate-spin`,"aria-hidden":!0}):null,e[12]=r,e[13]=I);let L=r?`ml-1.5`:void 0,R;e[14]!==t.saveAll||e[15]!==L?(R=(0,m.jsx)(`span`,{className:L,children:t.saveAll}),e[14]=t.saveAll,e[15]=L,e[16]=R):R=e[16];let z;e[17]!==I||e[18]!==R||e[19]!==P||e[20]!==F?(z=(0,m.jsxs)(c,{type:`button`,variant:`primary`,className:`px-2.5 py-1.5 text-xs`,disabled:P,onClick:F,children:[I,R]}),e[17]=I,e[18]=R,e[19]=P,e[20]=F,e[21]=z):z=e[21];let B;return e[22]!==z||e[23]!==A||e[24]!==N?(B=(0,m.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[A,N,z]}),e[22]=z,e[23]=A,e[24]=N,e[25]=B):B=e[25],(0,m.jsxs)(`div`,{className:k,role:`region`,"aria-label":t.title,children:[(0,m.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n?t.dirtySummary.replace(`{{count}}`,String(s)):T?t.savedSummary:t.cleanSummary}),B]})}function g(e){return e.discardAll}function _(e){return e.saveAll}function v(e){return e.dirtyCount}function y(e){return e.anySaving}function b(e){return e.anyDirty}function x(e){return e.language}function S({id:e,dirty:t,saving:n,save:r,discard:i}){let a=(0,u.useRef)(r),o=(0,u.useRef)(i);a.current=r,o.current=i;let s=p(e=>e.registerSection),c=p(e=>e.unregisterSection);(0,u.useEffect)(()=>(s({id:e,dirty:t,saving:n,save:async()=>{try{return await a.current(),{ok:!0}}catch(e){return{ok:!1,error:e instanceof Error?e.message:String(e)}}},discard:()=>o.current()}),()=>c(e)),[e,t,n,s,c])}export{h as n,p as r,S as t};
@@ -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{f as i,l as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-CMjnbdbn.js";import{n as l}from"./locale-store-DUW5YE3R.js";import{i as u}from"./vendor-swr-BIWyz7Rc.js";import{$t as d,Ac as f,As as p,Bo as m,Bt as h,Gl as g,Go as _,Gt as v,Hc as y,Ho as b,Ht as x,Ic as S,Jo as C,Jt as w,Ko as T,Kt as E,Ns as D,Oc as O,Pc as k,Qt as A,Rs as j,Rt as M,Sl as N,Uo as P,Us as F,Ut as I,Vo as L,Vt as R,Wl as z,Wo as B,Ws as V,Wt as H,Xt as U,Yt as W,Zt as G,_n as ee,_u as K,an as q,au as te,bc as J,bl as Y,cn as ne,dc as re,dn as ie,du as ae,en as oe,eu as se,fn as ce,gn as le,gt as ue,in as de,io as X,is as Z,ln as fe,ls as pe,mn as me,mo as he,mu as ge,nn as _e,oc as ve,on as ye,pc as be,pu as xe,qs as Se,qt as Ce,rn as we,rr as Te,rs as Ee,rt as De,sl as Oe,sn as ke,su as Ae,tn as je,un as Me,us as Ne,ws as Pe,wu as Fe,xc as Ie,yu as Le,zt as Re}from"./index-BvR-i-m6.js";import{t as ze}from"./page-tabs-DNrbCgmC.js";import{t as Be}from"./time-picker-CstQ___Y.js";import{E as Ve,O as He,t as Ue}from"./connector-logo-8YU53RUT.js";var We=n(),Q=e(t(),1),$=r();function Ge(e){let t=(0,We.c)(104),{value:n,onChange:r,labels:i,language:a,inputClassName:o}=e,c;t[0]===n.timezone?c=t[1]:(c=()=>le.some(e=>e.value===n.timezone)?``:n.timezone,t[0]=n.timezone,t[1]=c);let[l,u]=(0,Q.useState)(c),d;t[2]===n.timezone?d=t[3]:(d=()=>!!n.timezone&&!le.some(e=>e.value===n.timezone),t[2]=n.timezone,t[3]=d);let[f,p]=(0,Q.useState)(d),m;t[4]===n.pronouns?m=t[5]:(m=()=>!!n.pronouns&&!me.some(e=>e.value===n.pronouns),t[4]=n.pronouns,t[5]=m);let[h,g]=(0,Q.useState)(m),_;bb0:{if(f){_=`__custom__`;break bb0}_=le.some(e=>e.value===n.timezone)?n.timezone:`__custom__`}let v=_,y;t[6]!==r||t[7]!==n?(y=e=>r({...n,...e}),t[6]=r,t[7]=n,t[8]=y):y=t[8];let b=y,x;t[9]===a?x=t[10]:(x=(e,t)=>a===`zh`?t:e,t[9]=a,t[10]=x);let S=x,C;t[11]===i.callName?C=t[12]:(C=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.callName}),t[11]=i.callName,t[12]=C);let w;t[13]===b?w=t[14]:(w=e=>b({callName:e.target.value}),t[13]=b,t[14]=w);let T;t[15]!==o||t[16]!==i.callNamePlaceholder||t[17]!==w||t[18]!==n.callName?(T=(0,$.jsx)(`input`,{className:o,value:n.callName,onChange:w,placeholder:i.callNamePlaceholder,autoComplete:`off`}),t[15]=o,t[16]=i.callNamePlaceholder,t[17]=w,t[18]=n.callName,t[19]=T):T=t[19];let E;t[20]!==C||t[21]!==T?(E=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[C,T]}),t[20]=C,t[21]=T,t[22]=E):E=t[22];let D;t[23]===i.pronouns?D=t[24]:(D=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.pronouns}),t[23]=i.pronouns,t[24]=D);let O=h?`__custom__`:n.pronouns,k;t[25]!==b||t[26]!==n.pronouns?(k=e=>{if(e.target.value===`__custom__`){g(!0),me.some(e=>e.value===n.pronouns)&&b({pronouns:``});return}g(!1),b({pronouns:e.target.value})},t[25]=b,t[26]=n.pronouns,t[27]=k):k=t[27];let A;t[28]===i.pronounsPlaceholder?A=t[29]:(A=(0,$.jsx)(Z,{value:``,children:i.pronounsPlaceholder}),t[28]=i.pronounsPlaceholder,t[29]=A);let j;t[30]===S?j=t[31]:(j=me.map(e=>(0,$.jsx)(Z,{value:e.value,children:S(e.labelEn,e.labelZh)},e.value)),t[30]=S,t[31]=j);let M;t[32]===i.custom?M=t[33]:(M=(0,$.jsx)(Z,{value:`__custom__`,children:i.custom}),t[32]=i.custom,t[33]=M);let N;t[34]!==o||t[35]!==O||t[36]!==k||t[37]!==A||t[38]!==j||t[39]!==M?(N=(0,$.jsxs)(Ee,{className:o,value:O,onChange:k,children:[A,j,M]}),t[34]=o,t[35]=O,t[36]=k,t[37]=A,t[38]=j,t[39]=M,t[40]=N):N=t[40];let P;t[41]!==o||t[42]!==i.pronounsPlaceholder||t[43]!==h||t[44]!==b||t[45]!==n.pronouns?(P=h?(0,$.jsx)(`input`,{className:s(o,`mt-1 text-xs`),value:n.pronouns,onChange:e=>b({pronouns:e.target.value}),placeholder:i.pronounsPlaceholder,autoComplete:`off`}):null,t[41]=o,t[42]=i.pronounsPlaceholder,t[43]=h,t[44]=b,t[45]=n.pronouns,t[46]=P):P=t[46];let F;t[47]!==D||t[48]!==N||t[49]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[D,N,P]}),t[47]=D,t[48]=N,t[49]=P,t[50]=F):F=t[50];let I;t[51]===i.timezone?I=t[52]:(I=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[51]=i.timezone,t[52]=I);let L;t[53]===o?L=t[54]:(L=s(o,`min-w-0 flex-1`),t[53]=o,t[54]=L);let R;t[55]===b?R=t[56]:(R=e=>{if(e.target.value===`__custom__`){p(!0);return}p(!1),u(``),b({timezone:e.target.value})},t[55]=b,t[56]=R);let z;t[57]===S?z=t[58]:(z=le.map(e=>(0,$.jsx)(Z,{value:e.value,children:S(e.labelEn,e.labelZh)},e.value)),t[57]=S,t[58]=z);let B;t[59]===i.timezoneCustom?B=t[60]:(B=(0,$.jsx)(Z,{value:`__custom__`,children:i.timezoneCustom}),t[59]=i.timezoneCustom,t[60]=B);let V;t[61]!==L||t[62]!==R||t[63]!==z||t[64]!==B||t[65]!==v?(V=(0,$.jsxs)(Ee,{className:L,value:v,onChange:R,children:[z,B]}),t[61]=L,t[62]=R,t[63]=z,t[64]=B,t[65]=v,t[66]=V):V=t[66];let H;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(H=s(`shrink-0 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-xs font-medium text-fg-muted hover:bg-surface-hover hover:text-fg`,Pe.press),t[67]=H):H=t[67];let U;t[68]===b?U=t[69]:(U=()=>{let e=ee();if(!e)return;let t=le.some(t=>t.value===e);p(!t),u(t?``:e),b({timezone:e})},t[68]=b,t[69]=U);let W;t[70]!==i.timezoneDetect||t[71]!==U?(W=(0,$.jsx)(`button`,{type:`button`,className:H,onClick:U,children:i.timezoneDetect}),t[70]=i.timezoneDetect,t[71]=U,t[72]=W):W=t[72];let G;t[73]!==V||t[74]!==W?(G=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[V,W]}),t[73]=V,t[74]=W,t[75]=G):G=t[75];let K;t[76]!==l||t[77]!==o||t[78]!==f||t[79]!==b?(K=f?(0,$.jsx)(`input`,{className:s(o,`mt-1 font-mono text-xs`),value:l,onChange:e=>{u(e.target.value),b({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null,t[76]=l,t[77]=o,t[78]=f,t[79]=b,t[80]=K):K=t[80];let q;t[81]!==I||t[82]!==G||t[83]!==K?(q=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[I,G,K]}),t[81]=I,t[82]=G,t[83]=K,t[84]=q):q=t[84];let te;t[85]===i.notes?te=t[86]:(te=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.notes}),t[85]=i.notes,t[86]=te);let J;t[87]===o?J=t[88]:(J=s(o,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=o,t[88]=J);let Y;t[89]===b?Y=t[90]:(Y=e=>b({notes:e.target.value}),t[89]=b,t[90]=Y);let ne;t[91]!==i.notesPlaceholder||t[92]!==J||t[93]!==Y||t[94]!==n.notes?(ne=(0,$.jsx)(`textarea`,{className:J,value:n.notes,onChange:Y,placeholder:i.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=i.notesPlaceholder,t[92]=J,t[93]=Y,t[94]=n.notes,t[95]=ne):ne=t[95];let re;t[96]!==te||t[97]!==ne?(re=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[te,ne]}),t[96]=te,t[97]=ne,t[98]=re):re=t[98];let ie;return t[99]!==E||t[100]!==F||t[101]!==q||t[102]!==re?(ie=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[E,F,q,re]}),t[99]=E,t[100]=F,t[101]=q,t[102]=re,t[103]=ie):ie=t[103],ie}function Ke(e){let t=(0,We.c)(57),{open:n,t:r,onOpenChange:i,onNavigate:a}=e,o;t[0]!==r.helpLearningBody||t[1]!==r.helpLearningTitle?(o={icon:Le,title:r.helpLearningTitle,body:r.helpLearningBody},t[0]=r.helpLearningBody,t[1]=r.helpLearningTitle,t[2]=o):o=t[2];let c;t[3]!==r.helpSharingBody||t[4]!==r.helpSharingTitle?(c={icon:j,title:r.helpSharingTitle,body:r.helpSharingBody},t[3]=r.helpSharingBody,t[4]=r.helpSharingTitle,t[5]=c):c=t[5];let l;t[6]!==r.helpSourcesBody||t[7]!==r.helpSourcesTitle?(l={icon:g,title:r.helpSourcesTitle,body:r.helpSourcesBody},t[6]=r.helpSourcesBody,t[7]=r.helpSourcesTitle,t[8]=l):l=t[8];let u;t[9]!==r.helpControlBody||t[10]!==r.helpControlTitle?(u={icon:re,title:r.helpControlTitle,body:r.helpControlBody},t[9]=r.helpControlBody,t[10]=r.helpControlTitle,t[11]=u):u=t[11];let d;t[12]!==o||t[13]!==c||t[14]!==l||t[15]!==u?(d=[o,c,l,u],t[12]=o,t[13]=c,t[14]=l,t[15]=u,t[16]=d):d=t[16];let f=d,h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(B,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,Ne)}),t[17]=h):h=t[17];let v;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(v=s(`fixed right-3 top-1/2 flex h-[min(44rem,calc(100dvh-1.5rem))] w-[min(30rem,calc(100vw-1.5rem))] -translate-y-1/2 flex-col overflow-hidden`,pe,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[18]=v):v=t[18];let y;t[19]===r.helpTitle?y=t[20]:(y=(0,$.jsx)(T,{className:`text-base font-semibold text-fg`,children:r.helpTitle}),t[19]=r.helpTitle,t[20]=y);let x;t[21]===r.helpSubtitle?x=t[22]:(x=(0,$.jsx)(P,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.helpSubtitle}),t[21]=r.helpSubtitle,t[22]=x);let S;t[23]!==y||t[24]!==x?(S=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[y,x]}),t[23]=y,t[24]=x,t[25]=S):S=t[25];let C;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,$.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[26]=C):C=t[26];let w;t[27]===r.close?w=t[28]:(w=(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r.close,children:C})}),t[27]=r.close,t[28]=w);let E;t[29]!==S||t[30]!==w?(E=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[S,w]}),t[29]=S,t[30]=w,t[31]=E):E=t[31];let O;t[32]===f?O=t[33]:(O=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-2`,children:f.map(qe)}),t[32]=f,t[33]=O);let k;t[34]!==a||t[35]!==i?(k=()=>{i(!1),a(`sources`)},t[34]=a,t[35]=i,t[36]=k):k=t[36];let A;t[37]!==r.tabs.sources||t[38]!==k?(A=(0,$.jsx)(p,{type:`button`,variant:`ghost`,onClick:k,children:r.tabs.sources}),t[37]=r.tabs.sources,t[38]=k,t[39]=A):A=t[39];let M;t[40]!==a||t[41]!==i?(M=()=>{i(!1),a(`privacy`)},t[40]=a,t[41]=i,t[42]=M):M=t[42];let N;t[43]!==r.openPrivacyControls||t[44]!==M?(N=(0,$.jsx)(p,{type:`button`,variant:`secondary`,onClick:M,children:r.openPrivacyControls}),t[43]=r.openPrivacyControls,t[44]=M,t[45]=N):N=t[45];let F;t[46]!==A||t[47]!==N?(F=(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[A,N]}),t[46]=A,t[47]=N,t[48]=F):F=t[48];let I;t[49]!==E||t[50]!==O||t[51]!==F?(I=(0,$.jsxs)(_,{children:[h,(0,$.jsxs)(b,{className:v,children:[E,O,F]})]}),t[49]=E,t[50]=O,t[51]=F,t[52]=I):I=t[52];let R;return t[53]!==i||t[54]!==n||t[55]!==I?(R=(0,$.jsx)(m,{open:n,onOpenChange:i,children:I}),t[53]=i,t[54]=n,t[55]=I,t[56]=R):R=t[56],R}function qe(e){let{icon:t,title:n,body:r}=e;return(0,$.jsxs)(`section`,{className:`flex gap-3 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,$.jsx)(`span`,{className:`flex size-8 shrink-0 items-center justify-center rounded-lg bg-surface-muted text-fg-muted`,children:(0,$.jsx)(t,{className:`size-4`,"aria-hidden":!0})}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r})]})]},n)}var Je={zh:[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`],en:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]};function Ye(e,t){if(e.kind===`interval`){let n=t===`zh`?`每 ${e.everyHours} 小时`:`Every ${e.everyHours} hours`;return e.minute===0?n:t===`zh`?`${n},整点后 ${e.minute} 分`:`${n}, at :${String(e.minute).padStart(2,`0`)}`}if(e.kind===`daily`)return t===`zh`?`每天 ${e.time}`:`Daily at ${e.time}`;let n=Je[t][e.weekday];return t===`zh`?`每${n} ${e.time}`:`Every ${n} at ${e.time}`}function Xe(e,t,n){return e?new Intl.DateTimeFormat(t===`zh`?`zh-CN`:`en-US`,{timeZone:n,month:`short`,day:`numeric`,weekday:`short`,hour:`2-digit`,minute:`2-digit`,hourCycle:`h23`}).format(new Date(e)):t===`zh`?`暂无计划`:`Not scheduled`}function Ze(e,t){let n=new Intl.DateTimeFormat(`en`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts().find(e=>e.type===`timeZoneName`)?.value,r=t===`zh`&&e===`Asia/Shanghai`?`中国标准时间`:e;return n?`${r} (${n.replace(`GMT`,`UTC`)})`:r}var Qe={light:{kind:`interval`,everyHours:6,minute:0},deep:{kind:`daily`,time:`03:00`},rem:{kind:`weekly`,weekday:0,time:`05:00`}},$e=[1,2,3,4,6,8,12,24];function et(e){let t=(0,We.c)(136),{open:n,phase:r,value:i,language:a,saving:o,onOpenChange:c,onSave:l}=e,u=a===`zh`,[d,f]=(0,Q.useState)(i),h,g;t[0]!==n||t[1]!==i?(h=()=>{n&&f(i)},g=[n,i],t[0]=n,t[1]=i,t[2]=h,t[3]=g):(h=t[2],g=t[3]),(0,Q.useEffect)(h,g);let v;t[4]===d?v=t[5]:(v=e=>{let t=d.schedule,n=t.kind===`daily`||t.kind===`weekly`?t.time:`03:00`,r=e===`interval`?{kind:e,everyHours:6,minute:0}:e===`daily`?{kind:e,time:n}:{kind:e,weekday:0,time:n};f({...d,schedule:r})},t[4]=d,t[5]=v);let y=v,x;t[6]===d?x=t[7]:(x=e=>{d.schedule.kind===`interval`&&f({...d,schedule:{...d.schedule,...e}})},t[6]=d,t[7]=x);let S=x,C;t[8]===d?C=t[9]:(C=e=>{d.schedule.kind===`weekly`&&f({...d,schedule:{...d.schedule,...e}})},t[8]=d,t[9]=C);let w=C,E;t[10]===d?E=t[11]:(E=e=>{d.schedule.kind!==`interval`&&f({...d,schedule:{...d.schedule,time:e}})},t[10]=d,t[11]=E);let O=E,k;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(B,{className:s(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,Ne)}),t[12]=k):k=t[12];let A;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(A=s(`fixed left-1/2 top-1/2 flex h-[min(38rem,calc(100dvh-1.5rem))] w-[min(32rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden`,pe,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[13]=A):A=t[13];let j;t[14]===r?j=t[15]:(j=r.toUpperCase(),t[14]=r,t[15]=j);let M=u?`运行计划`:`Schedule`,N;t[16]!==M||t[17]!==j?(N=(0,$.jsxs)(T,{className:`text-base font-semibold text-fg`,children:[j,` · `,M]}),t[16]=M,t[17]=j,t[18]=N):N=t[18];let F=u?`设置后台记忆整理的频率和时间。`:`Choose when background memory consolidation runs.`,I;t[19]===F?I=t[20]:(I=(0,$.jsx)(P,{className:`mt-1 text-sm text-fg-muted`,children:F}),t[19]=F,t[20]=I);let R;t[21]!==N||t[22]!==I?(R=(0,$.jsxs)(`div`,{children:[N,I]}),t[21]=N,t[22]=I,t[23]=R):R=t[23];let z=u?`关闭`:`Close`,V;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,$.jsx)(D,{className:`size-4`}),t[24]=V):V=t[24];let H;t[25]===z?H=t[26]:(H=(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(p,{variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":z,children:V})}),t[25]=z,t[26]=H);let U;t[27]!==R||t[28]!==H?(U=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[R,H]}),t[27]=R,t[28]=H,t[29]=U):U=t[29];let W=u?`自动运行`:`Automatic runs`,G;t[30]===W?G=t[31]:(G=(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:W}),t[30]=W,t[31]=G);let ee=u?`关闭后仍可手动立即运行。`:`You can still run this phase manually.`,K;t[32]===ee?K=t[33]:(K=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:ee}),t[32]=ee,t[33]=K);let q;t[34]!==G||t[35]!==K?(q=(0,$.jsxs)(`div`,{children:[G,K]}),t[34]=G,t[35]=K,t[36]=q):q=t[36];let te=d.enabled,Y=d.enabled?`bg-accent`:`bg-surface-active`,ne;t[37]===Y?ne=t[38]:(ne=s(`relative h-6 w-11 shrink-0 overflow-hidden rounded-full transition-colors`,Y),t[37]=Y,t[38]=ne);let re;t[39]===d?re=t[40]:(re=()=>f({...d,enabled:!d.enabled}),t[39]=d,t[40]=re);let ie=d.enabled&&`translate-x-5`,ae;t[41]===ie?ae=t[42]:(ae=s(`absolute left-0.5 top-0.5 size-5 rounded-full bg-white shadow-sm transition-transform`,ie),t[41]=ie,t[42]=ae);let oe;t[43]===ae?oe=t[44]:(oe=(0,$.jsx)(`span`,{className:ae}),t[43]=ae,t[44]=oe);let se;t[45]!==d.enabled||t[46]!==ne||t[47]!==re||t[48]!==oe?(se=(0,$.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":te,className:ne,onClick:re,children:oe}),t[45]=d.enabled,t[46]=ne,t[47]=re,t[48]=oe,t[49]=se):se=t[49];let ce;t[50]!==q||t[51]!==se?(ce=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-xl border border-edge-subtle bg-surface-subtle px-4 py-3`,children:[q,se]}),t[50]=q,t[51]=se,t[52]=ce):ce=t[52];let le=u?`运行频率`:`Frequency`,ue;t[53]===le?ue=t[54]:(ue=(0,$.jsx)(`span`,{children:le}),t[53]=le,t[54]=ue);let de;t[55]===y?de=t[56]:(de=e=>y(e.target.value),t[55]=y,t[56]=de);let X=u?`每隔几小时`:`Every few hours`,fe;t[57]===X?fe=t[58]:(fe=(0,$.jsx)(Z,{value:`interval`,children:X}),t[57]=X,t[58]=fe);let me=u?`每天`:`Daily`,he;t[59]===me?he=t[60]:(he=(0,$.jsx)(Z,{value:`daily`,children:me}),t[59]=me,t[60]=he);let ge=u?`每周`:`Weekly`,_e;t[61]===ge?_e=t[62]:(_e=(0,$.jsx)(Z,{value:`weekly`,children:ge}),t[61]=ge,t[62]=_e);let ve;t[63]!==d.schedule.kind||t[64]!==de||t[65]!==fe||t[66]!==he||t[67]!==_e?(ve=(0,$.jsxs)(Ee,{value:d.schedule.kind,onChange:de,children:[fe,he,_e]}),t[63]=d.schedule.kind,t[64]=de,t[65]=fe,t[66]=he,t[67]=_e,t[68]=ve):ve=t[68];let ye;t[69]!==ue||t[70]!==ve?(ye=(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[ue,ve]}),t[69]=ue,t[70]=ve,t[71]=ye):ye=t[71];let be;t[72]!==d.schedule.everyHours||t[73]!==d.schedule.kind||t[74]!==d.schedule.minute||t[75]!==S||t[76]!==u?(be=d.schedule.kind===`interval`?(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`间隔`:`Interval`}),(0,$.jsx)(Ee,{value:String(d.schedule.everyHours),onChange:e=>S({everyHours:Number(e.target.value)}),children:$e.map(e=>(0,$.jsx)(Z,{value:String(e),children:u?`${e} 小时`:`${e} hours`},e))})]}),(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`开始分钟`:`Minute`}),(0,$.jsx)(Ee,{value:String(d.schedule.minute),onChange:e=>S({minute:Number(e.target.value)}),children:[0,15,30,45].map(nt)})]})]}):null,t[72]=d.schedule.everyHours,t[73]=d.schedule.kind,t[74]=d.schedule.minute,t[75]=S,t[76]=u,t[77]=be):be=t[77];let xe;t[78]!==d.schedule.kind||t[79]!==d.schedule.weekday||t[80]!==w||t[81]!==u?(xe=d.schedule.kind===`weekly`?(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`星期`:`Weekday`}),(0,$.jsx)(Ee,{value:String(d.schedule.weekday),onChange:e=>w({weekday:Number(e.target.value)}),children:(u?[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`]:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`]).map(tt)})]}):null,t[78]=d.schedule.kind,t[79]=d.schedule.weekday,t[80]=w,t[81]=u,t[82]=xe):xe=t[82];let Se;t[83]!==d.schedule.kind||t[84]!==d.schedule.time||t[85]!==O||t[86]!==u?(Se=d.schedule.kind===`daily`||d.schedule.kind===`weekly`?(0,$.jsxs)(`label`,{className:`block space-y-2 text-sm font-medium text-fg`,children:[(0,$.jsx)(`span`,{children:u?`运行时间`:`Run time`}),(0,$.jsx)(Be,{value:d.schedule.time,minuteStep:15,ariaLabel:u?`运行时间`:`Run time`,onChange:O})]}):null,t[83]=d.schedule.kind,t[84]=d.schedule.time,t[85]=O,t[86]=u,t[87]=Se):Se=t[87];let Ce=u?`计划预览`:`Schedule preview`,we;t[88]===Ce?we=t[89]:(we=(0,$.jsx)(`p`,{className:`text-xs font-medium text-accent-fg`,children:Ce}),t[88]=Ce,t[89]=we);let Te;t[90]!==d.schedule||t[91]!==a?(Te=Ye(d.schedule,a),t[90]=d.schedule,t[91]=a,t[92]=Te):Te=t[92];let De;t[93]===Te?De=t[94]:(De=(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:Te}),t[93]=Te,t[94]=De);let Oe;t[95]!==we||t[96]!==De?(Oe=(0,$.jsxs)(`div`,{className:`rounded-xl bg-accent-soft px-4 py-3`,children:[we,De]}),t[95]=we,t[96]=De,t[97]=Oe):Oe=t[97];let ke;t[98]!==ce||t[99]!==ye||t[100]!==be||t[101]!==xe||t[102]!==Se||t[103]!==Oe?(ke=(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-5 overflow-y-auto px-5 py-5`,children:[ce,ye,be,xe,Se,Oe]}),t[98]=ce,t[99]=ye,t[100]=be,t[101]=xe,t[102]=Se,t[103]=Oe,t[104]=ke):ke=t[104];let Ae;t[105]===r?Ae=t[106]:(Ae=()=>f({enabled:!0,schedule:Qe[r]}),t[105]=r,t[106]=Ae);let je;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(je=(0,$.jsx)(J,{className:`size-4`}),t[107]=je):je=t[107];let Me=u?`恢复推荐值`:`Restore recommended`,Pe;t[108]!==o||t[109]!==Ae||t[110]!==Me?(Pe=(0,$.jsxs)(p,{type:`button`,variant:`ghost`,disabled:o,onClick:Ae,children:[je,Me]}),t[108]=o,t[109]=Ae,t[110]=Me,t[111]=Pe):Pe=t[111];let Fe=u?`取消`:`Cancel`,Ie;t[112]!==o||t[113]!==Fe?(Ie=(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:o,children:Fe})}),t[112]=o,t[113]=Fe,t[114]=Ie):Ie=t[114];let Le;t[115]!==d||t[116]!==l?(Le=()=>void l(d),t[115]=d,t[116]=l,t[117]=Le):Le=t[117];let Re=o?u?`保存中…`:`Saving…`:u?`保存`:`Save`,ze;t[118]!==o||t[119]!==Le||t[120]!==Re?(ze=(0,$.jsx)(p,{type:`button`,variant:`primary`,disabled:o,onClick:Le,children:Re}),t[118]=o,t[119]=Le,t[120]=Re,t[121]=ze):ze=t[121];let Ve;t[122]!==Ie||t[123]!==ze?(Ve=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[Ie,ze]}),t[122]=Ie,t[123]=ze,t[124]=Ve):Ve=t[124];let He;t[125]!==Pe||t[126]!==Ve?(He=(0,$.jsxs)(`footer`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-5 py-4`,children:[Pe,Ve]}),t[125]=Pe,t[126]=Ve,t[127]=He):He=t[127];let Ue;t[128]!==U||t[129]!==ke||t[130]!==He?(Ue=(0,$.jsxs)(_,{children:[k,(0,$.jsxs)(b,{className:A,children:[U,ke,He]})]}),t[128]=U,t[129]=ke,t[130]=He,t[131]=Ue):Ue=t[131];let Ge;return t[132]!==c||t[133]!==n||t[134]!==Ue?(Ge=(0,$.jsx)(m,{open:n,onOpenChange:c,children:Ue}),t[132]=c,t[133]=n,t[134]=Ue,t[135]=Ge):Ge=t[135],Ge}function tt(e,t){return(0,$.jsx)(Z,{value:String(t),children:e},e)}function nt(e){return(0,$.jsx)(Z,{value:String(e),children:String(e).padStart(2,`0`)},e)}var rt=[`UTC`,`Asia/Shanghai`,`Asia/Hong_Kong`,`Asia/Tokyo`,`Asia/Singapore`,`Asia/Kolkata`,`Europe/London`,`Europe/Paris`,`America/New_York`,`America/Chicago`,`America/Denver`,`America/Los_Angeles`,`Australia/Sydney`],it={zh:{light:[`快速整理`,`整理近期产生的记忆信号。`],deep:[`深度巩固`,`强化反复被证明有用的理解。`],rem:[`模式发现`,`从跨任务证据中提出长期模式。`]},en:{light:[`Quick consolidation`,`Organizes recently created memory signals.`],deep:[`Deep consolidation`,`Strengthens understanding that repeatedly proves useful.`],rem:[`Pattern discovery`,`Proposes long-term patterns from evidence across tasks.`]}};function at({language:e}){let t=e===`zh`,{data:n,error:r,isLoading:i,mutate:a}=u(`/api/you/dreaming`,w),[o,s]=(0,Q.useState)(null),[c,l]=(0,Q.useState)(null);if(i)return(0,$.jsx)(X,{className:`h-64 rounded-2xl`});if(r||!n)return(0,$.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t?`无法加载 Dreaming 状态`:`Could not load Dreaming status`});let d=t?{off:`关闭`,observe:`只观察`,review:`生成待确认建议`,automatic:`自动应用高置信结果`}:{off:`Off`,observe:`Observe only`,review:`Propose for review`,automatic:`Apply high-confidence results`},m=t?{insufficient_feedback:`还需要更多经过评价的回答`,low_helpful_rate:`记忆帮助率尚未达标`,high_record_error_rate:`记录错误率偏高`,sensitive_feedback_detected:`近期出现敏感信息反馈`,insufficient_dreaming_runs:`还需要更多稳定运行记录`,high_dreaming_failure_rate:`后台整理失败率偏高`}:{insufficient_feedback:`More evaluated responses are required`,low_helpful_rate:`Memory helpfulness is below the threshold`,high_record_error_rate:`Record error rate is too high`,sensitive_feedback_detected:`Recent sensitive-information feedback was detected`,insufficient_dreaming_runs:`More stable Dreaming runs are required`,high_dreaming_failure_rate:`Dreaming failure rate is too high`},h=async(e,t)=>{s(t);try{return await q(e),await a(),!0}catch(e){return C({type:`error`,title:`Dreaming`,message:e instanceof Error?e.message:String(e)}),!1}finally{s(null)}},g=async e=>{s(`run:${e}`);try{await _e(e),await a()}catch(e){C({type:`error`,title:`Dreaming`,message:e instanceof Error?e.message:String(e)})}finally{s(null)}},_=[...new Set([n.settings.timezone,...rt])],v=it[e];return(0,$.jsxs)(`div`,{id:`you-panel-dreaming`,role:`tabpanel`,"aria-labelledby":`you-tab-dreaming`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(y,{className:`size-4 text-accent`,"aria-hidden":!0}),`Dreaming`]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t?`在空闲时整理已有证据、发现模式,并用可审计的方式提出或应用长期理解。`:`Consolidates existing evidence during idle time, discovers patterns, and records every proposal or change.`})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`grid gap-4 md:grid-cols-[minmax(0,1fr)_16rem]`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t?`运行模式`:`Operating mode`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t?`当前生效:${d[n.config.mode]} · 写入级别:${n.config.writeDisposition}`:`Effective: ${d[n.config.mode]} · write disposition: ${n.config.writeDisposition}`})]}),(0,$.jsx)(Ee,{value:n.settings.mode,disabled:o!==null,onChange:e=>void h({...n.settings,mode:e.target.value},`mode`),children:Object.entries(d).map(([e,t])=>(0,$.jsx)(Z,{value:e,children:t},e))})]}),n.settings.mode===`automatic`&&!n.readiness.ready?(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-warning/25 bg-warning-soft/35 px-4 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t?`自动写入暂时降级为待确认`:`Automatic writes are temporarily downgraded to review`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.readiness.reasons.map(e=>m[e]??e).join(t?`;`:`; `)})]}):null]}),(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-end justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(K,{className:`size-4 text-fg-muted`}),t?`运行计划`:`Schedule`]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:Ze(n.settings.timezone,e)})]}),(0,$.jsx)(`div`,{className:`w-full sm:w-64`,children:(0,$.jsx)(Ee,{value:n.settings.timezone,disabled:o!==null,onChange:e=>void h({...n.settings,timezone:e.target.value},`timezone`),children:_.map(t=>(0,$.jsx)(Z,{value:t,children:Ze(t,e)},t))})})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-3`,children:[`light`,`deep`,`rem`].map(r=>{let i=n.settings.phases[r],a=n.config.phases[r],[s,c]=v[r],u=i.enabled&&n.config.enabled;return(0,$.jsxs)(`article`,{className:`flex min-h-52 flex-col rounded-2xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-wide text-accent`,children:r}),(0,$.jsx)(`h4`,{className:`mt-1 text-sm font-semibold text-fg`,children:s})]}),(0,$.jsx)(`span`,{className:u?`text-xs text-success`:`text-xs text-fg-subtle`,children:u?t?`已启用`:`Enabled`:i.enabled?t?`随模式暂停`:`Paused by mode`:t?`已暂停`:`Paused`})]}),(0,$.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:c}),(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-muted px-3 py-3`,children:[(0,$.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:Ye(i.schedule,e)}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:[t?`下次运行:`:`Next run: `,u?Xe(a.nextRunsAt[0],e,n.settings.timezone):t?`已暂停`:`Paused`]})]}),(0,$.jsxs)(`div`,{className:`mt-auto flex gap-2 pt-4`,children:[(0,$.jsxs)(p,{type:`button`,variant:`secondary`,className:`flex-1`,disabled:o!==null,onClick:()=>l(r),children:[(0,$.jsx)(k,{className:`size-3.5`}),t?`编辑计划`:`Edit`]}),(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`flex-1`,disabled:!n.config.enabled||o!==null,onClick:()=>void g(r),children:[(0,$.jsx)(f,{className:`size-3.5`}),t?`立即运行`:`Run now`]})]})]},r)})})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t?`最近运行`:`Recent runs`}),n.runs.length?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:n.runs.map(t=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`p`,{className:`text-sm font-medium uppercase text-fg`,children:[t.phase,` · `,t.mode]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.reason??t.status})]}),(0,$.jsxs)(`div`,{className:`text-right text-xs text-fg-subtle`,children:[(0,$.jsx)(`p`,{children:t.status}),(0,$.jsx)(`p`,{children:De(Date.parse(t.startedAt),e)})]})]},t.runId))}):(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t?`还没有运行记录。`:`No runs yet.`})]}),c?(0,$.jsx)(et,{open:!0,phase:c,value:n.settings.phases[c],language:e,saving:o===`schedule:${c}`,onOpenChange:e=>{e||l(null)},onSave:async e=>{await h({...n.settings,phases:{...n.settings.phases,[c]:e}},`schedule:${c}`)&&l(null)}}):null]})}function ot(e){let t=(0,We.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:o}=e,l=c(r).you,[u,d]=(0,Q.useState)(`keep`),f=n?.accountLabel??(n?.accountCount&&n.accountCount>1&&n.accountOrdinal?l.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),h,v;t[0]===n?(h=t[1],v=t[2]):(h=()=>{n&&d(`keep`)},v=[n],t[0]=n,t[1]=h,t[2]=v),(0,Q.useEffect)(h,v);let y;t[3]!==i||t[4]!==a?(y=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=y):y=t[5];let x;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(B,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=x):x=t[6];let S;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[7]=S):S=t[7];let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>d(`keep`),t[8]=C):C=t[8];let w=u===`keep`?`border-accent/40 bg-accent-soft/35`:`border-edge-subtle hover:bg-surface-hover`,E;t[9]===w?E=t[10]:(E=s(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,w),t[9]=w,t[10]=E);let O;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,$.jsx)(g,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=O):O=t[11];let k;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>d(`delete`),t[12]=k):k=t[12];let A=u===`delete`?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,j;t[13]===A?j=t[14]:(j=s(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,A),t[13]=A,t[14]=j);let M;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(Se,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=M):M=t[15];let N=l.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),F;t[16]===N?F=t[17]:(F=(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:N}),t[16]=N,t[17]=F);let I;t[18]!==i||t[19]!==l.cancel?(I=(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:i,children:l.cancel})}),t[18]=i,t[19]=l.cancel,t[20]=I):I=t[20];let R=u===`delete`?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,z;t[21]!==o||t[22]!==u?(z=()=>o(u),t[21]=o,t[22]=u,t[23]=z):z=t[23];let H;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(V,{className:`size-4`,"aria-hidden":!0}),t[24]=H):H=t[24];let U=i?l.disconnecting:l.disconnectAction,W;t[25]!==i||t[26]!==R||t[27]!==z||t[28]!==U?(W=(0,$.jsxs)(p,{type:`button`,variant:`secondary`,className:R,disabled:i,onClick:z,children:[H,U]}),t[25]=i,t[26]=R,t[27]=z,t[28]=U,t[29]=W):W=t[29];let G;return t[30]!==I||t[31]!==W?(G=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[I,W]}),t[30]=I,t[31]=W,t[32]=G):G=t[32],(0,$.jsx)(m,{open:n!==null,onOpenChange:y,children:(0,$.jsxs)(_,{children:[x,(0,$.jsxs)(b,{className:`fixed left-1/2 top-1/2 z-[131] flex h-[min(31rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-elevated`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(T,{className:`text-base font-semibold text-fg`,children:l.disconnectTitle}),(0,$.jsx)(P,{className:`mt-1 text-sm text-fg-muted`,children:l.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":l.cancel,disabled:i,children:S})})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-3 overflow-y-auto p-5`,children:[(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-muted px-4 py-3 text-xs leading-5 text-fg-muted`,children:[f?(0,$.jsx)(`p`,{className:`font-medium text-fg`,children:l.disconnectAccount.replace(`{{account}}`,f)}):null,(0,$.jsx)(`p`,{children:l.disconnectImpact.replace(`{{items}}`,String(n?.knowledgeItemCount??0)).replace(`{{understandings}}`,String(n?.derivedUnderstandingCount??0))})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":u===`keep`,onClick:C,className:E,children:[O,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectKeepTitle}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:l.disconnectKeepBody})]})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":u===`delete`,onClick:k,disabled:!n?.derivedUnderstandingCount,className:j,children:[M,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:l.disconnectDeleteTitle}),F]})]})]}),G]})]})})}var st={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function ct(e){if(e.branding?.logoUrl)return e.branding;let t=st[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}function lt(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replace(`{{${t}}}`,String(n)),e)}function ut(e){return e.status===`active`||e.status===`connected`}function dt(e,t){return!ut(e)||e.learning?.status===`failed`||e.lastSyncStatus===`failed`?{summary:t.sourceNeedsAttention,tone:`attention`,badge:t.attentionTitle}:e.learning?.status===`paused`?{summary:t.sourcePausedSummary,tone:`paused`,badge:t.paused}:e.learning?.status===`queued`||e.learning?.status===`running`?{summary:t.sourceReading,tone:`learning`}:e.learningFunnel.provisionalClaims>0?{summary:lt(t.sourcePendingReview,{count:e.learningFunnel.provisionalClaims}),tone:`review`}:e.learningFunnel.activeClaims>0?{summary:lt(t.sourceReliable,{count:e.learningFunnel.activeClaims}),tone:`useful`}:e.learningFunnel.attributedItems>0?{summary:lt(t.sourceStillLearning,{count:e.learningFunnel.attributedItems}),tone:`learning`}:e.learningFunnel.indexedItems>0?{summary:lt(t.sourceNoPersonalSignal,{count:e.learningFunnel.indexedItems}),tone:`neutral`}:e.learning?.status===`completed`?{summary:t.sourceNoRecentSignal,tone:`neutral`}:{summary:t.sourcePreparing,tone:`learning`}}function ft(e,t){let n=e.id.toLocaleLowerCase();return/(github|gitlab|linear|jira)/.test(n)?t.sourcePurposeWork:/(gmail|outlook|slack|teams)/.test(n)?t.sourcePurposeCommunication:/calendar/.test(n)?t.sourcePurposeSchedule:/(docs|drive|notion|sheets|excel|onedrive|one-drive|local-files)/.test(n)?t.sourcePurposeDocuments:t.sourcePurposeDefault}function pt(e,t){return e.accountLabel?e.accountLabel:e.accountCount&&e.accountCount>1&&e.accountOrdinal?lt(t.sourceAccountFallback,{index:e.accountOrdinal,count:e.accountCount}):t.sourceUnknownAccount}function mt(e){return e.lastSyncAt??e.learning?.updatedAt??e.lastActivityAt??e.lastConnectedAt}function ht(e,t){let n=Date.parse(e);return Number.isFinite(n)?De(n,t):e}function gt(e,t){return{attention:0,learning:1,review:2,useful:3,paused:4,neutral:5}[dt(e,t).tone]}function _t(e){let t=(0,We.c)(173),{source:n,language:r,t:i,busy:a,onOpenChange:o,onLearn:c,onPause:l,onConfigure:u,onDisconnect:d,onViewUnderstanding:f}=e;if(!n)return null;let h;t[0]!==n||t[1]!==i?(h=dt(n,i),t[0]=n,t[1]=i,t[2]=h):h=t[2];let g=h,v,y,x,C,w,E,O,k,A,j,M,N,F,I,R,z;if(t[3]!==r||t[4]!==o||t[5]!==f||t[6]!==g.summary||t[7]!==g.tone||t[8]!==n||t[9]!==i){let e=mt(n);C=n.learning?.status===`paused`,w=g.tone===`attention`,x=m,O=!0,k=o,y=_,t[26]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(B,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[26]=E):E=t[26],v=b,R=`fixed inset-y-0 right-0 z-[131] flex h-dvh w-[min(34rem,100vw)] flex-col overflow-hidden border-l border-edge bg-surface-panel shadow-elevated`;let a=n.displayName,c;t[27]===n?c=t[28]:(c=ct(n),t[27]=n,t[28]=c);let l;t[29]!==n.displayName||t[30]!==c?(l=(0,$.jsx)(Ue,{connector:{displayName:a,branding:c},size:`sm`}),t[29]=n.displayName,t[30]=c,t[31]=l):l=t[31];let u;t[32]===n.displayName?u=t[33]:(u=(0,$.jsx)(T,{className:`truncate text-base font-semibold text-fg`,children:n.displayName}),t[32]=n.displayName,t[33]=u);let d;t[34]!==n||t[35]!==i?(d=pt(n,i),t[34]=n,t[35]=i,t[36]=d):d=t[36];let h;t[37]===d?h=t[38]:(h=(0,$.jsx)(P,{className:`mt-0.5 truncate text-sm text-fg-muted`,children:d}),t[37]=d,t[38]=h);let S;t[39]!==u||t[40]!==h?(S=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,h]}),t[39]=u,t[40]=h,t[41]=S):S=t[41];let V;t[42]!==l||t[43]!==S?(V=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[l,S]}),t[42]=l,t[43]=S,t[44]=V):V=t[44];let H;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[45]=H):H=t[45];let U;t[46]===i.close?U=t[47]:(U=(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`rounded-lg p-1.5 text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":i.close,children:H})}),t[46]=i.close,t[47]=U),t[48]!==V||t[49]!==U?(z=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[V,U]}),t[48]=V,t[49]=U,t[50]=z):z=t[50],F=`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`;let W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(Le,{className:`size-4 text-accent`,"aria-hidden":!0}),t[51]=W):W=t[51];let G;t[52]===i.sourceTaskTitle?G=t[53]:(G=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[W,i.sourceTaskTitle]}),t[52]=i.sourceTaskTitle,t[53]=G);let ee=g.tone===`attention`?`border-warning/30 bg-warning-soft text-fg`:`border-edge-subtle bg-surface-muted text-fg`,K;t[54]===ee?K=t[55]:(K=s(`mt-3 rounded-xl border px-4 py-3 text-sm leading-6`,ee),t[54]=ee,t[55]=K);let q;t[56]!==g.summary||t[57]!==K?(q=(0,$.jsx)(`p`,{className:K,children:g.summary}),t[56]=g.summary,t[57]=K,t[58]=q):q=t[58];let te;t[59]===n.learningFunnel.activeClaims?te=t[60]:(te=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.activeClaims}),t[59]=n.learningFunnel.activeClaims,t[60]=te);let J;t[61]===i.sourceReliableMetric?J=t[62]:(J=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourceReliableMetric}),t[61]=i.sourceReliableMetric,t[62]=J);let Y;t[63]!==te||t[64]!==J?(Y=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[te,J]}),t[63]=te,t[64]=J,t[65]=Y):Y=t[65];let ne;t[66]===n.learningFunnel.provisionalClaims?ne=t[67]:(ne=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.provisionalClaims}),t[66]=n.learningFunnel.provisionalClaims,t[67]=ne);let re;t[68]===i.sourcePendingMetric?re=t[69]:(re=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourcePendingMetric}),t[68]=i.sourcePendingMetric,t[69]=re);let ie;t[70]!==ne||t[71]!==re?(ie=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[ne,re]}),t[70]=ne,t[71]=re,t[72]=ie):ie=t[72];let ae;t[73]!==Y||t[74]!==ie?(ae=(0,$.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[Y,ie]}),t[73]=Y,t[74]=ie,t[75]=ae):ae=t[75];let oe;t[76]!==f||t[77]!==n.learningFunnel.activeClaims||t[78]!==n.learningFunnel.provisionalClaims||t[79]!==i.sourceViewUnderstanding?(oe=n.learningFunnel.activeClaims>0||n.learningFunnel.provisionalClaims>0?(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`mt-2 px-2`,onClick:f,children:[i.sourceViewUnderstanding,(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0})]}):null,t[76]=f,t[77]=n.learningFunnel.activeClaims,t[78]=n.learningFunnel.provisionalClaims,t[79]=i.sourceViewUnderstanding,t[80]=oe):oe=t[80],t[81]!==G||t[82]!==q||t[83]!==ae||t[84]!==oe?(I=(0,$.jsxs)(`section`,{children:[G,q,ae,oe]}),t[81]=G,t[82]=q,t[83]=ae,t[84]=oe,t[85]=I):I=t[85],A=`border-t border-edge-subtle pt-5`;let ce;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(se,{className:`size-4 text-accent`,"aria-hidden":!0}),t[86]=ce):ce=t[86],t[87]===i.sourceRecentRunTitle?j=t[88]:(j=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[ce,i.sourceRecentRunTitle]}),t[87]=i.sourceRecentRunTitle,t[88]=j);let le;t[89]!==n.learningFunnel.activeClaims||t[90]!==n.learningFunnel.attributedItems||t[91]!==n.learningFunnel.indexedItems||t[92]!==i.sourceRecentRunSummary?(le=lt(i.sourceRecentRunSummary,{indexed:n.learningFunnel.indexedItems,attributed:n.learningFunnel.attributedItems,claims:n.learningFunnel.activeClaims}),t[89]=n.learningFunnel.activeClaims,t[90]=n.learningFunnel.attributedItems,t[91]=n.learningFunnel.indexedItems,t[92]=i.sourceRecentRunSummary,t[93]=le):le=t[93],t[94]===le?M=t[95]:(M=(0,$.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:le}),t[94]=le,t[95]=M),N=e?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:lt(i.sourceUpdatedAt,{time:ht(e,r)})}):null,t[3]=r,t[4]=o,t[5]=f,t[6]=g.summary,t[7]=g.tone,t[8]=n,t[9]=i,t[10]=v,t[11]=y,t[12]=x,t[13]=C,t[14]=w,t[15]=E,t[16]=O,t[17]=k,t[18]=A,t[19]=j,t[20]=M,t[21]=N,t[22]=F,t[23]=I,t[24]=R,t[25]=z}else v=t[10],y=t[11],x=t[12],C=t[13],w=t[14],E=t[15],O=t[16],k=t[17],A=t[18],j=t[19],M=t[20],N=t[21],F=t[22],I=t[23],R=t[24],z=t[25];let H;t[96]!==A||t[97]!==j||t[98]!==M||t[99]!==N?(H=(0,$.jsxs)(`section`,{className:A,children:[j,M,N]}),t[96]=A,t[97]=j,t[98]=M,t[99]=N,t[100]=H):H=t[100];let U;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(re,{className:`size-4 text-accent`,"aria-hidden":!0}),t[101]=U):U=t[101];let W;t[102]===i.sourceAccessTitle?W=t[103]:(W=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[U,i.sourceAccessTitle]}),t[102]=i.sourceAccessTitle,t[103]=W);let G;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(ae,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[104]=G):G=t[104];let ee;t[105]===i.sourceReadAccess?ee=t[106]:(ee=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[G,(0,$.jsx)(`span`,{children:i.sourceReadAccess})]}),t[105]=i.sourceReadAccess,t[106]=ee);let K;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,$.jsx)(ae,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[107]=K):K=t[107];let q;t[108]===i.sourceMemoryAccess?q=t[109]:(q=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[K,(0,$.jsx)(`span`,{children:i.sourceMemoryAccess})]}),t[108]=i.sourceMemoryAccess,t[109]=q);let te;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,$.jsx)(re,{className:`mt-1 size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[110]=te):te=t[110];let J=n.access.write?i.sourceWriteAccess:i.sourceNoWriteAccess,Y;t[111]===J?Y=t[112]:(Y=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[te,(0,$.jsx)(`span`,{children:J})]}),t[111]=J,t[112]=Y);let ne;t[113]!==ee||t[114]!==q||t[115]!==Y?(ne=(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-sm leading-6 text-fg-muted`,children:[ee,q,Y]}),t[113]=ee,t[114]=q,t[115]=Y,t[116]=ne):ne=t[116];let ie;t[117]!==W||t[118]!==ne?(ie=(0,$.jsxs)(`section`,{className:`border-t border-edge-subtle pt-5`,children:[W,ne]}),t[117]=W,t[118]=ne,t[119]=ie):ie=t[119];let oe;t[120]!==H||t[121]!==ie||t[122]!==F||t[123]!==I?(oe=(0,$.jsxs)(`div`,{className:F,children:[I,H,ie]}),t[120]=H,t[121]=ie,t[122]=F,t[123]=I,t[124]=oe):oe=t[124];let ce;t[125]===i.sourceManagementTitle?ce=t[126]:(ce=(0,$.jsx)(`p`,{className:`mb-2 px-1 text-xs font-medium text-fg-subtle`,children:i.sourceManagementTitle}),t[125]=i.sourceManagementTitle,t[126]=ce);let le;t[127]!==a||t[128]!==C||t[129]!==w||t[130]!==c||t[131]!==l||t[132]!==n||t[133]!==i.sourcePauseLearning||t[134]!==i.sourceResumeLearning||t[135]!==i.sourceRetryLearning?(le=ut(n)?C||w?(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>c(n),children:[a?(0,$.jsx)(Ie,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(ve,{className:`size-4`,"aria-hidden":!0}),w?i.sourceRetryLearning:i.sourceResumeLearning]}):(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>l(n),children:[(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0}),i.sourcePauseLearning]}):null,t[127]=a,t[128]=C,t[129]=w,t[130]=c,t[131]=l,t[132]=n,t[133]=i.sourcePauseLearning,t[134]=i.sourceResumeLearning,t[135]=i.sourceRetryLearning,t[136]=le):le=t[136];let ue;t[137]!==u||t[138]!==n?(ue=()=>u(n),t[137]=u,t[138]=n,t[139]=ue):ue=t[139];let de;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(de=(0,$.jsx)(be,{className:`size-4`,"aria-hidden":!0}),t[140]=de):de=t[140];let X;t[141]!==i.sourceConnectionSettings||t[142]!==ue?(X=(0,$.jsxs)(p,{type:`button`,variant:`secondary`,onClick:ue,children:[de,i.sourceConnectionSettings]}),t[141]=i.sourceConnectionSettings,t[142]=ue,t[143]=X):X=t[143];let Z;t[144]!==d||t[145]!==n?(Z=()=>d(n),t[144]=d,t[145]=n,t[146]=Z):Z=t[146];let fe;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(V,{className:`size-4`,"aria-hidden":!0}),t[147]=fe):fe=t[147];let pe;t[148]!==i.disconnect||t[149]!==Z?(pe=(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`ml-auto text-danger hover:bg-danger-soft hover:text-danger`,onClick:Z,children:[fe,i.disconnect]}),t[148]=i.disconnect,t[149]=Z,t[150]=pe):pe=t[150];let me;t[151]!==le||t[152]!==X||t[153]!==pe?(me=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[le,X,pe]}),t[151]=le,t[152]=X,t[153]=pe,t[154]=me):me=t[154];let he;t[155]!==ce||t[156]!==me?(he=(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:[ce,me]}),t[155]=ce,t[156]=me,t[157]=he):he=t[157];let _e;t[158]!==v||t[159]!==oe||t[160]!==he||t[161]!==R||t[162]!==z?(_e=(0,$.jsxs)(v,{className:R,children:[z,oe,he]}),t[158]=v,t[159]=oe,t[160]=he,t[161]=R,t[162]=z,t[163]=_e):_e=t[163];let ye;t[164]!==y||t[165]!==E||t[166]!==_e?(ye=(0,$.jsxs)(y,{children:[E,_e]}),t[164]=y,t[165]=E,t[166]=_e,t[167]=ye):ye=t[167];let xe;return t[168]!==x||t[169]!==O||t[170]!==k||t[171]!==ye?(xe=(0,$.jsx)(x,{open:O,onOpenChange:k,children:ye}),t[168]=x,t[169]=O,t[170]=k,t[171]=ye,t[172]=xe):xe=t[172],xe}function vt(e){let t=(0,We.c)(77),{sources:n,recommendations:r,language:i,t:a,busyId:o,onAddSource:c,onConnectRecommendation:l,onLearn:u,onPause:d,onConfigure:f,onDisconnect:m,onViewUnderstanding:h}=e,[g,_]=(0,Q.useState)(null),v;if(t[0]!==n||t[1]!==a){let e=n.filter(bt),r=new Map;for(let t of e){let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}let i;t[3]===a?i=t[4]:(i=(e,t)=>Math.min(...e.accounts.map(e=>gt(e,a)))-Math.min(...t.accounts.map(e=>gt(e,a)))||e.source.displayName.localeCompare(t.source.displayName),t[3]=a,t[4]=i),v=[...r.values()].map(e=>({source:e[0],accounts:e.sort((e,t)=>gt(e,a)-gt(t,a)||pt(e,a).localeCompare(pt(t,a)))})).sort(i),t[0]=n,t[1]=a,t[2]=v}else v=t[2];let y=v,b,x,S,C,w,T,E,D,k;if(t[5]!==y||t[6]!==g||t[7]!==n||t[8]!==a.sourceConnectedSummary||t[9]!==a.sourcesSubtitle||t[10]!==a.sourcesTitle){let e=y.reduce(yt,0),r;t[20]!==g||t[21]!==n?(r=g?n.find(e=>e.instanceId===g)??null:null,t[20]=g,t[21]=n,t[22]=r):r=t[22],b=r,T=`you-panel-sources`,E=`tabpanel`,D=`you-tab-sources`,k=`space-y-5`,w=`flex flex-wrap items-start justify-between gap-3`,t[23]===a.sourcesTitle?x=t[24]:(x=(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:a.sourcesTitle}),t[23]=a.sourcesTitle,t[24]=x),t[25]===a.sourcesSubtitle?S=t[26]:(S=(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:a.sourcesSubtitle}),t[25]=a.sourcesSubtitle,t[26]=S),C=y.length>0?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:lt(a.sourceConnectedSummary,{accounts:e,sources:y.length})}):null,t[5]=y,t[6]=g,t[7]=n,t[8]=a.sourceConnectedSummary,t[9]=a.sourcesSubtitle,t[10]=a.sourcesTitle,t[11]=b,t[12]=x,t[13]=S,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=k}else b=t[11],x=t[12],S=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],k=t[19];let A;t[27]!==x||t[28]!==S||t[29]!==C?(A=(0,$.jsxs)(`div`,{children:[x,S,C]}),t[27]=x,t[28]=S,t[29]=C,t[30]=A):A=t[30];let j;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(O,{className:`size-4`,"aria-hidden":!0}),t[31]=j):j=t[31];let M;t[32]!==c||t[33]!==a.addSource?(M=(0,$.jsxs)(p,{type:`button`,variant:`primary`,onClick:c,children:[j,a.addSource]}),t[32]=c,t[33]=a.addSource,t[34]=M):M=t[34];let N;t[35]!==A||t[36]!==M||t[37]!==w?(N=(0,$.jsxs)(`div`,{className:w,children:[A,M]}),t[35]=A,t[36]=M,t[37]=w,t[38]=N):N=t[38];let P;t[39]!==l||t[40]!==r||t[41]!==a.connectRecommendedSource||t[42]!==a.permissionsBeforeConnectBadge||t[43]!==a.recommendationReason||t[44]!==a.recommendationsTitle?(P=r.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:a.recommendationsTitle}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-3`,children:r.map(e=>(0,$.jsxs)(`article`,{className:`rounded-xl border border-accent/20 bg-accent-soft/20 p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(ve,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h4`,{className:`truncate text-sm font-semibold text-fg`,children:e.sourceName}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:a.recommendationReason.replace(`{{goal}}`,e.taskTitle)})]})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-[11px] text-fg-subtle`,children:a.permissionsBeforeConnectBadge}),(0,$.jsx)(p,{type:`button`,variant:`secondary`,className:`h-8 px-2.5`,onClick:()=>l(e.sourceId),children:a.connectRecommendedSource})]})]},e.sourceId))})]}):null,t[39]=l,t[40]=r,t[41]=a.connectRecommendedSource,t[42]=a.permissionsBeforeConnectBadge,t[43]=a.recommendationReason,t[44]=a.recommendationsTitle,t[45]=P):P=t[45];let F;t[46]!==y||t[47]!==i||t[48]!==c||t[49]!==a?(F=y.length>0?(0,$.jsx)(`div`,{className:`space-y-3`,children:y.map(e=>{let{source:t,accounts:n}=e;return(0,$.jsxs)(`section`,{className:`overflow-hidden rounded-2xl border border-edge-subtle bg-surface-base`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3 border-b border-edge-subtle px-4 py-3.5 sm:px-5`,children:[(0,$.jsx)(Ue,{connector:{displayName:t.displayName,branding:ct(t)},size:`sm`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:t.displayName}),n.length>1?(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:lt(a.sourceAccountCount,{count:n.length})}):null]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:ft(t,a)})]})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>{let t=dt(e,a),n=mt(e);return(0,$.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-3 px-4 py-3.5 text-left transition-colors hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent/40 sm:px-5`,onClick:()=>_(e.instanceId??null),children:[(0,$.jsx)(`span`,{className:s(`size-2 shrink-0 rounded-full`,t.tone===`attention`?`bg-warning`:t.tone===`useful`?`bg-success`:t.tone===`learning`?`bg-accent`:`bg-fg-subtle/50`),"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:pt(e,a)}),t.badge?(0,$.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 text-[11px] font-medium`,t.tone===`attention`?`bg-warning-soft text-fg`:`bg-surface-muted text-fg-muted`),children:t.badge}):null]}),(0,$.jsx)(`span`,{className:s(`mt-1 block text-xs leading-5`,t.tone===`attention`?`text-fg`:`text-fg-muted`),children:t.summary})]}),n?(0,$.jsx)(`span`,{className:`hidden shrink-0 text-xs text-fg-subtle sm:block`,children:lt(a.sourceUpdatedAt,{time:ht(n,i)})}):null,(0,$.jsx)(ge,{className:`size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0})]},e.instanceId)})})]},t.id)})}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center`,children:[(0,$.jsx)(xe,{className:`mx-auto size-5 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:a.noSources}),(0,$.jsxs)(p,{type:`button`,variant:`secondary`,className:`mt-4`,onClick:c,children:[(0,$.jsx)(O,{className:`size-4`,"aria-hidden":!0}),a.addSource]})]}),t[46]=y,t[47]=i,t[48]=c,t[49]=a,t[50]=F):F=t[50];let I=b?o===`source-learning:${b.instanceId}`:!1,L;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(L=e=>{e||_(null)},t[51]=L):L=t[51];let R;t[52]===f?R=t[53]:(R=e=>{_(null),f(e)},t[52]=f,t[53]=R);let z;t[54]===m?z=t[55]:(z=e=>{_(null),m(e)},t[54]=m,t[55]=z);let B;t[56]===h?B=t[57]:(B=()=>{_(null),h()},t[56]=h,t[57]=B);let V;t[58]!==i||t[59]!==u||t[60]!==d||t[61]!==b||t[62]!==a||t[63]!==I||t[64]!==R||t[65]!==z||t[66]!==B?(V=(0,$.jsx)(_t,{source:b,language:i,t:a,busy:I,onOpenChange:L,onLearn:u,onPause:d,onConfigure:R,onDisconnect:z,onViewUnderstanding:B}),t[58]=i,t[59]=u,t[60]=d,t[61]=b,t[62]=a,t[63]=I,t[64]=R,t[65]=z,t[66]=B,t[67]=V):V=t[67];let H;return t[68]!==N||t[69]!==P||t[70]!==F||t[71]!==V||t[72]!==T||t[73]!==E||t[74]!==D||t[75]!==k?(H=(0,$.jsxs)(`div`,{id:T,role:E,"aria-labelledby":D,className:k,children:[N,P,F,V]}),t[68]=N,t[69]=P,t[70]=F,t[71]=V,t[72]=T,t[73]=E,t[74]=D,t[75]=k,t[76]=H):H=t[76],H}function yt(e,t){return e+t.accounts.length}function bt(e){return e.installed}var xt=new Set([`overview`,`memory`,`collaboration`,`sources`,`dreaming`,`privacy`]);function St(e){return e&&xt.has(e)?e:`overview`}var Ct=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],wt=[`relationship`,`routine`,`long_term_goal`],Tt=`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent/50 focus:ring-2 focus:ring-accent/20`;function Et(e,t){return e.replace(`{{count}}`,String(t))}function Dt(e){let t=(0,We.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,$.jsx)(`span`,{className:`inline-flex rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:n}),t[0]=n,t[1]=r),r}function Ot(e,t){let n=Date.parse(e);return Number.isFinite(n)?De(n,t):e}function kt(){let e=(0,We.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(X,{className:`h-24 rounded-2xl`}),e[0]=t):t=e[0];let n;return e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[t,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsx)(X,{className:`h-64 rounded-2xl`}),(0,$.jsx)(X,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function At(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function jt(e){let t=(0,We.c)(19),{item:n,language:r,t:i,busy:a,onConfirm:c,onReject:l,onUpdate:u,onForget:d}=e,[f,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(n.statement),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),x=n.status!==`active`,S=x?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,C;t[0]===S?C=t[1]:(C=s(`rounded-xl border p-3.5`,S),t[0]=S,t[1]=C);let w;t[2]!==a||t[3]!==h||t[4]!==f||t[5]!==_||t[6]!==y||t[7]!==n||t[8]!==r||t[9]!==x||t[10]!==c||t[11]!==d||t[12]!==l||t[13]!==u||t[14]!==i?(w=f?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:s(Tt,`min-h-20 resize-y`),value:h,onChange:e=>g(e.target.value),placeholder:i.updatePlaceholder}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{g(n.statement),m(!1)},children:i.cancel}),(0,$.jsx)(p,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!h.trim(),onClick:()=>{u(h.trim()),m(!1)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(ve,{className:`size-3 text-accent`,"aria-hidden":!0}),At(n,i)]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.understandingScopes[n.scope.type]}),(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-0.5`,children:i.stability[n.stability]}),n.evidenceCount>0?(0,$.jsx)(`span`,{children:Et(i.evidenceCount,n.evidenceCount)}):null,n.latestEvidenceAt?(0,$.jsx)(`span`,{children:i.observedAt.replace(`{{time}}`,Ot(n.latestEvidenceAt,r))}):null]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[x?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:c,children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,$.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>m(!0),children:[(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:y,onClick:()=>{if(_){v(null);return}b(!0),W(n.id).then(e=>v(e.history)).finally(()=>b(!1))},children:[(0,$.jsx)(Y,{className:`size-3.5`,"aria-hidden":!0}),i.history]}),(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:d,children:[(0,$.jsx)(Se,{className:`size-3.5`,"aria-hidden":!0}),i.forget]})]})]}),(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium text-fg-muted`,children:i.viewEvidence}),(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourceName})]}),n.sourcePath?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidencePath}),(0,$.jsx)(`dd`,{className:`mt-0.5 break-all text-fg-muted`,children:n.sourcePath})]}):null,(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceUpdated}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Ot(n.updatedAt,r)})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSupport}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Et(i.evidenceCount,n.evidenceCount)})]}),n.evidenceBasis?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:i.evidenceRuleValue.replace(`{{events}}`,String(n.evidenceBasis.eventCount)).replace(`{{days}}`,String(n.evidenceBasis.activeDays)).replace(`{{window}}`,String(n.evidenceBasis.windowDays))})]}):null,n.confidence===void 0?null:(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),(0,$.jsxs)(`dd`,{className:`mt-0.5 text-fg-muted`,children:[Math.round(n.confidence*100),`%`]})]}),n.validTo?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceValidUntil}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Ot(n.validTo,r)})]}):null,n.expiresAt?(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceExpires}),(0,$.jsx)(`dd`,{className:`mt-0.5 text-fg-muted`,children:Ot(n.expiresAt,r)})]}):null]})]}),_?(0,$.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-edge pt-2`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:i.historyTitle}),_.map(e=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3 text-xs`,children:[(0,$.jsx)(`p`,{className:`min-w-0 text-fg-muted`,children:e.statement}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-subtle`,children:Ot(e.updatedAt,r)})]},e.id))]}):null]}),t[2]=a,t[3]=h,t[4]=f,t[5]=_,t[6]=y,t[7]=n,t[8]=r,t[9]=x,t[10]=c,t[11]=d,t[12]=l,t[13]=u,t[14]=i,t[15]=w):w=t[15];let T;return t[16]!==C||t[17]!==w?(T=(0,$.jsx)(`article`,{className:C,children:w}),t[16]=C,t[17]=w,t[18]=T):T=t[18],T}function Mt(e){let t=(0,We.c)(86),{claim:n,language:r,t:i,busy:a,onDecision:c}=e,l=typeof n.value.label==`string`?n.value.label:``,u;if(t[0]!==n.class||t[1]!==n.value.hour||t[2]!==n.value.weekday||t[3]!==l||t[4]!==r||t[5]!==i.claimProject||t[6]!==i.claimRelationship||t[7]!==i.claimRoutine){let e=r===`zh`?[`周日`,`周一`,`周二`,`周三`,`周四`,`周五`,`周六`]:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];u=n.class===`relationship`?i.claimRelationship.replace(`{{label}}`,l):n.class===`project`?i.claimProject.replace(`{{label}}`,l):i.claimRoutine.replace(`{{weekday}}`,e[Number(n.value.weekday)]??``).replace(`{{hour}}`,String(n.value.hour).padStart(2,`0`)),t[0]=n.class,t[1]=n.value.hour,t[2]=n.value.weekday,t[3]=l,t[4]=r,t[5]=i.claimProject,t[6]=i.claimRelationship,t[7]=i.claimRoutine,t[8]=u}else u=t[8];let d=u,f;t[9]===n.evidence?f=t[10]:(f=new Set(n.evidence.map(Nt)),t[9]=n.evidence,t[10]=f);let m;t[11]===f?m=t[12]:(m=[...f],t[11]=f,t[12]=m);let h=m,g=n.state===`provisional`||n.state===`stale`,_=g?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,v;t[13]===_?v=t[14]:(v=s(`rounded-xl border p-3.5`,_),t[13]=_,t[14]=v);let y=i.claimClasses[n.class],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-subtle`,children:y}),t[15]=y,t[16]=b);let x;t[17]===d?x=t[18]:(x=(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-6 text-fg`,children:d}),t[17]=d,t[18]=x);let S;t[19]!==b||t[20]!==x?(S=(0,$.jsxs)(`div`,{children:[b,x]}),t[19]=b,t[20]=x,t[21]=S):S=t[21];let C=i.claimStates[n.state],w;t[22]===C?w=t[23]:(w=(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:C}),t[22]=C,t[23]=w);let T;t[24]!==w||t[25]!==S?(T=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[S,w]}),t[24]=w,t[25]=S,t[26]=T):T=t[26];let E;t[27]!==n.activeDayCount||t[28]!==n.independentEvidenceCount||t[29]!==i.claimEvidence?(E=i.claimEvidence.replace(`{{events}}`,String(n.independentEvidenceCount)).replace(`{{days}}`,String(n.activeDayCount)),t[27]=n.activeDayCount,t[28]=n.independentEvidenceCount,t[29]=i.claimEvidence,t[30]=E):E=t[30];let O;t[31]===E?O=t[32]:(O=(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:E}),t[31]=E,t[32]=O);let k;t[33]!==n.lastReinforcedAt||t[34]!==r||t[35]!==i.observedAt?(k=i.observedAt.replace(`{{time}}`,Ot(n.lastReinforcedAt,r)),t[33]=n.lastReinforcedAt,t[34]=r,t[35]=i.observedAt,t[36]=k):k=t[36];let A;t[37]===k?A=t[38]:(A=(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:k}),t[37]=k,t[38]=A);let j;t[39]!==a||t[40]!==g||t[41]!==c||t[42]!==i.confirm||t[43]!==i.notTrue?(j=g?(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>c(`confirm`),children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>c(`reject`),children:[(0,$.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,t[39]=a,t[40]=g,t[41]=c,t[42]=i.confirm,t[43]=i.notTrue,t[44]=j):j=t[44];let M;t[45]!==A||t[46]!==j?(M=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[A,j]}),t[45]=A,t[46]=j,t[47]=M):M=t[47];let N;t[48]===i.viewEvidence?N=t[49]:(N=(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:i.viewEvidence}),t[48]=i.viewEvidence,t[49]=N);let P;t[50]===i.evidenceSource?P=t[51]:(P=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),t[50]=i.evidenceSource,t[51]=P);let F=h.join(`, `),I;t[52]===F?I=t[53]:(I=(0,$.jsx)(`dd`,{className:`mt-0.5 break-all`,children:F}),t[52]=F,t[53]=I);let L;t[54]!==P||t[55]!==I?(L=(0,$.jsxs)(`div`,{children:[P,I]}),t[54]=P,t[55]=I,t[56]=L):L=t[56];let R;t[57]===i.evidenceConfidence?R=t[58]:(R=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),t[57]=i.evidenceConfidence,t[58]=R);let z;t[59]===n.confidence?z=t[60]:(z=Math.round(n.confidence*100),t[59]=n.confidence,t[60]=z);let B;t[61]===z?B=t[62]:(B=(0,$.jsxs)(`dd`,{className:`mt-0.5`,children:[z,`%`]}),t[61]=z,t[62]=B);let V;t[63]!==R||t[64]!==B?(V=(0,$.jsxs)(`div`,{children:[R,B]}),t[63]=R,t[64]=B,t[65]=V):V=t[65];let H;t[66]===i.evidenceRule?H=t[67]:(H=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),t[66]=i.evidenceRule,t[67]=H);let U;t[68]===i.claimRule?U=t[69]:(U=(0,$.jsx)(`dd`,{className:`mt-0.5`,children:i.claimRule}),t[68]=i.claimRule,t[69]=U);let W;t[70]!==H||t[71]!==U?(W=(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[H,U]}),t[70]=H,t[71]=U,t[72]=W):W=t[72];let G;t[73]!==L||t[74]!==V||t[75]!==W?(G=(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[L,V,W]}),t[73]=L,t[74]=V,t[75]=W,t[76]=G):G=t[76];let ee;t[77]!==N||t[78]!==G?(ee=(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[N,G]}),t[77]=N,t[78]=G,t[79]=ee):ee=t[79];let K;return t[80]!==T||t[81]!==O||t[82]!==M||t[83]!==ee||t[84]!==v?(K=(0,$.jsxs)(`article`,{className:v,children:[T,O,M,ee]}),t[80]=T,t[81]=O,t[82]=M,t[83]=ee,t[84]=v,t[85]=K):K=t[85],K}function Nt(e){return e.sourceInstanceId}function Pt(e){let t=(0,We.c)(70),{playbook:n,busy:r,t:i,onToggleGroup:a,onCreate:o,onUpdate:c,onDelete:l,onRollback:u}=e,[d,f]=(0,Q.useState)(``),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(``),v=n.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted`,y;t[0]===v?y=t[1]:(y=s(`rounded-xl border p-4`,v),t[0]=v,t[1]=y);let b=i.playbookNames[n.id],x;t[2]===b?x=t[3]:(x=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:b}),t[2]=b,t[3]=x);let S;t[4]!==n.rules||t[5]!==i.playbookRuleCount?(S=Et(i.playbookRuleCount,n.rules.filter(Lt).length),t[4]=n.rules,t[5]=i.playbookRuleCount,t[6]=S):S=t[6];let C;t[7]===S?C=t[8]:(C=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:S}),t[7]=S,t[8]=C);let w;t[9]!==x||t[10]!==C?(w=(0,$.jsxs)(`div`,{children:[x,C]}),t[9]=x,t[10]=C,t[11]=w):w=t[11];let T=n.enabled?i.pausePlaybook:i.resumePlaybook,E;t[12]!==r||t[13]!==a||t[14]!==T?(E=(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:r,onClick:a,children:T}),t[12]=r,t[13]=a,t[14]=T,t[15]=E):E=t[15];let D;t[16]!==w||t[17]!==E?(D=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[w,E]}),t[16]=w,t[17]=E,t[18]=D):D=t[18];let O;t[19]!==r||t[20]!==m||t[21]!==g||t[22]!==l||t[23]!==u||t[24]!==c||t[25]!==n.rules||t[26]!==i.cancel||t[27]!==i.deleteRule||t[28]!==i.disableRule||t[29]!==i.edit||t[30]!==i.enableRule||t[31]!==i.moveDown||t[32]!==i.moveUp||t[33]!==i.rollbackRule||t[34]!==i.ruleChannelContext||t[35]!==i.ruleContextAny||t[36]!==i.ruleHistory||t[37]!==i.ruleSupportContext||t[38]!==i.ruleSupportNeeds||t[39]!==i.save?(O=n.rules.map((e,t)=>(0,$.jsx)(`li`,{className:s(`rounded-lg border border-edge-subtle p-2.5`,!e.enabled&&`opacity-60`),children:m===e.id?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:s(Tt,`min-h-16 resize-y`),value:g,onChange:e=>_(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-7 px-2`,onClick:()=>h(null),children:i.cancel}),(0,$.jsx)(p,{type:`button`,variant:`primary`,className:`h-7 px-2`,disabled:!g.trim(),onClick:()=>{c(e.id,{statement:g.trim()}),h(null)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-1`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleSupportContext,(0,$.jsxs)(Ee,{value:e.context.supportNeed??``,disabled:r,onChange:t=>c(e.id,{context:{supportNeed:t.target.value||null}}),children:[(0,$.jsx)(Z,{value:``,children:i.ruleContextAny}),[`listen`,`clarify`,`advise`,`act`,`unknown`].map(e=>(0,$.jsx)(Z,{value:e,children:i.ruleSupportNeeds[e]},e))]})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleChannelContext,(0,$.jsxs)(Ee,{value:e.context.channel??``,disabled:r,onChange:t=>c(e.id,{context:{channel:t.target.value||null}}),children:[(0,$.jsx)(Z,{value:``,children:i.ruleContextAny}),[`webchat`,`telegram`,`weixin`,`feishu`,`cli`].map(It)]})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1`,children:[(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===0,onClick:()=>c(e.id,{order:n.rules[t-1].order-1}),children:i.moveUp}),(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===n.rules.length-1,onClick:()=>c(e.id,{order:n.rules[t+1].order+1}),children:i.moveDown}),(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>c(e.id,{enabled:!e.enabled}),children:e.enabled?i.disableRule:i.enableRule}),(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>{h(e.id),_(e.statement)},children:[(0,$.jsx)(k,{className:`size-3`,"aria-hidden":!0}),i.edit]}),(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-7 px-2 text-danger`,disabled:r,onClick:()=>l(e.id),children:[(0,$.jsx)(Se,{className:`size-3`,"aria-hidden":!0}),i.deleteRule]})]}),e.versions.length>1?(0,$.jsxs)(`details`,{className:`mt-2 border-t border-edge-subtle pt-2`,children:[(0,$.jsx)(`summary`,{className:`cursor-pointer text-[11px] text-fg-subtle`,children:i.ruleHistory}),(0,$.jsx)(`div`,{className:`mt-2 space-y-2`,children:e.versions.filter(Ft).map(t=>(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 text-[11px]`,children:[(0,$.jsx)(`p`,{className:`line-clamp-2 text-fg-muted`,children:t.statement}),(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-7 shrink-0 px-2`,disabled:r,onClick:()=>u(e.id,t.id),children:i.rollbackRule})]},t.id))})]}):null]})},e.id)),t[19]=r,t[20]=m,t[21]=g,t[22]=l,t[23]=u,t[24]=c,t[25]=n.rules,t[26]=i.cancel,t[27]=i.deleteRule,t[28]=i.disableRule,t[29]=i.edit,t[30]=i.enableRule,t[31]=i.moveDown,t[32]=i.moveUp,t[33]=i.rollbackRule,t[34]=i.ruleChannelContext,t[35]=i.ruleContextAny,t[36]=i.ruleHistory,t[37]=i.ruleSupportContext,t[38]=i.ruleSupportNeeds,t[39]=i.save,t[40]=O):O=t[40];let A;t[41]===O?A=t[42]:(A=(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:O}),t[41]=O,t[42]=A);let j;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(j=e=>f(e.target.value),t[43]=j):j=t[43];let M;t[44]!==d||t[45]!==i.newRulePlaceholder?(M=(0,$.jsx)(`input`,{className:Tt,value:d,onChange:j,placeholder:i.newRulePlaceholder}),t[44]=d,t[45]=i.newRulePlaceholder,t[46]=M):M=t[46];let N;t[47]!==r||t[48]!==d?(N=r||!d.trim(),t[47]=r,t[48]=d,t[49]=N):N=t[49];let P;t[50]!==d||t[51]!==o?(P=()=>{o(d.trim()),f(``)},t[50]=d,t[51]=o,t[52]=P):P=t[52];let F;t[53]!==i.addRule||t[54]!==N||t[55]!==P?(F=(0,$.jsx)(p,{type:`button`,variant:`secondary`,disabled:N,onClick:P,children:i.addRule}),t[53]=i.addRule,t[54]=N,t[55]=P,t[56]=F):F=t[56];let I;t[57]!==M||t[58]!==F?(I=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[M,F]}),t[57]=M,t[58]=F,t[59]=I):I=t[59];let L=i.playbookRuleExamples[n.id],R;t[60]===L?R=t[61]:(R=(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-5 text-fg-subtle`,children:L}),t[60]=L,t[61]=R);let z;t[62]!==I||t[63]!==R?(z=(0,$.jsxs)(`div`,{className:`mt-3`,children:[I,R]}),t[62]=I,t[63]=R,t[64]=z):z=t[64];let B;return t[65]!==D||t[66]!==A||t[67]!==y||t[68]!==z?(B=(0,$.jsxs)(`article`,{className:y,children:[D,A,z]}),t[65]=D,t[66]=A,t[67]=y,t[68]=z,t[69]=B):B=t[69],B}function Ft(e){return!e.current}function It(e){return(0,$.jsx)(Z,{value:e,children:e},e)}function Lt(e){return e.enabled}function Rt(e){let t=(0,We.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:o,onLater:c,t:l}=e,u;t[0]!==n||t[1]!==l.meetSuggestedTitle||t[2]!==l.meetTitle?(u=n?l.meetSuggestedTitle.replace(`{{name}}`,n.value):l.meetTitle,t[0]=n,t[1]=l.meetSuggestedTitle,t[2]=l.meetTitle,t[3]=u):u=t[3];let d;t[4]===u?d=t[5]:(d=(0,$.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight text-fg`,children:u}),t[4]=u,t[5]=d);let f=n?l.meetSuggestedBody:l.meetBody,m;t[6]===f?m=t[7]:(m=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:f}),t[6]=f,t[7]=m);let h;t[8]===l.callName?h=t[9]:(h=(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:`you-call-name`,children:l.callName}),t[8]=l.callName,t[9]=h);let g;t[10]===a?g=t[11]:(g=e=>a(e.target.value),t[10]=a,t[11]=g);let _;t[12]!==i||t[13]!==r||t[14]!==o?(_=e=>{e.key===`Enter`&&r.trim()&&!i&&o()},t[12]=i,t[13]=r,t[14]=o,t[15]=_):_=t[15];let v=l.meetPlaceholder,y;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=s(Tt,`h-10 flex-1 bg-surface-base/90`),t[16]=y):y=t[16];let b;t[17]!==r||t[18]!==l.meetPlaceholder||t[19]!==g||t[20]!==_?(b=(0,$.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,onChange:g,onKeyDown:_,placeholder:v,className:y}),t[17]=r,t[18]=l.meetPlaceholder,t[19]=g,t[20]=_,t[21]=b):b=t[21];let x;t[22]!==i||t[23]!==r?(x=i||!r.trim(),t[22]=i,t[23]=r,t[24]=x):x=t[24];let S=i?l.meetSaving:l.meetSave,C;t[25]!==o||t[26]!==x||t[27]!==S?(C=(0,$.jsx)(p,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:x,onClick:o,children:S}),t[25]=o,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;t[29]!==b||t[30]!==C||t[31]!==h?(w=(0,$.jsxs)(`div`,{className:`mt-5 flex max-w-xl flex-col gap-2 sm:flex-row`,children:[h,b,C]}),t[29]=b,t[30]=C,t[31]=h,t[32]=w):w=t[32];let T;t[33]!==n||t[34]!==l.meetSource?(T=n?(0,$.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,$.jsx)(re,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.meetSource})]}):null,t[33]=n,t[34]=l.meetSource,t[35]=T):T=t[35];let E;t[36]!==i||t[37]!==c||t[38]!==l.meetLater?(E=(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`mt-3 text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:c,children:l.meetLater}),t[36]=i,t[37]=c,t[38]=l.meetLater,t[39]=E):E=t[39];let D;return t[40]!==w||t[41]!==T||t[42]!==E||t[43]!==d||t[44]!==m?(D=(0,$.jsx)(`section`,{className:`relative overflow-hidden rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/80 via-surface-panel to-surface-panel p-5 sm:p-6`,children:(0,$.jsxs)(`div`,{className:`relative max-w-2xl`,children:[d,m,w,T,E]})}),t[40]=w,t[41]=T,t[42]=E,t[43]=d,t[44]=m,t[45]=D):D=t[45],D}function zt(){let e=l(e=>e.language),t=c(e).you,n=a(),[r,f]=i(),S=St(r.get(`tab`)),w=he(e=>e.setPageHeader),O=he(e=>e.clearPageHeader),{data:j,error:V,isLoading:W,mutate:K}=u(`/api/you`,U),[q,J]=(0,Q.useState)(null),[Y,ae]=(0,Q.useState)(!1),[se,le]=(0,Q.useState)(``),[X,pe]=(0,Q.useState)(`preference`),[me,_e]=(0,Q.useState)(!1),[ve,be]=(0,Q.useState)(null),[xe,Se]=(0,Q.useState)(!1),[De,Ne]=(0,Q.useState)(null),[Pe,Ie]=(0,Q.useState)(!1),[Ue,We]=(0,Q.useState)(``),[qe,Je]=(0,Q.useState)(!1),[Ye,Xe]=(0,Q.useState)(null),[Ze,Qe]=(0,Q.useState)(!1),[$e,et]=(0,Q.useState)(!1),[tt,nt]=(0,Q.useState)(!1),[rt,it]=(0,Q.useState)(null),[st,ct]=(0,Q.useState)(!1),[lt,ut]=(0,Q.useState)(null),[dt,ft]=(0,Q.useState)(null),[pt,mt]=(0,Q.useState)(!1),[ht,gt]=(0,Q.useState)(null),[_t,yt]=(0,Q.useState)(null),[bt,xt]=(0,Q.useState)(null),[Nt,Ft]=(0,Q.useState)(!1),It=(0,Q.useRef)(null),Lt=(0,Q.useRef)(null),zt=(0,Q.useRef)(null),Bt=j?.profile??{callName:``,pronouns:``,timezone:``,notes:``},Vt=(0,Q.useMemo)(()=>j?.understanding.filter(e=>e.status===`active`)??[],[j]),Ht=(0,Q.useMemo)(()=>j?.understanding.filter(e=>e.status!==`active`)??[],[j]),Ut=(0,Q.useMemo)(()=>j?.connectedClaims.filter(e=>e.state!==`rejected`)??[],[j]),Wt=(0,Q.useMemo)(()=>Ut.filter(e=>e.state!==`active`),[Ut]),Gt=(0,Q.useMemo)(()=>new Map(Ct.map(e=>[e,Vt.filter(t=>t.facet===e)])),[Vt]),Kt=Ye??j?.controls??null,qt=j?.sources.filter(e=>e.installed&&e.enabled)??[],Jt=qt.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status));(0,Q.useEffect)(()=>{let e=()=>{K()};return window.addEventListener(`connector-learning-updated`,e),()=>window.removeEventListener(`connector-learning-updated`,e)},[K]),(0,Q.useEffect)(()=>{if(S!==`memory`||!_t)return;let e=requestAnimationFrame(()=>{(_t===`profile`?It:Lt).current?.scrollIntoView({behavior:`smooth`,block:`start`}),yt(null)});return()=>cancelAnimationFrame(e)},[_t,S]);async function Yt(e){if(!(!j||tt)){nt(!0);try{let n=await ke(e);await K({...j,relationship:n.relationship},{revalidate:!1}),C({type:`success`,title:t.collaborationTitle,message:t.saved})}catch{C({type:`error`,title:t.supportModeTitle,message:t.saveError})}finally{nt(!1)}}}async function Xt(e,n){J(`claim:${e.id}`);try{let t=await de(e.id,n);await K(e=>e&&{...e,connectedClaims:e.connectedClaims.map(e=>e.id===t.id?t:e)},{revalidate:!1})}catch{C({type:`error`,title:t.connectedClaimsTitle,message:t.saveError})}finally{J(null)}}let Zt=e=>{let t=new URLSearchParams;e!==`overview`&&t.set(`tab`,e),f(t,{replace:!0})},Qt=e=>{yt(e),Zt(`memory`)},$t=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)},en=async e=>{if(e.instanceId){J(`source-learning:${e.instanceId}`);try{e.learning?.status===`paused`?await Ve(e.instanceId,!1):await He(e.instanceId),await K(),C({type:`success`,title:e.displayName,message:t.sourceLearningStarted})}catch(n){C({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{J(null)}}},tn=async e=>{if(e.instanceId){J(`source-learning:${e.instanceId}`);try{await Ve(e.instanceId,!0),await K()}catch(n){C({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{J(null)}}};(0,Q.useLayoutEffect)(()=>(w({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2.5 text-xs`,onClick:()=>ct(!0),children:[(0,$.jsx)(Ae,{className:`size-3.5`,"aria-hidden":!0}),t.howItWorks]})}),()=>O()),[O,w,t.howItWorks,t.subtitle,t.title]),(0,Q.useEffect)(()=>{!j||j.profile.callName||We(j.profileSetup.callNameSuggestion?.value??``)},[j,j?.profile.callName,j?.profileSetup.callNameSuggestion?.id]);async function nn(e,n,r){J(e.id);try{let t=await ne(e.id,{action:n,content:r});await K(r=>r&&{...r,understanding:n===`reject`?r.understanding.filter(t=>t.id!==e.id):r.understanding.map(n=>n.id===e.id?t:n)},{revalidate:!1}),K()}catch{C({type:`error`,title:t.title,message:t.saveError})}finally{J(null)}}async function rn(e,n){J(`consent:${e}`);try{await I(e,n),await K(),C({type:`success`,title:t.title,message:t.saved})}catch{C({type:`error`,title:t.title,message:t.saveError})}finally{J(null)}}async function an(){let e=se.trim();if(e){J(`understanding:new`);try{await x({content:e,kind:X}),le(``),ae(!1),_e(!1),await K(),C({type:`success`,title:t.understandingTitle,message:t.saved})}catch{C({type:`error`,title:t.understandingTitle,message:t.saveError})}finally{J(null)}}}async function on(){if(Ht.length){J(`understanding:batch`);try{await Re(Ht.map(e=>e.id),`confirm`),await K()}catch{C({type:`error`,title:t.reviewTitle,message:t.saveError})}finally{J(null)}}}async function sn(e,n){J(`conflict:${e}`);try{await d(e,n),await K()}catch{C({type:`error`,title:t.conflictsTitle,message:t.saveError})}finally{J(null)}}async function cn(e){J(`grant:${e}`);try{await oe(e),await K()}catch{C({type:`error`,title:t.grantsTitle,message:t.saveError})}finally{J(null)}}function ln(e){xt({insight:e,title:e.insight.split(/\r?\n/).find(e=>e.trim())?.trim().slice(0,72)??e.insight.slice(0,72),body:e.insight})}async function un(e){J(`insight:${e.id}`);try{await E(e.id),await K()}catch{C({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{J(null)}}async function dn(e){if(e.action===`start_progress`){ln(e);return}J(`insight:${e.id}`);try{let t=await M(e.id);await K(),t.href&&n(t.href)}catch{C({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{J(null)}}async function fn(r){if(r.preventDefault(),!bt||Nt)return;let i=bt.title.trim(),a=bt.body.trim();if(!(!i||!a)){Ft(!0);try{let t=await ue({idempotencyKey:`you-insight:${bt.insight.id}`,title:i,body:a,delegateAgentId:bt.insight.delegateAgentId,locale:e,priority:`normal`,contract:{objective:a,expectedOutputs:[],acceptanceCriteria:[],constraints:[],approvalRequired:[],assumptions:[],risks:[],acceptancePolicy:`manual`,outputDestinations:[]},dependencies:[],context:[{targetKind:`memory`,targetId:bt.insight.id,role:`input`,pinned:!0,retrievalPolicy:{},metadata:{source:`you-insight`}}],authorityGrants:[],activation:{mode:`capture`,phase:`backlog`}});await h(bt.insight.id,t.task.id),xt(null),await K(),n(`/tasks/${encodeURIComponent(t.task.id)}`)}catch{C({type:`error`,title:t.insightDraftTitle,message:t.saveError})}finally{Ft(!1)}}}async function pn(e){J(`playbook:${e.id}`);try{await we(e.id,!e.enabled),await K()}catch{C({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{J(null)}}async function mn(e,n){J(`playbook:${e}`);try{await n(),await K()}catch{C({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{J(null)}}async function hn(){if(ve){J(ve.id);try{await G(ve.id);let e=ve.id;be(null),await K(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),K()}catch{C({type:`error`,title:t.title,message:t.saveError})}finally{J(null)}}}async function gn(){if(De){Ie(!0);try{let e=await Me(De);Se(!1),Ne(null),await K(t=>t&&{...t,...e},{revalidate:!1})}catch{C({type:`error`,title:t.title,message:t.saveError})}finally{Ie(!1)}}}async function _n(){let e=Ue.trim();if(!(!e||qe)){Je(!0);try{let t=await Me({callName:e,timezone:Bt.timezone||ee()});await K(e=>e&&{...e,...t},{revalidate:!1})}catch{C({type:`error`,title:t.title,message:t.saveError})}finally{Je(!1)}}}async function vn(){if(!qe){Je(!0);try{let e=await ie(`snooze`);await K(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{C({type:`error`,title:t.title,message:t.saveError})}finally{Je(!1)}}}function yn(){Ne(Bt),Se(!0),Qt(`profile`)}function bn(e,t=!1){pe(e),_e(t),ae(!0),Zt(`memory`)}function xn(){ae(!1),_e(!1),le(``)}async function Sn(e){if(!Ze){Xe(e),Qe(!0);try{Xe(await fe(e)),await K(),C({type:`success`,title:t.privacyTitle,message:t.saved})}catch{Xe(null),C({type:`error`,title:t.privacyTitle,message:t.saveError})}finally{Qe(!1)}}}async function Cn(e){if(!($e||e===j?.trust.defaultActionLevel)){et(!0);try{let n=await ce(e);await K(e=>e&&{...e,trust:n},{revalidate:!1}),C({type:`success`,title:t.trustTitle,message:t.saved})}catch{C({type:`error`,title:t.trustTitle,message:t.saveError})}finally{et(!1),it(null)}}}async function wn(e){if(!(!dt?.instanceId||pt)){mt(!0);try{let n=await v(dt.instanceId,e);ft(null),await K(),C({type:`success`,title:t.sourcesTitle,message:e===`delete`?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{C({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{mt(!1)}}}async function Tn(){if(!ht){gt(`export`);try{let e=await Ce(),t=URL.createObjectURL(new Blob([JSON.stringify(e,null,2)],{type:`application/json`})),n=document.createElement(`a`);n.href=t,n.download=`xopc-about-you-${e.exportedAt.slice(0,10)}.json`,n.click(),URL.revokeObjectURL(t)}catch{C({type:`error`,title:t.transferTitle,message:t.saveError})}finally{gt(null)}}}async function En(e){if(!(!e||ht)){gt(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await A(JSON.parse(await e.text()));await K(),Qt(`review`),C({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{C({type:`error`,title:t.transferTitle,message:t.importError})}finally{zt.current&&(zt.current.value=``),ut(null),gt(null)}}}function Dn(){ut(null),zt.current&&(zt.current.value=``)}return(0,$.jsxs)(`main`,{className:`flex w-full flex-1 flex-col gap-5 px-3 py-6 sm:px-5 xl:px-6`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ze,{items:[{id:`overview`,label:t.tabs.overview,icon:N},{id:`memory`,label:t.tabs.memory,icon:Le,count:Ht.length+Wt.length||void 0},{id:`collaboration`,label:t.tabs.collaboration,icon:Fe},{id:`sources`,label:t.tabs.sources,icon:g},{id:`dreaming`,label:t.tabs.dreaming,icon:y},{id:`privacy`,label:t.tabs.privacy,icon:re}],activeTab:S,onChange:Zt,ariaLabel:t.title,tabIdPrefix:`you-tab`,panelIdPrefix:`you-panel`,className:`pr-8 sm:pr-1`,buttonClassName:`px-2.5 sm:px-3`}),(0,$.jsx)(`div`,{className:`pointer-events-none absolute inset-y-1 right-0 w-8 bg-gradient-to-l from-surface-panel to-transparent sm:hidden`,"aria-hidden":!0})]}),W?(0,$.jsx)(kt,{}):V||!j?(0,$.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,j&&S===`overview`?(0,$.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!Bt.callName&&j.profileSetup.shouldPrompt?(0,$.jsx)(Rt,{suggestion:j.profileSetup.callNameSuggestion,draft:Ue,busy:qe,onDraftChange:We,onSave:()=>void _n(),onLater:()=>void vn(),t}):null,Ht.length>0||Wt.length>0||Jt.length>0||!Bt.callName?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-warning/25 bg-warning-soft/35 p-5`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.attentionTitle}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[Ht.length+Wt.length>0?(0,$.jsxs)(p,{type:`button`,variant:`secondary`,onClick:()=>Qt(`review`),children:[Et(t.reviewCount,Ht.length+Wt.length),(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0})]}):null,Jt.length>0?(0,$.jsxs)(p,{type:`button`,variant:`secondary`,onClick:()=>Zt(`sources`),children:[Et(t.sourceIssues,Jt.length),(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0})]}):null,Bt.callName?null:(0,$.jsxs)(p,{type:`button`,variant:`secondary`,onClick:yn,children:[t.completeProfile,(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0})]})]})]}):null,(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-4`,children:(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>Zt(`memory`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:Vt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.knownSummary})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>Zt(`sources`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:qt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.connectedSources})]}),(0,$.jsxs)(`button`,{type:`button`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-3 text-left hover:bg-surface-hover`,onClick:()=>Qt(`review`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:Ht.length+Wt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.waitingReview})]})]})}),j.insights.length>0?(0,$.jsxs)(`section`,{className:`rounded-2xl border border-accent/15 bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(Oe,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,$.jsx)(Dt,{children:t.confirmedContextBadge})]}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:j.insights.map(e=>(0,$.jsxs)(`article`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.insight}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:e.evidenceCount>1?Et(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,$.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:q===`insight:${e.id}`,onClick:()=>void un(e),children:t.notNow}),(0,$.jsx)(p,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:q===`insight:${e.id}`,onClick:()=>void dn(e),children:t.insightActions[e.action]})]})]},e.id))})]}):null,(0,$.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Qt(`profile`),children:(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`dl`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Bt.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Bt.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Bt.pronouns||`—`})]}),Bt.notes?(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 line-clamp-2 text-sm leading-6 text-fg`,children:Bt.notes})]}):null]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(Le,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Zt(`memory`),children:(0,$.jsx)(ge,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[Vt.slice(0,4).map(e=>(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-3 py-2.5 text-sm leading-5 text-fg`,children:e.statement},e.id)),Vt.length===0?(0,$.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]})]}):null,j&&S===`memory`?(0,$.jsxs)(`div`,{id:`you-panel-memory`,role:`tabpanel`,"aria-labelledby":`you-tab-memory`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.memoryTitle}),(0,$.jsx)(Dt,{children:t.sharedAgentsBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.memoryHint})]}),(0,$.jsxs)(`section`,{ref:It,id:`you-profile-card`,className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(Dt,{children:t.onlyYouEditBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.profileHint})]}),xe?null:(0,$.jsxs)(p,{type:`button`,variant:`secondary`,onClick:yn,children:[(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),xe&&De?(0,$.jsxs)(`div`,{className:`mt-5`,children:[(0,$.jsx)(Ge,{value:De,onChange:Ne,language:e,inputClassName:Tt,labels:{callName:t.callName,callNamePlaceholder:t.meetPlaceholder,pronouns:t.pronouns,pronounsPlaceholder:t.pronounsPlaceholder,timezone:t.timezone,timezoneCustom:t.timezoneCustom,timezoneDetect:t.timezoneDetect,custom:t.custom,notes:t.notes,notesPlaceholder:t.notesPlaceholder}}),(0,$.jsxs)(`div`,{className:`mt-4 flex justify-end gap-2`,children:[(0,$.jsx)(p,{type:`button`,variant:`ghost`,onClick:()=>{Se(!1),Ne(null)},children:t.cancel}),(0,$.jsx)(p,{type:`button`,variant:`primary`,disabled:Pe,onClick:()=>void gn(),children:Pe?t.saving:t.save})]})]}):(0,$.jsxs)(`dl`,{className:`mt-5 grid gap-4 sm:grid-cols-2`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.callName}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Bt.callName||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.timezone}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Bt.timezone||`—`})]}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.pronouns}),(0,$.jsx)(`dd`,{className:`mt-1 text-sm text-fg`,children:Bt.pronouns||`—`})]}),(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,$.jsx)(`dt`,{className:`text-xs text-fg-subtle`,children:t.notes}),(0,$.jsx)(`dd`,{className:`mt-1 whitespace-pre-wrap text-sm leading-6 text-fg`,children:Bt.notes||`—`})]})]})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.structuredContextTitle}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2 xl:grid-cols-4`,children:[(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":Y&&!me&&X===`preference`,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,Y&&!me&&X===`preference`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>bn(`preference`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addPreference}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addPreferenceHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":Y&&!me&&X===`boundary`,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,Y&&!me&&X===`boundary`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>bn(`boundary`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addBoundary}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addBoundaryHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":Y&&!me&&X===`current_state`,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,Y&&!me&&X===`current_state`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>bn(`current_state`),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addCurrentFocus}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addCurrentFocusHint})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":Y&&me,className:s(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,Y&&me?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>bn(`relationship`,!0),children:[(0,$.jsx)(`span`,{className:`text-sm font-semibold text-fg`,children:t.addOther}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:t.addOtherHint})]})]}),Y?(0,$.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:me?t.addOther:X===`preference`?t.addPreference:X===`boundary`?t.addBoundary:t.addCurrentFocus}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:me?t.addOtherHint:X===`preference`?t.addPreferenceHint:X===`boundary`?t.addBoundaryHint:t.addCurrentFocusHint})]}),me?null:(0,$.jsx)(Dt,{children:t.understandingKinds[X]})]}),(0,$.jsx)(`textarea`,{className:s(Tt,`mt-3 min-h-24 resize-y`),value:se,onChange:e=>le(e.target.value),placeholder:t.understandingPlaceholders[X],autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-between gap-3`,children:[me?(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[t.understandingKind,(0,$.jsx)(Ee,{value:X,onChange:e=>pe(e.target.value),children:wt.map(e=>(0,$.jsx)(Z,{value:e,children:t.understandingKinds[e]},e))})]}):(0,$.jsx)(`span`,{}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(p,{type:`button`,variant:`ghost`,onClick:xn,children:t.cancel}),(0,$.jsx)(p,{type:`button`,variant:`primary`,disabled:!se.trim()||q===`understanding:new`,onClick:()=>void an(),children:t.add})]})]})]}):null]}),j.conflictGroups.some(e=>e.unresolved)?(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.conflictsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.conflictsHint}),(0,$.jsx)(`div`,{className:`mt-3 space-y-3`,children:j.conflictGroups.filter(e=>e.unresolved).map(n=>(0,$.jsx)(`div`,{className:`divide-y divide-edge overflow-hidden rounded-xl border border-warning/35 bg-warning-soft/25`,children:n.records.filter(e=>e.storedStatus!==`archived`&&e.storedStatus!==`rejected`).map(r=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:r.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[At(r,t),` · `,Ot(r.updatedAt,e)]})]}),(0,$.jsx)(p,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2.5`,disabled:q===`conflict:${n.id}`,onClick:()=>void sn(n.id,r.id),children:t.useThis})]},r.id))},n.id))})]}):null,j.consentRequests.length>0?(0,$.jsxs)(`section`,{className:`space-y-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.consentTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.consentHint})]}),j.consentRequests.map(e=>(0,$.jsxs)(`article`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/20 p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.consentPurpose.replace(`{{purpose}}`,e.purpose)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:q===`consent:${e.id}`,onClick:()=>void rn(e.id,`deny`),children:t.consentDeny}),(0,$.jsx)(p,{type:`button`,variant:`secondary`,disabled:q===`consent:${e.id}`,onClick:()=>void rn(e.id,`once`),children:t.consentOnce}),(0,$.jsx)(p,{type:`button`,variant:`secondary`,disabled:q===`consent:${e.id}`,onClick:()=>void rn(e.id,`session`),children:t.consentSession}),(0,$.jsx)(p,{type:`button`,variant:`primary`,disabled:q===`consent:${e.id}`,onClick:()=>void rn(e.id,`always`),children:t.consentAlways})]})]},e.id))]}):null,(0,$.jsxs)(`div`,{ref:Lt,className:`space-y-6 scroll-mt-6`,children:[Ut.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.connectedClaimsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.connectedClaimsHint})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:Ut.map(n=>(0,$.jsx)(Mt,{claim:n,language:e,t,busy:q===`claim:${n.id}`,onDecision:e=>void Xt(n,e)},n.id))})]}):null,Ht.length>0?(0,$.jsxs)(`section`,{children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.reviewTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.reviewHint})]}),(0,$.jsx)(p,{type:`button`,variant:`secondary`,disabled:q===`understanding:batch`,onClick:()=>void on(),children:t.reviewAll})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:Ht.map(n=>(0,$.jsx)(jt,{item:n,language:e,t,busy:q===n.id,onConfirm:()=>void nn(n,`confirm`),onReject:()=>void nn(n,`reject`),onUpdate:e=>void nn(n,`update`,e),onForget:()=>be(n)},n.id))})]}):Vt.length>0||Ut.some(e=>e.state===`active`)?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-success/20 bg-success-soft p-6 text-center`,children:[(0,$.jsx)(o,{className:`mx-auto size-5 text-success`,"aria-hidden":!0}),(0,$.jsx)(`h2`,{className:`mt-2 text-sm font-semibold text-fg`,children:t.nothingToReview}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.nothingToReviewHint})]}):null]}),Ct.map(n=>{let r=Gt.get(n)??[];return r.length===0?null:(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.facets[n]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:r.map(n=>(0,$.jsx)(jt,{item:n,language:e,t,busy:q===n.id,onConfirm:()=>void nn(n,`confirm`),onReject:()=>void nn(n,`reject`),onUpdate:e=>void nn(n,`update`,e),onForget:()=>be(n)},n.id))})]},n)}),j.understanding.length===0&&Ut.length===0?(0,$.jsx)(`div`,{className:`rounded-2xl border border-dashed border-edge p-10 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]}):null,j&&S===`collaboration`?(0,$.jsxs)(`div`,{id:`you-panel-collaboration`,role:`tabpanel`,"aria-labelledby":`you-tab-collaboration`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.collaborationTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.collaborationHint})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-4`,children:[(0,$.jsxs)(`div`,{className:`max-w-2xl`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[(0,$.jsx)(N,{className:`size-4 text-accent`,"aria-hidden":!0}),t.supportModeTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.supportModeHint})]}),(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[(0,$.jsx)(`span`,{className:`sr-only`,children:t.supportModeTitle}),(0,$.jsx)(Ee,{value:j.relationship.supportMode,disabled:tt,onChange:e=>void Yt({supportMode:e.target.value}),children:Object.entries(t.supportModes).map(([e,t])=>(0,$.jsx)(Z,{value:e,children:t},e))})]})]}),(0,$.jsxs)(`div`,{className:`mt-4 grid gap-3 border-t border-edge-subtle pt-4 sm:grid-cols-2 lg:grid-cols-4`,children:[(0,$.jsxs)(`label`,{className:`flex items-center gap-2 text-xs text-fg-muted`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:j.relationship.proactiveEnabled,disabled:tt,onChange:e=>void Yt({proactiveEnabled:e.target.checked})}),t.proactiveEnabled]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,$.jsx)(Be,{value:j.relationship.quietStart??``,disabled:tt,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietStart,onChange:e=>void Yt({quietStart:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,$.jsx)(Be,{value:j.relationship.quietEnd??``,disabled:tt,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietEnd,onChange:e=>void Yt({quietEnd:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.blockedTopics,(0,$.jsx)(`input`,{className:Tt,defaultValue:j.relationship.blockedTopics.join(`, `),disabled:tt,onBlur:e=>void Yt({blockedTopics:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)})})]})]}),(0,$.jsx)(`p`,{className:`mt-3 text-right text-xs text-fg-subtle`,children:tt?t.saving:t.autoSaveHint})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-base font-semibold text-fg`,children:[(0,$.jsx)(Fe,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,$.jsx)(Dt,{children:t.affectsAgentsBadge})]}),j.playbooks.length>0?(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 xl:grid-cols-3`,children:j.playbooks.map(e=>(0,$.jsx)(Pt,{playbook:e,busy:q===`playbook:${e.id}`,t,onToggleGroup:()=>void pn(e),onCreate:t=>void mn(e.id,()=>R(e.id,t,(e.rules.at(-1)?.order??0)+10)),onUpdate:(t,n)=>void mn(e.id,()=>ye(e.id,t,n)),onDelete:t=>void mn(e.id,()=>H(e.id,t)),onRollback:(t,n)=>void mn(e.id,()=>je(e.id,t,n))},e.id))}):(0,$.jsx)(`p`,{className:`mt-4 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.emptyPlaybooks})]})]}):null,j&&S===`sources`?(0,$.jsx)(vt,{sources:j.sources,recommendations:j.sourceRecommendations,language:e,t,busyId:q,onAddSource:()=>n(`/connectors?personalContext=1`),onConnectRecommendation:e=>n(`/connectors?personalContext=1&connector=${encodeURIComponent(e)}&returnTo=%2Fyou%3Ftab%3Dsources`),onLearn:e=>void en(e),onPause:e=>void tn(e),onConfigure:$t,onDisconnect:ft,onViewUnderstanding:()=>Zt(`memory`)}):null,j&&S===`dreaming`?(0,$.jsx)(at,{language:e}):null,j&&S===`privacy`&&Kt?(0,$.jsxs)(`div`,{id:`you-panel-privacy`,role:`tabpanel`,"aria-labelledby":`you-tab-privacy`,className:`space-y-6`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.privacyTitle}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:t.privacyHint})]}),(0,$.jsxs)(`div`,{className:`grid gap-6 xl:grid-cols-2`,children:[(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.controlTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.controlHint}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-3 rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.learningMode,(0,$.jsx)(Ee,{value:Kt.mode,disabled:Ze,onChange:e=>void Sn({...Kt,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,$.jsx)(Z,{value:e,children:t},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,$.jsx)(Ee,{value:Kt.sensitiveWritePolicy,disabled:Ze,onChange:e=>void Sn({...Kt,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,$.jsx)(Z,{value:e,children:t},e))}),(0,$.jsx)(`span`,{className:`font-normal leading-5 text-fg-subtle`,children:t.sensitiveOptionHints[Kt.sensitiveWritePolicy]})]}),(0,$.jsx)(`p`,{className:`text-right text-xs text-fg-subtle`,children:Ze?t.saving:t.autoSaveHint})]})]}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.trustTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.trustHint}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:j.trust.levels.map(e=>(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":e===j.trust.defaultActionLevel,disabled:$e,onClick:()=>{e!==j.trust.defaultActionLevel&&(e===`auto`?it(e):Cn(e))},className:s(`rounded-xl border p-3 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40 disabled:opacity-70`,e===j.trust.defaultActionLevel?`border-accent/35 bg-accent-soft/35`:`border-edge-subtle bg-surface-panel hover:border-accent/25 hover:bg-surface-hover`),children:[(0,$.jsx)(`p`,{className:`text-xs font-semibold text-fg`,children:t.trustLevels[e]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.trustLevelHints[e]}),e===j.trust.defaultActionLevel?(0,$.jsx)(`span`,{className:`mt-2 inline-block rounded-full bg-accent-soft px-2 py-0.5 text-[11px] text-accent-fg`,children:t.defaultTrust}):null]},e))})]})]}),(0,$.jsx)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(re,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.sharingTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.sharingHint})]})]})}),(0,$.jsxs)(`section`,{children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.grantsTitle}),(0,$.jsx)(`p`,{className:`mt-1 text-sm text-fg-muted`,children:t.grantsHint}),j.referenceGrants.length>0?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:j.referenceGrants.map(n=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:n.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[n.grantScope?t.grantScopes[n.grantScope]:``,n.expiresAt?` · ${Ot(n.expiresAt,e)}`:``]})]}),(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2.5`,disabled:q===`grant:${n.id}`,onClick:()=>void cn(n.id),children:t.revoke})]},n.id))}):(0,$.jsx)(`p`,{className:`mt-3 rounded-xl bg-surface-muted px-4 py-3 text-sm text-fg-muted`,children:t.noGrants})]}),(0,$.jsxs)(`section`,{className:`rounded-2xl border border-edge-subtle bg-surface-base p-5`,children:[(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:t.transferTitle}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2`,children:[(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:ht!==null,onClick:()=>void Tn(),children:[(0,$.jsx)(z,{className:`size-4`,"aria-hidden":!0}),ht===`export`?t.exporting:t.exportAction]}),(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:ht!==null,onClick:()=>zt.current?.click(),children:[(0,$.jsx)(F,{className:`size-4`,"aria-hidden":!0}),ht===`import`?t.importing:t.importAction]}),(0,$.jsx)(`input`,{ref:zt,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>ut(e.target.files?.[0]??null)})]})]})]}):null,(0,$.jsx)(m,{open:bt!==null,onOpenChange:e=>{!e&&!Nt&&xt(null)},children:(0,$.jsxs)(_,{children:[(0,$.jsx)(B,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,$.jsxs)(b,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(38rem,calc(100dvh-1.5rem))] w-[min(42rem,calc(100vw-1.5rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-edge bg-surface-panel shadow-float focus:outline-none`,children:[(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(T,{className:`text-base font-semibold text-fg`,children:t.insightDraftTitle}),(0,$.jsx)(P,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:t.insightDraftDescription})]}),(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,disabled:Nt,"aria-label":t.close,children:(0,$.jsx)(D,{className:`size-4`,"aria-hidden":!0})})})]}),(0,$.jsxs)(`form`,{onSubmit:fn,className:`flex min-h-0 flex-1 flex-col`,children:[(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-5 py-4`,children:[(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium text-fg`,children:[t.insightTaskTitleLabel,(0,$.jsx)(`input`,{className:Tt,value:bt?.title??``,maxLength:500,onChange:e=>xt(t=>t?{...t,title:e.target.value}:null),autoFocus:!0})]}),(0,$.jsxs)(`label`,{className:`grid gap-2 text-sm font-medium text-fg`,children:[t.insightTaskBodyLabel,(0,$.jsx)(`textarea`,{className:s(Tt,`min-h-56 resize-none leading-6`),value:bt?.body??``,maxLength:5e4,onChange:e=>xt(t=>t?{...t,body:e.target.value}:null)})]}),(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-subtle`,children:t.insightTaskContextHint})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,$.jsx)(L,{asChild:!0,children:(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:Nt,children:t.cancel})}),(0,$.jsx)(p,{type:`submit`,variant:`primary`,disabled:Nt||!bt?.title.trim()||!bt.body.trim(),children:Nt?t.insightCreatingDraft:t.insightCreateDraft})]})]})]})]})}),(0,$.jsx)(Te,{open:ve!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void hn(),onCancel:()=>be(null)}),(0,$.jsx)(Te,{open:rt===`auto`,title:t.autoConfirmTitle,description:t.autoConfirmBody,confirmLabel:t.autoConfirmAction,cancelLabel:t.cancel,onConfirm:()=>void Cn(`auto`),onCancel:()=>it(null)}),(0,$.jsx)(Te,{open:lt!==null,title:t.importConfirmTitle,description:t.importConfirmBody.replace(`{{name}}`,lt?.name??``),confirmLabel:t.importConfirmAction,cancelLabel:t.cancel,onConfirm:()=>{let e=lt;ut(null),En(e)},onCancel:Dn}),(0,$.jsx)(ot,{source:dt,language:e,busy:pt,onOpenChange:e=>{e||ft(null)},onConfirm:e=>void wn(e)}),(0,$.jsx)(Ke,{open:st,t,onOpenChange:ct,onNavigate:Zt})]})}export{zt as UserContextPage};
@@ -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{f as r,l as i}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as a}from"./check-DUBLcKHA.js";import{t as o}from"./cn-JdwAhgNB.js";import{t as s}from"./messages-CMjnbdbn.js";import{n as ee}from"./locale-store-DUW5YE3R.js";import{As as c,At as te,Co as ne,Dl as re,Do as ie,Eo as l,Et as ae,Fl as oe,Ns as se,Qc as u,So as ce,To as d,_o as le,bo as f,dc as p,eu as ue,go as de,gu as fe,ho as m,io as h,jl as g,js as pe,mu as me,vo as he,wo as ge,xo as _e,yo as ve}from"./index-BvR-i-m6.js";var _=e(t(),1),v=new Set([`completed`,`failed`,`canceled`]);function y(){return new Promise(e=>window.setTimeout(e,1200))}async function ye(e,t){let n=[],r=t.wait??y;for(let i=0;i<e.length&&!t.shouldStop?.();i+=1){let a=e[i];if(a)try{await t.grantDirectory(a.rootPath);let o=await t.startRun(a.rootPath);for(t.onRun(o,i,e.length);!v.has(o.status)&&!t.shouldStop?.();)await r(),o=await t.fetchRun(o.id),t.onRun(o,i,e.length);if(n.push(o),o.status===`canceled`||t.shouldStop?.())break}catch(e){if(t.onError?.(e,a,i),t.shouldStop?.())break}}return n}var b=n(),x=[`folder_structure`,`recent_progress`,`next_steps`];function S(e){return e instanceof Error?e.message:String(e)}function C({embedded:e=!1,onRequestClose:t}={}){let n=ee(e=>e.language),v=s(n).onboarding.workDiscovery,y=s(n).chat.workingDirectory,C=i(),[be]=r(),xe=e||be.get(`new`)===`1`,[w,T]=(0,_.useState)(`loading`),[E,Se]=(0,_.useState)(null),[D,O]=(0,_.useState)(null),[k,A]=(0,_.useState)(!1),[j,M]=(0,_.useState)(null),[Ce,N]=(0,_.useState)(!1),[P,F]=(0,_.useState)(``),[I,L]=(0,_.useState)(!1),[R,z]=(0,_.useState)(()=>new Set),[B,we]=(0,_.useState)([]),[V,H]=(0,_.useState)(()=>new Set),[Te,U]=(0,_.useState)([]),[Ee,De]=(0,_.useState)(!1),[W,G]=(0,_.useState)({current:0,total:0}),[K,Oe]=(0,_.useState)(()=>new Set),q=(0,_.useRef)(!1),ke=window.electronAPI?.platform===`darwin`,Ae=e=>{Oe(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},J=(0,_.useCallback)(e=>{m.getState().updateDirectoryRun(e),O(e),e.status===`completed`?(z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),T(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?T(`error`):T(`running`)},[]),je=async()=>{A(!0),M(null);try{let e=await le();if(!e.length){M(v.noCandidates);return}we(e),H(new Set([e[0].rootPath])),T(`candidates`)}catch(e){M(S(e))}finally{A(!1)}},Me=e=>{H(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ne=(0,_.useCallback)((e,t,n)=>{m.getState().updateDirectoryRun(e),O(e),G({current:t+1,total:n}),U(n=>{let r=[...n];return r[t]=e,r}),T(`running`)},[]),Pe=(0,_.useCallback)(e=>{U(t=>t.map(t=>t?.id===e.id?e:t))},[]),Fe=async()=>{let e=B.filter(e=>V.has(e.rootPath));if(!e.length)return;A(!0),M(null),U([]),G({current:1,total:e.length}),De(!0),q.current=!1;let t=!1;try{let n=await ye(e,{grantDirectory:_e,startRun:d,fetchRun:f,shouldStop:()=>q.current,onRun:(e,n,r)=>{Ne(e,n,r),t||(t=!0,m.getState().scanPersonalContext(e.id,[...K]))},onError:(t,n,r)=>{G({current:r+1,total:e.length}),M(v.folderAnalysisFailed.replace(`{{folder}}`,n.displayName).replace(`{{error}}`,S(t)))}});if(q.current)return;let r=n.find(e=>e.status===`completed`)??n.at(-1);r?J(r):T(`candidates`)}catch(e){M(S(e)),T(`candidates`)}finally{De(!1),A(!1)}},Y=te({onPicked:(0,_.useCallback)(async e=>{A(!0),M(null);try{Se(await ce(e)),T(`consent`)}catch(e){M(S(e)),T(`intro`)}finally{A(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return ve().then(async({enabled:n,state:r})=>{if(!e){if(!n){t?t():C(`/chat`,{replace:!0});return}if(!xe&&r.activeRunId)try{let t=await f(r.activeRunId);e||J(t);return}catch{}e||T(`intro`)}}).catch(t=>{e||(M(S(t)),T(`intro`))}),()=>{e=!0}},[J,C,t,xe]),(0,_.useEffect)(()=>{if(!D||w!==`running`||Ee)return;let e=!1,t=async()=>{try{let t=await f(D.id);e||J(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===D.id)&&t()};for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.addEventListener(e,r);return()=>{e=!0,window.clearInterval(n);for(let e of[`work-discovery-progress`,`work-discovery-completed`,`work-discovery-failed`,`work-discovery-canceled`])window.removeEventListener(e,r)}},[J,Ee,w,D]);let Ie=async()=>{A(!0);try{await he()}finally{t?t():C(`/chat`,{replace:!0})}},Le=async()=>{if(E){A(!0),M(null),U([]),G({current:0,total:0});try{await _e(E.canonicalRootPath);let e=await d(E.canonicalRootPath);J(e),m.getState().scanPersonalContext(e.id,[...K])}catch(e){M(S(e)),T(`consent`)}finally{A(!1)}}},X=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;C(`/chat/${encodeURIComponent(e)}${n}`)},Re=e=>{O(e),N(!1),L(!1),z(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?T(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?T(`error`):T(`running`)},ze=async()=>{D&&(q.current=!0,J(await de(D.id)))},Z=async(e,t)=>{if(!D)return;await ge(D.id,e.id).catch(()=>{});let r=t?`${n===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${e.actionPrompt}`:e.actionPrompt;X(D.sessionKey,r)},Be=async()=>{if(D){A(!0),M(null);try{let e=D.result?.profileCandidates??[],t=await l((e.length>0?await ie(D.id,e.map(e=>({id:e.id,status:R.has(e.id)?`accepted`:`rejected`}))):D).id,`confirmed`);O(t),Pe(t),T(`recommendation`)}catch(e){M(S(e))}finally{A(!1)}}},Q=async e=>{if(!(!D||!P.trim())){A(!0),M(null);try{let t=await l(D.id,e,P.trim());O(t),X(t.sessionKey,P.trim())}catch(e){M(S(e)),A(!1)}}},Ve=async()=>{if(D){A(!0);try{X((await l(D.id,`dismissed`)).sessionKey)}catch(e){M(S(e)),A(!1)}}},$=D?.result?.suggestions.find(e=>e.id===D.result?.primarySuggestionId)??D?.result?.suggestions[0],He=D?.result?.suggestions.filter(e=>e.id!==$?.id)??[],Ue=e=>e===`command`?v.riskCommand:e===`file_write`?v.riskFileWrite:v.riskAnalysis,We=Te.filter(e=>e?.status===`completed`),Ge=e&&w===`candidates`,Ke=We.length>1?(0,b.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,b.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:v.analysisResults}),(0,b.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:We.map(e=>{let t=B.find(t=>t.rootPath===e.rootPath)?.displayName??e.rootPath.split(/[\\/]/).filter(Boolean).at(-1)??e.rootPath;return(0,b.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===D?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Re(e),children:t},e.id)})})]}):null;return(0,b.jsxs)(`div`,{className:e?`flex h-full min-h-0 flex-1 flex-col overflow-hidden bg-surface-base`:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,b.jsxs)(`main`,{className:e?`mx-auto flex h-full min-h-0 w-full max-w-[40rem] flex-1 flex-col px-5 py-7 sm:px-8 sm:py-9 ${Ge?`overflow-hidden`:`overflow-y-auto [scrollbar-gutter:stable]`}`:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[e?null:(0,b.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,b.jsx)(pe,{className:`size-11`})}),w===`loading`?(0,b.jsxs)(`div`,{className:`mx-auto flex min-h-[26rem] w-full max-w-md flex-col items-center`,"aria-busy":!0,children:[(0,b.jsx)(h,{className:`h-8 w-64 max-w-full`}),(0,b.jsx)(h,{className:`mt-4 h-4 w-full max-w-sm`}),(0,b.jsx)(h,{className:`mt-2 h-4 w-4/5 max-w-xs`}),(0,b.jsx)(h,{className:`mt-10 h-12 w-full rounded-xl`}),(0,b.jsx)(h,{className:`mt-3 h-11 w-full rounded-xl`}),(0,b.jsx)(h,{className:`mt-5 h-4 w-3/5 max-w-56`})]}):null,w===`intro`?(0,b.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,b.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.title}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:v.subtitle})]}),(0,b.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[ke?(0,b.jsxs)(`div`,{className:`mb-5 rounded-xl border border-edge bg-surface-panel p-3 text-left`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.personalSourcesTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.personalSourcesSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 grid grid-cols-3 gap-2`,children:[[`apple_notes`,v.sourceAppleNotes],[`calendar`,v.sourceCalendar],[`reminders`,v.sourceReminders]].map(([e,t])=>{let n=K.has(e);return(0,b.jsxs)(`button`,{type:`button`,className:o(`flex min-h-16 flex-col items-center justify-center gap-1 rounded-lg border px-2 py-2 text-xs font-medium transition-colors`,n?`border-accent/40 bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),"aria-pressed":n,onClick:()=>Ae(e),children:[(0,b.jsx)(`span`,{className:o(`flex size-4 items-center justify-center rounded-full border`,n?`border-accent bg-accent text-white`:`border-edge`),children:n?(0,b.jsx)(a,{className:`size-3`,"aria-hidden":!0}):null}),t]},e)})})]}):null,(0,b.jsxs)(c,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void je(),disabled:k||Y.picking,children:[k?(0,b.jsx)(u,{className:`size-4 animate-spin`}):(0,b.jsx)(p,{className:`size-4`}),v.quickScan]}),(0,b.jsxs)(c,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:Y.pick,disabled:k||Y.picking,children:[Y.picking?(0,b.jsx)(u,{className:`size-4 animate-spin`}):(0,b.jsx)(g,{className:`size-4`}),v.chooseFolderManually]}),(0,b.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:v.quickScanNote})]}),(0,b.jsx)(`button`,{type:`button`,className:`mt-4 text-sm font-medium text-accent-fg hover:underline`,onClick:()=>C(`/connectors?personalContext=1&returnTo=%2Fonboarding%2Fworkspace`),children:v.connectCloudSource}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Ie(),disabled:k,children:v.skip})]}):null,w===`candidates`?(0,b.jsxs)(`section`,{className:e?`flex h-full min-h-0 flex-col`:void 0,"aria-labelledby":`work-discovery-candidates-title`,children:[(0,b.jsxs)(`div`,{className:e?`shrink-0 text-center`:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.candidatesTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.candidatesSubtitle})]}),(0,b.jsx)(`div`,{className:e?`mt-5 min-h-0 flex-1 space-y-2 overflow-y-auto overscroll-contain pr-1 [scrollbar-gutter:stable]`:`mt-7 space-y-2`,children:B.map((e,t)=>{let n=V.has(e.rootPath);return(0,b.jsxs)(`button`,{type:`button`,"aria-pressed":n,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${n?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Me(e.rootPath),children:[(0,b.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${n?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,b.jsx)(a,{className:`size-3.5`})}),(0,b.jsx)(g,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,b.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),t===0?(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:v.recommendedCandidate}):null]}),(0,b.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,b.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,b.jsx)(`span`,{children:e.projectKind===`coding`?v.codingProject:e.projectKind===`general`?v.generalProject:v.unknownProject}),e.branch?(0,b.jsx)(`span`,{children:v.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,b.jsx)(`span`,{children:v.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,b.jsxs)(`div`,{className:e?`shrink-0 border-t border-edge-subtle pt-4`:void 0,children:[(0,b.jsxs)(`div`,{className:`${e?``:`mt-5 `}flex items-start gap-2 rounded-xl border border-edge-subtle bg-surface-panel px-4 py-3 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`span`,{children:v.multiFolderPrivacyNote})]}),j?(0,b.jsx)(`p`,{className:`mt-3 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsxs)(`div`,{className:`${e?`mt-4`:`mt-7`} flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(c,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k||V.size===0,onClick:()=>void Fe(),children:[k?(0,b.jsx)(u,{className:`mr-2 size-4 animate-spin`}):null,v.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,b.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:Y.pick,children:v.chooseFolderManually})]}),(0,b.jsx)(`button`,{type:`button`,className:`${e?`mt-3`:`mt-6`} mx-auto block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>T(`intro`),children:v.back})]})]}):null,w===`consent`&&E?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.selectedTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.selectedSubtitle})]}),(0,b.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,b.jsx)(g,{className:`size-5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:E.displayName}),(0,b.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:E.canonicalRootPath})]}),(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:E.projectKind===`coding`?v.codingProject:E.projectKind===`general`?v.generalProject:v.unknownProject})]}),(0,b.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.localFingerprint}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:E.fingerprint.branch?v.branchValue.replace(`{{branch}}`,E.fingerprint.branch):v.noGitBranch})]}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentActivity}),(0,b.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:v.changedFiles.replace(`{{count}}`,String(E.fingerprint.changedFileCount))})]}),E.fingerprint.recentAreas.length>0?(0,b.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.recentAreas}),(0,b.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:E.fingerprint.recentAreas.map(e=>(0,b.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,b.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(oe,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willRead}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willReadValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(se,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,b.jsxs)(`div`,{children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.willIgnore}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:v.willIgnoreValue})]})]}),(0,b.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,b.jsx)(p,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,b.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:E.remoteModel?v.providerDisclosure.replace(`{{provider}}`,E.provider):v.localDisclosure})]})]})]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(c,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void Le(),children:[k?(0,b.jsx)(u,{className:`mr-2 size-4 animate-spin`}):null,v.startAnalysis]}),(0,b.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:Y.pick,children:v.changeFolder})]}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void Ie(),children:v.skip})]}):null,w===`running`&&D?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:v.analyzingTitle}),(0,b.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:v.analyzingSubtitle}),W.total>1?(0,b.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:v.analyzingFolderProgress.replace(`{{current}}`,String(W.current)).replace(`{{total}}`,String(W.total))}):null]}),(0,b.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:x.map((e,t)=>{let n=Math.max(0,x.indexOf(D.stage??`folder_structure`)),r=t<n,i=t===n;return(0,b.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,b.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${r?`bg-accent text-white`:i?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:r?(0,b.jsx)(a,{className:`size-4`}):i?(0,b.jsx)(u,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,b.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,b.jsx)(`span`,{className:i||r?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:v.stages[e]})]},e)})}),(0,b.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:D.rootPath}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,b.jsx)(c,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>C(`/chat`),children:v.continueInBackground}),(0,b.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void ze(),children:v.cancelAnalysis})]})]}):null,w===`recognition`&&D?.result?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.recognitionEyebrow}),(0,b.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:D.result.lowConfidence?v.lowConfidenceTitle:v.recognitionTitle})]}),Ke,(0,b.jsxs)(`div`,{className:`mt-7 rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/45 via-surface-panel to-surface-panel p-5 sm:p-6`,children:[(0,b.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:D.result.projectSummary}),(0,b.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:D.result.currentState}),!D.result.lowConfidence&&$?.evidence.length?(0,b.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:$.evidence.slice(0,3).map((e,t)=>(0,b.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,b.jsx)(re,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,b.jsxs)(`span`,{children:[e.path?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${$.id}-recognition-${t}`))}):null]}),D.result.workThreads?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.workThreadsTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.workThreadsSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:D.result.workThreads.map(e=>(0,b.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:e.horizon===`current`?v.workThreadCurrent:e.horizon===`ongoing`?v.workThreadOngoing:v.workThreadLongTerm}),(0,b.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,b.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,D.result.profileCandidates?.length?(0,b.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:v.profileCandidatesTitle}),(0,b.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:v.profileCandidatesSubtitle}),(0,b.jsx)(`div`,{className:`mt-3 space-y-2`,children:D.result.profileCandidates.map(e=>(0,b.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,b.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:R.has(e.id),onChange:()=>z(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,b.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,D.result.lowConfidence?(0,b.jsxs)(`div`,{className:`mt-5`,children:[(0,b.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:D.result.contextQuestion}),(0,b.jsx)(`textarea`,{value:P,onChange:e=>F(e.target.value),placeholder:v.correctionPlaceholder,className:`mt-3 min-h-24 w-full resize-y rounded-xl border border-edge bg-surface-panel px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsx)(c,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:k||!P.trim(),onClick:()=>void Q(`different_goal`),children:v.continueWithCorrection})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsxs)(c,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:k,onClick:()=>void Be(),children:[k?(0,b.jsx)(u,{className:`size-4 animate-spin`}):(0,b.jsx)(a,{className:`size-4`}),v.confirmUnderstanding]}),(0,b.jsx)(c,{variant:`secondary`,className:`h-11 flex-1`,disabled:k,onClick:()=>N(e=>!e),children:v.notQuiteRight})]}),Ce?(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,b.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:v.correctionLabel}),(0,b.jsx)(`textarea`,{id:`work-discovery-correction`,value:P,onChange:e=>F(e.target.value),placeholder:v.correctionPlaceholder,className:`mt-2 min-h-24 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2.5 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/15`}),(0,b.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,b.jsx)(c,{variant:`ghost`,disabled:k||!P.trim(),onClick:()=>void Q(`different_goal`),children:v.differentGoal}),(0,b.jsx)(c,{variant:`primary`,disabled:k||!P.trim(),onClick:()=>void Q(`corrected`),children:v.useCorrection})]})]}):null]}),j?(0,b.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:j}):null,(0,b.jsx)(`button`,{type:`button`,disabled:k,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void Ve(),children:v.openConversation})]}):null,w===`recommendation`&&D?.result&&$?(0,b.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,b.jsxs)(`div`,{className:`text-center`,children:[(0,b.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:v.understandingConfirmed}),(0,b.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:v.primaryRecommendationTitle})]}),Ke,(0,b.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,b.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,b.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,b.jsx)(me,{className:`size-5`})}),(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:$.title}),(0,b.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:$.rationale}),(0,b.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,b.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:[(0,b.jsx)(ue,{className:`size-3.5`}),v.estimatedMinutes.replace(`{{count}}`,String($.estimatedMinutes))]}),(0,b.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ue($.risk)})]}),(0,b.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,b.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:v.expectedTask}),(0,b.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:$.expectedTask})]}),(0,b.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,b.jsx)(c,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void Z($,!1),children:v.startRecommendedAction}),(0,b.jsx)(c,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void Z($,!0),children:v.explainFirst})]})]})]})}),He.length>0?(0,b.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between py-2 text-sm font-medium text-fg-muted hover:text-fg`,onClick:()=>L(e=>!e),children:[v.otherDirections,(0,b.jsx)(fe,{className:`size-4 transition-transform ${I?`rotate-180`:``}`})]}),I?(0,b.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle rounded-xl border border-edge bg-surface-panel px-4`,children:He.map(e=>(0,b.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void Z(e,!0),children:[(0,b.jsx)(me,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,b.jsxs)(`span`,{children:[(0,b.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,b.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedTask})]})]},e.id))}):null]}):null,(0,b.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>X(D.sessionKey),children:v.doSomethingElse}),(0,b.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{N(!0),T(`recognition`)},children:v.correctUnderstanding})]})]}):null,w===`error`&&D?(0,b.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,b.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,b.jsx)(se,{className:`size-5`})}),(0,b.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:v.errorTitle}),(0,b.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:D.errorMessage}),(0,b.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,b.jsx)(c,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void ne(D.id).then(J),children:v.retry}),(0,b.jsx)(c,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{O(null),Se(null),T(`intro`)},children:v.chooseDifferent})]}),(0,b.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>X(D.sessionKey),children:v.openConversation})]}):null]}),Y.hasNativePicker?null:(0,b.jsx)(ae,{open:Y.modalOpen,onOpenChange:Y.setModalOpen,initialAbsolutePath:E?.canonicalRootPath,onConfirm:Y.confirmPick,wd:y})]})}export{C as WorkDiscoveryPage};