@xopcai/xopc 0.0.174 → 0.0.176

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 (242) hide show
  1. package/dist/browser-ext/manifest.json +1 -1
  2. package/dist/extensions/telegram/xopc.extension.json +1 -1
  3. package/dist/gateway/static/root/assets/{activity-store-CyEDJeIt.js → activity-store-DsFM1upC.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DF7Bol6I.js → agent-avatar-dicebear-DvdMLOga.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-BVjlpbeZ.js +2 -0
  6. package/dist/gateway/static/root/assets/{api-DYunqroX.js → api-BdPLCCBm.js} +1 -1
  7. package/dist/gateway/static/root/assets/{api-DwyUxpgY.js → api-Bop4IQRW.js} +1 -1
  8. package/dist/gateway/static/root/assets/{app-management-settings-panel-B4xJyvDu.js → app-management-settings-panel-DMLDOHul.js} +1 -1
  9. package/dist/gateway/static/root/assets/appearance-settings-DbI9foFR.js +1 -0
  10. package/dist/gateway/static/root/assets/apps-page-njqxLWYD.js +1 -0
  11. package/dist/gateway/static/root/assets/{archive-plugin-DWhBmmjD.js → archive-plugin-Dfdxuwvb.js} +1 -1
  12. package/dist/gateway/static/root/assets/{attachment-load-BOpZfa_I.js → attachment-load-Dn3RlnYD.js} +2 -2
  13. package/dist/gateway/static/root/assets/{attachment-preview-renderer-DonnL2dL.js → attachment-preview-renderer-Cmo-5BP5.js} +2 -2
  14. package/dist/gateway/static/root/assets/{attachment-process-heavy-RnGYy9bC.js → attachment-process-heavy-B2_kr5EA.js} +3 -3
  15. package/dist/gateway/static/root/assets/{automation-suggestion-card-Byu3I7Rs.js → automation-suggestion-card-Bc0Y7A9u.js} +1 -1
  16. package/dist/gateway/static/root/assets/automations-page-D-eweHZJ.js +6 -0
  17. package/dist/gateway/static/root/assets/{binary-plugins-6AG1qatz.js → binary-plugins-0XtB-xC0.js} +2 -2
  18. package/dist/gateway/static/root/assets/{block-editor-CJhrn98_.js → block-editor-C4fXWbEE.js} +6 -6
  19. package/dist/gateway/static/root/assets/browser-settings-page-lC86-drr.js +8 -0
  20. package/dist/gateway/static/root/assets/{browser-workflow-inputs-CBVb4mt9.js → browser-workflow-inputs-CZmzNymN.js} +1 -1
  21. package/dist/gateway/static/root/assets/{browser-workflows-page-Cq4XUKbu.js → browser-workflows-page-CBYM9HqG.js} +2 -2
  22. package/dist/gateway/static/root/assets/capabilities-settings-panel-6tYNfHqJ.js +7 -0
  23. package/dist/gateway/static/root/assets/{capability-presets-api-hbW4NAKO.js → capability-presets-api-BiJxmmhW.js} +1 -1
  24. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Co-ymbd9.js +1 -0
  25. package/dist/gateway/static/root/assets/{channel-recipient-api-CzMjHb17.js → channel-recipient-api-BKTUZDp-.js} +1 -1
  26. package/dist/gateway/static/root/assets/channels-settings-D46eVjaQ.js +1 -0
  27. package/dist/gateway/static/root/assets/channels-status-swr-BMRAO4zZ.js +1 -0
  28. package/dist/gateway/static/root/assets/{connector-logo-B9Au6gMZ.js → connector-logo-Pr4RIKjj.js} +1 -1
  29. package/dist/gateway/static/root/assets/connectors-page-Dw1eYbRi.js +2 -0
  30. package/dist/gateway/static/root/assets/desktop-pet-B8cZuQUt.js +1 -0
  31. package/dist/gateway/static/root/assets/{desktop-pet-settings-CNff5TFb.js → desktop-pet-settings-CEQacUDF.js} +1 -1
  32. package/dist/gateway/static/root/assets/{directory-picker-path-field-Bf956uo-.js → directory-picker-path-field-DWnxdZtc.js} +1 -1
  33. package/dist/gateway/static/root/assets/{dreaming-settings-CHM8FE1g.js → dreaming-settings-D2e2w2Ho.js} +3 -3
  34. package/dist/gateway/static/root/assets/{extension-debug-page-ZqM_0eUs.js → extension-debug-page-BLjTGbv3.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-page-D4hvXOMM.js → extension-page-D2_UC6hy.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-GsqxaJjA.js → extension-settings-page-BsH6o_PX.js} +1 -1
  37. package/dist/gateway/static/root/assets/{focus-detail-page-CE6uwrl1.js → focus-detail-page-BBXUtxRB.js} +1 -1
  38. package/dist/gateway/static/root/assets/{gateway-config-api-B4THmgnS.js → gateway-config-api-C-DkC6UJ.js} +1 -1
  39. package/dist/gateway/static/root/assets/{gateway-settings-CPv-MxGE.js → gateway-settings-DEOGiimF.js} +1 -1
  40. package/dist/gateway/static/root/assets/{gateway-startup-retry-MP3K71pP.js → gateway-startup-retry-BlSLh1TF.js} +1 -1
  41. package/dist/gateway/static/root/assets/goal-create-dialog-CSFcRE_N.js +1 -0
  42. package/dist/gateway/static/root/assets/goal-detail-page-VjRArfAJ.js +4 -0
  43. package/dist/gateway/static/root/assets/{goals-config-api-DCcDuIjG.js → goals-config-api-CcdS9qek.js} +1 -1
  44. package/dist/gateway/static/root/assets/goals-page-BAcErdch.js +2 -0
  45. package/dist/gateway/static/root/assets/{goals-settings-o9QMXvNq.js → goals-settings-BY7crl0z.js} +1 -1
  46. package/dist/gateway/static/root/assets/{heartbeat-settings-DixwpXnH.js → heartbeat-settings-DtTkS0gs.js} +1 -1
  47. package/dist/gateway/static/root/assets/{image-generation-api-BOGH9FGi.js → image-generation-api-WGgkbwDZ.js} +1 -1
  48. package/dist/gateway/static/root/assets/index-2UImfRDC.js +212 -0
  49. package/dist/gateway/static/root/assets/index-CS9sVShT.css +1 -0
  50. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-D4o4ZPF6.js → keyboard-shortcuts-settings-C5lpWQ3f.js} +1 -1
  51. package/dist/gateway/static/root/assets/local-app-workbench-page-Cl0fcPL4.js +2 -0
  52. package/dist/gateway/static/root/assets/{local-apps-page-GzMmpO7G.js → local-apps-page-b05wWvXG.js} +1 -1
  53. package/dist/gateway/static/root/assets/{locale-store-CAuhEGCn.js → locale-store-sToMfHX_.js} +1 -1
  54. package/dist/gateway/static/root/assets/logs-page-cDE1jLJv.js +7 -0
  55. package/dist/gateway/static/root/assets/{markdown-split-CIX8D1pv.js → markdown-split-0gPVst5y.js} +1 -1
  56. package/dist/gateway/static/root/assets/{media-plugins-Bp3eIA45.js → media-plugins-Rxyq_KTm.js} +1 -1
  57. package/dist/gateway/static/root/assets/messages-CarlxqXV.js +3 -0
  58. package/dist/gateway/static/root/assets/{notes-page-RVFiYAoO.js → notes-page-DRhNDl_Q.js} +1 -1
  59. package/dist/gateway/static/root/assets/notes-workbench-BKNBk0Uf.js +4 -0
  60. package/dist/gateway/static/root/assets/{page-tabs-BGAYH3Ef.js → page-tabs-cOEOQqHh.js} +1 -1
  61. package/dist/gateway/static/root/assets/pdf-D4PI9qAw.js +54 -0
  62. package/dist/gateway/static/root/assets/pdf.worker.min-CHFwMXne.mjs +29 -0
  63. package/dist/gateway/static/root/assets/{preview-open-alternatives-BM6pDkHp.js → preview-open-alternatives-BopOLFvu.js} +1 -1
  64. package/dist/gateway/static/root/assets/{product-open-page-BiMetEmn.js → product-open-page-DWVPmmOq.js} +1 -1
  65. package/dist/gateway/static/root/assets/project-detail-page-BhjEXNQW.js +1 -0
  66. package/dist/gateway/static/root/assets/projects-page-B80e69PH.js +1 -0
  67. package/dist/gateway/static/root/assets/remote-access-hub-CwdVob6H.js +1 -0
  68. package/dist/gateway/static/root/assets/{save-bar-controls-BdjV8MK5.js → save-bar-controls-BfZmKe1t.js} +1 -1
  69. package/dist/gateway/static/root/assets/{schedule-field-ChlqXU46.js → schedule-field-Cpi4jCRV.js} +1 -1
  70. package/dist/gateway/static/root/assets/{schema-form-DDKf5ZSH.js → schema-form-OXFkcZQe.js} +1 -1
  71. package/dist/gateway/static/root/assets/sessions-page-BGt3Asj6.js +1 -0
  72. package/dist/gateway/static/root/assets/settings-advanced-gate-BnTdM9Nn.js +1 -0
  73. package/dist/gateway/static/root/assets/{settings-form-section-CPG0KGVs.js → settings-form-section-BwqkZCHJ.js} +1 -1
  74. package/dist/gateway/static/root/assets/{settings-loading-skeleton-DRSDHucM.js → settings-loading-skeleton-BbqH_S3Y.js} +1 -1
  75. package/dist/gateway/static/root/assets/{settings-page-CeB7_xD0.js → settings-page-BoxC-JSa.js} +1 -1
  76. package/dist/gateway/static/root/assets/{settings-page-layout-BENrkwd0.js → settings-page-layout-Ddu2iGaW.js} +1 -1
  77. package/dist/gateway/static/root/assets/setup-status-panel-z1Lwv0js.js +1 -0
  78. package/dist/gateway/static/root/assets/{share-preview-page-DIzczJkG.js → share-preview-page-CVazOFjy.js} +2 -2
  79. package/dist/gateway/static/root/assets/shares-settings-C4lXuyQj.js +1 -0
  80. package/dist/gateway/static/root/assets/skill-reload-api-DSuIDkeI.js +1 -0
  81. package/dist/gateway/static/root/assets/skills-page-xgZczqVe.js +2 -0
  82. package/dist/gateway/static/root/assets/skills-page.utils-DgyB1tSo.js +1 -0
  83. package/dist/gateway/static/root/assets/{system-settings-panel-Dp4d5Q1B.js → system-settings-panel-BoLSQL65.js} +1 -1
  84. package/dist/gateway/static/root/assets/{theme-store-CbGc1laW.js → theme-store-CBNcGOfj.js} +1 -1
  85. package/dist/gateway/static/root/assets/time-picker-gochWrny.js +1 -0
  86. package/dist/gateway/static/root/assets/{typed-models-lib-DwPk3OPL.js → typed-models-lib-DvRnr7YB.js} +1 -1
  87. package/dist/gateway/static/root/assets/{use-channel-catalog-CXrEu2dw.js → use-channel-catalog-CA9BFVB7.js} +1 -1
  88. package/dist/gateway/static/root/assets/user-context-page-CEfIy4WZ.js +1 -0
  89. package/dist/gateway/static/root/assets/{voice-api-key-field-DFoA79LB.js → voice-api-key-field-v8tgylEZ.js} +1 -1
  90. package/dist/gateway/static/root/assets/work-discovery-page-B-3MClaf.js +1 -0
  91. package/dist/gateway/static/root/assets/work-item-detail-page-CEsFEdax.js +1 -0
  92. package/dist/gateway/static/root/assets/work-page-CT9AHnq6.js +3 -0
  93. package/dist/gateway/static/root/assets/workflow-run-setup-panel-CC3cJn5k.js +3 -0
  94. package/dist/gateway/static/root/assets/workflows-page-C-1-_Zp1.js +11 -0
  95. package/dist/gateway/static/root/index.html +7 -7
  96. package/dist/package.js +1 -1
  97. package/dist/src/agent/agent-manager.js +8 -8
  98. package/dist/src/agent/context/execution-scope.d.ts +26 -0
  99. package/dist/src/agent/context/execution-scope.js +84 -0
  100. package/dist/src/agent/context/project-context.d.ts +3 -1
  101. package/dist/src/agent/context/project-context.js +26 -8
  102. package/dist/src/agent/embedded/model-runtime.d.ts +1 -2
  103. package/dist/src/agent/embedded/model-runtime.js +17 -29
  104. package/dist/src/agent/embedded/session-runner.js +2 -3
  105. package/dist/src/agent/mcp/mcp-transport.js +1 -1
  106. package/dist/src/agent/prompt/service-prompt-builder.js +1 -0
  107. package/dist/src/agent/prompt/system-prompt.js +1 -1
  108. package/dist/src/agent/service/process-direct-streaming.js +7 -4
  109. package/dist/src/agent/service.js +1 -1
  110. package/dist/src/agent/session/session-config-service.d.ts +4 -1
  111. package/dist/src/agent/session/session-config-service.js +5 -3
  112. package/dist/src/agent/session/session-inspector.d.ts +6 -0
  113. package/dist/src/agent/session/session-inspector.js +9 -2
  114. package/dist/src/agent/skills/hub-pull.js +1 -1
  115. package/dist/src/agent/skills/index.d.ts +2 -0
  116. package/dist/src/agent/skills/index.js +14 -5
  117. package/dist/src/agent/skills/marketplace/adapters/store/store-api-client.js +1 -1
  118. package/dist/src/agent/skills/skill-manage-ops.js +1 -1
  119. package/dist/src/agent/skills/test-framework.js +1 -1
  120. package/dist/src/agent/workflow/subagent-runner.js +2 -0
  121. package/dist/src/agent/workflow/types.d.ts +1 -0
  122. package/dist/src/auth/model-credential-store.d.ts +17 -0
  123. package/dist/src/auth/model-credential-store.js +110 -0
  124. package/dist/src/auth/oauth/github-copilot.js +2 -2
  125. package/dist/src/auth/oauth/openai-codex.js +98 -7
  126. package/dist/src/auth/oauth/types.d.ts +4 -1
  127. package/dist/src/auth/oauth/xopc-cloud.js +124 -6
  128. package/dist/src/automations/domain/defaults.d.ts +1 -0
  129. package/dist/src/automations/domain/defaults.js +4 -0
  130. package/dist/src/automations/domain/index.d.ts +1 -0
  131. package/dist/src/automations/domain/index.js +2 -1
  132. package/dist/src/automations/index.js +2 -1
  133. package/dist/src/automations/service/action-executor.js +2 -2
  134. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  135. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  136. package/dist/src/cli/commands/skills.js +1 -1
  137. package/dist/src/cli/commands/update.js +1 -1
  138. package/dist/src/config/agent-profile.js +1 -1
  139. package/dist/src/config/index.js +2 -2
  140. package/dist/src/config/schema.d.ts +21 -0
  141. package/dist/src/config/schema.js +12 -2
  142. package/dist/src/gateway/agents-admin.js +1 -1
  143. package/dist/src/gateway/heartbeat/service.js +1 -1
  144. package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -0
  145. package/dist/src/gateway/hono/lib/config-payload.js +1 -0
  146. package/dist/src/gateway/hono/oauth-async.d.ts +5 -0
  147. package/dist/src/gateway/hono/oauth-async.js +20 -8
  148. package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +1 -1
  149. package/dist/src/gateway/hono/routes/config-patch/gateway.js +9 -0
  150. package/dist/src/gateway/hono/routes/goals.js +13 -0
  151. package/dist/src/gateway/hono/routes/home.d.ts +16 -3
  152. package/dist/src/gateway/hono/routes/home.js +98 -25
  153. package/dist/src/gateway/hono/routes/index.js +2 -0
  154. package/dist/src/gateway/hono/routes/local-apps.js +1 -1
  155. package/dist/src/gateway/hono/routes/project-skills.d.ts +3 -0
  156. package/dist/src/gateway/hono/routes/project-skills.js +119 -0
  157. package/dist/src/gateway/hono/routes/update.js +2 -2
  158. package/dist/src/gateway/index.js +1 -1
  159. package/dist/src/gateway/run-loop.js +1 -1
  160. package/dist/src/gateway/service/sessions-api.d.ts +2 -1
  161. package/dist/src/gateway/service.js +5 -5
  162. package/dist/src/heartbeat/index.js +1 -1
  163. package/dist/src/infra/gateway-processes.js +1 -1
  164. package/dist/src/infra/update-restart.js +1 -1
  165. package/dist/src/infra/update-runner.js +2 -2
  166. package/dist/src/infra/update-startup.js +1 -1
  167. package/dist/src/mcp/channel-bridge.js +1 -1
  168. package/dist/src/projects/index.d.ts +1 -0
  169. package/dist/src/projects/index.js +2 -1
  170. package/dist/src/projects/project-skill-service.d.ts +67 -0
  171. package/dist/src/projects/project-skill-service.js +131 -0
  172. package/dist/src/providers/index.js +4 -2
  173. package/dist/src/providers/provider-auth-service.d.ts +22 -0
  174. package/dist/src/providers/provider-auth-service.js +66 -0
  175. package/dist/src/providers/register-runtime-providers.d.ts +6 -0
  176. package/dist/src/providers/register-runtime-providers.js +55 -0
  177. package/dist/src/providers/xopc-cloud-account-service.d.ts +2 -2
  178. package/dist/src/providers/xopc-cloud-account-service.js +6 -5
  179. package/dist/src/providers/xopc-cloud-config.d.ts +3 -0
  180. package/dist/src/providers/xopc-cloud-config.js +13 -0
  181. package/dist/src/providers/xopc-cloud-model-source.d.ts +2 -2
  182. package/dist/src/providers/xopc-cloud-model-source.js +6 -5
  183. package/dist/src/session/index.d.ts +1 -1
  184. package/dist/src/session/index.js +2 -2
  185. package/dist/src/session/thinking-resolve.d.ts +8 -0
  186. package/dist/src/session/thinking-resolve.js +6 -3
  187. package/dist/src/storage/sqlite/home-attention-repository.d.ts +3 -0
  188. package/dist/src/storage/sqlite/home-attention-repository.js +21 -0
  189. package/dist/src/storage/sqlite/index.d.ts +1 -0
  190. package/dist/src/storage/sqlite/index.js +2 -1
  191. package/dist/src/storage/sqlite/migrations/067_home_attention_acknowledgements.sql +9 -0
  192. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  193. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  194. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  195. package/dist/src/storage/sqlite/schema.js +1 -1
  196. package/dist/src/storage/sqlite/schema.sql +10 -0
  197. package/dist/src/tui/tui-startup-resources.js +1 -1
  198. package/dist/src/tui/tui.js +2 -2
  199. package/dist/src/tui/xopc-tui-keybindings.d.ts +44 -4
  200. package/dist/src/workflows/engine/workflow-engine.d.ts +1 -0
  201. package/dist/src/workflows/engine/workflow-engine.js +2 -0
  202. package/dist/src/workflows/service/workflow-run-service.js +11 -5
  203. package/dist/src/workflows/service/workflow-session-bridge.js +2 -1
  204. package/package.json +5 -5
  205. package/dist/gateway/static/root/assets/agents-BVxEFPQ5.js +0 -2
  206. package/dist/gateway/static/root/assets/appearance-settings-B2PQxRiu.js +0 -1
  207. package/dist/gateway/static/root/assets/apps-page-BtIgd82S.js +0 -1
  208. package/dist/gateway/static/root/assets/automations-page-CG_SCH5b.js +0 -6
  209. package/dist/gateway/static/root/assets/browser-settings-page-CfLqPWZC.js +0 -8
  210. package/dist/gateway/static/root/assets/capabilities-settings-panel-DCJmm6cR.js +0 -7
  211. package/dist/gateway/static/root/assets/capability-presets-settings-panel-CnkAYvWI.js +0 -1
  212. package/dist/gateway/static/root/assets/channels-settings-DtqqFpDn.js +0 -1
  213. package/dist/gateway/static/root/assets/channels-status-swr-C-5yHbc0.js +0 -1
  214. package/dist/gateway/static/root/assets/connectors-page-CaHfs8YF.js +0 -2
  215. package/dist/gateway/static/root/assets/desktop-pet-CvFMKYdb.js +0 -1
  216. package/dist/gateway/static/root/assets/goal-create-dialog-DAeb82xP.js +0 -1
  217. package/dist/gateway/static/root/assets/goal-detail-page-CwLSp01r.js +0 -4
  218. package/dist/gateway/static/root/assets/goals-page-DvJQ6_4M.js +0 -2
  219. package/dist/gateway/static/root/assets/index-CfXiRNN5.css +0 -1
  220. package/dist/gateway/static/root/assets/index-eyttVNS_.js +0 -212
  221. package/dist/gateway/static/root/assets/local-app-workbench-page-CPcfqn_A.js +0 -2
  222. package/dist/gateway/static/root/assets/logs-page-DXABWCZp.js +0 -7
  223. package/dist/gateway/static/root/assets/messages-BiBdO1-O.js +0 -3
  224. package/dist/gateway/static/root/assets/notes-workbench-DgJzZRX3.js +0 -4
  225. package/dist/gateway/static/root/assets/pdf-epILhEOn.js +0 -54
  226. package/dist/gateway/static/root/assets/pdf.worker.min-iDqQPrd3.mjs +0 -31
  227. package/dist/gateway/static/root/assets/project-detail-page-DF7F70Vg.js +0 -1
  228. package/dist/gateway/static/root/assets/projects-page-Cw3jyi5s.js +0 -1
  229. package/dist/gateway/static/root/assets/remote-access-hub-ChAJsaNY.js +0 -1
  230. package/dist/gateway/static/root/assets/sessions-page-BxZIxt7z.js +0 -1
  231. package/dist/gateway/static/root/assets/settings-advanced-gate-DcDLS0xV.js +0 -1
  232. package/dist/gateway/static/root/assets/setup-status-panel-4Xa9NA7v.js +0 -1
  233. package/dist/gateway/static/root/assets/shares-settings-BpN0o5Cf.js +0 -1
  234. package/dist/gateway/static/root/assets/skill-reload-api-DvF2UAaL.js +0 -1
  235. package/dist/gateway/static/root/assets/skills-page-CGKXpNfy.js +0 -2
  236. package/dist/gateway/static/root/assets/time-picker-BhgCeDuO.js +0 -1
  237. package/dist/gateway/static/root/assets/user-context-page-Dy_fKAK_.js +0 -1
  238. package/dist/gateway/static/root/assets/work-discovery-page-BWkjb1NK.js +0 -1
  239. package/dist/gateway/static/root/assets/work-item-detail-page-DLBNFse5.js +0 -1
  240. package/dist/gateway/static/root/assets/work-page-Bn5RXMIE.js +0 -1
  241. package/dist/gateway/static/root/assets/workflow-run-setup-panel-BuniGPO0.js +0 -3
  242. package/dist/gateway/static/root/assets/workflows-page-_vFhRrAl.js +0 -11
