@xopcai/xopc 0.0.468 → 0.0.469

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 (349) hide show
  1. package/dist/browser-ext/dist/sidepanel.js +5 -0
  2. package/dist/browser-ext/manifest.json +1 -1
  3. package/dist/extensions/telegram/xopc.extension.json +1 -1
  4. package/dist/gateway/static/root/assets/{agents-CIV2R_El.js → agents-DZftplJc.js} +3 -3
  5. package/dist/gateway/static/root/assets/{api-Cl08_xtM.js → api-BnS9d0p6.js} +1 -1
  6. package/dist/gateway/static/root/assets/{app-link-BkEO3eBe.js → app-link-CauYDM-y.js} +1 -1
  7. package/dist/gateway/static/root/assets/{apps-page-CncU5JvR.js → apps-page-CXKTWj1s.js} +1 -1
  8. package/dist/gateway/static/root/assets/arrow-down-to-line-C5D8Vt-L.js +1 -0
  9. package/dist/gateway/static/root/assets/{attachment-load-DrVGNxJm.js → attachment-load-C9iZLUHv.js} +1 -1
  10. package/dist/gateway/static/root/assets/attachment-preview-renderer-_6GhoCYk.js +12 -0
  11. package/dist/gateway/static/root/assets/attachment-utils-core-BPYdUI6y.js +1 -0
  12. package/dist/gateway/static/root/assets/{automation-task-card-sR61FFLn.js → automation-task-card-BNT3n0qu.js} +1 -1
  13. package/dist/gateway/static/root/assets/{automations-page-BNzj3R7A.js → automations-page-DqrAOReO.js} +1 -1
  14. package/dist/gateway/static/root/assets/automations-workspace-BYmFhO8E.js +9 -0
  15. package/dist/gateway/static/root/assets/binary-plugins-CnFVuJtL.js +2 -0
  16. package/dist/gateway/static/root/assets/{block-editor-B4Yqbxab.js → block-editor-jy5CCmhH.js} +9 -9
  17. package/dist/gateway/static/root/assets/{capabilities-CBSMm_jo.js → capabilities-CaJjMTli.js} +1 -1
  18. package/dist/gateway/static/root/assets/capabilities-YmBD7oK8.js +1 -0
  19. package/dist/gateway/static/root/assets/capabilities-page-XgIRdqCb.js +2 -0
  20. package/dist/gateway/static/root/assets/capabilities-settings-panel-DfyND0IO.js +8 -0
  21. package/dist/gateway/static/root/assets/channels-DwUmMnA1.js +1 -0
  22. package/dist/gateway/static/root/assets/{chat-chart-block-CS-cORJt.js → chat-chart-block-B_c5sy7q.js} +1 -1
  23. package/dist/gateway/static/root/assets/chat-page-DfFXhDRv.js +72 -0
  24. package/dist/gateway/static/root/assets/{chat-terminal-dock-D6LH3W5H.js → chat-terminal-dock-Dn7Cm1O4.js} +1 -1
  25. package/dist/gateway/static/root/assets/{connected-providers-grid-CxeXJKxg.js → connected-providers-grid-DUHMZjyV.js} +1 -1
  26. package/dist/gateway/static/root/assets/{connector-service-page-Bsec3-eZ.js → connector-service-page-DLbBblN2.js} +1 -1
  27. package/dist/gateway/static/root/assets/{connectors-page-C0ZCUtxF.js → connectors-page-HHGB3r3Q.js} +1 -1
  28. package/dist/gateway/static/root/assets/constants-D5Z-mUto.js +1 -0
  29. package/dist/gateway/static/root/assets/{device-pairing-wizard-diuSsk-H.js → device-pairing-wizard-eWeHH6Ru.js} +1 -1
  30. package/dist/gateway/static/root/assets/extension-authoritative-grants-BqtUnmq-.js +1 -0
  31. package/dist/gateway/static/root/assets/{extension-debug-page-DrpE2lQ3.js → extension-debug-page-DIAyDA-a.js} +1 -1
  32. package/dist/gateway/static/root/assets/{extension-iframe-host-hr60GwXQ.js → extension-iframe-host-CCe4R7L7.js} +1 -1
  33. package/dist/gateway/static/root/assets/{extension-message-router-aoF3x4-X.js → extension-message-router-BD0ZamBV.js} +1 -1
  34. package/dist/gateway/static/root/assets/{extension-page-BfM8zli6.js → extension-page-C09dlV3J.js} +1 -1
  35. package/dist/gateway/static/root/assets/{extension-provider-BcSgVeKW.js → extension-provider-BhluafoX.js} +1 -1
  36. package/dist/gateway/static/root/assets/{extension-settings-page-Db5t2Mz0.js → extension-settings-page-CB8KLYoG.js} +1 -1
  37. package/dist/gateway/static/root/assets/file-CStvVK2S.js +1 -0
  38. package/dist/gateway/static/root/assets/{file-BqMS_3DT.js → file-code-corner-byQA1VfD.js} +1 -1
  39. package/dist/gateway/static/root/assets/file-icon-N6WjUhq_.js +1 -0
  40. package/dist/gateway/static/root/assets/file-tree-CYUkQR1t.js +1 -0
  41. package/dist/gateway/static/root/assets/{home-page-DsS2UT08.js → home-page-8KwhWlYt.js} +3 -3
  42. package/dist/gateway/static/root/assets/index-CZUfwwLp.css +1 -0
  43. package/dist/gateway/static/root/assets/index-D5hovYIw.js +11 -0
  44. package/dist/gateway/static/root/assets/{install-connector-dialog-0_PeJJqO.js → install-connector-dialog-BZjodnUC.js} +1 -1
  45. package/dist/gateway/static/root/assets/local-app-workbench-page-DmzgjJNj.js +1 -0
  46. package/dist/gateway/static/root/assets/{local-apps-page-yBqRl5Bi.js → local-apps-page-Ct8z2B7R.js} +1 -1
  47. package/dist/gateway/static/root/assets/logs-page-CH9amuGc.js +2 -0
  48. package/dist/gateway/static/root/assets/{management-settings-D9HGIYXx.js → management-settings-CUQd0FJ3.js} +1 -1
  49. package/dist/gateway/static/root/assets/{markdown-view-CiGdWuN3.js → markdown-view-Dm01GIXv.js} +1 -1
  50. package/dist/gateway/static/root/assets/{media-plugins-C2lp7UmI.js → media-plugins-jsWNdARw.js} +1 -1
  51. package/dist/gateway/static/root/assets/models-hub-cache-B2QcrY4n.js +1 -0
  52. package/dist/gateway/static/root/assets/note-detail-panel-DeFb2HEC.js +7 -0
  53. package/dist/gateway/static/root/assets/note-image-lightbox-DUzoWZEe.js +1 -0
  54. package/dist/gateway/static/root/assets/notes-api-BMSPkAm8.js +1 -0
  55. package/dist/gateway/static/root/assets/notes-page-nvqpOeHp.js +8 -0
  56. package/dist/gateway/static/root/assets/{oauth-provider-connect-BW7zcXfb.js → oauth-provider-connect-BexlZuZ4.js} +1 -1
  57. package/dist/gateway/static/root/assets/{page-context-capture-button-Cw58-5P3.js → page-context-capture-button-Cn4zi3Mt.js} +1 -1
  58. package/dist/gateway/static/root/assets/page-header-store-1-lflHAx.js +1 -0
  59. package/dist/gateway/static/root/assets/personal-avatar-CM3vUGhL.js +1 -0
  60. package/dist/gateway/static/root/assets/personal-avatar-DsEp8QJ7.css +1 -0
  61. package/dist/gateway/static/root/assets/personal-page-HFjWZacf.js +1 -0
  62. package/dist/gateway/static/root/assets/{personal-profile-settings-CDrzvI35.js → personal-profile-settings-CNI5Eor6.js} +1 -1
  63. package/dist/gateway/static/root/assets/{personal-settings-panel-CoZ3qWSr.js → personal-settings-panel-BcrpYRn9.js} +1 -1
  64. package/dist/gateway/static/root/assets/{phone-model-connection-UHVwbC3H.js → phone-model-connection-DKvOEjWH.js} +1 -1
  65. package/dist/gateway/static/root/assets/{phone-settings-page-fS2IT-dK.js → phone-settings-page-DvX6okzz.js} +1 -1
  66. package/dist/gateway/static/root/assets/playback-coordinator-CWHIf0wr.js +1 -0
  67. package/dist/gateway/static/root/assets/presentation-D-Ui_vVA.js +1 -0
  68. package/dist/gateway/static/root/assets/preview-runtime-RnBDP-Lq.js +15 -0
  69. package/dist/gateway/static/root/assets/product-automation-feedback-xAcXeJM2.js +7 -0
  70. package/dist/gateway/static/root/assets/product-delivery-4gEqUIsK.js +1 -0
  71. package/dist/gateway/static/root/assets/{product-open-page-BMJ2x5m3.js → product-open-page-DXwOPgRP.js} +1 -1
  72. package/dist/gateway/static/root/assets/{product-preview-content-lkkZPvMa.js → product-preview-content-DiQbeaCK.js} +1 -1
  73. package/dist/gateway/static/root/assets/{product-preview-modal-DtUBJGs5.js → product-preview-modal-BU7Qojpq.js} +2 -2
  74. package/dist/gateway/static/root/assets/project-detail-page-Dr5_WPRB.js +7 -0
  75. package/dist/gateway/static/root/assets/{projects-page-Dua6taaG.js → projects-page-DGATZB23.js} +1 -1
  76. package/dist/gateway/static/root/assets/{providers-api-B6eZLEnh.js → providers-api-BXa2Aheb.js} +1 -1
  77. package/dist/gateway/static/root/assets/recording-upload-CQdhrRq3.js +1 -0
  78. package/dist/gateway/static/root/assets/{remote-access-hub-Dy3-oGK1.js → remote-access-hub-_7tmWand.js} +1 -1
  79. package/dist/gateway/static/root/assets/right-workspace-store-NXMrEuwH.js +1 -0
  80. package/dist/gateway/static/root/assets/route-preload-D-pdVwIK.js +2 -0
  81. package/dist/gateway/static/root/assets/routine-panel-rjq-8nZ8.js +2 -0
  82. package/dist/gateway/static/root/assets/scan-search-CSIGkseh.js +1 -0
  83. package/dist/gateway/static/root/assets/{service-recommendation-list-CsU74h1b.js → service-recommendation-list-2UOjV0Mx.js} +1 -1
  84. package/dist/gateway/static/root/assets/session-manager-BVS3zxRZ.js +22 -0
  85. package/dist/gateway/static/root/assets/{settings-page-ByFNIBfp.js → settings-page-bCW4rave.js} +1 -1
  86. package/dist/gateway/static/root/assets/{setup-interaction-page-Bsn4Wa4p.js → setup-interaction-page-BYXDX0F2.js} +1 -1
  87. package/dist/gateway/static/root/assets/{setup-status-panel-CstjOb7g.js → setup-status-panel-Bhda3jS2.js} +1 -1
  88. package/dist/gateway/static/root/assets/share-preview-page-nzWjWhqF.js +2 -0
  89. package/dist/gateway/static/root/assets/shares-settings-LB3SYKFS.js +1 -0
  90. package/dist/gateway/static/root/assets/sheet-C2H8iR8Y.js +1 -0
  91. package/dist/gateway/static/root/assets/{skills-page-CkkHufmv.js → skills-page-CfhEcU8L.js} +1 -1
  92. package/dist/gateway/static/root/assets/space-api-DaKpHc_7.js +1 -0
  93. package/dist/gateway/static/root/assets/space-page-BXyQdUvp.js +2 -0
  94. package/dist/gateway/static/root/assets/star-BuMAkjC9.js +1 -0
  95. package/dist/gateway/static/root/assets/task-detail-page-gffrDRvW.js +3 -0
  96. package/dist/gateway/static/root/assets/task-header-title-DwtjUOBg.js +1 -0
  97. package/dist/gateway/static/root/assets/{task-result-evidence-dtN1sSjU.js → task-result-evidence-Bmgta9z9.js} +1 -1
  98. package/dist/gateway/static/root/assets/tasks-BIehlq7k.js +1 -0
  99. package/dist/gateway/static/root/assets/turn-outcome-BSbEJx8h.js +1 -0
  100. package/dist/gateway/static/root/assets/use-composer-attachments-sszsCdh5.js +2 -0
  101. package/dist/gateway/static/root/assets/use-file-preview-expanded-D4b4fDeu.js +1 -0
  102. package/dist/gateway/static/root/assets/use-personal-profile-CNPszzzT.js +1 -0
  103. package/dist/gateway/static/root/assets/use-personal-work-C-rw8XVO.js +1 -0
  104. package/dist/gateway/static/root/assets/{use-realtime-voice-lRHVixh4.js → use-realtime-voice-cugjs8cK.js} +1 -1
  105. package/dist/gateway/static/root/assets/{use-workspace-tree-DrWnW1aA.js → use-workspace-tree-Crfx5ctU.js} +1 -1
  106. package/dist/gateway/static/root/assets/{user-model-page-Bw1_PGdD.js → user-model-page-BvnLbTYx.js} +1 -1
  107. package/dist/gateway/static/root/assets/video-generation-Cec49Jwg.js +1 -0
  108. package/dist/gateway/static/root/assets/voice-player-store-DZGlzjva.js +1 -0
  109. package/dist/gateway/static/root/assets/voice-settings-BzfNK5Jm.js +1 -0
  110. package/dist/gateway/static/root/assets/{work-discovery-overlay-DcZS4OMj.js → work-discovery-overlay-DpEYgcG2.js} +1 -1
  111. package/dist/gateway/static/root/assets/{work-discovery-page-CZF9iWPT.js → work-discovery-page-DappIHQq.js} +1 -1
  112. package/dist/gateway/static/root/assets/workspace-api-g-wCKoQU.js +2 -0
  113. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-DxaxVC3q.js +1 -0
  114. package/dist/gateway/static/root/assets/workspace-preview-store-DoIjn_2j.js +1 -0
  115. package/dist/gateway/static/root/index.html +90 -77
  116. package/dist/package.js +1 -1
  117. package/dist/packages/gateway-contract/src/automations.js +7 -0
  118. package/dist/packages/gateway-contract/src/capabilities.js +1 -1
  119. package/dist/packages/gateway-contract/src/clarifications.js +20 -2
  120. package/dist/packages/gateway-contract/src/index.js +6 -4
  121. package/dist/packages/gateway-contract/src/space.js +23 -0
  122. package/dist/packages/gateway-contract/src/task-lifecycle.js +1 -0
  123. package/dist/packages/gateway-contract/src/task-result-delivery.js +1 -0
  124. package/dist/packages/gateway-contract/src/task-runs.js +1 -0
  125. package/dist/packages/gateway-contract/src/tasks.js +118 -6
  126. package/dist/packages/gateway-contract/src/turn-outcome.js +16 -2
  127. package/dist/packages/gateway-contract/src/video-generation.js +29 -4
  128. package/dist/src/agent/agent-manager.js +2 -2
  129. package/dist/src/agent/embedded/agent-profile-context.js +1 -1
  130. package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
  131. package/dist/src/agent/orchestration/delegation-budget.d.ts +2 -2
  132. package/dist/src/agent/orchestration/turn-recovery.d.ts +12 -3
  133. package/dist/src/agent/orchestration/turn-recovery.js +25 -6
  134. package/dist/src/agent/service/process-direct-streaming.js +1 -1
  135. package/dist/src/agent/service/webchat-tts.js +1 -1
  136. package/dist/src/agent/service.js +1 -1
  137. package/dist/src/agent/tasks/task-judge-service.js +1 -1
  138. package/dist/src/agent/tools/apply-patch.js +1 -1
  139. package/dist/src/agent/tools/factory.js +1 -1
  140. package/dist/src/agent/tools/image-generate-tool.js +1 -0
  141. package/dist/src/agent/tools/language-diagnostics.js +1 -1
  142. package/dist/src/agent/tools/personal-task-tool.d.ts +1 -0
  143. package/dist/src/agent/tools/personal-task-tool.js +12 -7
  144. package/dist/src/agent/tools/publish-artifacts.js +2 -1
  145. package/dist/src/agent/tools/review-workspace.js +1 -1
  146. package/dist/src/agent/tools/send-media.js +1 -0
  147. package/dist/src/agent/tools/tool-media.d.ts +3 -1
  148. package/dist/src/agent/tools/tool-media.js +2 -0
  149. package/dist/src/agent/tools/xopc-use-tool.js +21 -4
  150. package/dist/src/agent-catalog/test-support.js +1 -1
  151. package/dist/src/agent-matching/delegation-service.js +1 -1
  152. package/dist/src/automations/capabilities/drafts.js +1 -1
  153. package/dist/src/automations/capabilities/write.d.ts +30 -6
  154. package/dist/src/automations/capabilities/write.js +2 -2
  155. package/dist/src/automations/configuration-conversation.js +1 -1
  156. package/dist/src/automations/domain/types.d.ts +6 -0
  157. package/dist/src/automations/domain/validation.d.ts +60 -12
  158. package/dist/src/automations/domain/validation.js +7 -0
  159. package/dist/src/automations/draft/automation-draft-validator.d.ts +12 -3
  160. package/dist/src/automations/draft/automation-draft-validator.js +1 -0
  161. package/dist/src/automations/service/action-executor.js +14 -2
  162. package/dist/src/automations/service/automation-service.js +2 -2
  163. package/dist/src/browser/providers/browser-ext-install.js +1 -1
  164. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  165. package/dist/src/computer/diagnostics.d.ts +9 -9
  166. package/dist/src/computer/errors.d.ts +2 -2
  167. package/dist/src/computer/evaluation.d.ts +7 -7
  168. package/dist/src/computer/runtime.d.ts +4 -4
  169. package/dist/src/config/schema.d.ts +2 -2
  170. package/dist/src/discussions/action-tasks.d.ts +2 -2
  171. package/dist/src/execution-environments/local-worktree-manager.js +1 -1
  172. package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -2
  173. package/dist/src/extensions/agent-plugins/setup.d.ts +3 -3
  174. package/dist/src/gateway/hono/routes/commands-skills.js +1 -1
  175. package/dist/src/gateway/hono/routes/connectors.js +2 -2
  176. package/dist/src/gateway/hono/routes/context-sources.js +1 -1
  177. package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
  178. package/dist/src/gateway/hono/routes/music-generation.js +2 -0
  179. package/dist/src/gateway/hono/routes/personal-agent.js +214 -5
  180. package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
  181. package/dist/src/gateway/hono/routes/space.d.ts +3 -0
  182. package/dist/src/gateway/hono/routes/space.js +105 -0
  183. package/dist/src/gateway/hono/routes/tasks.js +27 -28
  184. package/dist/src/gateway/hono/routes/video-generation.js +8 -5
  185. package/dist/src/gateway/html-preview-shell.d.ts +1 -1
  186. package/dist/src/gateway/html-preview-shell.js +3 -0
  187. package/dist/src/gateway/media-access.js +2 -2
  188. package/dist/src/gateway/security/gateway-scopes.js +2 -0
  189. package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
  190. package/dist/src/gateway/service.d.ts +1 -0
  191. package/dist/src/gateway/service.js +10 -3
  192. package/dist/src/gateway/session-context-summary.js +1 -1
  193. package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +2 -0
  194. package/dist/src/gateway/xopc-cloud-capability-setup.js +18 -1
  195. package/dist/src/home-intelligence/follow-ups.js +2 -1
  196. package/dist/src/home-intelligence/routines.js +1 -1
  197. package/dist/src/local-apps/automation-proposals.d.ts +54 -12
  198. package/dist/src/local-apps/capabilities/projections.d.ts +7 -7
  199. package/dist/src/local-apps/preview-fixtures.d.ts +1 -1
  200. package/dist/src/media/session-references.d.ts +4 -1
  201. package/dist/src/media/session-references.js +40 -8
  202. package/dist/src/music-generation/artifact.js +3 -1
  203. package/dist/src/music-generation/providers.js +26 -15
  204. package/dist/src/music-generation/repository.js +8 -1
  205. package/dist/src/music-generation/xopc-cloud.d.ts +2 -0
  206. package/dist/src/music-generation/xopc-cloud.js +38 -0
  207. package/dist/src/personal-agent/capability-service.js +1 -1
  208. package/dist/src/personal-agent/proactivity/service.js +1 -1
  209. package/dist/src/personal-agent/prompt-context.js +1 -1
  210. package/dist/src/personal-agent/prompts.js +1 -1
  211. package/dist/src/personal-agent/reply-composer.js +16 -7
  212. package/dist/src/personal-agent/repository.js +1 -1
  213. package/dist/src/personal-agent/request-delivery.js +17 -7
  214. package/dist/src/personal-agent/request-service.js +6 -10
  215. package/dist/src/personal-agent/result-extraction.js +13 -13
  216. package/dist/src/personal-agent/schedules.d.ts +9 -0
  217. package/dist/src/personal-agent/schedules.js +44 -0
  218. package/dist/src/personal-agent/service.js +1 -1
  219. package/dist/src/providers/model-catalog-persistence.js +6 -1
  220. package/dist/src/providers/model-catalog-store.js +1 -0
  221. package/dist/src/providers/model-catalog-types.d.ts +2 -0
  222. package/dist/src/providers/xopc-cloud-media-manifest.d.ts +24 -0
  223. package/dist/src/providers/xopc-cloud-media-manifest.js +28 -0
  224. package/dist/src/providers/xopc-cloud-media.d.ts +28 -0
  225. package/dist/src/providers/xopc-cloud-media.js +67 -0
  226. package/dist/src/providers/xopc-cloud-model-source.js +4 -0
  227. package/dist/src/runtime-tools/archive.js +1 -1
  228. package/dist/src/runtime-tools/manager.js +1 -1
  229. package/dist/src/runtime-tools/phone-dependencies.js +1 -1
  230. package/dist/src/session/client-history.d.ts +4 -1
  231. package/dist/src/session/client-history.js +18 -0
  232. package/dist/src/session/compact-history.js +30 -1
  233. package/dist/src/session/turn-outcome-projector.js +1 -1
  234. package/dist/src/space/ingest.d.ts +36 -0
  235. package/dist/src/space/ingest.js +149 -0
  236. package/dist/src/space/repository.d.ts +39 -0
  237. package/dist/src/space/repository.js +325 -0
  238. package/dist/src/space/worker.d.ts +14 -0
  239. package/dist/src/space/worker.js +199 -0
  240. package/dist/src/storage/sqlite/clarification-wait-repository.js +7 -4
  241. package/dist/src/storage/sqlite/row-mappers.d.ts +1 -0
  242. package/dist/src/storage/sqlite/row-mappers.js +9 -2
  243. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  244. package/dist/src/storage/sqlite/schema.js +8 -7
  245. package/dist/src/storage/sqlite/schema.sql +103 -0
  246. package/dist/src/storage/sqlite/transcript-repository.js +8 -0
  247. package/dist/src/storage/sqlite/upgrades/279_task_model_cutover.sql +288 -0
  248. package/dist/src/storage/sqlite/upgrades/280_space.sql +61 -0
  249. package/dist/src/tasks/capabilities/management.d.ts +15 -2
  250. package/dist/src/tasks/capabilities/management.js +8 -2
  251. package/dist/src/tasks/capabilities/read.js +14 -2
  252. package/dist/src/tasks/capabilities/relations.d.ts +13 -7
  253. package/dist/src/tasks/capabilities/write.d.ts +118 -2
  254. package/dist/src/tasks/capabilities/write.js +2 -0
  255. package/dist/src/tasks/home-query-service.js +7 -9
  256. package/dist/src/tasks/task-allocation-service.js +2 -2
  257. package/dist/src/tasks/task-application-service.d.ts +8 -2
  258. package/dist/src/tasks/task-application-service.js +94 -27
  259. package/dist/src/tasks/task-collaboration-repository.js +12 -1
  260. package/dist/src/tasks/task-context-assembler.js +9 -3
  261. package/dist/src/tasks/task-contract-planner.js +1 -3
  262. package/dist/src/tasks/task-conversation-summary.d.ts +33 -2
  263. package/dist/src/tasks/task-conversation-summary.js +3 -1
  264. package/dist/src/tasks/task-criterion-review-repository.d.ts +31 -2
  265. package/dist/src/tasks/task-criterion-review-repository.js +70 -23
  266. package/dist/src/tasks/task-deliverables.d.ts +7 -0
  267. package/dist/src/tasks/task-deliverables.js +112 -0
  268. package/dist/src/tasks/task-handoff-service.js +1 -1
  269. package/dist/src/tasks/task-instruction-sequence.js +10 -3
  270. package/dist/src/tasks/task-json-acceptance.js +3 -5
  271. package/dist/src/tasks/task-origin-repository.d.ts +99 -1
  272. package/dist/src/tasks/task-origin-repository.js +67 -5
  273. package/dist/src/tasks/task-read-model-projector.d.ts +4 -1
  274. package/dist/src/tasks/task-read-model-projector.js +123 -9
  275. package/dist/src/tasks/task-repository.d.ts +4 -1
  276. package/dist/src/tasks/task-repository.js +34 -11
  277. package/dist/src/tasks/task-research-repair.d.ts +2 -2
  278. package/dist/src/tasks/task-research-result.d.ts +1 -0
  279. package/dist/src/tasks/task-research-result.js +13 -3
  280. package/dist/src/tasks/task-result-delivery-repository.d.ts +4 -3
  281. package/dist/src/tasks/task-result-delivery-repository.js +35 -17
  282. package/dist/src/tasks/task-result-delivery-service.js +22 -7
  283. package/dist/src/tasks/task-result-versions.d.ts +11 -0
  284. package/dist/src/tasks/task-result-versions.js +34 -0
  285. package/dist/src/tasks/task-run-coordinator.js +28 -15
  286. package/dist/src/tasks/task-run-dispatcher.js +29 -4
  287. package/dist/src/tasks/task-run-repository.d.ts +2 -0
  288. package/dist/src/tasks/task-run-repository.js +62 -19
  289. package/dist/src/tasks/task-workspace-verification.d.ts +16 -0
  290. package/dist/src/tasks/task-workspace-verification.js +95 -0
  291. package/dist/src/tui/backends/embedded-backend.js +2 -2
  292. package/dist/src/video-generation/artifact.js +3 -1
  293. package/dist/src/video-generation/drafts.js +4 -0
  294. package/dist/src/video-generation/providers.d.ts +1 -0
  295. package/dist/src/video-generation/providers.js +37 -5
  296. package/dist/src/video-generation/repository.js +8 -1
  297. package/dist/src/video-generation/settings.d.ts +1 -0
  298. package/dist/src/video-generation/settings.js +10 -4
  299. package/dist/src/voice/realtime/runtime.js +1 -1
  300. package/package.json +1 -1
  301. package/dist/gateway/static/root/assets/attachment-preview-renderer-DdOEgexg.js +0 -12
  302. package/dist/gateway/static/root/assets/attachment-utils-core-BIOUBrpT.js +0 -1
  303. package/dist/gateway/static/root/assets/automations-workspace-BWpA-X_S.js +0 -9
  304. package/dist/gateway/static/root/assets/binary-plugins-BjEE5sVq.js +0 -2
  305. package/dist/gateway/static/root/assets/capabilities-EmBa4Blq.js +0 -1
  306. package/dist/gateway/static/root/assets/capabilities-page-BQf7oyqc.js +0 -2
  307. package/dist/gateway/static/root/assets/capabilities-settings-panel-hlByP8SE.js +0 -8
  308. package/dist/gateway/static/root/assets/channels-oyMymJDx.js +0 -1
  309. package/dist/gateway/static/root/assets/chat-page-hcsqrv-7.js +0 -71
  310. package/dist/gateway/static/root/assets/constants-Bg1wM2nv.js +0 -1
  311. package/dist/gateway/static/root/assets/extension-authoritative-grants-CVQ7q0DU.js +0 -1
  312. package/dist/gateway/static/root/assets/file-tree-CFlZnV3Y.js +0 -1
  313. package/dist/gateway/static/root/assets/index-DFa0pZhC.js +0 -11
  314. package/dist/gateway/static/root/assets/index-DHPaL7Ku.css +0 -1
  315. package/dist/gateway/static/root/assets/local-app-workbench-page-OSinc6m6.js +0 -1
  316. package/dist/gateway/static/root/assets/local-apps-DeqzkJiF.js +0 -1
  317. package/dist/gateway/static/root/assets/logs-page-BJxQ_Jd5.js +0 -2
  318. package/dist/gateway/static/root/assets/models-hub-cache-CmdULYFt.js +0 -1
  319. package/dist/gateway/static/root/assets/note-detail-panel-CVEG1JdF.js +0 -7
  320. package/dist/gateway/static/root/assets/note-image-lightbox-WA8FiHsm.js +0 -1
  321. package/dist/gateway/static/root/assets/notes-api-BQXOYFQ5.js +0 -1
  322. package/dist/gateway/static/root/assets/notes-page-Cc-c1Yhg.js +0 -8
  323. package/dist/gateway/static/root/assets/page-header-store-DwFwq_lI.js +0 -1
  324. package/dist/gateway/static/root/assets/personal-avatar-B-Oes3ef.js +0 -1
  325. package/dist/gateway/static/root/assets/personal-avatar-BUCb7OiW.css +0 -1
  326. package/dist/gateway/static/root/assets/personal-page-DWPu-iwK.js +0 -1
  327. package/dist/gateway/static/root/assets/phone-DdhTnt6X.js +0 -1
  328. package/dist/gateway/static/root/assets/product-automation-feedback-DrBclzH1.js +0 -7
  329. package/dist/gateway/static/root/assets/product-delivery-CnvCn9L-.js +0 -1
  330. package/dist/gateway/static/root/assets/project-detail-page-DGFUj6jS.js +0 -7
  331. package/dist/gateway/static/root/assets/recording-upload-DXxD6grq.js +0 -1
  332. package/dist/gateway/static/root/assets/right-workspace-store-BzXnZDK5.js +0 -1
  333. package/dist/gateway/static/root/assets/route-preload-8KCgPcjp.js +0 -2
  334. package/dist/gateway/static/root/assets/routine-panel-BALhliq6.js +0 -2
  335. package/dist/gateway/static/root/assets/session-manager-Cby6Nkib.js +0 -25
  336. package/dist/gateway/static/root/assets/share-preview-page-9pOnypJv.js +0 -2
  337. package/dist/gateway/static/root/assets/shares-settings-CJdVDQqf.js +0 -1
  338. package/dist/gateway/static/root/assets/star-CnYNmpLd.js +0 -1
  339. package/dist/gateway/static/root/assets/task-detail-page-BjBkKeIf.js +0 -3
  340. package/dist/gateway/static/root/assets/tasks-BTLabOMp.js +0 -1
  341. package/dist/gateway/static/root/assets/use-composer-attachments-BEYkb8cs.js +0 -2
  342. package/dist/gateway/static/root/assets/use-file-preview-expanded-CQeo2Ztn.js +0 -15
  343. package/dist/gateway/static/root/assets/use-personal-profile-CKm5FaTl.js +0 -1
  344. package/dist/gateway/static/root/assets/video-generation-D08uZbsu.js +0 -1
  345. package/dist/gateway/static/root/assets/voice-settings-CssuMBjt.js +0 -1
  346. package/dist/gateway/static/root/assets/with-selector-xonYxPoM.js +0 -1
  347. package/dist/gateway/static/root/assets/workspace-api-BfApIXLw.js +0 -2
  348. package/dist/gateway/static/root/assets/workspace-file-preview-dialog-BRhsCs1S.js +0 -1
  349. package/dist/gateway/static/root/assets/workspace-preview-store-BrofEVle.js +0 -1
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,t as r}from"./vendor-react-BOUWij0V.js";import{m as i}from"./chunk-KS7C4IRE-CiwuuyV8.js";import{i as a,l as o,n as s,o as c}from"./locale-store-Cit_aHqC.js";import{t as l}from"./messages-DQveK9sk.js";import{a as u,n as d,o as f,r as p,s as m,t as h}from"./dist-CY7CS_D3.js";import{t as g}from"./check-DUBLcKHA.js";import{t as _}from"./chevron-down-ccbiQQz_.js";import{n as v,r as y}from"./popover-select-CLsphyzA.js";import{i as b}from"./file-tree-utils-DJs1faGv.js";import{t as x}from"./cloud-C4-yfnnk.js";import{t as S}from"./copy-Dv6d4Dvw.js";import{t as C}from"./file-tree-CFlZnV3Y.js";import{t as w}from"./file-text-D12HbeVy.js";import{t as T}from"./folder-open-CyzJ19I9.js";import{t as E}from"./history-DXH_9jsE.js";import{t as D}from"./loader-circle-CifKLtgG.js";import{t as O}from"./message-square-fVE7Ghj1.js";import{t as k}from"./plus-Q2yW6OE7.js";import{t as ee}from"./refresh-cw-BRlGaq2w.js";import{t as A}from"./sticky-note-fzP7NAJq.js";import{t as j}from"./trash-2-DusmjVPV.js";import{n as M,r as N,t as P}from"./share-link-dialog-BxFk4-4u.js";import{t as F}from"./x-B_N4OPjy.js";import{t as I}from"./cn-0WouolD0.js";import{t as L}from"./skeleton-DzdOeGYz.js";import{i as te}from"./vendor-swr-CdRzEUwF.js";import{n as R,r as z}from"./gateway-config-swr-DVXDJNCI.js";import{o as B}from"./agents-admin-api-BL8lN8gP.js";import{t as V}from"./button-Cc4hUNTt.js";import{t as H}from"./copy-to-clipboard-HOJ79TWv.js";import{s as U}from"./form-field-width-DJw_jULe.js";import{t as W}from"./page-tabs-oeTY7z3_.js";import{n as ne}from"./agent-display-names-Bje7vfSn.js";import{r as re}from"./settings-form-draft-Dy10ldo8.js";import{t as G}from"./confirm-dialog-DrA5mTQp.js";import{a as K,b as ie,c as ae,g as oe,l as se,m as ce,o as le,r as ue,t as de,v as fe,x as pe}from"./shares-api-ChBHTPKN.js";import{t as me}from"./use-workspace-tree-DrWnW1aA.js";import{t as he}from"./workspace-editor-agent-store-DwpWKogz.js";import{t as ge}from"./settings-loading-skeleton-CAoOV17i.js";import{t as _e}from"./oauth-provider-connect-BW7zcXfb.js";import{t as ve}from"./number-input-El7Szeln.js";import{n as ye,t as be}from"./settings-page-header-B9Y_eGcH.js";import{t as q}from"./settings-page-layout-D1MgJ5zP.js";import{t as J}from"./settings-form-section-num14vSv.js";var Y=e(t(),1),xe=n(),X={enabled:!0,defaultTtlHours:24,maxTtlDays:30,maxActiveShares:500,maxFileSizeMb:500,directoryMaxFolderSizeMb:2048,directoryMaxFileCount:1e4,inlinePreviewMimes:[`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`image/svg+xml`,`application/pdf`,`text/html`,`text/markdown`,`text/plain`,`application/json`],noteEnabled:!0,noteMaxTotalSizeMb:250,noteMaxAttachmentCount:50,siteEnabled:!0,siteDefaultTtlHours:24,siteMaxTtlDays:30,maxActiveSites:50,siteMaxRootDirSizeMb:1024,siteMaxFileCount:2e4};function Se(){return structuredClone(X)}var Z=36e5,Ce=864e5,Q=1048576;function we(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Te(e,t=32){return Array.isArray(e)?e.filter(e=>typeof e==`string`&&e.trim().length>0).map(e=>e.trim()).slice(0,t):[]}function Ee(e){let t=we(e)?e:{},n=we(t.gateway)?t.gateway:{},r=we(n.share)?n.share:{},i=we(r.directory)?r.directory:{},a=we(r.note)?r.note:{},o=we(n.siteShare)?n.siteShare:{},s=we(o.static)?o.static:{},c=typeof r.defaultTtlMs==`number`&&Number.isFinite(r.defaultTtlMs)?Math.floor(r.defaultTtlMs):X.defaultTtlHours*Z,l=typeof r.maxTtlMs==`number`&&Number.isFinite(r.maxTtlMs)?Math.floor(r.maxTtlMs):X.maxTtlDays*Ce,u=typeof r.maxFileSize==`number`&&Number.isFinite(r.maxFileSize)?Math.floor(r.maxFileSize):X.maxFileSizeMb*Q,d=typeof i.maxFolderSize==`number`&&Number.isFinite(i.maxFolderSize)?Math.floor(i.maxFolderSize):X.directoryMaxFolderSizeMb*Q,f=typeof o.defaultTtlMs==`number`&&Number.isFinite(o.defaultTtlMs)?Math.floor(o.defaultTtlMs):X.siteDefaultTtlHours*Z,p=typeof o.maxTtlMs==`number`&&Number.isFinite(o.maxTtlMs)?Math.floor(o.maxTtlMs):X.siteMaxTtlDays*Ce,m=typeof s.maxRootDirSize==`number`&&Number.isFinite(s.maxRootDirSize)?Math.floor(s.maxRootDirSize):X.siteMaxRootDirSizeMb*Q,h=typeof a.maxTotalSize==`number`&&Number.isFinite(a.maxTotalSize)?Math.floor(a.maxTotalSize):X.noteMaxTotalSizeMb*Q;return{enabled:r.enabled!==!1,defaultTtlHours:Math.max(1,Math.round(c/Z)),maxTtlDays:Math.max(1,Math.round(l/Ce)),maxActiveShares:typeof r.maxActiveShares==`number`&&Number.isFinite(r.maxActiveShares)?Math.max(1,Math.min(1e4,Math.floor(r.maxActiveShares))):X.maxActiveShares,maxFileSizeMb:Math.max(1,Math.round(u/Q)),directoryMaxFolderSizeMb:Math.max(1,Math.round(d/Q)),directoryMaxFileCount:typeof i.maxFileCount==`number`&&Number.isFinite(i.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(i.maxFileCount))):X.directoryMaxFileCount,inlinePreviewMimes:Te(r.inlinePreviewMimes,32).length?Te(r.inlinePreviewMimes,32):[...X.inlinePreviewMimes],noteEnabled:a.enabled!==!1,noteMaxTotalSizeMb:Math.max(1,Math.round(h/Q)),noteMaxAttachmentCount:typeof a.maxAttachmentCount==`number`&&Number.isFinite(a.maxAttachmentCount)?Math.max(0,Math.min(500,Math.floor(a.maxAttachmentCount))):X.noteMaxAttachmentCount,siteEnabled:o.enabled!==!1,siteDefaultTtlHours:Math.max(1,Math.round(f/Z)),siteMaxTtlDays:Math.max(1,Math.round(p/Ce)),maxActiveSites:typeof o.maxActiveSites==`number`&&Number.isFinite(o.maxActiveSites)?Math.max(1,Math.min(1e3,Math.floor(o.maxActiveSites))):X.maxActiveSites,siteMaxRootDirSizeMb:Math.max(1,Math.round(m/Q)),siteMaxFileCount:typeof s.maxFileCount==`number`&&Number.isFinite(s.maxFileCount)?Math.max(1,Math.min(1e5,Math.floor(s.maxFileCount))):X.siteMaxFileCount}}function De(e){let t=e.defaultTtlHours*Z,n=e.maxTtlDays*Ce,r=e.siteDefaultTtlHours*Z,i=e.siteMaxTtlDays*Ce;return t<6e4||t>6048e5?`Default share TTL must be between 1 minute and 7 days.`:n<6e4||n>2592e6?`Maximum share TTL must be between 1 minute and 30 days.`:t>n?`Default TTL cannot exceed maximum TTL.`:e.maxActiveShares<1||e.maxActiveShares>1e4?`Maximum active shares must be between 1 and 10,000.`:e.maxActiveSites<1||e.maxActiveSites>1e3?`Maximum active site shares must be between 1 and 1,000.`:e.maxFileSizeMb<1||e.maxFileSizeMb>10240?`Maximum file size must be between 1 MB and 10 GB.`:e.directoryMaxFolderSizeMb<1||e.directoryMaxFolderSizeMb>10240?`Maximum folder size must be between 1 MB and 10 GB.`:e.directoryMaxFileCount<1||e.directoryMaxFileCount>1e5?`Maximum directory file count must be between 1 and 100,000.`:e.noteMaxTotalSizeMb<1||e.noteMaxTotalSizeMb>2048?`Maximum Note snapshot size must be between 1 MB and 2 GB.`:e.noteMaxAttachmentCount<0||e.noteMaxAttachmentCount>500?`Maximum Note attachment count must be between 0 and 500.`:r<6e4||r>6048e5?`Default site share TTL must be between 1 minute and 7 days.`:i<6e4||i>2592e6?`Maximum site share TTL must be between 1 minute and 30 days.`:r>i?`Default site TTL cannot exceed maximum site TTL.`:e.siteMaxRootDirSizeMb<1||e.siteMaxRootDirSizeMb>10240?`Maximum static site size must be between 1 MB and 10 GB.`:e.siteMaxFileCount<1||e.siteMaxFileCount>1e5?`Maximum static site file count must be between 1 and 100,000.`:null}async function Oe(e){let t=De(e);if(t)throw Error(t);await c(a(`/api/config`),{method:`PATCH`,body:JSON.stringify({gateway:{share:{enabled:e.enabled,defaultTtlMs:e.defaultTtlHours*Z,maxTtlMs:e.maxTtlDays*Ce,maxActiveShares:e.maxActiveShares,maxFileSize:e.maxFileSizeMb*Q,inlinePreviewMimes:e.inlinePreviewMimes,directory:{maxFolderSize:e.directoryMaxFolderSizeMb*Q,maxFileCount:e.directoryMaxFileCount},note:{enabled:e.noteEnabled,maxTotalSize:e.noteMaxTotalSizeMb*Q,maxAttachmentCount:e.noteMaxAttachmentCount}},siteShare:{enabled:e.siteEnabled,defaultTtlMs:e.siteDefaultTtlHours*Z,maxTtlMs:e.siteMaxTtlDays*Ce,maxActiveSites:e.maxActiveSites,static:{maxRootDirSize:e.siteMaxRootDirSizeMb*Q,maxFileCount:e.siteMaxFileCount}}}})}),R()}var $=r();function ke(){return I(`w-full rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg`,`placeholder:text-fg-subtle`,U,`dark:border-edge`)}function Ae({hasToken:e}){let t=l(s(e=>e.language)).sharesSettings,{data:n,isLoading:r}=z(e),i=(0,Y.useMemo)(()=>n?.payload?.config===void 0?null:structuredClone(Ee(n.payload.config)),[n]),a=(0,Y.useRef)(!1),[o,c]=(0,Y.useState)(null),[u,d]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(null),[m,h]=(0,Y.useState)(!1),g=o??i,_=i,v=(0,Y.useMemo)(()=>!g||!_?!1:JSON.stringify(g)!==JSON.stringify(_),[g,_]),y=(0,Y.useCallback)(e=>{a.current=!0,c(t=>{let n=t??_;return n?{...n,...e}:null})},[_]),b=(0,Y.useCallback)(async()=>{if(!(!g||u)){d(!0),p(null),h(!1);try{await Oe(g),a.current=!1,c(null),h(!0),window.setTimeout(()=>h(!1),2500)}catch(e){p(e instanceof Error?e.message:t.policySaveError)}finally{d(!1)}}},[g,u,t.policySaveError]),x=(0,Y.useCallback)(()=>{a.current=!1,c(null),p(null),h(!1)},[]);return!e||!g?r?(0,$.jsx)(J,{children:(0,$.jsx)(ge,{rows:2})}):null:(0,$.jsxs)(J,{children:[(0,$.jsxs)(`div`,{className:`mb-4 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between`,children:[(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:t.policyTitle}),(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:t.policyHint})]}),(0,$.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center gap-2`,children:[m?(0,$.jsx)(`span`,{className:`text-sm text-fg-muted`,children:t.policySaved}):null,(0,$.jsx)(V,{type:`button`,variant:`secondary`,disabled:u,onClick:()=>y(Se()),children:t.policyUseRecommended}),(0,$.jsx)(V,{type:`button`,variant:`secondary`,disabled:!v||u,onClick:x,children:t.policyDiscard}),(0,$.jsx)(V,{type:`button`,variant:`primary`,disabled:!v||u,onClick:()=>void b(),children:u?t.policySaving:t.policySave})]})]}),v?(0,$.jsx)(`p`,{className:`mb-3 text-xs text-amber-800 dark:text-amber-200`,children:t.policyUnsaved}):null,f?(0,$.jsx)(`p`,{className:`mb-3 text-sm text-red-600 dark:text-red-400`,children:f}):null,(0,$.jsx)(`p`,{className:`mb-4 text-xs text-fg-subtle`,children:t.policyRestartHint}),(0,$.jsx)(je,{t,form:g,onChange:y})]})}function je(e){let t=(0,xe.c)(189),{t:n,form:r,onChange:i}=e,a;t[0]===n.policyFileSection?a=t[1]:(a=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyFileSection}),t[0]=n.policyFileSection,t[1]=a);let o;t[2]===n.policyFileSectionHint?o=t[3]:(o=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyFileSectionHint}),t[2]=n.policyFileSectionHint,t[3]=o);let s;t[4]!==a||t[5]!==o?(s=(0,$.jsxs)(`div`,{className:`mb-4`,children:[a,o]}),t[4]=a,t[5]=o,t[6]=s):s=t[6];let c;t[7]===i?c=t[8]:(c=e=>i({enabled:e.target.checked}),t[7]=i,t[8]=c);let l;t[9]!==r.enabled||t[10]!==c?(l=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.enabled,onChange:c}),t[9]=r.enabled,t[10]=c,t[11]=l):l=t[11];let u;t[12]!==n.policyEnabled||t[13]!==l?(u=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[l,n.policyEnabled]}),t[12]=n.policyEnabled,t[13]=l,t[14]=u):u=t[14];let d=!r.enabled,f;t[15]===i?f=t[16]:(f=e=>i({defaultTtlHours:e}),t[15]=i,t[16]=f);let p;t[17]!==r.defaultTtlHours||t[18]!==n.policyDefaultTtlHint||t[19]!==n.policyDefaultTtlHours||t[20]!==d||t[21]!==f?(p=(0,$.jsx)(Me,{id:`share-default-ttl-hours`,label:n.policyDefaultTtlHours,hint:n.policyDefaultTtlHint,value:r.defaultTtlHours,min:1,max:168,disabled:d,onChange:f}),t[17]=r.defaultTtlHours,t[18]=n.policyDefaultTtlHint,t[19]=n.policyDefaultTtlHours,t[20]=d,t[21]=f,t[22]=p):p=t[22];let m=!r.enabled,h;t[23]===i?h=t[24]:(h=e=>i({maxTtlDays:e}),t[23]=i,t[24]=h);let g;t[25]!==r.maxTtlDays||t[26]!==n.policyMaxTtlDays||t[27]!==n.policyMaxTtlHint||t[28]!==m||t[29]!==h?(g=(0,$.jsx)(Me,{id:`share-max-ttl-days`,label:n.policyMaxTtlDays,hint:n.policyMaxTtlHint,value:r.maxTtlDays,min:1,max:30,disabled:m,onChange:h}),t[25]=r.maxTtlDays,t[26]=n.policyMaxTtlDays,t[27]=n.policyMaxTtlHint,t[28]=m,t[29]=h,t[30]=g):g=t[30];let _=!r.enabled,v;t[31]===i?v=t[32]:(v=e=>i({maxActiveShares:e}),t[31]=i,t[32]=v);let y;t[33]!==r.maxActiveShares||t[34]!==n.policyMaxActiveShares||t[35]!==n.policyMaxActiveSharesHint||t[36]!==_||t[37]!==v?(y=(0,$.jsx)(Me,{id:`share-max-active`,label:n.policyMaxActiveShares,hint:n.policyMaxActiveSharesHint,value:r.maxActiveShares,min:1,max:1e4,disabled:_,onChange:v}),t[33]=r.maxActiveShares,t[34]=n.policyMaxActiveShares,t[35]=n.policyMaxActiveSharesHint,t[36]=_,t[37]=v,t[38]=y):y=t[38];let b=!r.enabled,x;t[39]===i?x=t[40]:(x=e=>i({maxFileSizeMb:e}),t[39]=i,t[40]=x);let S;t[41]!==r.maxFileSizeMb||t[42]!==n.policyMaxFileSizeHint||t[43]!==n.policyMaxFileSizeMb||t[44]!==b||t[45]!==x?(S=(0,$.jsx)(Me,{id:`share-max-file-mb`,label:n.policyMaxFileSizeMb,hint:n.policyMaxFileSizeHint,value:r.maxFileSizeMb,min:1,max:10240,disabled:b,onChange:x}),t[41]=r.maxFileSizeMb,t[42]=n.policyMaxFileSizeHint,t[43]=n.policyMaxFileSizeMb,t[44]=b,t[45]=x,t[46]=S):S=t[46];let C=!r.enabled,w;t[47]===i?w=t[48]:(w=e=>i({directoryMaxFolderSizeMb:e}),t[47]=i,t[48]=w);let T;t[49]!==r.directoryMaxFolderSizeMb||t[50]!==n.policyDirectoryMaxFolderSizeHint||t[51]!==n.policyDirectoryMaxFolderSizeMb||t[52]!==C||t[53]!==w?(T=(0,$.jsx)(Me,{id:`share-directory-max-size-mb`,label:n.policyDirectoryMaxFolderSizeMb,hint:n.policyDirectoryMaxFolderSizeHint,value:r.directoryMaxFolderSizeMb,min:1,max:10240,disabled:C,onChange:w}),t[49]=r.directoryMaxFolderSizeMb,t[50]=n.policyDirectoryMaxFolderSizeHint,t[51]=n.policyDirectoryMaxFolderSizeMb,t[52]=C,t[53]=w,t[54]=T):T=t[54];let E=!r.enabled,D;t[55]===i?D=t[56]:(D=e=>i({directoryMaxFileCount:e}),t[55]=i,t[56]=D);let O;t[57]!==r.directoryMaxFileCount||t[58]!==n.policyDirectoryMaxFileCount||t[59]!==n.policyDirectoryMaxFileCountHint||t[60]!==E||t[61]!==D?(O=(0,$.jsx)(Me,{id:`share-directory-max-files`,label:n.policyDirectoryMaxFileCount,hint:n.policyDirectoryMaxFileCountHint,value:r.directoryMaxFileCount,min:1,max:1e5,disabled:E,onChange:D}),t[57]=r.directoryMaxFileCount,t[58]=n.policyDirectoryMaxFileCount,t[59]=n.policyDirectoryMaxFileCountHint,t[60]=E,t[61]=D,t[62]=O):O=t[62];let k;t[63]!==g||t[64]!==y||t[65]!==S||t[66]!==T||t[67]!==O||t[68]!==p?(k=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[p,g,y,S,T,O]}),t[63]=g,t[64]=y,t[65]=S,t[66]=T,t[67]=O,t[68]=p,t[69]=k):k=t[69];let ee=!r.enabled,A;t[70]===i?A=t[71]:(A=e=>i({inlinePreviewMimes:e}),t[70]=i,t[71]=A);let j;t[72]!==r.inlinePreviewMimes||t[73]!==n||t[74]!==ee||t[75]!==A?(j=(0,$.jsx)(Ne,{t:n,values:r.inlinePreviewMimes,disabled:ee,onChange:A}),t[72]=r.inlinePreviewMimes,t[73]=n,t[74]=ee,t[75]=A,t[76]=j):j=t[76];let M;t[77]!==k||t[78]!==j||t[79]!==s||t[80]!==u?(M=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[s,u,k,j]}),t[77]=k,t[78]=j,t[79]=s,t[80]=u,t[81]=M):M=t[81];let N;t[82]===n.policyNoteSection?N=t[83]:(N=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policyNoteSection}),t[82]=n.policyNoteSection,t[83]=N);let P;t[84]===n.policyNoteSectionHint?P=t[85]:(P=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policyNoteSectionHint}),t[84]=n.policyNoteSectionHint,t[85]=P);let F;t[86]!==N||t[87]!==P?(F=(0,$.jsxs)(`div`,{className:`mb-4`,children:[N,P]}),t[86]=N,t[87]=P,t[88]=F):F=t[88];let I;t[89]===i?I=t[90]:(I=e=>i({noteEnabled:e.target.checked}),t[89]=i,t[90]=I);let L;t[91]!==r.noteEnabled||t[92]!==I?(L=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.noteEnabled,onChange:I}),t[91]=r.noteEnabled,t[92]=I,t[93]=L):L=t[93];let te;t[94]!==n.policyNoteEnabled||t[95]!==L?(te=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[L,n.policyNoteEnabled]}),t[94]=n.policyNoteEnabled,t[95]=L,t[96]=te):te=t[96];let R=!r.enabled||!r.noteEnabled,z;t[97]===i?z=t[98]:(z=e=>i({noteMaxTotalSizeMb:e}),t[97]=i,t[98]=z);let B;t[99]!==r.noteMaxTotalSizeMb||t[100]!==n.policyNoteMaxTotalSizeHint||t[101]!==n.policyNoteMaxTotalSizeMb||t[102]!==R||t[103]!==z?(B=(0,$.jsx)(Me,{id:`share-note-max-size-mb`,label:n.policyNoteMaxTotalSizeMb,hint:n.policyNoteMaxTotalSizeHint,value:r.noteMaxTotalSizeMb,min:1,max:2048,disabled:R,onChange:z}),t[99]=r.noteMaxTotalSizeMb,t[100]=n.policyNoteMaxTotalSizeHint,t[101]=n.policyNoteMaxTotalSizeMb,t[102]=R,t[103]=z,t[104]=B):B=t[104];let V=!r.enabled||!r.noteEnabled,H;t[105]===i?H=t[106]:(H=e=>i({noteMaxAttachmentCount:e}),t[105]=i,t[106]=H);let U;t[107]!==r.noteMaxAttachmentCount||t[108]!==n.policyNoteMaxAttachmentCount||t[109]!==n.policyNoteMaxAttachmentCountHint||t[110]!==V||t[111]!==H?(U=(0,$.jsx)(Me,{id:`share-note-max-attachments`,label:n.policyNoteMaxAttachmentCount,hint:n.policyNoteMaxAttachmentCountHint,value:r.noteMaxAttachmentCount,min:0,max:500,disabled:V,onChange:H}),t[107]=r.noteMaxAttachmentCount,t[108]=n.policyNoteMaxAttachmentCount,t[109]=n.policyNoteMaxAttachmentCountHint,t[110]=V,t[111]=H,t[112]=U):U=t[112];let W;t[113]!==B||t[114]!==U?(W=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[B,U]}),t[113]=B,t[114]=U,t[115]=W):W=t[115];let ne;t[116]!==F||t[117]!==te||t[118]!==W?(ne=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[F,te,W]}),t[116]=F,t[117]=te,t[118]=W,t[119]=ne):ne=t[119];let re;t[120]===n.policySiteSection?re=t[121]:(re=(0,$.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:n.policySiteSection}),t[120]=n.policySiteSection,t[121]=re);let G;t[122]===n.policySiteSectionHint?G=t[123]:(G=(0,$.jsx)(`p`,{className:`mt-0.5 text-xs text-fg-muted`,children:n.policySiteSectionHint}),t[122]=n.policySiteSectionHint,t[123]=G);let K;t[124]!==re||t[125]!==G?(K=(0,$.jsxs)(`div`,{className:`mb-4`,children:[re,G]}),t[124]=re,t[125]=G,t[126]=K):K=t[126];let ie;t[127]===i?ie=t[128]:(ie=e=>i({siteEnabled:e.target.checked}),t[127]=i,t[128]=ie);let ae;t[129]!==r.siteEnabled||t[130]!==ie?(ae=(0,$.jsx)(`input`,{type:`checkbox`,className:`ui-checkbox`,checked:r.siteEnabled,onChange:ie}),t[129]=r.siteEnabled,t[130]=ie,t[131]=ae):ae=t[131];let oe;t[132]!==n.policySiteEnabled||t[133]!==ae?(oe=(0,$.jsxs)(`label`,{className:`mb-4 flex cursor-pointer items-center gap-2 text-sm text-fg`,children:[ae,n.policySiteEnabled]}),t[132]=n.policySiteEnabled,t[133]=ae,t[134]=oe):oe=t[134];let se=!r.siteEnabled,ce;t[135]===i?ce=t[136]:(ce=e=>i({siteDefaultTtlHours:e}),t[135]=i,t[136]=ce);let le;t[137]!==r.siteDefaultTtlHours||t[138]!==n.policySiteDefaultTtlHint||t[139]!==n.policySiteDefaultTtlHours||t[140]!==se||t[141]!==ce?(le=(0,$.jsx)(Me,{id:`site-share-default-ttl-hours`,label:n.policySiteDefaultTtlHours,hint:n.policySiteDefaultTtlHint,value:r.siteDefaultTtlHours,min:1,max:168,disabled:se,onChange:ce}),t[137]=r.siteDefaultTtlHours,t[138]=n.policySiteDefaultTtlHint,t[139]=n.policySiteDefaultTtlHours,t[140]=se,t[141]=ce,t[142]=le):le=t[142];let ue=!r.siteEnabled,de;t[143]===i?de=t[144]:(de=e=>i({siteMaxTtlDays:e}),t[143]=i,t[144]=de);let fe;t[145]!==r.siteMaxTtlDays||t[146]!==n.policySiteMaxTtlDays||t[147]!==n.policySiteMaxTtlHint||t[148]!==ue||t[149]!==de?(fe=(0,$.jsx)(Me,{id:`site-share-max-ttl-days`,label:n.policySiteMaxTtlDays,hint:n.policySiteMaxTtlHint,value:r.siteMaxTtlDays,min:1,max:30,disabled:ue,onChange:de}),t[145]=r.siteMaxTtlDays,t[146]=n.policySiteMaxTtlDays,t[147]=n.policySiteMaxTtlHint,t[148]=ue,t[149]=de,t[150]=fe):fe=t[150];let pe=!r.siteEnabled,me;t[151]===i?me=t[152]:(me=e=>i({maxActiveSites:e}),t[151]=i,t[152]=me);let he;t[153]!==r.maxActiveSites||t[154]!==n.policyMaxActiveSites||t[155]!==n.policyMaxActiveSitesHint||t[156]!==pe||t[157]!==me?(he=(0,$.jsx)(Me,{id:`site-share-max-active`,label:n.policyMaxActiveSites,hint:n.policyMaxActiveSitesHint,value:r.maxActiveSites,min:1,max:1e3,disabled:pe,onChange:me}),t[153]=r.maxActiveSites,t[154]=n.policyMaxActiveSites,t[155]=n.policyMaxActiveSitesHint,t[156]=pe,t[157]=me,t[158]=he):he=t[158];let ge=!r.siteEnabled,_e;t[159]===i?_e=t[160]:(_e=e=>i({siteMaxRootDirSizeMb:e}),t[159]=i,t[160]=_e);let ve;t[161]!==r.siteMaxRootDirSizeMb||t[162]!==n.policySiteMaxRootDirSizeHint||t[163]!==n.policySiteMaxRootDirSizeMb||t[164]!==ge||t[165]!==_e?(ve=(0,$.jsx)(Me,{id:`site-share-max-root-size-mb`,label:n.policySiteMaxRootDirSizeMb,hint:n.policySiteMaxRootDirSizeHint,value:r.siteMaxRootDirSizeMb,min:1,max:10240,disabled:ge,onChange:_e}),t[161]=r.siteMaxRootDirSizeMb,t[162]=n.policySiteMaxRootDirSizeHint,t[163]=n.policySiteMaxRootDirSizeMb,t[164]=ge,t[165]=_e,t[166]=ve):ve=t[166];let ye=!r.siteEnabled,be;t[167]===i?be=t[168]:(be=e=>i({siteMaxFileCount:e}),t[167]=i,t[168]=be);let q;t[169]!==r.siteMaxFileCount||t[170]!==n.policySiteMaxFileCount||t[171]!==n.policySiteMaxFileCountHint||t[172]!==ye||t[173]!==be?(q=(0,$.jsx)(Me,{id:`site-share-max-files`,label:n.policySiteMaxFileCount,hint:n.policySiteMaxFileCountHint,value:r.siteMaxFileCount,min:1,max:1e5,disabled:ye,onChange:be}),t[169]=r.siteMaxFileCount,t[170]=n.policySiteMaxFileCount,t[171]=n.policySiteMaxFileCountHint,t[172]=ye,t[173]=be,t[174]=q):q=t[174];let J;t[175]!==le||t[176]!==fe||t[177]!==he||t[178]!==ve||t[179]!==q?(J=(0,$.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[le,fe,he,ve,q]}),t[175]=le,t[176]=fe,t[177]=he,t[178]=ve,t[179]=q,t[180]=J):J=t[180];let Y;t[181]!==K||t[182]!==oe||t[183]!==J?(Y=(0,$.jsxs)(`div`,{className:`rounded-xl bg-surface-base/45 p-4`,children:[K,oe,J]}),t[181]=K,t[182]=oe,t[183]=J,t[184]=Y):Y=t[184];let X;return t[185]!==M||t[186]!==ne||t[187]!==Y?(X=(0,$.jsxs)(`div`,{className:`space-y-4`,children:[M,ne,Y]}),t[185]=M,t[186]=ne,t[187]=Y,t[188]=X):X=t[188],X}function Me(e){let t=(0,xe.c)(21),{id:n,label:r,hint:i,value:a,min:o,max:s,disabled:c,onChange:l}=e,u;t[0]!==n||t[1]!==r?(u=(0,$.jsx)(`label`,{className:`mb-1 block text-sm font-medium text-fg`,htmlFor:n,children:r}),t[0]=n,t[1]=r,t[2]=u):u=t[2];let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=I(ke(),`max-w-xs font-mono text-xs`),t[3]=d):d=t[3];let f;t[4]!==s||t[5]!==o||t[6]!==l?(f=e=>{let t=Number(e.target.value);Number.isFinite(t)&&l(Math.max(o,Math.min(s,Math.floor(t))))},t[4]=s,t[5]=o,t[6]=l,t[7]=f):f=t[7];let p;t[8]!==c||t[9]!==n||t[10]!==s||t[11]!==o||t[12]!==f||t[13]!==a?(p=(0,$.jsx)(ve,{id:n,type:`number`,min:o,max:s,disabled:c,className:d,value:a,onChange:f}),t[8]=c,t[9]=n,t[10]=s,t[11]=o,t[12]=f,t[13]=a,t[14]=p):p=t[14];let m;t[15]===i?m=t[16]:(m=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-subtle`,children:i}),t[15]=i,t[16]=m);let h;return t[17]!==u||t[18]!==p||t[19]!==m?(h=(0,$.jsxs)(`div`,{children:[u,p,m]}),t[17]=u,t[18]=p,t[19]=m,t[20]=h):h=t[20],h}function Ne(e){let t=(0,xe.c)(25),{t:n,values:r,disabled:i,onChange:a}=e,o;t[0]!==a||t[1]!==r?(o=e=>{let t=e.trim();!t||r.includes(t)||r.length>=32||a([...r,t])},t[0]=a,t[1]=r,t[2]=o):o=t[2];let s=o,c;t[3]===n.policyInlinePreviewMimes?c=t[4]:(c=(0,$.jsx)(`div`,{className:`text-sm font-medium text-fg`,children:n.policyInlinePreviewMimes}),t[3]=n.policyInlinePreviewMimes,t[4]=c);let l;t[5]===n.policyInlinePreviewMimesHint?l=t[6]:(l=(0,$.jsx)(`p`,{className:`text-xs text-fg-subtle`,children:n.policyInlinePreviewMimesHint}),t[5]=n.policyInlinePreviewMimesHint,t[6]=l);let u;t[7]!==i||t[8]!==a||t[9]!==r?(u=r.map(e=>(0,$.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-md border border-edge bg-surface-panel px-2 py-0.5 font-mono text-xs text-fg`,children:[e,i?null:(0,$.jsx)(`button`,{type:`button`,className:`text-fg-muted hover:text-fg`,"aria-label":`Remove ${e}`,onClick:()=>a(r.filter(t=>t!==e)),children:`×`})]},e)),t[7]=i,t[8]=a,t[9]=r,t[10]=u):u=t[10];let d;t[11]===u?d=t[12]:(d=(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u}),t[11]=u,t[12]=d);let f;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(f=I(ke(),`font-mono text-xs`),t[13]=f):f=t[13];let p=i||r.length>=32,m;t[14]===s?m=t[15]:(m=e=>{e.key===`Enter`&&(e.preventDefault(),s(e.target.value),e.target.value=``)},t[14]=s,t[15]=m);let h;t[16]!==n.policyMimePlaceholder||t[17]!==p||t[18]!==m?(h=(0,$.jsx)(`input`,{className:f,placeholder:n.policyMimePlaceholder,disabled:p,onKeyDown:m}),t[16]=n.policyMimePlaceholder,t[17]=p,t[18]=m,t[19]=h):h=t[19];let g;return t[20]!==c||t[21]!==l||t[22]!==d||t[23]!==h?(g=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-xl bg-surface-base/45 p-4`,children:[c,l,d,h]}),t[20]=c,t[21]=l,t[22]=d,t[23]=h,t[24]=g):g=t[24],g}function Pe(e){let t=(0,xe.c)(70),{open:n,onOpenChange:r,onConfirm:i,initialPath:a,selectKind:c,conversationId:g,agentId:_}=e,b=c===void 0?`any`:c,x=l(s(Le)),S=x.workspace,w=x.sharesSettings,E=he(Ie),{data:O}=te(o(Fe)?`picker-agents-list`:null,B),k;bb0:{let e;t[0]===_?e=t[1]:(e=_?.trim(),t[0]=_,t[1]=e);let n=e;if(n){k=n;break bb0}let r;t[2]===E?r=t[3]:(r=E.trim(),t[2]=E,t[3]=r);let i=r;if(i){k=i;break bb0}if(O?.defaultId){k=O.defaultId;break bb0}if(O?.agents?.[0]?.id){k=O.agents[0].id;break bb0}k=``}let A=k,[j,M]=(0,Y.useState)(A),N,P;t[4]===A?(N=t[5],P=t[6]):(N=()=>{M(A)},P=[A],t[4]=A,t[5]=N,t[6]=P),(0,Y.useEffect)(N,P);let{tree:L,loading:R,error:z,loadRoot:H,loadChildren:U,reset:W}=me(j,g??null),re;t[7]===a?re=t[8]:(re=a?{path:a,isDirectory:!1}:null,t[7]=a,t[8]=re);let[G,K]=(0,Y.useState)(re),ie;t[9]!==a||t[10]!==H||t[11]!==n||t[12]!==W||t[13]!==K?(ie=()=>{if(!n){W(),K(a?{path:a,isDirectory:!1}:null);return}H()},t[9]=a,t[10]=H,t[11]=n,t[12]=W,t[13]=K,t[14]=ie):ie=t[14];let ae;t[15]!==g||t[16]!==a||t[17]!==H||t[18]!==n||t[19]!==j||t[20]!==W?(ae=[n,j,g,H,W,a],t[15]=g,t[16]=a,t[17]=H,t[18]=n,t[19]=j,t[20]=W,t[21]=ae):ae=t[21],(0,Y.useEffect)(ie,ae);let oe;t[22]===U?oe=t[23]:(oe=e=>{U(e)},t[22]=U,t[23]=oe);let se=oe,ce=G!==null&&(b===`any`||b===`file`&&!G.isDirectory||b===`directory`&&G.isDirectory),le;bb1:{if(!G){le=w.pickerHintNone;break bb1}if(b===`file`&&G.isDirectory){le=w.pickerHintNeedsFile;break bb1}if(b===`directory`&&!G.isDirectory){le=w.pickerHintNeedsDirectory;break bb1}le=`${G.isDirectory?`📁`:`📄`} ${G.path}`}let ue=le,de=O?.agents??[],fe;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(fe=(0,$.jsx)(u,{className:`xopc-dialog-overlay fixed inset-0 z-[70] bg-scrim backdrop-blur-[2px]`}),t[24]=fe):fe=t[24];let pe;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(pe=I(`xopc-dialog-content fixed left-1/2 top-1/2 z-[71] w-[min(34rem,calc(100vw-2rem))] -translate-x-1/2 -translate-y-1/2`,`flex h-[min(28rem,calc(100vh-3rem))] flex-col overflow-hidden rounded-lg border border-edge bg-surface-overlay shadow-popover outline-none`),t[25]=pe):pe=t[25];let ge;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,$.jsx)(T,{className:`size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),t[26]=ge):ge=t[26];let _e=x.cron.refresh,ve=x.cron.refresh,ye;t[27]===H?ye=t[28]:(ye=()=>void H(),t[27]=H,t[28]=ye);let be=R&&`animate-spin`,q;t[29]===be?q=t[30]:(q=I(`size-4`,be),t[29]=be,t[30]=q);let J;t[31]===q?J=t[32]:(J=(0,$.jsx)(ee,{className:q,"aria-hidden":!0}),t[31]=q,t[32]=J);let X;t[33]===Symbol.for(`react.memo_cache_sentinel`)?(X=(0,$.jsx)(F,{className:`size-4`}),t[33]=X):X=t[33];let Se;t[34]!==z||t[35]!==S.loadError?(Se=z?(0,$.jsxs)(`p`,{className:`shrink-0 px-4 py-2 text-xs text-red-600 dark:text-red-400`,children:[S.loadError,`: `,z]}):null,t[34]=z,t[35]=S.loadError,t[36]=Se):Se=t[36];let Z;t[37]!==se||t[38]!==R||t[39]!==G?.path||t[40]!==K||t[41]!==S.emptyDir||t[42]!==S.title||t[43]!==L?(Z=R&&L.length===0?(0,$.jsxs)(`p`,{className:`flex shrink-0 items-center gap-2 px-4 py-3 text-sm text-fg-muted`,children:[(0,$.jsx)(D,{className:`size-4 animate-spin`}),S.title,`…`]}):(0,$.jsx)(C,{tree:L,selectedPath:G?.path??null,onSelectFile:e=>K({path:e,isDirectory:!1}),onSelectEntry:(e,t)=>K({path:e,isDirectory:t}),onExpandDir:se,onAction:void 0,emptyHint:S.emptyDir}),t[37]=se,t[38]=R,t[39]=G?.path,t[40]=K,t[41]=S.emptyDir,t[42]=S.title,t[43]=L,t[44]=Z):Z=t[44];let Ce;t[45]!==Se||t[46]!==Z?(Ce=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden`,children:[Se,Z]}),t[45]=Se,t[46]=Z,t[47]=Ce):Ce=t[47];let Q;t[48]===ue?Q=t[49]:(Q=(0,$.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:ue}),t[48]=ue,t[49]=Q);let we;t[50]===r?we=t[51]:(we=()=>r(!1),t[50]=r,t[51]=we);let Te;t[52]!==w.cancel||t[53]!==we?(Te=(0,$.jsx)(V,{type:`button`,variant:`ghost`,onClick:we,children:w.cancel}),t[52]=w.cancel,t[53]=we,t[54]=Te):Te=t[54];let Ee=!ce,De;t[55]!==i||t[56]!==r||t[57]!==j||t[58]!==G?(De=()=>{G&&(i({...G,agentId:j}),r(!1))},t[55]=i,t[56]=r,t[57]=j,t[58]=G,t[59]=De):De=t[59];let Oe;t[60]!==w.pickerConfirm||t[61]!==Ee||t[62]!==De?(Oe=(0,$.jsx)(V,{type:`button`,disabled:Ee,onClick:De,children:w.pickerConfirm}),t[60]=w.pickerConfirm,t[61]=Ee,t[62]=De,t[63]=Oe):Oe=t[63];let ke;t[64]!==Te||t[65]!==Oe?(ke=(0,$.jsxs)(`div`,{className:`flex shrink-0 gap-2`,children:[Te,Oe]}),t[64]=Te,t[65]=Oe,t[66]=ke):ke=t[66];let Ae;return t[67]!==Q||t[68]!==ke?(Ae=(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-3 border-t border-edge px-4 py-3`,children:[Q,ke]}),t[67]=Q,t[68]=ke,t[69]=Ae):Ae=t[69],(0,$.jsx)(h,{open:n,onOpenChange:r,children:(0,$.jsxs)(f,{children:[fe,(0,$.jsxs)(p,{className:pe,children:[(0,$.jsxs)(`div`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-edge px-4`,children:[ge,(0,$.jsx)(m,{className:`min-w-0 flex-1 truncate text-base font-semibold text-fg`,children:w.pickerTitle}),(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg disabled:opacity-50`,title:_e,"aria-label":ve,disabled:R,onClick:ye,children:J}),(0,$.jsx)(d,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,className:`inline-flex size-8 shrink-0 items-center justify-center rounded-md text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":S.close,children:X})})]}),de.length>0?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-edge px-4 py-2`,children:[(0,$.jsx)(`label`,{className:`text-xs text-fg-muted`,htmlFor:`picker-agent-select`,children:w.pickerAgentLabel}),(0,$.jsx)(v,{id:`picker-agent-select`,className:`min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-2 py-1 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:j,onChange:e=>{M(e.target.value),K(null)},children:de.map(e=>(0,$.jsxs)(y,{value:e.id,children:[ne(e,x.agentsSettings),e.id===O?.defaultId?` ★`:``]},e.id))})]}):null,Ce,Ae]})]})})}function Fe(e){return e.conversationId}function Ie(e){return e.agentId}function Le(e){return e.language}var Re=[`shares`,`policy`];function ze(e){let t=(e??``).trim();return Re.includes(t)?t:`shares`}function Be(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(1)} GB`}function Ve(e,t){let n=new Date(e).getTime()-Date.now(),r=Math.abs(n),i=n<0;if(r<6e4)return t===`zh`?`刚刚`:`just now`;let a=Math.floor(r/6e4);if(a<60){let e=t===`zh`?`${a} 分钟`:`${a}m`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let o=Math.floor(a/60);if(o<24){let e=t===`zh`?`${o} 小时`:`${o}h`;return i?t===`zh`?`${e}前`:`${e} ago`:e}let s=Math.floor(o/24),c=t===`zh`?`${s} 天`:`${s}d`;return i?t===`zh`?`${c}前`:`${c} ago`:c}var He=[{value:36e5,key:`1h`},{value:216e5,key:`6h`},{value:864e5,key:`24h`},{value:2592e5,key:`3d`},{value:6048e5,key:`7d`},{value:2592e6,key:`30d`}];function Ue(){let e=(0,xe.c)(23),t=s(Ge),n=l(t).sharesSettings,r=!!o(We),[a,c]=i(),u;e[0]===a?u=e[1]:(u=ze(a.get(`tab`)),e[0]=a,e[1]=u);let d=u,f;e[2]===c?f=e[3]:(f=e=>{c(t=>{let n=new URLSearchParams(t);return e===`shares`?n.delete(`tab`):n.set(`tab`,e),n},{replace:!0})},e[2]=c,e[3]=f);let p=f;if(!r)return(0,$.jsx)(ye,{gap:`gap-3`,padding:`px-3 py-8 sm:px-5 xl:px-6`,children:(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.needToken})});let m={shares:n.tabShares,policy:n.tabPolicy},h=Re.map(e=>({id:e,label:m[e]})),g;e[4]===n.title?g=e[5]:(g=(0,$.jsx)(be,{title:n.title}),e[4]=n.title,e[5]=g);let _;e[6]!==d||e[7]!==p||e[8]!==n.tabsAria||e[9]!==h?(_=(0,$.jsx)(W,{items:h,activeTab:d,onChange:p,ariaLabel:n.tabsAria,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`}),e[6]=d,e[7]=p,e[8]=n.tabsAria,e[9]=h,e[10]=_):_=e[10];let v;e[11]!==d||e[12]!==r||e[13]!==t||e[14]!==n?(v=d===`shares`?(0,$.jsx)(Ke,{t:n,language:t}):(0,$.jsx)(Ae,{hasToken:r}),e[11]=d,e[12]=r,e[13]=t,e[14]=n,e[15]=v):v=e[15];let y;e[16]!==d||e[17]!==v?(y=(0,$.jsx)(q,{id:d,activeTab:d,tabIdPrefix:`shares-tab`,panelIdPrefix:`shares-panel`,showHeading:!1,children:v}),e[16]=d,e[17]=v,e[18]=y):y=e[18];let b;return e[19]!==g||e[20]!==_||e[21]!==y?(b=(0,$.jsxs)(ye,{children:[g,_,y]}),e[19]=g,e[20]=_,e[21]=y,e[22]=b):b=e[22],b}function We(e){return e.conversationId}function Ge(e){return e.language}function Ke(e){let t=(0,xe.c)(79),{t:n,language:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i={refreshInterval:3e4},t[0]=i):i=t[0];let{data:a,error:o,isLoading:s,mutate:c}=te(`shares-list`,ce,i),l;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(l={refreshInterval:3e4},t[1]=l):l=t[1];let u=te(`hosted-publications-list`,se,l),d;t[2]===a?.payload?.shares?d=t[3]:(d=a?.payload?.shares??[],t[2]=a?.payload?.shares,t[3]=d);let f=d,[p,m]=(0,Y.useState)(!1),h;bb0:{if(p){h=f;break bb0}let e;t[4]===f?e=t[5]:(e=f.filter(Ze),t[4]=f,t[5]=e),h=e}let g=h,_;t[6]===f?_=t[7]:(_=f.filter(Xe),t[6]=f,t[7]=_);let v=_.length,y;t[8]===f?y=t[9]:(y=f.filter(Ye),t[8]=f,t[9]=y);let b=y.length,x;t[10]===c?x=t[11]:(x=()=>void c(),t[10]=c,t[11]=x);let S;t[12]!==n||t[13]!==x?(S=(0,$.jsx)(rt,{t:n,onCreated:x}),t[12]=n,t[13]=x,t[14]=S):S=t[14];let C=u.data?.connected===!0,w=u.data?.publishingAllowed===!0,T;t[15]===u?T=t[16]:(T=()=>void u.mutate(),t[15]=u,t[16]=T);let E;t[17]!==r||t[18]!==w||t[19]!==T||t[20]!==C?(E=(0,$.jsx)(Qe,{language:r,connected:C,publishingAllowed:w,onCreated:T}),t[17]=r,t[18]=w,t[19]=T,t[20]=C,t[21]=E):E=t[21];let D=p?n.allSharesTitle:n.listTitle,O;t[22]===v?O=t[23]:(O=v>0&&(0,$.jsxs)(`span`,{className:`ml-2 text-xs font-normal text-fg-muted`,children:[`(`,v,`)`]}),t[22]=v,t[23]=O);let k;t[24]!==D||t[25]!==O?(k=(0,$.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[D,O]}),t[24]=D,t[25]=O,t[26]=k):k=t[26];let A;t[27]===c?A=t[28]:(A=()=>void c(),t[27]=c,t[28]=A);let j=s&&`animate-spin`,M;t[29]===j?M=t[30]:(M=I(`size-3.5`,j),t[29]=j,t[30]=M);let N;t[31]===M?N=t[32]:(N=(0,$.jsx)(ee,{className:M}),t[31]=M,t[32]=N);let P;t[33]!==s||t[34]!==A||t[35]!==N?(P=(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:A,disabled:s,children:N}),t[33]=s,t[34]=A,t[35]=N,t[36]=P):P=t[36];let F;t[37]!==b||t[38]!==p||t[39]!==n.hideExpired||t[40]!==n.showExpired?(F=b>0&&(0,$.jsx)(`button`,{type:`button`,className:`text-xs text-accent hover:underline`,onClick:()=>m(Je),children:p?n.hideExpired:n.showExpired}),t[37]=b,t[38]=p,t[39]=n.hideExpired,t[40]=n.showExpired,t[41]=F):F=t[41];let L;t[42]!==P||t[43]!==F?(L=(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[P,F]}),t[42]=P,t[43]=F,t[44]=L):L=t[44];let R;t[45]!==k||t[46]!==L?(R=(0,$.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[k,L]}),t[45]=k,t[46]=L,t[47]=R):R=t[47];let z;t[48]!==a||t[49]!==o||t[50]!==g||t[51]!==s||t[52]!==r||t[53]!==c||t[54]!==n?(z=s&&!a?(0,$.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:4}).map(qe)}):o?(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-red-600 dark:text-red-400`,children:[(0,$.jsx)(`span`,{children:n.error}),(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-xs`,onClick:()=>void c(),children:n.retry})]}):g.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:n.emptyState}):(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:g.map(e=>(0,$.jsx)(at,{share:e,t:n,language:r,onRevoked:()=>void c(),onExtended:()=>void c()},e.id))}),t[48]=a,t[49]=o,t[50]=g,t[51]=s,t[52]=r,t[53]=c,t[54]=n,t[55]=z):z=t[55];let B;t[56]!==b||t[57]!==c||t[58]!==p||t[59]!==n?(B=b>0&&p&&(0,$.jsx)(ot,{t:n,onCleaned:()=>void c()}),t[56]=b,t[57]=c,t[58]=p,t[59]=n,t[60]=B):B=t[60];let H;t[61]!==R||t[62]!==z||t[63]!==B?(H=(0,$.jsxs)(J,{children:[R,z,B]}),t[61]=R,t[62]=z,t[63]=B,t[64]=H):H=t[64];let U;t[65]===u?U=t[66]:(U=()=>void u.mutate(),t[65]=u,t[66]=U);let W;t[67]!==u.data||t[68]!==u.error||t[69]!==u.isLoading||t[70]!==r||t[71]!==n||t[72]!==U?(W=(0,$.jsx)($e,{data:u.data,error:u.error,isLoading:u.isLoading,language:r,t:n,onChanged:U}),t[67]=u.data,t[68]=u.error,t[69]=u.isLoading,t[70]=r,t[71]=n,t[72]=U,t[73]=W):W=t[73];let ne;return t[74]!==E||t[75]!==H||t[76]!==W||t[77]!==S?(ne=(0,$.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[S,E,H,W]}),t[74]=E,t[75]=H,t[76]=W,t[77]=S,t[78]=ne):ne=t[78],ne}function qe(e,t){return(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-base/55 p-3`,children:(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(L,{className:`h-4 w-2/3`}),(0,$.jsx)(L,{className:`mt-2 h-3 w-1/2`})]}),(0,$.jsx)(L,{className:`h-7 w-20 rounded-md`})]})},t)}function Je(e){return!e}function Ye(e){return e.expired||e.revoked}function Xe(e){return!e.expired&&!e.revoked}function Ze(e){return!e.expired&&!e.revoked}function Qe({language:e,connected:t,publishingAllowed:n,onCreated:r}){let i=e===`zh`,[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)(``),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(6048e5),[_,b]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(null),[E,O]=(0,Y.useState)(null),k=async()=>{if(a.trim()){b(!0),O(null);try{let e=await ue({path:a.trim(),title:p.trim()||void 0,ttlMs:h,spaFallback:!0,...s?{agentId:s}:{}});C(e),r()}catch(e){O(e instanceof Error?e.message:String(e))}finally{b(!1)}}};return(0,$.jsxs)(J,{children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(x,{className:`mt-0.5 size-4 shrink-0 text-accent`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i?`发布静态网站`:`Publish static website`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:i?`把工作区内的 HTML 文件,或包含 index.html 的网站目录,发布到隔离的托管域名。`:`Publish an HTML file or a website directory containing index.html to the isolated hosted origin.`}),t&&!n?(0,$.jsx)(`p`,{className:`mt-3 rounded-md bg-warning-soft px-3 py-2 text-xs text-warning`,children:i?`管理员已暂停你的公网分享能力。已有远端链接当前不可访问;你仍可在下方撤销它们。`:`An administrator has paused public sharing for your account. Existing hosted links are unavailable, but you can still revoke them below.`}):null,(0,$.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-[1fr_12rem]`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(`input`,{value:a,onChange:e=>{o(e.target.value),u(!1),C(null)},placeholder:i?`选择 HTML 文件或网站目录`:`Select an HTML file or website directory`,className:`h-9 min-w-0 flex-1 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none placeholder:text-fg-subtle focus:border-accent`}),(0,$.jsxs)(V,{type:`button`,variant:`ghost`,className:`shrink-0`,onClick:()=>f(!0),children:[a&&!l?(0,$.jsx)(w,{className:`size-4`}):(0,$.jsx)(T,{className:`size-4`}),a?i?`更换`:`Change`:i?`选择`:`Browse`]})]}),(0,$.jsxs)(v,{value:String(h),onChange:e=>g(Number(e.target.value)),children:[(0,$.jsx)(y,{value:`86400000`,children:i?`24 小时`:`24 hours`}),(0,$.jsx)(y,{value:`604800000`,children:i?`7 天`:`7 days`}),(0,$.jsx)(y,{value:`2592000000`,children:i?`30 天`:`30 days`})]}),(0,$.jsx)(`input`,{value:p,onChange:e=>m(e.target.value),placeholder:i?`网站标题(可选)`:`Site title (optional)`,className:`h-9 rounded-md border border-edge bg-surface-panel px-3 text-sm text-fg outline-none focus:border-accent sm:col-span-2`})]}),(0,$.jsxs)(`div`,{className:`mt-3 flex items-center gap-3`,children:[(0,$.jsxs)(V,{type:`button`,onClick:()=>void k(),disabled:!a.trim()||_||!t||!n,children:[_?(0,$.jsx)(D,{className:`size-4 animate-spin`}):(0,$.jsx)(x,{className:`size-4`}),_?i?`发布中…`:`Publishing…`:i?`发布网站`:`Publish site`]}),S?(0,$.jsxs)(`button`,{type:`button`,className:`min-w-0 truncate text-xs text-accent hover:underline`,onClick:()=>void H(S.shareUrl),children:[S.shareUrl,` · `,S.fileCount,` `,i?`个文件`:`files`,` · `,Be(S.totalBytes)]}):null]}),E?(0,$.jsx)(`p`,{className:`mt-3 text-xs text-danger`,children:E}):null]})]}),(0,$.jsx)(Pe,{open:d,onOpenChange:f,initialPath:a||void 0,agentId:s||void 0,selectKind:`any`,onConfirm:e=>{o(e.path),c(e.agentId),u(e.isDirectory),C(null),O(null)}})]})}function $e(e){let t=(0,xe.c)(18),{data:n,error:r,isLoading:i,language:a,t:o,onChanged:s}=e,c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(x,{className:`size-4 text-accent`,"aria-hidden":!0}),t[0]=c):c=t[0];let l;t[1]===o.hostedTitle?l=t[2]:(l=(0,$.jsxs)(`h2`,{className:`flex items-center gap-2 text-sm font-semibold text-fg`,children:[c,o.hostedTitle]}),t[1]=o.hostedTitle,t[2]=l);let u;t[3]===o.hostedHint?u=t[4]:(u=(0,$.jsx)(`p`,{className:`mt-1 text-xs text-fg-muted`,children:o.hostedHint}),t[3]=o.hostedHint,t[4]=u);let d;t[5]!==l||t[6]!==u?(d=(0,$.jsx)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:(0,$.jsxs)(`div`,{children:[l,u]})}),t[5]=l,t[6]=u,t[7]=d):d=t[7];let f;t[8]!==n||t[9]!==r||t[10]!==i||t[11]!==a||t[12]!==s||t[13]!==o?(f=i&&!n?(0,$.jsx)(`div`,{className:`grid gap-2`,"aria-busy":`true`,children:Array.from({length:2}).map(et)}):r?(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:o.error}):n?.connected?(0,$.jsxs)(`div`,{className:`space-y-3`,children:[n.publishingAllowed?null:(0,$.jsx)(`p`,{className:`rounded-md bg-warning-soft px-3 py-2 text-xs text-warning`,children:a===`zh`?`管理员已暂停公网分享。已有托管链接当前不可访问,也不能更新;撤销操作仍然可用。`:`An administrator has paused public sharing. Existing hosted links are unavailable and cannot be updated; revocation remains available.`}),n.publications.length===0?(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.hostedEmpty}):(0,$.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.publications.map(e=>(0,$.jsx)(tt,{publication:e,language:a,t:o,publishingAllowed:n.publishingAllowed,onChanged:s},e.id))})]}):(0,$.jsxs)(`div`,{className:`space-y-3`,children:[(0,$.jsx)(`p`,{className:`text-sm text-fg-muted`,children:o.hostedDisconnected}),(0,$.jsx)(_e,{providerId:`xopc-share`,displayName:`XOPC Hosted Share`,connected:!1,onConnected:s})]}),t[8]=n,t[9]=r,t[10]=i,t[11]=a,t[12]=s,t[13]=o,t[14]=f):f=t[14];let p;return t[15]!==d||t[16]!==f?(p=(0,$.jsxs)(J,{children:[d,f]}),t[15]=d,t[16]=f,t[17]=p):p=t[17],p}function et(e,t){return(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-base/55 p-3`,children:[(0,$.jsx)(L,{className:`h-4 w-2/3`}),(0,$.jsx)(L,{className:`mt-2 h-3 w-1/2`})]},t)}function tt({publication:e,language:t,t:n,publishingAllowed:r,onChanged:i}){let[a,o]=(0,Y.useState)(!1),[s,c]=(0,Y.useState)(!1),[l,u]=(0,Y.useState)(!1),[d,f]=(0,Y.useState)(!1),[p,m]=(0,Y.useState)(!1),h=Date.now()>=new Date(e.expiresAt).getTime(),_=e.status===`active`&&!h,v=e.status===`revoked`?n.statusRevoked:h?n.statusExpired:e.status===`staging`?t===`zh`?`准备中`:`Staging`:n.statusActive,y=e.kind===`note_document`?A:e.kind===`static_site`?x:O,b=e.kind===`note_document`?t===`zh`?`笔记文档`:`Note document`:e.kind===`static_site`?t===`zh`?`静态网站`:`Static website`:t===`zh`?`会话快照`:`Conversation snapshot`,C=(0,Y.useCallback)(async()=>{e.shareUrl&&await H(e.shareUrl)&&(u(!0),window.setTimeout(()=>u(!1),2e3))},[e.shareUrl]),w=(0,Y.useCallback)(async()=>{o(!1),c(!0);try{await fe(e.id),i()}catch{}finally{c(!1)}},[e.id,i]),T=(0,Y.useCallback)(async()=>{if(!(!e.revision||e.revision<=1)){f(!0);try{let t=(await ae(e.id)).find(t=>t.revision<e.revision);if(!t)return;await pe(e.id,e.revision,t.revision),i()}catch{}finally{f(!1)}}},[e.id,e.revision,i]),k=(0,Y.useCallback)(async()=>{m(!0);try{await oe(e.id),i()}catch{}finally{m(!1)}},[e.id,i]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`rounded-lg bg-surface-base/55 px-3 py-2.5`,children:(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsx)(y,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.title}),(0,$.jsx)(`span`,{className:I(`text-xs font-medium`,_?`text-emerald-600 dark:text-emerald-400`:`text-fg-subtle`),children:v})]}),(0,$.jsxs)(`p`,{className:`mt-0.5 text-xs text-fg-subtle`,children:[b,` · `,n.hostedRevision,` `,e.revision??`—`,` · `,e.managedFromThisDevice?n.hostedThisDevice:n.hostedOtherDevice]}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,$.jsxs)(`span`,{children:[t===`zh`?`浏览`:`Views`,`: `,e.viewCount,e.maxViews===null?``:` / ${e.maxViews}`]}),(0,$.jsx)(`span`,{children:h?n.statusExpired:Ve(e.expiresAt,t)}),e.description?(0,$.jsx)(`span`,{className:`italic`,children:e.description}):null]})]}),_?(0,$.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.shareUrl?(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:!r,title:n.copyUrl,onClick:()=>void C(),children:l?(0,$.jsx)(g,{className:`size-3.5 text-emerald-500`}):(0,$.jsx)(S,{className:`size-3.5`})}):null,(e.revision??0)>1?(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:d||!r,onClick:()=>void T(),title:t===`zh`?`回滚上一版本`:`Roll back one revision`,children:d?(0,$.jsx)(D,{className:`size-3.5 animate-spin`}):(0,$.jsx)(E,{className:`size-3.5`})}):null,e.kind===`static_site`&&e.managedFromThisDevice?(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`px-2 py-1`,disabled:p||!r,onClick:()=>void k(),title:t===`zh`?`发布工作区中的最新版本`:`Publish latest workspace version`,children:(0,$.jsx)(ee,{className:I(`size-3.5`,p&&`animate-spin`)})}):null,(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,disabled:s,onClick:()=>o(!0),children:s?(0,$.jsx)(D,{className:`size-3.5 animate-spin`}):(0,$.jsx)(j,{className:`size-3.5`})})]}):null]})}),(0,$.jsx)(G,{open:a,title:n.revokeConfirmTitle,description:n.revokeConfirmBody,confirmLabel:n.revokeConfirmLabel,cancelLabel:n.cancel,destructive:!0,onConfirm:()=>void w(),onCancel:()=>o(!1)})]})}var nt={expanded:!0,path:``,isDirectory:!1,agentId:``,ttlMs:864e5,maxViews:null,description:``,directoryMode:`browse`,creating:!1,result:null,errorMsg:null,resultDialogOpen:!1,pickerOpen:!1};function rt({t:e,onCreated:t}){let[n,r]=(0,Y.useReducer)(re,nt),{expanded:i,path:a,isDirectory:o,agentId:s,ttlMs:c,maxViews:l,description:u,directoryMode:d,creating:f,result:p,errorMsg:m,resultDialogOpen:h,pickerOpen:g}=n,_=(0,Y.useCallback)(async()=>{if(a.trim()){r({type:`patch`,patch:{creating:!0,errorMsg:null,result:null}});try{let e=await K({path:a.trim(),ttlMs:c,maxViews:l,description:u.trim()||void 0,...s?{agentId:s}:{},...o?{kind:`directory`,directoryMode:d}:{}});r({type:`patch`,patch:{result:e.payload,resultDialogOpen:!0}}),t()}catch(e){r({type:`patch`,patch:{errorMsg:e instanceof Error?e.message:String(e)}})}finally{r({type:`patch`,patch:{creating:!1}})}}},[a,o,s,c,l,u,d,t]),b=(0,Y.useCallback)(()=>{r({type:`patch`,patch:{path:``,isDirectory:!1,agentId:``,description:``,maxViews:null,ttlMs:864e5,directoryMode:`browse`,result:null,errorMsg:null}})},[]);return i?(0,$.jsxs)(J,{children:[(0,$.jsx)(`h2`,{className:`mb-1 text-sm font-semibold text-fg`,children:e.createTitle}),(0,$.jsx)(`p`,{className:`mb-4 text-xs text-fg-muted`,children:e.createHint}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.pathLabel}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`div`,{className:I(`flex min-w-0 flex-1 items-center gap-2 rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm`,a?`text-fg`:`text-fg-subtle`),children:a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`span`,{"aria-hidden":!0,children:o?`📁`:`📄`}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,title:a,children:a})]}):(0,$.jsx)(`span`,{className:`truncate`,children:e.pathPlaceholder})}),(0,$.jsxs)(V,{type:`button`,variant:`ghost`,onClick:()=>r({type:`patch`,patch:{pickerOpen:!0}}),children:[(0,$.jsx)(w,{className:`size-4`}),a?e.pathBrowseChange:e.pathBrowse]})]})]}),o?(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.directoryModeLabel}),(0,$.jsxs)(v,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:d,onChange:e=>r({type:`patch`,patch:{directoryMode:e.target.value===`zip-only`?`zip-only`:`browse`}}),children:[(0,$.jsx)(y,{value:`browse`,children:e.directoryModeBrowse}),(0,$.jsx)(y,{value:`zip-only`,children:e.directoryModeZipOnly})]})]}):null,(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-3`,children:[(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.ttlLabel}),(0,$.jsx)(v,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:c,onChange:e=>r({type:`patch`,patch:{ttlMs:Number(e.target.value)}}),children:He.map(t=>(0,$.jsx)(y,{value:t.value,children:e.ttlOptions[t.key]},t.key))})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.maxViewsLabel}),(0,$.jsxs)(v,{className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg focus:outline-none focus:ring-2 focus:ring-accent`,value:l??`unlimited`,onChange:e=>r({type:`patch`,patch:{maxViews:e.target.value===`unlimited`?null:Number(e.target.value)}}),children:[(0,$.jsx)(y,{value:`unlimited`,children:e.maxViewsUnlimited}),(0,$.jsx)(y,{value:`1`,children:`1`}),(0,$.jsx)(y,{value:`5`,children:`5`}),(0,$.jsx)(y,{value:`10`,children:`10`}),(0,$.jsx)(y,{value:`50`,children:`50`}),(0,$.jsx)(y,{value:`100`,children:`100`})]})]})]}),(0,$.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-fg`,children:e.descriptionLabel}),(0,$.jsx)(`input`,{type:`text`,className:`rounded-lg border border-edge bg-surface-panel px-3 py-2 text-sm text-fg placeholder:text-fg-subtle focus:outline-none focus:ring-2 focus:ring-accent`,placeholder:e.descriptionPlaceholder,value:u,onChange:e=>r({type:`patch`,patch:{description:e.target.value}})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,$.jsxs)(V,{type:`button`,disabled:f||!a.trim(),onClick:()=>void _(),children:[f?(0,$.jsx)(D,{className:`size-4 animate-spin`}):(0,$.jsx)(k,{className:`size-4`}),f?e.creating:e.createButton]}),(0,$.jsx)(V,{type:`button`,variant:`ghost`,onClick:()=>{b(),r({type:`patch`,patch:{expanded:!1}})},children:e.cancel})]}),m&&(0,$.jsx)(`p`,{className:`text-sm text-red-600 dark:text-red-400`,children:m})]}),(0,$.jsx)(M,{open:h,onOpenChange:e=>{r({type:`patch`,patch:{resultDialogOpen:e,...e?{}:{result:null}}})},result:p}),(0,$.jsx)(Pe,{open:g,onOpenChange:e=>r({type:`patch`,patch:{pickerOpen:e}}),initialPath:a||void 0,selectKind:`any`,onConfirm:e=>r({type:`patch`,patch:{path:e.path,isDirectory:e.isDirectory,agentId:e.agentId,directoryMode:`browse`}})})]}):(0,$.jsxs)(V,{type:`button`,onClick:()=>r({type:`patch`,patch:{expanded:!0}}),className:`self-start`,children:[(0,$.jsx)(k,{className:`size-4`}),e.createTitle]})}var it={revokeOpen:!1,revoking:!1,linksOpen:!1,urlCopied:!1,copyFailed:!1,extending:!1};function at({share:e,t,language:n,onRevoked:r,onExtended:i}){let[a,o]=(0,Y.useReducer)(re,it),{revokeOpen:s,revoking:c,linksOpen:l,urlCopied:u,copyFailed:d,extending:f}=a,p=!e.expired&&!e.revoked,m=e.revoked?t.statusRevoked:e.expired?t.statusExpired:t.statusActive,h=e.revoked?`text-red-600 dark:text-red-400`:e.expired?`text-fg-subtle`:`text-emerald-600 dark:text-emerald-400`,v=(0,Y.useCallback)(async()=>{o({type:`patch`,patch:{revokeOpen:!1,revoking:!0}});try{await ie(e.id),r()}catch{}finally{o({type:`patch`,patch:{revoking:!1}})}},[e.id,r]),y=(0,Y.useCallback)(async()=>{if(o({type:`patch`,patch:{linksOpen:!0,copyFailed:!1}}),!await H(e.shareUrl)){o({type:`patch`,patch:{copyFailed:!0}}),window.setTimeout(()=>o({type:`patch`,patch:{copyFailed:!1}}),2500);return}o({type:`patch`,patch:{urlCopied:!0}}),window.setTimeout(()=>o({type:`patch`,patch:{urlCopied:!1}}),2e3)},[e.shareUrl]),x=(0,Y.useCallback)(async()=>{o({type:`patch`,patch:{extending:!0}});try{await le(e.id,864e5),i()}catch{}finally{o({type:`patch`,patch:{extending:!1}})}},[e.id,i]),C=`share-links-${e.id}`;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`div`,{className:`rounded-lg bg-surface-panel/80 px-3 py-2.5 shadow-surface`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,$.jsxs)(`button`,{type:`button`,className:I(`flex min-w-0 flex-1 items-start gap-3 rounded-md text-left`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`),"aria-expanded":l,"aria-controls":C,onClick:()=>o({type:`patch`,patch:{linksOpen:!l}}),children:[(0,$.jsx)(_,{className:I(`mt-0.5 size-4 shrink-0 text-fg-muted transition-transform`,l?`rotate-0`:`-rotate-90`),"aria-hidden":!0}),e.kind===`note`?(0,$.jsx)(A,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):e.kind===`session`?(0,$.jsx)(O,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}):(0,$.jsx)(w,{className:`mt-0.5 size-4 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{className:`truncate text-sm font-medium text-fg`,children:e.fileName}),(0,$.jsx)(`span`,{className:I(`text-xs font-medium`,h),children:m})]}),(0,$.jsx)(`p`,{className:`truncate text-xs text-fg-subtle`,children:e.kind===`note`?n===`zh`?`笔记快照 · 版本 ${e.snapshotRevision??1}`:`Note snapshot · revision ${e.snapshotRevision??1}`:e.kind===`session`?n===`zh`?`会话快照 · ${e.messageCount??0} 条消息 · 版本 ${e.snapshotRevision??1}`:`Conversation snapshot · ${e.messageCount??0} messages · revision ${e.snapshotRevision??1}`:e.workspaceRelativePath}),(0,$.jsxs)(`div`,{className:`mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-fg-muted`,children:[(0,$.jsx)(`span`,{children:Be(e.fileSize)}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,$.jsx)(b,{className:`size-3`}),e.expired?n===`zh`?`已过期`:`expired`:Ve(e.expiresAt,n)]}),(0,$.jsxs)(`span`,{children:[t.views,`: `,e.downloadCount,e.maxViews!==null&&` ${t.viewsOf} ${e.maxViews}`]}),e.description&&(0,$.jsx)(`span`,{className:`italic text-fg-subtle`,children:e.description})]})]})]}),(0,$.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`px-2 py-1`,title:t.copyUrl,onClick:()=>void y(),children:u?(0,$.jsx)(g,{className:`size-3.5 text-emerald-500`}):(0,$.jsx)(S,{className:`size-3.5`})}),(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`px-2 py-1`,onClick:()=>void x(),disabled:f,title:t.extend,children:f?(0,$.jsx)(D,{className:`size-3.5 animate-spin`}):(0,$.jsx)(b,{className:`size-3.5`})}),(0,$.jsx)(V,{type:`button`,variant:`ghost`,className:`px-2 py-1 text-red-600 hover:text-red-700 dark:text-red-400`,onClick:()=>o({type:`patch`,patch:{revokeOpen:!0}}),disabled:c,children:c?(0,$.jsx)(D,{className:`size-3.5 animate-spin`}):(0,$.jsx)(j,{className:`size-3.5`})})]})})]}),p&&l?(0,$.jsxs)(`div`,{id:C,className:`mt-3 bg-surface-base/45 py-3 pl-7 pr-3`,children:[(0,$.jsx)(N,{shareUrl:e.shareUrl,lanUrl:e.lanUrl,reachability:e.reachability,compact:!0}),d?(0,$.jsx)(`p`,{className:`mt-2 text-xs text-red-600 dark:text-red-400`,children:t.copyFailed}):null,(0,$.jsx)(`div`,{className:`mt-2`,children:(0,$.jsx)(P,{reachability:e.reachability})})]}):null]}),(0,$.jsx)(G,{open:s,title:t.revokeConfirmTitle,description:t.revokeConfirmBody,confirmLabel:t.revokeConfirmLabel,cancelLabel:t.cancel,destructive:!0,onConfirm:()=>void v(),onCancel:()=>o({type:`patch`,patch:{revokeOpen:!1}})})]})}function ot({t:e,onCleaned:t}){let[n,r]=(0,Y.useState)(!1),[i,a]=(0,Y.useState)(!1),o=(0,Y.useCallback)(async()=>{r(!1),a(!0);try{await de(),t()}catch{}finally{a(!1)}},[t]);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{className:`mt-3 flex justify-end`,children:(0,$.jsxs)(V,{type:`button`,variant:`secondary`,disabled:i,onClick:()=>r(!0),className:`border-danger/40 px-2 py-1 text-xs text-danger hover:bg-danger/10`,children:[i?(0,$.jsx)(D,{className:`size-3.5 animate-spin`}):(0,$.jsx)(j,{className:`size-3.5`}),e.cleanExpired]})}),(0,$.jsx)(G,{open:n,title:e.cleanExpiredConfirmTitle,description:e.cleanExpiredConfirmBody,confirmLabel:e.cleanExpiredConfirmLabel,cancelLabel:e.cancel,destructive:!0,onConfirm:()=>void o(),onCancel:()=>r(!1)})]})}export{Ue as SharesSettingsPanel};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),n=e(`notebook-text`,[[`path`,{d:`M2 6h4`,key:`aawbzj`}],[`path`,{d:`M2 10h4`,key:`l0bgd4`}],[`path`,{d:`M2 14h4`,key:`1gsvsf`}],[`path`,{d:`M2 18h4`,key:`1bu2t1`}],[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,key:`1nb95v`}],[`path`,{d:`M9.5 8h5`,key:`11mslq`}],[`path`,{d:`M9.5 12H16`,key:`ktog6x`}],[`path`,{d:`M9.5 16H14`,key:`p1seyn`}]]),r=e(`scan-search`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`m16 16-1.9-1.9`,key:`1dq9hf`}]]),i=e(`star`,[[`path`,{d:`M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z`,key:`r04s7s`}]]);export{t as i,r as n,n as r,i as t};
@@ -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-Cit_aHqC.js";import{t as f}from"./messages-DQveK9sk.js";import{a as p,i as m,n as h,o as g,r as _,s as v,t as y}from"./dist-CY7CS_D3.js";import{C as b,G as x,U as S,it as C,t as w}from"./chat-page-hcsqrv-7.js";import{t as T}from"./arrow-left-D880xG-P.js";import{f as E,i as D,u as O}from"./automation-display-DaVDNZz8.js";import{t as k}from"./check-DUBLcKHA.js";import{t as A}from"./chevron-right-BweFrslA.js";import{n as j,r as M}from"./popover-select-CLsphyzA.js";import{t as N}from"./circle-BoO4YvTx.js";import{t as P}from"./ellipsis-0k4rZLoy.js";import{t as F}from"./external-link-DjqjBmc3.js";import{t as I}from"./folder-kanban-CpLlFI1o.js";import{t as L}from"./folder-open-CyzJ19I9.js";import{B as R,H as z,I as ee,P as B}from"./markdown-view-CiGdWuN3.js";import{t as te}from"./message-square-fVE7Ghj1.js";import{t as ne}from"./pause-DuPxgSxk.js";import{t as re}from"./play-kxZvpBg8.js";import{t as ie}from"./x-B_N4OPjy.js";import{t as V}from"./cn-0WouolD0.js";import{t as ae}from"./skeleton-DzdOeGYz.js";import{c as oe}from"./api-Cl08_xtM.js";import{ht as se,mt as ce}from"./session-manager-Cby6Nkib.js";import{i as le}from"./vendor-swr-CdRzEUwF.js";import{C as ue,D as de,T as fe,_ as pe,a as me,f as he,i as ge,l as _e,n as ve,r as ye,t as H,u as be,x as xe}from"./workspace-preview-store-BrofEVle.js";import{t as Se}from"./chat-agents-api-Bim8--J9.js";import{t as U}from"./button-Cc4hUNTt.js";import{n as Ce}from"./right-workspace-store-BzXnZDK5.js";import{c as we}from"./composer-payload-handoff-CRCz17sd.js";import{t as Te}from"./page-header-store-DwFwq_lI.js";import{t as Ee}from"./agent-avatar-display-CIsejg_E.js";import{t as De}from"./automation-api-GcRQ9wM4.js";import{n as Oe}from"./agent-display-names-Bje7vfSn.js";import{t as ke}from"./sliding-tab-list-CmcrqRzN.js";import{t as Ae}from"./confirm-dialog-DrA5mTQp.js";import{l as je,m as Me,o as Ne,r as Pe,t as Fe,u as Ie}from"./dist-ZrL34Ps4.js";import{d as Le,f as W,l as Re,o as ze,u as Be}from"./automation-task-card-sR61FFLn.js";import{t as Ve}from"./date-picker-DRSq2kDz.js";import{t as He}from"./time-picker-C1PXAXZF.js";import{n as Ue}from"./date-formatters-DukWSVwc.js";import{t as We}from"./date-time-picker--LGC1D3b.js";import{n as Ge,r as G,t as Ke}from"./task-result-evidence-dtN1sSjU.js";import{t as qe}from"./page-context-capture-button-Cw58-5P3.js";import{t as Je}from"./dependency-picker-XjPB8FJS.js";var K=e(t(),1),q=n(),J=r();function Ye(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 Xe(e){let t=(0,q.c)(32),n,r,i,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],c=t[6],l=t[7]):({panelId:r,title:l,defaultOpen:s,children:n,summaryClassName:o,chevron:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c,t[7]=l);let u=s!==void 0&&s,d=c!==void 0&&c,[f,p]=a(),m;if(t[8]!==u||t[9]!==r||t[10]!==f){let e=f.getAll(`taskPanel`);m=e.includes(r)||u&&!e.includes(`${r}:closed`),t[8]=u,t[9]=r,t[10]=f,t[11]=m}else m=t[11];let h=m,g=o??`cursor-pointer py-2 text-xs text-fg-muted hover:text-fg`,_=d&&`flex list-none items-center justify-between gap-3 [&::-webkit-details-marker]:hidden`,v;t[12]!==g||t[13]!==_?(v=V(g,_),t[12]=g,t[13]=_,t[14]=v):v=t[14];let y;t[15]!==h||t[16]!==r||t[17]!==p?(y=e=>{e.preventDefault(),p(e=>Ye(e,r,!h),{preventScrollReset:!0})},t[15]=h,t[16]=r,t[17]=p,t[18]=y):y=t[18];let b;t[19]!==d||t[20]!==h||t[21]!==l?(b=d?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1`,children:l}),(0,J.jsx)(A,{"aria-hidden":!0,className:V(`size-4 shrink-0 text-fg-subtle motion-safe:transition-transform motion-safe:duration-150`,h&&`rotate-90`)})]}):l,t[19]=d,t[20]=h,t[21]=l,t[22]=b):b=t[22];let x;t[23]!==v||t[24]!==y||t[25]!==b?(x=(0,J.jsx)(`summary`,{className:v,onClick:y,children:b}),t[23]=v,t[24]=y,t[25]=b,t[26]=x):x=t[26];let S;return t[27]!==n||t[28]!==h||t[29]!==i||t[30]!==x?(S=(0,J.jsxs)(`details`,{...i,open:h,children:[x,n]}),t[27]=n,t[28]=h,t[29]=i,t[30]=x,t[31]=S):S=t[31],S}function Ze(e){let t=e;for(;t&&!/(auto|scroll)/.test(getComputedStyle(t).overflowY);)t=t.parentElement;return t}function Qe(e,t){let n=e?.closest(`.task-detail-scroll`),r=Array.from(n?.querySelectorAll(`[data-task-section]`)??[]).find(e=>e.dataset.taskSection===t);if(!r||!n)return;r instanceof HTMLDetailsElement&&(r.open=!0);let i=Ze(n),a=window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;if(!i){r.scrollIntoView({block:`start`,behavior:a?`instant`:`smooth`});return}let o=(e?.parentElement?.getBoundingClientRect().height??0)+16,s=Math.max(0,Math.min(i.scrollHeight-i.clientHeight,i.scrollTop+r.getBoundingClientRect().top-i.getBoundingClientRect().top-i.clientTop-o));i.scrollTo({top:s,behavior:a?`instant`:`smooth`});let c=i;return{cancel:()=>c.scrollTo({top:c.scrollTop,behavior:`instant`}),isComplete:()=>Math.abs(c.scrollTop-s)<1}}function $e(e){let t=(0,q.c)(28),{language:n,hasSchedule:r}=e,[i,o]=a(),s;t[0]===i?s=t[1]:(s=i.get(`taskSection`),t[0]=i,t[1]=s);let c=s,l=(0,K.useRef)(null),u=(0,K.useRef)(null),d=(0,K.useRef)(null),f=(0,K.useRef)(void 0),p=(0,K.useRef)(o),m=(0,K.useRef)(c),h,g;t[2]!==c||t[3]!==o?(h=()=>{p.current=o,m.current=c},g=[o,c],t[2]=c,t[3]=o,t[4]=h,t[5]=g):(h=t[4],g=t[5]),(0,K.useEffect)(h,g);let _=(0,K.useRef)(void 0),v=(0,K.useRef)(!1),y;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(y=()=>{let e=d.current;d.current=null,_.current=void 0,!(!e||!v.current)&&(v.current=!1,p.current(t=>{let n=Ye(t,e,!0);return n.set(`taskSection`,e),n},{preventScrollReset:!0}))},t[6]=y):y=t[6];let b=y,x;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(x=(e,t)=>{let n=t!==void 0&&t;clearTimeout(f.current),d.current=e,v.current=n,f.current=setTimeout(b,800),_.current=Qe(l.current,e)},t[7]=x):x=t[7];let S=x,[C,w]=(0,K.useState)(c??`results`),T;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(T=[],t[8]=T):T=t[8];let[E,D]=(0,K.useState)(T),O;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(O=()=>{let e=l.current,t=e?.closest(`.task-detail-scroll`),n=e?.parentElement;if(!t||!n)return;let r=Array.from(t.querySelectorAll(`[data-task-section]`));D(r.map(et));let i=0,a=()=>{if(d.current)return;let e=Ze(t),i=n.getBoundingClientRect().bottom+24,a=r[0];for(let e of r)e.getBoundingClientRect().top<=i&&(a=e);if(e&&e.scrollHeight>e.clientHeight&&e.scrollTop+e.clientHeight>=e.scrollHeight-2&&(a=r.at(-1)),!a)return;let o=a.dataset.taskSection;w(o),m.current!==o&&(u.current=o,clearTimeout(f.current),f.current=setTimeout(()=>{p.current(e=>{let t=new URLSearchParams(e);return t.set(`taskSection`,o),t},{replace:!0,preventScrollReset:!0})},160))},o=e=>{if(!(!(e.target instanceof Element)||!e.target.contains(t))){if(d.current){clearTimeout(f.current),f.current=setTimeout(b,160);return}clearTimeout(f.current),i||=requestAnimationFrame(()=>{i=0,a()})}},s=n=>{!(n.target instanceof Node)||!t.contains(n.target)||e.contains(n.target)||n instanceof KeyboardEvent&&![`ArrowUp`,`ArrowDown`,`PageUp`,`PageDown`,`Home`,`End`,` `].includes(n.key)||(_.current?.cancel(),_.current=void 0,d.current=null,v.current=!1,clearTimeout(f.current))},c=e=>{e.target instanceof Element&&e.target.contains(t)&&d.current&&(!_.current||_.current.isComplete())&&(clearTimeout(f.current),b())},h=()=>{let e=n.getBoundingClientRect().height;for(let t of r)t.style.scrollMarginTop=`${e+16}px`};h();let g=typeof ResizeObserver>`u`?null:new ResizeObserver(h);return g?.observe(n),window.addEventListener(`resize`,h),document.addEventListener(`scroll`,o,!0),document.addEventListener(`scrollend`,c,!0),document.addEventListener(`wheel`,s,{capture:!0,passive:!0}),document.addEventListener(`touchstart`,s,{capture:!0,passive:!0}),document.addEventListener(`pointerdown`,s,{capture:!0,passive:!0}),document.addEventListener(`keydown`,s,!0),()=>{cancelAnimationFrame(i),g?.disconnect(),window.removeEventListener(`resize`,h),document.removeEventListener(`scroll`,o,!0),document.removeEventListener(`scrollend`,c,!0),document.removeEventListener(`wheel`,s,!0),document.removeEventListener(`touchstart`,s,!0),document.removeEventListener(`pointerdown`,s,!0),document.removeEventListener(`keydown`,s,!0)}},t[9]=O):O=t[9];let k;t[10]!==r||t[11]!==n?(k=[n,r,b],t[10]=r,t[11]=n,t[12]=k):k=t[12],(0,K.useEffect)(O,k);let A,j;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(j=()=>()=>{clearTimeout(f.current),_.current?.cancel()},A=[],t[13]=A,t[14]=j):(A=t[13],j=t[14]),(0,K.useEffect)(j,A);let M,N;t[15]===c?(M=t[16],N=t[17]):(M=()=>{!c||u.current===c||(u.current=c,w(c),S(c))},N=[c,S],t[15]=c,t[16]=M,t[17]=N),(0,K.useEffect)(M,N);let P;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(P=()=>{let e=l.current,t=e?.querySelector(`[aria-current="location"]`);if(!e||!t)return;let n=t.offsetLeft<e.scrollLeft?t.offsetLeft:t.offsetLeft+t.offsetWidth>e.scrollLeft+e.clientWidth?t.offsetLeft+t.offsetWidth-e.clientWidth:e.scrollLeft;n!==e.scrollLeft&&e.scrollTo({left:n,behavior:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches?`instant`:`smooth`})},t[18]=P):P=t[18];let F;t[19]!==C||t[20]!==E?(F=[C,E],t[19]=C,t[20]=E,t[21]=F):F=t[21],(0,K.useEffect)(P,F);let I=n===`zh`?`任务详情分区`:`Task detail sections`,L;t[22]!==C||t[23]!==E?(L=E.map(e=>(0,J.jsx)(`button`,{type:`button`,"aria-current":C===e.id?`location`:void 0,"aria-pressed":C===e.id,"data-sliding-active":C===e.id,className:V(`relative z-10 min-h-9 min-w-max flex-1 touch-manipulation rounded-lg px-3 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accent`,C===e.id?`text-fg`:`text-fg-muted hover:text-fg`),onClick:()=>{u.current=e.id,w(e.id),S(e.id,!0)},children:e.label},e.id)),t[22]=C,t[23]=E,t[24]=L):L=t[24];let R;return t[25]!==I||t[26]!==L?(R=(0,J.jsx)(ke,{scrollFocusedItemIntoView:!1,as:`nav`,ref:l,"aria-label":I,className:`flex w-full gap-0.5 overflow-x-auto rounded-xl bg-surface-inset p-1`,indicatorClassName:`rounded-lg bg-surface-panel ring-1 ring-edge-subtle duration-300 [transition-timing-function:cubic-bezier(0.22,1,0.36,1)]`,children:L}),t[25]=I,t[26]=L,t[27]=R):R=t[27],R}function et(e){return{id:e.dataset.taskSection,label:e.dataset.taskSectionLabel}}var tt=`Default criteria were not expanded into concrete acceptance items; broad completion cannot certify item coverage.`;function nt(e){let t=(0,q.c)(64),{criterion:n,index:r,language:i,closed:a,pending:o,onReview:s,projectId:c,conversationId:l}=e,u=i===`zh`,d=(0,K.useId)(),f=n.status===`passed`,p=n.evidence.length>0||n.method||n.review||n.note,m=n.verificationStatus===`passed`?u?`通过`:`Passed`:n.verificationStatus===`failed`?u?`未通过`:`Failed`:u?`未核验`:`Unverified`,h=n.review?.status===`passed`?u?`已验收`:`Accepted`:n.review?.status===`failed`?u?`未通过`:`Failed`:u?`已撤销验收`:`Acceptance cleared`,g=!a&&!o&&`cursor-pointer`,_;t[0]===g?_=t[1]:(_=V(`relative grid size-11 shrink-0 place-items-center rounded-full`,g),t[0]=g,t[1]=_);let v=o||void 0,y;t[2]!==r||t[3]!==s||t[4]!==o?(y=e=>{o||s(r,e.target.checked?`passed`:`unverified`)},t[2]=r,t[3]=s,t[4]=o,t[5]=y):y=t[5];let b;t[6]!==f||t[7]!==a||t[8]!==v||t[9]!==y||t[10]!==d?(b=(0,J.jsx)(`input`,{type:`checkbox`,"aria-labelledby":d,className:`peer sr-only`,checked:f,disabled:a,"aria-disabled":v,onChange:y}),t[6]=f,t[7]=a,t[8]=v,t[9]=y,t[10]=d,t[11]=b):b=t[11];let x=f?`border-edge bg-surface-inset text-fg`:`border-fg-subtle/70`,S=!a&&!o&&`hover:bg-surface-hover`,C;t[12]!==x||t[13]!==S?(C=V(`grid size-5 place-items-center rounded-full border motion-safe:transition-colors motion-safe:duration-150 peer-focus-visible:ring-2 peer-focus-visible:ring-accent peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-surface-panel`,x,S),t[12]=x,t[13]=S,t[14]=C):C=t[14];let w;t[15]===f?w=t[16]:(w=f?(0,J.jsx)(k,{className:`size-3.5`,strokeWidth:2.8}):null,t[15]=f,t[16]=w);let T;t[17]!==C||t[18]!==w?(T=(0,J.jsx)(`span`,{"aria-hidden":!0,className:C,children:w}),t[17]=C,t[18]=w,t[19]=T):T=t[19];let E;t[20]!==T||t[21]!==_||t[22]!==b?(E=(0,J.jsxs)(`label`,{className:_,children:[b,T]}),t[20]=T,t[21]=_,t[22]=b,t[23]=E):E=t[23];let D=`criterion:${r}:evidence`,O;t[24]!==n.text||t[25]!==d?(O=(0,J.jsx)(`span`,{id:d,className:`block whitespace-pre-wrap break-words text-sm leading-5 text-fg [overflow-wrap:anywhere]`,children:n.text}),t[24]=n.text,t[25]=d,t[26]=O):O=t[26];let A=u?`验收依据`:`Acceptance evidence`,j;t[27]===A?j=t[28]:(j=(0,J.jsx)(`p`,{className:`font-medium text-fg`,children:A}),t[27]=A,t[28]=j);let M;t[29]!==n.method||t[30]!==m||t[31]!==u?(M=n.method?(0,J.jsxs)(`p`,{children:[u?`自动核验`:`Automatic verification`,` · `,m,n.method===`model_reviewed`?u?` · 模型审阅`:` · Model review`:``]}):null,t[29]=n.method,t[30]=m,t[31]=u,t[32]=M):M=t[32];let N;t[33]!==n.review||t[34]!==i||t[35]!==h||t[36]!==u?(N=n.review?(0,J.jsxs)(`p`,{children:[u?`人工验收`:`User review`,` · `,h,` · `,Ue(n.review.reviewedAt,i)]}):null,t[33]=n.review,t[34]=i,t[35]=h,t[36]=u,t[37]=N):N=t[37];let P;t[38]!==n.note||t[39]!==r||t[40]!==i?(P=n.note&&n.note!==tt?(0,J.jsx)(G,{content:n.note,contentKey:`criterion:${r}:note`,language:i,markdown:!1}):null,t[38]=n.note,t[39]=r,t[40]=i,t[41]=P):P=t[41];let F;t[42]!==l||t[43]!==n.evidence||t[44]!==i||t[45]!==c?(F=(0,J.jsx)(Ke,{evidence:n.evidence,projectId:c,conversationId:l,language:i}),t[42]=l,t[43]=n.evidence,t[44]=i,t[45]=c,t[46]=F):F=t[46];let I;t[47]!==p||t[48]!==u?(I=p?null:(0,J.jsx)(`p`,{children:u?`暂无验收依据`:`No evidence yet`}),t[47]=p,t[48]=u,t[49]=I):I=t[49];let L;t[50]!==j||t[51]!==M||t[52]!==N||t[53]!==P||t[54]!==F||t[55]!==I?(L=(0,J.jsxs)(`div`,{className:`mb-3 space-y-2 rounded-lg bg-surface-inset px-3 py-2.5 text-xs leading-5 text-fg-muted`,children:[j,M,N,P,F,I]}),t[50]=j,t[51]=M,t[52]=N,t[53]=P,t[54]=F,t[55]=I,t[56]=L):L=t[56];let R;t[57]!==D||t[58]!==O||t[59]!==L?(R=(0,J.jsx)(Xe,{panelId:D,chevron:!0,className:`min-w-0 flex-1`,summaryClassName:`-ms-1 min-h-11 cursor-pointer rounded-lg py-3 pe-2 ps-1 outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,title:O,children:L}),t[57]=D,t[58]=O,t[59]=L,t[60]=R):R=t[60];let z;return t[61]!==E||t[62]!==R?(z=(0,J.jsxs)(`li`,{className:`relative flex min-w-0 items-start px-2 before:absolute before:end-0 before:start-13 before:top-0 before:border-t before:border-edge-subtle first:before:hidden sm:px-3`,children:[E,R]}),t[61]=E,t[62]=R,t[63]=z):z=t[63],z}function rt(e){let t=(0,q.c)(39),{criteria:n,language:r,closed:i,pending:a,blockedReason:o,error:s,onReview:c,projectId:l,conversationId:u}=e,d=r===`zh`,f;t[0]===n?f=t[1]:(f=n.some(at),t[0]=n,t[1]=f);let p=f,m;t[2]!==p||t[3]!==d?(m=p?(0,J.jsx)(Xe,{panelId:`acceptance:diagnostic`,title:d?`自动核验未完成:验收标准过于宽泛`:`Automatic verification incomplete: criteria are too broad`,className:`mx-4 mb-2 text-xs leading-5 text-fg-muted`,children:(0,J.jsx)(`p`,{className:`mt-2 break-words`,children:tt})}):null,t[2]=p,t[3]=d,t[4]=m):m=t[4];let h=a||void 0,g;if(t[5]!==i||t[6]!==u||t[7]!==n||t[8]!==r||t[9]!==c||t[10]!==a||t[11]!==l){let e;t[13]!==i||t[14]!==u||t[15]!==r||t[16]!==c||t[17]!==a||t[18]!==l?(e=(e,t)=>(0,J.jsx)(nt,{criterion:e,index:t,language:r,closed:i,pending:a,onReview:c,projectId:l,conversationId:u},`${t}:${e.text}`),t[13]=i,t[14]=u,t[15]=r,t[16]=c,t[17]=a,t[18]=l,t[19]=e):e=t[19],g=n.map(e),t[5]=i,t[6]=u,t[7]=n,t[8]=r,t[9]=c,t[10]=a,t[11]=l,t[12]=g}else g=t[12];let _;t[20]!==h||t[21]!==g?(_=(0,J.jsx)(`ul`,{"aria-busy":h,className:`border-t border-edge-subtle`,children:g}),t[20]=h,t[21]=g,t[22]=_):_=t[22];let v;t[23]!==n.length||t[24]!==d?(v=n.length===0?(0,J.jsx)(`p`,{className:`px-4 py-4 text-sm text-fg-muted`,children:d?`尚未定义验收标准`:`No acceptance criteria defined`}):null,t[23]=n.length,t[24]=d,t[25]=v):v=t[25];let y;t[26]===s?y=t[27]:(y=s?(0,J.jsx)(`p`,{role:`alert`,className:`mx-4 my-2 text-sm text-danger`,children:s}):null,t[26]=s,t[27]=y);let b;t[28]!==o||t[29]!==i||t[30]!==n||t[31]!==d?(b=!i&&n.length>0&&(o||n.some(it))?(0,J.jsx)(`p`,{className:`border-t border-edge-subtle px-4 py-2.5 text-xs text-fg-muted`,children:o??(d?`勾选全部验收项后,任务自动完成。`:`Checking all criteria completes the task.`)}):null,t[28]=o,t[29]=i,t[30]=n,t[31]=d,t[32]=b):b=t[32];let x;return t[33]!==m||t[34]!==_||t[35]!==v||t[36]!==y||t[37]!==b?(x=(0,J.jsxs)(J.Fragment,{children:[m,_,v,y,b]}),t[33]=m,t[34]=_,t[35]=v,t[36]=y,t[37]=b,t[38]=x):x=t[38],x}function it(e){return e.status!==`passed`}function at(e){return e.note===tt}function ot(e){let t=(0,q.c)(22),{detail:n,language:r}=e,i=r===`zh`,a;if(t[0]!==n||t[1]!==r||t[2]!==i){let e=ve(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(ft)),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(dt).map(ut);let e=new Set(l.map(lt).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(ct))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,J.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,J.jsx)(Ke,{evidence:l,language:r,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,compact:!0}):(0,J.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,J.jsxs)(`section`,{"aria-label":i?`交付结果`:`Deliverables`,className:`rounded-xl border border-edge-subtle bg-surface-panel p-4`,children:[p,d?(0,J.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,J.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,J.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,J.jsxs)(`div`,{className:`mt-4 space-y-2 border-t border-edge-subtle pt-3`,"aria-label":i?`执行待办`:`Run follow-up`,children:[(0,J.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,J.jsx)(`ul`,{className:`space-y-2 text-sm leading-6 text-fg`,children:[...new Set(e.remainingWork)].map(st)}):null,e.nextAction?(0,J.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-sm leading-6 text-fg [overflow-wrap:anywhere]`,children:e.nextAction}):null,e.failure?(0,J.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,J.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:B(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 st(e){return(0,J.jsx)(`li`,{className:`whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e},e)}function ct(e){return e.kind===`artifact`}function lt(e){return e.uri}function ut(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 dt(e){return e.role===`deliverable`}function ft(e){return e.id}function pt(e){let t=(0,q.c)(13),{detail:n,language:r}=e,i=r===`zh`,a=we(r),o;t[0]===n?o=t[1]:(o=ve(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,K.useState)(`idle`),f;t[4]===s?f=t[5]:(f=async function(e){if(s){d(`pending`);try{await ue(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,J.jsx)(x,{detail:n,language:r}),t[6]=n,t[7]=r,t[8]=m):m=t[8];let h=s?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`h3`,{className:`text-sm font-medium text-fg`,children:a.latestResult}),(0,J.jsxs)(`span`,{className:`text-xs text-fg-muted`,children:[a.receiptStatuses[s.status],` · `,a.verificationStatuses[s.verification.status]]})]}),(0,J.jsx)(G,{content:s.summary,contentKey:`${n.task.id}:result:${s.runId}`,language:r}),s.evidence.length>0?(0,J.jsxs)(`details`,{children:[(0,J.jsxs)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:[i?`验证依据与执行产物`:`Evidence and artifacts`,` · `,s.evidence.length]}),(0,J.jsx)(Ke,{evidence:s.evidence,projectId:n.task.projectId,conversationId:n.conversation.activeConversationId??void 0,language:r})]}):null,(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-edge-subtle pt-3`,children:[(0,J.jsx)(U,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`helpful`),children:a.doneWell}),(0,J.jsx)(U,{variant:`ghost`,className:`min-h-9 px-2 text-xs`,disabled:u===`pending`,onClick:()=>void p(`not_helpful`),children:a.needsFix}),u===`saved`?(0,J.jsx)(`span`,{role:`status`,className:`text-xs text-fg-muted`,children:i?`反馈已记录`:`Feedback saved`}):null,u===`failed`?(0,J.jsx)(`span`,{role:`alert`,className:`text-xs text-danger`,children:a.actionFailed}):null]})]}):null,g=l.length>0?(0,J.jsxs)(`details`,{className:`border-t border-edge-subtle pt-3`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer py-2 text-xs text-fg-muted`,children:a.executionHistory.replace(`{{count}}`,String(l.length))}),(0,J.jsx)(`div`,{className:`mt-3 space-y-4`,children:l.map(e=>(0,J.jsxs)(`article`,{className:`space-y-2 rounded-lg bg-surface-hover p-3`,children:[(0,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:a.receiptStatuses[e.status]}),(0,J.jsx)(G,{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,J.jsxs)(`div`,{className:`space-y-4`,children:[m,h,g]}),t[9]=m,t[10]=h,t[11]=g,t[12]=_):_=t[12],_}function mt(e){let t=(0,q.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,J.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,J.jsxs)(`li`,{className:`text-sm text-fg`,children:[(0,J.jsxs)(`div`,{children:[o[e.fromPhase],e.fromResolution?` · ${u[e.fromResolution]}`:``,` → `,o[e.toPhase],e.toResolution?` · ${u[e.toResolution]}`:``]}),(0,J.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,J.jsx)(`time`,{dateTime:new Date(e.createdAt).toISOString(),children:Ue(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,J.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,J.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,J.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 ht({schedules:e,language:t,onEdit:n,onUpdated:r}){let i=t===`zh`,a=f(t),[s,c]=(0,K.useState)(null),l=(0,K.useRef)(!1),[u,d]=(0,K.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 De.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,J.jsxs)(`section`,{"aria-label":i?`执行时间`:`Execution schedule`,className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:i?`执行时间`:`Execution schedule`}),(0,J.jsx)(`div`,{className:`mt-3 space-y-4`,children:e.map(e=>{let r=e.trigger.kind===`schedule`?e.trigger.schedule:null,c=O(e),l=!e.management||e.management.editable.includes(`trigger`),u=!e.management||e.management.editable.includes(`enabled`);return(0,J.jsxs)(`article`,{className:`space-y-2 text-sm text-fg`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,J.jsx)(`span`,{className:`break-words font-medium`,children:e.name}),(0,J.jsx)(`span`,{className:`text-xs text-fg-muted`,children:c?i?`已执行`:`Completed`:e.enabled?i?`已启用`:`Enabled`:i?`已取消定时执行`:`Scheduling disabled`})]}),(0,J.jsx)(`p`,{children:r?.kind===`once`?`${i?`单次执行:`:`Run once: `}${p(Date.parse(r.at))}`:D(e.trigger,a.automations,a.cron,t)}),r?.kind===`cron`?(0,J.jsxs)(`p`,{className:`text-xs text-fg-muted`,children:[i?`执行时区:`:`Schedule timezone: `,r.tz||(i?`服务所在电脑时区`:`Server timezone`)]}):null,(0,J.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,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[l?(0,J.jsx)(U,{variant:`secondary`,disabled:s!==null,onClick:()=>n(e),children:i?`修改时间`:`Edit schedule`}):null,e.enabled&&u?(0,J.jsx)(U,{variant:`ghost`,disabled:s!==null,onClick:()=>void m(e),children:s===e.id?i?`正在取消…`:`Cancelling…`:i?`取消定时执行`:`Cancel schedule`}):null,(0,J.jsx)(U,{asChild:!0,variant:`ghost`,children:(0,J.jsx)(o,{to:`/automations?automation=${encodeURIComponent(e.id)}`,children:i?`查看自动化`:`View automation`})})]})]},e.id)})}),u?(0,J.jsx)(`p`,{role:`alert`,className:`mt-3 text-sm text-danger`,children:u}):null]})}var gt=`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 _t({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,K.useState)(()=>c?Le(c):{...W,name:t,projectId:n??``,actionMode:`task_command`,taskId:e,agentId:r??``,triggerMode:`once`,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone||`UTC`}),[x,S]=(0,K.useState)(null),[C,w]=(0,K.useState)(!1),T=(0,K.useRef)(!1),[E,D]=(0,K.useState)(null),O=e=>b(t=>({...t,...e}));async function k(e){if(e.preventDefault(),!(T.current||x)&&(D(null),!(!d.name.trim()||!c&&!r))){if(d.triggerMode===`once`&&(!Number.isFinite(new Date(d.onceAt).getTime())||new Date(d.onceAt).getTime()<=Date.now())){D(u.experience.futureTime);return}T.current=!0,w(!0);try{let e=c?Re(c,d).trigger:Be(d).trigger,{automation:t}=c?await De.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 De.create({...Be(d),enabled:!0});S(t),s(t)}catch(e){D(e instanceof Error?e.message:u.feedback.actionFailed)}finally{T.current=!1,w(!1)}}}return(0,J.jsx)(y,{open:!0,onOpenChange:e=>{!e&&!T.current&&a()},children:(0,J.jsxs)(g,{children:[(0,J.jsx)(p,{className:`fixed inset-0 z-[110] bg-black/45`}),(0,J.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,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 border-b border-edge-subtle px-5 py-4`,children:[(0,J.jsx)(v,{className:`text-base font-semibold text-fg`,children:c?l?`修改执行时间`:`Edit execution schedule`:l?`设置执行时间`:`Set execution time`}),(0,J.jsx)(h,{asChild:!0,children:(0,J.jsx)(U,{variant:`ghost`,className:`size-9 p-0`,disabled:C,"aria-label":l?`关闭`:`Close`,children:(0,J.jsx)(ie,{className:`size-4`})})})]}),(0,J.jsx)(m,{className:`sr-only`,children:l?`为当前任务创建定时或周期自动化。`:`Create a scheduled or recurring automation for this task.`}),x?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,J.jsx)(`p`,{role:`status`,className:`text-sm font-medium text-fg`,children:c?l?`执行时间已更新`:`Schedule updated`:l?`执行时间已设置`:`Schedule created`}),(0,J.jsx)(`p`,{className:`break-words text-sm text-fg-muted`,children:x.name}),(0,J.jsx)(U,{asChild:!0,variant:`primary`,children:(0,J.jsx)(o,{to:`/automations?automation=${encodeURIComponent(x.id)}`,children:l?`查看自动化`:`View automation`})})]}),(0,J.jsx)(`footer`,{className:`shrink-0 border-t border-edge-subtle p-4`,children:(0,J.jsx)(U,{onClick:a,children:l?`完成`:`Done`})})]}):(0,J.jsxs)(`form`,{onSubmit:e=>void k(e),className:`flex min-h-0 flex-1 flex-col`,children:[(0,J.jsxs)(`div`,{className:`min-h-0 flex-1 space-y-4 overflow-y-auto p-5`,children:[(0,J.jsxs)(`p`,{className:`break-words text-sm text-fg-muted`,children:[l?`执行任务:`:`Task: `,t]}),(0,J.jsxs)(`fieldset`,{disabled:C,className:`space-y-4`,children:[(0,J.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.name,(0,J.jsx)(`input`,{required:!0,readOnly:!!c?.management,className:gt,value:d.name,onChange:e=>O({name:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.trigger,(0,J.jsxs)(j,{value:d.triggerMode,onChange:e=>O({triggerMode:e.target.value}),children:[c?.trigger.kind===`schedule`&&c.trigger.schedule.kind===`interval`?(0,J.jsx)(M,{value:`interval`,children:l?`固定间隔`:`Fixed interval`}):null,c?.trigger.kind===`schedule`&&c.trigger.schedule.kind===`cron`?(0,J.jsx)(M,{value:`cron`,children:l?`自定义规则`:`Custom schedule`}):null,(0,J.jsx)(M,{value:`once`,children:u.trigger.once}),(0,J.jsx)(M,{value:`daily`,children:u.trigger.daily}),(0,J.jsx)(M,{value:`weekly`,children:u.trigger.weekly})]})]}),d.triggerMode===`once`?(0,J.jsx)(We,{label:u.form.onceAt,disabled:C,value:d.onceAt,defaultTime:d.time,onChange:e=>O({onceAt:e})}):[`daily`,`weekly`].includes(d.triggerMode)?(0,J.jsxs)(`div`,{className:`grid gap-2 text-sm text-fg`,children:[(0,J.jsx)(`span`,{children:u.form.time}),(0,J.jsx)(He,{disabled:C,value:d.time,onChange:e=>O({time:e}),ariaLabel:u.form.time})]}):null,d.triggerMode===`weekly`?(0,J.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.form.day,(0,J.jsx)(j,{value:d.weekday,onChange:e=>O({weekday:e.target.value}),children:[`sunday`,`monday`,`tuesday`,`wednesday`,`thursday`,`friday`,`saturday`].map((e,t)=>(0,J.jsx)(M,{value:String(t),children:u.weekdays[e]},e))})]}):null,d.triggerMode===`cron`?(0,J.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`定时规则`:`Cron expression`,(0,J.jsx)(`input`,{required:!0,className:gt,value:d.cronExpr,onChange:e=>O({cronExpr:e.target.value})})]}):null,d.triggerMode===`interval`?(0,J.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,J.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`执行间隔`:`Interval`,(0,J.jsx)(`input`,{required:!0,type:`number`,min:`1`,className:gt,value:d.intervalValue,onChange:e=>O({intervalValue:e.target.value})})]}),(0,J.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[l?`单位`:`Unit`,(0,J.jsxs)(j,{value:d.intervalUnit,onChange:e=>O({intervalUnit:e.target.value}),children:[(0,J.jsx)(M,{value:`minute`,children:l?`分钟`:`Minutes`}),(0,J.jsx)(M,{value:`hour`,children:l?`小时`:`Hours`}),(0,J.jsx)(M,{value:`day`,children:l?`天`:`Days`}),(0,J.jsx)(M,{value:`week`,children:l?`周`:`Weeks`})]})]})]}):null,(0,J.jsx)(ze,{form:d,onChange:O,language:i}),(0,J.jsxs)(`label`,{className:`grid gap-2 text-sm text-fg`,children:[u.draft.notifications,(0,J.jsxs)(j,{disabled:!!c?.management,value:d.notificationPolicy,onChange:e=>O({notificationPolicy:e.target.value}),children:[(0,J.jsx)(M,{value:`attention`,children:u.draft.notifyAttention}),(0,J.jsx)(M,{value:`all`,children:u.draft.notifyAll}),(0,J.jsx)(M,{value:`none`,children:u.draft.notifyNone})]})]})]}),!c&&!r?(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:l?`请先为任务指定执行 Agent。`:`Assign an executor agent to the task first.`}):null,E?(0,J.jsx)(`p`,{role:`alert`,className:`text-sm text-danger`,children:E}):null]}),(0,J.jsxs)(`footer`,{className:`flex shrink-0 justify-end gap-2 border-t border-edge-subtle p-4`,children:[(0,J.jsx)(U,{type:`button`,variant:`ghost`,disabled:C,onClick:a,children:l?`取消`:`Cancel`}),(0,J.jsx)(U,{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 vt(e){let t=(0,q.c)(44),{detail:n,executorName:r,language:i,onUpdated:a}=e,s=i===`zh`,c;t[0]===n.waits?c=t[1]:(c=n.waits.find(St),t[0]=n.waits,t[1]=c);let l=c,u,d,f,p,m,h,g;if(t[2]!==n||t[3]!==r||t[4]!==i||t[5]!==a||t[6]!==l||t[7]!==s){u=n.allowedCommands.includes(`resolve_wait`)&&!l?n.waits.filter(xt):[];let e=u.length>0||n.attention.some(bt),c;t[15]===n?c=t[16]:(c=ve(n),t[15]=n,t[16]=c);let _=c,v;t[17]===n.runs?v=t[18]:(v=n.runs.find(yt),t[17]=n.runs,t[18]=v);let y=v,b=s?`等待开始执行。`:`Waiting to start.`,x=r?s?`${r} 正在处理任务。`:`${r} is working on the task.`:s?`任务处理中。`:`The task is in progress.`,S=s?`任务正在等待继续。`:`The task is waiting to resume.`,C=s?`正在检查执行结果。`:`Checking the result.`,w;t[19]!==S||t[20]!==C||t[21]!==b||t[22]!==x?(w={queued:b,running:x,waiting:S,verifying:C},t[19]=S,t[20]=C,t[21]=b,t[22]=x,t[23]=w):w=t[23];let T=w;f=l?.reason??n.waits[0]?.reason??(n.task.phase===`closed`?_?.summary??(s?`任务已关闭,可查看交付物与执行结果。`:`The task is closed. Review its deliverables and results.`):n.task.phase===`review`?s?`请检查交付物并勾选通过的验收项。`:`Review the deliverables and check the criteria that pass.`:(y&&T[y.status])??_?.summary??(s?`任务尚未开始,可开始执行或设置执行时间。`:`Start the task or set an execution time.`)),d=n.attention.length>0?(0,J.jsx)(`ul`,{className:`mt-3 space-y-3`,children:n.attention.map((e,t)=>{let r=u.some(t=>e.kind===`input_required`&&t.kind===`user_input`||e.kind===`approval_required`&&t.kind===`approval`);return(0,J.jsxs)(`li`,{className:`text-sm leading-6 text-fg-muted`,children:[(0,J.jsx)(G,{content:e.summary,contentKey:`${n.task.id}:attention:${e.kind}:${t}`,language:i,markdown:!1,previewHeight:72}),!r&&(e.kind===`input_required`||e.kind===`approval_required`)?(0,J.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:B(n.task.id),children:s?e.kind===`approval_required`?`查看并决定`:`补充信息`:e.kind===`approval_required`?`Review decision`:`Provide information`}):null]},`${e.kind}-${t}`)})}):null,p=s?`当前需要处理`:`Current action`,m=`rounded-xl border border-edge bg-surface-panel p-4`;let E=e?s?`需要你处理`:`Your action needed`:s?`当前进展`:`Current progress`,D=u.length>1?` · ${u.length}`:``;t[24]!==E||t[25]!==D?(h=(0,J.jsxs)(`h2`,{className:`text-sm font-semibold text-fg`,children:[E,D]}),t[24]=E,t[25]=D,t[26]=h):h=t[26];let O;t[27]!==n||t[28]!==a||t[29]!==s?(O=e=>(0,J.jsx)(Ge,{wait:e,detail:n,zh:s,onUpdated:a},e.id),t[27]=n,t[28]=a,t[29]=s,t[30]=O):O=t[30],g=u.map(O),t[2]=n,t[3]=r,t[4]=i,t[5]=a,t[6]=l,t[7]=s,t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h,t[14]=g}else u=t[8],d=t[9],f=t[10],p=t[11],m=t[12],h=t[13],g=t[14];let _;t[31]!==u.length||t[32]!==d||t[33]!==n.task||t[34]!==i||t[35]!==f||t[36]!==s?(_=u.length>0?d?(0,J.jsxs)(`details`,{className:`mt-3`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-xs text-fg-muted`,children:s?`等待详情`:`Waiting details`}),d]}):null:d??(0,J.jsx)(G,{content:f,contentKey:`${n.task.id}:current-progress`,language:i,previewHeight:72,className:`mt-2 text-sm leading-6 text-fg-muted`,children:(0,J.jsx)(S,{content:se(f),compact:!0})}),t[31]=u.length,t[32]=d,t[33]=n.task,t[34]=i,t[35]=f,t[36]=s,t[37]=_):_=t[37];let v;return t[38]!==p||t[39]!==m||t[40]!==h||t[41]!==g||t[42]!==_?(v=(0,J.jsxs)(`section`,{"aria-label":p,className:m,children:[h,g,_]}),t[38]=p,t[39]=m,t[40]=h,t[41]=g,t[42]=_,t[43]=v):v=t[43],v}function yt(e){return!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)}function bt(e){return e.kind===`input_required`||e.kind===`approval_required`}function xt(e){return(e.kind===`user_input`||e.kind===`approval`&&typeof e.condition.capability==`string`)&&e.condition.type!==`connection`}function St(e){return e.kind===`paused`}function Ct(e){let t=(0,q.c)(16),{label:n,title:r,compact:i}=e,a=i&&!!r,o=a&&`-translate-y-2 opacity-0`,s;t[0]===o?s=t[1]:(s=V(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,o),t[0]=o,t[1]=s);let c;t[2]!==n||t[3]!==a||t[4]!==s?(c=(0,J.jsx)(`span`,{"aria-hidden":a,className:s,children:n}),t[2]=n,t[3]=a,t[4]=s,t[5]=c):c=t[5];let l=!a,u=!a&&`translate-y-2 opacity-0`,d;t[6]===u?d=t[7]:(d=V(`truncate [grid-area:1/1] motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out`,u),t[6]=u,t[7]=d);let f;t[8]!==l||t[9]!==d||t[10]!==r?(f=(0,J.jsx)(`span`,{"aria-hidden":l,className:d,children:r}),t[8]=l,t[9]=d,t[10]=r,t[11]=f):f=t[11];let p;return t[12]!==a||t[13]!==c||t[14]!==f?(p=(0,J.jsxs)(`span`,{className:`grid min-w-0 overflow-hidden leading-6`,"data-task-header-compact":a,children:[c,f]}),t[12]=a,t[13]=c,t[14]=f,t[15]=p):p=t[15],p}function wt(e){let t=(0,q.c)(17),{children:n,contentKey:r,language:i,className:o}=e,s=(0,K.useId)(),c=K.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,J.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,J.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,J.jsxs)(`div`,{className:o,children:[m,h]}),t[13]=o,t[14]=m,t[15]=h,t[16]=g):g=t[16],g}function Tt({taskId:e}){let t=l(e=>e.conversationId),n=u(e=>e.language),[r,i]=(0,K.useState)(``),[a,o]=(0,K.useState)(null),[s,f]=(0,K.useState)(!1),[p,m]=(0,K.useState)(!1),[h,g]=(0,K.useState)([]),[_,v]=(0,K.useState)(null),y=c(`/api/tasks/${encodeURIComponent(e)}/collaboration`),{data:b,error:x,mutate:S}=le([`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,K.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,J.jsxs)(`section`,{className:`rounded-xl border border-edge bg-surface-panel p-4`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:n===`zh`?`任务留言`:`Task updates`}),(0,J.jsxs)(`div`,{className:`mt-3 max-h-64 space-y-2 overflow-y-auto`,children:[!b&&!x?(0,J.jsxs)(`div`,{"aria-busy":`true`,className:`space-y-2`,children:[(0,J.jsx)(ae,{className:`h-14 w-full`}),(0,J.jsx)(ae,{className:`h-14 w-4/5`})]}):null,x?(0,J.jsx)(`p`,{role:`status`,className:`text-xs text-fg-muted`,children:n===`zh`?`暂时无法读取留言`:`Updates unavailable`}):null,C[0]&&C[0].sequence>1?(0,J.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,J.jsxs)(`div`,{className:`rounded-lg bg-surface-base px-3 py-2 text-sm`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-fg-subtle`,children:[(0,J.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,J.jsxs)(`span`,{children:[`· `,t.kind]}),t.deliveryStatus?(0,J.jsxs)(`span`,{children:[`· `,t.deliveryStatus]}):null]}),(0,J.jsx)(`div`,{className:`mt-1 min-w-0 text-fg`,"data-task-collaboration-body":!0,children:(0,J.jsx)(G,{content:t.body,contentKey:`${e}:update:${t.id}`,language:n,breaks:!0,previewHeight:120})}),t.kind===`question`&&t.authorKind===`worker_agent`?(0,J.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,J.jsx)(`p`,{className:`text-xs text-fg-muted`,children:n===`zh`?`暂无进展留言`:`No updates yet`}):null]}),a?(0,J.jsxs)(`p`,{className:`mt-3 text-xs text-accent`,children:[n===`zh`?`正在回复执行 Agent 的问题`:`Replying to the worker`,(0,J.jsx)(`button`,{type:`button`,className:`ml-2 underline`,onClick:()=>o(null),children:n===`zh`?`取消`:`Cancel`})]}):null,(0,J.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,J.jsx)(`p`,{role:`alert`,className:`mt-1 text-xs text-danger`,children:_}):null,(0,J.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 Et(e,t,n,r){return!!(e&&t!==e.version&&n!==e.value&&r!==n)}function Dt(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 Ot(e,t){return(t===`zh`?{backlog:`待规划`,ready:`就绪`,active:`进行中`,review:`待验收`,closed:`已关闭`}:{backlog:`Backlog`,ready:`Ready`,active:`Active`,review:`Review`,closed:`Closed`})[e]}function kt(){let e=(0,q.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,J.jsxs)(`div`,{className:`space-y-4`,"aria-busy":!0,children:[(0,J.jsx)(ae,{className:`h-32 rounded-2xl`}),(0,J.jsx)(ae,{className:`h-52 rounded-2xl`}),(0,J.jsx)(ae,{className:`h-40 rounded-2xl`})]}),e[0]=t):t=e[0],t}function At(e){if(e===void 0)return``;let t=new Date(e);return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,10)}function jt(e){return e?new Date(`${e}T23:59:59.999`).getTime():null}var Mt=[`backlog`,`ready`,`active`,`review`,`closed`],Nt=[`low`,`normal`,`high`,`critical`],Pt=(0,K.memo)(function(e){let t=(0,q.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,J.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=Mt.map(e=>(0,J.jsx)(M,{value:e,disabled:d(e),children:Ot(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,J.jsx)(j,{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,J.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}),Ft=(0,K.memo)(function(e){let t=(0,q.c)(14),{value:n,disabled:r,label:i,labels:a,onChange:o}=e,s;t[0]===i?s=t[1]:(s=(0,J.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=Nt.map(e=>(0,J.jsx)(M,{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,J.jsx)(j,{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,J.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}),It=(0,K.memo)(function(e){let t=(0,q.c)(10),{value:n,disabled:r,label:i,onChange:a}=e,o;t[0]===i?o=t[1]:(o=(0,J.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,J.jsx)(Ve,{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,J.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}),Lt=(0,K.memo)(function(e){let t=(0,q.c)(36),{value:n,disabled:r,label:i,unassignedLabel:a,agents:o,language:s,onChange:c}=e,l,u,d,p,m,h,g,_,v,y;if(t[0]!==o||t[1]!==r||t[2]!==i||t[3]!==s||t[4]!==c||t[5]!==a||t[6]!==n){let{agentsSettings:e}=f(s);v=`grid gap-1.5 text-xs text-fg-muted`,t[17]===i?y=t[18]:(y=(0,J.jsx)(`span`,{children:i}),t[17]=i,t[18]=y),l=j,u=`border-0 bg-surface-hover shadow-none focus-visible:ring-2 focus-visible:ring-accent/30`,d=`border-0`,p=n,m=r,t[19]===c?h=t[20]:(h=e=>c(e.target.value),t[19]=c,t[20]=h),t[21]===a?g=t[22]:(g=(0,J.jsx)(M,{value:``,disabled:!0,children:a}),t[21]=a,t[22]=g),_=o.map(t=>(0,J.jsx)(M,{value:t.id,children:Oe(t,e)},t.id)),t[0]=o,t[1]=r,t[2]=i,t[3]=s,t[4]=c,t[5]=a,t[6]=n,t[7]=l,t[8]=u,t[9]=d,t[10]=p,t[11]=m,t[12]=h,t[13]=g,t[14]=_,t[15]=v,t[16]=y}else l=t[7],u=t[8],d=t[9],p=t[10],m=t[11],h=t[12],g=t[13],_=t[14],v=t[15],y=t[16];let b;t[23]!==l||t[24]!==u||t[25]!==d||t[26]!==p||t[27]!==m||t[28]!==h||t[29]!==g||t[30]!==_?(b=(0,J.jsxs)(l,{triggerClassName:u,contentClassName:d,value:p,disabled:m,onChange:h,children:[g,_]}),t[23]=l,t[24]=u,t[25]=d,t[26]=p,t[27]=m,t[28]=h,t[29]=g,t[30]=_,t[31]=b):b=t[31];let x;return t[32]!==b||t[33]!==v||t[34]!==y?(x=(0,J.jsxs)(`label`,{className:v,children:[y,b]}),t[32]=b,t[33]=v,t[34]=y,t[35]=x):x=t[35],x}),Rt=(0,K.memo)(function(e){let t=(0,q.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(Qt),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,J.jsx)(Je,{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)),zt=`xopc.taskDetail.chatPanelPercent`,Bt=42;function Vt(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?Bt:Math.min(r,Math.max(n,e))}function Ht(){try{let e=Number(window.localStorage.getItem(zt));return Number.isFinite(e)&&e>=30&&e<=60?e:Bt}catch{return Bt}}function Ut(e){let t=(0,q.c)(13),{items:n,empty:r,contentKey:i}=e,a=u(Gt);if(n.length===0){let e;return t[0]===r?e=t[1]:(e=(0,J.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(Wt),t[4]=n,t[5]=s);let c;t[6]===s?c=t[7]:(c=(0,J.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,J.jsx)(G,{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 Wt(e){return(0,J.jsxs)(`li`,{className:`flex gap-2 text-sm leading-6 text-fg`,children:[(0,J.jsx)(N,{className:`mt-1 size-4 shrink-0 text-fg-subtle`}),(0,J.jsx)(`span`,{className:`min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]`,children:e})]},e)}function Gt(e){return e.language}function Kt({taskId:e,presentation:t,backgroundPath:n,onDeleted:r,onHeaderChange:i}){let[c,d]=a(),p=s(),m=u(e=>e.language),h=l(e=>e.conversationId),g=(0,K.useMemo)(()=>we(m),[m]),_=Te(e=>e.setPageHeader),v=Te(e=>e.clearPageHeader),y=Ce(e=>e.panes),x=b(e=>e.openForSession),{data:S,error:D,mutate:O,lastChange:k,conversationLoading:A,conversationError:j}=C(e),{data:M,error:N,mutate:ie}=le(e?[`task-detail-automations`,h]:null,()=>De.list(),{refreshInterval:3e4}),[ue,H]=(0,K.useState)(null),[ke,Le]=(0,K.useState)(null),[W,Re]=(0,K.useState)(()=>new Set),[ze,Be]=(0,K.useState)([]),[Ve,He]=(0,K.useState)(null),[We,Ge]=(0,K.useState)([]),[Ke,Je]=(0,K.useState)(!1),[q,Qe]=(0,K.useState)(``),[et,tt]=(0,K.useState)(!1),[nt,it]=(0,K.useState)(``),[at,st]=(0,K.useState)(Ht),[ct,lt]=(0,K.useState)(!1),ut=(0,K.useRef)(null),dt=(0,K.useRef)(null),ft=(0,K.useRef)(null),gt=(0,K.useRef)(null),[yt,bt]=(0,K.useState)(!1),xt=(0,K.useRef)(!1),St=(0,K.useRef)(!1),Ot=(0,K.useRef)(``),Mt=(0,K.useRef)(null),Nt=(0,K.useRef)(null),Wt=(0,K.useRef)(null),Gt=(0,K.useRef)(S),[Kt,Y]=(0,K.useState)(null),[qt,Jt]=(0,K.useState)(null),[Yt,Xt]=(0,K.useState)(!1),[Zt,Qt]=(0,K.useState)(!1),[$t,en]=(0,K.useState)(null),tn=(0,K.useRef)(null),nn=(0,K.useMemo)(()=>({link:g.linkDependencies,linked:g.linkedDependencies,searchPlaceholder:g.dependencySearchPlaceholder,noMatches:g.noDependencyMatches,noCandidates:g.noDependencyCandidates,remove:g.removeDependency}),[g.dependencySearchPlaceholder,g.linkDependencies,g.linkedDependencies,g.noDependencyCandidates,g.noDependencyMatches,g.removeDependency]),rn=S?.dependencies.map(e=>`${e.id}:${e.title}`).join(`\0`)??``,an=(0,K.useMemo)(()=>R(c.get(`returnTo`),`/`,[`/projects`,`/chat`,`/notes`,`/tasks`]),[c]),on=(0,K.useCallback)(e=>t===`modal`&&n?ee(n,e):z(`/tasks/${encodeURIComponent(e)}`,an),[n,t,an]);Gt.current=S;let X=(0,K.useCallback)((e,t)=>{Re(n=>{let r=new Set(n);return t?r.add(e):r.delete(e),r})},[]);(0,K.useEffect)(()=>{H(null),Le(null),Y(null),Je(!1),Mt.current=null,tt(!1),Jt(null),Xt(!1),Qt(!1),en(null)},[e]),(0,K.useEffect)(()=>{let e=!0;return Se().then(t=>{e&&Ge(t.items)}).catch(()=>void 0),()=>{e=!1}},[h]),(0,K.useEffect)(()=>{if(!k||k.source===`user`)return;Jt(k);let e=window.setTimeout(()=>Jt(null),3500);return()=>window.clearTimeout(e)},[k]),(0,K.useEffect)(()=>{let t=S?.task.projectId,n=S?.dependencies??[];if(!t){Wt.current=null,He(null),Be(n);return}Wt.current!==t&&(Wt.current=t,He(null));let r=!0;return oe(t).then(t=>{if(!r)return;He(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});Be([...i.values()])}).catch(()=>{r&&Be(n)}),()=>{r=!1}},[rn,S?.task.projectId,e]);let Z=(0,K.useCallback)(async(t,n=`command`)=>{let r=Gt.current;if(r){X(n,!0),H(null),t.type===`close`&&t.resolution===`done`&&Le(null);try{await O(await be(e,t,r.task.version),{revalidate:!1})}catch{H(g.actionFailed),t.type===`close`&&t.resolution===`done`&&Le(g.actionFailed)}finally{X(n,!1)}}},[g.actionFailed,O,X,e]),sn=(0,K.useCallback)(async(t,n)=>{let r=Gt.current;if(!r)return!1;n&&X(n,!0),H(null);try{let n=fe(e,t,r.task.version);return await O(n,{optimisticData:Dt(r,t),populateCache:!0,revalidate:!1,rollbackOnError:!0}),!0}catch{return H(g.actionFailed),!1}finally{n&&X(n,!1)}},[g.actionFailed,O,X,e]),cn=()=>{S&&(Mt.current={value:S.task.title,version:S.task.version},Y(null),Qe(S.task.title),Je(!0))},ln=()=>{xt.current=!0,Qe(Gt.current?.task.title??``),Mt.current=null,Y(null),Je(!1),queueMicrotask(()=>{xt.current=!1})},un=async(e=!1)=>{if(xt.current){xt.current=!1;return}let t=Gt.current;if(!t||W.has(`title`))return;let n=q.trim();if(!n){ln();return}let r=Mt.current;if(!e&&Et(r,t.task.version,t.task.title,n)){Y(`title`);return}if(n===t.task.title){ln();return}await sn({title:n},`title`)&&(Mt.current=null,Y(null),Je(!1))},dn=async()=>{if(!S)return;if(St.current){St.current=!1;return}let e=nt.trim(),t=Nt.current;if(Et(t,S.task.version,S.task.body??``,e)){Y(`description`);return}if(nt===Ot.current||e===(S.task.body??``).trim()){tt(!1);return}await sn({body:ce(S.task.body??``,e)||null})&&(Y(null),tt(!1))},fn=(0,K.useCallback)(async e=>{let t=Gt.current;!t||e===t.task.phase||await Z({type:`move`,phase:e},`phase`)},[Z]),pn=(0,K.useCallback)(e=>{sn({priority:e},`priority`)},[sn]),mn=(0,K.useCallback)(e=>{sn({dueAt:jt(e)},`dueAt`)},[sn]),hn=(0,K.useCallback)(e=>{st(e);try{window.localStorage.setItem(zt,String(e))}catch{}},[]),gn=(0,K.useCallback)(e=>{if(e.key!==`ArrowLeft`&&e.key!==`ArrowRight`&&e.key!==`Home`)return;e.preventDefault();let t=ft.current?.clientWidth??0,n=e.key===`Home`?Bt:at+(e.key===`ArrowLeft`?2:-2);hn(Vt(n,t))},[at,hn]),_n=(0,K.useCallback)(e=>{if(!window.matchMedia(`(min-width: 1024px)`).matches)return;let t=ft.current;if(!t)return;e.preventDefault();let n=e.currentTarget,r=e.pointerId;n.setPointerCapture(r),lt(!0);let i=at,a=0,o=()=>{a=0,t.style.setProperty(`--task-chat-panel-width`,`${i}%`)},s=e=>{let n=t.getBoundingClientRect();i=Vt((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{}lt(!1),hn(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)},[at,hn]),vn=(0,K.useCallback)(async t=>{let n=Gt.current;if(n){X(`dependencies`,!0),H(null);try{await O(await de(e,t,n.task.version),{revalidate:!1})}catch{H(g.dependencyUpdateFailed)}finally{X(`dependencies`,!1)}}},[g.dependencyUpdateFailed,O,X,e]),yn=(0,K.useCallback)(async t=>{let n=Gt.current;if(!(!n||!t||t===n.conversation.currentExecutorAgentId)){X(`delegateAgentId`,!0),H(null);try{await O(await pe(e,t,n.task.version),{revalidate:!1})}catch{H(g.actionFailed)}finally{X(`delegateAgentId`,!1)}}},[g.actionFailed,O,X,e]),bn=(0,K.useCallback)(async()=>{X(`delete`,!0),H(null);try{await he(e),r?r():p(an,{replace:!0})}catch(e){H(e instanceof Error?e.message:g.actionFailed)}finally{X(`delete`,!1)}},[g.actionFailed,p,r,an,X,e]),xn=(0,K.useCallback)(async(t,n)=>{let r=Gt.current;if(!r)return!1;X(`acceptance`,!0),Le(null),H(null);try{return await O(await xe(e,t,n,r.task.version,r.task.latestContractVersion),{revalidate:!1}),!0}catch{return Le(g.actionFailed),H(g.actionFailed),O().catch(()=>void 0),!1}finally{X(`acceptance`,!1)}},[g.actionFailed,O,X,e]),Sn=S?.task.title,Cn=Sn!==void 0;if((0,K.useLayoutEffect)(()=>{let e=gt.current,t=e?.parentElement;if(!Cn||!e||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(([e])=>{let n=Ze(t),r=n?n.getBoundingClientRect().top+n.clientTop:0;bt(!e.isIntersecting&&e.boundingClientRect.bottom<=r)});return n.observe(e),()=>n.disconnect()},[Cn,e]),(0,K.useLayoutEffect)(()=>{i?.({taskId:e,title:Sn,compact:yt})},[yt,i,e,Sn]),(0,K.useLayoutEffect)(()=>{if(t!==`modal`)return _({startExtra:(0,J.jsx)(o,{to:an,className:`flex size-9 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover`,"aria-label":g.backToWork,children:(0,J.jsx)(T,{className:`size-4`})}),main:Cn?(0,J.jsx)(`div`,{className:`min-w-0 text-sm font-semibold text-fg`,children:(0,J.jsx)(Ct,{label:Ve?`${Ve} / ${g.taskLabel}`:g.taskLabel,title:Sn,compact:yt})}):null,end:null}),v},[v,yt,g.backToWork,g.taskLabel,Cn,t,Ve,an,_,Sn]),D&&!S)return(0,J.jsx)(`div`,{className:t===`modal`?`p-5 text-sm text-danger`:`mx-auto max-w-3xl p-6 text-sm text-danger`,children:g.taskNotFound});if(!S)return(0,J.jsx)(`div`,{className:t===`modal`?`p-5`:`mx-auto max-w-4xl p-4 sm:p-6`,children:(0,J.jsx)(kt,{})});let wn=S.waits[0],Q=S.runs.find(e=>!e.parentRunId&&[`queued`,`running`,`waiting`,`verifying`].includes(e.status)),Tn=me(S),En=Tn.length>0&&Tn.every(e=>e.status===`passed`),Dn=S.waits.find(e=>e.kind===`paused`),On=ve(S),kn=ye(S),An=g.detailStatuses[kn],jn=se(S.task.body?.trim()||S.task.contract?.objective.trim()||``),Mn=S.allowedCommands.includes(`mark_ready`),Nn=S.allowedCommands.includes(`start`),Pn=S.allowedCommands.includes(`add_wait`),Fn=!wn&&!Q&&En&&S.task.phase===`review`&&S.allowedCommands.includes(`close`),In=S.allowedCommands.includes(`reopen`),$=S.conversation.activeConversationId,Ln=S.conversation.currentExecutorAgentId??S.task.delegateAgentId??S.task.ownerId,Rn=We.find(e=>e.id===Ln),zn=f(m).agentsSettings,Bn=Rn?Oe(Rn,zn):void 0,Vn=Q?.executorKind===`agent`?We.find(e=>e.id===(Q.executorRef.agentId??S.conversation.currentExecutorAgentId)):void 0,Hn=Vn?Oe(Vn,zn):void 0,Un=!!($&&y[$]?.open),Wn=S.context.filter(e=>e.role!==`deliverable`),Gn=M?.automations.filter(t=>t.action.kind===`task_command`&&t.action.taskId===e)??[],Kn=Gn.filter(e=>e.trigger.kind===`schedule`&&e.action.kind===`task_command`&&e.action.command.type===`start`),qn=Kn.filter(e=>e.enabled&&e.state.nextRunAtMs!==void 0).map(e=>e.state.nextRunAtMs).sort((e,t)=>e-t)[0],Jn=e=>{ie(t=>({automations:[e,...(t?.automations??[]).filter(t=>t.id!==e.id)]}),{revalidate:!1})},Yn=e=>{en(e),Qt(!0)},Xn=()=>{M&&(Kn.length===1?Yn(Kn[0]):Kn.length>1?(tn.current&&(tn.current.open=!0),d(e=>Ye(e,`schedule`,!0),{preventScrollReset:!0}),tn.current?.scrollIntoView({block:`start`,behavior:`smooth`}),tn.current?.focus({preventScroll:!0})):(en(null),Qt(!0)))},Zn=S.sessions.filter((e,t,n)=>n.findIndex(t=>t.conversationId===e.conversationId)===t),Qn=S.task.contract?.expectedOutputs??[],$n=S.task.contract?.constraints??[],er=S.task.contract?.approvalRequired??[],tr=S.task.contract?.assumptions??[],nr=S.task.contract?.risks??[],rr=$n.length>0||er.length>0||tr.length>0||nr.length>0,ir=(...e)=>!!qt?.changedFields.some(t=>e.includes(t)),ar=S.allowedCommands.includes(`move`),or=W.has(`command`),sr=W.has(`delete`),cr=Q!==void 0,lr=()=>{let e=ut.current;e&&(e.open=!0,d(e=>Ye(e,`acceptance`,!0),{preventScrollReset:!0}),e.scrollIntoView({block:`start`,behavior:`smooth`}),e.focus({preventScroll:!0}))},ur=(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[Mn&&!Nn&&!wn&&S.task.phase!==`review`?(0,J.jsxs)(U,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:or,onClick:()=>void Z({type:`mark_ready`}),children:[(0,J.jsx)(re,{className:`size-4`}),g.scheduleTask]}):null,Dn&&S.allowedCommands.includes(`resolve_wait`)?(0,J.jsxs)(U,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:or,onClick:()=>void Z({type:`resolve_wait`,waitId:Dn.id}),children:[(0,J.jsx)(re,{className:`size-4`}),g.resumeTask]}):null,!wn&&Nn&&S.task.phase!==`review`&&Ln?(0,J.jsxs)(U,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`primary`,disabled:or,onClick:()=>void Z({type:`start`,executor:{kind:`agent`,agentId:Ln}}),children:[(0,J.jsx)(re,{className:`size-4`}),g.runTask]}):null,In?(0,J.jsxs)(U,{className:`min-h-9 px-3 py-1.5 text-xs`,variant:`ghost`,disabled:or,onClick:()=>void Z({type:`reopen`,phase:`ready`}),children:[(0,J.jsx)(re,{className:`size-4`}),g.reopenTask]}):null,S.task.phase!==`review`&&!Dn&&Pn?(0,J.jsxs)(U,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:or,onClick:()=>void Z({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:[(0,J.jsx)(ne,{className:`size-4`}),g.pauseTask]}):null,S.task.phase===`closed`?(0,J.jsx)(U,{variant:`primary`,className:`min-h-9 px-3 py-1.5 text-xs`,onClick:()=>{dt.current?.scrollIntoView({block:`start`,behavior:`smooth`}),dt.current?.focus({preventScroll:!0})},children:m===`zh`?`查看结果`:`View results`}):null,!wn&&!Q&&S.task.phase!==`closed`&&S.task.phase!==`review`?(0,J.jsxs)(U,{variant:`ghost`,className:`min-h-9 px-3 py-1.5 text-xs`,disabled:!M,onClick:Xn,children:[(0,J.jsx)(E,{className:`size-4`}),Kn.length>0?m===`zh`?`管理执行时间`:`Manage schedule`:m===`zh`?`设置执行时间`:`Set execution time`]}):null,S.task.phase===`review`?(0,J.jsx)(U,{variant:`primary`,className:`min-h-9 px-3 py-1.5 text-xs`,onClick:lr,children:m===`zh`?`去验收`:`Review results`}):null,(0,J.jsxs)(je,{children:[(0,J.jsx)(Me,{asChild:!0,children:(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`size-9 p-0`,disabled:or||sr,"aria-label":g.moreActions,children:(0,J.jsx)(P,{className:`size-4`,"aria-hidden":!0})})}),(0,J.jsx)(Ne,{children:(0,J.jsxs)(Fe,{align:`end`,sideOffset:6,className:`z-[100] min-w-44 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:[S.task.phase===`review`&&!Dn&&Pn?(0,J.jsx)(Pe,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Z({type:`add_wait`,wait:{kind:`paused`,reason:`Paused by user`,condition:{}}}),children:g.pauseTask}):null,S.task.phase===`review`&&!wn&&!Q?(0,J.jsx)(Pe,{disabled:!M,className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover data-[disabled]:opacity-50`,onSelect:Xn,children:Kn.length>0?m===`zh`?`管理执行时间`:`Manage schedule`:m===`zh`?`设置执行时间`:`Set execution time`}):null,S.task.phase===`review`&&!wn&&Nn&&Ln?(0,J.jsx)(Pe,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Z({type:`start`,executor:{kind:`agent`,agentId:Ln}}),children:g.runTask}):null,Mn&&(Nn||wn||S.task.phase===`review`)?(0,J.jsx)(Pe,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-fg outline-none focus:bg-surface-hover`,onSelect:()=>void Z({type:`mark_ready`}),children:g.scheduleTask}):null,Q?(0,J.jsx)(Pe,{className:`cursor-pointer rounded-md px-3 py-2 text-sm text-danger outline-none hover:bg-surface-hover focus:bg-surface-hover`,onSelect:()=>{X(`command`,!0),H(null),O(_e(e,Q.id,Q.version),{revalidate:!1}).catch(()=>H(g.actionFailed)).finally(()=>X(`command`,!1))},children:g.cancelActiveRun}):null,Q?(0,J.jsx)(Ie,{className:`my-1 h-px bg-edge`}):null,S.task.phase===`closed`?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Pe,{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 Z({type:`close`,resolution:`cancelled`}),children:g.cancelTask}),(0,J.jsx)(Ie,{className:`my-1 h-px bg-edge`})]}),(0,J.jsx)(Pe,{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(cr){H(g.deleteActiveTaskBlocked);return}Xt(!0)},children:g.deleteTask})]})})]})]});return(0,J.jsxs)(`div`,{ref:ft,className:`flex h-full min-h-0 flex-col overflow-hidden ${ct?`lg:cursor-col-resize lg:select-none`:``}`,style:{"--task-chat-panel-width":`${at}%`},children:[(0,J.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-y-auto lg:flex-row lg:overflow-hidden`,children:[(0,J.jsxs)(`div`,{className:`task-detail-scroll flex min-w-0 shrink-0 flex-col bg-surface-panel lg:min-h-0 lg:flex-1 lg:shrink lg:overflow-y-auto lg:overscroll-contain`,children:[(0,J.jsxs)(`header`,{ref:gt,className:V(`shrink-0 px-4 py-5 sm:px-6 sm:py-6`,ir(`title`)&&`task-detail-live-update`),children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-x-6 gap-y-3`,children:[(0,J.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,J.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs text-fg-muted`,children:[Ve?(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,J.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),Ve]}):null,Ve?(0,J.jsx)(`span`,{"aria-hidden":`true`,children:`/`}):null,(0,J.jsx)(`span`,{children:g.taskLabel}),qt?(0,J.jsx)(`span`,{className:`rounded-full bg-accent-soft px-2 py-0.5 text-[11px] font-medium text-accent-fg`,role:`status`,children:qt.source===`agent`?m===`zh`?`Agent 刚刚更新`:`Updated by Agent`:m===`zh`?`执行结果已同步`:`Execution result synced`}):null]}),Ke?(0,J.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,"aria-label":m===`zh`?`任务标题`:`Task title`,rows:2,value:q,onFocus:e=>{Mt.current?.value===q&&(e.currentTarget.setSelectionRange(0,0),e.currentTarget.scrollTop=0)},onChange:e=>Qe(e.target.value),onBlur:()=>void un(),onKeyDown:e=>{e.nativeEvent.isComposing||(e.key===`Escape`?(e.preventDefault(),e.stopPropagation(),ln()):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 tracking-tight text-fg sm:text-2xl outline-none [field-sizing:content]`}):(0,J.jsx)(G,{content:S.task.title,contentKey:`${e}:title`,language:m,previewHeight:56,className:`mt-2 max-w-3xl`,children:(0,J.jsx)(`h1`,{className:`break-words text-xl font-semibold leading-7 tracking-tight text-fg sm:text-2xl`,children:(0,J.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:S.task.title,onClick:cn,children:S.task.title})})}),Kt===`title`?(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,J.jsx)(`span`,{children:m===`zh`?`Agent 在你编辑期间更新了标题。`:`The Agent updated the title while you were editing.`}),(0,J.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:ln,children:m===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,J.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,disabled:W.has(`title`),onClick:()=>void un(!0),children:m===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),(0,J.jsx)(`span`,{className:V(`shrink-0 rounded-full px-2.5 py-1 text-xs font-medium`,ge(kn)),children:An})]}),(0,J.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-4 gap-y-2 text-xs text-fg-muted`,children:[(0,J.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-2`,children:[Ln?(0,J.jsx)(Ee,{agentId:Ln,avatar:Rn?.avatar,size:20,className:`shrink-0`}):null,(0,J.jsxs)(`span`,{className:`min-w-0 break-words [overflow-wrap:anywhere]`,children:[g.executorLabel,` · `,Bn??Ln??g.unassigned]})]}),(0,J.jsx)(`span`,{className:`text-fg-subtle`,children:g.updatedAt.replace(`{{date}}`,Ue(S.task.updatedAt,m))})]})]}),(0,J.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":m===`zh`?`任务操作`:`Task actions`,children:[(0,J.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-fg-muted`,children:An}),ur,ue?(0,J.jsx)(`p`,{role:`alert`,className:`basis-full text-sm text-danger`,children:ue}):null,(0,J.jsx)($e,{language:m,hasSchedule:Kn.length>0},e)]}),(0,J.jsxs)(`section`,{className:`min-w-0 space-y-4 p-4 sm:p-5`,children:[S.task.phase===`review`?null:(0,J.jsx)(vt,{detail:S,executorName:Hn,language:m,onUpdated:e=>{O(e,{revalidate:!1})}}),(0,J.jsxs)(`section`,{"data-task-section":`results`,"data-task-section-label":m===`zh`?`交付结果`:`Results`,ref:dt,tabIndex:-1,"aria-labelledby":`task-results-heading`,className:`scroll-mt-24 space-y-4`,children:[(0,J.jsx)(ot,{detail:S,language:m}),S.task.phase===`review`&&(S.waits.length>0||S.attention.some(e=>e.kind===`input_required`||e.kind===`approval_required`))?(0,J.jsx)(vt,{detail:S,language:m,onUpdated:e=>{O(e,{revalidate:!1})}}):null,(0,J.jsx)(Xe,{panelId:`acceptance`,chevron:!0,"data-task-section":`acceptance`,"data-task-section-label":m===`zh`?`验收`:`Acceptance`,defaultOpen:!0,ref:ut,tabIndex:-1,"aria-label":g.successDefinition,className:`scroll-mt-24 overflow-hidden rounded-2xl border border-edge-subtle bg-surface-panel`,summaryClassName:`min-h-12 cursor-pointer px-4 py-2 text-sm font-semibold text-fg outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-accent`,title:(0,J.jsxs)(`span`,{className:`flex items-center justify-between gap-2`,children:[m===`zh`?`验收`:`Acceptance`,(0,J.jsxs)(`span`,{"aria-live":`polite`,className:`rounded-full bg-surface-inset px-2 py-0.5 text-xs font-medium tabular-nums text-fg-muted`,children:[Tn.filter(e=>e.status===`passed`).length,`/`,Tn.length]})]}),children:(0,J.jsx)(rt,{criteria:Tn,language:m,closed:S.task.phase===`closed`,pending:W.has(`acceptance`),error:ke,blockedReason:wn?m===`zh`?`请先处理待办事项`:`Resolve the pending request first`:Q?m===`zh`?`请等待当前执行结束`:`Wait for the current run to finish`:void 0,onReview:xn,projectId:S.task.projectId,conversationId:$??void 0},`${e}:${S.task.latestContractVersion}`)})]}),(0,J.jsx)(Xe,{panelId:`report`,chevron:!0,defaultOpen:!0,"data-task-section":`report`,"data-task-section-label":m===`zh`?`执行报告`:`Report`,className:`rounded-2xl border border-edge-subtle bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:m===`zh`?`完整执行报告`:`Full execution report`,children:(0,J.jsx)(pt,{detail:S,language:m},On?.runId??e)}),!M&&!N?(0,J.jsx)(ae,{className:`h-9 rounded-lg`}):null,N?(0,J.jsxs)(`div`,{role:`alert`,className:`flex flex-wrap items-center gap-2 text-sm text-danger`,children:[(0,J.jsx)(`span`,{children:m===`zh`?`无法读取执行计划,请重试后再设置时间。`:`Could not load schedules. Retry before setting a time.`}),(0,J.jsx)(U,{variant:`ghost`,onClick:()=>void ie(),children:m===`zh`?`重试`:`Retry`})]}):null,Kn.length>0?(0,J.jsx)(Xe,{panelId:`schedule`,chevron:!0,defaultOpen:!0,"data-task-section":`schedule`,"data-task-section-label":m===`zh`?`执行时间`:`Schedule`,ref:tn,tabIndex:-1,className:`scroll-mt-24 rounded-2xl border border-edge-subtle bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm text-fg-muted`,title:(0,J.jsxs)(J.Fragment,{children:[m===`zh`?`执行时间`:`Execution schedule`,` · `,Kn.length,qn===void 0?``:` · ${m===`zh`?`下次执行:`:`Next run: `}${Ue(qn,m)}`]}),children:(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsx)(ht,{schedules:Kn,language:m,onEdit:Yn,onUpdated:Jn})})}):null,(0,J.jsx)(Xe,{panelId:`goal`,chevron:!0,defaultOpen:!0,"data-task-section":`goal`,"data-task-section-label":m===`zh`?`目标说明`:`Goal`,className:`rounded-2xl border border-edge-subtle bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:m===`zh`?`任务目标与说明`:`Task goal and description`,children:(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsxs)(`section`,{className:`overflow-hidden rounded-xl border border-edge-subtle bg-surface-panel divide-y divide-edge-subtle`,children:[(0,J.jsxs)(`div`,{className:`border-b border-edge-subtle p-5`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:m===`zh`?`任务目标`:`Task goal`}),(0,J.jsx)(G,{content:S.task.contract?.objective||S.task.title,contentKey:`${e}:goal`,language:m,markdown:!1,previewHeight:72,className:`mt-3 text-sm leading-6 text-fg`}),(0,J.jsxs)(U,{variant:`ghost`,className:`mt-2 min-h-9 px-2 text-xs`,onClick:lr,children:[g.successDefinition,` · `,Tn.length]})]}),Qn.length>0?(0,J.jsxs)(`div`,{className:`p-5`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:g.expectedOutputs}),(0,J.jsx)(`div`,{className:`mt-2`,children:(0,J.jsx)(Ut,{contentKey:`${e}:expectedOutputs`,items:Qn,empty:g.noDefinition})})]}):null,(0,J.jsxs)(`details`,{className:V(`p-5`,ir(`body`)&&`task-detail-live-update`),children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:g.taskDescription}),et?(0,J.jsx)(`textarea`,{autoFocus:!0,"data-task-inline-editor":!0,rows:6,value:nt,onChange:e=>it(e.target.value),onBlur:()=>void dn(),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),St.current=!0,it(se(S.task.body??S.task.contract?.objective??``)),tt(!1),queueMicrotask(()=>{St.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,J.jsxs)(`div`,{className:`mt-2`,children:[jn&&jn!==S.task.title?(0,J.jsx)(G,{content:jn,contentKey:`${e}:description`,language:m}):(0,J.jsx)(`p`,{className:`text-sm leading-6 text-fg-muted`,children:g.noTaskDescription}),(0,J.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=se(S.task.body??S.task.contract?.objective??``);Ot.current=e,Nt.current={value:S.task.body??``,version:S.task.version},Y(null),it(e),tt(!0)},children:m===`zh`?`编辑说明`:`Edit description`})]}),Kt===`description`?(0,J.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-2 text-xs text-warning`,role:`alert`,children:[(0,J.jsx)(`span`,{children:m===`zh`?`Agent 在你编辑期间更新了描述。`:`The Agent updated the description while you were editing.`}),(0,J.jsx)(`button`,{type:`button`,className:`rounded-md bg-surface-hover px-2 py-1 text-fg`,onClick:()=>{it(se(S.task.body??``)),Y(null),tt(!1)},children:m===`zh`?`使用 Agent 版本`:`Use Agent version`}),(0,J.jsx)(`button`,{type:`button`,className:`rounded-md bg-accent-soft px-2 py-1 text-accent-fg`,onClick:()=>void sn({body:ce(S.task.body??``,nt.trim())||null}).then(e=>{e&&(Y(null),tt(!1))}),children:m===`zh`?`保留我的修改`:`Keep my changes`})]}):null]}),rr?(0,J.jsxs)(`section`,{className:V(`p-5`,ir(`contract`)&&`task-detail-live-update`),children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:g.taskDefinition}),(0,J.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:m===`zh`?`执行边界及补充背景`:`Execution boundaries and supporting context`}),$n.length>0?(0,J.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:g.constraints}),(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsx)(Ut,{contentKey:`${e}:constraints`,items:$n,empty:g.noDefinition})})]}):null,er.length>0?(0,J.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:g.approvalRequired}),(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsx)(Ut,{contentKey:`${e}:approvalRequired`,items:er,empty:g.noDefinition})})]}):null,tr.length>0?(0,J.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:g.contextAssumptions}),(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsx)(Ut,{contentKey:`${e}:assumptions`,items:tr,empty:g.noDefinition})})]}):null,nr.length>0?(0,J.jsxs)(`details`,{className:`mt-4 border-t border-edge-subtle pt-4`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-sm font-medium text-fg-muted hover:text-fg`,children:g.contextRisks}),(0,J.jsx)(`div`,{className:`mt-3`,children:(0,J.jsx)(Ut,{contentKey:`${e}:risks`,items:nr,empty:g.noDefinition})})]}):null]}):null]})})}),(0,J.jsxs)(Xe,{panelId:`management`,chevron:!0,defaultOpen:!0,"data-task-section":`management`,"data-task-section-label":m===`zh`?`任务管理`:`Management`,"aria-label":m===`zh`?`任务管理`:`Task management`,className:`rounded-2xl border border-edge-subtle bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-medium text-fg`,title:m===`zh`?`任务管理`:`Task management`,children:[(0,J.jsxs)(`aside`,{className:`min-w-0 overflow-hidden rounded-xl bg-surface-panel shadow-surface divide-y divide-edge-subtle`,children:[(0,J.jsxs)(`section`,{className:V(`p-5`,ir(`phase`,`resolution`,`priority`,`dueAt`,`delegateAgentId`)&&`task-detail-live-update`),children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:g.taskProperties}),(0,J.jsxs)(`div`,{className:`mt-4 grid gap-3 sm:grid-cols-2`,children:[(0,J.jsx)(Pt,{value:S.task.phase,disabled:W.has(`phase`),canMove:ar,canApprove:Fn,canReopen:In,language:m,label:g.taskPhase,onChange:fn}),(0,J.jsx)(Ft,{value:S.task.priority,disabled:W.has(`priority`),label:g.priority,labels:g.priorityLabels,onChange:pn}),(0,J.jsx)(It,{value:At(S.task.dueAt),disabled:W.has(`dueAt`),label:g.dueDate,onChange:mn}),(0,J.jsx)(Lt,{value:S.conversation.currentExecutorAgentId??``,disabled:W.has(`delegateAgentId`),label:g.executorLabel,unassignedLabel:g.unassigned,agents:We,language:m,onChange:yn})]})]}),(0,J.jsxs)(`details`,{className:V(`p-5`,ir(`dependencies`)&&`task-detail-live-update`),children:[(0,J.jsxs)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:[g.taskRelations,` · `,S.dependencies.length,` / `,S.dependents.length]}),(0,J.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:g.dependencies}),(0,J.jsx)(Rt,{candidates:ze,selected:S.dependencies,disabled:W.has(`dependencies`),labels:nn,getTaskHref:on,onChange:vn})]}),(0,J.jsxs)(`div`,{children:[(0,J.jsx)(`p`,{className:`mb-2 text-xs text-fg-muted`,children:g.dependents}),S.dependents.length>0?(0,J.jsx)(`div`,{className:`space-y-1.5`,children:S.dependents.map(t=>(0,J.jsx)(G,{content:t.title,contentKey:`${e}:dependent:${t.id}`,language:m,previewHeight:72,className:`rounded-lg bg-surface-hover p-2.5`,children:(0,J.jsx)(o,{to:on(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,J.jsx)(`p`,{className:`text-sm text-fg-subtle`,children:g.noDependents})]})]})]})]}),S.task.phase===`closed`?null:(0,J.jsxs)(U,{variant:`ghost`,className:`my-3`,disabled:!M,onClick:Xn,children:[(0,J.jsx)(E,{className:`size-4`}),Kn.length>0?m===`zh`?`管理执行时间`:`Manage schedule`:g.scheduleRecurringTask]}),(0,J.jsxs)(`details`,{className:`mb-4 rounded-xl border border-edge-subtle bg-surface-panel p-5 shadow-surface`,children:[(0,J.jsx)(`summary`,{className:`cursor-pointer text-sm font-semibold text-fg`,children:m===`zh`?`关联内容`:`Related work`}),Zn.length>0||S.runs.length>0||Gn.length>0||S.dependencies.length>0||S.dependents.length>0?(0,J.jsxs)(`div`,{className:`mt-3 grid gap-3 sm:grid-cols-2`,children:[Zn.length>0?(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:m===`zh`?`对话 · ${Zn.length}`:`Conversations · ${Zn.length}`}),(0,J.jsx)(wt,{contentKey:`${e}:sessions`,language:m,className:`mt-2`,children:Zn.map(t=>(0,J.jsx)(`li`,{children:(0,J.jsx)(o,{className:`block break-words [overflow-wrap:anywhere] text-sm text-accent hover:underline`,to:t.conversationId===$?B(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===$?m===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?m===`zh`?`关联讨论`:`Linked discussion`:m===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})]}):null,Gn.length>0?(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:m===`zh`?`自动化 · ${Gn.length}`:`Automations · ${Gn.length}`}),(0,J.jsx)(wt,{contentKey:`${e}:automations`,language:m,className:`mt-2`,children:Gn.map(e=>(0,J.jsx)(`li`,{children:(0,J.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,S.dependencies.length>0||S.dependents.length>0?(0,J.jsxs)(`div`,{className:`rounded-lg bg-surface-hover p-3`,children:[(0,J.jsx)(`h3`,{className:`text-xs font-medium text-fg-muted`,children:g.taskRelations}),(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg`,children:m===`zh`?`${S.dependencies.length} 个前置任务 · ${S.dependents.length} 个后续任务`:`${S.dependencies.length} prerequisites · ${S.dependents.length} dependents`})]}):null]}):(0,J.jsx)(`p`,{className:`mt-2 text-sm text-fg-muted`,children:m===`zh`?`还没有关联内容`:`No related work yet`}),(0,J.jsx)(`div`,{className:`mt-4 border-t border-edge-subtle pt-3`,children:(0,J.jsx)(qe,{resource:{kind:`task`,id:S.task.id,revision:String(S.task.version)},disabled:Ke||et||W.size>0})})]}),Wn.length>0?(0,J.jsxs)(`section`,{className:V(`p-5`,ir(`context`)&&`task-detail-live-update`),children:[(0,J.jsx)(`h2`,{className:`text-sm font-semibold text-fg`,children:g.contextUsed}),(0,J.jsx)(`ul`,{className:`mt-4 grid gap-2 sm:grid-cols-2`,children:Wn.map(e=>(0,J.jsxs)(`li`,{className:`min-w-0 rounded-lg bg-surface-hover p-2.5`,children:[(0,J.jsxs)(`span`,{className:`text-[11px] text-fg-subtle`,children:[g.contextRoleLabels[e.role],` · `,g.contextKindLabels[e.targetKind]]}),e.targetKind===`url`&&/^https?:\/\//.test(e.targetId)?(0,J.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,J.jsx)(`p`,{className:`mt-1 break-words text-sm text-fg`,children:e.title??e.targetId})]},e.id))})]}):null]}),(0,J.jsx)(Xe,{panelId:`activity`,chevron:!0,defaultOpen:!0,"data-task-section":`activity`,"data-task-section-label":m===`zh`?`活动留言`:`Activity`,className:`rounded-2xl border border-edge-subtle bg-surface-panel p-4`,summaryClassName:`cursor-pointer rounded-sm text-sm font-semibold text-fg`,title:m===`zh`?`活动记录与留言`:`Activity and updates`,children:(0,J.jsxs)(`div`,{className:`mt-3 space-y-4`,children:[(0,J.jsx)(Tt,{taskId:e},e),(0,J.jsx)(mt,{changes:S.phaseChanges,language:m})]})})]})]}),(0,J.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":m===`zh`?`调整任务信息和 Agent 对话的宽度`:`Resize task details and Agent chat`,"aria-valuemin":30,"aria-valuemax":60,"aria-valuenow":Math.round(at),tabIndex:0,onPointerDown:_n,onKeyDown:gn,onDoubleClick:()=>hn(Bt),className:`hidden w-2 shrink-0 cursor-col-resize touch-none bg-surface-panel outline-none focus-visible:bg-accent-soft lg:block`}),(0,J.jsxs)(`aside`,{className:`flex min-h-[34rem] min-w-0 shrink-0 flex-col bg-surface-panel lg:min-h-0 lg:w-[var(--task-chat-panel-width)]`,children:[(0,J.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-b border-edge-subtle px-4 py-3`,children:[(0,J.jsx)(`h2`,{className:`text-sm font-medium text-fg-muted`,children:m===`zh`?`执行对话`:`Execution chat`}),(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[Zn.length>1?(0,J.jsxs)(je,{children:[(0,J.jsx)(Me,{asChild:!0,children:(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:`h-8 px-2 text-xs`,children:m===`zh`?`${Zn.length} 段对话`:`${Zn.length} conversations`})}),(0,J.jsx)(Ne,{children:(0,J.jsx)(Fe,{align:`end`,sideOffset:6,className:`z-[100] min-w-52 rounded-lg border border-edge bg-surface-overlay p-1 shadow-popover`,children:Zn.map(t=>(0,J.jsx)(Pe,{asChild:!0,children:(0,J.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===$?B(e):`/chat/${encodeURIComponent(t.conversationId)}`,children:t.conversationId===$?m===`zh`?`当前执行对话`:`Current execution chat`:t.role===`discussion`?m===`zh`?`关联讨论`:`Linked discussion`:m===`zh`?`历史执行对话`:`Earlier execution chat`})},t.id))})})]}):null,$?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(U,{type:`button`,variant:`ghost`,className:V(`size-8 p-0`,Un&&`bg-surface-hover text-fg`),"aria-label":m===`zh`?`项目文件`:`Project files`,"aria-pressed":Un,onClick:()=>{Ce.getState().openFiles($),x($)},children:(0,J.jsx)(L,{className:`size-4`,"aria-hidden":!0})}),(0,J.jsx)(U,{asChild:!0,variant:`ghost`,className:`size-8 p-0`,children:(0,J.jsx)(o,{to:B(e),"aria-label":m===`zh`?`全屏打开对话`:`Open chat full screen`,children:(0,J.jsx)(F,{className:`size-4`,"aria-hidden":!0})})})]}):null]})]}),$?(0,J.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,J.jsx)(w,{embedded:!0,conversationId:$,taskId:e})}):A?(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-xs`,children:[(0,J.jsx)(te,{className:`mx-auto size-8 animate-pulse text-fg-subtle`}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:m===`zh`?`正在创建任务会话`:`Creating task conversation`})]})}):j?(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-xs`,children:[(0,J.jsx)(te,{className:`mx-auto size-8 text-danger`}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:m===`zh`?`任务会话创建失败`:`Could not create task conversation`}),(0,J.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:j instanceof Error?j.message:String(j)})]})}):(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center p-8 text-center`,children:(0,J.jsxs)(`div`,{className:`max-w-xs`,children:[(0,J.jsx)(te,{className:`mx-auto size-8 text-fg-subtle`}),(0,J.jsx)(`p`,{className:`mt-3 text-sm font-medium text-fg`,children:m===`zh`?`等待任务会话`:`Waiting for a task conversation`}),(0,J.jsx)(`p`,{className:`mt-2 text-xs leading-5 text-fg-muted`,children:m===`zh`?`安排或开始任务后,Agent 的执行过程和持续对话会显示在这里。`:`Schedule or start the task to see the agent run and continue the conversation here.`})]})})]})]}),Zt?(0,J.jsx)(_t,{automation:$t??void 0,taskId:e,taskTitle:S.task.title,projectId:S.task.projectId,executorAgentId:Ln,language:m,onClose:()=>Qt(!1),onCreated:Jn},`${e}:${$t?.id??`new`}`):null,(0,J.jsx)(Ae,{open:Yt,title:g.deleteTaskTitle,description:g.deleteTaskDescription.replace(`{{title}}`,S.task.title),confirmLabel:g.confirmDeleteTask,cancelLabel:g.keepTask,destructive:!0,onConfirm:()=>{Xt(!1),bn()},onCancel:()=>Xt(!1)})]})}function Y(){let e=(0,q.c)(2),{taskId:t}=i(),n=t===void 0?``:t,r;return e[0]===n?r=e[1]:(r=(0,J.jsx)(Kt,{taskId:n,presentation:`page`}),e[0]=n,e[1]=r),r}function qt(e){let t=(0,q.c)(43),{taskId:n,backgroundPath:r,workspacePanelWidth:i,onClose:a}=e,o=i===void 0?0:i,s=u(Zt),c=H(Xt),l=o>0,[d,f]=(0,K.useState)(),p=d?.taskId===n?d:void 0,b;t[0]!==a||t[1]!==c?(b=e=>{e||(c(null),a())},t[0]=a,t[1]=c,t[2]=b):b=t[2];let x=s===`zh`?`关闭任务详情`:`Close task details`,S;t[3]!==a||t[4]!==c?(S=()=>{c(null),a()},t[3]=a,t[4]=c,t[5]=S):S=t[5];let C;t[6]!==x||t[7]!==S?(C=(0,J.jsx)(`button`,{type:`button`,tabIndex:-1,"data-task-modal-backdrop":!0,className:`fixed inset-0 z-[80] bg-black/45`,"aria-label":x,onClick:S}),t[6]=x,t[7]=S,t[8]=C):C=t[8];let w=l?`true`:`false`,T=`${o/2}px`,E=`${o}px`,D;t[9]!==T||t[10]!==E?(D={"--task-detail-workspace-offset":T,"--task-detail-workspace-width":E},t[9]=T,t[10]=E,t[11]=D):D=t[11];let O=D,k=s===`zh`?`任务详情`:`Task details`,A=p?.title,j=p?.compact??!1,M;t[12]!==k||t[13]!==A||t[14]!==j?(M=(0,J.jsx)(v,{className:`min-w-0 flex-1 font-medium text-fg`,children:(0,J.jsx)(Ct,{label:k,title:A,compact:j})}),t[12]=k,t[13]=A,t[14]=j,t[15]=M):M=t[15];let N=s===`zh`?`查看并操作任务详情`:`View and manage task details`,P;t[16]===N?P=t[17]:(P=(0,J.jsx)(m,{className:`sr-only`,children:N}),t[16]=N,t[17]=P);let F=s===`zh`?`关闭任务详情`:`Close task details`,I;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,J.jsx)(ie,{className:`size-4`,"aria-hidden":!0}),t[18]=I):I=t[18];let L;t[19]===F?L=t[20]:(L=(0,J.jsx)(`div`,{className:`flex shrink-0 items-center gap-1`,children:(0,J.jsx)(h,{className:`flex size-8 items-center justify-center rounded-lg text-fg-muted hover:bg-surface-hover hover:text-fg`,"aria-label":F,children:I})}),t[19]=F,t[20]=L);let R;t[21]!==M||t[22]!==P||t[23]!==L?(R=(0,J.jsxs)(`header`,{className:`flex shrink-0 items-center justify-between gap-3 bg-surface-panel px-5 py-3.5`,children:[M,P,L]}),t[21]=M,t[22]=P,t[23]=L,t[24]=R):R=t[24];let z;t[25]!==a||t[26]!==c?(z=()=>{c(null),a()},t[25]=a,t[26]=c,t[27]=z):z=t[27];let ee;t[28]!==r||t[29]!==z||t[30]!==n?(ee=(0,J.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,J.jsx)(Kt,{taskId:n,presentation:`modal`,backgroundPath:r,onHeaderChange:f,onDeleted:z},n)}),t[28]=r,t[29]=z,t[30]=n,t[31]=ee):ee=t[31];let B;t[32]!==O||t[33]!==R||t[34]!==ee||t[35]!==w?(B=(0,J.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":w,style:O,onEscapeKeyDown:Yt,onInteractOutside:Jt,children:[R,ee]}),t[32]=O,t[33]=R,t[34]=ee,t[35]=w,t[36]=B):B=t[36];let te;t[37]!==B||t[38]!==C?(te=(0,J.jsxs)(g,{children:[C,B]}),t[37]=B,t[38]=C,t[39]=te):te=t[39];let ne;return t[40]!==b||t[41]!==te?(ne=(0,J.jsx)(y,{modal:!1,open:!0,onOpenChange:b,children:te}),t[40]=b,t[41]=te,t[42]=ne):ne=t[42],ne}function Jt(e){let t=e.detail.originalEvent.target;t instanceof Element&&t.closest(`#app-workspace-panel, [data-task-modal-backdrop]`)&&e.preventDefault()}function Yt(e){let t=e.target;t instanceof HTMLElement&&t.closest(`[data-task-inline-editor]`)&&e.preventDefault()}function Xt(e){return e.setPath}function Zt(e){return e.language}function Qt(e){return e.id}export{qt as TaskDetailModal,Y as TaskDetailPage};
@@ -1 +0,0 @@
1
- import{_ as e,a as t,c as n,d as r,f as i,i as a,m as o,n as s,o as c,u as l}from"./schemas-CCWMleym.js";import{n as u}from"./specialists-xbB3xL9e.js";var d=s([`backlog`,`ready`,`active`,`review`,`closed`]),f=s([`done`,`cancelled`,`duplicate`,`wont_do`]),p=s([`allocating`,`idle`,`queued`,`running`,`waiting`,`verifying`,`blocked`,`failed`,`cancelled`]),m=s([`dependency`,`user_input`,`approval`,`external_event`,`scheduled_time`,`retry_backoff`,`paused`]),h=s([`active`,`resolved`,`cancelled`]),g=r({id:o(),taskId:o(),taskRunId:o().optional(),kind:m,status:h,reason:o(),condition:i(o(),e()),resumeAt:l().int().nonnegative().optional(),resolvedBy:i(o(),e()).optional(),resolution:e().optional(),createdAt:l().int().nonnegative(),resolvedAt:l().int().nonnegative().optional()}),_=r({kind:s([`allocation_blocked`,`allocation_failed`,`input_required`,`approval_required`,`dependency_blocked`,`run_failed`,`verification_failed`,`overdue`,`stale`]),summary:o(),sourceId:o().optional()}),v=s([`agent`,`human`,`external`]),y=s([`queued`,`running`,`waiting`,`verifying`,`succeeded`,`failed`,`cancelled`]),b=new Set([`succeeded`,`failed`,`cancelled`]),x=r({id:o(),taskId:o(),rootRunId:o(),parentRunId:o().optional(),attempt:l().int().positive(),status:y,executorKind:v,executorRef:i(o(),e()),trigger:i(o(),e()),correlationId:o(),causationId:o().optional(),idempotencyKey:o(),contractVersion:l().int().positive(),contextSnapshotId:o().optional(),policySnapshot:i(o(),e()).optional(),conversationId:o().optional(),queuedAt:l().int().nonnegative(),scheduledAt:l().int().nonnegative().optional(),startedAt:l().int().nonnegative().optional(),heartbeatAt:l().int().nonnegative().optional(),completedAt:l().int().nonnegative().optional(),timeoutAt:l().int().nonnegative().optional(),leaseOwner:o().optional(),leaseExpiresAt:l().int().nonnegative().optional(),retryPolicy:i(o(),e()),retryOfRunId:o().optional(),terminalCode:o().optional(),terminalMessage:o().optional(),version:l().int().positive()}).superRefine((e,t)=>{!e.parentRunId&&e.rootRunId!==e.id&&t.addIssue({code:`custom`,path:[`rootRunId`],message:`A root run must reference itself`}),(e.startedAt!==void 0||[`running`,`verifying`,`succeeded`].includes(e.status))&&(!e.contextSnapshotId||!e.policySnapshot)&&t.addIssue({code:`custom`,path:[`contextSnapshotId`],message:`A dispatched run requires context and policy snapshots`}),b.has(e.status)!==!!e.completedAt&&t.addIssue({code:`custom`,path:[`completedAt`],message:`Only terminal runs have a completion timestamp`})}),S=r({id:o(),runId:o(),sequence:l().int().positive(),type:o(),payload:i(o(),e()),actor:i(o(),e()),occurredAt:l().int().nonnegative()}),C=r({id:o(),taskId:o(),status:s([`pending`,`selecting`,`assigned`,`blocked`,`failed`,`cancelled`]),selectedAgentId:o().optional(),selectionReason:o().optional(),reasonCode:o().optional(),attempts:l(),updatedAt:l()}),w=s([`low`,`normal`,`high`,`critical`]),T=s([`title`,`body`,`phase`,`resolution`,`priority`,`dueAt`,`projectId`,`milestoneId`,`parentTaskId`,`ownerId`,`delegateAgentId`,`boardRank`,`contract`,`dependencies`,`context`,`runs`,`receipts`,`acceptance`,`feedback`,`attention`,`conversation`]),E=r({taskId:o().min(1),projectId:o().min(1).optional(),version:l().int().positive(),changedFields:a(T).min(1),source:s([`user`,`agent`,`runtime`]),actorId:o().min(1).optional(),occurredAt:l().int().nonnegative()}),D=r({taskId:o().min(1),projectId:o().min(1).optional(),deletedAt:l().int().nonnegative()}),O=s([`verified_auto`,`verified_then_review`,`manual`]),k=r({kind:s([`user`,`agent`,`system`,`integration`]),id:o().optional()}),A=r({taskId:o(),version:l().int().positive(),objective:o(),expectedOutputs:a(o()),acceptanceCriteria:a(o()),constraints:a(o()),approvalRequired:a(o()),assumptions:a(o()),risks:a(o()),acceptancePolicy:O,outputDestinations:a(i(o(),e())),createdBy:k,createdAt:l().int().nonnegative()}),j=r({id:o(),title:o(),body:o().optional(),phase:d,resolution:f.optional(),priority:w,dueAt:l().int().nonnegative().optional(),projectId:o().optional(),milestoneId:o().optional(),parentTaskId:o().optional(),ownerId:o().optional(),delegateAgentId:o().optional(),source:o(),locale:s([`en`,`zh`]).optional(),latestContractVersion:l().int().positive(),boardRank:l().finite().default(0),version:l().int().positive(),contract:A.optional(),createdAt:l().int().nonnegative(),updatedAt:l().int().nonnegative(),closedAt:l().int().nonnegative().optional()}).superRefine((e,t)=>{e.phase===`closed`!=!!e.resolution&&t.addIssue({code:`custom`,path:[`resolution`],message:`Closed tasks require a resolution and open tasks cannot have one`})}),M=s([`input`,`reference`,`constraint`,`deliverable`,`evidence`]),N=r({id:o(),taskId:o(),targetKind:s([`document`,`file`,`url`,`session`,`memory`,`task`,`artifact`,`source`]),targetId:o(),role:M,title:o().optional(),pinned:t(),retrievalPolicy:i(o(),e()),metadata:i(o(),e()),createdBy:k,createdAt:l().int().nonnegative(),updatedAt:l().int().nonnegative()}),P=r({id:o(),taskId:o(),capability:o(),scope:i(o(),e()),grantedBy:k,grantedAt:l().int().nonnegative(),expiresAt:l().int().nonnegative().optional(),revokedAt:l().int().nonnegative().optional()}),F=r({id:o(),title:o(),phase:d,resolution:f.optional(),allocation:C.optional(),operationalState:p}),I=r({kind:s([`artifact`,`test`,`state`,`source`]),title:o(),summary:o(),uri:o().optional(),verifies:a(o()).optional(),provenance:s([`tool`,`external`,`user`,`judge`]),strength:s([`observed`,`verified`]),observedAt:l().int().nonnegative()}),L=r({recommendation:o(),reasons:a(o()),rejectedAlternatives:a(r({option:o(),reason:o()})),uncertainty:o().optional(),confidence:l().min(0).max(1)}),R=r({runId:o(),status:s([`succeeded`,`failed`,`cancelled`]),summary:o(),changes:a(I),evidence:a(I),verification:r({status:s([`passed`,`failed`,`unverified`]),checks:a(r({criterion:o(),status:s([`passed`,`failed`,`unverified`]),evidenceTitles:a(o()),note:o().optional(),method:s([`tool_verified`,`model_reviewed`,`unverified`]).optional()}))}),remainingWork:a(o()),nextAction:o().optional(),needsUser:t(),completionVerdict:s([`achieved`,`partial`,`not_achieved`]).optional(),failure:r({code:o(),phase:o(),recoveryAction:o()}).optional(),judgment:L.optional(),contextTraceId:o().optional(),finalizedAt:l().int().nonnegative()}),z=r({contractVersion:l().int().positive(),criterionIndex:l().int().nonnegative(),criterionText:o(),status:s([`passed`,`failed`,`unverified`]),note:o().optional(),reviewedBy:k,reviewedAt:l().int().nonnegative()});r({expectedVersion:l().int().positive(),contractVersion:l().int().positive(),status:s([`passed`,`failed`,`unverified`]),note:o().trim().max(2e3).optional()}).strict();var B=c(`kind`,[r({kind:n(`agent`),agentId:o().min(1)}),r({kind:n(`human`),actorId:o().min(1)}),r({kind:n(`external`),provider:o().min(1),config:e()})]),V=A.omit({taskId:!0,version:!0,createdBy:!0,createdAt:!0}).extend({acceptancePolicy:O.default(`verified_auto`)}),H=N.omit({id:!0,taskId:!0,createdBy:!0,createdAt:!0,updatedAt:!0});r({idempotencyKey:o().trim().min(1).max(200),title:o().trim().min(1).max(500),body:o().trim().max(5e4).optional(),projectId:o().trim().min(1).optional(),milestoneId:o().trim().min(1).optional(),parentTaskId:o().trim().min(1).optional(),priority:w.default(`normal`),dueAt:l().int().nonnegative().optional(),ownerId:o().trim().min(1).optional(),delegateAgentId:o().trim().min(1).optional(),originConversationId:o().trim().min(1).optional(),locale:s([`en`,`zh`]).optional(),contract:V,dependencies:a(o().trim().min(1)).default([]),context:a(H).default([]),authorityGrants:a(r({capability:o().min(1),scope:i(o(),e()).default({}),expiresAt:l().int().nonnegative().optional()})).default([]),activation:c(`mode`,[r({mode:n(`allocate`),requirements:u}).strict(),r({mode:n(`capture`),phase:s([`backlog`,`ready`]).default(`backlog`)}),r({mode:n(`start`),executor:B.optional(),scheduleAt:l().int().nonnegative().optional()})])}).strict(),r({expectedVersion:l().int().positive(),title:o().trim().min(1).max(500).optional(),body:o().trim().max(5e4).nullable().optional(),projectId:o().trim().min(1).nullable().optional(),milestoneId:o().trim().min(1).nullable().optional(),parentTaskId:o().trim().min(1).nullable().optional(),priority:w.optional(),dueAt:l().int().nonnegative().nullable().optional(),ownerId:o().trim().min(1).nullable().optional()}).strict();var U=r({kind:s([`dependency`,`user_input`,`approval`,`external_event`,`scheduled_time`,`retry_backoff`,`paused`]),reason:o().min(1),condition:i(o(),e()).default({}),resumeAt:l().int().nonnegative().optional()}),W=c(`type`,[r({type:n(`retry_allocation`)}),r({type:n(`move`),phase:d,resolution:f.optional()}),r({type:n(`mark_ready`)}),r({type:n(`start`),executor:B,scheduleAt:l().int().nonnegative().optional()}),r({type:n(`request_review`)}),r({type:n(`close`),resolution:f}),r({type:n(`reopen`),phase:s([`backlog`,`ready`,`active`,`review`])}),r({type:n(`add_wait`),wait:U}),r({type:n(`resolve_wait`),waitId:o(),resolution:e().optional()}),r({type:n(`revise_contract`),contract:V})]),G=s([`board`,`mobile`,`api`,`runtime`,`undo`]),K=r({id:o(),taskId:o(),fromPhase:d,toPhase:d,fromResolution:f.optional(),toResolution:f.optional(),actor:k,source:G,operationId:o().optional(),runId:o().optional(),taskVersion:l().int().positive(),createdAt:l()});r({source:G.optional(),idempotencyKey:o().trim().min(1).max(200),expectedVersion:l().int().positive(),command:W}).strict(),r({dependsOnTaskIds:a(o().trim().min(1)),expectedVersion:l().int().positive()}).strict(),r({expectedVersion:l().int().positive(),beforeTaskId:o().trim().min(1).nullable().optional()}).strict();var q=r({ok:n(!0),items:a(r({task:j,allocation:C.optional(),operationalState:p,attention:a(_)}))}),J=r({ok:n(!0),task:j,allocation:C.optional(),operationalState:p,run:x.optional()}),Y=r({taskId:o(),activeConversationId:o().optional(),currentExecutorAgentId:o().optional(),assignmentEpoch:l().int().nonnegative(),status:s([`idle`,`active`]),updatedAt:l().int().nonnegative()}),X=r({id:o(),taskId:o(),conversationId:o(),role:s([`primary`,`discussion`,`execution`]),agentId:o().optional(),runId:o().optional(),assignmentEpoch:l().int().nonnegative(),status:s([`active`,`completed`,`superseded`,`failed`]),startedAt:l().int().nonnegative(),endedAt:l().int().nonnegative().optional(),createdAt:l().int().nonnegative()});r({toAgentId:o().trim().min(1),expectedVersion:l().int().positive(),idempotencyKey:o().trim().min(1).max(200)}).strict(),r({ok:n(!0),task:j,conversation:Y,fromAgentId:o().optional(),toAgentId:o(),activeConversationId:o(),assignmentEpoch:l().int().positive()});var Z=r({phaseChanges:a(K).default([]),ok:n(!0),task:j,allocation:C.optional(),operationalState:p,attention:a(_),waits:a(g),runs:a(x),receipts:a(R),criterionReviews:a(z),context:a(N),conversation:Y,sessions:a(X),authorityGrants:a(P),dependencies:a(F),dependents:a(F),allowedCommands:a(o())});r({ok:n(!0),items:a(R)});function Q(e){let t=new Set(e?.evidence.filter(e=>e.strength===`verified`).map(e=>e.title));return new Set(e?.verification.checks.filter(e=>e.status===`passed`&&e.evidenceTitles.some(e=>t.has(e))).map(e=>e.criterion))}export{f as _,F as a,q as c,Q as d,S as f,d as g,p as h,D as i,w as l,_ as m,W as n,Z as o,x as p,J as r,B as s,E as t,R as u,g as v};
@@ -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{n as a}from"./locale-store-Cit_aHqC.js";import{t as o}from"./messages-DQveK9sk.js";import{o as s,r as c,s as l,t as u}from"./dist-CY7CS_D3.js";import{t as d}from"./chevron-left-DqFhpbvK.js";import{t as f}from"./chevron-right-BweFrslA.js";import{n as p,t as m}from"./file-BqMS_3DT.js";import{a as h,b as g,l as _,n as v,t as y}from"./use-file-preview-expanded-CQeo2Ztn.js";import{t as b}from"./mic-CuUb7zc-.js";import{n as x}from"./share-link-dialog-BxFk4-4u.js";import{t as S}from"./cn-0WouolD0.js";import{r as C,t as w}from"./constants-Bg1wM2nv.js";import{r as T}from"./attachment-utils-core-BIOUBrpT.js";import{n as E}from"./right-workspace-store-BzXnZDK5.js";import{n as D}from"./interaction-BdhHBbYa.js";import{t as O}from"./composer-notifications-B0IZsy8x.js";import{n as k}from"./electron-env-DHOGevH3.js";import{a as A,n as j,t as M}from"./file-preview-surface-CeFFZo3a.js";var N=n(),P=e(t(),1),F=r();function I(e){let t=(0,N.c)(6),n=g(),r,i;if(t[0]!==n||t[1]!==e?(r=()=>{!n||e.embedded||!e.open||!e.attachment||(E.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,P.useEffect)(r,i),n&&!e.embedded)return null;let a;return t[4]===e?a=t[5]:(a=(0,F.jsx)(L,{...e}),t[4]=e,t[5]=a),a}function L({open:e,embedded:t=!1,tabId:n,attachment:r,images:i=[],resultRevision:p,onAttachmentChange:m,authToken:h,conversationId:g,layerClassName:b=`z-[115]`,onClose:w}){let T=a(e=>e.language),E=o(T).chat,N=_({open:e,attachment:r,authToken:h,conversationId:g,language:T}),I=A(),{expanded:L,setExpanded:R}=y(e,I.dialogOpen),[z,B]=(0,P.useState)(!1),{preview:V,fileType:H,hasExtractedText:U}=N,W=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,G=H===`image`&&i.length>1&&W>=0&&!!m,K=e=>{if(!G||I.dialogOpen)return;let t=W+(e===`previous`?-1:1);t>=0&&t<i.length&&m?.(i[t])},q=H!==`image`&&H!==`text`&&H!==`pptx`&&U,J=V?.uri?C(V.uri):null,Y=!!(J||V?.uri?.startsWith(`media://`)&&(g||V.taskId)),X=()=>{!V?.uri||!Y||I.createShareLink(J?{fileId:J,fileName:V.name}:{uri:V.uri,conversationId:g??void 0,taskId:V.taskId,fileName:V.name})},ee=!!(V&&!N.loading&&!N.loadError),Z=()=>{R(!1),w()},te=()=>{if(!V||!N.downloadBuffer)return;let e=new Blob([N.downloadBuffer],{type:N.descriptor.mimeType}),t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=V.name??`download`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)},ne=!!N.downloadBuffer,re=k()&&H===`spreadsheet`&&/\.xlsx?$/i.test(N.fileName)&&!!N.downloadBuffer&&!!window.electronAPI?.shell?.openTemporaryFile,ie=async()=>{let e=N.downloadBuffer,t=window.electronAPI?.shell?.openTemporaryFile;if(!(!e||!t||z)){B(!0);try{(await t({fileName:N.fileName,data:new Uint8Array(e)})).ok||O(`warning`,E.attachmentPreviewOpenLocalFailed)}catch{O(`warning`,E.attachmentPreviewOpenLocalFailed)}finally{B(!1)}}},ae={onDownload:te,canDownload:ne},Q=S(`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`,D.focusRingBase),$=(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(v,{header:{expanded:L,onToggleExpanded:ee?()=>R(e=>!e):void 0,hideClose:t,hideExpand:!!n,onClose:Z,share:Y?{onClick:X,loading:I.loading}:void 0,openWithSystemApp:re?{onClick:()=>void ie(),loading:z}:void 0,textView:q?{active:N.showExtractedText,onChange:e=>{N.setShowExtractedText(e),N.clearLoadError()}}:void 0},chat:N.downloadBuffer?{conversationId:g,createFile:async()=>new File([N.downloadBuffer],N.fileName,{type:N.descriptor.mimeType})}:void 0,onImageSwipe:G?K:void 0,language:T,descriptor:n?{...N.descriptor,id:n}:N.descriptor,loading:N.loading,loadError:N.loadError,textContent:N.textContent,binaryBuffer:N.binaryBuffer,showExtractedText:N.showExtractedText,extractedText:N.extractedText,extractedTextTruncated:N.extractedTextTruncated,actions:ae}),p?(0,F.jsxs)(`p`,{className:`shrink-0 border-t border-edge px-4 py-2 text-xs text-fg-muted`,"data-result-revision":!0,children:[T===`zh`?`成果版本`:`Result version`,` `,p]}):null,G?(0,F.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,F.jsx)(`button`,{type:`button`,"aria-label":E.attachmentPreviewPreviousImage,disabled:W===0,onClick:()=>K(`previous`),className:S(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,D.focusRingBase),children:(0,F.jsx)(d,{size:20,"aria-hidden":`true`})}),(0,F.jsxs)(`span`,{role:`status`,className:`min-w-16 text-center text-sm tabular-nums text-fg-muted`,children:[W+1,` / `,i.length]}),(0,F.jsx)(`button`,{type:`button`,"aria-label":E.attachmentPreviewNextImage,disabled:W===i.length-1,onClick:()=>K(`next`),className:S(`flex size-11 touch-manipulation items-center justify-center rounded-lg hover:bg-surface-hover disabled:opacity-30`,D.focusRingBase),children:(0,F.jsx)(f,{size:20,"aria-hidden":`true`})})]}):null]});return t?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(M,{expanded:L,children:$}),(0,F.jsx)(x,{open:I.dialogOpen,onOpenChange:I.handleOpenChange,loading:I.loading,error:I.error,result:I.result,pendingParams:I.pendingParams,onConfirm:e=>void I.confirmShareLink(e)})]}):(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(u,{open:e,onOpenChange:e=>!e&&Z(),children:(0,F.jsx)(s,{children:(0,F.jsxs)(c,{"aria-describedby":void 0,onKeyDown:e=>{!G||I.dialogOpen||e.altKey||e.ctrlKey||e.metaKey||e.target.closest(`input, textarea, select, [contenteditable="true"]`)||(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),K(e.key===`ArrowLeft`?`previous`:`next`))},className:S(`xopc-dialog-content-fullscreen fixed inset-0 flex h-[100dvh] w-full flex-row overflow-hidden`,j(),b,`border-0 bg-transparent p-0 shadow-none outline-none`),children:[(0,F.jsx)(l,{className:`sr-only`,children:V?.name??``}),(0,F.jsx)(`button`,{type:`button`,className:Q,onClick:Z,"aria-label":E.attachmentPreviewClose}),(0,F.jsx)(`div`,{className:S(`flex h-full min-h-0 shrink-0 flex-col overflow-hidden`,L?`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:$}),(0,F.jsx)(`button`,{type:`button`,className:Q,onClick:Z,"aria-label":E.attachmentPreviewClose})]})})}),(0,F.jsx)(x,{open:I.dialogOpen,onOpenChange:I.handleOpenChange,loading:I.loading,error:I.error,result:I.result,pendingParams:I.pendingParams,onConfirm:e=>void I.confirmShareLink(e)})]})}function R(e){let t=(0,N.c)(23),{attachments:n,conversationId:r,topPadded:i,onRemove:s,className:c}=e,l=a(z),u;t[0]===l?u=t[1]:(u=o(l),t[0]=l,t[1]=u);let d=u.chat,[f,h]=(0,P.useState)(null);if(n.length===0)return null;let g=i?`pt-2`:`pt-3`,_;t[2]!==c||t[3]!==g?(_=S(`flex flex-wrap gap-2 border-b border-edge-subtle/90 bg-surface-hover/20 px-4 pb-2 dark:border-edge-subtle`,g,c),t[2]=c,t[3]=g,t[4]=_):_=t[4];let v;if(t[5]!==n||t[6]!==d||t[7]!==s){let e;t[9]!==d||t[10]!==s?(e=(e,t)=>{let n=e.type===`pasted_text`?d.pastedText:e.name;return(0,F.jsxs)(`div`,{className:`flex max-w-[200px] items-center rounded-lg bg-surface-hover text-xs dark:bg-surface-hover/80`,children:[(0,F.jsxs)(`button`,{type:`button`,className:S(`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`,D.transition,D.press,D.focusRingPanel),onClick:()=>h(e),"aria-label":`${d.attachmentPreviewOpen}: ${n}`,title:`${d.attachmentPreviewOpen}: ${n}`,children:[e.mimeType?.startsWith(`image/`)&&e.content?(0,F.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,F.jsx)(b,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):e.type===`pasted_text`?(0,F.jsx)(p,{className:`size-3.5 shrink-0 text-accent-fg`,"aria-hidden":!0}):(0,F.jsx)(m,{className:`size-3.5 shrink-0 text-fg-muted`,"aria-hidden":!0}),(0,F.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n}),(0,F.jsx)(`span`,{className:`shrink-0 text-fg-disabled`,children:T(e.size)})]}),(0,F.jsx)(`button`,{type:`button`,className:S(`flex min-h-8 min-w-8 items-center justify-center rounded-r-lg text-fg-muted hover:bg-surface-active hover:text-fg`,D.transition,D.press,D.focusRingPanel),onClick:()=>s(t),"aria-label":`${d.attachmentPreviewRemove}: ${n}`,title:`${d.attachmentPreviewRemove}: ${n}`,children:(0,F.jsx)(`span`,{"aria-hidden":!0,children:`×`})})]},e.id??`${e.name}-${e.size}-${e.mimeType}-${e.content?.slice(0,16)??``}`)},t[9]=d,t[10]=s,t[11]=e):e=t[11],v=n.map(e),t[5]=n,t[6]=d,t[7]=s,t[8]=v}else v=t[8];let y;t[12]!==_||t[13]!==v?(y=(0,F.jsx)(`div`,{className:_,children:v}),t[12]=_,t[13]=v,t[14]=y):y=t[14];let x=f!==null,C;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>h(null),t[15]=C):C=t[15];let w;t[16]!==r||t[17]!==f||t[18]!==x?(w=(0,F.jsx)(I,{open:x,attachment:f,conversationId:r,onClose:C}),t[16]=r,t[17]=f,t[18]=x,t[19]=w):w=t[19];let E;return t[20]!==y||t[21]!==w?(E=(0,F.jsxs)(F.Fragment,{children:[y,w]}),t[20]=y,t[21]=w,t[22]=E):E=t[22],E}function z(e){return e.language}function B(e){let{chat:t,initialAttachments:n=[],onAttachmentsChange:r}=e,[a,o]=(0,P.useState)(n),[s,c]=(0,P.useState)(!1),l=(0,P.useRef)(null),u=(0,P.useRef)(a),d=(0,P.useRef)(r);u.current=a,d.current=r;let f=(0,P.useCallback)(e=>{let t=typeof e==`function`?e(u.current):e;u.current=t,o(t),d.current?.(t)},[]),p=(0,P.useCallback)(()=>{f([])},[]),m=(0,P.useCallback)(e=>{f(t=>t.filter((t,n)=>n!==e))},[]),g=(0,P.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}:{}})),[]),_=(0,P.useCallback)(async(e,n)=>{if(e.length===0)return;let r=10-u.current.length;if(r<=0){O(`warning`,t.maxAttachmentsReached,{max:10});return}let a=e.slice(0,r);e.length>a.length&&O(`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 O(`warning`,t.attachmentFileTooLarge,{name:e.name,maxSize:T(w)}),null;try{return await o(e,e.name)}catch{return O(`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,P.useCallback)(e=>_(e),[_]);return(0,P.useEffect)(()=>{if(e.conversationId)return h(e.conversationId,async e=>{let t=u.current.length;return await _([e]),u.current.length>t})},[_,e.conversationId]),{attachments:a,setAttachments:f,attachmentsRef:u,isDragging:s,setIsDragging:c,fileInputRef:l,processFiles:v,processPastedText:(0,P.useCallback)(e=>_([new File([e.text],e.name,{type:e.mimeType})],`pasted_text`),[_]),removeAttachment:m,clearAttachments:p,wireAttachmentsPayload:g}}export{R as n,I as r,B as t};
@@ -1,15 +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-BwYU5OEh.js","assets/vendor-react-BOUWij0V.js","assets/vendor-codemirror-aCQ0FcJT.js","assets/languages-kF11aUYU.js","assets/binary-plugins-BjEE5sVq.js","assets/messages-DQveK9sk.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-C2lp7UmI.js","assets/archive-plugin-DS6JWBPZ.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-Cit_aHqC.js";import{t as u}from"./messages-DQveK9sk.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{K as C,q as w,t as T}from"./markdown-view-CiGdWuN3.js";import{t as E}from"./message-square-plus-XP0tGdlV.js";import{t as ee}from"./minimize-2-DtOGrlpo.js";import{t as D}from"./paperclip-f1HujQY1.js";import{t as te}from"./pencil-DmIY3Oa-.js";import{t as O}from"./plus-Q2yW6OE7.js";import{t as k}from"./refresh-cw-BRlGaq2w.js";import{t as A}from"./rotate-cw-LIg3Am9S.js";import{t as ne}from"./save-DRDABU--.js";import{t as j}from"./search-DA7gz22f.js";import{t as re}from"./x-B_N4OPjy.js";import{t as M}from"./cn-0WouolD0.js";import{t as N}from"./skeleton-DzdOeGYz.js";import{r as P,t as F}from"./constants-Bg1wM2nv.js";import{a as ie}from"./session-api-CkOliupg.js";import{a as ae,i as oe,n as se,r as I,s as L,t as R}from"./attachment-utils-core-BIOUBrpT.js";import{n as ce}from"./interaction-BdhHBbYa.js";import{t as z}from"./composer-notifications-B0IZsy8x.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-CmcrqRzN.js";import{a as pe,c as me,d as he,m as B,n as ge,r as V,u as H}from"./workspace-api-BfApIXLw.js";import{t as _e}from"./index.module-Cd9ENXfk.js";import{a as ve,l as ye,m as be,n as xe,o as Se,r as U,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=n(),G=e(t(),1),ke=(0,G.createContext)(null);function Ae(){return(0,G.useContext)(ke)}var K=(0,G.createContext)([]),je=(0,G.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 q(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(q(e))??n??`application/octet-stream`}function X(e,t){let n=q(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 Ue(e){switch(e){case`text`:case`markdown`:case`code`:case`html`:return`text`;case`unsupported`:return`metadata`;default:return`binary`}}async function We(e){let{uri:t,conversationId:n,taskId:r}=e;try{let e=P(t),i=await o(s(e?`/api/files/${encodeURIComponent(e)}/content`:L(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 Ge(e){let t=await We(e);return t.ok?{ok:!0,buffer:await t.blob.arrayBuffer()}:t}function Ke(e){return e.id?String(e.id):`${e.name}:${e.uri??``}`}function qe(){return{id:`__empty__`,context:`attachment`,fileName:``,mimeType:`application/octet-stream`,type:`unsupported`,source:{kind:`inline`}}}function Je(e){let t=(0,W.c)(65),{open:n,attachment:r,authToken:i,conversationId:a,language:o}=e,[s,c]=(0,G.useState)(n?r:null),[l,d]=(0,G.useState)(!1),[f,p]=(0,G.useState)(!1),m;t[0]!==r||t[1]!==n?(m=n&&r?Ke(r):null,t[0]=r,t[1]=n,t[2]=m):m=t[2];let h=m,g=(0,G.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=qe(),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=_?oe(_):void 0,t[18]=_,t[19]=b);let x=b,S=_?.uri,C;t[20]===y.type?C=t[21]:(C=Ue(y.type),t[20]=y.type,t[21]=C);let w=C,T=!!(n&&S&&!x&&i&&(w===`binary`||w===`text`)),E;t[22]!==a||t[23]!==o||t[24]!==S||t[25]!==_?.taskId?(E=async()=>{let e=u(o).chat,t=await Ge({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]=E):E=t[26];let ee=_?.taskId,D;t[27]!==i||t[28]!==a||t[29]!==x||t[30]!==o||t[31]!==S||t[32]!==n||t[33]!==w||t[34]!==ee?(D=[n,S,i,o,x,ee,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]=ee,t[35]=D):D=t[35];let te;t[36]===T?te=t[37]:(te={enabled:T,initial:null,errorData:null},t[36]=T,t[37]=te);let O=de(E,D,te),k;bb1:{if(x)try{let e;t[38]===x?e=t[39]:(e=se(x),t[38]=x,t[39]=e),k=e;break bb1}catch{k=null;break bb1}if(T&&O.loading){k=null;break bb1}k=O.data??null}let A=k,ne=w===`binary`?A:null,j=_?.extractedText??``,re;t[40]!==A||t[41]!==j||t[42]!==o||t[43]!==w?(re=w===`text`?j||(A?new TextDecoder(`utf-8`,{fatal:!1}).decode(new Uint8Array(A)):u(o).chat.attachmentPreviewNoText):null,t[40]=A,t[41]=j,t[42]=o,t[43]=w,t[44]=re):re=t[44];let M=re,N=!!_?.extractedText,P=y.type===`pptx`&&j.length>3e5,F;t[45]!==i||t[46]!==x||t[47]!==o||t[48]!==S||t[49]!==n||t[50]!==w?(F=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]=F):F=t[51];let ie=F,ae=O.error?O.error instanceof Error?O.error.message:String(O.error):null,I=f?null:ie??ae,L=T?O.loading:!1,R;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(R=()=>p(!0),t[52]=R):R=t[52];let ce=j||null,z;return t[53]!==ne||t[54]!==y||t[55]!==A||t[56]!==P||t[57]!==N||t[58]!==I||t[59]!==_||t[60]!==l||t[61]!==L||t[62]!==ce||t[63]!==M?(z={preview:_,descriptor:y,fileType:y.type,fileName:y.fileName,loading:L,loadError:I,clearLoadError:R,textContent:M,binaryBuffer:ne,downloadBuffer:A,hasExtractedText:N,extractedText:ce,extractedTextTruncated:P,showExtractedText:l,setShowExtractedText:d},t[53]=ne,t[54]=y,t[55]=A,t[56]=P,t[57]=N,t[58]=I,t[59]=_,t[60]=l,t[61]=L,t[62]=ce,t[63]=M,t[64]=z):z=t[64],z}function Ye(e){let t=(0,W.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 Xe(e){return{descriptor:e,textContent:null,binaryBuffer:null,fileResourceId:null,mtimeMs:null,loadError:null,loading:!1,pptxText:null,pptxTruncated:!1,pptxError:null}}function Ze(e,t){switch(t.type){case`clear`:return Xe(t.descriptor);case`loadStart`:return{...Xe(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{...Xe(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 Qe(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 $e({filePath:e,projectId:t,conversationId:n,agentId:r,initialEditMode:a=!1}){let o=Ye({projectId:t,conversationId:n,agentId:r}),s=(0,G.useMemo)(()=>{let t=e?J(e):``,i=Y(t,ae(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,G.useReducer)(Ze,s,Xe),[u,d]=(0,G.useReducer)(Qe,{sourceEditMode:a,saveStatus:`idle`}),[f,p]=(0,G.useState)([]),[m,h]=(0,G.useState)([]),g=(0,G.useRef)(e),_=(0,G.useRef)(void 0),v=(0,G.useRef)(null),y=(0,G.useRef)(null),b=(0,G.useRef)(null),[x,S]=(0,G.useState)(!1),[C,w]=(0,G.useState)(!1),[T,E]=(0,G.useState)(0);g.current!==e&&(g.current=e,d({type:`reset`})),(0,G.useEffect)(()=>{if(!e){l({type:`clear`,descriptor:s});return}let t=!1;l({type:`loadStart`,descriptor:s});let n=Ue(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),H(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(Ue(i.type)===`text`){let{content:r,mtimeMs:a,revision:s}=await me(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([me(e,o),H(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([pe(e,o),H(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,G.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 ee=(0,G.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 B(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]),D=_e(()=>void ee(),500),te=(0,G.useCallback)(e=>{v.current=e,S(e!==y.current),l({type:`patchText`,text:e}),D()},[D]);(0,G.useEffect)(()=>{let e=e=>{v.current!==y.current&&(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>{window.removeEventListener(`beforeunload`,e),D.cancel()}},[D]);let O=(0,G.useCallback)(()=>{!x&&!b.current&&E(e=>e+1)},[x]),k=(0,G.useRef)(!1),A=(0,G.useCallback)(async()=>{if(!(!e||c.loading||b.current||k.current)){k.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):O()}catch{w(!0)}finally{k.current=!1}}},[x,u.sourceEditMode,e,c.loading,c.mtimeMs,o,O]),ne=(0,G.useCallback)(async()=>{if(!e)return;let t=J(e);if(c.binaryBuffer){ge(t,c.binaryBuffer,c.descriptor.mimeType||`application/octet-stream`);return}if(c.textContent!=null){V(t,c.textContent);return}let n=await pe(e,o);ge(t,await n.arrayBuffer(),c.descriptor.mimeType||n.type||`application/octet-stream`)},[e,c.binaryBuffer,c.descriptor.mimeType,c.textContent,o]),j=(0,G.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 pe(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]),re=!c.loading&&!!e,M=ue()&&(!!c.fileResourceId&&!!window.electronAPI?.shell?.openFileResource||c.descriptor.type===`spreadsheet`&&!!c.binaryBuffer&&!!window.electronAPI?.shell?.openTemporaryFile),N=ue()&&!!c.fileResourceId&&!!window.electronAPI?.shell?.chooseAppAndOpenFileResource,P=(0,G.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,G.useEffect)(()=>{P()},[P]);let F=(0,G.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]),ie=(0,G.useCallback)(async()=>{let e=c.fileResourceId;if(!e||!window.electronAPI?.shell?.chooseAppAndOpenFileResource)return;let t=await window.electronAPI.shell.chooseAppAndOpenFileResource(e);return t.ok&&P(),t},[c.fileResourceId,P]),oe=(0,G.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&&P(),n},[c.fileResourceId,P]),se=ue()&&!!c.fileResourceId&&!!window.electronAPI?.shell?.showFileResourceInFolder,I=(0,G.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:ee,refresh:O,checkForUpdates:A,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:te,onDownload:ne,createAttachmentFile:j,canDownload:re,canOpenWithSystemApp:M,onOpenWithSystemApp:F,canChooseOpenWithApp:N,onChooseOpenWithApp:ie,recommendedOpenWithApps:m,recentOpenWithApps:f,onOpenWithRecentApp:oe,canRevealInFolder:se,onRevealInFolder:I}}var et=new Map;function tt(e){return et.get(e)??{zoom:1,rotation:0,page:1,pageCount:null,searchQuery:``,scroll:[]}}function nt(e,t){let n={...tt(e),...t};for(et.delete(e),et.set(e,n);et.size>100;)et.delete(et.keys().next().value)}c.subscribe((e,t)=>{(e.baseUrl!==t.baseUrl||e.conversationId!==t.conversationId)&&et.clear()});var rt=new Map;function it(e,t){return rt.set(e,t),()=>{rt.get(e)===t&&rt.delete(e)}}async function at(e,t){return await rt.get(e)?.(t)??!1}var ot=120*1e3,st=new Map;function ct(){return typeof globalThis.crypto?.randomUUID==`function`?globalThis.crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`}function lt(e){for(let[t,n]of st)n.expiresAt<=e&&st.delete(t)}function ut(e,t=Date.now()){lt(t);let n=ct();return st.set(n,{file:e,name:e.name,type:e.type,expiresAt:t+ot}),n}function dt(e,t=Date.now()){let n=st.get(e);return n?n.expiresAt<=t?(st.delete(e),null):{name:n.name,type:n.type}:null}function ft(e,t=Date.now()){let n=st.get(e);if(!n)return null;if(n.expiresAt<=t)return st.delete(e),null;if(!n.file)return null;let r=n.file;return n.file=null,r}var Z=r();function pt(e){let t=(0,W.c)(3),{app:n}=e,[r,i]=(0,G.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 mt({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,G.useState)(),[g,_]=(0,G.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`,E=`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)(pt,{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:M(`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)(pt,{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:M(`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)(Se,{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)(U,{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:E}),(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)(U,{className:T,disabled:x,title:e.name,onSelect:()=>{h(e),o(e.path)},children:[(0,Z.jsx)(pt,{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:E}),(0,Z.jsxs)(U,{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 ht=`<script>
3
- window.addEventListener('click', (event) => {
4
- if (event.defaultPrevented || event.button !== 0 ||
5
- event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) return;
6
- const link = event.target.closest?.('a[href], area[href]');
7
- const href = link?.getAttribute('href').trim();
8
- if (!href?.startsWith('#') || link.hasAttribute('download')) return;
9
- const target = link.getAttribute('target') ?? document.querySelector('base[target]')?.getAttribute('target');
10
- if (target && target.toLowerCase() !== '_self') return;
11
-
12
- event.preventDefault();
13
- window.location.assign('about:srcdoc' + href);
14
- });
15
- <\/script>`;function gt(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)}${ht}${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>${ht}</head>${e.slice(t)}`}let r=/^\s*<!doctype[^>]*>/i.exec(e);return r?`${r[0]}<head>${ht}</head>${e.slice(r[0].length)}`:`<head>${ht}</head>${e}`}function _t(e){let t=(0,W.c)(8),{html:n,title:r}=e,i=(0,G.useRef)(null),a;t[0]===n?a=t[1]:(a=()=>{i.current?.contentWindow?.postMessage({type:`xopc-html-preview`,html:gt(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,G.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 vt=(0,G.lazy)(()=>i(()=>import(`./source-workspace-editor-BwYU5OEh.js`).then(e=>({default:e.SourceWorkspaceEditor})),__vite__mapDeps([4,1,5,6,7,2])));function yt(){let e=(0,W.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 bt(e){let t=e.lastIndexOf(`.`);return t>0?e.slice(t).toLowerCase():``}function xt(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`}[bt(e)]??`plaintext`}function St(e){let t=(0,W.c)(12),{text:n,targetLine:r}=e,i=(0,G.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,G.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 Ct(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)(G.Suspense,{fallback:(0,Z.jsx)(yt,{}),children:(0,Z.jsx)(vt,{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)(_t,{html:n,title:e.descriptor.fileName})}):e.targetLine&&e.targetLine>0?(0,Z.jsx)(St,{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:`\`\`\`${xt(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 wt(e){return Ct(e,`text`)}function Tt(e){return Ct(e,`markdown`)}function Et(e){return Ct(e,`code`)}function Dt(e){return Ct(e,`html`)}function Ot(){return(0,G.createElement)(`div`,{className:`px-4 py-6 text-sm text-fg-muted`},`Loading preview...`)}function Q(e,t,n,r=`binary`){let i=(0,G.lazy)(n);return{id:e,readMode:r,capabilities:t,render:e=>(0,G.createElement)(G.Suspense,{fallback:Ot()},(0,G.createElement)(i,e))}}var kt={text:{id:`text`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,G.createElement)(wt,e)},markdown:{id:`markdown`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,G.createElement)(Tt,e)},code:{id:`code`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,G.createElement)(Et,e)},html:{id:`html`,readMode:`text`,capabilities:[`download`,`edit`],render:e=>(0,G.createElement)(Dt,e)},image:Q(`image`,[`download`,`zoom`,`rotate`],()=>i(()=>import(`./binary-plugins-BjEE5sVq.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-BjEE5sVq.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-BjEE5sVq.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-BjEE5sVq.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-BjEE5sVq.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-C2lp7UmI.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-C2lp7UmI.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-DS6JWBPZ.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-C2lp7UmI.js`).then(e=>({default:e.UnsupportedPreviewPluginView})),__vite__mapDeps([20,1,5,9,10,11,12,13,14,15,16,17,18,19])),`metadata`)};function At(e){return kt[e]??kt.unsupported}function jt(e){let t=(0,W.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)(Mt,{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)(Mt,{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)(Mt,{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)(O,{className:`size-3.5`}),t[47]=u):u=t[47];let d;t[48]===i?d=t[49]:(d=(0,Z.jsx)(Mt,{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)(A,{className:`size-3.5`}),t[54]=n):n=t[54];let r;t[55]===s?r=t[56]:(r=(0,Z.jsx)(Mt,{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)(j,{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 Mt(e){let t=(0,W.c)(6),{label:n,disabled:r,onClick:i,children:a}=e,o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=M(`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 Nt(e){let t=At(e.type),n=tt(e.id),[r,i]=(0,G.useState)(n.zoom),[a,o]=(0,G.useState)(n.rotation),[s,c]=(0,G.useState)(n.page),[l,u]=(0,G.useState)(n.pageCount),[d,f]=(0,G.useState)(n.searchQuery),p=(0,G.useCallback)(e=>{c(Math.max(1,Math.min(l??e,Math.floor(e))))},[l]);(0,G.useEffect)(()=>{let t=tt(e.id);i(t.zoom),o(t.rotation),c(t.page),u(t.pageCount),f(t.searchQuery)},[e.id,e.type]);let m=(0,G.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,G.useEffect)(()=>()=>nt(e.id,m.current),[e.id]),{plugin:t,controls:(0,G.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 Pt(e){let t=(0,W.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)(jt,{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 Ft(e){let t=(0,W.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)(N,{className:`h-5 w-48 max-w-full`}),(0,Z.jsx)(N,{className:`h-4 w-full`}),(0,Z.jsx)(N,{className:`h-4 w-11/12`}),(0,Z.jsx)(N,{className:`h-4 w-3/4`}),(0,Z.jsx)(N,{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)(It,{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 It(e){let t=(0,W.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 Lt(e){let t=(0,W.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=M(`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,W.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 Rt(e){let t=(0,W.c)(90),{referenceActions:n,onRefresh:r,onRetrySave:i,subtitle:a,controller:o,actions:s,expanded:c,onToggleExpanded:d,onClose:f,hideClose:m,hideExpand:C,edit:T,wordWrap:O,editInNewChat:A,share:j,openWithSystemApp:N,chooseApp:P,recommendedApps:F,recentApps:ie,onOpenWithApp:ae,onRevealInFolder:oe,copyPath:se,textView:I,openInBrowser:L}=e,R;t[0]===n?R=t[1]:(R=n===void 0?[]:n,t[0]=n,t[1]=R);let z=R,de;t[2]===F?de=t[3]:(de=F===void 0?[]:F,t[2]=F,t[3]=de);let pe=de,me;t[4]===ie?me=t[5]:(me=ie===void 0?[]:ie,t[4]=ie,t[5]=me);let he=me,B=l(Vt),ge;t[6]===B?ge=t[7]:(ge=u(B),t[6]=B,t[7]=ge);let V=ge,H=V.workspace,_e=o.plugin.id===`pdf`?V.chat.attachmentPreviewPdf:o.plugin.id===`docx`?V.chat.attachmentPreviewDocument:o.plugin.id===`spreadsheet`?V.chat.attachmentPreviewSpreadsheet:H.preview,ve;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(ve=ue(),t[8]=ve):ve=t[8];let ye=ve,be=(0,G.useContext)(je),xe=(0,G.useRef)(null),Se=(0,G.useRef)(null),[U,Ce]=(0,G.useState)(!1),we;t[9]===o.plugin.capabilities?we=t[10]:(we=o.plugin.capabilities.some(Bt),t[9]=o.plugin.capabilities,t[10]=we);let Ee=we,De,ke;t[11]===U?(De=t[12],ke=t[13]):(De=()=>{if(!U)return;xe.current?.querySelector(`button:not(:disabled), a`)?.focus();let e=e=>{if([`ArrowDown`,`ArrowUp`,`Home`,`End`].includes(e.key)&&xe.current?.contains(document.activeElement)){e.preventDefault(),e.stopImmediatePropagation();let t=[...xe.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(),Ce(!1),Se.current?.focus())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},ke=[U],t[11]=U,t[12]=De,t[13]=ke),(0,G.useEffect)(De,ke);let Ae;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=e=>{Ce(!1),Se.current?.focus(),e()},t[14]=Ae):Ae=t[14];let K=Ae,Me;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(Me=M(`shrink-0 bg-surface-base px-3 py-2 sm:px-4`,le),t[15]=Me):Me=t[15];let Ne;t[16]===be?Ne=t[17]:(Ne=be?(0,Z.jsx)(Lt,{label:be.label,active:be.active,onClick:be.onToggle,children:(0,Z.jsx)(Te,{className:`size-4`,strokeWidth:1.75,"aria-hidden":!0})}):null,t[16]=be,t[17]=Ne);let Pe;t[18]!==c||t[19]!==C||t[20]!==H.collapsePreview||t[21]!==H.expandPreview||t[22]!==d?(Pe=C?null:(0,Z.jsx)(Lt,{label:c?H.collapsePreview:H.expandPreview,active:c,disabled:!d,onClick:d,children:c?(0,Z.jsx)(ee,{className:`size-4`,"aria-hidden":!0}):(0,Z.jsx)(w,{className:`size-4`,"aria-hidden":!0})}),t[18]=c,t[19]=C,t[20]=H.collapsePreview,t[21]=H.expandPreview,t[22]=d,t[23]=Pe):Pe=t[23];let Fe;t[24]===U?Fe=t[25]:(Fe=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(),Ce(!1)}}):null,t[24]=U,t[25]=Fe);let Ie;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(Ie=M(`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[26]=Ie):Ie=t[26];let Le,Re;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(Le=()=>Ce(zt),Re=(0,Z.jsx)(_,{className:`size-4`}),t[27]=Le,t[28]=Re):(Le=t[27],Re=t[28]);let ze;t[29]!==H.moreActions||t[30]!==U?(ze=(0,Z.jsx)(`button`,{ref:Se,type:`button`,className:Ie,title:H.moreActions,"aria-label":H.moreActions,"aria-haspopup":`menu`,"aria-expanded":U,onClick:Le,children:Re}),t[29]=H.moreActions,t[30]=U,t[31]=ze):ze=t[31];let Be;t[32]!==s||t[33]!==P||t[34]!==o.plugin.capabilities||t[35]!==se||t[36]!==T||t[37]!==A||t[38]!==B||t[39]!==H.copyFilePath||t[40]!==H.copyWorkspacePath||t[41]!==H.download||t[42]!==H.edit||t[43]!==H.editInNewChat||t[44]!==H.moreActions||t[45]!==H.openInBrowser||t[46]!==H.pathCopied||t[47]!==H.preview||t[48]!==H.revealInFolder||t[49]!==H.saveCopy||t[50]!==H.shareLink||t[51]!==H.wordWrap||t[52]!==U||t[53]!==ae||t[54]!==r||t[55]!==i||t[56]!==oe||t[57]!==L||t[58]!==N||t[59]!==he||t[60]!==pe||t[61]!==z||t[62]!==j||t[63]!==O?(Be=U?(0,Z.jsxs)(`div`,{ref:xe,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)(mt,{variant:`menu`,onAction:K,systemApp:N,chooseApp:P,recommendedApps:pe,recentApps:he,onOpenWithApp:ae}),z.map(e=>(0,Z.jsx)($,{icon:(0,Z.jsx)(D,{className:`size-4`}),label:e.label,disabled:e.disabled,onClick:()=>K(e.onClick)},e.label)),i?(0,Z.jsx)($,{icon:(0,Z.jsx)(ne,{className:`size-4`}),label:B===`zh`?`重试保存`:`Retry save`,onClick:()=>K(i)}):null,r?(0,Z.jsx)($,{icon:(0,Z.jsx)(k,{className:`size-4`}),label:B===`zh`?`刷新文件`:`Refresh file`,onClick:()=>K(r)}):null,o.plugin.capabilities.includes(`edit`)?(0,Z.jsx)($,{icon:T?.active?(0,Z.jsx)(y,{className:`size-4`}):(0,Z.jsx)(te,{className:`size-4`}),label:T?.active?H.preview:H.edit,disabled:!T,onClick:()=>K(()=>T?.onToggle())}):null,O?(0,Z.jsx)($,{icon:(0,Z.jsx)(Oe,{className:`size-4`}),label:H.wordWrap,active:O.active,onClick:()=>K(O.onToggle)}):null,(0,Z.jsx)(`div`,{className:`my-1 border-t border-edge-subtle dark:border-edge`}),(0,Z.jsx)($,{icon:A?.loading?(0,Z.jsx)(S,{className:`size-4 animate-spin`}):(0,Z.jsx)(E,{className:`size-4`}),label:H.editInNewChat,disabled:!A||A.disabled||A.loading,onClick:()=>K(()=>A?.onClick())}),(0,Z.jsx)($,{icon:j?.loading?(0,Z.jsx)(S,{className:`size-4 animate-spin`}):(0,Z.jsx)(x,{className:`size-4`}),label:H.shareLink,disabled:!j||j.disabled||j.loading,onClick:()=>K(()=>j?.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:()=>Ce(!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:()=>K(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:ye?H.saveCopy:H.download,disabled:!s.canDownload,onClick:()=>K(()=>void s.onDownload())}),se?(0,Z.jsx)($,{icon:se.copied?(0,Z.jsx)(p,{className:`size-4 text-emerald-500`}):(0,Z.jsx)(h,{className:`size-4`}),label:se.copied?H.pathCopied:ye?H.copyFilePath:H.copyWorkspacePath,onClick:()=>K(se.onClick)}):null]}):null,t[32]=s,t[33]=P,t[34]=o.plugin.capabilities,t[35]=se,t[36]=T,t[37]=A,t[38]=B,t[39]=H.copyFilePath,t[40]=H.copyWorkspacePath,t[41]=H.download,t[42]=H.edit,t[43]=H.editInNewChat,t[44]=H.moreActions,t[45]=H.openInBrowser,t[46]=H.pathCopied,t[47]=H.preview,t[48]=H.revealInFolder,t[49]=H.saveCopy,t[50]=H.shareLink,t[51]=H.wordWrap,t[52]=U,t[53]=ae,t[54]=r,t[55]=i,t[56]=oe,t[57]=L,t[58]=N,t[59]=he,t[60]=pe,t[61]=z,t[62]=j,t[63]=O,t[64]=Be):Be=t[64];let Ve;t[65]!==Fe||t[66]!==ze||t[67]!==Be?(Ve=(0,Z.jsxs)(`div`,{className:`relative shrink-0`,children:[Fe,ze,Be]}),t[65]=Fe,t[66]=ze,t[67]=Be,t[68]=Ve):Ve=t[68];let He;t[69]!==m||t[70]!==H.close||t[71]!==f?(He=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)(Lt,{label:H.close,onClick:f,children:(0,Z.jsx)(re,{className:`size-4`,strokeWidth:1.75})})]}),t[69]=m,t[70]=H.close,t[71]=f,t[72]=He):He=t[72];let q;t[73]!==Ne||t[74]!==Pe||t[75]!==Ve||t[76]!==He?(q=(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:[Ne,Pe,Ve,He]})}),t[73]=Ne,t[74]=Pe,t[75]=Ve,t[76]=He,t[77]=q):q=t[77];let J;t[78]===a?J=t[79]:(J=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[78]=a,t[79]=J);let Y;t[80]!==o||t[81]!==Ee||t[82]!==V.chat||t[83]!==_e||t[84]!==I?(Y=Ee||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:_e},{active:!0,label:V.chat.attachmentPreviewText}].map(e=>(0,Z.jsx)(`button`,{type:`button`,"aria-pressed":I.active===e.active,className:M(`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,Ee?(0,Z.jsx)(Pt,{controller:o}):null]}):null,t[80]=o,t[81]=Ee,t[82]=V.chat,t[83]=_e,t[84]=I,t[85]=Y):Y=t[85];let X;return t[86]!==q||t[87]!==J||t[88]!==Y?(X=(0,Z.jsxs)(`div`,{"data-workspace-toolbar":!0,className:Me,children:[q,J,Y]}),t[86]=q,t[87]=J,t[88]=Y,t[89]=X):X=t[89],X}function zt(e){return!e}function Bt(e){return[`zoom`,`search`,`rotate`,`pageNavigation`].includes(e)}function Vt(e){return e.language}function Ht({header:e,chat:t,...n}){let r=(0,G.useRef)(null);(0,G.useEffect)(()=>{let e=r.current;if(!e)return;let t=()=>{let t=tt(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=()=>nt(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,G.useContext)(K),[o,s]=(0,G.useState)(!1),c=Nt(n.descriptor),l=a(),d=u(n.language),[f,p]=(0,G.useState)(!1),m=async()=>{if(!(!t||f)){p(!0);try{let[n,r]=await Promise.all([t.createFile(),t.conversationId?ie(t.conversationId).catch(()=>null):Promise.resolve(null)]);if(n.size>33554432){z(`warning`,d.chat.attachmentFileTooLarge,{name:n.name,maxSize:I(F)});return}let i=new URLSearchParams({attachmentHandoff:ut(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{z(`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)(Rt,{...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 at(e.id,r);z(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{z(`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)(Ft,{...n,controller:c})]})}function Ut(e,t){let n=(0,W.c)(7),r=e===void 0||e,i=t!==void 0&&t,[a,o]=(0,G.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,G.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{Ee as C,De as S,K as _,it as a,Ae as b,$e as c,Ne as d,Me as f,Ue as g,Y as h,ft as i,Je as l,J as m,Ht as n,tt as o,X as p,dt as r,nt as s,Ut as t,We as u,ke as v,Te as w,Oe as x,je as y};
@@ -1 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n}from"./vendor-react-BOUWij0V.js";import{i as r,l as i,o as a}from"./locale-store-Cit_aHqC.js";import{i as o}from"./vendor-swr-CdRzEUwF.js";var s=n(),c=e(t(),1);function l(){let e=(0,s.c)(11),t=i(d),n;e[0]===t?n=e[1]:(n=t?[`personal-agent-nav`,t]:null,e[0]=t,e[1]=n);let r;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(r={revalidateOnFocus:!1},e[2]=r):r=e[2];let{data:a,mutate:l}=o(n,u,r),f,p;e[3]===l?(f=e[4],p=e[5]):(f=()=>{let e=e=>{let t=e.detail;t===void 0?l():l({ok:!0,payload:t},{revalidate:!1})};return window.addEventListener(`personal-agent-updated`,e),()=>window.removeEventListener(`personal-agent-updated`,e)},p=[l],e[3]=l,e[4]=f,e[5]=p),(0,c.useEffect)(f,p);let m=a?.payload,h;e[6]===a?.payload?.displayName?h=e[7]:(h=a?.payload?.displayName?.trim()||`Ada`,e[6]=a?.payload?.displayName,e[7]=h);let g;return e[8]!==m||e[9]!==h?(g={profile:m,displayName:h},e[8]=m,e[9]=h,e[10]=g):g=e[10],g}function u(){return a(r(`/api/personal-agent`))}function d(e){return e.conversationId}export{l as t};
@@ -1 +0,0 @@
1
- import{t as e}from"./createLucideIcon-DPHK1VkS.js";var t=e(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),n=[`480P`,`720P`,`1080P`],r=`dashscope-cn/wan3.0-video`,i=`volcengine-ark/doubao-seedance-2-5-260628`,a=`volcengine-ark/doubao-seedance-2-0-fast-260128`,o=[r,i,a],s={[r]:{provider:`dashscope-cn`,name:`Wan 3.0`,minDuration:2,maxDuration:30,resolutions:n,imageRatios:[`adaptive`,`16:9`,`9:16`]},[i]:{provider:`volcengine-ark`,name:`Seedance 2.5`,minDuration:4,maxDuration:30,resolutions:n,imageRatios:[`adaptive`]},[a]:{provider:`volcengine-ark`,name:`Seedance 2.0 Fast`,minDuration:4,maxDuration:15,resolutions:[`480P`,`720P`],imageRatios:[`adaptive`,`16:9`,`9:16`]}};function c(e){return[-1,...Array.from({length:e.maxDuration-e.minDuration+1},(t,n)=>e.minDuration+n)]}export{t as a,c as i,o as n,r,s as t};