@xopcai/xopc 0.0.441 → 0.0.443

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 (367) hide show
  1. package/README.md +2 -3
  2. package/README.zh-CN.md +1 -2
  3. package/dist/browser-ext/_locales/en/messages.json +0 -28
  4. package/dist/browser-ext/_locales/zh_CN/messages.json +0 -28
  5. package/dist/browser-ext/dist/assets/{sidepanel-CQeQB5vW.css → sidepanel-lpBGVKwZ.css} +0 -42
  6. package/dist/browser-ext/dist/background.js +247 -647
  7. package/dist/browser-ext/dist/sidepanel.html +2 -2
  8. package/dist/browser-ext/dist/sidepanel.js +105 -346
  9. package/dist/browser-ext/manifest.json +1 -1
  10. package/dist/extensions/telegram/src/plugin.js +1 -1
  11. package/dist/extensions/telegram/xopc.extension.json +1 -1
  12. package/dist/gateway/static/root/assets/{activity-store-t5c6XavH.js → activity-store-CuPXAoLe.js} +1 -1
  13. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CSTtf3RI.js → agent-avatar-dicebear-D92uHOFV.js} +1 -1
  14. package/dist/gateway/static/root/assets/{agent-avatar-display-Cm0afn_O.js → agent-avatar-display-DINzeGs0.js} +2 -2
  15. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BMbsLf16.js → agent-defaults-settings-panel-rH1QpgiR.js} +1 -1
  16. package/dist/gateway/static/root/assets/{agent-plugin-dialog-DofyWKnP.js → agent-plugin-dialog-B2vXlrDW.js} +1 -1
  17. package/dist/gateway/static/root/assets/{agents-admin-api-CewiIx4v.js → agents-admin-api-DPLtjJtX.js} +1 -1
  18. package/dist/gateway/static/root/assets/{agents-CAqwtADW.js → agents-lvQfOQPN.js} +3 -3
  19. package/dist/gateway/static/root/assets/{api-CE6gdBWx.js → api-CEzBruRJ.js} +1 -1
  20. package/dist/gateway/static/root/assets/{api-DRyQFk9q.js → api-snfMD8_Y.js} +1 -1
  21. package/dist/gateway/static/root/assets/app-link-CdD448kS.js +1 -0
  22. package/dist/gateway/static/root/assets/{app-management-settings-panel-BZfs2ydm.js → app-management-settings-panel-CONwDpqL.js} +1 -1
  23. package/dist/gateway/static/root/assets/{appearance-settings-BA7spRv6.js → appearance-settings-Bu7K-_ri.js} +1 -1
  24. package/dist/gateway/static/root/assets/{apps-page-B0qorxfq.js → apps-page-C3iDd3ZQ.js} +1 -1
  25. package/dist/gateway/static/root/assets/{archive-plugin-CPCI6nqQ.js → archive-plugin-CfLz9o-2.js} +1 -1
  26. package/dist/gateway/static/root/assets/{automation-api-paBg5ie6.js → automation-api-Dl9fi8t0.js} +1 -1
  27. package/dist/gateway/static/root/assets/{automation-result-state-Ds-59DdX.js → automation-result-state-BjjZCxee.js} +1 -1
  28. package/dist/gateway/static/root/assets/{automation-run-list-Crw5qn_I.js → automation-run-list-9IPHu_UC.js} +1 -1
  29. package/dist/gateway/static/root/assets/automation-task-card-CKbHMLSy.js +3 -0
  30. package/dist/gateway/static/root/assets/{automations-page-D3Cb5vfR.js → automations-page-BDHgk3CW.js} +1 -1
  31. package/dist/gateway/static/root/assets/automations-workspace-B7D9U89Z.js +9 -0
  32. package/dist/gateway/static/root/assets/{binary-plugins-CFJCUpWH.js → binary-plugins-Bv4ixxo4.js} +1 -1
  33. package/dist/gateway/static/root/assets/{block-editor-DbG2QKd0.js → block-editor-CtaJSB9U.js} +1 -1
  34. package/dist/gateway/static/root/assets/browser-settings-page-CmBsnx24.js +8 -0
  35. package/dist/gateway/static/root/assets/{capabilities-DG0ckPuF.js → capabilities-DDJJhQ40.js} +1 -1
  36. package/dist/gateway/static/root/assets/capabilities-DJYgOjeq.js +1 -0
  37. package/dist/gateway/static/root/assets/capabilities-page-CBqvHAyp.js +2 -0
  38. package/dist/gateway/static/root/assets/capabilities-settings-panel-wjezs0OE.js +8 -0
  39. package/dist/gateway/static/root/assets/capability-icon-CmvCZOJX.js +1 -0
  40. package/dist/gateway/static/root/assets/{capability-links-DeO34GIF.js → capability-links-MZdYfPKx.js} +1 -1
  41. package/dist/gateway/static/root/assets/{channels-OiT-5N_6.js → channels-D4q8hiD0.js} +1 -1
  42. package/dist/gateway/static/root/assets/{chat-agents-api-CTL8cwNk.js → chat-agents-api-BOB3dILf.js} +1 -1
  43. package/dist/gateway/static/root/assets/{chat-chart-block-Z41MRuzh.js → chat-chart-block-DsaCatBN.js} +1 -1
  44. package/dist/gateway/static/root/assets/chat-page-CAt7FyMT.js +72 -0
  45. package/dist/gateway/static/root/assets/{chat-terminal-dock-CEaFlZEs.js → chat-terminal-dock-D9o0nUEV.js} +1 -1
  46. package/dist/gateway/static/root/assets/{command-palette-api-C3G6veE2.js → command-palette-api-Cj0_7g9o.js} +1 -1
  47. package/dist/gateway/static/root/assets/{composer-payload-handoff-Ccq_KF1W.js → composer-payload-handoff-CoDWKzBm.js} +1 -1
  48. package/dist/gateway/static/root/assets/{computer-settings-page-CTkICYyM.js → computer-settings-page-DJ9BIOHC.js} +1 -1
  49. package/dist/gateway/static/root/assets/connected-providers-grid-C5-3MDIj.js +1 -0
  50. package/dist/gateway/static/root/assets/connection-usage-BhdQRWgQ.js +1 -0
  51. package/dist/gateway/static/root/assets/connection-usage-guide-bD1sKiAp.js +1 -0
  52. package/dist/gateway/static/root/assets/{connector-service-page-C6yeCQWW.js → connector-service-page-BEq3i3Vi.js} +1 -1
  53. package/dist/gateway/static/root/assets/{connectors-api-HFW1Iey5.js → connectors-api-DEExP6a7.js} +1 -1
  54. package/dist/gateway/static/root/assets/connectors-page-QVWuoxuK.js +1 -0
  55. package/dist/gateway/static/root/assets/constants-CsVXarqA.js +1 -0
  56. package/dist/gateway/static/root/assets/{date-picker-C_tweuM0.js → date-picker-D2whl8Ci.js} +1 -1
  57. package/dist/gateway/static/root/assets/{desktop-pet-narrative-ChwjpnsG.js → desktop-pet-narrative-C8zQtMcw.js} +1 -1
  58. package/dist/gateway/static/root/assets/{desktop-pet-BAX0ZLyq.js → desktop-pet-qnIdmNnH.js} +1 -1
  59. package/dist/gateway/static/root/assets/{desktop-pet-settings-BIIsWpW9.js → desktop-pet-settings-C54b1FY4.js} +1 -1
  60. package/dist/gateway/static/root/assets/{dev-view-store-D4C_zjRq.js → dev-view-store-bryv5YRw.js} +1 -1
  61. package/dist/gateway/static/root/assets/{device-pairing-wizard-ZUE6wZ1X.js → device-pairing-wizard-Du-yOxZv.js} +1 -1
  62. package/dist/gateway/static/root/assets/{directory-picker-path-field-CFb2VFW-.js → directory-picker-path-field-GsMkjw59.js} +1 -1
  63. package/dist/gateway/static/root/assets/{discussion-annotation-sync-Bd4r2auZ.js → discussion-annotation-sync-CrpDiC7J.js} +1 -1
  64. package/dist/gateway/static/root/assets/earth-C9Z4bTTG.js +1 -0
  65. package/dist/gateway/static/root/assets/{extension-debug-page-DXGpnxwM.js → extension-debug-page-CDZfdMAR.js} +1 -1
  66. package/dist/gateway/static/root/assets/{extension-iframe-host-DTwDBQQ9.js → extension-iframe-host-CG70QWPS.js} +1 -1
  67. package/dist/gateway/static/root/assets/{extension-marketplace-api-Q6E4x8gu.js → extension-marketplace-api-D7Av-sOf.js} +1 -1
  68. package/dist/gateway/static/root/assets/{extension-page-BVBxNzys.js → extension-page-DpJTL6-v.js} +1 -1
  69. package/dist/gateway/static/root/assets/{extension-provider-D-Fa5PU-.js → extension-provider-BZTbdvCF.js} +1 -1
  70. package/dist/gateway/static/root/assets/{extension-settings-page-ycMuOpv3.js → extension-settings-page-CC4rmiFC.js} +1 -1
  71. package/dist/gateway/static/root/assets/{file-preview-surface-D62ph0m0.js → file-preview-surface-Dtla5oAW.js} +1 -1
  72. package/dist/gateway/static/root/assets/{gateway-config-swr-BW6eBLIt.js → gateway-config-swr-B5THNdYK.js} +1 -1
  73. package/dist/gateway/static/root/assets/{gateway-realtime-Bg4Mf7HA.js → gateway-realtime-hnEaDFaA.js} +1 -1
  74. package/dist/gateway/static/root/assets/gateway-realtime-store-ugwtyD4q.js +1 -0
  75. package/dist/gateway/static/root/assets/{gateway-restart-BzrJNB4Q.js → gateway-restart-kwv0njYq.js} +1 -1
  76. package/dist/gateway/static/root/assets/{gateway-settings-BOW90CER.js → gateway-settings-CxYPJTy8.js} +1 -1
  77. package/dist/gateway/static/root/assets/{gateway-startup-retry-DCjREMIO.js → gateway-startup-retry-CqtCJzWJ.js} +1 -1
  78. package/dist/gateway/static/root/assets/{global-defaults-api-myAmGZ2_.js → global-defaults-api-BQMdHLlp.js} +1 -1
  79. package/dist/gateway/static/root/assets/{home-page-eXW3llb0.js → home-page-CpbsTucI.js} +2 -2
  80. package/dist/gateway/static/root/assets/{image-generation-api-CLkuZdsz.js → image-generation-api-G3tQFhif.js} +1 -1
  81. package/dist/gateway/static/root/assets/{imports-page-BFsLQu7n.js → imports-page-BmEqiunH.js} +1 -1
  82. package/dist/gateway/static/root/assets/index-CbhkKfcy.js +11 -0
  83. package/dist/gateway/static/root/assets/index-DE2bG5EI.css +1 -0
  84. package/dist/gateway/static/root/assets/{install-connector-dialog-CVjCFdly.js → install-connector-dialog-BU4l6KJv.js} +1 -1
  85. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DdZfxLQb.js → keyboard-shortcuts-settings-CtNI6i7K.js} +1 -1
  86. package/dist/gateway/static/root/assets/{local-app-workbench-page-xV9a7McI.js → local-app-workbench-page-CE46mHc0.js} +1 -1
  87. package/dist/gateway/static/root/assets/{local-apps-page-buwr_S_-.js → local-apps-page-DqZT5hLH.js} +1 -1
  88. package/dist/gateway/static/root/assets/{local-session-drafts-v7v7Hb6T.js → local-session-drafts-Bt_e3A8f.js} +1 -1
  89. package/dist/gateway/static/root/assets/{locale-store-DGtk-KSF.js → locale-store-Bld7_m-Q.js} +1 -1
  90. package/dist/gateway/static/root/assets/{logs-page-D_VBpYkM.js → logs-page-CzajqK40.js} +1 -1
  91. package/dist/gateway/static/root/assets/{management-settings-BlRCdUF3.js → management-settings-BgdAP0kf.js} +1 -1
  92. package/dist/gateway/static/root/assets/{markdown-view-JXJ3e1CB.js → markdown-view-B3cFKCfO.js} +1 -1
  93. package/dist/gateway/static/root/assets/markdown-view-DG8DDkEA.css +1 -0
  94. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-Vr2dpowU.js → mcp-conversation-setup-page-ZcY1nqMO.js} +1 -1
  95. package/dist/gateway/static/root/assets/{media-plugins-DcN8Y0hJ.js → media-plugins-DSOplRhW.js} +1 -1
  96. package/dist/gateway/static/root/assets/messages-CGO1P4mz.js +3 -0
  97. package/dist/gateway/static/root/assets/{model-selector-zD2x0Sn6.js → model-selector-yAKlOR3O.js} +1 -1
  98. package/dist/gateway/static/root/assets/{models-hub-cache-DtZG5bA_.js → models-hub-cache-8V-ZpAIa.js} +1 -1
  99. package/dist/gateway/static/root/assets/{note-detail-panel-CVrfF6XL.js → note-detail-panel-DWIWloib.js} +3 -3
  100. package/dist/gateway/static/root/assets/note-image-lightbox-BbNYW2Rw.js +1 -0
  101. package/dist/gateway/static/root/assets/notes-api-CVQqqmGI.js +1 -0
  102. package/dist/gateway/static/root/assets/{notes-page-BOCURwg6.js → notes-page-DIugUbkV.js} +3 -3
  103. package/dist/gateway/static/root/assets/{oauth-api-DYNQAQBx.js → oauth-api-DGa6PTuq.js} +1 -1
  104. package/dist/gateway/static/root/assets/{oauth-provider-connect-BvV6SP0k.js → oauth-provider-connect-Bc-KLH1e.js} +1 -1
  105. package/dist/gateway/static/root/assets/{page-context-capture-button-Dor5Y5Bf.js → page-context-capture-button-B9L7V_n2.js} +1 -1
  106. package/dist/gateway/static/root/assets/{page-context-draft-B8DQ5lNT.js → page-context-draft-GveHK8e2.js} +1 -1
  107. package/dist/gateway/static/root/assets/page-header-store-YZfSLNTg.js +1 -0
  108. package/dist/gateway/static/root/assets/palette-CDI0VweW.js +1 -0
  109. package/dist/gateway/static/root/assets/{personal-avatar-CF6T0aTT.js → personal-avatar-Cu8lGBXZ.js} +1 -1
  110. package/dist/gateway/static/root/assets/personal-page-Dah3dgRQ.js +1 -0
  111. package/dist/gateway/static/root/assets/{personal-settings-panel-BrQ94X_A.js → personal-settings-panel-awr10jTV.js} +1 -1
  112. package/dist/gateway/static/root/assets/{phone-dependencies-card-Zvbw-N0D.js → phone-dependencies-card-CAxn3usD.js} +1 -1
  113. package/dist/gateway/static/root/assets/{phone-model-connection-CQ4PhhE5.js → phone-model-connection-BBG3LxRP.js} +1 -1
  114. package/dist/gateway/static/root/assets/{phone-model-picker-BDBtemUm.js → phone-model-picker-CfPjKpnd.js} +1 -1
  115. package/dist/gateway/static/root/assets/{phone-settings-page-D2KXWcg1.js → phone-settings-page-C4dJdwRW.js} +1 -1
  116. package/dist/gateway/static/root/assets/{phone-workspace-store-BhJAeHdQ.js → phone-workspace-store-BKltFHtG.js} +1 -1
  117. package/dist/gateway/static/root/assets/{plugin-details-dialog-DpPtI0sI.js → plugin-details-dialog-BqcFfZFH.js} +1 -1
  118. package/dist/gateway/static/root/assets/{popover-select-CEMWIrtY.js → popover-select-CLsphyzA.js} +1 -1
  119. package/dist/gateway/static/root/assets/{preference-select-fields-Bx26yGRF.js → preference-select-fields-QlyIA8ve.js} +1 -1
  120. package/dist/gateway/static/root/assets/product-automation-feedback-CRsfuAXl.js +7 -0
  121. package/dist/gateway/static/root/assets/product-navigation-Dp-adLY_.js +1 -0
  122. package/dist/gateway/static/root/assets/{product-open-page-DSWELoz0.js → product-open-page-CQ4dk-_l.js} +1 -1
  123. package/dist/gateway/static/root/assets/{product-preview-content-DJb-OtMo.js → product-preview-content-CGbqoID0.js} +1 -1
  124. package/dist/gateway/static/root/assets/{product-preview-modal-DaQhXcev.js → product-preview-modal-0wvIDcVr.js} +2 -2
  125. package/dist/gateway/static/root/assets/{project-detail-page-BHLOHrat.js → project-detail-page-VPcXR1YD.js} +2 -2
  126. package/dist/gateway/static/root/assets/{project-understanding-CjhVk8l-.js → project-understanding-CU2af95r.js} +1 -1
  127. package/dist/gateway/static/root/assets/{projects-page-sVWDuzmC.js → projects-page-BsgZb6n9.js} +1 -1
  128. package/dist/gateway/static/root/assets/{providers-api-gWGsgOOf.js → providers-api-CspehmSU.js} +1 -1
  129. package/dist/gateway/static/root/assets/recording-upload-BOZAOdCI.js +1 -0
  130. package/dist/gateway/static/root/assets/{registry-api-CRxE9kFY.js → registry-api-Bdp3UUyz.js} +1 -1
  131. package/dist/gateway/static/root/assets/{remote-access-hub-Bw__qp-v.js → remote-access-hub-Bos3uwAT.js} +1 -1
  132. package/dist/gateway/static/root/assets/{resource-unavailable-BaczkGfK.js → resource-unavailable-DJR3SCy6.js} +1 -1
  133. package/dist/gateway/static/root/assets/route-preload-Blmi-1Iq.js +2 -0
  134. package/dist/gateway/static/root/assets/{runtime-tools-api-ygfM5FCT.js → runtime-tools-api-DsbahxzE.js} +1 -1
  135. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BWEK7BZS.js → runtime-tools-settings-panel-DW9_OFi2.js} +1 -1
  136. package/dist/gateway/static/root/assets/{schema-form-C-jw6Hid.js → schema-form-CtRM41Re.js} +1 -1
  137. package/dist/gateway/static/root/assets/{service-recommendation-list-DrgwXSEt.js → service-recommendation-list-Bd1JDO5T.js} +1 -1
  138. package/dist/gateway/static/root/assets/{session-api-CpZ24vrQ.js → session-api-DjnHJ-0n.js} +1 -1
  139. package/dist/gateway/static/root/assets/{session-manager-CZyY5Y87.js → session-manager-ChHnJOWW.js} +1 -1
  140. package/dist/gateway/static/root/assets/{sessions-page-DgXRw0_8.js → sessions-page-BM-oqd22.js} +1 -1
  141. package/dist/gateway/static/root/assets/settings-advanced-gate-DyGT3o1e.js +1 -0
  142. package/dist/gateway/static/root/assets/{settings-advanced-section-DmCp3OWb.js → settings-advanced-section-CM44UlF8.js} +1 -1
  143. package/dist/gateway/static/root/assets/{settings-loading-skeleton-BTqvr_Fw.js → settings-loading-skeleton-CAoOV17i.js} +1 -1
  144. package/dist/gateway/static/root/assets/{settings-mode-store-fZ6mzf4A.js → settings-mode-store-Blc4C8aw.js} +1 -1
  145. package/dist/gateway/static/root/assets/{settings-page-SQwLKlTr.js → settings-page-CMSYmtOu.js} +1 -1
  146. package/dist/gateway/static/root/assets/{settings-page-header-4d1u-o-F.js → settings-page-header-BYFaTD8a.js} +1 -1
  147. package/dist/gateway/static/root/assets/{settings-page-layout-Cy9_VBag.js → settings-page-layout-CnUQSxT3.js} +1 -1
  148. package/dist/gateway/static/root/assets/{setup-interaction-page-OFU6DKgp.js → setup-interaction-page-DqaiLQ0I.js} +1 -1
  149. package/dist/gateway/static/root/assets/{setup-status-panel-KKAneNTe.js → setup-status-panel-iOYgfkoK.js} +1 -1
  150. package/dist/gateway/static/root/assets/{share-link-dialog-Apq3cegw.js → share-link-dialog-C_uYNUlp.js} +1 -1
  151. package/dist/gateway/static/root/assets/{share-preview-page-B6yMj5nG.js → share-preview-page-CFebGqyB.js} +1 -1
  152. package/dist/gateway/static/root/assets/{shares-api-Q5x_ty6F.js → shares-api-C2GDyqxP.js} +1 -1
  153. package/dist/gateway/static/root/assets/{shares-settings-vxTYg6Hp.js → shares-settings-B-7la3QN.js} +1 -1
  154. package/dist/gateway/static/root/assets/skeleton-DzdOeGYz.js +1 -0
  155. package/dist/gateway/static/root/assets/{skill-api-CBFXDh9m.js → skill-api-BnpTSZGc.js} +1 -1
  156. package/dist/gateway/static/root/assets/{skill-list-api-C8tm-XxH.js → skill-list-api-7MY9ewiu.js} +1 -1
  157. package/dist/gateway/static/root/assets/{skill-reload-api-B-4Yj46U.js → skill-reload-api-DkDpu3Wd.js} +1 -1
  158. package/dist/gateway/static/root/assets/skills-page-sL2kGqHZ.js +2 -0
  159. package/dist/gateway/static/root/assets/sliding-tab-list-CmcrqRzN.js +1 -0
  160. package/dist/gateway/static/root/assets/{system-settings-panel-a4mBz4J2.js → system-settings-panel-BltKPJdb.js} +1 -1
  161. package/dist/gateway/static/root/assets/task-detail-page-BuP1vEuu.js +3 -0
  162. package/dist/gateway/static/root/assets/{task-result-evidence-DFiu5SlL.js → task-result-evidence-B1MHhqVR.js} +1 -1
  163. package/dist/gateway/static/root/assets/{tasks-DRmd6sWt.js → tasks-D_xuHn6V.js} +1 -1
  164. package/dist/gateway/static/root/assets/{terminal-panel-store-BdOlpRkY.js → terminal-panel-store-DUEJoa1M.js} +1 -1
  165. package/dist/gateway/static/root/assets/{theme-store-D58tk8pq.js → theme-store-DsvYj7Vy.js} +1 -1
  166. package/dist/gateway/static/root/assets/tool-friendly-title-DEGpbye4.js +1 -0
  167. package/dist/gateway/static/root/assets/{tracing-settings-page-CO0-AiCl.js → tracing-settings-page-B_Xdc2VF.js} +1 -1
  168. package/dist/gateway/static/root/assets/{tunnel-api-DVRX9yW6.js → tunnel-api-B6BhWTh3.js} +1 -1
  169. package/dist/gateway/static/root/assets/{understanding-activity-store-B_-648uj.js → understanding-activity-store-B7rFXhDk.js} +1 -1
  170. package/dist/gateway/static/root/assets/{understanding-refresh-store-BXJ-kwzq.js → understanding-refresh-store-DCFASve5.js} +1 -1
  171. package/dist/gateway/static/root/assets/{usage-page-C76JnWR8.js → usage-page-DqzosTxy.js} +1 -1
  172. package/dist/gateway/static/root/assets/{use-autosave-xytwr7Lc.js → use-autosave-DsqcLHV9.js} +1 -1
  173. package/dist/gateway/static/root/assets/use-composer-attachments-Brdrrzrp.js +2 -0
  174. package/dist/gateway/static/root/assets/use-file-preview-expanded-9DED7ohY.js +2 -0
  175. package/dist/gateway/static/root/assets/{use-personal-profile-BXHU0P8I.js → use-personal-profile-T2e6P5Ed.js} +1 -1
  176. package/dist/gateway/static/root/assets/{use-workspace-tree-CiLbOQHQ.js → use-workspace-tree-Dq0qgK3N.js} +1 -1
  177. package/dist/gateway/static/root/assets/user-model-page-Ziz55hVM.js +2 -0
  178. package/dist/gateway/static/root/assets/{voice-api-key-field-Dn092u0X.js → voice-api-key-field-D7NPAc1E.js} +1 -1
  179. package/dist/gateway/static/root/assets/voice-call-context-CJ1ZiJWR.js +1 -0
  180. package/dist/gateway/static/root/assets/{voice-config-api-fqUzP-ZY.js → voice-config-api-UQDTh6hh.js} +1 -1
  181. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-D7QdPeuj.js → voice-input-shortcut-events-SD2gZVg8.js} +1 -1
  182. package/dist/gateway/static/root/assets/{voice-transcribe-api-NpNY_gsE.js → voice-transcribe-api-Bf9FaI-p.js} +1 -1
  183. package/dist/gateway/static/root/assets/{work-discovery-overlay-BARpCMZl.js → work-discovery-overlay-B41GOFXh.js} +1 -1
  184. package/dist/gateway/static/root/assets/{work-discovery-page-p0aVb8xr.js → work-discovery-page-NNhExALx.js} +1 -1
  185. package/dist/gateway/static/root/assets/{working-directory-picker-modal-7G-6icvh.js → working-directory-picker-modal-DeNWVFFK.js} +1 -1
  186. package/dist/gateway/static/root/assets/{workspace-api-BKbezgv-.js → workspace-api-DrVss2Fd.js} +2 -2
  187. package/dist/gateway/static/root/assets/workspace-editor-agent-store-CmSYxTmk.js +1 -0
  188. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-CS8-ZbVG.js → workspace-file-preview-dialog-C2egBzza.js} +1 -1
  189. package/dist/gateway/static/root/assets/{workspace-open-location-menu-BQrTy-8o.js → workspace-open-location-menu-XFUtwfLY.js} +1 -1
  190. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Bc5rXL-E.js → xopc-cloud-account-card-BlhFT1q9.js} +1 -1
  191. package/dist/gateway/static/root/index.html +98 -101
  192. package/dist/package.js +1 -1
  193. package/dist/packages/browser-control-contract/src/dom.js +79 -0
  194. package/dist/packages/browser-control-contract/src/index.js +2 -25
  195. package/dist/packages/gateway-contract/src/automations.js +0 -6
  196. package/dist/packages/gateway-contract/src/task-research-result.js +1 -0
  197. package/dist/packages/gateway-contract/src/tasks.js +1 -1
  198. package/dist/src/agent/agent-manager.d.ts +0 -1
  199. package/dist/src/agent/agent-manager.js +0 -1
  200. package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -1
  201. package/dist/src/agent/embedded/execution-tool-policy.js +2 -1
  202. package/dist/src/agent/external-tools/index.d.ts +1 -1
  203. package/dist/src/agent/service.js +0 -1
  204. package/dist/src/agent/service.types.d.ts +0 -1
  205. package/dist/src/agent/tool-manuals/browser.d.ts +1 -1
  206. package/dist/src/agent/tool-manuals/browser.js +0 -3
  207. package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
  208. package/dist/src/agent/tool-manuals/xopc-use.js +3 -0
  209. package/dist/src/agent/tools/factory.d.ts +0 -2
  210. package/dist/src/agent/tools/factory.js +1 -2
  211. package/dist/src/agent/tools/find.d.ts +1 -1
  212. package/dist/src/agent/tools/grep.d.ts +1 -1
  213. package/dist/src/agent/tools/index.d.ts +0 -1
  214. package/dist/src/agent/tools/index.js +1 -2
  215. package/dist/src/agent/tools/metadata.d.ts +1 -1
  216. package/dist/src/agent/tools/personal-request-result-tool.js +2 -2
  217. package/dist/src/agent/tools/personal-request-tool.js +4 -1
  218. package/dist/src/agent/tools/personal-task-tool.d.ts +1 -0
  219. package/dist/src/agent/tools/personal-task-tool.js +4 -0
  220. package/dist/src/agent/tools/xopc-use-tool.js +10 -1
  221. package/dist/src/auth/oauth/anthropic.d.ts +1 -7
  222. package/dist/src/auth/oauth/anthropic.js +6 -83
  223. package/dist/src/auth/oauth/index.d.ts +0 -2
  224. package/dist/src/auth/oauth/index.js +2 -6
  225. package/dist/src/auth/oauth/kimi-coding.d.ts +1 -6
  226. package/dist/src/auth/oauth/kimi-coding.js +5 -79
  227. package/dist/src/auth/oauth/openai.js +1 -1
  228. package/dist/src/auth/oauth/pi-oauth-adapter.d.ts +4 -0
  229. package/dist/src/auth/oauth/pi-oauth-adapter.js +53 -0
  230. package/dist/src/auth/oauth/registry.js +0 -9
  231. package/dist/src/automations/capabilities/write.d.ts +6 -18
  232. package/dist/src/automations/domain/defaults.d.ts +0 -1
  233. package/dist/src/automations/domain/defaults.js +2 -3
  234. package/dist/src/automations/domain/index.js +2 -2
  235. package/dist/src/automations/domain/types.d.ts +0 -26
  236. package/dist/src/automations/domain/validation.d.ts +12 -36
  237. package/dist/src/automations/domain/validation.js +0 -7
  238. package/dist/src/automations/draft/automation-draft-validator.d.ts +1 -7
  239. package/dist/src/automations/draft/automation-draft-validator.js +0 -1
  240. package/dist/src/automations/index.js +2 -2
  241. package/dist/src/automations/service/action-executor.d.ts +0 -1
  242. package/dist/src/automations/service/action-executor.js +0 -31
  243. package/dist/src/automations/service/automation-service.d.ts +0 -1
  244. package/dist/src/automations/service/automation-service.js +1 -13
  245. package/dist/src/browser/drivers/playwright-driver.js +1 -2
  246. package/dist/src/channels/index.js +1 -1
  247. package/dist/src/channels/manager.js +1 -1
  248. package/dist/src/cli/commands/connectors.js +1 -1
  249. package/dist/src/cli/commands/extension-marketplace.js +1 -1
  250. package/dist/src/cli/commands/models.js +1 -1
  251. package/dist/src/cli/commands/onboard.js +1 -1
  252. package/dist/src/config/models-json.d.ts +24 -24
  253. package/dist/src/endpoint-tools/policy.js +3 -4
  254. package/dist/src/extensions/sdk/index.js +1 -1
  255. package/dist/src/gateway/hono/routes/lazy-bundles.js +0 -16
  256. package/dist/src/gateway/hono/routes/projects.js +1 -1
  257. package/dist/src/gateway/next-turn-suggestions/snapshot.js +11 -3
  258. package/dist/src/gateway/security/gateway-scopes.js +0 -2
  259. package/dist/src/gateway/service.d.ts +0 -3
  260. package/dist/src/gateway/service.js +2 -17
  261. package/dist/src/home-intelligence/application-service.js +1 -1
  262. package/dist/src/personal-agent/communication.d.ts +1 -1
  263. package/dist/src/personal-agent/communication.js +2 -2
  264. package/dist/src/personal-agent/prompts.js +1 -1
  265. package/dist/src/personal-agent/reply-style.d.ts +2 -2
  266. package/dist/src/personal-agent/reply-style.js +12 -0
  267. package/dist/src/personal-agent/request-delivery.js +1 -5
  268. package/dist/src/personal-agent/request-repository.d.ts +1 -0
  269. package/dist/src/personal-agent/request-service.d.ts +1 -0
  270. package/dist/src/personal-agent/request-service.js +12 -3
  271. package/dist/src/personal-agent/request-verification.d.ts +6 -0
  272. package/dist/src/personal-agent/request-verification.js +22 -0
  273. package/dist/src/providers/domestic-presets.d.ts +2 -310
  274. package/dist/src/providers/domestic-presets.js +2 -396
  275. package/dist/src/providers/env-keys.js +2 -6
  276. package/dist/src/providers/index.js +6 -13
  277. package/dist/src/providers/presentation.js +4 -6
  278. package/dist/src/providers/setup/profiles.js +1 -2
  279. package/dist/src/storage/sqlite/schema.sql +0 -81
  280. package/dist/src/tasks/home-query-service.js +0 -1
  281. package/dist/src/tasks/task-allocation-service.js +4 -2
  282. package/dist/src/tasks/task-application-service.js +4 -1
  283. package/dist/src/tasks/task-context-assembler.js +3 -1
  284. package/dist/src/tasks/task-contract-definition.d.ts +1 -0
  285. package/dist/src/tasks/task-contract-planner.js +3 -0
  286. package/dist/src/tasks/task-main-update-decision-service.js +7 -7
  287. package/dist/src/tasks/task-main-update-delivery.js +15 -2
  288. package/dist/src/tasks/task-repository.js +1 -1
  289. package/dist/src/tasks/task-research-repair.d.ts +1 -0
  290. package/dist/src/tasks/task-research-repair.js +3 -1
  291. package/dist/src/tasks/task-research-result.js +19 -1
  292. package/dist/src/tasks/task-run-coordinator.js +12 -9
  293. package/package.json +8 -8
  294. package/dist/gateway/static/root/assets/app-link-DRy3-k7j.js +0 -1
  295. package/dist/gateway/static/root/assets/arrow-up-right-T72JbQ1Q.js +0 -1
  296. package/dist/gateway/static/root/assets/automation-task-card-BecBULES.js +0 -3
  297. package/dist/gateway/static/root/assets/automations-workspace-BBSTBucV.js +0 -9
  298. package/dist/gateway/static/root/assets/book-open-CCGtrT3R.js +0 -1
  299. package/dist/gateway/static/root/assets/browser-automation-inputs-DADzEaqe.js +0 -1
  300. package/dist/gateway/static/root/assets/browser-automations-page-V7_ZTcyU.js +0 -3
  301. package/dist/gateway/static/root/assets/browser-control-api-Bdr2nGCE.js +0 -6
  302. package/dist/gateway/static/root/assets/browser-settings-page-irOt8KDh.js +0 -3
  303. package/dist/gateway/static/root/assets/capabilities-CrAs-oqU.js +0 -1
  304. package/dist/gateway/static/root/assets/capabilities-page-CJLVUcD4.js +0 -2
  305. package/dist/gateway/static/root/assets/capabilities-settings-panel-D8t5F998.js +0 -8
  306. package/dist/gateway/static/root/assets/capability-icon-DVoZxEgW.js +0 -1
  307. package/dist/gateway/static/root/assets/chat-page-DBAezT9u.js +0 -72
  308. package/dist/gateway/static/root/assets/connected-providers-grid-CpO98SqR.js +0 -1
  309. package/dist/gateway/static/root/assets/connection-usage-Cm_McddI.js +0 -1
  310. package/dist/gateway/static/root/assets/connection-usage-guide-DOf2VWzv.js +0 -1
  311. package/dist/gateway/static/root/assets/connectors-page-Cbn4LSpC.js +0 -1
  312. package/dist/gateway/static/root/assets/constants-DBtMsXdW.js +0 -1
  313. package/dist/gateway/static/root/assets/earth-BMhZtzcj.js +0 -1
  314. package/dist/gateway/static/root/assets/gateway-realtime-store-xYMxjztG.js +0 -1
  315. package/dist/gateway/static/root/assets/index-CKIirf4W.css +0 -1
  316. package/dist/gateway/static/root/assets/index-CQ570IAI.js +0 -11
  317. package/dist/gateway/static/root/assets/markdown-view-C-DHb3Io.css +0 -1
  318. package/dist/gateway/static/root/assets/messages-DYDySzn1.js +0 -3
  319. package/dist/gateway/static/root/assets/note-image-lightbox-V4rmgfLB.js +0 -1
  320. package/dist/gateway/static/root/assets/notes-api-UXC3eyeM.js +0 -1
  321. package/dist/gateway/static/root/assets/page-header-store-f8XcAs9b.js +0 -1
  322. package/dist/gateway/static/root/assets/personal-page-DUykELZZ.js +0 -1
  323. package/dist/gateway/static/root/assets/product-automation-feedback-_K6grEOt.js +0 -7
  324. package/dist/gateway/static/root/assets/product-navigation-Co8pLbDP.js +0 -1
  325. package/dist/gateway/static/root/assets/recording-upload-CBefH7C5.js +0 -1
  326. package/dist/gateway/static/root/assets/route-preload-Coy9Gjyy.js +0 -2
  327. package/dist/gateway/static/root/assets/settings-advanced-gate-Ch9MNvvk.js +0 -1
  328. package/dist/gateway/static/root/assets/skeleton-BI5TyibZ.js +0 -1
  329. package/dist/gateway/static/root/assets/skills-page-Xbnh0-6I.js +0 -2
  330. package/dist/gateway/static/root/assets/sliding-tab-list-DuQyViqe.js +0 -1
  331. package/dist/gateway/static/root/assets/star-BUWJqJ5c.js +0 -1
  332. package/dist/gateway/static/root/assets/task-detail-page-B9akf3i8.js +0 -3
  333. package/dist/gateway/static/root/assets/tool-friendly-title-DcCc6g7o.js +0 -1
  334. package/dist/gateway/static/root/assets/use-composer-attachments-fK2PUQbB.js +0 -2
  335. package/dist/gateway/static/root/assets/use-file-preview-expanded-ivMxmMu1.js +0 -2
  336. package/dist/gateway/static/root/assets/user-model-page-BzpV1hq_.js +0 -2
  337. package/dist/gateway/static/root/assets/video-B6V0GFss.js +0 -1
  338. package/dist/gateway/static/root/assets/voice-call-context-BM2A4bLz.js +0 -1
  339. package/dist/gateway/static/root/assets/workspace-editor-agent-store-CODAQqJn.js +0 -1
  340. package/dist/packages/browser-control-contract/src/automation.js +0 -213
  341. package/dist/src/agent/tools/browser-automation-tool.d.ts +0 -194
  342. package/dist/src/agent/tools/browser-automation-tool.js +0 -243
  343. package/dist/src/auth/oauth/minimax-cn.d.ts +0 -11
  344. package/dist/src/auth/oauth/minimax-cn.js +0 -95
  345. package/dist/src/auth/oauth/minimax.d.ts +0 -8
  346. package/dist/src/auth/oauth/minimax.js +0 -95
  347. package/dist/src/browser/automations/index.d.ts +0 -4
  348. package/dist/src/browser/automations/index.js +0 -4
  349. package/dist/src/browser/automations/repository.d.ts +0 -17
  350. package/dist/src/browser/automations/repository.js +0 -81
  351. package/dist/src/browser/automations/runner.d.ts +0 -17
  352. package/dist/src/browser/automations/runner.js +0 -265
  353. package/dist/src/browser/automations/runtime-service.d.ts +0 -8
  354. package/dist/src/browser/automations/runtime-service.js +0 -38
  355. package/dist/src/browser/automations/schema.d.ts +0 -227
  356. package/dist/src/browser/automations/schema.js +0 -201
  357. package/dist/src/browser/automations/service.d.ts +0 -232
  358. package/dist/src/browser/automations/service.js +0 -214
  359. package/dist/src/browser/automations/types.d.ts +0 -105
  360. package/dist/src/browser/automations/types.js +0 -1
  361. package/dist/src/browser/recordings/service.d.ts +0 -22
  362. package/dist/src/browser/recordings/service.js +0 -159
  363. package/dist/src/gateway/hono/routes/browser-automations.d.ts +0 -3
  364. package/dist/src/gateway/hono/routes/browser-automations.js +0 -93
  365. package/dist/src/gateway/hono/routes/browser-recordings.d.ts +0 -3
  366. package/dist/src/gateway/hono/routes/browser-recordings.js +0 -78
  367. package/dist/browser-ext/dist/assets/{page-context-DngcqfGf.js → auth-DAIwDtVp.js} +1368 -1368
