@xopcai/xopc 0.0.176 → 0.0.178

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 (238) 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-DsFM1upC.js → activity-store-BzGX__8I.js} +1 -1
  4. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DvdMLOga.js → agent-avatar-dicebear-BzxntcaZ.js} +1 -1
  5. package/dist/gateway/static/root/assets/agents-DC9F12Kw.js +2 -0
  6. package/dist/gateway/static/root/assets/{api-BdPLCCBm.js → api-hi6f2Xtp.js} +1 -1
  7. package/dist/gateway/static/root/assets/{app-management-settings-panel-DMLDOHul.js → app-management-settings-panel-fTY1F7ac.js} +1 -1
  8. package/dist/gateway/static/root/assets/{appearance-settings-DbI9foFR.js → appearance-settings-BZ-IxQfB.js} +1 -1
  9. package/dist/gateway/static/root/assets/apps-page-5bKr05Fa.js +1 -0
  10. package/dist/gateway/static/root/assets/{archive-plugin-Dfdxuwvb.js → archive-plugin-ZSLLG8wB.js} +1 -1
  11. package/dist/gateway/static/root/assets/{attachment-load-Dn3RlnYD.js → attachment-load-D4YktqIF.js} +1 -1
  12. package/dist/gateway/static/root/assets/{automation-suggestion-card-Bc0Y7A9u.js → automation-suggestion-card-B7mxFRtf.js} +1 -1
  13. package/dist/gateway/static/root/assets/automations-page-Dg6dmt5g.js +6 -0
  14. package/dist/gateway/static/root/assets/{binary-plugins-0XtB-xC0.js → binary-plugins-BIkPxfxj.js} +1 -1
  15. package/dist/gateway/static/root/assets/{block-editor-C4fXWbEE.js → block-editor-Q3v_YQom.js} +6 -6
  16. package/dist/gateway/static/root/assets/{browser-settings-page-lC86-drr.js → browser-settings-page-BHoo6Rpq.js} +4 -4
  17. package/dist/gateway/static/root/assets/{browser-workflow-inputs-CZmzNymN.js → browser-workflow-inputs-M5lTEW1I.js} +1 -1
  18. package/dist/gateway/static/root/assets/{browser-workflows-page-CBYM9HqG.js → browser-workflows-page-B3T1KYk4.js} +2 -2
  19. package/dist/gateway/static/root/assets/capabilities-settings-panel-BlsqN8Fu.js +7 -0
  20. package/dist/gateway/static/root/assets/{capability-presets-api-BiJxmmhW.js → capability-presets-api-DE09c0VB.js} +1 -1
  21. package/dist/gateway/static/root/assets/capability-presets-settings-panel-DJeT8_B4.js +1 -0
  22. package/dist/gateway/static/root/assets/{channel-recipient-api-BKTUZDp-.js → channel-recipient-api-CFR5FBfS.js} +1 -1
  23. package/dist/gateway/static/root/assets/channels-settings-C4VVjYEm.js +1 -0
  24. package/dist/gateway/static/root/assets/channels-status-swr-vdf8kB16.js +1 -0
  25. package/dist/gateway/static/root/assets/{connector-logo-Pr4RIKjj.js → connector-logo-B1mD-3pM.js} +1 -1
  26. package/dist/gateway/static/root/assets/connectors-page-DNcrDThX.js +2 -0
  27. package/dist/gateway/static/root/assets/desktop-pet-B1urphOZ.js +1 -0
  28. package/dist/gateway/static/root/assets/{desktop-pet-settings-CEQacUDF.js → desktop-pet-settings-DTL6J3EP.js} +1 -1
  29. package/dist/gateway/static/root/assets/{directory-picker-path-field-DWnxdZtc.js → directory-picker-path-field-BYQJ2XUS.js} +1 -1
  30. package/dist/gateway/static/root/assets/{dreaming-settings-D2e2w2Ho.js → dreaming-settings-BXcb8fwx.js} +3 -3
  31. package/dist/gateway/static/root/assets/{extension-debug-page-BLjTGbv3.js → extension-debug-page-O1Xu1r4Q.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-page-D2_UC6hy.js → extension-page-C2Jraq8l.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-settings-page-BsH6o_PX.js → extension-settings-page-DcXQDTpG.js} +1 -1
  34. package/dist/gateway/static/root/assets/{gateway-config-api-C-DkC6UJ.js → gateway-config-api-DmPIZrvg.js} +1 -1
  35. package/dist/gateway/static/root/assets/{gateway-settings-DEOGiimF.js → gateway-settings-DmObBx9b.js} +1 -1
  36. package/dist/gateway/static/root/assets/{gateway-startup-retry-BlSLh1TF.js → gateway-startup-retry-BZEkOdPm.js} +1 -1
  37. package/dist/gateway/static/root/assets/{goal-create-dialog-CSFcRE_N.js → goal-create-dialog-BRhmmBe9.js} +1 -1
  38. package/dist/gateway/static/root/assets/goal-detail-page-C1k7_s_O.js +4 -0
  39. package/dist/gateway/static/root/assets/{goals-config-api-CcdS9qek.js → goals-config-api-Fwu1wjEP.js} +1 -1
  40. package/dist/gateway/static/root/assets/{goals-page-BAcErdch.js → goals-page-hOu9uA3q.js} +2 -2
  41. package/dist/gateway/static/root/assets/{goals-settings-BY7crl0z.js → goals-settings-DY-JjvHz.js} +1 -1
  42. package/dist/gateway/static/root/assets/{heartbeat-settings-DtTkS0gs.js → heartbeat-settings-BtKu2NWT.js} +1 -1
  43. package/dist/gateway/static/root/assets/{image-generation-api-WGgkbwDZ.js → image-generation-api-05Gg8wsU.js} +1 -1
  44. package/dist/gateway/static/root/assets/{index-2UImfRDC.js → index-C0CGebQ1.js} +65 -65
  45. package/dist/gateway/static/root/assets/index-eqq25gvV.css +1 -0
  46. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-C5lpWQ3f.js → keyboard-shortcuts-settings-CfmDR9Sc.js} +1 -1
  47. package/dist/gateway/static/root/assets/local-app-workbench-page-EjsNT7nJ.js +2 -0
  48. package/dist/gateway/static/root/assets/{local-apps-page-b05wWvXG.js → local-apps-page-Df8BW1A_.js} +1 -1
  49. package/dist/gateway/static/root/assets/{locale-store-sToMfHX_.js → locale-store-CTwSy7yW.js} +1 -1
  50. package/dist/gateway/static/root/assets/{logs-page-cDE1jLJv.js → logs-page-Dswjlraa.js} +3 -3
  51. package/dist/gateway/static/root/assets/{markdown-split-0gPVst5y.js → markdown-split-B3FvKbaP.js} +1 -1
  52. package/dist/gateway/static/root/assets/{media-plugins-Rxyq_KTm.js → media-plugins-DsjrvvB6.js} +1 -1
  53. package/dist/gateway/static/root/assets/messages-DP6tPKk-.js +3 -0
  54. package/dist/gateway/static/root/assets/{notes-page-DRhNDl_Q.js → notes-page-tuzIwy3c.js} +1 -1
  55. package/dist/gateway/static/root/assets/notes-workbench-DSh3-hMY.js +4 -0
  56. package/dist/gateway/static/root/assets/{page-tabs-cOEOQqHh.js → page-tabs-ke9s4nYi.js} +1 -1
  57. package/dist/gateway/static/root/assets/{preview-open-alternatives-BopOLFvu.js → preview-open-alternatives-Cp1eI4S9.js} +1 -1
  58. package/dist/gateway/static/root/assets/{product-open-page-DWVPmmOq.js → product-open-page-dXQCMAtH.js} +1 -1
  59. package/dist/gateway/static/root/assets/project-detail-page-D0QPRHR_.js +1 -0
  60. package/dist/gateway/static/root/assets/projects-page-CI5Vz62F.js +1 -0
  61. package/dist/gateway/static/root/assets/remote-access-hub-S1jpzBS5.js +1 -0
  62. package/dist/gateway/static/root/assets/{save-bar-controls-BfZmKe1t.js → save-bar-controls-Bl30zjHc.js} +1 -1
  63. package/dist/gateway/static/root/assets/{schedule-field-Cpi4jCRV.js → schedule-field-DqhmXQKo.js} +1 -1
  64. package/dist/gateway/static/root/assets/{schema-form-OXFkcZQe.js → schema-form-DkUCy6vf.js} +1 -1
  65. package/dist/gateway/static/root/assets/sessions-page-CTm66k7h.js +1 -0
  66. package/dist/gateway/static/root/assets/settings-advanced-gate-CU52AUVD.js +1 -0
  67. package/dist/gateway/static/root/assets/{settings-form-section-BwqkZCHJ.js → settings-form-section-C6ZbNpdy.js} +1 -1
  68. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BbqH_S3Y.js → settings-loading-skeleton-Bk58_cr7.js} +1 -1
  69. package/dist/gateway/static/root/assets/{settings-page-BoxC-JSa.js → settings-page-k8iE_NdX.js} +1 -1
  70. package/dist/gateway/static/root/assets/{settings-page-layout-Ddu2iGaW.js → settings-page-layout-DgFSya2e.js} +1 -1
  71. package/dist/gateway/static/root/assets/{setup-status-panel-z1Lwv0js.js → setup-status-panel-B_KDlyZA.js} +1 -1
  72. package/dist/gateway/static/root/assets/{share-preview-page-CVazOFjy.js → share-preview-page-CV7nL_J9.js} +1 -1
  73. package/dist/gateway/static/root/assets/shares-settings-DK6XK95e.js +1 -0
  74. package/dist/gateway/static/root/assets/skill-reload-api-Bvv_u4ii.js +1 -0
  75. package/dist/gateway/static/root/assets/skills-page-BGHvVbay.js +2 -0
  76. package/dist/gateway/static/root/assets/{skills-page.utils-DgyB1tSo.js → skills-page.utils-kahBIHg0.js} +1 -1
  77. package/dist/gateway/static/root/assets/{system-settings-panel-BoLSQL65.js → system-settings-panel-JV3-MG5F.js} +1 -1
  78. package/dist/gateway/static/root/assets/{theme-store-CBNcGOfj.js → theme-store-DFLyzoLO.js} +1 -1
  79. package/dist/gateway/static/root/assets/{time-picker-gochWrny.js → time-picker-XwpxdZFr.js} +1 -1
  80. package/dist/gateway/static/root/assets/{typed-models-lib-DvRnr7YB.js → typed-models-lib-60Aqo-UJ.js} +1 -1
  81. package/dist/gateway/static/root/assets/{use-channel-catalog-CA9BFVB7.js → use-channel-catalog-CnTkHDnw.js} +1 -1
  82. package/dist/gateway/static/root/assets/user-context-page-DBCMk-Vn.js +1 -0
  83. package/dist/gateway/static/root/assets/{voice-api-key-field-v8tgylEZ.js → voice-api-key-field-CNa8qUgS.js} +1 -1
  84. package/dist/gateway/static/root/assets/work-discovery-page-C1UIdsCl.js +1 -0
  85. package/dist/gateway/static/root/assets/work-item-detail-page-DEAQepB8.js +1 -0
  86. package/dist/gateway/static/root/assets/work-page-D5qYmCTq.js +3 -0
  87. package/dist/gateway/static/root/assets/{workflow-run-setup-panel-CC3cJn5k.js → workflow-run-setup-panel-yV_x595t.js} +2 -2
  88. package/dist/gateway/static/root/assets/workflows-page-yrK17ZZ5.js +11 -0
  89. package/dist/gateway/static/root/index.html +7 -7
  90. package/dist/package.js +1 -1
  91. package/dist/src/agent/embedded/model-runtime.js +3 -0
  92. package/dist/src/agent/embedded/run-for-session.js +18 -5
  93. package/dist/src/agent/embedded/run-turn.js +6 -3
  94. package/dist/src/agent/embedded/types.d.ts +2 -0
  95. package/dist/src/automations/service/automation-service.d.ts +3 -0
  96. package/dist/src/automations/service/automation-service.js +37 -7
  97. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  98. package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
  99. package/dist/src/cli/commands/update.js +1 -1
  100. package/dist/src/connectors/composio-sessions.js +1 -1
  101. package/dist/src/gateway/hono/routes/home.d.ts +18 -2
  102. package/dist/src/gateway/hono/routes/home.js +19 -0
  103. package/dist/src/gateway/hono/routes/index.js +2 -2
  104. package/dist/src/gateway/hono/routes/local-apps.js +1 -1
  105. package/dist/src/gateway/hono/routes/proactive.d.ts +4 -0
  106. package/dist/src/gateway/hono/routes/proactive.js +157 -0
  107. package/dist/src/gateway/hono/routes/projects.js +2 -2
  108. package/dist/src/gateway/hono/routes/update.js +2 -2
  109. package/dist/src/gateway/index.js +1 -1
  110. package/dist/src/gateway/run-loop.js +1 -1
  111. package/dist/src/gateway/service.d.ts +10 -1
  112. package/dist/src/gateway/service.js +36 -36
  113. package/dist/src/infra/gateway-processes.js +1 -1
  114. package/dist/src/infra/update-restart.js +1 -1
  115. package/dist/src/infra/update-runner.js +2 -2
  116. package/dist/src/infra/update-startup.js +1 -1
  117. package/dist/src/mcp/channel-bridge.js +1 -1
  118. package/dist/src/mobile/notification-service.d.ts +1 -0
  119. package/dist/src/mobile/notification-service.js +38 -18
  120. package/dist/src/mobile/notification-types.d.ts +2 -2
  121. package/dist/src/proactive/events/envelope.d.ts +2 -0
  122. package/dist/src/proactive/events/envelope.js +54 -0
  123. package/dist/src/proactive/events/publisher.d.ts +4 -0
  124. package/dist/src/proactive/events/repository.d.ts +9 -0
  125. package/dist/src/proactive/events/repository.js +62 -0
  126. package/dist/src/proactive/events/types.d.ts +44 -0
  127. package/dist/src/proactive/events/types.js +15 -0
  128. package/dist/src/proactive/execution/agent-executor.d.ts +16 -0
  129. package/dist/src/proactive/execution/agent-executor.js +104 -0
  130. package/dist/src/proactive/execution/context.d.ts +31 -0
  131. package/dist/src/proactive/execution/context.js +72 -0
  132. package/dist/src/proactive/execution/insight.d.ts +4 -0
  133. package/dist/src/proactive/execution/insight.js +74 -0
  134. package/dist/src/proactive/execution/repository.d.ts +23 -0
  135. package/dist/src/proactive/execution/repository.js +122 -0
  136. package/dist/src/proactive/execution/types.d.ts +54 -0
  137. package/dist/src/proactive/execution/types.js +1 -0
  138. package/dist/src/proactive/execution/worker.d.ts +15 -0
  139. package/dist/src/proactive/execution/worker.js +96 -0
  140. package/dist/src/proactive/inbox/repository.d.ts +24 -0
  141. package/dist/src/proactive/inbox/repository.js +117 -0
  142. package/dist/src/proactive/inbox/service.d.ts +17 -0
  143. package/dist/src/proactive/inbox/service.js +22 -0
  144. package/dist/src/proactive/inbox/types.d.ts +38 -0
  145. package/dist/src/proactive/inbox/types.js +1 -0
  146. package/dist/src/proactive/inbox/worker.d.ts +12 -0
  147. package/dist/src/proactive/inbox/worker.js +56 -0
  148. package/dist/src/proactive/index.d.ts +17 -0
  149. package/dist/src/proactive/index.js +11 -0
  150. package/dist/src/proactive/routing/batch-repository.d.ts +27 -0
  151. package/dist/src/proactive/routing/batch-repository.js +56 -0
  152. package/dist/src/proactive/routing/matcher.d.ts +5 -0
  153. package/dist/src/proactive/routing/matcher.js +56 -0
  154. package/dist/src/proactive/routing/types.d.ts +44 -0
  155. package/dist/src/proactive/routing/types.js +1 -0
  156. package/dist/src/proactive/scenarios/prompt-composer.d.ts +14 -0
  157. package/dist/src/proactive/scenarios/prompt-composer.js +24 -0
  158. package/dist/src/proactive/scenarios/repository.d.ts +23 -0
  159. package/dist/src/proactive/scenarios/repository.js +162 -0
  160. package/dist/src/proactive/scenarios/service.d.ts +15 -0
  161. package/dist/src/proactive/scenarios/service.js +26 -0
  162. package/dist/src/proactive/scenarios/types.d.ts +36 -0
  163. package/dist/src/proactive/scenarios/types.js +1 -0
  164. package/dist/src/proactive/service.d.ts +18 -0
  165. package/dist/src/proactive/service.js +61 -0
  166. package/dist/src/projects/project-service.d.ts +3 -1
  167. package/dist/src/projects/project-service.js +62 -32
  168. package/dist/src/providers/provider-auth-service.js +3 -0
  169. package/dist/src/providers/register-bundled-oauth-flows.d.ts +2 -0
  170. package/dist/src/providers/register-bundled-oauth-flows.js +16 -0
  171. package/dist/src/session/store.d.ts +2 -0
  172. package/dist/src/session/store.js +30 -0
  173. package/dist/src/storage/sqlite/migrations/068_proactive_event_spine.sql +71 -0
  174. package/dist/src/storage/sqlite/migrations/069_proactive_scenario_control.sql +69 -0
  175. package/dist/src/storage/sqlite/migrations/070_proactive_execution.sql +55 -0
  176. package/dist/src/storage/sqlite/migrations/071_proactive_inbox.sql +45 -0
  177. package/dist/src/storage/sqlite/migrations/072_proactive_judgments.sql +14 -0
  178. package/dist/src/storage/sqlite/migrations/073_enable_default_proactive_scenarios.sql +13 -0
  179. package/dist/src/storage/sqlite/migrations/074_deduplicate_blocked_work_routing.sql +5 -0
  180. package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
  181. package/dist/src/storage/sqlite/migrations/runner.js +3 -3
  182. package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
  183. package/dist/src/storage/sqlite/schema.js +1 -1
  184. package/dist/src/work-discovery/thread-service.d.ts +1 -3
  185. package/dist/src/work-discovery/thread-service.js +13 -25
  186. package/dist/src/work-items/work-item-service.d.ts +3 -1
  187. package/dist/src/work-items/work-item-service.js +67 -36
  188. package/package.json +3 -11
  189. package/dist/gateway/static/root/assets/agents-BVjlpbeZ.js +0 -2
  190. package/dist/gateway/static/root/assets/api-Bop4IQRW.js +0 -1
  191. package/dist/gateway/static/root/assets/apps-page-njqxLWYD.js +0 -1
  192. package/dist/gateway/static/root/assets/automations-page-D-eweHZJ.js +0 -6
  193. package/dist/gateway/static/root/assets/capabilities-settings-panel-6tYNfHqJ.js +0 -7
  194. package/dist/gateway/static/root/assets/capability-presets-settings-panel-Co-ymbd9.js +0 -1
  195. package/dist/gateway/static/root/assets/channels-settings-D46eVjaQ.js +0 -1
  196. package/dist/gateway/static/root/assets/channels-status-swr-BMRAO4zZ.js +0 -1
  197. package/dist/gateway/static/root/assets/connectors-page-Dw1eYbRi.js +0 -2
  198. package/dist/gateway/static/root/assets/copy-VueTIC2x.js +0 -1
  199. package/dist/gateway/static/root/assets/desktop-pet-B8cZuQUt.js +0 -1
  200. package/dist/gateway/static/root/assets/focus-detail-page-BBXUtxRB.js +0 -1
  201. package/dist/gateway/static/root/assets/goal-detail-page-VjRArfAJ.js +0 -4
  202. package/dist/gateway/static/root/assets/index-CS9sVShT.css +0 -1
  203. package/dist/gateway/static/root/assets/local-app-workbench-page-Cl0fcPL4.js +0 -2
  204. package/dist/gateway/static/root/assets/messages-CarlxqXV.js +0 -3
  205. package/dist/gateway/static/root/assets/notes-workbench-BKNBk0Uf.js +0 -4
  206. package/dist/gateway/static/root/assets/project-detail-page-BhjEXNQW.js +0 -1
  207. package/dist/gateway/static/root/assets/projects-page-B80e69PH.js +0 -1
  208. package/dist/gateway/static/root/assets/remote-access-hub-CwdVob6H.js +0 -1
  209. package/dist/gateway/static/root/assets/sessions-page-BGt3Asj6.js +0 -1
  210. package/dist/gateway/static/root/assets/settings-advanced-gate-BnTdM9Nn.js +0 -1
  211. package/dist/gateway/static/root/assets/shares-settings-C4lXuyQj.js +0 -1
  212. package/dist/gateway/static/root/assets/skill-reload-api-DSuIDkeI.js +0 -1
  213. package/dist/gateway/static/root/assets/skills-page-xgZczqVe.js +0 -2
  214. package/dist/gateway/static/root/assets/user-context-page-CEfIy4WZ.js +0 -1
  215. package/dist/gateway/static/root/assets/work-discovery-page-B-3MClaf.js +0 -1
  216. package/dist/gateway/static/root/assets/work-item-detail-page-CEsFEdax.js +0 -1
  217. package/dist/gateway/static/root/assets/work-page-CT9AHnq6.js +0 -3
  218. package/dist/gateway/static/root/assets/workflows-page-C-1-_Zp1.js +0 -11
  219. package/dist/src/focuses/candidate-repository.d.ts +0 -15
  220. package/dist/src/focuses/candidate-repository.js +0 -91
  221. package/dist/src/focuses/index.d.ts +0 -7
  222. package/dist/src/focuses/index.js +0 -7
  223. package/dist/src/focuses/insight-repository.d.ts +0 -22
  224. package/dist/src/focuses/insight-repository.js +0 -77
  225. package/dist/src/focuses/prompts.d.ts +0 -2
  226. package/dist/src/focuses/prompts.js +0 -18
  227. package/dist/src/focuses/reconciler.d.ts +0 -5
  228. package/dist/src/focuses/reconciler.js +0 -26
  229. package/dist/src/focuses/repository.d.ts +0 -61
  230. package/dist/src/focuses/repository.js +0 -214
  231. package/dist/src/focuses/run-processor.d.ts +0 -18
  232. package/dist/src/focuses/run-processor.js +0 -162
  233. package/dist/src/focuses/service.d.ts +0 -42
  234. package/dist/src/focuses/service.js +0 -241
  235. package/dist/src/focuses/types.d.ts +0 -89
  236. package/dist/src/gateway/hono/routes/focuses.d.ts +0 -3
  237. package/dist/src/gateway/hono/routes/focuses.js +0 -319
  238. /package/dist/src/{focuses/types.js → proactive/events/publisher.js} +0 -0