@@ -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"./circle-alert-BEjgurr2.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-BiBdO1-O.js";import{n as u}from"./locale-store-CAuhEGCn.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$t as f,Ac as p,Bo as m,Cl as h,Cs as g,Eu as _,Go as v,Gs as y,Gt as b,Ho as x,Hs as S,Ht as C,Ic as w,Jl as T,Jt as E,Kt as D,Ls as O,Ms as k,Qt as A,Rc as j,Sc as M,Tl as N,To as P,Uo as F,Ut as I,Vo as L,Vs as R,Wo as z,Wt as B,Xt as V,Yl as H,Yt as U,Zt as W,ac as G,an as K,cn as ee,cu as q,dc as te,dn as ne,en as re,gn as ie,hn as J,hu as ae,in as oe,is as Y,ks as X,lc as se,ln as ce,ls as le,nn as ue,nr as de,ns as fe,on as pe,pn as me,pu as he,qo as Z,qt as ge,rn as _e,ro as ve,ru as ye,sn as be,tn as xe,ul as Se,un as Ce,us as we,uu as Te,vt as Ee,xu as De,zo as Oe}from"./index-eyttVNS_.js";import{t as ke}from"./page-tabs-BGAYH3Ef.js";import{t as Ae}from"./time-picker-BhgCeDuO.js";import{D as je,E as Me,t as Ne}from"./connector-logo-B9Au6gMZ.js";var Pe=n(),Q=e(t(),1),$=r();function Fe(e){let t=(0,Pe.c)(104),{value:n,onChange:r,labels:i,language:a,inputClassName:o}=e,s;t[0]===n.timezone?s=t[1]:(s=()=>J.some(e=>e.value===n.timezone)?``:n.timezone,t[0]=n.timezone,t[1]=s);let[l,u]=(0,Q.useState)(s),d;t[2]===n.timezone?d=t[3]:(d=()=>!!n.timezone&&!J.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,_]=(0,Q.useState)(m),v;bb0:{if(f){v=`__custom__`;break bb0}v=J.some(e=>e.value===n.timezone)?n.timezone:`__custom__`}let y=v,b;t[6]!==r||t[7]!==n?(b=e=>r({...n,...e}),t[6]=r,t[7]=n,t[8]=b):b=t[8];let x=b,S;t[9]===a?S=t[10]:(S=(e,t)=>a===`zh`?t:e,t[9]=a,t[10]=S);let C=S,w;t[11]===i.callName?w=t[12]:(w=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.callName}),t[11]=i.callName,t[12]=w);let T;t[13]===x?T=t[14]:(T=e=>x({callName:e.target.value}),t[13]=x,t[14]=T);let E;t[15]!==o||t[16]!==i.callNamePlaceholder||t[17]!==T||t[18]!==n.callName?(E=(0,$.jsx)(`input`,{className:o,value:n.callName,onChange:T,placeholder:i.callNamePlaceholder,autoComplete:`off`}),t[15]=o,t[16]=i.callNamePlaceholder,t[17]=T,t[18]=n.callName,t[19]=E):E=t[19];let D;t[20]!==w||t[21]!==E?(D=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[w,E]}),t[20]=w,t[21]=E,t[22]=D):D=t[22];let O;t[23]===i.pronouns?O=t[24]:(O=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.pronouns}),t[23]=i.pronouns,t[24]=O);let k=h?`__custom__`:n.pronouns,A;t[25]!==x||t[26]!==n.pronouns?(A=e=>{if(e.target.value===`__custom__`){_(!0),me.some(e=>e.value===n.pronouns)&&x({pronouns:``});return}_(!1),x({pronouns:e.target.value})},t[25]=x,t[26]=n.pronouns,t[27]=A):A=t[27];let j;t[28]===i.pronounsPlaceholder?j=t[29]:(j=(0,$.jsx)(Y,{value:``,children:i.pronounsPlaceholder}),t[28]=i.pronounsPlaceholder,t[29]=j);let M;t[30]===C?M=t[31]:(M=me.map(e=>(0,$.jsx)(Y,{value:e.value,children:C(e.labelEn,e.labelZh)},e.value)),t[30]=C,t[31]=M);let N;t[32]===i.custom?N=t[33]:(N=(0,$.jsx)(Y,{value:`__custom__`,children:i.custom}),t[32]=i.custom,t[33]=N);let P;t[34]!==o||t[35]!==k||t[36]!==A||t[37]!==j||t[38]!==M||t[39]!==N?(P=(0,$.jsxs)(fe,{className:o,value:k,onChange:A,children:[j,M,N]}),t[34]=o,t[35]=k,t[36]=A,t[37]=j,t[38]=M,t[39]=N,t[40]=P):P=t[40];let F;t[41]!==o||t[42]!==i.pronounsPlaceholder||t[43]!==h||t[44]!==x||t[45]!==n.pronouns?(F=h?(0,$.jsx)(`input`,{className:c(o,`mt-1 text-xs`),value:n.pronouns,onChange:e=>x({pronouns:e.target.value}),placeholder:i.pronounsPlaceholder,autoComplete:`off`}):null,t[41]=o,t[42]=i.pronounsPlaceholder,t[43]=h,t[44]=x,t[45]=n.pronouns,t[46]=F):F=t[46];let I;t[47]!==O||t[48]!==P||t[49]!==F?(I=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[O,P,F]}),t[47]=O,t[48]=P,t[49]=F,t[50]=I):I=t[50];let L;t[51]===i.timezone?L=t[52]:(L=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[51]=i.timezone,t[52]=L);let R;t[53]===o?R=t[54]:(R=c(o,`min-w-0 flex-1`),t[53]=o,t[54]=R);let z;t[55]===x?z=t[56]:(z=e=>{if(e.target.value===`__custom__`){p(!0);return}p(!1),u(``),x({timezone:e.target.value})},t[55]=x,t[56]=z);let B;t[57]===C?B=t[58]:(B=J.map(e=>(0,$.jsx)(Y,{value:e.value,children:C(e.labelEn,e.labelZh)},e.value)),t[57]=C,t[58]=B);let V;t[59]===i.timezoneCustom?V=t[60]:(V=(0,$.jsx)(Y,{value:`__custom__`,children:i.timezoneCustom}),t[59]=i.timezoneCustom,t[60]=V);let H;t[61]!==R||t[62]!==z||t[63]!==B||t[64]!==V||t[65]!==y?(H=(0,$.jsxs)(fe,{className:R,value:y,onChange:z,children:[B,V]}),t[61]=R,t[62]=z,t[63]=B,t[64]=V,t[65]=y,t[66]=H):H=t[66];let U;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(U=c(`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`,g.press),t[67]=U):U=t[67];let W;t[68]===x?W=t[69]:(W=()=>{let e=ie();if(!e)return;let t=J.some(t=>t.value===e);p(!t),u(t?``:e),x({timezone:e})},t[68]=x,t[69]=W);let G;t[70]!==i.timezoneDetect||t[71]!==W?(G=(0,$.jsx)(`button`,{type:`button`,className:U,onClick:W,children:i.timezoneDetect}),t[70]=i.timezoneDetect,t[71]=W,t[72]=G):G=t[72];let K;t[73]!==H||t[74]!==G?(K=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[H,G]}),t[73]=H,t[74]=G,t[75]=K):K=t[75];let ee;t[76]!==l||t[77]!==o||t[78]!==f||t[79]!==x?(ee=f?(0,$.jsx)(`input`,{className:c(o,`mt-1 font-mono text-xs`),value:l,onChange:e=>{u(e.target.value),x({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null,t[76]=l,t[77]=o,t[78]=f,t[79]=x,t[80]=ee):ee=t[80];let q;t[81]!==L||t[82]!==K||t[83]!==ee?(q=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[L,K,ee]}),t[81]=L,t[82]=K,t[83]=ee,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 ne;t[87]===o?ne=t[88]:(ne=c(o,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=o,t[88]=ne);let re;t[89]===x?re=t[90]:(re=e=>x({notes:e.target.value}),t[89]=x,t[90]=re);let ae;t[91]!==i.notesPlaceholder||t[92]!==ne||t[93]!==re||t[94]!==n.notes?(ae=(0,$.jsx)(`textarea`,{className:ne,value:n.notes,onChange:re,placeholder:i.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=i.notesPlaceholder,t[92]=ne,t[93]=re,t[94]=n.notes,t[95]=ae):ae=t[95];let oe;t[96]!==te||t[97]!==ae?(oe=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[te,ae]}),t[96]=te,t[97]=ae,t[98]=oe):oe=t[98];let X;return t[99]!==D||t[100]!==I||t[101]!==q||t[102]!==oe?(X=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[D,I,q,oe]}),t[99]=D,t[100]=I,t[101]=q,t[102]=oe,t[103]=X):X=t[103],X}function Ie(e){let t=(0,Pe.c)(57),{open:n,t:r,onOpenChange:i,onNavigate:a}=e,o;t[0]!==r.helpLearningBody||t[1]!==r.helpLearningTitle?(o={icon:De,title:r.helpLearningTitle,body:r.helpLearningBody},t[0]=r.helpLearningBody,t[1]=r.helpLearningTitle,t[2]=o):o=t[2];let s;t[3]!==r.helpSharingBody||t[4]!==r.helpSharingTitle?(s={icon:O,title:r.helpSharingTitle,body:r.helpSharingBody},t[3]=r.helpSharingBody,t[4]=r.helpSharingTitle,t[5]=s):s=t[5];let l;t[6]!==r.helpSourcesBody||t[7]!==r.helpSourcesTitle?(l={icon:H,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:se,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]!==s||t[14]!==l||t[15]!==u?(d=[o,s,l,u],t[12]=o,t[13]=s,t[14]=l,t[15]=u,t[16]=d):d=t[16];let f=d,p;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(F,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,we)}),t[17]=p):p=t[17];let h;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(h=c(`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`,le,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[18]=h):h=t[18];let g;t[19]===r.helpTitle?g=t[20]:(g=(0,$.jsx)(v,{className:`text-base font-semibold text-fg`,children:r.helpTitle}),t[19]=r.helpTitle,t[20]=g);let _;t[21]===r.helpSubtitle?_=t[22]:(_=(0,$.jsx)(x,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.helpSubtitle}),t[21]=r.helpSubtitle,t[22]=_);let y;t[23]!==g||t[24]!==_?(y=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[g,_]}),t[23]=g,t[24]=_,t[25]=y):y=t[25];let b;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[26]=b):b=t[26];let S;t[27]===r.close?S=t[28]:(S=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r.close,children:b})}),t[27]=r.close,t[28]=S);let C;t[29]!==y||t[30]!==S?(C=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[y,S]}),t[29]=y,t[30]=S,t[31]=C):C=t[31];let w;t[32]===f?w=t[33]:(w=(0,$.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-5 py-2`,children:f.map(Le)}),t[32]=f,t[33]=w);let T;t[34]!==a||t[35]!==i?(T=()=>{i(!1),a(`sources`)},t[34]=a,t[35]=i,t[36]=T):T=t[36];let E;t[37]!==r.tabs.sources||t[38]!==T?(E=(0,$.jsx)(X,{type:`button`,variant:`ghost`,onClick:T,children:r.tabs.sources}),t[37]=r.tabs.sources,t[38]=T,t[39]=E):E=t[39];let D;t[40]!==a||t[41]!==i?(D=()=>{i(!1),a(`privacy`)},t[40]=a,t[41]=i,t[42]=D):D=t[42];let A;t[43]!==r.openPrivacyControls||t[44]!==D?(A=(0,$.jsx)(X,{type:`button`,variant:`secondary`,onClick:D,children:r.openPrivacyControls}),t[43]=r.openPrivacyControls,t[44]=D,t[45]=A):A=t[45];let j;t[46]!==E||t[47]!==A?(j=(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[E,A]}),t[46]=E,t[47]=A,t[48]=j):j=t[48];let M;t[49]!==C||t[50]!==w||t[51]!==j?(M=(0,$.jsxs)(z,{children:[p,(0,$.jsxs)(L,{className:h,children:[C,w,j]})]}),t[49]=C,t[50]=w,t[51]=j,t[52]=M):M=t[52];let N;return t[53]!==i||t[54]!==n||t[55]!==M?(N=(0,$.jsx)(Oe,{open:n,onOpenChange:i,children:M}),t[53]=i,t[54]=n,t[55]=M,t[56]=N):N=t[56],N}function Le(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)}function Re(e){let t=(0,Pe.c)(33),{source:n,language:r,busy:i,onOpenChange:a,onConfirm:o}=e,s=l(r).you,[u,d]=(0,Q.useState)(!1),f=n?.accountLabel??(n?.accountCount&&n.accountCount>1&&n.accountOrdinal?s.sourceAccountFallback.replace(`{{index}}`,String(n.accountOrdinal)).replace(`{{count}}`,String(n.accountCount)):void 0),p,h;t[0]===n?(p=t[1],h=t[2]):(p=()=>{n&&d(!1)},h=[n],t[0]=n,t[1]=p,t[2]=h),(0,Q.useEffect)(p,h);let g;t[3]!==i||t[4]!==a?(g=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=g):g=t[5];let _;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=_):_=t[6];let b;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[7]=b):b=t[7];let C;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>d(!1),t[8]=C):C=t[8];let w=u?`border-edge-subtle hover:bg-surface-hover`:`border-accent/40 bg-accent-soft/35`,T;t[9]===w?T=t[10]:(T=c(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,w),t[9]=w,t[10]=T);let E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(H,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=E):E=t[11];let D;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>d(!0),t[12]=D):D=t[12];let O=u?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,A;t[13]===O?A=t[14]:(A=c(`flex w-full items-start gap-3 rounded-xl border p-4 text-left disabled:cursor-not-allowed disabled:opacity-55`,O),t[13]=O,t[14]=A);let j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(y,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=j):j=t[15];let M=s.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),N;t[16]===M?N=t[17]:(N=(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:M}),t[16]=M,t[17]=N);let P;t[18]!==i||t[19]!==s.cancel?(P=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(X,{type:`button`,variant:`ghost`,disabled:i,children:s.cancel})}),t[18]=i,t[19]=s.cancel,t[20]=P):P=t[20];let I=u?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,R;t[21]!==u||t[22]!==o?(R=()=>o(u),t[21]=u,t[22]=o,t[23]=R):R=t[23];let B;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(B=(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[24]=B):B=t[24];let V=i?s.disconnecting:s.disconnectAction,U;t[25]!==i||t[26]!==I||t[27]!==R||t[28]!==V?(U=(0,$.jsxs)(X,{type:`button`,variant:`secondary`,className:I,disabled:i,onClick:R,children:[B,V]}),t[25]=i,t[26]=I,t[27]=R,t[28]=V,t[29]=U):U=t[29];let W;return t[30]!==P||t[31]!==U?(W=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[P,U]}),t[30]=P,t[31]=U,t[32]=W):W=t[32],(0,$.jsx)(Oe,{open:n!==null,onOpenChange:g,children:(0,$.jsxs)(z,{children:[_,(0,$.jsxs)(L,{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)(v,{className:`text-base font-semibold text-fg`,children:s.disconnectTitle}),(0,$.jsx)(x,{className:`mt-1 text-sm text-fg-muted`,children:s.disconnectBody.replace(`{{source}}`,n?.displayName??``)})]}),(0,$.jsx)(m,{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":s.cancel,disabled:i,children:b})})]}),(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:s.disconnectAccount.replace(`{{account}}`,f)}):null,(0,$.jsx)(`p`,{children:s.disconnectImpact.replace(`{{items}}`,String(n?.knowledgeItemCount??0)).replace(`{{understandings}}`,String(n?.derivedUnderstandingCount??0))})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":!u,onClick:C,className:T,children:[E,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:s.disconnectKeepTitle}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:s.disconnectKeepBody})]})]}),(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":u,onClick:D,disabled:!n?.derivedUnderstandingCount,className:A,children:[j,(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block text-sm font-semibold text-fg`,children:s.disconnectDeleteTitle}),N]})]})]}),W]})]})})}var ze={"composio-gmail":`gmail`,"composio-googledrive":`google-drive`,"composio-notion":`notion`,"composio-slack":`slack`,memory:`memory`};function Be(e){if(e.branding?.logoUrl)return e.branding;let t=ze[e.id];return t?{...e.branding,logoUrl:`/connector-icons/${t}.svg`}:e.branding}function Ve(e,t){return Object.entries(t).reduce((e,[t,n])=>e.replace(`{{${t}}}`,String(n)),e)}function He(e){return e.status===`active`||e.status===`connected`}function Ue(e,t){return!He(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:Ve(t.sourcePendingReview,{count:e.learningFunnel.provisionalClaims}),tone:`review`}:e.learningFunnel.activeClaims>0?{summary:Ve(t.sourceReliable,{count:e.learningFunnel.activeClaims}),tone:`useful`}:e.learningFunnel.attributedItems>0?{summary:Ve(t.sourceStillLearning,{count:e.learningFunnel.attributedItems}),tone:`learning`}:e.learningFunnel.indexedItems>0?{summary:Ve(t.sourceNoPersonalSignal,{count:e.learningFunnel.indexedItems}),tone:`neutral`}:e.learning?.status===`completed`?{summary:t.sourceNoRecentSignal,tone:`neutral`}:{summary:t.sourcePreparing,tone:`learning`}}function We(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 Ge(e,t){return e.accountLabel?e.accountLabel:e.accountCount&&e.accountCount>1&&e.accountOrdinal?Ve(t.sourceAccountFallback,{index:e.accountOrdinal,count:e.accountCount}):t.sourceUnknownAccount}function Ke(e){return e.lastSyncAt??e.learning?.updatedAt??e.lastActivityAt??e.lastConnectedAt}function qe(e,t){let n=Date.parse(e);return Number.isFinite(n)?Ee(n,t):e}function Je(e,t){return{attention:0,learning:1,review:2,useful:3,paused:4,neutral:5}[Ue(e,t).tone]}function Ye(e){let t=(0,Pe.c)(173),{source:n,language:r,t:i,busy:a,onOpenChange:o,onLearn:s,onPause:l,onConfigure:u,onDisconnect:d,onViewUnderstanding:f}=e;if(!n)return null;let p;t[0]!==n||t[1]!==i?(p=Ue(n,i),t[0]=n,t[1]=i,t[2]=p):p=t[2];let h=p,g,_,y,b,C,w,T,E,D,O,A,N,P,I,R,B;if(t[3]!==r||t[4]!==o||t[5]!==f||t[6]!==h.summary||t[7]!==h.tone||t[8]!==n||t[9]!==i){let e=Ke(n);b=n.learning?.status===`paused`,C=h.tone===`attention`,y=Oe,T=!0,E=o,_=z,t[26]===Symbol.for(`react.memo_cache_sentinel`)?(w=(0,$.jsx)(F,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[26]=w):w=t[26],g=L,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,s;t[27]===n?s=t[28]:(s=Be(n),t[27]=n,t[28]=s);let l;t[29]!==n.displayName||t[30]!==s?(l=(0,$.jsx)(Ne,{connector:{displayName:a,branding:s},size:`sm`}),t[29]=n.displayName,t[30]=s,t[31]=l):l=t[31];let u;t[32]===n.displayName?u=t[33]:(u=(0,$.jsx)(v,{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=Ge(n,i),t[34]=n,t[35]=i,t[36]=d):d=t[36];let p;t[37]===d?p=t[38]:(p=(0,$.jsx)(x,{className:`mt-0.5 truncate text-sm text-fg-muted`,children:d}),t[37]=d,t[38]=p);let S;t[39]!==u||t[40]!==p?(S=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,p]}),t[39]=u,t[40]=p,t[41]=S):S=t[41];let j;t[42]!==l||t[43]!==S?(j=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[l,S]}),t[42]=l,t[43]=S,t[44]=j):j=t[44];let M;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,$.jsx)(k,{className:`size-4`,"aria-hidden":!0}),t[45]=M):M=t[45];let V;t[46]===i.close?V=t[47]:(V=(0,$.jsx)(m,{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:M})}),t[46]=i.close,t[47]=V),t[48]!==j||t[49]!==V?(B=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[j,V]}),t[48]=j,t[49]=V,t[50]=B):B=t[50],P=`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`;let H;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(De,{className:`size-4 text-accent`,"aria-hidden":!0}),t[51]=H):H=t[51];let U;t[52]===i.sourceOutcomeTitle?U=t[53]:(U=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[H,i.sourceOutcomeTitle]}),t[52]=i.sourceOutcomeTitle,t[53]=U);let W=h.tone===`attention`?`border-warning/30 bg-warning-soft text-fg`:`border-edge-subtle bg-surface-muted text-fg`,G;t[54]===W?G=t[55]:(G=c(`mt-3 rounded-xl border px-4 py-3 text-sm leading-6`,W),t[54]=W,t[55]=G);let K;t[56]!==h.summary||t[57]!==G?(K=(0,$.jsx)(`p`,{className:G,children:h.summary}),t[56]=h.summary,t[57]=G,t[58]=K):K=t[58];let ee;t[59]===n.learningFunnel.activeClaims?ee=t[60]:(ee=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.activeClaims}),t[59]=n.learningFunnel.activeClaims,t[60]=ee);let q;t[61]===i.sourceReliableMetric?q=t[62]:(q=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourceReliableMetric}),t[61]=i.sourceReliableMetric,t[62]=q);let te;t[63]!==ee||t[64]!==q?(te=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[ee,q]}),t[63]=ee,t[64]=q,t[65]=te):te=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 J;t[73]!==te||t[74]!==ie?(J=(0,$.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[te,ie]}),t[73]=te,t[74]=ie,t[75]=J):J=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)(X,{type:`button`,variant:`ghost`,className:`mt-2 px-2`,onClick:f,children:[i.sourceViewUnderstanding,(0,$.jsx)(ae,{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]!==U||t[82]!==K||t[83]!==J||t[84]!==oe?(I=(0,$.jsxs)(`section`,{children:[U,K,J,oe]}),t[81]=U,t[82]=K,t[83]=J,t[84]=oe,t[85]=I):I=t[85],D=`border-t border-edge-subtle pt-5`;let Y;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,$.jsx)(ye,{className:`size-4 text-accent`,"aria-hidden":!0}),t[86]=Y):Y=t[86],t[87]===i.sourceRecentRunTitle?O=t[88]:(O=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[Y,i.sourceRecentRunTitle]}),t[87]=i.sourceRecentRunTitle,t[88]=O);let se;t[89]!==n.learningFunnel.activeClaims||t[90]!==n.learningFunnel.attributedItems||t[91]!==n.learningFunnel.indexedItems||t[92]!==i.sourceRecentRunSummary?(se=Ve(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]=se):se=t[93],t[94]===se?A=t[95]:(A=(0,$.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:se}),t[94]=se,t[95]=A),N=e?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:Ve(i.sourceUpdatedAt,{time:qe(e,r)})}):null,t[3]=r,t[4]=o,t[5]=f,t[6]=h.summary,t[7]=h.tone,t[8]=n,t[9]=i,t[10]=g,t[11]=_,t[12]=y,t[13]=b,t[14]=C,t[15]=w,t[16]=T,t[17]=E,t[18]=D,t[19]=O,t[20]=A,t[21]=N,t[22]=P,t[23]=I,t[24]=R,t[25]=B}else g=t[10],_=t[11],y=t[12],b=t[13],C=t[14],w=t[15],T=t[16],E=t[17],D=t[18],O=t[19],A=t[20],N=t[21],P=t[22],I=t[23],R=t[24],B=t[25];let V;t[96]!==D||t[97]!==O||t[98]!==A||t[99]!==N?(V=(0,$.jsxs)(`section`,{className:D,children:[O,A,N]}),t[96]=D,t[97]=O,t[98]=A,t[99]=N,t[100]=V):V=t[100];let H;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(se,{className:`size-4 text-accent`,"aria-hidden":!0}),t[101]=H):H=t[101];let U;t[102]===i.sourceAccessTitle?U=t[103]:(U=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[H,i.sourceAccessTitle]}),t[102]=i.sourceAccessTitle,t[103]=U);let W;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(he,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[104]=W):W=t[104];let K;t[105]===i.sourceReadAccess?K=t[106]:(K=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[W,(0,$.jsx)(`span`,{children:i.sourceReadAccess})]}),t[105]=i.sourceReadAccess,t[106]=K);let ee;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,$.jsx)(he,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[107]=ee):ee=t[107];let q;t[108]===i.sourceMemoryAccess?q=t[109]:(q=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[ee,(0,$.jsx)(`span`,{children:i.sourceMemoryAccess})]}),t[108]=i.sourceMemoryAccess,t[109]=q);let ne;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(se,{className:`mt-1 size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[110]=ne):ne=t[110];let re=n.access.write?i.sourceWriteAccess:i.sourceNoWriteAccess,ie;t[111]===re?ie=t[112]:(ie=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[ne,(0,$.jsx)(`span`,{children:re})]}),t[111]=re,t[112]=ie);let J;t[113]!==K||t[114]!==q||t[115]!==ie?(J=(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-sm leading-6 text-fg-muted`,children:[K,q,ie]}),t[113]=K,t[114]=q,t[115]=ie,t[116]=J):J=t[116];let oe;t[117]!==U||t[118]!==J?(oe=(0,$.jsxs)(`section`,{className:`border-t border-edge-subtle pt-5`,children:[U,J]}),t[117]=U,t[118]=J,t[119]=oe):oe=t[119];let Y;t[120]!==V||t[121]!==oe||t[122]!==P||t[123]!==I?(Y=(0,$.jsxs)(`div`,{className:P,children:[I,V,oe]}),t[120]=V,t[121]=oe,t[122]=P,t[123]=I,t[124]=Y):Y=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]!==b||t[129]!==C||t[130]!==s||t[131]!==l||t[132]!==n||t[133]!==i.sourcePauseLearning||t[134]!==i.sourceResumeLearning||t[135]!==i.sourceRetryLearning?(le=He(n)?b||C?(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>s(n),children:[a?(0,$.jsx)(M,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(G,{className:`size-4`,"aria-hidden":!0}),C?i.sourceRetryLearning:i.sourceResumeLearning]}):(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>l(n),children:[(0,$.jsx)(j,{className:`size-4`,"aria-hidden":!0}),i.sourcePauseLearning]}):null,t[127]=a,t[128]=b,t[129]=C,t[130]=s,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)(te,{className:`size-4`,"aria-hidden":!0}),t[140]=de):de=t[140];let fe;t[141]!==i.sourceConnectionSettings||t[142]!==ue?(fe=(0,$.jsxs)(X,{type:`button`,variant:`secondary`,onClick:ue,children:[de,i.sourceConnectionSettings]}),t[141]=i.sourceConnectionSettings,t[142]=ue,t[143]=fe):fe=t[143];let pe;t[144]!==d||t[145]!==n?(pe=()=>d(n),t[144]=d,t[145]=n,t[146]=pe):pe=t[146];let me;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(me=(0,$.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[147]=me):me=t[147];let Z;t[148]!==i.disconnect||t[149]!==pe?(Z=(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`ml-auto text-danger hover:bg-danger-soft hover:text-danger`,onClick:pe,children:[me,i.disconnect]}),t[148]=i.disconnect,t[149]=pe,t[150]=Z):Z=t[150];let ge;t[151]!==le||t[152]!==fe||t[153]!==Z?(ge=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[le,fe,Z]}),t[151]=le,t[152]=fe,t[153]=Z,t[154]=ge):ge=t[154];let _e;t[155]!==ce||t[156]!==ge?(_e=(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:[ce,ge]}),t[155]=ce,t[156]=ge,t[157]=_e):_e=t[157];let ve;t[158]!==g||t[159]!==Y||t[160]!==_e||t[161]!==R||t[162]!==B?(ve=(0,$.jsxs)(g,{className:R,children:[B,Y,_e]}),t[158]=g,t[159]=Y,t[160]=_e,t[161]=R,t[162]=B,t[163]=ve):ve=t[163];let be;t[164]!==_||t[165]!==w||t[166]!==ve?(be=(0,$.jsxs)(_,{children:[w,ve]}),t[164]=_,t[165]=w,t[166]=ve,t[167]=be):be=t[167];let xe;return t[168]!==y||t[169]!==T||t[170]!==E||t[171]!==be?(xe=(0,$.jsx)(y,{open:T,onOpenChange:E,children:be}),t[168]=y,t[169]=T,t[170]=E,t[171]=be,t[172]=xe):xe=t[172],xe}function Xe(e){let t=(0,Pe.c)(69),{sources:n,language:r,t:i,busyId:a,onAddSource:o,onLearn:l,onPause:u,onConfigure:d,onDisconnect:f,onViewUnderstanding:m}=e,[h,g]=(0,Q.useState)(null),_;if(t[0]!==n||t[1]!==i){let e=n.filter(Qe),r=new Map;for(let t of e){let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}let a;t[3]===i?a=t[4]:(a=(e,t)=>Math.min(...e.accounts.map(e=>Je(e,i)))-Math.min(...t.accounts.map(e=>Je(e,i)))||e.source.displayName.localeCompare(t.source.displayName),t[3]=i,t[4]=a),_=[...r.values()].map(e=>({source:e[0],accounts:e.sort((e,t)=>Je(e,i)-Je(t,i)||Ge(e,i).localeCompare(Ge(t,i)))})).sort(a),t[0]=n,t[1]=i,t[2]=_}else _=t[2];let v=_,y,b,x,S,C,w,T,E,D;if(t[5]!==v||t[6]!==h||t[7]!==n||t[8]!==i.sourceConnectedSummary||t[9]!==i.sourcesSubtitle||t[10]!==i.sourcesTitle){let e=v.reduce(Ze,0),r;t[20]!==h||t[21]!==n?(r=h?n.find(e=>e.instanceId===h)??null:null,t[20]=h,t[21]=n,t[22]=r):r=t[22],y=r,w=`you-panel-sources`,T=`tabpanel`,E=`you-tab-sources`,D=`space-y-5`,C=`flex flex-wrap items-start justify-between gap-3`,t[23]===i.sourcesTitle?b=t[24]:(b=(0,$.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:i.sourcesTitle}),t[23]=i.sourcesTitle,t[24]=b),t[25]===i.sourcesSubtitle?x=t[26]:(x=(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm leading-6 text-fg-muted`,children:i.sourcesSubtitle}),t[25]=i.sourcesSubtitle,t[26]=x),S=v.length>0?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:Ve(i.sourceConnectedSummary,{accounts:e,sources:v.length})}):null,t[5]=v,t[6]=h,t[7]=n,t[8]=i.sourceConnectedSummary,t[9]=i.sourcesSubtitle,t[10]=i.sourcesTitle,t[11]=y,t[12]=b,t[13]=x,t[14]=S,t[15]=C,t[16]=w,t[17]=T,t[18]=E,t[19]=D}else y=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];let O;t[27]!==b||t[28]!==x||t[29]!==S?(O=(0,$.jsxs)(`div`,{children:[b,x,S]}),t[27]=b,t[28]=x,t[29]=S,t[30]=O):O=t[30];let k;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0}),t[31]=k):k=t[31];let A;t[32]!==o||t[33]!==i.addSource?(A=(0,$.jsxs)(X,{type:`button`,variant:`primary`,onClick:o,children:[k,i.addSource]}),t[32]=o,t[33]=i.addSource,t[34]=A):A=t[34];let j;t[35]!==O||t[36]!==A||t[37]!==C?(j=(0,$.jsxs)(`div`,{className:C,children:[O,A]}),t[35]=O,t[36]=A,t[37]=C,t[38]=j):j=t[38];let M;t[39]!==v||t[40]!==r||t[41]!==o||t[42]!==i?(M=v.length>0?(0,$.jsx)(`div`,{className:`space-y-3`,children:v.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)(Ne,{connector:{displayName:t.displayName,branding:Be(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:Ve(i.sourceAccountCount,{count:n.length})}):null]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:We(t,i)})]})]}),(0,$.jsx)(`div`,{className:`divide-y divide-edge-subtle`,children:n.map(e=>{let t=Ue(e,i),n=Ke(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:()=>g(e.instanceId??null),children:[(0,$.jsx)(`span`,{className:c(`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:Ge(e,i)}),t.badge?(0,$.jsx)(`span`,{className:c(`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:c(`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:Ve(i.sourceUpdatedAt,{time:qe(n,r)})}):null,(0,$.jsx)(ae,{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)(s,{className:`mx-auto size-5 text-fg-subtle`,"aria-hidden":!0}),(0,$.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i.noSources}),(0,$.jsxs)(X,{type:`button`,variant:`secondary`,className:`mt-4`,onClick:o,children:[(0,$.jsx)(p,{className:`size-4`,"aria-hidden":!0}),i.addSource]})]}),t[39]=v,t[40]=r,t[41]=o,t[42]=i,t[43]=M):M=t[43];let N=y?a===`source-learning:${y.instanceId}`:!1,P;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(P=e=>{e||g(null)},t[44]=P):P=t[44];let F;t[45]===d?F=t[46]:(F=e=>{g(null),d(e)},t[45]=d,t[46]=F);let I;t[47]===f?I=t[48]:(I=e=>{g(null),f(e)},t[47]=f,t[48]=I);let L;t[49]===m?L=t[50]:(L=()=>{g(null),m()},t[49]=m,t[50]=L);let R;t[51]!==r||t[52]!==l||t[53]!==u||t[54]!==y||t[55]!==i||t[56]!==N||t[57]!==F||t[58]!==I||t[59]!==L?(R=(0,$.jsx)(Ye,{source:y,language:r,t:i,busy:N,onOpenChange:P,onLearn:l,onPause:u,onConfigure:F,onDisconnect:I,onViewUnderstanding:L}),t[51]=r,t[52]=l,t[53]=u,t[54]=y,t[55]=i,t[56]=N,t[57]=F,t[58]=I,t[59]=L,t[60]=R):R=t[60];let z;return t[61]!==j||t[62]!==M||t[63]!==R||t[64]!==w||t[65]!==T||t[66]!==E||t[67]!==D?(z=(0,$.jsxs)(`div`,{id:w,role:T,"aria-labelledby":E,className:D,children:[j,M,R]}),t[61]=j,t[62]=M,t[63]=R,t[64]=w,t[65]=T,t[66]=E,t[67]=D,t[68]=z):z=t[68],z}function Ze(e,t){return e+t.accounts.length}function Qe(e){return e.installed}var $e=new Set([`overview`,`memory`,`collaboration`,`sources`,`privacy`]);function et(e){return e&&$e.has(e)?e:`overview`}var tt=[`collaboration`,`priorities`,`boundaries`,`people`,`current`,`basics`],nt=[`relationship`,`routine`,`long_term_goal`],rt=`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 it(e,t){return e.replace(`{{count}}`,String(t))}function at(e){let t=(0,Pe.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)?Ee(n,t):e}function st(){let e=(0,Pe.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(ve,{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)(ve,{className:`h-64 rounded-2xl`}),(0,$.jsx)(ve,{className:`h-64 rounded-2xl`})]})]}),e[1]=n):n=e[1],n}function ct(e,t){return e.origin===`connected_source`?t.origins.connected_source.replace(`{{source}}`,e.sourceName):t.origins[e.origin]}function lt(e){let t=(0,Pe.c)(19),{item:n,language:r,t:i,busy:a,onConfirm:s,onReject:l,onUpdate:u,onForget:d}=e,[f,p]=(0,Q.useState)(!1),[m,g]=(0,Q.useState)(n.statement),[_,v]=(0,Q.useState)(null),[b,x]=(0,Q.useState)(!1),S=n.status!==`active`,C=S?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,T;t[0]===C?T=t[1]:(T=c(`rounded-xl border p-3.5`,C),t[0]=C,t[1]=T);let E;t[2]!==a||t[3]!==m||t[4]!==f||t[5]!==_||t[6]!==b||t[7]!==n||t[8]!==r||t[9]!==S||t[10]!==s||t[11]!==d||t[12]!==l||t[13]!==u||t[14]!==i?(E=f?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:c(rt,`min-h-20 resize-y`),value:m,onChange:e=>g(e.target.value),placeholder:i.updatePlaceholder}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{g(n.statement),p(!1)},children:i.cancel}),(0,$.jsx)(X,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!m.trim(),onClick:()=>{u(m.trim()),p(!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)(G,{className:`size-3 text-accent`,"aria-hidden":!0}),ct(n,i)]}),(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:it(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:[S?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:s,children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>p(!0),children:[(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:b,onClick:()=>{if(_){v(null);return}x(!0),U(n.id).then(e=>v(e.history)).finally(()=>x(!1))},children:[(0,$.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),i.history]}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:d,children:[(0,$.jsx)(y,{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:it(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]=m,t[4]=f,t[5]=_,t[6]=b,t[7]=n,t[8]=r,t[9]=S,t[10]=s,t[11]=d,t[12]=l,t[13]=u,t[14]=i,t[15]=E):E=t[15];let D;return t[16]!==T||t[17]!==E?(D=(0,$.jsx)(`article`,{className:T,children:E}),t[16]=T,t[17]=E,t[18]=D):D=t[18],D}function ut(e){let t=(0,Pe.c)(86),{claim:n,language:r,t:i,busy:a,onDecision:s}=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(dt)),t[9]=n.evidence,t[10]=f);let p;t[11]===f?p=t[12]:(p=[...f],t[11]=f,t[12]=p);let m=p,h=n.state===`provisional`||n.state===`stale`,g=h?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,_;t[13]===g?_=t[14]:(_=c(`rounded-xl border p-3.5`,g),t[13]=g,t[14]=_);let v=i.claimClasses[n.class],y;t[15]===v?y=t[16]:(y=(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-subtle`,children:v}),t[15]=v,t[16]=y);let b;t[17]===d?b=t[18]:(b=(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-6 text-fg`,children:d}),t[17]=d,t[18]=b);let x;t[19]!==y||t[20]!==b?(x=(0,$.jsxs)(`div`,{children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21];let S=i.claimStates[n.state],C;t[22]===S?C=t[23]:(C=(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:S}),t[22]=S,t[23]=C);let w;t[24]!==C||t[25]!==x?(w=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[x,C]}),t[24]=C,t[25]=x,t[26]=w):w=t[26];let T;t[27]!==n.activeDayCount||t[28]!==n.independentEvidenceCount||t[29]!==i.claimEvidence?(T=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]=T):T=t[30];let E;t[31]===T?E=t[32]:(E=(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:T}),t[31]=T,t[32]=E);let D;t[33]!==n.lastReinforcedAt||t[34]!==r||t[35]!==i.observedAt?(D=i.observedAt.replace(`{{time}}`,ot(n.lastReinforcedAt,r)),t[33]=n.lastReinforcedAt,t[34]=r,t[35]=i.observedAt,t[36]=D):D=t[36];let O;t[37]===D?O=t[38]:(O=(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:D}),t[37]=D,t[38]=O);let A;t[39]!==a||t[40]!==h||t[41]!==s||t[42]!==i.confirm||t[43]!==i.notTrue?(A=h?(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>s(`confirm`),children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>s(`reject`),children:[(0,$.jsx)(k,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,t[39]=a,t[40]=h,t[41]=s,t[42]=i.confirm,t[43]=i.notTrue,t[44]=A):A=t[44];let j;t[45]!==O||t[46]!==A?(j=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[O,A]}),t[45]=O,t[46]=A,t[47]=j):j=t[47];let M;t[48]===i.viewEvidence?M=t[49]:(M=(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:i.viewEvidence}),t[48]=i.viewEvidence,t[49]=M);let N;t[50]===i.evidenceSource?N=t[51]:(N=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),t[50]=i.evidenceSource,t[51]=N);let P=m.join(`, `),F;t[52]===P?F=t[53]:(F=(0,$.jsx)(`dd`,{className:`mt-0.5 break-all`,children:P}),t[52]=P,t[53]=F);let I;t[54]!==N||t[55]!==F?(I=(0,$.jsxs)(`div`,{children:[N,F]}),t[54]=N,t[55]=F,t[56]=I):I=t[56];let L;t[57]===i.evidenceConfidence?L=t[58]:(L=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),t[57]=i.evidenceConfidence,t[58]=L);let R;t[59]===n.confidence?R=t[60]:(R=Math.round(n.confidence*100),t[59]=n.confidence,t[60]=R);let z;t[61]===R?z=t[62]:(z=(0,$.jsxs)(`dd`,{className:`mt-0.5`,children:[R,`%`]}),t[61]=R,t[62]=z);let B;t[63]!==L||t[64]!==z?(B=(0,$.jsxs)(`div`,{children:[L,z]}),t[63]=L,t[64]=z,t[65]=B):B=t[65];let V;t[66]===i.evidenceRule?V=t[67]:(V=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),t[66]=i.evidenceRule,t[67]=V);let H;t[68]===i.claimRule?H=t[69]:(H=(0,$.jsx)(`dd`,{className:`mt-0.5`,children:i.claimRule}),t[68]=i.claimRule,t[69]=H);let U;t[70]!==V||t[71]!==H?(U=(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[V,H]}),t[70]=V,t[71]=H,t[72]=U):U=t[72];let W;t[73]!==I||t[74]!==B||t[75]!==U?(W=(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[I,B,U]}),t[73]=I,t[74]=B,t[75]=U,t[76]=W):W=t[76];let G;t[77]!==M||t[78]!==W?(G=(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[M,W]}),t[77]=M,t[78]=W,t[79]=G):G=t[79];let K;return t[80]!==w||t[81]!==E||t[82]!==j||t[83]!==G||t[84]!==_?(K=(0,$.jsxs)(`article`,{className:_,children:[w,E,j,G]}),t[80]=w,t[81]=E,t[82]=j,t[83]=G,t[84]=_,t[85]=K):K=t[85],K}function dt(e){return e.sourceInstanceId}function ft(e){let t=(0,Pe.c)(70),{playbook:n,busy:r,t:i,onToggleGroup:a,onCreate:o,onUpdate:s,onDelete:l,onRollback:u}=e,[d,f]=(0,Q.useState)(``),[p,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(``),_=n.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted`,v;t[0]===_?v=t[1]:(v=c(`rounded-xl border p-4`,_),t[0]=_,t[1]=v);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=it(i.playbookRuleCount,n.rules.filter(ht).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 T;t[9]!==x||t[10]!==C?(T=(0,$.jsxs)(`div`,{children:[x,C]}),t[9]=x,t[10]=C,t[11]=T):T=t[11];let E=n.enabled?i.pausePlaybook:i.resumePlaybook,D;t[12]!==r||t[13]!==a||t[14]!==E?(D=(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:r,onClick:a,children:E}),t[12]=r,t[13]=a,t[14]=E,t[15]=D):D=t[15];let O;t[16]!==T||t[17]!==D?(O=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,D]}),t[16]=T,t[17]=D,t[18]=O):O=t[18];let k;t[19]!==r||t[20]!==p||t[21]!==h||t[22]!==l||t[23]!==u||t[24]!==s||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?(k=n.rules.map((e,t)=>(0,$.jsx)(`li`,{className:c(`rounded-lg border border-edge-subtle p-2.5`,!e.enabled&&`opacity-60`),children:p===e.id?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:c(rt,`min-h-16 resize-y`),value:h,onChange:e=>g(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2`,onClick:()=>m(null),children:i.cancel}),(0,$.jsx)(X,{type:`button`,variant:`primary`,className:`h-7 px-2`,disabled:!h.trim(),onClick:()=>{s(e.id,{statement:h.trim()}),m(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)(fe,{value:e.context.supportNeed??``,disabled:r,onChange:t=>s(e.id,{context:{supportNeed:t.target.value||null}}),children:[(0,$.jsx)(Y,{value:``,children:i.ruleContextAny}),[`listen`,`clarify`,`advise`,`act`,`unknown`].map(e=>(0,$.jsx)(Y,{value:e,children:i.ruleSupportNeeds[e]},e))]})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleChannelContext,(0,$.jsxs)(fe,{value:e.context.channel??``,disabled:r,onChange:t=>s(e.id,{context:{channel:t.target.value||null}}),children:[(0,$.jsx)(Y,{value:``,children:i.ruleContextAny}),[`webchat`,`telegram`,`weixin`,`feishu`,`cli`].map(mt)]})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===0,onClick:()=>s(e.id,{order:n.rules[t-1].order-1}),children:i.moveUp}),(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r||t===n.rules.length-1,onClick:()=>s(e.id,{order:n.rules[t+1].order+1}),children:i.moveDown}),(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>s(e.id,{enabled:!e.enabled}),children:e.enabled?i.disableRule:i.enableRule}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>{m(e.id),g(e.statement)},children:[(0,$.jsx)(w,{className:`size-3`,"aria-hidden":!0}),i.edit]}),(0,$.jsxs)(X,{type:`button`,variant:`ghost`,className:`h-7 px-2 text-danger`,disabled:r,onClick:()=>l(e.id),children:[(0,$.jsx)(y,{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(pt).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)(X,{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]=p,t[21]=h,t[22]=l,t[23]=u,t[24]=s,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]=k):k=t[40];let A;t[41]===k?A=t[42]:(A=(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:k}),t[41]=k,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:rt,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)(X,{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]!==O||t[66]!==A||t[67]!==v||t[68]!==z?(B=(0,$.jsxs)(`article`,{className:v,children:[O,A,z]}),t[65]=O,t[66]=A,t[67]=v,t[68]=z,t[69]=B):B=t[69],B}function pt(e){return!e.current}function mt(e){return(0,$.jsx)(Y,{value:e,children:e},e)}function ht(e){return e.enabled}function gt(e){let t=(0,Pe.c)(46),{suggestion:n,draft:r,busy:i,onDraftChange:a,onSave:o,onLater:s,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,p;t[6]===f?p=t[7]:(p=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:f}),t[6]=f,t[7]=p);let m;t[8]===l.callName?m=t[9]:(m=(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:`you-call-name`,children:l.callName}),t[8]=l.callName,t[9]=m);let h;t[10]===a?h=t[11]:(h=e=>a(e.target.value),t[10]=a,t[11]=h);let g;t[12]!==i||t[13]!==r||t[14]!==o?(g=e=>{e.key===`Enter`&&r.trim()&&!i&&o()},t[12]=i,t[13]=r,t[14]=o,t[15]=g):g=t[15];let _=l.meetPlaceholder,v;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(v=c(rt,`h-10 flex-1 bg-surface-base/90`),t[16]=v):v=t[16];let y;t[17]!==r||t[18]!==l.meetPlaceholder||t[19]!==h||t[20]!==g?(y=(0,$.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,onChange:h,onKeyDown:g,placeholder:_,className:v}),t[17]=r,t[18]=l.meetPlaceholder,t[19]=h,t[20]=g,t[21]=y):y=t[21];let b;t[22]!==i||t[23]!==r?(b=i||!r.trim(),t[22]=i,t[23]=r,t[24]=b):b=t[24];let x=i?l.meetSaving:l.meetSave,S;t[25]!==o||t[26]!==b||t[27]!==x?(S=(0,$.jsx)(X,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:b,onClick:o,children:x}),t[25]=o,t[26]=b,t[27]=x,t[28]=S):S=t[28];let C;t[29]!==y||t[30]!==S||t[31]!==m?(C=(0,$.jsxs)(`div`,{className:`mt-5 flex max-w-xl flex-col gap-2 sm:flex-row`,children:[m,y,S]}),t[29]=y,t[30]=S,t[31]=m,t[32]=C):C=t[32];let w;t[33]!==n||t[34]!==l.meetSource?(w=n?(0,$.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,$.jsx)(se,{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]=w):w=t[35];let T;t[36]!==i||t[37]!==s||t[38]!==l.meetLater?(T=(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:s,children:l.meetLater}),t[36]=i,t[37]=s,t[38]=l.meetLater,t[39]=T):T=t[39];let E;return t[40]!==C||t[41]!==w||t[42]!==T||t[43]!==d||t[44]!==p?(E=(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,p,C,w,T]})}),t[40]=C,t[41]=w,t[42]=T,t[43]=d,t[44]=p,t[45]=E):E=t[45],E}function _t(){let e=u(e=>e.language),t=l(e).you,n=a(),[r,s]=i(),p=et(r.get(`tab`)),m=P(e=>e.setPageHeader),h=P(e=>e.clearPageHeader),{data:g,error:v,isLoading:y,mutate:x}=d(`/api/you`,V),[S,O]=(0,Q.useState)(null),[k,j]=(0,Q.useState)(!1),[M,F]=(0,Q.useState)(``),[L,z]=(0,Q.useState)(`preference`),[U,G]=(0,Q.useState)(!1),[te,J]=(0,Q.useState)(null),[le,me]=(0,Q.useState)(!1),[he,ve]=(0,Q.useState)(null),[ye,we]=(0,Q.useState)(!1),[Ee,Oe]=(0,Q.useState)(``),[Ne,Pe]=(0,Q.useState)(!1),[Le,ze]=(0,Q.useState)(null),[Be,Ve]=(0,Q.useState)(!1),[He,Ue]=(0,Q.useState)(!1),[We,Ge]=(0,Q.useState)(!1),[Ke,qe]=(0,Q.useState)(null),[Je,Ye]=(0,Q.useState)(!1),[Ze,Qe]=(0,Q.useState)(null),[$e,dt]=(0,Q.useState)(null),[pt,mt]=(0,Q.useState)(!1),[ht,_t]=(0,Q.useState)(null),[vt,yt]=(0,Q.useState)(null),bt=(0,Q.useRef)(null),xt=(0,Q.useRef)(null),St=(0,Q.useRef)(null),Ct=g?.profile??{callName:``,pronouns:``,timezone:``,notes:``},wt=(0,Q.useMemo)(()=>g?.understanding.filter(e=>e.status===`active`)??[],[g]),Tt=(0,Q.useMemo)(()=>g?.understanding.filter(e=>e.status!==`active`)??[],[g]),Et=(0,Q.useMemo)(()=>g?.connectedClaims.filter(e=>e.state!==`rejected`)??[],[g]),Dt=(0,Q.useMemo)(()=>Et.filter(e=>e.state!==`active`),[Et]),Ot=(0,Q.useMemo)(()=>new Map(tt.map(e=>[e,wt.filter(t=>t.facet===e)])),[wt]),kt=Le??g?.controls??null,At=g?.sources.filter(e=>e.installed&&e.enabled)??[],jt=At.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status));(0,Q.useEffect)(()=>{let e=()=>{x()};return window.addEventListener(`connector-learning-updated`,e),()=>window.removeEventListener(`connector-learning-updated`,e)},[x]),(0,Q.useEffect)(()=>{if(p!==`memory`||!vt)return;let e=requestAnimationFrame(()=>{(vt===`profile`?bt:xt).current?.scrollIntoView({behavior:`smooth`,block:`start`}),yt(null)});return()=>cancelAnimationFrame(e)},[vt,p]);async function Mt(e){if(!(!g||We)){Ge(!0);try{let n=await pe(e);await x({...g,relationship:n.relationship},{revalidate:!1}),Z({type:`success`,title:t.collaborationTitle,message:t.saved})}catch{Z({type:`error`,title:t.supportModeTitle,message:t.saveError})}finally{Ge(!1)}}}async function Nt(e,n){O(`claim:${e.id}`);try{let t=await _e(e.id,n);await x(e=>e&&{...e,connectedClaims:e.connectedClaims.map(e=>e.id===t.id?t:e)},{revalidate:!1})}catch{Z({type:`error`,title:t.connectedClaimsTitle,message:t.saveError})}finally{O(null)}}let Pt=e=>{let t=new URLSearchParams;e!==`overview`&&t.set(`tab`,e),s(t,{replace:!0})},Ft=e=>{yt(e),Pt(`memory`)},It=e=>{let t=new URLSearchParams({connector:e.id});e.instanceId&&t.set(`instance`,e.instanceId),n(`/connectors?${t.toString()}`)},Lt=async e=>{if(e.instanceId){O(`source-learning:${e.instanceId}`);try{e.learning?.status===`paused`?await Me(e.instanceId,!1):await je(e.instanceId),await x(),Z({type:`success`,title:e.displayName,message:t.sourceLearningStarted})}catch(n){Z({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{O(null)}}},Rt=async e=>{if(e.instanceId){O(`source-learning:${e.instanceId}`);try{await Me(e.instanceId,!0),await x()}catch(n){Z({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{O(null)}}};(0,Q.useLayoutEffect)(()=>(m({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)(X,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2.5 text-xs`,onClick:()=>Ye(!0),children:[(0,$.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0}),t.howItWorks]})}),()=>h()),[h,m,t.howItWorks,t.subtitle,t.title]),(0,Q.useEffect)(()=>{!g||g.profile.callName||Oe(g.profileSetup.callNameSuggestion?.value??``)},[g,g?.profile.callName,g?.profileSetup.callNameSuggestion?.id]);async function zt(e,n,r){O(e.id);try{let t=await be(e.id,{action:n,content:r});await x(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}),x()}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{O(null)}}async function Bt(e,n){O(`consent:${e}`);try{await b(e,n),await x(),Z({type:`success`,title:t.title,message:t.saved})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{O(null)}}async function Vt(){let e=M.trim();if(e){O(`understanding:new`);try{await B({content:e,kind:L}),F(``),j(!1),G(!1),await x(),Z({type:`success`,title:t.understandingTitle,message:t.saved})}catch{Z({type:`error`,title:t.understandingTitle,message:t.saveError})}finally{O(null)}}}async function Ht(){if(Tt.length){O(`understanding:batch`);try{await C(Tt.map(e=>e.id),`confirm`),await x()}catch{Z({type:`error`,title:t.reviewTitle,message:t.saveError})}finally{O(null)}}}async function Ut(e,n){O(`conflict:${e}`);try{await f(e,n),await x()}catch{Z({type:`error`,title:t.conflictsTitle,message:t.saveError})}finally{O(null)}}async function Wt(e){O(`grant:${e}`);try{await re(e),await x()}catch{Z({type:`error`,title:t.grantsTitle,message:t.saveError})}finally{O(null)}}async function Gt(r,i){O(`insight:${r.id}`);try{let t=await oe(r.id,{action:i,uiLocale:e});await x(),i===`apply`&&t.href&&n(t.href)}catch{Z({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{O(null)}}async function Kt(e){O(`playbook:${e.id}`);try{await ue(e.id,!e.enabled),await x()}catch{Z({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{O(null)}}async function qt(e,n){O(`playbook:${e}`);try{await n(),await x()}catch{Z({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{O(null)}}async function Jt(){if(te){O(te.id);try{await W(te.id);let e=te.id;J(null),await x(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),x()}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{O(null)}}}async function Yt(){if(he){we(!0);try{let e=await ce(he);me(!1),ve(null),await x(t=>t&&{...t,...e},{revalidate:!1})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{we(!1)}}}async function Xt(){let e=Ee.trim();if(!(!e||Ne)){Pe(!0);try{let t=await ce({callName:e,timezone:Ct.timezone||ie()});await x(e=>e&&{...e,...t},{revalidate:!1})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{Pe(!1)}}}async function Zt(){if(!Ne){Pe(!0);try{let e=await Ce(`snooze`);await x(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{Pe(!1)}}}function Qt(){ve(Ct),me(!0),Ft(`profile`)}function $t(e,t=!1){z(e),G(t),j(!0),Pt(`memory`)}function en(){j(!1),G(!1),F(``)}async function tn(e){if(!Be){ze(e),Ve(!0);try{ze(await ee(e)),await x(),Z({type:`success`,title:t.privacyTitle,message:t.saved})}catch{ze(null),Z({type:`error`,title:t.privacyTitle,message:t.saveError})}finally{Ve(!1)}}}async function nn(e){if(!(He||e===g?.trust.defaultActionLevel)){Ue(!0);try{let n=await ne(e);await x(e=>e&&{...e,trust:n},{revalidate:!1}),Z({type:`success`,title:t.trustTitle,message:t.saved})}catch{Z({type:`error`,title:t.trustTitle,message:t.saveError})}finally{Ue(!1),qe(null)}}}async function rn(e){if(!(!$e?.instanceId||pt)){mt(!0);try{let n=await ge($e.instanceId,e);dt(null),await x(),Z({type:`success`,title:t.sourcesTitle,message:e?t.disconnectDeleted.replace(`{{count}}`,String(n.deletedUnderstandingCount)):t.disconnectSuccess})}catch{Z({type:`error`,title:t.sourcesTitle,message:t.saveError})}finally{mt(!1)}}}async function an(){if(!ht){_t(`export`);try{let e=await E(),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{Z({type:`error`,title:t.transferTitle,message:t.saveError})}finally{_t(null)}}}async function on(e){if(!(!e||ht)){_t(`import`);try{if(e.size>2*1024*1024)throw Error(`file too large`);let n=await A(JSON.parse(await e.text()));await x(),Ft(`review`),Z({type:`success`,title:t.transferTitle,message:t.importSuccess.replace(`{{count}}`,String(n.importedCount)).replace(`{{skipped}}`,String(n.skippedCount))})}catch{Z({type:`error`,title:t.transferTitle,message:t.importError})}finally{St.current&&(St.current.value=``),Qe(null),_t(null)}}}function sn(){Qe(null),St.current&&(St.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)(ke,{items:[{id:`overview`,label:t.tabs.overview,icon:N},{id:`memory`,label:t.tabs.memory,icon:De,count:Tt.length+Dt.length||void 0},{id:`collaboration`,label:t.tabs.collaboration,icon:_},{id:`sources`,label:t.tabs.sources,icon:H},{id:`privacy`,label:t.tabs.privacy,icon:se}],activeTab:p,onChange:Pt,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})]}),y?(0,$.jsx)(st,{}):v||!g?(0,$.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,g&&p===`overview`?(0,$.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!Ct.callName&&g.profileSetup.shouldPrompt?(0,$.jsx)(gt,{suggestion:g.profileSetup.callNameSuggestion,draft:Ee,busy:Ne,onDraftChange:Oe,onSave:()=>void Xt(),onLater:()=>void Zt(),t}):null,Tt.length>0||Dt.length>0||jt.length>0||!Ct.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:[Tt.length+Dt.length>0?(0,$.jsxs)(X,{type:`button`,variant:`secondary`,onClick:()=>Ft(`review`),children:[it(t.reviewCount,Tt.length+Dt.length),(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0})]}):null,jt.length>0?(0,$.jsxs)(X,{type:`button`,variant:`secondary`,onClick:()=>Pt(`sources`),children:[it(t.sourceIssues,jt.length),(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0})]}):null,Ct.callName?null:(0,$.jsxs)(X,{type:`button`,variant:`secondary`,onClick:Qt,children:[t.completeProfile,(0,$.jsx)(ae,{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:()=>Pt(`memory`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:wt.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:()=>Pt(`sources`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:At.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:()=>Ft(`review`),children:[(0,$.jsx)(`span`,{className:`text-xl font-semibold text-fg`,children:Tt.length+Dt.length}),(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:t.waitingReview})]})]})}),g.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)(Se,{className:`size-4 text-accent`,"aria-hidden":!0}),t.insightsTitle]}),(0,$.jsx)(at,{children:t.confirmedContextBadge})]}),(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 lg:grid-cols-2`,children:g.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?it(t.insightEvidence,e.evidenceCount):t.insightReason}),(0,$.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:S===`insight:${e.id}`,onClick:()=>void Gt(e,`dismiss`),children:t.notNow}),(0,$.jsx)(X,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:S===`insight:${e.id}`,onClick:()=>void Gt(e,`apply`),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)(q,{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)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Ft(`profile`),children:(0,$.jsx)(ae,{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:Ct.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:Ct.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:Ct.pronouns||`—`})]}),Ct.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:Ct.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)(De,{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)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Pt(`memory`),children:(0,$.jsx)(ae,{className:`size-4`,"aria-hidden":!0})})]}),(0,$.jsxs)(`div`,{className:`mt-4 space-y-2`,children:[wt.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)),wt.length===0?(0,$.jsx)(`p`,{className:`py-5 text-center text-sm text-fg-muted`,children:t.emptyUnderstanding}):null]})]})]})]}):null,g&&p===`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)(at,{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:bt,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)(q,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(at,{children:t.onlyYouEditBadge})]}),(0,$.jsx)(`p`,{className:`mt-1 max-w-2xl text-sm text-fg-muted`,children:t.profileHint})]}),le?null:(0,$.jsxs)(X,{type:`button`,variant:`secondary`,onClick:Qt,children:[(0,$.jsx)(w,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),le&&he?(0,$.jsxs)(`div`,{className:`mt-5`,children:[(0,$.jsx)(Fe,{value:he,onChange:ve,language:e,inputClassName:rt,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)(X,{type:`button`,variant:`ghost`,onClick:()=>{me(!1),ve(null)},children:t.cancel}),(0,$.jsx)(X,{type:`button`,variant:`primary`,disabled:ye,onClick:()=>void Yt(),children:ye?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:Ct.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:Ct.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:Ct.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:Ct.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":k&&!U&&L===`preference`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!U&&L===`preference`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`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":k&&!U&&L===`boundary`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!U&&L===`boundary`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`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":k&&!U&&L===`current_state`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&!U&&L===`current_state`?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`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":k&&U,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,k&&U?`border-accent/40 bg-accent-soft/20`:`border-edge-subtle`),onClick:()=>$t(`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})]})]}),k?(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:U?t.addOther:L===`preference`?t.addPreference:L===`boundary`?t.addBoundary:t.addCurrentFocus}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:U?t.addOtherHint:L===`preference`?t.addPreferenceHint:L===`boundary`?t.addBoundaryHint:t.addCurrentFocusHint})]}),U?null:(0,$.jsx)(at,{children:t.understandingKinds[L]})]}),(0,$.jsx)(`textarea`,{className:c(rt,`mt-3 min-h-24 resize-y`),value:M,onChange:e=>F(e.target.value),placeholder:t.understandingPlaceholders[L],autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-between gap-3`,children:[U?(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[t.understandingKind,(0,$.jsx)(fe,{value:L,onChange:e=>z(e.target.value),children:nt.map(e=>(0,$.jsx)(Y,{value:e,children:t.understandingKinds[e]},e))})]}):(0,$.jsx)(`span`,{}),(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[(0,$.jsx)(X,{type:`button`,variant:`ghost`,onClick:en,children:t.cancel}),(0,$.jsx)(X,{type:`button`,variant:`primary`,disabled:!M.trim()||S===`understanding:new`,onClick:()=>void Vt(),children:t.add})]})]})]}):null]}),g.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:g.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:[ct(r,t),` · `,ot(r.updatedAt,e)]})]}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2.5`,disabled:S===`conflict:${n.id}`,onClick:()=>void Ut(n.id,r.id),children:t.useThis})]},r.id))},n.id))})]}):null,g.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})]}),g.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)(X,{type:`button`,variant:`ghost`,disabled:S===`consent:${e.id}`,onClick:()=>void Bt(e.id,`deny`),children:t.consentDeny}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,disabled:S===`consent:${e.id}`,onClick:()=>void Bt(e.id,`once`),children:t.consentOnce}),(0,$.jsx)(X,{type:`button`,variant:`secondary`,disabled:S===`consent:${e.id}`,onClick:()=>void Bt(e.id,`session`),children:t.consentSession}),(0,$.jsx)(X,{type:`button`,variant:`primary`,disabled:S===`consent:${e.id}`,onClick:()=>void Bt(e.id,`always`),children:t.consentAlways})]})]},e.id))]}):null,(0,$.jsxs)(`div`,{ref:xt,className:`space-y-6 scroll-mt-6`,children:[Et.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:Et.map(n=>(0,$.jsx)(ut,{claim:n,language:e,t,busy:S===`claim:${n.id}`,onDecision:e=>void Nt(n,e)},n.id))})]}):null,Tt.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)(X,{type:`button`,variant:`secondary`,disabled:S===`understanding:batch`,onClick:()=>void Ht(),children:t.reviewAll})]}),(0,$.jsx)(`div`,{className:`mt-3 grid gap-3 lg:grid-cols-2`,children:Tt.map(n=>(0,$.jsx)(lt,{item:n,language:e,t,busy:S===n.id,onConfirm:()=>void zt(n,`confirm`),onReject:()=>void zt(n,`reject`),onUpdate:e=>void zt(n,`update`,e),onForget:()=>J(n)},n.id))})]}):wt.length>0||Et.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]}),tt.map(n=>{let r=Ot.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)(lt,{item:n,language:e,t,busy:S===n.id,onConfirm:()=>void zt(n,`confirm`),onReject:()=>void zt(n,`reject`),onUpdate:e=>void zt(n,`update`,e),onForget:()=>J(n)},n.id))})]},n)}),g.understanding.length===0&&Et.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,g&&p===`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)(fe,{value:g.relationship.supportMode,disabled:We,onChange:e=>void Mt({supportMode:e.target.value}),children:Object.entries(t.supportModes).map(([e,t])=>(0,$.jsx)(Y,{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:g.relationship.proactiveEnabled,disabled:We,onChange:e=>void Mt({proactiveEnabled:e.target.checked})}),t.proactiveEnabled]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietStart,(0,$.jsx)(Ae,{value:g.relationship.quietStart??``,disabled:We,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietStart,onChange:e=>void Mt({quietStart:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.quietEnd,(0,$.jsx)(Ae,{value:g.relationship.quietEnd??``,disabled:We,allowEmpty:!0,clearLabel:t.clearTime,ariaLabel:t.quietEnd,onChange:e=>void Mt({quietEnd:e||null})})]}),(0,$.jsxs)(`label`,{className:`grid gap-1 text-xs text-fg-muted`,children:[t.blockedTopics,(0,$.jsx)(`input`,{className:rt,defaultValue:g.relationship.blockedTopics.join(`, `),disabled:We,onBlur:e=>void Mt({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:We?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)(_,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,$.jsx)(at,{children:t.affectsAgentsBadge})]}),g.playbooks.length>0?(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 xl:grid-cols-3`,children:g.playbooks.map(e=>(0,$.jsx)(ft,{playbook:e,busy:S===`playbook:${e.id}`,t,onToggleGroup:()=>void Kt(e),onCreate:t=>void qt(e.id,()=>I(e.id,t,(e.rules.at(-1)?.order??0)+10)),onUpdate:(t,n)=>void qt(e.id,()=>K(e.id,t,n)),onDelete:t=>void qt(e.id,()=>D(e.id,t)),onRollback:(t,n)=>void qt(e.id,()=>xe(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,g&&p===`sources`?(0,$.jsx)(Xe,{sources:g.sources,language:e,t,busyId:S,onAddSource:()=>n(`/connectors?personalContext=1`),onLearn:e=>void Lt(e),onPause:e=>void Rt(e),onConfigure:It,onDisconnect:dt,onViewUnderstanding:()=>Pt(`memory`)}):null,g&&p===`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)(fe,{value:kt.mode,disabled:Be,onChange:e=>void tn({...kt,mode:e.target.value}),children:Object.entries(t.learningModes).map(([e,t])=>(0,$.jsx)(Y,{value:e,children:t},e))})]}),(0,$.jsxs)(`label`,{className:`grid gap-1.5 text-sm font-medium text-fg`,children:[t.sensitive,(0,$.jsx)(fe,{value:kt.sensitiveWritePolicy,disabled:Be,onChange:e=>void tn({...kt,sensitiveWritePolicy:e.target.value}),children:Object.entries(t.sensitiveOptions).map(([e,t])=>(0,$.jsx)(Y,{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:Be?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:g.trust.levels.map(e=>(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":e===g.trust.defaultActionLevel,disabled:He,onClick:()=>{e!==g.trust.defaultActionLevel&&(e===`auto`?qe(e):nn(e))},className:c(`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===g.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===g.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)(se,{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}),g.referenceGrants.length>0?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:g.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)(X,{type:`button`,variant:`ghost`,className:`h-8 px-2.5`,disabled:S===`grant:${n.id}`,onClick:()=>void Wt(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)(X,{type:`button`,variant:`secondary`,disabled:ht!==null,onClick:()=>void an(),children:[(0,$.jsx)(T,{className:`size-4`,"aria-hidden":!0}),ht===`export`?t.exporting:t.exportAction]}),(0,$.jsxs)(X,{type:`button`,variant:`secondary`,disabled:ht!==null,onClick:()=>St.current?.click(),children:[(0,$.jsx)(R,{className:`size-4`,"aria-hidden":!0}),ht===`import`?t.importing:t.importAction]}),(0,$.jsx)(`input`,{ref:St,type:`file`,accept:`application/json,.json`,className:`sr-only`,onChange:e=>Qe(e.target.files?.[0]??null)})]})]})]}):null,(0,$.jsx)(de,{open:te!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Jt(),onCancel:()=>J(null)}),(0,$.jsx)(de,{open:Ke===`auto`,title:t.autoConfirmTitle,description:t.autoConfirmBody,confirmLabel:t.autoConfirmAction,cancelLabel:t.cancel,onConfirm:()=>void nn(`auto`),onCancel:()=>qe(null)}),(0,$.jsx)(de,{open:Ze!==null,title:t.importConfirmTitle,description:t.importConfirmBody.replace(`{{name}}`,Ze?.name??``),confirmLabel:t.importConfirmAction,cancelLabel:t.cancel,onConfirm:()=>{let e=Ze;Qe(null),on(e)},onCancel:sn}),(0,$.jsx)(Re,{source:$e,language:e,busy:pt,onOpenChange:e=>{e||dt(null)},onConfirm:e=>void rn(e)}),(0,$.jsx)(Ie,{open:Je,t,onOpenChange:Ye,onNavigate:Pt})]})}export{_t 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"./messages-BiBdO1-O.js";import{n as ee}from"./locale-store-CAuhEGCn.js";import{Al as te,Ao as ne,As as re,At as ie,Do as ae,Eo as s,Fo as oe,Io as se,Lo as c,Mo as ce,Ms as l,No as le,Oo as ue,Pl as u,Po as de,Pt as fe,Rl as pe,Ro as me,Ul as he,_u as ge,hu as d,jo as f,ko as _e,ks as p,lc as m,ro as h,ru as ve,tl as g}from"./index-eyttVNS_.js";import{l as ye,t as be}from"./api-DwyUxpgY.js";var _=e(t(),1),v=new Set([`completed`,`failed`,`canceled`]);function xe(){return new Promise(e=>window.setTimeout(e,1200))}async function Se(e,t){let n=[],r=t.wait??xe;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 y=n(),Ce=[`folder_structure`,`recent_progress`,`next_steps`];function b(e){return e instanceof Error?e.message:String(e)}function x(){let e=ee(e=>e.language),t=o(e).onboarding.workDiscovery,n=o(e).chat.workingDirectory,v=i(),[xe]=r(),x=xe.get(`new`)===`1`,[S,C]=(0,_.useState)(`loading`),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)(null),[O,k]=(0,_.useState)(!1),[A,j]=(0,_.useState)(null),[we,M]=(0,_.useState)(!1),[N,P]=(0,_.useState)(``),[F,I]=(0,_.useState)(!1),[L,R]=(0,_.useState)(()=>new Set),[z,Te]=(0,_.useState)(!1),[B,Ee]=(0,_.useState)([]),[V,De]=(0,_.useState)(()=>new Set),[Oe,H]=(0,_.useState)([]),[ke,Ae]=(0,_.useState)(!1),[U,W]=(0,_.useState)({current:0,total:0}),G=(0,_.useRef)(!1),K=(0,_.useCallback)(e=>{s.getState().updateDirectoryRun(e),D(e),e.status===`completed`?(R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),C(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`)):e.status===`failed`||e.status===`canceled`?C(`error`):C(`running`)},[]),je=async()=>{k(!0),j(null);try{let e=await ue();if(!e.length){j(t.noCandidates);return}Ee(e),De(new Set([e[0].rootPath])),C(`candidates`)}catch(e){j(b(e))}finally{k(!1)}},Me=e=>{De(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},Ne=(0,_.useCallback)((e,t,n)=>{s.getState().updateDirectoryRun(e),D(e),W({current:t+1,total:n}),H(n=>{let r=[...n];return r[t]=e,r}),C(`running`)},[]),Pe=(0,_.useCallback)(e=>{H(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;k(!0),j(null),H([]),W({current:1,total:e.length}),Ae(!0),G.current=!1;let n=!1;try{let r=await Se(e,{grantDirectory:ce,startRun:se,fetchRun:f,shouldStop:()=>G.current,onRun:(e,t,r)=>{Ne(e,t,r),n||(n=!0,s.getState().scanPersonalContext(e.id))},onError:(n,r,i)=>{W({current:i+1,total:e.length}),j(t.folderAnalysisFailed.replace(`{{folder}}`,r.displayName).replace(`{{error}}`,b(n)))}});if(G.current)return;let i=r.find(e=>e.status===`completed`)??r.at(-1);i?K(i):C(`candidates`)}catch(e){j(b(e)),C(`candidates`)}finally{Ae(!1),k(!1)}},q=fe({onPicked:(0,_.useCallback)(async e=>{k(!0),j(null);try{T(await le(e)),C(`consent`)}catch(e){j(b(e)),C(`intro`)}finally{k(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return ne().then(async({enabled:t,state:n})=>{if(!e){if(!t){v(`/chat`,{replace:!0});return}if(!x&&n.activeRunId)try{let t=await f(n.activeRunId);e||K(t);return}catch{}e||C(`intro`)}}).catch(t=>{e||(j(b(t)),C(`intro`))}),()=>{e=!0}},[K,v,x]),(0,_.useEffect)(()=>{if(!E||S!==`running`||ke)return;let e=!1,t=async()=>{try{let t=await f(E.id);e||K(t)}catch{}},n=window.setInterval(()=>void t(),1200),r=e=>{let n=e.detail;(!n?.runId||n.runId===E.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)}},[K,ke,S,E]);let J=async()=>{k(!0);try{await _e()}finally{v(`/chat`,{replace:!0})}},Ie=async()=>{if(w){k(!0),j(null),H([]),W({current:0,total:0});try{await ce(w.canonicalRootPath);let e=await se(w.canonicalRootPath);K(e),s.getState().scanPersonalContext(e.id)}catch(e){j(b(e)),C(`consent`)}finally{k(!1)}}},Y=(e,t)=>{let n=t?`?draft=${encodeURIComponent(t)}`:``;v(`/chat/${encodeURIComponent(e)}${n}`)},Le=e=>{D(e),Te(!1),M(!1),I(!1),R(new Set(e.result?.profileCandidates?.filter(e=>e.status===`pending`).map(e=>e.id)??[])),e.status===`completed`?C(e.feedback?.recognitionDecision===`confirmed`?`recommendation`:`recognition`):e.status===`failed`||e.status===`canceled`?C(`error`):C(`running`)},Re=async()=>{E&&(G.current=!0,K(await ae(E.id)))},X=async(t,n)=>{if(!E)return;await oe(E.id,t.id).catch(()=>{});let r=n?`${e===`zh`?`先帮我评估这个方向,不要修改文件:`:`First assess this direction without changing files:`}\n\n${t.actionPrompt}`:t.actionPrompt;Y(E.sessionKey,r)},ze=async()=>{if(E){k(!0),j(null);try{let e=E.result?.profileCandidates??[],t=await c((e.length>0?await me(E.id,e.map(e=>({id:e.id,status:L.has(e.id)?`accepted`:`rejected`}))):E).id,`confirmed`);D(t),Pe(t),C(`recommendation`)}catch(e){j(b(e))}finally{k(!1)}}},Z=async e=>{if(!(!E||!N.trim())){k(!0),j(null);try{let t=await c(E.id,e,N.trim());D(t),Y(t.sessionKey,N.trim())}catch(e){j(b(e)),k(!1)}}},Be=async()=>{if(E){k(!0);try{Y((await c(E.id,`dismissed`)).sessionKey)}catch(e){j(b(e)),k(!1)}}},Ve=async()=>{let e=E?.result?.workThreads?.find(e=>e.horizon===`current`)??E?.result?.workThreads?.[0];if(e){k(!0),j(null);try{let t=await ye(e.id,`accept`);t&&await be(t.id,`progress`,!0),Te(!0)}catch(e){j(b(e))}finally{k(!1)}}},Q=E?.result?.suggestions.find(e=>e.id===E.result?.primarySuggestionId)??E?.result?.suggestions[0],He=E?.result?.suggestions.filter(e=>e.id!==Q?.id)??[],Ue=e=>e===`command`?t.riskCommand:e===`file_write`?t.riskFileWrite:t.riskAnalysis,We=Oe.filter(e=>e?.status===`completed`),$=We.length>1?(0,y.jsxs)(`div`,{className:`mt-6 rounded-xl border border-edge bg-surface-panel p-2`,children:[(0,y.jsx)(`p`,{className:`px-2 pb-2 text-xs font-medium text-fg-muted`,children:t.analysisResults}),(0,y.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,y.jsx)(`button`,{type:`button`,className:`rounded-lg px-3 py-2 text-sm font-medium transition ${e.id===E?.id?`bg-accent text-white`:`bg-surface-muted text-fg hover:bg-surface-hover`}`,onClick:()=>Le(e),children:t},e.id)})})]}):null;return(0,y.jsxs)(`div`,{className:`flex min-h-full flex-1 flex-col bg-surface-base`,children:[(0,y.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[40rem] flex-1 flex-col px-5 py-10 sm:px-8 sm:py-16`,children:[(0,y.jsx)(`div`,{className:`mb-10 flex items-center justify-center`,children:(0,y.jsx)(re,{className:`size-11`})}),S===`loading`?(0,y.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,y.jsx)(h,{className:`mx-auto h-8 w-64`}),(0,y.jsx)(h,{className:`mx-auto h-4 w-full max-w-lg`}),(0,y.jsx)(h,{className:`mx-auto size-4/5 max-w-md`}),(0,y.jsx)(h,{className:`mt-8 h-12 w-full rounded-xl`})]}):null,S===`intro`?(0,y.jsxs)(`section`,{className:`flex flex-1 flex-col text-center`,"aria-labelledby":`work-discovery-title`,children:[(0,y.jsxs)(`div`,{className:`mx-auto max-w-[36rem]`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.title}),(0,y.jsx)(`p`,{className:`mx-auto mt-3 max-w-[34rem] text-[0.95rem] leading-7 text-fg-muted`,children:t.subtitle})]}),(0,y.jsxs)(`div`,{className:`mx-auto mt-9 w-full max-w-md`,children:[(0,y.jsxs)(p,{type:`button`,className:`h-12 w-full gap-2 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void je(),disabled:O||q.picking,children:[O?(0,y.jsx)(g,{className:`size-4 animate-spin`}):(0,y.jsx)(m,{className:`size-4`}),t.quickScan]}),(0,y.jsxs)(p,{type:`button`,variant:`secondary`,className:`mt-3 h-11 w-full gap-2`,onClick:q.pick,disabled:O||q.picking,children:[q.picking?(0,y.jsx)(g,{className:`size-4 animate-spin`}):(0,y.jsx)(u,{className:`size-4`}),t.chooseFolderManually]}),(0,y.jsxs)(`div`,{className:`mt-4 flex items-start justify-center gap-2 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`span`,{children:t.quickScanNote})]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-auto pt-10 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),disabled:O,children:t.skip})]}):null,S===`candidates`?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-candidates-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-candidates-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.candidatesTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.candidatesSubtitle})]}),(0,y.jsx)(`div`,{className:`mt-7 space-y-2`,children:B.map((e,n)=>{let r=V.has(e.rootPath);return(0,y.jsxs)(`button`,{type:`button`,"aria-pressed":r,className:`flex w-full items-start gap-3 rounded-xl border p-4 text-left transition ${r?`border-accent bg-accent-soft/45`:`border-edge bg-surface-panel hover:border-edge-strong`}`,onClick:()=>Me(e.rootPath),children:[(0,y.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-md border ${r?`border-accent bg-accent text-white`:`border-edge bg-surface-base text-transparent`}`,children:(0,y.jsx)(a,{className:`size-3.5`})}),(0,y.jsx)(u,{className:`mt-0.5 size-5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,y.jsxs)(`span`,{className:`flex flex-wrap items-center gap-2`,children:[(0,y.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.displayName}),n===0?(0,y.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[0.7rem] font-medium text-accent-fg`,children:t.recommendedCandidate}):null]}),(0,y.jsx)(`span`,{className:`mt-1 block truncate font-mono text-xs text-fg-muted`,children:e.rootPath}),(0,y.jsxs)(`span`,{className:`mt-2 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,y.jsx)(`span`,{children:e.projectKind===`coding`?t.codingProject:e.projectKind===`general`?t.generalProject:t.unknownProject}),e.branch?(0,y.jsx)(`span`,{children:t.branchValue.replace(`{{branch}}`,e.branch)}):null,e.changedFileCount>0?(0,y.jsx)(`span`,{children:t.changedFiles.replace(`{{count}}`,String(e.changedFileCount))}):null]})]})]},e.id)})}),(0,y.jsxs)(`div`,{className:`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,y.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`span`,{children:t.multiFolderPrivacyNote})]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(p,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O||V.size===0,onClick:()=>void Fe(),children:[O?(0,y.jsx)(g,{className:`mr-2 size-4 animate-spin`}):null,t.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,y.jsx)(p,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:q.pick,children:t.chooseFolderManually})]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>C(`intro`),children:t.back})]}):null,S===`consent`&&w?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-consent-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-consent-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.selectedTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.selectedSubtitle})]}),(0,y.jsxs)(`div`,{className:`mt-8 overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-edge-subtle px-4 py-3.5`,children:[(0,y.jsx)(u,{className:`size-5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`p`,{className:`truncate text-sm font-medium text-fg`,children:w.displayName}),(0,y.jsx)(`p`,{className:`truncate font-mono text-xs text-fg-muted`,children:w.canonicalRootPath})]}),(0,y.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2.5 py-1 text-xs font-medium text-accent-fg`,children:w.projectKind===`coding`?t.codingProject:w.projectKind===`general`?t.generalProject:t.unknownProject})]}),(0,y.jsxs)(`div`,{className:`grid gap-3 border-b border-edge-subtle bg-surface-base/60 p-4 sm:grid-cols-2`,children:[(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.localFingerprint}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:w.fingerprint.branch?t.branchValue.replace(`{{branch}}`,w.fingerprint.branch):t.noGitBranch})]}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentActivity}),(0,y.jsx)(`p`,{className:`mt-1 text-sm text-fg`,children:t.changedFiles.replace(`{{count}}`,String(w.fingerprint.changedFileCount))})]}),w.fingerprint.recentAreas.length>0?(0,y.jsxs)(`div`,{className:`sm:col-span-2`,children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.recentAreas}),(0,y.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-1.5`,children:w.fingerprint.recentAreas.map(e=>(0,y.jsx)(`code`,{className:`rounded-md bg-surface-muted px-2 py-1 text-xs text-fg`,children:e},e))})]}):null]}),(0,y.jsxs)(`div`,{className:`divide-y divide-edge-subtle px-4`,children:[(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(pe,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willRead}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willReadValue})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(l,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`}),(0,y.jsxs)(`div`,{children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.willIgnore}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:t.willIgnoreValue})]})]}),(0,y.jsxs)(`div`,{className:`flex gap-3 py-4`,children:[(0,y.jsx)(m,{className:`mt-0.5 size-4 shrink-0 text-accent-fg`}),(0,y.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:w.remoteModel?t.providerDisclosure.replace(`{{provider}}`,w.provider):t.localDisclosure})]})]})]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsxs)(`div`,{className:`mt-7 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(p,{type:`button`,className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void Ie(),children:[O?(0,y.jsx)(g,{className:`mr-2 size-4 animate-spin`}):null,t.startAnalysis]}),(0,y.jsx)(p,{type:`button`,variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:q.pick,children:t.changeFolder})]}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>void J(),children:t.skip})]}):null,S===`running`&&E?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-running-title`,"aria-live":`polite`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h1`,{id:`work-discovery-running-title`,className:`text-2xl font-semibold tracking-tight text-fg`,children:t.analyzingTitle}),(0,y.jsx)(`p`,{className:`mt-3 text-[0.95rem] leading-7 text-fg-muted`,children:t.analyzingSubtitle}),U.total>1?(0,y.jsx)(`p`,{className:`mt-2 text-sm font-medium text-accent-fg`,children:t.analyzingFolderProgress.replace(`{{current}}`,String(U.current)).replace(`{{total}}`,String(U.total))}):null]}),(0,y.jsx)(`div`,{className:`mt-9 rounded-xl border border-edge bg-surface-panel px-5 py-2`,children:Ce.map((e,n)=>{let r=Math.max(0,Ce.indexOf(E.stage??`folder_structure`)),i=n<r,o=n===r;return(0,y.jsxs)(`div`,{className:`flex items-center gap-4 border-b border-edge-subtle py-4 last:border-b-0`,children:[(0,y.jsx)(`span`,{className:`flex size-7 items-center justify-center rounded-full ${i?`bg-accent text-white`:o?`bg-accent-soft text-accent-fg`:`bg-surface-muted text-fg-subtle`}`,children:i?(0,y.jsx)(a,{className:`size-4`}):o?(0,y.jsx)(g,{className:`size-4 animate-spin motion-reduce:animate-none`}):(0,y.jsx)(`span`,{className:`size-1.5 rounded-full bg-current`})}),(0,y.jsx)(`span`,{className:o||i?`text-sm font-medium text-fg`:`text-sm text-fg-muted`,children:t.stages[e]})]},e)})}),(0,y.jsx)(`p`,{className:`mt-4 truncate text-center font-mono text-xs text-fg-muted`,children:E.rootPath}),(0,y.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3`,children:[(0,y.jsx)(p,{type:`button`,variant:`secondary`,className:`h-11 w-full`,onClick:()=>v(`/chat`),children:t.continueInBackground}),(0,y.jsx)(`button`,{type:`button`,className:`mx-auto text-sm text-fg-muted hover:text-danger hover:underline`,onClick:()=>void Re(),children:t.cancelAnalysis})]})]}):null,S===`recognition`&&E?.result?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-recognition-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.recognitionEyebrow}),(0,y.jsx)(`h1`,{id:`work-discovery-recognition-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:E.result.lowConfidence?t.lowConfidenceTitle:t.recognitionTitle})]}),$,(0,y.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,y.jsx)(`p`,{className:`text-base font-medium leading-7 text-fg`,children:E.result.projectSummary}),(0,y.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:E.result.currentState}),!E.result.lowConfidence&&Q?.evidence.length?(0,y.jsx)(`ul`,{className:`mt-5 space-y-2 border-t border-edge-subtle pt-4`,children:Q.evidence.slice(0,3).map((e,t)=>(0,y.jsxs)(`li`,{className:`flex gap-2 text-xs leading-5 text-fg-muted`,children:[(0,y.jsx)(te,{className:`mt-0.5 size-3.5 shrink-0 text-accent-fg`}),(0,y.jsxs)(`span`,{children:[e.path?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(`code`,{className:`font-mono text-fg`,children:e.path}),`: `]}):null,e.observation]})]},`${Q.id}-recognition-${t}`))}):null]}),E.result.workThreads?.length?(0,y.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.workThreadsTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.workThreadsSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 divide-y divide-edge-subtle`,children:E.result.workThreads.map(e=>(0,y.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,y.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`?t.workThreadCurrent:e.horizon===`ongoing`?t.workThreadOngoing:t.workThreadLongTerm}),(0,y.jsx)(`span`,{className:`text-sm font-medium text-fg`,children:e.title})]}),(0,y.jsx)(`p`,{className:`mt-1.5 text-xs leading-5 text-fg-muted`,children:e.summary})]},e.id))})]}):null,E.result.profileCandidates?.length?(0,y.jsxs)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:t.profileCandidatesTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:t.profileCandidatesSubtitle}),(0,y.jsx)(`div`,{className:`mt-3 space-y-2`,children:E.result.profileCandidates.map(e=>(0,y.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 rounded-lg px-2 py-2 hover:bg-surface-muted`,children:[(0,y.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 size-4 rounded border-edge accent-accent`,checked:L.has(e.id),onChange:()=>R(t=>{let n=new Set(t);return n.has(e.id)?n.delete(e.id):n.add(e.id),n})}),(0,y.jsx)(`span`,{className:`text-sm leading-5 text-fg`,children:e.statement})]},e.id))})]}):null,E.result.lowConfidence?(0,y.jsxs)(`div`,{className:`mt-5`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium leading-6 text-fg`,children:E.result.contextQuestion}),(0,y.jsx)(`textarea`,{value:N,onChange:e=>P(e.target.value),placeholder:t.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,y.jsx)(p,{className:`mt-3 w-full bg-accent text-white hover:bg-accent-hover`,disabled:O||!N.trim(),onClick:()=>void Z(`different_goal`),children:t.continueWithCorrection})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsxs)(p,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void ze(),children:[O?(0,y.jsx)(g,{className:`size-4 animate-spin`}):(0,y.jsx)(a,{className:`size-4`}),t.confirmUnderstanding]}),(0,y.jsx)(p,{variant:`secondary`,className:`h-11 flex-1`,disabled:O,onClick:()=>M(e=>!e),children:t.notQuiteRight})]}),we?(0,y.jsxs)(`div`,{className:`mt-4 rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,y.jsx)(`label`,{className:`text-sm font-medium text-fg`,htmlFor:`work-discovery-correction`,children:t.correctionLabel}),(0,y.jsx)(`textarea`,{id:`work-discovery-correction`,value:N,onChange:e=>P(e.target.value),placeholder:t.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,y.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,y.jsx)(p,{variant:`ghost`,disabled:O||!N.trim(),onClick:()=>void Z(`different_goal`),children:t.differentGoal}),(0,y.jsx)(p,{variant:`primary`,disabled:O||!N.trim(),onClick:()=>void Z(`corrected`),children:t.useCorrection})]})]}):null]}),A?(0,y.jsx)(`p`,{className:`mt-4 text-sm text-danger`,role:`alert`,children:A}):null,(0,y.jsx)(`button`,{type:`button`,disabled:O,className:`mx-auto mt-6 block text-sm text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:()=>void Be(),children:t.openConversation})]}):null,S===`recommendation`&&E?.result&&Q?(0,y.jsxs)(`section`,{"aria-labelledby":`work-discovery-recommendation-title`,children:[(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`p`,{className:`text-xs font-semibold uppercase tracking-[0.16em] text-accent-fg`,children:t.understandingConfirmed}),(0,y.jsx)(`h1`,{id:`work-discovery-recommendation-title`,className:`mt-2 text-2xl font-semibold tracking-tight text-fg`,children:t.primaryRecommendationTitle})]}),$,(0,y.jsx)(`article`,{className:`mt-7 rounded-2xl border border-accent/30 bg-surface-panel p-5 sm:p-6`,children:(0,y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,y.jsx)(`div`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:(0,y.jsx)(d,{className:`size-5`})}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`h2`,{className:`text-lg font-semibold text-fg`,children:Q.title}),(0,y.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:Q.rationale}),(0,y.jsxs)(`div`,{className:`mt-4 flex flex-wrap gap-2 text-xs`,children:[(0,y.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,y.jsx)(ve,{className:`size-3.5`}),t.estimatedMinutes.replace(`{{count}}`,String(Q.estimatedMinutes))]}),(0,y.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2.5 py-1 text-fg-muted`,children:Ue(Q.risk)})]}),(0,y.jsxs)(`div`,{className:`mt-4 rounded-xl bg-surface-base px-4 py-3`,children:[(0,y.jsx)(`p`,{className:`text-xs font-medium text-fg-muted`,children:t.expectedOutcome}),(0,y.jsx)(`p`,{className:`mt-1 text-sm leading-6 text-fg`,children:Q.expectedOutcome})]}),(0,y.jsxs)(`div`,{className:`mt-5 flex flex-wrap gap-2`,children:[(0,y.jsx)(p,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:t.startRecommendedAction}),(0,y.jsx)(p,{className:`h-10 px-4`,variant:`secondary`,onClick:()=>void X(Q,!0),children:t.explainFirst})]})]})]})}),E.result.workThreads?.length?(0,y.jsx)(`div`,{className:`mt-5 rounded-xl border border-edge bg-surface-panel p-4`,children:(0,y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,y.jsx)(`span`,{className:`flex size-9 shrink-0 items-center justify-center rounded-xl bg-accent-soft text-accent-fg`,children:z?(0,y.jsx)(a,{className:`size-4`}):(0,y.jsx)(he,{className:`size-4`})}),(0,y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,y.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:z?t.focusActive:t.focusTitle}),(0,y.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:z?t.focusActiveDescription:t.focusDescription}),z?null:(0,y.jsxs)(p,{className:`mt-3 h-9`,variant:`secondary`,disabled:O,onClick:()=>void Ve(),children:[O?(0,y.jsx)(g,{className:`size-4 animate-spin`}):(0,y.jsx)(he,{className:`size-4`}),t.activateFocus]})]})]})}):null,He.length>0?(0,y.jsxs)(`div`,{className:`mt-5 border-t border-edge-subtle pt-4`,children:[(0,y.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:()=>I(e=>!e),children:[t.otherDirections,(0,y.jsx)(ge,{className:`size-4 transition-transform ${F?`rotate-180`:``}`})]}),F?(0,y.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,y.jsxs)(`button`,{type:`button`,className:`flex w-full items-start gap-3 py-4 text-left`,onClick:()=>void X(e,!0),children:[(0,y.jsx)(d,{className:`mt-0.5 size-4 shrink-0 text-fg-subtle`}),(0,y.jsxs)(`span`,{children:[(0,y.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:e.title}),(0,y.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:e.expectedOutcome})]})]},e.id))}):null]}):null,(0,y.jsxs)(`div`,{className:`mt-6 flex flex-wrap items-center justify-center gap-x-5 gap-y-3`,children:[(0,y.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(E.sessionKey),children:t.doSomethingElse}),(0,y.jsx)(`button`,{type:`button`,className:`text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>{M(!0),C(`recognition`)},children:t.correctUnderstanding})]})]}):null,S===`error`&&E?(0,y.jsxs)(`section`,{className:`text-center`,"aria-labelledby":`work-discovery-error-title`,children:[(0,y.jsx)(`div`,{className:`mx-auto flex size-11 items-center justify-center rounded-xl bg-danger-soft text-danger`,children:(0,y.jsx)(l,{className:`size-5`})}),(0,y.jsx)(`h1`,{id:`work-discovery-error-title`,className:`mt-5 text-2xl font-semibold tracking-tight text-fg`,children:t.errorTitle}),(0,y.jsx)(`p`,{className:`mx-auto mt-3 max-w-lg text-sm leading-6 text-fg-muted`,children:E.errorMessage}),(0,y.jsxs)(`div`,{className:`mx-auto mt-7 flex max-w-md flex-col gap-3 sm:flex-row-reverse`,children:[(0,y.jsx)(p,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void de(E.id).then(K),children:t.retry}),(0,y.jsx)(p,{variant:`secondary`,className:`h-11 flex-1`,onClick:()=>{D(null),T(null),C(`intro`)},children:t.chooseDifferent})]}),(0,y.jsx)(`button`,{type:`button`,className:`mt-6 text-sm text-fg-muted hover:text-fg hover:underline`,onClick:()=>Y(E.sessionKey),children:t.openConversation})]}):null]}),q.hasNativePicker?null:(0,y.jsx)(ie,{open:q.modalOpen,onOpenChange:q.setModalOpen,initialAbsolutePath:w?.canonicalRootPath,onConfirm:q.confirmPick,wd:n})]})}export{x as WorkDiscoveryPage};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{d as i,l as a,t as o}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as s}from"./cn-JdwAhgNB.js";import{t as c}from"./messages-BiBdO1-O.js";import{n as ee}from"./locale-store-CAuhEGCn.js";import{A as te,Ac as ne,Al as re,Fa as ie,Gs as ae,Jl as oe,Nu as l,Rl as u,Sc as se,To as d,Wl as ce,Xc as f,Ys as p,a as m,bu as h,f as le,is as g,ks as _,l as ue,m as de,ns as fe,o as pe,p as me,pu as v,s as he,u as y,vt as b,xc as x,zc as S}from"./index-eyttVNS_.js";var C=n(),w=e(t(),1),T=r();function ge(e){return e===`done`||e===`in_review`?`bg-emerald-500/10 text-emerald-700 dark:text-emerald-300`:e===`blocked`||e===`needs_input`?`bg-red-500/10 text-red-700 dark:text-red-300`:e===`in_progress`?`bg-accent-soft text-accent-fg`:e===`backlog`||e===`todo`?`bg-amber-500/10 text-amber-700 dark:text-amber-300`:`bg-surface-muted text-fg-subtle`}function E(e){return e?b(new Date(e)):``}function _e(e){return!Number.isFinite(e)||e<=0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(+(e<10*1024))} KB`:`${(e/(1024*1024)).toFixed(+(e<10*1024*1024))} MB`}function ve(e){return e.kind===`chat`?`/chat/${encodeURIComponent(e.targetId)}`:e.kind===`goal`?`/goals/${encodeURIComponent(e.targetId)}`:e.kind===`workflow_run`?`/workflows?run=${encodeURIComponent(e.targetId)}`:e.kind===`automation`?`/automations?automationId=${encodeURIComponent(e.targetId)}`:e.kind===`note`?`/notes/${encodeURIComponent(e.targetId)}`:`#`}function D(e){let t=(0,C.c)(7),{label:n,value:r}=e,i;t[0]===n?i=t[1]:(i=(0,T.jsx)(`dt`,{className:`text-xs font-medium text-fg-subtle`,children:n}),t[0]=n,t[1]=i);let a=r||`-`,o;t[2]===a?o=t[3]:(o=(0,T.jsx)(`dd`,{className:`min-w-0 break-words text-sm text-fg`,children:a}),t[2]=a,t[3]=o);let s;return t[4]!==i||t[5]!==o?(s=(0,T.jsxs)(`div`,{className:`grid gap-1`,children:[i,o]}),t[4]=i,t[5]=o,t[6]=s):s=t[6],s}function ye(e){let t=(0,C.c)(9),{events:n,t:r}=e;if(!n.length){let e;return t[0]===r.detail.noActivity?e=t[1]:(e=(0,T.jsx)(`div`,{className:`rounded-lg bg-surface-panel px-4 py-8 text-center text-sm text-fg-muted shadow-surface`,children:r.detail.noActivity}),t[0]=r.detail.noActivity,t[1]=e),e}let i;if(t[2]!==n||t[3]!==r){let e;t[5]===r?e=t[6]:(e=e=>(0,T.jsx)(`article`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:r.eventTypes[e.type]??e.type}),(0,T.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:E(e.createdAt)})]})},e.id),t[5]=r,t[6]=e),i=n.map(e),t[2]=n,t[3]=r,t[4]=i}else i=t[4];let a;return t[7]===i?a=t[8]:(a=(0,T.jsx)(`div`,{className:`grid gap-3`,children:i}),t[7]=i,t[8]=a),a}function O(e){return new Set(e.toLowerCase().split(/[^a-z0-9\u4e00-\u9fff]+/).filter(e=>e.length>=2))}function k(e,t,n){let r=t?.projectKind,i=[e.title,e.description,e.nextAction,e.blockedReason,e.status,e.priority,t?.name,t?.description,r].filter(Boolean).join(` `),a=[n.title,n.description,n.metadata.whenToUse,...n.metadata.tags??[]].filter(Boolean).join(` `),o=O(i),s=0;for(let e of O(a))o.has(e)&&(s+=3);let c=a.toLowerCase();return(e.status===`blocked`||e.status===`needs_input`)&&/debug|diagnos|review|audit|fix|检查|排查|修复/.test(c)&&(s+=8),e.status===`in_review`&&/review|audit|check|验收|评审|检查/.test(c)&&(s+=6),e.attachments?.length&&/analy|extract|summar|review|整理|分析|总结/.test(c)&&(s+=5),r===`coding`&&/code|repo|test|pr|review|代码|仓库|测试/.test(c)&&(s+=5),s}function A(e,t,n){return[...n].sort((n,r)=>k(e,t,r)-k(e,t,n)||n.title.localeCompare(r.title))}function j(){let{workItemId:e=``}=i(),t=a(),n=c(ee(e=>e.language)).projectDetailPage.workItems,[r,b]=(0,w.useState)(null),[C,O]=(0,w.useState)(null),[j,M]=(0,w.useState)([]),[N,be]=(0,w.useState)([]),[P,F]=(0,w.useState)(``),[I,L]=(0,w.useState)(``),[R,z]=(0,w.useState)(!0),[B,V]=(0,w.useState)(!1),[H,U]=(0,w.useState)(null),W=(0,w.useRef)(null),G=d(e=>e.setPageHeader),K=d(e=>e.clearPageHeader),q=(0,w.useMemo)(()=>r?`/projects/${encodeURIComponent(r.projectId)}/work-items`:`/projects`,[r]),J=(0,w.useCallback)(async()=>{if(e){z(!0),U(null);try{let[t,n]=await Promise.all([ue(e),y(e).catch(()=>({events:[]}))]);b(t.item),L(t.item.nextAction||t.item.title),M(n.events);let[r,i]=await Promise.all([ie(t.item.projectId).catch(()=>null),te().catch(()=>[])]),a=A(t.item,r,i);O(r),be(a),F(e=>e||a[0]?.id||``)}catch(e){U(e instanceof Error?e.message:String(e))}finally{z(!1)}}},[e]);(0,w.useEffect)(()=>{J()},[J]);let Y=(0,w.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await le(r.id);b(e.item),t(`/chat/${encodeURIComponent(e.session.key)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),X=(0,w.useCallback)(async()=>{if(r){V(!0),U(null);try{let e=await m(r.id);b(e.item),t(`/goals/${encodeURIComponent(e.goal.id)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t]),Z=(0,w.useCallback)(async e=>{M((await y(e).catch(()=>({events:[]}))).events)},[]),xe=(0,w.useCallback)(async()=>{if(!(!r||!P)){V(!0),U(null);try{let e=await me(r.id,{definitionId:P,goal:I.trim()||r.nextAction||r.title});b(e.item),await Z(e.item.id),t(`/workflows?run=${encodeURIComponent(e.runId)}`)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,t,Z,P,I]),Se=(0,w.useCallback)(async e=>{if(!(!r||!e.length)){V(!0),U(null);try{let t=await de(r.id,e);b(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),Ce=(0,w.useCallback)(async e=>{if(r){V(!0),U(null);try{let t=await pe(r.id,e.id);b(t.item),await Z(t.item.id)}catch(e){U(e instanceof Error?e.message:String(e))}finally{V(!1)}}},[r,Z]),we=(0,w.useCallback)(async e=>{if(r){U(null);try{await he(r.id,e)}catch(e){U(e instanceof Error?e.message:String(e))}}},[r]),Q=(0,w.useMemo)(()=>r?N.filter(e=>k(r,C,e)>0).slice(0,3):[],[r,C,N]),$=(0,w.useMemo)(()=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(_,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void J(),children:[(0,T.jsx)(se,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden sm:inline`,children:n.refreshShort})]}),r?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,T.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.createGoal})]})]}):null]}),[B,X,Y,r,J,n.detail.createGoal,n.detail.startChat,n.refreshShort]);return(0,w.useLayoutEffect)(()=>(G({startExtra:(0,T.jsx)(o,{to:q,className:`inline-flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":C?.name?n.detail.backToProject.replace(`{{name}}`,C.name):n.detail.backToProjects,children:(0,T.jsx)(l,{className:`size-4`,"aria-hidden":!0})}),main:(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(h,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:r?.title??(R?n.detail.loading:n.detail.notFound)})]}),r?(0,T.jsxs)(`p`,{className:`truncate text-xs text-fg-muted`,children:[n.statuses[r.status],` · `,n.priorities[r.priority],` · `,C?.name||r.projectId,` · `,n.updated,`: `,E(r.updatedAt)]}):null]}),end:$}),()=>K()),[K,$,r,R,C?.name,q,G,n,C]),R?(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,"aria-busy":!0,children:[(0,T.jsx)(`div`,{className:`h-8 w-40 animate-pulse rounded-md bg-surface-hover`}),(0,T.jsx)(`div`,{className:`mt-5 h-44 animate-pulse rounded-xl bg-surface-hover`})]}):H||!r?(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-6 sm:px-5 xl:px-6`,children:[(0,T.jsxs)(o,{to:`/projects`,className:`inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(l,{className:`size-4`,"aria-hidden":!0}),n.detail.backToProjects]}),(0,T.jsx)(`div`,{className:`mt-5 rounded-lg border border-danger/30 bg-danger-soft px-4 py-3 text-sm text-danger`,children:H||n.detail.notFound})]}):(0,T.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[var(--max-width-app-main)] flex-1 flex-col px-3 py-5 sm:px-5 xl:px-6`,children:[(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel p-4 shadow-surface sm:px-5`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 flex-wrap items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,T.jsx)(h,{className:`size-4 shrink-0 text-accent-fg`,"aria-hidden":!0}),(0,T.jsx)(`h1`,{className:`min-w-0 break-words text-lg font-semibold leading-7 text-fg`,children:r.title})]}),(0,T.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs`,children:[(0,T.jsx)(`span`,{className:s(`rounded-full px-2 py-0.5 font-medium`,ge(r.status)),children:n.statuses[r.status]}),(0,T.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.priorities[r.priority]}),r.archivedAt?(0,T.jsx)(`span`,{className:`rounded-full bg-surface-muted px-2 py-0.5 text-fg-muted`,children:n.detail.archived}):null]})]}),(0,T.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[(0,T.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,T.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(p,{className:`size-3.5`,"aria-hidden":!0}),n.detail.createGoal]})]})]}),(0,T.jsxs)(`dl`,{className:`mt-5 grid gap-4 border-t border-edge pt-4 sm:grid-cols-2`,children:[(0,T.jsx)(D,{label:n.create.descriptionLabel,value:r.description||n.detail.noDescription}),(0,T.jsx)(D,{label:n.nextAction,value:r.nextAction||n.noNextAction}),(0,T.jsx)(D,{label:n.blockedReason,value:r.blockedReason||n.detail.noBlockedReason}),(0,T.jsx)(D,{label:n.updated,value:E(r.updatedAt)})]})]}),(0,T.jsxs)(`div`,{className:`mt-4 grid min-h-0 gap-4 lg:grid-cols-[minmax(0,1fr)_18rem]`,children:[(0,T.jsxs)(`section`,{className:`min-w-0`,children:[(0,T.jsxs)(`div`,{className:`mb-2 flex items-center gap-2`,children:[(0,T.jsx)(u,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.activity})]}),(0,T.jsx)(ye,{events:j,t:n})]}),(0,T.jsxs)(`aside`,{className:`grid content-start gap-4`,children:[(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`div`,{className:`flex items-center justify-between gap-3`,children:(0,T.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,T.jsx)(re,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.detail.workflowTitle})]})}),(0,T.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:n.detail.workflowHint}),(0,T.jsxs)(`div`,{className:`mt-3 grid gap-2`,children:[(0,T.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowTemplate,(0,T.jsxs)(fe,{className:`h-9 rounded-md border border-edge bg-surface-base px-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:P,disabled:B||N.length===0,onChange:e=>F(e.target.value),children:[N.length===0?(0,T.jsx)(g,{value:``,children:n.detail.noWorkflowTemplates}):null,N.map(e=>(0,T.jsx)(g,{value:e.id,children:e.title},e.id))]})]}),Q.length?(0,T.jsxs)(`div`,{className:`grid gap-1`,children:[(0,T.jsx)(`div`,{className:`text-xs font-medium text-fg-subtle`,children:n.detail.recommendedWorkflows}),(0,T.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Q.map(e=>(0,T.jsx)(`button`,{type:`button`,className:s(`min-w-0 rounded-md border px-2 py-1 text-left text-xs transition-colors`,P===e.id?`border-accent bg-accent-soft text-accent-fg`:`border-edge bg-surface-base text-fg-muted hover:bg-surface-hover hover:text-fg`),disabled:B,onClick:()=>F(e.id),children:(0,T.jsx)(`span`,{className:`block max-w-48 truncate`,children:e.title})},e.id))})]}):null,(0,T.jsxs)(`label`,{className:`grid gap-1 text-xs font-medium text-fg-subtle`,children:[n.detail.workflowGoal,(0,T.jsx)(`textarea`,{className:`min-h-20 resize-y rounded-md border border-edge bg-surface-base p-2 text-sm font-normal text-fg outline-none focus:border-accent`,value:I,disabled:B,onChange:e=>L(e.target.value)})]}),(0,T.jsxs)(_,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:B||!P,onClick:xe,children:[(0,T.jsx)(x,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startWorkflow]}),N.length?null:(0,T.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n.detail.noWorkflowTemplates})]})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,T.jsxs)(`h2`,{className:`inline-flex min-w-0 items-center gap-2 text-sm font-semibold text-fg`,children:[(0,T.jsx)(S,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,T.jsxs)(_,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:()=>W.current?.click(),children:[(0,T.jsx)(ne,{className:`size-3.5`,"aria-hidden":!0}),n.attachments.add]}),(0,T.jsx)(`input`,{ref:W,type:`file`,multiple:!0,className:`hidden`,onChange:e=>{Se(Array.from(e.target.files??[])),e.currentTarget.value=``}})]}),(0,T.jsx)(`div`,{className:`mt-3 grid gap-2`,children:r.attachments?.length?r.attachments.map(e=>(0,T.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 rounded-md border border-edge bg-surface-base p-2 text-sm`,children:[(0,T.jsx)(u,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,T.jsx)(`div`,{className:`truncate font-medium text-fg`,children:e.fileName}),(0,T.jsxs)(`div`,{className:`truncate text-xs text-fg-subtle`,children:[e.mimeType,` · `,_e(e.size)]})]}),(0,T.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,title:n.attachments.download,"aria-label":n.attachments.download,disabled:B,onClick:()=>void we(e),children:(0,T.jsx)(oe,{className:`size-3.5`,"aria-hidden":!0})}),(0,T.jsx)(`button`,{type:`button`,className:`inline-flex size-7 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-danger`,title:n.attachments.remove,"aria-label":n.attachments.remove,disabled:B,onClick:()=>void Ce(e),children:(0,T.jsx)(ae,{className:`size-3.5`,"aria-hidden":!0})})]},e.id)):(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.attachments.empty})})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.links}),(0,T.jsx)(`div`,{className:`mt-3 grid gap-1 text-sm`,children:r.links?.length?r.links.map(e=>(0,T.jsxs)(o,{to:ve(e),className:`flex min-w-0 items-center justify-between gap-3 rounded-md px-2 py-1.5 hover:bg-surface-hover`,children:[(0,T.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.title||e.targetId}),(0,T.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-1 text-xs text-fg-muted`,children:[n.linkKinds[e.kind],(0,T.jsx)(ce,{className:`size-3.5`,"aria-hidden":!0})]})]},e.id)):(0,T.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.detail.noLinks})})]}),(0,T.jsxs)(`section`,{className:`rounded-lg bg-surface-panel px-4 py-3 shadow-surface`,children:[(0,T.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n.detail.project}),(0,T.jsxs)(o,{to:q,className:`mt-2 inline-flex min-w-0 items-center gap-2 text-sm font-medium text-accent hover:text-accent-fg`,children:[(0,T.jsx)(v,{className:`size-4 shrink-0`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:C?.name||r.projectId})]})]})]})]})]})}export{j as WorkItemDetailPage};
@@ -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{l as i,t as a}from"./chunk-KS7C4IRE-BMhrPKJC.js";import{t as o}from"./check-DUBLcKHA.js";import{t as s}from"./circle-alert-BEjgurr2.js";import{t as c}from"./cn-JdwAhgNB.js";import{t as l}from"./messages-BiBdO1-O.js";import{n as u,o as d,r as f,s as p}from"./locale-store-CAuhEGCn.js";import{n as m}from"./activity-store-CyEDJeIt.js";import{Ac as h,Bo as g,Ci as _,Ei as v,Fl as y,Gl as b,Go as x,Gs as S,Ho as C,Mc as w,Ms as T,Mu as E,Qc as D,Rc as O,Ru as k,Si as A,Ti as j,To as M,Ul as N,Uo as P,Va as F,Vo as I,Wo as L,Ws as R,ac as z,hc as B,hu as V,ks as H,pu as U,ro as W,ru as ee,tl as G,tt as te,vl as ne,vt as K,vu as re,wi as q,xi as ie,zo as ae}from"./index-eyttVNS_.js";import{a as oe,d as se,l as ce,n as le,s as ue,t as de}from"./api-DwyUxpgY.js";import{t as fe}from"./copy-VueTIC2x.js";var J=e(t(),1),Y=n();function pe(e){try{return decodeURIComponent(e).trim()||null}catch{return null}}function X(e){if(!e)return null;let t=e.split(/[?#]/,1)[0],n=/^\/goals\/([^/]+)\/?$/.exec(t);if(n){let e=pe(n[1]);return e?{kind:`goal`,id:e}:null}let r=/^\/chat\/([^/]+)\/?$/.exec(t);if(r){let e=pe(r[1]);return!e||e===`new`?null:{kind:`session`,id:e}}return null}async function me(e,t){let n=e.kind===`goal`?`/api/goals/${encodeURIComponent(e.id)}`:`/api/sessions/${encodeURIComponent(e.id)}?limit=1`;try{return(await d(f(n),{signal:t})).status===404?`missing`:`available`}catch(e){if(t?.aborted)throw e;return`available`}}var Z=r(),Q=3,he={info:{Icon:ne,className:`text-accent-fg bg-accent-soft`},success:{Icon:U,className:`text-success bg-success-soft`},warning:{Icon:R,className:`text-warning bg-warning-soft`},error:{Icon:s,className:`text-danger bg-danger-soft`}};function ge(e,t){let n=Math.max(0,Math.round((Date.now()-e)/1e3));if(n<60)return t===`zh`?`刚刚`:`Just now`;let r=Math.round(n/60);if(r<60)return t===`zh`?`${r} 分钟前`:`${r}m ago`;let i=Math.round(r/60);if(i<24)return t===`zh`?`${i} 小时前`:`${i}h ago`;let a=Math.round(i/24);return t===`zh`?`${a} 天前`:`${a}d ago`}function _e(e){let t=(0,Y.c)(55),{item:n,targetAvailability:r}=e,i=u($),o;t[0]===i?o=t[1]:(o=l(i),t[0]=i,t[1]=o);let s=o.projectsPage.workHome,d=m(ve),{Icon:f,className:p}=he[n.tone],h;t[2]===p?h=t[3]:(h=c(`mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-lg`,p),t[2]=p,t[3]=h);let g;t[4]!==f||t[5]!==n.status?(g=n.status===`running`?(0,Z.jsx)(G,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,Z.jsx)(f,{className:`size-3.5`,"aria-hidden":!0}),t[4]=f,t[5]=n.status,t[6]=g):g=t[6];let _;t[7]!==h||t[8]!==g?(_=(0,Z.jsx)(`div`,{className:h,children:g}),t[7]=h,t[8]=g,t[9]=_):_=t[9];let v;t[10]===n.title?v=t[11]:(v=(0,Z.jsx)(`h3`,{className:`min-w-0 flex-1 text-sm font-medium leading-5 text-fg`,children:n.title}),t[10]=n.title,t[11]=v);let y;t[12]!==s.activityUnread||t[13]!==n.read?(y=n.read?null:(0,Z.jsx)(`span`,{className:`mt-1.5 size-1.5 shrink-0 rounded-full bg-accent`,"aria-label":s.activityUnread}),t[12]=s.activityUnread,t[13]=n.read,t[14]=y):y=t[14];let b;t[15]!==v||t[16]!==y?(b=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-start gap-2`,children:[v,y]}),t[15]=v,t[16]=y,t[17]=b):b=t[17];let x;t[18]===n.message?x=t[19]:(x=n.message?(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.message}):null,t[18]=n.message,t[19]=x);let S;t[20]===n.source?S=t[21]:(S=n.source?(0,Z.jsx)(`span`,{className:`max-w-48 truncate`,children:n.source}):null,t[20]=n.source,t[21]=S);let C;t[22]!==n.updatedAt||t[23]!==i?(C=ge(n.updatedAt,i),t[22]=n.updatedAt,t[23]=i,t[24]=C):C=t[24];let w;t[25]===C?w=t[26]:(w=(0,Z.jsx)(`span`,{children:C}),t[25]=C,t[26]=w);let E;t[27]===n.occurrences?E=t[28]:(E=n.occurrences>1?(0,Z.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=E);let D;t[29]!==s.activityCheckingRelated||t[30]!==s.activityRelatedMissing||t[31]!==s.activityViewRelated||t[32]!==n.href||t[33]!==r?(D=n.href&&r===`available`?(0,Z.jsxs)(a,{to:n.href,className:`inline-flex items-center gap-0.5 font-medium text-accent-fg hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[s.activityViewRelated,(0,Z.jsx)(V,{className:`size-3`,"aria-hidden":!0})]}):n.href&&r===`checking`?(0,Z.jsx)(W,{className:`h-3 w-20 rounded`,"aria-label":s.activityCheckingRelated}):n.href&&r===`missing`?(0,Z.jsx)(`span`,{className:`font-medium text-fg-subtle`,role:`status`,children:s.activityRelatedMissing}):null,t[29]=s.activityCheckingRelated,t[30]=s.activityRelatedMissing,t[31]=s.activityViewRelated,t[32]=n.href,t[33]=r,t[34]=D):D=t[34];let O;t[35]!==w||t[36]!==E||t[37]!==D||t[38]!==S?(O=(0,Z.jsxs)(`div`,{className:`mt-1.5 flex min-w-0 flex-wrap items-center gap-x-2 text-[11px] text-fg-subtle`,children:[S,w,E,D]}),t[35]=w,t[36]=E,t[37]=D,t[38]=S,t[39]=O):O=t[39];let k;t[40]!==O||t[41]!==b||t[42]!==x?(k=(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[b,x,O]}),t[40]=O,t[41]=b,t[42]=x,t[43]=k):k=t[43];let A;t[44]!==n.id||t[45]!==d?(A=()=>d(n.id),t[44]=n.id,t[45]=d,t[46]=A):A=t[46];let j;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Z.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),t[47]=j):j=t[47];let M;t[48]!==s.activityRemove||t[49]!==A?(M=(0,Z.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-subtle opacity-0 transition-opacity hover:bg-surface-hover hover:text-fg group-hover:opacity-100 focus:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":s.activityRemove,onClick:A,children:j}),t[48]=s.activityRemove,t[49]=A,t[50]=M):M=t[50];let N;return t[51]!==k||t[52]!==M||t[53]!==_?(N=(0,Z.jsxs)(`article`,{className:`group flex items-start gap-3 border-t border-edge-subtle px-1 py-3 first:border-t-0`,children:[_,k,M]}),t[51]=k,t[52]=M,t[53]=_,t[54]=N):N=t[54],N}function ve(e){return e.remove}function $(e){return e.language}function ye(){let e=(0,Y.c)(12),t=l(u(Ae)).projectsPage.workHome,n=m(ke),r=m(Oe),i=m(De),[a,s]=(0,J.useState)(!1),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[d,f]=(0,J.useState)(c),p;e[1]===n?p=e[2]:(p=n.filter(Ee),e[1]=n,e[2]=p);let h=p.length,g;e[3]===n?g=e[4]:(g=n.filter(Te),e[3]=n,e[4]=g);let _=g.length,v;e[5]!==a||e[6]!==n?(v=a?n:n.slice(0,Q),e[5]=a,e[6]=n,e[7]=v):v=e[7];let y=v,b,x;e[8]===n?(b=e[9],x=e[10]):(b=()=>{let e=new AbortController,t=new Map(n.flatMap(we));return f(Object.fromEntries([...t.keys()].map(Ce))),Promise.all([...t].map(async t=>{let[n,r]=t,i=await me(r,e.signal);e.signal.aborted||f(e=>({...e,[n]:i}))})).catch(Se),()=>e.abort()},x=[n],e[8]=n,e[9]=b,e[10]=x),(0,J.useEffect)(b,x);let C;return e[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Z.jsx)(k,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[11]=C):C=e[11],(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsx)(`div`,{children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[C,(0,Z.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),h>0?(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5 rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,children:[(0,Z.jsx)(G,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),h,` `,t.running]}):_>0?(0,Z.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[_,` `,t.activityNew]}):null]})}),a&&n.length>0?(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[_>0?(0,Z.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,Z.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(xe)?(0,Z.jsxs)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,Z.jsx)(S,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,Z.jsxs)(`div`,{className:`mt-3 px-1`,children:[y.map(e=>(0,Z.jsx)(_e,{item:e,targetAvailability:e.href&&X(e.href)?d[e.href]??`checking`:`available`},e.id)),n.length>Q?(0,Z.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,Z.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>s(be),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,Z.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,Z.jsx)(ee,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`p`,{children:t.activityEmpty})]})]})}function be(e){return!e}function xe(e){return e.status===`done`}function Se(){}function Ce(e){return[e,`checking`]}function we(e){let t=X(e.href);return e.href&&t?[[e.href,t]]:[]}function Te(e){return!e.read}function Ee(e){return e.status===`running`}function De(e){return e.clearFinished}function Oe(e){return e.markAllRead}function ke(e){return e.items}function Ae(e){return e.language}function je(e){let t=(0,Y.c)(32),{focus:n,kind:r,language:i,busy:a,onMonitor:o}=e,s;t[0]===i?s=t[1]:(s=fe(i),t[0]=i,t[1]=s);let c=s,l;if(t[2]!==a||t[3]!==c.disabled||t[4]!==c.enableExternal||t[5]!==c.enableProgress||t[6]!==c.enabled||t[7]!==c.external||t[8]!==c.failed||t[9]!==c.lastRun||t[10]!==c.neverRun||t[11]!==c.nextRun||t[12]!==c.progress||t[13]!==c.queued||t[14]!==c.running||t[15]!==n.monitors||t[16]!==n.status||t[17]!==r||t[18]!==o){let e;t[20]===r?e=t[21]:(e=e=>e.kind===r,t[20]=r,t[21]=e);let i=n.monitors.find(e),s=i?.enabled===!0,u=r===`progress`?c.progress:c.external,d=r===`progress`?c.enableProgress:c.enableExternal,f=i?.runState===`running`?c.running:i?.runState===`queued`?c.queued:i?.runState===`failed`?c.failed:s?c.enabled:c.disabled,p=`size-1.5 shrink-0 rounded-full ${s?`bg-success`:`bg-fg-subtle/40`}`,m;t[22]===p?m=t[23]:(m=(0,Z.jsx)(`span`,{className:p,"aria-hidden":!0}),t[22]=p,t[23]=m);let h;t[24]!==m||t[25]!==u?(h=(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-xs font-medium text-fg`,children:[m,u]}),t[24]=m,t[25]=u,t[26]=h):h=t[26];let g;t[27]===f?g=t[28]:(g=(0,Z.jsx)(`span`,{className:`shrink-0 text-[11px] text-fg-subtle`,children:f}),t[27]=f,t[28]=g);let _;t[29]!==h||t[30]!==g?(_=(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[h,g]}),t[29]=h,t[30]=g,t[31]=_):_=t[31],l=(0,Z.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base/70 px-3 py-2.5`,children:[_,s?(0,Z.jsxs)(`p`,{className:`mt-1.5 text-[11px] text-fg-subtle`,children:[i?.lastRunAt?`${c.lastRun} ${K(new Date(i.lastRunAt))}`:c.neverRun,i?.nextRunAt?` · ${c.nextRun} ${K(new Date(i.nextRunAt))}`:``]}):(0,Z.jsx)(H,{type:`button`,variant:`ghost`,className:`mt-1 h-7 px-0 text-xs text-accent`,disabled:a||n.status!==`active`,onClick:()=>o(r,!0),children:d})]}),t[2]=a,t[3]=c.disabled,t[4]=c.enableExternal,t[5]=c.enableProgress,t[6]=c.enabled,t[7]=c.external,t[8]=c.failed,t[9]=c.lastRun,t[10]=c.neverRun,t[11]=c.nextRun,t[12]=c.progress,t[13]=c.queued,t[14]=c.running,t[15]=n.monitors,t[16]=n.status,t[17]=r,t[18]=o,t[19]=l}else l=t[19];return l}function Me(e){let t=(0,Y.c)(61),{focus:n,language:r,busy:a,onMonitor:o,onStatus:s,onDelete:c}=e,l;t[0]===r?l=t[1]:(l=fe(r),t[0]=r,t[1]=l);let u=l,d=i(),f;t[2]!==n.id||t[3]!==d?(f=()=>d(`/work/focuses/${encodeURIComponent(n.id)}`),t[2]=n.id,t[3]=d,t[4]=f):f=t[4];let p;t[5]===n.title?p=t[6]:(p=(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[5]=n.title,t[6]=p);let m;t[7]===n.summary?m=t[8]:(m=(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.summary}),t[7]=n.summary,t[8]=m);let h;t[9]!==f||t[10]!==p||t[11]!==m?(h=(0,Z.jsxs)(`button`,{type:`button`,className:`min-w-0 flex-1 text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,onClick:f,children:[p,m]}),t[9]=f,t[10]=p,t[11]=m,t[12]=h):h=t[12];let g;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,Z.jsx)(b,{className:`size-4`,"aria-hidden":!0}),t[13]=g):g=t[13];let y;t[14]===a?y=t[15]:(y=(0,Z.jsx)(v,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,className:`rounded-md p-1 text-fg-muted hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,"aria-label":`Actions`,disabled:a,children:g})}),t[14]=a,t[15]=y);let x;t[16]!==n.status||t[17]!==s?(x=()=>s(n.status===`paused`?`active`:`paused`),t[16]=n.status,t[17]=s,t[18]=x):x=t[18];let C;t[19]===n.status?C=t[20]:(C=n.status===`paused`?(0,Z.jsx)(w,{className:`size-4`}):(0,Z.jsx)(O,{className:`size-4`}),t[19]=n.status,t[20]=C);let T=n.status===`paused`?u.resume:u.pause,E;t[21]!==T||t[22]!==x||t[23]!==C?(E=(0,Z.jsxs)(A,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:x,children:[C,T]}),t[21]=T,t[22]=x,t[23]=C,t[24]=E):E=t[24];let D;t[25]===s?D=t[26]:(D=()=>s(`completed`),t[25]=s,t[26]=D);let k;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Z.jsx)(U,{className:`size-4`}),t[27]=k):k=t[27];let M;t[28]!==u.complete||t[29]!==D?(M=(0,Z.jsxs)(A,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:D,children:[k,u.complete]}),t[28]=u.complete,t[29]=D,t[30]=M):M=t[30];let N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Z.jsx)(j,{className:`my-1 h-px bg-edge-subtle`}),t[31]=N):N=t[31];let P;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,Z.jsx)(S,{className:`size-4`}),t[32]=P):P=t[32];let F;t[33]!==u.remove||t[34]!==c?(F=(0,Z.jsxs)(A,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-3 py-2 text-sm text-danger outline-none focus:bg-surface-hover`,onSelect:c,children:[P,u.remove]}),t[33]=u.remove,t[34]=c,t[35]=F):F=t[35];let I;t[36]!==E||t[37]!==M||t[38]!==F?(I=(0,Z.jsx)(_,{children:(0,Z.jsxs)(ie,{align:`end`,sideOffset:4,className:`z-50 min-w-40 rounded-xl border border-edge bg-surface-panel p-1 shadow-lg`,children:[E,M,N,F]})}),t[36]=E,t[37]=M,t[38]=F,t[39]=I):I=t[39];let L;t[40]!==I||t[41]!==y?(L=(0,Z.jsxs)(q,{children:[y,I]}),t[40]=I,t[41]=y,t[42]=L):L=t[42];let R;t[43]!==L||t[44]!==h?(R=(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[h,L]}),t[43]=L,t[44]=h,t[45]=R):R=t[45];let z;t[46]!==a||t[47]!==n||t[48]!==r||t[49]!==o?(z=(0,Z.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,Z.jsx)(je,{focus:n,kind:`progress`,language:r,busy:a,onMonitor:o}),(0,Z.jsx)(je,{focus:n,kind:`external_changes`,language:r,busy:a,onMonitor:o})]}),t[46]=a,t[47]=n,t[48]=r,t[49]=o,t[50]=z):z=t[50];let B;t[51]!==n.id||t[52]!==d?(B=()=>d(`/work/focuses/${encodeURIComponent(n.id)}`),t[51]=n.id,t[52]=d,t[53]=B):B=t[53];let V;t[54]!==u.details||t[55]!==B?(V=(0,Z.jsxs)(`button`,{type:`button`,className:`mt-3 text-xs font-medium text-accent hover:underline`,onClick:B,children:[u.details,` →`]}),t[54]=u.details,t[55]=B,t[56]=V):V=t[56];let H;return t[57]!==R||t[58]!==z||t[59]!==V?(H=(0,Z.jsxs)(`article`,{className:`group rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:border-edge-strong`,children:[R,z,V]}),t[57]=R,t[58]=z,t[59]=V,t[60]=H):H=t[60],H}function Ne(e){return p(f(`/api/home${e?`?locale=${encodeURIComponent(e)}`:``}`))}function Pe(e,t){return p(f(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function Fe(e){return e===`zh`?{newWork:`交给 xopc`,dialogTitle:`现在想完成什么?`,dialogDescription:`发送后会直接进入对话,xopc 会立即开始处理。`,intentLabel:`告诉 xopc 你要做什么`,intentPlaceholder:`例如:整理这周的会议记录,提炼待办并给出下周优先级`,submit:`进入对话`,needsAttention:`等你决定`,running:`xopc 正在处理`,continue:`继续推进`,recent:`最近对话`,focuses:`持续关注`,projects:`长期项目`,emptyRunning:`当前没有正在处理的对话`,emptyContinue:`还没有需要继续推进的事项`,openChat:`打开对话`}:{newWork:`Ask xopc`,dialogTitle:`What do you want to get done?`,dialogDescription:`You will enter a conversation immediately and xopc will start working.`,intentLabel:`Tell xopc what you need`,intentPlaceholder:`For example: summarize this week’s meeting notes and suggest next week’s priorities`,submit:`Open conversation`,needsAttention:`Needs your decision`,running:`xopc is working`,continue:`Continue`,recent:`Recent conversations`,focuses:`Ongoing focuses`,projects:`Long-term projects`,emptyRunning:`No conversations are running`,emptyContinue:`No ongoing items yet`,openChat:`Open conversation`}}function Ie(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Le(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:K(n)}function Re(e){let t=(0,Y.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Z.jsx)(`span`,{className:`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 ze(){let e=(0,Y.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,Z.jsx)(W,{className:`h-20 rounded-2xl`}),(0,Z.jsx)(W,{className:`h-72 rounded-2xl`}),(0,Z.jsx)(W,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Be(e){let t=(0,Y.c)(19),{item:n,statusLabel:r}=e,i=`/work-items/${encodeURIComponent(n.id)}`,o;t[0]===n.title?o=t[1]:(o=(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=o);let s;t[2]===n.projectName?s=t[3]:(s=(0,Z.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:n.projectName}),t[2]=n.projectName,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===r?l=t[8]:(l=(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:r}),t[7]=r,t[8]=l);let u;t[9]!==c||t[10]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[9]=c,t[10]=l,t[11]=u):u=t[11];let d;t[12]!==n.blockedReason||t[13]!==n.nextAction?(d=n.blockedReason||n.nextAction?(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.blockedReason||n.nextAction}):null,t[12]=n.blockedReason,t[13]=n.nextAction,t[14]=d):d=t[14];let f;return t[15]!==i||t[16]!==u||t[17]!==d?(f=(0,Z.jsxs)(a,{to:i,className:`group block rounded-lg px-1 py-2.5 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,d]}),t[15]=i,t[16]=u,t[17]=d,t[18]=f):f=t[18],f}function Ve(e){let t=(0,Y.c)(15),{chat:n,statusLabel:r}=e,i=`/chat/${encodeURIComponent(n.key)}`,o;t[0]===n.name?o=t[1]:(o=(0,Z.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:n.name}),t[0]=n.name,t[1]=o);let s;t[2]===r?s=t[3]:(s=(0,Z.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-muted px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:r}),t[2]=r,t[3]=s);let c;t[4]!==o||t[5]!==s?(c=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[o,s]}),t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;t[7]===n.updatedAt?l=t[8]:(l=Le(n.updatedAt,``),t[7]=n.updatedAt,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,Z.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:l}),t[9]=l,t[10]=u);let d;return t[11]!==i||t[12]!==c||t[13]!==u?(d=(0,Z.jsxs)(a,{to:i,className:`group block rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[c,u]}),t[11]=i,t[12]=c,t[13]=u,t[14]=d):d=t[14],d}function He(e){let t=(0,Y.c)(27),{item:n,kindLabel:r,reasonLabel:i,approveLabel:o,denyLabel:s,busy:c,onRespond:l}=e,u;t[0]===n.title?u=t[1]:(u=(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=u);let d=n.projectName||r,f;t[2]===d?f=t[3]:(f=(0,Z.jsx)(`p`,{className:`mt-1 truncate text-xs text-fg-subtle`,children:d}),t[2]=d,t[3]=f);let p;t[4]!==u||t[5]!==f?(p=(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[u,f]}),t[4]=u,t[5]=f,t[6]=p):p=t[6];let m;t[7]===i?m=t[8]:(m=(0,Z.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:i}),t[7]=i,t[8]=m);let h;t[9]!==p||t[10]!==m?(h=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[p,m]}),t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===n.detail?g=t[13]:(g=n.detail?(0,Z.jsx)(`p`,{className:`mt-2 line-clamp-2 text-xs leading-5 text-fg-muted`,children:n.detail}):null,t[12]=n.detail,t[13]=g);let _;t[14]!==n.href||t[15]!==h||t[16]!==g?(_=(0,Z.jsxs)(a,{to:n.href,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,g]}),t[14]=n.href,t[15]=h,t[16]=g,t[17]=_):_=t[17];let v;t[18]!==o||t[19]!==c||t[20]!==s||t[21]!==n.response||t[22]!==l?(v=n.response?(0,Z.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,Z.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`deny`),children:s}),(0,Z.jsx)(H,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`approve`),children:o})]}):null,t[18]=o,t[19]=c,t[20]=s,t[21]=n.response,t[22]=l,t[23]=v):v=t[23];let y;return t[24]!==_||t[25]!==v?(y=(0,Z.jsxs)(`article`,{className:`rounded-xl border border-warning/35 bg-warning-soft/25 p-3.5 transition-colors hover:bg-warning-soft/40`,children:[_,v]}),t[24]=_,t[25]=v,t[26]=y):y=t[26],y}function Ue(e){let t=(0,Y.c)(19),{project:n,openLabel:r,noDescription:i}=e,o=`/projects/${encodeURIComponent(n.id)}`,s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Z.jsx)(y,{className:`size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[0]=s):s=t[0];let c;t[1]===n.name?c=t[2]:(c=(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[s,(0,Z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:n.name})]}),t[1]=n.name,t[2]=c);let l;t[3]===r?l=t[4]:(l=(0,Z.jsx)(E,{className:`size-4 shrink-0 text-fg-subtle transition-transform group-hover:translate-x-0.5`,"aria-label":r}),t[3]=r,t[4]=l);let u;t[5]!==c||t[6]!==l?(u=(0,Z.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[c,l]}),t[5]=c,t[6]=l,t[7]=u):u=t[7];let d=n.description||n.brief||i,f;t[8]===d?f=t[9]:(f=(0,Z.jsx)(`p`,{className:`mt-3 line-clamp-2 text-xs leading-5 text-fg-muted`,children:d}),t[8]=d,t[9]=f);let p=n.lastActiveAt??n.updatedAt,m;t[10]===p?m=t[11]:(m=Le(p,``),t[10]=p,t[11]=m);let h;t[12]===m?h=t[13]:(h=(0,Z.jsx)(`p`,{className:`mt-auto pt-3 text-[11px] text-fg-subtle`,children:m}),t[12]=m,t[13]=h);let g;return t[14]!==o||t[15]!==h||t[16]!==u||t[17]!==f?(g=(0,Z.jsxs)(a,{to:o,className:`group flex min-h-32 flex-col rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:bg-surface-hover/55 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[u,f,h]}),t[14]=o,t[15]=h,t[16]=u,t[17]=f,t[18]=g):g=t[18],g}function We(){let e=u(e=>e.language),t=l(e),n=t.projectsPage,r=fe(e),o=Fe(e),c=i(),d=M(e=>e.setPageHeader),f=M(e=>e.clearPageHeader),[p,m]=(0,J.useState)(null),[_,v]=(0,J.useState)([]),[y,b]=(0,J.useState)([]),[S,w]=(0,J.useState)([]),[E,O]=(0,J.useState)(!0),[k,A]=(0,J.useState)(null),[j,R]=(0,J.useState)(``),[V,U]=(0,J.useState)(!1),[W,G]=(0,J.useState)(``),[ne,K]=(0,J.useState)(null),[q,ie]=(0,J.useState)(null),[Y,pe]=(0,J.useState)(null),X=(0,J.useCallback)(async()=>{O(!0),A(null);try{let[t,n,r,i]=await Promise.all([Ne(e),F({limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),ue(),oe()]);m(t),v(n.items),b(r),w(i)}catch(e){A(e instanceof Error?e.message:String(e))}finally{O(!1)}},[e]);(0,J.useEffect)(()=>{X()},[X]),(0,J.useEffect)(()=>{let e=()=>void X(),t=[`session-created`,`session-updated`,`session-transcript-updated`,`agent-run-started`,`agent-run-ended`,`focus-created`,`focus-updated`,`focus-deleted`,`focus-monitor-updated`,`focus-run-updated`,`focus-insight-updated`,`focus-candidate-updated`];return t.forEach(t=>window.addEventListener(t,e)),()=>t.forEach(t=>window.removeEventListener(t,e))},[X]);let me=(0,J.useMemo)(()=>{let e=j.trim().toLocaleLowerCase(),t=_.filter(e=>e.status!==`archived`);return e?t.filter(t=>[t.name,t.description,t.brief].filter(Boolean).some(t=>t.toLocaleLowerCase().includes(e))):t.slice(0,6)},[_,j]),Q=(0,J.useMemo)(()=>p?.decisions??[],[p]),he=(0,J.useMemo)(()=>p?.work.current.filter(e=>e.status!==`needs_input`&&e.status!==`in_review`&&e.status!==`blocked`).slice(0,10)??[],[p]),ge=(0,J.useCallback)(e=>{e.preventDefault();let t=W.trim();t&&(G(``),U(!1),c({pathname:`/chat/new`,search:`?${new URLSearchParams({draft:t,autoSend:`1`}).toString()}`},{state:{forceNewChat:!0}}))},[c,W]),_e=(0,J.useMemo)(()=>(0,Z.jsxs)(H,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>U(!0),children:[(0,Z.jsx)(h,{className:`size-4`,"aria-hidden":!0}),o.newWork]}),[o.newWork]),ve=(0,J.useCallback)(async(e,t)=>{if(e.response){K(e.id),A(null);try{await Pe(e.response,t),await X()}catch(e){A(e instanceof Error?e.message:String(e))}finally{K(null)}}},[X]),$=(0,J.useCallback)(async(e,t,n=r.operationDone)=>{ie(e),A(null),pe(null);try{await t();let[e,r]=await Promise.all([ue(),oe()]);b(e),w(r),pe(n)}catch(e){A(e instanceof Error?e.message:String(e))}finally{ie(null)}},[r.operationDone]);return(0,J.useLayoutEffect)(()=>(d({startExtra:null,main:(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,Z.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.workHome.subtitle})]}),end:_e}),()=>f()),[f,_e,d,n.title,n.workHome.subtitle]),(0,Z.jsxs)(`main`,{className:`mx-auto flex w-full max-w-[1200px] flex-1 flex-col gap-7 px-4 py-7 sm:px-6 lg:px-8 lg:py-9`,children:[(0,Z.jsx)(ae,{open:V,onOpenChange:U,children:(0,Z.jsxs)(L,{children:[(0,Z.jsx)(P,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,Z.jsxs)(I,{className:`fixed left-1/2 top-1/2 z-[90] flex h-[min(31rem,calc(100dvh-1.5rem))] w-[min(36rem,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,Z.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(x,{className:`text-base font-semibold text-fg`,children:o.dialogTitle}),(0,Z.jsx)(C,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:o.dialogDescription})]}),(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(H,{type:`button`,variant:`ghost`,className:`-mr-2 -mt-1 size-8 shrink-0 rounded-lg p-0`,title:n.cancel,"aria-label":n.cancel,children:(0,Z.jsx)(T,{className:`size-4`,"aria-hidden":!0})})})]}),(0,Z.jsxs)(`form`,{onSubmit:ge,className:`flex min-h-0 flex-1 flex-col`,children:[(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,Z.jsx)(`label`,{htmlFor:`new-work-outcome`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:o.intentLabel}),(0,Z.jsx)(`textarea`,{id:`new-work-outcome`,className:`min-h-32 w-full flex-1 resize-none rounded-xl border border-edge bg-surface-base p-3 text-sm font-normal leading-6 text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,value:W,onChange:e=>G(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},placeholder:o.intentPlaceholder,maxLength:12e3,autoFocus:!0}),(0,Z.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,Z.jsx)(`span`,{children:n.workHome.submitShortcut}),(0,Z.jsxs)(`span`,{className:`tabular-nums`,children:[W.length.toLocaleString(),` / `,12e3.toLocaleString()]})]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsx)(H,{type:`button`,variant:`ghost`,children:n.cancel})}),(0,Z.jsxs)(H,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:!W.trim(),children:[(0,Z.jsx)(z,{className:`size-4`,"aria-hidden":!0}),o.submit]})]})]})]})]})}),k?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-xl border border-danger/25 bg-danger-soft px-4 py-3 text-sm text-danger`,children:[(0,Z.jsx)(`span`,{children:k}),(0,Z.jsx)(H,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void X(),children:n.workHome.retry})]}):null,E?(0,Z.jsx)(ze,{}):p?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,Z.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:n.workHome.briefingTitle}),(0,Z.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:p.decisions.length>0?Ie(n.workHome.todaySummary,{attention:p.decisions.length,moving:p.briefing.progress.movingCount+p.chats.running.length}):Ie(n.workHome.todaySummaryClear,{moving:p.briefing.progress.movingCount+p.chats.running.length})}),p.briefing.summary?(0,Z.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.briefing.summary}):null]}),Y?(0,Z.jsx)(`div`,{role:`status`,className:`rounded-xl border border-success/25 bg-success-soft px-4 py-3 text-sm text-success`,children:Y}):null,p.work.current.length===0&&p.workflowRuns.active.length===0&&p.decisions.length===0&&p.chats.running.length===0&&p.chats.recent.length===0&&p.upcomingAutomations.length===0&&y.length===0?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,Z.jsx)(D,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.workHome.emptyTitle}),(0,Z.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:n.workHome.emptyBody}),(0,Z.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,Z.jsx)(H,{type:`button`,variant:`primary`,onClick:()=>c(`/chat/new`),children:n.workHome.startChat}),(0,Z.jsx)(H,{type:`button`,variant:`secondary`,onClick:()=>U(!0),children:o.newWork})]})]}):null,(0,Z.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[Q.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(s,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.needsAttention}),(0,Z.jsx)(Re,{children:Q.length.toLocaleString()})]}),(0,Z.jsx)(`div`,{className:`mt-4 space-y-2`,children:Q.map(e=>(0,Z.jsx)(He,{item:e,kindLabel:n.workHome.decisionKinds[e.kind],reasonLabel:n.workHome.decisionReasons[e.reason],approveLabel:n.workHome.approve,denyLabel:n.workHome.deny,busy:ne===e.id,onRespond:t=>void ve(e,t)},e.id))})]}):(0,Z.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,Z.jsx)(`span`,{className:`flex size-5 items-center justify-center rounded-full bg-success-soft text-xs text-success`,"aria-hidden":!0,children:`✓`}),n.workHome.nothingNeedsYou]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(z,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.running}),(0,Z.jsx)(Re,{children:(p.chats.running.length+p.workflowRuns.active.length).toLocaleString()})]}),(0,Z.jsxs)(`div`,{className:`mt-4 divide-y divide-edge-subtle px-1`,children:[p.chats.running.map(e=>(0,Z.jsx)(`div`,{className:`py-1`,children:(0,Z.jsx)(Ve,{chat:e,statusLabel:n.workHome.running})},e.key)),p.workflowRuns.active.map(e=>(0,Z.jsxs)(a,{to:te(e.id),className:`flex items-center justify-between gap-3 rounded-lg px-2 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.title})]}),(0,Z.jsx)(`span`,{className:`shrink-0 text-xs text-fg-subtle`,children:n.workHome.running})]},e.id)),p.chats.running.length===0&&p.workflowRuns.active.length===0?(0,Z.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:o.emptyRunning}):null]})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(ee,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.continue}),(0,Z.jsx)(Re,{children:he.length.toLocaleString()})]}),(0,Z.jsxs)(`div`,{className:`mt-4 divide-y divide-edge-subtle px-1`,children:[he.map(e=>(0,Z.jsx)(`div`,{className:`py-1`,children:(0,Z.jsx)(Be,{item:e,statusLabel:t.projectDetailPage.workItems.statuses[e.status]})},e.id)),he.length===0?(0,Z.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:o.emptyContinue}):null]})]}),p.chats.recent.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.recent})}),(0,Z.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:p.chats.recent.slice(0,6).map(e=>(0,Z.jsx)(Ve,{chat:e,statusLabel:o.openChat},e.key))})]}):null]}),(0,Z.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":n.workHome.nowTitle,children:[(0,Z.jsx)(`div`,{className:`px-1`,children:(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.nowTitle})}),p.upcomingAutomations.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(re,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.workHome.scheduled})]}),(0,Z.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:p.upcomingAutomations.slice(0,3).map(e=>(0,Z.jsxs)(a,{to:`/automations`,className:`flex items-center justify-between gap-3 rounded-lg px-1 py-3 text-sm hover:bg-surface-hover/55`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,Z.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:Le(e.nextRunAt,n.never)})]},e.id))})]}):null,(0,Z.jsx)(ye,{}),p.briefing.wins.length>0?(0,Z.jsxs)(a,{to:p.briefing.wins[0].href,className:`flex items-center justify-between gap-3 rounded-xl px-2 py-2 text-sm text-fg-muted hover:bg-surface-hover/55 hover:text-fg`,children:[(0,Z.jsx)(`span`,{children:Ie(n.workHome.completedSummary,{count:p.briefing.wins.length})}),(0,Z.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[n.workHome.viewLatestResult,` →`]})]}):null]})]}),(0,Z.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(N,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.focuses}),(0,Z.jsx)(Re,{children:y.length.toLocaleString()})]}),y.length>0?(0,Z.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2`,children:y.slice(0,6).map(t=>(0,Z.jsx)(Me,{focus:t,language:e,busy:q===t.id,onMonitor:(e,n)=>void $(t.id,async()=>{await de(t.id,e,n)},n?r.monitorStarted:r.monitorStopped),onStatus:e=>void $(t.id,async()=>{await se(t.id,{status:e})}),onDelete:()=>{window.confirm(r.deleteConfirm)&&$(t.id,()=>le(t.id))}},t.id))}):(0,Z.jsxs)(`div`,{className:`py-8 text-center`,children:[(0,Z.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.empty}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.emptyHint})]})]}),S.length>0?(0,Z.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-5`,children:[(0,Z.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.candidates}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.candidatesHint}),(0,Z.jsx)(`div`,{className:`mt-4 space-y-2`,children:S.map(e=>(0,Z.jsxs)(`article`,{className:`flex flex-col gap-3 rounded-xl bg-surface-panel p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,Z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.summary})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,Z.jsx)(H,{variant:`ghost`,className:`h-8 text-xs`,disabled:q===e.id,onClick:()=>void $(e.id,async()=>{await ce(e.id,`dismiss`)}),children:r.dismiss}),(0,Z.jsx)(H,{variant:`primary`,className:`h-8 text-xs`,disabled:q===e.id,onClick:()=>void $(e.id,async()=>{await ce(e.id,`accept`)}),children:r.accept})]})]},e.id))})]}):null]}):null,(0,Z.jsxs)(`section`,{className:`border-t border-edge-subtle pt-7`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,Z.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.projects}),(0,Z.jsx)(a,{to:`/projects`,className:`text-xs font-medium text-accent hover:underline`,children:n.management.viewAll})]}),_.filter(e=>e.status!==`archived`).length>6?(0,Z.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,Z.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,Z.jsx)(B,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,Z.jsx)(`input`,{className:`h-9 w-52 rounded-lg border border-edge bg-surface-panel pl-9 pr-3 text-sm text-fg outline-none placeholder:text-fg-muted focus:border-accent`,value:j,onChange:e=>R(e.target.value),placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder})]})}):null,(0,Z.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:me.map(e=>(0,Z.jsx)(Ue,{project:e,openLabel:n.workHome.openSpace,noDescription:n.noDescription},e.id))}),!E&&me.length===0?(0,Z.jsx)(`p`,{className:`py-8 text-center text-sm text-fg-muted`,children:n.workHome.noSpaces}):null]})]})}export{We as WorkPage};
@@ -1,3 +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-BiBdO1-O.js";import{o,r as s}from"./locale-store-CAuhEGCn.js";import{Bo as c,G as l,Go as u,Ji as d,Ms as f,Sc as p,Ul as m,Uo as h,Vo as g,Wo as _,X as v,Ys as y,_u as b,ac as x,gt as S,hl as C,ht as w,is as T,ks as E,ns as D,ot as O,rc as k,sc as A,zo as j,zs as M}from"./index-eyttVNS_.js";var N=e(t(),1),P=n();function F(e){if(!e.trim())return null;try{return JSON.parse(e)}catch{return null}}function I(e){return typeof e.message==`string`&&e.message.trim()?e.message:typeof e.error==`string`&&e.error.trim()?e.error:e.error&&typeof e.error==`object`&&typeof e.error.message==`string`?e.error.message:`AI suggestion failed`}function L(e,t={}){let n=F(e.split(`
2
- `).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
3
- `));if(!n)return null;if(n.type===`text_delta`&&typeof n.delta==`string`)return t.onDelta?.(n.delta),null;if(n.type===`thinking_delta`&&typeof n.delta==`string`)return t.onThinkingDelta?.(n.delta),null;if(n.type===`done`&&typeof n.text==`string`)return n.text;if(n.type===`error`)throw Error(I(n));return null}async function R(e,t={}){let n=await o(s(`/api/ai/text-assist`),{method:`POST`,headers:{Accept:`text/event-stream`},body:JSON.stringify(e)});if(!n.ok){let e=await n.json().catch(()=>({})),t=typeof e.error==`string`?e.error:e.error?.message;throw Error(t||`AI suggestion failed (${n.status})`)}if(!n.body){let e=await n.json().catch(()=>null);if(e?.text)return e;throw Error(`AI suggestion stream is empty`)}let r=n.body.getReader(),i=new TextDecoder,a=``,c=``,l=``;for(;;){let{done:e,value:n}=await r.read();if(n){a+=i.decode(n,{stream:!e});let r=a.split(/\r?\n\r?\n/);a=r.pop()??``;for(let e of r){let n=L(e,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});n!==null&&(c=n)}}if(e)break}if(a.trim()){let e=L(a,{onDelta:e=>{c+=e,t.onDelta?.(e)},onThinkingDelta:e=>{l+=e,t.onThinkingDelta?.(e)}});e!==null&&(c=e)}let u=c.trim();if(!u)throw Error(`AI returned an empty suggestion`);return{text:u,thinking:l.trim()||void 0}}function ee(){let[e,t]=(0,N.useState)(``),[n,r]=(0,N.useState)(``),[i,a]=(0,N.useState)(!1),[o,s]=(0,N.useState)(null);return{suggestion:e,thinking:n,loading:i,error:o,generate:(0,N.useCallback)(async e=>{a(!0),s(null),t(``),r(``);try{let n=await R(e,{onDelta:e=>{t(t=>t+e)},onThinkingDelta:e=>{r(t=>t+e)}});return t(n.text),r(n.thinking??``),n.text}catch(e){return s(e instanceof Error?e.message:`AI suggestion failed`),null}finally{a(!1)}},[]),reset:(0,N.useCallback)(()=>{t(``),r(``),s(null),a(!1)},[])}}var z=r(),te=5;function ne(e){return e.startsWith(`zh`)?{title:`AI 优化文案`,buttonTitle:`优化文案`,current:`当前内容`,suggestion:`AI 建议`,editedSuggestion:`审核并编辑建议`,thinking:`模型思考`,thinkingLoading:`思考中`,edit:`编辑`,preview:`预览`,loading:`正在生成建议...`,empty:`暂无内容`,generate:`生成建议`,regenerate:`重新生成`,applyCurrent:`应用当前内容`,replace:`替换`,append:`追加`,cancel:`取消`,close:`关闭`}:{title:`AI text assist`,buttonTitle:`Improve text`,current:`Current`,suggestion:`Suggestion`,editedSuggestion:`Review and edit suggestion`,thinking:`Model thinking`,thinkingLoading:`Thinking`,edit:`Edit`,preview:`Preview`,loading:`Generating suggestion...`,empty:`No content`,generate:`Generate suggestion`,regenerate:`Regenerate`,applyCurrent:`Apply current`,replace:`Replace`,append:`Append`,cancel:`Cancel`,close:`Close`}}function B(e){let t=(0,P.c)(232),{value:n,onApply:r,fieldId:a,fieldLabel:o,scenario:s,format:l,intent:v,locale:y,context:S,disabled:C,className:w,showLabel:T}=e,D=s===void 0?`generic.text`:s,O=l===void 0?`plain`:l,A=v===void 0?`improve`:v,M=T===void 0?!0:T,[F,I]=(0,N.useState)(!1),[L,R]=(0,N.useState)(n),[B,V]=(0,N.useState)(`preview`),[H,U]=(0,N.useState)(``),[W,ae]=(0,N.useState)(`edit`),[G,K]=(0,N.useState)(!0),oe=(0,N.useRef)(null),se=(0,N.useRef)(!0),{suggestion:q,thinking:J,loading:Y,error:X,generate:ce,reset:le}=ee(),ue;t[0]===y?ue=t[1]:(ue=ne(y),t[0]=y,t[1]=ue);let Z=ue,de;t[2]!==Y||t[3]!==J?(de=Y&&J.trim().length>0,t[2]=Y,t[3]=J,t[4]=de):de=t[4];let Q=de,fe,pe;t[5]!==F||t[6]!==n?(fe=()=>{F||R(n)},pe=[F,n],t[5]=F,t[6]=n,t[7]=fe,t[8]=pe):(fe=t[7],pe=t[8]),(0,N.useEffect)(fe,pe);let me,he;t[9]===q?(me=t[10],he=t[11]):(he=()=>{U(q)},me=[q],t[9]=q,t[10]=me,t[11]=he),(0,N.useEffect)(he,me);let ge,_e;t[12]===J?(ge=t[13],_e=t[14]):(ge=()=>{J.trim()&&K(!0)},_e=[J],t[12]=J,t[13]=ge,t[14]=_e),(0,N.useEffect)(ge,_e);let ve;t[15]!==Q||t[16]!==G?(ve=()=>{let e=oe.current;!e||!Q||!G||se.current&&(e.scrollTop=e.scrollHeight)},t[15]=Q,t[16]=G,t[17]=ve):ve=t[17];let ye;t[18]!==Q||t[19]!==J||t[20]!==G?(ye=[Q,J,G],t[18]=Q,t[19]=J,t[20]=G,t[21]=ye):ye=t[21],(0,N.useLayoutEffect)(ve,ye);let be;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(be=()=>{let e=oe.current;e&&(se.current=e.scrollHeight-e.scrollTop-e.clientHeight<=te)},t[22]=be):be=t[22];let xe=be,Se;t[23]!==S||t[24]!==a||t[25]!==o||t[26]!==O||t[27]!==ce||t[28]!==A||t[29]!==y||t[30]!==D?(Se=async e=>{ae(`edit`),K(!0),se.current=!0,await ce({intent:A,scenario:D,input:e,locale:y,field:{id:a,label:o,format:O},context:S})},t[23]=S,t[24]=a,t[25]=o,t[26]=O,t[27]=ce,t[28]=A,t[29]=y,t[30]=D,t[31]=Se):Se=t[31];let Ce=Se,we;t[32]!==le||t[33]!==n?(we=()=>{R(n),V(`preview`),U(``),ae(`edit`),K(!0),le(),I(!0)},t[32]=le,t[33]=n,t[34]=we):we=t[34];let Te=we,Ee;t[35]!==L||t[36]!==Ce?(Ee=async()=>{await Ce(L)},t[35]=L,t[36]=Ce,t[37]=Ee):Ee=t[37];let De=Ee,Oe;t[38]!==le||t[39]!==n?(Oe=()=>{I(!1),R(n),V(`preview`),U(``),ae(`edit`),K(!0),le()},t[38]=le,t[39]=n,t[40]=Oe):Oe=t[40];let $=Oe,ke;t[41]!==$||t[42]!==L||t[43]!==r?(ke=()=>{r(L),$()},t[41]=$,t[42]=L,t[43]=r,t[44]=ke):ke=t[44];let Ae=ke,je;t[45]!==$||t[46]!==H||t[47]!==r?(je=()=>{H.trim()&&(r(H),$())},t[45]=$,t[46]=H,t[47]=r,t[48]=je):je=t[48];let Me=je,Ne;t[49]!==$||t[50]!==L||t[51]!==H||t[52]!==r?(Ne=()=>{if(!H.trim())return;let e=L.trimEnd();r(e?`${e}\n\n${H}`:H),$()},t[49]=$,t[50]=L,t[51]=H,t[52]=r,t[53]=Ne):Ne=t[53];let Pe=Ne,Fe;t[54]!==H||t[55]!==X||t[56]!==Y?(Fe=!Y&&!X&&H.trim().length>0,t[54]=H,t[55]=X,t[56]=Y,t[57]=Fe):Fe=t[57];let Ie=Fe,Le=L!==n,Re;t[58]!==H||t[59]!==X||t[60]!==J?(Re=H.trim().length>0||J.trim().length>0||!!X,t[58]=H,t[59]=X,t[60]=J,t[61]=Re):Re=t[61];let ze=Re,Be=!M&&`size-7 p-0`,Ve;t[62]!==w||t[63]!==Be?(Ve=i(`h-7 gap-1 px-2 text-xs`,Be,w),t[62]=w,t[63]=Be,t[64]=Ve):Ve=t[64];let He=C||Y,Ue;t[65]===Symbol.for(`react.memo_cache_sentinel`)?(Ue=(0,z.jsx)(x,{className:`size-3.5`,strokeWidth:1.75,"aria-hidden":!0}),t[65]=Ue):Ue=t[65];let We=M?Z.buttonTitle:null,Ge;t[66]!==Z.buttonTitle||t[67]!==Te||t[68]!==Ve||t[69]!==He||t[70]!==We?(Ge=(0,z.jsxs)(E,{type:`button`,variant:`ghost`,className:Ve,title:Z.buttonTitle,"aria-label":Z.buttonTitle,disabled:He,onClick:Te,children:[Ue,We]}),t[66]=Z.buttonTitle,t[67]=Te,t[68]=Ve,t[69]=He,t[70]=We,t[71]=Ge):Ge=t[71];let Ke;t[72]===$?Ke=t[73]:(Ke=e=>e?I(!0):$(),t[72]=$,t[73]=Ke);let qe;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(qe=(0,z.jsx)(h,{className:`xopc-dialog-overlay fixed inset-0 z-[80] bg-scrim`}),t[74]=qe):qe=t[74];let Je;t[75]===Z.title?Je=t[76]:(Je=(0,z.jsx)(u,{className:`text-base font-semibold text-fg`,children:Z.title}),t[75]=Z.title,t[76]=Je);let Ye;t[77]===Symbol.for(`react.memo_cache_sentinel`)?(Ye=(0,z.jsx)(f,{className:`size-5`,strokeWidth:1.75}),t[77]=Ye):Ye=t[77];let Xe;t[78]===Z.close?Xe=t[79]:(Xe=(0,z.jsx)(c,{asChild:!0,children:(0,z.jsx)(E,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":Z.close,children:Ye})}),t[78]=Z.close,t[79]=Xe);let Ze;t[80]!==Je||t[81]!==Xe?(Ze=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge px-4 py-3`,children:[Je,Xe]}),t[80]=Je,t[81]=Xe,t[82]=Ze):Ze=t[82];let Qe;t[83]===Z.current?Qe=t[84]:(Qe=(0,z.jsx)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:Z.current}),t[83]=Z.current,t[84]=Qe);let $e=B===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,et;t[85]===$e?et=t[86]:(et=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,$e),t[85]=$e,t[86]=et);let tt,nt;t[87]===Symbol.for(`react.memo_cache_sentinel`)?(tt=()=>V(`edit`),nt=(0,z.jsx)(k,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[87]=tt,t[88]=nt):(tt=t[87],nt=t[88]);let rt;t[89]!==Z.edit||t[90]!==et?(rt=(0,z.jsxs)(`button`,{type:`button`,className:et,onClick:tt,children:[nt,Z.edit]}),t[89]=Z.edit,t[90]=et,t[91]=rt):rt=t[91];let it=B===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,at;t[92]===it?at=t[93]:(at=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,it),t[92]=it,t[93]=at);let ot,st;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(ot=()=>V(`preview`),st=(0,z.jsx)(m,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[94]=ot,t[95]=st):(ot=t[94],st=t[95]);let ct;t[96]!==Z.preview||t[97]!==at?(ct=(0,z.jsxs)(`button`,{type:`button`,className:at,onClick:ot,children:[st,Z.preview]}),t[96]=Z.preview,t[97]=at,t[98]=ct):ct=t[98];let lt;t[99]!==rt||t[100]!==ct?(lt=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[rt,ct]}),t[99]=rt,t[100]=ct,t[101]=lt):lt=t[101];let ut;t[102]!==Qe||t[103]!==lt?(ut=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[Qe,lt]}),t[102]=Qe,t[103]=lt,t[104]=ut):ut=t[104];let dt;t[105]!==L||t[106]!==B||t[107]!==O||t[108]!==Z.current||t[109]!==Z.empty?(dt=B===`preview`?(0,z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:O===`markdown`?(0,z.jsx)(d,{content:L||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:L||Z.empty})}):(0,z.jsx)(`textarea`,{className:`min-h-0 flex-1 resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25`,value:L,onChange:e=>R(e.currentTarget.value),placeholder:Z.empty,"aria-label":Z.current}),t[105]=L,t[106]=B,t[107]=O,t[108]=Z.current,t[109]=Z.empty,t[110]=dt):dt=t[110];let ft;t[111]!==ut||t[112]!==dt?(ft=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[ut,dt]}),t[111]=ut,t[112]=dt,t[113]=ft):ft=t[113];let pt;t[114]===Z.editedSuggestion?pt=t[115]:(pt=(0,z.jsx)(`span`,{children:Z.editedSuggestion}),t[114]=Z.editedSuggestion,t[115]=pt);let mt;t[116]!==Z.loading||t[117]!==Y?(mt=Y?(0,z.jsx)(`span`,{className:`ml-2 font-normal`,children:Z.loading}):null,t[116]=Z.loading,t[117]=Y,t[118]=mt):mt=t[118];let ht;t[119]!==pt||t[120]!==mt?(ht=(0,z.jsxs)(`div`,{className:`min-w-0 text-xs font-medium text-fg-muted`,children:[pt,mt]}),t[119]=pt,t[120]=mt,t[121]=ht):ht=t[121];let gt=W===`edit`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,_t;t[122]===gt?_t=t[123]:(_t=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,gt),t[122]=gt,t[123]=_t);let vt,yt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(vt=()=>ae(`edit`),yt=(0,z.jsx)(k,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[124]=vt,t[125]=yt):(vt=t[124],yt=t[125]);let bt;t[126]!==Z.edit||t[127]!==_t?(bt=(0,z.jsxs)(`button`,{type:`button`,className:_t,onClick:vt,children:[yt,Z.edit]}),t[126]=Z.edit,t[127]=_t,t[128]=bt):bt=t[128];let xt=W===`preview`?`bg-surface-panel text-fg shadow-surface`:`text-fg-muted hover:bg-surface-hover`,St;t[129]===xt?St=t[130]:(St=i(`inline-flex h-7 items-center gap-1.5 rounded-md px-2 text-xs font-medium`,xt),t[129]=xt,t[130]=St);let Ct,wt;t[131]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=()=>ae(`preview`),wt=(0,z.jsx)(m,{className:`size-3.5 shrink-0`,strokeWidth:1.75,"aria-hidden":!0}),t[131]=Ct,t[132]=wt):(Ct=t[131],wt=t[132]);let Tt;t[133]!==Z.preview||t[134]!==St?(Tt=(0,z.jsxs)(`button`,{type:`button`,className:St,onClick:Ct,children:[wt,Z.preview]}),t[133]=Z.preview,t[134]=St,t[135]=Tt):Tt=t[135];let Et;t[136]!==bt||t[137]!==Tt?(Et=(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 rounded-lg border border-edge bg-surface-muted p-0.5`,children:[bt,Tt]}),t[136]=bt,t[137]=Tt,t[138]=Et):Et=t[138];let Dt;t[139]!==ht||t[140]!==Et?(Dt=(0,z.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-2`,children:[ht,Et]}),t[139]=ht,t[140]=Et,t[141]=Dt):Dt=t[141];let Ot=Q?`opacity-100`:`pointer-events-none opacity-0`,kt;t[142]===Ot?kt=t[143]:(kt=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Ot),t[142]=Ot,t[143]=kt);let At=!Q,jt;t[144]===Symbol.for(`react.memo_cache_sentinel`)?(jt=()=>K(re),t[144]=jt):jt=t[144];let Mt;t[145]!==Z.thinkingLoading||t[146]!==Y?(Mt=Y?(0,z.jsxs)(`span`,{className:`ml-1 font-normal`,children:[`· `,Z.thinkingLoading]}):null,t[145]=Z.thinkingLoading,t[146]=Y,t[147]=Mt):Mt=t[147];let Nt;t[148]!==Z.thinking||t[149]!==Mt?(Nt=(0,z.jsxs)(`span`,{className:`min-w-0 truncate`,children:[Z.thinking,Mt]}),t[148]=Z.thinking,t[149]=Mt,t[150]=Nt):Nt=t[150];let Pt=G&&`rotate-180`,Ft;t[151]===Pt?Ft=t[152]:(Ft=i(`size-3.5 shrink-0 transition-transform`,Pt),t[151]=Pt,t[152]=Ft);let It;t[153]===Ft?It=t[154]:(It=(0,z.jsx)(b,{className:Ft,strokeWidth:1.75,"aria-hidden":!0}),t[153]=Ft,t[154]=It);let Lt;t[155]!==Nt||t[156]!==It?(Lt=(0,z.jsxs)(`button`,{type:`button`,className:`flex shrink-0 items-center justify-between gap-2 px-2.5 py-2 text-left text-xs font-medium text-fg-muted hover:text-fg`,onClick:jt,children:[Nt,It]}),t[155]=Nt,t[156]=It,t[157]=Lt):Lt=t[157];let Rt;t[158]!==J||t[159]!==G?(Rt=G?(0,z.jsx)(`pre`,{ref:oe,className:`min-h-0 flex-1 overflow-auto border-t border-edge px-2.5 py-2 whitespace-pre-wrap text-xs leading-5 text-fg-muted`,onScroll:xe,children:J}):null,t[158]=J,t[159]=G,t[160]=Rt):Rt=t[160];let zt;t[161]!==Lt||t[162]!==Rt?(zt=(0,z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col rounded-lg border border-edge bg-surface-muted/70`,children:[Lt,Rt]}),t[161]=Lt,t[162]=Rt,t[163]=zt):zt=t[163];let Bt;t[164]!==kt||t[165]!==At||t[166]!==zt?(Bt=(0,z.jsx)(`div`,{className:kt,"aria-hidden":At,children:zt}),t[164]=kt,t[165]=At,t[166]=zt,t[167]=Bt):Bt=t[167];let Vt=Q?`pointer-events-none opacity-0`:`opacity-100`,Ht;t[168]===Vt?Ht=t[169]:(Ht=i(`absolute inset-0 min-h-0 transition-opacity duration-200 ease-out motion-reduce:transition-none`,Vt),t[168]=Vt,t[169]=Ht);let Ut;t[170]!==H||t[171]!==X||t[172]!==O||t[173]!==Z.empty||t[174]!==Z.loading||t[175]!==Z.suggestion||t[176]!==Y||t[177]!==W?(Ut=X?(0,z.jsx)(`pre`,{className:`h-full min-h-0 overflow-auto whitespace-pre-wrap rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg-muted`,children:X}):W===`preview`?(0,z.jsx)(`div`,{className:`h-full min-h-0 overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg`,children:Y&&!H.trim()?(0,z.jsx)(`p`,{className:`text-sm text-fg-muted`,children:Z.loading}):O===`markdown`?(0,z.jsx)(d,{content:H||Z.empty,compact:!0,className:`text-sm`}):(0,z.jsx)(`pre`,{className:`whitespace-pre-wrap text-sm leading-6 text-fg`,children:H||Z.empty})}):(0,z.jsx)(`textarea`,{className:`h-full min-h-0 w-full resize-none overflow-auto rounded-lg border border-edge bg-surface-base p-3 text-sm leading-6 text-fg outline-none focus:border-accent focus:ring-2 focus:ring-accent/25 disabled:text-fg-muted`,value:H,onChange:e=>U(e.currentTarget.value),disabled:Y,placeholder:Y?Z.loading:Z.empty,"aria-label":Z.suggestion}),t[170]=H,t[171]=X,t[172]=O,t[173]=Z.empty,t[174]=Z.loading,t[175]=Z.suggestion,t[176]=Y,t[177]=W,t[178]=Ut):Ut=t[178];let Wt;t[179]!==Ht||t[180]!==Ut?(Wt=(0,z.jsx)(`div`,{className:Ht,children:Ut}),t[179]=Ht,t[180]=Ut,t[181]=Wt):Wt=t[181];let Gt;t[182]!==Bt||t[183]!==Wt?(Gt=(0,z.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-hidden`,children:[Bt,Wt]}),t[182]=Bt,t[183]=Wt,t[184]=Gt):Gt=t[184];let Kt;t[185]!==Dt||t[186]!==Gt?(Kt=(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-hidden`,children:[Dt,Gt]}),t[185]=Dt,t[186]=Gt,t[187]=Kt):Kt=t[187];let qt;t[188]!==ft||t[189]!==Kt?(qt=(0,z.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 gap-3 overflow-hidden p-4 md:grid-cols-2`,children:[ft,Kt]}),t[188]=ft,t[189]=Kt,t[190]=qt):qt=t[190];let Jt;t[191]!==$||t[192]!==Z.cancel?(Jt=(0,z.jsx)(E,{type:`button`,variant:`secondary`,onClick:$,children:Z.cancel}),t[191]=$,t[192]=Z.cancel,t[193]=Jt):Jt=t[193];let Yt=!Le,Xt;t[194]!==Ae||t[195]!==Z.applyCurrent||t[196]!==Yt?(Xt=(0,z.jsx)(E,{type:`button`,variant:`secondary`,disabled:Yt,onClick:Ae,children:Z.applyCurrent}),t[194]=Ae,t[195]=Z.applyCurrent,t[196]=Yt,t[197]=Xt):Xt=t[197];let Zt;t[198]===De?Zt=t[199]:(Zt=()=>void De(),t[198]=De,t[199]=Zt);let Qt;t[200]===ze?Qt=t[201]:(Qt=ze?(0,z.jsx)(p,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}):(0,z.jsx)(x,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0}),t[200]=ze,t[201]=Qt);let $t=ze?Z.regenerate:Z.generate,en;t[202]!==Y||t[203]!==Zt||t[204]!==Qt||t[205]!==$t?(en=(0,z.jsxs)(E,{type:`button`,variant:`secondary`,disabled:Y,onClick:Zt,children:[Qt,$t]}),t[202]=Y,t[203]=Zt,t[204]=Qt,t[205]=$t,t[206]=en):en=t[206];let tn=!Ie,nn;t[207]!==Pe||t[208]!==Z.append||t[209]!==tn?(nn=(0,z.jsx)(E,{type:`button`,variant:`secondary`,disabled:tn,onClick:Pe,children:Z.append}),t[207]=Pe,t[208]=Z.append,t[209]=tn,t[210]=nn):nn=t[210];let rn=!Ie,an;t[211]!==Me||t[212]!==Z.replace||t[213]!==rn?(an=(0,z.jsx)(E,{type:`button`,variant:`primary`,disabled:rn,onClick:Me,children:Z.replace}),t[211]=Me,t[212]=Z.replace,t[213]=rn,t[214]=an):an=t[214];let on;t[215]!==Jt||t[216]!==Xt||t[217]!==en||t[218]!==nn||t[219]!==an?(on=(0,z.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-4 py-3`,children:[Jt,Xt,en,nn,an]}),t[215]=Jt,t[216]=Xt,t[217]=en,t[218]=nn,t[219]=an,t[220]=on):on=t[220];let sn;t[221]!==Ze||t[222]!==qt||t[223]!==on?(sn=(0,z.jsxs)(_,{children:[qe,(0,z.jsx)(`div`,{className:`fixed inset-0 z-[80] flex items-center justify-center p-4 pointer-events-none`,children:(0,z.jsxs)(g,{className:`xopc-dialog-content-pane pointer-events-auto flex h-[min(78vh,38rem)] w-full max-w-4xl flex-col overflow-hidden rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`,onOpenAutoFocus:ie,children:[Ze,qt,on]})})]}),t[221]=Ze,t[222]=qt,t[223]=on,t[224]=sn):sn=t[224];let cn;t[225]!==F||t[226]!==Ke||t[227]!==sn?(cn=(0,z.jsx)(j,{open:F,onOpenChange:Ke,children:sn}),t[225]=F,t[226]=Ke,t[227]=sn,t[228]=cn):cn=t[228];let ln;return t[229]!==cn||t[230]!==Ge?(ln=(0,z.jsxs)(z.Fragment,{children:[Ge,cn]}),t[229]=cn,t[230]=Ge,t[231]=ln):ln=t[231],ln}function re(e){return!e}function ie(e){return e.preventDefault()}function V(e){return!!(e&&e.type===`object`&&e.properties&&!Array.isArray(e.properties))}function H(e){let t=e.properties??{},n=new Set(e.required??[]);return Object.entries(t).map(([e,t])=>({key:e,schema:t,required:n.has(e)}))}function U(e,t){return!V(e)||!e?!0:H(e).every(e=>{if(!e.required)return!0;let n=t[e.key];return n==null?!1:typeof n==`string`?n.trim().length>0:!0})}function W(e,t){if(e)return V(e.inputSchema)?Object.keys(t.schemaInput).length>0?t.schemaInput:void 0:l(t.argValues)}function ae(e,t,n){let r=a(t).workflows;if(!e)return r.noInputSummary;let i=S(e,t);if(V(e.inputSchema)&&Object.keys(n.schemaInput).length>0)return Object.entries(n.schemaInput).map(([e,t])=>`${e}: ${String(t)}`).join(` · `);let o=Object.values(n.argValues).map(e=>e.trim()).filter(Boolean),s=n.goal.trim()||i.description;return s&&o.unshift(s),o.length>0?o.join(` · `):r.noInputSummary}function G(e,t,n=!0){return e?n?V(e.inputSchema)?U(e.inputSchema,t.schemaInput)?{valid:!0}:{valid:!1,reason:`schema-required`}:{valid:(O[e.name]??[]).every(e=>!e.required||!!t.argValues[e.key]?.trim())}:{valid:!1,reason:`raw-json`}:{valid:!1}}function K(e,t){return e[t]??t}function oe(e,t){let n=O[e]??[];if(n.length===0)return{};let r=t&&typeof t==`object`&&!Array.isArray(t)?t:{},i={};for(let e of n){let t=r[e.key];t!=null&&(i[e.key]=String(t))}return i}function se(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function q(e){let t=(0,P.c)(34),{workflowName:n,language:r,argValues:o,onArgValuesChange:s,goal:c,onGoalChange:l,examplePrompts:u,showGoal:d,inputClassName:f,aiAssist:p}=e,m;t[0]===u?m=t[1]:(m=u===void 0?[]:u,t[0]=u,t[1]=m);let h=m,g=d===void 0?!0:d,_,v,y,b,x,S,C;if(t[2]!==p||t[3]!==o||t[4]!==h||t[5]!==c||t[6]!==f||t[7]!==r||t[8]!==s||t[9]!==l||t[10]!==g||t[11]!==n){y=a(r).workflows;let e=O[n]??[];v=e.length>0;let u=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,f),d;t[19]!==o||t[20]!==s||t[21]!==l?(d=e=>{w(e,l,e=>{s(e(o))})},t[19]=o,t[20]=s,t[21]=l,t[22]=d):d=t[22],_=d,b=`flex flex-col gap-3`,x=e.map(e=>{let t=K(y.args,e.labelKey),a=K(y.args,e.placeholderKey),c=o[e.key]??``;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg-muted`,children:[t,e.required?` *`:``]}),e.multiline&&p?(0,z.jsx)(B,{value:c,onApply:t=>s({...o,[e.key]:t}),fieldId:`workflow.arg.${e.key}`,fieldLabel:t,scenario:p.argScenario??`workflow.arg`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o,fieldKey:e.key},disabled:p.disabled,showLabel:!1}):null]}),e.multiline?(0,z.jsx)(`textarea`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:i(u,`min-h-20 resize-y`)}):(0,z.jsx)(`input`,{value:c,onChange:t=>s({...o,[e.key]:t.target.value}),placeholder:a,className:u})]},e.key)}),S=v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,C=g?(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:y.goalLabel}),p?(0,z.jsx)(B,{value:c,onApply:l,fieldId:`workflow.goal`,fieldLabel:y.goalLabel,scenario:p.goalScenario??`cron.workflowGoal`,locale:r,context:{...p.context,workflowName:n,workflowArgs:o},disabled:p.disabled,showLabel:!1}):null]}),(0,z.jsx)(`textarea`,{value:c,onChange:e=>l(e.target.value),placeholder:y.goalPlaceholder,className:i(u,`min-h-20 resize-y`)})]}):null,t[2]=p,t[3]=o,t[4]=h,t[5]=c,t[6]=f,t[7]=r,t[8]=s,t[9]=l,t[10]=g,t[11]=n,t[12]=_,t[13]=v,t[14]=y,t[15]=b,t[16]=x,t[17]=S,t[18]=C}else _=t[12],v=t[13],y=t[14],b=t[15],x=t[16],S=t[17],C=t[18];let T;t[23]!==_||t[24]!==h||t[25]!==v||t[26]!==y?(T=!v&&h.length>0?(0,z.jsx)(se,{examples:h,labels:y,onSelect:_}):null,t[23]=_,t[24]=h,t[25]=v,t[26]=y,t[27]=T):T=t[27];let E;return t[28]!==b||t[29]!==x||t[30]!==S||t[31]!==C||t[32]!==T?(E=(0,z.jsxs)(`div`,{className:b,children:[x,S,C,T]}),t[28]=b,t[29]=x,t[30]=S,t[31]=C,t[32]=T,t[33]=E):E=t[33],E}var J=`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`;function Y({schema:e,value:t,onChange:n,labels:r,aiAssist:a,onValidChange:o}){let s=(0,N.useMemo)(()=>H(e),[e]),[c,l]=(0,N.useState)(!1),[u,d]=(0,N.useState)(()=>JSON.stringify(t,null,2)),[f,p]=(0,N.useState)(null);if(s.length===0)return null;let m=(e,r)=>{let i={...t,[e]:r};(r===``||r===void 0)&&delete i[e],n(i),c&&d(JSON.stringify(i,null,2))},h=e=>{d(e);try{let t=e.trim()?JSON.parse(e):{};if(!t||typeof t!=`object`||Array.isArray(t)){p(r.rawJsonInvalid),o?.(!1);return}p(null),n(t),o?.(!0,t)}catch{p(r.rawJsonInvalid),o?.(!1)}};return(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel/70 p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:r.inputSchemaHeading}),(0,z.jsx)(`button`,{type:`button`,className:`text-xs font-medium text-accent-fg hover:underline`,onClick:()=>{let e=!c;l(e),e&&(d(JSON.stringify(t,null,2)),p(null),o?.(!0))},children:r.rawJson})]}),c?(0,z.jsxs)(`div`,{className:`mt-3`,children:[(0,z.jsx)(`textarea`,{value:u,onChange:e=>h(e.target.value),spellCheck:!1,className:i(J,`min-h-40 font-mono text-xs leading-5`)}),f?(0,z.jsx)(`p`,{className:`mt-1 text-xs text-red-600 dark:text-red-300`,children:f}):null]}):(0,z.jsx)(`div`,{className:`mt-3 grid gap-3`,children:s.map(e=>(0,z.jsx)(X,{field:e,value:t[e.key],labels:r,aiAssist:a,allValues:t,onChange:t=>m(e.key,t)},e.key))})]})}function X(e){let t=(0,P.c)(30),{field:n,value:r,labels:a,aiAssist:o,allValues:s,onChange:c}=e,l=n.schema.title||n.key,u=typeof n.schema.description==`string`?n.schema.description:void 0,d=Array.isArray(n.schema.type)?n.schema.type[0]:n.schema.type,f;t[0]===n.schema.enum?f=t[1]:(f=Array.isArray(n.schema.enum)?n.schema.enum:[],t[0]=n.schema.enum,t[1]=f);let p=f,m=!!o&&!p.length&&(d===`string`||!d),h=String(l),g=n.required?` *`:``,_;t[2]!==h||t[3]!==g?(_=(0,z.jsxs)(`span`,{className:`text-xs font-medium text-fg`,children:[h,g]}),t[2]=h,t[3]=g,t[4]=_):_=t[4];let v;t[5]!==o||t[6]!==s||t[7]!==n.key||t[8]!==n.schema||t[9]!==c||t[10]!==m||t[11]!==l||t[12]!==r?(v=m&&o?(0,z.jsx)(B,{value:typeof r==`string`?r:r==null?``:String(r),onApply:c,fieldId:`workflow.schema.${n.key}`,fieldLabel:String(l),scenario:o.scenario??`workflow.arg`,locale:o.locale,context:{...o.context,fieldKey:n.key,fieldSchema:n.schema,inputValues:s},disabled:o.disabled,showLabel:!1}):null,t[5]=o,t[6]=s,t[7]=n.key,t[8]=n.schema,t[9]=c,t[10]=m,t[11]=l,t[12]=r,t[13]=v):v=t[13];let y;t[14]!==_||t[15]!==v?(y=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[_,v]}),t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===u?b=t[18]:(b=u?(0,z.jsx)(`p`,{className:`mt-0.5 text-xs leading-5 text-fg-subtle`,children:u}):null,t[17]=u,t[18]=b);let x;t[19]!==u||t[20]!==p||t[21]!==a||t[22]!==c||t[23]!==d||t[24]!==r?(x=p.length>0?(0,z.jsxs)(D,{value:r==null?``:String(r),onChange:e=>c(e.target.value),className:J,children:[(0,z.jsx)(T,{value:``}),p.map(ce)]}):d===`boolean`?(0,z.jsxs)(D,{value:typeof r==`boolean`?String(r):``,onChange:e=>c(e.target.value===``?void 0:e.target.value===`true`),className:J,children:[(0,z.jsx)(T,{value:``}),(0,z.jsx)(T,{value:`true`,children:a.booleanTrue}),(0,z.jsx)(T,{value:`false`,children:a.booleanFalse})]}):d===`number`||d===`integer`?(0,z.jsx)(`input`,{type:`number`,value:typeof r==`number`||typeof r==`string`?String(r):``,onChange:e=>c(e.target.value===``?void 0:Number(e.target.value)),className:J}):(0,z.jsx)(`textarea`,{value:typeof r==`string`?r:r==null?``:String(r),onChange:e=>c(e.target.value),className:i(J,u&&u.length>80?`min-h-20 resize-y`:`min-h-10 resize-y`)}),t[19]=u,t[20]=p,t[21]=a,t[22]=c,t[23]=d,t[24]=r,t[25]=x):x=t[25];let S;return t[26]!==y||t[27]!==b||t[28]!==x?(S=(0,z.jsxs)(`div`,{className:`block`,children:[y,b,x]}),t[26]=y,t[27]=b,t[28]=x,t[29]=S):S=t[29],S}function ce(e){return(0,z.jsx)(T,{value:String(e),children:String(e)},String(e))}function le(e){let t=(0,P.c)(12),{examples:n,labels:r,onSelect:i}=e;if(n.length===0)return null;let a;t[0]===r.examplePrompts?a=t[1]:(a=(0,z.jsx)(`div`,{className:`text-xs font-medium text-fg-muted`,children:r.examplePrompts}),t[0]=r.examplePrompts,t[1]=a);let o;if(t[2]!==n||t[3]!==i){let e;t[5]===i?e=t[6]:(e=e=>(0,z.jsx)(`button`,{type:`button`,onClick:()=>i(e),className:`rounded-lg border border-edge bg-surface-base/50 px-3 py-2 text-left text-xs text-fg-muted hover:bg-surface-hover`,children:e.text},`${e.field}:${e.text}`),t[5]=i,t[6]=e),o=n.map(e),t[2]=n,t[3]=i,t[4]=o}else o=t[4];let s;t[7]===o?s=t[8]:(s=(0,z.jsx)(`div`,{className:`mt-2 flex flex-col gap-1.5`,children:o}),t[7]=o,t[8]=s);let c;return t[9]!==a||t[10]!==s?(c=(0,z.jsxs)(`div`,{children:[a,s]}),t[9]=a,t[10]=s,t[11]=c):c=t[11],c}function ue(e){let t=(0,P.c)(114),{definition:n,language:r,value:o,onChange:s,aiAssist:c,inputClassName:l,onValidityChange:u}=e,d;t[0]===r?d=t[1]:(d=a(r),t[0]=r,t[1]=d);let f=d.workflows,p;t[2]!==n||t[3]!==r?(p=S(n,r),t[2]=n,t[3]=r,t[4]=p):p=t[4];let m=p,[h,g]=(0,N.useState)(!0),_;t[5]===m.examplePrompts?_=t[6]:(_=m.examplePrompts??[],t[5]=m.examplePrompts,t[6]=_);let v=_,y;t[7]===n.inputSchema?y=t[8]:(y=V(n.inputSchema),t[7]=n.inputSchema,t[8]=y);let b=y,x,C,w,T,E,D,O,k,A,j;if(t[9]!==c||t[10]!==n||t[11]!==v||t[12]!==b||t[13]!==l||t[14]!==f||t[15]!==r||t[16]!==m.description||t[17]!==s||t[18]!==u||t[19]!==h||t[20]!==o){E=Symbol.for(`react.early_return_sentinel`);bb0:{let e=i(`mt-1.5 w-full rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`,l),a;t[31]!==n||t[32]!==s||t[33]!==u||t[34]!==h?(a=(e,t)=>{let r=t===void 0?h:t;s(e),u?.(G(n,e,r))},t[31]=n,t[32]=s,t[33]=u,t[34]=h,t[35]=a):a=t[35];let d=a,p;t[36]!==d||t[37]!==o?(p=e=>d({...o,goal:e}),t[36]=d,t[37]=o,t[38]=p):p=t[38];let _=p,y;t[39]!==d||t[40]!==o?(y=e=>d({...o,schemaInput:e}),t[39]=d,t[40]=o,t[41]=y):y=t[41];let S=y,M;t[42]!==d||t[43]!==o?(M=e=>d({...o,argValues:e}),t[42]=d,t[43]=o,t[44]=M):M=t[44];let N=M,P;if(t[45]!==_||t[46]!==S||t[47]!==o.schemaInput?(P=e=>{if(e.field===`goal`){_(e.text);return}S({...o.schemaInput,[e.field]:e.text})},t[45]=_,t[46]=S,t[47]=o.schemaInput,t[48]=P):P=t[48],x=P,!b){let e;t[49]!==c||t[50]!==n.id||t[51]!==n.name||t[52]!==n.title||t[53]!==m.description?(e=c?{disabled:c.disabled,argScenario:c.inputScenario??`workflow.arg`,goalScenario:c.goalScenario??`workflow.goal`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,t[49]=c,t[50]=n.id,t[51]=n.name,t[52]=n.title,t[53]=m.description,t[54]=e):e=t[54];let i;t[55]!==n.name||t[56]!==v||t[57]!==l||t[58]!==r||t[59]!==N||t[60]!==_||t[61]!==e||t[62]!==o.argValues||t[63]!==o.goal?(i=(0,z.jsx)(q,{workflowName:n.name,language:r,argValues:o.argValues,onArgValuesChange:N,goal:o.goal,onGoalChange:_,examplePrompts:v,inputClassName:l,aiAssist:e}),t[55]=n.name,t[56]=v,t[57]=l,t[58]=r,t[59]=N,t[60]=_,t[61]=e,t[62]=o.argValues,t[63]=o.goal,t[64]=i):i=t[64],E=i;break bb0}w=`flex flex-col gap-3`,t[65]!==c||t[66]!==n||t[67]!==f.booleanFalse||t[68]!==f.booleanTrue||t[69]!==f.inputSchemaHeading||t[70]!==f.rawJson||t[71]!==f.rawJsonInvalid||t[72]!==r||t[73]!==m.description||t[74]!==u||t[75]!==S||t[76]!==o?(T=n.inputSchema?(0,z.jsx)(Y,{schema:n.inputSchema,value:o.schemaInput,onChange:S,onValidChange:(e,t)=>{g(e),u?.(G(n,t?{...o,schemaInput:t}:o,e))},aiAssist:c?{locale:r,disabled:c.disabled,scenario:c.inputScenario??`workflow.arg`,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description}}:void 0,labels:{inputSchemaHeading:f.inputSchemaHeading,rawJson:f.rawJson,rawJsonInvalid:f.rawJsonInvalid,booleanTrue:f.booleanTrue,booleanFalse:f.booleanFalse}}):null,t[65]=c,t[66]=n,t[67]=f.booleanFalse,t[68]=f.booleanTrue,t[69]=f.inputSchemaHeading,t[70]=f.rawJson,t[71]=f.rawJsonInvalid,t[72]=r,t[73]=m.description,t[74]=u,t[75]=S,t[76]=o,t[77]=T):T=t[77],j=`flex flex-col gap-1`;let F;t[78]===f.goalLabel?F=t[79]:(F=(0,z.jsx)(`span`,{className:`text-xs font-medium text-fg-muted`,children:f.goalLabel}),t[78]=f.goalLabel,t[79]=F);let I;t[80]!==c||t[81]!==n.id||t[82]!==n.name||t[83]!==n.title||t[84]!==f.goalLabel||t[85]!==r||t[86]!==m.description||t[87]!==_||t[88]!==o.goal||t[89]!==o.schemaInput?(I=c?(0,z.jsx)(B,{value:o.goal,onApply:_,fieldId:`workflow.goal`,fieldLabel:f.goalLabel,scenario:c.goalScenario??`workflow.goal`,locale:r,context:{...c.context,workflowId:n.id,workflowName:n.name,workflowTitle:n.title,workflowDescription:m.description,workflowInput:o.schemaInput},disabled:c.disabled,showLabel:!1}):null,t[80]=c,t[81]=n.id,t[82]=n.name,t[83]=n.title,t[84]=f.goalLabel,t[85]=r,t[86]=m.description,t[87]=_,t[88]=o.goal,t[89]=o.schemaInput,t[90]=I):I=t[90],t[91]!==F||t[92]!==I?(C=(0,z.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[F,I]}),t[91]=F,t[92]=I,t[93]=C):C=t[93],D=o.goal,t[94]===_?O=t[95]:(O=e=>_(e.target.value),t[94]=_,t[95]=O),k=f.goalPlaceholder,A=i(e,`min-h-20 resize-y`)}t[9]=c,t[10]=n,t[11]=v,t[12]=b,t[13]=l,t[14]=f,t[15]=r,t[16]=m.description,t[17]=s,t[18]=u,t[19]=h,t[20]=o,t[21]=x,t[22]=C,t[23]=w,t[24]=T,t[25]=E,t[26]=D,t[27]=O,t[28]=k,t[29]=A,t[30]=j}else x=t[21],C=t[22],w=t[23],T=t[24],E=t[25],D=t[26],O=t[27],k=t[28],A=t[29],j=t[30];if(E!==Symbol.for(`react.early_return_sentinel`))return E;let M;t[96]!==D||t[97]!==O||t[98]!==k||t[99]!==A?(M=(0,z.jsx)(`textarea`,{value:D,onChange:O,placeholder:k,className:A}),t[96]=D,t[97]=O,t[98]=k,t[99]=A,t[100]=M):M=t[100];let F;t[101]!==C||t[102]!==M||t[103]!==j?(F=(0,z.jsxs)(`div`,{className:j,children:[C,M]}),t[101]=C,t[102]=M,t[103]=j,t[104]=F):F=t[104];let I;t[105]!==x||t[106]!==v||t[107]!==f?(I=(0,z.jsx)(le,{examples:v,labels:f,onSelect:x}),t[105]=x,t[106]=v,t[107]=f,t[108]=I):I=t[108];let L;return t[109]!==w||t[110]!==T||t[111]!==F||t[112]!==I?(L=(0,z.jsxs)(`div`,{className:w,children:[T,F,I]}),t[109]=w,t[110]=T,t[111]=F,t[112]=I,t[113]=L):L=t[113],L}function Z(e,t){let n=e.metadata.estimatedAgents;return n?n.min===n.max?v(t.agentScaleExact,{count:n.min}):v(t.agentScaleRange,{min:n.min,max:n.max}):v(t.agentScaleExact,{count:e.defaults.maxSubagents})}function de(e){let t=(0,P.c)(41),{definition:n,language:r,value:o,onChange:s,mode:c,badgeLabel:l,aiAssist:u,inputClassName:d,showTimeout:f,defaultAdvancedOpen:p,onValidityChange:m}=e,h=f===void 0?!1:f,g=p===void 0?!1:p,_=a(r).workflows,[x,w]=(0,N.useState)(g),T;t[0]!==n||t[1]!==r?(T=S(n,r),t[0]=n,t[1]=r,t[2]=T):T=t[2];let E=T,D;t[3]!==n.defaults||t[4]!==o.concurrency?(D=o.concurrency.trim()?Number(o.concurrency):n.defaults.concurrency,t[3]=n.defaults,t[4]=o.concurrency,t[5]=D):D=t[5];let O=D,k;t[6]!==n.defaults||t[7]!==o.maxSubagents?(k=o.maxSubagents.trim()?Number(o.maxSubagents):n.defaults.maxSubagents,t[6]=n.defaults,t[7]=o.maxSubagents,t[8]=k):k=t[8];let j=k,F;t[9]!==n||t[10]!==r||t[11]!==o?(F=ae(n,r,o),t[9]=n,t[10]=r,t[11]=o,t[12]=F):F=t[12];let I=F,L=l??_.readyToStart,R;t[13]!==s||t[14]!==o?(R=e=>s({...o,...e}),t[13]=s,t[14]=o,t[15]=R):R=t[15];let ee=R,te=c===`automation`&&`rounded-xl bg-surface-panel/70 p-3 shadow-surface`,ne;t[16]===te?ne=t[17]:(ne=i(`space-y-4`,te),t[16]=te,t[17]=ne);let B=I||E.description,re;t[18]===B?re=t[19]:(re=(0,z.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:B}),t[18]=B,t[19]=re);let ie;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(ie=(0,z.jsx)(C,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[20]=ie):ie=t[20];let V;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,z.jsx)(M,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[21]=V):V=t[21];let H;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,z.jsx)(A,{className:`size-3.5 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[22]=H):H=t[22];let U;t[23]!==s||t[24]!==o?(U=e=>s({...o,...e}),t[23]=s,t[24]=o,t[25]=U):U=t[25];let W;t[26]===m?W=t[27]:(W=e=>{m?.(e)},t[26]=m,t[27]=W);let G;t[28]!==u||t[29]!==n||t[30]!==d||t[31]!==r||t[32]!==U||t[33]!==W||t[34]!==o?(G=(0,z.jsx)(ue,{definition:n,language:r,value:o,onChange:U,onValidityChange:W,aiAssist:u,inputClassName:d}),t[28]=u,t[29]=n,t[30]=d,t[31]=r,t[32]=U,t[33]=W,t[34]=o,t[35]=G):G=t[35];let K;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(K=()=>w(Q),t[36]=K):K=t[36];let oe=_.advancedSettings,se=x&&`rotate-180`,q;t[37]===se?q=t[38]:(q=i(`size-4 transition-transform`,se),t[37]=se,t[38]=q);let J;return t[39]===q?J=t[40]:(J=(0,z.jsx)(b,{className:q}),t[39]=q,t[40]=J),(0,z.jsxs)(`div`,{className:ne,children:[(0,z.jsxs)(`section`,{className:`rounded-2xl bg-surface-panel p-4 shadow-surface`,children:[(0,z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsx)(`h3`,{className:`truncate text-sm font-semibold text-fg`,children:_.runPlanPreview}),re]}),(0,z.jsx)(`span`,{className:`shrink-0 rounded-full bg-accent-soft px-2 py-1 text-[11px] font-medium text-accent-fg`,children:L})]}),(0,z.jsxs)(`div`,{className:`mt-4 grid gap-2 text-xs text-fg-muted sm:grid-cols-3`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[ie,(0,z.jsx)(`span`,{children:v(_.phaseCount,{count:n.phases.length})})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[V,(0,z.jsx)(`span`,{children:Z(n,_)})]}),(0,z.jsxs)(`div`,{className:`flex items-center gap-2 rounded-xl bg-surface-panel px-2.5 py-2`,children:[H,(0,z.jsx)(`span`,{children:v(_.runLimitsSummary,{concurrency:O,max:j})})]})]}),n.phases.length>0?(0,z.jsxs)(`div`,{className:`mt-4`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] font-medium uppercase tracking-wide text-fg-subtle`,children:[(0,z.jsx)(y,{className:`size-3.5`,"aria-hidden":!0}),_.startPlanPhases]}),(0,z.jsx)(`div`,{className:`mt-2 flex flex-wrap items-center gap-1.5`,children:n.phases.map(fe)})]}):null]}),G,(0,z.jsxs)(`div`,{className:`rounded-xl border border-edge`,children:[(0,z.jsxs)(`button`,{type:`button`,className:`flex w-full items-center justify-between px-3 py-2.5 text-left text-sm text-fg`,onClick:K,children:[oe,J]}),x?(0,z.jsxs)(`div`,{className:`grid gap-3 border-t border-edge px-3 pb-3 pt-3 sm:grid-cols-2`,children:[(0,z.jsx)(`input`,{value:o.concurrency,onChange:e=>ee({concurrency:e.target.value}),placeholder:v(_.concurrencyPlaceholder,{default:n.defaults.concurrency}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),(0,z.jsx)(`input`,{value:o.maxSubagents,onChange:e=>ee({maxSubagents:e.target.value}),placeholder:v(_.maxSubagentsPlaceholder,{default:n.defaults.maxSubagents}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}),h?(0,z.jsx)(`input`,{value:o.timeoutSeconds??``,onChange:e=>ee({timeoutSeconds:e.target.value}),placeholder:v(_.timeoutSecondsPlaceholder,{default:n.defaults.timeoutSec}),inputMode:`numeric`,className:`rounded-xl border border-edge bg-surface-base px-3 py-2 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent focus:ring-2 focus:ring-accent/20`}):null]}):null]})]})}function Q(e){return!e}function fe(e,t){return(0,z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[t>0?(0,z.jsx)(`span`,{className:`text-fg-subtle`,children:`→`}):null,(0,z.jsx)(`span`,{className:`rounded-lg border border-edge-subtle bg-surface-panel px-2 py-1 text-[11px] text-fg-muted`,children:e.title})]},e.id)}export{B as a,G as i,oe as n,W as r,de as t};