@@ -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{f as i,m as a,t as o,u as s}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as c,l,n as u,o as d}from"./locale-store-DGtk-KSF.js";import{t as f}from"./messages-DYDySzn1.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./dist-BGTk37IG.js";import{U as b,nt as x,t as S,w as C}from"./chat-page-DBAezT9u.js";import{t as w}from"./arrow-left-D880xG-P.js";import{t as T}from"./calendar-clock-D-quYVPe.js";import{n as E,r as D}from"./popover-select-CEMWIrtY.js";import{t as ee}from"./circle-check-C23XjkUj.js";import{t as O}from"./circle-x-DFsCKeya.js";import{t as k}from"./circle-BoO4YvTx.js";import{t as A}from"./ellipsis-0k4rZLoy.js";import{t as j}from"./external-link-DjqjBmc3.js";import{t as te}from"./folder-kanban-CpLlFI1o.js";import{t as ne}from"./folder-open-CyzJ19I9.js";import{F as re,N as M,V as ie,z as ae}from"./markdown-view-JXJ3e1CB.js";import{t as oe}from"./message-square-fVE7Ghj1.js";import{t as se}from"./pause-DuPxgSxk.js";import{t as ce}from"./play-kxZvpBg8.js";import{t as le}from"./x-B_N4OPjy.js";import{t as N}from"./cn-0WouolD0.js";import{t as ue}from"./skeleton-BI5TyibZ.js";import{c as de}from"./api-DRyQFk9q.js";import{dt as fe,ft as pe}from"./session-manager-CZyY5Y87.js";import{i as me}from"./vendor-swr-CdRzEUwF.js";import{C as he,D as ge,T as _e,d as ve,f as ye,k as be,m as xe,y as Se}from"./use-composer-attachments-fK2PUQbB.js";import{t as Ce}from"./chat-agents-api-CTL8cwNk.js";import{t as P}from"./button-Cc4hUNTt.js";import{s as we}from"./file-preview-surface-D62ph0m0.js";import{d as Te,f as Ee,h as De,m as Oe,p as ke,s as Ae}from"./composer-payload-handoff-Ccq_KF1W.js";import{t as je}from"./page-header-store-f8XcAs9b.js";import{t as Me}from"./agent-avatar-display-Cm0afn_O.js";import{t as Ne}from"./automation-api-paBg5ie6.js";import{t as Pe}from"./confirm-dialog-D7dQJytv.js";import{l as Fe,m as Ie,o as Le,r as F,t as Re,u as ze}from"./dist-ZrL34Ps4.js";import{C as I,_ as Be,a as Ve,c as L,d as He,l as Ue,u as We,w as Ge}from"./automation-task-card-BecBULES.js";import{t as Ke}from"./date-picker-C_tweuM0.js";import{n as qe}from"./date-formatters-DukWSVwc.js";import{n as Je,r as R,t as Ye}from"./task-result-evidence-DFiu5SlL.js";import{t as Xe}from"./page-context-capture-button-Dor5Y5Bf.js";import{t as Ze}from"./dependency-picker-XjPB8FJS.js";var z=e(t(),1),B=n(),V=r();function Qe(e,t,n){let r=new URLSearchParams(e),i=r.getAll(`taskPanel`).filter(e=>e!==t&&e!==`${t}:closed`);r.delete(`taskPanel`);for(let e of i)r.append(`taskPanel`,e);return r.append(`taskPanel`,n?t:`${t}:closed`),r}function $e(e){let t=(0,B.c)(24),n,r,i,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],c=t[6]):({panelId:r,title:c,defaultOpen:s,children:n,summaryClassName:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c);let l=s!==void 0&&s,[u,d]=a(),f;if(t[7]!==l||t[8]!==r||t[9]!==u){let e=u.getAll(`taskPanel`);f=e.includes(r)||l&&!e.includes(`${r}:closed`),t[7]=l,t[8]=r,t[9]=u,t[10]=f}else f=t[10];let p=f,m=o??`cursor-pointer py-2 text-xs text-fg-muted hover:text-fg`,h;t[11]!==p||t[12]!==r||t[13]!==d?(h=e=>{e.preventDefault(),d(e=>Qe(e,r,!p),{preventScrollReset:!0})},t[11]=p,t[12]=r,t[13]=d,t[14]=h):h=t[14];let g;t[15]!==m||t[16]!==h||t[17]!==c?(g=(0,V.jsx)(`summary`,{className:m,onClick:h,children:c}),t[15]=m,t[16]=h,t[17]=c,t[18]=g):g=t[18];let _;return t[19]!==n||t[20]!==p||t[21]!==i||t[22]!==g?(_=(0,V.jsxs)(`details`,{...i,open:p,children:[g,n]}),t[19]=n,t[20]=p,t[21]=i,t[22]=g,t[23]=_):_=t[23],_}var et=`Default criteria were not expanded into concrete acceptance items; broad completion cannot certify item coverage.`;function tt(e){let t=(0,B.c)(50),{criterion:n,index:r,language:i,closed:a,pending:o,onReview:s,projectId:c,conversationId:l}=e,u=i===`zh`,[d,f]=(0,z.useState)(!1),p=n.status===`passed`?ee:n.status===`failed`?O:k,m=n.status===`passed`?u?`已通过`:`Passed`:n.status===`failed`?u?`未通过`:`Failed`:u?`待验收`:`Awaiting review`,h=n.review?u?`用户确认`:`User reviewed`:n.status===`passed`||n.status===`failed`?u?`自动核验`:`Automatic verification`:void 0,g;t[0]!==r||t[1]!==s?(g=async function(e){await s(r,e)&&f(!1)},t[0]=r,t[1]=s,t[2]=g):g=t[2];let _=g,v=n.status===`passed`?`text-success`:n.status===`failed`?`text-danger`:`text-fg-subtle`,y;t[3]===v?y=t[4]:(y=N(`mt-0.5 size-4 shrink-0`,v),t[3]=v,t[4]=y);let b;t[5]!==p||t[6]!==y?(b=(0,V.jsx)(p,{"aria-hidden":!0,className:y}),t[5]=p,t[6]=y,t[7]=b):b=t[7];let x;t[8]===n.text?x=t[9]:(x=(0,V.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:n.text}),t[8]=n.text,t[9]=x);let S;t[10]===m?S=t[11]:(S=(0,V.jsx)(`span`,{children:m}),t[10]=m,t[11]=S);let C;t[12]===h?C=t[13]:(C=h?(0,V.jsxs)(`span`,{children:[`· `,h]}):null,t[12]=h,t[13]=C);let w;t[14]!==a||t[15]!==n.review||t[16]!==d||t[17]!==o||t[18]!==u?(w=n.review&&!a&&!d?(0,V.jsx)(P,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:o,onClick:()=>f(!0),children:u?`更改判定`:`Change review`}):null,t[14]=a,t[15]=n.review,t[16]=d,t[17]=o,t[18]=u,t[19]=w):w=t[19];let T;t[20]!==a||t[21]!==n.review||t[22]!==d||t[23]!==o||t[24]!==_||t[25]!==u?(T=!a&&(!n.review||d)?(0,V.jsxs)(`div`,{className:`ml-auto flex flex-wrap gap-2`,children:[(0,V.jsx)(P,{variant:`secondary`,className:`min-h-9 px-3 text-xs`,disabled:o,onClick:()=>void _(`passed`),children:u?`确认通过`:`Mark passed`}),(0,V.jsx)(P,{variant:`ghost`,className:`min-h-9 px-3 text-xs`,disabled:o,onClick:()=>void _(`failed`),children:u?`标记未通过`:`Mark failed`}),d?(0,V.jsx)(P,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:o,onClick:()=>f(!1),children:u?`取消`:`Cancel`}):null]}):null,t[20]=a,t[21]=n.review,t[22]=d,t[23]=o,t[24]=_,t[25]=u,t[26]=T):T=t[26];let E;t[27]!==S||t[28]!==C||t[29]!==w||t[30]!==T?(E=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-2 text-xs text-fg-muted`,children:[S,C,w,T]}),t[27]=S,t[28]=C,t[29]=w,t[30]=T,t[31]=E):E=t[31];let D;t[32]!==l||t[33]!==n.evidence||t[34]!==n.method||t[35]!==n.note||t[36]!==n.review||t[37]!==n.verificationStatus||t[38]!==r||t[39]!==i||t[40]!==c||t[41]!==u?(D=n.evidence.length>0||n.method||n.review||n.note?(0,V.jsx)($e,{panelId:`criterion:${r}:evidence`,title:(0,V.jsxs)(V.Fragment,{children:[u?`查看依据`:`View evidence`,n.evidence.length>0?` · ${n.evidence.length}`:``]}),summaryClassName:`min-h-9 cursor-pointer py-2 text-xs text-fg-muted hover:text-fg`,children:(0,V.jsxs)(`div`,{className:`space-y-2 border-l border-edge pl-3 text-xs leading-5 text-fg-muted`,children:[n.method?(0,V.jsxs)(`p`,{children:[u?`自动核验`:`Automatic verification`,` · `,n.verificationStatus===`passed`?u?`通过`:`Passed`:n.verificationStatus===`failed`?u?`未通过`:`Failed`:u?`未核验`:`Unverified`,n.method===`model_reviewed`?u?` · 模型审阅`:` · Model review`:``]}):null,n.review?(0,V.jsxs)(`p`,{children:[u?`人工判定`:`User review`,` · `,qe(n.review.reviewedAt,i)]}):null,n.note&&n.note!==et?(0,V.jsx)(R,{content:n.note,contentKey:`criterion:${r}:note`,language:i,markdown:!1}):null,(0,V.jsx)(Ye,{evidence:n.evidence,projectId:c,conversationId:l,language:i})]})}):null,t[32]=l,t[33]=n.evidence,t[34]=n.method,t[35]=n.note,t[36]=n.review,t[37]=n.verificationStatus,t[38]=r,t[39]=i,t[40]=c,t[41]=u,t[42]=D):D=t[42];let A;t[43]!==E||t[44]!==D||t[45]!==x?(A=(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[x,E,D]}),t[43]=E,t[44]=D,t[45]=x,t[46]=A):A=t[46];let j;return t[47]!==A||t[48]!==b?(j=(0,V.jsxs)(`li`,{className:`flex min-w-0 items-start gap-3 py-4`,children:[b,A]}),t[47]=A,t[48]=b,t[49]=j):j=t[49],j}function nt(e){let t=(0,B.c)(41),{criteria:n,language:r,closed:i,pending:a,canComplete:o,completionPending:s,blockedReason:c,error:l,onReview:u,onComplete:d,projectId:f,conversationId:p}=e,m=r===`zh`,h;t[0]===n?h=t[1]:(h=n.some(rt),t[0]=n,t[1]=h);let g=h,_;t[2]!==g||t[3]!==m?(_=g?(0,V.jsx)($e,{panelId:`acceptance:diagnostic`,title:m?`自动核验未完成:验收标准过于宽泛`:`Automatic verification incomplete: criteria are too broad`,className:`mb-2 text-xs leading-5 text-fg-muted`,children:(0,V.jsx)(`p`,{className:`mt-2 break-words`,children:et})}):null,t[2]=g,t[3]=m,t[4]=_):_=t[4];let v;if(t[5]!==i||t[6]!==p||t[7]!==n||t[8]!==r||t[9]!==u||t[10]!==a||t[11]!==f){let e;t[13]!==i||t[14]!==p||t[15]!==r||t[16]!==u||t[17]!==a||t[18]!==f?(e=(e,t)=>(0,V.jsx)(tt,{criterion:e,index:t,language:r,closed:i,pending:a,onReview:u,projectId:f,conversationId:p},`${t}:${e.text}`),t[13]=i,t[14]=p,t[15]=r,t[16]=u,t[17]=a,t[18]=f,t[19]=e):e=t[19],v=n.map(e),t[5]=i,t[6]=p,t[7]=n,t[8]=r,t[9]=u,t[10]=a,t[11]=f,t[12]=v}else v=t[12];let y;t[20]===v?y=t[21]:(y=(0,V.jsx)(`ul`,{className:`divide-y divide-edge-subtle`,children:v}),t[20]=v,t[21]=y);let b;t[22]!==n.length||t[23]!==m?(b=n.length===0?(0,V.jsx)(`p`,{className:`py-4 text-sm text-fg-muted`,children:m?`尚未定义验收标准`:`No acceptance criteria defined`}):null,t[22]=n.length,t[23]=m,t[24]=b):b=t[24];let x;t[25]===l?x=t[26]:(x=l?(0,V.jsx)(`p`,{role:`alert`,className:`my-2 text-sm text-danger`,children:l}):null,t[25]=l,t[26]=x);let S;t[27]!==c||t[28]!==o||t[29]!==i||t[30]!==s||t[31]!==d||t[32]!==a||t[33]!==m?(S=i?null:(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-end gap-3 border-t border-edge-subtle pt-4`,children:[!o&&c?(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:c}):null,(0,V.jsx)(P,{variant:`primary`,disabled:!o||a||s,onClick:d,children:m?`验收通过,完成任务`:`Accept and complete task`})]}),t[27]=c,t[28]=o,t[29]=i,t[30]=s,t[31]=d,t[32]=a,t[33]=m,t[34]=S):S=t[34];let C;return t[35]!==_||t[36]!==y||t[37]!==b||t[38]!==x||t[39]!==S?(C=(0,V.jsxs)(V.Fragment,{children:[_,y,b,x,S]}),t[35]=_,t[36]=y,t[37]=b,t[38]=x,t[39]=S,t[40]=C):C=t[40],C}function rt(e){return e.note===et}function it(e){let t=(0,B.c)(22),{detail:n,language:r}=e,i=r===`zh`,a;if(t[0]!==n||t[1]!==r||t[2]!==i){let e=Ee(n),s;if(t[4]!==n.runs||t[5]!==n.task){let e;t[7]===n.task?e=t[8]:(e=e=>e.contractVersion===n.task.latestContractVersion,t[7]=n.task,t[8]=e),s=new Set(n.runs.filter(e).map(lt)),t[4]=n.runs,t[5]=n.task,t[6]=s}else s=t[6];let c=s,l;if(t[9]!==n.context||t[10]!==n.receipts||t[11]!==c){l=n.context.filter(ct).map(st);let e=new Set(l.map(ot).filter(Boolean)),r;t[13]===c?r=t[14]:(r=e=>c.has(e.runId),t[13]=c,t[14]=r);for(let t of n.receipts.filter(r))for(let n of t.evidence.filter(at))n.uri&&e.has(n.uri)||(n.uri&&e.add(n.uri),l.push(n));t[9]=n.context,t[10]=n.receipts,t[11]=c,t[12]=l}else l=t[12];let u=e?.summary.trim(),d=u&&u.length<=160&&!u.includes(`
2
- `)&&!/\b(?:Claim|Criterion|Research claim)\b|c-ac\d|Default criteria were not/i.test(u)?u:void 0,f=i?`交付结果`:`Deliverables`,p;t[15]===f?p=t[16]:(p=(0,V.jsx)(`h2`,{id:`task-results-heading`,className:`text-sm font-semibold text-fg`,children:f}),t[15]=f,t[16]=p);let m;t[17]!==n||t[18]!==l||t[19]!==r||t[20]!==i?(m=l.length>0?(0,V.jsx)(Ye,{evidence:l,language:r,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,compact:!0}):(0,V.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:i?`尚无可查看的交付物`:`No deliverables available yet`}),t[17]=n,t[18]=l,t[19]=r,t[20]=i,t[21]=m):m=t[21],a=(0,V.jsxs)(`section`,{"aria-label":i?`交付结果`:`Deliverables`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[p,d?(0,V.jsx)(`p`,{className:`mt-2 break-words text-sm leading-6 text-fg-muted [overflow-wrap:anywhere]`,children:d}):null,e&&e.completionVerdict!==`achieved`?(0,V.jsx)(`p`,{className:`mt-2 text-xs text-fg-muted`,children:i?`本次执行尚未报告目标全部达成。`:`This run has not reported the full goal achieved.`}):null,m,e?null:(0,V.jsx)(`p`,{className:`mt-2 text-xs text-fg-subtle`,children:i?`尚无本版任务的执行结果`:`No run result for this task version`}),e&&(e.needsUser||e.remainingWork.length>0||e.nextAction||e.failure)?(0,V.jsxs)(`div`,{className:`mt-4 space-y-2 border-t border-edge-subtle pt-3`,"aria-label":i?`执行待办`:`Run follow-up`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:e.needsUser?i?`需要你决定`:`Your decision needed`:i?`待处理事项`:`Remaining work`}),e.remainingWork.length>0?(0,V.jsx)(`ul`,{className:`space-y-2 text-sm leading-6 text-fg`,children:[...new Set(e.remainingWork)].map(H)}):null,e.nextAction?(0,V.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:e.nextAction}):null,e.failure?(0,V.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-danger [overflow-wrap:anywhere]`,children:e.failure.recoveryAction}):null,e.needsUser?(0,V.jsx)(o,{className:`inline-flex min-h-9 items-center rounded-sm text-xs font-medium text-accent-fg hover:underline focus-visible:ring-2 focus-visible:ring-accent/40`,to:M(n.task.id),children:i?`查看并决定`:`Review and decide`}):null]}):null]}),t[0]=n,t[1]=r,t[2]=i,t[3]=a}else a=t[3];return a}function H(e){return(0,V.jsx)(`li`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e},e)}function at(e){return e.kind===`artifact`}function ot(e){return e.uri}function st(e){return{kind:[`file`,`url`].includes(e.targetKind)?`artifact`:`source`,title:e.title??e.targetId,summary:``,...[`file`,`url`].includes(e.targetKind)?{uri:e.targetId}:{},provenance:`user`,strength:`observed`,observedAt:0}}function ct(e){return e.role===`deliverable`}function lt(e){return e.id}function ut(e){let t=(0,B.c)(13),{detail:n,language:r}=e,i=r===`zh`,a=Te(r),o;t[0]===n?o=t[1]:(o=Ee(n),t[0]=n,t[1]=o);let s=o,c;t[2]===s?.runId?c=t[3]:(c=e=>e.runId!==s?.runId,t[2]=s?.runId,t[3]=c);let l=n.receipts.filter(c),[u,d]=(0,z.useState)(`idle`),f;t[4]===s?f=t[5]:(f=async function(e){if(s){d(`pending`);try{await _e(s.runId,e),d(`saved`)}catch{d(`failed`)}}},t[4]=s,t[5]=f);let p=f,m;t[6]!==n||t[7]!==r?(m=(0,V.jsx)(b,{detail:n,language:r}),t[6]=n,t[7]=r,t[8]=m):m=t[8];let h=s?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,V.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:a.latestResult}),(0,V.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[a.receiptStatuses[s.status],` · `,a.verificationStatuses[s.verification.status]]})]}),(0,V.jsx)(R,{content:s.summary,contentKey:`${n.task.id}:result:${s.runId}`,language:r}),s.evidence.length>0?(0,V.jsxs)(`details`,{children:[(0,V.jsxs)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:[i?`验证依据与执行产物`:`Evidence and artifacts`,` · `,s.evidence.length]}),(0,V.jsx)(Ye,{evidence:s.evidence,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,language:r})]}):null,(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,V.jsx)(P,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`helpful`),children:a.doneWell}),(0,V.jsx)(P,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`not_helpful`),children:a.needsFix}),u===`saved`?(0,V.jsx)(`span`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`反馈已记录`:`Feedback saved`}):null,u===`failed`?(0,V.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:a.actionFailed}):null]})]}):null,g=l.length>0?(0,V.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:a.executionHistory.replace(`{{count}}`,String(l.length))}),(0,V.jsx)(`div`,{className:`mt-3 space-y-4`,children:l.map(e=>(0,V.jsxs)(`article`,{className:`space-y-2 rounded-lg bg-surface-hover p-3`,children:[(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.receiptStatuses[e.status]}),(0,V.jsx)(R,{content:e.summary,contentKey:`${n.task.id}:result:${e.runId}`,language:r})]},e.runId))})]}):null,_;return t[9]!==m||t[10]!==h||t[11]!==g?(_=(0,V.jsxs)(`div`,{className:`space-y-4`,children:[m,h,g]}),t[9]=m,t[10]=h,t[11]=g,t[12]=_):_=t[12],_}function dt(e){let t=(0,B.c)(33),{changes:n,language:r}=e,i=r===`zh`,a;t[0]===i?a=t[1]:(a=i?{backlog:`待办池`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`},t[0]=i,t[1]=a);let o=a,s;t[2]===i?s=t[3]:(s=i?{board:`看板`,mobile:`移动端`,api:`手动操作`,runtime:`自动流转`,undo:`撤销`}:{board:`Board`,mobile:`Mobile`,api:`Manual update`,runtime:`Automatic`,undo:`Undo`},t[2]=i,t[3]=s);let c=s,l;t[4]===i?l=t[5]:(l=i?{done:`完成`,cancelled:`取消`,duplicate:`重复`,wont_do:`不做`}:{done:`Done`,cancelled:`Cancelled`,duplicate:`Duplicate`,wont_do:`Won’t do`},t[4]=i,t[5]=l);let u=l,d;t[6]===i?d=t[7]:(d=i?{user:`用户`,agent:`Agent`,system:`系统`,integration:`外部服务`}:{user:`User`,agent:`Agent`,system:`System`,integration:`Integration`},t[6]=i,t[7]=d);let f=d,p=i?`变更记录`:`Change log`,m;t[8]!==n.length||t[9]!==p?(m=(0,V.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[p,` (`,n.length,`)`]}),t[8]=n.length,t[9]=p,t[10]=m):m=t[10];let h;if(t[11]!==f||t[12]!==n||t[13]!==r||t[14]!==o||t[15]!==u||t[16]!==c){let e;t[18]!==f||t[19]!==r||t[20]!==o||t[21]!==u||t[22]!==c?(e=e=>(0,V.jsxs)(`li`,{className:`text-sm text-fg`,children:[(0,V.jsxs)(`div`,{children:[o[e.fromPhase],e.fromResolution?` · ${u[e.fromResolution]}`:``,` → `,o[e.toPhase],e.toResolution?` · ${u[e.toResolution]}`:``]}),(0,V.jsxs)(`div`,{className:`mt-1 text-xs text-fg-muted`,children:[f[e.actor.kind],e.actor.id?` (${e.actor.id})`:``,` · `,c[e.source],` · `,(0,V.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),children:qe(e.createdAt,r)})]})]},e.id),t[18]=f,t[19]=r,t[20]=o,t[21]=u,t[22]=c,t[23]=e):e=t[23],h=[...n].reverse().map(e),t[11]=f,t[12]=n,t[13]=r,t[14]=o,t[15]=u,t[16]=c,t[17]=h}else h=t[17];let g;t[24]===h?g=t[25]:(g=(0,V.jsx)(`ol`,{className:`mt-3 max-h-80 space-y-3 overflow-y-auto`,children:h}),t[24]=h,t[25]=g);let _;t[26]!==n.length||t[27]!==i?(_=n.length?null:(0,V.jsx)(`p`,{className:`mt-3 text-xs text-fg-muted`,children:i?`暂无阶段变更记录`:`No phase changes yet`}),t[26]=n.length,t[27]=i,t[28]=_):_=t[28];let v;return t[29]!==m||t[30]!==g||t[31]!==_?(v=(0,V.jsxs)(`details`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[m,g,_]}),t[29]=m,t[30]=g,t[31]=_,t[32]=v):v=t[32],v}function ft({schedules:e,language:t,onEdit:n,onUpdated:r}){let i=t===`zh`,a=f(t),[s,c]=(0,z.useState)(null),l=(0,z.useRef)(!1),[u,d]=(0,z.useState)(null),p=e=>new Date(e).toLocaleString(i?`zh-CN`:`en-US`,{year:`numeric`,month:`2-digit`,day:`2-digit`,hour:`2-digit`,minute:`2-digit`,timeZoneName:`short`});async function m(e){if(!l.current){l.current=!0,c(e.id),d(null);try{r((await Ne.update(e.id,{enabled:!1,expectedRevision:e.updatedAtMs})).automation)}catch(e){d(e instanceof Error?e.message:a.automations.feedback.actionFailed)}finally{l.current=!1,c(null)}}}return(0,V.jsxs)(`section`,{"aria-label":i?`执行时间`:`Execution schedule`,className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i?`执行时间`:`Execution schedule`}),(0,V.jsx)(`div`,{className:`mt-3 space-y-4`,children:e.map(e=>{let r=e.trigger.kind===`schedule`?e.trigger.schedule:null,c=I(e),l=!e.management||e.management.editable.includes(`trigger`),u=!e.management||e.management.editable.includes(`enabled`);return(0,V.jsxs)(`article`,{className:`space-y-2 text-sm text-fg`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,V.jsx)(`span`,{className:`break-words font-medium`,children:e.name}),(0,V.jsx)(`span`,{className:`text-xs text-fg-muted`,children:c?i?`已执行`:`Completed`:e.enabled?i?`已启用`:`Enabled`:i?`已取消定时执行`:`Scheduling disabled`})]}),(0,V.jsx)(`p`,{children:r?.kind===`once`?`${i?`单次执行:`:`Run once: `}${p(Date.parse(r.at))}`:Be(e.trigger,a.automations,a.cron,t)}),r?.kind===`cron`?(0,V.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[i?`执行时区:`:`Schedule timezone: `,r.tz||(i?`服务所在电脑时区`:`Server timezone`)]}):null,(0,V.jsxs)(`p`,{className:`text-fg-muted`,children:[i?`下次执行:`:`Next run: `,c?i?`已执行,无后续计划`:`Completed; no upcoming run`:e.enabled?e.state.nextRunAtMs===void 0?i?`暂无后续执行`:`No upcoming run`:p(e.state.nextRunAtMs):i?`已取消,不再自动执行`:`Disabled; no automatic runs`]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l?(0,V.jsx)(P,{variant:`secondary`,disabled:s!==null,onClick:()=>n(e),children:i?`修改时间`:`Edit schedule`}):null,e.enabled&&u?(0,V.jsx)(P,{variant:`ghost`,disabled:s!==null,onClick:()=>void m(e),children:s===e.id?i?`正在取消…`:`Cancelling…`:i?`取消定时执行`:`Cancel schedule`}):null,(0,V.jsx)(P,{asChild:!0,variant:`ghost`,children:(0,V.jsx)(o,{to:`/automations?automation=${encodeURIComponent(e.id)}`,children:i?`查看自动化`:`View automation`})})]})]},e.id)})}),u?(0,V.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:u}):null]})}var pt=`w-full rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-2 focus-visible:outline-accent`;function mt({taskId:e,taskTitle:t,projectId:n,executorAgentId:r,language:i,onClose:a,onCreated:s,automation:c}){let l=i===`zh`,u=f(i).automations,[d,b]=(0,z.useState)(()=>c?We(c):{...He,name:t,projectId:n??``,actionMode:`task_command`,taskId:e,agentId:r??``,triggerMode:`once`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}),[x,S]=(0,z.useState)(null),[C,w]=(0,z.useState)(!1),T=(0,z.useRef)(!1),[ee,O]=(0,z.useState)(null),k=e=>b(t=>({...t,...e}));async function A(e){if(e.preventDefault(),!(T.current||x)&&(O(null),!(!d.name.trim()||!c&&!r))){if(d.triggerMode===`once`&&(!Number.isFinite(new Date(d.onceAt).getTime())||new Date(d.onceAt).getTime()<=Date.now())){O(u.experience.futureTime);return}T.current=!0,w(!0);try{let e=c?L(c,d).trigger:Ue(d).trigger,{automation:t}=c?await Ne.update(c.id,{trigger:e,...c.management?{}:{name:d.name.trim(),delivery:{...c.delivery,notificationPolicy:d.notificationPolicy}},...!c.management||c.management.editable.includes(`enabled`)?{enabled:!0}:{},expectedRevision:c.updatedAtMs}):await Ne.create({...Ue(d),enabled:!0});S(t),s(t)}catch(e){O(e instanceof Error?e.message:u.feedback.actionFailed)}finally{T.current=!1,w(!1)}}}return(0,V.jsx)(y,{open:!0,onOpenChange:e=>{!e&&!T.current&&a()},children:(0,V.jsxs)(g,{children:[(0,V.jsx)(p,{className:`fixed inset-0 z-[110] bg-black/45`}),(0,V.jsxs)(_,{className:`xopc-dialog-content fixed left-1/2 top-1/2 z-[111] flex h-[min(38rem,calc(100dvh-2rem))] w-[min(32rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay shadow-popover outline-none`,children:[(0,V.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,V.jsx)(v,{className:`text-base font-semibold text-fg`,children:c?l?`修改执行时间`:`Edit execution schedule`:l?`设置执行时间`:`Set execution time`}),(0,V.jsx)(h,{asChild:!0,children:(0,V.jsx)(P,{variant:`ghost`,className:`size-9 p-0`,disabled:C,"aria-label":l?`关闭`:`Close`,children:(0,V.jsx)(le,{className:`size-4`})})})]}),(0,V.jsx)(m,{className:`sr-only`,children:l?`为当前任务创建定时或周期自动化。`:`Create a scheduled or recurring automation for this task.`}),x?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,V.jsx)(`p`,{role:`status`,className:`text-sm font-medium text-fg`,children:c?l?`执行时间已更新`:`Schedule updated`:l?`执行时间已设置`:`Schedule created`}),(0,V.jsx)(`p`,{className:`break-words text-sm text-fg-muted`,children:x.name}),(0,V.jsx)(P,{asChild:!0,variant:`primary`,children:(0,V.jsx)(o,{to:`/automations?automation=${encodeURIComponent(x.id)}`,children:l?`查看自动化`:`View automation`})})]}),(0,V.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:(0,V.jsx)(P,{onClick:a,children:l?`完成`:`Done`})})]}):(0,V.jsxs)(`form`,{onSubmit:e=>void A(e),className:`flex min-h-0 flex-1 flex-col`,children:[(0,V.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,V.jsxs)(`p`,{className:`break-words text-sm text-fg-muted`,children:[l?`执行任务:`:`Task: `,t]}),(0,V.jsxs)(`fieldset`,{disabled:C,className:`space-y-4`,children:[(0,V.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.name,(0,V.jsx)(`input`,{required:!0,readOnly:!!c?.management,className:pt,value:d.name,onChange:e=>k({name:e.target.value})})]}),(0,V.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.trigger,(0,V.jsxs)(E,{value:d.triggerMode,onChange:e=>k({triggerMode:e.target.value}),children:[c?.trigger.kind===`schedule`&&c.trigger.schedule.kind===`interval`?(0,V.jsx)(D,{value:`interval`,children:l?`固定间隔`:`Fixed interval`}):null,c?.trigger.kind===`schedule`&&c.trigger.schedule.kind===`cron`?(0,V.jsx)(D,{value:`cron`,children:l?`自定义规则`:`Custom schedule`}):null,(0,V.jsx)(D,{value:`once`,children:u.trigger.once}),(0,V.jsx)(D,{value:`daily`,children:u.trigger.daily}),(0,V.jsx)(D,{value:`weekly`,children:u.trigger.weekly})]})]}),d.triggerMode===`once`?(0,V.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.onceAt,(0,V.jsx)(`input`,{required:!0,type:`datetime-local`,className:pt,value:d.onceAt,onChange:e=>k({onceAt:e.target.value})})]}):[`daily`,`weekly`].includes(d.triggerMode)?(0,V.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,V.jsx)(`span`,{children:u.form.time}),(0,V.jsx)(Ge,{disabled:C,value:d.time,onChange:e=>k({time:e}),ariaLabel:u.form.time})]}):null,d.triggerMode===`weekly`?(0,V.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.day,(0,V.jsx)(E,{value:d.weekday,onChange:e=>k({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,V.jsx)(D,{value:String(t),children:u.weekdays[e]},e))})]}):null,d.triggerMode===`cron`?(0,V.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`定时规则`:`Cron expression`,(0,V.jsx)(`input`,{required:!0,className:pt,value:d.cronExpr,onChange:e=>k({cronExpr:e.target.value})})]}):null,d.triggerMode===`interval`?(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,V.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`执行间隔`:`Interval`,(0,V.jsx)(`input`,{required:!0,type:`number`,min:`1`,className:pt,value:d.intervalValue,onChange:e=>k({intervalValue:e.target.value})})]}),(0,V.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`单位`:`Unit`,(0,V.jsxs)(E,{value:d.intervalUnit,onChange:e=>k({intervalUnit:e.target.value}),children:[(0,V.jsx)(D,{value:`minute`,children:l?`分钟`:`Minutes`}),(0,V.jsx)(D,{value:`hour`,children:l?`小时`:`Hours`}),(0,V.jsx)(D,{value:`day`,children:l?`天`:`Days`}),(0,V.jsx)(D,{value:`week`,children:l?`周`:`Weeks`})]})]})]}):null,(0,V.jsx)(Ve,{form:d,onChange:k,language:i}),(0,V.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.draft.notifications,(0,V.jsxs)(E,{disabled:!!c?.management,value:d.notificationPolicy,onChange:e=>k({notificationPolicy:e.target.value}),children:[(0,V.jsx)(D,{value:`attention`,children:u.draft.notifyAttention}),(0,V.jsx)(D,{value:`all`,children:u.draft.notifyAll}),(0,V.jsx)(D,{value:`none`,children:u.draft.notifyNone})]})]})]}),!c&&!r?(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:l?`请先为任务指定执行 Agent。`:`Assign an executor agent to the task first.`}):null,ee?(0,V.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:ee}):null]}),(0,V.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,V.jsx)(P,{type:`button`,variant:`ghost`,disabled:C,onClick:a,children:l?`取消`:`Cancel`}),(0,V.jsx)(P,{type:`submit`,variant:`primary`,disabled:C||!c&&!r||!d.name.trim()||d.triggerMode===`once`&&!d.onceAt,children:C?l?`正在保存…`:`Saving…`:c?c.enabled?l?`保存修改`:`Save changes`:l?`保存并启用`:`Save and enable`:l?`创建自动化`:`Create automation`})]})]})]})]})})}function ht(e){let t=(0,B.c)(36),{detail:n,language:r,onUpdated:i}=e,a=r===`zh`,s;t[0]===n.waits?s=t[1]:(s=n.waits.find(yt),t[0]=n.waits,t[1]=s);let c=s,l,u,d,f,p,m,h;if(t[2]!==n||t[3]!==r||t[4]!==i||t[5]!==c||t[6]!==a){l=n.allowedCommands.includes(`resolve_wait`)&&!c?n.waits.filter(vt):[];let e=l.length>0||n.attention.some(_t),s;t[14]===n?s=t[15]:(s=Ee(n),t[14]=n,t[15]=s);let g=s,_=n.runs.some(gt);d=c?.reason??n.waits[0]?.reason??(n.task.phase===`closed`?a?`任务已关闭,可查看交付物与执行结果。`:`The task is closed. Review its deliverables and results.`:n.task.phase===`review`?a?`请检查交付物与验收项,通过后确认完成。`:`Review the deliverables and acceptance criteria before completing the task.`:_?a?`Agent 正在执行任务,无需你操作。`:`The agent is working. No action is needed from you.`:g?.summary??(a?`任务尚未开始,可开始执行或设置执行时间。`:`Start the task or set an execution time.`)),u=n.attention.length>0?(0,V.jsx)(`ul`,{className:`mt-3 space-y-3`,children:n.attention.map((e,t)=>{let i=l.some(t=>e.kind===`input_required`&&t.kind===`user_input`||e.kind===`approval_required`&&t.kind===`approval`);return(0,V.jsxs)(`li`,{className:`text-sm leading-6 text-fg-muted`,children:[(0,V.jsx)(R,{content:e.summary,contentKey:`${n.task.id}:attention:${e.kind}:${t}`,language:r,markdown:!1,previewHeight:72}),!i&&(e.kind===`input_required`||e.kind===`approval_required`)?(0,V.jsx)(o,{className:`mt-2 inline-flex min-h-11 items-center rounded-lg bg-accent-soft px-3 font-medium text-accent-fg`,to:M(n.task.id),children:a?e.kind===`approval_required`?`查看并决定`:`补充信息`:e.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${e.kind}-${t}`)})}):null,f=a?`当前需要处理`:`Current action`,p=`rounded-xl border border-edge bg-surface-panel p-4`;let v=e?a?`需要你处理`:`Your action needed`:a?`当前进展`:`Current progress`,y=l.length>1?` · ${l.length}`:``;t[16]!==v||t[17]!==y?(m=(0,V.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[v,y]}),t[16]=v,t[17]=y,t[18]=m):m=t[18];let b;t[19]!==n||t[20]!==i||t[21]!==a?(b=e=>(0,V.jsx)(Je,{wait:e,detail:n,zh:a,onUpdated:i},e.id),t[19]=n,t[20]=i,t[21]=a,t[22]=b):b=t[22],h=l.map(b),t[2]=n,t[3]=r,t[4]=i,t[5]=c,t[6]=a,t[7]=l,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h}else l=t[7],u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13];let g;t[23]!==l.length||t[24]!==u||t[25]!==n.task||t[26]!==r||t[27]!==d||t[28]!==a?(g=l.length>0?u?(0,V.jsxs)(`details`,{className:`mt-3`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:a?`等待详情`:`Waiting details`}),u]}):null:u??(0,V.jsx)(R,{content:d,contentKey:`${n.task.id}:current-progress`,language:r,markdown:!1,previewHeight:72,className:`mt-2 text-sm leading-6 text-fg-muted`}),t[23]=l.length,t[24]=u,t[25]=n.task,t[26]=r,t[27]=d,t[28]=a,t[29]=g):g=t[29];let _;return t[30]!==f||t[31]!==p||t[32]!==m||t[33]!==h||t[34]!==g?(_=(0,V.jsxs)(`section`,{"aria-label":f,className:p,children:[m,h,g]}),t[30]=f,t[31]=p,t[32]=m,t[33]=h,t[34]=g,t[35]=_):_=t[35],_}function gt(e){return!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)}function _t(e){return e.kind===`input_required`||e.kind===`approval_required`}function vt(e){return(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`}function yt(e){return e.kind===`paused`}function bt(e){let t=(0,B.c)(17),{children:n,contentKey:r,language:i,className:o}=e,s=(0,z.useId)(),c=z.Children.toArray(n),[l,u]=a(),d;t[0]!==r||t[1]!==l?(d=l.getAll(`taskExpanded`).includes(r),t[0]=r,t[1]=l,t[2]=d):d=t[2];let f=d,p=f?c:c.slice(0,3),m;t[3]!==s||t[4]!==p?(m=(0,V.jsx)(`ul`,{id:s,className:`space-y-1.5`,children:p}),t[3]=s,t[4]=p,t[5]=m):m=t[5];let h;t[6]!==r||t[7]!==f||t[8]!==s||t[9]!==c.length||t[10]!==i||t[11]!==u?(h=c.length>3?(0,V.jsx)(`button`,{type:`button`,"aria-expanded":f,"aria-controls":s,className:`mt-2 min-h-9 rounded-sm text-xs font-medium text-accent hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent/40`,onClick:()=>u(e=>{let t=new URLSearchParams(e),n=t.getAll(`taskExpanded`).filter(e=>e!==r);return t.delete(`taskExpanded`),n.forEach(e=>t.append(`taskExpanded`,e)),f||t.append(`taskExpanded`,r),t},{preventScrollReset:!0}),children:i===`zh`?f?`收起`:`查看全部(${c.length})`:f?`Show less`:`Show all (${c.length})`}):null,t[6]=r,t[7]=f,t[8]=s,t[9]=c.length,t[10]=i,t[11]=u,t[12]=h):h=t[12];let g;return t[13]!==o||t[14]!==m||t[15]!==h?(g=(0,V.jsxs)(`div`,{className:o,children:[m,h]}),t[13]=o,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function xt({taskId:e}){let t=l(e=>e.conversationId),n=u(e=>e.language),[r,i]=(0,z.useState)(``),[a,o]=(0,z.useState)(null),[s,f]=(0,z.useState)(!1),[p,m]=(0,z.useState)(!1),[h,g]=(0,z.useState)([]),[_,v]=(0,z.useState)(null),y=c(`/api/tasks/${encodeURIComponent(e)}/collaboration`),{data:b,error:x,mutate:S}=me([`task-collaboration`,e,t],()=>d(`${y}?recent=1`),{revalidateOnFocus:!0}),C=[...new Map([...h,...b?.items??[]].map(e=>[e.id,e])).values()].sort((e,t)=>e.sequence-t.sequence),w=async()=>{let e=C[0];if(!(!e||p)){m(!0);try{let t=await d(`${y}?recent=1&beforeSequence=${e.sequence}`);g(e=>[...t.items,...e])}catch(e){v(e instanceof Error?e.message:String(e))}finally{m(!1)}}};(0,z.useEffect)(()=>{let t=t=>{let n=t.detail;(!n?.taskId||n.taskId===e)&&S()};return window.addEventListener(`task-collaboration-entry-added`,t),window.addEventListener(`gateway-realtime-connected`,t),()=>{window.removeEventListener(`task-collaboration-entry-added`,t),window.removeEventListener(`gateway-realtime-connected`,t)}},[S,e]);let T=async()=>{if(!(!r.trim()||s)){f(!0),v(null);try{await d(y,{method:`POST`,headers:{"idempotency-key":crypto.randomUUID()},body:JSON.stringify({kind:a?`answer`:`instruction`,body:r.trim(),...a?{causationId:a}:{}})}),i(``),o(null),await S()}catch(e){v(e instanceof Error?e.message:String(e))}finally{f(!1)}}};return(0,V.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n===`zh`?`任务留言`:`Task updates`}),(0,V.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-2 overflow-y-auto`,children:[!b&&!x?(0,V.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,V.jsx)(ue,{className:`h-14 w-full`}),(0,V.jsx)(ue,{className:`h-14 w-4/5`})]}):null,x?(0,V.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:n===`zh`?`暂时无法读取留言`:`Updates unavailable`}):null,C[0]&&C[0].sequence>1?(0,V.jsx)(`button`,{type:`button`,disabled:p,onClick:()=>void w(),className:`text-xs text-accent hover:underline disabled:opacity-50`,children:n===`zh`?`查看更早留言`:`Earlier updates`}):null,C.map(t=>(0,V.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 text-sm`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,V.jsx)(`span`,{children:t.authorKind===`worker_agent`?n===`zh`?`执行 Agent`:`Worker`:t.authorKind===`main_agent`?n===`zh`?`主 Agent`:`Main Agent`:t.authorKind===`system`?n===`zh`?`系统`:`System`:n===`zh`?`用户`:`You`}),(0,V.jsxs)(`span`,{children:[`· `,t.kind]}),t.deliveryStatus?(0,V.jsxs)(`span`,{children:[`· `,t.deliveryStatus]}):null]}),(0,V.jsx)(`div`,{className:`mt-1 min-w-0 text-fg`,"data-task-collaboration-body":!0,children:(0,V.jsx)(R,{content:t.body,contentKey:`${e}:update:${t.id}`,language:n,breaks:!0,previewHeight:120})}),t.kind===`question`&&t.authorKind===`worker_agent`?(0,V.jsx)(`button`,{type:`button`,className:`mt-2 text-xs text-accent hover:underline`,onClick:()=>o(t.id),children:n===`zh`?`回复问题`:`Reply`}):null]},t.id)),b&&!C.length?(0,V.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n===`zh`?`暂无进展留言`:`No updates yet`}):null]}),a?(0,V.jsxs)(`p`,{className:`mt-3 text-xs text-accent`,children:[n===`zh`?`正在回复执行 Agent 的问题`:`Replying to the worker`,(0,V.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>o(null),children:n===`zh`?`取消`:`Cancel`})]}):null,(0,V.jsx)(`textarea`,{value:r,onChange:e=>i(e.target.value),rows:2,"aria-label":n===`zh`?`任务留言`:`Task message`,placeholder:n===`zh`?`给执行 Agent 留言`:`Message the worker`,className:`mt-3 w-full resize-y rounded-lg border border-edge bg-surface-base px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`}),_?(0,V.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-danger`,children:_}):null,(0,V.jsx)(`button`,{type:`button`,disabled:!r.trim()||s,onClick:()=>void T(),className:`mt-2 rounded-lg bg-accent px-3 py-2 text-xs font-medium text-white disabled:opacity-50`,children:s?n===`zh`?`发送中`:`Sending`:n===`zh`?`发送`:`Send`})]})}function St(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Ct(e,t){let n={...e.task};t.title!==void 0&&(n.title=t.title),t.priority!==void 0&&(n.priority=t.priority);for(let e of[`body`,`projectId`,`milestoneId`,`parentTaskId`,`dueAt`,`ownerId`]){let r=t[e];r!==void 0&&(r===null?delete n[e]:Object.assign(n,{[e]:r}))}return n.version+=1,n.updatedAt=Date.now(),{...e,task:n}}function wt(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function Tt(){let e=(0,B.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,V.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,V.jsx)(ue,{className:`h-32 rounded-2xl`}),(0,V.jsx)(ue,{className:`h-52 rounded-2xl`}),(0,V.jsx)(ue,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function Et(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function Dt(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Ot=[`backlog`,`ready`,`active`,`review`,`closed`],kt=[`low`,`normal`,`high`,`critical`],At=(0,z.memo)(function(e){let t=(0,B.c)(20),{value:n,disabled:r,canMove:i,canApprove:a,canReopen:o,language:s,label:c,onChange:l}=e,u;t[0]!==a||t[1]!==i||t[2]!==o||t[3]!==n?(u=e=>e!==n&&!i&&!(e===`closed`?a:n===`closed`&&o),t[0]=a,t[1]=i,t[2]=o,t[3]=n,t[4]=u):u=t[4];let d=u,f;t[5]===c?f=t[6]:(f=(0,V.jsx)(`span`,{children:c}),t[5]=c,t[6]=f);let p;t[7]===l?p=t[8]:(p=e=>l(e.target.value),t[7]=l,t[8]=p);let m;t[9]!==s||t[10]!==d?(m=Ot.map(e=>(0,V.jsx)(D,{value:e,disabled:d(e),children:wt(e,s)},e)),t[9]=s,t[10]=d,t[11]=m):m=t[11];let h;t[12]!==r||t[13]!==p||t[14]!==m||t[15]!==n?(h=(0,V.jsx)(E,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:p,children:m}),t[12]=r,t[13]=p,t[14]=m,t[15]=n,t[16]=h):h=t[16];let g;return t[17]!==f||t[18]!==h?(g=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[f,h]}),t[17]=f,t[18]=h,t[19]=g):g=t[19],g}),jt=(0,z.memo)(function(e){let t=(0,B.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=s);let c;t[2]===o?c=t[3]:(c=e=>o(e.target.value),t[2]=o,t[3]=c);let l;t[4]===a?l=t[5]:(l=kt.map(e=>(0,V.jsx)(D,{value:e,children:a[e]},e)),t[4]=a,t[5]=l);let u;t[6]!==r||t[7]!==c||t[8]!==l||t[9]!==n?(u=(0,V.jsx)(E,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:c,children:l}),t[6]=r,t[7]=c,t[8]=l,t[9]=n,t[10]=u):u=t[10];let d;return t[11]!==s||t[12]!==u?(d=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[s,u]}),t[11]=s,t[12]=u,t[13]=d):d=t[13],d}),Mt=(0,z.memo)(function(e){let t=(0,B.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=o);let s;t[2]!==r||t[3]!==i||t[4]!==a||t[5]!==n?(s=(0,V.jsx)(Ke,{disabled:r,value:n,onChange:a,ariaLabel:i}),t[2]=r,t[3]=i,t[4]=a,t[5]=n,t[6]=s):s=t[6];let c;return t[7]!==o||t[8]!==s?(c=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[o,s]}),t[7]=o,t[8]=s,t[9]=c):c=t[9],c}),Nt=(0,z.memo)(function(e){let t=(0,B.c)(17),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,onChange:s}=e,c;t[0]===i?c=t[1]:(c=(0,V.jsx)(`span`,{children:i}),t[0]=i,t[1]=c);let l;t[2]===s?l=t[3]:(l=e=>s(e.target.value),t[2]=s,t[3]=l);let u;t[4]===a?u=t[5]:(u=(0,V.jsx)(D,{value:``,disabled:!0,children:a}),t[4]=a,t[5]=u);let d;t[6]===o?d=t[7]:(d=o.map(qt),t[6]=o,t[7]=d);let f;t[8]!==r||t[9]!==l||t[10]!==u||t[11]!==d||t[12]!==n?(f=(0,V.jsxs)(E,{triggerClassName:`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,contentClassName:`border-0`,value:n,disabled:r,onChange:l,children:[u,d]}),t[8]=r,t[9]=l,t[10]=u,t[11]=d,t[12]=n,t[13]=f):f=t[13];let p;return t[14]!==c||t[15]!==f?(p=(0,V.jsxs)(`label`,{className:`grid gap-1.5 text-xs text-fg-muted`,children:[c,f]}),t[14]=c,t[15]=f,t[16]=p):p=t[16],p}),Pt=(0,z.memo)(function(e){let t=(0,B.c)(9),{candidates:n,selected:r,disabled:i,labels:a,getTaskHref:o,onChange:s}=e,c;t[0]===r?c=t[1]:(c=r.map(Jt),t[0]=r,t[1]=c);let l;return t[2]!==n||t[3]!==i||t[4]!==o||t[5]!==a||t[6]!==s||t[7]!==c?(l=(0,V.jsx)(Ze,{borderless:!0,candidates:n,selectedIds:c,disabled:i,getTaskHref:o,onChange:s,labels:a}),t[2]=n,t[3]=i,t[4]=o,t[5]=a,t[6]=s,t[7]=c,t[8]=l):l=t[8],l},(e,t)=>e.disabled===t.disabled&&e.labels===t.labels&&e.getTaskHref===t.getTaskHref&&e.onChange===t.onChange&&e.candidates.length===t.candidates.length&&e.candidates.every((e,n)=>e.id===t.candidates[n]?.id&&e.title===t.candidates[n]?.title)&&e.selected.length===t.selected.length&&e.selected.every((e,n)=>e.id===t.selected[n]?.id&&e.title===t.selected[n]?.title)),Ft=`xopc.taskDetail.chatPanelPercent`,It=42;function Lt(e,t){let n=Math.max(30,352/Math.max(t,1)*100),r=Math.min(60,(t-480)/Math.max(t,1)*100);return r<n?It:Math.min(r,Math.max(n,e))}function Rt(){try{let e=Number(window.localStorage.getItem(Ft));return Number.isFinite(e)&&e>=30&&e<=60?e:It}catch{return It}}function zt(e){let t=(0,B.c)(13),{items:n,empty:r,contentKey:i}=e,a=u(Vt);if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:r}),t[0]=r,t[1]=e),e}let o;t[2]===n?o=t[3]:(o=n.join(`
3
- `),t[2]=n,t[3]=o);let s;t[4]===n?s=t[5]:(s=n.map(Bt),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,V.jsx)(`ul`,{className:`space-y-2`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==i||t[9]!==a||t[10]!==o||t[11]!==c?(l=(0,V.jsx)(R,{content:o,contentKey:i,language:a,previewHeight:144,children:c}),t[8]=i,t[9]=a,t[10]=o,t[11]=c,t[12]=l):l=t[12],l}function Bt(e){return(0,V.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,V.jsx)(k,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,V.jsx)(`span`,{className:`min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e})]},e)}function Vt(e){return e.language}function U({taskId:e,presentation:t,backgroundPath:n,onDeleted:r}){let[i,c]=a(),d=s(),f=u(e=>e.language),p=l(e=>e.conversationId),m=(0,z.useMemo)(()=>Te(f),[f]),h=je(e=>e.setPageHeader),g=je(e=>e.clearPageHeader),_=we(e=>e.panes),v=C(e=>e.openForSession),{data:y,error:b,mutate:E,lastChange:D,conversationLoading:ee,conversationError:O}=x(e),{data:k,error:le,mutate:_e}=me(e?[`task-detail-automations`,p]:null,()=>Ne.list(),{refreshInterval:3e4}),[Ae,I]=(0,z.useState)(null),[Be,Ve]=(0,z.useState)(null),[L,He]=(0,z.useState)(()=>new Set),[Ue,We]=(0,z.useState)([]),[Ge,Ke]=(0,z.useState)(null),[Je,Ye]=(0,z.useState)([]),[Ze,B]=(0,z.useState)(!1),[et,tt]=(0,z.useState)(``),[rt,H]=(0,z.useState)(!1),[at,ot]=(0,z.useState)(``),[st,ct]=(0,z.useState)(Rt),[lt,pt]=(0,z.useState)(!1),gt=(0,z.useRef)(null),_t=(0,z.useRef)(null),vt=(0,z.useRef)(null),yt=(0,z.useRef)(!1),wt=(0,z.useRef)(!1),Ot=(0,z.useRef)(``),kt=(0,z.useRef)(null),Bt=(0,z.useRef)(null),Vt=(0,z.useRef)(null),U=(0,z.useRef)(y),[Ht,W]=(0,z.useState)(null),[Ut,Wt]=(0,z.useState)(null),[Gt,Kt]=(0,z.useState)(!1),[qt,Jt]=(0,z.useState)(!1),[Yt,Xt]=(0,z.useState)(null),Zt=(0,z.useRef)(null),Qt=(0,z.useMemo)(()=>({link:m.linkDependencies,linked:m.linkedDependencies,searchPlaceholder:m.dependencySearchPlaceholder,noMatches:m.noDependencyMatches,noCandidates:m.noDependencyCandidates,remove:m.removeDependency}),[m.dependencySearchPlaceholder,m.linkDependencies,m.linkedDependencies,m.noDependencyCandidates,m.noDependencyMatches,m.removeDependency]),$t=y?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,en=(0,z.useMemo)(()=>ae(i.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[i]),tn=(0,z.useCallback)(e=>t===`modal`&&n?re(n,e):ie(`/tasks/${encodeURIComponent(e)}`,en),[n,t,en]);U.current=y;let G=(0,z.useCallback)((e,t)=>{He(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,z.useEffect)(()=>{I(null),Ve(null),W(null),B(!1),kt.current=null,H(!1),Wt(null),Kt(!1),Jt(!1),Xt(null)},[e]),(0,z.useEffect)(()=>{let e=!0;return Ce().then(t=>{e&&Ye(t.items)}).catch(()=>void 0),()=>{e=!1}},[p]),(0,z.useEffect)(()=>{if(!D||D.source===`user`)return;Wt(D);let e=window.setTimeout(()=>Wt(null),3500);return()=>window.clearTimeout(e)},[D]),(0,z.useEffect)(()=>{let t=y?.task.projectId,n=y?.dependencies??[];if(!t){Vt.current=null,Ke(null),We(n);return}Vt.current!==t&&(Vt.current=t,Ke(null));let r=!0;return de(t).then(t=>{if(!r)return;Ke(t.project.name);let i=new Map;for(let r of[...t.tasks,...n])r.id!==e&&i.set(r.id,{id:r.id,title:r.title});We([...i.values()])}).catch(()=>{r&&We(n)}),()=>{r=!1}},[$t,y?.task.projectId,e]);let K=(0,z.useCallback)(async(t,n=`command`)=>{let r=U.current;if(r){G(n,!0),I(null),t.type===`close`&&t.resolution===`done`&&Ve(null);try{await E(await ye(e,t,r.task.version),{revalidate:!1})}catch{I(m.actionFailed),t.type===`close`&&t.resolution===`done`&&Ve(m.actionFailed)}finally{G(n,!1)}}},[m.actionFailed,E,G,e]),nn=(0,z.useCallback)(async(t,n)=>{let r=U.current;if(!r)return!1;n&&G(n,!0),I(null);try{let n=ge(e,t,r.task.version);return await E(n,{optimisticData:Ct(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return I(m.actionFailed),!1}finally{n&&G(n,!1)}},[m.actionFailed,E,G,e]),rn=()=>{y&&(kt.current={value:y.task.title,version:y.task.version},W(null),tt(y.task.title),B(!0))},an=()=>{yt.current=!0,tt(U.current?.task.title??``),kt.current=null,W(null),B(!1),queueMicrotask(()=>{yt.current=!1})},on=async(e=!1)=>{if(yt.current){yt.current=!1;return}let t=U.current;if(!t||L.has(`title`))return;let n=et.trim();if(!n){an();return}let r=kt.current;if(!e&&St(r,t.task.version,t.task.title,n)){W(`title`);return}if(n===t.task.title){an();return}await nn({title:n},`title`)&&(kt.current=null,W(null),B(!1))},sn=async()=>{if(!y)return;if(wt.current){wt.current=!1;return}let e=at.trim(),t=Bt.current;if(St(t,y.task.version,y.task.body??``,e)){W(`description`);return}if(at===Ot.current||e===(y.task.body??``).trim()){H(!1);return}await nn({body:fe(y.task.body??``,e)||null})&&(W(null),H(!1))},cn=(0,z.useCallback)(async e=>{let t=U.current;!t||e===t.task.phase||await K({type:`move`,phase:e},`phase`)},[K]),ln=(0,z.useCallback)(e=>{nn({priority:e},`priority`)},[nn]),un=(0,z.useCallback)(e=>{nn({dueAt:Dt(e)},`dueAt`)},[nn]),dn=(0,z.useCallback)(e=>{ct(e);try{window.localStorage.setItem(Ft,String(e))}catch{}},[]),fn=(0,z.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=vt.current?.clientWidth??0,n=e.key===`Home`?It:st+(e.key===`ArrowLeft`?2:-2);dn(Lt(n,t))},[st,dn]),pn=(0,z.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=vt.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),pt(!0);let i=st,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Lt((n.right-e.clientX)/n.width*100,n.width),a===0&&(a=window.requestAnimationFrame(o))},c=()=>{a!==0&&(window.cancelAnimationFrame(a),o());try{n.releasePointerCapture(r)}catch{}pt(!1),dn(i),window.removeEventListener(`pointermove`,s),window.removeEventListener(`pointerup`,c),window.removeEventListener(`pointercancel`,c)};window.addEventListener(`pointermove`,s),window.addEventListener(`pointerup`,c),window.addEventListener(`pointercancel`,c)},[st,dn]),mn=(0,z.useCallback)(async t=>{let n=U.current;if(n){G(`dependencies`,!0),I(null);try{await E(await be(e,t,n.task.version),{revalidate:!1})}catch{I(m.dependencyUpdateFailed)}finally{G(`dependencies`,!1)}}},[m.dependencyUpdateFailed,E,G,e]),hn=(0,z.useCallback)(async t=>{let n=U.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){G(`delegateAgentId`,!0),I(null);try{await E(await Se(e,t,n.task.version),{revalidate:!1})}catch{I(m.actionFailed)}finally{G(`delegateAgentId`,!1)}}},[m.actionFailed,E,G,e]),gn=(0,z.useCallback)(async()=>{G(`delete`,!0),I(null);try{await xe(e),r?r():d(en,{replace:!0})}catch(e){I(e instanceof Error?e.message:m.actionFailed)}finally{G(`delete`,!1)}},[m.actionFailed,d,r,en,G,e]),_n=(0,z.useCallback)(async(t,n)=>{let r=U.current;if(!r)return!1;G(`acceptance`,!0),Ve(null),I(null);try{return await E(await he(e,t,n,r.task.version,r.task.latestContractVersion),{revalidate:!1}),!0}catch{return Ve(m.actionFailed),I(m.actionFailed),E().catch(()=>void 0),!1}finally{G(`acceptance`,!1)}},[m.actionFailed,E,G,e]);if((0,z.useLayoutEffect)(()=>{if(t!==`modal`)return h({startExtra:(0,V.jsx)(o,{to:en,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":m.backToWork,children:(0,V.jsx)(w,{className:`size-4`})}),main:y?(0,V.jsx)(`p`,{className:`truncate text-sm font-semibold text-fg`,children:Ge?`${Ge} / ${m.taskLabel}`:m.taskLabel}):null,end:null}),g},[g,m.backToWork,m.taskLabel,y,t,Ge,en,h]),b&&!y)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:m.taskNotFound});if(!y)return(0,V.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,V.jsx)(Tt,{})});let q=y.waits[0],J=y.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),Y=De(y),vn=Y.length>0&&Y.every(e=>e.status===`passed`),yn=y.waits.find(e=>e.kind===`paused`),bn=Ee(y),xn=ke(y),Sn=m.detailStatuses[xn],Cn=pe(y.task.body?.trim()||y.task.contract?.objective.trim()||``),wn=y.allowedCommands.includes(`mark_ready`),Tn=y.allowedCommands.includes(`start`),En=y.allowedCommands.includes(`add_wait`),Dn=!q&&!J&&vn&&y.task.phase===`review`&&y.allowedCommands.includes(`close`),On=y.allowedCommands.includes(`reopen`),X=y.conversation.activeConversationId,Z=y.conversation.currentExecutorAgentId??y.task.delegateAgentId??y.task.ownerId,kn=Je.find(e=>e.id===Z),An=!!(X&&_[X]?.open),jn=y.context.filter(e=>e.role!==`deliverable`),Mn=k?.automations.filter(t=>t.action.kind===`task_command`&&t.action.taskId===e)??[],Q=Mn.filter(e=>e.trigger.kind===`schedule`&&e.action.kind===`task_command`&&e.action.command.type===`start`),Nn=Q.filter(e=>e.enabled&&e.state.nextRunAtMs!==void 0).map(e=>e.state.nextRunAtMs).sort((e,t)=>e-t)[0],Pn=e=>{_e(t=>({automations:[e,...(t?.automations??[]).filter(t=>t.id!==e.id)]}),{revalidate:!1})},Fn=e=>{Xt(e),Jt(!0)},In=()=>{k&&(Q.length===1?Fn(Q[0]):Q.length>1?(Zt.current&&(Zt.current.open=!0),c(e=>Qe(e,`schedule`,!0),{preventScrollReset:!0}),Zt.current?.scrollIntoView({block:`start`,behavior:`smooth`}),Zt.current?.focus({preventScroll:!0})):(Xt(null),Jt(!0)))},$=y.sessions.filter((e,t,n)=>n.findIndex(t=>t.conversationId===e.conversationId)===t),Ln=y.task.contract?.expectedOutputs??[],Rn=y.task.contract?.constraints??[],zn=y.task.contract?.approvalRequired??[],Bn=y.task.contract?.assumptions??[],Vn=y.task.contract?.risks??[],Hn=Rn.length>0||zn.length>0||Bn.length>0||Vn.length>0,Un=(...e)=>!!Ut?.changedFields.some(t=>e.includes(t)),Wn=y.allowedCommands.includes(`move`),Gn=L.has(`command`),Kn=L.has(`delete`),qn=J!==void 0,Jn=()=>{let e=gt.current;e&&(e.open=!0,c(e=>Qe(e,`acceptance`,!0),{preventScrollReset:!0}),e.scrollIntoView({block:`start`,behavior:`smooth`}),e.focus({preventScroll:!0}))},Yn=(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[wn&&!Tn&&!q&&y.task.phase!==`review`?(0,V.jsxs)(P,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:Gn,onClick:()=>void K({type:`mark_ready`}),children:[(0,V.jsx)(ce,{className:`size-4`}),m.scheduleTask]}):null,yn&&y.allowedCommands.includes(`resolve_wait`)?(0,V.jsxs)(P,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:Gn,onClick:()=>void K({type:`resolve_wait`,waitId:yn.id}),children:[(0,V.jsx)(ce,{className:`size-4`}),m.resumeTask]}):null,!q&&Tn&&y.task.phase!==`review`&&Z?(0,V.jsxs)(P,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:Gn,onClick:()=>void K({type:`start`,executor:{kind:`agent`,agentId:Z}}),children:[(0,V.jsx)(ce,{className:`size-4`}),m.runTask]}):null,On?(0,V.jsxs)(P,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`ghost`,disabled:Gn,onClick:()=>void K({type:`reopen`,phase:`ready`}),children:[(0,V.jsx)(ce,{className:`size-4`}),m.reopenTask]}):null,y.task.phase!==`review`&&!yn&&En?(0,V.jsxs)(P,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:Gn,onClick:()=>void K({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,V.jsx)(se,{className:`size-4`}),m.pauseTask]}):null,y.task.phase===`closed`?(0,V.jsx)(P,{variant:`primary`,className:`min-h-9 px-3 py-1.5 text-xs`,onClick:()=>{_t.current?.scrollIntoView({block:`start`,behavior:`smooth`}),_t.current?.focus({preventScroll:!0})},children:f===`zh`?`查看结果`:`View results`}):null,!q&&!J&&y.task.phase!==`closed`&&y.task.phase!==`review`?(0,V.jsxs)(P,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:!k,onClick:In,children:[(0,V.jsx)(T,{className:`size-4`}),Q.length>0?f===`zh`?`管理执行时间`:`Manage schedule`:f===`zh`?`设置执行时间`:`Set execution time`]}):null,y.task.phase===`review`?(0,V.jsx)(P,{variant:`primary`,className:`min-h-9 px-3 py-1.5 text-xs`,onClick:Jn,children:f===`zh`?`去验收`:`Review results`}):null,(0,V.jsxs)(Fe,{children:[(0,V.jsx)(Ie,{asChild:!0,children:(0,V.jsx)(P,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:Gn||Kn,"aria-label":m.moreActions,children:(0,V.jsx)(A,{className:`size-4`,"aria-hidden":!0})})}),(0,V.jsx)(Le,{children:(0,V.jsxs)(Re,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[y.task.phase===`review`&&!yn&&En?(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void K({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:m.pauseTask}):null,y.task.phase===`review`&&!q&&!J?(0,V.jsx)(F,{disabled:!k,className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:opacity-50`,onSelect:In,children:Q.length>0?f===`zh`?`管理执行时间`:`Manage schedule`:f===`zh`?`设置执行时间`:`Set execution time`}):null,y.task.phase===`review`&&!q&&Tn&&Z?(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void K({type:`start`,executor:{kind:`agent`,agentId:Z}}),children:m.runTask}):null,wn&&(Tn||q||y.task.phase===`review`)?(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void K({type:`mark_ready`}),children:m.scheduleTask}):null,J?(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{G(`command`,!0),I(null),E(ve(e,J.id,J.version),{revalidate:!1}).catch(()=>I(m.actionFailed)).finally(()=>G(`command`,!1))},children:m.cancelActiveRun}):null,J?(0,V.jsx)(ze,{className:`my-1 h-px bg-edge`}):null,y.task.phase===`closed`?null:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>void K({type:`close`,resolution:`cancelled`}),children:m.cancelTask}),(0,V.jsx)(ze,{className:`my-1 h-px bg-edge`})]}),(0,V.jsx)(F,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{if(qn){I(m.deleteActiveTaskBlocked);return}Kt(!0)},children:m.deleteTask})]})})]})]});return(0,V.jsxs)(`div`,{ref:vt,className:`flex h-full min-h-0 flex-col overflow-hidden ${lt?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${st}%`},children:[(0,V.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,V.jsxs)(`div`,{className:`task-detail-scroll flex min-w-0 shrink-0 flex-col lg:min-h-0 lg:flex-1 lg:shrink lg:overflow-y-auto lg:overscroll-contain`,children:[(0,V.jsxs)(`header`,{className:N(`shrink-0 border-b border-edge-subtle bg-surface-panel px-5 py-4 sm:px-6`,Un(`title`)&&`task-detail-live-update`),children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-3`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[Ge?(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,V.jsx)(te,{className:`size-3.5`,"aria-hidden":!0}),Ge]}):null,Ge?(0,V.jsx)(`span`,{"aria-hidden":`true`,children:`/`}):null,(0,V.jsx)(`span`,{children:m.taskLabel}),Ut?(0,V.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:Ut.source===`agent`?f===`zh`?`Agent 刚刚更新`:`Updated by Agent`:f===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Ze?(0,V.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,"aria-label":f===`zh`?`任务标题`:`Task title`,rows:2,value:et,onFocus:e=>{kt.current?.value===et&&(e.currentTarget.setSelectionRange(0,0),e.currentTarget.scrollTop=0)},onChange:e=>tt(e.target.value),onBlur:()=>void on(),onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),an()):e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),e.currentTarget.blur()))},className:`mt-2 block max-h-56 min-h-14 w-full max-w-3xl resize-none overflow-y-auto bg-transparent p-0 text-xl font-semibold leading-7 text-fg outline-none [field-sizing:content]`}):(0,V.jsx)(R,{content:y.task.title,contentKey:`${e}:title`,language:f,previewHeight:56,className:`mt-2 max-w-3xl`,children:(0,V.jsx)(`h1`,{className:`break-words text-xl font-semibold leading-7 text-fg`,children:(0,V.jsx)(`button`,{type:`button`,className:`max-w-full whitespace-pre-wrap break-words [overflow-wrap:anywhere] rounded-sm text-left outline-none hover:bg-surface-hover/60 focus-visible:ring-2 focus-visible:ring-accent/40`,title:y.task.title,onClick:rn,children:y.task.title})})}),Ht===`title`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:f===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:an,children:f===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,disabled:L.has(`title`),onClick:()=>void on(!0),children:f===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,V.jsx)(`span`,{className:N(`shrink-0 rounded-full px-2.5 py-1 text-xs font-medium`,Oe(xn)),children:Sn})]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,V.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[Z?(0,V.jsx)(Me,{agentId:Z,avatar:kn?.avatar,size:20,className:`shrink-0`}):null,(0,V.jsxs)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[m.executorLabel,` · `,kn?.name??Z??m.unassigned]})]}),(0,V.jsx)(`span`,{className:`text-fg-subtle`,children:m.updatedAt.replace(`{{date}}`,qe(y.task.updatedAt,f))})]})]}),(0,V.jsxs)(`div`,{className:`sticky top-0 z-10 flex shrink-0 flex-wrap items-center justify-between gap-2 border-b border-edge-subtle bg-surface-panel px-4 py-2 sm:px-5`,"aria-label":f===`zh`?`任务操作`:`Task actions`,children:[(0,V.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:[y.task.title,` · `,Sn]}),Yn,Ae?(0,V.jsx)(`p`,{role:`alert`,className:`basis-full text-sm text-danger`,children:Ae}):null]}),(0,V.jsxs)(`section`,{className:`min-w-0 space-y-4 p-4 sm:p-5`,children:[y.task.phase===`review`?null:(0,V.jsx)(ht,{detail:y,language:f,onUpdated:e=>{E(e,{revalidate:!1})}}),(0,V.jsxs)(`section`,{ref:_t,tabIndex:-1,"aria-labelledby":`task-results-heading`,className:`scroll-mt-24 space-y-4`,children:[(0,V.jsx)(it,{detail:y,language:f}),y.task.phase===`review`&&(y.waits.length>0||y.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`))?(0,V.jsx)(ht,{detail:y,language:f,onUpdated:e=>{E(e,{revalidate:!1})}}):null,(0,V.jsx)($e,{panelId:`acceptance`,defaultOpen:y.task.phase===`review`||!!bn,ref:gt,tabIndex:-1,"aria-label":m.successDefinition,className:`scroll-mt-24 overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel`,summaryClassName:`cursor-pointer p-4 text-sm font-medium text-fg`,title:(0,V.jsxs)(V.Fragment,{children:[f===`zh`?`验收`:`Acceptance`,` · `,Y.filter(e=>e.status===`passed`).length,`/`,Y.length]}),children:(0,V.jsx)(`div`,{className:`px-4 pb-4`,children:(0,V.jsx)(nt,{criteria:Y,language:f,closed:y.task.phase===`closed`,pending:L.has(`acceptance`),completionPending:Gn,canComplete:Dn,error:Be,blockedReason:q?f===`zh`?`请先处理待办事项`:`Resolve the pending request first`:J?f===`zh`?`请等待当前执行结束`:`Wait for the current run to finish`:vn?f===`zh`?`任务尚未进入可完成状态`:`The task is not ready for completion`:Y.length===0?f===`zh`?`请先定义验收标准`:`Define acceptance criteria first`:f===`zh`?`还有 ${Y.filter(e=>e.status!==`passed`).length} 项待验收`:`${Y.filter(e=>e.status!==`passed`).length} criteria need review`,onReview:_n,onComplete:()=>void K({type:`close`,resolution:`done`}),projectId:y.task.projectId,conversationId:X??void 0},`${e}:${y.task.latestContractVersion}`)})})]}),(0,V.jsx)($e,{panelId:`report`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,summaryClassName:`cursor-pointer text-sm font-medium text-fg`,title:f===`zh`?`完整执行报告`:`Full execution report`,children:(0,V.jsx)(ut,{detail:y,language:f},bn?.runId??e)}),!k&&!le?(0,V.jsx)(ue,{className:`h-9 rounded-lg`}):null,le?(0,V.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-sm text-danger`,children:[(0,V.jsx)(`span`,{children:f===`zh`?`无法读取执行计划,请重试后再设置时间。`:`Could not load schedules. Retry before setting a time.`}),(0,V.jsx)(P,{variant:`ghost`,onClick:()=>void _e(),children:f===`zh`?`重试`:`Retry`})]}):null,Q.length>0?(0,V.jsx)($e,{panelId:`schedule`,ref:Zt,tabIndex:-1,className:`scroll-mt-24 rounded-xl border border-edge-subtle bg-surface-panel p-4`,summaryClassName:`cursor-pointer text-sm text-fg-muted`,title:(0,V.jsxs)(V.Fragment,{children:[f===`zh`?`执行时间`:`Execution schedule`,` · `,Q.length,Nn===void 0?``:` · ${f===`zh`?`下次执行:`:`Next run: `}${qe(Nn,f)}`]}),children:(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(ft,{schedules:Q,language:f,onEdit:Fn,onUpdated:Pn})})}):null,(0,V.jsx)($e,{panelId:`goal`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,summaryClassName:`cursor-pointer text-sm font-medium text-fg`,title:f===`zh`?`任务目标与说明`:`Task goal and description`,children:(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel divide-y divide-edge-subtle`,children:[(0,V.jsxs)(`div`,{className:`border-b border-edge-subtle p-5`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:f===`zh`?`任务目标`:`Task goal`}),(0,V.jsx)(R,{content:y.task.contract?.objective||y.task.title,contentKey:`${e}:goal`,language:f,markdown:!1,previewHeight:72,className:`mt-3 text-sm leading-6 text-fg`}),(0,V.jsxs)(P,{variant:`ghost`,className:`mt-2 min-h-9 px-2 text-xs`,onClick:Jn,children:[m.successDefinition,` · `,Y.length]})]}),Ln.length>0?(0,V.jsxs)(`div`,{className:`p-5`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:m.expectedOutputs}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(zt,{contentKey:`${e}:expectedOutputs`,items:Ln,empty:m.noDefinition})})]}):null,(0,V.jsxs)(`details`,{className:N(`p-5`,Un(`body`)&&`task-detail-live-update`),children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:m.taskDescription}),rt?(0,V.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:at,onChange:e=>ot(e.target.value),onBlur:()=>void sn(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),wt.current=!0,ot(pe(y.task.body??y.task.contract?.objective??``)),H(!1),queueMicrotask(()=>{wt.current=!1}))},className:`mt-3 w-full resize-y rounded-lg bg-surface-hover px-3 py-2 text-sm leading-6 text-fg outline-none ring-2 ring-accent/20 focus:ring-accent/50`}):(0,V.jsxs)(`div`,{className:`mt-2`,children:[Cn&&Cn!==y.task.title?(0,V.jsx)(R,{content:Cn,contentKey:`${e}:description`,language:f}):(0,V.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:m.noTaskDescription}),(0,V.jsx)(`button`,{type:`button`,className:`mt-2 rounded-md px-2 py-1 text-xs text-accent hover:bg-surface-hover focus-visible:bg-surface-hover`,onClick:()=>{let e=pe(y.task.body??y.task.contract?.objective??``);Ot.current=e,Bt.current={value:y.task.body??``,version:y.task.version},W(null),ot(e),H(!0)},children:f===`zh`?`编辑说明`:`Edit description`})]}),Ht===`description`?(0,V.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,V.jsx)(`span`,{children:f===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{ot(pe(y.task.body??``)),W(null),H(!1)},children:f===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,V.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void nn({body:fe(y.task.body??``,at.trim())||null}).then(e=>{e&&(W(null),H(!1))}),children:f===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),Hn?(0,V.jsxs)(`section`,{className:N(`p-5`,Un(`contract`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.taskDefinition}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:f===`zh`?`执行边界及补充背景`:`Execution boundaries and supporting context`}),Rn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:m.constraints}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(zt,{contentKey:`${e}:constraints`,items:Rn,empty:m.noDefinition})})]}):null,zn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:m.approvalRequired}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(zt,{contentKey:`${e}:approvalRequired`,items:zn,empty:m.noDefinition})})]}):null,Bn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:m.contextAssumptions}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(zt,{contentKey:`${e}:assumptions`,items:Bn,empty:m.noDefinition})})]}):null,Vn.length>0?(0,V.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:m.contextRisks}),(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(zt,{contentKey:`${e}:risks`,items:Vn,empty:m.noDefinition})})]}):null]}):null]})})}),(0,V.jsxs)($e,{panelId:`management`,"aria-label":f===`zh`?`任务管理`:`Task management`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,summaryClassName:`cursor-pointer text-sm font-medium text-fg`,title:f===`zh`?`任务管理`:`Task management`,children:[(0,V.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,V.jsxs)(`section`,{className:N(`p-5`,Un(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.taskProperties}),(0,V.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,V.jsx)(At,{value:y.task.phase,disabled:L.has(`phase`),canMove:Wn,canApprove:Dn,canReopen:On,language:f,label:m.taskPhase,onChange:cn}),(0,V.jsx)(jt,{value:y.task.priority,disabled:L.has(`priority`),label:m.priority,labels:m.priorityLabels,onChange:ln}),(0,V.jsx)(Mt,{value:Et(y.task.dueAt),disabled:L.has(`dueAt`),label:m.dueDate,onChange:un}),(0,V.jsx)(Nt,{value:y.conversation.currentExecutorAgentId??``,disabled:L.has(`delegateAgentId`),label:m.executorLabel,unassignedLabel:m.unassigned,agents:Je,onChange:hn})]})]}),(0,V.jsxs)(`details`,{className:N(`p-5`,Un(`dependencies`)&&`task-detail-live-update`),children:[(0,V.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[m.taskRelations,` · `,y.dependencies.length,` / `,y.dependents.length]}),(0,V.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:m.dependencies}),(0,V.jsx)(Pt,{candidates:Ue,selected:y.dependencies,disabled:L.has(`dependencies`),labels:Qt,getTaskHref:tn,onChange:mn})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:m.dependents}),y.dependents.length>0?(0,V.jsx)(`div`,{className:`space-y-1.5`,children:y.dependents.map(t=>(0,V.jsx)(R,{content:t.title,contentKey:`${e}:dependent:${t.id}`,language:f,previewHeight:72,className:`rounded-lg bg-surface-hover p-2.5`,children:(0,V.jsx)(o,{to:tn(t.id),className:`block break-words [overflow-wrap:anywhere] text-sm text-fg-muted transition-colors hover:text-fg`,children:t.title})},t.id))}):(0,V.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:m.noDependents})]})]})]})]}),y.task.phase===`closed`?null:(0,V.jsxs)(P,{variant:`ghost`,className:`my-3`,disabled:!k,onClick:In,children:[(0,V.jsx)(T,{className:`size-4`}),Q.length>0?f===`zh`?`管理执行时间`:`Manage schedule`:m.scheduleRecurringTask]}),(0,V.jsxs)(`details`,{className:`mb-4 rounded-xl border border-edge-subtle bg-surface-panel p-5 shadow-surface`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:f===`zh`?`关联内容`:`Related work`}),$.length>0||y.runs.length>0||Mn.length>0||y.dependencies.length>0||y.dependents.length>0?(0,V.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[$.length>0?(0,V.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:f===`zh`?`对话 · ${$.length}`:`Conversations · ${$.length}`}),(0,V.jsx)(bt,{contentKey:`${e}:sessions`,language:f,className:`mt-2`,children:$.map(t=>(0,V.jsx)(`li`,{children:(0,V.jsx)(o,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:t.conversationId===X?M(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===X?f===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?f===`zh`?`关联讨论`:`Linked discussion`:f===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})]}):null,Mn.length>0?(0,V.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:f===`zh`?`自动化 · ${Mn.length}`:`Automations · ${Mn.length}`}),(0,V.jsx)(bt,{contentKey:`${e}:automations`,language:f,className:`mt-2`,children:Mn.map(e=>(0,V.jsx)(`li`,{children:(0,V.jsx)(o,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:`/automations?automation=${encodeURIComponent(e.id)}`,children:e.name})},e.id))})]}):null,y.dependencies.length>0||y.dependents.length>0?(0,V.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,V.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:m.taskRelations}),(0,V.jsx)(`p`,{className:`mt-2 text-sm text-fg`,children:f===`zh`?`${y.dependencies.length} 个前置任务 · ${y.dependents.length} 个后续任务`:`${y.dependencies.length} prerequisites · ${y.dependents.length} dependents`})]}):null]}):(0,V.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:f===`zh`?`还没有关联内容`:`No related work yet`}),(0,V.jsx)(`div`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:(0,V.jsx)(Xe,{resource:{kind:`task`,id:y.task.id,revision:String(y.task.version)},disabled:Ze||rt||L.size>0})})]}),jn.length>0?(0,V.jsxs)(`section`,{className:N(`p-5`,Un(`context`)&&`task-detail-live-update`),children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m.contextUsed}),(0,V.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:jn.map(e=>(0,V.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,V.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[m.contextRoleLabels[e.role],` · `,m.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,V.jsx)(`a`,{className:`mt-1 block break-all text-sm text-accent hover:underline`,href:e.targetId,target:`_blank`,rel:`noreferrer`,children:e.title??e.targetId}):(0,V.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,V.jsxs)(`details`,{className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:f===`zh`?`活动记录与留言`:`Activity and updates`}),(0,V.jsxs)(`div`,{className:`mt-3 space-y-4`,children:[(0,V.jsx)(xt,{taskId:e},e),(0,V.jsx)(dt,{changes:y.phaseChanges,language:f})]})]})]})]}),(0,V.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":f===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(st),tabIndex:0,onPointerDown:pn,onKeyDown:fn,onDoubleClick:()=>dn(It),className:`group hidden w-2 shrink-0 cursor-col-resize touch-none items-stretch justify-center bg-surface-panel outline-none transition-colors hover:bg-surface-hover focus-visible:bg-surface-hover lg:flex ${lt?`bg-surface-hover`:``}`,children:(0,V.jsx)(`div`,{className:`w-px bg-edge-strong/70 transition-colors group-hover:bg-accent group-focus-visible:bg-accent`})}),(0,V.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 shrink-0 flex-col border-t border-edge-subtle bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)] lg:border-t-0`,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge-subtle px-4 py-3`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-medium text-fg-muted`,children:f===`zh`?`执行对话`:`Execution chat`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[$.length>1?(0,V.jsxs)(Fe,{children:[(0,V.jsx)(Ie,{asChild:!0,children:(0,V.jsx)(P,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,children:f===`zh`?`${$.length} 段对话`:`${$.length} conversations`})}),(0,V.jsx)(Le,{children:(0,V.jsx)(Re,{align:`end`,sideOffset:6,className:`z-[100] min-w-52 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:$.map(t=>(0,V.jsx)(F,{asChild:!0,children:(0,V.jsx)(o,{className:`block rounded-md px-3 py-2 text-sm text-fg outline-none hover:bg-surface-hover focus:bg-surface-hover`,to:t.conversationId===X?M(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===X?f===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?f===`zh`?`关联讨论`:`Linked discussion`:f===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})})]}):null,X?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(P,{type:`button`,variant:`ghost`,className:N(`size-8 p-0`,An&&`bg-surface-hover text-fg`),"aria-label":f===`zh`?`项目文件`:`Project files`,"aria-pressed":An,onClick:()=>{we.getState().openFiles(X),v(X)},children:(0,V.jsx)(ne,{className:`size-4`,"aria-hidden":!0})}),(0,V.jsx)(P,{asChild:!0,variant:`ghost`,className:`size-8 p-0`,children:(0,V.jsx)(o,{to:M(e),"aria-label":f===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,V.jsx)(j,{className:`size-4`,"aria-hidden":!0})})})]}):null]})]}),X?(0,V.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,V.jsx)(S,{embedded:!0,conversationId:X,taskId:e})}):ee?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(oe,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:f===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):O?(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(oe,{className:`mx-auto size-8 text-danger`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:f===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:O instanceof Error?O.message:String(O)})]})}):(0,V.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,V.jsxs)(`div`,{className:`max-w-xs`,children:[(0,V.jsx)(oe,{className:`mx-auto size-8 text-fg-subtle`}),(0,V.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:f===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,V.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:f===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]}),qt?(0,V.jsx)(mt,{automation:Yt??void 0,taskId:e,taskTitle:y.task.title,projectId:y.task.projectId,executorAgentId:Z,language:f,onClose:()=>Jt(!1),onCreated:Pn},`${e}:${Yt?.id??`new`}`):null,(0,V.jsx)(Pe,{open:Gt,title:m.deleteTaskTitle,description:m.deleteTaskDescription.replace(`{{title}}`,y.task.title),confirmLabel:m.confirmDeleteTask,cancelLabel:m.keepTask,destructive:!0,onConfirm:()=>{Kt(!1),gn()},onCancel:()=>Kt(!1)})]})}function Ht(){let e=(0,B.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,V.jsx)(U,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function W(e){let t=(0,B.c)(41),{taskId:n,backgroundPath:r,workspacePanelWidth:i,onClose:a}=e,o=i===void 0?0:i,s=u(Kt),c=Ae(Gt),l=o>0,d;t[0]!==a||t[1]!==c?(d=e=>{e||(c(null),a())},t[0]=a,t[1]=c,t[2]=d):d=t[2];let f=s===`zh`?`关闭任务详情`:`Close task details`,p;t[3]!==a||t[4]!==c?(p=()=>{c(null),a()},t[3]=a,t[4]=c,t[5]=p):p=t[5];let b;t[6]!==f||t[7]!==p?(b=(0,V.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45`,"aria-label":f,onClick:p}),t[6]=f,t[7]=p,t[8]=b):b=t[8];let x=l?`true`:`false`,S=`${o/2}px`,C=`${o}px`,w;t[9]!==S||t[10]!==C?(w={"--task-detail-workspace-offset":S,"--task-detail-workspace-width":C},t[9]=S,t[10]=C,t[11]=w):w=t[11];let T=w,E=s===`zh`?`任务详情`:`Task details`,D;t[12]===E?D=t[13]:(D=(0,V.jsx)(v,{className:`font-medium text-fg`,children:E}),t[12]=E,t[13]=D);let ee=s===`zh`?`查看并操作任务详情`:`View and manage task details`,O;t[14]===ee?O=t[15]:(O=(0,V.jsx)(m,{className:`sr-only`,children:ee}),t[14]=ee,t[15]=O);let k=s===`zh`?`关闭任务详情`:`Close task details`,A;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,V.jsx)(le,{className:`size-4`,"aria-hidden":!0}),t[16]=A):A=t[16];let j;t[17]===k?j=t[18]:(j=(0,V.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:(0,V.jsx)(h,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":k,children:A})}),t[17]=k,t[18]=j);let te;t[19]!==D||t[20]!==O||t[21]!==j?(te=(0,V.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[D,O,j]}),t[19]=D,t[20]=O,t[21]=j,t[22]=te):te=t[22];let ne;t[23]!==a||t[24]!==c?(ne=()=>{c(null),a()},t[23]=a,t[24]=c,t[25]=ne):ne=t[25];let re;t[26]!==r||t[27]!==ne||t[28]!==n?(re=(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,V.jsx)(U,{taskId:n,presentation:`modal`,backgroundPath:r,onDeleted:ne})}),t[26]=r,t[27]=ne,t[28]=n,t[29]=re):re=t[29];let M;t[30]!==T||t[31]!==te||t[32]!==re||t[33]!==x?(M=(0,V.jsxs)(_,{className:`xopc-dialog-content task-detail-modal-content fixed top-1/2 z-[90] flex h-[min(54rem,calc(100dvh-2rem))] -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-2xl border border-edge bg-surface-overlay focus:outline-none`,"data-workspace-panel-open":x,style:T,onEscapeKeyDown:Wt,onInteractOutside:Ut,children:[te,re]}),t[30]=T,t[31]=te,t[32]=re,t[33]=x,t[34]=M):M=t[34];let ie;t[35]!==M||t[36]!==b?(ie=(0,V.jsxs)(g,{children:[b,M]}),t[35]=M,t[36]=b,t[37]=ie):ie=t[37];let ae;return t[38]!==d||t[39]!==ie?(ae=(0,V.jsx)(y,{modal:!1,open:!0,onOpenChange:d,children:ie}),t[38]=d,t[39]=ie,t[40]=ae):ae=t[40],ae}function Ut(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Wt(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Gt(e){return e.setPath}function Kt(e){return e.language}function qt(e){return(0,V.jsx)(D,{value:e.id,children:e.name||e.id},e.id)}function Jt(e){return e.id}export{W as TaskDetailModal,Ht as TaskDetailPage};
@@ -1 +0,0 @@
1
- import{t as e}from"./tool-activity-BtJkgjFf.js";function t(e){if(typeof e==`string`)try{return t(JSON.parse(e))}catch{return null}return typeof e==`object`&&e&&!Array.isArray(e)?e:null}function n(e,t){return e.replace(/\{\{(\w+)\}\}/g,(e,n)=>t[n]??``)}function r(e){return e.trim().toLowerCase().replace(/-/g,`_`).split(`__`).at(-1)?.split(`.`).at(-1)??``}var i={automation:`automation`,browser_automation:`browser`,browser_use:`browser`,clarify:`clarification`,codemode:`codeExecution`,tool_search:`toolSearch`,computer_use:`computer`,create_desktop_pet:`desktopPet`,create_share:`share`,delegate_task:`delegation`,image_generate:`imageGeneration`,image:`imageInspection`,language_diagnostics:`diagnostics`,managed_job:`job`,memory_maintenance:`memoryMaintenance`,knowledge_get:`memoryRead`,knowledge_write:`memoryUpdate`,user_context_get:`memoryRead`,user_context_update:`memoryUpdate`,publish_artifacts:`publish`,update_plan:`planning`,read_media:`mediaRead`,review_workspace:`review`,send_media:`mediaSend`,send_message:`message`,session_recall:`sessionRecall`,session_search:`sessionSearch`,session_status:`sessionStatus`,skill_install:`skillInstall`,skill_manage:`skillManage`,skills_marketplace_search:`skillSearch`,skills_list:`skillSearch`,skill_view:`skillView`,text_to_speech:`speech`,structured_output:`structuredOutput`,todo:`todo`,tool_manual:`manual`,web_extract:`webExtract`,xopc_require_connection:`connection`};function a(e){let t=r(e);return t===`xopc_use`||t===`phone_use`||t in i}function o(e,t,n,i,o){if(a(e.name)){let a=r(e.name);return x(e.name,a===`xopc_use`||a===`phone_use`?e.input:void 0,t,n,i,e.activity)}let s=S(e.name,e.activity);return t===`running`?o[s]:s===`other`?n.fallback.completed.replace(/\{\{name\}\}/g,``).trim():C(e.name,i,e.activity)}var s=new Set([`list`,`get`,`get_card`,`history`,`list_milestones`,`list_updates`,`mail_sources`,`preview_edit`,`resolve_workspace`]),c=new Set([`create`,`create_milestone`,`create_update`,`follow_up`,`start`]),l=new Set([`add_context`,`append`,`command`,`remove_context`,`update`,`update_dependencies`,`update_follow_up`,`update_milestone`]),u=new Set([`delete`]),d=new Set([`run`,`resume`]),f=new Set([`cancel`,`pause`]),p=new Set([`check`,`validate`]),m=new Set([`open`]),h=new Set([`continue_card`]);function g(e){return s.has(e)?`inspect`:c.has(e)?`create`:l.has(e)?`update`:u.has(e)?`remove`:d.has(e)?`run`:f.has(e)?`stop`:p.has(e)?`validate`:m.has(e)?`open`:h.has(e)?`continue`:`use`}function _(e,t){return e===`project`&&t.includes(`milestone`)?`milestone`:e===`project`&&t.includes(`update`)?`projectUpdate`:e===`project`?`project`:e===`automation`?`automation`:e===`note`?`note`:e===`task`?`task`:e===`task_run`?`taskRun`:e===`local_app`?`localApp`:e===`settings`?`settings`:e===`context`?`context`:e===`chat_preview`?`chatPreview`:`productItem`}function v(e){return(e.trim().split(`__`).at(-1)?.split(`.`).at(-1)??e.trim()).replace(/[-_]+/g,` `).replace(/\s+/g,` `).trim()||`tool`}var y={list:`inspect`,get:`inspect`,read:`inspect`,fetch:`inspect`,find:`inspect`,search:`inspect`,query:`inspect`,create:`create`,add:`create`,generate:`create`,install:`create`,update:`update`,edit:`update`,write:`update`,append:`update`,set:`update`,delete:`remove`,remove:`remove`,uninstall:`remove`,run:`run`,execute:`run`,start:`run`,trigger:`run`,stop:`stop`,cancel:`stop`,pause:`stop`,validate:`validate`,check:`validate`,test:`validate`,verify:`validate`,analyze:`validate`,review:`validate`,open:`open`,navigate:`open`,continue:`continue`,resume:`continue`};function b(e,t,r){let[i,...a]=v(e).split(` `),o=y[i.toLowerCase()],s=a.join(` `).trim();return!o||!s?null:n(r.actions[o][t],{object:s})}function x(a,o,s,c,l,u){let d=r(a);if(d===`phone_use`&&c.phone){let e=t(o)?.op;return(typeof e==`string`&&Object.hasOwn(c.phone,e)?c.phone[e]:c.phone.default)[s]}if(d===`xopc_use`){let e=t(o),r=typeof e?.mode==`string`?e.mode.trim().toLowerCase():``,i=typeof e?.command==`string`?e.command.trim().toLowerCase():``,a=g(i),l=_(r,i);return n(c.actions[a][s],{object:c.objects[l]})}let f=i[d];if(f){let e=c.builtins[f][s],n=t(o),r=f===`skillView`?n?.name:void 0;return typeof r==`string`&&r.trim()?`${e} · ${r.trim().replace(/\s+/g,` `).slice(0,100)}`:e}let p=u??e(a,s===`running`?`running`:`completed`);return p.category!==`other`||p.action!==`use`?C(a,l,p):b(a,s,c)??n(c.fallback[s],{name:v(a)})}function S(t,n){if(t===`user_context_search`||t===`knowledge_search`)return`memorySearch`;let r=n??e(t,`running`);return r.category===`memory`&&r.action===`search`?`memorySearch`:r.category===`web`&&r.action===`search`?`webSearch`:r.category===`code`&&r.action===`search`?`codeSearch`:r.category===`other`&&r.action===`search`?`search`:r.category===`file`&&r.action===`read`?`readFile`:r.category===`file`&&r.action===`list`?`listDir`:r.category===`file`&&r.action===`write`?`writeFile`:r.category===`file`&&r.action===`edit`?`editFile`:r.category===`command`&&r.action===`execute`?`runCommand`:r.category===`navigation`&&r.action===`open`?`openUrl`:r.category===`web`&&r.action===`read`?`fetchUrl`:`other`}function C(t,n,r){let i=r??e(t,`running`);if(i.category===`planning`)return n.updatePlan??n.unknownTool.replace(`{{name}}`,t);let a=S(t,i);return a===`webSearch`?n.searchedWeb:a===`memorySearch`?n.searchedMemory??n.searched??n.searchedWeb:a===`codeSearch`?n.searchedCode??n.searched??n.searchedWeb:a===`search`?n.searched??n.searchedWeb:a===`readFile`?n.readFile:a===`runCommand`?n.runCommand:a===`listDir`?n.listDirectory:a===`writeFile`?n.writeFile:a===`editFile`?n.editFile:a===`openUrl`?n.openUrl:a===`fetchUrl`?n.fetchUrl:n.unknownTool.replace(`{{name}}`,t.trim()||`tool`)}export{a as i,C as n,o as r,S as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-load-DrVGNxJm.js","assets/rolldown-runtime-aKtaBQYM.js","assets/attachment-utils-core-BIOUBrpT.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{i as a,n as o,o as s}from"./locale-store-DGtk-KSF.js";import{t as c}from"./messages-DYDySzn1.js";import{o as l,r as u,s as d,t as f}from"./dist-BGTk37IG.js";import{t as p}from"./chevron-left-DqFhpbvK.js";import{t as m}from"./chevron-right-BweFrslA.js";import{n as h,t as g}from"./file-BqMS_3DT.js";import{a as _,b as v,l as y,n as b,t as x,x as S}from"./use-file-preview-expanded-ivMxmMu1.js";import{t as C}from"./mic-CuUb7zc-.js";import{n as w}from"./share-link-dialog-Apq3cegw.js";import{t as T}from"./cn-0WouolD0.js";import{r as ee,t as E}from"./constants-DBtMsXdW.js";import{r as D}from"./tasks-DRmd6sWt.js";import{a as O,i as k,o as A}from"./capabilities-CrAs-oqU.js";import{t as j}from"./capabilities-DG0ckPuF.js";import{r as M}from"./attachment-utils-core-BIOUBrpT.js";import{a as te,n as ne,s as N,t as re}from"./file-preview-surface-D62ph0m0.js";import{n as P}from"./interaction-BdhHBbYa.js";import{n as ie}from"./electron-env-DHOGevH3.js";import{i as F}from"./skill-wire-pattern-BPpeIcCi.js";async function I(e){return D.parse(await s(a(`/api/tasks`),{method:`POST`,body:JSON.stringify(e)}))}async function L(e){return j(`xopc.tasks.get`,{id:e})}async function R(e){return s(a(`/api/tasks/${encodeURIComponent(e)}/conversation`),{method:`POST`})}async function z(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}`),{method:`PATCH`,body:JSON.stringify({...t,expectedVersion:n})}),L(e)}async function ae(e){await s(a(`/api/tasks/${encodeURIComponent(e)}`),{method:`DELETE`})}async function B(e,t,n,r=crypto.randomUUID(),i=`api`){return await s(a(`/api/tasks/${encodeURIComponent(e)}/commands`),{method:`POST`,body:JSON.stringify({idempotencyKey:r,expectedVersion:n,command:t,source:i})}),L(e)}async function V(e,t,n,r,i){return await s(a(`/api/tasks/${encodeURIComponent(e)}/criteria/${t}/review`),{method:`PUT`,body:JSON.stringify({status:n,expectedVersion:r,contractVersion:i})}),L(e)}async function H(e,t,n){return await s(a(`/api/task-runs/${encodeURIComponent(t)}/cancel`),{method:`POST`,body:JSON.stringify({expectedVersion:n,reason:`Cancelled by user`})}),L(e)}async function U(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}/handoff`),{method:`POST`,body:JSON.stringify({toAgentId:t,expectedVersion:n,idempotencyKey:crypto.randomUUID()})}),L(e)}async function W(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}/dependencies`),{method:`PUT`,body:JSON.stringify({dependsOnTaskIds:t,expectedVersion:n})}),L(e)}async function G(e,t,n){return await s(a(`/api/tasks/${encodeURIComponent(e)}/board-position`),{method:`PUT`,body:JSON.stringify({beforeTaskId:t,expectedVersion:n})}),L(e)}async function K(e,t,n){await s(a(`/api/task-runs/${encodeURIComponent(e)}/feedback`),{method:`POST`,headers:{"idempotency-key":crypto.randomUUID()},body:JSON.stringify({rating:t,reason:n?.trim()||void 0})})}function q(e,t=!1){let n=new URLSearchParams;return e&&n.set(`locale`,e),t&&n.set(`attention`,`all`),s(a(`/api/home${n.size?`?${n.toString()}`:``}`)).then(A)}function J(e){return s(a(`/api/home/advisor/refresh`),{method:`POST`,body:JSON.stringify({idempotencyKey:crypto.randomUUID(),locale:e})})}function Y(){return s(a(`/api/home/advisor/history`)).then(e=>O.parse(e))}async function X(e,t){return k.parse(await s(a(`/api/home/opportunities/${encodeURIComponent(e.id)}/action`),{method:`POST`,body:JSON.stringify({idempotencyKey:crypto.randomUUID(),expectedRevision:e.revision,mode:t})}))}function Z(e,t){let n=crypto.randomUUID();return s(a(`/api/home/opportunities/${encodeURIComponent(e.id)}/feedback`),{method:`POST`,body:JSON.stringify({...t,idempotencyKey:n,expectedRevision:e.revision})}).then(()=>({ok:!0,idempotencyKey:n}))}function oe(e,t){return s(a(`/api/home/opportunities/${encodeURIComponent(e)}/feedback/undo`),{method:`POST`,body:JSON.stringify({idempotencyKey:t})})}function se(e,t){return s(a(`/api/home/decisions/respond`),{method:`POST`,body:JSON.stringify({...e,decision:t})})}function ce(e){return s(a(`/api/home/attention/acknowledge`),{method:`POST`,body:JSON.stringify(e)})}function le(e){return s(a(`/api/home/attention/retry`),{method:`POST`,body:JSON.stringify(e)})}function ue(e,t){let n=e.trim(),r=t.trim();return n&&F(n)?`/skill:${n}${r?` ${r}`:` `}`:r||null}function de(e,t,n){let r=e.trim(),i=t?.trim()??``;if(!r&&!i)return null;let a=new URLSearchParams;return r&&a.set(`draft`,r),a.set(`autoSend`,`1`),i&&a.set(`attachmentsHandoff`,i),n?.projectScope===`none`&&a.set(`projectScope`,`none`),`/chat/new?${a.toString()}`}function fe(e){let t=e.startsWith(`?`)?e.slice(1):e;if(!t)return``;let n=new URLSearchParams(t),r=new URLSearchParams,i=n.get(`skill`),a=n.get(`slash`),o=n.get(`draft`),s=n.get(`autoSend`),c=n.get(`attachmentHandoff`),l=n.get(`attachmentsHandoff`),u=n.get(`agentSetup`);i&&r.set(`skill`,i),a&&r.set(`slash`,a),o&&r.set(`draft`,o),s===`1`&&r.set(`autoSend`,`1`),c&&r.set(`attachmentHandoff`,c),l&&r.set(`attachmentsHandoff`,l),n.get(`setup`)===`automation`&&r.set(`setup`,`automation`),u===`1`&&r.set(`agentSetup`,`1`),n.get(`scene`)===`find-skills`&&r.set(`scene`,`find-skills`);let d=r.toString();return d?`?${d}`:``}function pe(e){let t=e.startsWith(`?`)?e.slice(1):e,n=new URLSearchParams(t),r=n.get(`projectId`)?.trim();return r?{kind:`project`,projectId:r}:n.get(`projectScope`)===`none`?{kind:`none`}:{kind:`remember-last`}}function me(e){let t=e?.trim();return t?`/chat/new?projectId=${encodeURIComponent(t)}`:`/chat/new?projectScope=none`}var he=n(),Q=e(t(),1),$=r();function ge(e){let t=(0,he.c)(6),n=v(),r,i;if(t[0]!==n||t[1]!==e?(r=()=>{!n||e.embedded||!e.open||!e.attachment||(N.getState().openFile({attachment:e.attachment,images:e.images,conversationId:e.conversationId||void 0,resultRevision:e.resultRevision},n),e.onClose())},i=[n,e],t[0]=n,t[1]=e,t[2]=r,t[3]=i):(r=t[2],i=t[3]),(0,Q.useEffect)(r,i),n&&!e.embedded)return null;let a;return t[4]===e?a=t[5]:(a=(0,$.jsx)(_e,{...e}),t[4]=e,t[5]=a),a}function _e({open:e,embedded:t=!1,tabId:n,attachment:r,images:i=[],resultRevision:a,onAttachmentChange:s,authToken:h,conversationId:g,layerClassName:_=`z-[81]`,onClose:v}){let C=o(e=>e.language),E=c(C).chat,D=y({open:e,attachment:r,authToken:h,conversationId:g,language:C}),O=te(),{expanded:k,setExpanded:A}=x(e,O.dialogOpen),[j,M]=(0,Q.useState)(!1),{preview:N,fileType:F,hasExtractedText:I}=D,L=r?i.findIndex(e=>e===r||e.id&&e.id===r.id||e.uri&&e.uri===r.uri||!e.id&&!e.uri&&e.name===r.name&&!!e.data&&e.data===r.data):-1,R=F===`image`&&i.length>1&&L>=0&&!!s,z=e=>{if(!R||O.dialogOpen)return;let t=L+(e===`previous`?-1:1);t>=0&&t<i.length&&s?.(i[t])},ae=F!==`image`&&F!==`text`&&F!==`pptx`&&I,B=N?.uri?ee(N.uri):null,V=!!(B||N?.uri?.startsWith(`media://`)&&(g||N.taskId)),H=()=>{!N?.uri||!V||O.createShareLink(B?{fileId:B,fileName:N.name}:{uri:N.uri,conversationId:g??void 0,taskId:N.taskId,fileName:N.name})},U=!!(N&&!D.loading&&!D.loadError),W=()=>{A(!1),v()},G=()=>{if(!N||!D.downloadBuffer)return;let e=new Blob([D.downloadBuffer],{type:D.descriptor.mimeType}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=N.name??`download`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},K=!!D.downloadBuffer,q=ie()&&F===`spreadsheet`&&/\.xlsx?$/i.test(D.fileName)&&!!D.downloadBuffer&&!!window.electronAPI?.shell?.openTemporaryFile,J=async()=>{let e=D.downloadBuffer,t=window.electronAPI?.shell?.openTemporaryFile;if(!(!e||!t||j)){M(!0);try{(await t({fileName:D.fileName,data:new Uint8Array(e)})).ok||S(`warning`,E.attachmentPreviewOpenLocalFailed)}catch{S(`warning`,E.attachmentPreviewOpenLocalFailed)}finally{M(!1)}}},Y={onDownload:G,canDownload:K},X=T(`min-h-0 min-w-0 flex-1 cursor-pointer border-0 p-0`,`bg-surface-base transition-colors`,`hover:bg-surface-hover/90 dark:bg-black/60 dark:hover:bg-black/70`,P.focusRingBase),Z=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(b,{header:{expanded:k,onToggleExpanded:U?()=>A(e=>!e):void 0,hideClose:t,onClose:W,share:V?{onClick:H,loading:O.loading}:void 0,openWithSystemApp:q?{onClick:()=>void J(),loading:j}:void 0,textView:ae?{active:D.showExtractedText,onChange:e=>{D.setShowExtractedText(e),D.clearLoadError()}}:void 0},chat:D.downloadBuffer?{conversationId:g,createFile:async()=>new File([D.downloadBuffer],D.fileName,{type:D.descriptor.mimeType})}:void 0,onImageSwipe:R?z:void 0,language:C,descriptor:n?{...D.descriptor,id:n}:D.descriptor,loading:D.loading,loadError:D.loadError,textContent:D.textContent,binaryBuffer:D.binaryBuffer,showExtractedText:D.showExtractedText,extractedText:D.extractedText,extractedTextTruncated:D.extractedTextTruncated,actions:Y}),a?(0,$.jsxs)(`p`,{className:`shrink-0 border-t border-edge px-4 py-2 text-xs text-fg-muted`,"data-result-revision":!0,children:[C===`zh`?`成果版本`:`Result version`,` `,a]}):null,R?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-center gap-4 border-t border-edge bg-surface-panel px-3 py-2`,children:[(0,$.jsx)(`button`,{type:`button`,"aria-label":E.attachmentPreviewPreviousImage,disabled:L===0,onClick:()=>z(`previous`),className:T(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,P.focusRingBase),children:(0,$.jsx)(p,{size:20,"aria-hidden":`true`})}),(0,$.jsxs)(`span`,{role:`status`,className:`min-w-16 text-center text-sm tabular-nums text-fg-muted`,children:[L+1,` / `,i.length]}),(0,$.jsx)(`button`,{type:`button`,"aria-label":E.attachmentPreviewNextImage,disabled:L===i.length-1,onClick:()=>z(`next`),className:T(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,P.focusRingBase),children:(0,$.jsx)(m,{size:20,"aria-hidden":`true`})})]}):null]});return t?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(re,{expanded:k,children:Z}),(0,$.jsx)(w,{open:O.dialogOpen,onOpenChange:O.handleOpenChange,loading:O.loading,error:O.error,result:O.result,pendingParams:O.pendingParams,onConfirm:e=>void O.confirmShareLink(e)})]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(f,{open:e,onOpenChange:e=>!e&&W(),children:(0,$.jsx)(l,{children:(0,$.jsxs)(u,{"aria-describedby":void 0,onKeyDown:e=>{!R||O.dialogOpen||e.altKey||e.ctrlKey||e.metaKey||e.target.closest(`input, textarea, select, [contenteditable="true"]`)||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),z(e.key===`ArrowLeft`?`previous`:`next`))},className:T(`xopc-dialog-content-fullscreen fixed inset-0 flex h-[100dvh] w-full flex-row overflow-hidden`,ne(),_,`border-0 bg-transparent p-0 shadow-none outline-none`),children:[(0,$.jsx)(d,{className:`sr-only`,children:N?.name??``}),(0,$.jsx)(`button`,{type:`button`,className:X,onClick:W,"aria-label":E.attachmentPreviewClose}),(0,$.jsx)(`div`,{className:T(`flex h-full min-h-0 shrink-0 flex-col overflow-hidden`,k?`w-full`:`w-[min(100%,var(--max-width-app-main))]`,`bg-surface-panel sm:border-x sm:border-edge dark:sm:border-edge`,`shadow-float dark:shadow-elevated`),children:Z}),(0,$.jsx)(`button`,{type:`button`,className:X,onClick:W,"aria-label":E.attachmentPreviewClose})]})})}),(0,$.jsx)(w,{open:O.dialogOpen,onOpenChange:O.handleOpenChange,loading:O.loading,error:O.error,result:O.result,pendingParams:O.pendingParams,onConfirm:e=>void O.confirmShareLink(e)})]})}function ve(e){let t=(0,he.c)(23),{attachments:n,conversationId:r,topPadded:i,onRemove:a,className:s}=e,l=o(ye),u;t[0]===l?u=t[1]:(u=c(l),t[0]=l,t[1]=u);let d=u.chat,[f,p]=(0,Q.useState)(null);if(n.length===0)return null;let m=i?`pt-2`:`pt-3`,_;t[2]!==s||t[3]!==m?(_=T(`flex flex-wrap gap-2 border-b border-edge-subtle/90 bg-surface-hover/20 px-4 pb-2 dark:border-edge-subtle`,m,s),t[2]=s,t[3]=m,t[4]=_):_=t[4];let v;if(t[5]!==n||t[6]!==d||t[7]!==a){let e;t[9]!==d||t[10]!==a?(e=(e,t)=>{let n=e.type===`pasted_text`?d.pastedText:e.name;return(0,$.jsxs)(`div`,{className:`flex max-w-[200px] items-center rounded-lg bg-surface-hover text-xs dark:bg-surface-hover/80`,children:[(0,$.jsxs)(`button`,{type:`button`,className:T(`flex min-w-0 flex-1 items-center gap-1.5 rounded-l-lg py-1 pl-2 pr-1 text-left hover:bg-surface-active`,P.transition,P.press,P.focusRingPanel),onClick:()=>p(e),"aria-label":`${d.attachmentPreviewOpen}: ${n}`,title:`${d.attachmentPreviewOpen}: ${n}`,children:[e.mimeType?.startsWith(`image/`)&&e.content?(0,$.jsx)(`img`,{src:`data:${e.mimeType};base64,${e.content}`,alt:``,className:`size-6 shrink-0 rounded object-cover`}):e.type===`voice`||e.mimeType?.startsWith(`audio/`)?(0,$.jsx)(C,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):e.type===`pasted_text`?(0,$.jsx)(h,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):(0,$.jsx)(g,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),(0,$.jsx)(`span`,{className:`shrink-0 text-fg-disabled`,children:M(e.size)})]}),(0,$.jsx)(`button`,{type:`button`,className:T(`flex min-h-8 min-w-8 items-center justify-center rounded-r-lg text-fg-muted hover:bg-surface-active hover:text-fg`,P.transition,P.press,P.focusRingPanel),onClick:()=>a(t),"aria-label":`${d.attachmentPreviewRemove}: ${n}`,title:`${d.attachmentPreviewRemove}: ${n}`,children:(0,$.jsx)(`span`,{"aria-hidden":!0,children:`×`})})]},e.id??`${e.name}-${e.size}-${e.mimeType}-${e.content?.slice(0,16)??``}`)},t[9]=d,t[10]=a,t[11]=e):e=t[11],v=n.map(e),t[5]=n,t[6]=d,t[7]=a,t[8]=v}else v=t[8];let y;t[12]!==_||t[13]!==v?(y=(0,$.jsx)(`div`,{className:_,children:v}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let b=f!==null,x;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>p(null),t[15]=x):x=t[15];let S;t[16]!==r||t[17]!==f||t[18]!==b?(S=(0,$.jsx)(ge,{open:b,attachment:f,conversationId:r,onClose:x}),t[16]=r,t[17]=f,t[18]=b,t[19]=S):S=t[19];let w;return t[20]!==y||t[21]!==S?(w=(0,$.jsxs)($.Fragment,{children:[y,S]}),t[20]=y,t[21]=S,t[22]=w):w=t[22],w}function ye(e){return e.language}function be(e){let{chat:t,initialAttachments:n=[],onAttachmentsChange:r}=e,[a,o]=(0,Q.useState)(n),[s,c]=(0,Q.useState)(!1),l=(0,Q.useRef)(null),u=(0,Q.useRef)(a),d=(0,Q.useRef)(r);u.current=a,d.current=r;let f=(0,Q.useCallback)(e=>{let t=typeof e==`function`?e(u.current):e;u.current=t,o(t),d.current?.(t)},[]),p=(0,Q.useCallback)(()=>{f([])},[]),m=(0,Q.useCallback)(e=>{f(t=>t.filter((t,n)=>n!==e))},[]),h=(0,Q.useCallback)(()=>u.current.map(e=>({type:e.type===`voice`?`voice`:e.type||`file`,mimeType:e.mimeType,data:e.content,name:e.name,size:e.size,...e.uri?{uri:e.uri}:{},...typeof e.durationSeconds==`number`&&Number.isFinite(e.durationSeconds)&&e.durationSeconds>0?{durationSeconds:e.durationSeconds}:{}})),[]),g=(0,Q.useCallback)(async(e,n)=>{if(e.length===0)return;let r=10-u.current.length;if(r<=0){S(`warning`,t.maxAttachmentsReached,{max:10});return}let a=e.slice(0,r);e.length>a.length&&S(`warning`,t.maxAttachmentsTruncated,{max:10,dropped:e.length-a.length});let{loadAttachment:o}=await i(async()=>{let{loadAttachment:e}=await import(`./attachment-load-DrVGNxJm.js`).then(e=>e.t);return{loadAttachment:e}},__vite__mapDeps([0,1,2])),s=(await Promise.all(a.map(async e=>{if(e.size>33554432)return S(`warning`,t.attachmentFileTooLarge,{name:e.name,maxSize:M(E)}),null;try{return await o(e,e.name)}catch{return S(`error`,t.attachmentLoadFailed,{name:e.name}),null}}))).filter(e=>e!==null).map(e=>n?{...e,type:n}:e);f(e=>[...e,...s])},[t.attachmentFileTooLarge,t.attachmentLoadFailed,t.maxAttachmentsReached,t.maxAttachmentsTruncated]),v=(0,Q.useCallback)(e=>g(e),[g]);return(0,Q.useEffect)(()=>{if(e.conversationId)return _(e.conversationId,async e=>{let t=u.current.length;return await g([e]),u.current.length>t})},[g,e.conversationId]),{attachments:a,setAttachments:f,attachmentsRef:u,isDragging:s,setIsDragging:c,fileInputRef:l,processFiles:v,processPastedText:(0,Q.useCallback)(e=>g([new File([e.text],e.name,{type:e.mimeType})],`pasted_text`),[g]),removeAttachment:m,clearAttachments:p,wireAttachmentsPayload:h}}export{V as C,z as D,oe as E,G as O,le as S,K as T,Y as _,de as a,J as b,fe as c,H as d,B as f,q as g,R as h,ue as i,W as k,ce as l,ae as m,ve as n,me as o,I as p,ge as r,pe as s,be as t,X as u,L as v,Z as w,se as x,U as y};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/attachment-process-heavy-DGZZ-M85.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-Czpn1I53.js","assets/pdf-runtime-JnUAvfIa.js","assets/source-workspace-editor-kxosllTu.js","assets/vendor-react-BOUWij0V.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/languages-zXtNocoy.js","assets/binary-plugins-CFJCUpWH.js","assets/messages-DYDySzn1.js","assets/attachment-utils-core-BIOUBrpT.js","assets/preview-open-alternatives-CY_hjK4b.js","assets/download-Dk-ZjtO6.js","assets/createLucideIcon-DPHK1VkS.js","assets/external-link-DjqjBmc3.js","assets/cn-0WouolD0.js","assets/bundle-mjs-rHxsej31.js","assets/interaction-BdhHBbYa.js","assets/electron-env-DHOGevH3.js","assets/use-blob-object-url-D4BFuzZB.js","assets/media-plugins-DcN8Y0hJ.js","assets/archive-plugin-CPCI6nqQ.js","assets/jszip.min-Dj17eJqX.js"])))=>i.map(i=>d[i]);
2
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{t as i}from"./preload-helper-Czpn1I53.js";import{u as a}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{a as o,i as s,l as c,n as l}from"./locale-store-DGtk-KSF.js";import{t as u}from"./messages-DYDySzn1.js";import{t as d}from"./createLucideIcon-DPHK1VkS.js";import{t as f}from"./app-window-DXFNqt_0.js";import{t as p}from"./check-DUBLcKHA.js";import{t as m}from"./chevron-down-ccbiQQz_.js";import{t as h}from"./copy-Dv6d4Dvw.js";import{t as g}from"./download-Dk-ZjtO6.js";import{t as _}from"./ellipsis-0k4rZLoy.js";import{t as v}from"./external-link-DjqjBmc3.js";import{t as y}from"./eye-CABVeTq0.js";import{t as b}from"./folder-open-CyzJ19I9.js";import{t as x}from"./link-2-D_ZKYUW7.js";import{t as S}from"./loader-circle-CifKLtgG.js";import{G as C,K as w,t as T}from"./markdown-view-JXJ3e1CB.js";import{t as ee}from"./message-square-plus-XP0tGdlV.js";import{t as te}from"./minimize-2-DtOGrlpo.js";import{t as E}from"./paperclip-f1HujQY1.js";import{t as ne}from"./pencil-DmIY3Oa-.js";import{t as D}from"./plus-Q2yW6OE7.js";import{t as O}from"./refresh-cw-BRlGaq2w.js";import{t as k}from"./rotate-cw-LIg3Am9S.js";import{t as re}from"./save-DRDABU--.js";import{t as A}from"./search-DA7gz22f.js";import{t as ie}from"./x-B_N4OPjy.js";import{t as j}from"./cn-0WouolD0.js";import{t as M}from"./skeleton-BI5TyibZ.js";import{r as N,t as P}from"./constants-DBtMsXdW.js";import{a as ae}from"./session-api-CpZ24vrQ.js";import{a as oe,i as F,n as I,r as L,s as se,t as R}from"./attachment-utils-core-BIOUBrpT.js";import{n as ce}from"./interaction-BdhHBbYa.js";import{t as z}from"./activity-store-t5c6XavH.js";import{r as le}from"./app-chrome-BeB4KgOf.js";import{n as ue}from"./electron-env-DHOGevH3.js";import{t as de}from"./use-async-resource-BHFGZCY2.js";import{t as fe}from"./sliding-tab-list-DuQyViqe.js";import{t as pe}from"./index.module-Cd9ENXfk.js";import{a as me,c as B,d as he,m as V,n as H,r as ge,u as _e}from"./workspace-api-BKbezgv-.js";import{a as ve,l as ye,m as be,n as xe,o as U,r as Se,t as Ce,u as we}from"./dist-ZrL34Ps4.js";var Te=d(`folders`,[[`path`,{d:`M20 5a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H9a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h2.5a1.5 1.5 0 0 1 1.2.6l.6.8a1.5 1.5 0 0 0 1.2.6z`,key:`a4852j`}],[`path`,{d:`M3 8.268a2 2 0 0 0-1 1.738V19a2 2 0 0 0 2 2h11a2 2 0 0 0 1.732-1`,key:`yxbcw3`}]]),Ee=d(`step-forward`,[[`path`,{d:`M10.029 4.285A2 2 0 0 0 7 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z`,key:`1ystz2`}],[`path`,{d:`M3 4v16`,key:`1ph11n`}]]),De=d(`step-back`,[[`path`,{d:`M13.971 4.285A2 2 0 0 1 17 6v12a2 2 0 0 1-3.029 1.715l-9.997-5.998a2 2 0 0 1-.003-3.432z`,key:`19qhus`}],[`path`,{d:`M21 20V4`,key:`cb8qj8`}]]),Oe=d(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),W=e(t(),1),G=n();function K(e,t,n,r){let i=n?t.replace(/\{\{(\w+)\}\}/g,(e,t)=>String(n[t]??``)):t;z({tone:e,title:i,href:r?.href,dedupeKey:`action-feedback:${e}:${i}`})}var q=(0,W.createContext)(null);function ke(){return(0,W.useContext)(q)}var Ae=(0,W.createContext)([]),je=(0,W.createContext)(null),Me=5*1024*1024,Ne=32*1024*1024,Pe=new Set(`.astro,.bat,.c,.cc,.clj,.cljs,.cljc,.cmd,.cpp,.cs,.cts,.cxx,.dart,.edn,.erl,.ex,.exs,.fish,.fs,.fsx,.go,.gql,.graphql,.groovy,.h,.hh,.hpp,.hrl,.hxx,.java,.ts,.tsx,.mts,.js,.jsx,.mjs,.cjs,.css,.scss,.sass,.less,.json,.jsonc,.json5,.yml,.yaml,.xml,.xsd,.xsl,.py,.pyw,.rb,.php,.rs,.kt,.kts,.scala,.swift,.m,.mm,.sh,.bash,.zsh,.ps1,.sql,.lua,.r,.pl,.pm,.sol,.tf,.tfvars,.nix,.proto,.vue,.svelte,.toml,.ini,.cfg,.conf,.properties`.split(`,`)),Fe=new Set([`.txt`,`.log`,`.lock`,`.csv`,`.tsv`,`.env`,`.gitignore`,`.gitattributes`,`.editorconfig`,`.npmrc`,`.dockerignore`,`.eslintignore`,`.prettierignore`,`.stylelintignore`]),Ie=new Set([`dockerfile`,`gemfile`,`jenkinsfile`,`makefile`,`procfile`,`rakefile`]),Le=new Set([`brewfile`,`changelog`,`codeowners`,`license`,`readme`]),Re=new Set([`.png`,`.jpg`,`.jpeg`,`.gif`,`.webp`,`.bmp`,`.ico`,`.svg`,`.svgz`,`.tif`,`.tiff`,`.avif`,`.heic`,`.heif`,`.jxl`]),ze=new Set([`.mp3`,`.wav`,`.ogg`,`.oga`,`.aac`,`.m4a`,`.flac`,`.opus`,`.weba`]),Be=new Set([`.mp4`,`.webm`,`.mov`,`.m4v`,`.ogv`]),Ve=new Set([`.zip`]),He=new Map([[`.pdf`,`application/pdf`],[`.docx`,`application/vnd.openxmlformats-officedocument.wordprocessingml.document`],[`.pptx`,`application/vnd.openxmlformats-officedocument.presentationml.presentation`],[`.xlsx`,`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`],[`.xls`,`application/vnd.ms-excel`],[`.md`,`text/markdown`],[`.markdown`,`text/markdown`],[`.html`,`text/html`],[`.htm`,`text/html`],[`.json`,`application/json`],[`.txt`,`text/plain`],[`.csv`,`text/csv`],[`.tsv`,`text/tab-separated-values`],[`.png`,`image/png`],[`.jpg`,`image/jpeg`],[`.jpeg`,`image/jpeg`],[`.gif`,`image/gif`],[`.webp`,`image/webp`],[`.svg`,`image/svg+xml`],[`.svgz`,`image/svg+xml`],[`.mp3`,`audio/mpeg`],[`.wav`,`audio/wav`],[`.ogg`,`audio/ogg`],[`.mp4`,`video/mp4`],[`.webm`,`video/webm`],[`.mov`,`video/quicktime`],[`.zip`,`application/zip`]]);function Ue(e){let t=J(e),n=t.lastIndexOf(`.`);return n<0||n===t.length-1?``:t.slice(n).toLowerCase()}function J(e){let t=e.replace(/\\/g,`/`).split(`/`);return t[t.length-1]||e}function Y(e,t){let n=t?.split(`;`)[0]?.trim().toLowerCase();return n&&n!==`application/octet-stream`?n:He.get(Ue(e))??n??`application/octet-stream`}function X(e,t){let n=Ue(e),r=J(e).toLowerCase(),i=Y(e,t);return i===`text/markdown`||n===`.md`||n===`.markdown`?`markdown`:i===`text/html`||n===`.html`||n===`.htm`?`html`:i===`application/pdf`||n===`.pdf`?`pdf`:i===`application/vnd.openxmlformats-officedocument.wordprocessingml.document`||n===`.docx`?`docx`:i===`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet`||i===`application/vnd.ms-excel`||n===`.xlsx`||n===`.xls`?`spreadsheet`:i===`application/vnd.openxmlformats-officedocument.presentationml.presentation`||n===`.pptx`?`pptx`:i.startsWith(`image/`)||Re.has(n)?`image`:i.startsWith(`audio/`)||ze.has(n)?`audio`:i.startsWith(`video/`)||Be.has(n)?`video`:i===`application/zip`||Ve.has(n)?`archive`:Pe.has(n)||Ie.has(r)||r.startsWith(`dockerfile.`)?`code`:i.startsWith(`text/`)||Fe.has(n)||Le.has(r)||r.startsWith(`.env.`)||i===`application/json`?`text`:`unsupported`}function We(e){switch(e){case`text`:case`markdown`:case`code`:case`html`:return`text`;case`unsupported`:return`metadata`;default:return`binary`}}async function Ge(e){let{uri:t,conversationId:n,taskId:r}=e;try{let e=N(t),i=await o(s(e?`/api/files/${encodeURIComponent(e)}/content`:se(t,n,r)));return i.ok?{ok:!0,blob:await i.blob()}:{ok:!1,reason:`http`,status:i.status}}catch(e){return{ok:!1,reason:`network`,message:e instanceof Error?e.message:String(e)}}}async function Ke(e){let t=await Ge(e);return t.ok?{ok:!0,buffer:await t.blob.arrayBuffer()}:t}function qe(e){return e.id?String(e.id):`${e.name}:${e.uri??``}`}function Je(){return{id:`__empty__`,context:`attachment`,fileName:``,mimeType:`application/octet-stream`,type:`unsupported`,source:{kind:`inline`}}}function Ye(e){let t=(0,G.c)(65),{open:n,attachment:r,authToken:i,conversationId:a,language:o}=e,[s,c]=(0,W.useState)(n?r:null),[l,d]=(0,W.useState)(!1),[f,p]=(0,W.useState)(!1),m;t[0]!==r||t[1]!==n?(m=n&&r?qe(r):null,t[0]=r,t[1]=n,t[2]=m):m=t[2];let h=m,g=(0,W.useRef)(h);h!==g.current&&(g.current=h,c(n&&r?r:null),d(!1),p(!1));let _=s,v;bb0:{if(!_){let e;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(e=Je(),t[3]=e):e=t[3],v=e;break bb0}let e=_.name??`attachment`,n,r;t[4]!==e||t[5]!==_.mimeType?(n=Y(e,_.mimeType),r=X(e,n),t[4]=e,t[5]=_.mimeType,t[6]=n,t[7]=r):(n=t[6],r=t[7]);let i=r,o=_.id?String(_.id):`${e}:${_.uri??``}`,s;t[8]!==a||t[9]!==_.uri?(s=_.uri?{kind:`media-uri`,uri:_.uri,conversationId:a}:{kind:`inline`},t[8]=a,t[9]=_.uri,t[10]=s):s=t[10];let c;t[11]!==e||t[12]!==n||t[13]!==_.size||t[14]!==o||t[15]!==s||t[16]!==i?(c={id:o,context:`attachment`,fileName:e,mimeType:n,size:_.size,type:i,source:s},t[11]=e,t[12]=n,t[13]=_.size,t[14]=o,t[15]=s,t[16]=i,t[17]=c):c=t[17],v=c}let y=v,b;t[18]===_?b=t[19]:(b=_?F(_):void 0,t[18]=_,t[19]=b);let x=b,S=_?.uri,C;t[20]===y.type?C=t[21]:(C=We(y.type),t[20]=y.type,t[21]=C);let w=C,T=!!(n&&S&&!x&&i&&(w===`binary`||w===`text`)),ee;t[22]!==a||t[23]!==o||t[24]!==S||t[25]!==_?.taskId?(ee=async()=>{let e=u(o).chat,t=await Ke({uri:S,conversationId:a,taskId:_?.taskId});if(!t.ok)throw t.reason===`http`?Error(`${e.attachmentPreviewLoadError} (HTTP ${t.status})`):Error(t.message);return t.buffer},t[22]=a,t[23]=o,t[24]=S,t[25]=_?.taskId,t[26]=ee):ee=t[26];let te=_?.taskId,E;t[27]!==i||t[28]!==a||t[29]!==x||t[30]!==o||t[31]!==S||t[32]!==n||t[33]!==w||t[34]!==te?(E=[n,S,i,o,x,te,a,w],t[27]=i,t[28]=a,t[29]=x,t[30]=o,t[31]=S,t[32]=n,t[33]=w,t[34]=te,t[35]=E):E=t[35];let ne;t[36]===T?ne=t[37]:(ne={enabled:T,initial:null,errorData:null},t[36]=T,t[37]=ne);let D=de(ee,E,ne),O;bb1:{if(x)try{let e;t[38]===x?e=t[39]:(e=I(x),t[38]=x,t[39]=e),O=e;break bb1}catch{O=null;break bb1}if(T&&D.loading){O=null;break bb1}O=D.data??null}let k=O,re=w===`binary`?k:null,A=_?.extractedText??``,ie;t[40]!==k||t[41]!==A||t[42]!==o||t[43]!==w?(ie=w===`text`?A||(k?new TextDecoder(`utf-8`,{fatal:!1}).decode(new Uint8Array(k)):u(o).chat.attachmentPreviewNoText):null,t[40]=k,t[41]=A,t[42]=o,t[43]=w,t[44]=ie):ie=t[44];let j=ie,M=!!_?.extractedText,N=y.type===`pptx`&&A.length>3e5,P;t[45]!==i||t[46]!==x||t[47]!==o||t[48]!==S||t[49]!==n||t[50]!==w?(P=n&&S&&!x&&!i&&w===`binary`?u(o).chat.attachmentPreviewMissingAuth:null,t[45]=i,t[46]=x,t[47]=o,t[48]=S,t[49]=n,t[50]=w,t[51]=P):P=t[51];let ae=P,oe=D.error?D.error instanceof Error?D.error.message:String(D.error):null,L=f?null:ae??oe,se=T?D.loading:!1,R;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>p(!0),t[52]=R):R=t[52];let ce=A||null,z;return t[53]!==re||t[54]!==y||t[55]!==k||t[56]!==N||t[57]!==M||t[58]!==L||t[59]!==_||t[60]!==l||t[61]!==se||t[62]!==ce||t[63]!==j?(z={preview:_,descriptor:y,fileType:y.type,fileName:y.fileName,loading:se,loadError:L,clearLoadError:R,textContent:j,binaryBuffer:re,downloadBuffer:k,hasExtractedText:M,extractedText:ce,extractedTextTruncated:N,showExtractedText:l,setShowExtractedText:d},t[53]=re,t[54]=y,t[55]=k,t[56]=N,t[57]=M,t[58]=L,t[59]=_,t[60]=l,t[61]=se,t[62]=ce,t[63]=j,t[64]=z):z=t[64],z}function Xe(e){let t=(0,G.c)(12),{projectId:n,conversationId:r,agentId:i}=e,a;bb0:{let e;t[0]===n?e=t[1]:(e=n?.trim(),t[0]=n,t[1]=e);let o=e;if(o){let e;t[2]===o?e=t[3]:(e={projectId:o},t[2]=o,t[3]=e),a=e;break bb0}let s;t[4]===r?s=t[5]:(s=r?.trim(),t[4]=r,t[5]=s);let c=s;if(c){let e;t[6]===c?e=t[7]:(e={conversationId:c},t[6]=c,t[7]=e),a=e;break bb0}let l;t[8]===i?l=t[9]:(l=i?.trim(),t[8]=i,t[9]=l);let u=l,d;t[10]===u?d=t[11]:(d=u?{agentId:u}:void 0,t[10]=u,t[11]=d),a=d}return a}function Ze(e){return{descriptor:e,textContent:null,binaryBuffer:null,fileResourceId:null,mtimeMs:null,loadError:null,loading:!1,pptxText:null,pptxTruncated:!1,pptxError:null}}function Qe(e,t){switch(t.type){case`clear`:return Ze(t.descriptor);case`loadStart`:return{...Ze(t.descriptor),loading:!0};case`loadSuccess`:return{...e,descriptor:t.payload.descriptor,textContent:t.payload.textContent??null,binaryBuffer:t.payload.binaryBuffer??null,fileResourceId:t.payload.fileResourceId??null,mtimeMs:t.payload.mtimeMs??null,loadError:null,loading:!1};case`loadError`:return{...Ze(t.descriptor),loadError:t.error};case`patchMtime`:return{...e,mtimeMs:t.mtimeMs};case`patchText`:return{...e,textContent:t.text};case`pptxClear`:return{...e,pptxText:null,pptxTruncated:!1,pptxError:null};case`pptxSuccess`:return{...e,pptxText:t.text,pptxTruncated:t.truncated,pptxError:null};case`pptxError`:return{...e,pptxText:null,pptxTruncated:!1,pptxError:t.error}}}function $e(e,t){switch(t.type){case`reset`:return{sourceEditMode:!1,saveStatus:`idle`};case`source`:return{...e,sourceEditMode:typeof t.value==`function`?t.value(e.sourceEditMode):t.value};case`saveStatus`:return{...e,saveStatus:t.value}}}function et({filePath:e,projectId:t,conversationId:n,agentId:r,initialEditMode:a=!1}){let o=Xe({projectId:t,conversationId:n,agentId:r}),s=(0,W.useMemo)(()=>{let t=e?J(e):``,i=Y(t,oe(t)),a=e?X(t,i):`unsupported`;return{id:e||`__empty__`,context:`workspace`,fileName:t,mimeType:i,type:a,source:{kind:`workspace`,path:e||``,conversationId:n,agentId:r}}},[r,e,n]),[c,l]=(0,W.useReducer)(Qe,s,Ze),[u,d]=(0,W.useReducer)($e,{sourceEditMode:a,saveStatus:`idle`}),[f,p]=(0,W.useState)([]),[m,h]=(0,W.useState)([]),g=(0,W.useRef)(e),_=(0,W.useRef)(void 0),v=(0,W.useRef)(null),y=(0,W.useRef)(null),b=(0,W.useRef)(null),[x,S]=(0,W.useState)(!1),[C,w]=(0,W.useState)(!1),[T,ee]=(0,W.useState)(0);g.current!==e&&(g.current=e,d({type:`reset`})),(0,W.useEffect)(()=>{if(!e){l({type:`clear`,descriptor:s});return}let t=!1;l({type:`loadStart`,descriptor:s});let n=We(s.type),r=e=>{t||l({type:`loadError`,descriptor:s,error:e instanceof Error?e.message:String(e)})};return n===`metadata`?(Promise.all([he(e,o).catch(()=>null),_e(e,o).catch(()=>null)]).then(async([n,r])=>{if(!n){t||l({type:`loadSuccess`,payload:{descriptor:s,fileResourceId:r?.fileId??null,mtimeMs:typeof r?.mtimeMs==`number`?r.mtimeMs:null}});return}let i={...s,mimeType:n.mimeType,type:X(n.name,n.mimeType)};if(We(i.type)===`text`){let{content:r,mtimeMs:a,revision:s}=await B(e,o);t||(_.current=s,v.current=r,y.current=r,S(!1),w(!1)),t||l({type:`loadSuccess`,payload:{descriptor:i,textContent:r,fileResourceId:n.id,mtimeMs:typeof a==`number`?a:n.modifiedAt}});return}t||l({type:`loadSuccess`,payload:{descriptor:i,fileResourceId:n.id,mtimeMs:n.modifiedAt}})}).catch(r),()=>{t=!0}):(n===`text`?Promise.all([B(e,o),_e(e,o).catch(()=>null)]).then(([{content:e,mtimeMs:n,revision:r},i])=>{t||(_.current=r,v.current=e,y.current=e,S(!1),w(!1)),t||l({type:`loadSuccess`,payload:{descriptor:s,textContent:e,fileResourceId:i?.fileId??null,mtimeMs:typeof n==`number`?n:null}})}).catch(r):Promise.all([me(e,o),_e(e,o).catch(()=>null)]).then(async([e,n])=>{let r=await e.arrayBuffer();t||l({type:`loadSuccess`,payload:{descriptor:s,binaryBuffer:r,fileResourceId:n?.fileId??null,mtimeMs:typeof n?.mtimeMs==`number`?n.mtimeMs:null}})}).catch(r),()=>{t=!0})},[s,e,o,T]),(0,W.useEffect)(()=>{if(!c.binaryBuffer||c.descriptor.type!==`pptx`){l({type:`pptxClear`});return}let e=!1;return l({type:`pptxClear`}),i(()=>import(`./attachment-process-heavy-DGZZ-M85.js`).then(e=>e.processPptx(c.binaryBuffer,c.descriptor.fileName)),__vite__mapDeps([0,1,2,3])).then(({extractedText:t})=>{if(e)return;let n=t.length>R;l({type:`pptxSuccess`,text:n?t.slice(0,R):t,truncated:n})}).catch(t=>{e||l({type:`pptxError`,error:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},[c.binaryBuffer,c.descriptor.fileName,c.descriptor.type]);let te=(0,W.useCallback)(async()=>{if(b.current&&!await b.current)return!1;if(!e||v.current===null||v.current===y.current)return!0;let t=(async()=>{d({type:`saveStatus`,value:`saving`});try{for(;v.current!==y.current;){let t=v.current,n=await V(e,t,o,_.current);_.current=n.revision,y.current=t,typeof n.mtimeMs==`number`&&l({type:`patchMtime`,mtimeMs:n.mtimeMs})}return S(!1),d({type:`saveStatus`,value:`saved`}),!0}catch{return d({type:`saveStatus`,value:`error`}),!1}})();b.current=t;try{return await t}finally{b.current===t&&(b.current=null)}},[e,o]),E=pe(()=>void te(),500),ne=(0,W.useCallback)(e=>{v.current=e,S(e!==y.current),l({type:`patchText`,text:e}),E()},[E]);(0,W.useEffect)(()=>{let e=e=>{v.current!==y.current&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>{window.removeEventListener(`beforeunload`,e),E.cancel()}},[E]);let D=(0,W.useCallback)(()=>{!x&&!b.current&&ee(e=>e+1)},[x]),O=(0,W.useRef)(!1),k=(0,W.useCallback)(async()=>{if(!(!e||c.loading||b.current||O.current)){O.current=!0;try{let t=await he(e,o);if(!t||!(_.current?t.revision!==_.current:c.mtimeMs!=null&&t.modifiedAt!==c.mtimeMs))return;x||u.sourceEditMode?w(!0):D()}catch{w(!0)}finally{O.current=!1}}},[x,u.sourceEditMode,e,c.loading,c.mtimeMs,o,D]),re=(0,W.useCallback)(async()=>{if(!e)return;let t=J(e);if(c.binaryBuffer){H(t,c.binaryBuffer,c.descriptor.mimeType||`application/octet-stream`);return}if(c.textContent!=null){ge(t,c.textContent);return}let n=await me(e,o);H(t,await n.arrayBuffer(),c.descriptor.mimeType||n.type||`application/octet-stream`)},[e,c.binaryBuffer,c.descriptor.mimeType,c.textContent,o]),A=(0,W.useCallback)(async()=>{if(!e)throw Error(`No workspace file selected`);let t=J(e),n=c.descriptor.mimeType||`application/octet-stream`,r;return r=c.binaryBuffer?new Blob([c.binaryBuffer],{type:n}):c.textContent==null?await me(e,o):new Blob([c.textContent],{type:n}),new File([r],t,{type:c.descriptor.mimeType||r.type||`application/octet-stream`,lastModified:c.mtimeMs??Date.now()})},[e,c.binaryBuffer,c.descriptor.mimeType,c.mtimeMs,c.textContent,o]),ie=!c.loading&&!!e,j=ue()&&(!!c.fileResourceId&&!!window.electronAPI?.shell?.openFileResource||c.descriptor.type===`spreadsheet`&&!!c.binaryBuffer&&!!window.electronAPI?.shell?.openTemporaryFile),M=ue()&&!!c.fileResourceId&&!!window.electronAPI?.shell?.chooseAppAndOpenFileResource,N=(0,W.useCallback)(async()=>{let e=c.fileResourceId;if(!ue()||!e||!window.electronAPI?.shell?.getOpenWithAppsForFileResource){h([]),p([]);return}try{let t=await window.electronAPI.shell.getOpenWithAppsForFileResource(e);h(t.recommended.map(e=>({name:e.name,path:e.path,iconDataUrl:e.iconDataUrl}))),p(t.recent.map(e=>({name:e.name,path:e.path,iconDataUrl:e.iconDataUrl,lastUsedAt:e.lastUsedAt})))}catch{h([]),p([])}},[c.fileResourceId]);(0,W.useEffect)(()=>{N()},[N]);let P=(0,W.useCallback)(async()=>{let e=c.fileResourceId;if(e&&window.electronAPI?.shell?.openFileResource)return window.electronAPI.shell.openFileResource(e);if(c.descriptor.type===`spreadsheet`&&c.binaryBuffer&&window.electronAPI?.shell?.openTemporaryFile)return window.electronAPI.shell.openTemporaryFile({fileName:c.descriptor.fileName,data:new Uint8Array(c.binaryBuffer)})},[c.binaryBuffer,c.descriptor.fileName,c.descriptor.type,c.fileResourceId]),ae=(0,W.useCallback)(async()=>{let e=c.fileResourceId;if(!e||!window.electronAPI?.shell?.chooseAppAndOpenFileResource)return;let t=await window.electronAPI.shell.chooseAppAndOpenFileResource(e);return t.ok&&N(),t},[c.fileResourceId,N]),F=(0,W.useCallback)(async e=>{let t=c.fileResourceId;if(!t||!e||!window.electronAPI?.shell?.openFileResourceWithApp)return;let n=await window.electronAPI.shell.openFileResourceWithApp(t,e);return n.ok&&N(),n},[c.fileResourceId,N]),I=ue()&&!!c.fileResourceId&&!!window.electronAPI?.shell?.showFileResourceInFolder,L=(0,W.useCallback)(async()=>{let e=c.fileResourceId;if(e&&window.electronAPI?.shell?.showFileResourceInFolder)return window.electronAPI.shell.showFileResourceInFolder(e)},[c.fileResourceId]);return{...c,dirty:x,externalChange:C,flushSource:te,refresh:D,checkForUpdates:k,extractedText:c.descriptor.type===`pptx`?c.pptxText:null,extractedTextTruncated:c.pptxTruncated,sourceEditMode:u.sourceEditMode,setSourceEditMode:e=>d({type:`source`,value:e}),saveStatus:u.saveStatus,onSourceChange:ne,onDownload:re,createAttachmentFile:A,canDownload:ie,canOpenWithSystemApp:j,onOpenWithSystemApp:P,canChooseOpenWithApp:M,onChooseOpenWithApp:ae,recommendedOpenWithApps:m,recentOpenWithApps:f,onOpenWithRecentApp:F,canRevealInFolder:I,onRevealInFolder:L}}var tt=new Map;function nt(e){return tt.get(e)??{zoom:1,rotation:0,page:1,pageCount:null,searchQuery:``,scroll:[]}}function rt(e,t){let n={...nt(e),...t};for(tt.delete(e),tt.set(e,n);tt.size>100;)tt.delete(tt.keys().next().value)}c.subscribe((e,t)=>{(e.baseUrl!==t.baseUrl||e.conversationId!==t.conversationId)&&tt.clear()});var it=new Map;function at(e,t){return it.set(e,t),()=>{it.get(e)===t&&it.delete(e)}}async function ot(e,t){return await it.get(e)?.(t)??!1}var st=120*1e3,ct=new Map;function lt(){return typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function ut(e){for(let[t,n]of ct)n.expiresAt<=e&&ct.delete(t)}function dt(e,t=Date.now()){ut(t);let n=lt();return ct.set(n,{file:e,name:e.name,type:e.type,expiresAt:t+st}),n}function ft(e,t=Date.now()){let n=ct.get(e);return n?n.expiresAt<=t?(ct.delete(e),null):{name:n.name,type:n.type}:null}function pt(e,t=Date.now()){let n=ct.get(e);if(!n)return null;if(n.expiresAt<=t)return ct.delete(e),null;if(!n.file)return null;let r=n.file;return n.file=null,r}var Z=r();function mt(e){let t=(0,G.c)(3),{app:n}=e,[r,i]=(0,W.useState)(),a;return t[0]!==n||t[1]!==r?(a=n?.iconDataUrl&&n.iconDataUrl!==r?(0,Z.jsx)(`img`,{src:n.iconDataUrl,alt:``,width:20,height:20,className:`size-5 shrink-0 object-contain`,onError:()=>i(n.iconDataUrl)}):(0,Z.jsx)(f,{className:`size-5 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),t[0]=n,t[1]=r,t[2]=a):a=t[2],a}function ht({variant:e=`split`,onAction:t,systemApp:n,chooseApp:r,recommendedApps:i,recentApps:a,onOpenWithApp:o}){let s=l(e=>e.language),c=u(s).workspace,[d,h]=(0,W.useState)(),[g,_]=(0,W.useState)(!1),y=[...i,...a],b=o&&d!==null?y.find(e=>e.path===d?.path)??d??y[0]:void 0,x=!!(g||n?.loading||r?.loading),C=x||!!n?.disabled,w=b?s===`zh`?`用 ${b.name} 打开`:`Open with ${b.name}`:c.openSystemApp,T=`flex min-h-9 cursor-default items-center gap-2.5 rounded-md px-2.5 py-2 text-sm text-fg outline-none data-[highlighted]:bg-surface-hover data-[disabled]:pointer-events-none data-[disabled]:opacity-40`,ee=`my-1 h-px bg-edge-subtle`;if(!n&&!r&&(!o||!y.length))return null;if(e===`menu`){let e=e=>t?t(e):e(),s=`flex min-h-9 w-full items-center gap-2.5 rounded-md px-2.5 py-2 text-left text-sm text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-40`;return(0,Z.jsxs)(Z.Fragment,{children:[n?(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,className:s,disabled:C,onClick:()=>e(n.onClick),children:[(0,Z.jsx)(v,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:c.openSystemApp})]}):null,o?[{label:c.recommendedApps,apps:i},{label:c.recentApps,apps:a.filter(e=>!i.some(t=>t.path===e.path))}].map(t=>t.apps.length?(0,Z.jsxs)(`div`,{role:`group`,"aria-label":t.label,children:[(0,Z.jsx)(`div`,{className:`px-2.5 pb-1 pt-1.5 text-xs font-medium text-fg-muted`,children:t.label}),t.apps.map(t=>(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,className:s,disabled:C,onClick:()=>e(()=>o(t.path)),children:[(0,Z.jsx)(mt,{app:t}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t.name})]},t.path))]},t.label):null):null,r?(0,Z.jsxs)(`button`,{type:`button`,role:`menuitem`,className:s,disabled:C||r.disabled,onClick:()=>e(()=>{r.onClick()}),children:[(0,Z.jsx)(f,{className:`size-5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:c.chooseApp})]}):null,(0,Z.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`})]})}return(0,Z.jsxs)(`div`,{className:`inline-flex h-9 shrink-0 items-stretch rounded-full border border-edge-subtle bg-surface-panel`,children:[(0,Z.jsxs)(`button`,{type:`button`,"aria-label":w,title:w,disabled:C||!b&&!n,onClick:()=>b?o?.(b.path):n?.onClick(),className:j(`inline-flex min-w-0 items-center gap-2 rounded-l-full pl-3 pr-2 text-sm font-medium text-fg transition-colors hover:bg-surface-hover disabled:cursor-not-allowed disabled:opacity-40`,ce.focusRingPanel),children:[x?(0,Z.jsx)(S,{className:`size-5 animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(mt,{app:b}),(0,Z.jsx)(`span`,{children:s===`zh`?`打开`:`Open`})]}),(0,Z.jsxs)(ye,{modal:!1,children:[(0,Z.jsx)(be,{asChild:!0,children:(0,Z.jsx)(`button`,{type:`button`,"aria-label":c.chooseApp,title:c.chooseApp,disabled:C,className:j(`inline-flex w-8 shrink-0 items-center justify-center rounded-r-full text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-40`,ce.focusRingPanel),children:(0,Z.jsx)(m,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})})}),(0,Z.jsx)(U,{children:(0,Z.jsxs)(Ce,{align:`end`,sideOffset:6,collisionPadding:8,"aria-label":c.chooseApp,onEscapeKeyDown:e=>e.stopPropagation(),className:`z-[150] max-h-[var(--radix-dropdown-menu-content-available-height)] w-64 max-w-[calc(100vw-1rem)] overflow-y-auto overscroll-contain rounded-xl border border-edge bg-surface-overlay p-1 shadow-popover outline-none`,children:[n?(0,Z.jsxs)(Se,{className:T,disabled:n.disabled||x,onSelect:()=>{h(null),n.onClick()},children:[(0,Z.jsx)(v,{className:`size-5 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:c.openSystemApp}),b?null:(0,Z.jsx)(p,{className:`size-4 shrink-0`,"aria-hidden":!0})]}):null,o?[{label:c.recommendedApps,apps:i},{label:c.recentApps,apps:a.filter(e=>!i.some(t=>t.path===e.path))}].map(e=>e.apps.length?(0,Z.jsxs)(xe,{children:[(0,Z.jsx)(we,{className:ee}),(0,Z.jsx)(ve,{className:`px-2.5 pb-1 pt-1.5 text-xs font-medium text-fg-muted`,children:e.label}),e.apps.map(e=>(0,Z.jsxs)(Se,{className:T,disabled:x,title:e.name,onSelect:()=>{h(e),o(e.path)},children:[(0,Z.jsx)(mt,{app:e}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.path===b?.path?(0,Z.jsx)(p,{className:`size-4 shrink-0`,"aria-hidden":!0}):null]},e.path))]},e.label):null):null,r?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(we,{className:ee}),(0,Z.jsxs)(Se,{className:T,disabled:r.disabled||x,onSelect:async()=>{_(!0);try{let e=await r.onClick();e&&h(e)}finally{_(!1)}},children:[(0,Z.jsx)(f,{className:`size-5 shrink-0 text-fg-muted`,strokeWidth:1.75,"aria-hidden":!0}),(0,Z.jsx)(`span`,{className:`min-w-0 truncate`,children:c.chooseApp})]})]}):null]})})]})]})}var gt=`<base href="about:srcdoc">`;function _t(e){if(/<base(?:\s|>)/i.test(e))return e;let t=/<head(?:\s[^>]*)?>/i.exec(e);if(t?.index!==void 0){let n=t.index+t[0].length;return`${e.slice(0,n)}${gt}${e.slice(n)}`}let n=/<html(?:\s[^>]*)?>/i.exec(e);if(n?.index!==void 0){let t=n.index+n[0].length;return`${e.slice(0,t)}<head>${gt}</head>${e.slice(t)}`}let r=/^\s*<!doctype[^>]*>/i.exec(e);return r?`${r[0]}<head>${gt}</head>${e.slice(r[0].length)}`:`<head>${gt}</head>${e}`}function vt(e){let t=(0,G.c)(8),{html:n,title:r}=e,i=(0,W.useRef)(null),a;t[0]===n?a=t[1]:(a=()=>{i.current?.contentWindow?.postMessage({type:`xopc-html-preview`,html:_t(n)},`*`)},t[0]=n,t[1]=a);let o=a,c;t[2]===o?c=t[3]:(c=[o],t[2]=o,t[3]=c),(0,W.useEffect)(o,c);let l;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=s(`/api/preview/html`),t[4]=l):l=t[4];let u;return t[5]!==o||t[6]!==r?(u=(0,Z.jsx)(`iframe`,{ref:i,title:r,className:`min-h-0 w-full flex-1 rounded-lg border border-edge-subtle bg-white dark:border-edge dark:bg-[#1e1e1e]`,src:l,sandbox:`allow-scripts allow-popups allow-popups-to-escape-sandbox allow-downloads allow-forms allow-modals`,referrerPolicy:`no-referrer`,onLoad:o}),t[5]=o,t[6]=r,t[7]=u):u=t[7],u}var yt=(0,W.lazy)(()=>i(()=>import(`./source-workspace-editor-kxosllTu.js`).then(e=>({default:e.SourceWorkspaceEditor})),__vite__mapDeps([4,1,5,6,7,2])));function bt(){let e=(0,G.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,Z.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col px-4 py-3`,"aria-busy":!0,children:[(0,Z.jsx)(`div`,{className:`h-4 w-11/12 animate-pulse rounded bg-surface-hover`}),(0,Z.jsx)(`div`,{className:`mt-3 h-4 w-9/12 animate-pulse rounded bg-surface-hover`}),(0,Z.jsx)(`div`,{className:`mt-3 h-4 w-10/12 animate-pulse rounded bg-surface-hover`})]}),e[0]=t):t=e[0],t}function xt(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t).toLowerCase():``}function St(e){return{".ts":`typescript`,".tsx":`tsx`,".js":`javascript`,".jsx":`jsx`,".json":`json`,".css":`css`,".yml":`yaml`,".yaml":`yaml`,".py":`python`,".go":`go`,".rs":`rust`,".sh":`bash`}[xt(e)]??`plaintext`}function Ct(e){let t=(0,G.c)(12),{text:n,targetLine:r}=e,i=(0,W.useRef)(null),a;if(t[0]!==n){let e;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=/\r\n|\n|\r/,t[2]=e):e=t[2],a=n.split(e),t[0]=n,t[1]=a}else a=t[1];let o=a,s;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(s=()=>{i.current?.scrollIntoView({block:`center`})},t[3]=s):s=t[3];let c;t[4]!==r||t[5]!==n?(c=[r,n],t[4]=r,t[5]=n,t[6]=c):c=t[6],(0,W.useEffect)(s,c);let l;t[7]!==o||t[8]!==r?(l=o.map((e,t)=>{let n=t+1,a=n===r;return(0,Z.jsxs)(`div`,{ref:a?i:void 0,className:a?`flex bg-accent-soft/60 text-fg`:`flex`,"data-line":n,children:[(0,Z.jsx)(`span`,{className:`w-12 shrink-0 select-none pr-3 text-right text-fg-subtle`,children:n}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap break-words`,children:e||` `})]},n)}),t[7]=o,t[8]=r,t[9]=l):l=t[9];let u;return t[10]===l?u=t[11]:(u=(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-4 py-3`,children:(0,Z.jsx)(`div`,{className:`min-w-max font-mono text-xs leading-relaxed text-fg`,children:l})}),t[10]=l,t[11]=u),u}function wt(e,t){let n=e.textContent??``,r=e.descriptor.context===`workspace`,i=e.workspaceEditing;return r&&i?.sourceEditMode?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,Z.jsx)(W.Suspense,{fallback:(0,Z.jsx)(bt,{}),children:(0,Z.jsx)(yt,{fileName:e.descriptor.fileName,initialContent:n,onChange:e=>i.onSourceChange?.(e),isDark:(i.isDark??e.resolvedTheme===`dark`)===!0,lineWrap:i.sourceWordWrap===!0},e.descriptor.id)})}):t===`markdown`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Z.jsx)(T,{content:n})}):t===`html`?(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-2 pb-2 pt-1 sm:px-4`,children:(0,Z.jsx)(vt,{html:n,title:e.descriptor.fileName})}):e.targetLine&&e.targetLine>0?(0,Z.jsx)(Ct,{text:n,targetLine:e.targetLine}):t===`code`?(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Z.jsx)(T,{content:`\`\`\`${St(e.descriptor.fileName)}\n${n}\n\`\`\``})}):(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-3`,children:(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs text-fg`,children:n})})}function Tt(e){return wt(e,`text`)}function Et(e){return wt(e,`markdown`)}function Dt(e){return wt(e,`code`)}function Ot(e){return wt(e,`html`)}function kt(){return(0,W.createElement)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`},`Loading preview...`)}function Q(e,t,n,r=`binary`){let i=(0,W.lazy)(n);return{id:e,readMode:r,capabilities:t,render:e=>(0,W.createElement)(W.Suspense,{fallback:kt()},(0,W.createElement)(i,e))}}var At={text:{id:`text`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,W.createElement)(Tt,e)},markdown:{id:`markdown`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,W.createElement)(Et,e)},code:{id:`code`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,W.createElement)(Dt,e)},html:{id:`html`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,W.createElement)(Ot,e)},image:Q(`image`,[`download`,`zoom`,`rotate`],()=>i(()=>import(`./binary-plugins-CFJCUpWH.js`).then(e=>({default:e.InteractiveImagePreview})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),pdf:Q(`pdf`,[`download`,`zoom`,`rotate`,`pageNavigation`,`print`],()=>i(()=>import(`./binary-plugins-CFJCUpWH.js`).then(e=>({default:e.PdfPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),docx:Q(`docx`,[`download`],()=>i(()=>import(`./binary-plugins-CFJCUpWH.js`).then(e=>({default:e.DocxPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),spreadsheet:Q(`spreadsheet`,[`download`],()=>i(()=>import(`./binary-plugins-CFJCUpWH.js`).then(e=>({default:e.SpreadsheetPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),pptx:Q(`pptx`,[`download`],()=>i(()=>import(`./binary-plugins-CFJCUpWH.js`).then(e=>({default:e.PptxPreviewPluginView})),__vite__mapDeps([8,1,5,2,9,10,11,12,13,14,15,16,17,18,19]))),audio:Q(`audio`,[`download`],()=>i(()=>import(`./media-plugins-DcN8Y0hJ.js`).then(e=>({default:e.AudioPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19]))),video:Q(`video`,[`download`],()=>i(()=>import(`./media-plugins-DcN8Y0hJ.js`).then(e=>({default:e.VideoPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19]))),archive:Q(`archive`,[`download`],()=>i(()=>import(`./archive-plugin-CPCI6nqQ.js`).then(e=>({default:e.ArchivePreviewPluginView})),__vite__mapDeps([21,1,5,9,22,11,12,13,14,15,16,17,18]))),unsupported:Q(`unsupported`,[`download`],()=>i(()=>import(`./media-plugins-DcN8Y0hJ.js`).then(e=>({default:e.UnsupportedPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19])),`metadata`)};function jt(e){return At[e]??At.unsupported}function Mt(e){let t=(0,G.c)(63),{plugin:n,controls:r,onZoomIn:i,onZoomOut:a,onZoomReset:o,onRotate:s,onSearchChange:c}=e,l;t[0]===n.capabilities?l=t[1]:(l=n.capabilities.includes(`zoom`),t[0]=n.capabilities,t[1]=l);let u=l,d;t[2]===n.capabilities?d=t[3]:(d=n.capabilities.includes(`search`),t[2]=n.capabilities,t[3]=d);let f=d,p;t[4]===n.capabilities?p=t[5]:(p=n.capabilities.includes(`rotate`),t[4]=n.capabilities,t[5]=p);let m=p,h;t[6]!==r||t[7]!==n.capabilities?(h=n.capabilities.includes(`pageNavigation`)&&r.pageCount!=null&&r.pageCount>1,t[6]=r,t[7]=n.capabilities,t[8]=h):h=t[8];let g=h;if(!(u||f||m||g))return null;let _;if(t[9]!==g||t[10]!==m||t[11]!==f||t[12]!==u||t[13]!==r||t[14]!==s||t[15]!==c||t[16]!==i||t[17]!==a||t[18]!==o){let e=[];if(g){let n=r.page<=1,i;t[20]===r?i=t[21]:(i=()=>r.setPage(Math.max(1,r.page-1)),t[20]=r,t[21]=i);let a;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Z.jsx)(De,{className:`size-3.5`}),t[22]=a):a=t[22];let o;t[23]!==n||t[24]!==i?(o=(0,Z.jsx)(Nt,{label:`Previous page`,disabled:n,onClick:i,children:a}),t[23]=n,t[24]=i,t[25]=o):o=t[25];let s;t[26]!==r.page||t[27]!==r.pageCount?(s=(0,Z.jsxs)(`span`,{className:`min-w-16 px-1 text-center text-xs text-fg-muted`,children:[r.page,` / `,r.pageCount]}),t[26]=r.page,t[27]=r.pageCount,t[28]=s):s=t[28];let c=r.page>=(r.pageCount??1),l;t[29]===r?l=t[30]:(l=()=>r.setPage(Math.min(r.pageCount??r.page,r.page+1)),t[29]=r,t[30]=l);let u;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(Ee,{className:`size-3.5`}),t[31]=u):u=t[31];let d;t[32]!==c||t[33]!==l?(d=(0,Z.jsx)(Nt,{label:`Next page`,disabled:c,onClick:l,children:u}),t[32]=c,t[33]=l,t[34]=d):d=t[34];let f;t[35]!==s||t[36]!==d||t[37]!==o?(f=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-base p-0.5 dark:border-edge`,children:[o,s,d]},`page`),t[35]=s,t[36]=d,t[37]=o,t[38]=f):f=t[38],e.push(f)}if(u){let n;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(C,{className:`size-3.5`}),t[39]=n):n=t[39];let s;t[40]===a?s=t[41]:(s=(0,Z.jsx)(Nt,{label:`Zoom out`,onClick:a,children:n}),t[40]=a,t[41]=s);let c;t[42]===r.zoom?c=t[43]:(c=Math.round(r.zoom*100),t[42]=r.zoom,t[43]=c);let l;t[44]!==o||t[45]!==c?(l=(0,Z.jsxs)(`button`,{type:`button`,className:`min-w-14 rounded px-1.5 py-1 text-xs text-fg-muted hover:bg-surface-hover hover:text-fg`,onClick:o,title:`Reset zoom`,children:[c,`%`]}),t[44]=o,t[45]=c,t[46]=l):l=t[46];let u;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Z.jsx)(D,{className:`size-3.5`}),t[47]=u):u=t[47];let d;t[48]===i?d=t[49]:(d=(0,Z.jsx)(Nt,{label:`Zoom in`,onClick:i,children:u}),t[48]=i,t[49]=d);let f;t[50]!==d||t[51]!==s||t[52]!==l?(f=(0,Z.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-edge-subtle bg-surface-base p-0.5 dark:border-edge`,children:[s,l,d]},`zoom`),t[50]=d,t[51]=s,t[52]=l,t[53]=f):f=t[53],e.push(f)}if(m){let n;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(k,{className:`size-3.5`}),t[54]=n):n=t[54];let r;t[55]===s?r=t[56]:(r=(0,Z.jsx)(Nt,{label:`Rotate`,onClick:s,children:n},`rotate`),t[55]=s,t[56]=r),e.push(r)}if(f){let n;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Z.jsx)(A,{className:`size-3.5`,"aria-hidden":!0}),t[57]=n):n=t[57];let i;t[58]===c?i=t[59]:(i=e=>c(e.target.value),t[58]=c,t[59]=i);let a;t[60]!==r.searchQuery||t[61]!==i?(a=(0,Z.jsxs)(`label`,{className:`flex min-w-40 items-center gap-1 rounded-md border border-edge-subtle bg-surface-base px-2 py-1 text-xs text-fg-muted dark:border-edge`,children:[n,(0,Z.jsx)(`input`,{className:`min-w-0 flex-1 bg-transparent text-fg outline-none placeholder:text-fg-subtle`,value:r.searchQuery,onChange:i,placeholder:`Search`})]},`search`),t[60]=r.searchQuery,t[61]=i,t[62]=a):a=t[62],e.push(a)}_=(0,Z.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:e}),t[9]=g,t[10]=m,t[11]=f,t[12]=u,t[13]=r,t[14]=s,t[15]=c,t[16]=i,t[17]=a,t[18]=o,t[19]=_}else _=t[19];return _}function Nt(e){let t=(0,G.c)(6),{label:n,disabled:r,onClick:i,children:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=j(`inline-flex size-9 shrink-0 items-center justify-center rounded-md text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:opacity-40`),t[0]=o):o=t[0];let s;return t[1]!==a||t[2]!==r||t[3]!==n||t[4]!==i?(s=(0,Z.jsx)(`button`,{type:`button`,className:o,title:n,"aria-label":n,disabled:r,onClick:i,children:a}),t[1]=a,t[2]=r,t[3]=n,t[4]=i,t[5]=s):s=t[5],s}function Pt(e){let t=jt(e.type),n=nt(e.id),[r,i]=(0,W.useState)(n.zoom),[a,o]=(0,W.useState)(n.rotation),[s,c]=(0,W.useState)(n.page),[l,u]=(0,W.useState)(n.pageCount),[d,f]=(0,W.useState)(n.searchQuery),p=(0,W.useCallback)(e=>{c(Math.max(1,Math.min(l??e,Math.floor(e))))},[l]);(0,W.useEffect)(()=>{let t=nt(e.id);i(t.zoom),o(t.rotation),c(t.page),u(t.pageCount),f(t.searchQuery)},[e.id,e.type]);let m=(0,W.useRef)({zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d});return m.current={zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d},(0,W.useEffect)(()=>()=>rt(e.id,m.current),[e.id]),{plugin:t,controls:(0,W.useMemo)(()=>({zoom:r,rotation:a,page:s,pageCount:l,searchQuery:d,setPageCount:u,setPage:p}),[s,l,a,d,p,r]),onZoomIn:()=>i(e=>Math.min(4,Number((e+.15).toFixed(2)))),onZoomOut:()=>i(e=>Math.max(.25,Number((e-.15).toFixed(2)))),onZoomReset:()=>{i(1),o(0)},onRotate:()=>o(e=>(e+90)%360),onSearchChange:f}}function Ft(e){let t=(0,G.c)(8),{controller:n}=e,r;return t[0]!==n.controls||t[1]!==n.onRotate||t[2]!==n.onSearchChange||t[3]!==n.onZoomIn||t[4]!==n.onZoomOut||t[5]!==n.onZoomReset||t[6]!==n.plugin?(r=(0,Z.jsx)(Mt,{plugin:n.plugin,controls:n.controls,onZoomIn:n.onZoomIn,onZoomOut:n.onZoomOut,onZoomReset:n.onZoomReset,onRotate:n.onRotate,onSearchChange:n.onSearchChange}),t[0]=n.controls,t[1]=n.onRotate,t[2]=n.onSearchChange,t[3]=n.onZoomIn,t[4]=n.onZoomOut,t[5]=n.onZoomReset,t[6]=n.plugin,t[7]=r):r=t[7],r}function It(e){let t=(0,G.c)(14),n;t[0]===e.language?n=t[1]:(n=u(e.language),t[0]=e.language,t[1]=n);let r=n,{controller:i}=e;if(e.loading){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 px-4 py-6`,"aria-busy":`true`,children:[(0,Z.jsx)(M,{className:`h-5 w-48 max-w-full`}),(0,Z.jsx)(M,{className:`h-4 w-full`}),(0,Z.jsx)(M,{className:`h-4 w-11/12`}),(0,Z.jsx)(M,{className:`h-4 w-3/4`}),(0,Z.jsx)(M,{className:`mt-3 min-h-48 flex-1 rounded-lg`})]}),t[2]=e):e=t[2],e}if(e.loadError){let n=(e.descriptor.context===`workspace`?r.workspace.loadError:r.chat.attachmentPreviewLoadError)+`: `+e.loadError,i;return t[3]===n?i=t[4]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-3 overflow-auto p-4`,children:(0,Z.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:n})}),t[3]=n,t[4]=i),i}if(e.descriptor.context===`attachment`&&e.showExtractedText&&e.descriptor.type!==`image`){let n=e.extractedText||r.chat.attachmentPreviewNoText,i;return t[5]===n?i=t[6]:(i=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-2 overflow-hidden`,children:(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto rounded-lg border border-edge-subtle bg-surface-hover/40 p-4 dark:border-edge`,children:(0,Z.jsx)(`pre`,{className:`whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-fg-muted`,children:n})})}),t[5]=n,t[6]=i),i}let a=`${e.descriptor.id}:${i.plugin.id}`,o;t[7]!==i.controls||t[8]!==e?(o={...e,controls:i.controls},t[7]=i.controls,t[8]=e,t[9]=o):o=t[9];let s;return t[10]!==i.plugin.render||t[11]!==a||t[12]!==o?(s=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:(0,Z.jsx)(Lt,{pluginRender:i.plugin.render,props:o},a)}),t[10]=i.plugin.render,t[11]=a,t[12]=o,t[13]=s):s=t[13],s}function Lt(e){let t=(0,G.c)(5),{pluginRender:n,props:r}=e,i;t[0]!==n||t[1]!==r?(i=n(r),t[0]=n,t[1]=r,t[2]=i):i=t[2];let a;return t[3]===i?a=t[4]:(a=(0,Z.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:i}),t[3]=i,t[4]=a),a}function Rt(e){let t=(0,G.c)(9),{label:n,active:r,disabled:i,onClick:a,children:o}=e,s=r&&`border-accent/20 bg-accent-soft text-accent-fg`,c;t[0]===s?c=t[1]:(c=j(`inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-edge-subtle bg-surface-panel text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg disabled:cursor-not-allowed disabled:opacity-40`,s,ce.focusRingPanel),t[0]=s,t[1]=c);let l;return t[2]!==r||t[3]!==o||t[4]!==i||t[5]!==n||t[6]!==a||t[7]!==c?(l=(0,Z.jsx)(`button`,{type:`button`,className:c,title:n,"aria-label":n,"aria-pressed":r,disabled:i,onClick:a,children:o}),t[2]=r,t[3]=o,t[4]=i,t[5]=n,t[6]=a,t[7]=c,t[8]=l):l=t[8],l}function $(e){let t=(0,G.c)(14),{icon:n,label:r,active:i,disabled:a,onClick:o}=e,s=i===void 0?`menuitem`:`menuitemcheckbox`,c;t[0]===n?c=t[1]:(c=(0,Z.jsx)(`span`,{className:`flex size-4 shrink-0 items-center justify-center text-fg-muted`,"aria-hidden":!0,children:n}),t[0]=n,t[1]=c);let l;t[2]===r?l=t[3]:(l=(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:r}),t[2]=r,t[3]=l);let u;t[4]===i?u=t[5]:(u=i?(0,Z.jsx)(p,{className:`size-4 shrink-0`,"aria-hidden":!0}):null,t[4]=i,t[5]=u);let d;return t[6]!==i||t[7]!==a||t[8]!==o||t[9]!==s||t[10]!==c||t[11]!==l||t[12]!==u?(d=(0,Z.jsxs)(`button`,{type:`button`,role:s,"aria-checked":i,className:`flex h-9 w-full min-w-0 items-center gap-2.5 rounded-md px-2.5 text-left text-sm text-fg hover:bg-surface-hover focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent disabled:cursor-not-allowed disabled:opacity-40`,disabled:a,onClick:o,children:[c,l,u]}),t[6]=i,t[7]=a,t[8]=o,t[9]=s,t[10]=c,t[11]=l,t[12]=u,t[13]=d):d=t[13],d}function zt(e){let t=(0,G.c)(92),{referenceActions:n,onRefresh:r,onRetrySave:i,subtitle:a,controller:o,actions:s,expanded:c,onToggleExpanded:d,onClose:f,hideClose:m,edit:C,wordWrap:T,editInNewChat:D,share:k,openWithSystemApp:A,chooseApp:M,recommendedApps:N,recentApps:P,onOpenWithApp:ae,onRevealInFolder:oe,copyPath:F,textView:I,openInBrowser:L}=e,se;t[0]===n?se=t[1]:(se=n===void 0?[]:n,t[0]=n,t[1]=se);let R=se,z;t[2]===N?z=t[3]:(z=N===void 0?[]:N,t[2]=N,t[3]=z);let de=z,pe;t[4]===P?pe=t[5]:(pe=P===void 0?[]:P,t[4]=P,t[5]=pe);let me=pe,B=l(Ht),he;t[6]===B?he=t[7]:(he=u(B),t[6]=B,t[7]=he);let V=he,H=V.workspace,ge=o.plugin.id===`pdf`?V.chat.attachmentPreviewPdf:o.plugin.id===`docx`?V.chat.attachmentPreviewDocument:o.plugin.id===`spreadsheet`?V.chat.attachmentPreviewSpreadsheet:H.preview,_e;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(_e=ue(),t[8]=_e):_e=t[8];let ve=_e,ye=(0,W.useContext)(je),be=(0,W.useRef)(null),xe=(0,W.useRef)(null),[U,Se]=(0,W.useState)(!1),Ce;t[9]===o.plugin.capabilities?Ce=t[10]:(Ce=o.plugin.capabilities.some(Vt),t[9]=o.plugin.capabilities,t[10]=Ce);let we=Ce,Ee,De;t[11]===U?(Ee=t[12],De=t[13]):(Ee=()=>{if(!U)return;be.current?.querySelector(`button:not(:disabled), a`)?.focus();let e=e=>{if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)&&be.current?.contains(document.activeElement)){e.preventDefault(),e.stopImmediatePropagation();let t=[...be.current.querySelectorAll(`button:not(:disabled), a`)],n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:(n+(e.key===`ArrowDown`?1:-1)+t.length)%t.length]?.focus();return}e.key===`Escape`&&(e.preventDefault(),e.stopImmediatePropagation(),Se(!1),xe.current?.focus())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},De=[U],t[11]=U,t[12]=Ee,t[13]=De),(0,W.useEffect)(Ee,De);let K;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(K=e=>{Se(!1),xe.current?.focus(),e()},t[14]=K):K=t[14];let q=K,ke;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(ke=j(`shrink-0 bg-surface-base px-3 py-2 sm:px-4`,le),t[15]=ke):ke=t[15];let Ae;t[16]===ye?Ae=t[17]:(Ae=ye?(0,Z.jsx)(Rt,{label:ye.label,active:ye.active,onClick:ye.onToggle,children:(0,Z.jsx)(Te,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}):null,t[16]=ye,t[17]=Ae);let Me=c?H.collapsePreview:H.expandPreview,Ne=!d,Pe;t[18]===c?Pe=t[19]:(Pe=c?(0,Z.jsx)(te,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(w,{className:`size-4`,"aria-hidden":!0}),t[18]=c,t[19]=Pe);let Fe;t[20]!==c||t[21]!==d||t[22]!==Me||t[23]!==Ne||t[24]!==Pe?(Fe=(0,Z.jsx)(Rt,{label:Me,active:c,disabled:Ne,onClick:d,children:Pe}),t[20]=c,t[21]=d,t[22]=Me,t[23]=Ne,t[24]=Pe,t[25]=Fe):Fe=t[25];let Ie;t[26]===U?Ie=t[27]:(Ie=U?(0,Z.jsx)(`button`,{type:`button`,className:`fixed inset-0 z-40 cursor-default bg-transparent`,"aria-hidden":!0,tabIndex:-1,onPointerDown:e=>{e.preventDefault(),Se(!1)}}):null,t[26]=U,t[27]=Ie);let Le;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(Le=j(`inline-flex size-9 shrink-0 items-center justify-center rounded-full border border-edge-subtle bg-surface-panel text-fg-muted transition-colors hover:bg-surface-hover hover:text-fg`,ce.focusRingPanel),t[28]=Le):Le=t[28];let Re,ze;t[29]===Symbol.for(`react.memo_cache_sentinel`)?(Re=()=>Se(Bt),ze=(0,Z.jsx)(_,{className:`size-4`}),t[29]=Re,t[30]=ze):(Re=t[29],ze=t[30]);let Be;t[31]!==H.moreActions||t[32]!==U?(Be=(0,Z.jsx)(`button`,{ref:xe,type:`button`,className:Le,title:H.moreActions,"aria-label":H.moreActions,"aria-haspopup":`menu`,"aria-expanded":U,onClick:Re,children:ze}),t[31]=H.moreActions,t[32]=U,t[33]=Be):Be=t[33];let Ve;t[34]!==s||t[35]!==M||t[36]!==o.plugin.capabilities||t[37]!==F||t[38]!==C||t[39]!==D||t[40]!==B||t[41]!==H.copyFilePath||t[42]!==H.copyWorkspacePath||t[43]!==H.download||t[44]!==H.edit||t[45]!==H.editInNewChat||t[46]!==H.moreActions||t[47]!==H.openInBrowser||t[48]!==H.pathCopied||t[49]!==H.preview||t[50]!==H.revealInFolder||t[51]!==H.saveCopy||t[52]!==H.shareLink||t[53]!==H.wordWrap||t[54]!==U||t[55]!==ae||t[56]!==r||t[57]!==i||t[58]!==oe||t[59]!==L||t[60]!==A||t[61]!==me||t[62]!==de||t[63]!==R||t[64]!==k||t[65]!==T?(Ve=U?(0,Z.jsxs)(`div`,{ref:be,role:`menu`,"aria-label":H.moreActions,"data-file-preview-menu":!0,className:`absolute right-0 top-full z-50 mt-1 max-h-[min(32rem,calc(100dvh-8rem))] w-60 max-w-[calc(100vw-2rem)] overflow-y-auto overscroll-contain rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[(0,Z.jsx)(ht,{variant:`menu`,onAction:q,systemApp:A,chooseApp:M,recommendedApps:de,recentApps:me,onOpenWithApp:ae}),R.map(e=>(0,Z.jsx)($,{icon:(0,Z.jsx)(E,{className:`size-4`}),label:e.label,disabled:e.disabled,onClick:()=>q(e.onClick)},e.label)),i?(0,Z.jsx)($,{icon:(0,Z.jsx)(re,{className:`size-4`}),label:B===`zh`?`重试保存`:`Retry save`,onClick:()=>q(i)}):null,r?(0,Z.jsx)($,{icon:(0,Z.jsx)(O,{className:`size-4`}),label:B===`zh`?`刷新文件`:`Refresh file`,onClick:()=>q(r)}):null,o.plugin.capabilities.includes(`edit`)?(0,Z.jsx)($,{icon:C?.active?(0,Z.jsx)(y,{className:`size-4`}):(0,Z.jsx)(ne,{className:`size-4`}),label:C?.active?H.preview:H.edit,disabled:!C,onClick:()=>q(()=>C?.onToggle())}):null,T?(0,Z.jsx)($,{icon:(0,Z.jsx)(Oe,{className:`size-4`}),label:H.wordWrap,active:T.active,onClick:()=>q(T.onToggle)}):null,(0,Z.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`}),(0,Z.jsx)($,{icon:D?.loading?(0,Z.jsx)(S,{className:`size-4 animate-spin`}):(0,Z.jsx)(ee,{className:`size-4`}),label:H.editInNewChat,disabled:!D||D.disabled||D.loading,onClick:()=>q(()=>D?.onClick())}),(0,Z.jsx)($,{icon:k?.loading?(0,Z.jsx)(S,{className:`size-4 animate-spin`}):(0,Z.jsx)(x,{className:`size-4`}),label:H.shareLink,disabled:!k||k.disabled||k.loading,onClick:()=>q(()=>k?.onClick())}),(0,Z.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`}),L?(0,Z.jsxs)(`a`,{href:L.href,target:`_blank`,rel:`noopener noreferrer`,role:`menuitem`,className:`flex h-9 w-full items-center gap-2.5 rounded-md px-2.5 text-sm text-fg hover:bg-surface-hover`,onClick:()=>Se(!1),children:[(0,Z.jsx)(v,{className:`size-4 text-fg-muted`,"aria-hidden":!0}),H.openInBrowser]}):null,oe?(0,Z.jsx)($,{icon:(0,Z.jsx)(b,{className:`size-4`}),label:H.revealInFolder,onClick:()=>q(oe)}):null,oe?(0,Z.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`}):null,(0,Z.jsx)($,{icon:(0,Z.jsx)(g,{className:`size-4`}),label:ve?H.saveCopy:H.download,disabled:!s.canDownload,onClick:()=>q(()=>void s.onDownload())}),F?(0,Z.jsx)($,{icon:F.copied?(0,Z.jsx)(p,{className:`size-4 text-emerald-500`}):(0,Z.jsx)(h,{className:`size-4`}),label:F.copied?H.pathCopied:ve?H.copyFilePath:H.copyWorkspacePath,onClick:()=>q(F.onClick)}):null]}):null,t[34]=s,t[35]=M,t[36]=o.plugin.capabilities,t[37]=F,t[38]=C,t[39]=D,t[40]=B,t[41]=H.copyFilePath,t[42]=H.copyWorkspacePath,t[43]=H.download,t[44]=H.edit,t[45]=H.editInNewChat,t[46]=H.moreActions,t[47]=H.openInBrowser,t[48]=H.pathCopied,t[49]=H.preview,t[50]=H.revealInFolder,t[51]=H.saveCopy,t[52]=H.shareLink,t[53]=H.wordWrap,t[54]=U,t[55]=ae,t[56]=r,t[57]=i,t[58]=oe,t[59]=L,t[60]=A,t[61]=me,t[62]=de,t[63]=R,t[64]=k,t[65]=T,t[66]=Ve):Ve=t[66];let He;t[67]!==Ie||t[68]!==Be||t[69]!==Ve?(He=(0,Z.jsxs)(`div`,{className:`relative shrink-0`,children:[Ie,Be,Ve]}),t[67]=Ie,t[68]=Be,t[69]=Ve,t[70]=He):He=t[70];let Ue;t[71]!==m||t[72]!==H.close||t[73]!==f?(Ue=m?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`mx-0.5 h-5 w-px bg-edge-subtle`,"aria-hidden":!0}),(0,Z.jsx)(Rt,{label:H.close,onClick:f,children:(0,Z.jsx)(ie,{className:`size-4`,strokeWidth:1.75})})]}),t[71]=m,t[72]=H.close,t[73]=f,t[74]=Ue):Ue=t[74];let J;t[75]!==Ae||t[76]!==Fe||t[77]!==He||t[78]!==Ue?(J=(0,Z.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:(0,Z.jsxs)(`div`,{className:`ml-auto flex shrink-0 items-center gap-1.5`,children:[Ae,Fe,He,Ue]})}),t[75]=Ae,t[76]=Fe,t[77]=He,t[78]=Ue,t[79]=J):J=t[79];let Y;t[80]===a?Y=t[81]:(Y=a?(0,Z.jsx)(`div`,{className:`mt-1.5 flex min-h-4 min-w-0 items-center gap-2 px-3 text-xs leading-4 text-fg-muted`,children:a}):null,t[80]=a,t[81]=Y);let X;t[82]!==o||t[83]!==we||t[84]!==V.chat||t[85]!==ge||t[86]!==I?(X=we||I?(0,Z.jsxs)(`div`,{className:`mt-2 flex items-center gap-2 overflow-x-auto pb-0.5`,children:[I?(0,Z.jsx)(fe,{className:`mr-2 flex shrink-0 rounded-lg bg-surface-hover p-0.5`,role:`group`,"aria-label":V.chat.attachmentPreviewText,children:[{active:!1,label:ge},{active:!0,label:V.chat.attachmentPreviewText}].map(e=>(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":I.active===e.active,className:j(`rounded-md px-2.5 py-1 text-xs font-medium`,I.active===e.active?`bg-surface-hover text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>I.onChange(e.active),children:e.label},e.label))}):null,we?(0,Z.jsx)(Ft,{controller:o}):null]}):null,t[82]=o,t[83]=we,t[84]=V.chat,t[85]=ge,t[86]=I,t[87]=X):X=t[87];let We;return t[88]!==J||t[89]!==Y||t[90]!==X?(We=(0,Z.jsxs)(`div`,{"data-workspace-toolbar":!0,className:ke,children:[J,Y,X]}),t[88]=J,t[89]=Y,t[90]=X,t[91]=We):We=t[91],We}function Bt(e){return!e}function Vt(e){return[`zoom`,`search`,`rotate`,`pageNavigation`].includes(e)}function Ht(e){return e.language}function Ut({header:e,chat:t,...n}){let r=(0,W.useRef)(null);(0,W.useEffect)(()=>{let e=r.current;if(!e)return;let t=()=>{let t=nt(n.descriptor.id).scroll;e.querySelectorAll(`[class*="overflow-auto"], [class*="overflow-y-auto"], .cm-scroller`).forEach((e,n)=>{t[n]!=null&&(e.scrollTop=t[n])})},i=requestAnimationFrame(t),a=typeof MutationObserver<`u`?new MutationObserver(t):null;a?.observe(e,{childList:!0,subtree:!0});let o=()=>rt(n.descriptor.id,{scroll:[...e.querySelectorAll(`[class*="overflow-auto"], [class*="overflow-y-auto"], .cm-scroller`)].map(e=>e.scrollTop)});return e.addEventListener(`scroll`,o,!0),()=>{cancelAnimationFrame(i),a?.disconnect(),e.removeEventListener(`scroll`,o,!0)}},[n.descriptor.id]);let i=(0,W.useContext)(Ae),[o,s]=(0,W.useState)(!1),c=Pt(n.descriptor),l=a(),d=u(n.language),[f,p]=(0,W.useState)(!1),m=async()=>{if(!(!t||f)){p(!0);try{let[n,r]=await Promise.all([t.createFile(),t.conversationId?ae(t.conversationId).catch(()=>null):Promise.resolve(null)]);if(n.size>33554432){K(`warning`,d.chat.attachmentFileTooLarge,{name:n.name,maxSize:L(P)});return}let i=new URLSearchParams({attachmentHandoff:dt(n)}),a=t.projectId?.trim()||r?.projectId?.trim(),o=t.agentId?.trim()||r?.routing?.agentId?.trim();a&&i.set(`projectId`,a),l({pathname:`/chat/new`,search:`?${i}`},{state:{forceNewChat:!0,agentId:o||void 0}}),e.onClose()}catch{K(`error`,d.workspace.editInNewChatFailed)}finally{p(!1)}}};return(0,Z.jsxs)(`div`,{ref:r,className:`flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden bg-transparent`,children:[(0,Z.jsx)(zt,{...e,name:n.descriptor.fileName,filePath:n.descriptor.source.kind===`workspace`?n.descriptor.source.path:void 0,controller:c,actions:n.actions,referenceActions:t?i.map(e=>({label:e.label,disabled:o||n.loading||!!n.loadError||t.disabled,onClick:async()=>{if(!o){s(!0);try{let r=await t.createFile(),i=await ot(e.id,r);K(i?`success`:`warning`,n.language===`zh`?i?`已添加到目标聊天草稿`:`未能添加附件,请确认目标聊天可用及附件限制`:i?`Added to the target chat draft`:`Could not add attachment. Check the target chat and attachment limits.`)}catch{K(`error`,n.language===`zh`?`文件引用失败,原草稿已保留`:`Could not reference file. Your draft is retained.`)}finally{s(!1)}}}})):void 0,editInNewChat:t?{onClick:()=>void m(),loading:f,disabled:n.loading||!!n.loadError||t.disabled}:void 0},n.descriptor.id),(0,Z.jsx)(It,{...n,controller:c})]})}function Wt(e,t){let n=(0,G.c)(7),r=e===void 0||e,i=t!==void 0&&t,[a,o]=(0,W.useState)(!1);!r&&a&&o(!1);let s,c;n[0]!==r||n[1]!==i||n[2]!==a?(s=()=>{if(!r||!a)return;let e=document.body.style.overflow;document.body.style.overflow=`hidden`;let t=e=>{i||e.key!==`Escape`||e.defaultPrevented||document.querySelector(`[data-file-preview-menu]`)||(e.preventDefault(),e.stopImmediatePropagation(),o(!1))};return window.addEventListener(`keydown`,t,!0),()=>{document.body.style.overflow=e,window.removeEventListener(`keydown`,t,!0)}},c=[r,a,i],n[0]=r,n[1]=i,n[2]=a,n[3]=s,n[4]=c):(s=n[3],c=n[4]),(0,W.useEffect)(s,c);let l;return n[5]===a?l=n[6]:(l={expanded:a,setExpanded:o},n[5]=a,n[6]=l),l}export{De as C,Oe as S,Te as T,Ae as _,at as a,ke as b,et as c,Ne as d,Me as f,We as g,Y as h,pt as i,Ye as l,J as m,Ut as n,nt as o,X as p,ft as r,rt as s,Wt as t,Ge as u,q as v,Ee as w,K as x,je as y};