@@ -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-CarlxqXV.js";import{n as u}from"./locale-store-sToMfHX_.js";import{i as d}from"./vendor-swr-BIWyz7Rc.js";import{$t as f,As as p,Bo as m,Cc as h,Du as g,El as _,Go as v,Gt as y,Ho as b,Hs as x,Ht as S,Jt as C,Ks as w,Kt as T,Lc as E,Ns as D,Qt as O,Rs as k,Su as A,To as j,Uo as M,Us as N,Ut as P,Vo as F,Wo as I,Wt as L,Xl as R,Xt as z,Yl as B,Yt as V,Zt as H,an as U,cn as W,dl as G,dn as K,du as q,en as ee,fc as te,gn as ne,gu as re,hn as J,in as ie,is as Y,iu as ae,jc as X,ln as oe,ls as se,lu as ce,mu as le,nn as ue,nr as de,ns as fe,oc as pe,on as me,pn as he,qo as Z,qt as ge,rn as _e,ro as ve,sn as ye,tn as be,uc as xe,un as Se,us as Ce,vt as we,wl as Te,ws as Ee,zc as De,zo as Oe}from"./index-2UImfRDC.js";import{t as ke}from"./page-tabs-cOEOQqHh.js";import{t as Ae}from"./time-picker-gochWrny.js";import{D as je,E as Me,t as Ne}from"./connector-logo-Pr4RIKjj.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&&!he.some(e=>e.value===n.pronouns),t[4]=n.pronouns,t[5]=m);let[h,g]=(0,Q.useState)(m),_;bb0:{if(f){_=`__custom__`;break bb0}_=J.some(e=>e.value===n.timezone)?n.timezone:`__custom__`}let v=_,y;t[6]!==r||t[7]!==n?(y=e=>r({...n,...e}),t[6]=r,t[7]=n,t[8]=y):y=t[8];let b=y,x;t[9]===a?x=t[10]:(x=(e,t)=>a===`zh`?t:e,t[9]=a,t[10]=x);let S=x,C;t[11]===i.callName?C=t[12]:(C=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.callName}),t[11]=i.callName,t[12]=C);let w;t[13]===b?w=t[14]:(w=e=>b({callName:e.target.value}),t[13]=b,t[14]=w);let T;t[15]!==o||t[16]!==i.callNamePlaceholder||t[17]!==w||t[18]!==n.callName?(T=(0,$.jsx)(`input`,{className:o,value:n.callName,onChange:w,placeholder:i.callNamePlaceholder,autoComplete:`off`}),t[15]=o,t[16]=i.callNamePlaceholder,t[17]=w,t[18]=n.callName,t[19]=T):T=t[19];let E;t[20]!==C||t[21]!==T?(E=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm`,children:[C,T]}),t[20]=C,t[21]=T,t[22]=E):E=t[22];let D;t[23]===i.pronouns?D=t[24]:(D=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.pronouns}),t[23]=i.pronouns,t[24]=D);let O=h?`__custom__`:n.pronouns,k;t[25]!==b||t[26]!==n.pronouns?(k=e=>{if(e.target.value===`__custom__`){g(!0),he.some(e=>e.value===n.pronouns)&&b({pronouns:``});return}g(!1),b({pronouns:e.target.value})},t[25]=b,t[26]=n.pronouns,t[27]=k):k=t[27];let A;t[28]===i.pronounsPlaceholder?A=t[29]:(A=(0,$.jsx)(Y,{value:``,children:i.pronounsPlaceholder}),t[28]=i.pronounsPlaceholder,t[29]=A);let j;t[30]===S?j=t[31]:(j=he.map(e=>(0,$.jsx)(Y,{value:e.value,children:S(e.labelEn,e.labelZh)},e.value)),t[30]=S,t[31]=j);let M;t[32]===i.custom?M=t[33]:(M=(0,$.jsx)(Y,{value:`__custom__`,children:i.custom}),t[32]=i.custom,t[33]=M);let N;t[34]!==o||t[35]!==O||t[36]!==k||t[37]!==A||t[38]!==j||t[39]!==M?(N=(0,$.jsxs)(fe,{className:o,value:O,onChange:k,children:[A,j,M]}),t[34]=o,t[35]=O,t[36]=k,t[37]=A,t[38]=j,t[39]=M,t[40]=N):N=t[40];let P;t[41]!==o||t[42]!==i.pronounsPlaceholder||t[43]!==h||t[44]!==b||t[45]!==n.pronouns?(P=h?(0,$.jsx)(`input`,{className:c(o,`mt-1 text-xs`),value:n.pronouns,onChange:e=>b({pronouns:e.target.value}),placeholder:i.pronounsPlaceholder,autoComplete:`off`}):null,t[41]=o,t[42]=i.pronounsPlaceholder,t[43]=h,t[44]=b,t[45]=n.pronouns,t[46]=P):P=t[46];let F;t[47]!==D||t[48]!==N||t[49]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[D,N,P]}),t[47]=D,t[48]=N,t[49]=P,t[50]=F):F=t[50];let I;t[51]===i.timezone?I=t[52]:(I=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.timezone}),t[51]=i.timezone,t[52]=I);let L;t[53]===o?L=t[54]:(L=c(o,`min-w-0 flex-1`),t[53]=o,t[54]=L);let R;t[55]===b?R=t[56]:(R=e=>{if(e.target.value===`__custom__`){p(!0);return}p(!1),u(``),b({timezone:e.target.value})},t[55]=b,t[56]=R);let z;t[57]===S?z=t[58]:(z=J.map(e=>(0,$.jsx)(Y,{value:e.value,children:S(e.labelEn,e.labelZh)},e.value)),t[57]=S,t[58]=z);let B;t[59]===i.timezoneCustom?B=t[60]:(B=(0,$.jsx)(Y,{value:`__custom__`,children:i.timezoneCustom}),t[59]=i.timezoneCustom,t[60]=B);let V;t[61]!==L||t[62]!==R||t[63]!==z||t[64]!==B||t[65]!==v?(V=(0,$.jsxs)(fe,{className:L,value:v,onChange:R,children:[z,B]}),t[61]=L,t[62]=R,t[63]=z,t[64]=B,t[65]=v,t[66]=V):V=t[66];let H;t[67]===Symbol.for(`react.memo_cache_sentinel`)?(H=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`,Ee.press),t[67]=H):H=t[67];let U;t[68]===b?U=t[69]:(U=()=>{let e=ne();if(!e)return;let t=J.some(t=>t.value===e);p(!t),u(t?``:e),b({timezone:e})},t[68]=b,t[69]=U);let W;t[70]!==i.timezoneDetect||t[71]!==U?(W=(0,$.jsx)(`button`,{type:`button`,className:H,onClick:U,children:i.timezoneDetect}),t[70]=i.timezoneDetect,t[71]=U,t[72]=W):W=t[72];let G;t[73]!==V||t[74]!==W?(G=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-stretch gap-2`,children:[V,W]}),t[73]=V,t[74]=W,t[75]=G):G=t[75];let K;t[76]!==l||t[77]!==o||t[78]!==f||t[79]!==b?(K=f?(0,$.jsx)(`input`,{className:c(o,`mt-1 font-mono text-xs`),value:l,onChange:e=>{u(e.target.value),b({timezone:e.target.value})},placeholder:`e.g. Asia/Shanghai`,autoComplete:`off`}):null,t[76]=l,t[77]=o,t[78]=f,t[79]=b,t[80]=K):K=t[80];let q;t[81]!==I||t[82]!==G||t[83]!==K?(q=(0,$.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[I,G,K]}),t[81]=I,t[82]=G,t[83]=K,t[84]=q):q=t[84];let ee;t[85]===i.notes?ee=t[86]:(ee=(0,$.jsx)(`span`,{className:`font-medium text-fg`,children:i.notes}),t[85]=i.notes,t[86]=ee);let te;t[87]===o?te=t[88]:(te=c(o,`min-h-28 resize-y text-sm leading-relaxed`),t[87]=o,t[88]=te);let re;t[89]===b?re=t[90]:(re=e=>b({notes:e.target.value}),t[89]=b,t[90]=re);let ie;t[91]!==i.notesPlaceholder||t[92]!==te||t[93]!==re||t[94]!==n.notes?(ie=(0,$.jsx)(`textarea`,{className:te,value:n.notes,onChange:re,placeholder:i.notesPlaceholder,rows:5,spellCheck:!0}),t[91]=i.notesPlaceholder,t[92]=te,t[93]=re,t[94]=n.notes,t[95]=ie):ie=t[95];let ae;t[96]!==ee||t[97]!==ie?(ae=(0,$.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-sm sm:col-span-2`,children:[ee,ie]}),t[96]=ee,t[97]=ie,t[98]=ae):ae=t[98];let X;return t[99]!==E||t[100]!==F||t[101]!==q||t[102]!==ae?(X=(0,$.jsxs)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:[E,F,q,ae]}),t[99]=E,t[100]=F,t[101]=q,t[102]=ae,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:A,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:k,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:R,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:xe,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,h;t[17]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(M,{className:c(`xopc-dialog-overlay fixed inset-0 bg-scrim backdrop-blur-[1px]`,Ce)}),t[17]=h):h=t[17];let g;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(g=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`,se,`rounded-2xl border border-edge bg-surface-panel shadow-popover outline-none`),t[18]=g):g=t[18];let _;t[19]===r.helpTitle?_=t[20]:(_=(0,$.jsx)(v,{className:`text-base font-semibold text-fg`,children:r.helpTitle}),t[19]=r.helpTitle,t[20]=_);let y;t[21]===r.helpSubtitle?y=t[22]:(y=(0,$.jsx)(b,{className:`mt-1 text-sm leading-6 text-fg-muted`,children:r.helpSubtitle}),t[21]=r.helpSubtitle,t[22]=y);let x;t[23]!==_||t[24]!==y?(x=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[_,y]}),t[23]=_,t[24]=y,t[25]=x):x=t[25];let S;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,$.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[26]=S):S=t[26];let C;t[27]===r.close?C=t[28]:(C=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`size-9 shrink-0 p-0`,"aria-label":r.close,children:S})}),t[27]=r.close,t[28]=C);let w;t[29]!==x||t[30]!==C?(w=(0,$.jsxs)(`header`,{className:`flex shrink-0 items-start justify-between gap-4 border-b border-edge px-5 py-4`,children:[x,C]}),t[29]=x,t[30]=C,t[31]=w):w=t[31];let T;t[32]===f?T=t[33]:(T=(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]=T);let E;t[34]!==a||t[35]!==i?(E=()=>{i(!1),a(`sources`)},t[34]=a,t[35]=i,t[36]=E):E=t[36];let O;t[37]!==r.tabs.sources||t[38]!==E?(O=(0,$.jsx)(p,{type:`button`,variant:`ghost`,onClick:E,children:r.tabs.sources}),t[37]=r.tabs.sources,t[38]=E,t[39]=O):O=t[39];let j;t[40]!==a||t[41]!==i?(j=()=>{i(!1),a(`privacy`)},t[40]=a,t[41]=i,t[42]=j):j=t[42];let N;t[43]!==r.openPrivacyControls||t[44]!==j?(N=(0,$.jsx)(p,{type:`button`,variant:`secondary`,onClick:j,children:r.openPrivacyControls}),t[43]=r.openPrivacyControls,t[44]=j,t[45]=N):N=t[45];let P;t[46]!==O||t[47]!==N?(P=(0,$.jsxs)(`footer`,{className:`flex shrink-0 flex-wrap justify-end gap-2 border-t border-edge px-5 py-4`,children:[O,N]}),t[46]=O,t[47]=N,t[48]=P):P=t[48];let L;t[49]!==w||t[50]!==T||t[51]!==P?(L=(0,$.jsxs)(I,{children:[h,(0,$.jsxs)(F,{className:g,children:[w,T,P]})]}),t[49]=w,t[50]=T,t[51]=P,t[52]=L):L=t[52];let z;return t[53]!==i||t[54]!==n||t[55]!==L?(z=(0,$.jsx)(Oe,{open:n,onOpenChange:i,children:L}),t[53]=i,t[54]=n,t[55]=L,t[56]=z):z=t[56],z}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),h,g;t[0]===n?(h=t[1],g=t[2]):(h=()=>{n&&d(!1)},g=[n],t[0]=n,t[1]=h,t[2]=g),(0,Q.useEffect)(h,g);let _;t[3]!==i||t[4]!==a?(_=e=>!i&&a(e),t[3]=i,t[4]=a,t[5]=_):_=t[5];let y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(M,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[6]=y):y=t[6];let x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[7]=x):x=t[7];let S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=()=>d(!1),t[8]=S):S=t[8];let C=u?`border-edge-subtle hover:bg-surface-hover`:`border-accent/40 bg-accent-soft/35`,T;t[9]===C?T=t[10]:(T=c(`flex w-full items-start gap-3 rounded-xl border p-4 text-left`,C),t[9]=C,t[10]=T);let E;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,$.jsx)(R,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),t[11]=E):E=t[11];let O;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>d(!0),t[12]=O):O=t[12];let k=u?`border-danger/40 bg-danger-soft`:`border-edge-subtle hover:bg-surface-hover`,A;t[13]===k?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`,k),t[13]=k,t[14]=A);let j;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,$.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-danger`,"aria-hidden":!0}),t[15]=j):j=t[15];let P=s.disconnectDeleteBody.replace(`{{count}}`,String(n?.derivedUnderstandingCount??0)),L;t[16]===P?L=t[17]:(L=(0,$.jsx)(`span`,{className:`mt-1 block text-xs leading-5 text-fg-muted`,children:P}),t[16]=P,t[17]=L);let z;t[18]!==i||t[19]!==s.cancel?(z=(0,$.jsx)(m,{asChild:!0,children:(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:i,children:s.cancel})}),t[18]=i,t[19]=s.cancel,t[20]=z):z=t[20];let B=u?`border-danger/35 text-danger hover:bg-danger-soft`:void 0,V;t[21]!==u||t[22]!==o?(V=()=>o(u),t[21]=u,t[22]=o,t[23]=V):V=t[23];let H;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[24]=H):H=t[24];let U=i?s.disconnecting:s.disconnectAction,W;t[25]!==i||t[26]!==B||t[27]!==V||t[28]!==U?(W=(0,$.jsxs)(p,{type:`button`,variant:`secondary`,className:B,disabled:i,onClick:V,children:[H,U]}),t[25]=i,t[26]=B,t[27]=V,t[28]=U,t[29]=W):W=t[29];let G;return t[30]!==z||t[31]!==W?(G=(0,$.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle px-5 py-4`,children:[z,W]}),t[30]=z,t[31]=W,t[32]=G):G=t[32],(0,$.jsx)(Oe,{open:n!==null,onOpenChange:_,children:(0,$.jsxs)(I,{children:[y,(0,$.jsxs)(F,{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)(b,{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:x})})]}),(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:S,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:O,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}),L]})]})]}),G]})]})})}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)?we(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 g;t[0]!==n||t[1]!==i?(g=Ue(n,i),t[0]=n,t[1]=i,t[2]=g):g=t[2];let _=g,y,x,S,C,w,T,E,O,k,j,P,L,R,z,B,V;if(t[3]!==r||t[4]!==o||t[5]!==f||t[6]!==_.summary||t[7]!==_.tone||t[8]!==n||t[9]!==i){let e=Ke(n);C=n.learning?.status===`paused`,w=_.tone===`attention`,S=Oe,E=!0,O=o,x=I,t[26]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,$.jsx)(M,{className:`xopc-dialog-overlay fixed inset-0 z-[130] bg-scrim`}),t[26]=T):T=t[26],y=F,B=`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 h;t[37]===d?h=t[38]:(h=(0,$.jsx)(b,{className:`mt-0.5 truncate text-sm text-fg-muted`,children:d}),t[37]=d,t[38]=h);let g;t[39]!==u||t[40]!==h?(g=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[u,h]}),t[39]=u,t[40]=h,t[41]=g):g=t[41];let N;t[42]!==l||t[43]!==g?(N=(0,$.jsxs)(`div`,{className:`flex min-w-0 items-start gap-3`,children:[l,g]}),t[42]=l,t[43]=g,t[44]=N):N=t[44];let H;t[45]===Symbol.for(`react.memo_cache_sentinel`)?(H=(0,$.jsx)(D,{className:`size-4`,"aria-hidden":!0}),t[45]=H):H=t[45];let U;t[46]===i.close?U=t[47]:(U=(0,$.jsx)(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:H})}),t[46]=i.close,t[47]=U),t[48]!==N||t[49]!==U?(V=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-start justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[N,U]}),t[48]=N,t[49]=U,t[50]=V):V=t[50],R=`min-h-0 flex-1 space-y-5 overflow-y-auto p-5`;let W;t[51]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,$.jsx)(A,{className:`size-4 text-accent`,"aria-hidden":!0}),t[51]=W):W=t[51];let G;t[52]===i.sourceOutcomeTitle?G=t[53]:(G=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[W,i.sourceOutcomeTitle]}),t[52]=i.sourceOutcomeTitle,t[53]=G);let K=_.tone===`attention`?`border-warning/30 bg-warning-soft text-fg`:`border-edge-subtle bg-surface-muted text-fg`,q;t[54]===K?q=t[55]:(q=c(`mt-3 rounded-xl border px-4 py-3 text-sm leading-6`,K),t[54]=K,t[55]=q);let ee;t[56]!==_.summary||t[57]!==q?(ee=(0,$.jsx)(`p`,{className:q,children:_.summary}),t[56]=_.summary,t[57]=q,t[58]=ee):ee=t[58];let te;t[59]===n.learningFunnel.activeClaims?te=t[60]:(te=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.activeClaims}),t[59]=n.learningFunnel.activeClaims,t[60]=te);let ne;t[61]===i.sourceReliableMetric?ne=t[62]:(ne=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourceReliableMetric}),t[61]=i.sourceReliableMetric,t[62]=ne);let J;t[63]!==te||t[64]!==ne?(J=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[te,ne]}),t[63]=te,t[64]=ne,t[65]=J):J=t[65];let ie;t[66]===n.learningFunnel.provisionalClaims?ie=t[67]:(ie=(0,$.jsx)(`strong`,{className:`text-xl font-semibold text-fg`,children:n.learningFunnel.provisionalClaims}),t[66]=n.learningFunnel.provisionalClaims,t[67]=ie);let Y;t[68]===i.sourcePendingMetric?Y=t[69]:(Y=(0,$.jsx)(`span`,{className:`mt-1 block text-xs text-fg-muted`,children:i.sourcePendingMetric}),t[68]=i.sourcePendingMetric,t[69]=Y);let X;t[70]!==ie||t[71]!==Y?(X=(0,$.jsxs)(`div`,{className:`rounded-xl border border-edge-subtle bg-surface-base px-4 py-3`,children:[ie,Y]}),t[70]=ie,t[71]=Y,t[72]=X):X=t[72];let oe;t[73]!==J||t[74]!==X?(oe=(0,$.jsxs)(`div`,{className:`mt-3 grid grid-cols-2 gap-3`,children:[J,X]}),t[73]=J,t[74]=X,t[75]=oe):oe=t[75];let se;t[76]!==f||t[77]!==n.learningFunnel.activeClaims||t[78]!==n.learningFunnel.provisionalClaims||t[79]!==i.sourceViewUnderstanding?(se=n.learningFunnel.activeClaims>0||n.learningFunnel.provisionalClaims>0?(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`mt-2 px-2`,onClick:f,children:[i.sourceViewUnderstanding,(0,$.jsx)(re,{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]=se):se=t[80],t[81]!==G||t[82]!==ee||t[83]!==oe||t[84]!==se?(z=(0,$.jsxs)(`section`,{children:[G,ee,oe,se]}),t[81]=G,t[82]=ee,t[83]=oe,t[84]=se,t[85]=z):z=t[85],k=`border-t border-edge-subtle pt-5`;let ce;t[86]===Symbol.for(`react.memo_cache_sentinel`)?(ce=(0,$.jsx)(ae,{className:`size-4 text-accent`,"aria-hidden":!0}),t[86]=ce):ce=t[86],t[87]===i.sourceRecentRunTitle?j=t[88]:(j=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[ce,i.sourceRecentRunTitle]}),t[87]=i.sourceRecentRunTitle,t[88]=j);let le;t[89]!==n.learningFunnel.activeClaims||t[90]!==n.learningFunnel.attributedItems||t[91]!==n.learningFunnel.indexedItems||t[92]!==i.sourceRecentRunSummary?(le=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]=le):le=t[93],t[94]===le?P=t[95]:(P=(0,$.jsx)(`p`,{className:`mt-3 text-sm leading-6 text-fg-muted`,children:le}),t[94]=le,t[95]=P),L=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]=_.summary,t[7]=_.tone,t[8]=n,t[9]=i,t[10]=y,t[11]=x,t[12]=S,t[13]=C,t[14]=w,t[15]=T,t[16]=E,t[17]=O,t[18]=k,t[19]=j,t[20]=P,t[21]=L,t[22]=R,t[23]=z,t[24]=B,t[25]=V}else y=t[10],x=t[11],S=t[12],C=t[13],w=t[14],T=t[15],E=t[16],O=t[17],k=t[18],j=t[19],P=t[20],L=t[21],R=t[22],z=t[23],B=t[24],V=t[25];let H;t[96]!==k||t[97]!==j||t[98]!==P||t[99]!==L?(H=(0,$.jsxs)(`section`,{className:k,children:[j,P,L]}),t[96]=k,t[97]=j,t[98]=P,t[99]=L,t[100]=H):H=t[100];let U;t[101]===Symbol.for(`react.memo_cache_sentinel`)?(U=(0,$.jsx)(xe,{className:`size-4 text-accent`,"aria-hidden":!0}),t[101]=U):U=t[101];let W;t[102]===i.sourceAccessTitle?W=t[103]:(W=(0,$.jsxs)(`h3`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[U,i.sourceAccessTitle]}),t[102]=i.sourceAccessTitle,t[103]=W);let G;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,$.jsx)(le,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[104]=G):G=t[104];let K;t[105]===i.sourceReadAccess?K=t[106]:(K=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[G,(0,$.jsx)(`span`,{children:i.sourceReadAccess})]}),t[105]=i.sourceReadAccess,t[106]=K);let q;t[107]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,$.jsx)(le,{className:`mt-1 size-4 shrink-0 text-success`,"aria-hidden":!0}),t[107]=q):q=t[107];let ee;t[108]===i.sourceMemoryAccess?ee=t[109]:(ee=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[q,(0,$.jsx)(`span`,{children:i.sourceMemoryAccess})]}),t[108]=i.sourceMemoryAccess,t[109]=ee);let ne;t[110]===Symbol.for(`react.memo_cache_sentinel`)?(ne=(0,$.jsx)(xe,{className:`mt-1 size-4 shrink-0 text-fg-subtle`,"aria-hidden":!0}),t[110]=ne):ne=t[110];let J=n.access.write?i.sourceWriteAccess:i.sourceNoWriteAccess,ie;t[111]===J?ie=t[112]:(ie=(0,$.jsxs)(`li`,{className:`flex gap-2`,children:[ne,(0,$.jsx)(`span`,{children:J})]}),t[111]=J,t[112]=ie);let Y;t[113]!==K||t[114]!==ee||t[115]!==ie?(Y=(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-sm leading-6 text-fg-muted`,children:[K,ee,ie]}),t[113]=K,t[114]=ee,t[115]=ie,t[116]=Y):Y=t[116];let X;t[117]!==W||t[118]!==Y?(X=(0,$.jsxs)(`section`,{className:`border-t border-edge-subtle pt-5`,children:[W,Y]}),t[117]=W,t[118]=Y,t[119]=X):X=t[119];let oe;t[120]!==H||t[121]!==X||t[122]!==R||t[123]!==z?(oe=(0,$.jsxs)(`div`,{className:R,children:[z,H,X]}),t[120]=H,t[121]=X,t[122]=R,t[123]=z,t[124]=oe):oe=t[124];let se;t[125]===i.sourceManagementTitle?se=t[126]:(se=(0,$.jsx)(`p`,{className:`mb-2 px-1 text-xs font-medium text-fg-subtle`,children:i.sourceManagementTitle}),t[125]=i.sourceManagementTitle,t[126]=se);let ce;t[127]!==a||t[128]!==C||t[129]!==w||t[130]!==s||t[131]!==l||t[132]!==n||t[133]!==i.sourcePauseLearning||t[134]!==i.sourceResumeLearning||t[135]!==i.sourceRetryLearning?(ce=He(n)?C||w?(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>s(n),children:[a?(0,$.jsx)(h,{className:`size-4 animate-spin`,"aria-hidden":!0}):(0,$.jsx)(pe,{className:`size-4`,"aria-hidden":!0}),w?i.sourceRetryLearning:i.sourceResumeLearning]}):(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:a,onClick:()=>l(n),children:[(0,$.jsx)(De,{className:`size-4`,"aria-hidden":!0}),i.sourcePauseLearning]}):null,t[127]=a,t[128]=C,t[129]=w,t[130]=s,t[131]=l,t[132]=n,t[133]=i.sourcePauseLearning,t[134]=i.sourceResumeLearning,t[135]=i.sourceRetryLearning,t[136]=ce):ce=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)(p,{type:`button`,variant:`secondary`,onClick:ue,children:[de,i.sourceConnectionSettings]}),t[141]=i.sourceConnectionSettings,t[142]=ue,t[143]=fe):fe=t[143];let me;t[144]!==d||t[145]!==n?(me=()=>d(n),t[144]=d,t[145]=n,t[146]=me):me=t[146];let he;t[147]===Symbol.for(`react.memo_cache_sentinel`)?(he=(0,$.jsx)(N,{className:`size-4`,"aria-hidden":!0}),t[147]=he):he=t[147];let Z;t[148]!==i.disconnect||t[149]!==me?(Z=(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`ml-auto text-danger hover:bg-danger-soft hover:text-danger`,onClick:me,children:[he,i.disconnect]}),t[148]=i.disconnect,t[149]=me,t[150]=Z):Z=t[150];let ge;t[151]!==ce||t[152]!==fe||t[153]!==Z?(ge=(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[ce,fe,Z]}),t[151]=ce,t[152]=fe,t[153]=Z,t[154]=ge):ge=t[154];let _e;t[155]!==se||t[156]!==ge?(_e=(0,$.jsxs)(`div`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:[se,ge]}),t[155]=se,t[156]=ge,t[157]=_e):_e=t[157];let ve;t[158]!==y||t[159]!==oe||t[160]!==_e||t[161]!==B||t[162]!==V?(ve=(0,$.jsxs)(y,{className:B,children:[V,oe,_e]}),t[158]=y,t[159]=oe,t[160]=_e,t[161]=B,t[162]=V,t[163]=ve):ve=t[163];let ye;t[164]!==x||t[165]!==T||t[166]!==ve?(ye=(0,$.jsxs)(x,{children:[T,ve]}),t[164]=x,t[165]=T,t[166]=ve,t[167]=ye):ye=t[167];let be;return t[168]!==S||t[169]!==E||t[170]!==O||t[171]!==ye?(be=(0,$.jsx)(S,{open:E,onOpenChange:O,children:ye}),t[168]=S,t[169]=E,t[170]=O,t[171]=ye,t[172]=be):be=t[172],be}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)(X,{className:`size-4`,"aria-hidden":!0}),t[31]=k):k=t[31];let A;t[32]!==o||t[33]!==i.addSource?(A=(0,$.jsxs)(p,{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)(re,{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)(p,{type:`button`,variant:`secondary`,className:`mt-4`,onClick:o,children:[(0,$.jsx)(X,{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)?we(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,m]=(0,Q.useState)(!1),[h,g]=(0,Q.useState)(n.statement),[_,v]=(0,Q.useState)(null),[y,b]=(0,Q.useState)(!1),x=n.status!==`active`,S=x?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,C;t[0]===S?C=t[1]:(C=c(`rounded-xl border p-3.5`,S),t[0]=S,t[1]=C);let T;t[2]!==a||t[3]!==h||t[4]!==f||t[5]!==_||t[6]!==y||t[7]!==n||t[8]!==r||t[9]!==x||t[10]!==s||t[11]!==d||t[12]!==l||t[13]!==u||t[14]!==i?(T=f?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:c(rt,`min-h-20 resize-y`),value:h,onChange:e=>g(e.target.value),placeholder:i.updatePlaceholder}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>{g(n.statement),m(!1)},children:i.cancel}),(0,$.jsx)(p,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:a||!h.trim(),onClick:()=>{u(h.trim()),m(!1)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:n.statement}),(0,$.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-subtle`,children:[(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,$.jsx)(pe,{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:[x?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(p,{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)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:l,children:[(0,$.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>m(!0),children:[(0,$.jsx)(E,{className:`size-3.5`,"aria-hidden":!0}),i.change]}),(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:y,onClick:()=>{if(_){v(null);return}b(!0),V(n.id).then(e=>v(e.history)).finally(()=>b(!1))},children:[(0,$.jsx)(Te,{className:`size-3.5`,"aria-hidden":!0}),i.history]}),(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:d,children:[(0,$.jsx)(w,{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]=h,t[4]=f,t[5]=_,t[6]=y,t[7]=n,t[8]=r,t[9]=x,t[10]=s,t[11]=d,t[12]=l,t[13]=u,t[14]=i,t[15]=T):T=t[15];let O;return t[16]!==C||t[17]!==T?(O=(0,$.jsx)(`article`,{className:C,children:T}),t[16]=C,t[17]=T,t[18]=O):O=t[18],O}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 m;t[11]===f?m=t[12]:(m=[...f],t[11]=f,t[12]=m);let h=m,g=n.state===`provisional`||n.state===`stale`,_=g?`border-warning/35 bg-warning-soft/35`:`border-edge-subtle bg-surface-panel`,v;t[13]===_?v=t[14]:(v=c(`rounded-xl border p-3.5`,_),t[13]=_,t[14]=v);let y=i.claimClasses[n.class],b;t[15]===y?b=t[16]:(b=(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-fg-subtle`,children:y}),t[15]=y,t[16]=b);let x;t[17]===d?x=t[18]:(x=(0,$.jsx)(`p`,{className:`mt-1 text-sm font-medium leading-6 text-fg`,children:d}),t[17]=d,t[18]=x);let S;t[19]!==b||t[20]!==x?(S=(0,$.jsxs)(`div`,{children:[b,x]}),t[19]=b,t[20]=x,t[21]=S):S=t[21];let C=i.claimStates[n.state],w;t[22]===C?w=t[23]:(w=(0,$.jsx)(`span`,{className:`rounded-full bg-surface-hover px-2 py-1 text-[11px] text-fg-muted`,children:C}),t[22]=C,t[23]=w);let T;t[24]!==w||t[25]!==S?(T=(0,$.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-2`,children:[S,w]}),t[24]=w,t[25]=S,t[26]=T):T=t[26];let E;t[27]!==n.activeDayCount||t[28]!==n.independentEvidenceCount||t[29]!==i.claimEvidence?(E=i.claimEvidence.replace(`{{events}}`,String(n.independentEvidenceCount)).replace(`{{days}}`,String(n.activeDayCount)),t[27]=n.activeDayCount,t[28]=n.independentEvidenceCount,t[29]=i.claimEvidence,t[30]=E):E=t[30];let O;t[31]===E?O=t[32]:(O=(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:E}),t[31]=E,t[32]=O);let k;t[33]!==n.lastReinforcedAt||t[34]!==r||t[35]!==i.observedAt?(k=i.observedAt.replace(`{{time}}`,ot(n.lastReinforcedAt,r)),t[33]=n.lastReinforcedAt,t[34]=r,t[35]=i.observedAt,t[36]=k):k=t[36];let A;t[37]===k?A=t[38]:(A=(0,$.jsx)(`span`,{className:`text-xs text-fg-subtle`,children:k}),t[37]=k,t[38]=A);let j;t[39]!==a||t[40]!==g||t[41]!==s||t[42]!==i.confirm||t[43]!==i.notTrue?(j=g?(0,$.jsxs)(`div`,{className:`flex gap-1`,children:[(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>s(`confirm`),children:[(0,$.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),i.confirm]}),(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:a,onClick:()=>s(`reject`),children:[(0,$.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),i.notTrue]})]}):null,t[39]=a,t[40]=g,t[41]=s,t[42]=i.confirm,t[43]=i.notTrue,t[44]=j):j=t[44];let M;t[45]!==A||t[46]!==j?(M=(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center justify-between gap-2`,children:[A,j]}),t[45]=A,t[46]=j,t[47]=M):M=t[47];let N;t[48]===i.viewEvidence?N=t[49]:(N=(0,$.jsx)(`summary`,{className:`cursor-pointer font-medium`,children:i.viewEvidence}),t[48]=i.viewEvidence,t[49]=N);let P;t[50]===i.evidenceSource?P=t[51]:(P=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceSource}),t[50]=i.evidenceSource,t[51]=P);let F=h.join(`, `),I;t[52]===F?I=t[53]:(I=(0,$.jsx)(`dd`,{className:`mt-0.5 break-all`,children:F}),t[52]=F,t[53]=I);let L;t[54]!==P||t[55]!==I?(L=(0,$.jsxs)(`div`,{children:[P,I]}),t[54]=P,t[55]=I,t[56]=L):L=t[56];let R;t[57]===i.evidenceConfidence?R=t[58]:(R=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceConfidence}),t[57]=i.evidenceConfidence,t[58]=R);let z;t[59]===n.confidence?z=t[60]:(z=Math.round(n.confidence*100),t[59]=n.confidence,t[60]=z);let B;t[61]===z?B=t[62]:(B=(0,$.jsxs)(`dd`,{className:`mt-0.5`,children:[z,`%`]}),t[61]=z,t[62]=B);let V;t[63]!==R||t[64]!==B?(V=(0,$.jsxs)(`div`,{children:[R,B]}),t[63]=R,t[64]=B,t[65]=V):V=t[65];let H;t[66]===i.evidenceRule?H=t[67]:(H=(0,$.jsx)(`dt`,{className:`text-fg-subtle`,children:i.evidenceRule}),t[66]=i.evidenceRule,t[67]=H);let U;t[68]===i.claimRule?U=t[69]:(U=(0,$.jsx)(`dd`,{className:`mt-0.5`,children:i.claimRule}),t[68]=i.claimRule,t[69]=U);let W;t[70]!==H||t[71]!==U?(W=(0,$.jsxs)(`div`,{className:`sm:col-span-2`,children:[H,U]}),t[70]=H,t[71]=U,t[72]=W):W=t[72];let G;t[73]!==L||t[74]!==V||t[75]!==W?(G=(0,$.jsxs)(`dl`,{className:`mt-2 grid gap-1.5 sm:grid-cols-2`,children:[L,V,W]}),t[73]=L,t[74]=V,t[75]=W,t[76]=G):G=t[76];let K;t[77]!==N||t[78]!==G?(K=(0,$.jsxs)(`details`,{className:`mt-2 rounded-lg bg-surface-muted/70 px-3 py-2 text-xs text-fg-muted`,children:[N,G]}),t[77]=N,t[78]=G,t[79]=K):K=t[79];let q;return t[80]!==T||t[81]!==O||t[82]!==M||t[83]!==K||t[84]!==v?(q=(0,$.jsxs)(`article`,{className:v,children:[T,O,M,K]}),t[80]=T,t[81]=O,t[82]=M,t[83]=K,t[84]=v,t[85]=q):q=t[85],q}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)(``),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(``),v=n.enabled?`border-edge-subtle bg-surface-panel`:`border-edge-subtle bg-surface-muted`,y;t[0]===v?y=t[1]:(y=c(`rounded-xl border p-4`,v),t[0]=v,t[1]=y);let b=i.playbookNames[n.id],x;t[2]===b?x=t[3]:(x=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:b}),t[2]=b,t[3]=x);let S;t[4]!==n.rules||t[5]!==i.playbookRuleCount?(S=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 D=n.enabled?i.pausePlaybook:i.resumePlaybook,O;t[12]!==r||t[13]!==a||t[14]!==D?(O=(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:r,onClick:a,children:D}),t[12]=r,t[13]=a,t[14]=D,t[15]=O):O=t[15];let k;t[16]!==T||t[17]!==O?(k=(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[T,O]}),t[16]=T,t[17]=O,t[18]=k):k=t[18];let A;t[19]!==r||t[20]!==m||t[21]!==g||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?(A=n.rules.map((e,t)=>(0,$.jsx)(`li`,{className:c(`rounded-lg border border-edge-subtle p-2.5`,!e.enabled&&`opacity-60`),children:m===e.id?(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(`textarea`,{className:c(rt,`min-h-16 resize-y`),value:g,onChange:e=>_(e.target.value)}),(0,$.jsxs)(`div`,{className:`flex justify-end gap-1`,children:[(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-7 px-2`,onClick:()=>h(null),children:i.cancel}),(0,$.jsx)(p,{type:`button`,variant:`primary`,className:`h-7 px-2`,disabled:!g.trim(),onClick:()=>{s(e.id,{statement:g.trim()}),h(null)},children:i.save})]})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-xs leading-5 text-fg-muted`,children:e.statement}),(0,$.jsxs)(`div`,{className:`mt-2 grid grid-cols-2 gap-1`,children:[(0,$.jsxs)(`label`,{className:`grid gap-1 text-[10px] text-fg-subtle`,children:[i.ruleSupportContext,(0,$.jsxs)(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)(p,{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)(p,{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)(p,{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)(p,{type:`button`,variant:`ghost`,className:`h-7 px-2`,disabled:r,onClick:()=>{h(e.id),_(e.statement)},children:[(0,$.jsx)(E,{className:`size-3`,"aria-hidden":!0}),i.edit]}),(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-7 px-2 text-danger`,disabled:r,onClick:()=>l(e.id),children:[(0,$.jsx)(w,{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)(p,{type:`button`,variant:`ghost`,className:`h-7 shrink-0 px-2`,disabled:r,onClick:()=>u(e.id,t.id),children:i.rollbackRule})]},t.id))})]}):null]})},e.id)),t[19]=r,t[20]=m,t[21]=g,t[22]=l,t[23]=u,t[24]=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]=A):A=t[40];let j;t[41]===A?j=t[42]:(j=(0,$.jsx)(`ul`,{className:`mt-3 space-y-2`,children:A}),t[41]=A,t[42]=j);let M;t[43]===Symbol.for(`react.memo_cache_sentinel`)?(M=e=>f(e.target.value),t[43]=M):M=t[43];let N;t[44]!==d||t[45]!==i.newRulePlaceholder?(N=(0,$.jsx)(`input`,{className:rt,value:d,onChange:M,placeholder:i.newRulePlaceholder}),t[44]=d,t[45]=i.newRulePlaceholder,t[46]=N):N=t[46];let P;t[47]!==r||t[48]!==d?(P=r||!d.trim(),t[47]=r,t[48]=d,t[49]=P):P=t[49];let F;t[50]!==d||t[51]!==o?(F=()=>{o(d.trim()),f(``)},t[50]=d,t[51]=o,t[52]=F):F=t[52];let I;t[53]!==i.addRule||t[54]!==P||t[55]!==F?(I=(0,$.jsx)(p,{type:`button`,variant:`secondary`,disabled:P,onClick:F,children:i.addRule}),t[53]=i.addRule,t[54]=P,t[55]=F,t[56]=I):I=t[56];let L;t[57]!==N||t[58]!==I?(L=(0,$.jsxs)(`div`,{className:`flex gap-2`,children:[N,I]}),t[57]=N,t[58]=I,t[59]=L):L=t[59];let R=i.playbookRuleExamples[n.id],z;t[60]===R?z=t[61]:(z=(0,$.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-5 text-fg-subtle`,children:R}),t[60]=R,t[61]=z);let B;t[62]!==L||t[63]!==z?(B=(0,$.jsxs)(`div`,{className:`mt-3`,children:[L,z]}),t[62]=L,t[63]=z,t[64]=B):B=t[64];let V;return t[65]!==k||t[66]!==j||t[67]!==y||t[68]!==B?(V=(0,$.jsxs)(`article`,{className:y,children:[k,j,B]}),t[65]=k,t[66]=j,t[67]=y,t[68]=B,t[69]=V):V=t[69],V}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,m;t[6]===f?m=t[7]:(m=(0,$.jsx)(`p`,{className:`mt-2 text-sm leading-6 text-fg-muted`,children:f}),t[6]=f,t[7]=m);let h;t[8]===l.callName?h=t[9]:(h=(0,$.jsx)(`label`,{className:`sr-only`,htmlFor:`you-call-name`,children:l.callName}),t[8]=l.callName,t[9]=h);let g;t[10]===a?g=t[11]:(g=e=>a(e.target.value),t[10]=a,t[11]=g);let _;t[12]!==i||t[13]!==r||t[14]!==o?(_=e=>{e.key===`Enter`&&r.trim()&&!i&&o()},t[12]=i,t[13]=r,t[14]=o,t[15]=_):_=t[15];let v=l.meetPlaceholder,y;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=c(rt,`h-10 flex-1 bg-surface-base/90`),t[16]=y):y=t[16];let b;t[17]!==r||t[18]!==l.meetPlaceholder||t[19]!==g||t[20]!==_?(b=(0,$.jsx)(`input`,{id:`you-call-name`,value:r,maxLength:80,onChange:g,onKeyDown:_,placeholder:v,className:y}),t[17]=r,t[18]=l.meetPlaceholder,t[19]=g,t[20]=_,t[21]=b):b=t[21];let x;t[22]!==i||t[23]!==r?(x=i||!r.trim(),t[22]=i,t[23]=r,t[24]=x):x=t[24];let S=i?l.meetSaving:l.meetSave,C;t[25]!==o||t[26]!==x||t[27]!==S?(C=(0,$.jsx)(p,{type:`button`,variant:`primary`,className:`h-10 shrink-0`,disabled:x,onClick:o,children:S}),t[25]=o,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;t[29]!==b||t[30]!==C||t[31]!==h?(w=(0,$.jsxs)(`div`,{className:`mt-5 flex max-w-xl flex-col gap-2 sm:flex-row`,children:[h,b,C]}),t[29]=b,t[30]=C,t[31]=h,t[32]=w):w=t[32];let T;t[33]!==n||t[34]!==l.meetSource?(T=n?(0,$.jsxs)(`p`,{className:`mt-3 flex items-start gap-1.5 text-xs leading-5 text-fg-subtle`,children:[(0,$.jsx)(xe,{className:`mt-0.5 size-3.5 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsx)(`span`,{children:l.meetSource})]}):null,t[33]=n,t[34]=l.meetSource,t[35]=T):T=t[35];let E;t[36]!==i||t[37]!==s||t[38]!==l.meetLater?(E=(0,$.jsx)(`button`,{type:`button`,disabled:i,className:`mt-3 text-xs font-medium text-fg-muted hover:text-fg hover:underline disabled:opacity-60`,onClick:s,children:l.meetLater}),t[36]=i,t[37]=s,t[38]=l.meetLater,t[39]=E):E=t[39];let D;return t[40]!==w||t[41]!==T||t[42]!==E||t[43]!==d||t[44]!==m?(D=(0,$.jsx)(`section`,{className:`relative overflow-hidden rounded-2xl border border-accent/25 bg-gradient-to-br from-accent-soft/80 via-surface-panel to-surface-panel p-5 sm:p-6`,children:(0,$.jsxs)(`div`,{className:`relative max-w-2xl`,children:[d,m,w,T,E]})}),t[40]=w,t[41]=T,t[42]=E,t[43]=d,t[44]=m,t[45]=D):D=t[45],D}function _t(){let e=u(e=>e.language),t=l(e).you,n=a(),[r,s]=i(),m=et(r.get(`tab`)),h=j(e=>e.setPageHeader),v=j(e=>e.clearPageHeader),{data:b,error:w,isLoading:D,mutate:k}=d(`/api/you`,z),[M,N]=(0,Q.useState)(null),[F,I]=(0,Q.useState)(!1),[V,te]=(0,Q.useState)(``),[J,ae]=(0,Q.useState)(`preference`),[X,se]=(0,Q.useState)(!1),[le,pe]=(0,Q.useState)(null),[he,ve]=(0,Q.useState)(!1),[Ce,we]=(0,Q.useState)(null),[Te,Ee]=(0,Q.useState)(!1),[De,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=b?.profile??{callName:``,pronouns:``,timezone:``,notes:``},wt=(0,Q.useMemo)(()=>b?.understanding.filter(e=>e.status===`active`)??[],[b]),Tt=(0,Q.useMemo)(()=>b?.understanding.filter(e=>e.status!==`active`)??[],[b]),Et=(0,Q.useMemo)(()=>b?.connectedClaims.filter(e=>e.state!==`rejected`)??[],[b]),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??b?.controls??null,At=b?.sources.filter(e=>e.installed&&e.enabled)??[],jt=At.filter(e=>[`failed`,`unauthorized`,`degraded`,`not_configured`].includes(e.status));(0,Q.useEffect)(()=>{let e=()=>{k()};return window.addEventListener(`connector-learning-updated`,e),()=>window.removeEventListener(`connector-learning-updated`,e)},[k]),(0,Q.useEffect)(()=>{if(m!==`memory`||!vt)return;let e=requestAnimationFrame(()=>{(vt===`profile`?bt:xt).current?.scrollIntoView({behavior:`smooth`,block:`start`}),yt(null)});return()=>cancelAnimationFrame(e)},[vt,m]);async function Mt(e){if(!(!b||We)){Ge(!0);try{let n=await me(e);await k({...b,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){N(`claim:${e.id}`);try{let t=await _e(e.id,n);await k(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{N(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){N(`source-learning:${e.instanceId}`);try{e.learning?.status===`paused`?await Me(e.instanceId,!1):await je(e.instanceId),await k(),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{N(null)}}},Rt=async e=>{if(e.instanceId){N(`source-learning:${e.instanceId}`);try{await Me(e.instanceId,!0),await k()}catch(n){Z({type:`error`,title:e.displayName,message:n instanceof Error?n.message:t.sourceLearningStartFailed})}finally{N(null)}}};(0,Q.useLayoutEffect)(()=>(h({startExtra:null,main:(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:t.title}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:t.subtitle})]}),end:(0,$.jsxs)(p,{type:`button`,variant:`ghost`,className:`h-8 gap-1.5 px-2.5 text-xs`,onClick:()=>Ye(!0),children:[(0,$.jsx)(q,{className:`size-3.5`,"aria-hidden":!0}),t.howItWorks]})}),()=>v()),[v,h,t.howItWorks,t.subtitle,t.title]),(0,Q.useEffect)(()=>{!b||b.profile.callName||Oe(b.profileSetup.callNameSuggestion?.value??``)},[b,b?.profile.callName,b?.profileSetup.callNameSuggestion?.id]);async function zt(e,n,r){N(e.id);try{let t=await ye(e.id,{action:n,content:r});await k(r=>r&&{...r,understanding:n===`reject`?r.understanding.filter(t=>t.id!==e.id):r.understanding.map(n=>n.id===e.id?t:n)},{revalidate:!1}),k()}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{N(null)}}async function Bt(e,n){N(`consent:${e}`);try{await y(e,n),await k(),Z({type:`success`,title:t.title,message:t.saved})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{N(null)}}async function Vt(){let e=V.trim();if(e){N(`understanding:new`);try{await L({content:e,kind:J}),te(``),I(!1),se(!1),await k(),Z({type:`success`,title:t.understandingTitle,message:t.saved})}catch{Z({type:`error`,title:t.understandingTitle,message:t.saveError})}finally{N(null)}}}async function Ht(){if(Tt.length){N(`understanding:batch`);try{await S(Tt.map(e=>e.id),`confirm`),await k()}catch{Z({type:`error`,title:t.reviewTitle,message:t.saveError})}finally{N(null)}}}async function Ut(e,n){N(`conflict:${e}`);try{await f(e,n),await k()}catch{Z({type:`error`,title:t.conflictsTitle,message:t.saveError})}finally{N(null)}}async function Wt(e){N(`grant:${e}`);try{await ee(e),await k()}catch{Z({type:`error`,title:t.grantsTitle,message:t.saveError})}finally{N(null)}}async function Gt(r,i){N(`insight:${r.id}`);try{let t=await ie(r.id,{action:i,uiLocale:e});await k(),i===`apply`&&t.href&&n(t.href)}catch{Z({type:`error`,title:t.insightsTitle,message:t.saveError})}finally{N(null)}}async function Kt(e){N(`playbook:${e.id}`);try{await ue(e.id,!e.enabled),await k()}catch{Z({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{N(null)}}async function qt(e,n){N(`playbook:${e}`);try{await n(),await k()}catch{Z({type:`error`,title:t.playbooksTitle,message:t.saveError})}finally{N(null)}}async function Jt(){if(le){N(le.id);try{await H(le.id);let e=le.id;pe(null),await k(t=>t&&{...t,understanding:t.understanding.filter(t=>t.id!==e)},{revalidate:!1}),k()}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{N(null)}}}async function Yt(){if(Ce){Ee(!0);try{let e=await oe(Ce);ve(!1),we(null),await k(t=>t&&{...t,...e},{revalidate:!1})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{Ee(!1)}}}async function Xt(){let e=De.trim();if(!(!e||Ne)){Pe(!0);try{let t=await oe({callName:e,timezone:Ct.timezone||ne()});await k(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 Se(`snooze`);await k(t=>t&&{...t,profileSetup:e.profileSetup},{revalidate:!1})}catch{Z({type:`error`,title:t.title,message:t.saveError})}finally{Pe(!1)}}}function Qt(){we(Ct),ve(!0),Ft(`profile`)}function $t(e,t=!1){ae(e),se(t),I(!0),Pt(`memory`)}function en(){I(!1),se(!1),te(``)}async function tn(e){if(!Be){ze(e),Ve(!0);try{ze(await W(e)),await k(),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===b?.trust.defaultActionLevel)){Ue(!0);try{let n=await K(e);await k(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 k(),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 C(),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 O(JSON.parse(await e.text()));await k(),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:_},{id:`memory`,label:t.tabs.memory,icon:A,count:Tt.length+Dt.length||void 0},{id:`collaboration`,label:t.tabs.collaboration,icon:g},{id:`sources`,label:t.tabs.sources,icon:R},{id:`privacy`,label:t.tabs.privacy,icon:xe}],activeTab:m,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})]}),D?(0,$.jsx)(st,{}):w||!b?(0,$.jsx)(`div`,{className:`rounded-2xl border border-danger/25 bg-danger-soft p-5 text-sm text-danger`,children:t.loadError}):null,b&&m===`overview`?(0,$.jsxs)(`div`,{id:`you-panel-overview`,role:`tabpanel`,"aria-labelledby":`you-tab-overview`,className:`space-y-4`,children:[!Ct.callName&&b.profileSetup.shouldPrompt?(0,$.jsx)(gt,{suggestion:b.profileSetup.callNameSuggestion,draft:De,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)(p,{type:`button`,variant:`secondary`,onClick:()=>Ft(`review`),children:[it(t.reviewCount,Tt.length+Dt.length),(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0})]}):null,jt.length>0?(0,$.jsxs)(p,{type:`button`,variant:`secondary`,onClick:()=>Pt(`sources`),children:[it(t.sourceIssues,jt.length),(0,$.jsx)(re,{className:`size-4`,"aria-hidden":!0})]}):null,Ct.callName?null:(0,$.jsxs)(p,{type:`button`,variant:`secondary`,onClick:Qt,children:[t.completeProfile,(0,$.jsx)(re,{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})]})]})}),b.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)(G,{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:b.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)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:M===`insight:${e.id}`,onClick:()=>void Gt(e,`dismiss`),children:t.notNow}),(0,$.jsx)(p,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:M===`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)(ce,{className:`size-4 text-accent`,"aria-hidden":!0}),t.profileTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.profileHint})]}),(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Ft(`profile`),children:(0,$.jsx)(re,{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)(A,{className:`size-4 text-accent`,"aria-hidden":!0}),t.understandingTitle]}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:t.understandingHint})]}),(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>Pt(`memory`),children:(0,$.jsx)(re,{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,b&&m===`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)(ce,{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})]}),he?null:(0,$.jsxs)(p,{type:`button`,variant:`secondary`,onClick:Qt,children:[(0,$.jsx)(E,{className:`size-3.5`,"aria-hidden":!0}),t.edit]})]}),he&&Ce?(0,$.jsxs)(`div`,{className:`mt-5`,children:[(0,$.jsx)(Fe,{value:Ce,onChange:we,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)(p,{type:`button`,variant:`ghost`,onClick:()=>{ve(!1),we(null)},children:t.cancel}),(0,$.jsx)(p,{type:`button`,variant:`primary`,disabled:Te,onClick:()=>void Yt(),children:Te?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":F&&!X&&J===`preference`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,F&&!X&&J===`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":F&&!X&&J===`boundary`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,F&&!X&&J===`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":F&&!X&&J===`current_state`,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,F&&!X&&J===`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":F&&X,className:c(`rounded-xl border bg-surface-panel p-4 text-left transition-colors hover:border-accent/30 hover:bg-surface-hover`,F&&X?`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})]})]}),F?(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:X?t.addOther:J===`preference`?t.addPreference:J===`boundary`?t.addBoundary:t.addCurrentFocus}),(0,$.jsx)(`p`,{className:`mt-1 text-xs leading-5 text-fg-muted`,children:X?t.addOtherHint:J===`preference`?t.addPreferenceHint:J===`boundary`?t.addBoundaryHint:t.addCurrentFocusHint})]}),X?null:(0,$.jsx)(at,{children:t.understandingKinds[J]})]}),(0,$.jsx)(`textarea`,{className:c(rt,`mt-3 min-h-24 resize-y`),value:V,onChange:e=>te(e.target.value),placeholder:t.understandingPlaceholders[J],autoFocus:!0}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-end justify-between gap-3`,children:[X?(0,$.jsxs)(`label`,{className:`grid min-w-48 gap-1 text-xs font-medium text-fg-muted`,children:[t.understandingKind,(0,$.jsx)(fe,{value:J,onChange:e=>ae(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)(p,{type:`button`,variant:`ghost`,onClick:en,children:t.cancel}),(0,$.jsx)(p,{type:`button`,variant:`primary`,disabled:!V.trim()||M===`understanding:new`,onClick:()=>void Vt(),children:t.add})]})]})]}):null]}),b.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:b.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)(p,{type:`button`,variant:`secondary`,className:`h-8 shrink-0 px-2.5`,disabled:M===`conflict:${n.id}`,onClick:()=>void Ut(n.id,r.id),children:t.useThis})]},r.id))},n.id))})]}):null,b.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})]}),b.consentRequests.map(e=>(0,$.jsxs)(`article`,{className:`rounded-2xl border border-accent/25 bg-accent-soft/20 p-4`,children:[(0,$.jsx)(`p`,{className:`text-sm leading-6 text-fg`,children:e.statement}),(0,$.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:t.consentPurpose.replace(`{{purpose}}`,e.purpose)}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2`,children:[(0,$.jsx)(p,{type:`button`,variant:`ghost`,disabled:M===`consent:${e.id}`,onClick:()=>void Bt(e.id,`deny`),children:t.consentDeny}),(0,$.jsx)(p,{type:`button`,variant:`secondary`,disabled:M===`consent:${e.id}`,onClick:()=>void Bt(e.id,`once`),children:t.consentOnce}),(0,$.jsx)(p,{type:`button`,variant:`secondary`,disabled:M===`consent:${e.id}`,onClick:()=>void Bt(e.id,`session`),children:t.consentSession}),(0,$.jsx)(p,{type:`button`,variant:`primary`,disabled:M===`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:M===`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)(p,{type:`button`,variant:`secondary`,disabled:M===`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:M===n.id,onConfirm:()=>void zt(n,`confirm`),onReject:()=>void zt(n,`reject`),onUpdate:e=>void zt(n,`update`,e),onForget:()=>pe(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:M===n.id,onConfirm:()=>void zt(n,`confirm`),onReject:()=>void zt(n,`reject`),onUpdate:e=>void zt(n,`update`,e),onForget:()=>pe(n)},n.id))})]},n)}),b.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,b&&m===`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)(_,{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:b.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:b.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:b.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:b.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:b.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)(g,{className:`size-4 text-accent`,"aria-hidden":!0}),t.playbooksTitle]}),(0,$.jsx)(at,{children:t.affectsAgentsBadge})]}),b.playbooks.length>0?(0,$.jsx)(`div`,{className:`mt-4 grid gap-3 xl:grid-cols-3`,children:b.playbooks.map(e=>(0,$.jsx)(ft,{playbook:e,busy:M===`playbook:${e.id}`,t,onToggleGroup:()=>void Kt(e),onCreate:t=>void qt(e.id,()=>P(e.id,t,(e.rules.at(-1)?.order??0)+10)),onUpdate:(t,n)=>void qt(e.id,()=>U(e.id,t,n)),onDelete:t=>void qt(e.id,()=>T(e.id,t)),onRollback:(t,n)=>void qt(e.id,()=>be(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,b&&m===`sources`?(0,$.jsx)(Xe,{sources:b.sources,language:e,t,busyId:M,onAddSource:()=>n(`/connectors?personalContext=1`),onLearn:e=>void Lt(e),onPause:e=>void Rt(e),onConfigure:It,onDisconnect:dt,onViewUnderstanding:()=>Pt(`memory`)}):null,b&&m===`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:b.trust.levels.map(e=>(0,$.jsxs)(`button`,{type:`button`,"aria-pressed":e===b.trust.defaultActionLevel,disabled:He,onClick:()=>{e!==b.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===b.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===b.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)(xe,{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}),b.referenceGrants.length>0?(0,$.jsx)(`div`,{className:`mt-3 divide-y divide-edge overflow-hidden rounded-xl border border-edge bg-surface-panel`,children:b.referenceGrants.map(n=>(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3 px-4 py-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsx)(`p`,{className:`truncate text-sm text-fg`,children:n.statement}),(0,$.jsxs)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:[n.grantScope?t.grantScopes[n.grantScope]:``,n.expiresAt?` · ${ot(n.expiresAt,e)}`:``]})]}),(0,$.jsx)(p,{type:`button`,variant:`ghost`,className:`h-8 px-2.5`,disabled:M===`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)(p,{type:`button`,variant:`secondary`,disabled:ht!==null,onClick:()=>void an(),children:[(0,$.jsx)(B,{className:`size-4`,"aria-hidden":!0}),ht===`export`?t.exporting:t.exportAction]}),(0,$.jsxs)(p,{type:`button`,variant:`secondary`,disabled:ht!==null,onClick:()=>St.current?.click(),children:[(0,$.jsx)(x,{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:le!==null,title:t.forgetTitle,description:t.forgetBody,confirmLabel:t.forget,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void Jt(),onCancel:()=>pe(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-CarlxqXV.js";import{n as ee}from"./locale-store-sToMfHX_.js";import{Ao as te,As as s,At as ne,Do as re,Eo as c,Fl as l,Fo as ie,Io as ae,Lo as u,Mo as d,No as oe,Ns as f,Oo as se,Po as ce,Pt as le,Ro as ue,Wl as de,gu as fe,iu as pe,jl as me,jo as p,js as he,ko as ge,nl as m,ro as h,uc as g,vu as _e,zl as ve}from"./index-2UImfRDC.js";import{l as ye,t as be}from"./api-Bop4IQRW.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=>{c.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 se();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)=>{c.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:d,startRun:ae,fetchRun:p,shouldStop:()=>G.current,onRun:(e,t,r)=>{Ne(e,t,r),n||(n=!0,c.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=le({onPicked:(0,_.useCallback)(async e=>{k(!0),j(null);try{T(await oe(e)),C(`consent`)}catch(e){j(b(e)),C(`intro`)}finally{k(!1)}},[])});(0,_.useEffect)(()=>{let e=!1;return te().then(async({enabled:t,state:n})=>{if(!e){if(!t){v(`/chat`,{replace:!0});return}if(!x&&n.activeRunId)try{let t=await p(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 p(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 ge()}finally{v(`/chat`,{replace:!0})}},Ie=async()=>{if(w){k(!0),j(null),H([]),W({current:0,total:0});try{await d(w.canonicalRootPath);let e=await ae(w.canonicalRootPath);K(e),c.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 re(E.id)))},X=async(t,n)=>{if(!E)return;await ie(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 u((e.length>0?await ue(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 u(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 u(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)(he,{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)(s,{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)(m,{className:`size-4 animate-spin`}):(0,y.jsx)(g,{className:`size-4`}),t.quickScan]}),(0,y.jsxs)(s,{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)(m,{className:`size-4 animate-spin`}):(0,y.jsx)(l,{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)(g,{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)(l,{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)(g,{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)(s,{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)(m,{className:`mr-2 size-4 animate-spin`}):null,t.analyzeSelected.replace(`{{count}}`,String(V.size))]}),(0,y.jsx)(s,{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)(l,{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)(ve,{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)(f,{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)(g,{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)(s,{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)(m,{className:`mr-2 size-4 animate-spin`}):null,t.startAnalysis]}),(0,y.jsx)(s,{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)(m,{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)(s,{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)(me,{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)(s,{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)(s,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,disabled:O,onClick:()=>void ze(),children:[O?(0,y.jsx)(m,{className:`size-4 animate-spin`}):(0,y.jsx)(a,{className:`size-4`}),t.confirmUnderstanding]}),(0,y.jsx)(s,{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)(s,{variant:`ghost`,disabled:O||!N.trim(),onClick:()=>void Z(`different_goal`),children:t.differentGoal}),(0,y.jsx)(s,{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)(fe,{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)(pe,{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)(s,{className:`h-10 bg-accent px-4 text-white hover:bg-accent-hover`,onClick:()=>void X(Q,!1),children:t.startRecommendedAction}),(0,y.jsx)(s,{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)(de,{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)(s,{className:`mt-3 h-9`,variant:`secondary`,disabled:O,onClick:()=>void Ve(),children:[O?(0,y.jsx)(m,{className:`size-4 animate-spin`}):(0,y.jsx)(de,{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)(_e,{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)(fe,{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)(f,{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)(s,{className:`h-11 flex-1 bg-accent text-white hover:bg-accent-hover`,onClick:()=>void ce(E.id).then(K),children:t.retry}),(0,y.jsx)(s,{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)(ne,{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-CarlxqXV.js";import{n as ee}from"./locale-store-sToMfHX_.js";import{A as l,As as u,Bc as te,Cc as ne,Fa as re,Gl as ie,Ks as d,Pu as f,Sc as ae,To as p,Xs as m,Yl as oe,Zc as h,a as g,f as se,is as _,jc as ce,jl as le,l as ue,m as de,mu as fe,ns as pe,o as me,p as v,s as he,u as y,vt as b,xu as x,zl as S}from"./index-2UImfRDC.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=p(e=>e.setPageHeader),K=p(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([re(t.item.projectId).catch(()=>null),l().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 se(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 g(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 v(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 me(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)(u,{type:`button`,variant:`ghost`,className:`h-8 rounded-lg px-2.5 text-xs`,onClick:()=>void J(),children:[(0,T.jsx)(ne,{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)(u,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`hidden md:inline`,children:n.detail.startChat})]}),(0,T.jsxs)(u,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(m,{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)(f,{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)(x,{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)(f,{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)(x,{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)(u,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:Y,children:[(0,T.jsx)(h,{className:`size-3.5`,"aria-hidden":!0}),n.detail.startChat]}),(0,T.jsxs)(u,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:X,children:[(0,T.jsx)(m,{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)(S,{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)(le,{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)(pe,{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)(_,{value:``,children:n.detail.noWorkflowTemplates}):null,N.map(e=>(0,T.jsx)(_,{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)(u,{type:`button`,variant:`primary`,className:`h-9 rounded-lg px-3 text-xs`,disabled:B||!P,onClick:xe,children:[(0,T.jsx)(ae,{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)(te,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,T.jsx)(`span`,{className:`truncate`,children:n.attachments.title})]}),(0,T.jsxs)(u,{type:`button`,variant:`secondary`,className:`h-8 rounded-lg px-2.5 text-xs`,disabled:B,onClick:()=>W.current?.click(),children:[(0,T.jsx)(ce,{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)(S,{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)(d,{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)(ie,{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)(fe,{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,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{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-CarlxqXV.js";import{n as u,o as d,r as f,s as p}from"./locale-store-sToMfHX_.js";import{n as m}from"./activity-store-DsFM1upC.js";import{$c as h,As as g,Bo as _,Ci as v,Ei as y,Go as b,Gs as x,Ho as S,Il as C,Kl as w,Ks as T,Nc as E,Ns as D,Nu as O,Si as k,Ti as A,To as j,Uo as M,Va as N,Vo as P,Wl as F,Wo as I,gc as L,gu as R,iu as z,jc as B,mu as ee,nl as V,oc as te,ro as H,tt as ne,vt as U,wi as re,xi as ie,yl as ae,yu as oe,zc as se,zo as ce,zu as le}from"./index-2UImfRDC.js";import{a as ue,d as de,l as fe,n as pe,s as me,t as he}from"./api-Bop4IQRW.js";import{t as ge}from"./copy-VueTIC2x.js";var W=e(t(),1),G=n();function K(e){try{return decodeURIComponent(e).trim()||null}catch{return null}}function q(e){if(!e)return null;let t=e.split(/[?#]/,1)[0],n=/^\/goals\/([^/]+)\/?$/.exec(t);if(n){let e=K(n[1]);return e?{kind:`goal`,id:e}:null}let r=/^\/chat\/([^/]+)\/?$/.exec(t);if(r){let e=K(r[1]);return!e||e===`new`?null:{kind:`session`,id:e}}return null}async function _e(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 J=r(),Y=3,ve={info:{Icon:ae,className:`text-accent-fg bg-accent-soft`},success:{Icon:ee,className:`text-success bg-success-soft`},warning:{Icon:x,className:`text-warning bg-warning-soft`},error:{Icon:s,className:`text-danger bg-danger-soft`}};function X(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 Z(e){let t=(0,G.c)(55),{item:n,targetAvailability:r}=e,i=u(be),o;t[0]===i?o=t[1]:(o=l(i),t[0]=i,t[1]=o);let s=o.projectsPage.workHome,d=m(ye),{Icon:f,className:p}=ve[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,J.jsx)(V,{className:`size-3.5 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}):(0,J.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,J.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,J.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,J.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,J.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,J.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,J.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=X(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,J.jsx)(`span`,{children:C}),t[25]=C,t[26]=w);let T;t[27]===n.occurrences?T=t[28]:(T=n.occurrences>1?(0,J.jsxs)(`span`,{children:[`×`,n.occurrences]}):null,t[27]=n.occurrences,t[28]=T);let E;t[29]!==s.activityCheckingRelated||t[30]!==s.activityRelatedMissing||t[31]!==s.activityViewRelated||t[32]!==n.href||t[33]!==r?(E=n.href&&r===`available`?(0,J.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,J.jsx)(R,{className:`size-3`,"aria-hidden":!0})]}):n.href&&r===`checking`?(0,J.jsx)(H,{className:`h-3 w-20 rounded`,"aria-label":s.activityCheckingRelated}):n.href&&r===`missing`?(0,J.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]=E):E=t[34];let O;t[35]!==w||t[36]!==T||t[37]!==E||t[38]!==S?(O=(0,J.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,T,E]}),t[35]=w,t[36]=T,t[37]=E,t[38]=S,t[39]=O):O=t[39];let k;t[40]!==O||t[41]!==b||t[42]!==x?(k=(0,J.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,J.jsx)(D,{className:`size-3.5`,"aria-hidden":!0}),t[47]=j):j=t[47];let M;t[48]!==s.activityRemove||t[49]!==A?(M=(0,J.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,J.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 ye(e){return e.remove}function be(e){return e.language}function xe(){let e=(0,G.c)(14),t=l(u(Me)).projectsPage.workHome,n=m(je),r=m(Ae),i=m(ke),[a,s]=(0,W.useState)(!1),c;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(c={},e[0]=c):c=e[0];let[d,f]=(0,W.useState)(c),p;e[1]===n?p=e[2]:(p=n.filter(Oe),e[1]=n,e[2]=p);let h=p.length,_;e[3]===n?_=e[4]:(_=n.filter(De),e[3]=n,e[4]=_);let v=_.length,y;e[5]!==a||e[6]!==n?(y=a?n:n.slice(0,Y),e[5]=a,e[6]=n,e[7]=y):y=e[7];let b=y,x;e[8]===n?x=e[9]:(x=[...new Set(n.flatMap(Ee))].sort().join(`
2
- `),e[8]=n,e[9]=x);let S=x,C,w;e[10]===S?(C=e[11],w=e[12]):(C=()=>{let e=new AbortController,t=new Map((S?S.split(`
3
- `):[]).flatMap(Te));return f(Object.fromEntries([...t.keys()].map(Q))),Promise.all([...t].map(async t=>{let[n,r]=t,i=await _e(r,e.signal);e.signal.aborted||f(e=>({...e,[n]:i}))})).catch(we),()=>e.abort()},w=[S],e[10]=S,e[11]=C,e[12]=w),(0,W.useEffect)(C,w);let E;return e[13]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,J.jsx)(le,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),e[13]=E):E=e[13],(0,J.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,"aria-labelledby":`workbench-activity-title`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsx)(`div`,{children:(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[E,(0,J.jsx)(`h2`,{id:`workbench-activity-title`,className:`text-sm font-semibold text-fg`,children:t.activityTitle}),h>0?(0,J.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,J.jsx)(V,{className:`size-3 animate-spin motion-reduce:animate-none`,"aria-hidden":!0}),h,` `,t.running]}):v>0?(0,J.jsxs)(`span`,{className:`rounded-full bg-surface-panel px-2 py-0.5 text-[11px] font-medium text-fg-muted`,children:[v,` `,t.activityNew]}):null]})}),a&&n.length>0?(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v>0?(0,J.jsxs)(g,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:r,children:[(0,J.jsx)(o,{className:`size-3.5`,"aria-hidden":!0}),t.activityMarkRead]}):null,n.some(Ce)?(0,J.jsxs)(g,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs text-fg-muted`,onClick:i,children:[(0,J.jsx)(T,{className:`size-3.5`,"aria-hidden":!0}),t.activityClearFinished]}):null]}):null]}),n.length>0?(0,J.jsxs)(`div`,{className:`mt-3 px-1`,children:[b.map(e=>(0,J.jsx)(Z,{item:e,targetAvailability:e.href&&q(e.href)?d[e.href]??`checking`:`available`},e.id)),n.length>Y?(0,J.jsx)(`div`,{className:`border-t border-edge-subtle py-2 text-center`,children:(0,J.jsx)(g,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,onClick:()=>s(Se),children:a?t.activityShowLess:t.activityShowAll.replace(`{{count}}`,String(n.length))})}):null]}):(0,J.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 text-sm text-fg-muted`,children:[(0,J.jsx)(z,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`p`,{children:t.activityEmpty})]})]})}function Se(e){return!e}function Ce(e){return e.status===`done`}function we(){}function Q(e){return[e,`checking`]}function Te(e){let t=q(e);return t?[[e,t]]:[]}function Ee(e){return e.href&&q(e.href)?[e.href]:[]}function De(e){return!e.read}function Oe(e){return e.status===`running`}function ke(e){return e.clearFinished}function Ae(e){return e.markAllRead}function je(e){return e.items}function Me(e){return e.language}function Ne(e){let t=(0,G.c)(32),{focus:n,kind:r,language:i,busy:a,onMonitor:o}=e,s;t[0]===i?s=t[1]:(s=ge(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,J.jsx)(`span`,{className:p,"aria-hidden":!0}),t[22]=p,t[23]=m);let h;t[24]!==m||t[25]!==u?(h=(0,J.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 _;t[27]===f?_=t[28]:(_=(0,J.jsx)(`span`,{className:`shrink-0 text-[11px] text-fg-subtle`,children:f}),t[27]=f,t[28]=_);let v;t[29]!==h||t[30]!==_?(v=(0,J.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[h,_]}),t[29]=h,t[30]=_,t[31]=v):v=t[31],l=(0,J.jsxs)(`div`,{className:`rounded-lg border border-edge-subtle bg-surface-base/70 px-3 py-2.5`,children:[v,s?(0,J.jsxs)(`p`,{className:`mt-1.5 text-[11px] text-fg-subtle`,children:[i?.lastRunAt?`${c.lastRun} ${U(new Date(i.lastRunAt))}`:c.neverRun,i?.nextRunAt?` · ${c.nextRun} ${U(new Date(i.nextRunAt))}`:``]}):(0,J.jsx)(g,{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 Pe(e){let t=(0,G.c)(61),{focus:n,language:r,busy:a,onMonitor:o,onStatus:s,onDelete:c}=e,l;t[0]===r?l=t[1]:(l=ge(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,J.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,J.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,J.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,J.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[13]=g):g=t[13];let _;t[14]===a?_=t[15]:(_=(0,J.jsx)(y,{asChild:!0,children:(0,J.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]=_);let b;t[16]!==n.status||t[17]!==s?(b=()=>s(n.status===`paused`?`active`:`paused`),t[16]=n.status,t[17]=s,t[18]=b):b=t[18];let x;t[19]===n.status?x=t[20]:(x=n.status===`paused`?(0,J.jsx)(E,{className:`size-4`}):(0,J.jsx)(se,{className:`size-4`}),t[19]=n.status,t[20]=x);let S=n.status===`paused`?u.resume:u.pause,C;t[21]!==S||t[22]!==b||t[23]!==x?(C=(0,J.jsxs)(k,{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:b,children:[x,S]}),t[21]=S,t[22]=b,t[23]=x,t[24]=C):C=t[24];let D;t[25]===s?D=t[26]:(D=()=>s(`completed`),t[25]=s,t[26]=D);let O;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,J.jsx)(ee,{className:`size-4`}),t[27]=O):O=t[27];let j;t[28]!==u.complete||t[29]!==D?(j=(0,J.jsxs)(k,{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:[O,u.complete]}),t[28]=u.complete,t[29]=D,t[30]=j):j=t[30];let M;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,J.jsx)(A,{className:`my-1 h-px bg-edge-subtle`}),t[31]=M):M=t[31];let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,J.jsx)(T,{className:`size-4`}),t[32]=N):N=t[32];let P;t[33]!==u.remove||t[34]!==c?(P=(0,J.jsxs)(k,{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:[N,u.remove]}),t[33]=u.remove,t[34]=c,t[35]=P):P=t[35];let F;t[36]!==C||t[37]!==j||t[38]!==P?(F=(0,J.jsx)(v,{children:(0,J.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:[C,j,M,P]})}),t[36]=C,t[37]=j,t[38]=P,t[39]=F):F=t[39];let I;t[40]!==F||t[41]!==_?(I=(0,J.jsxs)(re,{children:[_,F]}),t[40]=F,t[41]=_,t[42]=I):I=t[42];let L;t[43]!==I||t[44]!==h?(L=(0,J.jsxs)(`div`,{className:`flex items-start gap-3`,children:[h,I]}),t[43]=I,t[44]=h,t[45]=L):L=t[45];let R;t[46]!==a||t[47]!==n||t[48]!==r||t[49]!==o?(R=(0,J.jsxs)(`div`,{className:`mt-3 grid gap-2 sm:grid-cols-2`,children:[(0,J.jsx)(Ne,{focus:n,kind:`progress`,language:r,busy:a,onMonitor:o}),(0,J.jsx)(Ne,{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]=R):R=t[50];let z;t[51]!==n.id||t[52]!==d?(z=()=>d(`/work/focuses/${encodeURIComponent(n.id)}`),t[51]=n.id,t[52]=d,t[53]=z):z=t[53];let B;t[54]!==u.details||t[55]!==z?(B=(0,J.jsxs)(`button`,{type:`button`,className:`mt-3 text-xs font-medium text-accent hover:underline`,onClick:z,children:[u.details,` →`]}),t[54]=u.details,t[55]=z,t[56]=B):B=t[56];let V;return t[57]!==L||t[58]!==R||t[59]!==B?(V=(0,J.jsxs)(`article`,{className:`group rounded-xl border border-edge-subtle bg-surface-panel p-4 transition-colors hover:border-edge-strong`,children:[L,R,B]}),t[57]=L,t[58]=R,t[59]=B,t[60]=V):V=t[60],V}function Fe(e){return p(f(`/api/home${e?`?locale=${encodeURIComponent(e)}`:``}`))}function Ie(e,t){return p(f(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function Le(e){return p(f(`/api/home/attention/acknowledge`),{method:`POST`,body:JSON.stringify(e)})}function Re(e){return p(f(`/api/home/attention/retry`),{method:`POST`,body:JSON.stringify(e)})}function ze(e){return e===`zh`?{newWork:`交给 xopc`,dialogTitle:`现在想完成什么?`,dialogDescription:`发送后会直接进入对话,xopc 会立即开始处理。`,intentLabel:`告诉 xopc 你要做什么`,intentPlaceholder:`例如:整理这周的会议记录,提炼待办并给出下周优先级`,submit:`进入对话`,needsAttention:`需要你处理`,runAttention:`运行异常`,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 attention`,runAttention:`Run issues`,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 Be(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>String(t[n]??``))}function Ve(e,t){if(e==null)return t;let n=new Date(e);return Number.isNaN(n.getTime())?t:U(n)}function $(e){let t=(0,G.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,J.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 He(){let e=(0,G.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`space-y-5`,"aria-busy":!0,children:[(0,J.jsx)(H,{className:`h-20 rounded-2xl`}),(0,J.jsx)(H,{className:`h-72 rounded-2xl`}),(0,J.jsx)(H,{className:`h-44 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Ue(e){let t=(0,G.c)(19),{item:n,statusLabel:r}=e,i=`/work-items/${encodeURIComponent(n.id)}`,o;t[0]===n.title?o=t[1]:(o=(0,J.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,J.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,J.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,J.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,J.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,J.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,J.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 We(e){let t=(0,G.c)(15),{chat:n,statusLabel:r}=e,i=`/chat/${encodeURIComponent(n.key)}`,o;t[0]===n.name?o=t[1]:(o=(0,J.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,J.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,J.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=Ve(n.updatedAt,``),t[7]=n.updatedAt,t[8]=l);let u;t[9]===l?u=t[10]:(u=(0,J.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,J.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 Ge(e){let t=(0,G.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,J.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,J.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,J.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,J.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,J.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 _;t[12]===n.detail?_=t[13]:(_=n.detail?(0,J.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]=_);let v;t[14]!==n.href||t[15]!==h||t[16]!==_?(v=(0,J.jsxs)(a,{to:n.href,className:`group block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[h,_]}),t[14]=n.href,t[15]=h,t[16]=_,t[17]=v):v=t[17];let y;t[18]!==o||t[19]!==c||t[20]!==s||t[21]!==n.response||t[22]!==l?(y=n.response?(0,J.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2 border-t border-warning/20 pt-3`,children:[(0,J.jsx)(g,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:()=>l(`deny`),children:s}),(0,J.jsx)(g,{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]=y):y=t[23];let b;return t[24]!==v||t[25]!==y?(b=(0,J.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,y]}),t[24]=v,t[25]=y,t[26]=b):b=t[26],b}function Ke(e){let t=(0,G.c)(32),{item:n,statusLabel:r,retryLabel:i,viewLabel:o,acknowledgeLabel:s,busy:c,onView:l,onRetry:u,onAcknowledge:d}=e,f;t[0]===n.title?f=t[1]:(f=(0,J.jsx)(`h3`,{className:`min-w-0 truncate text-sm font-semibold text-fg`,children:n.title}),t[0]=n.title,t[1]=f);let p;t[2]===r?p=t[3]:(p=(0,J.jsx)(`span`,{className:`shrink-0 rounded-full bg-surface-panel/80 px-2 py-0.5 text-[11px] font-medium text-danger`,children:r}),t[2]=r,t[3]=p);let m;t[4]!==f||t[5]!==p?(m=(0,J.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[f,p]}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]===n.detail?h=t[8]:(h=(0,J.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:n.detail}),t[7]=n.detail,t[8]=h);let _;t[9]!==n.href||t[10]!==m||t[11]!==h?(_=(0,J.jsxs)(a,{to:n.href,className:`block focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,children:[m,h]}),t[9]=n.href,t[10]=m,t[11]=h,t[12]=_):_=t[12];let v;t[13]!==s||t[14]!==c||t[15]!==d?(v=(0,J.jsx)(g,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:d,children:s}),t[13]=s,t[14]=c,t[15]=d,t[16]=v):v=t[16];let y;t[17]!==c||t[18]!==l||t[19]!==o?(y=(0,J.jsx)(g,{type:`button`,variant:`ghost`,className:`h-8 px-2`,disabled:c,onClick:l,children:o}),t[17]=c,t[18]=l,t[19]=o,t[20]=y):y=t[20];let b;t[21]!==c||t[22]!==u||t[23]!==i?(b=(0,J.jsx)(g,{type:`button`,variant:`primary`,className:`h-8 px-2`,disabled:c,onClick:u,children:i}),t[21]=c,t[22]=u,t[23]=i,t[24]=b):b=t[24];let x;t[25]!==v||t[26]!==y||t[27]!==b?(x=(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-2 border-t border-danger/15 pt-3`,children:[v,y,b]}),t[25]=v,t[26]=y,t[27]=b,t[28]=x):x=t[28];let S;return t[29]!==_||t[30]!==x?(S=(0,J.jsxs)(`article`,{className:`rounded-xl border border-danger/25 bg-danger-soft/35 p-3.5`,children:[_,x]}),t[29]=_,t[30]=x,t[31]=S):S=t[31],S}function qe(e){let t=(0,G.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,J.jsx)(C,{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,J.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[s,(0,J.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,J.jsx)(O,{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,J.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,J.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=Ve(p,``),t[10]=p,t[11]=m);let h;t[12]===m?h=t[13]:(h=(0,J.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,J.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 Je(){let e=u(e=>e.language),t=l(e),n=t.projectsPage,r=ge(e),o=ze(e),c=i(),d=j(e=>e.setPageHeader),f=j(e=>e.clearPageHeader),[p,m]=(0,W.useState)(null),[v,y]=(0,W.useState)([]),[x,C]=(0,W.useState)([]),[w,T]=(0,W.useState)([]),[E,O]=(0,W.useState)(!0),[k,A]=(0,W.useState)(null),[R,ee]=(0,W.useState)(``),[V,H]=(0,W.useState)(!1),[U,re]=(0,W.useState)(``),[ie,ae]=(0,W.useState)(null),[se,le]=(0,W.useState)(null),[G,K]=(0,W.useState)(null),[q,_e]=(0,W.useState)(null),Y=(0,W.useCallback)(async(t=!1)=>{t&&O(!0),A(null);try{let[t,n,r,i]=await Promise.all([Fe(e),N({limit:100,sortBy:`updatedAt`,sortOrder:`desc`}),me(),ue()]);m(t),y(n.items),C(r),T(i)}catch(e){A(e instanceof Error?e.message:String(e))}finally{O(!1)}},[e]);(0,W.useEffect)(()=>{Y(!0)},[Y]),(0,W.useEffect)(()=>{let e,t=t=>{e!==void 0&&window.clearTimeout(e),e=window.setTimeout(()=>{e=void 0,Y()},t)},n=()=>t(100),r=()=>t(750),i=[`session-created`,`agent-run-started`,`agent-run-ended`,`automation-run-completed`,`workflow-run-updated`,`workflow-run-error`,`focus-created`,`focus-updated`,`focus-deleted`,`focus-monitor-updated`,`focus-run-updated`,`focus-insight-updated`,`focus-candidate-updated`],a=[`session-updated`,`session-transcript-updated`];return i.forEach(e=>window.addEventListener(e,n)),a.forEach(e=>window.addEventListener(e,r)),()=>{i.forEach(e=>window.removeEventListener(e,n)),a.forEach(e=>window.removeEventListener(e,r)),e!==void 0&&window.clearTimeout(e)}},[Y]);let ve=(0,W.useMemo)(()=>{let e=R.trim().toLocaleLowerCase(),t=v.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)},[v,R]),X=(0,W.useMemo)(()=>p?.decisions??[],[p]),Z=(0,W.useMemo)(()=>p?.attention??[],[p]),ye=(0,W.useMemo)(()=>p?.work.current.filter(e=>e.status!==`needs_input`&&e.status!==`in_review`&&e.status!==`blocked`).slice(0,10)??[],[p]),be=(0,W.useCallback)(e=>{e.preventDefault();let t=U.trim();t&&(re(``),H(!1),c({pathname:`/chat/new`,search:`?${new URLSearchParams({draft:t,autoSend:`1`}).toString()}`},{state:{forceNewChat:!0}}))},[c,U]),Se=(0,W.useMemo)(()=>(0,J.jsxs)(g,{type:`button`,variant:`primary`,className:`h-9 rounded-lg`,onClick:()=>H(!0),children:[(0,J.jsx)(B,{className:`size-4`,"aria-hidden":!0}),o.newWork]}),[o.newWork]),Ce=(0,W.useCallback)(async(e,t)=>{if(e.response){ae(e.id),A(null);try{await Ie(e.response,t),await Y()}catch(e){A(e instanceof Error?e.message:String(e))}finally{ae(null)}}},[Y]),we=(0,W.useCallback)(async(e,t)=>{le(e.id),A(null);try{await t({kind:e.kind,runId:e.runId}),await Y()}catch(e){A(e instanceof Error?e.message:String(e))}finally{le(null)}},[Y]),Q=(0,W.useCallback)(async(e,t,n=r.operationDone)=>{K(e),A(null),_e(null);try{await t();let[e,r]=await Promise.all([me(),ue()]);C(e),T(r),_e(n)}catch(e){A(e instanceof Error?e.message:String(e))}finally{K(null)}},[r.operationDone]);return(0,W.useLayoutEffect)(()=>(d({startExtra:null,main:(0,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h1`,{className:`truncate text-base font-semibold tracking-tight text-fg`,children:n.title}),(0,J.jsx)(`p`,{className:`truncate text-xs text-fg-muted`,children:n.workHome.subtitle})]}),end:Se}),()=>f()),[f,Se,d,n.title,n.workHome.subtitle]),(0,J.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,J.jsx)(ce,{open:V,onOpenChange:H,children:(0,J.jsxs)(I,{children:[(0,J.jsx)(M,{className:`fixed inset-0 z-[80] bg-scrim backdrop-blur-[2px]`}),(0,J.jsxs)(P,{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,J.jsxs)(`div`,{className:`flex shrink-0 items-start gap-4 border-b border-edge px-5 py-4`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsx)(b,{className:`text-base font-semibold text-fg`,children:o.dialogTitle}),(0,J.jsx)(S,{className:`mt-1 text-sm leading-5 text-fg-muted`,children:o.dialogDescription})]}),(0,J.jsx)(_,{asChild:!0,children:(0,J.jsx)(g,{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,J.jsx)(D,{className:`size-4`,"aria-hidden":!0})})})]}),(0,J.jsxs)(`form`,{onSubmit:be,className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto px-5 py-4`,children:[(0,J.jsx)(`label`,{htmlFor:`new-work-outcome`,className:`mb-2 shrink-0 text-sm font-medium text-fg`,children:o.intentLabel}),(0,J.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:U,onChange:e=>re(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,J.jsxs)(`div`,{className:`mt-2 flex shrink-0 items-center justify-between gap-3 text-[11px] text-fg-subtle`,children:[(0,J.jsx)(`span`,{children:n.workHome.submitShortcut}),(0,J.jsxs)(`span`,{className:`tabular-nums`,children:[U.length.toLocaleString(),` / `,12e3.toLocaleString()]})]})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge px-5 py-4`,children:[(0,J.jsx)(_,{asChild:!0,children:(0,J.jsx)(g,{type:`button`,variant:`ghost`,children:n.cancel})}),(0,J.jsxs)(g,{type:`submit`,variant:`primary`,className:`min-w-32`,disabled:!U.trim(),children:[(0,J.jsx)(te,{className:`size-4`,"aria-hidden":!0}),o.submit]})]})]})]})]})}),k?(0,J.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,J.jsx)(`span`,{children:k}),(0,J.jsx)(g,{type:`button`,variant:`ghost`,className:`h-8 px-2`,onClick:()=>void Y(),children:n.workHome.retry})]}):null,E?(0,J.jsx)(He,{}):p?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`section`,{className:`border-b border-edge-subtle pb-5`,children:[(0,J.jsx)(`p`,{className:`text-xs font-medium text-fg-subtle`,children:n.workHome.briefingTitle}),(0,J.jsx)(`h2`,{className:`mt-1 text-xl font-semibold tracking-tight text-fg`,children:p.decisions.length+p.attention.length>0?Be(n.workHome.todaySummary,{attention:p.decisions.length+p.attention.length,moving:p.briefing.progress.movingCount+p.chats.running.length}):Be(n.workHome.todaySummaryClear,{moving:p.briefing.progress.movingCount+p.chats.running.length})}),p.briefing.summary?(0,J.jsx)(`p`,{className:`mt-2 max-w-3xl text-sm leading-6 text-fg-muted`,children:p.briefing.summary}):null]}),q?(0,J.jsx)(`div`,{role:`status`,className:`rounded-xl border border-success/25 bg-success-soft px-4 py-3 text-sm text-success`,children:q}):null,p.work.current.length===0&&p.workflowRuns.active.length===0&&p.decisions.length===0&&p.attention.length===0&&p.chats.running.length===0&&p.chats.recent.length===0&&p.upcomingAutomations.length===0&&x.length===0?(0,J.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-8 text-center`,children:[(0,J.jsx)(h,{className:`mx-auto size-6 text-accent`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`mt-3 text-sm font-semibold text-fg`,children:n.workHome.emptyTitle}),(0,J.jsx)(`p`,{className:`mx-auto mt-1 max-w-lg text-sm leading-6 text-fg-muted`,children:n.workHome.emptyBody}),(0,J.jsxs)(`div`,{className:`mt-4 flex justify-center gap-2`,children:[(0,J.jsx)(g,{type:`button`,variant:`primary`,onClick:()=>c(`/chat/new`),children:n.workHome.startChat}),(0,J.jsx)(g,{type:`button`,variant:`secondary`,onClick:()=>H(!0),children:o.newWork})]})]}):null,(0,J.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,2fr)_minmax(18rem,1fr)]`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 space-y-6`,children:[Z.length>0?(0,J.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(s,{className:`size-4 text-danger`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.runAttention}),(0,J.jsx)($,{children:Z.length.toLocaleString()})]}),(0,J.jsx)(`div`,{className:`mt-4 space-y-2`,children:Z.map(e=>(0,J.jsx)(Ke,{item:e,statusLabel:e.reason===`run_timeout`?n.workHome.attentionTimeout:n.workHome.attentionFailed,retryLabel:n.workHome.attentionRetry,viewLabel:n.workHome.attentionView,acknowledgeLabel:n.workHome.attentionAcknowledge,busy:se===e.id,onView:()=>c(e.href),onRetry:()=>void we(e,Re),onAcknowledge:()=>void we(e,Le)},e.id))})]}):null,X.length>0?(0,J.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(s,{className:`size-4 text-warning`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.needsAttention}),(0,J.jsx)($,{children:X.length.toLocaleString()})]}),(0,J.jsx)(`div`,{className:`mt-4 space-y-2`,children:X.map(e=>(0,J.jsx)(Ge,{item:e,kindLabel:n.workHome.decisionKinds[e.kind],reasonLabel:n.workHome.decisionReasons[e.reason],approveLabel:n.workHome.approve,denyLabel:n.workHome.deny,busy:ie===e.id,onRespond:t=>void Ce(e,t)},e.id))})]}):(0,J.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-fg-muted`,children:[(0,J.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,J.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(te,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.running}),(0,J.jsx)($,{children:(p.chats.running.length+p.workflowRuns.active.length).toLocaleString()})]}),(0,J.jsxs)(`div`,{className:`mt-4 divide-y divide-edge-subtle px-1`,children:[p.chats.running.map(e=>(0,J.jsx)(`div`,{className:`py-1`,children:(0,J.jsx)(We,{chat:e,statusLabel:n.workHome.running})},e.key)),p.workflowRuns.active.map(e=>(0,J.jsxs)(a,{to:ne(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,J.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,J.jsx)(`span`,{className:`size-1.5 shrink-0 rounded-full bg-accent`,"aria-hidden":!0}),(0,J.jsx)(`span`,{className:`truncate font-medium text-fg`,children:e.title})]}),(0,J.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,J.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:o.emptyRunning}):null]})]}),(0,J.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(z,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.continue}),(0,J.jsx)($,{children:ye.length.toLocaleString()})]}),(0,J.jsxs)(`div`,{className:`mt-4 divide-y divide-edge-subtle px-1`,children:[ye.map(e=>(0,J.jsx)(`div`,{className:`py-1`,children:(0,J.jsx)(Ue,{item:e,statusLabel:t.projectDetailPage.workItems.statuses[e.status]})},e.id)),ye.length===0?(0,J.jsx)(`p`,{className:`py-6 text-center text-sm text-fg-muted`,children:o.emptyContinue}):null]})]}),p.chats.recent.length>0?(0,J.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,J.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,J.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.recent})}),(0,J.jsx)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:p.chats.recent.slice(0,6).map(e=>(0,J.jsx)(We,{chat:e,statusLabel:o.openChat},e.key))})]}):null]}),(0,J.jsxs)(`aside`,{className:`min-w-0 space-y-4`,"aria-label":n.workHome.nowTitle,children:[(0,J.jsx)(`div`,{className:`px-1`,children:(0,J.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:n.workHome.nowTitle})}),p.upcomingAutomations.length>0?(0,J.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-4 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,J.jsx)(oe,{className:`size-4 text-fg-subtle`,"aria-hidden":!0}),(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.workHome.scheduled})]}),(0,J.jsx)(`div`,{className:`mt-2 divide-y divide-edge-subtle`,children:p.upcomingAutomations.slice(0,3).map(e=>(0,J.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,J.jsx)(`span`,{className:`min-w-0 truncate text-fg`,children:e.name||e.action}),(0,J.jsx)(`time`,{className:`shrink-0 text-xs text-fg-subtle`,children:Ve(e.nextRunAt,n.never)})]},e.id))})]}):null,(0,J.jsx)(xe,{}),p.briefing.wins.length>0?(0,J.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,J.jsx)(`span`,{children:Be(n.workHome.completedSummary,{count:p.briefing.wins.length})}),(0,J.jsxs)(`span`,{className:`shrink-0 text-xs font-medium text-accent`,children:[n.workHome.viewLatestResult,` →`]})]}):null]})]}),(0,J.jsxs)(`section`,{className:`rounded-2xl bg-surface-base p-5 shadow-surface`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,J.jsx)(F,{className:`size-4 text-accent`,"aria-hidden":!0}),(0,J.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:o.focuses}),(0,J.jsx)($,{children:x.length.toLocaleString()})]}),x.length>0?(0,J.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2`,children:x.slice(0,6).map(t=>(0,J.jsx)(Pe,{focus:t,language:e,busy:G===t.id,onMonitor:(e,n)=>void Q(t.id,async()=>{await he(t.id,e,n)},n?r.monitorStarted:r.monitorStopped),onStatus:e=>void Q(t.id,async()=>{await de(t.id,{status:e})}),onDelete:()=>{window.confirm(r.deleteConfirm)&&Q(t.id,()=>pe(t.id))}},t.id))}):(0,J.jsxs)(`div`,{className:`py-8 text-center`,children:[(0,J.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:r.empty}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.emptyHint})]})]}),w.length>0?(0,J.jsxs)(`section`,{className:`rounded-2xl border border-dashed border-edge p-5`,children:[(0,J.jsx)(`h2`,{className:`text-base font-semibold text-fg`,children:r.candidates}),(0,J.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:r.candidatesHint}),(0,J.jsx)(`div`,{className:`mt-4 space-y-2`,children:w.map(e=>(0,J.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,J.jsxs)(`div`,{className:`min-w-0`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e.title}),(0,J.jsx)(`p`,{className:`mt-1 line-clamp-2 text-xs leading-5 text-fg-muted`,children:e.summary})]}),(0,J.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[(0,J.jsx)(g,{variant:`ghost`,className:`h-8 text-xs`,disabled:G===e.id,onClick:()=>void Q(e.id,async()=>{await fe(e.id,`dismiss`)}),children:r.dismiss}),(0,J.jsx)(g,{variant:`primary`,className:`h-8 text-xs`,disabled:G===e.id,onClick:()=>void Q(e.id,async()=>{await fe(e.id,`accept`)}),children:r.accept})]})]},e.id))})]}):null]}):null,(0,J.jsxs)(`section`,{className:`border-t border-edge-subtle pt-7`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:o.projects}),(0,J.jsx)(a,{to:`/projects`,className:`text-xs font-medium text-accent hover:underline`,children:n.management.viewAll})]}),v.filter(e=>e.status!==`archived`).length>6?(0,J.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,J.jsxs)(`label`,{className:`relative block min-w-0`,children:[(0,J.jsx)(L,{className:`pointer-events-none absolute left-3 top-1/2 size-4 -translate-y-1/2 text-fg-subtle`,"aria-hidden":!0}),(0,J.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:R,onChange:e=>ee(e.target.value),placeholder:n.searchPlaceholder,"aria-label":n.searchPlaceholder})]})}):null,(0,J.jsx)(`div`,{className:`mt-4 grid gap-3 md:grid-cols-2 xl:grid-cols-3`,children:ve.map(e=>(0,J.jsx)(qe,{project:e,openLabel:n.workHome.openSpace,noDescription:n.noDescription},e.id))}),!E&&ve.length===0?(0,J.jsx)(`p`,{className:`py-8 text-center text-sm text-fg-muted`,children:n.workHome.noSpaces}):null]})]})}export{Je as WorkPage};