@qqbrowser/qbot-dsh 0.0.15 → 0.1.0

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 (331) hide show
  1. package/config/agent-presets/code/agent.cordis.yml +2 -2
  2. package/config/agent-presets/standard/agent.cordis.yml +2 -2
  3. package/node_modules/@deepseek-ai/cordis-plugin-hmr/package.json +1 -1
  4. package/node_modules/@deepseek-ai/dsh-agent/package.json +1 -1
  5. package/node_modules/@deepseek-ai/dsh-agent-default-model/package.json +1 -1
  6. package/node_modules/@deepseek-ai/dsh-agent-instructions/package.json +1 -1
  7. package/node_modules/@deepseek-ai/dsh-agent-loop/package.json +1 -1
  8. package/node_modules/@deepseek-ai/dsh-agent-presets/package.json +1 -1
  9. package/node_modules/@deepseek-ai/dsh-agent-tool-presentation/package.json +1 -1
  10. package/node_modules/@deepseek-ai/dsh-anonymous-user-id/package.json +1 -1
  11. package/node_modules/@deepseek-ai/dsh-api-gateway/package.json +1 -1
  12. package/node_modules/@deepseek-ai/dsh-api-remotes/package.json +1 -1
  13. package/node_modules/@deepseek-ai/dsh-app-boot/package.json +1 -1
  14. package/node_modules/@deepseek-ai/dsh-atomic-write/package.json +1 -1
  15. package/node_modules/@deepseek-ai/dsh-attachment/lib/index.js +1 -1
  16. package/node_modules/@deepseek-ai/dsh-attachment/package.json +1 -1
  17. package/node_modules/@deepseek-ai/dsh-attachment-local/package.json +1 -1
  18. package/node_modules/@deepseek-ai/dsh-base/package.json +1 -1
  19. package/node_modules/@deepseek-ai/dsh-bash-local/package.json +1 -1
  20. package/node_modules/@deepseek-ai/dsh-bash-sandbox/package.json +1 -1
  21. package/node_modules/@deepseek-ai/dsh-brand/package.json +1 -1
  22. package/node_modules/@deepseek-ai/dsh-client-connection/lib/client.js +1 -1
  23. package/node_modules/@deepseek-ai/dsh-client-connection/package.json +1 -1
  24. package/node_modules/@deepseek-ai/dsh-client-hmr/package.json +1 -1
  25. package/node_modules/@deepseek-ai/dsh-client-locale/lib/client.js +1 -1
  26. package/node_modules/@deepseek-ai/dsh-client-locale/package.json +1 -1
  27. package/node_modules/@deepseek-ai/dsh-client-modules/package.json +1 -1
  28. package/node_modules/@deepseek-ai/dsh-client-runtime/lib/client.js +4 -4
  29. package/node_modules/@deepseek-ai/dsh-client-runtime/package.json +1 -1
  30. package/node_modules/@deepseek-ai/dsh-client-schema-form/package.json +1 -1
  31. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/lib/client.js +1 -1
  32. package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/package.json +1 -1
  33. package/node_modules/@deepseek-ai/dsh-client-ui-attachment/package.json +1 -1
  34. package/node_modules/@deepseek-ai/dsh-client-ui-commands/lib/client.js +1 -1
  35. package/node_modules/@deepseek-ai/dsh-client-ui-commands/package.json +1 -1
  36. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +8 -8
  37. package/node_modules/@deepseek-ai/dsh-client-ui-conversation/package.json +1 -1
  38. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/lib/client.js +3 -3
  39. package/node_modules/@deepseek-ai/dsh-client-ui-cordis/package.json +1 -1
  40. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/client.js +1 -1
  41. package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/package.json +1 -1
  42. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/lib/client.js +1 -1
  43. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/package.json +1 -1
  44. package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-native/package.json +1 -1
  45. package/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/client.js +1 -1
  46. package/node_modules/@deepseek-ai/dsh-client-ui-goal/package.json +1 -1
  47. package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/lib/client.js +1 -1
  48. package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/package.json +1 -1
  49. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/lib/client.js +1 -1
  50. package/node_modules/@deepseek-ai/dsh-client-ui-jobs/package.json +1 -1
  51. package/node_modules/@deepseek-ai/dsh-client-ui-layout/lib/client.js +1 -1
  52. package/node_modules/@deepseek-ai/dsh-client-ui-layout/package.json +1 -1
  53. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/lib/client.js +1 -1
  54. package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/package.json +1 -1
  55. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +1 -1
  56. package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/package.json +1 -1
  57. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/lib/client.js +1 -1
  58. package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/package.json +1 -1
  59. package/node_modules/@deepseek-ai/dsh-client-ui-plan/lib/client.js +1 -1
  60. package/node_modules/@deepseek-ai/dsh-client-ui-plan/package.json +1 -1
  61. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/index.js +22 -22
  62. package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +1 -1
  63. package/node_modules/@deepseek-ai/dsh-client-ui-settings/package.json +1 -1
  64. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +1 -1
  65. package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/package.json +1 -1
  66. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +3 -3
  67. package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/package.json +1 -1
  68. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/lib/client.js +1 -1
  69. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/package.json +1 -1
  70. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/client.js +1 -1
  71. package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/package.json +1 -1
  72. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
  73. package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/package.json +1 -1
  74. package/node_modules/@deepseek-ai/dsh-client-ui-skill/lib/client.js +3 -3
  75. package/node_modules/@deepseek-ai/dsh-client-ui-skill/package.json +1 -1
  76. package/node_modules/@deepseek-ai/dsh-client-ui-slots/package.json +1 -1
  77. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/lib/client.js +1 -1
  78. package/node_modules/@deepseek-ai/dsh-client-ui-subagent/package.json +1 -1
  79. package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +1 -1
  80. package/node_modules/@deepseek-ai/dsh-client-ui-theme/package.json +1 -1
  81. package/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/client.js +4 -4
  82. package/node_modules/@deepseek-ai/dsh-client-ui-tool/package.json +1 -1
  83. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/lib/client.js +14 -14
  84. package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/package.json +1 -1
  85. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/lib/client.js +1 -1
  86. package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/package.json +1 -1
  87. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/lib/client.js +1 -1
  88. package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/package.json +1 -1
  89. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +1 -1
  90. package/node_modules/@deepseek-ai/dsh-client-ui-workspace/package.json +1 -1
  91. package/node_modules/@deepseek-ai/dsh-client-web/package.json +1 -1
  92. package/node_modules/@deepseek-ai/dsh-client-web-react/package.json +1 -1
  93. package/node_modules/@deepseek-ai/dsh-cmdline/package.json +1 -1
  94. package/node_modules/@deepseek-ai/dsh-code-runtime/package.json +1 -1
  95. package/node_modules/@deepseek-ai/dsh-code-runtime-worker-thread/package.json +1 -1
  96. package/node_modules/@deepseek-ai/dsh-command-compact/package.json +1 -1
  97. package/node_modules/@deepseek-ai/dsh-command-feedback/package.json +1 -1
  98. package/node_modules/@deepseek-ai/dsh-command-goal/package.json +1 -1
  99. package/node_modules/@deepseek-ai/dsh-commands/lib/typert.host.js +5 -2
  100. package/node_modules/@deepseek-ai/dsh-commands/package.json +1 -1
  101. package/node_modules/@deepseek-ai/dsh-compaction/package.json +1 -1
  102. package/node_modules/@deepseek-ai/dsh-compaction-basic/package.json +1 -1
  103. package/node_modules/@deepseek-ai/dsh-compaction-tool-result-pruner/package.json +1 -1
  104. package/node_modules/@deepseek-ai/dsh-content-review/package.json +1 -1
  105. package/node_modules/@deepseek-ai/dsh-cordis-client-runner/lib/client.js +4 -4
  106. package/node_modules/@deepseek-ai/dsh-cordis-client-runner/package.json +1 -1
  107. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/lib/typert.host.js +10 -4
  108. package/node_modules/@deepseek-ai/dsh-cordis-host-runner/package.json +1 -1
  109. package/node_modules/@deepseek-ai/dsh-credentials/package.json +1 -1
  110. package/node_modules/@deepseek-ai/dsh-credentials-local/package.json +1 -1
  111. package/node_modules/@deepseek-ai/dsh-fs/package.json +1 -1
  112. package/node_modules/@deepseek-ai/dsh-fs-local/package.json +1 -1
  113. package/node_modules/@deepseek-ai/dsh-fs-observation-policy/package.json +1 -1
  114. package/node_modules/@deepseek-ai/dsh-fs-sandbox/package.json +1 -1
  115. package/node_modules/@deepseek-ai/dsh-goal/lib/typert.host.js +5 -2
  116. package/node_modules/@deepseek-ai/dsh-goal/package.json +1 -1
  117. package/node_modules/@deepseek-ai/dsh-goal-round-driver/package.json +1 -1
  118. package/node_modules/@deepseek-ai/dsh-headless/package.json +1 -1
  119. package/node_modules/@deepseek-ai/dsh-home-paths/package.json +1 -1
  120. package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/package.json +1 -1
  121. package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/index.js +7 -7
  122. package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/types/api/rpc.schema.js +1 -1
  123. package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/types/api-proxy.js +1 -1
  124. package/node_modules/@deepseek-ai/dsh-host-apiproxy/package.json +1 -1
  125. package/node_modules/@deepseek-ai/dsh-host-directory-picker/package.json +1 -1
  126. package/node_modules/@deepseek-ai/dsh-host-directory-picker-auto/package.json +1 -1
  127. package/node_modules/@deepseek-ai/dsh-host-directory-picker-browse/package.json +1 -1
  128. package/node_modules/@deepseek-ai/dsh-host-directory-picker-native/package.json +1 -1
  129. package/node_modules/@deepseek-ai/dsh-host-frontend-static/package.json +1 -1
  130. package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/package.json +1 -1
  131. package/node_modules/@deepseek-ai/dsh-host-webserver/package.json +1 -1
  132. package/node_modules/@deepseek-ai/dsh-invariants/package.json +1 -1
  133. package/node_modules/@deepseek-ai/dsh-jobs/package.json +1 -1
  134. package/node_modules/@deepseek-ai/dsh-jobs-local/package.json +1 -1
  135. package/node_modules/@deepseek-ai/dsh-launch-environment/package.json +1 -1
  136. package/node_modules/@deepseek-ai/dsh-llm/lib/index.js +1 -1
  137. package/node_modules/@deepseek-ai/dsh-llm/lib/types/assembler.js +1 -1
  138. package/node_modules/@deepseek-ai/dsh-llm/package.json +1 -1
  139. package/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/index.js +1 -1
  140. package/node_modules/@deepseek-ai/dsh-llm-deepseek/package.json +1 -1
  141. package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/package.json +1 -1
  142. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +1 -1
  143. package/node_modules/@deepseek-ai/dsh-llm-pi-ai/package.json +1 -1
  144. package/node_modules/@deepseek-ai/dsh-llm-retry/package.json +1 -1
  145. package/node_modules/@deepseek-ai/dsh-mcp-client/lib/index.js +3 -2
  146. package/node_modules/@deepseek-ai/dsh-mcp-client/package.json +1 -1
  147. package/node_modules/@deepseek-ai/dsh-message-feedback/package.json +1 -1
  148. package/node_modules/@deepseek-ai/dsh-native-command/package.json +1 -1
  149. package/node_modules/@deepseek-ai/dsh-output-retention/package.json +1 -1
  150. package/node_modules/@deepseek-ai/dsh-permission-presets/package.json +1 -1
  151. package/node_modules/@deepseek-ai/dsh-persona/package.json +1 -1
  152. package/node_modules/@deepseek-ai/dsh-plan-mode/package.json +1 -1
  153. package/node_modules/@deepseek-ai/dsh-pwsh-local/package.json +1 -1
  154. package/node_modules/@deepseek-ai/dsh-pwsh-sandbox/package.json +1 -1
  155. package/node_modules/@deepseek-ai/dsh-qb-auth/package.json +1 -1
  156. package/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/package.json +1 -1
  157. package/node_modules/@deepseek-ai/dsh-sandbox/package.json +1 -1
  158. package/node_modules/@deepseek-ai/dsh-sandbox-local/package.json +1 -1
  159. package/node_modules/@deepseek-ai/dsh-sandbox-policy/package.json +1 -1
  160. package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/package.json +1 -1
  161. package/node_modules/@deepseek-ai/dsh-schedule/package.json +1 -1
  162. package/node_modules/@deepseek-ai/dsh-scope/package.json +1 -1
  163. package/node_modules/@deepseek-ai/dsh-session/package.json +1 -1
  164. package/node_modules/@deepseek-ai/dsh-session-checkpoint-policy/package.json +1 -1
  165. package/node_modules/@deepseek-ai/dsh-session-log-export/lib/client.js +1 -1
  166. package/node_modules/@deepseek-ai/dsh-session-log-export/package.json +1 -1
  167. package/node_modules/@deepseek-ai/dsh-session-persistence/package.json +1 -1
  168. package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/package.json +1 -1
  169. package/node_modules/@deepseek-ai/dsh-session-projection/package.json +1 -1
  170. package/node_modules/@deepseek-ai/dsh-session-projection-cache/package.json +1 -1
  171. package/node_modules/@deepseek-ai/dsh-session-query/lib/index.js +2 -2
  172. package/node_modules/@deepseek-ai/dsh-session-query/package.json +1 -1
  173. package/node_modules/@deepseek-ai/dsh-session-query-sqlite/package.json +1 -1
  174. package/node_modules/@deepseek-ai/dsh-session-reference/package.json +1 -1
  175. package/node_modules/@deepseek-ai/dsh-session-stats/package.json +1 -1
  176. package/node_modules/@deepseek-ai/dsh-session-telemetry/package.json +1 -1
  177. package/node_modules/@deepseek-ai/dsh-session-telemetry-otel/package.json +1 -1
  178. package/node_modules/@deepseek-ai/dsh-session-title/package.json +1 -1
  179. package/node_modules/@deepseek-ai/dsh-session-title-first-prompt-llm/package.json +1 -1
  180. package/node_modules/@deepseek-ai/dsh-session-title-llm/package.json +1 -1
  181. package/node_modules/@deepseek-ai/dsh-settings/package.json +1 -1
  182. package/node_modules/@deepseek-ai/dsh-settings-file/package.json +1 -1
  183. package/node_modules/@deepseek-ai/dsh-shell/package.json +1 -1
  184. package/node_modules/@deepseek-ai/dsh-shell-env/package.json +1 -1
  185. package/node_modules/@deepseek-ai/dsh-skill/package.json +1 -1
  186. package/node_modules/@deepseek-ai/dsh-skill-badge/package.json +1 -1
  187. package/node_modules/@deepseek-ai/dsh-skill-filesystem/package.json +1 -1
  188. package/node_modules/@deepseek-ai/dsh-spill/package.json +1 -1
  189. package/node_modules/@deepseek-ai/dsh-spill-local/package.json +1 -1
  190. package/node_modules/@deepseek-ai/dsh-spill-policy/package.json +1 -1
  191. package/node_modules/@deepseek-ai/dsh-storage/package.json +1 -1
  192. package/node_modules/@deepseek-ai/dsh-storage-domain/package.json +1 -1
  193. package/node_modules/@deepseek-ai/dsh-storage-json/package.json +1 -1
  194. package/node_modules/@deepseek-ai/dsh-subagent/package.json +1 -1
  195. package/node_modules/@deepseek-ai/dsh-subagent-fork-in-process/package.json +1 -1
  196. package/node_modules/@deepseek-ai/dsh-subagent-in-process-driver/package.json +1 -1
  197. package/node_modules/@deepseek-ai/dsh-subagent-spawn-in-process/package.json +1 -1
  198. package/node_modules/@deepseek-ai/dsh-subprocess/package.json +1 -1
  199. package/node_modules/@deepseek-ai/dsh-subprocess-local/package.json +1 -1
  200. package/node_modules/@deepseek-ai/dsh-system-prompt/package.json +1 -1
  201. package/node_modules/@deepseek-ai/dsh-terminal/package.json +1 -1
  202. package/node_modules/@deepseek-ai/dsh-terminal-bash/lib/index.js +1 -1
  203. package/node_modules/@deepseek-ai/dsh-terminal-bash/package.json +1 -1
  204. package/node_modules/@deepseek-ai/dsh-time-context/package.json +1 -1
  205. package/node_modules/@deepseek-ai/dsh-timeout/package.json +1 -1
  206. package/node_modules/@deepseek-ai/dsh-tmux-context/package.json +1 -1
  207. package/node_modules/@deepseek-ai/dsh-token-meter/package.json +1 -1
  208. package/node_modules/@deepseek-ai/dsh-tool-ask-user/package.json +1 -1
  209. package/node_modules/@deepseek-ai/dsh-tool-bash/package.json +1 -1
  210. package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/lib/index.js +7 -10
  211. package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/package.json +1 -1
  212. package/node_modules/@deepseek-ai/dsh-tool-call-timeout-policy/package.json +1 -1
  213. package/node_modules/@deepseek-ai/dsh-tool-cordis/lib/index.js +5 -2
  214. package/node_modules/@deepseek-ai/dsh-tool-cordis/package.json +1 -1
  215. package/node_modules/@deepseek-ai/dsh-tool-fs/lib/index.js +8 -8
  216. package/node_modules/@deepseek-ai/dsh-tool-fs/package.json +1 -1
  217. package/node_modules/@deepseek-ai/dsh-tool-fs-search/package.json +1 -1
  218. package/node_modules/@deepseek-ai/dsh-tool-goal/package.json +1 -1
  219. package/node_modules/@deepseek-ai/dsh-tool-jobs/package.json +1 -1
  220. package/node_modules/@deepseek-ai/dsh-tool-pwsh/package.json +1 -1
  221. package/node_modules/@deepseek-ai/dsh-tool-ralph/package.json +1 -1
  222. package/node_modules/@deepseek-ai/dsh-tool-skill/package.json +1 -1
  223. package/node_modules/@deepseek-ai/dsh-tool-str-replace-editor/package.json +1 -1
  224. package/node_modules/@deepseek-ai/dsh-tool-subagent/lib/index.js +2 -2
  225. package/node_modules/@deepseek-ai/dsh-tool-subagent/package.json +1 -1
  226. package/node_modules/@deepseek-ai/dsh-tool-subagent-control/package.json +1 -1
  227. package/node_modules/@deepseek-ai/dsh-tool-subagent-report/package.json +1 -1
  228. package/node_modules/@deepseek-ai/dsh-tool-todo/package.json +1 -1
  229. package/node_modules/@deepseek-ai/dsh-tool-web/package.json +1 -1
  230. package/node_modules/@deepseek-ai/dsh-tool-workflow/package.json +1 -1
  231. package/node_modules/@deepseek-ai/dsh-tools/lib/index.js +15 -15
  232. package/node_modules/@deepseek-ai/dsh-tools/lib/types/code-mode.js +8 -8
  233. package/node_modules/@deepseek-ai/dsh-tools/lib/types/py-types.js +3 -3
  234. package/node_modules/@deepseek-ai/dsh-tools/lib/types/ts-types.js +4 -4
  235. package/node_modules/@deepseek-ai/dsh-tools/package.json +1 -1
  236. package/node_modules/@deepseek-ai/dsh-typert-loader/package.json +1 -1
  237. package/node_modules/@deepseek-ai/dsh-typert-protocol/package.json +1 -1
  238. package/node_modules/@deepseek-ai/dsh-typert-registry/package.json +1 -1
  239. package/node_modules/@deepseek-ai/dsh-user-approval/package.json +1 -1
  240. package/node_modules/@deepseek-ai/dsh-user-questions/package.json +1 -1
  241. package/node_modules/@deepseek-ai/dsh-web/package.json +1 -1
  242. package/node_modules/@deepseek-ai/dsh-web-app/package.json +1 -1
  243. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/{index-BQQQ5Qt-.js → index-fPGOmJjK.js} +25 -25
  244. package/node_modules/@deepseek-ai/dsh-web-frontend/dist/index.html +1 -1
  245. package/node_modules/@deepseek-ai/dsh-web-frontend/package.json +1 -1
  246. package/node_modules/@deepseek-ai/dsh-web-search-deepseek/package.json +1 -1
  247. package/node_modules/@deepseek-ai/dsh-web-search-dsh/package.json +1 -1
  248. package/node_modules/@deepseek-ai/dsh-workflow/package.json +1 -1
  249. package/node_modules/@deepseek-ai/dsh-workflow-worker-thread/package.json +1 -1
  250. package/node_modules/@deepseek-ai/dsh-workspace/package.json +1 -1
  251. package/node_modules/@tanstack/react-virtual/package.json +1 -1
  252. package/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs +7 -1
  253. package/node_modules/@tanstack/virtual-core/dist/cjs/utils.cjs +14 -4
  254. package/node_modules/@tanstack/virtual-core/dist/esm/index.js +1 -1
  255. package/node_modules/@tanstack/virtual-core/dist/esm/utils.js +2 -2
  256. package/node_modules/@tanstack/virtual-core/package.json +1 -1
  257. package/node_modules/hono/dist/cjs/client/utils.js +1 -1
  258. package/node_modules/hono/dist/cjs/context.js +4 -0
  259. package/node_modules/hono/dist/cjs/middleware/cors/index.js +1 -1
  260. package/node_modules/hono/dist/cjs/middleware/csrf/index.js +1 -1
  261. package/node_modules/hono/dist/cjs/middleware/etag/digest.js +1 -1
  262. package/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -2
  263. package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +3 -1
  264. package/node_modules/hono/dist/cjs/router/linear-router/router.js +7 -2
  265. package/node_modules/hono/dist/cjs/router/pattern-router/router.js +3 -9
  266. package/node_modules/hono/dist/cjs/router/trie-router/node.js +43 -67
  267. package/node_modules/hono/dist/cjs/router/trie-router/router.js +3 -11
  268. package/node_modules/hono/dist/cjs/utils/ipaddr.js +5 -3
  269. package/node_modules/hono/dist/client/utils.js +1 -1
  270. package/node_modules/hono/dist/middleware/cors/index.js +1 -1
  271. package/node_modules/hono/dist/middleware/csrf/index.js +1 -1
  272. package/node_modules/hono/dist/middleware/etag/digest.js +1 -1
  273. package/node_modules/hono/dist/middleware/etag/index.js +1 -1
  274. package/node_modules/hono/dist/middleware/pretty-json/index.js +1 -1
  275. package/node_modules/hono/dist/router/linear-router/router.js +1 -1
  276. package/node_modules/hono/dist/router/pattern-router/router.js +1 -1
  277. package/node_modules/hono/dist/router/trie-router/node.js +1 -1
  278. package/node_modules/hono/dist/router/trie-router/router.js +1 -1
  279. package/node_modules/hono/dist/utils/ipaddr.js +1 -1
  280. package/node_modules/hono/package.json +1 -1
  281. package/node_modules/node-pty/lib/conpty_console_list_agent.js +11 -2
  282. package/node_modules/node-pty/lib/index.js +6 -6
  283. package/node_modules/node-pty/lib/shared/conout.js +2 -3
  284. package/node_modules/node-pty/lib/terminal.js +2 -2
  285. package/node_modules/node-pty/lib/unixTerminal.js +11 -6
  286. package/node_modules/node-pty/lib/utils.js +6 -7
  287. package/node_modules/node-pty/lib/windowsConoutConnection.js +24 -18
  288. package/node_modules/node-pty/lib/windowsPtyAgent.js +125 -101
  289. package/node_modules/node-pty/lib/windowsTerminal.js +14 -4
  290. package/node_modules/node-pty/lib/worker/conoutSocketWorker.js +3 -3
  291. package/node_modules/node-pty/package.json +1 -1
  292. package/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
  293. package/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
  294. package/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
  295. package/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
  296. package/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
  297. package/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
  298. package/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
  299. package/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
  300. package/node_modules/node-pty/scripts/post-install.js +1 -5
  301. package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-arm64/OpenConsole.exe +0 -0
  302. package/node_modules/node-pty/third_party/conpty/{1.23.251008001 → 1.25.260303002}/win10-arm64/conpty.dll +0 -0
  303. package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-x64/OpenConsole.exe +0 -0
  304. package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-x64/conpty.dll +0 -0
  305. package/package.json +1 -1
  306. package/node_modules/node-pty/deps/winpty/.drone.yml +0 -15
  307. package/node_modules/node-pty/deps/winpty/LICENSE +0 -21
  308. package/node_modules/node-pty/deps/winpty/configure +0 -167
  309. package/node_modules/node-pty/deps/winpty/misc/ConinMode.ps1 +0 -116
  310. package/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 +0 -51
  311. package/node_modules/node-pty/deps/winpty/misc/build32.sh +0 -9
  312. package/node_modules/node-pty/deps/winpty/misc/build64.sh +0 -9
  313. package/node_modules/node-pty/deps/winpty/misc/color-test.sh +0 -212
  314. package/node_modules/node-pty/deps/winpty/ship/build-pty4j-libpty.bat +0 -36
  315. package/node_modules/node-pty/deps/winpty/src/shared/GetCommitHash.bat +0 -13
  316. package/node_modules/node-pty/deps/winpty/src/shared/UpdateGenVersion.bat +0 -20
  317. package/node_modules/node-pty/deps/winpty/vcbuild.bat +0 -83
  318. package/node_modules/node-pty/lib/eventEmitter2.test.js +0 -30
  319. package/node_modules/node-pty/lib/terminal.test.js +0 -139
  320. package/node_modules/node-pty/lib/testUtils.test.js +0 -28
  321. package/node_modules/node-pty/lib/unixTerminal.test.js +0 -351
  322. package/node_modules/node-pty/lib/windowsPtyAgent.test.js +0 -90
  323. package/node_modules/node-pty/lib/windowsTerminal.test.js +0 -219
  324. package/node_modules/node-pty/prebuilds/win32-x64/pty.node +0 -0
  325. package/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
  326. package/node_modules/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
  327. package/node_modules/node-pty/scripts/gen-compile-commands.js +0 -8
  328. package/node_modules/node-pty/scripts/increment-version.js +0 -54
  329. package/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/OpenConsole.exe +0 -0
  330. package/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/OpenConsole.exe +0 -0
  331. package/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/conpty.dll +0 -0
@@ -1,8 +1,8 @@
1
- var hl=Object.defineProperty;var r=(Ce,dt)=>hl(Ce,"name",{value:dt,configurable:!0});window.__ModuleLoader__.load({id:"@deepseek-ai/dsh-client-ui-conversation",factory:r(Ce=>{var dt={exports:{}},ut=dt.exports;Object.defineProperty(ut,Symbol.toStringTag,{value:"Module"});let Ys=Ce("@deepseek-ai/dsh-client-ui-slots"),D=Ce("@deepseek-ai/dsh-client-runtime/client"),Qs=Ce("@deepseek-ai/cordis"),i=Ce("react/jsx-runtime"),h=Ce("react"),_=Ce("@deepseek-ai/dsh-client-ui-primitives"),Ze=Ce("@deepseek-ai/dsh-client-ui-attachment");function Zs(){return(0,D.defineStore)({init:r(()=>({selection:null,draft:"",view:null,inspect:null}),"init"),persist:"dsh.conversation.chat",actions:{select:r((e,t)=>{e.selection=t},"select"),setDraft:r((e,t)=>{e.draft=t},"setDraft"),setView:r((e,t)=>{e.view=t},"setView"),setInspect:r((e,t)=>{e.inspect=t},"setInspect")}})}r(Zs,"createChatStore");function er(e){return{kind:"image",id:crypto.randomUUID(),previewUrl:URL.createObjectURL(e),file:e}}r(er,"browserDraftAttachment");var en=class extends Error{static{r(this,"UnsupportedImageMediaTypeError")}mediaType;constructor(e){super(`unsupported image media type: ${e||"(empty)"}`),this.name="UnsupportedImageMediaTypeError",this.mediaType=e}},tn=class extends Qs.Service{static{r(this,"ConversationController")}input;blocks;draftAttachments=new Map;imageUrls=new Map;imageGenerations=new Map;createdImageUrls=new Set;disposed=!1;constructor(e,t){super(e,"conversation"),this.input=t.input,this.blocks=t.blocks,e.effect(()=>()=>{this.disposed=!0;for(const n of this.createdImageUrls)At(n);this.createdImageUrls.clear(),this.draftAttachments.clear(),this.imageUrls.clear(),this.imageGenerations.clear()},"conversation attachment URL cache")}async send(e){const t=await this.scopedSession("send").prompt([{type:"text",text:e}],"queue");if(!t.ok)throw new Error(`conversation.send failed: ${t.error.code}: ${t.error.message}`)}async sendSession(e,t,n,s){const o=this.draftImages(n);if(o.length!==n.length)throw new Error("conversation.sendSession: one or more draft images are no longer available");const a=[...await this.serializeImages(o.map(c=>c.file)),...t===""?[]:[{type:"text",text:t}]],l=await e.prompt(a,s);if(!l.ok)throw new Error(`conversation.send failed: ${l.error.code}: ${l.error.message}`);this.releaseDraftImages(o)}createDraftImages(e){for(const t of e)nn(t.type);return e.map(t=>{const n=er(t);return this.draftAttachments.set(n.id,n),this.createdImageUrls.add(n.previewUrl),n})}draftImages(e){const t=[];for(const n of e){const s=this.draftAttachments.get(n);s!==void 0&&t.push(s)}return t}releaseDraftImage(e){const t=this.draftAttachments.get(e);t!==void 0&&(this.draftAttachments.delete(e),this.createdImageUrls.delete(t.previewUrl),At(t.previewUrl))}releaseDraftImages(e){for(const t of e)this.releaseDraftImage(t.id)}resolveImage(e,t){if(this.disposed)return Promise.reject(new Error("conversation.resolveImage: service is disposed"));const n=`${e}:${t.attachmentId}`,s=this.imageUrls.get(n);if(s!==void 0)return s.pending;const o=this.imageGenerations.get(e)??0,a=this.requireSessions().binding(e)?.session;if(a===void 0)return Promise.reject(new Error(`conversation.resolveImage: unknown session "${e}"`));const l=a.readAttachment(t.attachmentId).then(c=>{if(!c.ok)throw new Error(`${c.error.code}: ${c.error.message}`);if(this.disposed)throw new Error("conversation.resolveImage: service was disposed before loading completed");if((this.imageGenerations.get(e)??0)!==o)throw new Error("historical image scope was released before loading completed");if(typeof URL.createObjectURL!="function")return`data:${c.value.attachment.mediaType};base64,${sn(c.value.data)}`;const d=Uint8Array.from(c.value.data),u=URL.createObjectURL(new Blob([d.buffer],{type:c.value.attachment.mediaType}));return this.createdImageUrls.add(u),u}).catch(c=>{throw this.imageUrls.get(n)?.generation===o&&this.imageUrls.delete(n),c});return this.imageUrls.set(n,{sessionId:e,generation:o,pending:l}),l}releaseSessionImages(e){this.imageGenerations.set(e,(this.imageGenerations.get(e)??0)+1);for(const[t,n]of this.imageUrls)n.sessionId===e&&(this.imageUrls.delete(t),n.pending.then(s=>{this.createdImageUrls.delete(s)&&At(s)},()=>{}))}async updateQueue(e,t){const n=await this.scopedSession("updateQueue").updateQueue(e,t);if(!n.ok){if(t.kind==="steer"&&(n.error.code==="steer-unavailable"||n.error.code==="queue-item-not-found"))return;throw new Error(`conversation.updateQueue failed: ${n.error.code}: ${n.error.message}`)}}async cancel(){const e=await this.scopedSession("cancel").cancel();if(!e.ok)throw new Error(`conversation.cancel failed: ${e.error.code}: ${e.error.message}`)}async loadOlder(){await this.scopedSession("loadOlder").loadOlder()}scopedSession(e){const t=this.scopeId(e),n=this.requireSessions().binding(t);if(n===void 0)throw new Error(`conversation.${e}: session "${t}" resolved no binding`);return n.session}scopeId(e){const t=this.requireSessions().scopeOf(this.ctx);if(t===void 0)throw new Error(`conversation.${e} requires a session scope — address one via ctx.sessions.scope(id).conversation`);return t}requireSessions(){const e=this.ctx.get("sessions");if(e===void 0)throw new Error("conversation: sessions service unavailable");return e}serializeImages(e){return Promise.all(e.map(async t=>({type:"image",mediaType:nn(t.type),data:sn(new Uint8Array(await t.arrayBuffer())),...t.name===""?{}:{name:t.name}})))}};function nn(e){switch(e){case"image/png":case"image/jpeg":case"image/webp":case"image/gif":return e;default:throw new en(e)}}r(nn,"imageMediaType");function sn(e){let t="";for(let s=0;s<e.length;s+=32768)t+=String.fromCharCode(...e.subarray(s,s+32768));return btoa(t)}r(sn,"bytesToBase64");function At(e){e.startsWith("blob:")&&URL.revokeObjectURL(e)}r(At,"revokePreview");var tr=class{static{r(this,"ComposerBlockRegistry")}stores=new Map;set(e,t){const n=this.storeFor(e);n.getSnapshot()?.reason!==t?.reason&&n.set(t)}storeFor(e){const t=this.stores.get(e);if(t!==void 0)return t;const n=(0,D.createSnapshotStore)(void 0);return this.stores.set(e,n),n}forget(e){this.stores.delete(e)}};function nr(e){return{getSnapshot:r(()=>e.getSnapshot().queue,"getSnapshot"),subscribe:r(t=>e.subscribe(t),"subscribe")}}r(nr,"queueReadFaceOf");const sr=[],rn=100;function on(e){throw new Error(`unreachable input event: ${JSON.stringify(e)}`)}r(on,"unreachable");function an(e,t){const n=e.trimStart();if(n.startsWith(t))return n.slice(t.length);const s=t.trimEnd();if(n.startsWith(s)){const o=n.slice(s.length);return/^\s/.test(o)?o.slice(1):o}return""}r(an,"argsAfter");function rr(e,t){let n=0;const s=Math.min(e.length,t.length);for(;n<s&&e[n]===t[n];)n+=1;let o=0;const a=s-n;for(;o<a&&e[e.length-1-o]===t[t.length-1-o];)o+=1;return{start:n,end:e.length-o,insertedLength:t.length-o-n}}r(rr,"diffEdit");var or=class{static{r(this,"InputMachine")}draft="";draftRev=0;phase="plain";claim;occurrences=[];occurrenceSeq=0;seq=0;inflight;log=[];redoStack=[];typingRun;paste;pasteSeq=0;mergeWindowMs;now;constructor(e={}){this.mergeWindowMs=e.mergeWindowMs??1e3,this.now=e.now??(()=>0)}get state(){const e=this.claim;return{draft:this.draft,imageIds:[],draftRev:this.draftRev,phase:this.phase,...e?{claim:{token:e.token,...e.hint!==void 0?{hint:e.hint}:{}}}:{},occurrences:this.occurrences,...this.paste!==void 0?{paste:this.paste}:{},queue:sr}}dispatch(e){switch(e.type){case"draft-changed":return this.onDraftChanged(e.draft,e.editRange);case"begin-command":return this.onBeginCommand(e.claim,e.span);case"insert-ref":return this.onInsertRef(e.reference,e.span);case"consume-token":return this.onConsumeToken(e.guard);case"set-invalid":return this.onSetInvalid(e.invalidIds);case"undo":return this.onUndo();case"redo":return this.onRedo();case"paste-begin":return this.onPasteBegin(e.text,e.selection,e.components,e.generation);case"paste-upgrade":return this.onPasteUpgrade(e.attemptId,e.span,e.reference);case"invalidate-paste":return this.paste=void 0,[];case"enter":return this.onEnter(e.mode);case"adjudicated":return this.onAdjudicated(e.attempt,e.outcome);case"adjudication-failed":return this.onAdjudicationFailed(e.attempt,e.message);case"submit-settled":return this.onSubmitSettled(e);case"send-committed":return this.onSendCommitted();case"release":return this.onRelease();default:return on(e)}}adopt(e){this.draft=e,this.draftRev+=1}pushTxn(e){this.log.push({draftBefore:this.draft,occurrencesBefore:this.occurrences,...e!==void 0?{selectionBefore:e}:{}}),this.log.length>rn&&this.log.shift(),this.redoStack=[]}reconcile(e){const t=e.insertedLength-(e.end-e.start),n=[];for(const s of this.occurrences)s.offset<e.start?n.push(s):s.offset>=e.end&&n.push(t===0?s:{...s,offset:s.offset+t});this.occurrences=n}watchClaim(){this.phase==="claimed"&&this.claim!==void 0&&!this.draft.startsWith(this.claim.token)&&(this.phase="plain",this.claim=void 0)}mint(e,t){return this.occurrenceSeq+=1,{occurrenceId:this.occurrenceSeq,source:e.source,ref:e.ref,offset:t,label:e.label,clipboardText:e.clipboardText}}withMinted(e){e.length!==0&&(this.occurrences=[...this.occurrences,...e].sort((t,n)=>t.offset-n.offset))}onDraftChanged(e,t){if(e===this.draft)return[];const n=t??rr(this.draft,e),s=n.start===n.end&&n.insertedLength===1,o=this.now(),a=this.typingRun;return s&&a!==void 0&&a.end===n.start&&o-a.at<=this.mergeWindowMs||this.pushTxn({start:n.start,end:n.end}),this.typingRun=s?{end:n.start+1,at:o}:void 0,this.reconcile(n),this.adopt(e),this.watchClaim(),this.paste=void 0,[]}casOk(e){return e.draftRev===this.draftRev&&e.start>=0&&e.start<=e.end&&e.end<=this.draft.length}onBeginCommand(e,t){return this.phase!=="plain"&&this.phase!=="claimed"?[]:!this.casOk(t)||this.draft.slice(0,t.start).trim()!==""?[]:(this.pushTxn(),this.typingRun=void 0,this.reconcile({start:0,end:t.end,insertedLength:e.token.length}),this.adopt(e.token+this.draft.slice(t.end)),this.claim=e,this.phase="claimed",this.paste=void 0,[])}onInsertRef(e,t){return this.phase!=="plain"&&this.phase!=="claimed"?[]:this.casOk(t)?(this.replaceSpanWithChip(e,t),this.paste=void 0,[]):[]}replaceSpanWithChip(e,t){this.pushTxn(),this.typingRun=void 0;const n=this.draft.slice(t.end),s=""+(n.length===0||n[0]!==" "?" ":"");return this.reconcile({start:t.start,end:t.end,insertedLength:s.length}),this.withMinted([this.mint(e,t.start)]),this.adopt(this.draft.slice(0,t.start)+s+n),this.watchClaim(),s.length}onConsumeToken(e){if(this.phase!=="plain"&&this.phase!=="claimed")return[];switch(e.kind){case"span":{const t=e.span;return!this.casOk(t)||t.start===t.end?[]:(this.pushTxn(),this.typingRun=void 0,this.reconcile({start:t.start,end:t.end,insertedLength:0}),this.adopt(this.draft.slice(0,t.start)+this.draft.slice(t.end)),this.watchClaim(),this.paste=void 0,[])}case"bare-token":return e.token===""||this.draft.trim()!==e.token?[]:(this.pushTxn(),this.typingRun=void 0,this.occurrences=[],this.adopt(""),this.watchClaim(),this.paste=void 0,[]);default:return on(e)}}onSetInvalid(e){const t=new Set(e);return this.occurrences.some(n=>n.invalid===!0!==t.has(n.occurrenceId))?(this.occurrences=this.occurrences.map(n=>{const s=t.has(n.occurrenceId);if(n.invalid===!0===s)return n;const{invalid:o,...a}=n;return s?{...a,invalid:!0}:a}),[]):[]}onUndo(){const e=this.log.pop();return e===void 0?[]:(this.redoStack.push({draftBefore:this.draft,occurrencesBefore:this.occurrences}),this.occurrences=e.occurrencesBefore,this.adopt(e.draftBefore),this.watchClaim(),this.typingRun=void 0,this.paste=void 0,[])}onRedo(){const e=this.redoStack.pop();return e===void 0?[]:(this.log.push({draftBefore:this.draft,occurrencesBefore:this.occurrences}),this.log.length>rn&&this.log.shift(),this.occurrences=e.occurrencesBefore,this.adopt(e.draftBefore),this.watchClaim(),this.typingRun=void 0,this.paste=void 0,[])}onPasteBegin(e,t,n=[],s=0){const{start:o,end:a}=t;if(o<0||o>a||a>this.draft.length)return[];const l=e.split("").join("");this.pushTxn(t),this.typingRun=void 0;const c=[...n].sort((m,k)=>m.start-k.start),d=[];let u="",f=0;for(const m of c)u+=l.slice(f,m.start),d.push(this.mint(m.reference,o+u.length)),u+="",f=m.end;return u+=l.slice(f),this.reconcile({start:o,end:a,insertedLength:u.length}),this.withMinted(d),this.adopt(this.draft.slice(0,o)+u+this.draft.slice(a)),this.watchClaim(),this.phase==="plain"||this.phase==="claimed"?(this.pasteSeq+=1,this.paste={attemptId:this.pasteSeq,insertedRange:{start:o,end:o+u.length},generation:s}):this.paste=void 0,[]}onPasteUpgrade(e,t,n){const s=this.paste;if(s===void 0||s.attemptId!==e)return[];if(this.phase!=="plain"&&this.phase!=="claimed")return[];if(!this.casOk(t)||t.start===t.end)return[];const o=this.replaceSpanWithChip(n,t);return this.paste={...s,insertedRange:{start:s.insertedRange.start,end:s.insertedRange.end+o-(t.end-t.start)}},[]}beginAttempt(e){const t=new AbortController;this.seq+=1;const n={seq:this.seq,signal:t.signal,draftSnapshot:this.draft,mode:e};return this.inflight={attempt:n,controller:t},n}onEnter(e){if(this.phase==="adjudicating"||this.phase==="submitting")return[];if(this.phase==="claimed"&&this.claim!==void 0){const n=this.beginAttempt(e);return this.phase="submitting",this.paste=void 0,[{type:"begin-submit",attempt:n,claim:this.claim,args:an(this.draft,this.claim.token)}]}const t=this.draft.trim();if(t==="")return[];if(this.paste=void 0,t.startsWith("/")){const n=this.beginAttempt(e);return this.phase="adjudicating",[{type:"adjudicate",attempt:n,draft:this.draft}]}return[{type:"default-sink",draft:this.draft,mode:e}]}onAdjudicated(e,t){const n=this.inflight;return this.phase!=="adjudicating"||n===void 0||n.attempt.seq!==e.seq?[]:t!==void 0&&t!=="handled"&&"claim"in t?(this.claim=t.claim,this.phase="submitting",[{type:"begin-submit",attempt:e,claim:t.claim,args:an(e.draftSnapshot,t.claim.token)}]):(this.inflight=void 0,this.phase="plain",t===void 0?[{type:"default-sink",draft:e.draftSnapshot,mode:e.mode}]:[])}onAdjudicationFailed(e,t){return this.phase!=="adjudicating"||this.inflight?.attempt.seq!==e.seq?[]:(this.inflight=void 0,this.phase="plain",[{type:"notice",level:"error",text:t}])}onSubmitSettled(e){const t=this.inflight;if(this.phase!=="submitting"||t===void 0||t.attempt.seq!==e.attempt.seq)return[];if(this.inflight=void 0,e.ok)return this.phase="plain",this.claim=void 0,this.occurrences=[],this.adopt(""),this.log=[],this.redoStack=[],this.typingRun=void 0,this.paste=void 0,e.outcome?.text!==void 0?[{type:"notice",level:e.outcome.kind==="error"?"error":"info",text:e.outcome.text}]:[];const n=e.message??e.outcome?.text??"command failed";return this.draft===t.attempt.draftSnapshot&&this.claim!==void 0&&this.draft.startsWith(this.claim.token)?(this.phase="claimed",[{type:"notice",level:"error",text:n}]):(this.phase="plain",this.claim=void 0,[{type:"notice",level:"error",text:n}])}onSendCommitted(){return this.claim=void 0,this.occurrences=[],this.adopt(""),this.log=[],this.redoStack=[],this.typingRun=void 0,this.paste=void 0,[]}onRelease(){return this.inflight!==void 0&&(this.inflight.controller.abort(),this.inflight=void 0),this.phase="plain",this.claim=void 0,this.typingRun=void 0,this.paste=void 0,[]}};function ln(e){switch(e){case"plain":return"plain";case"claimed":return"claimed";default:return"frozen"}}r(ln,"guardOf");const ir=[],ar=new Map;var lr=class{static{r(this,"SessionInputShell")}deps;state;notices=(0,D.createSnapshotStore)(null);actions={setDraft:r(e=>{this.setDraft(e)},"setDraft"),addImages:r(e=>this.addImages(e),"addImages"),removeImage:r(e=>{this.removeImage(e)},"removeImage"),pruneImages:r(e=>{this.pruneImages(e)},"pruneImages"),submit:r(()=>{this.submit("queue")},"submit")};core=new or({now:r(()=>Date.now(),"now")});noticeSeq=0;lastDraft="";imageIds=[];disposed=!1;mirrorFn;constructor(e){this.deps=e,this.state=(0,D.createSnapshotStore)(this.compose()),e.queue?.subscribe(()=>{this.publish()})}setDraft(e,t){this.run(this.core.dispatch({type:"draft-changed",draft:e,...t!==void 0?{editRange:t}:{}}))}addImages(e){return this.snapshot.phase==="adjudicating"||this.snapshot.phase==="submitting"?!1:(e.length===0||(this.imageIds=[...this.imageIds,...e],this.publish()),!0)}removeImage(e){const t=this.imageIds.filter(n=>n!==e);t.length!==this.imageIds.length&&(this.imageIds=t,this.publish())}pruneImages(e){const t=new Set(e),n=this.imageIds.filter(s=>t.has(s));n.length!==this.imageIds.length&&(this.imageIds=n,this.publish())}restoreImages(e){const t=new Set(this.imageIds);this.imageIds=[...e.filter(n=>!t.has(n)),...this.imageIds],this.publish()}commitSend(e){const t=new Set(e);this.imageIds=this.imageIds.filter(n=>!t.has(n)),this.run(this.core.dispatch({type:"send-committed"}))}undo(){this.run(this.core.dispatch({type:"undo"}))}redo(){this.run(this.core.dispatch({type:"redo"}))}pasteBegin(e,t,n,s){this.run(this.core.dispatch({type:"paste-begin",text:e,selection:t,...n!==void 0?{components:n}:{},...s!==void 0?{generation:s}:{}}))}invalidatePaste(){this.run(this.core.dispatch({type:"invalidate-paste"}))}submit(e="queue"){if(this.snapshot.draft.trim()===""&&this.imageIds.length>0){this.snapshot.phase==="plain"&&this.deps.defaultSink("",[...this.imageIds],e);return}this.run(this.core.dispatch({type:"enter",mode:e}));const t=this.snapshot.phase;(t==="adjudicating"||t==="submitting")&&(this.deps.popup?.()?.dismiss(),this.deps.inputTriggers?.()?.track(this.snapshot.draft,0,{tier:"frozen"},this.snapshot.draftRev))}track(e,t){this.deps.inputTriggers?.()?.track(e,t,{tier:ln(this.snapshot.phase)},this.snapshot.draftRev)}arbitrate(e,t){return this.deps.inputTriggers?.()?.arbitrate(e,t)??"pass"}steerQueue(){this.deps.steerQueue?.()}space(){const e=this.deps.inputTriggers?.();if(e===void 0)return!1;const t=e.onSpace();if(t){const n=this.snapshot;e.track(n.draft,n.draft.length,{tier:ln(n.phase)},n.draftRev)}return t}dismissPopup(){this.deps.popup?.()?.dismiss()}lexicon={getSnapshot:r(()=>this.deps.inputTriggers?.()?.lexicon.getSnapshot()??ar,"getSnapshot"),subscribe:r(e=>this.deps.inputTriggers?.()?.lexicon.subscribe(e)??(()=>{}),"subscribe")};beginCommand(e,t){const n=this.core.state.draftRev;return this.run(this.core.dispatch({type:"begin-command",claim:e,span:t})),this.core.state.phase==="claimed"&&this.core.state.draftRev!==n}insertReference(e,t){const n=this.core.state.draftRev;return this.run(this.core.dispatch({type:"insert-ref",reference:e,span:t})),this.core.state.draftRev!==n}consumeToken(e){const t=this.core.state;if(e.kind==="span"){if(e.span.draftRev!==t.draftRev)return!1;const n=t.draft;return this.setDraft(n.slice(0,e.span.start)+n.slice(e.span.end)),!0}return t.draft.trim()!==e.token?!1:(this.setDraft(""),!0)}insertText(e,t){const n=this.core.state;if(t.draftRev!==n.draftRev)return!1;const s=n.draft;return this.setDraft(s.slice(0,t.start)+e+s.slice(t.end)),!0}notify(e,t){this.noticeSeq+=1,this.notices.set({level:e,text:t,seq:this.noticeSeq})}dispose(){this.disposed=!0,this.run(this.core.dispatch({type:"release"}))}get snapshot(){return this.state.getSnapshot()}bindMirror(e){return this.mirrorFn=e,()=>{this.mirrorFn===e&&(this.mirrorFn=void 0)}}run(e){for(const t of e)this.execute(t);this.publish()}execute(e){switch(e.type){case"notice":this.noticeSeq+=1,this.notices.set({level:e.level,text:e.text,seq:this.noticeSeq});return;case"adjudicate":this.adjudicate(e.attempt,e.draft);return;case"begin-submit":this.beginSubmit(e.attempt,e.claim,e.args);return;case"default-sink":this.sinkSerialized(e.draft,e.mode);return;default:return}}sinkSerialized(e,t){const n=[...this.imageIds],s=this.core.state.occurrences;if(s.length===0){this.deps.defaultSink(e.trim(),n,t);return}const o=this.deps.inputTriggers?.(),a=new AbortController;Promise.all(s.map(async l=>{if(o===void 0)throw new Error(`no serializer for reference source "${l.source}"`);return{offset:l.offset,text:await o.serializeReference(l.source,l.ref,a.signal)}})).then(l=>{if(this.disposed)return;let c="",d=0;for(const u of l)c+=e.slice(d,u.offset)+u.text,d=u.offset+1;c+=e.slice(d),this.deps.defaultSink(c.trim(),n,t)},l=>{if(a.abort(),this.disposed)return;const c=l instanceof Error?l.message:String(l);this.notify("error",c)})}adjudicate(e,t){const n=this.deps.inputTriggers?.();if(n===void 0){this.run(this.core.dispatch({type:"adjudicated",attempt:e,outcome:void 0}));return}n.adjudicate(t.trim(),e.signal).then(s=>{this.dead(e)||this.run(this.core.dispatch({type:"adjudicated",attempt:e,outcome:s}))},s=>{if(this.dead(e))return;const o=s instanceof Error?s.message:String(s);this.run(this.core.dispatch({type:"adjudication-failed",attempt:e,message:o}))})}beginSubmit(e,t,n){Promise.resolve().then(()=>t.submit(n,this.deps.actx)).then(s=>{this.dead(e)||this.run(this.core.dispatch({type:"submit-settled",attempt:e,ok:s.kind==="success",outcome:s}))},s=>{if(this.dead(e))return;const o=s instanceof Error?s.message:String(s);this.run(this.core.dispatch({type:"submit-settled",attempt:e,ok:!1,message:o}))})}dead(e){return this.disposed||e.signal.aborted}compose(){return{...this.core.state,imageIds:this.imageIds,queue:this.deps.queue?.getSnapshot()??ir}}publish(){const e=this.compose();this.state.set(e),e.draft!==this.lastDraft&&(this.lastDraft=e.draft,this.mirrorFn?.(e.draft))}},cr=class{static{r(this,"InputHub")}rootCtx;t;shells=new Map;constructor(e,t){this.rootCtx=e,this.t=t}for(e){const t=this.sessions().scopeOf(e);if(t===void 0)throw new Error("conversation.input.for requires a session scope");return this.shell(t)}shellFor(e){const t=this.shells.get(e.sessionId);if(t!==void 0)return t;const{sessionId:n,session:s,ctx:o}=e,a=new lr({actx:o,inputTriggers:r(()=>this.controller(o),"inputTriggers"),popup:r(()=>this.popup(o),"popup"),queue:nr(s),defaultSink:r((l,c,d)=>{this.sink(s,l,c,d)},"defaultSink"),steerQueue:r(()=>{this.steerQueue(s,a)},"steerQueue")});return this.shells.set(n,a),o.effect(()=>{const l=[o.on("slash/input-begin-command",c=>a.beginCommand(c.claim,c.span)?!0:void 0),o.on("slash/input-insert-reference",c=>a.insertReference(c.reference,c.span)?!0:void 0),o.on("slash/input-consume-token",c=>a.consumeToken(c.guard)?!0:void 0),o.on("slash/input-insert-text",c=>a.insertText(c.text,c.span)?!0:void 0)];return()=>{for(const u of l)u();const c=a.snapshot.imageIds;a.dispose(),this.shells.delete(n);const d=this.rootCtx.get("conversation");for(const u of c)d?.releaseDraftImage(u)}},"conversation.input: session shell"),a}shell(e){const t=this.shells.get(e);if(t!==void 0)return t;const n=this.sessions().binding(e);if(n===void 0)throw new Error(`conversation.input: session "${e}" resolved no binding`);return this.shellFor(n)}keyboard(e){return this.shell(e)}inputTriggers(e){const t=this.sessions().scope(e);return t===void 0?void 0:this.controller(t)}sink(e,t,n,s){if(t===""&&n.length===0)return;const o=this.shells.get(e.sessionId);o?.commitSend(n),this.conversation().sendSession(e,t,n,s).catch(()=>{if(this.shells.get(e.sessionId)===o){o?.restoreImages(n),o?.snapshot.draft===""&&o.setDraft(t);return}const a=this.rootCtx.get("conversation");for(const l of n)a?.releaseDraftImage(l)})}async steerQueue(e,t){const n=e.getSnapshot().queue.filter(s=>s.placement==="queued");if(n.length!==0)for(const s of n){const o=await e.updateQueue(s.id,{kind:"steer"});if(!o.ok){if(o.error.code==="steer-unavailable"||o.error.code==="queue-item-not-found")return;t.notify("error",this.t("queue.steerFailed"));return}}}controller(e){return this.rootCtx.get("inputTriggers")?.sessionOf(e)}popup(e){return this.rootCtx.get("commandUi")?.popupFor(e)}sessions(){const e=this.rootCtx.get("sessions");if(e===void 0)throw new Error("conversation.input: sessions service unavailable");return e}conversation(){const e=this.rootCtx.get("conversation");if(e===void 0)throw new Error("conversation.input: conversation service unavailable");return e}};function oe(e){return e==null}r(oe,"isNullable");function St(e){return e&&typeof e=="object"&&!Array.isArray(e)}r(St,"isPlainObject");function dr(e,t){return Object.fromEntries(Object.entries(e).filter(([n,s])=>t(n,s)))}r(dr,"filterKeys");function Re(e,t){return Object.fromEntries(Object.entries(e).map(([n,s])=>[n,t(s,n)]))}r(Re,"mapValues");function ur(e,t,n){if(!t)return{...e};const s={};for(const o of t)(n||e[o]!==void 0)&&(s[o]=e[o]);return s}r(ur,"pick");function $e(e,t){return arguments.length===1?n=>$e(e,n):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}r($e,"is");function pt(e){return $e("ArrayBuffer",e)||$e("SharedArrayBuffer",e)}r(pt,"isArrayBufferLike");function pr(e){return pt(e)||ArrayBuffer.isView(e)}r(pr,"isArrayBufferSource");let ye;(function(e){e.is=pt,e.isSource=pr;function t(l){return ArrayBuffer.isView(l)?l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength):l}r(t,"fromSource"),e.fromSource=t;function n(l){if(l=t(l),typeof Buffer<"u")return Buffer.from(l).toString("base64");let c="";const d=new Uint8Array(l);for(let u=0;u<d.byteLength;u++)c+=String.fromCharCode(d[u]);return btoa(c)}r(n,"toBase64"),e.toBase64=n;function s(l){return typeof Buffer<"u"?t(Buffer.from(l,"base64")):Uint8Array.from(atob(l),c=>c.charCodeAt(0))}r(s,"fromBase64"),e.fromBase64=s;function o(l){return l=t(l),typeof Buffer<"u"?Buffer.from(l).toString("hex"):Array.from(new Uint8Array(l),c=>c.toString(16).padStart(2,"0")).join("")}r(o,"toHex"),e.toHex=o;function a(l){if(typeof Buffer<"u")return t(Buffer.from(l,"hex"));const c=l.length%2===0?l:l.slice(0,l.length-1),d=[];for(let u=0;u<c.length;u+=2)d.push(parseInt(`${c[u]}${c[u+1]}`,16));return Uint8Array.from(d).buffer}r(a,"fromHex"),e.fromHex=a})(ye||(ye={})),ye.fromBase64,ye.toBase64,ye.fromHex,ye.toHex;function Ct(e,t=new Map){if(!e||typeof e!="object")return e;if($e("Date",e))return new Date(e.valueOf());if($e("RegExp",e))return new RegExp(e.source,e.flags);if(pt(e))return e.slice(0);if(ArrayBuffer.isView(e))return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);const n=t.get(e);if(n)return n;if(Array.isArray(e)){const o=[];return t.set(e,o),e.forEach((a,l)=>{o[l]=Reflect.apply(Ct,null,[a,t])}),o}const s=Object.create(Object.getPrototypeOf(e));t.set(e,s);for(const o of Reflect.ownKeys(e)){const a={...Reflect.getOwnPropertyDescriptor(e,o)};"value"in a&&(a.value=Reflect.apply(Ct,null,[a.value,t])),Reflect.defineProperty(s,o,a)}return s}r(Ct,"clone");function et(e,t,n){if(e===t||!n&&oe(e)&&oe(t))return!0;if(typeof e!=typeof t||typeof e!="object"||!e||!t)return!1;function s(o,a){return o(e)?o(t)?a(e,t):!1:o(t)?!1:void 0}return r(s,"check"),s(Array.isArray,(o,a)=>o.length===a.length&&o.every((l,c)=>et(l,a[c])))??s($e("Date"),(o,a)=>o.valueOf()===a.valueOf())??s($e("RegExp"),(o,a)=>o.source===a.source&&o.flags===a.flags)??s(pt,(o,a)=>{if(o.byteLength!==a.byteLength)return!1;const l=new Uint8Array(o),c=new Uint8Array(a);for(let d=0;d<l.length;d++)if(l[d]!==c[d])return!1;return!0})??Object.keys({...e,...t}).every(o=>et(e[o],t[o],n))}r(et,"deepEqual");let cn;(function(e){e.millisecond=1;const t=e.second=1e3,n=e.minute=t*60,s=e.hour=n*60,o=e.day=s*24,a=e.week=o*7;let l=new Date().getTimezoneOffset();function c(x){l=x}r(c,"setTimezoneOffset"),e.setTimezoneOffset=c;function d(){return l}r(d,"getTimezoneOffset"),e.getTimezoneOffset=d;function u(x=new Date,A){return typeof x=="number"&&(x=new Date(x)),A===void 0&&(A=l),Math.floor((x.valueOf()/n-A)/1440)}r(u,"getDateNumber"),e.getDateNumber=u;function f(x,A){const S=new Date(x*o);return A===void 0&&(A=l),new Date(+S+A*n)}r(f,"fromDateNumber"),e.fromDateNumber=f;const m=/\d+(?:\.\d+)?/.source,k=new RegExp(`^${["w(?:eek(?:s)?)?","d(?:ay(?:s)?)?","h(?:our(?:s)?)?","m(?:in(?:ute)?(?:s)?)?","s(?:ec(?:ond)?(?:s)?)?"].map(x=>`(${m}${x})?`).join("")}$`);function g(x){const A=k.exec(x);return A?(parseFloat(A[1])*a||0)+(parseFloat(A[2])*o||0)+(parseFloat(A[3])*s||0)+(parseFloat(A[4])*n||0)+(parseFloat(A[5])*t||0):0}r(g,"parseTime"),e.parseTime=g;function y(x){const A=g(x);return A?x=Date.now()+A:/^\d{1,2}(:\d{1,2}){1,2}$/.test(x)?x=`${new Date().toLocaleDateString()}-${x}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(x)&&(x=`${new Date().getFullYear()}-${x}`),x?new Date(x):new Date}r(y,"parseDate"),e.parseDate=y;function b(x){const A=Math.abs(x);return A>=o-s/2?Math.round(x/o)+"d":A>=s-n/2?Math.round(x/s)+"h":A>=n-t/2?Math.round(x/n)+"m":A>=t?Math.round(x/t)+"s":x+"ms"}r(b,"format"),e.format=b;function w(x,A=2){return x.toString().padStart(A,"0")}r(w,"toDigits"),e.toDigits=w;function j(x,A=new Date){return x.replace("yyyy",A.getFullYear().toString()).replace("yy",A.getFullYear().toString().slice(2)).replace("MM",w(A.getMonth()+1)).replace("dd",w(A.getDate())).replace("hh",w(A.getHours())).replace("mm",w(A.getMinutes())).replace("ss",w(A.getSeconds())).replace("SSS",w(A.getMilliseconds(),3))}r(j,"template"),e.template=j})(cn||(cn={}));const ht=Symbol.for("schemastery"),dn=Symbol.for("ValidationError");globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var G=class extends TypeError{static{r(this,"ValidationError")}options;name="ValidationError";constructor(e,t){let n="$";for(const s of t.path||[])typeof s=="string"?n+="."+s:typeof s=="number"?n+="["+s+"]":typeof s=="symbol"&&(n+=`[Symbol(${s.toString()})]`);n.startsWith(".")&&(n=n.slice(1)),super((n==="$"?"":`${n} `)+e),this.options=t}static is(e){return!!e?.[dn]}};Object.defineProperty(G.prototype,dn,{value:!0});const v=r(function(e){const t=r(function(n,s={}){return v.resolve(n,t,s)[0]},"schema");if(e.refs){const n=Re(e.refs,o=>new v(o)),s=r(o=>n[o],"getRef");for(const o in n){const a=n[o];a.sKey=s(a.sKey),a.inner=s(a.inner),a.list=a.list&&a.list.map(s),a.dict=a.dict&&Re(a.dict,s)}return n[e.uid]}if(Object.assign(t,e),typeof t.callback=="string")try{t.callback=new Function("return "+t.callback)()}catch{}return Object.defineProperty(t,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(t,v.prototype),t.meta||={},t.toString=t.toString.bind(t),t},"Schema");v.prototype=Object.create(Function.prototype),v.prototype[ht]=!0,Object.defineProperty(v.prototype,"~standard",{get(){return{version:1,vendor:"schemastery",validate:r(e=>{try{return{value:v.resolve(e,this,{})[0]}}catch(t){if(G.is(t))return{issues:[{message:t.message,path:t.options.path}]};throw t}},"validate")}}}),v.ValidationError=G,v.prototype.toJSON=r(function(){if(globalThis.__schemastery_refs__)return globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this})),this.uid;globalThis.__schemastery_refs__={[this.uid]:{...this}},globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));const t={uid:this.uid,refs:globalThis.__schemastery_refs__};return globalThis.__schemastery_refs__=void 0,t},"toJSON"),v.prototype.set=r(function(t,n){return this.dict[t]=n,this},"set"),v.prototype.push=r(function(t){return this.list.push(t),this},"push");function hr(e,t){const n=typeof e=="string"?{"":e}:{...e};for(const s in t){const o=t[s];o?.$description||o?.$desc?n[s]=o.$description||o.$desc:typeof o=="string"&&(n[s]=o)}return n}r(hr,"mergeDesc");function tt(e){return e?.$value??e?.$inner}r(tt,"getInner");function un(e){return dr(e??{},t=>!t.startsWith("$"))}r(un,"extractKeys"),v.prototype.i18n=r(function(t){const n=v(this),s=hr(n.meta.description,t);return Object.keys(s).length&&(n.meta.description=s),n.dict&&(n.dict=Re(n.dict,(o,a)=>o.i18n(Re(t,l=>tt(l)?.[a]??l?.[a])))),n.list&&(n.list=n.list.map((o,a)=>o.i18n(Re(t,(l={})=>Array.isArray(tt(l))?tt(l)[a]:Array.isArray(l)?l[a]:un(l))))),n.inner&&(n.inner=n.inner.i18n(Re(t,o=>tt(o)?tt(o):un(o)))),n.sKey&&(n.sKey=n.sKey.i18n(Re(t,o=>o?.$key))),n},"i18n"),v.prototype.extra=r(function(t,n){const s=v(this);return s.meta={...s.meta,[t]:n},s},"extra");for(const e of["required","disabled","collapse","hidden","loose"])Object.assign(v.prototype,{[e](t=!0){const n=v(this);return n.meta={...n.meta,[e]:t},n}});v.prototype.deprecated=r(function(){const t=v(this);return t.meta.badges||=[],t.meta.badges.push({text:"deprecated",type:"danger"}),t},"deprecated"),v.prototype.experimental=r(function(){const t=v(this);return t.meta.badges||=[],t.meta.badges.push({text:"experimental",type:"warning"}),t},"experimental"),v.prototype.pattern=r(function(t){const n=v(this),s=ur(t,["source","flags"]);return n.meta={...n.meta,pattern:s},n},"pattern"),v.prototype.simplify=r(function(t){if(et(t,this.meta.default,this.type==="dict"))return null;if(oe(t))return t;if(this.type==="object"||this.type==="dict"){const n={};for(const s in t){const o=(this.type==="object"?this.dict[s]:this.inner)?.simplify(t[s]);(this.type==="dict"||!oe(o))&&(n[s]=o)}return et(n,this.meta.default,this.type==="dict")?null:n}else if(this.type==="array"||this.type==="tuple"){const n=[];return t.forEach((s,o)=>{const a=this.type==="array"?this.inner:this.list[o],l=a?a.simplify(s):s;n.push(l)}),n}else if(this.type==="intersect"){const n={};for(const s of this.list)Object.assign(n,s.simplify(t));return n}else if(this.type==="union")for(const n of this.list)try{return v.resolve(t,n,{}),n.simplify(t)}catch{}return t},"simplify"),v.prototype.toString=r(function(t){return hn[this.type]?.(this,t)??`Schema<${this.type}>`},"toString"),v.prototype.role=r(function(e,t){const n=v(this);return n.meta={...n.meta,role:e,extra:t},n},"role");for(const e of["default","link","comment","description","max","min","step"])Object.assign(v.prototype,{[e](t){const n=v(this);return n.meta={...n.meta,[e]:t},n}});const pn={};v.extend=r(function(t,n){pn[t]=n},"extend"),v.resolve=r(function(t,n,s={},o=!1){if(!n)return[t];if(s.ignore?.(t,n))return[t];if(oe(t)&&n.type!=="lazy"){if(n.meta.required)throw new G("missing required value",s);let l=n,c=n.meta.default;for(;l?.type==="intersect"&&oe(c);)l=l.list[0],c=l?.meta.default;if(oe(c))return[t];t=Ct(c)}const a=pn[n.type];if(!a)throw new G(`unsupported type "${n.type}"`,s);try{return a(t,n,s,o)}catch(l){if(!n.meta.loose)throw l;return[n.meta.default]}},"resolve"),v.from=r(function(t){if(oe(t))return v.any();if(["string","number","boolean"].includes(typeof t))return v.const(t).required();if(t[ht])return t;if(typeof t=="function")switch(t){case String:return v.string().required();case Number:return v.number().required();case Boolean:return v.boolean().required();case Function:return v.function().required();default:return v.is(t).required()}else throw new TypeError(`cannot infer schema from ${t}`)},"from"),v.lazy=r(function(t){const n=r(()=>(s.inner[ht]||(s.inner=s.builder(),s.inner.meta={...s.meta,...s.inner.meta}),s.inner.toJSON()),"toJSON"),s=new v({type:"lazy",builder:t,inner:{toJSON:n}});return s},"lazy"),v.natural=r(function(){return v.number().step(1).min(0)},"natural"),v.percent=r(function(){return v.number().step(.01).min(0).max(1).role("slider")},"percent"),v.date=r(function(){return v.union([v.is(Date),v.transform(v.string().role("datetime"),(t,n)=>{const s=new Date(t);if(isNaN(+s))throw new G(`invalid date "${t}"`,n);return s},!0)])},"date"),v.regExp=r(function(t=""){return v.union([v.is(RegExp),v.transform(v.string().role("regexp",{flag:t}),(n,s)=>{try{return new RegExp(n,t)}catch(o){throw new G(o.message,s)}},!0)])},"regExp"),v.arrayBuffer=r(function(t){return v.union([v.is(ArrayBuffer),v.is(SharedArrayBuffer),v.transform(v.any(),(n,s)=>{if(ye.isSource(n))return ye.fromSource(n);throw new G(`expected ArrayBufferSource but got ${n}`,s)},!0),...t?[v.transform(v.string(),(n,s)=>{try{return t==="base64"?ye.fromBase64(n):ye.fromHex(n)}catch(o){throw new G(o.message,s)}},!0)]:[]])},"arrayBuffer"),v.extend("lazy",(e,t,n,s)=>(t.inner[ht]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),v.resolve(e,t.inner,n,s))),v.extend("any",e=>[e]),v.extend("never",(e,t,n)=>{throw new G(`expected nullable but got ${e}`,n)}),v.extend("const",(e,{value:t},n)=>{if(et(e,t))return[t];throw new G(`expected ${t} but got ${e}`,n)});function jt(e,t,n,s,o=!1){const{max:a=1/0,min:l=-1/0}=t;if(e>a)throw new G(`expected ${n} <= ${a} but got ${e}`,s);if(e<l&&!o)throw new G(`expected ${n} >= ${l} but got ${e}`,s)}r(jt,"checkWithinRange"),v.extend("string",(e,{meta:t},n)=>{if(typeof e!="string")throw new G(`expected string but got ${e}`,n);if(t.pattern){const s=new RegExp(t.pattern.source,t.pattern.flags);if(!s.test(e))throw new G(`expect string to match regexp ${s}`,n)}return jt(e.length,t,"string length",n),[e]});function It(e,t){const n=e.toString();if(n.includes("e"))return e*Math.pow(10,t);const s=n.indexOf(".");if(s===-1)return e*Math.pow(10,t);const o=n.slice(s+1),a=n.slice(0,s);return o.length<=t?+(a+o.padEnd(t,"0")):+(a+o.slice(0,t)+"."+o.slice(t))}r(It,"decimalShift");function mr(e,t,n){if(n=Math.abs(n),!/^\d+\.\d+$/.test(n.toString()))return(e-t)%n===0;const s=n.toString().indexOf("."),o=n.toString().slice(s+1).length;return Math.abs(It(e,o)-It(t,o))%It(n,o)===0}r(mr,"isMultipleOf"),v.extend("number",(e,{meta:t},n)=>{if(typeof e!="number")throw new G(`expected number but got ${e}`,n);jt(e,t,"number",n);const{step:s}=t;if(s&&!mr(e,t.min??0,s))throw new G(`expected number multiple of ${s} but got ${e}`,n);return[e]}),v.extend("boolean",(e,t,n)=>{if(typeof e=="boolean")return[e];throw new G(`expected boolean but got ${e}`,n)}),v.extend("bitset",(e,{bits:t,meta:n},s)=>{let o=0,a=[];if(typeof e=="number"){o=e;for(const l in t)e&t[l]&&a.push(l)}else if(Array.isArray(e)){a=e;for(const l of a){if(typeof l!="string")throw new G(`expected string but got ${l}`,s);l in t&&(o|=t[l])}}else throw new G(`expected number or array but got ${e}`,s);return o===n.default?[o]:[o,a]}),v.extend("function",(e,t,n)=>{if(typeof e=="function")return[e];throw new G(`expected function but got ${e}`,n)}),v.extend("is",(e,{constructor:t},n)=>{if(typeof t=="function"){if(e instanceof t)return[e];throw new G(`expected ${t.name} but got ${e}`,n)}else{if(oe(e))throw new G(`expected ${t} but got ${e}`,n);let s=Object.getPrototypeOf(e);for(;s;){if(s.constructor?.name===t)return[e];s=Object.getPrototypeOf(s)}throw new G(`expected ${t} but got ${e}`,n)}});function mt(e,t,n,s){try{const[o,a]=v.resolve(e[t],n,{...s,path:[...s.path||[],t]});return a!==void 0&&(e[t]=a),o}catch(o){if(!s?.autofix)throw o;return delete e[t],n.meta.default}}r(mt,"property"),v.extend("array",(e,{inner:t,meta:n},s)=>{if(!Array.isArray(e))throw new G(`expected array but got ${e}`,s);return jt(e.length,n,"array length",s,!oe(t.meta.default)),[e.map((o,a)=>mt(e,a,t,s))]}),v.extend("dict",(e,{inner:t,sKey:n},s,o)=>{if(!St(e))throw new G(`expected object but got ${e}`,s);const a={};for(const l in e){let c;try{c=v.resolve(l,n,s)[0]}catch(d){if(o)continue;throw d}a[c]=mt(e,l,t,s),e[c]=e[l],l!==c&&delete e[l]}return[a]}),v.extend("tuple",(e,{list:t},n,s)=>{if(!Array.isArray(e))throw new G(`expected array but got ${e}`,n);const o=t.map((a,l)=>mt(e,l,a,n));return s?[o]:(o.push(...e.slice(t.length)),[o])});function Nt(e,t){for(const n in t)n in e||(e[n]=t[n])}r(Nt,"merge"),v.extend("object",(e,{dict:t},n,s)=>{if(!St(e))throw new G(`expected object but got ${e}`,n);const o={};for(const a in t){const l=mt(e,a,t[a],n);(!oe(l)||a in e)&&(o[a]=l)}return s||Nt(o,e),[o]}),v.extend("union",(e,{list:t,toString:n},s,o)=>{const a=[];for(const l of t)try{return v.resolve(e,l,s,o)}catch(c){a.push(c)}throw new G(`expected ${n()} but got ${JSON.stringify(e)}`,s)}),v.extend("intersect",(e,{list:t,toString:n},s,o)=>{if(!t.length)return[e];let a;for(const l of t){const c=v.resolve(e,l,s,!0)[0];if(!oe(c))if(oe(a))a=c;else{if(typeof a!=typeof c)throw new G(`expected ${n()} but got ${JSON.stringify(e)}`,s);if(typeof c=="object")Nt(a??={},c);else if(a!==c)throw new G(`expected ${n()} but got ${JSON.stringify(e)}`,s)}}return!o&&St(e)&&Nt(a,e),[a]}),v.extend("transform",(e,{inner:t,callback:n,preserve:s},o)=>{const[a,l=e]=v.resolve(e,t,o,!0);return s?[n(a)]:[n(a),n(l)]});const hn={};function Y(e,t,n){hn[e]=n,Object.assign(v,{[e](...s){const o=new v({type:e});return t.forEach((a,l)=>{switch(a){case"sKey":o.sKey=s[l]??v.string();break;case"inner":o.inner=v.from(s[l]);break;case"list":o.list=s[l].map(v.from);break;case"dict":o.dict=Re(s[l],v.from);break;case"bits":o.bits={};for(const c in s[l])typeof s[l][c]=="number"&&(o.bits[c]=s[l][c]);break;case"callback":{const c=o.callback=s[l];c.toJSON||=()=>c.toString();break}case"constructor":{const c=o.constructor=s[l];typeof c=="function"&&(c.toJSON||=()=>c.name);break}default:o[a]=s[l]}}),e==="object"||e==="dict"?o.meta.default={}:e==="array"||e==="tuple"?o.meta.default=[]:e==="bitset"&&(o.meta.default=0),o}})}r(Y,"defineMethod"),Y("is",["constructor"],({constructor:e})=>typeof e=="function"?e.name:e),Y("any",[],()=>"any"),Y("never",[],()=>"never"),Y("const",["value"],({value:e})=>typeof e=="string"?JSON.stringify(e):e),Y("string",[],()=>"string"),Y("number",[],()=>"number"),Y("boolean",[],()=>"boolean"),Y("bitset",["bits"],()=>"bitset"),Y("function",[],()=>"function"),Y("array",["inner"],({inner:e})=>`${e.toString(!0)}[]`),Y("dict",["inner","sKey"],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),Y("tuple",["list"],({list:e})=>`[${e.map(t=>t.toString()).join(", ")}]`),Y("object",["dict"],({dict:e})=>Object.keys(e).length===0?"{}":`{ ${Object.entries(e).map(([t,n])=>`${t}${n.meta.required?"":"?"}: ${n.toString()}`).join(", ")} }`),Y("union",["list"],({list:e},t)=>{const n=e.map(({toString:s})=>s()).join(" | ");return t?`(${n})`:n}),Y("intersect",["list"],({list:e})=>`${e.map(t=>t.toString(!0)).join(" & ")}`),Y("transform",["inner","callback","preserve"],({inner:e},t)=>e.toString(t));const fr="ui-conversation",mn="busyEnter",gr=["queue","steer"],fn="queue";v.object({[mn]:v.union([...gr]).default(fn)});var vr=class{static{r(this,"ComposerSubmissionPolicy")}busyEnter=(0,D.createSnapshotStore)(fn);host;constructor(e){this.host=e,e!==void 0&&(e.subscribe(()=>{this.adopt(e)}),this.adopt(e))}resolve(e,t,n){if(!e||!n)return"queue";const s=this.busyEnter.getSnapshot();return t==="enter"?s:s==="queue"?"steer":"queue"}setBusyEnter(e){this.busyEnter.getSnapshot()!==e&&(this.busyEnter.set(e),this.host?.set(mn,e))}adopt(e){const t=e.getSnapshot().value;t===void 0||this.busyEnter.getSnapshot()===t.busyEnter||this.busyEnter.set(t.busyEnter)}};function gn(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=gn(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}r(gn,"r");function je(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=gn(e))&&(s&&(s+=" "),s+=t);return s}r(je,"clsx");const vn=/(^|\s)([/@])([\w-]+)/g;function yr(e,t){if(t.size===0||e==="")return[];const n=[];vn.lastIndex=0;let s;for(;(s=vn.exec(e))!==null;){const o=s[2],a=s[3]??"";if(t.get(o)?.includes(a)){const l=s.index+(s[1]?.length??0);n.push({start:l,end:l+1+a.length,trigger:o})}}return n}r(yr,"scanTextRefs");const xr=new Map;function br(e,t=xr){const{draft:n,claim:s,phase:o,occurrences:a}=e,l=(o==="claimed"||o==="submitting")&&s!==void 0&&n.startsWith(s.token),c=l?{start:0,end:s.token.length}:null,d=a.map(f=>({occurrenceId:f.occurrenceId,offset:f.offset,label:f.label,invalid:f.invalid===!0})),u=l&&s.hint!==void 0&&n.slice(s.token.length).trim()===""?s.hint:null;return{token:c,chips:d,textRefs:yr(n,t),hint:u}}r(br,"deriveDecorations");function nt(e){const t=e/1048576;return`${Number.isInteger(t)?String(t):t.toFixed(1)}MB`}r(nt,"imageSizeText");function wr(e,t,n){switch(t){case"MODEL_DOES_NOT_SUPPORT_IMAGES":return e("image.modelUnsupported");case"SUBAGENT_IMAGE_UNSUPPORTED":return e("image.subagentUnsupported");case"IMAGE_TOO_MANY_PIXELS":return e("image.tooManyPixels");case"INVALID_IMAGE":case"IMAGE_TYPE_MISMATCH":return e("image.unsupportedType");case"TOO_MANY_IMAGES":if(n!==void 0)return e("image.tooMany",{count:n.maxImagesPerMessage});break;case"IMAGE_TOO_LARGE":if(n!==void 0)return e("image.fileTooLarge",{size:nt(n.maxImageBytes)});break;case"IMAGES_TOO_LARGE":if(n!==void 0)return e("image.totalTooLarge",{size:nt(n.maxMessageImageBytes)})}return e("image.sendFailed",{reason:t})}r(wr,"attachmentErrorText");function yn(e){return{dialog:e("image.preview"),close:e("image.closePreview")}}r(yn,"lightboxLabels");function xn(e){return{image:e("image.label"),open:e("image.openOriginal"),openNamed:r(t=>e("image.openOriginalLabel",{label:t}),"openNamed"),loading:e("image.loading"),loadFailed:e("image.loadFailed"),lightbox:yn(e)}}r(xn,"messageImageLabels");function kr(e,t,n){return t?{title:e("image.dropTitle"),desc:n===void 0?void 0:e("image.dropDesc",{count:n.count,size:n.size})}:{title:e("image.dropBlocked")}}r(kr,"dropOverlayLabels");function _r(e){return{group:e("image.pending"),open:e("image.openOriginal"),scrollLeft:e("image.scrollLeft"),scrollRight:e("image.scrollRight")}}r(_r,"attachmentRailLabels");function bn(e){return String(e).padStart(2,"0")}r(bn,"pad2");function wn(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}r(wn,"startOfLocalDay");function kn(e){const t=new Date(e);return t.setHours(24,0,0,0),Math.max(t.getTime()-e,1)}r(kn,"msUntilNextLocalMidnight");function _n(e,t){const n=Math.max(0,Math.floor(e/1e3)),s=Math.floor(n/60),o=n%60;return s>0?t("duration.minutes",{minutes:s,seconds:String(o).padStart(2,"0")}):t("duration.seconds",{seconds:o})}r(_n,"formatRunDuration");function Ar(e){const t=Math.max(0,e)/1e3;return t<10?String(Math.round(t*10)/10):String(Math.round(t))}r(Ar,"formatLatencySeconds");function An(e){const t=Math.max(0,e);return t>=10?String(Math.round(t)):String(Math.round(t*10)/10)}r(An,"formatTokensPerSecond");function Sr(e,t,n=Date.now()){const s=new Date(e),o=new Date(n),a=`${bn(s.getHours())}:${bn(s.getMinutes())}`;if(s.getFullYear()===o.getFullYear()&&s.getMonth()===o.getMonth()&&s.getDate()===o.getDate())return a;const l={y:s.getFullYear(),m:s.getMonth()+1,d:s.getDate()};return`${s.getFullYear()===o.getFullYear()?t("clock.md",l):t("clock.ymd",l)} ${a}`}r(Sr,"formatMessageClock");function Cr(e){if(typeof e!="object"||e===null)return null;const t=e.outputTokens;return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null}r(Cr,"usageOutputTokens");function Sn(e){const t=e.timing;return{ttftMs:t!==void 0&&t.stepStartTime!==null&&t.firstTokenTime!==null?Math.max(0,t.firstTokenTime-t.stepStartTime):null,decodeMs:t!==void 0&&t.firstTokenTime!==null?Math.max(0,t.completedTime-t.firstTokenTime):null,outputTokens:Cr(e.usage)}}r(Sn,"assistantStepReading");function jr(e){const t=new Map;for(const s of e){if(s.kind!=="assistant")continue;const o=Sn(s);let a=t.get(s.turn);a===void 0?(a={firstStep:s.step,firstStepTtftMs:o.ttftMs,decodeMs:0,outputTokens:0,sampled:!1},t.set(s.turn,a)):s.step<a.firstStep&&(a.firstStep=s.step,a.firstStepTtftMs=o.ttftMs),o.decodeMs!==null&&o.outputTokens!==null&&(a.decodeMs+=o.decodeMs,a.outputTokens+=o.outputTokens,a.sampled=!0)}const n=new Map;for(const[s,o]of t){const a={};o.firstStepTtftMs!==null&&(a.ttftMs=o.firstStepTtftMs),o.sampled&&o.decodeMs>0&&(a.tokensPerSecond=o.outputTokens/(o.decodeMs/1e3)),(a.ttftMs!==void 0||a.tokensPerSecond!==void 0)&&n.set(s,a)}return n}r(jr,"deriveTurnMetrics");const Ir="._86-6hq_root{text-align:center;max-width:var(--dsh-chat-content-width);box-sizing:border-box;width:100%;padding:4px calc(var(--dsh-composer-side-clearance) + 16px) 0px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;margin:0 auto;font-size:12px;line-height:20px;display:block;overflow:hidden}._86-6hq_sep{color:var(--dsw-alias-separator-primary);margin:0 10px}",Cn="@deepseek-ai/dsh-client-ui-conversation/StatsLine.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Cn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Cn,e.textContent=Ir,document.head.appendChild(e)}var jn={root:"_86-6hq_root",sep:"_86-6hq_sep"};function Nr(e){const t=new Set;let n=0,s=0,o=0,a=0,l=0,c=0,d=0;for(const u of e){if(u.kind==="tool-result"){u.callTime!==null&&(o+=Math.max(0,u.time-u.callTime));continue}if(u.kind!=="assistant")continue;t.add(u.turn),n+=1,u.timing!==void 0&&u.timing.stepStartTime!==null&&(s+=Math.max(0,u.timing.completedTime-u.timing.stepStartTime));const f=Sn(u);f.ttftMs!==null&&(a+=f.ttftMs,l+=1),f.decodeMs!==null&&f.outputTokens!==null&&(c+=f.decodeMs,d+=f.outputTokens)}return{turns:t.size,steps:n,llmMs:s,toolMs:o,ttftMs:a,ttftSteps:l,decodeMs:c,decodeTokens:d}}r(Nr,"deriveStats");function st(e){const t=r(n=>n>=100?String(Math.round(n)):String(Math.round(n*10)/10),"scaled");return e<1e3?String(e):e<1e6?`${t(e/1e3)}K`:`${t(e/1e6)}M`}r(st,"formatTokens");function Et(e){const t=e/1e3;if(t<60)return`${Math.round(t*10)/10}s`;const n=Math.round(t);return`${Math.floor(n/60)}m${n%60}s`}r(Et,"formatDuration");function Er(e){const t=Tt(e);return t===0?null:Math.round(e.cacheReadTokens/t*100)}r(Er,"cacheHitPercent");function Tt(e){return e.uncachedInputTokens+e.cacheReadTokens+e.cacheWriteTokens}r(Tt,"billedInputTokens");function Tr(e){const t=e?.projectedTokens??e?.pressureTokens;return t===void 0||e?.contextWindow===void 0?null:{percent:Math.min(100,Math.round(t/e.contextWindow*100)),usedTokens:t,contextWindow:e.contextWindow}}r(Tr,"contextOccupancy");const qr=(0,h.memo)(r(function({useSession:t,useProjection:n,t:s}){const o=t(g=>g.chat.legacy.nodes),a=n("tokenUsage"),l=n("sessionStats"),c=(0,h.useMemo)(()=>l??Nr(o),[l,o]),d=[];if(c.steps>0){d.push(s("stats.counts",{turns:c.turns,steps:c.steps}));const g=[];c.llmMs>0&&g.push(s("stats.llm",{duration:Et(c.llmMs)})),c.toolMs>0&&g.push(s("stats.toolCall",{duration:Et(c.toolMs)})),g.length>0&&d.push(g.join(" · "));const y=[];c.ttftSteps>0&&y.push(s("stats.ttftAverage",{duration:Et(c.ttftMs/c.ttftSteps)})),c.decodeMs>0&&y.push(s("stats.tokensPerSecond",{throughput:An(c.decodeTokens/(c.decodeMs/1e3))})),y.length>0&&d.push(y.join(" · "))}if(a!==void 0&&(Tt(a)>0||a.outputTokens>0)){const g=Er(a);g!==null&&d.push(s("stats.cacheHit",{percent:g})),d.push(s("stats.tokens",{input:st(Tt(a)),output:st(a.outputTokens)}))}const u=d.join(" | "),f=(0,h.useRef)(null),[m,k]=(0,h.useState)(!1);return(0,h.useLayoutEffect)(()=>{const g=f.current;if(g===null)return;const y=r(()=>{k(g.scrollWidth>g.clientWidth)},"measure");if(y(),typeof ResizeObserver>"u")return;const b=new ResizeObserver(y);return b.observe(g),()=>{b.disconnect()}},[u]),d.length===0?null:(0,i.jsx)(_.Tooltip,{label:u,side:"top",delayMs:500,disabled:!m,children:(0,i.jsx)("div",{ref:f,className:jn.root,children:d.map((g,y)=>(0,i.jsxs)(h.Fragment,{children:[y>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:jn.sep,"aria-hidden":!0,children:"|"})," "]}),(0,i.jsx)("span",{children:g})]},g))})})},"StatsLine")),Rr="._3Gutda_root{display:inline-flex;position:relative}._3Gutda_trigger{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;display:grid}._3Gutda_trigger:hover{background:var(--dsw-alias-interactive-bg-hover)}._3Gutda_track{fill:none;stroke:var(--dsw-alias-border-l3);stroke-width:2px}._3Gutda_fill{fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:2px;stroke-linecap:round}._3Gutda_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-inverted);background:var(--dsw-specific-menu);width:264px;box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-secondary);cursor:default;border-radius:12px;padding:12px;font-size:12px;line-height:20px;position:absolute;bottom:calc(100% + 8px);right:0}._3Gutda_header{align-items:center;gap:6px;display:flex}._3Gutda_figures{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin-left:auto;font-weight:500}._3Gutda_percent{color:var(--dsw-alias-label-primary);font-weight:500}._3Gutda_headline{color:var(--dsw-alias-label-tertiary)}._3Gutda_headline:empty{display:none}._3Gutda_bar{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;gap:1px;height:4px;margin:10px 0 12px;display:flex;overflow:hidden}._3Gutda_segment{background:var(--meter-tint,var(--dsw-alias-label-tertiary));border-radius:1px;flex:none;min-width:2px;height:100%}._3Gutda_swatch{background:var(--meter-tint);vertical-align:baseline;border-radius:2px;width:8px;height:8px;margin-right:6px;display:inline-block}._3Gutda_colorSystem{--meter-tint:var(--dsw-static-neutral-bluish-400)}._3Gutda_colorTools{--meter-tint:#a78bfa}._3Gutda_colorMessages{--meter-tint:var(--dsw-static-blue-450)}._3Gutda_rows{margin:6px 0 0}._3Gutda_row{justify-content:space-between;align-items:center;gap:12px;padding:2px 0;display:flex}._3Gutda_row dt{color:var(--dsw-alias-label-secondary)}._3Gutda_row dd{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin:0}",In="@deepseek-ai/dsh-client-ui-conversation/ContextMeter.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(In)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=In,e.textContent=Rr,document.head.appendChild(e)}var K={root:"_3Gutda_root",colorSystem:"_3Gutda_colorSystem",track:"_3Gutda_track",swatch:"_3Gutda_swatch",colorMessages:"_3Gutda_colorMessages",headline:"_3Gutda_headline",row:"_3Gutda_row",fill:"_3Gutda_fill",figures:"_3Gutda_figures",segment:"_3Gutda_segment",percent:"_3Gutda_percent",panel:"_3Gutda_panel",trigger:"_3Gutda_trigger",rows:"_3Gutda_rows",bar:"_3Gutda_bar",header:"_3Gutda_header",colorTools:"_3Gutda_colorTools"};const qt=5.5,Nn=2*Math.PI*qt,En="\0",Tn=[{key:"systemTokens",label:"context.system",color:K.colorSystem},{key:"toolsTokens",label:"context.tools",color:K.colorTools},{key:"messageTokens",label:"context.messages",color:K.colorMessages}];function Mr({useProjection:e,t}){const n=e("contextPressure"),s=e("contextBreakdown"),[o,a]=(0,h.useState)(!1),l=(0,h.useRef)(null),c=Tr(n),d=c!==null;if((0,h.useEffect)(()=>{!d&&o&&a(!1)},[d,o]),(0,h.useEffect)(()=>{if(!o||!d)return;const b=r(j=>{j.target instanceof Node&&l.current?.contains(j.target)===!0||a(!1)},"onPointerDown"),w=r(j=>{j.key==="Escape"&&a(!1)},"onKeyDown");return document.addEventListener("pointerdown",b),document.addEventListener("keydown",w),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("keydown",w)}},[d,o]),c===null)return null;const u=c.percent,f=`${u}%`,[m="",k=""]=t("context.aria",{percent:En}).split(En).map(b=>b.trim()),g=s===void 0?0:s.systemTokens+s.toolsTokens+s.messageTokens,y=(s===void 0||g===0?[{key:"total",color:void 0,width:u}]:Tn.map(b=>({key:b.key,color:b.color,width:u*s[b.key]/g}))).filter(b=>b.width>0);return(0,i.jsxs)("span",{ref:l,className:K.root,children:[(0,i.jsx)(_.Tooltip,{label:t("context.aria",{percent:f}),side:"top",delayMs:200,disabled:o,children:(0,i.jsx)("button",{type:"button",className:K.trigger,"aria-label":t("context.aria",{percent:f}),"aria-haspopup":"dialog","aria-expanded":o,onClick:r(()=>{a(!o)},"onClick"),children:(0,i.jsxs)("svg",{viewBox:"0 0 14 14",width:"14",height:"14","aria-hidden":!0,children:[(0,i.jsx)("circle",{className:K.track,cx:"7",cy:"7",r:qt}),(0,i.jsx)("circle",{className:K.fill,cx:"7",cy:"7",r:qt,strokeDasharray:`${Nn*u/100} ${Nn}`,transform:"rotate(-90 7 7)"})]})})}),o&&(0,i.jsxs)("div",{className:K.panel,role:"dialog","aria-label":t("context.used"),children:[(0,i.jsxs)("div",{className:K.header,children:[(0,i.jsx)("span",{className:K.headline,children:m}),(0,i.jsx)("span",{className:K.percent,children:f}),(0,i.jsx)("span",{className:K.headline,children:k}),(0,i.jsx)("span",{className:K.figures,children:`~${st(c.usedTokens)} / ${st(c.contextWindow)}`})]}),(0,i.jsx)("div",{className:K.bar,children:y.map(b=>(0,i.jsx)("div",{className:b.color===void 0?K.segment:`${K.segment} ${b.color}`,style:{width:`${b.width}%`}},b.key))}),s!==void 0&&(0,i.jsx)("dl",{className:K.rows,children:Tn.map(b=>(0,i.jsxs)("div",{className:K.row,children:[(0,i.jsxs)("dt",{children:[(0,i.jsx)("span",{className:`${K.swatch} ${b.color}`,"aria-hidden":!0}),t(b.label)]}),(0,i.jsx)("dd",{children:`~${st(s[b.key])}`})]},b.key))})]})]})}r(Mr,"ContextMeter");const Wr=".fGWvBG_trigger{min-width:0;max-width:220px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:24px;outline:none;align-items:center;gap:4px;padding:0 4px 0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.fGWvBG_trigger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.fGWvBG_trigger:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-border-l3)}.fGWvBG_trigger:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.fGWvBG_triggerIcon{flex:none;display:inline-flex}.fGWvBG_triggerIcon svg{width:14px;height:14px}.fGWvBG_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.fGWvBG_chevron{color:var(--dsw-alias-label-caption);flex:none;transition:transform .12s;display:inline-flex}@container (width<=460px){.fGWvBG_trigger:has(.fGWvBG_triggerIcon) .fGWvBG_triggerLabel{display:none}}.fGWvBG_chevronOpen{transform:rotate(180deg)}",qn="@deepseek-ai/dsh-client-ui-conversation/PermissionSelect.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(qn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=qn,e.textContent=Wr,document.head.appendChild(e)}var rt={triggerLabel:"fGWvBG_triggerLabel",trigger:"fGWvBG_trigger",chevron:"fGWvBG_chevron",chevronOpen:"fGWvBG_chevronOpen",triggerIcon:"fGWvBG_triggerIcon"};const Rt="danger-full-access",Rn="M8.20554 0.899994L14.7901 3.36857V7.01026C14.7901 12 11.0466 14.2103 8.20554 15.3C5.36446 14.2103 1.62012 12 1.62012 7.01026V3.36857L8.20554 0.899994Z",Gr={"read-only":(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:[(0,i.jsx)("path",{d:Rn,stroke:"currentColor",strokeWidth:"1.31831",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M12.1654 5.7552L8.9447 9.41475C8.73044 9.65816 8.53628 9.8804 8.35774 10.0423C8.1713 10.2114 7.94235 10.3717 7.64016 10.4254C7.48207 10.4535 7.32 10.4552 7.16151 10.4294C6.85843 10.3801 6.62728 10.2223 6.43836 10.0559C6.25752 9.89653 6.06037 9.67732 5.84264 9.43705L4.72925 8.20897L5.63557 7.38707L6.74897 8.61594C6.98603 8.87755 7.12974 9.03533 7.24673 9.13839C7.31033 9.19443 7.34485 9.21476 7.35823 9.22122C7.38068 9.22484 7.40352 9.22515 7.42593 9.22122C7.40522 9.22502 7.42893 9.23294 7.53583 9.136C7.65132 9.03126 7.79316 8.87139 8.02643 8.60638L11.2479 4.94763L12.1654 5.7552Z",fill:"currentColor"})]}),"workspace-write":(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:[(0,i.jsx)("path",{d:"M8.08887 0.251709C8.20479 0.23085 8.32486 0.241168 8.43652 0.282959L15.0215 2.75171C15.2787 2.84819 15.4492 3.09414 15.4492 3.3689V7.0105C15.4492 7.10986 15.4441 7.2081 15.4414 7.30542C15.0285 7.07175 14.5905 6.87695 14.1309 6.73022V3.82495L8.20508 1.60327L2.2793 3.82495V7.0105C2.27936 9.7171 3.4745 11.5379 5.02734 12.7947C5.01025 12.9942 5 13.1962 5 13.4001C5.00001 13.7617 5.02722 14.1169 5.08008 14.4636C2.91555 13.0393 0.961014 10.752 0.960938 7.0105V3.3689C0.960938 3.09417 1.13146 2.84821 1.38867 2.75171L7.97461 0.282959L8.08887 0.251709Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M11.3525 5.64688V6.85688H5V5.64688H11.3525Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M9.5824 8.29376V9.50376H5V8.29376H9.5824Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M14.6647 15.6852H10.0338C10.3878 15.3751 10.7567 15.0517 11.0772 14.7706C11.2531 14.6164 11.4144 14.4746 11.5511 14.3547H14.6647V15.6852Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M8.14852 14.1308L7.33925 15.4976C7.22458 15.6912 7.42245 15.9194 7.63037 15.8333L9.09785 15.2254L15.0399 10.0719L14.0905 8.97733L8.14852 14.1308Z",fill:"currentColor"})]}),[Rt]:(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:[(0,i.jsx)("path",{d:Rn,stroke:"currentColor",strokeWidth:"1.31831",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M9.10094 4.5V8.75939H7.59888V4.5H9.10094Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M9.10094 9.8114V11.5H7.59888V9.8114H9.10094Z",fill:"currentColor"})]})};function Mt(e){return Gr[e]}r(Mt,"permissionGlyph");function Wt(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)?e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "):e}r(Wt,"displayName");function Gt(e){return e.value===Rt?"Full access":Wt(e.name)}r(Gt,"optionLabel");function Or({value:e,locked:t,command:n,t:s}){const[o,a]=(0,h.useState)(null),[l,c]=(0,h.useState)(!1),[d,u]=(0,h.useState)(null),[f,m]=(0,h.useState)(!1);if((0,h.useEffect)(()=>{!t&&e!==void 0||(c(!1),m(!1),u(null))},[t,e]),e===void 0)return null;const k=o??e.currentValue,g=e.options.find(S=>S.value===k),y=o!==null||d!==null,b=e.options.filter(S=>S.value!=="custom").map(S=>{const z=Mt(S.value);return{id:S.value,label:Gt(S),...z===void 0?{}:{icon:z}}}),w=r(S=>{a(S),n(`/permission ${S}`).catch(()=>!1).then(()=>{a(null)})},"submit"),j=r(S=>{if(c(!1),S!==e.currentValue){if(S===Rt){m(!1),u(S);return}w(S)}},"choose"),x=r(()=>{m(!1),u(null)},"closeConfirmation"),A=r(()=>{if(t||!f||d===null)return;const S=d;x(),w(S)},"confirmFullAccess");return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_.Menu,{open:l,items:b,selectedId:k,onSelect:j,onClose:r(()=>{c(!1)},"onClose"),side:"top",anchor:(0,i.jsxs)("button",{type:"button",className:rt.trigger,"aria-label":s("input.accessMode",{name:g===void 0?Wt(k):Gt(g)}),title:g?.description,disabled:t||y,onClick:r(()=>{c(!l)},"onClick"),children:[Mt(k)!==void 0&&(0,i.jsx)("span",{className:rt.triggerIcon,"aria-hidden":!0,children:Mt(k)}),(0,i.jsx)("span",{className:rt.triggerLabel,children:g===void 0?Wt(k):Gt(g)}),(0,i.jsx)("span",{className:je(rt.chevron,l&&rt.chevronOpen),"aria-hidden":!0,children:(0,i.jsx)(_.IconChevronDownOutline14,{})})]})}),(0,i.jsx)(_.RiskConfirmation,{open:d!==null,title:s("access.confirm.title"),description:s("access.confirm.description"),acknowledgeLabel:s("access.confirm.acknowledge"),cancelLabel:s("access.confirm.cancel"),confirmLabel:s("access.confirm.enable"),acknowledged:f,disabled:t,onAcknowledgedChange:m,onCancel:x,onConfirm:A})]})}r(Or,"PermissionSelect");const Lr=`@font-face{font-family:DshChipCell;src:url(data:font/ttf;base64,AAEAAAAKAIAAAwAgT1MvMkT8SmIAAAEoAAAAYGNtYXAADQBPAAABkAAAADRnbHlmAAAAAAAAAcwAAAABaGVhZCwtPGoAAACsAAAANmhoZWEDIg7bAAAA5AAAACRobXR4EZQAAAAAAYgAAAAIbG9jYQAAAAAAAAHEAAAABm1heHAAAwACAAABCAAAACBuYW1lvljk2gAAAdAAAABscG9zdNNweNQAAAI8AAAALQABAAAAAQAAdia1tV8PPPUAAwPoAAAAAOaLfcUAAAAA5ot9xQAAAAAAAAAAAAAAAwACAAAAAAAAAAEAAAMg/zgAAA+gAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAEAAAACAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAwjKAZAABQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAPz8/PwAA//z//AMg/zgAAAMgAMgAAAAAAAAAAAAAAAAAAAAgAAAB9AAAD6AAAAAAAAIAAAADAAAAFAADAAEAAAAUAAQAIAAAAAQABAABAAD//P//AAD//P//AAUAAQAAAAAAAAAAAAAAAAAAAAAAAAAEADYAAQAAAAAAAQALAAAAAQAAAAAAAgAHAAsAAwABBAkAAQAWABIAAwABBAkAAgAOAChEc2hDaGlwQ2VsbFJlZ3VsYXIARABzAGgAQwBoAGkAcABDAGUAbABsAFIAZQBnAHUAbABhAHIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAABAgZvYmpyZXAAAAA=)format("truetype")}.ICfoyq_root{padding:0 var(--dsh-composer-side-clearance);flex-direction:column;align-items:center;display:flex}.ICfoyq_hero{padding:0 var(--dsh-composer-side-clearance)}.ICfoyq_notice{width:100%;max-width:var(--dsh-composer-card-max-width);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);border-radius:8px;margin-bottom:6px;padding:4px 8px;font-size:12px;line-height:18px}.ICfoyq_noticeError{background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary)}.ICfoyq_card{box-sizing:border-box;width:100%;max-width:var(--dsh-composer-card-max-width);border:1px solid var(--dsw-alias-border-l2-darkmode-thin);background:var(--dsw-specific-input-major);box-shadow:var(--dsw-shadow-lv2);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:22px;flex-direction:column;gap:12px;padding-top:10px;font-size:16px;line-height:24px;display:flex;position:relative}.ICfoyq_cardWorkspaceTrigger{cursor:pointer;border-color:#0000}.ICfoyq_cardWorkspaceTrigger:after{content:"";background:var(--dsw-alias-border-l4);pointer-events:none;border-radius:22px;transition:background-color .1s;position:absolute;inset:-1px;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='none' rx='22' ry='22' stroke='black' stroke-width='2' stroke-dasharray='4 4'/%3E%3C/svg%3E");mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='none' rx='22' ry='22' stroke='black' stroke-width='2' stroke-dasharray='4 4'/%3E%3C/svg%3E")}.ICfoyq_cardWorkspaceTrigger :disabled{pointer-events:none}.ICfoyq_cardWorkspaceTrigger:hover:after{background:var(--dsw-alias-state-business-primary)}.ICfoyq_accessory{align-items:center;gap:8px;padding:10px 12px 0;display:flex}.ICfoyq_attachments{min-width:0;padding:4px 12px 0}.ICfoyq_overlayAnchor{height:0;position:absolute;inset:0 0 auto}.ICfoyq_scroll{max-height:var(--dsh-composer-text-max-height);overflow-y:auto}.ICfoyq_grow{position:relative}.ICfoyq_backdrop{color:var(--dsw-alias-label-primary);pointer-events:none;position:absolute;inset:0;overflow:hidden}.ICfoyq_hlToken{color:var(--dsw-alias-state-warn-label);background-color:#0000}.ICfoyq_hlSegment{color:#0000;background-color:#0000;border-radius:4px}.ICfoyq_hint{color:var(--dsw-alias-label-caption)}.ICfoyq_pending{background:var(--dsw-alias-state-business-primary);border-radius:50%;width:8px;height:8px;animation:1s ease-in-out infinite alternate ICfoyq_input-pending}@keyframes ICfoyq_input-pending{0%{opacity:.35}to{opacity:1}}.ICfoyq_input{resize:none;color:#0000;width:100%;height:100%;caret-color:var(--dsw-alias-state-business-primary);background:0 0;border:none;outline:none;position:absolute;inset:0;overflow:hidden}.ICfoyq_input,.ICfoyq_mirror,.ICfoyq_backdrop{box-sizing:border-box;font-family:"DshChipCell", var(--dsw-font-family);font-size:inherit;line-height:inherit;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;padding:4px 12px 0 16px}.ICfoyq_input::placeholder{color:var(--dsw-alias-label-caption);user-select:none}.ICfoyq_input:disabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}.ICfoyq_input[aria-haspopup=menu]{cursor:pointer}.ICfoyq_mirror{visibility:hidden;pointer-events:none}.ICfoyq_hero .ICfoyq_mirror{min-height:52px}.ICfoyq_row{justify-content:space-between;align-items:center;gap:12px;min-width:0;padding:2px 8px 6px;display:flex;container-type:inline-size}.ICfoyq_tools,.ICfoyq_modes,.ICfoyq_trailing{align-items:center;min-width:0;display:flex}.ICfoyq_tools{gap:16px}.ICfoyq_modes{gap:12px}.ICfoyq_trailing{flex:none;gap:12px}.ICfoyq_add{background:var(--dsw-specific-selector);width:28px;height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;display:grid}.ICfoyq_add:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.ICfoyq_add:disabled{opacity:.5;cursor:default}.ICfoyq_select{max-width:220px;height:28px;color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;appearance:none;background-color:#0000;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-position:right 4px center;background-repeat:no-repeat;background-size:12px 12px;border:none;border-radius:8px;outline:none;padding:0 20px 0 8px;font-size:13px;font-weight:500;line-height:20px}.ICfoyq_select:hover:not(:disabled){background-color:var(--dsw-alias-interactive-bg-hover)}.ICfoyq_select:disabled{opacity:.5;cursor:default}.ICfoyq_primary{background:var(--dsw-alias-button-info-fill);color:#fff;cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;width:34px;height:34px;transition:background-color .1s;display:grid;transform:translateY(-2px)}.ICfoyq_primary:hover:not(:disabled){background:var(--dsw-alias-button-info-hover)}.ICfoyq_primary:disabled{opacity:.4;cursor:default}.ICfoyq_retry{color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:4px;margin-left:8px;padding:1px 8px;font-size:12px}.ICfoyq_textRef{color:var(--dsw-alias-state-business-primary);-webkit-box-decoration-break:clone;box-decoration-break:clone;background-color:#0000}.ICfoyq_textRef:after{display:none}.ICfoyq_chip{background:#6187d838;border-radius:6px;position:relative}.ICfoyq_chip:before{content:"";color:#0000}.ICfoyq_chipLabel{width:calc(138.889% - 10px);color:var(--dsw-alias-label-primary);white-space:nowrap;justify-content:center;align-items:center;display:flex;position:absolute;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)scale(.72)}.ICfoyq_chipInvalid{opacity:.7;background:#d8616133;text-decoration:line-through}`,Mn="@deepseek-ai/dsh-client-ui-conversation/InputBar.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Mn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Mn,e.textContent=Lr,document.head.appendChild(e)}var B={add:"ICfoyq_add",tools:"ICfoyq_tools",modes:"ICfoyq_modes","input-pending":"ICfoyq_input-pending",notice:"ICfoyq_notice",select:"ICfoyq_select",attachments:"ICfoyq_attachments",trailing:"ICfoyq_trailing",overlayAnchor:"ICfoyq_overlayAnchor",chipInvalid:"ICfoyq_chipInvalid",chipLabel:"ICfoyq_chipLabel",row:"ICfoyq_row",chip:"ICfoyq_chip",accessory:"ICfoyq_accessory",retry:"ICfoyq_retry",hlToken:"ICfoyq_hlToken",backdrop:"ICfoyq_backdrop",grow:"ICfoyq_grow",root:"ICfoyq_root",scroll:"ICfoyq_scroll",hlSegment:"ICfoyq_hlSegment",pending:"ICfoyq_pending",input:"ICfoyq_input",textRef:"ICfoyq_textRef",hero:"ICfoyq_hero",primary:"ICfoyq_primary",card:"ICfoyq_card",cardWorkspaceTrigger:"ICfoyq_cardWorkspaceTrigger",hint:"ICfoyq_hint",noticeError:"ICfoyq_noticeError",mirror:"ICfoyq_mirror"};const Dr={token:null,chips:[],textRefs:[],hint:null};function Br({useSession:e,useInput:t,inputActions:n,keyboard:s,addImages:o,removeImage:a,draftImages:l,resolveSubmitMode:c,toggleCommandMenu:d,stop:u,command:f,t:m,renderSlot:k,useNotices:g,useLexicon:y,useMenuLauncher:b,useProjection:w,sessionId:j,variant:x,disabled:A=!1,blocked:S,workspacePickerOpen:z=!1,onRequestWorkspace:ne,placeholder:Ee,accessory:he,overlay:Xe,leftItems:Z,rightItems:Ge,footer:be}){const O=t(p=>p),Q=g(p=>p),me=y(p=>p),se=b(p=>p==="command"),ee=e(p=>p.promptError)??null,Te=e(p=>p.running)??!1,pe=e(p=>p.subagent)??null,fe=e(p=>p.removed)??!1,Oe=w("plan",p=>p!==void 0&&(p.pending?!p.active:p.active)),Ve=w("goal",p=>p!=null),E=O!==void 0&&s!==void 0&&n!==void 0,L=O?.draft??"",de=(0,h.useMemo)(()=>O===void 0||l===void 0?[]:l(O.imageIds),[l,O?.imageIds]),we=L.trim()===""&&de.length===0,[ge,Le]=(0,h.useState)(null),[bt,He]=(0,h.useState)(!1),[lt,C]=(0,h.useState)(null),q=(0,h.useRef)(0),J=(0,h.useCallback)(p=>{q.current+=1,C({seq:q.current,text:p})},[]),ke=(0,h.useCallback)(()=>{C(null)},[]),F=w("imageLimits");(0,h.useEffect)(()=>{ee!==null&&J(ee.error.code==="attachment-error"?wr(m,ee.error.details.reason,F):`${ee.error.message} (${ee.error.code})`)},[ee,J,m,F]);const X=(0,h.useRef)(null),De=(0,h.useRef)(null),_e=(0,h.useRef)(0),Ye=(0,h.useRef)(null),$s=(0,h.useRef)(null),Ht=(0,h.useRef)(!1),Za=r(()=>{Ht.current=!0},"onCompositionStart"),el=r(()=>{setTimeout(()=>{Ht.current=!1},10)},"onCompositionEnd"),tl=w("permissions"),Us=pe?.address.mode==="continuable",Ps=Us&&!pe.parentAvailable,wt=fe||A||!E||S!==void 0||Ps,re=wt,nl=fe||A||!E,Ae=O?.phase==="adjudicating"||O?.phase==="submitting",qe=A&&!fe&&ne!==void 0,sl=fe||re&&!qe,zs=!re&&!Ae&&!se&&we&&Te&&pe===null&&O.queue.some(p=>p.placement==="queued");(0,h.useEffect)(()=>{O===void 0||n===void 0||de.length!==O.imageIds.length&&n.pruneImages(de.map(p=>p.id))},[de,O?.imageIds,n]),(0,h.useEffect)(()=>{ge!==null&&!de.some(p=>p.id===ge.id)&&Le(null)},[de,ge]);const Fs=r(p=>{const N=Ye.current,W=$s.current,I=W?.firstChild;if(N===null||W===null||!(I instanceof Text)||N.scrollHeight<=N.clientHeight)return;const M=Math.min(p,I.data.length),H=M>0&&I.data[M-1]===`
2
- `,T=document.createRange();T.setStart(I,H?M-1:M),H?T.setEnd(I,M):T.collapse(!0);const Se=H?Number.parseFloat(getComputedStyle(W).lineHeight):0,ve=T.getBoundingClientRect(),_t=N.getBoundingClientRect();ve.bottom+Se>_t.bottom?N.scrollTop+=ve.bottom+Se-_t.bottom:ve.top+Se<_t.top&&(N.scrollTop-=_t.top-ve.top-Se)},"revealCaret"),Js=r(p=>{const N=p.selectionDirection==="backward"?p.selectionStart:p.selectionEnd;Fs(N??p.value.length)},"revealSelectionFocus");(0,h.useEffect)(()=>{const p=X.current;re||p===null||(p.focus({preventScroll:!0}),Js(p))},[re,j]),(0,h.useEffect)(()=>{const p=X.current;re||L===""||p===null||Js(p)},[L!==""]);const Ks=r((p,N)=>{requestAnimationFrame(()=>{p.setSelectionRange(N,N),Fs(N)})},"restoreCaret");(0,h.useEffect)(()=>{const p=Ye.current;if(p===null)return;const N=r(W=>{const I=p.closest("[data-conversation-scroll]");if(!(I instanceof HTMLElement)||W.deltaY===0)return;const M=p.scrollTop<=0,H=p.scrollTop+p.clientHeight>=p.scrollHeight-1;W.deltaY<0&&!M||W.deltaY>0&&!H||(W.preventDefault(),I.scrollTop+=W.deltaY)},"onWheel");return p.addEventListener("wheel",N,{passive:!1}),()=>{p.removeEventListener("wheel",N)}},[]);const rl=r(p=>{if(qe){(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),ne());return}if(s===void 0||n===void 0||p.key==="Enter"&&p.shiftKey)return;const N=Ht.current||p.nativeEvent.isComposing||p.nativeEvent.keyCode===229;if(p.key==="ArrowUp"||p.key==="ArrowDown"){s.arbitrate(p.key==="ArrowUp"?"up":"down",N)==="consumed"&&p.preventDefault();return}if(p.key==="Escape"){s.dismissPopup(),s.arbitrate("escape",N)==="consumed"&&p.preventDefault();return}if((p.metaKey||p.ctrlKey)&&(p.key==="z"||p.key==="Z"||p.key==="y")){if(p.preventDefault(),Ae||re)return;p.key==="y"||p.shiftKey?s.redo():s.undo();return}if(p.key===" "){if(N)return;s.space()&&p.preventDefault();return}if(p.key!=="Enter"||N)return;if(s.arbitrate("enter",N)!=="pass"){p.preventDefault();return}if(p.preventDefault(),p.repeat||re||Ae)return;const W=p.ctrlKey||p.metaKey;if(W&&zs){s.steerQueue();return}s.submit(c(Te,W?"accelerated":"enter",pe===null))},"onKeyDown"),ol=r(p=>{if(s===void 0||re||Ae)return;const N=p.target.value;s.setDraft(N),s.track(N,p.target.selectionStart??N.length)},"onChange"),Yt=r(p=>({start:p.selectionStart??0,end:p.selectionEnd??p.selectionStart??0}),"selectionOf"),Xs=r((p,N)=>{if(O===void 0||s===void 0)return;const W=p.currentTarget,{start:I,end:M}=Yt(W);if(I===M)return;L.slice(I,M);const H=O.occurrences.filter(ve=>ve.offset>=I&&ve.offset<M);if(H.length===0&&!N)return;p.preventDefault();let T="",Se=I;for(const ve of H)T+=L.slice(Se,ve.offset)+ve.clipboardText,Se=ve.offset+1;T+=L.slice(Se,M),p.clipboardData.setData("text/plain",T),N&&!Ae&&!re&&(s.setDraft(L.slice(0,I)+L.slice(M),{start:I,end:M,insertedLength:0}),Ks(W,I))},"onCopyOrCut"),il=r(p=>{if(s===void 0||Ae||re)return;const N=Array.from(p.clipboardData.items).filter(T=>T.kind==="file").map(T=>T.getAsFile()).filter(T=>T!==null);N.length>0&&Qt(N);const W=p.clipboardData.getData("text/plain");if(W===""){N.length>0&&p.preventDefault();return}p.preventDefault();const I=p.currentTarget,M=Yt(I);s.pasteBegin(W,M);const H=M.start+W.length;Ks(I,H),s.track(s.snapshot.draft,H)},"onPaste"),Qt=(0,h.useCallback)(p=>{if(o===void 0||p.length===0)return;const N=(()=>{if(F!==void 0){if(p.some(W=>!F.mediaTypes.includes(W.type)))return o(p);if(de.length+p.length>F.maxImagesPerMessage)return m("image.tooMany",{count:F.maxImagesPerMessage});if(p.some(W=>W.size>F.maxImageBytes))return m("image.fileTooLarge",{size:nt(F.maxImageBytes)});if(de.reduce((W,I)=>W+I.file.size,0)+p.reduce((W,I)=>W+I.size,0)>F.maxMessageImageBytes)return m("image.totalTooLarge",{size:nt(F.maxMessageImageBytes)})}return o(p)})();N!==null&&J(N)},[o,de,F,J,m]),ct=!re&&!Ae&&o!==void 0;(0,h.useEffect)(()=>{const p=r(T=>T.dataTransfer?.types.includes("Files")??!1,"hasFiles"),N=r(()=>{_e.current=0,He(!1)},"reset"),W=r(T=>{p(T)&&(T.preventDefault(),_e.current+=1,He(!0))},"onDragEnter"),I=r(T=>{!p(T)||T.dataTransfer===null||(T.preventDefault(),T.dataTransfer.dropEffect=ct?"copy":"none")},"onDragOver"),M=r(T=>{if(!p(T))return;_e.current=Math.max(0,_e.current-1),_e.current===0&&He(!1);const Se=T.clientX<=0||T.clientY<=0||T.clientX>=window.innerWidth||T.clientY>=window.innerHeight;(T.target===document.documentElement||T.target===document.body)&&Se&&N()},"onDragLeave"),H=r(T=>{p(T)&&(T.preventDefault(),N(),ct&&Qt([...T.dataTransfer?.files??[]]))},"onDrop");return document.addEventListener("dragenter",W),document.addEventListener("dragover",I),document.addEventListener("dragleave",M),document.addEventListener("drop",H),window.addEventListener("dragend",N),()=>{document.removeEventListener("dragenter",W),document.removeEventListener("dragover",I),document.removeEventListener("dragleave",M),document.removeEventListener("drop",H),window.removeEventListener("dragend",N)}},[ct,Qt]);const al=(0,h.useCallback)(()=>{Le(null)},[]),Vs=(0,h.useMemo)(()=>de.map(p=>({id:p.id,previewUrl:p.previewUrl,alt:p.file.name||m("image.pending"),removeLabel:m("image.remove",{name:p.file.name}),attachment:p})),[de,m]),ll=r(p=>{s!==void 0&&s.snapshot.paste!==void 0&&s.invalidatePaste()},"onSelect"),Zt=r(p=>{p.preventDefault(),X.current?.focus({preventScroll:!0})},"keepFocus"),cl=r(()=>{const p=X.current;p!==null&&d?.(Yt(p))},"onToggleCommandMenu"),kt=Te&&pe===null,dl=Te&&Us,Hs=m(kt?"input.stop":"input.send"),ul=r(()=>{if(kt){u?.();return}n!==void 0&&!we&&!wt&&!Ae&&n.submit()},"onPrimary"),pl=f===void 0?null:(0,i.jsx)(Or,{value:tl,locked:re,command:f,t:m},j),Be=O===void 0?Dr:br(O,me),Qe=[];{let p=0;const N=r(I=>{I>p&&Qe.push(L.slice(p,I)),p=I},"pushPlain");Be.token!==null&&(Qe.push((0,i.jsx)("mark",{className:B.hlToken,"data-decoration":"token",children:L.slice(Be.token.start,Be.token.end)},"token")),p=Be.token.end);const W=[...Be.chips.map(I=>({at:I.offset,kind:"chip",chip:I})),...Be.textRefs.map(I=>({at:I.start,kind:"text-ref",ref:I}))].sort((I,M)=>I.at-M.at);for(const I of W)if(!(I.at<p))if(N(I.at),I.kind==="chip"){const M=I.chip;Qe.push((0,i.jsx)("span",{className:je(B.chip,M.invalid&&B.chipInvalid),"data-decoration":"chip","data-occurrence":M.occurrenceId,"data-invalid":M.invalid||void 0,title:M.label,children:(0,i.jsx)("span",{className:B.chipLabel,children:M.label})},`chip-${M.occurrenceId}`)),p=M.offset+1}else Qe.push((0,i.jsx)("mark",{className:B.textRef,"data-decoration":"text-ref",children:L.slice(I.ref.start,I.ref.end)},`ref-${I.ref.start}`)),p=I.ref.end;if(N(L.length),Be.hint!==null){const I=O?.claim?.token.slice(1).trim()??"",M=`hint.${I==="goal"&&Ve?"goal.active":I}`,H=m(M),T=H!==M?H:Be.hint;Qe.push((0,i.jsx)("span",{className:B.hint,"data-decoration":"hint",children:T},"hint"))}}return(0,i.jsxs)("div",{className:je(B.root,x==="hero"&&B.hero),children:[bt&&(0,i.jsx)(Ze.DropOverlay,{disabled:!ct,labels:kr(m,ct,F===void 0?void 0:{count:F.maxImagesPerMessage,size:nt(F.maxImageBytes)})}),lt!==null&&(0,i.jsx)(_.Toast,{text:lt.text,icon:(0,i.jsx)(_.IconWarningOutline16,{}),anchor:De.current,onDone:ke},lt.seq),Q!==null&&(0,i.jsx)("div",{className:je(B.notice,Q.level==="error"&&B.noticeError),role:"status",children:Q.text}),(0,i.jsxs)("div",{ref:De,className:je(B.card,qe&&B.cardWorkspaceTrigger),"data-composer-card":!0,onClick:qe?ne:void 0,onPointerDown:qe?p=>{p.stopPropagation()}:void 0,children:[Xe!==void 0&&(0,i.jsx)("div",{className:B.overlayAnchor,children:Xe}),he!==void 0&&(0,i.jsx)("div",{className:B.accessory,children:he}),Vs.length>0&&(0,i.jsx)("div",{className:B.attachments,children:(0,i.jsx)(Ze.AttachmentRail,{items:Vs,labels:_r(m),onOpen:r(p=>{Le(p.attachment)},"onOpen"),onRemove:r(p=>{a?.(p.attachment.id)},"onRemove")})}),(0,i.jsx)("div",{ref:Ye,className:B.scroll,"data-input-scroll":!0,children:(0,i.jsxs)("div",{className:B.grow,children:[(0,i.jsx)("div",{"aria-hidden":!0,className:B.backdrop,"data-input-backdrop":!0,children:Qe}),(0,i.jsx)("textarea",{ref:X,className:B.input,value:L,disabled:sl,readOnly:Ae||qe,"aria-label":qe?m("hero.chooseWorkspace"):void 0,"aria-haspopup":qe?"menu":void 0,"aria-expanded":qe?z:void 0,"data-phase":O?.phase??"inert",placeholder:Ee??m(Ps?"placeholder.parentOffline":wt?"placeholder.unavailable":zs?"placeholder.steerQueue":Oe?"placeholder.plan":"placeholder.default"),rows:2,onChange:ol,onKeyDown:rl,onSelect:ll,onCopy:r(p=>{Xs(p,!1)},"onCopy"),onCut:r(p=>{Xs(p,!0)},"onCut"),onPaste:il,onCompositionStart:Za,onCompositionEnd:el}),(0,i.jsx)("div",{ref:$s,"aria-hidden":!0,className:B.mirror,"data-input-mirror":!0,children:`${L}
3
- `})]})}),(0,i.jsxs)("div",{className:B.row,children:[(0,i.jsxs)("div",{className:B.tools,children:[(0,i.jsx)(_.Tooltip,{label:m("input.commands"),side:"top",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:B.add,"aria-label":m("input.commands"),"aria-haspopup":"listbox","aria-expanded":se,disabled:re||d===void 0,onMouseDown:Zt,onClick:cl,children:(0,i.jsx)(_.IconPlusOutline16,{size:14})})}),(0,i.jsxs)("div",{className:B.modes,children:[pl,k("conversation.input.plan",{locked:re})]}),Z]}),(0,i.jsxs)("div",{className:B.trailing,children:[Ge,k("conversation.input.model",{locked:nl}),(0,i.jsx)(Mr,{useProjection:w,t:m}),dl&&(0,i.jsx)(_.Tooltip,{label:m("input.stop"),side:"top",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:B.primary,"aria-label":m("input.stop"),disabled:u===void 0,onMouseDown:Zt,onClick:u,children:(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":!0,children:(0,i.jsx)("rect",{x:"3",y:"3",width:"10",height:"10",rx:"3",fill:"currentColor"})})})}),(0,i.jsx)(_.Tooltip,{label:Hs,side:"top",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:B.primary,"aria-label":Hs,disabled:kt?u===void 0:we||wt||Ae,onMouseDown:Zt,onClick:ul,children:kt?(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":!0,children:(0,i.jsx)("rect",{x:"3",y:"3",width:"10",height:"10",rx:"3",fill:"currentColor"})}):(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":!0,children:(0,i.jsx)("path",{d:"M8.3125 0.980183C8.66767 1.0531 8.97902 1.20418 9.2627 1.43233C9.48724 1.61297 9.73029 1.85793 9.97949 2.10714L14.707 6.83468L13.293 8.24874L9 3.95577V15.0417H7V3.95577L2.70703 8.24874L1.29297 6.83468L6.02051 2.10714C6.26971 1.85793 6.51277 1.61297 6.7373 1.43233C6.97662 1.23986 7.28445 1.04402 7.6875 0.980183C7.8973 0.947006 8.1031 0.95516 8.3125 0.980183Z",fill:"currentColor"})})})})]})]})]}),ge!==null&&(0,i.jsx)(Ze.ImageLightbox,{src:ge.previewUrl,alt:ge.file.name||m("image.original"),labels:yn(m),onClose:al}),be]})}r(Br,"InputBar");const $r="._802Euq_row{border-bottom:1px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}._802Euq_rowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}._802Euq_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}._802Euq_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}._802Euq_selector{background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:18px;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}._802Euq_selector:hover{background:var(--dsw-alias-interactive-bg-hover)}._802Euq_chevron{flex:none}",Wn="@deepseek-ai/dsh-client-ui-conversation/EnterBehaviorRow.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Wn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Wn,e.textContent=$r,document.head.appendChild(e)}var ze={selector:"_802Euq_selector",chevron:"_802Euq_chevron",title:"_802Euq_title",rowText:"_802Euq_rowText",row:"_802Euq_row",desc:"_802Euq_desc"};const Ur=[{id:"queue",label:"settings.enter.queue"},{id:"steer",label:"settings.enter.steer"}];function Pr({useBusyEnter:e,setBusyEnter:t,t:n}){const s=e(c=>c),[o,a]=(0,h.useState)(!1),l=s==="queue"?"settings.enter.queue":"settings.enter.steer";return(0,i.jsxs)("div",{className:ze.row,children:[(0,i.jsxs)("div",{className:ze.rowText,children:[(0,i.jsx)("div",{className:ze.title,children:n("settings.enter.title")}),(0,i.jsx)("div",{className:ze.desc,children:n("settings.enter.description")})]}),(0,i.jsx)(_.Menu,{open:o,onClose:r(()=>{a(!1)},"onClose"),items:Ur.map(c=>({id:c.id,label:n(c.label)})),selectedId:s,onSelect:r(c=>{a(!1),t(c)},"onSelect"),align:"end",portal:!0,anchor:(0,i.jsxs)("button",{type:"button",className:ze.selector,"aria-haspopup":"menu","aria-expanded":o,onClick:r(()=>{a(c=>!c)},"onClick"),children:[n(l),(0,i.jsx)(_.IconChevronDownOutline14,{className:ze.chevron})]})})]})}r(Pr,"EnterBehaviorRow");const zr='.JsXUgW_userRow{flex-direction:column;align-items:flex-end;gap:6px;display:flex}.JsXUgW_userStack{flex-direction:column;align-items:flex-end;gap:8px;min-width:0;max-width:min(525px,82%);display:flex}.JsXUgW_bubble{background:var(--dsw-specific-bubble);max-width:100%;color:var(--dsw-alias-label-primary);border-radius:22px;padding:10px 16px;font-size:16px;line-height:24px}.JsXUgW_contextRow,.JsXUgW_compactionRow{padding:2px 0}.JsXUgW_compactionButton{width:100%;min-width:0;height:24px;color:inherit;font:inherit;text-align:left;background:0 0;border:none;border-radius:6px;align-items:center;padding:0;display:flex}.JsXUgW_compactionButton:not(:disabled){cursor:pointer}.JsXUgW_compactionButton:not(:disabled):hover{background:var(--dsw-alias-interactive-bg-hover)}.JsXUgW_compactionLeading{width:16px;height:16px;color:var(--dsw-alias-label-secondary);flex:none;place-items:center;margin-right:6px;display:inline-grid}.JsXUgW_compactionContextIcon,.JsXUgW_compactionDisclosureIcon{grid-area:1/1;justify-content:center;align-items:center;display:inline-flex}.JsXUgW_compactionDisclosureIcon,.JsXUgW_compactionButton:not(:disabled):hover .JsXUgW_compactionContextIcon,.JsXUgW_compactionButton:not(:disabled):focus-visible .JsXUgW_compactionContextIcon{opacity:0}.JsXUgW_compactionButton:not(:disabled):hover .JsXUgW_compactionDisclosureIcon,.JsXUgW_compactionButton:not(:disabled):focus-visible .JsXUgW_compactionDisclosureIcon{opacity:1}.JsXUgW_compactionTitle{color:var(--dsw-alias-label-primary-dimmed);flex:none;font-size:14px;line-height:24px}.JsXUgW_compactionSep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.JsXUgW_compactionSummary{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:14px;line-height:24px;overflow:hidden}.JsXUgW_compactionBody{color:var(--dsw-alias-label-tertiary);padding:4px 0 4px 22px;font-size:14px;line-height:24px}.JsXUgW_retryRow{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:20px}.JsXUgW_retrySummary{width:fit-content;color:inherit;cursor:pointer;user-select:none;border-radius:3px;align-items:center;gap:7px;padding:2px 0;list-style:none;display:inline-flex}.JsXUgW_retrySummary::-webkit-details-marker{display:none}.JsXUgW_retrySummary:after{content:"";opacity:.8;border-bottom:1.5px solid;border-right:1.5px solid;width:6px;height:6px;transition:transform .12s;transform:rotate(-45deg)}.JsXUgW_retrySummary:hover{color:var(--dsw-alias-label-secondary)}.JsXUgW_retrySummary:focus-visible{outline:1.5px solid var(--dsw-alias-button-info-fill);outline-offset:2px}.JsXUgW_retryText{color:inherit}.JsXUgW_retryRow[data-active] .JsXUgW_retryText{background:linear-gradient(90deg, var(--dsw-alias-label-tertiary) 0%, var(--dsw-alias-label-tertiary) 40%, var(--dsw-alias-label-secondary) 50%, var(--dsw-alias-label-tertiary) 60%, var(--dsw-alias-label-tertiary) 100%);color:#0000;background-position:100%;background-size:200% 100%;background-clip:text;animation:1.6s ease-in-out infinite JsXUgW_retry-shimmer}.JsXUgW_retryRow[open] .JsXUgW_retrySummary:after{transform:rotate(45deg)}.JsXUgW_retryDetails{overflow-wrap:anywhere;gap:2px;margin-top:3px;padding-left:14px;font-size:12px;line-height:18px;display:grid}.JsXUgW_retryDetailLabel{color:var(--dsw-alias-label-secondary)}.JsXUgW_turnErrorRow{grid-template-columns:10px minmax(0,1fr) auto;align-items:start;gap:8px;padding:2px 0;font-size:13px;line-height:20px;display:grid}.JsXUgW_turnErrorDot{margin-top:5px}.JsXUgW_turnErrorCopy{overflow-wrap:anywhere;min-width:0}.JsXUgW_turnErrorTitle{color:var(--dsw-alias-state-error-primary);margin-right:6px;font-weight:600}.JsXUgW_turnErrorMessage{color:var(--dsw-alias-label-secondary)}.JsXUgW_turnErrorCode{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-markdown-code-block-small)}.JsXUgW_maxTokensTitle{color:var(--dsw-alias-state-warn-primary);margin-right:6px;font-weight:600}@keyframes JsXUgW_retry-shimmer{0%{background-position:100%}to{background-position:0}}@media (prefers-reduced-motion:reduce){.JsXUgW_retryRow[data-active] .JsXUgW_retryText{color:inherit;background:0 0;animation:none}}.JsXUgW_refChip{color:var(--dsw-alias-label-primary);white-space:nowrap;vertical-align:baseline;background:#6187d838;border-radius:6px;margin:0 2px;padding:0 8px;font-size:.85em;line-height:1.6;display:inline-block}',Gn="@deepseek-ai/dsh-client-ui-conversation/MessageItem.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Gn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Gn,e.textContent=zr,document.head.appendChild(e)}var R={compactionLeading:"JsXUgW_compactionLeading",retryRow:"JsXUgW_retryRow",turnErrorTitle:"JsXUgW_turnErrorTitle",turnErrorCode:"JsXUgW_turnErrorCode",compactionRow:"JsXUgW_compactionRow",contextRow:"JsXUgW_contextRow",compactionBody:"JsXUgW_compactionBody",turnErrorRow:"JsXUgW_turnErrorRow",compactionContextIcon:"JsXUgW_compactionContextIcon",userRow:"JsXUgW_userRow",compactionDisclosureIcon:"JsXUgW_compactionDisclosureIcon",compactionSep:"JsXUgW_compactionSep",turnErrorDot:"JsXUgW_turnErrorDot",bubble:"JsXUgW_bubble",compactionButton:"JsXUgW_compactionButton",retryText:"JsXUgW_retryText",compactionTitle:"JsXUgW_compactionTitle","retry-shimmer":"JsXUgW_retry-shimmer",turnErrorCopy:"JsXUgW_turnErrorCopy",turnErrorMessage:"JsXUgW_turnErrorMessage",userStack:"JsXUgW_userStack",retryDetails:"JsXUgW_retryDetails",maxTokensTitle:"JsXUgW_maxTokensTitle",retrySummary:"JsXUgW_retrySummary",refChip:"JsXUgW_refChip",retryDetailLabel:"JsXUgW_retryDetailLabel",compactionSummary:"JsXUgW_compactionSummary"};const On=(0,h.memo)(r(function({node:t,title:n,fallbackSummary:s,t:o}){const[a,l]=(0,h.useState)(!1),c=t.summary!==null,d=c&&a,u=t.shadowedItemCount!==null&&t.shadowedTokenCount!==null?o("message.compaction.completed",{items:t.shadowedItemCount,tokens:t.shadowedTokenCount}):s??o(c?"message.compaction.expand":"message.compaction.unavailable");return(0,i.jsxs)("div",{className:R.compactionRow,children:[(0,i.jsxs)("button",{type:"button",className:R.compactionButton,disabled:!c,"aria-expanded":c?d:void 0,onClick:r(()=>{l(f=>!f)},"onClick"),children:[(0,i.jsxs)("span",{className:R.compactionLeading,"aria-hidden":!0,children:[(0,i.jsx)("span",{className:R.compactionContextIcon,"data-compaction-icon":"context",children:(0,i.jsx)(_.IconApiOutline14,{})}),(0,i.jsx)("span",{className:R.compactionDisclosureIcon,"data-compaction-disclosure":d?"expanded":"collapsed",children:d?(0,i.jsx)(_.IconChevronDownOutline14,{}):(0,i.jsx)(_.IconChevronRightOutline14,{})})]}),(0,i.jsx)("span",{className:R.compactionTitle,children:n??o("message.compaction")}),(0,i.jsx)("span",{className:R.compactionSep,"aria-hidden":!0}),(0,i.jsx)("span",{className:R.compactionSummary,children:u})]}),d&&t.summary!==null&&(0,i.jsx)("div",{className:R.compactionBody,children:(0,i.jsx)(_.MarkdownText,{text:t.summary})})]})},"CompactionItem")),Fr=".tWf1yG_text{color:var(--dsw-alias-label-secondary);font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.tWf1yG_fields{border-top:1px solid var(--dsw-alias-line-secondary);flex-direction:column;gap:2px;margin:8px 0 0;padding-top:8px;display:flex}.tWf1yG_field{gap:8px;min-width:0;display:flex}.tWf1yG_fieldKey{min-width:96px;color:var(--dsw-alias-label-caption);flex:none}.tWf1yG_fieldValue{min-width:0;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;flex:auto;margin:0}.tWf1yG_files{flex-wrap:wrap;gap:4px 12px;margin:0 0 8px;padding:0;list-style:none;display:flex}.tWf1yG_file{align-items:baseline;gap:6px;min-width:0;display:flex}.tWf1yG_filePath{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.tWf1yG_fileAction{color:var(--dsw-alias-label-caption)}.tWf1yG_catalogNotice{color:var(--dsw-alias-label-caption);margin:0 0 6px}.tWf1yG_entries{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.tWf1yG_entry{gap:8px;min-width:0;display:flex}.tWf1yG_entryName{color:var(--dsw-alias-label-secondary);flex:none}.tWf1yG_entryDescription{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;overflow:hidden}.tWf1yG_sections{flex-direction:column;gap:8px;margin:0;display:flex}.tWf1yG_section{flex-direction:column;gap:2px;min-width:0;display:flex}.tWf1yG_sectionName{color:var(--dsw-alias-label-caption)}.tWf1yG_sectionText{color:var(--dsw-alias-label-secondary);white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.tWf1yG_relaySender{color:var(--dsw-alias-label-caption);overflow-wrap:anywhere;margin:0 0 6px}.tWf1yG_recalls{flex-direction:column;gap:2px;margin:0 0 8px;padding:0;list-style:none;display:flex}.tWf1yG_recall{gap:8px;min-width:0;display:flex}.tWf1yG_recallLabel{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.tWf1yG_recallCounts{color:var(--dsw-alias-label-caption);flex:none}",Ln="@deepseek-ai/dsh-client-ui-conversation/ContextBody.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Ln)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Ln,e.textContent=Fr,document.head.appendChild(e)}var $={section:"tWf1yG_section",entryDescription:"tWf1yG_entryDescription",text:"tWf1yG_text",sections:"tWf1yG_sections",fieldValue:"tWf1yG_fieldValue",sectionName:"tWf1yG_sectionName",fieldKey:"tWf1yG_fieldKey",fileAction:"tWf1yG_fileAction",relaySender:"tWf1yG_relaySender",recallLabel:"tWf1yG_recallLabel",entries:"tWf1yG_entries",field:"tWf1yG_field",filePath:"tWf1yG_filePath",file:"tWf1yG_file",fields:"tWf1yG_fields",entryName:"tWf1yG_entryName",recall:"tWf1yG_recall",sectionText:"tWf1yG_sectionText",recalls:"tWf1yG_recalls",catalogNotice:"tWf1yG_catalogNotice",recallCounts:"tWf1yG_recallCounts",files:"tWf1yG_files",entry:"tWf1yG_entry"};const Dn=2e4,Jr=200;function ie(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}r(ie,"asRecord");function Bn(e){const t=[];for(const n of e){if(n.type!=="text"){t.push({block:n});continue}const s=t[t.length-1];s!==void 0&&"text"in s?s.text+=n.text:t.push({text:n.text})}return t}r(Bn,"contentRuns");function Kr(e){return Bn(e).flatMap(t=>"block"in t?[t.block]:[])}r(Kr,"unknownBlocks");function Ot(e,t){return e.length>Dn?`${e.slice(0,Dn)}
4
- ${t("json.truncated",{total:e.length})}`:e}r(Ot,"boundedText");function Xr(e,t){return Ot(typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e),t)}r(Xr,"fieldValue");function Vr({source:e,formRendered:t,t:n}){const s=ie(e);if(s===null)return null;const o=t?["kind","form"]:["kind"],a=Object.entries(s).filter(([l])=>!o.includes(l));return a.length===0?null:(0,i.jsx)("dl",{className:$.fields,"data-context-fields":!0,children:a.map(([l,c])=>(0,i.jsxs)("div",{className:$.field,children:[(0,i.jsx)("dt",{className:$.fieldKey,children:l}),(0,i.jsx)("dd",{className:$.fieldValue,children:Xr(c,n)})]},l))})}r(Vr,"SourceFields");function Hr({blocks:e,t}){return(0,i.jsx)(i.Fragment,{children:e.map((n,s)=>(0,i.jsx)(_.JsonBlock,{label:t("message.unknownBlock"),payload:n,truncatedLabel:r(o=>t("json.truncated",{total:o}),"truncatedLabel")},s))})}r(Hr,"UnknownBlocks");function ot({content:e,t}){return(0,i.jsx)(i.Fragment,{children:Bn(e).map((n,s)=>"text"in n?n.text!==""&&(0,i.jsx)("pre",{className:$.text,"data-context-text":!0,children:Ot(n.text,t)},s):(0,i.jsx)(_.JsonBlock,{label:t("message.unknownBlock"),payload:n.block,truncatedLabel:r(o=>t("json.truncated",{total:o}),"truncatedLabel")},s))})}r(ot,"ModelFacingContent");function Fe({content:e,source:t,t:n}){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ot,{content:e,t:n}),(0,i.jsx)(Vr,{source:t,formRendered:!1,t:n})]})}r(Fe,"OpaqueBody");function $n(e){const t=ie(e),n=t===null?void 0:t.changes;if(!Array.isArray(n))return null;const s=[],o=new Set;for(const a of n){const l=ie(a);if(l===null)return null;const c=l.path;if(typeof c!="string"||c==="")return null;const d=l.action;if(d!=="set"&&d!=="replace"&&d!=="remove")return null;const u=l.digest;o.has(c)||(o.add(c),s.push({action:d,path:c,...typeof u=="string"?{digest:u}:{}}))}return s.length===0?null:s}r($n,"instructionChanges");function Yr(e,t){return e==="remove"?"message.context.instructions.removed":t?"message.context.instructions.loaded":e==="set"?"message.context.instructions.added":"message.context.instructions.updated"}r(Yr,"instructionAction");function Qr({content:e,source:t,t:n}){const s=$n(t);if(s===null)return(0,i.jsx)(Fe,{content:e,source:t,t:n});const o=ie(t)?.baseline===!0;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("ul",{className:$.files,"data-context-files":!0,children:s.map(a=>(0,i.jsxs)("li",{className:$.file,title:a.digest,children:[(0,i.jsx)("span",{className:$.filePath,children:a.path}),(0,i.jsx)("span",{className:$.fileAction,children:n(Yr(a.action,o))})]},a.path))}),(0,i.jsx)(ot,{content:e,t:n})]})}r(Qr,"InstructionsBody");function Un(e){const t=ie(e),n=t===null?void 0:t.entries;if(!Array.isArray(n))return null;const s=[];for(const o of n){const a=ie(o);if(a===null)return null;const l=a.name,c=a.description;if(typeof l!="string"||l===""||typeof c!="string")return null;s.push({name:l,description:c})}return s}r(Un,"catalogEntries");function Zr({content:e,source:t,t:n}){const s=Un(t);if(s===null)return(0,i.jsx)(Fe,{content:e,source:t,t:n});const o=ie(t)?.update===!0,a=s.slice(0,Jr),l=Kr(e);return(0,i.jsxs)(i.Fragment,{children:[o&&(0,i.jsx)("p",{className:$.catalogNotice,"data-context-catalog-update":!0,children:n("message.context.catalog.replaced")}),(0,i.jsx)("ul",{className:$.entries,"data-context-entries":!0,children:a.map((c,d)=>(0,i.jsxs)("li",{className:$.entry,children:[(0,i.jsx)("code",{className:$.entryName,children:c.name}),(0,i.jsx)("span",{className:$.entryDescription,children:c.description})]},d))}),a.length<s.length&&(0,i.jsx)("p",{className:$.catalogNotice,"data-context-entries-truncated":!0,children:n("message.context.catalog.more",{count:s.length-a.length})}),(0,i.jsx)(Hr,{blocks:l,t:n})]})}r(Zr,"CatalogBody");function Pn(e){const t=ie(e),n=t===null?void 0:t.sections;if(!Array.isArray(n))return null;const s=[];for(const o of n){const a=ie(o);if(a===null)return null;const l=a.name,c=a.text;if(typeof l!="string"||l===""||typeof c!="string")return null;s.push({name:l,text:c})}return s.length===0?null:s}r(Pn,"snapshotSections");function eo({content:e,source:t,t:n}){const s=Pn(t);return s===null?(0,i.jsx)(Fe,{content:e,source:t,t:n}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{className:$.catalogNotice,"data-context-snapshot-supersedes":!0,children:n("message.context.snapshot.supersedes")}),(0,i.jsx)("dl",{className:$.sections,"data-context-sections":!0,children:s.map((o,a)=>(0,i.jsxs)("div",{className:$.section,children:[(0,i.jsx)("dt",{className:$.sectionName,children:o.name}),(0,i.jsx)("dd",{className:$.sectionText,children:Ot(o.text,n)})]},a))})]})}r(eo,"SnapshotBody");function to({content:e,t}){return(0,i.jsx)(ot,{content:e,t})}r(to,"NoticeBody");function no({content:e,source:t,t:n}){const s=zn(t);return s===null?(0,i.jsx)(Fe,{content:e,source:t,t:n}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{className:$.relaySender,"data-context-relay-sender":!0,children:n("message.context.relay.from",{session:s})}),(0,i.jsx)(ot,{content:e,t:n})]})}r(no,"RelayBody");function zn(e){const t=ie(e)?.senderSessionId;return typeof t=="string"&&t!==""?t:null}r(zn,"relaySender");function Fn(e){const t=ie(e),n=t===null?void 0:t.references;if(!Array.isArray(n))return null;const s=[];for(const o of n){const a=ie(o);if(a===null)return null;const l=a.label,c=a.retainedMessages,d=a.omittedMessages,u=a.truncated;if(typeof l!="string"||l===""||typeof c!="number"||typeof d!="number"||typeof u!="boolean")return null;s.push({label:l,retained:c,omitted:d,truncated:u})}return s.length===0?null:s}r(Fn,"recalledSessions");function so({content:e,source:t,t:n}){const s=Fn(t);return s===null?(0,i.jsx)(Fe,{content:e,source:t,t:n}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("ul",{className:$.recalls,"data-context-recalls":!0,children:s.map((o,a)=>(0,i.jsxs)("li",{className:$.recall,children:[(0,i.jsx)("span",{className:$.recallLabel,children:o.label}),(0,i.jsx)("span",{className:$.recallCounts,children:n("message.context.recall.counts",{retained:o.retained,omitted:o.omitted})}),o.truncated&&(0,i.jsx)("span",{className:$.recallCounts,children:n("message.context.recall.truncated")})]},a))}),(0,i.jsx)(ot,{content:e,t:n})]})}r(so,"RecallBody");function ro(e){const t=ie(e)?.summary;return typeof t=="string"&&t!==""?t:null}r(ro,"noticeSummary");function oo(e,t){const n={rendered:null,summary:null,body:(0,i.jsx)(Fe,{...t})};switch(e){case"instructions":return $n(t.source)===null?n:{rendered:"instructions",summary:null,body:(0,i.jsx)(Qr,{...t})};case"catalog":return Un(t.source)===null?n:{rendered:"catalog",summary:null,body:(0,i.jsx)(Zr,{...t})};case"snapshot":return Pn(t.source)===null?n:{rendered:"snapshot",summary:null,body:(0,i.jsx)(eo,{...t})};case"notice":{const s=ro(t.source);return s===null?n:{rendered:"notice",summary:s,body:(0,i.jsx)(to,{...t})}}case"relay":return zn(t.source)===null?n:{rendered:"relay",summary:null,body:(0,i.jsx)(no,{...t})};case"recall":return Fn(t.source)===null?n:{rendered:"recall",summary:null,body:(0,i.jsx)(so,{...t})};case null:return n;default:throw new Error(`unreachable context form: ${String(e)}`)}}r(oo,"contextBody");const io=".wmVwWa_root{min-width:0}.wmVwWa_root[data-open]{padding-bottom:4px}.wmVwWa_chevron{color:var(--dsw-alias-label-secondary)}.wmVwWa_sep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.wmVwWa_source{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:none;font-size:14px;line-height:24px;overflow:hidden}.wmVwWa_summary{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:14px;line-height:24px;overflow:hidden}.wmVwWa_body{box-sizing:border-box;background:var(--dsw-alias-markdown-code-block);width:calc(100% - 22px);max-height:141px;color:var(--dsw-alias-label-tertiary);font:400 11px/16px var(--ds-font-family-code);border:none;border-radius:8px;margin:4px 0 0 22px;padding:10px 16px 12px 12px;overflow:auto}",Jn="@deepseek-ai/dsh-client-ui-conversation/ContextInjectionRow.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Jn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Jn,e.textContent=io,document.head.appendChild(e)}var Ue={root:"wmVwWa_root",sep:"wmVwWa_sep",chevron:"wmVwWa_chevron",source:"wmVwWa_source",body:"wmVwWa_body",summary:"wmVwWa_summary"};function ao({content:e,source:t,provenance:n,form:s,t:o}){const[a,l]=(0,h.useState)(!1),{rendered:c,summary:d,body:u}=oo(s,{content:e,source:t,t:o});return(0,i.jsx)(_.DisclosureRow,{className:Ue.root,icon:(0,i.jsx)(_.IconBrowseOutline16,{size:14}),chevronClassName:Ue.chevron,title:o(n.role==="recall"?"message.contextRecall":"message.contextInjection"),collapsedContent:n.label===null?void 0:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:Ue.sep,"aria-hidden":!0}),(0,i.jsx)("span",{className:Ue.source,"data-context-source":!0,children:n.label}),d!==null&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:Ue.sep,"aria-hidden":!0}),(0,i.jsx)("span",{className:Ue.summary,"data-context-summary":!0,children:d})]})]}),keepContentWhenOpen:!0,open:a,expandable:!0,expandOnRowClick:!0,onToggle:r(()=>{l(f=>!f)},"onToggle"),children:(0,i.jsx)("div",{className:Ue.body,"data-context-injection-body":!0,"data-context-form":c??void 0,children:u})})}r(ao,"ContextInjectionRow");function lo(){const[e,t]=(0,h.useState)(()=>wn(Date.now()));return(0,h.useEffect)(()=>{let n;const s=r(()=>{const o=Date.now();t(wn(o)),n=setTimeout(s,kn(o))},"arm");return n=setTimeout(s,kn(Date.now())),()=>{clearTimeout(n)}},[]),e}r(lo,"useCalendarDay");const co=".KjuGrW_actions{align-items:center;gap:10px;height:28px;display:flex}.KjuGrW_timeStart{color:var(--dsw-alias-label-tertiary);white-space:nowrap;padding-right:12px;font-size:14px;line-height:24px}.KjuGrW_timeEnd{color:var(--dsw-alias-label-tertiary);white-space:nowrap;padding-left:12px;font-size:14px;line-height:24px}.KjuGrW_runTimeDot{margin:0 10px}@media (hover:hover){[data-time-hover-root] :is(.KjuGrW_timeStart,.KjuGrW_timeEnd){opacity:0;transition:opacity 80ms}[data-time-hover-root]:hover :is(.KjuGrW_timeStart,.KjuGrW_timeEnd),[data-time-hover-root]:focus-within :is(.KjuGrW_timeStart,.KjuGrW_timeEnd){opacity:1}}.KjuGrW_action{width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:28px;justify-content:center;align-items:center;padding:6px;display:inline-flex}.KjuGrW_action:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.KjuGrW_action[data-unavailable]{cursor:default;opacity:.4}.KjuGrW_action[data-unavailable]:hover{color:var(--dsw-alias-label-tertiary);background:0 0}.KjuGrW_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}",Kn="@deepseek-ai/dsh-client-ui-conversation/MessageIconActions.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Kn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Kn,e.textContent=co,document.head.appendChild(e)}var xe={timeEnd:"KjuGrW_timeEnd",action:"KjuGrW_action",timeStart:"KjuGrW_timeStart",actions:"KjuGrW_actions",runTimeDot:"KjuGrW_runTimeDot",visuallyHidden:"KjuGrW_visuallyHidden"};function Lt({text:e,time:t,runMs:n,ttftMs:s,tokensPerSecond:o,clock:a,onBranch:l,branchUnavailable:c=!1,className:d,extraActions:u,t:f}){const m=lo(),k=(0,h.useId)(),[g,y]=(0,h.useState)(!1),b=(0,h.useRef)(!1),w=(0,h.useRef)(null),j=(0,h.useRef)(0);(0,h.useEffect)(()=>()=>{j.current+=1,b.current=!1,w.current!==null&&clearTimeout(w.current)},[]);const x=(0,h.useCallback)(()=>{if(g||b.current)return;const S=j.current;b.current=!0,(0,_.writeClipboard)(e).then(z=>{S===j.current&&(b.current=!1,z&&(y(!0),w.current=window.setTimeout(()=>{w.current=null,y(!1)},1e3)))})},[g,e]),A=t===void 0?null:(0,i.jsxs)("span",{className:a==="start"?xe.timeStart:xe.timeEnd,children:[Sr(t,f,m),n!==void 0&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsx)("span",{className:xe.runTimeDot,"aria-hidden":!0,children:"·"})," ",f("message.ranFor",{duration:_n(n,f)})]}),s!==void 0&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsx)("span",{className:xe.runTimeDot,"aria-hidden":!0,children:"·"})," ",f("message.ttft",{seconds:Ar(s)})]}),o!==void 0&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsx)("span",{className:xe.runTimeDot,"aria-hidden":!0,children:"·"})," ",f("message.tokensPerSecond",{tps:An(o)})]})]});return(0,i.jsxs)("div",{className:d===void 0?xe.actions:`${xe.actions} ${d}`,children:[a==="start"?A:null,(0,i.jsx)(_.Tooltip,{label:f(g?"copied":"copy"),side:"bottom",children:(0,i.jsx)("button",{type:"button",className:xe.action,"aria-label":f(g?"copied":"copy"),onClick:x,children:g?(0,i.jsx)(_.IconCheckOutline16,{}):(0,i.jsx)(_.IconCopyOutline16,{})})}),u,l!==void 0&&(0,i.jsx)(_.Tooltip,{label:f(c?"message.branchUnavailable":"message.branch"),side:"bottom",children:(0,i.jsx)("button",{type:"button",className:xe.action,"aria-label":f("message.branch"),"aria-disabled":c||void 0,"aria-describedby":c?k:void 0,"data-unavailable":c||void 0,onClick:c?void 0:l,children:(0,i.jsx)(_.IconBranchOutline16,{})})}),l!==void 0&&c&&(0,i.jsx)("span",{id:k,className:xe.visuallyHidden,children:f("message.branchUnavailable")}),a==="end"?A:null]})}r(Lt,"MessageIconActions");function uo(e){const t=[],n=[],s=[];for(const o of e){const a=o;a.type==="text"&&typeof a.text=="string"?t.push(a.text):a.type==="image"&&a.attachment!==void 0?n.push({attachment:a.attachment}):s.push(o)}return{text:t.join(""),images:n,rest:s}}r(uo,"contentParts");function ft(e){return Math.max(1,Math.ceil(e/1e3))}r(ft,"retrySeconds");function po({node:e,active:t,t:n}){const s=(0,h.useMemo)(()=>Date.now()+e.delayMs,[e.delayMs,e.seq]),o=ft(e.delayMs),a=e.mode==="normal"?e.maxRetries:"∞",[l,c]=(0,h.useState)(()=>({deadline:s,seconds:ft(s-Date.now())})),d=l.deadline===s?l.seconds:ft(s-Date.now());(0,h.useEffect)(()=>{if(!t)return;const m=r(()=>{const g=ft(s-Date.now());return c(y=>y.deadline===s&&y.seconds===g?y:{deadline:s,seconds:g}),g},"updateCountdown");if(m()===1)return;const k=window.setInterval(()=>{m()===1&&window.clearInterval(k)},250);return()=>{window.clearInterval(k)}},[t,s]);const u=t?n("message.retry.active"):e.retryState==="cancelled"?n("message.retry.cancelled"):e.retryState==="started"?n("message.retry.started"):n("message.retry.scheduled"),f=t?d:o;return(0,i.jsxs)("details",{className:R.retryRow,"data-active":t||void 0,children:[(0,i.jsx)("summary",{className:R.retrySummary,children:(0,i.jsx)("span",{className:R.retryText,role:"status",children:n("message.retry.status",{label:u,retry:e.retry,maximum:a,seconds:f})})}),(0,i.jsxs)("div",{className:R.retryDetails,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("span",{className:R.retryDetailLabel,children:n("message.retry.delay")}),Math.round(e.delayMs),"ms"]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("span",{className:R.retryDetailLabel,children:n("message.retry.failure")}),e.failure.message]})]})]})}r(po,"ModelRetryItem");function ho({node:e,t}){return(0,i.jsxs)("div",{className:R.turnErrorRow,role:"status",children:[(0,i.jsx)(_.StateDot,{state:"error",className:R.turnErrorDot}),(0,i.jsxs)("div",{className:R.turnErrorCopy,children:[(0,i.jsx)("span",{className:R.turnErrorTitle,children:t("message.turnError")}),(0,i.jsx)("span",{className:R.turnErrorMessage,children:e.message})]}),e.code!==void 0&&(0,i.jsx)("code",{className:R.turnErrorCode,children:e.code})]})}r(ho,"TurnErrorItem");function mo({t:e}){return(0,i.jsxs)("div",{className:R.turnErrorRow,role:"status",children:[(0,i.jsx)(_.StateDot,{state:"warning",className:R.turnErrorDot}),(0,i.jsxs)("div",{className:R.turnErrorCopy,children:[(0,i.jsx)("span",{className:R.maxTokensTitle,children:e("message.maxTokens")}),(0,i.jsx)("span",{className:R.turnErrorMessage,children:e("message.maxTokens.hint")})]})]})}r(mo,"TurnMaxTokensItem");function fo(e){const t=/(^|\s)([/@][\w-]+)(?=\s|$)/g,n=[];let s=0,o;for(;(o=t.exec(e))!==null;){const a=o.index+(o[1]?.length??0),l=o[2]??"";a>s&&n.push((0,i.jsx)(_.MessageText,{text:e.slice(s,a)},s)),n.push((0,i.jsx)("span",{className:R.refChip,"data-ref-chip":l.startsWith("@")?"subagent":"skill",children:l},a)),s=a+l.length}return n.length===0?(0,i.jsx)(_.MessageText,{text:e}):(s<e.length&&n.push((0,i.jsx)(_.MessageText,{text:e.slice(s)},s)),(0,i.jsx)(i.Fragment,{children:n}))}r(fo,"projectUserText");function Xn({content:e,imageLoader:t,actions:n,pending:s=!1,t:o}){const{text:a,images:l,rest:c}=uo(e),d=r(f=>o("json.truncated",{total:f}),"truncated"),u=a!==""||c.length>0;return(0,i.jsxs)("div",{className:R.userRow,"data-pending-steering":s||void 0,"data-time-hover-root":!0,children:[(0,i.jsxs)("div",{className:R.userStack,children:[(0,i.jsx)(Ze.ImageGallery,{images:l,load:t,align:"end",labels:xn(o)}),u&&(0,i.jsxs)("div",{className:R.bubble,children:[fo(a),c.map((f,m)=>(0,i.jsx)(_.JsonBlock,{label:o("message.extraBlock"),payload:f,truncatedLabel:d},m))]})]}),n?.(a)]})}r(Xn,"UserStyleBubble");function go({content:e,loadImage:t,t:n}){return(0,i.jsx)(Xn,{content:e,imageLoader:t??(()=>Promise.reject(new Error(n("image.serviceUnavailable")))),pending:!0,t:n,actions:r(s=>(0,i.jsx)(Lt,{text:s,clock:"start",className:R.actions,t:n}),"actions")})}r(go,"PendingSteeringBubble");const Vn=(0,h.memo)(r(function({node:t,loadImage:n,t:s}){const o=t.data;return(0,i.jsx)(Xn,{content:o.content,imageLoader:n,t:s,actions:r(a=>(0,i.jsx)(Lt,{text:a,time:o.time,clock:"start",className:R.actions,t:s}),"actions")})},"UserMessageNodeView")),vo=(0,h.memo)(r(function({node:t,t:n}){const s=t.data;return(0,i.jsx)(ao,{content:s.content,source:s.source,provenance:s.provenance,form:s.form,t:n})},"ContextMessageNodeView")),yo=(0,h.memo)(r(function({node:t,t:n}){return(0,i.jsx)(On,{node:t.data,t:n})},"CompactionNodeView")),xo=(0,h.memo)(r(function({node:t,t:n}){const s=t.data;return(0,i.jsx)(po,{node:s.current,active:s.current.retryState==="scheduled",t:n})},"RetryNodeView")),bo=(0,h.memo)(r(function({node:t,t:n}){return(0,i.jsx)(ho,{node:t.data,t:n})},"TurnErrorNodeView")),wo=(0,h.memo)(r(function({t}){return(0,i.jsx)(mo,{t})},"TurnMaxTokensNodeView")),ko=(0,h.memo)(r(function({node:t,t:n}){const s=t.data;return(0,i.jsx)("div",{className:R.contextRow,children:(0,i.jsx)(_.JsonBlock,{label:n("message.unknownSurface",{type:s.type}),payload:s.data,truncatedLabel:r(o=>n("json.truncated",{total:o}),"truncatedLabel")})})},"UnknownNodeView")),_o=".ylv09G_root{flex-direction:column;flex:auto;min-height:0;display:flex;position:relative}.ylv09G_scroll{min-height:0;padding:16px calc(var(--dsh-composer-side-clearance) + 16px);flex:auto;overflow-y:auto}[data-conversation-scroll] .ylv09G_root{flex:none;height:auto;min-height:auto}[data-conversation-scroll] .ylv09G_scroll{flex:none;min-height:auto;overflow:visible}.ylv09G_column{max-width:var(--dsh-chat-content-width);flex-direction:column;gap:16px;width:100%;margin:0 auto;display:flex}.ylv09G_flowItem{min-width:0}.ylv09G_flowItem:empty{display:none}.ylv09G_callRow{border-radius:6px}.ylv09G_turnStatus{height:26px;font:var(--dsw-font-s-strong-14);white-space:nowrap;background:linear-gradient(90deg, var(--dsw-static-deepseek-500) 0%, var(--dsw-static-deepseek-500) 40%, var(--dsw-static-deepseek-200) 50%, var(--dsw-static-deepseek-500) 60%, var(--dsw-static-deepseek-500) 100%);color:#0000;-webkit-text-fill-color:transparent;background-position:100% 0;background-size:250% 100%;-webkit-background-clip:text;background-clip:text;flex:none;align-self:flex-start;align-items:center;animation:1.8s linear infinite ylv09G_dsh-turn-status-shimmer;display:inline-flex}.ylv09G_turnStatusClock{font:var(--dsw-font-xs-13);font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-caption);-webkit-text-fill-color:var(--dsw-alias-label-caption);margin-left:8px;font-weight:400}@keyframes ylv09G_dsh-turn-status-shimmer{to{background-position:0 0}}@media (prefers-reduced-motion:reduce){.ylv09G_turnStatus{background-position:0 0;background-size:100% 100%;animation:none}}.ylv09G_hint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.ylv09G_openError{color:var(--dsw-alias-state-error-primary);font-size:12px;line-height:18px}.ylv09G_older{justify-content:center;display:flex}.ylv09G_older button{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-interactive-bg-hover-solid);cursor:pointer;border:none;border-radius:14px;padding:4px 12px;font-size:12px}.ylv09G_older button:disabled{cursor:default;opacity:.6}.ylv09G_toBottomSlot{z-index:8;height:0;padding-right:max(0px, calc((100% - var(--dsh-chat-content-width)) / 2));pointer-events:none;justify-content:flex-end;display:flex;position:sticky;bottom:16px}[data-conversation-scroll] .ylv09G_toBottomSlot{bottom:calc(var(--dsh-composer-height,152px) + 16px)}.ylv09G_toBottom{border:1px solid var(--dsw-alias-border-l2);width:34px;height:34px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-button-floating-fill);box-shadow:var(--dsw-shadow-lv2);cursor:pointer;pointer-events:auto;border-radius:100px;justify-content:center;align-items:center;margin-top:-34px;padding:0;display:flex}.ylv09G_toBottom:hover{background:var(--dsw-alias-button-floating-hover)}",Hn="@deepseek-ai/dsh-client-ui-conversation/ChatView.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Hn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Hn,e.textContent=_o,document.head.appendChild(e)}var ae={"dsh-turn-status-shimmer":"ylv09G_dsh-turn-status-shimmer",column:"ylv09G_column",flowItem:"ylv09G_flowItem",hint:"ylv09G_hint",turnStatusClock:"ylv09G_turnStatusClock",toBottom:"ylv09G_toBottom",toBottomSlot:"ylv09G_toBottomSlot",openError:"ylv09G_openError",scroll:"ylv09G_scroll",turnStatus:"ylv09G_turnStatus",older:"ylv09G_older",callRow:"ylv09G_callRow",root:"ylv09G_root"};const Ao=(0,h.memo)(r(function({nodeKey:t,selectedCallId:n,cwd:s,openFile:o,inspectCall:a,forkAt:l,loadImage:c,fileMentions:d,useSession:u,renderSlot:f,t:m}){const k=u(w=>w.chat.nodes.get(t)),g=k,y=(0,h.useMemo)(()=>k===void 0?null:{selectedCallId:n,cwd:s,openFile:o,inspectCall:a,forkAt:l,loadImage:c,fileMentions:d},[k,n,s,o,a,l,c,d]);if(g===void 0||y===null)return null;const b={...y,node:g};return(0,i.jsx)("div",{className:ae.flowItem,"data-chat-anchor-key":g.key,"data-chat-flow-key":g.key,"data-chat-flow-kind":g.kind,children:f("conversation.chat.node",b,{entryKey:g.kind,hookContext:t,fallback:(0,i.jsx)(_.JsonBlock,{label:m("message.unknownSurface",{type:g.kind}),payload:g.data,truncatedLabel:r(w=>m("json.truncated",{total:w}),"truncatedLabel")})})})},"ChatNodeSeat"));function Pe(e){return e.closest("[data-conversation-scroll]")??e}r(Pe,"scrollerOf");function Yn(e,t){for(const n of e.querySelectorAll("[data-chat-anchor-key]"))if(n.dataset.chatAnchorKey===t)return n;return null}r(Yn,"anchorElement");function gt(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}r(gt,"flowTop");function Qn(e,t){const n=t.getBoundingClientRect(),s=t.querySelector("[data-composer-seat]")?.getBoundingClientRect().top??n.bottom;if(typeof document.elementsFromPoint=="function"&&s>n.top){const a=e.getBoundingClientRect(),l=Math.max(n.left,a.left),c=Math.min(n.right,a.right),d=l+Math.max(0,c-l)/2,u=s-n.top,f=[1,Math.min(32,u/3),u/2,Math.max(1,u-1)];for(const m of f)for(const k of document.elementsFromPoint(d,n.top+m)){const g=k instanceof HTMLElement?k.closest("[data-chat-anchor-key]"):null;if(g!==null&&e.contains(g))return g}}const o=[...e.querySelectorAll("[data-chat-anchor-key]")];return o.filter(a=>{const l=a.getBoundingClientRect();return l.bottom>n.top&&l.top<s})[0]??o[0]??null}r(Qn,"pagingAnchor");function Zn(e,t){const n=Qn(e,t),s=n?.dataset.chatAnchorKey;return n===null||s===void 0?null:{anchorKey:s,anchorTop:gt(n,t),scrollTop:t.scrollTop}}r(Zn,"scrollPosition");function So(e){let t=null;for(const n of e.turns.values())n.status==="open"&&n.start!==void 0&&(t=n.start.time);return t}r(So,"runningTurnStartTime");function Co({startTime:e,t}){const[n]=(0,h.useState)(()=>Date.now()),s=e??n,[o,a]=(0,h.useState)(()=>Math.max(0,Date.now()-s));(0,h.useEffect)(()=>{const c=r(()=>{a(Math.max(0,Date.now()-s))},"tick");c();const d=setInterval(c,1e3);return()=>{clearInterval(d)}},[s]);const l=o>=15e3;return(0,i.jsxs)("div",{className:ae.turnStatus,role:"status","aria-live":"polite",children:["Deep diving...",l&&(0,i.jsx)("span",{className:ae.turnStatusClock,"aria-hidden":!0,children:_n(o,t)})]})}r(Co,"TurnStatus");function jo({useSession:e,useSessions:t,useStore:n,renderSlot:s,sessionId:o,openFile:a,loadOlder:l,loadImage:c,inspectCall:d,chatScroll:u,forkAt:f,fileMentions:m,t:k}){const g=e(C=>C.chat.order),y=e(C=>C.chat.nodes),b=e(C=>C.chat.timeline),w=e(C=>C.queue),j=t(C=>C.byId[o]?.cwd),x=e(C=>C.running),A=e(C=>C.openState),S=e(C=>C.openError),z=e(C=>C.hasMore),ne=e(C=>C.loadingOlder),Ee=n(C=>C.selection?.callId),he=(0,h.useMemo)(()=>w.filter(C=>C.placement==="steering"),[w]),Xe=(0,h.useMemo)(()=>So(b),[b]),Z=(0,h.useRef)(null),Ge=(0,h.useRef)(null),be=(0,h.useRef)(!0),[O,Q]=(0,h.useState)(!0),me=(0,h.useRef)(0),se=(0,h.useRef)(null),ee=(0,h.useRef)(null),Te=(0,h.useRef)(!1),pe=(0,h.useRef)(null),fe=(0,h.useRef)(null),Oe=(0,h.useRef)(null),Ve=g[0],E=Ve===void 0?null:y.get(Ve)?.anchorSeq??null,L=g.at(-1)??null,de=L===null?void 0:y.get(L),we=he[he.length-1]?.id??null,ge=`${A}:${E}:${L}:${g.length}:${x?1:0}:${we??""}`,Le=r(C=>{se.current=null,C.scrollTop=C.scrollHeight,me.current=C.scrollTop,be.current=!0,Q(!0),u.save(null)},"toBottom");(0,h.useLayoutEffect)(()=>{const C=Z.current;if(C===null)return;const q=Pe(C);if(A==="open"&&!Te.current){Te.current=!0;const X=u.read();if(X===null)Le(q);else{q.scrollTop=X.scrollTop;const De=Yn(C,X.anchorKey);De!==null&&(q.scrollTop+=gt(De,q)-X.anchorTop),me.current=q.scrollTop;const _e=q.scrollHeight-q.scrollTop-q.clientHeight<=25;be.current=_e,Q(_e);const Ye=_e?null:Zn(C,q);_e?u.save(null):Ye!==null&&u.save(Ye)}ee.current=E,pe.current=L,fe.current=we,Oe.current=ge;return}if(se.current!==null&&E!==null&&ee.current!==null&&E<ee.current){const X=se.current;se.current=null;const De=Yn(C,X.key);De!==null&&(q.scrollTop+=gt(De,q)-X.top),me.current=q.scrollTop,ee.current=E,pe.current=L,fe.current=we,Oe.current=ge;return}ee.current=E;const J=L!==pe.current&&de?.kind==="user",ke=we!==null&&we!==fe.current,F=Oe.current!==ge;pe.current=L,fe.current=we,Oe.current=ge,(J||ke||F&&be.current)&&Le(q)});const bt=(0,h.useRef)(()=>{});bt.current=()=>{const C=Z.current;if(C===null)return;const q=Pe(C),J=Math.max(0,q.scrollHeight-q.clientHeight),ke=Math.abs(q.scrollTop-Math.min(me.current,J))>.5,F=ke?J-q.scrollTop<=25:be.current;if(!ke&&F){Le(q);return}be.current=F,Q(F);const X=F?null:Zn(C,q);F?se.current=null:se.current!==null&&X!==null&&(se.current={key:X.anchorKey,top:X.anchorTop}),F?u.save(null):X!==null&&u.save(X),me.current=q.scrollTop},(0,h.useEffect)(()=>{const C=Z.current;if(C===null)return;const q=Pe(C),J=r(()=>{bt.current()},"onScroll");return q.addEventListener("scroll",J,{passive:!0}),()=>{q.removeEventListener("scroll",J)}},[]);const He=(0,h.useRef)(null);He.current=()=>{const C=Z.current;if(C!==null&&be.current){const q=Pe(C);q.scrollTop=q.scrollHeight,me.current=q.scrollTop,u.save(null)}},(0,h.useEffect)(()=>{const C=Ge.current,q=Z.current;if(C===null||q===null||typeof ResizeObserver>"u")return;const J=Pe(q).querySelector("[data-composer-seat]"),ke=new ResizeObserver(()=>{He.current?.()});return ke.observe(C),J!==null&&ke.observe(J),()=>{ke.disconnect()}},[]),(0,h.useEffect)(()=>{ne||(se.current=null)},[ne]);const lt=r(()=>{const C=Z.current;if(C!==null){const q=Pe(C),J=Qn(C,q);J!==null&&J.dataset.chatAnchorKey!==void 0&&(se.current={key:J.dataset.chatAnchorKey,top:gt(J,q)})}l()},"loadOlderAnchored");return(0,i.jsx)("div",{className:ae.root,children:(0,i.jsxs)("div",{ref:Z,className:ae.scroll,children:[(0,i.jsxs)("div",{ref:Ge,className:ae.column,"data-chat-flow":"",children:[A==="loading"&&(0,i.jsx)("div",{className:ae.hint,children:k("chat.loadingHistory")}),A==="error"&&S!==null&&(0,i.jsx)("div",{className:ae.openError,children:k("chat.loadError",{message:S.message,code:S.code})}),z&&(0,i.jsx)("div",{className:ae.older,children:(0,i.jsx)("button",{type:"button",disabled:ne,onClick:lt,children:k(ne?"loading":"chat.loadOlder")})}),g.map(C=>(0,i.jsx)(Ao,{nodeKey:C,useSession:e,selectedCallId:Ee,cwd:j,openFile:a,inspectCall:d,forkAt:f,loadImage:c,fileMentions:m,renderSlot:s,t:k},C)),x&&(0,i.jsx)(Co,{startTime:Xe,t:k}),he.map(C=>(0,i.jsx)(go,{content:C.content,loadImage:c,t:k},C.id))]}),!O&&(0,i.jsx)("div",{className:ae.toBottomSlot,children:(0,i.jsx)("button",{type:"button",className:ae.toBottom,"aria-label":k("chat.toBottom"),onClick:r(()=>{const C=Z.current;C!==null&&Le(Pe(C))},"onClick"),children:(0,i.jsx)(_.IconChevronDownOutline14,{})})})]})})}r(jo,"ChatView");var Io=class{static{r(this,"PendingApproval")}wait;constructor(e){this.wait=e}get key(){return this.wait.key}get toolName(){return this.wait.payload.toolName}get reason(){return this.wait.payload.reason}get callId(){return this.wait.payload.callId}async answer(e){const t=await this.wait.respond({ok:!0,value:{sessionId:this.wait.sessionId,approvalId:this.wait.payload.approvalId,outcome:e}});if(!t.accepted)throw new Error(`approval response rejected: ${t.reason}`)}};function es(e){return e?.kind==="tool-call"?e:void 0}r(es,"toolNode");function No(e,t){return es(e.chat.nodes.get((0,D.conversationContextKey)("tool-call",t)))?.data.root}r(No,"rootToolCall");function Eo(e,t){const n=r(s=>{if(s.callId===t)return s;for(const o of s.subCalls){const a=n(o);if(a!==void 0)return a}},"visit");for(const s of e.chat.nodes.values()){const o=es(s)?.data.root;if(o===void 0)continue;const a=n(o);if(a!==void 0)return a}}r(Eo,"findToolCall");const To=".XI9R9W_root{padding:8px calc(var(--dsh-composer-side-clearance) + 16px) 12px;flex-direction:column;align-items:center;display:flex}.XI9R9W_card{width:100%;max-width:var(--dsh-chat-content-width);border:1px solid var(--dsw-alias-state-warn-secondary);background:var(--dsw-specific-input-major);box-shadow:var(--dsw-shadow-lv2);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:20px;overflow:hidden}.XI9R9W_strip{background:var(--dsw-alias-state-warn-tertiary);color:var(--dsw-alias-state-warn-primary);align-items:center;gap:8px;padding:10px 16px;font-size:13px;line-height:18px;display:flex}.XI9R9W_dot{background:var(--dsw-alias-state-warn-primary);border-radius:50%;width:8px;height:8px}.XI9R9W_body{box-sizing:border-box;max-height:var(--dsh-composer-text-max-height);flex-direction:column;gap:6px;padding:12px 16px 0;display:flex;overflow-y:auto}.XI9R9W_headline{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:500;line-height:24px}.XI9R9W_command{color:var(--dsw-alias-label-tertiary);font-family:var(--ds-font-family-code);word-break:break-all;font-size:13px;line-height:20px}.XI9R9W_actionRow{justify-content:flex-end;gap:8px;padding:14px 16px;display:flex}.XI9R9W_reject:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary);border-color:#0000}",ts="@deepseek-ai/dsh-client-ui-conversation/ApprovalPanel.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(ts)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=ts,e.textContent=To,document.head.appendChild(e)}var Ie={dot:"XI9R9W_dot",reject:"XI9R9W_reject",body:"XI9R9W_body",root:"XI9R9W_root",actionRow:"XI9R9W_actionRow",headline:"XI9R9W_headline",card:"XI9R9W_card",strip:"XI9R9W_strip",command:"XI9R9W_command"};function qo(e){if(e!==void 0)try{const t=JSON.parse(e.argsRaw);return typeof t.command=="string"?t.command:void 0}catch{return}}r(qo,"commandOf");function Ro(e){const t=(0,h.useMemo)(()=>new Io(e.matched),[e.matched]),n=e.useSession(s=>{if(t.callId===void 0)return;const o=No(s,t.callId);if(o!==void 0)return o.callId===t.callId&&!("kind"in o)?qo(o):void 0});return(0,i.jsx)(Mo,{pending:t,t:e.t,...n===void 0?{}:{command:n}},t.key)}r(Ro,"ApprovalPanel");function Mo({pending:e,command:t,t:n}){const[s,o]=(0,h.useState)(!1),a=r(l=>{o(!0),e.answer(l).catch(()=>{o(!1)})},"answer");return(0,i.jsx)("div",{className:Ie.root,"data-approval-key":e.key,children:(0,i.jsxs)("div",{className:Ie.card,children:[(0,i.jsxs)("div",{className:Ie.strip,children:[(0,i.jsx)("span",{className:Ie.dot}),n("approval.waiting")]}),(0,i.jsxs)("div",{className:Ie.body,"data-approval-scroll":"",tabIndex:0,role:"group","aria-label":n("approval.detail.aria"),children:[(0,i.jsx)("div",{className:Ie.headline,children:e.reason??n("approval.escalation",{toolName:e.toolName})}),t!==void 0&&(0,i.jsx)("div",{className:Ie.command,children:t})]}),(0,i.jsxs)("div",{className:Ie.actionRow,children:[(0,i.jsx)(_.Button,{variant:"outline",className:Ie.reject,disabled:s,onClick:r(()=>{a("rejected")},"onClick"),children:n("approval.reject")}),(0,i.jsx)(_.Button,{variant:"primary",disabled:s,onClick:r(()=>{a("allowed-once")},"onClick"),children:n("approval.allowOnce")})]})]})})}r(Mo,"ApprovalFlow");const U="conversation",ns="描述你的任务以生成计划",ss="describe your task to generate plan",Wo={"view.chat":"对话","hint.plan":ns,"hint.goal":"输入目标,智能体将持续执行","hint.goal.active":"当前目标进行中。可输入 edit 修改 / pause 暂停 / resume 继续 / clear 清除","placeholder.plan":ns,"placeholder.default":"给智能体发消息","placeholder.unavailable":"会话不可用","placeholder.parentOffline":"父会话已离线,无法继续发送;仍可停止当前运行","placeholder.hero":"描述你想要构建的内容","placeholder.workspace":"选择一个工作区开始","input.commands":"命令","input.stop":"停止生成","input.send":"发送消息","placeholder.steerQueue":"Cmd/Ctrl+Enter 插话发送全部排队消息","input.accessMode":"访问模式,当前:{name}","image.dropTitle":"图片拖动到此处即可添加","image.dropDesc":"最多 {count} 张,每张 {size}","image.dropBlocked":"当前无法添加图片","image.pending":"待发送图片","image.openOriginal":"查看原图","image.openOriginalLabel":"{label},点击查看原图","image.remove":"移除图片 {name}","image.scrollLeft":"向左滚动图片","image.scrollRight":"向右滚动图片","image.original":"原图","image.label":"图片","image.loadFailed":"图片加载失败,点击重试","image.loading":"图片加载中…","image.preview":"原图预览","image.closePreview":"关闭原图预览","image.serviceUnavailable":"图片读取服务不可用","image.unsupportedType":"仅支持 PNG、JPG、WebP、GIF 格式的图片","image.tooMany":"一条消息最多添加 {count} 张图片","image.fileTooLarge":"单张图片不能超过 {size}","image.totalTooLarge":"图片总大小超过 {size},请移除部分图片","image.tooManyPixels":"图片分辨率过大,请压缩后重试","image.modelUnsupported":"当前模型不支持图片,请切换支持图片的模型","image.subagentUnsupported":"子智能体会话暂不支持图片","image.sendFailed":"图片发送失败({reason}),请重新添加图片后再试","context.aria":"上下文已用 {percent}","context.used":"上下文已用","context.system":"系统提示词","context.tools":"工具","context.messages":"对话消息","stats.counts":"{turns} 轮 · {steps} 步","stats.llm":"LLM {duration}","stats.toolCall":"工具调用 {duration}","stats.ttftAverage":"首 token 平均 {duration}","stats.tokensPerSecond":"{throughput} tok/s","stats.cacheHit":"缓存命中 {percent}%","stats.tokens":"输入 {input} tok · 输出 {output} tok",disclaimer:"当前版本为开发者预览版,可能存在部分使用风险,请谨慎控制AI权限","settings.enter.title":"繁忙时 Enter 键行为","settings.enter.description":"仅在智能体运行时生效;Cmd/Ctrl+Enter 使用另一行为","settings.enter.queue":"排队发送","settings.enter.steer":"插话发送","access.confirm.title":"确认启用 Full access?","access.confirm.description":"启用 Full access 后,agent 将减少确认步骤,并且可以直接执行更多操作,包括敏感操作、文件修改或外部命令。仅建议在你信任当前任务时使用。","access.confirm.acknowledge":"我已了解风险,并愿意继续","access.confirm.cancel":"取消","access.confirm.enable":"启用 Full access","hero.headline":"探索未至之境","hero.preview":"预览版","hero.chooseWorkspace":"选择工作区","session.hierarchy":"会话层级","details.title":"详情","details.close":"关闭详情","details.empty":"点击消息流中的工具行查看详情","details.notInWindow":"该调用不在当前窗口内","details.input":"输入","details.output":"输出","details.running":"运行中…","todo.title":"任务","todo.progress.done":"{done} 已完成","todo.progress.active":"{active} 进行中","todo.progress.pending":"{pending} 待处理","todo.rowTitle":"更新任务清单","todo.completed":"{done}/{total} 已完成","chat.loadingHistory":"载入历史…","chat.loadError":"历史加载失败:{message}({code})","chat.loadOlder":"加载更早","chat.toBottom":"回到底部","message.extraBlock":"附加内容块","message.contextInjection":"上下文注入","message.contextRecall":"跨会话召回","message.context.instructions.loaded":"已载入","message.context.instructions.added":"已新增","message.context.instructions.updated":"已更新","message.context.instructions.removed":"已移除","message.context.catalog.replaced":"替换目录","message.context.catalog.more":"…还有 {count} 条","message.context.snapshot.supersedes":"取代先前的快照","message.context.relay.from":"来自会话 {session}","message.context.recall.counts":"保留 {retained} 条 · 省略 {omitted} 条","message.context.recall.truncated":"已截断","message.compaction":"上下文已压缩","message.compaction.running":"正在压缩…","message.compaction.completed":"已压缩 {items} 条历史记录(约 {tokens} tokens)","message.compaction.expand":"点击查看压缩摘要","message.compaction.unavailable":"压缩摘要不可用","message.unknownSurface":"未知 surface 事件:{type}","message.unknownBlock":"未知内容块","message.stopped":"已停止","message.branch":"在新对话中分支","message.branchUnavailable":"仅可从已完成轮次的最后一条消息分支","message.retry.active":"正在重试模型请求","message.retry.cancelled":"模型请求重试已取消","message.retry.started":"已重试模型请求","message.retry.scheduled":"等待重试模型请求","message.retry.status":"{label}({retry}/{maximum}) · {seconds}s","message.retry.delay":"重试延迟:","message.retry.failure":"失败原因:","message.turnError":"本轮运行失败","message.maxTokens":"已达到输出 token 上限","message.maxTokens.hint":"回答被截断,已有输出保留在对话中。发送“继续”可让模型接着输出。","message.ranFor":"用时 {duration}","message.ttft":"首 token {seconds}秒","message.tokensPerSecond":"{tps} tok/s","duration.seconds":"{seconds}秒","duration.minutes":"{minutes}分{seconds}秒","command.running":"执行中…","command.failed":"命令失败","command.done":"已完成","command.title":"命令","approval.waiting":"等待审批","approval.detail.aria":"审批详情","approval.escalation":"工具 {toolName} 请求越权执行","approval.reject":"拒绝","approval.allowOnce":"允许一次","ask.rowTitle":"提问","ask.waiting":"等待回答","ask.cancelled":"已取消","ask.interrupted":"已中断","ask.answered":"{answered}/{total} 已回答","bash.running":"运行中","bash.failed":"失败","bash.stopped":"已停止","row.running":"运行中","row.failed":"失败","row.stopped":"已停止","queue.count":"{n} 条排队消息","queue.edit":"编辑排队消息","queue.edit.unsupported":"包含非文本内容,暂不支持编辑","queue.save":"保存排队消息","queue.cancelEdit":"取消编辑","queue.remove":"删除排队消息","queue.steer":"插话发送","queue.steer.unavailable":"仅运行中可插话发送","queue.editFailed":"编辑失败:这条消息可能已经开始发送。","queue.removeFailed":"删除失败:这条消息可能已经开始发送。","queue.steerFailed":"插话发送失败,请重试。","terminal.signal":"信号 {signal}","terminal.exitCode":"退出码 {code}","terminal.running":"运行中","terminal.failed":"失败","terminal.done":"已完成","terminal.noOutput":"无输出","terminal.collapseAria":"收起输出","terminal.expandAria":"展开其余 {n} 行输出","terminal.expandRest":"… 其余 {n} 行","json.truncated":"… 已截断,共 {total} 字符","clock.md":"{m}月{d}日","clock.ymd":"{y}年{m}月{d}日"},Go={"view.chat":"Chat","hint.plan":ss,"hint.goal":"describe the objective for a long-running task","hint.goal.active":"goal active — edit / pause / resume / clear","placeholder.plan":ss,"placeholder.default":"Message the agent","placeholder.unavailable":"Session unavailable","placeholder.parentOffline":"Parent session offline; sending is unavailable but you can still stop the run","placeholder.hero":"Describe what you want to build","placeholder.workspace":"Choose a workspace to start","input.commands":"Commands","input.stop":"Stop generating","input.send":"Send message","placeholder.steerQueue":"Cmd/Ctrl+Enter steers all queued messages","input.accessMode":"Access mode, current: {name}","image.dropTitle":"Drag images here to add them","image.dropDesc":"Up to {count} images, {size} each","image.dropBlocked":"Images cannot be added right now","image.pending":"Pending images","image.openOriginal":"View original","image.openOriginalLabel":"{label}, click to view original","image.remove":"Remove image {name}","image.scrollLeft":"Scroll images left","image.scrollRight":"Scroll images right","image.original":"Original image","image.label":"Image","image.loadFailed":"Image failed to load; click to retry","image.loading":"Loading image…","image.preview":"Original image preview","image.closePreview":"Close original image preview","image.serviceUnavailable":"Image loading service unavailable","image.unsupportedType":"Only PNG, JPG, WebP, and GIF images are supported","image.tooMany":"A message can include up to {count} images","image.fileTooLarge":"Each image must be smaller than {size}","image.totalTooLarge":"Images exceed {size} in total; remove some and try again","image.tooManyPixels":"Image resolution is too high; compress it and try again","image.modelUnsupported":"The current model does not support images; switch to a model that does","image.subagentUnsupported":"Subagent sessions do not support images yet","image.sendFailed":"Sending images failed ({reason}); re-add them and try again","context.aria":"{percent} of context used","context.used":"of context used","context.system":"System prompt","context.tools":"Tools","context.messages":"Messages","stats.counts":"{turns} turns · {steps} steps","stats.llm":"LLM {duration}","stats.toolCall":"Tool call {duration}","stats.ttftAverage":"TTFT avg {duration}","stats.tokensPerSecond":"{throughput} tok/s","stats.cacheHit":"Cache hit {percent}%","stats.tokens":"Input {input} tok · Output {output} tok",disclaimer:"This version is a developer preview and may involve usage risks. Please control AI permissions carefully.","settings.enter.title":"Enter behavior while busy","settings.enter.description":"Busy only; Cmd/Ctrl+Enter uses the other behavior","settings.enter.queue":"Queue","settings.enter.steer":"Steer","access.confirm.title":"Enable Full access?","access.confirm.description":"Full access reduces confirmation steps and lets the agent perform more actions directly, including sensitive operations, file changes, or external commands. Only use it when you trust the current task.","access.confirm.acknowledge":"I understand the risks and want to continue","access.confirm.cancel":"Cancel","access.confirm.enable":"Enable Full access","hero.headline":"Into the Unknown","hero.preview":"Preview","hero.chooseWorkspace":"Choose workspace","session.hierarchy":"Session hierarchy","details.title":"Details","details.close":"Close details","details.empty":"Click a tool row in the message flow to view its details","details.notInWindow":"This call is outside the current window","details.input":"Input","details.output":"Output","details.running":"Running…","todo.title":"To-dos","todo.progress.done":"{done} completed","todo.progress.active":"{active} in progress","todo.progress.pending":"{pending} pending","todo.rowTitle":"Update to-do list","todo.completed":"{done}/{total} completed","chat.loadingHistory":"Loading history…","chat.loadError":"Failed to load history: {message} ({code})","chat.loadOlder":"Load earlier","chat.toBottom":"Back to bottom","message.extraBlock":"Extra content block","message.contextInjection":"Context injection","message.contextRecall":"Session recall","message.context.instructions.loaded":"loaded","message.context.instructions.added":"added","message.context.instructions.updated":"updated","message.context.instructions.removed":"removed","message.context.catalog.replaced":"Replacement catalog","message.context.catalog.more":"… {count} more","message.context.snapshot.supersedes":"Supersedes earlier snapshots","message.context.relay.from":"From session {session}","message.context.recall.counts":"{retained} kept · {omitted} omitted","message.context.recall.truncated":"truncated","message.compaction":"Context compacted","message.compaction.running":"Compacting context…","message.compaction.completed":"Compacted {items} history items (~{tokens} tokens)","message.compaction.expand":"View compaction summary","message.compaction.unavailable":"Compaction summary unavailable","message.unknownSurface":"Unknown surface event: {type}","message.unknownBlock":"Unknown content block","message.stopped":"Stopped","message.branch":"Branch into a new conversation","message.branchUnavailable":"Available only on the last message of a completed turn","message.retry.active":"Retrying model request","message.retry.cancelled":"Model request retry cancelled","message.retry.started":"Retried model request","message.retry.scheduled":"Waiting to retry model request","message.retry.status":"{label} ({retry}/{maximum}) · {seconds}s","message.retry.delay":"Retry delay: ","message.retry.failure":"Failure reason: ","message.turnError":"This turn failed","message.maxTokens":"Output token limit reached","message.maxTokens.hint":'The reply was cut off; earlier output is preserved in the conversation. Send "continue" to let the model resume.',"message.ranFor":"Ran for {duration}","message.ttft":"TTFT {seconds}s","message.tokensPerSecond":"{tps} tok/s","duration.seconds":"{seconds}s","duration.minutes":"{minutes}m {seconds}s","command.running":"Running…","command.failed":"Command failed","command.done":"Completed","command.title":"Command","approval.waiting":"Waiting for approval","approval.detail.aria":"Approval details","approval.escalation":"Tool {toolName} requests privileged execution","approval.reject":"Reject","approval.allowOnce":"Allow once","ask.rowTitle":"Ask question","ask.waiting":"waiting","ask.cancelled":"cancelled","ask.interrupted":"interrupted","ask.answered":"{answered}/{total} answered","bash.running":"Running","bash.failed":"Failed","bash.stopped":"Stopped","row.running":"Running","row.failed":"Failed","row.stopped":"Stopped","queue.count":"{n} queued messages","queue.edit":"Edit queued message","queue.edit.unsupported":"Contains non-text content; editing is not supported yet","queue.save":"Save queued message","queue.cancelEdit":"Cancel editing","queue.remove":"Remove queued message","queue.steer":"Steer queued message","queue.steer.unavailable":"Steering is available only while the agent is running","queue.editFailed":"Edit failed: this message may have already started sending.","queue.removeFailed":"Removal failed: this message may have already started sending.","queue.steerFailed":"Steering failed. Try again.","terminal.signal":"signal {signal}","terminal.exitCode":"exit code {code}","terminal.running":"Running","terminal.failed":"Failed","terminal.done":"Done","terminal.noOutput":"No output","terminal.collapseAria":"Collapse output","terminal.expandAria":"Expand the remaining {n} output lines","terminal.expandRest":"… {n} more lines","json.truncated":"… truncated, {total} characters total","clock.md":"{m}/{d}","clock.ymd":"{y}-{m}-{d}"},Oo=".MOxlRG_root{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-specific-tip);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:12px;flex:none;margin:0 auto;overflow:hidden}.MOxlRG_body{flex-direction:column;gap:8px;padding:6px 12px;display:flex}.MOxlRG_header{text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;width:100%;padding:0;display:flex}.MOxlRG_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.MOxlRG_title{color:var(--dsw-alias-label-primary);flex:none;font-size:13px;font-weight:500;line-height:24px}.MOxlRG_progress{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:13px;font-weight:400;line-height:20px;overflow:hidden}.MOxlRG_chevron{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.MOxlRG_list{flex-direction:column;gap:8px;max-height:180px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.MOxlRG_item{min-width:0;color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:13px;line-height:20px;display:flex}.MOxlRG_glyph{flex:none;place-items:center;width:16px;height:16px;display:grid}.MOxlRG_glyphCompleted{color:var(--dsw-alias-state-success-primary)}.MOxlRG_glyphPending{color:var(--dsw-alias-label-caption)}.MOxlRG_glyphProgress{color:var(--dsw-alias-state-business-primary);animation:1s linear infinite MOxlRG_todo-progress-spin}@keyframes MOxlRG_todo-progress-spin{to{transform:rotate(360deg)}}.MOxlRG_content{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}",rs="@deepseek-ai/dsh-client-ui-conversation/TodoPanel.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(rs)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=rs,e.textContent=Oo,document.head.appendChild(e)}var te={progress:"MOxlRG_progress",glyph:"MOxlRG_glyph",list:"MOxlRG_list",content:"MOxlRG_content",root:"MOxlRG_root",glyphCompleted:"MOxlRG_glyphCompleted",glyphPending:"MOxlRG_glyphPending",chevron:"MOxlRG_chevron",body:"MOxlRG_body",lead:"MOxlRG_lead",title:"MOxlRG_title",header:"MOxlRG_header",glyphProgress:"MOxlRG_glyphProgress",item:"MOxlRG_item","todo-progress-spin":"MOxlRG_todo-progress-spin"};function Lo(e){throw new Error(`unreachable todo status: ${String(e)}`)}r(Lo,"assertNever");function Do(){return(0,i.jsxs)("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:te.glyphCompleted,children:[(0,i.jsx)("circle",{cx:"7",cy:"7",r:"6.4",stroke:"currentColor",strokeWidth:"1.2"}),(0,i.jsx)("path",{d:"M10.9631 5.71411L7.70154 8.97571C7.48011 9.19714 7.27736 9.40099 7.09229 9.54993C6.89742 9.70669 6.66314 9.85279 6.3634 9.90027C6.2049 9.92534 6.04339 9.92534 5.88489 9.90027C5.58515 9.85279 5.35087 9.70669 5.15601 9.54993C4.97093 9.40099 4.76818 9.19714 4.54675 8.97571L3.03516 7.46411L3.96313 6.53613L5.47473 8.04773C5.7169 8.28989 5.86196 8.43389 5.97888 8.52795C6.08597 8.61409 6.10875 8.60701 6.08997 8.604C6.11259 8.60758 6.13571 8.60758 6.15833 8.604C6.13954 8.60701 6.16232 8.61409 6.26941 8.52795C6.38633 8.43389 6.53139 8.28989 6.77356 8.04773L10.0352 4.78613L10.9631 5.71411Z",fill:"currentColor"})]})}r(Do,"CompletedGlyph");function Bo(){const e=(0,h.useId)();return(0,i.jsxs)("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:te.glyphProgress,children:[(0,i.jsx)("defs",{children:(0,i.jsxs)("linearGradient",{id:e,x1:"2.5",y1:"12",x2:"10.5",y2:"3.5",gradientUnits:"userSpaceOnUse",children:[(0,i.jsx)("stop",{stopColor:"currentColor"}),(0,i.jsx)("stop",{offset:"1",stopColor:"currentColor",stopOpacity:"0"})]})}),(0,i.jsx)("circle",{cx:"7",cy:"7",r:"6.4",stroke:`url(#${e})`,strokeWidth:"1.2"})]})}r(Bo,"ProgressGlyph");function $o(){return(0,i.jsx)("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:te.glyphPending,children:(0,i.jsx)("circle",{cx:"7",cy:"7",r:"6.4",stroke:"currentColor",strokeWidth:"1.2",strokeDasharray:"2.4 2.4"})})}r($o,"PendingGlyph");function Uo({status:e}){switch(e){case"completed":return(0,i.jsx)(Do,{});case"in_progress":return(0,i.jsx)(Bo,{});case"pending":return(0,i.jsx)($o,{});default:return Lo(e)}}r(Uo,"StatusGlyph");function Po(e,t){const n=e.filter(a=>a.status==="completed").length,s=e.filter(a=>a.status==="in_progress").length,o=e.length-n-s;return[...n>0?[t("todo.progress.done",{done:n})]:[],...s>0?[t("todo.progress.active",{active:s})]:[],...o>0?[t("todo.progress.pending",{pending:o})]:[]].join(" · ")}r(Po,"progressLabel");function zo({todos:e,t}){const[n,s]=(0,h.useState)(!0);return e.length===0?null:(0,i.jsx)("section",{className:te.root,"data-testid":"todo-panel","aria-label":t("todo.title"),children:(0,i.jsxs)("div",{className:te.body,children:[(0,i.jsxs)("button",{type:"button",className:te.header,"aria-expanded":!n,onClick:r(()=>{s(o=>!o)},"onClick"),children:[(0,i.jsx)("span",{className:te.lead,"aria-hidden":!0,children:(0,i.jsx)(_.IconChecklistOutline14,{})}),(0,i.jsx)("span",{className:te.title,children:t("todo.title")}),(0,i.jsx)("span",{className:te.progress,children:Po(e,t)}),(0,i.jsx)("span",{className:te.chevron,"aria-hidden":!0,children:n?(0,i.jsx)(_.IconChevronUpOutline14,{}):(0,i.jsx)(_.IconChevronDownOutline14,{})})]}),!n&&(0,i.jsx)("ul",{className:te.list,children:e.map(o=>(0,i.jsxs)("li",{className:te.item,"data-status":o.status,children:[(0,i.jsx)("span",{className:te.glyph,"aria-hidden":!0,children:(0,i.jsx)(Uo,{status:o.status})}),(0,i.jsx)("span",{className:te.content,children:o.content})]},o.content))})]})})}r(zo,"TodoPanel");function Fo({useProjection:e,t}){const n=e("todos");return(0,i.jsx)(zo,{todos:n??[],t})}r(Fo,"TodoDock");const Jo={name:"conversation-todo-dock",inject:["slots"],apply(e){e.slots.inject("conversation.input.dock",()=>e.slots.register({name:"conversation.input.dock",id:"todo",order:0,locale:U},Fo))}},Ko='.SIggOG_dock{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));margin:0 auto calc(0px - var(--dsh-composer-stack-gap) - 3px);padding:0 var(--dsh-composer-dock-inset);flex:none}.SIggOG_panel{background:var(--dsw-specific-tip);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:12px 12px 0 0;width:100%;padding:2px 0;position:relative;overflow:hidden}.SIggOG_panel:after{border:1px solid var(--dsw-alias-border-l1);border-radius:inherit;content:"";pointer-events:none;border-bottom:none;position:absolute;inset:0}.SIggOG_header{box-sizing:border-box;width:100%;height:36px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:8px;align-items:center;gap:10px;padding:4px 12px;display:flex}.SIggOG_header:focus-visible{outline:2px solid var(--dsw-alias-label-tertiary);outline-offset:-2px}.SIggOG_header:disabled{cursor:default}.SIggOG_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.SIggOG_count{min-width:0;font-family:Inter, var(--dsw-font-family);flex:auto;font-size:13px;font-weight:500;line-height:24px}.SIggOG_chevron{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.SIggOG_list{max-height:180px;margin:0;padding:0;list-style:none;overflow-y:auto}.SIggOG_row{box-sizing:border-box;border-radius:8px;align-items:center;gap:10px;width:100%;height:36px;padding:4px 5px 4px 12px;display:flex}.SIggOG_row+.SIggOG_row{box-shadow:inset 0 1px 0 var(--dsw-alias-border-l1)}.SIggOG_preview,.SIggOG_editor{min-width:0;font:var(--dsw-font-xs-13);font-family:Inter, var(--dsw-font-family);flex:auto}.SIggOG_preview{color:var(--dsw-alias-label-primary-dimmed);text-overflow:ellipsis;white-space:nowrap;word-break:break-word;overflow:hidden}.SIggOG_editor{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);height:28px;color:var(--dsw-alias-label-primary);border-radius:6px;outline:none;padding:0 8px}.SIggOG_editor:focus{border-color:var(--dsw-alias-state-business-primary)}.SIggOG_actions{flex:none;align-items:center;gap:10px;display:flex}.SIggOG_action{width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;padding:0;display:grid}.SIggOG_action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.SIggOG_action:focus-visible{outline:2px solid var(--dsw-alias-label-tertiary);outline-offset:-2px}.SIggOG_action:disabled{cursor:default;opacity:.45}',os="@deepseek-ai/dsh-client-ui-conversation/QueueDock.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(os)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=os,e.textContent=Ko,document.head.appendChild(e)}var V={action:"SIggOG_action",panel:"SIggOG_panel",actions:"SIggOG_actions",list:"SIggOG_list",chevron:"SIggOG_chevron",editor:"SIggOG_editor",header:"SIggOG_header",count:"SIggOG_count",preview:"SIggOG_preview",dock:"SIggOG_dock",row:"SIggOG_row",lead:"SIggOG_lead"};function Xo({useSession:e,updateQueue:t,notify:n,t:s}){const o=e(S=>S.queue),a=(0,h.useMemo)(()=>o.filter(S=>S.placement==="queued"),[o]),l=e(S=>S.running),c=e(S=>S.subagent===null),[d,u]=(0,h.useState)(null),[f,m]=(0,h.useState)(null),[k,g]=(0,h.useState)(!0),y=(0,h.useId)();if((0,h.useEffect)(()=>{a.length===0&&!k&&g(!0),d!==null&&(!c||!a.some(S=>S.id===d.id))&&u(null)},[k,d,a,c]),a.length===0)return null;const b=c&&(d!==null||f!==null),w=!k||b,j=a.length===1||w,x=r(async(S,z,ne)=>{m(S);try{return await t(S,z),!0}catch{return n("error",ne),!1}finally{m(Ee=>Ee===S?null:Ee)}},"applyAction"),A=r(async()=>{d===null||d.text.trim()===""||await x(d.id,{kind:"edit",content:[{type:"text",text:d.text}]},s("queue.editFailed"))&&u(null)},"saveEdit");return(0,i.jsx)("div",{className:V.dock,"data-queue-dock":"",children:(0,i.jsxs)("div",{className:V.panel,children:[a.length>1&&(0,i.jsxs)("button",{type:"button",className:V.header,"aria-controls":y,"aria-expanded":w,disabled:b,onClick:r(()=>{g(S=>!S)},"onClick"),children:[(0,i.jsx)("span",{className:V.lead,"aria-hidden":!0,children:(0,i.jsx)(_.IconQueueOutline14,{})}),(0,i.jsx)("span",{className:V.count,children:s("queue.count",{n:a.length})}),(0,i.jsx)("span",{className:V.chevron,"aria-hidden":!0,children:w?(0,i.jsx)(_.IconChevronDownOutline14,{}):(0,i.jsx)(_.IconChevronUpOutline14,{})})]}),(0,i.jsx)("ul",{id:y,className:V.list,hidden:!j,children:j&&a.map(S=>(0,i.jsxs)("li",{className:V.row,children:[a.length===1&&(0,i.jsx)("span",{className:V.lead,"aria-hidden":!0,children:(0,i.jsx)(_.IconQueueOutline14,{})}),d?.id===S.id?(0,i.jsx)("input",{autoFocus:!0,className:V.editor,"aria-label":s("queue.edit"),value:d.text,onChange:r(z=>{u({id:S.id,text:z.currentTarget.value})},"onChange"),onKeyDown:r(z=>{if(z.key==="Escape"){u(null);return}z.key==="Enter"&&!z.nativeEvent.isComposing&&(z.preventDefault(),A())},"onKeyDown")}):(0,i.jsx)("span",{className:V.preview,children:S.preview}),c&&(0,i.jsx)("div",{className:V.actions,children:d?.id===S.id?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_.Tooltip,{label:s("queue.save"),side:"bottom",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:V.action,"aria-label":s("queue.save"),disabled:f!==null||d.text.trim()==="",onClick:r(()=>{A()},"onClick"),children:(0,i.jsx)(_.IconCheckOutline16,{size:14})})}),(0,i.jsx)(_.Tooltip,{label:s("queue.cancelEdit"),side:"bottom",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:V.action,"aria-label":s("queue.cancelEdit"),disabled:f!==null,onClick:r(()=>{u(null)},"onClick"),children:(0,i.jsx)(_.IconCloseOutline16,{size:14})})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_.Tooltip,{label:s("queue.edit"),side:"bottom",delayMs:500,disabled:S.text===null,children:(0,i.jsx)("button",{type:"button",className:V.action,"aria-label":s("queue.edit"),title:S.text===null?s("queue.edit.unsupported"):void 0,disabled:f!==null||S.text===null,onClick:r(()=>{S.text!==null&&u({id:S.id,text:S.text})},"onClick"),children:(0,i.jsx)(_.IconEditOutline16,{size:14})})}),(0,i.jsx)(_.Tooltip,{label:s("queue.remove"),side:"bottom",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:V.action,"aria-label":s("queue.remove"),disabled:f!==null,onClick:r(()=>{x(S.id,{kind:"remove"},s("queue.removeFailed"))},"onClick"),children:(0,i.jsx)(_.IconTrashOutline16,{size:14})})}),(0,i.jsx)(_.Tooltip,{label:s("queue.steer"),side:"bottom",delayMs:500,disabled:!l,children:(0,i.jsx)("button",{type:"button",className:V.action,"aria-label":s("queue.steer"),title:l?void 0:s("queue.steer.unavailable"),disabled:f!==null||!l,onClick:r(()=>{x(S.id,{kind:"steer"},s("queue.steerFailed"))},"onClick"),children:(0,i.jsx)(_.IconSendOutline14,{})})})]})})]},S.id))})]})})}r(Xo,"QueueDock");const Vo={name:"conversation-queue-dock",inject:["slots","conversation","sessions"],apply(e){e.slots.inject("conversation.input.dock",()=>e.slots.register({name:"conversation.input.dock",id:"queue",order:20,locale:U,inject:r(t=>{const n=e.sessions.scope(t);if(n===void 0)throw new Error(`queue dock: session "${t}" resolved no scope`);const s=n.get("conversation");if(s===void 0)throw new Error("queue dock: conversation service unavailable");return{updateQueue:r((o,a)=>s.updateQueue(o,a),"updateQueue"),notify:r((o,a)=>{s.input.for(n).notify(o,a)},"notify")}},"inject")},Xo))}},Ho=".KYLh4G_root{justify-content:center;align-items:center;min-width:0;height:100%;padding:0 24px;display:flex}.KYLh4G_stack{width:100%;max-width:var(--dsh-composer-card-max-width);flex-direction:column;align-items:stretch;gap:12px;display:flex;overflow:visible}.KYLh4G_headline{color:var(--dsw-alias-label-primary);grid-template-columns:34px auto auto;justify-content:center;align-items:center;column-gap:10px;font-size:26px;font-weight:500;line-height:32px;display:grid}.KYLh4G_headlineText{grid-area:1/2}.KYLh4G_previewBadge{border:1px solid var(--dsw-alias-interactive-bg-hover);background:var(--dsw-alias-state-business-tertiary);color:var(--dsw-alias-label-primary-bluish);font-family:var(--ds-font-family-code);white-space:nowrap;border-radius:24px;grid-area:1/3;align-self:start;margin-top:2px;margin-left:-3px;padding:1px 7px 0;font-size:12px;font-weight:500;line-height:18px}.KYLh4G_fishHitbox{grid-area:1/1;justify-content:center;align-items:center;display:inline-flex}.KYLh4G_fish{color:var(--dsw-alias-label-primary);transform-origin:50% 60%}@keyframes KYLh4G_hero-fish-swim{0%,to{transform:translate(0)rotate(0)}35%{transform:translate(-1px,-1px)rotate(-5deg)}70%{transform:translate(1px)rotate(3deg)}}@media (hover:hover) and (prefers-reduced-motion:no-preference){.KYLh4G_fishHitbox:hover .KYLh4G_fish{animation:KYLh4G_hero-fish-swim var(--ds-transition-duration-slow) var(--ds-ease-in-out)}}.KYLh4G_body{flex-direction:column;gap:12px;min-width:0;display:flex;position:relative;overflow:visible}.KYLh4G_body>*{z-index:1;position:relative}.KYLh4G_body>.KYLh4G_workspaceRow{z-index:10;align-items:center;min-width:0;padding-left:8px;display:flex}.KYLh4G_workspace{max-width:min(100%,360px);min-height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:none;border-radius:16px;align-items:center;gap:4px;padding:0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.KYLh4G_workspace:not(:disabled):hover,.KYLh4G_workspace[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}.KYLh4G_workspace:disabled{cursor:default}.KYLh4G_folder{color:var(--dsw-alias-label-primary);flex:none}.KYLh4G_workspaceLabel{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.KYLh4G_chevron{color:var(--dsw-alias-label-caption);flex:none}.KYLh4G_modalInput{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;border-radius:22px;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.KYLh4G_modalInput::placeholder{color:var(--dsw-alias-label-caption)}.KYLh4G_modalInput:disabled{color:var(--dsw-alias-label-dimmed)}.KYLh4G_modalAction{min-width:72px}.KYLh4G_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}",is="@deepseek-ai/dsh-client-ui-conversation/HeroShell.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(is)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=is,e.textContent=Ho,document.head.appendChild(e)}var le={folder:"KYLh4G_folder",root:"KYLh4G_root",modalAction:"KYLh4G_modalAction",body:"KYLh4G_body",workspaceLabel:"KYLh4G_workspaceLabel",chevron:"KYLh4G_chevron",modalError:"KYLh4G_modalError",stack:"KYLh4G_stack",fish:"KYLh4G_fish",workspaceRow:"KYLh4G_workspaceRow",modalInput:"KYLh4G_modalInput",headline:"KYLh4G_headline",headlineText:"KYLh4G_headlineText",previewBadge:"KYLh4G_previewBadge",fishHitbox:"KYLh4G_fishHitbox",workspace:"KYLh4G_workspace","hero-fish-swim":"KYLh4G_hero-fish-swim"};function Yo(e){const t=(0,D.workspaceTitleOf)(e);return t!==""?t:e}r(Yo,"workspaceLabel");function Qo({buttonRef:e,label:t,menuOpen:n=!1,onClick:s,t:o}){return(0,i.jsxs)("button",{ref:e,type:"button",className:le.workspace,"aria-label":o("hero.chooseWorkspace"),"aria-haspopup":"menu","aria-expanded":n,onClick:s,children:[t===void 0?(0,i.jsx)(_.IconFolderClose16,{className:le.folder,size:16}):(0,i.jsx)(_.IconFolderOpen16,{className:le.folder,size:16}),(0,i.jsx)("span",{className:le.workspaceLabel,children:t??o("hero.chooseWorkspace")}),(0,i.jsx)(_.IconChevronDownOutline14,{className:le.chevron,size:12})]})}r(Qo,"WorkspaceChip");function Zo({className:e}){const t=`empty-glow-${(0,h.useId)().replace(/:/g,"")}`;return(0,i.jsxs)("svg",{className:e,viewBox:"0 0 1051 468",fill:"none","aria-hidden":"true",children:[(0,i.jsx)("defs",{children:(0,i.jsxs)("filter",{id:t,x:"0",y:"0",width:"1051",height:"468",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[(0,i.jsx)("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),(0,i.jsx)("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),(0,i.jsx)("feGaussianBlur",{stdDeviation:"50",result:"effect1_foregroundBlur"})]})}),(0,i.jsx)("g",{filter:`url(#${t})`,children:(0,i.jsx)("ellipse",{cx:"525.5",cy:"234",rx:"425.5",ry:"134",fill:"#6187D8",fillOpacity:"0.08"})})]})}r(Zo,"HeroGlow");function ei({t:e,children:t}){return(0,i.jsxs)("div",{className:le.root,children:[(0,i.jsxs)("div",{className:le.stack,children:[(0,i.jsxs)("div",{className:le.headline,children:[(0,i.jsx)("span",{className:le.fishHitbox,children:(0,i.jsx)(_.FishLogo,{size:34,className:le.fish})}),(0,i.jsx)("span",{className:le.headlineText,children:e("hero.headline")}),(0,i.jsx)("span",{className:le.previewBadge,children:e("hero.preview")})]}),(0,i.jsx)("div",{className:le.body})]}),t]})}r(ei,"HeroShell");const ti='._9N7-fW_root{background:var(--dsw-alias-bg-base);--dsh-chat-content-width:748px;--dsh-composer-card-max-width:calc(var(--dsh-chat-content-width) + 32px);--dsh-composer-side-clearance:16px;--dsh-composer-dock-inset:8px;flex-direction:column;min-width:0;height:100%;display:flex}._9N7-fW_disclaimer{width:100%;max-width:var(--dsh-chat-content-width);box-sizing:border-box;padding:0 calc(var(--dsh-composer-side-clearance) + 16px) 4px;color:var(--dsw-alias-label-tertiary);text-align:center;white-space:nowrap;text-overflow:ellipsis;flex:none;margin:0 auto;font-size:12px;line-height:20px;display:block;overflow:hidden}._9N7-fW_header{border-bottom:1px solid #0000;flex:none;padding:12px 28px 0 20px;position:relative}._9N7-fW_header:after{content:"";z-index:0;background:var(--dsw-alias-border-l2);pointer-events:none;height:1px;position:absolute;bottom:1px;left:0;right:0}._9N7-fW_headerHidden{display:none}._9N7-fW_titleRow{align-items:center;gap:0;min-height:32px;display:flex}._9N7-fW_titleCluster{flex:1;align-items:center;gap:10px;min-width:0;display:flex}._9N7-fW_crumbs{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex;overflow:hidden}._9N7-fW_crumbSeg{align-items:center;gap:4px;min-width:0;display:inline-flex}._9N7-fW_crumbSep{color:var(--dsw-alias-label-caption);font-size:14px;line-height:20px}._9N7-fW_crumb{max-width:220px;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;cursor:pointer;background:0 0;border:none;border-radius:12px;padding:4px 8px;font-size:14px;line-height:20px;overflow:hidden}._9N7-fW_crumb:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}._9N7-fW_crumbCurrent{color:var(--dsw-alias-label-primary);cursor:default;font-weight:500}._9N7-fW_headerActions{flex:none;align-items:center;gap:8px;display:flex}._9N7-fW_headerUtilities{flex:none;align-items:center;gap:8px;margin-left:20px;display:flex}._9N7-fW_headerUtilities:empty{display:none}._9N7-fW_tabs{z-index:1;gap:36px;margin-top:4px;padding-left:8px;display:flex;position:relative}._9N7-fW_tab{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;padding:0 0 11px;font-size:13px;font-weight:500;line-height:16px;position:relative}._9N7-fW_tab:after{content:"";background:0 0;border-radius:2px;height:2px;position:absolute;bottom:1px;left:0;right:0}._9N7-fW_tabActive{color:var(--dsw-alias-state-business-primary)}._9N7-fW_tabActive:after{background:var(--dsw-alias-state-business-primary)}._9N7-fW_viewArea{flex-direction:column;flex:1;min-height:0;display:flex}._9N7-fW_composerStack{--dsh-composer-stack-gap:6px;gap:var(--dsh-composer-stack-gap);flex-direction:column;display:flex}._9N7-fW_composerSeat{--dsh-composer-text-max-height:336px;flex-direction:column;flex:none;display:flex}._9N7-fW_root[data-phase=active]{overflow:hidden}._9N7-fW_root[data-phase=active] ._9N7-fW_header{flex:none}._9N7-fW_scrollBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden auto}._9N7-fW_root[data-phase=active] ._9N7-fW_viewArea{flex:1 0 auto;min-height:auto}._9N7-fW_root[data-phase=active] ._9N7-fW_composerSeat{z-index:7;background:linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 0%, transparent) 0px, var(--dsw-alias-bg-base) 36px);position:sticky;bottom:0}._9N7-fW_scrollBody:has([data-conversation-composer-overlay]){scrollbar-gutter:auto;position:relative;overflow:hidden auto}._9N7-fW_scrollBody:has([data-conversation-composer-overlay])>[data-slot=conversation\\.session]>._9N7-fW_viewArea{flex:1 1 0;min-height:0;overflow:hidden}._9N7-fW_scrollBody:has([data-conversation-composer-overlay])>._9N7-fW_composerSeat{right:var(--dsh-scrollbar-width);position:absolute;bottom:0;left:0}._9N7-fW_composerHero{width:min(calc(var(--dsh-composer-card-max-width) + 2 * var(--dsh-composer-side-clearance)), 100%);z-index:1;align-self:center;gap:8px;padding-bottom:32px;position:relative}._9N7-fW_heroGlow{z-index:-1;aspect-ratio:1051/468;pointer-events:none;width:135.438%;position:absolute;bottom:92px;left:50%;transform:translate(-50%,50%)}._9N7-fW_heroWorkspaceRow{align-items:center;gap:2px;min-width:0;margin-top:4px;padding-left:20px;display:flex}._9N7-fW_root[data-phase=hero] ._9N7-fW_scrollBody{justify-content:center;overflow-y:auto}._9N7-fW_root[data-phase=settling] ._9N7-fW_composerSeat{visibility:hidden}',as="@deepseek-ai/dsh-client-ui-conversation/ConversationRoot.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(as)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=as,e.textContent=ti,document.head.appendChild(e)}var P={root:"_9N7-fW_root",titleRow:"_9N7-fW_titleRow",headerUtilities:"_9N7-fW_headerUtilities",header:"_9N7-fW_header",crumb:"_9N7-fW_crumb",tabActive:"_9N7-fW_tabActive",crumbCurrent:"_9N7-fW_crumbCurrent",tabs:"_9N7-fW_tabs",crumbSep:"_9N7-fW_crumbSep",headerHidden:"_9N7-fW_headerHidden",viewArea:"_9N7-fW_viewArea",composerStack:"_9N7-fW_composerStack",composerSeat:"_9N7-fW_composerSeat",scrollBody:"_9N7-fW_scrollBody",composerHero:"_9N7-fW_composerHero",heroGlow:"_9N7-fW_heroGlow",heroWorkspaceRow:"_9N7-fW_heroWorkspaceRow",crumbs:"_9N7-fW_crumbs",crumbSeg:"_9N7-fW_crumbSeg",disclaimer:"_9N7-fW_disclaimer",titleCluster:"_9N7-fW_titleCluster",headerActions:"_9N7-fW_headerActions",tab:"_9N7-fW_tab"};function ni({sessionId:e,useSession:t,useSessions:n,useWorkspaces:s,useInput:o,useComposerBlock:a,renderSlot:l,renderSlotChain:c,selectWorkspace:d,t:u}){const f=t(E=>E.openState),m=t(E=>E.composerPhase),k=t(E=>E.pending)??[],g=t(E=>E),y=o(E=>E),b=n(E=>e===void 0?void 0:E.byId[e]?.cwd),w=n(E=>e===void 0?void 0:E.byId[e]?.blank),j=s(E=>E),x=a(E=>E),[A,S]=(0,h.useState)(!1),[z,ne]=(0,h.useState)(),Ee=(0,h.useRef)(null),he=(0,h.useRef)(null),Xe=(0,h.useCallback)(E=>{he.current?.disconnect(),he.current=null;const L=E?.parentElement??null;E===null||L===null||(he.current=new ResizeObserver(()=>{L.style.setProperty("--dsh-composer-height",`${E.offsetHeight}px`)}),he.current.observe(E))},[]),Z=e===void 0?void 0:j.items.find(E=>E.sessionIds.includes(e)),Ge=j.items.find(E=>E.workspaceId===z);(0,h.useEffect)(()=>{z!==void 0&&(Z?.workspaceId===z||j.phase==="ready"&&Ge===void 0)&&ne(void 0)},[z,Z?.workspaceId,j.phase,Ge]);const be=e!==void 0&&m==="blank"&&f==="loading"&&w!==!0,O=e===void 0||m==="blank"&&(f==="open"||w===!0),Q=g===void 0||y===void 0?void 0:{session:g,input:y},me=Ge?.title??(e===void 0?void 0:Z?.title??(j.phase==="ready"||b===void 0||b===""?void 0:Yo(b))),se=(0,i.jsxs)("div",{className:P.heroWorkspaceRow,children:[(0,i.jsx)(Qo,{buttonRef:Ee,label:me,menuOpen:A,onClick:r(()=>{S(E=>!E)},"onClick"),t:u}),l("conversation.hero.workspace",{open:A,anchorRef:Ee,selectedId:z??Z?.workspaceId,onPick:r(E=>{S(!1),ne(E),d(E).catch(()=>{ne(L=>L===E?void 0:L)})},"onPick"),onClose:r(()=>{S(!1)},"onClose")}),l("conversation.hero.agentPreset",{})]}),ee=e===void 0||O&&me===void 0,Te=l("conversation.composer.bar",{variant:O?"hero":"composer",...ee?{disabled:!0,placeholder:u("placeholder.workspace"),workspacePickerOpen:A,onRequestWorkspace:r(()=>{S(!0)},"onRequestWorkspace")}:!ee&&x!==void 0?{blocked:x,placeholder:x.reason}:O?{placeholder:u("placeholder.hero")}:{},overlay:l("conversation.input.overlay",{}),leftItems:Q===void 0?null:l("conversation.input.left",Q),rightItems:Q===void 0?null:l("conversation.input.right",Q),footer:!O&&Q!==void 0?l("conversation.composer.dock",Q):null}),pe=(0,i.jsxs)("div",{className:je(P.composerStack,O&&P.composerHero),children:[O&&(0,i.jsx)(Zo,{className:P.heroGlow}),O&&(0,i.jsx)(ei,{t:u}),O&&se,Q!==void 0&&l("conversation.input.dock",Q),Te]}),fe=be?"settling":O?"hero":"active",Oe=c("conversation.composer",{interactions:k,session:g},{fallback:pe,overlay:!0}),Ve=(0,i.jsx)("div",{ref:Xe,className:P.composerSeat,"data-composer-seat":"",children:Oe});return(0,i.jsxs)("div",{className:P.root,"data-phase":fe,children:[l("conversation.session.header",{}),(0,i.jsxs)("div",{className:P.scrollBody,"data-conversation-scroll":"",children:[l("conversation.session",{}),Ve]}),(0,i.jsx)("div",{className:P.disclaimer,"data-ai-disclaimer":!0,children:u("disclaimer")})]})}r(ni,"ConversationRoot");const ls="chat";function cs(e,t){const n=t??ls;return e.find(s=>s.id===n)??e.find(s=>s.id===ls)}r(cs,"resolveActiveView");function si(e,t){const n=[],s=new Set;let o=t;for(;o!==void 0&&!s.has(o);){s.add(o);const a=e.byId[o];if(a===void 0||(n.unshift({id:a.id,displayTitle:a.displayTitle}),a.origin!=="subagent"))break;o=a.parentId}return n}r(si,"deriveAncestry");function ri(e,t){return e.length===t.length&&e.every((n,s)=>{const o=t.at(s);return o!==void 0&&n.id===o.id&&n.displayTitle===o.displayTitle})}r(ri,"equalBreadcrumbs");function oi({sessionId:e,useSession:t,useSessions:n,useStore:s,actions:o,renderSlot:a,views:l,open:c,t:d}){(0,h.useSyncExternalStore)(l.subscribe,l.version);const u=l.list(),f=cs(u,s(y=>y.view)),m=n(y=>si(y,e),ri),k=t(y=>y.composerPhase),g=t(y=>y.blank)&&k==="blank";return(0,i.jsx)("header",{className:je(P.header,g&&P.headerHidden),"aria-hidden":g||void 0,children:!g&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:P.titleRow,children:[(0,i.jsxs)("div",{className:P.titleCluster,children:[(0,i.jsxs)("nav",{className:P.crumbs,"aria-label":d("session.hierarchy"),children:[m.map((y,b)=>{const w=b===m.length-1;return(0,i.jsxs)("span",{className:P.crumbSeg,children:[b>0&&(0,i.jsx)("span",{className:P.crumbSep,children:"/"}),(0,i.jsx)("button",{type:"button",className:je(P.crumb,w&&P.crumbCurrent),disabled:w,onClick:r(()=>{c(y.id)},"onClick"),children:y.displayTitle})]},y.id)}),m.length===0&&(0,i.jsx)("span",{className:P.crumbCurrent,children:e})]}),(0,i.jsx)("div",{className:P.headerActions,children:a("conversation.session.header.actions",{})})]}),(0,i.jsx)("div",{className:P.headerUtilities,children:a("conversation.session.header.utilities",{})})]}),u.length>1&&(0,i.jsx)("div",{className:P.tabs,role:"tablist",children:u.map(y=>(0,i.jsx)("button",{type:"button",role:"tab","aria-selected":y.id===f?.id,className:je(P.tab,y.id===f?.id&&P.tabActive),onClick:r(()=>{o.setView(y.id)},"onClick"),children:y.label},y.id))})]})})}r(oi,"ConversationSessionHeader");function ii({sessionId:e,useSession:t,useInput:n,inputActions:s,useStore:o,actions:a,renderSlot:l,views:c,bindDraftMirror:d,releaseSessionImages:u}){(0,h.useSyncExternalStore)(c.subscribe,c.version);const f=cs(c.list(),o(w=>w.view)),m=t(w=>w.composerPhase),k=t(w=>w.blank),g=n(w=>w),y=o(w=>w.draft),b=o(w=>w.inspect??null);return(0,h.useEffect)(()=>{g.draft===""&&y!==""&&s.setDraft(y);const w=d(a.setDraft);return()=>{w()}},[s]),(0,h.useEffect)(()=>()=>{u(e)},[u,e]),k&&m==="blank"?null:(0,i.jsx)("div",{className:P.viewArea,children:f!==void 0&&l("conversation.view",{inspect:b,onInspectDone:r(()=>{a.setInspect(null)},"onInspectDone")},{only:f.id})})}r(ii,"ConversationSession");const ai=".EKfR1W_root{border-left:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);flex-direction:column;min-width:0;height:100%;display:flex}.EKfR1W_header{border-bottom:1px solid var(--dsw-alias-border-l2);justify-content:space-between;align-items:center;gap:8px;padding:14px 12px 12px;display:flex}.EKfR1W_title{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:20px;overflow:hidden}.EKfR1W_close{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;display:grid}.EKfR1W_close:hover{background:var(--dsw-alias-interactive-bg-hover)}.EKfR1W_body{flex:1;min-height:0;padding:12px 16px;overflow-y:auto}.EKfR1W_empty{color:var(--dsw-alias-label-tertiary);padding:8px 0;font-size:13px;line-height:20px}.EKfR1W_section{margin-bottom:16px}.EKfR1W_sectionLabel{color:var(--dsw-alias-label-secondary);margin-bottom:6px;font-size:12px;font-weight:500;line-height:18px}.EKfR1W_code{background:var(--dsw-alias-markdown-code-block);font-family:var(--ds-font-family-code);color:var(--dsw-alias-label-primary);white-space:pre-wrap;word-break:break-word;border-radius:12px;margin:0;padding:16px;font-size:13px;line-height:22px}.EKfR1W_code[data-error]{color:var(--dsw-alias-state-error-primary)}",ds="@deepseek-ai/dsh-client-ui-conversation/DetailsPanel.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(ds)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=ds,e.textContent=ai,document.head.appendChild(e)}var ce={code:"EKfR1W_code",empty:"EKfR1W_empty",body:"EKfR1W_body",header:"EKfR1W_header",close:"EKfR1W_close",root:"EKfR1W_root",sectionLabel:"EKfR1W_sectionLabel",section:"EKfR1W_section",title:"EKfR1W_title"};function li(e,t){return{name:e.call?.name??t,argsRaw:e.call?.argsRaw??null,block:e}}r(li,"settledMaterial");function ci(e){return{name:e.name,argsRaw:e.argsRaw,block:e}}r(ci,"runningMaterial");function di(e,t){const n=Eo(e,t);return n===void 0?null:"kind"in n?li(n,t):ci(n)}r(di,"materialFor");function ui(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}r(ui,"pretty");function pi(e){if(!("kind"in e))return"";const t=e.content.map(n=>n.type==="text"?n.text:JSON.stringify(n,null,2));return t.length===0&&e.error!==void 0&&t.push(`${e.error.name}: ${e.error.code}`),t.join(`
5
- `)}r(pi,"rawResultText");function hi({useSession:e,useSessions:t,sessionId:n,useStore:s,renderSlot:o,closeDetails:a,t:l}){const c=s(m=>m.selection),d=t(m=>m.byId[n]?.cwd),u=c?.callId,f=e(m=>u===void 0?null:di(m,u),(m,k)=>(0,D.shallowEqual)(m,k));return(0,i.jsxs)("div",{className:ce.root,children:[(0,i.jsxs)("div",{className:ce.header,children:[(0,i.jsx)("div",{className:ce.title,children:c===null?l("details.title"):f?.name??c.toolName??l("details.title")}),(0,i.jsx)("button",{type:"button",className:ce.close,"aria-label":l("details.close"),onClick:r(()=>{a()},"onClick"),children:(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":!0,children:(0,i.jsx)("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),(0,i.jsx)("div",{className:ce.body,children:c===null||u===void 0?(0,i.jsx)("div",{className:ce.empty,children:l("details.empty")}):f===null?(0,i.jsx)("div",{className:ce.empty,children:l("details.notInWindow")}):(0,i.jsxs)(i.Fragment,{children:[f.argsRaw!==null&&(0,i.jsxs)("section",{className:ce.section,children:[(0,i.jsx)("div",{className:ce.sectionLabel,children:l("details.input")}),(0,i.jsx)(_.CodeBlock,{code:ui(f.argsRaw),lang:"json",copyLabel:l("copy"),copiedLabel:l("copied")})]}),(0,i.jsxs)("section",{className:ce.section,children:[(0,i.jsx)("div",{className:ce.sectionLabel,children:l("details.output")}),(0,i.jsx)(h.Fragment,{children:o("conversation.details.tool",{block:f.block,cwd:d},{fallback:"kind"in f.block?(0,i.jsx)("pre",{className:ce.code,"data-error":f.block.isError||void 0,children:pi(f.block)}):(0,i.jsx)("div",{className:ce.empty,children:l("details.running")})})},u)]})]})})]})}r(hi,"DetailsPanel");const it={interruptedAssistant:-.9,interruptedFollowup:-.8,maxTokensNotice:.05,finalizedFollowup:.1};function mi(e){return e.start?.location??e.matches[0]?.location??{kind:"unresolved"}}r(mi,"contextLocation");function ue(e,t,n,s,o={}){return{key:e.key,kind:t,id:e.id,target:"chat",anchorSeq:n,location:o.location??mi(e),visibility:o.visibility??"visible",data:s}}r(ue,"chatNode");function vt(e,t){return{turn:e,step:t,blocks:[],firstVisibleSeq:void 0,firstVisibleTime:void 0,firstTokenTime:void 0,hidden:!1,final:void 0,usage:void 0}}r(vt,"initialState");function Dt(e){return e.filter(t=>t!==void 0)}r(Dt,"compactBlocks");function us(e){return e.some(t=>t.kind==="tool-call"?!1:t.kind==="text"||t.kind==="reasoning"?t.text.trim()!=="":!0)}r(us,"hasVisibleContent");function fi(e){return e.some(t=>t.kind==="text"||t.kind==="reasoning"?t.text.trim()!=="":!0)}r(fi,"hasInterruptionEvidence");function ps(e){return{...vt(e.turn,e.step),firstTokenTime:e.firstTokenTime,hidden:!0}}r(ps,"resetForRetry");function hs(e,t){if(t.event.type!=="assistant/chunk")return e;const n=t.event.data.chunk,s=[...e.blocks];switch(n.type){case"block-start":s[n.index]=(0,D.emptyAssistantBlock)(n.blockType);break;case"text-delta":{const l=s[n.index];s[n.index]={kind:"text",text:(l?.kind==="text"?l.text:"")+n.text};break}case"reasoning-delta":{const l=s[n.index];s[n.index]={kind:"reasoning",text:(l?.kind==="reasoning"?l.text:"")+n.text};break}case"tool-call-delta":{const l=s[n.index],c=l?.kind==="tool-call"?l:{kind:"tool-call",callId:"",name:"",argsRaw:""};s[n.index]={kind:"tool-call",callId:c.callId||String(n.id),name:n.name??c.name,argsRaw:c.argsRaw+n.argumentsDelta};break}case"block-end":s[n.index]=(0,D.toAssistantBlock)(n.block);break;case"usage":return{...e,usage:n.usage};default:return e}const o=us(Dt(s)),a=(0,D.isTokenDelta)(n);return{...e,blocks:s,hidden:o?!1:e.hidden,...o&&e.firstVisibleSeq===void 0?{firstVisibleSeq:t.event.seq,firstVisibleTime:t.event.time}:{},...a&&e.firstTokenTime===void 0?{firstTokenTime:t.event.time}:{}}}r(hs,"updateChunk");function gi(e){if(e.kind==="step"&&e.step.status==="closed"&&e.step.end!==void 0)return e.step.end;if((e.kind==="step"||e.kind==="turn")&&e.turn.status==="closed"&&e.turn.end!==void 0)return e.turn.end}r(gi,"closedBoundary");function vi(e,t){const n=e.final;if(n?.event.type==="assistant/message"){const l=n.event;return{kind:"assistant",seq:l.seq,messageId:l.data.message.id,time:l.time,turn:e.turn,step:e.step,blocks:(0,D.toAssistantBlocks)(l.data.message.content),usage:l.data.usage,timing:{stepStartTime:t.start?.event.time??null,firstTokenTime:e.firstTokenTime??null,completedTime:l.time}}}const s=t.start?.location??t.matches.at(-1)?.location,o=s===void 0?void 0:gi(s),a=Dt(e.blocks);if(!(o===void 0||!fi(a)))return{kind:"assistant",seq:o.seq+it.interruptedAssistant,time:o.time,turn:e.turn,step:e.step,blocks:a,interrupted:!0}}r(vi,"finalNode");function ms(e){let t;for(const n of e.matches){if(n.event.type==="assistant/chunk"){t??=vt(n.event.data.turn,n.event.data.step),t=hs(t,n);continue}if(n.event.type==="assistant/message"){t??=vt(n.event.data.turn,n.event.data.step),t={...t,blocks:(0,D.toAssistantBlocks)(n.event.data.message.content),hidden:!1,final:n,usage:n.event.data.usage};continue}n.event.type==="llm/retry"&&t!==void 0&&(t=ps(t))}return t}r(ms,"fallbackState$4");function fs(e){const t=e.state??ms(e);if(t===void 0)return;const n=vi(t,e),s=n?.blocks??Dt(t.blocks),o=us(s),a=n?.interrupted===!0?"interrupted":n===void 0?"running":"settled",l=n?.seq??t.firstVisibleSeq??e.matches[0]?.event.seq??0,c=n?.time??t.firstVisibleTime??e.matches[0]?.event.time??0;return{anchorSeq:l,visible:o,settled:n,data:{status:a,turn:t.turn,step:t.step,blocks:s,time:c,...t.usage===void 0?{}:{usage:t.usage},...n===void 0?{}:{finalNode:n}}}}r(fs,"projectAssistant");const yi={kind:"assistant-step",target:"chat",match:r(e=>e.type==="step/start"?{id:`${e.data.turn}:${e.data.step}`,role:"start"}:e.type==="assistant/chunk"||e.type==="assistant/message"&&(0,D.isAppendSurfaceEvent)(e)?{id:`${e.data.turn}:${e.data.step}`,role:"update"}:e.type==="llm/retry"?{id:`${e.data.turn}:${e.data.step}`,role:"update"}:null,"match"),start:r((e,t)=>{if(t.event.type!=="step/start")throw new Error("assistant-step start requires step/start");return vt(t.event.data.turn,t.event.data.step)},"start"),update:r((e,t)=>t.event.type==="assistant/chunk"?hs(e.state,t):t.event.type==="assistant/message"?{...e.state,blocks:(0,D.toAssistantBlocks)(t.event.data.message.content),hidden:!1,final:t,usage:t.event.data.usage}:t.event.type==="llm/retry"?ps(e.state):e.state,"update"),publication:r(e=>{if(e.event.type==="step/start")return"none";if(e.event.type!=="assistant/chunk")return"immediate";const t=e.event.data.chunk.type;return t==="usage"||t==="finish"?"none":"animation-frame"},"publication"),buildLocationData:r((e,t)=>{if(t!=="step")return null;const n=fs(e);return n===void 0?null:{kind:"step",turn:n.data.turn,step:n.data.step,key:"assistant-step",value:n.data}},"buildLocationData"),buildViewNode:r(e=>{const t=fs(e);if(t===void 0)return null;if(t.settled===void 0&&!t.visible){const n=e.state??ms(e);if(n===void 0)return null;const s=e.current.get("chat");if(!n.hidden||s===void 0||s===null)return null}return ue(e,"assistant-step",t.anchorSeq,t.data,{visibility:t.settled?.interrupted===!0||t.visible?"visible":"hidden"})},"buildViewNode")};function xi(e){e.conversationEvents.register(yi)}r(xi,"registerAssistantConversationNode");function bi(e){return"kind"in e}r(bi,"isSettledTool");function wi(e){return!bi(e)}r(wi,"isRunningTool");const at=[],ki=[],Ne=[];function Je(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}r(Je,"sameReferences$1");var _i=class{static{r(this,"MutableChatNodeStore")}byKey=new Map;valuesCache=Ne;valuesDirty=!1;get(e){return this.byKey.get(e)}values(){return this.valuesDirty&&(this.valuesCache=[...this.byKey.values()],this.valuesDirty=!1),this.valuesCache}replace(e){this.byKey.clear();for(const t of e)this.byKey.set(t.key,t);this.valuesCache=[...this.byKey.values()],this.valuesDirty=!1}upsert(e){let t=!1;for(const n of e)this.byKey.get(n.key)!==n&&(this.byKey.set(n.key,n),t=!0);t&&(this.valuesDirty=!0)}},Ai=class{static{r(this,"MutableChatLocationIndex")}turns=new Map;steps=new Map;getTurn(e){return this.turns.get(e)??at}getStep(e,t){return this.steps.get(Bt(e,t))??at}rebuild(e,t){const n=new Map,s=new Map;for(const o of e){const a=t.get(o)?.location;if(a===void 0)continue;const l=$t(a);if(l.turn===void 0)continue;const c=n.get(l.turn)??[];if(c.push(o),n.set(l.turn,c),l.step===void 0)continue;const d=Bt(l.turn,l.step),u=s.get(d)??[];u.push(o),s.set(d,u)}this.turns=gs(this.turns,n),this.steps=gs(this.steps,s)}touch(e){const t=new Set,n=new Set;for(const s of e){const o=$t(s.location);o.turn===void 0||!this.turns.get(o.turn)?.includes(s.key)||(t.add(o.turn),o.step!==void 0&&n.add(Bt(o.turn,o.step)))}for(const s of t){const o=this.turns.get(s);o!==void 0&&this.turns.set(s,[...o])}for(const s of n){const o=this.steps.get(s);o!==void 0&&this.steps.set(s,[...o])}}};function gs(e,t){const n=new Map,s=new Set([...e.keys(),...t.keys()]);for(const o of s){const a=e.get(o)??at,l=t.get(o)??at,c=Je(a,l)?a:l;l.length>0&&n.set(o,c)}return n}r(gs,"updateIndex");function Bt(e,t){return`${e}:${t}`}r(Bt,"stepKey");function $t(e){return e.kind==="step"?{turn:e.turn.turn,step:e.step.step}:e.kind==="turn"?{turn:e.turn.turn}:{}}r($t,"locationCoordinates");function vs(e){return e.filter(t=>t.visibility==="visible").sort((t,n)=>t.anchorSeq-n.anchorSeq||t.key.localeCompare(n.key))}r(vs,"orderedVisible");const yt={anchorSeq:0,nodes:Ne,partial:null,running:null};function ys(e){const t=e;if(e.visibility!=="visible"&&t.kind!=="assistant-step")return yt;switch(t.kind){case"user":case"steering":case"context":case"command":case"compaction":case"turn-error":case"turn-max-tokens":case"unknown":return{anchorSeq:t.anchorSeq,nodes:[t.data],partial:null,running:null};case"assistant-step":{const n=t.data;return n.status==="running"?e.visibility!=="visible"?yt:{anchorSeq:t.anchorSeq,nodes:Ne,partial:{turn:n.turn,step:n.step,blocks:n.blocks},running:null}:{anchorSeq:t.anchorSeq,nodes:n.finalNode===void 0?Ne:[n.finalNode],partial:null,running:null}}case"tool-call":{const n=t.data.root;return wi(n)?{anchorSeq:t.anchorSeq,nodes:Ne,partial:null,running:n}:{anchorSeq:t.anchorSeq,nodes:[n],partial:null,running:null}}case"manual-compaction":{const n=t.data;return{anchorSeq:t.anchorSeq,nodes:n.compaction===null?[n.command]:[n.command,n.compaction],partial:null,running:null}}case"model-retry":return{anchorSeq:t.anchorSeq,nodes:t.data.attempts,partial:null,running:null};case"turn-tail":return yt;default:return yt}}r(ys,"legacyContribution");function Si(e,t){return e!==void 0&&e.anchorSeq===t.anchorSeq&&e.partial?.blocks===t.partial?.blocks&&e.partial?.turn===t.partial?.turn&&e.partial?.step===t.partial?.step&&e.running===t.running&&Je(e.nodes,t.nodes)}r(Si,"sameContribution");var Ci=class{static{r(this,"LegacySliceBuilder")}contributions=new Map;finalizedContributions=new Map;runningContributions=new Map;partialContributions=new Map;finalized=Ne;runningCalls=Ne;partial=null;timeline;turnTimings=new Map;turnEnds=new Map;replace(e,t){this.contributions.clear(),this.finalizedContributions.clear(),this.runningContributions.clear(),this.partialContributions.clear();for(const n of e){const s=ys(n);this.contributions.set(n.key,s),this.indexContribution(n.key,s)}return this.rebuildFinalized(),this.rebuildRunning(),this.rebuildPartial(),this.updateTimeline(t),this.snapshot()}apply(e,t){let n=!1,s=!1,o=!1;for(const a of e){const l=ys(a),c=this.contributions.get(a.key);Si(c,l)||(n||=ji(c,l),s||=Ii(c,l),o||=Ni(c,l),this.contributions.set(a.key,l),this.indexContribution(a.key,l))}return n&&this.rebuildFinalized(),s&&this.rebuildRunning(),o&&this.rebuildPartial(),this.updateTimeline(t),this.snapshot()}indexContribution(e,t){Ut(this.finalizedContributions,e,t,t.nodes.length>0),Ut(this.runningContributions,e,t,t.running!==null),Ut(this.partialContributions,e,t,t.partial!==null)}rebuildFinalized(){const e=[...this.finalizedContributions.values()].flatMap(t=>t.nodes).sort((t,n)=>t.seq-n.seq);Je(this.finalized,e)||(this.finalized=e)}rebuildRunning(){const e=[...this.runningContributions.values()].sort((t,n)=>t.anchorSeq-n.anchorSeq).flatMap(t=>t.running===null?[]:[t.running]);Je(this.runningCalls,e)||(this.runningCalls=e)}rebuildPartial(){const e=[...this.partialContributions.values()].sort((t,n)=>t.anchorSeq-n.anchorSeq).findLast(t=>t.partial!==null)?.partial??null;(this.partial?.blocks!==e?.blocks||this.partial?.turn!==e?.turn||this.partial?.step!==e?.step)&&(this.partial=e)}updateTimeline(e){if(this.timeline===e)return;this.timeline=e;const t=new Map,n=new Map;for(const s of e.turns.values())s.start!==void 0&&t.set(s.turn,{startTime:s.start.time,...s.end===void 0?{}:{endTime:s.end.time}}),s.end!==void 0&&n.set(s.turn,s.end.seq);this.turnTimings=t,this.turnEnds=n}snapshot(){return{nodes:this.finalized,turnTimings:this.turnTimings,turnEnds:this.turnEnds,partial:this.partial,runningCalls:this.runningCalls}}};function Ut(e,t,n,s){s?e.set(t,n):e.delete(t)}r(Ut,"updateContributionIndex");function ji(e,t){const n=e?.nodes??Ne;return!Je(n,t.nodes)||(n.length>0||t.nodes.length>0)&&e?.anchorSeq!==t.anchorSeq}r(ji,"finalizedContributionChanged");function Ii(e,t){return e?.running!==t.running||(e.running!==null||t.running!==null)&&e.anchorSeq!==t.anchorSeq}r(Ii,"runningContributionChanged");function Ni(e,t){return e?.partial?.blocks!==t.partial?.blocks||e?.partial?.turn!==t.partial?.turn||e?.partial?.step!==t.partial?.step||((e?.partial??null)!==null||t.partial!==null)&&e?.anchorSeq!==t.anchorSeq}r(Ni,"partialContributionChanged");var Ei=class{static{r(this,"ChatSnapshotBuilder")}store=new _i;locations=new Ai;legacy=new Ci;order=at;empty;constructor(){this.empty=this.snapshot({turnOrder:ki,turns:new Map})}replace(e){return this.store.replace(e.nodes),this.order=vs(e.nodes).map(t=>t.key),this.locations.rebuild(this.order,this.store),this.snapshot(e.timeline,this.legacy.replace(e.nodes,e.timeline))}apply(e){let t=!1;const n=[];for(const s of e.upserts){const o=this.store.get(s.key),a=o===void 0||o.anchorSeq!==s.anchorSeq||o.visibility!==s.visibility||xs(o.location)!==xs(s.location);t||=a,a||n.push(s)}if(this.store.upsert(e.upserts),t){const s=vs(this.store.values()).map(o=>o.key);this.order=Je(this.order,s)?this.order:s,this.locations.rebuild(this.order,this.store)}return this.locations.touch(n),this.snapshot(e.timeline,this.legacy.apply(e.upserts,e.timeline))}snapshot(e,t=this.legacy.replace(Ne,e)){return{order:this.order,nodes:this.store,locations:this.locations,timeline:e,legacy:t}}};function xs(e){const t=$t(e);return`${e.kind}:${t.turn??""}:${t.step??""}`}r(xs,"locationIdentity");const Ti={target:"chat",create:r(()=>new Ei,"create")};function qi(e){e.conversationViews.register(Ti)}r(qi,"registerChatConversationView");const Ri="compact";function Mi(e){if(e.event.type!=="command/run")throw new Error("command start requires command/run");const t=e.event.data;return{kind:"command",seq:e.event.seq,time:e.event.time,commandId:t.commandId,name:t.name,args:t.args??null,outcome:null}}r(Mi,"commandFromRun");function xt(e,t){if(e.event.type!=="command/done")throw new Error("command update requires command/done");const n=e.event.data,s=n.kind==="success"&&n.sourceEventSeq!==void 0&&Number.isSafeInteger(n.sourceEventSeq)&&n.sourceEventSeq>=0?n.sourceEventSeq:void 0;return{kind:"command",seq:t?.seq??e.event.seq,time:t?.time??e.event.time,commandId:n.commandId,name:t?.name??null,args:t?.args??null,outcome:{kind:n.kind,...n.text===void 0?{}:{text:n.text},...s===void 0?{}:{sourceEventSeq:s}}}}r(xt,"commandFromDone");function Ke(e){if(e.type!=="user/message"||!(0,D.isReplacementSurfaceEvent)(e))return;const t=e.data.source;if(!(t.kind!=="plugin"||t.plugin!==Ri||typeof t.compactionId!="string"))return{compactionId:t.compactionId,...t.sourceCommandId===void 0?{}:{sourceCommandId:t.sourceCommandId}}}r(Ke,"compactSource");function bs(e,t){let n=null,s=null,o=null;if(e?.event.type==="compaction/summary"){const a=e.event.data;if(Array.isArray(a.summary)){const l=a.summary.map(c=>c.type==="text"?c.text:"").join("");n=l.trim()===""?null:l}s=Array.isArray(a.shadowedSeqs)&&a.shadowedSeqs.every(l=>Number.isSafeInteger(l)&&l>=0)?a.shadowedSeqs.length:null,o=Number.isSafeInteger(a.shadowedTokenCount)&&a.shadowedTokenCount>=0?a.shadowedTokenCount:null}return{kind:"compaction",seq:t.event.seq,time:t.event.time,summary:n,summaryEventSeq:e?.event.seq??null,shadowedItemCount:s,shadowedTokenCount:o}}r(bs,"compactSummary");function Wi(e){const t=e.matches.find(a=>a.event.type==="command/done"),n=e.matches.find(a=>Ke(a.event)!==void 0),s=e.matches.find(a=>a.event.type==="compaction/summary");if(n===void 0)return t===void 0?void 0:{command:xt(t)};const o=Ke(n.event);return o?.sourceCommandId===void 0?t===void 0?void 0:{command:xt(t)}:{command:t===void 0?{kind:"command",seq:n.event.seq,time:n.event.time,commandId:o.sourceCommandId,name:"compact",args:null,outcome:null}:{...xt(t),name:"compact"},checkpoint:n,...s===void 0?{}:{summary:s}}}r(Wi,"fallbackState$3");function ws(e,t){return t.event.type==="compaction/summary"?{...e,summary:t}:Ke(t.event)!==void 0?{...e,checkpoint:t}:e}r(ws,"updateCompactionState");const Gi={kind:"command",target:"chat",match:r(e=>{if(e.type==="command/run")return{id:String(e.data.commandId),role:"start"};if(e.type==="command/done")return{id:String(e.data.commandId),role:"update"};const t=Ke(e);return t?.sourceCommandId!==void 0?{id:String(t.sourceCommandId),role:"update"}:(e.type==="compaction/start"||e.type==="compaction/summary"||e.type==="compaction/end")&&e.data.sourceCommandId!==void 0?{id:String(e.data.sourceCommandId),role:"update"}:null},"match"),start:r((e,t)=>({command:Mi(t)}),"start"),update:r((e,t)=>t.event.type==="command/done"?{...e.state,command:xt(t,e.state.command)}:ws(e.state,t),"update"),buildViewNode:r(e=>{const t=e.state??Wi(e);if(t===void 0)return null;if(t.command.name!=="compact")return ue(e,"command",t.command.seq,t.command);const n=t.checkpoint===void 0?null:bs(t.summary,t.checkpoint),s={command:t.command,compaction:n};return ue(e,"manual-compaction",n?.seq??t.command.seq,s)},"buildViewNode")};function Oi(e){e.conversationEvents.register(Gi)}r(Oi,"registerCommandConversationNode");function Li(e){const t=e.matches.find(s=>s.event.type==="compaction/summary"),n=e.matches.find(s=>Ke(s.event)!==void 0);return{...t===void 0?{}:{summary:t},...n===void 0?{}:{checkpoint:n}}}r(Li,"fallbackState$2");const Di={kind:"compaction",target:"chat",match:r(e=>{const t=Ke(e);if(t!==void 0&&t.sourceCommandId===void 0)return{id:t.compactionId,role:"update"};if(e.type==="compaction/start"||e.type==="compaction/summary"||e.type==="compaction/end"){if(e.data.sourceCommandId!==void 0)return null;const n=e.data.compactionId;return typeof n!="string"||n===""?null:{id:n,role:e.type==="compaction/start"?"start":"update"}}return null},"match"),start:r(()=>({}),"start"),update:r((e,t)=>ws(e.state,t),"update"),buildViewNode:r(e=>{const t=e.state??Li(e);if(t.checkpoint===void 0)return null;const n=bs(t.summary,t.checkpoint);return ue(e,"compaction",n.seq,n)},"buildViewNode")};function Bi(e){e.conversationEvents.register(Di)}r(Bi,"registerCompactionConversationNode");const $i={kind:"unknown-surface",target:"chat",match:r(e=>(0,D.isAppendSurfaceEvent)(e)?{id:String(e.seq),role:"start"}:null,"match"),start:r((e,t)=>({kind:"unknown",seq:t.event.seq,time:t.event.time,type:t.event.type,data:t.event.data}),"start"),update:r(e=>e.state,"update"),buildViewNode:r(e=>e.state===void 0?null:ue(e,"unknown",e.state.seq,e.state),"buildViewNode")};function Ui(e){e.conversationEvents.registerFallback($i)}r(Ui,"registerUnknownConversationFallback");function Pi(e,t){const n=[...e?.state.pending??[]],s=new Set(e?.state.claimed??[]),o=n.splice(t.start,t.removedCount??0,...t.inserted);for(const a of t.inserted)s.delete(a.id);if(t.target==="next-step"&&t.outcome!=="canceled")for(const a of o)s.add(a.id);return{pending:n,claimed:s}}r(Pi,"applySplice");function ks(e){const t=`inbox-${e}`;return{kind:t,match:r(n=>n.type==="agent/inbox/spliced"&&n.data.target===e?{id:String(n.seq),role:"start"}:null,"match"),start:r((n,s,o)=>{if(s.event.type!=="agent/inbox/spliced")throw new Error(`${t} start requires agent/inbox/spliced`);return Pi(o.previous(t),s.event.data)},"start"),update:r(n=>n.state,"update"),publication:r(()=>"none","publication")}}r(ks,"inboxDefinition");const zi=ks("next-turn"),Fi=ks("next-step");function Ji(e){e.conversationEvents.register(zi),e.conversationEvents.register(Fi)}r(Ji,"registerInboxConversationNodes");function Ki(e){if(e.type!=="user/message"||!(0,D.isReplacementSurfaceEvent)(e))return!1;const t=e.data.source;return t.kind==="plugin"&&t.plugin==="compact"}r(Ki,"isCompactionCheckpoint");const Xi={kind:"input-message",target:"chat",match:r(e=>e.type==="user/message"&&(0,D.isAppendSurfaceEvent)(e)&&!Ki(e)?{id:String(e.data.id),role:"start"}:null,"match"),start:r((e,t,n)=>{if(t.event.type!=="user/message")throw new Error("input-message start requires user/message");const s=t.event;return s.data.source.kind!=="user"?{kind:"context",seq:s.seq,time:s.time,content:s.data.content,source:s.data.source,provenance:(0,D.contextProvenance)(s.data.source),form:(0,D.contextForm)(s.data.source)}:n.previous("inbox-next-step")?.state.claimed.has(String(s.data.id))===!0?{kind:"steering",messageId:s.data.id,seq:s.seq,time:s.time,content:s.data.content,source:s.data.source}:{kind:"user",seq:s.seq,time:s.time,content:s.data.content,source:s.data.source}},"start"),update:r(e=>e.state,"update"),buildViewNode:r(e=>e.state===void 0?null:ue(e,e.state.kind,e.state.seq,e.state),"buildViewNode")};function Vi(e){e.conversationEvents.register(Xi)}r(Vi,"registerMessageConversationNode");function _s(e){if(e.event.type==="llm/retry")return{kind:"model-retry",seq:e.event.seq,time:e.event.time,retryState:"scheduled",...e.event.data}}r(_s,"scheduledNode");function Hi(e){return e.kind==="step"&&e.step.status==="closed"||(e.kind==="step"||e.kind==="turn")&&e.turn.status==="closed"}r(Hi,"isClosed");const Yi={kind:"model-retry",target:"chat",match:r(e=>{if(e.type==="llm/retry"){const t=e.data.retryId;return typeof t!="string"||t===""?null:{id:t,role:e.data.retry===1?"start":"update"}}if(e.type==="llm/retry-started"){const t=e.data.retryId;return typeof t=="string"&&t!==""?{id:t,role:"update"}:null}return null},"match"),start:r((e,t)=>{const n=_s(t);if(n===void 0)throw new Error("model-retry start requires a valid llm/retry event");return{turn:n.turn,step:n.step,attempts:[n]}},"start"),update:r((e,t)=>{if(t.event.type==="llm/retry"){const s=_s(t);return s===void 0?e.state:{...e.state,attempts:[...e.state.attempts,s]}}if(t.event.type!=="llm/retry-started")return e.state;const n=t.event.data.retry;return{...e.state,attempts:e.state.attempts.map(s=>s.retry===n?{...s,retryState:"started"}:s)}},"update"),buildViewNode:r(e=>{if(e.state===void 0||e.state.attempts.length===0)return null;const t=e.start?.location??e.matches[0]?.location??{kind:"unresolved"},n=e.state.attempts,s=n.map((l,c)=>c===n.length-1&&l.retryState==="scheduled"&&Hi(t)?{...l,retryState:"cancelled"}:l),o=s.at(-1);if(o===void 0)return null;const a={attempts:s,current:o};return ue(e,"model-retry",s[0]?.seq??o.seq,a)},"buildViewNode")};function Qi(e){e.conversationEvents.register(Yi)}r(Qi,"registerRetryConversationNode");const As=256,Ss=new WeakMap;function Cs(e){return JSON.stringify(e)}r(Cs,"jsonArguments");function Zi(e){if(e.event.type!=="tool/call")throw new Error("tool-call start requires tool/call");return{callId:String(e.event.data.callId),name:e.event.data.name,argsRaw:e.event.data.arguments,turn:e.event.data.turn,step:e.event.data.step,time:e.event.time,callView:e.view?.for==="call"?e.view.view:null,subCalls:[]}}r(Zi,"rootCall");function js(e,t){if(e.event.type!=="tool/result")return;const n=e.event.data.message.content[0];return{kind:"tool-result",seq:e.event.seq,time:e.event.time,callId:String(e.event.data.message.source.callId),call:t===void 0?null:{name:t.name,argsRaw:t.argsRaw},callTime:t?.time??null,content:n.content,isError:n.isError===!0,...e.event.data.error===void 0?{}:{error:e.event.data.error},meta:e.event.data.meta,callView:t?.callView??null,resultView:e.view?.for==="result"?e.view.view:null,subCalls:[]}}r(js,"rootResult");function ea(e,t){return{callId:t.subCallId,name:t.name,argsRaw:Cs(t.arguments),turn:na(e),step:sa(e),time:e.event.time,callView:null,subCalls:[]}}r(ea,"childCall");function ta(e,t,n){return{kind:"tool-result",seq:e.event.seq,time:e.event.time,callId:t.subCallId,call:{name:t.name,argsRaw:Cs(t.arguments)},callTime:n?.time??null,content:t.content??[],isError:t.isError===!0,callView:null,resultView:null,subCalls:[]}}r(ta,"childResult");function na(e){return e.location.kind==="step"||e.location.kind==="turn"?e.location.turn.turn:0}r(na,"locationTurn");function sa(e){return e.location.kind==="step"?e.location.step.step:0}r(sa,"locationStep");function Is(e,t,n){if(t===n||e.parents.has(n))return!1;let s=t,o=0;const a=new Set;for(;s!==void 0;){if(s===n||a.has(s))return!1;a.add(s),o++,s=e.parents.get(s)}const l=[{callId:n,depth:1}],c=new Set;let d=0;for(const u of l){if(c.has(u.callId))return!1;c.add(u.callId),d=Math.max(d,u.depth);for(const f of e.children.get(u.callId)??[])l.push({callId:f.callId,depth:u.depth+1})}return o+d<=As}r(Is,"acceptsEdge");function Ns(e,t){const n=t.event;if(n.type!=="tool/code-dispatch-start"&&n.type!=="tool/code-dispatch")return e;const s=n.data,o=String(s.parentCallId),a=String(s.subCallId),l=e.children.get(o)??[],c=l.findIndex(m=>m.callId===a);if(n.type==="tool/code-dispatch-start"){if(c>=0||!Is(e,o,a))return e;const m=new Map(e.children);m.set(o,[...l,ea(t,s)]);const k=new Map(e.parents);return k.set(a,o),{...e,children:m,parents:k}}if(c<0&&!Is(e,o,a))return e;const d=ta(t,s,c<0?void 0:l[c]),u=new Map(e.children);u.set(o,c<0?[...l,d]:l.map((m,k)=>k===c?d:m));const f=new Map(e.parents);return c<0&&f.set(a,o),{...e,children:u,parents:f}}r(Ns,"updateDispatch");function Es(e,t,n,s=new Set,o=1){if(s.has(e.callId)||o>As)return{...e,subCalls:[]};const a=new Set(s);a.add(e.callId);const l=(t.children.get(e.callId)??e.subCalls).map(m=>Es(m,t,n,a,o+1)),c="kind"in e?void 0:n?.seq,d="kind"in e?void 0:n?.time,u=Ss.get(e);if(u!==void 0&&u.interruptionSeq===c&&u.interruptionTime===d&&Ts(u.children,l))return u.value;const f="kind"in e||n===void 0?Ts(e.subCalls,l)?e:{...e,subCalls:l}:{kind:"tool-result",seq:n.seq+it.interruptedFollowup,time:n.time,callId:e.callId,call:{name:e.name,argsRaw:e.argsRaw},callTime:e.time,content:[],isError:!0,error:{name:"Interrupted",code:"interrupted"},callView:e.callView,resultView:null,subCalls:l};return Ss.set(e,{children:l,interruptionSeq:c,interruptionTime:d,value:f}),f}r(Es,"projectBlock");function Ts(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}r(Ts,"sameReferences");function ra(e){const t=e.start?.location;if(t?.kind==="step"&&t.step.status==="closed")return t.step.end;if((t?.kind==="step"||t?.kind==="turn")&&t.turn.status==="closed")return t.turn.end}r(ra,"interruption");function oa(e){const t=e.matches.find(o=>o.event.type==="tool/result"),n=t===void 0?void 0:js(t);if(n===void 0)return;let s={root:n,children:new Map,parents:new Map};for(const o of e.matches)s=Ns(s,o);return s}r(oa,"fallbackState$1");const ia={kind:"tool-call",target:"chat",match:r(e=>{if(e.type==="tool/call")return{id:String(e.data.callId),role:"start"};if(e.type==="tool/result"&&(0,D.isAppendSurfaceEvent)(e))return{id:String(e.data.message.source.callId),role:"update"};if(e.type==="tool/code-dispatch-start"||e.type==="tool/code-dispatch"){const t=e.data.rootCallId;return typeof t=="string"&&t!==""?{id:t,role:"update"}:null}return null},"match"),start:r((e,t)=>({root:Zi(t),children:new Map,parents:new Map}),"start"),update:r((e,t)=>{if(t.event.type==="tool/result"){const n=js(t,"kind"in e.state.root?void 0:e.state.root);return n===void 0?e.state:{...e.state,root:n}}return Ns(e.state,t)},"update"),buildViewNode:r(e=>{const t=e.state??oa(e);if(t===void 0)return null;const n=Es(t.root,t,ra(e));return ue(e,"tool-call",e.start?.event.seq??("kind"in t.root?t.root.seq:e.matches[0]?.event.seq??0),{root:n})},"buildViewNode")};function aa(e){e.conversationEvents.register(ia)}r(aa,"registerToolConversationNode");function la(e){const t=e.start?.location??e.matches[0]?.location;return t?.kind!=="turn"&&t?.kind!=="step"?0:t.turn.steps.at(-1)?.step??0}r(la,"lastStep$1");function Pt(e){return e.type==="llm/retry"||e.type==="llm/retry-started"?e.data.turn:void 0}r(Pt,"retryTurn");function zt(e){if(e.event.type!=="turn/end"||e.event.data.reason.kind!=="error")return;const t=e.event.data.reason.error;return{seq:e.event.seq,time:e.event.time,message:(0,D.displayFailureMessage)(t),code:t.code}}r(zt,"failureFrom");function ca(e){const t=e.matches.find(o=>zt(o)!==void 0);if(t?.event.type!=="turn/end")return;const n=zt(t);if(n===void 0)return;const s=t.event.data.turn;return{turn:s,hidden:e.matches.some(o=>Pt(o.event)===s),failure:n}}r(ca,"fallbackState");const da={kind:"turn-error",target:"chat",match:r(e=>{if(e.type==="turn/start")return{id:String(e.data.turn),role:"start"};if(e.type==="turn/end"&&e.data.reason.kind==="error")return{id:String(e.data.turn),role:"update"};const t=Pt(e);return t===void 0?null:{id:String(t),role:"update"}},"match"),start:r((e,t)=>{if(t.event.type!=="turn/start")throw new Error("turn-error start requires turn/start");return{turn:t.event.data.turn,hidden:!1}},"start"),update:r((e,t)=>{const n=zt(t);return n!==void 0?{...e.state,failure:n}:Pt(t.event)===e.state.turn?{...e.state,hidden:!0}:e.state},"update"),buildViewNode:r(e=>{const t=e.state??ca(e);if(t?.failure===void 0)return null;const n=t.failure,s={kind:"turn-error",seq:n.seq,time:n.time,turn:t.turn,step:la(e),message:n.message,...n.code===void 0?{}:{code:n.code}};if(!t.hidden)return ue(e,"turn-error",s.seq,s);const o=e.current.get("chat");return o==null?null:ue(e,"turn-error",s.seq,s,{visibility:"hidden"})},"buildViewNode")};function ua(e){e.conversationEvents.register(da)}r(ua,"registerTurnErrorConversationNode");function pa(e){const t=e.start?.location??e.matches[0]?.location;return t?.kind!=="turn"&&t?.kind!=="step"?0:t.turn.steps.at(-1)?.step??0}r(pa,"lastStep");function ha(e,t){const n=e.start?.location??e.matches[0]?.location;if(n?.kind!=="turn"&&n?.kind!=="step")return t;const s=n.turn.data.get("turn-tail")?.closing;return s==null?t:s.finalNode.seq+it.maxTokensNotice}r(ha,"noticeAnchor");function ma(e){if(!(e.event.type!=="turn/end"||e.event.data.reason.kind!=="max-tokens"))return{turn:e.event.data.turn,seq:e.event.seq,time:e.event.time}}r(ma,"stateFrom");const fa={kind:"turn-max-tokens",target:"chat",match:r(e=>e.type==="turn/end"&&e.data.reason.kind==="max-tokens"?{id:String(e.data.turn),role:"start"}:null,"match"),start:r((e,t)=>{const n=ma(t);if(n===void 0)throw new Error("turn-max-tokens start requires a max-tokens turn/end");return n},"start"),update:r(e=>e.state,"update"),buildViewNode:r(e=>{const t=e.state;if(t===void 0)return null;const n={kind:"turn-max-tokens",seq:t.seq,time:t.time,turn:t.turn,step:pa(e)};return ue(e,"turn-max-tokens",ha(e,t.seq),n)},"buildViewNode")};function ga(e){e.conversationEvents.register(fa)}r(ga,"registerTurnMaxTokensConversationNode");function va(e){return e.type==="assistant/message"&&(0,D.isAppendSurfaceEvent)(e)&&(0,D.toAssistantBlocks)(e.data.message.content).some(t=>t.kind==="text"&&t.text.trim()!=="")}r(va,"hasTextAssistant");function ya(e){if(e.type!=="assistant/chunk")return!1;const t=e.data.chunk;return t.type==="text-delta"?t.text.trim()!=="":t.type==="block-end"&&t.block.type==="text"&&t.block.text.trim()!==""}r(ya,"chunkHasText");function qs(e){if(e.type==="assistant/message"||e.type==="assistant/chunk"||e.type==="step/end")return{turn:e.data.turn,step:e.data.step};if(e.type==="llm/retry")return{turn:e.data.turn,step:e.data.step}}r(qs,"turnCoordinates");function xa(e){let t=e.matches.find(s=>s.event.type==="turn/end")?.event.seq??e.start?.event.seq??e.matches[0]?.event.seq??0;const n=new Map;for(const s of e.matches){const o=s.event;if(o.type==="turn/end")continue;const a=qs(o);if(a?.step===void 0)continue;const l=n.get(a.step)??{streamedText:!1,finalized:!1};if(o.type==="assistant/chunk"){n.set(a.step,{...l,streamedText:l.streamedText||ya(o)});continue}if(o.type==="assistant/message"){n.set(a.step,{streamedText:!1,finalized:!0}),va(o)&&(t=o.seq+it.finalizedFollowup);continue}if(o.type==="llm/retry"){n.set(a.step,{streamedText:!1,finalized:!1});continue}o.type==="step/end"&&l.streamedText&&!l.finalized&&(t=o.seq+it.interruptedFollowup)}return t}r(xa,"closingAnchor");function Rs(e){const t=e.start?.location??e.matches[0]?.location;return t?.kind==="turn"||t?.kind==="step"?t.turn:void 0}r(Rs,"turnLocation");function ba(e){return e.finalNode!==void 0&&e.blocks.some(t=>t.kind==="text"&&t.text.trim()!=="")}r(ba,"hasText");function wa(e){const t=e.state?.end??e.matches.find(c=>c.event.type==="turn/end");if(t?.event.type!=="turn/end")return null;const n=Rs(e);if(n===void 0)return null;const s=n.steps.map(c=>c.data.get("assistant-step")).filter(c=>c!==void 0).filter(c=>c.finalNode!==void 0).sort((c,d)=>c.finalNode.seq-d.finalNode.seq),o=s.findLast(ba)??null;let a=s.at(-1)?.finalNode.seq;for(const c of e.matches){const d=c.event,u=d.type==="tool/call"||d.type==="tool/result"&&(0,D.isAppendSurfaceEvent)(d)||d.type==="turn/end"&&d.data.reason.kind==="error"||d.type==="llm/retry"?d.seq:void 0;u!==void 0&&(a===void 0||u>a)&&(a=u)}const l=jr(s.map(c=>c.finalNode)).get(t.event.data.turn);return{turn:t.event.data.turn,seq:t.event.seq,time:t.event.time,closing:o,branchUnavailable:o===null||a!==o.finalNode.seq,...l?.ttftMs===void 0?{}:{ttftMs:l.ttftMs},...l?.tokensPerSecond===void 0?{}:{tokensPerSecond:l.tokensPerSecond}}}r(wa,"tailData");const ka={kind:"turn-tail",target:"chat",match:r(e=>{if(e.type==="turn/start")return{id:String(e.data.turn),role:"start"};if(e.type==="turn/end")return{id:String(e.data.turn),role:"update"};if(e.type==="tool/call"||e.type==="tool/result")return{id:String(e.data.turn),role:"update"};const t=qs(e);return t!==void 0?{id:String(t.turn),role:"update"}:null},"match"),start:r((e,t)=>{if(t.event.type!=="turn/start")throw new Error("turn-tail start requires turn/start");return{turn:t.event.data.turn}},"start"),update:r((e,t)=>t.event.type==="turn/end"?{...e.state,end:t}:e.state,"update"),publication:r(e=>e.event.type==="turn/end"?"immediate":"none","publication"),buildLocationData:r((e,t)=>{if(t!=="turn")return null;const n=wa(e);return n===null?null:{kind:"turn",turn:n.turn,key:"turn-tail",value:n}},"buildLocationData"),buildViewNode:r(e=>{const t=Rs(e)?.data.get("turn-tail");return t===void 0?null:ue(e,"turn-tail",xa(e),t)},"buildViewNode")};function _a(e){e.conversationEvents.register(ka)}r(_a,"registerTurnTailConversationNode");function Aa(e){Ji(e),Vi(e),xi(e),aa(e),Oi(e),Bi(e),Qi(e),ua(e),ga(e),_a(e),Ui(e),qi(e)}r(Aa,"registerConversationNodes");const Sa=3;function Ca(e,t=Sa){const n=(0,h.useRef)(e);n.current=e;const s=(0,h.useRef)(null);return(0,h.useLayoutEffect)(()=>()=>{s.current!==null&&(cancelAnimationFrame(s.current),s.current=null)},[]),(0,h.useCallback)(()=>{if(s.current!==null)return;let o=t;const a=r(()=>{if(o-=1,o>0){s.current=requestAnimationFrame(a);return}s.current=null,n.current()},"advance");s.current=requestAnimationFrame(a)},[t])}r(Ca,"useThrottledVisualUpdate");const ja=".MpeKdG_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}",Ms="@deepseek-ai/dsh-client-ui-conversation/accessibility.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Ms)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Ms,e.textContent=ja,document.head.appendChild(e)}var Ft={visuallyHidden:"MpeKdG_visuallyHidden"};const Ia='._4HtOLa_root{flex-direction:column;display:flex}._4HtOLa_row{position:relative;overflow:hidden}._4HtOLa_root[data-state=running] ._4HtOLa_row:after{content:"";inset-block:0;background:linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 55%, transparent 100%);pointer-events:none;width:300px;animation:2.6s ease-out infinite _4HtOLa_dsh-reasoning-row-sweep;position:absolute;left:0}@keyframes _4HtOLa_dsh-reasoning-row-sweep{0%{left:-300px}90%,to{left:100%}}._4HtOLa_leading{flex-shrink:0}._4HtOLa_chevron{color:var(--dsw-alias-label-secondary)}._4HtOLa_title{font-weight:400}._4HtOLa_separator{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}._4HtOLa_summary{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:14px;line-height:24px;overflow:hidden}._4HtOLa_summary[data-follow-end]{text-overflow:clip}._4HtOLa_thinkBody{color:var(--dsw-alias-label-tertiary);white-space:pre-wrap;word-break:break-word;padding:4px 0 4px 22px;font-size:14px;line-height:24px}@media (prefers-reduced-motion:reduce){._4HtOLa_root[data-state=running] ._4HtOLa_row:after{animation:none}}',Ws="@deepseek-ai/dsh-client-ui-conversation/ReasoningRow.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Ws)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Ws,e.textContent=Ia,document.head.appendChild(e)}var Me={row:"_4HtOLa_row","dsh-reasoning-row-sweep":"_4HtOLa_dsh-reasoning-row-sweep",root:"_4HtOLa_root",leading:"_4HtOLa_leading",separator:"_4HtOLa_separator",chevron:"_4HtOLa_chevron",title:"_4HtOLa_title",thinkBody:"_4HtOLa_thinkBody",summary:"_4HtOLa_summary"};function Na(e){const t=e.indexOf(`
6
- `);return t===-1?e:e.slice(0,t)}r(Na,"firstLine");function Ea(e){const t=e.trimEnd(),n=t.lastIndexOf(`
7
- `);return n===-1?t:t.slice(n+1)}r(Ea,"latestLine");function Ta({text:e,running:t,t:n}){const[s,o]=(0,h.useState)(!1),a=(0,h.useRef)(null),l=t?Ea(e):Na(e),c=Ca(()=>{const d=a.current;d!==null&&(d.scrollLeft=t?d.scrollWidth-d.clientWidth:0)});return(0,h.useEffect)(()=>{c()},[t,c,l]),(0,i.jsxs)("div",{className:Me.root,"data-variant":"think","data-state":t?"running":"ok",children:[t&&(0,i.jsx)("span",{className:Ft.visuallyHidden,children:n("row.running")}),(0,i.jsx)(_.DisclosureRow,{rowClassName:Me.row,leadingClassName:Me.leading,titleClassName:Me.title,chevronClassName:Me.chevron,icon:(0,i.jsx)(_.IconThinkOutline14,{size:14}),title:"Think",open:s,expandable:!0,expandOnRowClick:!0,onToggle:r(()=>{o(d=>!d)},"onToggle"),collapsedContent:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:Me.separator,"aria-hidden":!0}),(0,i.jsx)("span",{ref:a,className:Me.summary,"data-follow-end":t||void 0,children:l})]}),children:(0,i.jsx)("div",{className:Me.thinkBody,children:e})})]})}r(Ta,"ReasoningRow");const qa=".UAhSbG_root{color:var(--dsw-alias-label-primary);flex-direction:column;font-size:16px;line-height:28px;display:flex}.UAhSbG_body{flex-direction:column;gap:16px;display:flex}.UAhSbG_stopped{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-tertiary);border-radius:6px;align-self:flex-start;padding:0 6px;font-size:11px;line-height:18px}.UAhSbG_actions{margin-top:16px;margin-left:-6px}",Gs="@deepseek-ai/dsh-client-ui-conversation/AssistantMarkdown.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Gs)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Gs,e.textContent=qa,document.head.appendChild(e)}var Jt={root:"UAhSbG_root",stopped:"UAhSbG_stopped",actions:"UAhSbG_actions",body:"UAhSbG_body"};const Ra=(0,h.memo)(r(function({blocks:t,streaming:n,interrupted:s,loadImage:o,mentions:a,t:l}){const c=o??(()=>Promise.reject(new Error(l("image.serviceUnavailable")))),d=(0,h.useMemo)(()=>({copyLabel:l("copy"),copiedLabel:l("copied")}),[l]),u=t.length-1;if(!(n||s===!0||t.some(m=>m.kind!=="tool-call")))return null;const f=[];for(let m=0;m<t.length;m++){const k=t[m];if(k!==void 0)switch(k.kind){case"text":f.push((0,i.jsx)(_.MarkdownText,{text:k.text,streaming:n,codeLabels:d,fileMentions:a},m));break;case"reasoning":f.push((0,i.jsx)(Ta,{text:k.text,running:n&&m===u,t:l},m));break;case"image":{const g=m,y=[k];for(;m+1<t.length;){const b=t[m+1];if(b===void 0||b.kind!=="image")break;y.push(b),m+=1}f.push((0,i.jsx)(Ze.ImageGallery,{images:y,load:c,align:"start",labels:xn(l)},g));break}case"tool-call":break;default:f.push((0,i.jsx)(_.JsonBlock,{label:l("message.unknownBlock"),payload:k.block,truncatedLabel:r(g=>l("json.truncated",{total:g}),"truncatedLabel")},m))}}return(0,i.jsx)("div",{className:Jt.root,"data-streaming":n||void 0,children:(0,i.jsxs)("div",{className:Jt.body,children:[f,s&&(0,i.jsx)("span",{className:Jt.stopped,children:l("message.stopped")})]})})},"AssistantMarkdown")),Ma=(0,h.memo)(r(function({node:t,useTurnData:n,openFile:s,loadImage:o,fileMentions:a,t:l}){const c=t.data,d=t.location.kind==="turn"||t.location.kind==="step"?t.location.turn:void 0,u=n("turn-tail"),f=(0,h.useMemo)(()=>{if(!(d?.status!=="closed"||c.finalNode===void 0)&&u?.closing?.finalNode.seq===c.finalNode.seq)return{turn:d,seq:c.finalNode.seq,openFile:s}},[c.finalNode,s,u,d]),m=(0,h.useMemo)(()=>f===void 0?void 0:a(f),[a,f]);return(0,i.jsx)(Ra,{blocks:c.blocks,streaming:c.status==="running",interrupted:c.status==="interrupted",loadImage:o,mentions:m,t:l})},"AssistantNodeView")),Wa='.dXuJPa_root{flex-direction:column;display:flex}.dXuJPa_row{position:relative;overflow:hidden}.dXuJPa_root[data-state=running] .dXuJPa_row:after{content:"";inset-block:0;background:linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 55%, transparent 100%);pointer-events:none;width:300px;animation:2.6s ease-out infinite dXuJPa_dsh-command-row-sweep;position:absolute;left:0}@keyframes dXuJPa_dsh-command-row-sweep{0%{left:-300px}90%,to{left:100%}}.dXuJPa_leading{flex-shrink:0}.dXuJPa_chevron{color:var(--dsw-alias-label-secondary)}.dXuJPa_title{font-weight:400}.dXuJPa_separator{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.dXuJPa_summary{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:14px;line-height:24px;overflow:hidden}.dXuJPa_summary[data-error],.dXuJPa_body[data-error]{color:var(--dsw-alias-state-error-primary)}.dXuJPa_body{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-markdown-code-block);max-height:260px;color:var(--dsw-alias-label-primary);font:var(--dsw-font-markdown-code-block-small);white-space:pre-wrap;border-radius:12px;margin:4px 0 4px 4px;padding:12px 16px;overflow:auto}@media (prefers-reduced-motion:reduce){.dXuJPa_root[data-state=running] .dXuJPa_row:after{animation:none}}',Os="@deepseek-ai/dsh-client-ui-conversation/GenericCommandCard.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Os)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Os,e.textContent=Wa,document.head.appendChild(e)}var We={"dsh-command-row-sweep":"dXuJPa_dsh-command-row-sweep",body:"dXuJPa_body",row:"dXuJPa_row",chevron:"dXuJPa_chevron",summary:"dXuJPa_summary",title:"dXuJPa_title",separator:"dXuJPa_separator",leading:"dXuJPa_leading",root:"dXuJPa_root"};function Ga(e){return e===null?"running":e.kind==="error"?"error":"ok"}r(Ga,"stateOf");function Oa(e){return e==="error"?(0,i.jsx)(_.StateDot,{state:"error"}):(0,i.jsx)(_.IconApiOutline14,{size:14})}r(Oa,"leadingFor");function Kt({node:e,t,runningSummary:n}){const[s,o]=(0,h.useState)(!1),a=e.outcome?.text,l=e.outcome===null?n??t("command.running"):a??(e.outcome.kind==="error"?t("command.failed"):t("command.done")),c=e.name??t("command.title"),d=Ga(e.outcome),u=a!==void 0&&a.includes(`
8
- `)?a:null,f=s&&u!==null;return(0,i.jsxs)("div",{className:We.root,"data-variant":"others","data-state":d,children:[d==="running"&&(0,i.jsx)("span",{className:Ft.visuallyHidden,children:t("row.running")}),d==="error"&&(0,i.jsx)("span",{className:Ft.visuallyHidden,children:t("row.failed")}),(0,i.jsx)(_.DisclosureRow,{rowClassName:We.row,leadingClassName:We.leading,titleClassName:We.title,chevronClassName:We.chevron,icon:Oa(d),title:c,open:f,expandable:u!==null,expandOnRowClick:!0,keepContentWhenOpen:!0,onToggle:r(()=>{o(m=>!m)},"onToggle"),collapsedContent:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:We.separator,"aria-hidden":!0}),(0,i.jsx)("span",{className:We.summary,"data-error":d==="error"||void 0,children:l})]}),children:(0,i.jsx)("pre",{className:We.body,"data-error":d==="error"||void 0,children:u})})]})}r(Kt,"GenericCommandCard");function La({node:e,compaction:t,t:n}){return t!==void 0?(0,i.jsx)(On,{node:t,title:"compact",fallbackSummary:e.outcome?.text??null,t:n}):e.outcome!==null?(0,i.jsx)(Kt,{node:e,t:n}):(0,i.jsx)(Kt,{node:e,t:n,runningSummary:n("message.compaction.running")})}r(La,"CompactionCommandCard");const Da=(0,h.memo)(r(function({node:t,renderSlot:n,t:s}){const o=t.data,a=(0,h.useMemo)(()=>({node:o}),[o]);return(0,i.jsx)("div",{className:ae.callRow,children:n("conversation.chat.commandview",a,{entryKey:o.name??"",fallback:(0,i.jsx)(Kt,{...a,t:s})})})},"CommandNodeView")),Ba=(0,h.memo)(r(function({node:t,t:n}){const s=t.data;return(0,i.jsx)("div",{className:ae.callRow,children:(0,i.jsx)(La,{node:s.command,...s.compaction===null?{}:{compaction:s.compaction},t:n})})},"ManualCompactionNodeView"));function $a(e){return e.flatMap(t=>t.kind==="text"?[t.text]:[]).join("")}r($a,"assistantText");const Ua=".y8secq_root{flex-direction:column;gap:16px;display:flex}.y8secq_actions{margin-left:-6px}",Ls="@deepseek-ai/dsh-client-ui-conversation/TurnTailNodeView.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Ls)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Ls,e.textContent=Ua,document.head.appendChild(e)}var Xt={actions:"y8secq_actions",root:"y8secq_root"};const Pa=(0,h.memo)(r(function({node:t,openFile:n,forkAt:s,renderSlot:o,renderSlotChain:a,t:l,useSession:c}){const d=t.data,u=c(w=>w.chat.locations.getTurn(d.turn).at(-1)!==t.key),f=t.location.kind==="turn"||t.location.kind==="step"?t.location.turn:void 0;if(f===void 0)return null;const m=d.closing,k=a("conversation.chat.turnTail",{turn:f,seq:m?.finalNode.seq??d.seq,openFile:n});if(m===null)return k===null?null:(0,i.jsx)("div",{className:Xt.root,children:k});const g=f.start===void 0||f.end===void 0?void 0:Math.max(0,f.end.time-f.start.time),y=m.finalNode.messageId,b=y===void 0?null:o("conversation.chat.assistant-actions",{messageId:y});return(0,i.jsxs)("div",{className:Xt.root,"data-turn-tail":d.turn,"data-time-hover-root":!0,children:[k,(0,i.jsx)(Lt,{text:$a(m.blocks),time:m.time,runMs:g,ttftMs:d.ttftMs,tokensPerSecond:d.tokensPerSecond,clock:"end",onBranch:r(()=>{s(m.finalNode.seq)},"onBranch"),branchUnavailable:d.branchUnavailable||u,className:Xt.actions,extraActions:b,t:l})]})},"TurnTailNodeView"));function za(e){e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"user",locale:U},Vn)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"steering",locale:U},Vn)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"context",locale:U},vo)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"assistant-step",locale:U},Ma)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"command",locale:U,children:{"conversation.chat.commandview":{kind:"keyed",scope:"session"}}},Da)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"manual-compaction",locale:U},Ba)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"compaction",locale:U},yo)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"model-retry",locale:U},xo)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"turn-error",locale:U},bo)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"turn-max-tokens",locale:U},wo)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"turn-tail",locale:U,children:{"conversation.chat.turnTail":{kind:"chain",scope:"session"},"conversation.chat.assistant-actions":{kind:"list",scope:"session"}}},Pa)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"unknown",locale:U},ko))}r(za,"registerChatNodeRenderers");const Fa=["slots","layout","sessions","workspaces","locale","connection","remote","settingsScope","conversationEvents","conversationViews"],Ja={getSnapshot:r(()=>null,"getSnapshot"),subscribe:r(()=>()=>{},"subscribe")},Ka={getSnapshot:r(()=>{},"getSnapshot"),subscribe:r(()=>()=>{},"subscribe")},Xa=new Map,Va={getSnapshot:r(()=>Xa,"getSnapshot"),subscribe:r(()=>()=>{},"subscribe")},Ds={getSnapshot:r(()=>null,"getSnapshot"),subscribe:r(()=>()=>{},"subscribe")},Ha={hooks:{turnData:r(({useSession:e},t)=>r(function(s){return e(o=>{const a=o.chat.nodes.get(t)?.location;return a?.kind==="turn"||a?.kind==="step"?a.turn.data.get(s):void 0})},"useTurnData"),"turnData")}};function Bs(e,t){const n=e.scope(t);if(n===void 0)throw new Error(`ui-conversation: session "${t}" resolved no scope`);const s=n.get("conversation");if(s===void 0)throw new Error("ui-conversation: conversation service unavailable through the session scope");return s}r(Bs,"scopedConversation");function Vt(e){const t=e.get("conversation");if(t===void 0)throw new Error("ui-conversation: conversation service unavailable");return t}r(Vt,"concreteConversation");function Ya({interactions:e}){return e.find(t=>t.kind==="approval")??null}r(Ya,"selectApproval");function Qa(e){const t=e.sessions,n=e.workspaces,s=e.layout,o=e.slots;Aa(e),za(e),e.effect(()=>e.locale.register(U,{zh:Wo,en:Go}),"ui-conversation: dictionaries");const a=e.locale.bind(U),l=Zs(),c=new vr(e.settingsScope.bind({namespace:fr}));e.slots.inject("settings.general.item",()=>e.slots.register({name:"settings.general.item",id:"composer-enter",order:20,locale:U,inject:r(()=>({hooks:{busyEnter:c.busyEnter},setBusyEnter:r(g=>{c.setBusyEnter(g)},"setBusyEnter")}),"inject")},Pr));const d=new Map,f={list:r(()=>{const g=[];for(const y of o.entries("conversation.view"))y.options.id!==void 0&&g.push({id:y.options.id,label:(0,Ys.resolveSlotLabel)(y.options.label)??y.options.id});return g},"viewTabs"),subscribe:r(g=>o.subscribe("conversation.view",g),"subscribe"),version:r(()=>o.getVersion("conversation.view"),"version")},m=new cr(e,a),k=new tr;e.effect(()=>t.provide({hooks:["input"],props:["inputActions"],resolve:r(g=>{const y=m.shellFor(g);return{hooks:{input:y.state},props:{inputActions:y.actions}}},"resolve")}),"ui-conversation: input standard-kit provider"),o.register({name:"conversation",locale:U,children:{"conversation.session":{kind:"single",scope:"session"},"conversation.session.header":{kind:"single",scope:"session"},"conversation.composer":{kind:"chain",scope:"session"},"conversation.composer.bar":{kind:"single",scope:"session-maybe"},"conversation.input.overlay":{kind:"list",scope:"session"},"conversation.input.dock":{kind:"list",scope:"session"},"conversation.composer.dock":{kind:"list",scope:"session"},"conversation.input.left":{kind:"list",scope:"session"},"conversation.input.right":{kind:"list",scope:"session"},"conversation.hero.workspace":{kind:"single",scope:"root"},"conversation.hero.agentPreset":{kind:"single",scope:"root"}},inject:r(g=>({hooks:{composerBlock:g===void 0?Ka:k.storeFor(g)},selectWorkspace:r(async y=>{const b=await n.connectWorkspace(y);if(g!==void 0&&b!==g){const w=m.shell(g),j=w.snapshot.draft,x=w.snapshot.imageIds,A=m.shell(b);if((x.length===0||A.addImages(x))&&(j!==""&&(A.setDraft(j),w.setDraft("")),x.length>0))for(const S of x)w.removeImage(S)}t.open(b)},"selectWorkspace")}),"inject")},ni),o.register({name:"conversation.session",children:{"conversation.view":{kind:"list",scope:"session"}},store:l,inject:r((g,y)=>{const b=Vt(e);return{views:f,releaseSessionImages:r(w=>{b.releaseSessionImages(w)},"releaseSessionImages"),bindDraftMirror:r(w=>m.shell(g).bindMirror(w),"bindDraftMirror")}},"inject")},ii),o.register({name:"conversation.session.header",locale:U,children:{"conversation.session.header.actions":{kind:"list",scope:"session"},"conversation.session.header.utilities":{kind:"list",scope:"session"}},store:l,inject:r(()=>({views:f,open:r(g=>{t.open(g)},"open")}),"inject")},oi),o.register({name:"conversation.composer.bar",locale:U,children:{"conversation.input.plan":{kind:"single",scope:"session"},"conversation.input.model":{kind:"single",scope:"session"}},inject:r(g=>{if(g===void 0)return{keyboard:void 0,addImages:void 0,removeImage:void 0,draftImages:void 0,resolveSubmitMode:r((j,x,A)=>c.resolve(j,x,A),"resolveSubmitMode"),toggleCommandMenu:void 0,stop:void 0,command:void 0,hooks:{notices:Ja,lexicon:Va,menuLauncher:Ds}};const y=Vt(e),b=m.shell(g),w=m.inputTriggers(g);return{keyboard:b,addImages:r(j=>{try{const x=y.createDraftImages(j);return b.addImages(x.map(A=>A.id))||y.releaseDraftImages(x),null}catch(x){return x instanceof en?a("image.unsupportedType"):x instanceof Error?x.message:String(x)}},"addImages"),removeImage:r(j=>{y.releaseDraftImage(j),b.removeImage(j)},"removeImage"),draftImages:r(j=>y.draftImages(j),"draftImages"),resolveSubmitMode:r((j,x,A)=>c.resolve(j,x,A),"resolveSubmitMode"),toggleCommandMenu:w===void 0?void 0:j=>{b.dismissPopup();const x=b.snapshot;w.toggleSource("command",{trigger:"/",query:"",position:x.draft.slice(0,j.start).trim()===""?"leading":"inline",span:{...j,draftRev:x.draftRev}})},stop:r(()=>{Bs(t,g).cancel().catch(()=>{})},"stop"),command:r(async j=>{const x=t.binding(g)?.session;if(x===void 0)return!1;const A=await x.command(j);return A.ok&&A.value.matched},"command"),hooks:{notices:b.notices,lexicon:b.lexicon,menuLauncher:w?.launcher??Ds}}},"inject")},Br),o.register({name:"conversation.composer",select:Ya,priority:1,locale:U},Ro),o.register({name:"conversation.view",id:"chat",order:0,label:r(()=>a("view.chat"),"label"),locale:U,children:{"conversation.chat.node":{kind:"keyed",scope:"session",inject:Ha}},store:l,inject:r((g,y)=>{const b=Vt(e),w=Bs(t,g);return{openDetails:r(j=>{y.select(j),s.openDetails()},"openDetails"),fileMentions:r(j=>e.get("chatFileMentions")?.forClosing(j),"fileMentions"),openFile:r(j=>{const x=t.list.getSnapshot().byId[g]?.cwd;n.openPath((0,D.resolveWorkspacePath)(x,j)).catch(()=>{})},"openFile"),loadOlder:r(()=>{w.loadOlder()},"loadOlder"),loadImage:r(j=>b.resolveImage(g,j),"loadImage"),inspectCall:r(j=>{y.setInspect({callId:j}),y.setView("trajectory")},"inspectCall"),chatScroll:{save:r(j=>{j===null?d.delete(g):d.set(g,j)},"save"),read:r(()=>d.get(g)??null,"read")},forkAt:r(j=>{t.fork({sessionId:g,atSeq:j,increaseTitle:!0}).then(x=>{t.open(x)}).catch(()=>{})},"forkAt")}},"inject")},jo),o.register({name:"conversation.composer.dock",id:"stats",order:0,locale:U},qr),e.plugin(tn,{input:m,blocks:k}),e.plugin(Jo),e.plugin(Vo),o.register({name:"details",locale:U,children:{"conversation.details.tool":{kind:"single",scope:"session"}},store:l,inject:r(()=>({closeDetails:r(()=>{s.closeDetails()},"closeDetails")}),"inject")},hi)}return r(Qa,"apply"),ut.ConversationController=tn,ut.apply=Qa,ut.inject=Fa,dt.exports},"factory")});
1
+ var xl=Object.defineProperty;var r=(Se,dt)=>xl(Se,"name",{value:dt,configurable:!0});window.__ModuleLoader__.load({id:"@deepseek-ai/dsh-client-ui-conversation",factory:r(Se=>{var dt={exports:{}},ut=dt.exports;Object.defineProperty(ut,Symbol.toStringTag,{value:"Module"});let Xs=Se("@deepseek-ai/dsh-client-ui-slots"),O=Se("@deepseek-ai/dsh-client-runtime/client"),er=Se("@deepseek-ai/cordis"),i=Se("react/jsx-runtime"),h=Se("react"),_=Se("@deepseek-ai/dsh-client-ui-primitives"),Xe=Se("@deepseek-ai/dsh-client-ui-attachment");function tr(){return(0,O.defineStore)({init:r(()=>({selection:null,draft:"",view:null,inspect:null}),"init"),persist:"dsh.conversation.chat",actions:{select:r((e,t)=>{e.selection=t},"select"),setDraft:r((e,t)=>{e.draft=t},"setDraft"),setView:r((e,t)=>{e.view=t},"setView"),setInspect:r((e,t)=>{e.inspect=t},"setInspect")}})}r(tr,"createChatStore");function nr(e){return{kind:"image",id:crypto.randomUUID(),previewUrl:URL.createObjectURL(e),file:e}}r(nr,"browserDraftAttachment");var nn=class extends Error{static{r(this,"UnsupportedImageMediaTypeError")}mediaType;constructor(e){super(`unsupported image media type: ${e||"(empty)"}`),this.name="UnsupportedImageMediaTypeError",this.mediaType=e}},sn=class extends er.Service{static{r(this,"ConversationController")}input;blocks;draftAttachments=new Map;imageUrls=new Map;imageGenerations=new Map;createdImageUrls=new Set;disposed=!1;constructor(e,t){super(e,"conversation"),this.input=t.input,this.blocks=t.blocks,e.effect(()=>()=>{this.disposed=!0;for(const n of this.createdImageUrls)At(n);this.createdImageUrls.clear(),this.draftAttachments.clear(),this.imageUrls.clear(),this.imageGenerations.clear()},"conversation attachment URL cache")}async send(e){const t=await this.scopedSession("send").prompt([{type:"text",text:e}],"queue");if(!t.ok)throw new Error(`conversation.send failed: ${t.error.code}: ${t.error.message}`)}async sendSession(e,t,n,s){const o=this.draftImages(n);if(o.length!==n.length)throw new Error("conversation.sendSession: one or more draft images are no longer available");const a=[...await this.serializeImages(o.map(c=>c.file)),...t===""?[]:[{type:"text",text:t}]],l=await e.prompt(a,s);if(!l.ok)throw new Error(`conversation.send failed: ${l.error.code}: ${l.error.message}`);this.releaseDraftImages(o)}createDraftImages(e){for(const t of e)rn(t.type);return e.map(t=>{const n=nr(t);return this.draftAttachments.set(n.id,n),this.createdImageUrls.add(n.previewUrl),n})}draftImages(e){const t=[];for(const n of e){const s=this.draftAttachments.get(n);s!==void 0&&t.push(s)}return t}releaseDraftImage(e){const t=this.draftAttachments.get(e);t!==void 0&&(this.draftAttachments.delete(e),this.createdImageUrls.delete(t.previewUrl),At(t.previewUrl))}releaseDraftImages(e){for(const t of e)this.releaseDraftImage(t.id)}resolveImage(e,t){if(this.disposed)return Promise.reject(new Error("conversation.resolveImage: service is disposed"));const n=`${e}:${t.attachmentId}`,s=this.imageUrls.get(n);if(s!==void 0)return s.pending;const o=this.imageGenerations.get(e)??0,a=this.requireSessions().binding(e)?.session;if(a===void 0)return Promise.reject(new Error(`conversation.resolveImage: unknown session "${e}"`));const l=a.readAttachment(t.attachmentId).then(c=>{if(!c.ok)throw new Error(`${c.error.code}: ${c.error.message}`);if(this.disposed)throw new Error("conversation.resolveImage: service was disposed before loading completed");if((this.imageGenerations.get(e)??0)!==o)throw new Error("historical image scope was released before loading completed");if(typeof URL.createObjectURL!="function")return`data:${c.value.attachment.mediaType};base64,${on(c.value.data)}`;const d=Uint8Array.from(c.value.data),u=URL.createObjectURL(new Blob([d.buffer],{type:c.value.attachment.mediaType}));return this.createdImageUrls.add(u),u}).catch(c=>{throw this.imageUrls.get(n)?.generation===o&&this.imageUrls.delete(n),c});return this.imageUrls.set(n,{sessionId:e,generation:o,pending:l}),l}releaseSessionImages(e){this.imageGenerations.set(e,(this.imageGenerations.get(e)??0)+1);for(const[t,n]of this.imageUrls)n.sessionId===e&&(this.imageUrls.delete(t),n.pending.then(s=>{this.createdImageUrls.delete(s)&&At(s)},()=>{}))}async updateQueue(e,t){const n=await this.scopedSession("updateQueue").updateQueue(e,t);if(!n.ok){if(t.kind==="steer"&&(n.error.code==="steer-unavailable"||n.error.code==="queue-item-not-found"))return;throw new Error(`conversation.updateQueue failed: ${n.error.code}: ${n.error.message}`)}}async cancel(){const e=await this.scopedSession("cancel").cancel();if(!e.ok)throw new Error(`conversation.cancel failed: ${e.error.code}: ${e.error.message}`)}async loadOlder(){await this.scopedSession("loadOlder").loadOlder()}scopedSession(e){const t=this.scopeId(e),n=this.requireSessions().binding(t);if(n===void 0)throw new Error(`conversation.${e}: session "${t}" resolved no binding`);return n.session}scopeId(e){const t=this.requireSessions().scopeOf(this.ctx);if(t===void 0)throw new Error(`conversation.${e} requires a session scope — address one via ctx.sessions.scope(id).conversation`);return t}requireSessions(){const e=this.ctx.get("sessions");if(e===void 0)throw new Error("conversation: sessions service unavailable");return e}serializeImages(e){return Promise.all(e.map(async t=>({type:"image",mediaType:rn(t.type),data:on(new Uint8Array(await t.arrayBuffer())),...t.name===""?{}:{name:t.name}})))}};function rn(e){switch(e){case"image/png":case"image/jpeg":case"image/webp":case"image/gif":return e;default:throw new nn(e)}}r(rn,"imageMediaType");function on(e){let t="";for(let s=0;s<e.length;s+=32768)t+=String.fromCharCode(...e.subarray(s,s+32768));return btoa(t)}r(on,"bytesToBase64");function At(e){e.startsWith("blob:")&&URL.revokeObjectURL(e)}r(At,"revokePreview");var sr=class{static{r(this,"ComposerBlockRegistry")}stores=new Map;set(e,t){const n=this.storeFor(e);n.getSnapshot()?.reason!==t?.reason&&n.set(t)}storeFor(e){const t=this.stores.get(e);if(t!==void 0)return t;const n=(0,O.createSnapshotStore)(void 0);return this.stores.set(e,n),n}forget(e){this.stores.delete(e)}};function rr(e){return{getSnapshot:r(()=>e.getSnapshot().queue,"getSnapshot"),subscribe:r(t=>e.subscribe(t),"subscribe")}}r(rr,"queueReadFaceOf");const or=[],an=100;function ln(e){throw new Error(`unreachable input event: ${JSON.stringify(e)}`)}r(ln,"unreachable");function cn(e,t){const n=e.trimStart();if(n.startsWith(t))return n.slice(t.length);const s=t.trimEnd();if(n.startsWith(s)){const o=n.slice(s.length);return/^\s/.test(o)?o.slice(1):o}return""}r(cn,"argsAfter");function ir(e,t){let n=0;const s=Math.min(e.length,t.length);for(;n<s&&e[n]===t[n];)n+=1;let o=0;const a=s-n;for(;o<a&&e[e.length-1-o]===t[t.length-1-o];)o+=1;return{start:n,end:e.length-o,insertedLength:t.length-o-n}}r(ir,"diffEdit");var ar=class{static{r(this,"InputMachine")}draft="";draftRev=0;phase="plain";claim;occurrences=[];occurrenceSeq=0;seq=0;inflight;log=[];redoStack=[];typingRun;paste;pasteSeq=0;mergeWindowMs;now;constructor(e={}){this.mergeWindowMs=e.mergeWindowMs??1e3,this.now=e.now??(()=>0)}get state(){const e=this.claim;return{draft:this.draft,imageIds:[],draftRev:this.draftRev,phase:this.phase,...e?{claim:{token:e.token,...e.hint!==void 0?{hint:e.hint}:{}}}:{},occurrences:this.occurrences,...this.paste!==void 0?{paste:this.paste}:{},queue:or}}dispatch(e){switch(e.type){case"draft-changed":return this.onDraftChanged(e.draft,e.editRange);case"begin-command":return this.onBeginCommand(e.claim,e.span);case"insert-ref":return this.onInsertRef(e.reference,e.span);case"consume-token":return this.onConsumeToken(e.guard);case"set-invalid":return this.onSetInvalid(e.invalidIds);case"undo":return this.onUndo();case"redo":return this.onRedo();case"paste-begin":return this.onPasteBegin(e.text,e.selection,e.components,e.generation);case"paste-upgrade":return this.onPasteUpgrade(e.attemptId,e.span,e.reference);case"invalidate-paste":return this.paste=void 0,[];case"enter":return this.onEnter(e.mode);case"adjudicated":return this.onAdjudicated(e.attempt,e.outcome);case"adjudication-failed":return this.onAdjudicationFailed(e.attempt,e.message);case"submit-settled":return this.onSubmitSettled(e);case"send-committed":return this.onSendCommitted();case"release":return this.onRelease();default:return ln(e)}}adopt(e){this.draft=e,this.draftRev+=1}pushTxn(e){this.log.push({draftBefore:this.draft,occurrencesBefore:this.occurrences,...e!==void 0?{selectionBefore:e}:{}}),this.log.length>an&&this.log.shift(),this.redoStack=[]}reconcile(e){const t=e.insertedLength-(e.end-e.start),n=[];for(const s of this.occurrences)s.offset<e.start?n.push(s):s.offset>=e.end&&n.push(t===0?s:{...s,offset:s.offset+t});this.occurrences=n}watchClaim(){this.phase==="claimed"&&this.claim!==void 0&&!this.draft.startsWith(this.claim.token)&&(this.phase="plain",this.claim=void 0)}mint(e,t){return this.occurrenceSeq+=1,{occurrenceId:this.occurrenceSeq,source:e.source,ref:e.ref,offset:t,label:e.label,clipboardText:e.clipboardText}}withMinted(e){e.length!==0&&(this.occurrences=[...this.occurrences,...e].sort((t,n)=>t.offset-n.offset))}onDraftChanged(e,t){if(e===this.draft)return[];const n=t??ir(this.draft,e),s=n.start===n.end&&n.insertedLength===1,o=this.now(),a=this.typingRun;return s&&a!==void 0&&a.end===n.start&&o-a.at<=this.mergeWindowMs||this.pushTxn({start:n.start,end:n.end}),this.typingRun=s?{end:n.start+1,at:o}:void 0,this.reconcile(n),this.adopt(e),this.watchClaim(),this.paste=void 0,[]}casOk(e){return e.draftRev===this.draftRev&&e.start>=0&&e.start<=e.end&&e.end<=this.draft.length}onBeginCommand(e,t){return this.phase!=="plain"&&this.phase!=="claimed"?[]:!this.casOk(t)||this.draft.slice(0,t.start).trim()!==""?[]:(this.pushTxn(),this.typingRun=void 0,this.reconcile({start:0,end:t.end,insertedLength:e.token.length}),this.adopt(e.token+this.draft.slice(t.end)),this.claim=e,this.phase="claimed",this.paste=void 0,[])}onInsertRef(e,t){return this.phase!=="plain"&&this.phase!=="claimed"?[]:this.casOk(t)?(this.replaceSpanWithChip(e,t),this.paste=void 0,[]):[]}replaceSpanWithChip(e,t){this.pushTxn(),this.typingRun=void 0;const n=this.draft.slice(t.end),s=""+(n.length===0||n[0]!==" "?" ":"");return this.reconcile({start:t.start,end:t.end,insertedLength:s.length}),this.withMinted([this.mint(e,t.start)]),this.adopt(this.draft.slice(0,t.start)+s+n),this.watchClaim(),s.length}onConsumeToken(e){if(this.phase!=="plain"&&this.phase!=="claimed")return[];switch(e.kind){case"span":{const t=e.span;return!this.casOk(t)||t.start===t.end?[]:(this.pushTxn(),this.typingRun=void 0,this.reconcile({start:t.start,end:t.end,insertedLength:0}),this.adopt(this.draft.slice(0,t.start)+this.draft.slice(t.end)),this.watchClaim(),this.paste=void 0,[])}case"bare-token":return e.token===""||this.draft.trim()!==e.token?[]:(this.pushTxn(),this.typingRun=void 0,this.occurrences=[],this.adopt(""),this.watchClaim(),this.paste=void 0,[]);default:return ln(e)}}onSetInvalid(e){const t=new Set(e);return this.occurrences.some(n=>n.invalid===!0!==t.has(n.occurrenceId))?(this.occurrences=this.occurrences.map(n=>{const s=t.has(n.occurrenceId);if(n.invalid===!0===s)return n;const{invalid:o,...a}=n;return s?{...a,invalid:!0}:a}),[]):[]}onUndo(){const e=this.log.pop();return e===void 0?[]:(this.redoStack.push({draftBefore:this.draft,occurrencesBefore:this.occurrences}),this.occurrences=e.occurrencesBefore,this.adopt(e.draftBefore),this.watchClaim(),this.typingRun=void 0,this.paste=void 0,[])}onRedo(){const e=this.redoStack.pop();return e===void 0?[]:(this.log.push({draftBefore:this.draft,occurrencesBefore:this.occurrences}),this.log.length>an&&this.log.shift(),this.occurrences=e.occurrencesBefore,this.adopt(e.draftBefore),this.watchClaim(),this.typingRun=void 0,this.paste=void 0,[])}onPasteBegin(e,t,n=[],s=0){const{start:o,end:a}=t;if(o<0||o>a||a>this.draft.length)return[];const l=e.split("").join("");this.pushTxn(t),this.typingRun=void 0;const c=[...n].sort((m,k)=>m.start-k.start),d=[];let u="",f=0;for(const m of c)u+=l.slice(f,m.start),d.push(this.mint(m.reference,o+u.length)),u+="",f=m.end;return u+=l.slice(f),this.reconcile({start:o,end:a,insertedLength:u.length}),this.withMinted(d),this.adopt(this.draft.slice(0,o)+u+this.draft.slice(a)),this.watchClaim(),this.phase==="plain"||this.phase==="claimed"?(this.pasteSeq+=1,this.paste={attemptId:this.pasteSeq,insertedRange:{start:o,end:o+u.length},generation:s}):this.paste=void 0,[]}onPasteUpgrade(e,t,n){const s=this.paste;if(s===void 0||s.attemptId!==e)return[];if(this.phase!=="plain"&&this.phase!=="claimed")return[];if(!this.casOk(t)||t.start===t.end)return[];const o=this.replaceSpanWithChip(n,t);return this.paste={...s,insertedRange:{start:s.insertedRange.start,end:s.insertedRange.end+o-(t.end-t.start)}},[]}beginAttempt(e){const t=new AbortController;this.seq+=1;const n={seq:this.seq,signal:t.signal,draftSnapshot:this.draft,mode:e};return this.inflight={attempt:n,controller:t},n}onEnter(e){if(this.phase==="adjudicating"||this.phase==="submitting")return[];if(this.phase==="claimed"&&this.claim!==void 0){const n=this.beginAttempt(e);return this.phase="submitting",this.paste=void 0,[{type:"begin-submit",attempt:n,claim:this.claim,args:cn(this.draft,this.claim.token)}]}const t=this.draft.trim();if(t==="")return[];if(this.paste=void 0,t.startsWith("/")){const n=this.beginAttempt(e);return this.phase="adjudicating",[{type:"adjudicate",attempt:n,draft:this.draft}]}return[{type:"default-sink",draft:this.draft,mode:e}]}onAdjudicated(e,t){const n=this.inflight;return this.phase!=="adjudicating"||n===void 0||n.attempt.seq!==e.seq?[]:t!==void 0&&t!=="handled"&&"claim"in t?(this.claim=t.claim,this.phase="submitting",[{type:"begin-submit",attempt:e,claim:t.claim,args:cn(e.draftSnapshot,t.claim.token)}]):(this.inflight=void 0,this.phase="plain",t===void 0?[{type:"default-sink",draft:e.draftSnapshot,mode:e.mode}]:[])}onAdjudicationFailed(e,t){return this.phase!=="adjudicating"||this.inflight?.attempt.seq!==e.seq?[]:(this.inflight=void 0,this.phase="plain",[{type:"notice",level:"error",text:t}])}onSubmitSettled(e){const t=this.inflight;if(this.phase!=="submitting"||t===void 0||t.attempt.seq!==e.attempt.seq)return[];if(this.inflight=void 0,e.ok)return this.phase="plain",this.claim=void 0,this.occurrences=[],this.adopt(""),this.log=[],this.redoStack=[],this.typingRun=void 0,this.paste=void 0,e.outcome?.text!==void 0?[{type:"notice",level:e.outcome.kind==="error"?"error":"info",text:e.outcome.text}]:[];const n=e.message??e.outcome?.text??"command failed";return this.draft===t.attempt.draftSnapshot&&this.claim!==void 0&&this.draft.startsWith(this.claim.token)?(this.phase="claimed",[{type:"notice",level:"error",text:n}]):(this.phase="plain",this.claim=void 0,[{type:"notice",level:"error",text:n}])}onSendCommitted(){return this.claim=void 0,this.occurrences=[],this.adopt(""),this.log=[],this.redoStack=[],this.typingRun=void 0,this.paste=void 0,[]}onRelease(){return this.inflight!==void 0&&(this.inflight.controller.abort(),this.inflight=void 0),this.phase="plain",this.claim=void 0,this.typingRun=void 0,this.paste=void 0,[]}};function dn(e){switch(e){case"plain":return"plain";case"claimed":return"claimed";default:return"frozen"}}r(dn,"guardOf");const lr=[],cr=new Map;var dr=class{static{r(this,"SessionInputShell")}deps;state;notices=(0,O.createSnapshotStore)(null);actions={setDraft:r(e=>{this.setDraft(e)},"setDraft"),addImages:r(e=>this.addImages(e),"addImages"),removeImage:r(e=>{this.removeImage(e)},"removeImage"),pruneImages:r(e=>{this.pruneImages(e)},"pruneImages"),submit:r(()=>{this.submit("queue")},"submit")};core=new ar({now:r(()=>Date.now(),"now")});noticeSeq=0;lastDraft="";imageIds=[];disposed=!1;mirrorFn;constructor(e){this.deps=e,this.state=(0,O.createSnapshotStore)(this.compose()),e.queue?.subscribe(()=>{this.publish()})}setDraft(e,t){this.run(this.core.dispatch({type:"draft-changed",draft:e,...t!==void 0?{editRange:t}:{}}))}addImages(e){return this.snapshot.phase==="adjudicating"||this.snapshot.phase==="submitting"?!1:(e.length===0||(this.imageIds=[...this.imageIds,...e],this.publish()),!0)}removeImage(e){const t=this.imageIds.filter(n=>n!==e);t.length!==this.imageIds.length&&(this.imageIds=t,this.publish())}pruneImages(e){const t=new Set(e),n=this.imageIds.filter(s=>t.has(s));n.length!==this.imageIds.length&&(this.imageIds=n,this.publish())}restoreImages(e){const t=new Set(this.imageIds);this.imageIds=[...e.filter(n=>!t.has(n)),...this.imageIds],this.publish()}commitSend(e){const t=new Set(e);this.imageIds=this.imageIds.filter(n=>!t.has(n)),this.run(this.core.dispatch({type:"send-committed"}))}undo(){this.run(this.core.dispatch({type:"undo"}))}redo(){this.run(this.core.dispatch({type:"redo"}))}pasteBegin(e,t,n,s){this.run(this.core.dispatch({type:"paste-begin",text:e,selection:t,...n!==void 0?{components:n}:{},...s!==void 0?{generation:s}:{}}))}invalidatePaste(){this.run(this.core.dispatch({type:"invalidate-paste"}))}submit(e="queue"){if(this.snapshot.draft.trim()===""&&this.imageIds.length>0){this.snapshot.phase==="plain"&&this.deps.defaultSink("",[...this.imageIds],e);return}this.run(this.core.dispatch({type:"enter",mode:e}));const t=this.snapshot.phase;(t==="adjudicating"||t==="submitting")&&(this.deps.popup?.()?.dismiss(),this.deps.inputTriggers?.()?.track(this.snapshot.draft,0,{tier:"frozen"},this.snapshot.draftRev))}track(e,t){this.deps.inputTriggers?.()?.track(e,t,{tier:dn(this.snapshot.phase)},this.snapshot.draftRev)}arbitrate(e,t){return this.deps.inputTriggers?.()?.arbitrate(e,t)??"pass"}steerQueue(){this.deps.steerQueue?.()}space(){const e=this.deps.inputTriggers?.();if(e===void 0)return!1;const t=e.onSpace();if(t){const n=this.snapshot;e.track(n.draft,n.draft.length,{tier:dn(n.phase)},n.draftRev)}return t}dismissPopup(){this.deps.popup?.()?.dismiss()}lexicon={getSnapshot:r(()=>this.deps.inputTriggers?.()?.lexicon.getSnapshot()??cr,"getSnapshot"),subscribe:r(e=>this.deps.inputTriggers?.()?.lexicon.subscribe(e)??(()=>{}),"subscribe")};beginCommand(e,t){const n=this.core.state.draftRev;return this.run(this.core.dispatch({type:"begin-command",claim:e,span:t})),this.core.state.phase==="claimed"&&this.core.state.draftRev!==n}insertReference(e,t){const n=this.core.state.draftRev;return this.run(this.core.dispatch({type:"insert-ref",reference:e,span:t})),this.core.state.draftRev!==n}consumeToken(e){const t=this.core.state;if(e.kind==="span"){if(e.span.draftRev!==t.draftRev)return!1;const n=t.draft;return this.setDraft(n.slice(0,e.span.start)+n.slice(e.span.end)),!0}return t.draft.trim()!==e.token?!1:(this.setDraft(""),!0)}insertText(e,t){const n=this.core.state;if(t.draftRev!==n.draftRev)return!1;const s=n.draft;return this.setDraft(s.slice(0,t.start)+e+s.slice(t.end)),!0}notify(e,t){this.noticeSeq+=1,this.notices.set({level:e,text:t,seq:this.noticeSeq})}dispose(){this.disposed=!0,this.run(this.core.dispatch({type:"release"}))}get snapshot(){return this.state.getSnapshot()}bindMirror(e){return this.mirrorFn=e,()=>{this.mirrorFn===e&&(this.mirrorFn=void 0)}}run(e){for(const t of e)this.execute(t);this.publish()}execute(e){switch(e.type){case"notice":this.noticeSeq+=1,this.notices.set({level:e.level,text:e.text,seq:this.noticeSeq});return;case"adjudicate":this.adjudicate(e.attempt,e.draft);return;case"begin-submit":this.beginSubmit(e.attempt,e.claim,e.args);return;case"default-sink":this.sinkSerialized(e.draft,e.mode);return;default:return}}sinkSerialized(e,t){const n=[...this.imageIds],s=this.core.state.occurrences;if(s.length===0){this.deps.defaultSink(e.trim(),n,t);return}const o=this.deps.inputTriggers?.(),a=new AbortController;Promise.all(s.map(async l=>{if(o===void 0)throw new Error(`no serializer for reference source "${l.source}"`);return{offset:l.offset,text:await o.serializeReference(l.source,l.ref,a.signal)}})).then(l=>{if(this.disposed)return;let c="",d=0;for(const u of l)c+=e.slice(d,u.offset)+u.text,d=u.offset+1;c+=e.slice(d),this.deps.defaultSink(c.trim(),n,t)},l=>{if(a.abort(),this.disposed)return;const c=l instanceof Error?l.message:String(l);this.notify("error",c)})}adjudicate(e,t){const n=this.deps.inputTriggers?.();if(n===void 0){this.run(this.core.dispatch({type:"adjudicated",attempt:e,outcome:void 0}));return}n.adjudicate(t.trim(),e.signal).then(s=>{this.dead(e)||this.run(this.core.dispatch({type:"adjudicated",attempt:e,outcome:s}))},s=>{if(this.dead(e))return;const o=s instanceof Error?s.message:String(s);this.run(this.core.dispatch({type:"adjudication-failed",attempt:e,message:o}))})}beginSubmit(e,t,n){Promise.resolve().then(()=>t.submit(n,this.deps.actx)).then(s=>{this.dead(e)||this.run(this.core.dispatch({type:"submit-settled",attempt:e,ok:s.kind==="success",outcome:s}))},s=>{if(this.dead(e))return;const o=s instanceof Error?s.message:String(s);this.run(this.core.dispatch({type:"submit-settled",attempt:e,ok:!1,message:o}))})}dead(e){return this.disposed||e.signal.aborted}compose(){return{...this.core.state,imageIds:this.imageIds,queue:this.deps.queue?.getSnapshot()??lr}}publish(){const e=this.compose();this.state.set(e),e.draft!==this.lastDraft&&(this.lastDraft=e.draft,this.mirrorFn?.(e.draft))}},ur=class{static{r(this,"InputHub")}rootCtx;t;shells=new Map;constructor(e,t){this.rootCtx=e,this.t=t}for(e){const t=this.sessions().scopeOf(e);if(t===void 0)throw new Error("conversation.input.for requires a session scope");return this.shell(t)}shellFor(e){const t=this.shells.get(e.sessionId);if(t!==void 0)return t;const{sessionId:n,session:s,ctx:o}=e,a=new dr({actx:o,inputTriggers:r(()=>this.controller(o),"inputTriggers"),popup:r(()=>this.popup(o),"popup"),queue:rr(s),defaultSink:r((l,c,d)=>{this.sink(s,l,c,d)},"defaultSink"),steerQueue:r(()=>{this.steerQueue(s,a)},"steerQueue")});return this.shells.set(n,a),o.effect(()=>{const l=[o.on("slash/input-begin-command",c=>a.beginCommand(c.claim,c.span)?!0:void 0),o.on("slash/input-insert-reference",c=>a.insertReference(c.reference,c.span)?!0:void 0),o.on("slash/input-consume-token",c=>a.consumeToken(c.guard)?!0:void 0),o.on("slash/input-insert-text",c=>a.insertText(c.text,c.span)?!0:void 0)];return()=>{for(const u of l)u();const c=a.snapshot.imageIds;a.dispose(),this.shells.delete(n);const d=this.rootCtx.get("conversation");for(const u of c)d?.releaseDraftImage(u)}},"conversation.input: session shell"),a}shell(e){const t=this.shells.get(e);if(t!==void 0)return t;const n=this.sessions().binding(e);if(n===void 0)throw new Error(`conversation.input: session "${e}" resolved no binding`);return this.shellFor(n)}keyboard(e){return this.shell(e)}inputTriggers(e){const t=this.sessions().scope(e);return t===void 0?void 0:this.controller(t)}sink(e,t,n,s){if(t===""&&n.length===0)return;const o=this.shells.get(e.sessionId);o?.commitSend(n),this.conversation().sendSession(e,t,n,s).catch(()=>{if(this.shells.get(e.sessionId)===o){o?.restoreImages(n),o?.snapshot.draft===""&&o.setDraft(t);return}const a=this.rootCtx.get("conversation");for(const l of n)a?.releaseDraftImage(l)})}async steerQueue(e,t){const n=e.getSnapshot().queue.filter(s=>s.placement==="queued");if(n.length!==0)for(const s of n){const o=await e.updateQueue(s.id,{kind:"steer"});if(!o.ok){if(o.error.code==="steer-unavailable"||o.error.code==="queue-item-not-found")return;t.notify("error",this.t("queue.steerFailed"));return}}}controller(e){return this.rootCtx.get("inputTriggers")?.sessionOf(e)}popup(e){return this.rootCtx.get("commandUi")?.popupFor(e)}sessions(){const e=this.rootCtx.get("sessions");if(e===void 0)throw new Error("conversation.input: sessions service unavailable");return e}conversation(){const e=this.rootCtx.get("conversation");if(e===void 0)throw new Error("conversation.input: conversation service unavailable");return e}};function oe(e){return e==null}r(oe,"isNullable");function jt(e){return e&&typeof e=="object"&&!Array.isArray(e)}r(jt,"isPlainObject");function pr(e,t){return Object.fromEntries(Object.entries(e).filter(([n,s])=>t(n,s)))}r(pr,"filterKeys");function Ie(e,t){return Object.fromEntries(Object.entries(e).map(([n,s])=>[n,t(s,n)]))}r(Ie,"mapValues");function hr(e,t,n){if(!t)return{...e};const s={};for(const o of t)(n||e[o]!==void 0)&&(s[o]=e[o]);return s}r(hr,"pick");function Fe(e,t){return arguments.length===1?n=>Fe(e,n):e in globalThis&&t instanceof globalThis[e]||Object.prototype.toString.call(t).slice(8,-1)===e}r(Fe,"is");function pt(e){return Fe("ArrayBuffer",e)||Fe("SharedArrayBuffer",e)}r(pt,"isArrayBufferLike");function mr(e){return pt(e)||ArrayBuffer.isView(e)}r(mr,"isArrayBufferSource");let xe;(function(e){e.is=pt,e.isSource=mr;function t(l){return ArrayBuffer.isView(l)?l.buffer.slice(l.byteOffset,l.byteOffset+l.byteLength):l}r(t,"fromSource"),e.fromSource=t;function n(l){if(l=t(l),typeof Buffer<"u")return Buffer.from(l).toString("base64");let c="";const d=new Uint8Array(l);for(let u=0;u<d.byteLength;u++)c+=String.fromCharCode(d[u]);return btoa(c)}r(n,"toBase64"),e.toBase64=n;function s(l){return typeof Buffer<"u"?t(Buffer.from(l,"base64")):Uint8Array.from(atob(l),c=>c.charCodeAt(0))}r(s,"fromBase64"),e.fromBase64=s;function o(l){return l=t(l),typeof Buffer<"u"?Buffer.from(l).toString("hex"):Array.from(new Uint8Array(l),c=>c.toString(16).padStart(2,"0")).join("")}r(o,"toHex"),e.toHex=o;function a(l){if(typeof Buffer<"u")return t(Buffer.from(l,"hex"));const c=l.length%2===0?l:l.slice(0,l.length-1),d=[];for(let u=0;u<c.length;u+=2)d.push(parseInt(`${c[u]}${c[u+1]}`,16));return Uint8Array.from(d).buffer}r(a,"fromHex"),e.fromHex=a})(xe||(xe={})),xe.fromBase64,xe.toBase64,xe.fromHex,xe.toHex;function St(e,t=new Map){if(!e||typeof e!="object")return e;if(Fe("Date",e))return new Date(e.valueOf());if(Fe("RegExp",e))return new RegExp(e.source,e.flags);if(pt(e))return e.slice(0);if(ArrayBuffer.isView(e))return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);const n=t.get(e);if(n)return n;if(Array.isArray(e)){const o=[];return t.set(e,o),e.forEach((a,l)=>{o[l]=Reflect.apply(St,null,[a,t])}),o}const s=Object.create(Object.getPrototypeOf(e));t.set(e,s);for(const o of Reflect.ownKeys(e)){const a={...Reflect.getOwnPropertyDescriptor(e,o)};"value"in a&&(a.value=Reflect.apply(St,null,[a.value,t])),Reflect.defineProperty(s,o,a)}return s}r(St,"clone");function et(e,t,n){if(e===t||!n&&oe(e)&&oe(t))return!0;if(typeof e!=typeof t||typeof e!="object"||!e||!t)return!1;function s(o,a){return o(e)?o(t)?a(e,t):!1:o(t)?!1:void 0}return r(s,"check"),s(Array.isArray,(o,a)=>o.length===a.length&&o.every((l,c)=>et(l,a[c])))??s(Fe("Date"),(o,a)=>o.valueOf()===a.valueOf())??s(Fe("RegExp"),(o,a)=>o.source===a.source&&o.flags===a.flags)??s(pt,(o,a)=>{if(o.byteLength!==a.byteLength)return!1;const l=new Uint8Array(o),c=new Uint8Array(a);for(let d=0;d<l.length;d++)if(l[d]!==c[d])return!1;return!0})??Object.keys({...e,...t}).every(o=>et(e[o],t[o],n))}r(et,"deepEqual");let un;(function(e){e.millisecond=1;const t=e.second=1e3,n=e.minute=t*60,s=e.hour=n*60,o=e.day=s*24,a=e.week=o*7;let l=new Date().getTimezoneOffset();function c(y){l=y}r(c,"setTimezoneOffset"),e.setTimezoneOffset=c;function d(){return l}r(d,"getTimezoneOffset"),e.getTimezoneOffset=d;function u(y=new Date,A){return typeof y=="number"&&(y=new Date(y)),A===void 0&&(A=l),Math.floor((y.valueOf()/n-A)/1440)}r(u,"getDateNumber"),e.getDateNumber=u;function f(y,A){const j=new Date(y*o);return A===void 0&&(A=l),new Date(+j+A*n)}r(f,"fromDateNumber"),e.fromDateNumber=f;const m=/\d+(?:\.\d+)?/.source,k=new RegExp(`^${["w(?:eek(?:s)?)?","d(?:ay(?:s)?)?","h(?:our(?:s)?)?","m(?:in(?:ute)?(?:s)?)?","s(?:ec(?:ond)?(?:s)?)?"].map(y=>`(${m}${y})?`).join("")}$`);function g(y){const A=k.exec(y);return A?(parseFloat(A[1])*a||0)+(parseFloat(A[2])*o||0)+(parseFloat(A[3])*s||0)+(parseFloat(A[4])*n||0)+(parseFloat(A[5])*t||0):0}r(g,"parseTime"),e.parseTime=g;function x(y){const A=g(y);return A?y=Date.now()+A:/^\d{1,2}(:\d{1,2}){1,2}$/.test(y)?y=`${new Date().toLocaleDateString()}-${y}`:/^\d{1,2}-\d{1,2}-\d{1,2}(:\d{1,2}){1,2}$/.test(y)&&(y=`${new Date().getFullYear()}-${y}`),y?new Date(y):new Date}r(x,"parseDate"),e.parseDate=x;function b(y){const A=Math.abs(y);return A>=o-s/2?Math.round(y/o)+"d":A>=s-n/2?Math.round(y/s)+"h":A>=n-t/2?Math.round(y/n)+"m":A>=t?Math.round(y/t)+"s":y+"ms"}r(b,"format"),e.format=b;function w(y,A=2){return y.toString().padStart(A,"0")}r(w,"toDigits"),e.toDigits=w;function C(y,A=new Date){return y.replace("yyyy",A.getFullYear().toString()).replace("yy",A.getFullYear().toString().slice(2)).replace("MM",w(A.getMonth()+1)).replace("dd",w(A.getDate())).replace("hh",w(A.getHours())).replace("mm",w(A.getMinutes())).replace("ss",w(A.getSeconds())).replace("SSS",w(A.getMilliseconds(),3))}r(C,"template"),e.template=C})(un||(un={}));const ht=Symbol.for("schemastery"),pn=Symbol.for("ValidationError");globalThis.__schemastery_index__??=0,globalThis.__schemastery_refs__=void 0;var R=class extends TypeError{static{r(this,"ValidationError")}options;name="ValidationError";constructor(e,t){let n="$";for(const s of t.path||[])typeof s=="string"?n+="."+s:typeof s=="number"?n+="["+s+"]":typeof s=="symbol"&&(n+=`[Symbol(${s.toString()})]`);n.startsWith(".")&&(n=n.slice(1)),super((n==="$"?"":`${n} `)+e),this.options=t}static is(e){return!!e?.[pn]}};Object.defineProperty(R.prototype,pn,{value:!0});const v=r(function(e){const t=r(function(n,s={}){return v.resolve(n,t,s)[0]},"schema");if(e.refs){const n=Ie(e.refs,o=>new v(o)),s=r(o=>n[o],"getRef");for(const o in n){const a=n[o];a.sKey=s(a.sKey),a.inner=s(a.inner),a.list=a.list&&a.list.map(s),a.dict=a.dict&&Ie(a.dict,s)}return n[e.uid]}if(Object.assign(t,e),typeof t.callback=="string")try{t.callback=new Function("return "+t.callback)()}catch{}return Object.defineProperty(t,"uid",{value:globalThis.__schemastery_index__++}),Object.setPrototypeOf(t,v.prototype),t.meta||={},t.toString=t.toString.bind(t),t},"Schema");v.prototype=Object.create(Function.prototype),v.prototype[ht]=!0,Object.defineProperty(v.prototype,"~standard",{get(){return{version:1,vendor:"schemastery",validate:r(e=>{try{return{value:v.resolve(e,this,{})[0]}}catch(t){if(R.is(t))return{issues:[{message:t.message,path:t.options.path}]};throw t}},"validate")}}}),v.ValidationError=R,v.prototype.toJSON=r(function(){if(globalThis.__schemastery_refs__)return globalThis.__schemastery_refs__[this.uid]??=JSON.parse(JSON.stringify({...this})),this.uid;globalThis.__schemastery_refs__={[this.uid]:{...this}},globalThis.__schemastery_refs__[this.uid]=JSON.parse(JSON.stringify({...this}));const t={uid:this.uid,refs:globalThis.__schemastery_refs__};return globalThis.__schemastery_refs__=void 0,t},"toJSON"),v.prototype.set=r(function(t,n){return this.dict[t]=n,this},"set"),v.prototype.push=r(function(t){return this.list.push(t),this},"push");function fr(e,t){const n=typeof e=="string"?{"":e}:{...e};for(const s in t){const o=t[s];o?.$description||o?.$desc?n[s]=o.$description||o.$desc:typeof o=="string"&&(n[s]=o)}return n}r(fr,"mergeDesc");function tt(e){return e?.$value??e?.$inner}r(tt,"getInner");function hn(e){return pr(e??{},t=>!t.startsWith("$"))}r(hn,"extractKeys"),v.prototype.i18n=r(function(t){const n=v(this),s=fr(n.meta.description,t);return Object.keys(s).length&&(n.meta.description=s),n.dict&&(n.dict=Ie(n.dict,(o,a)=>o.i18n(Ie(t,l=>tt(l)?.[a]??l?.[a])))),n.list&&(n.list=n.list.map((o,a)=>o.i18n(Ie(t,(l={})=>Array.isArray(tt(l))?tt(l)[a]:Array.isArray(l)?l[a]:hn(l))))),n.inner&&(n.inner=n.inner.i18n(Ie(t,o=>tt(o)?tt(o):hn(o)))),n.sKey&&(n.sKey=n.sKey.i18n(Ie(t,o=>o?.$key))),n},"i18n"),v.prototype.extra=r(function(t,n){const s=v(this);return s.meta={...s.meta,[t]:n},s},"extra");for(const e of["required","disabled","collapse","hidden","loose"])Object.assign(v.prototype,{[e](t=!0){const n=v(this);return n.meta={...n.meta,[e]:t},n}});v.prototype.deprecated=r(function(){const t=v(this);return t.meta.badges||=[],t.meta.badges.push({text:"deprecated",type:"danger"}),t},"deprecated"),v.prototype.experimental=r(function(){const t=v(this);return t.meta.badges||=[],t.meta.badges.push({text:"experimental",type:"warning"}),t},"experimental"),v.prototype.pattern=r(function(t){const n=v(this),s=hr(t,["source","flags"]);return n.meta={...n.meta,pattern:s},n},"pattern"),v.prototype.simplify=r(function(t){if(et(t,this.meta.default,this.type==="dict"))return null;if(oe(t))return t;if(this.type==="object"||this.type==="dict"){const n={};for(const s in t){const o=(this.type==="object"?this.dict[s]:this.inner)?.simplify(t[s]);(this.type==="dict"||!oe(o))&&(n[s]=o)}return et(n,this.meta.default,this.type==="dict")?null:n}else if(this.type==="array"||this.type==="tuple"){const n=[];return t.forEach((s,o)=>{const a=this.type==="array"?this.inner:this.list[o],l=a?a.simplify(s):s;n.push(l)}),n}else if(this.type==="intersect"){const n={};for(const s of this.list)Object.assign(n,s.simplify(t));return n}else if(this.type==="union")for(const n of this.list)try{return v.resolve(t,n,{}),n.simplify(t)}catch{}return t},"simplify"),v.prototype.toString=r(function(t){return fn[this.type]?.(this,t)??`Schema<${this.type}>`},"toString"),v.prototype.role=r(function(e,t){const n=v(this);return n.meta={...n.meta,role:e,extra:t},n},"role");for(const e of["default","link","comment","description","max","min","step"])Object.assign(v.prototype,{[e](t){const n=v(this);return n.meta={...n.meta,[e]:t},n}});const mn={};v.extend=r(function(t,n){mn[t]=n},"extend"),v.resolve=r(function(t,n,s={},o=!1){if(!n)return[t];if(s.ignore?.(t,n))return[t];if(oe(t)&&n.type!=="lazy"){if(n.meta.required)throw new R("missing required value",s);let l=n,c=n.meta.default;for(;l?.type==="intersect"&&oe(c);)l=l.list[0],c=l?.meta.default;if(oe(c))return[t];t=St(c)}const a=mn[n.type];if(!a)throw new R(`unsupported type "${n.type}"`,s);try{return a(t,n,s,o)}catch(l){if(!n.meta.loose)throw l;return[n.meta.default]}},"resolve"),v.from=r(function(t){if(oe(t))return v.any();if(["string","number","boolean"].includes(typeof t))return v.const(t).required();if(t[ht])return t;if(typeof t=="function")switch(t){case String:return v.string().required();case Number:return v.number().required();case Boolean:return v.boolean().required();case Function:return v.function().required();default:return v.is(t).required()}else throw new TypeError(`cannot infer schema from ${t}`)},"from"),v.lazy=r(function(t){const n=r(()=>(s.inner[ht]||(s.inner=s.builder(),s.inner.meta={...s.meta,...s.inner.meta}),s.inner.toJSON()),"toJSON"),s=new v({type:"lazy",builder:t,inner:{toJSON:n}});return s},"lazy"),v.natural=r(function(){return v.number().step(1).min(0)},"natural"),v.percent=r(function(){return v.number().step(.01).min(0).max(1).role("slider")},"percent"),v.date=r(function(){return v.union([v.is(Date),v.transform(v.string().role("datetime"),(t,n)=>{const s=new Date(t);if(isNaN(+s))throw new R(`invalid date "${t}"`,n);return s},!0)])},"date"),v.regExp=r(function(t=""){return v.union([v.is(RegExp),v.transform(v.string().role("regexp",{flag:t}),(n,s)=>{try{return new RegExp(n,t)}catch(o){throw new R(o.message,s)}},!0)])},"regExp"),v.arrayBuffer=r(function(t){return v.union([v.is(ArrayBuffer),v.is(SharedArrayBuffer),v.transform(v.any(),(n,s)=>{if(xe.isSource(n))return xe.fromSource(n);throw new R(`expected ArrayBufferSource but got ${n}`,s)},!0),...t?[v.transform(v.string(),(n,s)=>{try{return t==="base64"?xe.fromBase64(n):xe.fromHex(n)}catch(o){throw new R(o.message,s)}},!0)]:[]])},"arrayBuffer"),v.extend("lazy",(e,t,n,s)=>(t.inner[ht]||(t.inner=t.builder(),t.inner.meta={...t.meta,...t.inner.meta}),v.resolve(e,t.inner,n,s))),v.extend("any",e=>[e]),v.extend("never",(e,t,n)=>{throw new R(`expected nullable but got ${e}`,n)}),v.extend("const",(e,{value:t},n)=>{if(et(e,t))return[t];throw new R(`expected ${t} but got ${e}`,n)});function Ct(e,t,n,s,o=!1){const{max:a=1/0,min:l=-1/0}=t;if(e>a)throw new R(`expected ${n} <= ${a} but got ${e}`,s);if(e<l&&!o)throw new R(`expected ${n} >= ${l} but got ${e}`,s)}r(Ct,"checkWithinRange"),v.extend("string",(e,{meta:t},n)=>{if(typeof e!="string")throw new R(`expected string but got ${e}`,n);if(t.pattern){const s=new RegExp(t.pattern.source,t.pattern.flags);if(!s.test(e))throw new R(`expect string to match regexp ${s}`,n)}return Ct(e.length,t,"string length",n),[e]});function Wt(e,t){const n=e.toString();if(n.includes("e"))return e*Math.pow(10,t);const s=n.indexOf(".");if(s===-1)return e*Math.pow(10,t);const o=n.slice(s+1),a=n.slice(0,s);return o.length<=t?+(a+o.padEnd(t,"0")):+(a+o.slice(0,t)+"."+o.slice(t))}r(Wt,"decimalShift");function gr(e,t,n){if(n=Math.abs(n),!/^\d+\.\d+$/.test(n.toString()))return(e-t)%n===0;const s=n.toString().indexOf("."),o=n.toString().slice(s+1).length;return Math.abs(Wt(e,o)-Wt(t,o))%Wt(n,o)===0}r(gr,"isMultipleOf"),v.extend("number",(e,{meta:t},n)=>{if(typeof e!="number")throw new R(`expected number but got ${e}`,n);Ct(e,t,"number",n);const{step:s}=t;if(s&&!gr(e,t.min??0,s))throw new R(`expected number multiple of ${s} but got ${e}`,n);return[e]}),v.extend("boolean",(e,t,n)=>{if(typeof e=="boolean")return[e];throw new R(`expected boolean but got ${e}`,n)}),v.extend("bitset",(e,{bits:t,meta:n},s)=>{let o=0,a=[];if(typeof e=="number"){o=e;for(const l in t)e&t[l]&&a.push(l)}else if(Array.isArray(e)){a=e;for(const l of a){if(typeof l!="string")throw new R(`expected string but got ${l}`,s);l in t&&(o|=t[l])}}else throw new R(`expected number or array but got ${e}`,s);return o===n.default?[o]:[o,a]}),v.extend("function",(e,t,n)=>{if(typeof e=="function")return[e];throw new R(`expected function but got ${e}`,n)}),v.extend("is",(e,{constructor:t},n)=>{if(typeof t=="function"){if(e instanceof t)return[e];throw new R(`expected ${t.name} but got ${e}`,n)}else{if(oe(e))throw new R(`expected ${t} but got ${e}`,n);let s=Object.getPrototypeOf(e);for(;s;){if(s.constructor?.name===t)return[e];s=Object.getPrototypeOf(s)}throw new R(`expected ${t} but got ${e}`,n)}});function mt(e,t,n,s){try{const[o,a]=v.resolve(e[t],n,{...s,path:[...s.path||[],t]});return a!==void 0&&(e[t]=a),o}catch(o){if(!s?.autofix)throw o;return delete e[t],n.meta.default}}r(mt,"property"),v.extend("array",(e,{inner:t,meta:n},s)=>{if(!Array.isArray(e))throw new R(`expected array but got ${e}`,s);return Ct(e.length,n,"array length",s,!oe(t.meta.default)),[e.map((o,a)=>mt(e,a,t,s))]}),v.extend("dict",(e,{inner:t,sKey:n},s,o)=>{if(!jt(e))throw new R(`expected object but got ${e}`,s);const a={};for(const l in e){let c;try{c=v.resolve(l,n,s)[0]}catch(d){if(o)continue;throw d}a[c]=mt(e,l,t,s),e[c]=e[l],l!==c&&delete e[l]}return[a]}),v.extend("tuple",(e,{list:t},n,s)=>{if(!Array.isArray(e))throw new R(`expected array but got ${e}`,n);const o=t.map((a,l)=>mt(e,l,a,n));return s?[o]:(o.push(...e.slice(t.length)),[o])});function Tt(e,t){for(const n in t)n in e||(e[n]=t[n])}r(Tt,"merge"),v.extend("object",(e,{dict:t},n,s)=>{if(!jt(e))throw new R(`expected object but got ${e}`,n);const o={};for(const a in t){const l=mt(e,a,t[a],n);(!oe(l)||a in e)&&(o[a]=l)}return s||Tt(o,e),[o]}),v.extend("union",(e,{list:t,toString:n},s,o)=>{const a=[];for(const l of t)try{return v.resolve(e,l,s,o)}catch(c){a.push(c)}throw new R(`expected ${n()} but got ${JSON.stringify(e)}`,s)}),v.extend("intersect",(e,{list:t,toString:n},s,o)=>{if(!t.length)return[e];let a;for(const l of t){const c=v.resolve(e,l,s,!0)[0];if(!oe(c))if(oe(a))a=c;else{if(typeof a!=typeof c)throw new R(`expected ${n()} but got ${JSON.stringify(e)}`,s);if(typeof c=="object")Tt(a??={},c);else if(a!==c)throw new R(`expected ${n()} but got ${JSON.stringify(e)}`,s)}}return!o&&jt(e)&&Tt(a,e),[a]}),v.extend("transform",(e,{inner:t,callback:n,preserve:s},o)=>{const[a,l=e]=v.resolve(e,t,o,!0);return s?[n(a)]:[n(a),n(l)]});const fn={};function K(e,t,n){fn[e]=n,Object.assign(v,{[e](...s){const o=new v({type:e});return t.forEach((a,l)=>{switch(a){case"sKey":o.sKey=s[l]??v.string();break;case"inner":o.inner=v.from(s[l]);break;case"list":o.list=s[l].map(v.from);break;case"dict":o.dict=Ie(s[l],v.from);break;case"bits":o.bits={};for(const c in s[l])typeof s[l][c]=="number"&&(o.bits[c]=s[l][c]);break;case"callback":{const c=o.callback=s[l];c.toJSON||=()=>c.toString();break}case"constructor":{const c=o.constructor=s[l];typeof c=="function"&&(c.toJSON||=()=>c.name);break}default:o[a]=s[l]}}),e==="object"||e==="dict"?o.meta.default={}:e==="array"||e==="tuple"?o.meta.default=[]:e==="bitset"&&(o.meta.default=0),o}})}r(K,"defineMethod"),K("is",["constructor"],({constructor:e})=>typeof e=="function"?e.name:e),K("any",[],()=>"any"),K("never",[],()=>"never"),K("const",["value"],({value:e})=>typeof e=="string"?JSON.stringify(e):e),K("string",[],()=>"string"),K("number",[],()=>"number"),K("boolean",[],()=>"boolean"),K("bitset",["bits"],()=>"bitset"),K("function",[],()=>"function"),K("array",["inner"],({inner:e})=>`${e.toString(!0)}[]`),K("dict",["inner","sKey"],({inner:e,sKey:t})=>`{ [key: ${t.toString()}]: ${e.toString()} }`),K("tuple",["list"],({list:e})=>`[${e.map(t=>t.toString()).join(", ")}]`),K("object",["dict"],({dict:e})=>Object.keys(e).length===0?"{}":`{ ${Object.entries(e).map(([t,n])=>`${t}${n.meta.required?"":"?"}: ${n.toString()}`).join(", ")} }`),K("union",["list"],({list:e},t)=>{const n=e.map(({toString:s})=>s()).join(" | ");return t?`(${n})`:n}),K("intersect",["list"],({list:e})=>`${e.map(t=>t.toString(!0)).join(" & ")}`),K("transform",["inner","callback","preserve"],({inner:e},t)=>e.toString(t));const vr="ui-conversation",gn="busyEnter",xr=["queue","steer"],vn="queue";v.object({[gn]:v.union([...xr]).default(vn)});var yr=class{static{r(this,"ComposerSubmissionPolicy")}busyEnter=(0,O.createSnapshotStore)(vn);host;constructor(e){this.host=e,e!==void 0&&(e.subscribe(()=>{this.adopt(e)}),this.adopt(e))}resolve(e,t,n){if(!e||!n)return"queue";const s=this.busyEnter.getSnapshot();return t==="enter"?s:s==="queue"?"steer":"queue"}setBusyEnter(e){this.busyEnter.getSnapshot()!==e&&(this.busyEnter.set(e),this.host?.set(gn,e))}adopt(e){const t=e.getSnapshot().value;t===void 0||this.busyEnter.getSnapshot()===t.busyEnter||this.busyEnter.set(t.busyEnter)}};function xn(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=xn(e[t]))&&(s&&(s+=" "),s+=n)}else for(n in e)e[n]&&(s&&(s+=" "),s+=n);return s}r(xn,"r");function Ce(){for(var e,t,n=0,s="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=xn(e))&&(s&&(s+=" "),s+=t);return s}r(Ce,"clsx");const yn=/(^|\s)([/@])([\w-]+)/g;function br(e,t){if(t.size===0||e==="")return[];const n=[];yn.lastIndex=0;let s;for(;(s=yn.exec(e))!==null;){const o=s[2],a=s[3]??"";if(t.get(o)?.includes(a)){const l=s.index+(s[1]?.length??0);n.push({start:l,end:l+1+a.length,trigger:o})}}return n}r(br,"scanTextRefs");const wr=new Map;function kr(e,t=wr){const{draft:n,claim:s,phase:o,occurrences:a}=e,l=(o==="claimed"||o==="submitting")&&s!==void 0&&n.startsWith(s.token),c=l?{start:0,end:s.token.length}:null,d=a.map(f=>({occurrenceId:f.occurrenceId,offset:f.offset,label:f.label,invalid:f.invalid===!0})),u=l&&s.hint!==void 0&&n.slice(s.token.length).trim()===""?s.hint:null;return{token:c,chips:d,textRefs:br(n,t),hint:u}}r(kr,"deriveDecorations");function nt(e){const t=e/1048576;return`${Number.isInteger(t)?String(t):t.toFixed(1)}MB`}r(nt,"imageSizeText");function _r(e,t,n){switch(t){case"MODEL_DOES_NOT_SUPPORT_IMAGES":return e("image.modelUnsupported");case"SUBAGENT_IMAGE_UNSUPPORTED":return e("image.subagentUnsupported");case"IMAGE_TOO_MANY_PIXELS":return e("image.tooManyPixels");case"INVALID_IMAGE":case"IMAGE_TYPE_MISMATCH":return e("image.unsupportedType");case"TOO_MANY_IMAGES":if(n!==void 0)return e("image.tooMany",{count:n.maxImagesPerMessage});break;case"IMAGE_TOO_LARGE":if(n!==void 0)return e("image.fileTooLarge",{size:nt(n.maxImageBytes)});break;case"IMAGES_TOO_LARGE":if(n!==void 0)return e("image.totalTooLarge",{size:nt(n.maxMessageImageBytes)})}return e("image.sendFailed",{reason:t})}r(_r,"attachmentErrorText");function bn(e){return{dialog:e("image.preview"),close:e("image.closePreview")}}r(bn,"lightboxLabels");function wn(e){return{image:e("image.label"),open:e("image.openOriginal"),openNamed:r(t=>e("image.openOriginalLabel",{label:t}),"openNamed"),loading:e("image.loading"),loadFailed:e("image.loadFailed"),lightbox:bn(e)}}r(wn,"messageImageLabels");function Ar(e,t,n){return t?{title:e("image.dropTitle"),desc:n===void 0?void 0:e("image.dropDesc",{count:n.count,size:n.size})}:{title:e("image.dropBlocked")}}r(Ar,"dropOverlayLabels");function jr(e){return{group:e("image.pending"),open:e("image.openOriginal"),scrollLeft:e("image.scrollLeft"),scrollRight:e("image.scrollRight")}}r(jr,"attachmentRailLabels");function kn(e){return String(e).padStart(2,"0")}r(kn,"pad2");function _n(e){const t=new Date(e);return t.setHours(0,0,0,0),t.getTime()}r(_n,"startOfLocalDay");function An(e){const t=new Date(e);return t.setHours(24,0,0,0),Math.max(t.getTime()-e,1)}r(An,"msUntilNextLocalMidnight");function jn(e,t){const n=Math.max(0,Math.floor(e/1e3)),s=Math.floor(n/60),o=n%60;return s>0?t("duration.minutes",{minutes:s,seconds:String(o).padStart(2,"0")}):t("duration.seconds",{seconds:o})}r(jn,"formatRunDuration");function Sr(e){const t=Math.max(0,e)/1e3;return t<10?String(Math.round(t*10)/10):String(Math.round(t))}r(Sr,"formatLatencySeconds");function Sn(e){const t=Math.max(0,e);return t>=10?String(Math.round(t)):String(Math.round(t*10)/10)}r(Sn,"formatTokensPerSecond");function Cr(e,t,n=Date.now()){const s=new Date(e),o=new Date(n),a=`${kn(s.getHours())}:${kn(s.getMinutes())}`;if(s.getFullYear()===o.getFullYear()&&s.getMonth()===o.getMonth()&&s.getDate()===o.getDate())return a;const l={y:s.getFullYear(),m:s.getMonth()+1,d:s.getDate()};return`${s.getFullYear()===o.getFullYear()?t("clock.md",l):t("clock.ymd",l)} ${a}`}r(Cr,"formatMessageClock");function Wr(e){if(typeof e!="object"||e===null)return null;const t=e.outputTokens;return typeof t=="number"&&Number.isFinite(t)&&t>=0?t:null}r(Wr,"usageOutputTokens");function Cn(e){const t=e.timing;return{ttftMs:t!==void 0&&t.stepStartTime!==null&&t.firstTokenTime!==null?Math.max(0,t.firstTokenTime-t.stepStartTime):null,decodeMs:t!==void 0&&t.firstTokenTime!==null?Math.max(0,t.completedTime-t.firstTokenTime):null,outputTokens:Wr(e.usage)}}r(Cn,"assistantStepReading");function Tr(e){const t=new Map;for(const s of e){if(s.kind!=="assistant")continue;const o=Cn(s);let a=t.get(s.turn);a===void 0?(a={firstStep:s.step,firstStepTtftMs:o.ttftMs,decodeMs:0,outputTokens:0,sampled:!1},t.set(s.turn,a)):s.step<a.firstStep&&(a.firstStep=s.step,a.firstStepTtftMs=o.ttftMs),o.decodeMs!==null&&o.outputTokens!==null&&(a.decodeMs+=o.decodeMs,a.outputTokens+=o.outputTokens,a.sampled=!0)}const n=new Map;for(const[s,o]of t){const a={};o.firstStepTtftMs!==null&&(a.ttftMs=o.firstStepTtftMs),o.sampled&&o.decodeMs>0&&(a.tokensPerSecond=o.outputTokens/(o.decodeMs/1e3)),(a.ttftMs!==void 0||a.tokensPerSecond!==void 0)&&n.set(s,a)}return n}r(Tr,"deriveTurnMetrics");const Er=".Ltr6eW_root{text-align:center;max-width:var(--dsh-chat-content-width);box-sizing:border-box;width:100%;padding:4px calc(var(--dsh-composer-side-clearance) + 16px) 0px;color:var(--dsw-alias-label-tertiary);white-space:nowrap;text-overflow:ellipsis;margin:0 auto;font-size:12px;line-height:20px;display:block;overflow:hidden}.Ltr6eW_sep{color:var(--dsw-alias-separator-primary);margin:0 10px}",Wn="@deepseek-ai/dsh-client-ui-conversation/StatsLine.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Wn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Wn,e.textContent=Er,document.head.appendChild(e)}var Tn={sep:"Ltr6eW_sep",root:"Ltr6eW_root"};function Nr(e){const t=new Set;let n=0,s=0,o=0,a=0,l=0,c=0,d=0;for(const u of e){if(u.kind==="tool-result"){u.callTime!==null&&(o+=Math.max(0,u.time-u.callTime));continue}if(u.kind!=="assistant")continue;t.add(u.turn),n+=1,u.timing!==void 0&&u.timing.stepStartTime!==null&&(s+=Math.max(0,u.timing.completedTime-u.timing.stepStartTime));const f=Cn(u);f.ttftMs!==null&&(a+=f.ttftMs,l+=1),f.decodeMs!==null&&f.outputTokens!==null&&(c+=f.decodeMs,d+=f.outputTokens)}return{turns:t.size,steps:n,llmMs:s,toolMs:o,ttftMs:a,ttftSteps:l,decodeMs:c,decodeTokens:d}}r(Nr,"deriveStats");function st(e){const t=r(n=>n>=100?String(Math.round(n)):String(Math.round(n*10)/10),"scaled");return e<1e3?String(e):e<1e6?`${t(e/1e3)}K`:`${t(e/1e6)}M`}r(st,"formatTokens");function Et(e){const t=e/1e3;if(t<60)return`${Math.round(t*10)/10}s`;const n=Math.round(t);return`${Math.floor(n/60)}m${n%60}s`}r(Et,"formatDuration");function qr(e){const t=Nt(e);return t===0?null:Math.round(e.cacheReadTokens/t*100)}r(qr,"cacheHitPercent");function Nt(e){return e.uncachedInputTokens+e.cacheReadTokens+e.cacheWriteTokens}r(Nt,"billedInputTokens");function Ir(e){const t=e?.projectedTokens??e?.pressureTokens;return t===void 0||e?.contextWindow===void 0?null:{percent:Math.min(100,Math.round(t/e.contextWindow*100)),usedTokens:t,contextWindow:e.contextWindow}}r(Ir,"contextOccupancy");const Lr=(0,h.memo)(r(function({useSession:t,useProjection:n,t:s}){const o=t(g=>g.chat.legacy.nodes),a=n("tokenUsage"),l=n("sessionStats"),c=(0,h.useMemo)(()=>l??Nr(o),[l,o]),d=[];if(c.steps>0){d.push(s("stats.counts",{turns:c.turns,steps:c.steps}));const g=[];c.llmMs>0&&g.push(s("stats.llm",{duration:Et(c.llmMs)})),c.toolMs>0&&g.push(s("stats.toolCall",{duration:Et(c.toolMs)})),g.length>0&&d.push(g.join(" · "));const x=[];c.ttftSteps>0&&x.push(s("stats.ttftAverage",{duration:Et(c.ttftMs/c.ttftSteps)})),c.decodeMs>0&&x.push(s("stats.tokensPerSecond",{throughput:Sn(c.decodeTokens/(c.decodeMs/1e3))})),x.length>0&&d.push(x.join(" · "))}if(a!==void 0&&(Nt(a)>0||a.outputTokens>0)){const g=qr(a);g!==null&&d.push(s("stats.cacheHit",{percent:g})),d.push(s("stats.tokens",{input:st(Nt(a)),output:st(a.outputTokens)}))}const u=d.join(" | "),f=(0,h.useRef)(null),[m,k]=(0,h.useState)(!1);return(0,h.useLayoutEffect)(()=>{const g=f.current;if(g===null)return;const x=r(()=>{k(g.scrollWidth>g.clientWidth)},"measure");if(x(),typeof ResizeObserver>"u")return;const b=new ResizeObserver(x);return b.observe(g),()=>{b.disconnect()}},[u]),d.length===0?null:(0,i.jsx)(_.Tooltip,{label:u,side:"top",delayMs:500,disabled:!m,children:(0,i.jsx)("div",{ref:f,className:Tn.root,children:d.map((g,x)=>(0,i.jsxs)(h.Fragment,{children:[x>0&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:Tn.sep,"aria-hidden":!0,children:"|"})," "]}),(0,i.jsx)("span",{children:g})]},g))})})},"StatsLine")),Mr=".MUHbCq_root{display:inline-flex;position:relative}.MUHbCq_trigger{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;display:grid}.MUHbCq_trigger:hover{background:var(--dsw-alias-interactive-bg-hover)}.MUHbCq_track{fill:none;stroke:var(--dsw-alias-border-l3);stroke-width:2px}.MUHbCq_fill{fill:none;stroke:var(--dsw-alias-label-tertiary);stroke-width:2px;stroke-linecap:round}.MUHbCq_panel{z-index:100;box-sizing:border-box;border:1px solid var(--dsw-alias-border-inverted);background:var(--dsw-specific-menu);width:264px;box-shadow:var(--dsw-shadow-lv3);color:var(--dsw-alias-label-secondary);cursor:default;border-radius:12px;padding:12px;font-size:12px;line-height:20px;position:absolute;bottom:calc(100% + 8px);right:0}.MUHbCq_header{align-items:center;gap:6px;display:flex}.MUHbCq_figures{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin-left:auto;font-weight:500}.MUHbCq_percent{color:var(--dsw-alias-label-primary);font-weight:500}.MUHbCq_headline{color:var(--dsw-alias-label-tertiary)}.MUHbCq_headline:empty{display:none}.MUHbCq_bar{background:var(--dsw-alias-interactive-bg-hover);border-radius:999px;gap:1px;height:4px;margin:10px 0 12px;display:flex;overflow:hidden}.MUHbCq_segment{background:var(--meter-tint,var(--dsw-alias-label-tertiary));border-radius:1px;flex:none;min-width:2px;height:100%}.MUHbCq_swatch{background:var(--meter-tint);vertical-align:baseline;border-radius:2px;width:8px;height:8px;margin-right:6px;display:inline-block}.MUHbCq_colorSystem{--meter-tint:var(--dsw-static-neutral-bluish-400)}.MUHbCq_colorTools{--meter-tint:#a78bfa}.MUHbCq_colorMessages{--meter-tint:var(--dsw-static-blue-450)}.MUHbCq_rows{margin:6px 0 0}.MUHbCq_row{justify-content:space-between;align-items:center;gap:12px;padding:2px 0;display:flex}.MUHbCq_row dt{color:var(--dsw-alias-label-secondary)}.MUHbCq_row dd{font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-primary);margin:0}",En="@deepseek-ai/dsh-client-ui-conversation/ContextMeter.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(En)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=En,e.textContent=Mr,document.head.appendChild(e)}var H={segment:"MUHbCq_segment",panel:"MUHbCq_panel",swatch:"MUHbCq_swatch",colorSystem:"MUHbCq_colorSystem",headline:"MUHbCq_headline",percent:"MUHbCq_percent",colorMessages:"MUHbCq_colorMessages",colorTools:"MUHbCq_colorTools",track:"MUHbCq_track",header:"MUHbCq_header",figures:"MUHbCq_figures",row:"MUHbCq_row",fill:"MUHbCq_fill",rows:"MUHbCq_rows",bar:"MUHbCq_bar",trigger:"MUHbCq_trigger",root:"MUHbCq_root"};const qt=5.5,Nn=2*Math.PI*qt,qn="\0",In=[{key:"systemTokens",label:"context.system",color:H.colorSystem},{key:"toolsTokens",label:"context.tools",color:H.colorTools},{key:"messageTokens",label:"context.messages",color:H.colorMessages}];function Rr({useProjection:e,t}){const n=e("contextPressure"),s=e("contextBreakdown"),[o,a]=(0,h.useState)(!1),l=(0,h.useRef)(null),c=Ir(n),d=c!==null;if((0,h.useEffect)(()=>{!d&&o&&a(!1)},[d,o]),(0,h.useEffect)(()=>{if(!o||!d)return;const b=r(C=>{C.target instanceof Node&&l.current?.contains(C.target)===!0||a(!1)},"onPointerDown"),w=r(C=>{C.key==="Escape"&&a(!1)},"onKeyDown");return document.addEventListener("pointerdown",b),document.addEventListener("keydown",w),()=>{document.removeEventListener("pointerdown",b),document.removeEventListener("keydown",w)}},[d,o]),c===null)return null;const u=c.percent,f=`${u}%`,[m="",k=""]=t("context.aria",{percent:qn}).split(qn).map(b=>b.trim()),g=s===void 0?0:s.systemTokens+s.toolsTokens+s.messageTokens,x=(s===void 0||g===0?[{key:"total",color:void 0,width:u}]:In.map(b=>({key:b.key,color:b.color,width:u*s[b.key]/g}))).filter(b=>b.width>0);return(0,i.jsxs)("span",{ref:l,className:H.root,children:[(0,i.jsx)(_.Tooltip,{label:t("context.aria",{percent:f}),side:"top",delayMs:200,disabled:o,children:(0,i.jsx)("button",{type:"button",className:H.trigger,"aria-label":t("context.aria",{percent:f}),"aria-haspopup":"dialog","aria-expanded":o,onClick:r(()=>{a(!o)},"onClick"),children:(0,i.jsxs)("svg",{viewBox:"0 0 14 14",width:"14",height:"14","aria-hidden":!0,children:[(0,i.jsx)("circle",{className:H.track,cx:"7",cy:"7",r:qt}),(0,i.jsx)("circle",{className:H.fill,cx:"7",cy:"7",r:qt,strokeDasharray:`${Nn*u/100} ${Nn}`,transform:"rotate(-90 7 7)"})]})})}),o&&(0,i.jsxs)("div",{className:H.panel,role:"dialog","aria-label":t("context.used"),children:[(0,i.jsxs)("div",{className:H.header,children:[(0,i.jsx)("span",{className:H.headline,children:m}),(0,i.jsx)("span",{className:H.percent,children:f}),(0,i.jsx)("span",{className:H.headline,children:k}),(0,i.jsx)("span",{className:H.figures,children:`~${st(c.usedTokens)} / ${st(c.contextWindow)}`})]}),(0,i.jsx)("div",{className:H.bar,children:x.map(b=>(0,i.jsx)("div",{className:b.color===void 0?H.segment:`${H.segment} ${b.color}`,style:{width:`${b.width}%`}},b.key))}),s!==void 0&&(0,i.jsx)("dl",{className:H.rows,children:In.map(b=>(0,i.jsxs)("div",{className:H.row,children:[(0,i.jsxs)("dt",{children:[(0,i.jsx)("span",{className:`${H.swatch} ${b.color}`,"aria-hidden":!0}),t(b.label)]}),(0,i.jsx)("dd",{children:`~${st(s[b.key])}`})]},b.key))})]})]})}r(Rr,"ContextMeter");const Dr=".F-gcEW_trigger{min-width:0;max-width:220px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:24px;outline:none;align-items:center;gap:4px;padding:0 4px 0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.F-gcEW_trigger:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.F-gcEW_trigger:focus-visible{box-shadow:0 0 0 2px var(--dsw-alias-border-l3)}.F-gcEW_trigger:disabled{color:var(--dsw-alias-label-dimmed);cursor:default}.F-gcEW_triggerIcon{flex:none;display:inline-flex}.F-gcEW_triggerIcon svg{width:14px;height:14px}.F-gcEW_triggerLabel{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}.F-gcEW_chevron{color:var(--dsw-alias-label-caption);flex:none;transition:transform .12s;display:inline-flex}@container (width<=460px){.F-gcEW_trigger:has(.F-gcEW_triggerIcon) .F-gcEW_triggerLabel{display:none}}.F-gcEW_chevronOpen{transform:rotate(180deg)}",Ln="@deepseek-ai/dsh-client-ui-conversation/PermissionSelect.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Ln)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Ln,e.textContent=Dr,document.head.appendChild(e)}var rt={chevronOpen:"F-gcEW_chevronOpen",triggerLabel:"F-gcEW_triggerLabel",chevron:"F-gcEW_chevron",triggerIcon:"F-gcEW_triggerIcon",trigger:"F-gcEW_trigger"};const It="danger-full-access",Mn="M8.20554 0.899994L14.7901 3.36857V7.01026C14.7901 12 11.0466 14.2103 8.20554 15.3C5.36446 14.2103 1.62012 12 1.62012 7.01026V3.36857L8.20554 0.899994Z",Ur={"read-only":(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:[(0,i.jsx)("path",{d:Mn,stroke:"currentColor",strokeWidth:"1.31831",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M12.1654 5.7552L8.9447 9.41475C8.73044 9.65816 8.53628 9.8804 8.35774 10.0423C8.1713 10.2114 7.94235 10.3717 7.64016 10.4254C7.48207 10.4535 7.32 10.4552 7.16151 10.4294C6.85843 10.3801 6.62728 10.2223 6.43836 10.0559C6.25752 9.89653 6.06037 9.67732 5.84264 9.43705L4.72925 8.20897L5.63557 7.38707L6.74897 8.61594C6.98603 8.87755 7.12974 9.03533 7.24673 9.13839C7.31033 9.19443 7.34485 9.21476 7.35823 9.22122C7.38068 9.22484 7.40352 9.22515 7.42593 9.22122C7.40522 9.22502 7.42893 9.23294 7.53583 9.136C7.65132 9.03126 7.79316 8.87139 8.02643 8.60638L11.2479 4.94763L12.1654 5.7552Z",fill:"currentColor"})]}),"workspace-write":(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:[(0,i.jsx)("path",{d:"M8.08887 0.251709C8.20479 0.23085 8.32486 0.241168 8.43652 0.282959L15.0215 2.75171C15.2787 2.84819 15.4492 3.09414 15.4492 3.3689V7.0105C15.4492 7.10986 15.4441 7.2081 15.4414 7.30542C15.0285 7.07175 14.5905 6.87695 14.1309 6.73022V3.82495L8.20508 1.60327L2.2793 3.82495V7.0105C2.27936 9.7171 3.4745 11.5379 5.02734 12.7947C5.01025 12.9942 5 13.1962 5 13.4001C5.00001 13.7617 5.02722 14.1169 5.08008 14.4636C2.91555 13.0393 0.961014 10.752 0.960938 7.0105V3.3689C0.960938 3.09417 1.13146 2.84821 1.38867 2.75171L7.97461 0.282959L8.08887 0.251709Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M11.3525 5.64688V6.85688H5V5.64688H11.3525Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M9.5824 8.29376V9.50376H5V8.29376H9.5824Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M14.6647 15.6852H10.0338C10.3878 15.3751 10.7567 15.0517 11.0772 14.7706C11.2531 14.6164 11.4144 14.4746 11.5511 14.3547H14.6647V15.6852Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M8.14852 14.1308L7.33925 15.4976C7.22458 15.6912 7.42245 15.9194 7.63037 15.8333L9.09785 15.2254L15.0399 10.0719L14.0905 8.97733L8.14852 14.1308Z",fill:"currentColor"})]}),[It]:(0,i.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":!0,children:[(0,i.jsx)("path",{d:Mn,stroke:"currentColor",strokeWidth:"1.31831",strokeLinejoin:"round"}),(0,i.jsx)("path",{d:"M9.10094 4.5V8.75939H7.59888V4.5H9.10094Z",fill:"currentColor"}),(0,i.jsx)("path",{d:"M9.10094 9.8114V11.5H7.59888V9.8114H9.10094Z",fill:"currentColor"})]})};function Lt(e){return Ur[e]}r(Lt,"permissionGlyph");function Mt(e){return/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e)?e.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" "):e}r(Mt,"displayName");function Rt(e){return e.value===It?"Full access":Mt(e.name)}r(Rt,"optionLabel");function Or({value:e,locked:t,command:n,t:s}){const[o,a]=(0,h.useState)(null),[l,c]=(0,h.useState)(!1),[d,u]=(0,h.useState)(null),[f,m]=(0,h.useState)(!1);if((0,h.useEffect)(()=>{!t&&e!==void 0||(c(!1),m(!1),u(null))},[t,e]),e===void 0)return null;const k=o??e.currentValue,g=e.options.find(j=>j.value===k),x=o!==null||d!==null,b=e.options.filter(j=>j.value!=="custom").map(j=>{const z=Lt(j.value);return{id:j.value,label:Rt(j),...z===void 0?{}:{icon:z}}}),w=r(j=>{a(j),n(`/permission ${j}`).catch(()=>!1).then(()=>{a(null)})},"submit"),C=r(j=>{if(c(!1),j!==e.currentValue){if(j===It){m(!1),u(j);return}w(j)}},"choose"),y=r(()=>{m(!1),u(null)},"closeConfirmation"),A=r(()=>{if(t||!f||d===null)return;const j=d;y(),w(j)},"confirmFullAccess");return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_.Menu,{open:l,items:b,selectedId:k,onSelect:C,onClose:r(()=>{c(!1)},"onClose"),side:"top",anchor:(0,i.jsxs)("button",{type:"button",className:rt.trigger,"aria-label":s("input.accessMode",{name:g===void 0?Mt(k):Rt(g)}),title:g?.description,disabled:t||x,onClick:r(()=>{c(!l)},"onClick"),children:[Lt(k)!==void 0&&(0,i.jsx)("span",{className:rt.triggerIcon,"aria-hidden":!0,children:Lt(k)}),(0,i.jsx)("span",{className:rt.triggerLabel,children:g===void 0?Mt(k):Rt(g)}),(0,i.jsx)("span",{className:Ce(rt.chevron,l&&rt.chevronOpen),"aria-hidden":!0,children:(0,i.jsx)(_.IconChevronDownOutline14,{})})]})}),(0,i.jsx)(_.RiskConfirmation,{open:d!==null,title:s("access.confirm.title"),description:s("access.confirm.description"),acknowledgeLabel:s("access.confirm.acknowledge"),cancelLabel:s("access.confirm.cancel"),confirmLabel:s("access.confirm.enable"),acknowledged:f,disabled:t,onAcknowledgedChange:m,onCancel:y,onConfirm:A})]})}r(Or,"PermissionSelect");const Br=/\b(?:CriOS|FxiOS|EdgiOS|OPiOS|OPT|DuckDuckGo|Brave)(?:\/|\b)/;function Fr(e){return e.vendor==="Apple Computer, Inc."&&/\bVersion\/[\d.]+.*\bSafari\/[\d.]+/.test(e.userAgent)&&!Br.test(e.userAgent)}r(Fr,"isSafariBrowser");function Vr(e){if(e===null||e.scrollHeight<=e.clientHeight)return;const t=e.closest("[data-input-scroll]");if(t===null)return;const n=e.style.height;e.style.height=`${String(e.clientHeight+1)}px`,e.offsetHeight,e.style.height=n,e.offsetHeight;const s=t.style.height;t.style.height=`${String(t.clientHeight+1)}px`,t.offsetHeight,t.style.height=s,t.offsetHeight}r(Vr,"repairSafariTextareaLayout");const $r=`@font-face{font-family:DshChipCell;src:url(data:font/ttf;base64,AAEAAAAKAIAAAwAgT1MvMkT8SmIAAAEoAAAAYGNtYXAADQBPAAABkAAAADRnbHlmAAAAAAAAAcwAAAABaGVhZCwtPGoAAACsAAAANmhoZWEDIg7bAAAA5AAAACRobXR4EZQAAAAAAYgAAAAIbG9jYQAAAAAAAAHEAAAABm1heHAAAwACAAABCAAAACBuYW1lvljk2gAAAdAAAABscG9zdNNweNQAAAI8AAAALQABAAAAAQAAdia1tV8PPPUAAwPoAAAAAOaLfcUAAAAA5ot9xQAAAAAAAAAAAAAAAwACAAAAAAAAAAEAAAMg/zgAAA+gAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAACAAEAAAACAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAwjKAZAABQAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAAAAAPz8/PwAA//z//AMg/zgAAAMgAMgAAAAAAAAAAAAAAAAAAAAgAAAB9AAAD6AAAAAAAAIAAAADAAAAFAADAAEAAAAUAAQAIAAAAAQABAABAAD//P//AAD//P//AAUAAQAAAAAAAAAAAAAAAAAAAAAAAAAEADYAAQAAAAAAAQALAAAAAQAAAAAAAgAHAAsAAwABBAkAAQAWABIAAwABBAkAAgAOAChEc2hDaGlwQ2VsbFJlZ3VsYXIARABzAGgAQwBoAGkAcABDAGUAbABsAFIAZQBnAHUAbABhAHIAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAABAgZvYmpyZXAAAAA=)format("truetype")}.-UWAWa_root{padding:0 var(--dsh-composer-side-clearance);flex-direction:column;align-items:center;display:flex}.-UWAWa_hero{padding:0 var(--dsh-composer-side-clearance)}.-UWAWa_notice{width:100%;max-width:var(--dsh-composer-card-max-width);background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary);border-radius:8px;margin-bottom:6px;padding:4px 8px;font-size:12px;line-height:18px}.-UWAWa_noticeError{background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary)}.-UWAWa_card{box-sizing:border-box;width:100%;max-width:var(--dsh-composer-card-max-width);border:1px solid var(--dsw-alias-border-l2-darkmode-thin);background:var(--dsw-specific-input-major);box-shadow:var(--dsw-shadow-lv2);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:22px;flex-direction:column;gap:12px;padding-top:10px;font-size:16px;line-height:24px;display:flex;position:relative}.-UWAWa_cardWorkspaceTrigger{cursor:pointer;border-color:#0000}.-UWAWa_cardWorkspaceTrigger:after{content:"";background:var(--dsw-alias-border-l4);pointer-events:none;border-radius:22px;transition:background-color .1s;position:absolute;inset:-1px;-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='none' rx='22' ry='22' stroke='black' stroke-width='2' stroke-dasharray='4 4'/%3E%3C/svg%3E");mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='100%25' height='100%25' fill='none' rx='22' ry='22' stroke='black' stroke-width='2' stroke-dasharray='4 4'/%3E%3C/svg%3E")}.-UWAWa_cardWorkspaceTrigger :disabled{pointer-events:none}.-UWAWa_cardWorkspaceTrigger:hover:after{background:var(--dsw-alias-state-business-primary)}.-UWAWa_accessory{align-items:center;gap:8px;padding:10px 12px 0;display:flex}.-UWAWa_attachments{min-width:0;padding:4px 12px 0}.-UWAWa_overlayAnchor{height:0;position:absolute;inset:0 0 auto}.-UWAWa_scroll{max-height:var(--dsh-composer-text-max-height);overflow-y:auto}.-UWAWa_grow{position:relative}.-UWAWa_backdrop{color:var(--dsw-alias-label-primary);pointer-events:none;position:absolute;inset:0;overflow:hidden}.-UWAWa_hlToken{color:var(--dsw-alias-state-warn-label);background-color:#0000}.-UWAWa_hlSegment{color:#0000;background-color:#0000;border-radius:4px}.-UWAWa_hint{color:var(--dsw-alias-label-caption)}.-UWAWa_pending{background:var(--dsw-alias-state-business-primary);border-radius:50%;width:8px;height:8px;animation:1s ease-in-out infinite alternate -UWAWa_input-pending}@keyframes -UWAWa_input-pending{0%{opacity:.35}to{opacity:1}}.-UWAWa_input{resize:none;color:#0000;width:100%;height:100%;caret-color:var(--dsw-alias-state-business-primary);background:0 0;border:none;outline:none;position:absolute;inset:0;overflow:hidden}.-UWAWa_input,.-UWAWa_mirror,.-UWAWa_backdrop{box-sizing:border-box;font-family:"DshChipCell", var(--dsw-font-family);font-size:inherit;line-height:inherit;white-space:pre-wrap;word-break:break-word;overflow-wrap:anywhere;padding:4px 12px 0 16px}.-UWAWa_input::placeholder{color:var(--dsw-alias-label-caption);user-select:none}.-UWAWa_input:disabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}.-UWAWa_input[aria-haspopup=menu]{cursor:pointer}.-UWAWa_mirror{visibility:hidden;pointer-events:none}.-UWAWa_hero .-UWAWa_mirror{min-height:52px}.-UWAWa_row{justify-content:space-between;align-items:center;gap:12px;min-width:0;padding:2px 8px 6px;display:flex;container-type:inline-size}.-UWAWa_tools,.-UWAWa_modes,.-UWAWa_trailing{align-items:center;min-width:0;display:flex}.-UWAWa_tools{gap:16px}.-UWAWa_modes{gap:12px}.-UWAWa_trailing{flex:none;gap:12px}.-UWAWa_add{background:var(--dsw-specific-selector);width:28px;height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;display:grid}.-UWAWa_add:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-solid)}.-UWAWa_add:disabled{opacity:.5;cursor:default}.-UWAWa_select{max-width:220px;height:28px;color:var(--dsw-alias-label-secondary);white-space:nowrap;cursor:pointer;appearance:none;background-color:#0000;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%2381858C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-position:right 4px center;background-repeat:no-repeat;background-size:12px 12px;border:none;border-radius:8px;outline:none;padding:0 20px 0 8px;font-size:13px;font-weight:500;line-height:20px}.-UWAWa_select:hover:not(:disabled){background-color:var(--dsw-alias-interactive-bg-hover)}.-UWAWa_select:disabled{opacity:.5;cursor:default}.-UWAWa_primary{background:var(--dsw-alias-button-info-fill);color:#fff;cursor:pointer;border:none;border-radius:999px;flex:none;place-items:center;width:34px;height:34px;transition:background-color .1s;display:grid;transform:translateY(-2px)}.-UWAWa_primary:hover:not(:disabled){background:var(--dsw-alias-button-info-hover)}.-UWAWa_primary:disabled{opacity:.4;cursor:default}.-UWAWa_retry{color:inherit;cursor:pointer;background:0 0;border:1px solid;border-radius:4px;margin-left:8px;padding:1px 8px;font-size:12px}.-UWAWa_textRef{color:var(--dsw-alias-state-business-primary);-webkit-box-decoration-break:clone;box-decoration-break:clone;background-color:#0000}.-UWAWa_textRef:after{display:none}.-UWAWa_chip{background:#6187d838;border-radius:6px;position:relative}.-UWAWa_chip:before{content:"";color:#0000}.-UWAWa_chipLabel{width:calc(138.889% - 10px);color:var(--dsw-alias-label-primary);white-space:nowrap;justify-content:center;align-items:center;display:flex;position:absolute;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)scale(.72)}.-UWAWa_chipInvalid{opacity:.7;background:#d8616133;text-decoration:line-through}`,Rn="@deepseek-ai/dsh-client-ui-conversation/InputBar.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Rn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Rn,e.textContent=$r,document.head.appendChild(e)}var B={select:"-UWAWa_select",pending:"-UWAWa_pending",modes:"-UWAWa_modes",accessory:"-UWAWa_accessory",scroll:"-UWAWa_scroll",card:"-UWAWa_card",grow:"-UWAWa_grow",trailing:"-UWAWa_trailing",hlSegment:"-UWAWa_hlSegment",chipLabel:"-UWAWa_chipLabel",notice:"-UWAWa_notice",hlToken:"-UWAWa_hlToken",hero:"-UWAWa_hero",primary:"-UWAWa_primary",chip:"-UWAWa_chip",input:"-UWAWa_input",retry:"-UWAWa_retry",noticeError:"-UWAWa_noticeError",overlayAnchor:"-UWAWa_overlayAnchor",attachments:"-UWAWa_attachments",backdrop:"-UWAWa_backdrop",textRef:"-UWAWa_textRef",row:"-UWAWa_row",hint:"-UWAWa_hint",chipInvalid:"-UWAWa_chipInvalid","input-pending":"-UWAWa_input-pending",mirror:"-UWAWa_mirror",root:"-UWAWa_root",cardWorkspaceTrigger:"-UWAWa_cardWorkspaceTrigger",add:"-UWAWa_add",tools:"-UWAWa_tools"};const zr={token:null,chips:[],textRefs:[],hint:null};function Pr({useSession:e,useInput:t,inputActions:n,keyboard:s,addImages:o,removeImage:a,draftImages:l,resolveSubmitMode:c,toggleCommandMenu:d,stop:u,command:f,t:m,renderSlot:k,useNotices:g,useLexicon:x,useMenuLauncher:b,useProjection:w,sessionId:C,variant:y,disabled:A=!1,blocked:j,workspacePickerOpen:z=!1,onRequestWorkspace:ne,placeholder:Ee,accessory:he,overlay:He,leftItems:X,rightItems:Re,footer:be}){const U=t(p=>p),Y=g(p=>p),me=x(p=>p),se=b(p=>p==="command"),ee=e(p=>p.promptError)??null,Ne=e(p=>p.running)??!1,pe=e(p=>p.subagent)??null,fe=e(p=>p.removed)??!1,De=w("plan",p=>p!==void 0&&(p.pending?!p.active:p.active)),Qe=w("goal",p=>p!=null),E=U!==void 0&&s!==void 0&&n!==void 0,D=U?.draft??"",de=(0,h.useMemo)(()=>U===void 0||l===void 0?[]:l(U.imageIds),[l,U?.imageIds]),we=D.trim()===""&&de.length===0,[ge,Ue]=(0,h.useState)(null),[bt,Je]=(0,h.useState)(!1),[lt,S]=(0,h.useState)(null),q=(0,h.useRef)(0),Z=(0,h.useCallback)(p=>{q.current+=1,S({seq:q.current,text:p})},[]),ke=(0,h.useCallback)(()=>{S(null)},[]),P=w("imageLimits");(0,h.useEffect)(()=>{ee!==null&&Z(ee.error.code==="attachment-error"?_r(m,ee.error.details.reason,P):`${ee.error.message} (${ee.error.code})`)},[ee,Z,m,P]);const G=(0,h.useRef)(null),Oe=(0,h.useRef)(null),_e=(0,h.useRef)(0),Ke=(0,h.useRef)(null),$s=(0,h.useRef)(null),Jt=(0,h.useMemo)(()=>Fr(navigator),[]),Kt=(0,h.useRef)(!1),Yt=(0,h.useRef)(!1),rl=r(()=>{Yt.current=!0},"onCompositionStart"),ol=r(()=>{setTimeout(()=>{Yt.current=!1},10)},"onCompositionEnd"),il=w("permissions"),zs=pe?.address.mode==="continuable",Ps=zs&&!pe.parentAvailable,wt=fe||A||!E||j!==void 0||Ps,re=wt,al=fe||A||!E,Ae=U?.phase==="adjudicating"||U?.phase==="submitting",qe=A&&!fe&&ne!==void 0,ll=fe||re&&!qe,Zs=!re&&!Ae&&!se&&we&&Ne&&pe===null&&U.queue.some(p=>p.placement==="queued");(0,h.useEffect)(()=>{U===void 0||n===void 0||de.length!==U.imageIds.length&&n.pruneImages(de.map(p=>p.id))},[de,U?.imageIds,n]),(0,h.useLayoutEffect)(()=>{const p=Kt.current;Kt.current=!1,Jt&&p&&Vr(G.current)},[D,Jt]),(0,h.useEffect)(()=>{ge!==null&&!de.some(p=>p.id===ge.id)&&Ue(null)},[de,ge]);const Gs=r(p=>{const T=Ke.current,M=$s.current,W=M?.firstChild;if(T===null||M===null||!(W instanceof Text)||T.scrollHeight<=T.clientHeight)return;const L=Math.min(p,W.data.length),J=L>0&&W.data[L-1]===`
2
+ `,N=document.createRange();N.setStart(W,J?L-1:L),J?N.setEnd(W,L):N.collapse(!0);const je=J?Number.parseFloat(getComputedStyle(M).lineHeight):0,ve=N.getBoundingClientRect(),_t=T.getBoundingClientRect();ve.bottom+je>_t.bottom?T.scrollTop+=ve.bottom+je-_t.bottom:ve.top+je<_t.top&&(T.scrollTop-=_t.top-ve.top-je)},"revealCaret"),Hs=r(p=>{const T=p.selectionDirection==="backward"?p.selectionStart:p.selectionEnd;Gs(T??p.value.length)},"revealSelectionFocus");(0,h.useEffect)(()=>{const p=G.current;re||p===null||(p.focus({preventScroll:!0}),Hs(p))},[re,C]),(0,h.useEffect)(()=>{const p=G.current;re||D===""||p===null||Hs(p)},[D!==""]);const Qs=r((p,T)=>{requestAnimationFrame(()=>{p.setSelectionRange(T,T),Gs(T)})},"restoreCaret");(0,h.useEffect)(()=>{const p=Ke.current;if(p===null)return;const T=r(M=>{const W=p.closest("[data-conversation-scroll]");if(!(W instanceof HTMLElement)||M.deltaY===0)return;const L=p.scrollTop<=0,J=p.scrollTop+p.clientHeight>=p.scrollHeight-1;M.deltaY<0&&!L||M.deltaY>0&&!J||(M.preventDefault(),W.scrollTop+=M.deltaY)},"onWheel");return p.addEventListener("wheel",T,{passive:!1}),()=>{p.removeEventListener("wheel",T)}},[]);const cl=r(p=>{if(qe){(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),ne());return}if(s===void 0||n===void 0||p.key==="Enter"&&p.shiftKey)return;const T=Yt.current||p.nativeEvent.isComposing||p.nativeEvent.keyCode===229;if(p.key==="ArrowUp"||p.key==="ArrowDown"){s.arbitrate(p.key==="ArrowUp"?"up":"down",T)==="consumed"&&p.preventDefault();return}if(p.key==="Escape"){s.dismissPopup(),s.arbitrate("escape",T)==="consumed"&&p.preventDefault();return}if((p.metaKey||p.ctrlKey)&&(p.key==="z"||p.key==="Z"||p.key==="y")){if(p.preventDefault(),Ae||re)return;p.key==="y"||p.shiftKey?s.redo():s.undo();return}if(p.key===" "){if(T)return;s.space()&&p.preventDefault();return}if(p.key!=="Enter"||T)return;if(s.arbitrate("enter",T)!=="pass"){p.preventDefault();return}if(p.preventDefault(),p.repeat||re||Ae)return;const M=p.ctrlKey||p.metaKey;if(M&&Zs){s.steerQueue();return}s.submit(c(Ne,M?"accelerated":"enter",pe===null))},"onKeyDown"),dl=r(p=>{if(s===void 0||re||Ae)return;const T=p.target.value;Kt.current=Jt&&T.length<D.length,s.setDraft(T),s.track(T,p.target.selectionStart??T.length)},"onChange"),Xt=r(p=>({start:p.selectionStart??0,end:p.selectionEnd??p.selectionStart??0}),"selectionOf"),Js=r((p,T)=>{if(U===void 0||s===void 0)return;const M=p.currentTarget,{start:W,end:L}=Xt(M);if(W===L)return;D.slice(W,L);const J=U.occurrences.filter(ve=>ve.offset>=W&&ve.offset<L);if(J.length===0&&!T)return;p.preventDefault();let N="",je=W;for(const ve of J)N+=D.slice(je,ve.offset)+ve.clipboardText,je=ve.offset+1;N+=D.slice(je,L),p.clipboardData.setData("text/plain",N),T&&!Ae&&!re&&(s.setDraft(D.slice(0,W)+D.slice(L),{start:W,end:L,insertedLength:0}),Qs(M,W))},"onCopyOrCut"),ul=r(p=>{if(s===void 0||Ae||re)return;const T=Array.from(p.clipboardData.items).filter(N=>N.kind==="file").map(N=>N.getAsFile()).filter(N=>N!==null);T.length>0&&en(T);const M=p.clipboardData.getData("text/plain");if(M===""){T.length>0&&p.preventDefault();return}p.preventDefault();const W=p.currentTarget,L=Xt(W);s.pasteBegin(M,L);const J=L.start+M.length;Qs(W,J),s.track(s.snapshot.draft,J)},"onPaste"),en=(0,h.useCallback)(p=>{if(o===void 0||p.length===0)return;const T=(()=>{if(P!==void 0){if(p.some(M=>!P.mediaTypes.includes(M.type)))return o(p);if(de.length+p.length>P.maxImagesPerMessage)return m("image.tooMany",{count:P.maxImagesPerMessage});if(p.some(M=>M.size>P.maxImageBytes))return m("image.fileTooLarge",{size:nt(P.maxImageBytes)});if(de.reduce((M,W)=>M+W.file.size,0)+p.reduce((M,W)=>M+W.size,0)>P.maxMessageImageBytes)return m("image.totalTooLarge",{size:nt(P.maxMessageImageBytes)})}return o(p)})();T!==null&&Z(T)},[o,de,P,Z,m]),ct=!re&&!Ae&&o!==void 0;(0,h.useEffect)(()=>{const p=r(N=>N.dataTransfer?.types.includes("Files")??!1,"hasFiles"),T=r(()=>{_e.current=0,Je(!1)},"reset"),M=r(N=>{p(N)&&(N.preventDefault(),_e.current+=1,Je(!0))},"onDragEnter"),W=r(N=>{!p(N)||N.dataTransfer===null||(N.preventDefault(),N.dataTransfer.dropEffect=ct?"copy":"none")},"onDragOver"),L=r(N=>{if(!p(N))return;_e.current=Math.max(0,_e.current-1),_e.current===0&&Je(!1);const je=N.clientX<=0||N.clientY<=0||N.clientX>=window.innerWidth||N.clientY>=window.innerHeight;(N.target===document.documentElement||N.target===document.body)&&je&&T()},"onDragLeave"),J=r(N=>{p(N)&&(N.preventDefault(),T(),ct&&en([...N.dataTransfer?.files??[]]))},"onDrop");return document.addEventListener("dragenter",M),document.addEventListener("dragover",W),document.addEventListener("dragleave",L),document.addEventListener("drop",J),window.addEventListener("dragend",T),()=>{document.removeEventListener("dragenter",M),document.removeEventListener("dragover",W),document.removeEventListener("dragleave",L),document.removeEventListener("drop",J),window.removeEventListener("dragend",T)}},[ct,en]);const pl=(0,h.useCallback)(()=>{Ue(null)},[]),Ks=(0,h.useMemo)(()=>de.map(p=>({id:p.id,previewUrl:p.previewUrl,alt:p.file.name||m("image.pending"),removeLabel:m("image.remove",{name:p.file.name}),attachment:p})),[de,m]),hl=r(p=>{s!==void 0&&s.snapshot.paste!==void 0&&s.invalidatePaste()},"onSelect"),tn=r(p=>{p.preventDefault(),G.current?.focus({preventScroll:!0})},"keepFocus"),ml=r(()=>{const p=G.current;p!==null&&d?.(Xt(p))},"onToggleCommandMenu"),kt=Ne&&pe===null,fl=Ne&&zs,Ys=m(kt?"input.stop":"input.send"),gl=r(()=>{if(kt){u?.();return}n!==void 0&&!we&&!wt&&!Ae&&n.submit()},"onPrimary"),vl=f===void 0?null:(0,i.jsx)(Or,{value:il,locked:re,command:f,t:m},C),Be=U===void 0?zr:kr(U,me),Ye=[];{let p=0;const T=r(W=>{W>p&&Ye.push(D.slice(p,W)),p=W},"pushPlain");Be.token!==null&&(Ye.push((0,i.jsx)("mark",{className:B.hlToken,"data-decoration":"token",children:D.slice(Be.token.start,Be.token.end)},"token")),p=Be.token.end);const M=[...Be.chips.map(W=>({at:W.offset,kind:"chip",chip:W})),...Be.textRefs.map(W=>({at:W.start,kind:"text-ref",ref:W}))].sort((W,L)=>W.at-L.at);for(const W of M)if(!(W.at<p))if(T(W.at),W.kind==="chip"){const L=W.chip;Ye.push((0,i.jsx)("span",{className:Ce(B.chip,L.invalid&&B.chipInvalid),"data-decoration":"chip","data-occurrence":L.occurrenceId,"data-invalid":L.invalid||void 0,title:L.label,children:(0,i.jsx)("span",{className:B.chipLabel,children:L.label})},`chip-${L.occurrenceId}`)),p=L.offset+1}else Ye.push((0,i.jsx)("mark",{className:B.textRef,"data-decoration":"text-ref",children:D.slice(W.ref.start,W.ref.end)},`ref-${W.ref.start}`)),p=W.ref.end;if(T(D.length),Be.hint!==null){const W=U?.claim?.token.slice(1).trim()??"",L=`hint.${W==="goal"&&Qe?"goal.active":W}`,J=m(L),N=J!==L?J:Be.hint;Ye.push((0,i.jsx)("span",{className:B.hint,"data-decoration":"hint",children:N},"hint"))}}return(0,i.jsxs)("div",{className:Ce(B.root,y==="hero"&&B.hero),children:[bt&&(0,i.jsx)(Xe.DropOverlay,{disabled:!ct,labels:Ar(m,ct,P===void 0?void 0:{count:P.maxImagesPerMessage,size:nt(P.maxImageBytes)})}),lt!==null&&(0,i.jsx)(_.Toast,{text:lt.text,icon:(0,i.jsx)(_.IconWarningOutline16,{}),anchor:Oe.current,onDone:ke},lt.seq),Y!==null&&(0,i.jsx)("div",{className:Ce(B.notice,Y.level==="error"&&B.noticeError),role:"status",children:Y.text}),(0,i.jsxs)("div",{ref:Oe,className:Ce(B.card,qe&&B.cardWorkspaceTrigger),"data-composer-card":!0,onClick:qe?ne:void 0,onPointerDown:qe?p=>{p.stopPropagation()}:void 0,children:[He!==void 0&&(0,i.jsx)("div",{className:B.overlayAnchor,children:He}),he!==void 0&&(0,i.jsx)("div",{className:B.accessory,children:he}),Ks.length>0&&(0,i.jsx)("div",{className:B.attachments,children:(0,i.jsx)(Xe.AttachmentRail,{items:Ks,labels:jr(m),onOpen:r(p=>{Ue(p.attachment)},"onOpen"),onRemove:r(p=>{a?.(p.attachment.id)},"onRemove")})}),(0,i.jsx)("div",{ref:Ke,className:B.scroll,"data-input-scroll":!0,children:(0,i.jsxs)("div",{className:B.grow,children:[(0,i.jsx)("div",{"aria-hidden":!0,className:B.backdrop,"data-input-backdrop":!0,children:Ye}),(0,i.jsx)("textarea",{ref:G,className:B.input,value:D,disabled:ll,readOnly:Ae||qe,"aria-label":qe?m("hero.chooseWorkspace"):void 0,"aria-haspopup":qe?"menu":void 0,"aria-expanded":qe?z:void 0,"data-phase":U?.phase??"inert",placeholder:Ee??m(Ps?"placeholder.parentOffline":wt?"placeholder.unavailable":Zs?"placeholder.steerQueue":De?"placeholder.plan":"placeholder.default"),rows:2,onChange:dl,onKeyDown:cl,onSelect:hl,onCopy:r(p=>{Js(p,!1)},"onCopy"),onCut:r(p=>{Js(p,!0)},"onCut"),onPaste:ul,onCompositionStart:rl,onCompositionEnd:ol}),(0,i.jsx)("div",{ref:$s,"aria-hidden":!0,className:B.mirror,"data-input-mirror":!0,children:`${D}
3
+ `})]})}),(0,i.jsxs)("div",{className:B.row,children:[(0,i.jsxs)("div",{className:B.tools,children:[(0,i.jsx)(_.Tooltip,{label:m("input.commands"),side:"top",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:B.add,"aria-label":m("input.commands"),"aria-haspopup":"listbox","aria-expanded":se,disabled:re||d===void 0,onMouseDown:tn,onClick:ml,children:(0,i.jsx)(_.IconPlusOutline16,{size:14})})}),(0,i.jsxs)("div",{className:B.modes,children:[vl,k("conversation.input.plan",{locked:re})]}),X]}),(0,i.jsxs)("div",{className:B.trailing,children:[Re,k("conversation.input.model",{locked:al}),(0,i.jsx)(Rr,{useProjection:w,t:m}),fl&&(0,i.jsx)(_.Tooltip,{label:m("input.stop"),side:"top",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:B.primary,"aria-label":m("input.stop"),disabled:u===void 0,onMouseDown:tn,onClick:u,children:(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":!0,children:(0,i.jsx)("rect",{x:"3",y:"3",width:"10",height:"10",rx:"3",fill:"currentColor"})})})}),(0,i.jsx)(_.Tooltip,{label:Ys,side:"top",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:B.primary,"aria-label":Ys,disabled:kt?u===void 0:we||wt||Ae,onMouseDown:tn,onClick:gl,children:kt?(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":!0,children:(0,i.jsx)("rect",{x:"3",y:"3",width:"10",height:"10",rx:"3",fill:"currentColor"})}):(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"16",height:"16","aria-hidden":!0,children:(0,i.jsx)("path",{d:"M8.3125 0.980183C8.66767 1.0531 8.97902 1.20418 9.2627 1.43233C9.48724 1.61297 9.73029 1.85793 9.97949 2.10714L14.707 6.83468L13.293 8.24874L9 3.95577V15.0417H7V3.95577L2.70703 8.24874L1.29297 6.83468L6.02051 2.10714C6.26971 1.85793 6.51277 1.61297 6.7373 1.43233C6.97662 1.23986 7.28445 1.04402 7.6875 0.980183C7.8973 0.947006 8.1031 0.95516 8.3125 0.980183Z",fill:"currentColor"})})})})]})]})]}),ge!==null&&(0,i.jsx)(Xe.ImageLightbox,{src:ge.previewUrl,alt:ge.file.name||m("image.original"),labels:bn(m),onClose:pl}),be]})}r(Pr,"InputBar");const Zr=".YxYVtq_row{border-bottom:1px solid var(--dsw-alias-border-l2);align-items:center;gap:8px;padding:16px 0;display:flex}.YxYVtq_rowText{flex-direction:column;flex:1;gap:4px;min-width:0;padding-right:48px;display:flex}.YxYVtq_title{color:var(--dsw-alias-label-primary);font-size:14px;font-weight:400;line-height:22px}.YxYVtq_desc{color:var(--dsw-alias-label-tertiary);font-size:12px;font-weight:400;line-height:18px}.YxYVtq_selector{background:var(--dsw-alias-bg-module-platform);height:36px;font:inherit;color:var(--dsw-alias-label-primary);cursor:pointer;border:none;border-radius:18px;align-items:center;gap:12px;padding:0 14px;font-size:14px;line-height:22px;display:inline-flex}.YxYVtq_selector:hover{background:var(--dsw-alias-interactive-bg-hover)}.YxYVtq_chevron{flex:none}",Dn="@deepseek-ai/dsh-client-ui-conversation/EnterBehaviorRow.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Dn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Dn,e.textContent=Zr,document.head.appendChild(e)}var ze={title:"YxYVtq_title",selector:"YxYVtq_selector",desc:"YxYVtq_desc",chevron:"YxYVtq_chevron",rowText:"YxYVtq_rowText",row:"YxYVtq_row"};const Gr=[{id:"queue",label:"settings.enter.queue"},{id:"steer",label:"settings.enter.steer"}];function Hr({useBusyEnter:e,setBusyEnter:t,t:n}){const s=e(c=>c),[o,a]=(0,h.useState)(!1),l=s==="queue"?"settings.enter.queue":"settings.enter.steer";return(0,i.jsxs)("div",{className:ze.row,children:[(0,i.jsxs)("div",{className:ze.rowText,children:[(0,i.jsx)("div",{className:ze.title,children:n("settings.enter.title")}),(0,i.jsx)("div",{className:ze.desc,children:n("settings.enter.description")})]}),(0,i.jsx)(_.Menu,{open:o,onClose:r(()=>{a(!1)},"onClose"),items:Gr.map(c=>({id:c.id,label:n(c.label)})),selectedId:s,onSelect:r(c=>{a(!1),t(c)},"onSelect"),align:"end",portal:!0,anchor:(0,i.jsxs)("button",{type:"button",className:ze.selector,"aria-haspopup":"menu","aria-expanded":o,onClick:r(()=>{a(c=>!c)},"onClick"),children:[n(l),(0,i.jsx)(_.IconChevronDownOutline14,{className:ze.chevron})]})})]})}r(Hr,"EnterBehaviorRow");const Qr='.poLjgW_userRow{flex-direction:column;align-items:flex-end;gap:6px;display:flex}.poLjgW_userStack{flex-direction:column;align-items:flex-end;gap:8px;min-width:0;max-width:min(525px,82%);display:flex}.poLjgW_bubble{background:var(--dsw-specific-bubble);max-width:100%;color:var(--dsw-alias-label-primary);border-radius:22px;padding:10px 16px;font-size:16px;line-height:24px}.poLjgW_contextRow,.poLjgW_compactionRow{padding:2px 0}.poLjgW_compactionButton{width:100%;min-width:0;height:24px;color:inherit;font:inherit;text-align:left;background:0 0;border:none;border-radius:6px;align-items:center;padding:0;display:flex}.poLjgW_compactionButton:not(:disabled){cursor:pointer}.poLjgW_compactionButton:not(:disabled):hover{background:var(--dsw-alias-interactive-bg-hover)}.poLjgW_compactionLeading{width:16px;height:16px;color:var(--dsw-alias-label-secondary);flex:none;place-items:center;margin-right:6px;display:inline-grid}.poLjgW_compactionContextIcon,.poLjgW_compactionDisclosureIcon{grid-area:1/1;justify-content:center;align-items:center;display:inline-flex}.poLjgW_compactionDisclosureIcon,.poLjgW_compactionButton:not(:disabled):hover .poLjgW_compactionContextIcon,.poLjgW_compactionButton:not(:disabled):focus-visible .poLjgW_compactionContextIcon{opacity:0}.poLjgW_compactionButton:not(:disabled):hover .poLjgW_compactionDisclosureIcon,.poLjgW_compactionButton:not(:disabled):focus-visible .poLjgW_compactionDisclosureIcon{opacity:1}.poLjgW_compactionTitle{color:var(--dsw-alias-label-primary-dimmed);flex:none;font-size:14px;line-height:24px}.poLjgW_compactionSep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.poLjgW_compactionSummary{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:14px;line-height:24px;overflow:hidden}.poLjgW_compactionBody{color:var(--dsw-alias-label-tertiary);padding:4px 0 4px 22px;font-size:14px;line-height:24px}.poLjgW_retryRow{color:var(--dsw-alias-label-tertiary);font-size:13px;line-height:20px}.poLjgW_retrySummary{width:fit-content;color:inherit;cursor:pointer;user-select:none;border-radius:3px;align-items:center;gap:7px;padding:2px 0;list-style:none;display:inline-flex}.poLjgW_retrySummary::-webkit-details-marker{display:none}.poLjgW_retrySummary:after{content:"";opacity:.8;border-bottom:1.5px solid;border-right:1.5px solid;width:6px;height:6px;transition:transform .12s;transform:rotate(-45deg)}.poLjgW_retrySummary:hover{color:var(--dsw-alias-label-secondary)}.poLjgW_retrySummary:focus-visible{outline:1.5px solid var(--dsw-alias-button-info-fill);outline-offset:2px}.poLjgW_retryText{color:inherit}.poLjgW_retryRow[data-active] .poLjgW_retryText{background:linear-gradient(90deg, var(--dsw-alias-label-tertiary) 0%, var(--dsw-alias-label-tertiary) 40%, var(--dsw-alias-label-secondary) 50%, var(--dsw-alias-label-tertiary) 60%, var(--dsw-alias-label-tertiary) 100%);color:#0000;background-position:100%;background-size:200% 100%;background-clip:text;animation:1.6s ease-in-out infinite poLjgW_retry-shimmer}.poLjgW_retryRow[open] .poLjgW_retrySummary:after{transform:rotate(45deg)}.poLjgW_retryDetails{overflow-wrap:anywhere;gap:2px;margin-top:3px;padding-left:14px;font-size:12px;line-height:18px;display:grid}.poLjgW_retryDetailLabel{color:var(--dsw-alias-label-secondary)}.poLjgW_turnErrorRow{grid-template-columns:10px minmax(0,1fr) auto;align-items:start;gap:8px;padding:2px 0;font-size:13px;line-height:20px;display:grid}.poLjgW_turnErrorDot{margin-top:5px}.poLjgW_turnErrorCopy{overflow-wrap:anywhere;min-width:0}.poLjgW_turnErrorTitle{color:var(--dsw-alias-state-error-primary);margin-right:6px;font-weight:600}.poLjgW_turnErrorMessage{color:var(--dsw-alias-label-secondary)}.poLjgW_turnErrorCode{color:var(--dsw-alias-label-tertiary);font:var(--dsw-font-markdown-code-block-small)}.poLjgW_maxTokensTitle{color:var(--dsw-alias-state-warn-primary);margin-right:6px;font-weight:600}@keyframes poLjgW_retry-shimmer{0%{background-position:100%}to{background-position:0}}@media (prefers-reduced-motion:reduce){.poLjgW_retryRow[data-active] .poLjgW_retryText{color:inherit;background:0 0;animation:none}}.poLjgW_refChip{color:var(--dsw-alias-label-primary);white-space:nowrap;vertical-align:baseline;background:#6187d838;border-radius:6px;margin:0 2px;padding:0 8px;font-size:.85em;line-height:1.6;display:inline-block}',Un="@deepseek-ai/dsh-client-ui-conversation/MessageItem.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Un)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Un,e.textContent=Qr,document.head.appendChild(e)}var I={bubble:"poLjgW_bubble",retryDetails:"poLjgW_retryDetails",turnErrorMessage:"poLjgW_turnErrorMessage",userRow:"poLjgW_userRow",contextRow:"poLjgW_contextRow",compactionDisclosureIcon:"poLjgW_compactionDisclosureIcon",compactionTitle:"poLjgW_compactionTitle",compactionSummary:"poLjgW_compactionSummary",compactionBody:"poLjgW_compactionBody",turnErrorRow:"poLjgW_turnErrorRow",turnErrorDot:"poLjgW_turnErrorDot",turnErrorCopy:"poLjgW_turnErrorCopy",compactionSep:"poLjgW_compactionSep",turnErrorCode:"poLjgW_turnErrorCode",maxTokensTitle:"poLjgW_maxTokensTitle","retry-shimmer":"poLjgW_retry-shimmer",turnErrorTitle:"poLjgW_turnErrorTitle",refChip:"poLjgW_refChip",compactionContextIcon:"poLjgW_compactionContextIcon",retryRow:"poLjgW_retryRow",retryText:"poLjgW_retryText",userStack:"poLjgW_userStack",compactionRow:"poLjgW_compactionRow",retryDetailLabel:"poLjgW_retryDetailLabel",retrySummary:"poLjgW_retrySummary",compactionLeading:"poLjgW_compactionLeading",compactionButton:"poLjgW_compactionButton"};const On=(0,h.memo)(r(function({node:t,title:n,fallbackSummary:s,t:o}){const[a,l]=(0,h.useState)(!1),c=t.summary!==null,d=c&&a,u=t.shadowedItemCount!==null&&t.shadowedTokenCount!==null?o("message.compaction.completed",{items:t.shadowedItemCount,tokens:t.shadowedTokenCount}):s??o(c?"message.compaction.expand":"message.compaction.unavailable");return(0,i.jsxs)("div",{className:I.compactionRow,children:[(0,i.jsxs)("button",{type:"button",className:I.compactionButton,disabled:!c,"aria-expanded":c?d:void 0,onClick:r(()=>{l(f=>!f)},"onClick"),children:[(0,i.jsxs)("span",{className:I.compactionLeading,"aria-hidden":!0,children:[(0,i.jsx)("span",{className:I.compactionContextIcon,"data-compaction-icon":"context",children:(0,i.jsx)(_.IconApiOutline14,{})}),(0,i.jsx)("span",{className:I.compactionDisclosureIcon,"data-compaction-disclosure":d?"expanded":"collapsed",children:d?(0,i.jsx)(_.IconChevronDownOutline14,{}):(0,i.jsx)(_.IconChevronRightOutline14,{})})]}),(0,i.jsx)("span",{className:I.compactionTitle,children:n??o("message.compaction")}),(0,i.jsx)("span",{className:I.compactionSep,"aria-hidden":!0}),(0,i.jsx)("span",{className:I.compactionSummary,children:u})]}),d&&t.summary!==null&&(0,i.jsx)("div",{className:I.compactionBody,children:(0,i.jsx)(_.MarkdownText,{text:t.summary})})]})},"CompactionItem")),Jr=".L849KG_text{color:var(--dsw-alias-label-secondary);font:inherit;white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.L849KG_fields{border-top:1px solid var(--dsw-alias-line-secondary);flex-direction:column;gap:2px;margin:8px 0 0;padding-top:8px;display:flex}.L849KG_field{gap:8px;min-width:0;display:flex}.L849KG_fieldKey{min-width:96px;color:var(--dsw-alias-label-caption);flex:none}.L849KG_fieldValue{min-width:0;color:var(--dsw-alias-label-tertiary);overflow-wrap:anywhere;flex:auto;margin:0}.L849KG_files{flex-wrap:wrap;gap:4px 12px;margin:0 0 8px;padding:0;list-style:none;display:flex}.L849KG_file{align-items:baseline;gap:6px;min-width:0;display:flex}.L849KG_filePath{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.L849KG_fileAction{color:var(--dsw-alias-label-caption)}.L849KG_catalogNotice{color:var(--dsw-alias-label-caption);margin:0 0 6px}.L849KG_entries{flex-direction:column;gap:4px;margin:0;padding:0;list-style:none;display:flex}.L849KG_entry{gap:8px;min-width:0;display:flex}.L849KG_entryName{color:var(--dsw-alias-label-secondary);flex:none}.L849KG_entryDescription{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;overflow:hidden}.L849KG_sections{flex-direction:column;gap:8px;margin:0;display:flex}.L849KG_section{flex-direction:column;gap:2px;min-width:0;display:flex}.L849KG_sectionName{color:var(--dsw-alias-label-caption)}.L849KG_sectionText{color:var(--dsw-alias-label-secondary);white-space:pre-wrap;overflow-wrap:anywhere;margin:0}.L849KG_relaySender{color:var(--dsw-alias-label-caption);overflow-wrap:anywhere;margin:0 0 6px}.L849KG_recalls{flex-direction:column;gap:2px;margin:0 0 8px;padding:0;list-style:none;display:flex}.L849KG_recall{gap:8px;min-width:0;display:flex}.L849KG_recallLabel{color:var(--dsw-alias-label-secondary);overflow-wrap:anywhere}.L849KG_recallCounts{color:var(--dsw-alias-label-caption);flex:none}",Bn="@deepseek-ai/dsh-client-ui-conversation/ContextBody.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Bn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Bn,e.textContent=Jr,document.head.appendChild(e)}var F={fileAction:"L849KG_fileAction",section:"L849KG_section",files:"L849KG_files",recall:"L849KG_recall",recallLabel:"L849KG_recallLabel",file:"L849KG_file",recallCounts:"L849KG_recallCounts",fieldValue:"L849KG_fieldValue",recalls:"L849KG_recalls",catalogNotice:"L849KG_catalogNotice",sectionName:"L849KG_sectionName",text:"L849KG_text",entry:"L849KG_entry",fieldKey:"L849KG_fieldKey",entryName:"L849KG_entryName",sectionText:"L849KG_sectionText",relaySender:"L849KG_relaySender",filePath:"L849KG_filePath",sections:"L849KG_sections",field:"L849KG_field",fields:"L849KG_fields",entries:"L849KG_entries",entryDescription:"L849KG_entryDescription"};const Fn=2e4,Kr=200;function ie(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null}r(ie,"asRecord");function Vn(e){const t=[];for(const n of e){if(n.type!=="text"){t.push({block:n});continue}const s=t[t.length-1];s!==void 0&&"text"in s?s.text+=n.text:t.push({text:n.text})}return t}r(Vn,"contentRuns");function Yr(e){return Vn(e).flatMap(t=>"block"in t?[t.block]:[])}r(Yr,"unknownBlocks");function Dt(e,t){return e.length>Fn?`${e.slice(0,Fn)}
4
+ ${t("json.truncated",{total:e.length})}`:e}r(Dt,"boundedText");function Xr(e,t){return Dt(typeof e=="string"?e:typeof e=="number"||typeof e=="boolean"?String(e):JSON.stringify(e),t)}r(Xr,"fieldValue");function eo({source:e,formRendered:t,t:n}){const s=ie(e);if(s===null)return null;const o=t?["kind","form"]:["kind"],a=Object.entries(s).filter(([l])=>!o.includes(l));return a.length===0?null:(0,i.jsx)("dl",{className:F.fields,"data-context-fields":!0,children:a.map(([l,c])=>(0,i.jsxs)("div",{className:F.field,children:[(0,i.jsx)("dt",{className:F.fieldKey,children:l}),(0,i.jsx)("dd",{className:F.fieldValue,children:Xr(c,n)})]},l))})}r(eo,"SourceFields");function to({blocks:e,t}){return(0,i.jsx)(i.Fragment,{children:e.map((n,s)=>(0,i.jsx)(_.JsonBlock,{label:t("message.unknownBlock"),payload:n,truncatedLabel:r(o=>t("json.truncated",{total:o}),"truncatedLabel")},s))})}r(to,"UnknownBlocks");function ot({content:e,t}){return(0,i.jsx)(i.Fragment,{children:Vn(e).map((n,s)=>"text"in n?n.text!==""&&(0,i.jsx)("pre",{className:F.text,"data-context-text":!0,children:Dt(n.text,t)},s):(0,i.jsx)(_.JsonBlock,{label:t("message.unknownBlock"),payload:n.block,truncatedLabel:r(o=>t("json.truncated",{total:o}),"truncatedLabel")},s))})}r(ot,"ModelFacingContent");function Pe({content:e,source:t,t:n}){return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(ot,{content:e,t:n}),(0,i.jsx)(eo,{source:t,formRendered:!1,t:n})]})}r(Pe,"OpaqueBody");function $n(e){const t=ie(e),n=t===null?void 0:t.changes;if(!Array.isArray(n))return null;const s=[],o=new Set;for(const a of n){const l=ie(a);if(l===null)return null;const c=l.path;if(typeof c!="string"||c==="")return null;const d=l.action;if(d!=="set"&&d!=="replace"&&d!=="remove")return null;const u=l.digest;o.has(c)||(o.add(c),s.push({action:d,path:c,...typeof u=="string"?{digest:u}:{}}))}return s.length===0?null:s}r($n,"instructionChanges");function no(e,t){return e==="remove"?"message.context.instructions.removed":t?"message.context.instructions.loaded":e==="set"?"message.context.instructions.added":"message.context.instructions.updated"}r(no,"instructionAction");function so({content:e,source:t,t:n}){const s=$n(t);if(s===null)return(0,i.jsx)(Pe,{content:e,source:t,t:n});const o=ie(t)?.baseline===!0;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("ul",{className:F.files,"data-context-files":!0,children:s.map(a=>(0,i.jsxs)("li",{className:F.file,title:a.digest,children:[(0,i.jsx)("span",{className:F.filePath,children:a.path}),(0,i.jsx)("span",{className:F.fileAction,children:n(no(a.action,o))})]},a.path))}),(0,i.jsx)(ot,{content:e,t:n})]})}r(so,"InstructionsBody");function zn(e){const t=ie(e),n=t===null?void 0:t.entries;if(!Array.isArray(n))return null;const s=[];for(const o of n){const a=ie(o);if(a===null)return null;const l=a.name,c=a.description;if(typeof l!="string"||l===""||typeof c!="string")return null;s.push({name:l,description:c})}return s}r(zn,"catalogEntries");function ro({content:e,source:t,t:n}){const s=zn(t);if(s===null)return(0,i.jsx)(Pe,{content:e,source:t,t:n});const o=ie(t)?.update===!0,a=s.slice(0,Kr),l=Yr(e);return(0,i.jsxs)(i.Fragment,{children:[o&&(0,i.jsx)("p",{className:F.catalogNotice,"data-context-catalog-update":!0,children:n("message.context.catalog.replaced")}),(0,i.jsx)("ul",{className:F.entries,"data-context-entries":!0,children:a.map((c,d)=>(0,i.jsxs)("li",{className:F.entry,children:[(0,i.jsx)("code",{className:F.entryName,children:c.name}),(0,i.jsx)("span",{className:F.entryDescription,children:c.description})]},d))}),a.length<s.length&&(0,i.jsx)("p",{className:F.catalogNotice,"data-context-entries-truncated":!0,children:n("message.context.catalog.more",{count:s.length-a.length})}),(0,i.jsx)(to,{blocks:l,t:n})]})}r(ro,"CatalogBody");function Pn(e){const t=ie(e),n=t===null?void 0:t.sections;if(!Array.isArray(n))return null;const s=[];for(const o of n){const a=ie(o);if(a===null)return null;const l=a.name,c=a.text;if(typeof l!="string"||l===""||typeof c!="string")return null;s.push({name:l,text:c})}return s.length===0?null:s}r(Pn,"snapshotSections");function oo({content:e,source:t,t:n}){const s=Pn(t);return s===null?(0,i.jsx)(Pe,{content:e,source:t,t:n}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{className:F.catalogNotice,"data-context-snapshot-supersedes":!0,children:n("message.context.snapshot.supersedes")}),(0,i.jsx)("dl",{className:F.sections,"data-context-sections":!0,children:s.map((o,a)=>(0,i.jsxs)("div",{className:F.section,children:[(0,i.jsx)("dt",{className:F.sectionName,children:o.name}),(0,i.jsx)("dd",{className:F.sectionText,children:Dt(o.text,n)})]},a))})]})}r(oo,"SnapshotBody");function io({content:e,t}){return(0,i.jsx)(ot,{content:e,t})}r(io,"NoticeBody");function ao({content:e,source:t,t:n}){const s=Zn(t);return s===null?(0,i.jsx)(Pe,{content:e,source:t,t:n}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{className:F.relaySender,"data-context-relay-sender":!0,children:n("message.context.relay.from",{session:s})}),(0,i.jsx)(ot,{content:e,t:n})]})}r(ao,"RelayBody");function Zn(e){const t=ie(e)?.senderSessionId;return typeof t=="string"&&t!==""?t:null}r(Zn,"relaySender");function Gn(e){const t=ie(e),n=t===null?void 0:t.references;if(!Array.isArray(n))return null;const s=[];for(const o of n){const a=ie(o);if(a===null)return null;const l=a.label,c=a.retainedMessages,d=a.omittedMessages,u=a.truncated;if(typeof l!="string"||l===""||typeof c!="number"||typeof d!="number"||typeof u!="boolean")return null;s.push({label:l,retained:c,omitted:d,truncated:u})}return s.length===0?null:s}r(Gn,"recalledSessions");function lo({content:e,source:t,t:n}){const s=Gn(t);return s===null?(0,i.jsx)(Pe,{content:e,source:t,t:n}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("ul",{className:F.recalls,"data-context-recalls":!0,children:s.map((o,a)=>(0,i.jsxs)("li",{className:F.recall,children:[(0,i.jsx)("span",{className:F.recallLabel,children:o.label}),(0,i.jsx)("span",{className:F.recallCounts,children:n("message.context.recall.counts",{retained:o.retained,omitted:o.omitted})}),o.truncated&&(0,i.jsx)("span",{className:F.recallCounts,children:n("message.context.recall.truncated")})]},a))}),(0,i.jsx)(ot,{content:e,t:n})]})}r(lo,"RecallBody");function co(e){const t=ie(e)?.summary;return typeof t=="string"&&t!==""?t:null}r(co,"noticeSummary");function uo(e,t){const n={rendered:null,summary:null,body:(0,i.jsx)(Pe,{...t})};switch(e){case"instructions":return $n(t.source)===null?n:{rendered:"instructions",summary:null,body:(0,i.jsx)(so,{...t})};case"catalog":return zn(t.source)===null?n:{rendered:"catalog",summary:null,body:(0,i.jsx)(ro,{...t})};case"snapshot":return Pn(t.source)===null?n:{rendered:"snapshot",summary:null,body:(0,i.jsx)(oo,{...t})};case"notice":{const s=co(t.source);return s===null?n:{rendered:"notice",summary:s,body:(0,i.jsx)(io,{...t})}}case"relay":return Zn(t.source)===null?n:{rendered:"relay",summary:null,body:(0,i.jsx)(ao,{...t})};case"recall":return Gn(t.source)===null?n:{rendered:"recall",summary:null,body:(0,i.jsx)(lo,{...t})};case null:return n;default:throw new Error(`unreachable context form: ${String(e)}`)}}r(uo,"contextBody");const po=".lL660W_root{min-width:0}.lL660W_root[data-open]{padding-bottom:4px}.lL660W_chevron{color:var(--dsw-alias-label-secondary)}.lL660W_sep{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.lL660W_source{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:none;font-size:14px;line-height:24px;overflow:hidden}.lL660W_summary{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:14px;line-height:24px;overflow:hidden}.lL660W_body{box-sizing:border-box;background:var(--dsw-alias-markdown-code-block);width:calc(100% - 22px);max-height:141px;color:var(--dsw-alias-label-tertiary);font:400 11px/16px var(--ds-font-family-code);border:none;border-radius:8px;margin:4px 0 0 22px;padding:10px 16px 12px 12px;overflow:auto}",Hn="@deepseek-ai/dsh-client-ui-conversation/ContextInjectionRow.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Hn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Hn,e.textContent=po,document.head.appendChild(e)}var Ve={root:"lL660W_root",chevron:"lL660W_chevron",summary:"lL660W_summary",source:"lL660W_source",body:"lL660W_body",sep:"lL660W_sep"};function ho({content:e,source:t,provenance:n,form:s,t:o}){const[a,l]=(0,h.useState)(!1),{rendered:c,summary:d,body:u}=uo(s,{content:e,source:t,t:o});return(0,i.jsx)(_.DisclosureRow,{className:Ve.root,icon:(0,i.jsx)(_.IconBrowseOutline16,{size:14}),chevronClassName:Ve.chevron,title:o(n.role==="recall"?"message.contextRecall":"message.contextInjection"),collapsedContent:n.label===null?void 0:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:Ve.sep,"aria-hidden":!0}),(0,i.jsx)("span",{className:Ve.source,"data-context-source":!0,children:n.label}),d!==null&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:Ve.sep,"aria-hidden":!0}),(0,i.jsx)("span",{className:Ve.summary,"data-context-summary":!0,children:d})]})]}),keepContentWhenOpen:!0,open:a,expandable:!0,expandOnRowClick:!0,onToggle:r(()=>{l(f=>!f)},"onToggle"),children:(0,i.jsx)("div",{className:Ve.body,"data-context-injection-body":!0,"data-context-form":c??void 0,children:u})})}r(ho,"ContextInjectionRow");function mo(){const[e,t]=(0,h.useState)(()=>_n(Date.now()));return(0,h.useEffect)(()=>{let n;const s=r(()=>{const o=Date.now();t(_n(o)),n=setTimeout(s,An(o))},"arm");return n=setTimeout(s,An(Date.now())),()=>{clearTimeout(n)}},[]),e}r(mo,"useCalendarDay");const fo=".vobGIq_actions{align-items:center;gap:10px;height:28px;display:flex}.vobGIq_timeStart{color:var(--dsw-alias-label-tertiary);white-space:nowrap;padding-right:12px;font-size:14px;line-height:24px}.vobGIq_timeEnd{color:var(--dsw-alias-label-tertiary);white-space:nowrap;padding-left:12px;font-size:14px;line-height:24px}.vobGIq_runTimeDot{margin:0 10px}@media (hover:hover){[data-time-hover-root] :is(.vobGIq_timeStart,.vobGIq_timeEnd){opacity:0;transition:opacity 80ms}[data-time-hover-root]:hover :is(.vobGIq_timeStart,.vobGIq_timeEnd),[data-time-hover-root]:focus-within :is(.vobGIq_timeStart,.vobGIq_timeEnd){opacity:1}}.vobGIq_action{width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:28px;justify-content:center;align-items:center;padding:6px;display:inline-flex}.vobGIq_action:hover{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-secondary)}.vobGIq_action[data-unavailable]{cursor:default;opacity:.4}.vobGIq_action[data-unavailable]:hover{color:var(--dsw-alias-label-tertiary);background:0 0}.vobGIq_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}",Qn="@deepseek-ai/dsh-client-ui-conversation/MessageIconActions.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Qn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Qn,e.textContent=fo,document.head.appendChild(e)}var ye={action:"vobGIq_action",visuallyHidden:"vobGIq_visuallyHidden",actions:"vobGIq_actions",timeEnd:"vobGIq_timeEnd",runTimeDot:"vobGIq_runTimeDot",timeStart:"vobGIq_timeStart"};function Ut({text:e,time:t,runMs:n,ttftMs:s,tokensPerSecond:o,clock:a,onBranch:l,branchUnavailable:c=!1,className:d,extraActions:u,t:f}){const m=mo(),k=(0,h.useId)(),[g,x]=(0,h.useState)(!1),b=(0,h.useRef)(!1),w=(0,h.useRef)(null),C=(0,h.useRef)(0);(0,h.useEffect)(()=>()=>{C.current+=1,b.current=!1,w.current!==null&&clearTimeout(w.current)},[]);const y=(0,h.useCallback)(()=>{if(g||b.current)return;const j=C.current;b.current=!0,(0,_.writeClipboard)(e).then(z=>{j===C.current&&(b.current=!1,z&&(x(!0),w.current=window.setTimeout(()=>{w.current=null,x(!1)},1e3)))})},[g,e]),A=t===void 0?null:(0,i.jsxs)("span",{className:a==="start"?ye.timeStart:ye.timeEnd,children:[Cr(t,f,m),n!==void 0&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsx)("span",{className:ye.runTimeDot,"aria-hidden":!0,children:"·"})," ",f("message.ranFor",{duration:jn(n,f)})]}),s!==void 0&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsx)("span",{className:ye.runTimeDot,"aria-hidden":!0,children:"·"})," ",f("message.ttft",{seconds:Sr(s)})]}),o!==void 0&&(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsx)("span",{className:ye.runTimeDot,"aria-hidden":!0,children:"·"})," ",f("message.tokensPerSecond",{tps:Sn(o)})]})]});return(0,i.jsxs)("div",{className:d===void 0?ye.actions:`${ye.actions} ${d}`,children:[a==="start"?A:null,(0,i.jsx)(_.Tooltip,{label:f(g?"copied":"copy"),side:"bottom",children:(0,i.jsx)("button",{type:"button",className:ye.action,"aria-label":f(g?"copied":"copy"),onClick:y,children:g?(0,i.jsx)(_.IconCheckOutline16,{}):(0,i.jsx)(_.IconCopyOutline16,{})})}),u,l!==void 0&&(0,i.jsx)(_.Tooltip,{label:f(c?"message.branchUnavailable":"message.branch"),side:"bottom",children:(0,i.jsx)("button",{type:"button",className:ye.action,"aria-label":f("message.branch"),"aria-disabled":c||void 0,"aria-describedby":c?k:void 0,"data-unavailable":c||void 0,onClick:c?void 0:l,children:(0,i.jsx)(_.IconBranchOutline16,{})})}),l!==void 0&&c&&(0,i.jsx)("span",{id:k,className:ye.visuallyHidden,children:f("message.branchUnavailable")}),a==="end"?A:null]})}r(Ut,"MessageIconActions");function go(e){const t=[],n=[],s=[];for(const o of e){const a=o;a.type==="text"&&typeof a.text=="string"?t.push(a.text):a.type==="image"&&a.attachment!==void 0?n.push({attachment:a.attachment}):s.push(o)}return{text:t.join(""),images:n,rest:s}}r(go,"contentParts");function ft(e){return Math.max(1,Math.ceil(e/1e3))}r(ft,"retrySeconds");function vo({node:e,active:t,t:n}){const s=(0,h.useMemo)(()=>Date.now()+e.delayMs,[e.delayMs,e.seq]),o=ft(e.delayMs),a=e.mode==="normal"?e.maxRetries:"∞",[l,c]=(0,h.useState)(()=>({deadline:s,seconds:ft(s-Date.now())})),d=l.deadline===s?l.seconds:ft(s-Date.now());(0,h.useEffect)(()=>{if(!t)return;const m=r(()=>{const g=ft(s-Date.now());return c(x=>x.deadline===s&&x.seconds===g?x:{deadline:s,seconds:g}),g},"updateCountdown");if(m()===1)return;const k=window.setInterval(()=>{m()===1&&window.clearInterval(k)},250);return()=>{window.clearInterval(k)}},[t,s]);const u=t?n("message.retry.active"):e.retryState==="cancelled"?n("message.retry.cancelled"):e.retryState==="started"?n("message.retry.started"):n("message.retry.scheduled"),f=t?d:o;return(0,i.jsxs)("details",{className:I.retryRow,"data-active":t||void 0,children:[(0,i.jsx)("summary",{className:I.retrySummary,children:(0,i.jsx)("span",{className:I.retryText,role:"status",children:n("message.retry.status",{label:u,retry:e.retry,maximum:a,seconds:f})})}),(0,i.jsxs)("div",{className:I.retryDetails,children:[(0,i.jsxs)("div",{children:[(0,i.jsx)("span",{className:I.retryDetailLabel,children:n("message.retry.delay")}),Math.round(e.delayMs),"ms"]}),(0,i.jsxs)("div",{children:[(0,i.jsx)("span",{className:I.retryDetailLabel,children:n("message.retry.failure")}),e.failure.message]})]})]})}r(vo,"ModelRetryItem");function xo({node:e,t}){return(0,i.jsxs)("div",{className:I.turnErrorRow,role:"status",children:[(0,i.jsx)(_.StateDot,{state:"error",className:I.turnErrorDot}),(0,i.jsxs)("div",{className:I.turnErrorCopy,children:[(0,i.jsx)("span",{className:I.turnErrorTitle,children:t("message.turnError")}),(0,i.jsx)("span",{className:I.turnErrorMessage,children:e.message})]}),e.code!==void 0&&(0,i.jsx)("code",{className:I.turnErrorCode,children:e.code})]})}r(xo,"TurnErrorItem");function yo({t:e}){return(0,i.jsxs)("div",{className:I.turnErrorRow,role:"status",children:[(0,i.jsx)(_.StateDot,{state:"warning",className:I.turnErrorDot}),(0,i.jsxs)("div",{className:I.turnErrorCopy,children:[(0,i.jsx)("span",{className:I.maxTokensTitle,children:e("message.maxTokens")}),(0,i.jsx)("span",{className:I.turnErrorMessage,children:e("message.maxTokens.hint")})]})]})}r(yo,"TurnMaxTokensItem");function bo(e){const t=/(^|\s)([/@][\w-]+)(?=\s|$)/g,n=[];let s=0,o;for(;(o=t.exec(e))!==null;){const a=o.index+(o[1]?.length??0),l=o[2]??"";a>s&&n.push((0,i.jsx)(_.MessageText,{text:e.slice(s,a)},s)),n.push((0,i.jsx)("span",{className:I.refChip,"data-ref-chip":l.startsWith("@")?"subagent":"skill",children:l},a)),s=a+l.length}return n.length===0?(0,i.jsx)(_.MessageText,{text:e}):(s<e.length&&n.push((0,i.jsx)(_.MessageText,{text:e.slice(s)},s)),(0,i.jsx)(i.Fragment,{children:n}))}r(bo,"projectUserText");function Jn({content:e,imageLoader:t,actions:n,pending:s=!1,t:o}){const{text:a,images:l,rest:c}=go(e),d=r(f=>o("json.truncated",{total:f}),"truncated"),u=a!==""||c.length>0;return(0,i.jsxs)("div",{className:I.userRow,"data-pending-steering":s||void 0,"data-time-hover-root":!0,children:[(0,i.jsxs)("div",{className:I.userStack,children:[(0,i.jsx)(Xe.ImageGallery,{images:l,load:t,align:"end",labels:wn(o)}),u&&(0,i.jsxs)("div",{className:I.bubble,children:[bo(a),c.map((f,m)=>(0,i.jsx)(_.JsonBlock,{label:o("message.extraBlock"),payload:f,truncatedLabel:d},m))]})]}),n?.(a)]})}r(Jn,"UserStyleBubble");function wo({content:e,loadImage:t,t:n}){return(0,i.jsx)(Jn,{content:e,imageLoader:t??(()=>Promise.reject(new Error(n("image.serviceUnavailable")))),pending:!0,t:n,actions:r(s=>(0,i.jsx)(Ut,{text:s,clock:"start",className:I.actions,t:n}),"actions")})}r(wo,"PendingSteeringBubble");const Kn=(0,h.memo)(r(function({node:t,loadImage:n,t:s}){const o=t.data;return(0,i.jsx)(Jn,{content:o.content,imageLoader:n,t:s,actions:r(a=>(0,i.jsx)(Ut,{text:a,time:o.time,clock:"start",className:I.actions,t:s}),"actions")})},"UserMessageNodeView")),ko=(0,h.memo)(r(function({node:t,t:n}){const s=t.data;return(0,i.jsx)(ho,{content:s.content,source:s.source,provenance:s.provenance,form:s.form,t:n})},"ContextMessageNodeView")),_o=(0,h.memo)(r(function({node:t,t:n}){return(0,i.jsx)(On,{node:t.data,t:n})},"CompactionNodeView")),Ao=(0,h.memo)(r(function({node:t,t:n}){const s=t.data;return(0,i.jsx)(vo,{node:s.current,active:s.current.retryState==="scheduled",t:n})},"RetryNodeView")),jo=(0,h.memo)(r(function({node:t,t:n}){return(0,i.jsx)(xo,{node:t.data,t:n})},"TurnErrorNodeView")),So=(0,h.memo)(r(function({t}){return(0,i.jsx)(yo,{t})},"TurnMaxTokensNodeView")),Co=(0,h.memo)(r(function({node:t,t:n}){const s=t.data;return(0,i.jsx)("div",{className:I.contextRow,children:(0,i.jsx)(_.JsonBlock,{label:n("message.unknownSurface",{type:s.type}),payload:s.data,truncatedLabel:r(o=>n("json.truncated",{total:o}),"truncatedLabel")})})},"UnknownNodeView")),Wo=".aTk3qW_root{flex-direction:column;flex:auto;min-height:0;display:flex;position:relative}.aTk3qW_scroll{min-height:0;padding:16px calc(var(--dsh-composer-side-clearance) + 16px);flex:auto;overflow-y:auto}[data-conversation-scroll] .aTk3qW_root{flex:none;height:auto;min-height:auto}[data-conversation-scroll] .aTk3qW_scroll{flex:none;min-height:auto;overflow:visible}.aTk3qW_column{max-width:var(--dsh-chat-content-width);flex-direction:column;gap:16px;width:100%;margin:0 auto;display:flex}.aTk3qW_flowItem{min-width:0}.aTk3qW_flowItem:empty{display:none}.aTk3qW_callRow{border-radius:6px}.aTk3qW_turnStatus{height:26px;font:var(--dsw-font-s-strong-14);white-space:nowrap;background:linear-gradient(90deg, var(--dsw-static-deepseek-500) 0%, var(--dsw-static-deepseek-500) 40%, var(--dsw-static-deepseek-200) 50%, var(--dsw-static-deepseek-500) 60%, var(--dsw-static-deepseek-500) 100%);color:#0000;-webkit-text-fill-color:transparent;background-position:100% 0;background-size:250% 100%;-webkit-background-clip:text;background-clip:text;flex:none;align-self:flex-start;align-items:center;animation:1.8s linear infinite aTk3qW_dsh-turn-status-shimmer;display:inline-flex}.aTk3qW_turnStatusClock{font:var(--dsw-font-xs-13);font-variant-numeric:tabular-nums;color:var(--dsw-alias-label-caption);-webkit-text-fill-color:var(--dsw-alias-label-caption);margin-left:8px;font-weight:400}@keyframes aTk3qW_dsh-turn-status-shimmer{to{background-position:0 0}}@media (prefers-reduced-motion:reduce){.aTk3qW_turnStatus{background-position:0 0;background-size:100% 100%;animation:none}}.aTk3qW_hint{color:var(--dsw-alias-label-tertiary);font-size:12px;line-height:18px}.aTk3qW_openError{color:var(--dsw-alias-state-error-primary);font-size:12px;line-height:18px}.aTk3qW_older{justify-content:center;display:flex}.aTk3qW_older button{color:var(--dsw-alias-label-secondary);background:var(--dsw-alias-interactive-bg-hover-solid);cursor:pointer;border:none;border-radius:14px;padding:4px 12px;font-size:12px}.aTk3qW_older button:disabled{cursor:default;opacity:.6}.aTk3qW_toBottomSlot{z-index:8;height:0;padding-right:max(0px, calc((100% - var(--dsh-chat-content-width)) / 2));pointer-events:none;justify-content:flex-end;display:flex;position:sticky;bottom:16px}[data-conversation-scroll] .aTk3qW_toBottomSlot{bottom:calc(var(--dsh-composer-height,152px) + 16px)}.aTk3qW_toBottom{border:1px solid var(--dsw-alias-border-l2);width:34px;height:34px;color:var(--dsw-alias-label-primary);background:var(--dsw-alias-button-floating-fill);box-shadow:var(--dsw-shadow-lv2);cursor:pointer;pointer-events:auto;border-radius:100px;justify-content:center;align-items:center;margin-top:-34px;padding:0;display:flex}.aTk3qW_toBottom:hover{background:var(--dsw-alias-button-floating-hover)}",Yn="@deepseek-ai/dsh-client-ui-conversation/ChatView.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Yn)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Yn,e.textContent=Wo,document.head.appendChild(e)}var ae={toBottomSlot:"aTk3qW_toBottomSlot",hint:"aTk3qW_hint",older:"aTk3qW_older",root:"aTk3qW_root",scroll:"aTk3qW_scroll",turnStatus:"aTk3qW_turnStatus",column:"aTk3qW_column","dsh-turn-status-shimmer":"aTk3qW_dsh-turn-status-shimmer",openError:"aTk3qW_openError",toBottom:"aTk3qW_toBottom",flowItem:"aTk3qW_flowItem",turnStatusClock:"aTk3qW_turnStatusClock",callRow:"aTk3qW_callRow"};const To=(0,h.memo)(r(function({nodeKey:t,selectedCallId:n,cwd:s,openFile:o,inspectCall:a,forkAt:l,loadImage:c,fileMentions:d,useSession:u,renderSlot:f,t:m}){const k=u(w=>w.chat.nodes.get(t)),g=k,x=(0,h.useMemo)(()=>k===void 0?null:{selectedCallId:n,cwd:s,openFile:o,inspectCall:a,forkAt:l,loadImage:c,fileMentions:d},[k,n,s,o,a,l,c,d]);if(g===void 0||x===null)return null;const b={...x,node:g};return(0,i.jsx)("div",{className:ae.flowItem,"data-chat-anchor-key":g.key,"data-chat-flow-key":g.key,"data-chat-flow-kind":g.kind,children:f("conversation.chat.node",b,{entryKey:g.kind,hookContext:t,fallback:(0,i.jsx)(_.JsonBlock,{label:m("message.unknownSurface",{type:g.kind}),payload:g.data,truncatedLabel:r(w=>m("json.truncated",{total:w}),"truncatedLabel")})})})},"ChatNodeSeat"));function $e(e){return e.closest("[data-conversation-scroll]")??e}r($e,"scrollerOf");function Xn(e,t){for(const n of e.querySelectorAll("[data-chat-anchor-key]"))if(n.dataset.chatAnchorKey===t)return n;return null}r(Xn,"anchorElement");function gt(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}r(gt,"flowTop");function es(e,t){const n=t.getBoundingClientRect(),s=t.querySelector("[data-composer-seat]")?.getBoundingClientRect().top??n.bottom;if(typeof document.elementsFromPoint=="function"&&s>n.top){const a=e.getBoundingClientRect(),l=Math.max(n.left,a.left),c=Math.min(n.right,a.right),d=l+Math.max(0,c-l)/2,u=s-n.top,f=[1,Math.min(32,u/3),u/2,Math.max(1,u-1)];for(const m of f)for(const k of document.elementsFromPoint(d,n.top+m)){const g=k instanceof HTMLElement?k.closest("[data-chat-anchor-key]"):null;if(g!==null&&e.contains(g))return g}}const o=[...e.querySelectorAll("[data-chat-anchor-key]")];return o.filter(a=>{const l=a.getBoundingClientRect();return l.bottom>n.top&&l.top<s})[0]??o[0]??null}r(es,"pagingAnchor");function ts(e,t){const n=es(e,t),s=n?.dataset.chatAnchorKey;return n===null||s===void 0?null:{anchorKey:s,anchorTop:gt(n,t),scrollTop:t.scrollTop}}r(ts,"scrollPosition");function Eo(e){let t=null;for(const n of e.turns.values())n.status==="open"&&n.start!==void 0&&(t=n.start.time);return t}r(Eo,"runningTurnStartTime");function No({startTime:e,t}){const[n]=(0,h.useState)(()=>Date.now()),s=e??n,[o,a]=(0,h.useState)(()=>Math.max(0,Date.now()-s));(0,h.useEffect)(()=>{const c=r(()=>{a(Math.max(0,Date.now()-s))},"tick");c();const d=setInterval(c,1e3);return()=>{clearInterval(d)}},[s]);const l=o>=15e3;return(0,i.jsxs)("div",{className:ae.turnStatus,role:"status","aria-live":"polite",children:["Deep diving...",l&&(0,i.jsx)("span",{className:ae.turnStatusClock,"aria-hidden":!0,children:jn(o,t)})]})}r(No,"TurnStatus");function qo({useSession:e,useSessions:t,useStore:n,renderSlot:s,sessionId:o,openFile:a,loadOlder:l,loadImage:c,inspectCall:d,chatScroll:u,forkAt:f,fileMentions:m,t:k}){const g=e(S=>S.chat.order),x=e(S=>S.chat.nodes),b=e(S=>S.chat.timeline),w=e(S=>S.queue),C=t(S=>S.byId[o]?.cwd),y=e(S=>S.running),A=e(S=>S.openState),j=e(S=>S.openError),z=e(S=>S.hasMore),ne=e(S=>S.loadingOlder),Ee=n(S=>S.selection?.callId),he=(0,h.useMemo)(()=>w.filter(S=>S.placement==="steering"),[w]),He=(0,h.useMemo)(()=>Eo(b),[b]),X=(0,h.useRef)(null),Re=(0,h.useRef)(null),be=(0,h.useRef)(!0),[U,Y]=(0,h.useState)(!0),me=(0,h.useRef)(0),se=(0,h.useRef)(null),ee=(0,h.useRef)(null),Ne=(0,h.useRef)(!1),pe=(0,h.useRef)(null),fe=(0,h.useRef)(null),De=(0,h.useRef)(null),Qe=g[0],E=Qe===void 0?null:x.get(Qe)?.anchorSeq??null,D=g.at(-1)??null,de=D===null?void 0:x.get(D),we=he[he.length-1]?.id??null,ge=`${A}:${E}:${D}:${g.length}:${y?1:0}:${we??""}`,Ue=r(S=>{se.current=null,S.scrollTop=S.scrollHeight,me.current=S.scrollTop,be.current=!0,Y(!0),u.save(null)},"toBottom");(0,h.useLayoutEffect)(()=>{const S=X.current;if(S===null)return;const q=$e(S);if(A==="open"&&!Ne.current){Ne.current=!0;const G=u.read();if(G===null)Ue(q);else{q.scrollTop=G.scrollTop;const Oe=Xn(S,G.anchorKey);Oe!==null&&(q.scrollTop+=gt(Oe,q)-G.anchorTop),me.current=q.scrollTop;const _e=q.scrollHeight-q.scrollTop-q.clientHeight<=25;be.current=_e,Y(_e);const Ke=_e?null:ts(S,q);_e?u.save(null):Ke!==null&&u.save(Ke)}ee.current=E,pe.current=D,fe.current=we,De.current=ge;return}if(se.current!==null&&E!==null&&ee.current!==null&&E<ee.current){const G=se.current;se.current=null;const Oe=Xn(S,G.key);Oe!==null&&(q.scrollTop+=gt(Oe,q)-G.top),me.current=q.scrollTop,ee.current=E,pe.current=D,fe.current=we,De.current=ge;return}ee.current=E;const Z=D!==pe.current&&de?.kind==="user",ke=we!==null&&we!==fe.current,P=De.current!==ge;pe.current=D,fe.current=we,De.current=ge,(Z||ke||P&&be.current)&&Ue(q)});const bt=(0,h.useRef)(()=>{});bt.current=()=>{const S=X.current;if(S===null)return;const q=$e(S),Z=Math.max(0,q.scrollHeight-q.clientHeight),ke=Math.abs(q.scrollTop-Math.min(me.current,Z))>.5,P=ke?Z-q.scrollTop<=25:be.current;if(!ke&&P){Ue(q);return}be.current=P,Y(P);const G=P?null:ts(S,q);P?se.current=null:se.current!==null&&G!==null&&(se.current={key:G.anchorKey,top:G.anchorTop}),P?u.save(null):G!==null&&u.save(G),me.current=q.scrollTop},(0,h.useEffect)(()=>{const S=X.current;if(S===null)return;const q=$e(S),Z=r(()=>{bt.current()},"onScroll");return q.addEventListener("scroll",Z,{passive:!0}),()=>{q.removeEventListener("scroll",Z)}},[]);const Je=(0,h.useRef)(null);Je.current=()=>{const S=X.current;if(S!==null&&be.current){const q=$e(S);q.scrollTop=q.scrollHeight,me.current=q.scrollTop,u.save(null)}},(0,h.useEffect)(()=>{const S=Re.current,q=X.current;if(S===null||q===null||typeof ResizeObserver>"u")return;const Z=$e(q).querySelector("[data-composer-seat]"),ke=new ResizeObserver(()=>{Je.current?.()});return ke.observe(S),Z!==null&&ke.observe(Z),()=>{ke.disconnect()}},[]),(0,h.useEffect)(()=>{ne||(se.current=null)},[ne]);const lt=r(()=>{const S=X.current;if(S!==null){const q=$e(S),Z=es(S,q);Z!==null&&Z.dataset.chatAnchorKey!==void 0&&(se.current={key:Z.dataset.chatAnchorKey,top:gt(Z,q)})}l()},"loadOlderAnchored");return(0,i.jsx)("div",{className:ae.root,children:(0,i.jsxs)("div",{ref:X,className:ae.scroll,children:[(0,i.jsxs)("div",{ref:Re,className:ae.column,"data-chat-flow":"",children:[A==="loading"&&(0,i.jsx)("div",{className:ae.hint,children:k("chat.loadingHistory")}),A==="error"&&j!==null&&(0,i.jsx)("div",{className:ae.openError,children:k("chat.loadError",{message:j.message,code:j.code})}),z&&(0,i.jsx)("div",{className:ae.older,children:(0,i.jsx)("button",{type:"button",disabled:ne,onClick:lt,children:k(ne?"loading":"chat.loadOlder")})}),g.map(S=>(0,i.jsx)(To,{nodeKey:S,useSession:e,selectedCallId:Ee,cwd:C,openFile:a,inspectCall:d,forkAt:f,loadImage:c,fileMentions:m,renderSlot:s,t:k},S)),y&&(0,i.jsx)(No,{startTime:He,t:k}),he.map(S=>(0,i.jsx)(wo,{content:S.content,loadImage:c,t:k},S.id))]}),!U&&(0,i.jsx)("div",{className:ae.toBottomSlot,children:(0,i.jsx)("button",{type:"button",className:ae.toBottom,"aria-label":k("chat.toBottom"),onClick:r(()=>{const S=X.current;S!==null&&Ue($e(S))},"onClick"),children:(0,i.jsx)(_.IconChevronDownOutline14,{})})})]})})}r(qo,"ChatView");var Io=class{static{r(this,"PendingApproval")}wait;constructor(e){this.wait=e}get key(){return this.wait.key}get toolName(){return this.wait.payload.toolName}get reason(){return this.wait.payload.reason}get callId(){return this.wait.payload.callId}async answer(e){const t=await this.wait.respond({ok:!0,value:{sessionId:this.wait.sessionId,approvalId:this.wait.payload.approvalId,outcome:e}});if(!t.accepted)throw new Error(`approval response rejected: ${t.reason}`)}};function ns(e){return e?.kind==="tool-call"?e:void 0}r(ns,"toolNode");function Lo(e,t){return ns(e.chat.nodes.get((0,O.conversationContextKey)("tool-call",t)))?.data.root}r(Lo,"rootToolCall");function Mo(e,t){const n=r(s=>{if(s.callId===t)return s;for(const o of s.subCalls){const a=n(o);if(a!==void 0)return a}},"visit");for(const s of e.chat.nodes.values()){const o=ns(s)?.data.root;if(o===void 0)continue;const a=n(o);if(a!==void 0)return a}}r(Mo,"findToolCall");const Ro=".V4yZlG_root{padding:8px calc(var(--dsh-composer-side-clearance) + 16px) 12px;flex-direction:column;align-items:center;display:flex}.V4yZlG_card{width:100%;max-width:var(--dsh-chat-content-width);border:1px solid var(--dsw-alias-state-warn-secondary);background:var(--dsw-specific-input-major);box-shadow:var(--dsw-shadow-lv2);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:20px;overflow:hidden}.V4yZlG_strip{background:var(--dsw-alias-state-warn-tertiary);color:var(--dsw-alias-state-warn-primary);align-items:center;gap:8px;padding:10px 16px;font-size:13px;line-height:18px;display:flex}.V4yZlG_dot{background:var(--dsw-alias-state-warn-primary);border-radius:50%;width:8px;height:8px}.V4yZlG_body{box-sizing:border-box;max-height:var(--dsh-composer-text-max-height);flex-direction:column;gap:6px;padding:12px 16px 0;display:flex;overflow-y:auto}.V4yZlG_headline{color:var(--dsw-alias-label-primary);font-size:15px;font-weight:500;line-height:24px}.V4yZlG_command{color:var(--dsw-alias-label-tertiary);font-family:var(--ds-font-family-code);word-break:break-all;font-size:13px;line-height:20px}.V4yZlG_actionRow{justify-content:flex-end;gap:8px;padding:14px 16px;display:flex}.V4yZlG_reject:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover-danger);color:var(--dsw-alias-state-error-primary);border-color:#0000}",ss="@deepseek-ai/dsh-client-ui-conversation/ApprovalPanel.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(ss)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=ss,e.textContent=Ro,document.head.appendChild(e)}var We={command:"V4yZlG_command",strip:"V4yZlG_strip",body:"V4yZlG_body",actionRow:"V4yZlG_actionRow",headline:"V4yZlG_headline",reject:"V4yZlG_reject",root:"V4yZlG_root",dot:"V4yZlG_dot",card:"V4yZlG_card"};function Do(e){if(e!==void 0)try{const t=JSON.parse(e.argsRaw);return typeof t.command=="string"?t.command:void 0}catch{return}}r(Do,"commandOf");function Uo(e){const t=(0,h.useMemo)(()=>new Io(e.matched),[e.matched]),n=e.useSession(s=>{if(t.callId===void 0)return;const o=Lo(s,t.callId);if(o!==void 0)return o.callId===t.callId&&!("kind"in o)?Do(o):void 0});return(0,i.jsx)(Oo,{pending:t,t:e.t,...n===void 0?{}:{command:n}},t.key)}r(Uo,"ApprovalPanel");function Oo({pending:e,command:t,t:n}){const[s,o]=(0,h.useState)(!1),a=r(l=>{o(!0),e.answer(l).catch(()=>{o(!1)})},"answer");return(0,i.jsx)("div",{className:We.root,"data-approval-key":e.key,children:(0,i.jsxs)("div",{className:We.card,children:[(0,i.jsxs)("div",{className:We.strip,children:[(0,i.jsx)("span",{className:We.dot}),n("approval.waiting")]}),(0,i.jsxs)("div",{className:We.body,"data-approval-scroll":"",tabIndex:0,role:"group","aria-label":n("approval.detail.aria"),children:[(0,i.jsx)("div",{className:We.headline,children:e.reason??n("approval.escalation",{toolName:e.toolName})}),t!==void 0&&(0,i.jsx)("div",{className:We.command,children:t})]}),(0,i.jsxs)("div",{className:We.actionRow,children:[(0,i.jsx)(_.Button,{variant:"outline",className:We.reject,disabled:s,onClick:r(()=>{a("rejected")},"onClick"),children:n("approval.reject")}),(0,i.jsx)(_.Button,{variant:"primary",disabled:s,onClick:r(()=>{a("allowed-once")},"onClick"),children:n("approval.allowOnce")})]})]})})}r(Oo,"ApprovalFlow");const V="conversation",rs="描述你的任务以生成计划",os="describe your task to generate plan",Bo={"view.chat":"对话","hint.plan":rs,"hint.goal":"输入目标,智能体将持续执行","hint.goal.active":"当前目标进行中。可输入 edit 修改 / pause 暂停 / resume 继续 / clear 清除","placeholder.plan":rs,"placeholder.default":"给智能体发消息","placeholder.unavailable":"会话不可用","placeholder.parentOffline":"父会话已离线,无法继续发送;仍可停止当前运行","placeholder.hero":"描述你想要构建的内容","placeholder.workspace":"选择一个工作区开始","input.commands":"命令","input.stop":"停止生成","input.send":"发送消息","placeholder.steerQueue":"Cmd/Ctrl+Enter 插话发送全部排队消息","input.accessMode":"访问模式,当前:{name}","image.dropTitle":"图片拖动到此处即可添加","image.dropDesc":"最多 {count} 张,每张 {size}","image.dropBlocked":"当前无法添加图片","image.pending":"待发送图片","image.openOriginal":"查看原图","image.openOriginalLabel":"{label},点击查看原图","image.remove":"移除图片 {name}","image.scrollLeft":"向左滚动图片","image.scrollRight":"向右滚动图片","image.original":"原图","image.label":"图片","image.loadFailed":"图片加载失败,点击重试","image.loading":"图片加载中…","image.preview":"原图预览","image.closePreview":"关闭原图预览","image.serviceUnavailable":"图片读取服务不可用","image.unsupportedType":"仅支持 PNG、JPG、WebP、GIF 格式的图片","image.tooMany":"一条消息最多添加 {count} 张图片","image.fileTooLarge":"单张图片不能超过 {size}","image.totalTooLarge":"图片总大小超过 {size},请移除部分图片","image.tooManyPixels":"图片分辨率过大,请压缩后重试","image.modelUnsupported":"当前模型不支持图片,请切换支持图片的模型","image.subagentUnsupported":"子智能体会话暂不支持图片","image.sendFailed":"图片发送失败({reason}),请重新添加图片后再试","context.aria":"上下文已用 {percent}","context.used":"上下文已用","context.system":"系统提示词","context.tools":"工具","context.messages":"对话消息","stats.counts":"{turns} 轮 · {steps} 步","stats.llm":"LLM {duration}","stats.toolCall":"工具调用 {duration}","stats.ttftAverage":"首 token 平均 {duration}","stats.tokensPerSecond":"{throughput} tok/s","stats.cacheHit":"缓存命中 {percent}%","stats.tokens":"输入 {input} tok · 输出 {output} tok",disclaimer:"当前版本为开发者预览版本,内容由AI提供,可能存在风险,请谨慎控制AI权限","settings.enter.title":"繁忙时 Enter 键行为","settings.enter.description":"仅在智能体运行时生效;Cmd/Ctrl+Enter 使用另一行为","settings.enter.queue":"排队发送","settings.enter.steer":"插话发送","access.confirm.title":"确认启用 Full access?","access.confirm.description":"启用 Full access 后,agent 将减少确认步骤,并且可以直接执行更多操作,包括敏感操作、文件修改或外部命令。仅建议在你信任当前任务时使用。","access.confirm.acknowledge":"我已了解风险,并愿意继续","access.confirm.cancel":"取消","access.confirm.enable":"启用 Full access","hero.headline":"探索未至之境","hero.preview":"预览版","hero.chooseWorkspace":"选择工作区","session.hierarchy":"会话层级","details.title":"详情","details.close":"关闭详情","details.empty":"点击消息流中的工具行查看详情","details.notInWindow":"该调用不在当前窗口内","details.input":"输入","details.output":"输出","details.running":"运行中…","todo.title":"任务","todo.progress.done":"{done} 已完成","todo.progress.active":"{active} 进行中","todo.progress.pending":"{pending} 待处理","todo.rowTitle":"更新任务清单","todo.completed":"{done}/{total} 已完成","chat.loadingHistory":"载入历史…","chat.loadError":"历史加载失败:{message}({code})","chat.loadOlder":"加载更早","chat.toBottom":"回到底部","message.extraBlock":"附加内容块","message.contextInjection":"上下文注入","message.contextRecall":"跨会话召回","message.context.instructions.loaded":"已载入","message.context.instructions.added":"已新增","message.context.instructions.updated":"已更新","message.context.instructions.removed":"已移除","message.context.catalog.replaced":"替换目录","message.context.catalog.more":"…还有 {count} 条","message.context.snapshot.supersedes":"取代先前的快照","message.context.relay.from":"来自会话 {session}","message.context.recall.counts":"保留 {retained} 条 · 省略 {omitted} 条","message.context.recall.truncated":"已截断","message.compaction":"上下文已压缩","message.compaction.running":"正在压缩…","message.compaction.completed":"已压缩 {items} 条历史记录(约 {tokens} tokens)","message.compaction.expand":"点击查看压缩摘要","message.compaction.unavailable":"压缩摘要不可用","message.unknownSurface":"未知 surface 事件:{type}","message.unknownBlock":"未知内容块","message.stopped":"已停止","message.branch":"在新对话中分支","message.branchUnavailable":"仅可从已完成轮次的最后一条消息分支","message.retry.active":"正在重试模型请求","message.retry.cancelled":"模型请求重试已取消","message.retry.started":"已重试模型请求","message.retry.scheduled":"等待重试模型请求","message.retry.status":"{label}({retry}/{maximum}) · {seconds}s","message.retry.delay":"重试延迟:","message.retry.failure":"失败原因:","message.turnError":"本轮运行失败","message.maxTokens":"已达到输出 token 上限","message.maxTokens.hint":"回答被截断,已有输出保留在对话中。发送“继续”可让模型接着输出。","message.ranFor":"用时 {duration}","message.ttft":"首 token {seconds}秒","message.tokensPerSecond":"{tps} tok/s","duration.seconds":"{seconds}秒","duration.minutes":"{minutes}分{seconds}秒","command.running":"执行中…","command.failed":"命令失败","command.done":"已完成","command.title":"命令","approval.waiting":"等待审批","approval.detail.aria":"审批详情","approval.escalation":"工具 {toolName} 请求越权执行","approval.reject":"拒绝","approval.allowOnce":"允许一次","ask.rowTitle":"提问","ask.waiting":"等待回答","ask.cancelled":"已取消","ask.interrupted":"已中断","ask.answered":"{answered}/{total} 已回答","bash.running":"运行中","bash.failed":"失败","bash.stopped":"已停止","row.running":"运行中","row.failed":"失败","row.stopped":"已停止","queue.count":"{n} 条排队消息","queue.edit":"编辑排队消息","queue.edit.unsupported":"包含非文本内容,暂不支持编辑","queue.save":"保存排队消息","queue.cancelEdit":"取消编辑","queue.remove":"删除排队消息","queue.steer":"插话发送","queue.steer.unavailable":"仅运行中可插话发送","queue.editFailed":"编辑失败:这条消息可能已经开始发送。","queue.removeFailed":"删除失败:这条消息可能已经开始发送。","queue.steerFailed":"插话发送失败,请重试。","terminal.signal":"信号 {signal}","terminal.exitCode":"退出码 {code}","terminal.running":"运行中","terminal.failed":"失败","terminal.done":"已完成","terminal.noOutput":"无输出","terminal.collapseAria":"收起输出","terminal.expandAria":"展开其余 {n} 行输出","terminal.expandRest":"… 其余 {n} 行","json.truncated":"… 已截断,共 {total} 字符","clock.md":"{m}月{d}日","clock.ymd":"{y}年{m}月{d}日"},Fo={"view.chat":"Chat","hint.plan":os,"hint.goal":"describe the objective for a long-running task","hint.goal.active":"goal active — edit / pause / resume / clear","placeholder.plan":os,"placeholder.default":"Message the agent","placeholder.unavailable":"Session unavailable","placeholder.parentOffline":"Parent session offline; sending is unavailable but you can still stop the run","placeholder.hero":"Describe what you want to build","placeholder.workspace":"Choose a workspace to start","input.commands":"Commands","input.stop":"Stop generating","input.send":"Send message","placeholder.steerQueue":"Cmd/Ctrl+Enter steers all queued messages","input.accessMode":"Access mode, current: {name}","image.dropTitle":"Drag images here to add them","image.dropDesc":"Up to {count} images, {size} each","image.dropBlocked":"Images cannot be added right now","image.pending":"Pending images","image.openOriginal":"View original","image.openOriginalLabel":"{label}, click to view original","image.remove":"Remove image {name}","image.scrollLeft":"Scroll images left","image.scrollRight":"Scroll images right","image.original":"Original image","image.label":"Image","image.loadFailed":"Image failed to load; click to retry","image.loading":"Loading image…","image.preview":"Original image preview","image.closePreview":"Close original image preview","image.serviceUnavailable":"Image loading service unavailable","image.unsupportedType":"Only PNG, JPG, WebP, and GIF images are supported","image.tooMany":"A message can include up to {count} images","image.fileTooLarge":"Each image must be smaller than {size}","image.totalTooLarge":"Images exceed {size} in total; remove some and try again","image.tooManyPixels":"Image resolution is too high; compress it and try again","image.modelUnsupported":"The current model does not support images; switch to a model that does","image.subagentUnsupported":"Subagent sessions do not support images yet","image.sendFailed":"Sending images failed ({reason}); re-add them and try again","context.aria":"{percent} of context used","context.used":"of context used","context.system":"System prompt","context.tools":"Tools","context.messages":"Messages","stats.counts":"{turns} turns · {steps} steps","stats.llm":"LLM {duration}","stats.toolCall":"Tool call {duration}","stats.ttftAverage":"TTFT avg {duration}","stats.tokensPerSecond":"{throughput} tok/s","stats.cacheHit":"Cache hit {percent}%","stats.tokens":"Input {input} tok · Output {output} tok",disclaimer:"This version is a developer preview. Content is provided by AI and may involve risks. Please control AI permissions carefully.","settings.enter.title":"Enter behavior while busy","settings.enter.description":"Busy only; Cmd/Ctrl+Enter uses the other behavior","settings.enter.queue":"Queue","settings.enter.steer":"Steer","access.confirm.title":"Enable Full access?","access.confirm.description":"Full access reduces confirmation steps and lets the agent perform more actions directly, including sensitive operations, file changes, or external commands. Only use it when you trust the current task.","access.confirm.acknowledge":"I understand the risks and want to continue","access.confirm.cancel":"Cancel","access.confirm.enable":"Enable Full access","hero.headline":"Into the Unknown","hero.preview":"Preview","hero.chooseWorkspace":"Choose workspace","session.hierarchy":"Session hierarchy","details.title":"Details","details.close":"Close details","details.empty":"Click a tool row in the message flow to view its details","details.notInWindow":"This call is outside the current window","details.input":"Input","details.output":"Output","details.running":"Running…","todo.title":"To-dos","todo.progress.done":"{done} completed","todo.progress.active":"{active} in progress","todo.progress.pending":"{pending} pending","todo.rowTitle":"Update to-do list","todo.completed":"{done}/{total} completed","chat.loadingHistory":"Loading history…","chat.loadError":"Failed to load history: {message} ({code})","chat.loadOlder":"Load earlier","chat.toBottom":"Back to bottom","message.extraBlock":"Extra content block","message.contextInjection":"Context injection","message.contextRecall":"Session recall","message.context.instructions.loaded":"loaded","message.context.instructions.added":"added","message.context.instructions.updated":"updated","message.context.instructions.removed":"removed","message.context.catalog.replaced":"Replacement catalog","message.context.catalog.more":"… {count} more","message.context.snapshot.supersedes":"Supersedes earlier snapshots","message.context.relay.from":"From session {session}","message.context.recall.counts":"{retained} kept · {omitted} omitted","message.context.recall.truncated":"truncated","message.compaction":"Context compacted","message.compaction.running":"Compacting context…","message.compaction.completed":"Compacted {items} history items (~{tokens} tokens)","message.compaction.expand":"View compaction summary","message.compaction.unavailable":"Compaction summary unavailable","message.unknownSurface":"Unknown surface event: {type}","message.unknownBlock":"Unknown content block","message.stopped":"Stopped","message.branch":"Branch into a new conversation","message.branchUnavailable":"Available only on the last message of a completed turn","message.retry.active":"Retrying model request","message.retry.cancelled":"Model request retry cancelled","message.retry.started":"Retried model request","message.retry.scheduled":"Waiting to retry model request","message.retry.status":"{label} ({retry}/{maximum}) · {seconds}s","message.retry.delay":"Retry delay: ","message.retry.failure":"Failure reason: ","message.turnError":"This turn failed","message.maxTokens":"Output token limit reached","message.maxTokens.hint":'The reply was cut off; earlier output is preserved in the conversation. Send "continue" to let the model resume.',"message.ranFor":"Ran for {duration}","message.ttft":"TTFT {seconds}s","message.tokensPerSecond":"{tps} tok/s","duration.seconds":"{seconds}s","duration.minutes":"{minutes}m {seconds}s","command.running":"Running…","command.failed":"Command failed","command.done":"Completed","command.title":"Command","approval.waiting":"Waiting for approval","approval.detail.aria":"Approval details","approval.escalation":"Tool {toolName} requests privileged execution","approval.reject":"Reject","approval.allowOnce":"Allow once","ask.rowTitle":"Ask question","ask.waiting":"waiting","ask.cancelled":"cancelled","ask.interrupted":"interrupted","ask.answered":"{answered}/{total} answered","bash.running":"Running","bash.failed":"Failed","bash.stopped":"Stopped","row.running":"Running","row.failed":"Failed","row.stopped":"Stopped","queue.count":"{n} queued messages","queue.edit":"Edit queued message","queue.edit.unsupported":"Contains non-text content; editing is not supported yet","queue.save":"Save queued message","queue.cancelEdit":"Cancel editing","queue.remove":"Remove queued message","queue.steer":"Steer queued message","queue.steer.unavailable":"Steering is available only while the agent is running","queue.editFailed":"Edit failed: this message may have already started sending.","queue.removeFailed":"Removal failed: this message may have already started sending.","queue.steerFailed":"Steering failed. Try again.","terminal.signal":"signal {signal}","terminal.exitCode":"exit code {code}","terminal.running":"Running","terminal.failed":"Failed","terminal.done":"Done","terminal.noOutput":"No output","terminal.collapseAria":"Collapse output","terminal.expandAria":"Expand the remaining {n} output lines","terminal.expandRest":"… {n} more lines","json.truncated":"… truncated, {total} characters total","clock.md":"{m}/{d}","clock.ymd":"{y}-{m}-{d}"},Vo=".rx6zwW_root{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-specific-tip);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:12px;flex:none;margin:0 auto;overflow:hidden}.rx6zwW_body{flex-direction:column;gap:8px;padding:6px 12px;display:flex}.rx6zwW_header{text-align:left;cursor:pointer;background:0 0;border:none;align-items:center;gap:10px;width:100%;padding:0;display:flex}.rx6zwW_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.rx6zwW_title{color:var(--dsw-alias-label-primary);flex:none;font-size:13px;font-weight:500;line-height:24px}.rx6zwW_progress{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:13px;font-weight:400;line-height:20px;overflow:hidden}.rx6zwW_chevron{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.rx6zwW_list{flex-direction:column;gap:8px;max-height:180px;margin:0;padding:0;list-style:none;display:flex;overflow-y:auto}.rx6zwW_item{min-width:0;color:var(--dsw-alias-label-secondary);align-items:center;gap:10px;font-size:13px;line-height:20px;display:flex}.rx6zwW_glyph{flex:none;place-items:center;width:16px;height:16px;display:grid}.rx6zwW_glyphCompleted{color:var(--dsw-alias-state-success-primary)}.rx6zwW_glyphPending{color:var(--dsw-alias-label-caption)}.rx6zwW_glyphProgress{color:var(--dsw-alias-state-business-primary);animation:1s linear infinite rx6zwW_todo-progress-spin}@keyframes rx6zwW_todo-progress-spin{to{transform:rotate(360deg)}}.rx6zwW_content{text-overflow:ellipsis;white-space:nowrap;min-width:0;overflow:hidden}",is="@deepseek-ai/dsh-client-ui-conversation/TodoPanel.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(is)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=is,e.textContent=Vo,document.head.appendChild(e)}var te={"todo-progress-spin":"rx6zwW_todo-progress-spin",glyph:"rx6zwW_glyph",content:"rx6zwW_content",header:"rx6zwW_header",title:"rx6zwW_title",item:"rx6zwW_item",chevron:"rx6zwW_chevron",glyphProgress:"rx6zwW_glyphProgress",root:"rx6zwW_root",progress:"rx6zwW_progress",body:"rx6zwW_body",lead:"rx6zwW_lead",list:"rx6zwW_list",glyphPending:"rx6zwW_glyphPending",glyphCompleted:"rx6zwW_glyphCompleted"};function $o(e){throw new Error(`unreachable todo status: ${String(e)}`)}r($o,"assertNever");function zo(){return(0,i.jsxs)("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:te.glyphCompleted,children:[(0,i.jsx)("circle",{cx:"7",cy:"7",r:"6.4",stroke:"currentColor",strokeWidth:"1.2"}),(0,i.jsx)("path",{d:"M10.9631 5.71411L7.70154 8.97571C7.48011 9.19714 7.27736 9.40099 7.09229 9.54993C6.89742 9.70669 6.66314 9.85279 6.3634 9.90027C6.2049 9.92534 6.04339 9.92534 5.88489 9.90027C5.58515 9.85279 5.35087 9.70669 5.15601 9.54993C4.97093 9.40099 4.76818 9.19714 4.54675 8.97571L3.03516 7.46411L3.96313 6.53613L5.47473 8.04773C5.7169 8.28989 5.86196 8.43389 5.97888 8.52795C6.08597 8.61409 6.10875 8.60701 6.08997 8.604C6.11259 8.60758 6.13571 8.60758 6.15833 8.604C6.13954 8.60701 6.16232 8.61409 6.26941 8.52795C6.38633 8.43389 6.53139 8.28989 6.77356 8.04773L10.0352 4.78613L10.9631 5.71411Z",fill:"currentColor"})]})}r(zo,"CompletedGlyph");function Po(){const e=(0,h.useId)();return(0,i.jsxs)("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:te.glyphProgress,children:[(0,i.jsx)("defs",{children:(0,i.jsxs)("linearGradient",{id:e,x1:"2.5",y1:"12",x2:"10.5",y2:"3.5",gradientUnits:"userSpaceOnUse",children:[(0,i.jsx)("stop",{stopColor:"currentColor"}),(0,i.jsx)("stop",{offset:"1",stopColor:"currentColor",stopOpacity:"0"})]})}),(0,i.jsx)("circle",{cx:"7",cy:"7",r:"6.4",stroke:`url(#${e})`,strokeWidth:"1.2"})]})}r(Po,"ProgressGlyph");function Zo(){return(0,i.jsx)("svg",{width:14,height:14,viewBox:"0 0 14 14",fill:"none","aria-hidden":"true",className:te.glyphPending,children:(0,i.jsx)("circle",{cx:"7",cy:"7",r:"6.4",stroke:"currentColor",strokeWidth:"1.2",strokeDasharray:"2.4 2.4"})})}r(Zo,"PendingGlyph");function Go({status:e}){switch(e){case"completed":return(0,i.jsx)(zo,{});case"in_progress":return(0,i.jsx)(Po,{});case"pending":return(0,i.jsx)(Zo,{});default:return $o(e)}}r(Go,"StatusGlyph");function Ho(e,t){const n=e.filter(a=>a.status==="completed").length,s=e.filter(a=>a.status==="in_progress").length,o=e.length-n-s;return[...n>0?[t("todo.progress.done",{done:n})]:[],...s>0?[t("todo.progress.active",{active:s})]:[],...o>0?[t("todo.progress.pending",{pending:o})]:[]].join(" · ")}r(Ho,"progressLabel");function Qo({todos:e,t}){const[n,s]=(0,h.useState)(!0);return e.length===0?null:(0,i.jsx)("section",{className:te.root,"data-testid":"todo-panel","aria-label":t("todo.title"),children:(0,i.jsxs)("div",{className:te.body,children:[(0,i.jsxs)("button",{type:"button",className:te.header,"aria-expanded":!n,onClick:r(()=>{s(o=>!o)},"onClick"),children:[(0,i.jsx)("span",{className:te.lead,"aria-hidden":!0,children:(0,i.jsx)(_.IconChecklistOutline14,{})}),(0,i.jsx)("span",{className:te.title,children:t("todo.title")}),(0,i.jsx)("span",{className:te.progress,children:Ho(e,t)}),(0,i.jsx)("span",{className:te.chevron,"aria-hidden":!0,children:n?(0,i.jsx)(_.IconChevronUpOutline14,{}):(0,i.jsx)(_.IconChevronDownOutline14,{})})]}),!n&&(0,i.jsx)("ul",{className:te.list,children:e.map(o=>(0,i.jsxs)("li",{className:te.item,"data-status":o.status,children:[(0,i.jsx)("span",{className:te.glyph,"aria-hidden":!0,children:(0,i.jsx)(Go,{status:o.status})}),(0,i.jsx)("span",{className:te.content,children:o.content})]},o.content))})]})})}r(Qo,"TodoPanel");function Jo({useProjection:e,t}){const n=e("todos");return(0,i.jsx)(Qo,{todos:n??[],t})}r(Jo,"TodoDock");const Ko={name:"conversation-todo-dock",inject:["slots"],apply(e){e.slots.inject("conversation.input.dock",()=>e.slots.register({name:"conversation.input.dock",id:"todo",order:0,locale:V},Jo))}},Yo='.D1vdvW_dock{box-sizing:border-box;width:calc(100% - var(--dsh-composer-side-clearance) - var(--dsh-composer-side-clearance) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));max-width:calc(var(--dsh-composer-card-max-width) - var(--dsh-composer-dock-inset) - var(--dsh-composer-dock-inset));margin:0 auto calc(0px - var(--dsh-composer-stack-gap) - 3px);padding:0 var(--dsh-composer-dock-inset);flex:none}.D1vdvW_panel{background:var(--dsw-specific-tip);--dsh-scrollbar-thumb:var(--dsw-alias-scrollbar-bg-l2);--dsh-scrollbar-thumb-hover:var(--dsw-alias-scrollbar-hover-l2);border-radius:12px 12px 0 0;width:100%;padding:2px 0;position:relative;overflow:hidden}.D1vdvW_panel:after{border:1px solid var(--dsw-alias-border-l1);border-radius:inherit;content:"";pointer-events:none;border-bottom:none;position:absolute;inset:0}.D1vdvW_header{box-sizing:border-box;width:100%;height:36px;color:var(--dsw-alias-label-primary);text-align:left;cursor:pointer;background:0 0;border:none;border-radius:8px;align-items:center;gap:10px;padding:4px 12px;display:flex}.D1vdvW_header:focus-visible{outline:2px solid var(--dsw-alias-label-tertiary);outline-offset:-2px}.D1vdvW_header:disabled{cursor:default}.D1vdvW_lead{color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.D1vdvW_count{min-width:0;font-family:Inter, var(--dsw-font-family);flex:auto;font-size:13px;font-weight:500;line-height:24px}.D1vdvW_chevron{width:14px;height:14px;color:var(--dsw-alias-label-tertiary);flex:none;place-items:center;display:grid}.D1vdvW_list{max-height:180px;margin:0;padding:0;list-style:none;overflow-y:auto}.D1vdvW_row{box-sizing:border-box;border-radius:8px;align-items:center;gap:10px;width:100%;height:36px;padding:4px 5px 4px 12px;display:flex}.D1vdvW_row+.D1vdvW_row{box-shadow:inset 0 1px 0 var(--dsw-alias-border-l1)}.D1vdvW_preview,.D1vdvW_editor{min-width:0;font:var(--dsw-font-xs-13);font-family:Inter, var(--dsw-font-family);flex:auto}.D1vdvW_preview{color:var(--dsw-alias-label-primary-dimmed);text-overflow:ellipsis;white-space:nowrap;word-break:break-word;overflow:hidden}.D1vdvW_editor{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);height:28px;color:var(--dsw-alias-label-primary);border-radius:6px;outline:none;padding:0 8px}.D1vdvW_editor:focus{border-color:var(--dsw-alias-state-business-primary)}.D1vdvW_actions{flex:none;align-items:center;gap:10px;display:flex}.D1vdvW_action{width:28px;height:28px;color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;padding:0;display:grid}.D1vdvW_action:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.D1vdvW_action:focus-visible{outline:2px solid var(--dsw-alias-label-tertiary);outline-offset:-2px}.D1vdvW_action:disabled{cursor:default;opacity:.45}',as="@deepseek-ai/dsh-client-ui-conversation/QueueDock.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(as)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=as,e.textContent=Yo,document.head.appendChild(e)}var Q={preview:"D1vdvW_preview",action:"D1vdvW_action",lead:"D1vdvW_lead",list:"D1vdvW_list",editor:"D1vdvW_editor",panel:"D1vdvW_panel",chevron:"D1vdvW_chevron",dock:"D1vdvW_dock",header:"D1vdvW_header",count:"D1vdvW_count",actions:"D1vdvW_actions",row:"D1vdvW_row"};function Xo({useSession:e,updateQueue:t,notify:n,t:s}){const o=e(j=>j.queue),a=(0,h.useMemo)(()=>o.filter(j=>j.placement==="queued"),[o]),l=e(j=>j.running),c=e(j=>j.subagent===null),[d,u]=(0,h.useState)(null),[f,m]=(0,h.useState)(null),[k,g]=(0,h.useState)(!0),x=(0,h.useId)();if((0,h.useEffect)(()=>{a.length===0&&!k&&g(!0),d!==null&&(!c||!a.some(j=>j.id===d.id))&&u(null)},[k,d,a,c]),a.length===0)return null;const b=c&&(d!==null||f!==null),w=!k||b,C=a.length===1||w,y=r(async(j,z,ne)=>{m(j);try{return await t(j,z),!0}catch{return n("error",ne),!1}finally{m(Ee=>Ee===j?null:Ee)}},"applyAction"),A=r(async()=>{d===null||d.text.trim()===""||await y(d.id,{kind:"edit",content:[{type:"text",text:d.text}]},s("queue.editFailed"))&&u(null)},"saveEdit");return(0,i.jsx)("div",{className:Q.dock,"data-queue-dock":"",children:(0,i.jsxs)("div",{className:Q.panel,children:[a.length>1&&(0,i.jsxs)("button",{type:"button",className:Q.header,"aria-controls":x,"aria-expanded":w,disabled:b,onClick:r(()=>{g(j=>!j)},"onClick"),children:[(0,i.jsx)("span",{className:Q.lead,"aria-hidden":!0,children:(0,i.jsx)(_.IconQueueOutline14,{})}),(0,i.jsx)("span",{className:Q.count,children:s("queue.count",{n:a.length})}),(0,i.jsx)("span",{className:Q.chevron,"aria-hidden":!0,children:w?(0,i.jsx)(_.IconChevronDownOutline14,{}):(0,i.jsx)(_.IconChevronUpOutline14,{})})]}),(0,i.jsx)("ul",{id:x,className:Q.list,hidden:!C,children:C&&a.map(j=>(0,i.jsxs)("li",{className:Q.row,children:[a.length===1&&(0,i.jsx)("span",{className:Q.lead,"aria-hidden":!0,children:(0,i.jsx)(_.IconQueueOutline14,{})}),d?.id===j.id?(0,i.jsx)("input",{autoFocus:!0,className:Q.editor,"aria-label":s("queue.edit"),value:d.text,onChange:r(z=>{u({id:j.id,text:z.currentTarget.value})},"onChange"),onKeyDown:r(z=>{if(z.key==="Escape"){u(null);return}z.key==="Enter"&&!z.nativeEvent.isComposing&&(z.preventDefault(),A())},"onKeyDown")}):(0,i.jsx)("span",{className:Q.preview,children:j.preview}),c&&(0,i.jsx)("div",{className:Q.actions,children:d?.id===j.id?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_.Tooltip,{label:s("queue.save"),side:"bottom",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:Q.action,"aria-label":s("queue.save"),disabled:f!==null||d.text.trim()==="",onClick:r(()=>{A()},"onClick"),children:(0,i.jsx)(_.IconCheckOutline16,{size:14})})}),(0,i.jsx)(_.Tooltip,{label:s("queue.cancelEdit"),side:"bottom",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:Q.action,"aria-label":s("queue.cancelEdit"),disabled:f!==null,onClick:r(()=>{u(null)},"onClick"),children:(0,i.jsx)(_.IconCloseOutline16,{size:14})})})]}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(_.Tooltip,{label:s("queue.edit"),side:"bottom",delayMs:500,disabled:j.text===null,children:(0,i.jsx)("button",{type:"button",className:Q.action,"aria-label":s("queue.edit"),title:j.text===null?s("queue.edit.unsupported"):void 0,disabled:f!==null||j.text===null,onClick:r(()=>{j.text!==null&&u({id:j.id,text:j.text})},"onClick"),children:(0,i.jsx)(_.IconEditOutline16,{size:14})})}),(0,i.jsx)(_.Tooltip,{label:s("queue.remove"),side:"bottom",delayMs:500,children:(0,i.jsx)("button",{type:"button",className:Q.action,"aria-label":s("queue.remove"),disabled:f!==null,onClick:r(()=>{y(j.id,{kind:"remove"},s("queue.removeFailed"))},"onClick"),children:(0,i.jsx)(_.IconTrashOutline16,{size:14})})}),(0,i.jsx)(_.Tooltip,{label:s("queue.steer"),side:"bottom",delayMs:500,disabled:!l,children:(0,i.jsx)("button",{type:"button",className:Q.action,"aria-label":s("queue.steer"),title:l?void 0:s("queue.steer.unavailable"),disabled:f!==null||!l,onClick:r(()=>{y(j.id,{kind:"steer"},s("queue.steerFailed"))},"onClick"),children:(0,i.jsx)(_.IconSendOutline14,{})})})]})})]},j.id))})]})})}r(Xo,"QueueDock");const ei={name:"conversation-queue-dock",inject:["slots","conversation","sessions"],apply(e){e.slots.inject("conversation.input.dock",()=>e.slots.register({name:"conversation.input.dock",id:"queue",order:20,locale:V,inject:r(t=>{const n=e.sessions.scope(t);if(n===void 0)throw new Error(`queue dock: session "${t}" resolved no scope`);const s=n.get("conversation");if(s===void 0)throw new Error("queue dock: conversation service unavailable");return{updateQueue:r((o,a)=>s.updateQueue(o,a),"updateQueue"),notify:r((o,a)=>{s.input.for(n).notify(o,a)},"notify")}},"inject")},Xo))}},ti=".cFXUsa_root{justify-content:center;align-items:center;min-width:0;height:100%;padding:0 24px;display:flex}.cFXUsa_stack{width:100%;max-width:var(--dsh-composer-card-max-width);flex-direction:column;align-items:stretch;gap:12px;display:flex;overflow:visible}.cFXUsa_headline{color:var(--dsw-alias-label-primary);grid-template-columns:34px auto auto;justify-content:center;align-items:center;column-gap:10px;font-size:26px;font-weight:500;line-height:32px;display:grid}.cFXUsa_headlineText{grid-area:1/2}.cFXUsa_previewBadge{border:1px solid var(--dsw-alias-interactive-bg-hover);background:var(--dsw-alias-state-business-tertiary);color:var(--dsw-alias-label-primary-bluish);font-family:var(--ds-font-family-code);white-space:nowrap;border-radius:24px;grid-area:1/3;align-self:start;margin-top:2px;margin-left:-3px;padding:1px 7px 0;font-size:12px;font-weight:500;line-height:18px}.cFXUsa_fishHitbox{grid-area:1/1;justify-content:center;align-items:center;display:inline-flex}.cFXUsa_fish{color:var(--dsw-alias-label-primary);transform-origin:50% 60%}@keyframes cFXUsa_hero-fish-swim{0%,to{transform:translate(0)rotate(0)}35%{transform:translate(-1px,-1px)rotate(-5deg)}70%{transform:translate(1px)rotate(3deg)}}@media (hover:hover) and (prefers-reduced-motion:no-preference){.cFXUsa_fishHitbox:hover .cFXUsa_fish{animation:cFXUsa_hero-fish-swim var(--ds-transition-duration-slow) var(--ds-ease-in-out)}}.cFXUsa_body{flex-direction:column;gap:12px;min-width:0;display:flex;position:relative;overflow:visible}.cFXUsa_body>*{z-index:1;position:relative}.cFXUsa_body>.cFXUsa_workspaceRow{z-index:10;align-items:center;min-width:0;padding-left:8px;display:flex}.cFXUsa_workspace{max-width:min(100%,360px);min-height:28px;color:var(--dsw-alias-label-primary);cursor:pointer;background:0 0;border:none;border-radius:16px;align-items:center;gap:4px;padding:0 8px;font-size:13px;font-weight:500;line-height:20px;display:inline-flex}.cFXUsa_workspace:not(:disabled):hover,.cFXUsa_workspace[aria-expanded=true]{background:var(--dsw-alias-interactive-bg-hover)}.cFXUsa_workspace:disabled{cursor:default}.cFXUsa_folder{color:var(--dsw-alias-label-primary);flex:none}.cFXUsa_workspaceLabel{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.cFXUsa_chevron{color:var(--dsw-alias-label-caption);flex:none}.cFXUsa_modalInput{box-sizing:border-box;border:1px solid var(--dsw-alias-border-l2);width:100%;height:44px;color:var(--dsw-alias-label-primary);background:0 0;border-radius:22px;outline:none;padding:7px 14px;font-size:14px;font-weight:400;line-height:22px}.cFXUsa_modalInput::placeholder{color:var(--dsw-alias-label-caption)}.cFXUsa_modalInput:disabled{color:var(--dsw-alias-label-dimmed)}.cFXUsa_modalAction{min-width:72px}.cFXUsa_modalError{color:var(--dsw-alias-state-error-primary);margin-top:8px;font-size:12px;line-height:18px}",ls="@deepseek-ai/dsh-client-ui-conversation/HeroShell.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(ls)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=ls,e.textContent=ti,document.head.appendChild(e)}var le={workspace:"cFXUsa_workspace",modalInput:"cFXUsa_modalInput",fishHitbox:"cFXUsa_fishHitbox",workspaceLabel:"cFXUsa_workspaceLabel",stack:"cFXUsa_stack","hero-fish-swim":"cFXUsa_hero-fish-swim",modalError:"cFXUsa_modalError",chevron:"cFXUsa_chevron",headlineText:"cFXUsa_headlineText",body:"cFXUsa_body",headline:"cFXUsa_headline",folder:"cFXUsa_folder",fish:"cFXUsa_fish",previewBadge:"cFXUsa_previewBadge",modalAction:"cFXUsa_modalAction",root:"cFXUsa_root",workspaceRow:"cFXUsa_workspaceRow"};function ni(e){const t=(0,O.workspaceTitleOf)(e);return t!==""?t:e}r(ni,"workspaceLabel");function si({buttonRef:e,label:t,menuOpen:n=!1,onClick:s,t:o}){return(0,i.jsxs)("button",{ref:e,type:"button",className:le.workspace,"aria-label":o("hero.chooseWorkspace"),"aria-haspopup":"menu","aria-expanded":n,onClick:s,children:[t===void 0?(0,i.jsx)(_.IconFolderClose16,{className:le.folder,size:16}):(0,i.jsx)(_.IconFolderOpen16,{className:le.folder,size:16}),(0,i.jsx)("span",{className:le.workspaceLabel,children:t??o("hero.chooseWorkspace")}),(0,i.jsx)(_.IconChevronDownOutline14,{className:le.chevron,size:12})]})}r(si,"WorkspaceChip");function ri({className:e}){const t=`empty-glow-${(0,h.useId)().replace(/:/g,"")}`;return(0,i.jsxs)("svg",{className:e,viewBox:"0 0 1051 468",fill:"none","aria-hidden":"true",children:[(0,i.jsx)("defs",{children:(0,i.jsxs)("filter",{id:t,x:"0",y:"0",width:"1051",height:"468",filterUnits:"userSpaceOnUse",colorInterpolationFilters:"sRGB",children:[(0,i.jsx)("feFlood",{floodOpacity:"0",result:"BackgroundImageFix"}),(0,i.jsx)("feBlend",{mode:"normal",in:"SourceGraphic",in2:"BackgroundImageFix",result:"shape"}),(0,i.jsx)("feGaussianBlur",{stdDeviation:"50",result:"effect1_foregroundBlur"})]})}),(0,i.jsx)("g",{filter:`url(#${t})`,children:(0,i.jsx)("ellipse",{cx:"525.5",cy:"234",rx:"425.5",ry:"134",fill:"#6187D8",fillOpacity:"0.08"})})]})}r(ri,"HeroGlow");function oi({t:e,children:t}){return(0,i.jsxs)("div",{className:le.root,children:[(0,i.jsxs)("div",{className:le.stack,children:[(0,i.jsxs)("div",{className:le.headline,children:[(0,i.jsx)("span",{className:le.fishHitbox,children:(0,i.jsx)(_.FishLogo,{size:34,className:le.fish})}),(0,i.jsx)("span",{className:le.headlineText,children:e("hero.headline")}),(0,i.jsx)("span",{className:le.previewBadge,children:e("hero.preview")})]}),(0,i.jsx)("div",{className:le.body})]}),t]})}r(oi,"HeroShell");const ii='.JQZZVW_root{background:var(--dsw-alias-bg-base);--dsh-chat-content-width:748px;--dsh-composer-card-max-width:calc(var(--dsh-chat-content-width) + 32px);--dsh-composer-side-clearance:16px;--dsh-composer-dock-inset:8px;flex-direction:column;min-width:0;height:100%;display:flex}.JQZZVW_disclaimer{width:100%;max-width:var(--dsh-chat-content-width);box-sizing:border-box;padding:0 calc(var(--dsh-composer-side-clearance) + 16px) 4px;color:var(--dsw-alias-label-tertiary);text-align:center;white-space:nowrap;text-overflow:ellipsis;flex:none;margin:0 auto;font-size:12px;line-height:20px;display:block;overflow:hidden}.JQZZVW_header{border-bottom:1px solid #0000;flex:none;padding:12px 28px 0 20px;position:relative}.JQZZVW_header:after{content:"";z-index:0;background:var(--dsw-alias-border-l2);pointer-events:none;height:1px;position:absolute;bottom:1px;left:0;right:0}.JQZZVW_headerHidden{display:none}.JQZZVW_titleRow{align-items:center;gap:0;min-height:32px;display:flex}.JQZZVW_titleCluster{flex:1;align-items:center;gap:10px;min-width:0;display:flex}.JQZZVW_crumbs{white-space:nowrap;align-items:center;gap:4px;min-width:0;display:flex;overflow:hidden}.JQZZVW_crumbSeg{align-items:center;gap:4px;min-width:0;display:inline-flex}.JQZZVW_crumbSep{color:var(--dsw-alias-label-caption);font-size:14px;line-height:20px}.JQZZVW_crumb{max-width:220px;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;cursor:pointer;background:0 0;border:none;border-radius:12px;padding:4px 8px;font-size:14px;line-height:20px;overflow:hidden}.JQZZVW_crumb:hover:not(:disabled){background:var(--dsw-alias-interactive-bg-hover)}.JQZZVW_crumbCurrent{color:var(--dsw-alias-label-primary);cursor:default;font-weight:500}.JQZZVW_headerActions{flex:none;align-items:center;gap:8px;display:flex}.JQZZVW_headerUtilities{flex:none;align-items:center;gap:8px;margin-left:20px;display:flex}.JQZZVW_headerUtilities:empty{display:none}.JQZZVW_tabs{z-index:1;gap:36px;margin-top:4px;padding-left:8px;display:flex;position:relative}.JQZZVW_tab{color:var(--dsw-alias-label-tertiary);cursor:pointer;background:0 0;border:none;padding:0 0 11px;font-size:13px;font-weight:500;line-height:16px;position:relative}.JQZZVW_tab:after{content:"";background:0 0;border-radius:2px;height:2px;position:absolute;bottom:1px;left:0;right:0}.JQZZVW_tabActive{color:var(--dsw-alias-state-business-primary)}.JQZZVW_tabActive:after{background:var(--dsw-alias-state-business-primary)}.JQZZVW_viewArea{flex-direction:column;flex:1;min-height:0;display:flex}.JQZZVW_composerStack{--dsh-composer-stack-gap:6px;gap:var(--dsh-composer-stack-gap);flex-direction:column;display:flex}.JQZZVW_composerSeat{--dsh-composer-text-max-height:336px;flex-direction:column;flex:none;display:flex}.JQZZVW_root[data-phase=active]{overflow:hidden}.JQZZVW_root[data-phase=active] .JQZZVW_header{flex:none}.JQZZVW_scrollBody{scrollbar-gutter:stable;flex-direction:column;flex:1;min-height:0;display:flex;overflow:hidden auto}.JQZZVW_root[data-phase=active] .JQZZVW_viewArea{flex:1 0 auto;min-height:auto}.JQZZVW_root[data-phase=active] .JQZZVW_composerSeat{z-index:7;background:linear-gradient(180deg, color-mix(in srgb, var(--dsw-alias-bg-base) 0%, transparent) 0px, var(--dsw-alias-bg-base) 36px);position:sticky;bottom:0}.JQZZVW_scrollBody:has([data-conversation-composer-overlay]){scrollbar-gutter:auto;position:relative;overflow:hidden auto}.JQZZVW_scrollBody:has([data-conversation-composer-overlay])>[data-slot=conversation\\.session]>.JQZZVW_viewArea{flex:1 1 0;min-height:0;overflow:hidden}.JQZZVW_scrollBody:has([data-conversation-composer-overlay])>.JQZZVW_composerSeat{right:var(--dsh-scrollbar-width);position:absolute;bottom:0;left:0}.JQZZVW_composerHero{width:min(calc(var(--dsh-composer-card-max-width) + 2 * var(--dsh-composer-side-clearance)), 100%);z-index:1;align-self:center;gap:8px;padding-bottom:32px;position:relative}.JQZZVW_heroGlow{z-index:-1;aspect-ratio:1051/468;pointer-events:none;width:135.438%;position:absolute;bottom:92px;left:50%;transform:translate(-50%,50%)}.JQZZVW_heroWorkspaceRow{align-items:center;gap:2px;min-width:0;margin-top:4px;padding-left:20px;display:flex}.JQZZVW_root[data-phase=hero] .JQZZVW_scrollBody{justify-content:center;overflow-y:auto}.JQZZVW_root[data-phase=settling] .JQZZVW_composerSeat{visibility:hidden}',cs="@deepseek-ai/dsh-client-ui-conversation/ConversationRoot.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(cs)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=cs,e.textContent=ii,document.head.appendChild(e)}var $={tabActive:"JQZZVW_tabActive",viewArea:"JQZZVW_viewArea",header:"JQZZVW_header",crumbCurrent:"JQZZVW_crumbCurrent",titleCluster:"JQZZVW_titleCluster",crumbSep:"JQZZVW_crumbSep",heroGlow:"JQZZVW_heroGlow",crumb:"JQZZVW_crumb",composerStack:"JQZZVW_composerStack",crumbs:"JQZZVW_crumbs",disclaimer:"JQZZVW_disclaimer",composerSeat:"JQZZVW_composerSeat",headerHidden:"JQZZVW_headerHidden",headerUtilities:"JQZZVW_headerUtilities",heroWorkspaceRow:"JQZZVW_heroWorkspaceRow",composerHero:"JQZZVW_composerHero",crumbSeg:"JQZZVW_crumbSeg",root:"JQZZVW_root",tab:"JQZZVW_tab",scrollBody:"JQZZVW_scrollBody",headerActions:"JQZZVW_headerActions",titleRow:"JQZZVW_titleRow",tabs:"JQZZVW_tabs"};function ai({sessionId:e,useSession:t,useSessions:n,useWorkspaces:s,useInput:o,useComposerBlock:a,renderSlot:l,renderSlotChain:c,selectWorkspace:d,t:u}){const f=t(E=>E.openState),m=t(E=>E.composerPhase),k=t(E=>E.pending)??[],g=t(E=>E),x=o(E=>E),b=n(E=>e===void 0?void 0:E.byId[e]?.cwd),w=n(E=>e===void 0?void 0:E.byId[e]?.blank),C=s(E=>E),y=a(E=>E),[A,j]=(0,h.useState)(!1),[z,ne]=(0,h.useState)(),Ee=(0,h.useRef)(null),he=(0,h.useRef)(null),He=(0,h.useCallback)(E=>{he.current?.disconnect(),he.current=null;const D=E?.parentElement??null;E===null||D===null||(he.current=new ResizeObserver(()=>{D.style.setProperty("--dsh-composer-height",`${E.offsetHeight}px`)}),he.current.observe(E))},[]),X=e===void 0?void 0:C.items.find(E=>E.sessionIds.includes(e)),Re=C.items.find(E=>E.workspaceId===z);(0,h.useEffect)(()=>{z!==void 0&&(X?.workspaceId===z||C.phase==="ready"&&Re===void 0)&&ne(void 0)},[z,X?.workspaceId,C.phase,Re]);const be=e!==void 0&&m==="blank"&&f==="loading"&&w!==!0,U=e===void 0||m==="blank"&&(f==="open"||w===!0),Y=g===void 0||x===void 0?void 0:{session:g,input:x},me=Re?.title??(e===void 0?void 0:X?.title??(C.phase==="ready"||b===void 0||b===""?void 0:ni(b))),se=(0,i.jsxs)("div",{className:$.heroWorkspaceRow,children:[(0,i.jsx)(si,{buttonRef:Ee,label:me,menuOpen:A,onClick:r(()=>{j(E=>!E)},"onClick"),t:u}),l("conversation.hero.workspace",{open:A,anchorRef:Ee,selectedId:z??X?.workspaceId,onPick:r(E=>{j(!1),ne(E),d(E).catch(()=>{ne(D=>D===E?void 0:D)})},"onPick"),onClose:r(()=>{j(!1)},"onClose")}),l("conversation.hero.agentPreset",{})]}),ee=e===void 0||U&&me===void 0,Ne=l("conversation.composer.bar",{variant:U?"hero":"composer",...ee?{disabled:!0,placeholder:u("placeholder.workspace"),workspacePickerOpen:A,onRequestWorkspace:r(()=>{j(!0)},"onRequestWorkspace")}:!ee&&y!==void 0?{blocked:y,placeholder:y.reason}:U?{placeholder:u("placeholder.hero")}:{},overlay:l("conversation.input.overlay",{}),leftItems:Y===void 0?null:l("conversation.input.left",Y),rightItems:Y===void 0?null:l("conversation.input.right",Y),footer:!U&&Y!==void 0?l("conversation.composer.dock",Y):null}),pe=(0,i.jsxs)("div",{className:Ce($.composerStack,U&&$.composerHero),children:[U&&(0,i.jsx)(ri,{className:$.heroGlow}),U&&(0,i.jsx)(oi,{t:u}),U&&se,Y!==void 0&&l("conversation.input.dock",Y),Ne]}),fe=be?"settling":U?"hero":"active",De=c("conversation.composer",{interactions:k,session:g},{fallback:pe,overlay:!0}),Qe=(0,i.jsx)("div",{ref:He,className:$.composerSeat,"data-composer-seat":"",children:De});return(0,i.jsxs)("div",{className:$.root,"data-phase":fe,children:[l("conversation.session.header",{}),(0,i.jsxs)("div",{className:$.scrollBody,"data-conversation-scroll":"",children:[l("conversation.session",{}),Qe]}),(0,i.jsx)("div",{className:$.disclaimer,"data-ai-disclaimer":!0,children:u("disclaimer")})]})}r(ai,"ConversationRoot");const ds="chat";function us(e,t){const n=t??ds;return e.find(s=>s.id===n)??e.find(s=>s.id===ds)}r(us,"resolveActiveView");function li(e,t){const n=[],s=new Set;let o=t;for(;o!==void 0&&!s.has(o);){s.add(o);const a=e.byId[o];if(a===void 0||(n.unshift({id:a.id,displayTitle:a.displayTitle}),a.origin!=="subagent"))break;o=a.parentId}return n}r(li,"deriveAncestry");function ci(e,t){return e.length===t.length&&e.every((n,s)=>{const o=t.at(s);return o!==void 0&&n.id===o.id&&n.displayTitle===o.displayTitle})}r(ci,"equalBreadcrumbs");function di({sessionId:e,useSession:t,useSessions:n,useStore:s,actions:o,renderSlot:a,views:l,open:c,t:d}){(0,h.useSyncExternalStore)(l.subscribe,l.version);const u=l.list(),f=us(u,s(x=>x.view)),m=n(x=>li(x,e),ci),k=t(x=>x.composerPhase),g=t(x=>x.blank)&&k==="blank";return(0,i.jsx)("header",{className:Ce($.header,g&&$.headerHidden),"aria-hidden":g||void 0,children:!g&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:$.titleRow,children:[(0,i.jsxs)("div",{className:$.titleCluster,children:[(0,i.jsxs)("nav",{className:$.crumbs,"aria-label":d("session.hierarchy"),children:[m.map((x,b)=>{const w=b===m.length-1;return(0,i.jsxs)("span",{className:$.crumbSeg,children:[b>0&&(0,i.jsx)("span",{className:$.crumbSep,children:"/"}),(0,i.jsx)("button",{type:"button",className:Ce($.crumb,w&&$.crumbCurrent),disabled:w,onClick:r(()=>{c(x.id)},"onClick"),children:x.displayTitle})]},x.id)}),m.length===0&&(0,i.jsx)("span",{className:$.crumbCurrent,children:e})]}),(0,i.jsx)("div",{className:$.headerActions,children:a("conversation.session.header.actions",{})})]}),(0,i.jsx)("div",{className:$.headerUtilities,children:a("conversation.session.header.utilities",{})})]}),u.length>1&&(0,i.jsx)("div",{className:$.tabs,role:"tablist",children:u.map(x=>(0,i.jsx)("button",{type:"button",role:"tab","aria-selected":x.id===f?.id,className:Ce($.tab,x.id===f?.id&&$.tabActive),onClick:r(()=>{o.setView(x.id)},"onClick"),children:x.label},x.id))})]})})}r(di,"ConversationSessionHeader");function ui({sessionId:e,useSession:t,useInput:n,inputActions:s,useStore:o,actions:a,renderSlot:l,views:c,bindDraftMirror:d,releaseSessionImages:u}){(0,h.useSyncExternalStore)(c.subscribe,c.version);const f=us(c.list(),o(w=>w.view)),m=t(w=>w.composerPhase),k=t(w=>w.blank),g=n(w=>w),x=o(w=>w.draft),b=o(w=>w.inspect??null);return(0,h.useEffect)(()=>{g.draft===""&&x!==""&&s.setDraft(x);const w=d(a.setDraft);return()=>{w()}},[s]),(0,h.useEffect)(()=>()=>{u(e)},[u,e]),k&&m==="blank"?null:(0,i.jsx)("div",{className:$.viewArea,children:f!==void 0&&l("conversation.view",{inspect:b,onInspectDone:r(()=>{a.setInspect(null)},"onInspectDone")},{only:f.id})})}r(ui,"ConversationSession");const pi=".gSc0EW_root{border-left:1px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);flex-direction:column;min-width:0;height:100%;display:flex}.gSc0EW_header{border-bottom:1px solid var(--dsw-alias-border-l2);justify-content:space-between;align-items:center;gap:8px;padding:14px 12px 12px;display:flex}.gSc0EW_title{color:var(--dsw-alias-label-primary);text-overflow:ellipsis;white-space:nowrap;font-size:14px;font-weight:500;line-height:20px;overflow:hidden}.gSc0EW_close{width:28px;height:28px;color:var(--dsw-alias-label-secondary);cursor:pointer;background:0 0;border:none;border-radius:999px;flex:none;place-items:center;display:grid}.gSc0EW_close:hover{background:var(--dsw-alias-interactive-bg-hover)}.gSc0EW_body{flex:1;min-height:0;padding:12px 16px;overflow-y:auto}.gSc0EW_empty{color:var(--dsw-alias-label-tertiary);padding:8px 0;font-size:13px;line-height:20px}.gSc0EW_section{margin-bottom:16px}.gSc0EW_sectionLabel{color:var(--dsw-alias-label-secondary);margin-bottom:6px;font-size:12px;font-weight:500;line-height:18px}.gSc0EW_code{background:var(--dsw-alias-markdown-code-block);font-family:var(--ds-font-family-code);color:var(--dsw-alias-label-primary);white-space:pre-wrap;word-break:break-word;border-radius:12px;margin:0;padding:16px;font-size:13px;line-height:22px}.gSc0EW_code[data-error]{color:var(--dsw-alias-state-error-primary)}",ps="@deepseek-ai/dsh-client-ui-conversation/DetailsPanel.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(ps)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=ps,e.textContent=pi,document.head.appendChild(e)}var ce={title:"gSc0EW_title",header:"gSc0EW_header",close:"gSc0EW_close",code:"gSc0EW_code",section:"gSc0EW_section",sectionLabel:"gSc0EW_sectionLabel",empty:"gSc0EW_empty",body:"gSc0EW_body",root:"gSc0EW_root"};function hi(e,t){return{name:e.call?.name??t,argsRaw:e.call?.argsRaw??null,block:e}}r(hi,"settledMaterial");function mi(e){return{name:e.name,argsRaw:e.argsRaw,block:e}}r(mi,"runningMaterial");function fi(e,t){const n=Mo(e,t);return n===void 0?null:"kind"in n?hi(n,t):mi(n)}r(fi,"materialFor");function gi(e){try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}r(gi,"pretty");function vi(e){if(!("kind"in e))return"";const t=e.content.map(n=>n.type==="text"?n.text:JSON.stringify(n,null,2));return t.length===0&&e.error!==void 0&&t.push(`${e.error.name}: ${e.error.code}`),t.join(`
5
+ `)}r(vi,"rawResultText");function xi({useSession:e,useSessions:t,sessionId:n,useStore:s,renderSlot:o,closeDetails:a,t:l}){const c=s(m=>m.selection),d=t(m=>m.byId[n]?.cwd),u=c?.callId,f=e(m=>u===void 0?null:fi(m,u),(m,k)=>(0,O.shallowEqual)(m,k));return(0,i.jsxs)("div",{className:ce.root,children:[(0,i.jsxs)("div",{className:ce.header,children:[(0,i.jsx)("div",{className:ce.title,children:c===null?l("details.title"):f?.name??c.toolName??l("details.title")}),(0,i.jsx)("button",{type:"button",className:ce.close,"aria-label":l("details.close"),onClick:r(()=>{a()},"onClick"),children:(0,i.jsx)("svg",{viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":!0,children:(0,i.jsx)("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})})]}),(0,i.jsx)("div",{className:ce.body,children:c===null||u===void 0?(0,i.jsx)("div",{className:ce.empty,children:l("details.empty")}):f===null?(0,i.jsx)("div",{className:ce.empty,children:l("details.notInWindow")}):(0,i.jsxs)(i.Fragment,{children:[f.argsRaw!==null&&(0,i.jsxs)("section",{className:ce.section,children:[(0,i.jsx)("div",{className:ce.sectionLabel,children:l("details.input")}),(0,i.jsx)(_.CodeBlock,{code:gi(f.argsRaw),lang:"json",copyLabel:l("copy"),copiedLabel:l("copied")})]}),(0,i.jsxs)("section",{className:ce.section,children:[(0,i.jsx)("div",{className:ce.sectionLabel,children:l("details.output")}),(0,i.jsx)(h.Fragment,{children:o("conversation.details.tool",{block:f.block,cwd:d},{fallback:"kind"in f.block?(0,i.jsx)("pre",{className:ce.code,"data-error":f.block.isError||void 0,children:vi(f.block)}):(0,i.jsx)("div",{className:ce.empty,children:l("details.running")})})},u)]})]})})]})}r(xi,"DetailsPanel");const it={interruptedAssistant:-.9,interruptedFollowup:-.8,maxTokensNotice:.05,finalizedFollowup:.1};function yi(e){return e.start?.location??e.matches[0]?.location??{kind:"unresolved"}}r(yi,"contextLocation");function ue(e,t,n,s,o={}){return{key:e.key,kind:t,id:e.id,target:"chat",anchorSeq:n,location:o.location??yi(e),visibility:o.visibility??"visible",data:s}}r(ue,"chatNode");function vt(e,t){return{turn:e,step:t,blocks:[],firstVisibleSeq:void 0,firstVisibleTime:void 0,firstTokenTime:void 0,hidden:!1,final:void 0,usage:void 0}}r(vt,"initialState");function Ot(e){return e.filter(t=>t!==void 0)}r(Ot,"compactBlocks");function hs(e){return e.some(t=>t.kind==="tool-call"?!1:t.kind==="text"||t.kind==="reasoning"?t.text.trim()!=="":!0)}r(hs,"hasVisibleContent");function bi(e){return e.some(t=>t.kind==="text"||t.kind==="reasoning"?t.text.trim()!=="":!0)}r(bi,"hasInterruptionEvidence");function ms(e){return{...vt(e.turn,e.step),firstTokenTime:e.firstTokenTime,hidden:!0}}r(ms,"resetForRetry");function fs(e,t){if(t.event.type!=="assistant/chunk")return e;const n=t.event.data.chunk,s=[...e.blocks];switch(n.type){case"block-start":s[n.index]=(0,O.emptyAssistantBlock)(n.blockType);break;case"text-delta":{const l=s[n.index];s[n.index]={kind:"text",text:(l?.kind==="text"?l.text:"")+n.text};break}case"reasoning-delta":{const l=s[n.index];s[n.index]={kind:"reasoning",text:(l?.kind==="reasoning"?l.text:"")+n.text};break}case"tool-call-delta":{const l=s[n.index],c=l?.kind==="tool-call"?l:{kind:"tool-call",callId:"",name:"",argsRaw:""};s[n.index]={kind:"tool-call",callId:c.callId||String(n.id),name:n.name??c.name,argsRaw:c.argsRaw+n.argumentsDelta};break}case"block-end":s[n.index]=(0,O.toAssistantBlock)(n.block);break;case"usage":return{...e,usage:n.usage};default:return e}const o=hs(Ot(s)),a=(0,O.isTokenDelta)(n);return{...e,blocks:s,hidden:o?!1:e.hidden,...o&&e.firstVisibleSeq===void 0?{firstVisibleSeq:t.event.seq,firstVisibleTime:t.event.time}:{},...a&&e.firstTokenTime===void 0?{firstTokenTime:t.event.time}:{}}}r(fs,"updateChunk");function wi(e){if(e.kind==="step"&&e.step.status==="closed"&&e.step.end!==void 0)return e.step.end;if((e.kind==="step"||e.kind==="turn")&&e.turn.status==="closed"&&e.turn.end!==void 0)return e.turn.end}r(wi,"closedBoundary");function ki(e,t){const n=e.final;if(n?.event.type==="assistant/message"){const l=n.event;return{kind:"assistant",seq:l.seq,messageId:l.data.message.id,time:l.time,turn:e.turn,step:e.step,blocks:(0,O.toAssistantBlocks)(l.data.message.content),usage:l.data.usage,timing:{stepStartTime:t.start?.event.time??null,firstTokenTime:e.firstTokenTime??null,completedTime:l.time}}}const s=t.start?.location??t.matches.at(-1)?.location,o=s===void 0?void 0:wi(s),a=Ot(e.blocks);if(!(o===void 0||!bi(a)))return{kind:"assistant",seq:o.seq+it.interruptedAssistant,time:o.time,turn:e.turn,step:e.step,blocks:a,interrupted:!0}}r(ki,"finalNode");function gs(e){let t;for(const n of e.matches){if(n.event.type==="assistant/chunk"){t??=vt(n.event.data.turn,n.event.data.step),t=fs(t,n);continue}if(n.event.type==="assistant/message"){t??=vt(n.event.data.turn,n.event.data.step),t={...t,blocks:(0,O.toAssistantBlocks)(n.event.data.message.content),hidden:!1,final:n,usage:n.event.data.usage};continue}n.event.type==="llm/retry"&&t!==void 0&&(t=ms(t))}return t}r(gs,"fallbackState$4");function vs(e){const t=e.state??gs(e);if(t===void 0)return;const n=ki(t,e),s=n?.blocks??Ot(t.blocks),o=hs(s),a=n?.interrupted===!0?"interrupted":n===void 0?"running":"settled",l=n?.seq??t.firstVisibleSeq??e.matches[0]?.event.seq??0,c=n?.time??t.firstVisibleTime??e.matches[0]?.event.time??0;return{anchorSeq:l,visible:o,settled:n,data:{status:a,turn:t.turn,step:t.step,blocks:s,time:c,...t.usage===void 0?{}:{usage:t.usage},...n===void 0?{}:{finalNode:n}}}}r(vs,"projectAssistant");const _i={kind:"assistant-step",target:"chat",match:r(e=>e.type==="step/start"?{id:`${e.data.turn}:${e.data.step}`,role:"start"}:e.type==="assistant/chunk"||e.type==="assistant/message"&&(0,O.isAppendSurfaceEvent)(e)?{id:`${e.data.turn}:${e.data.step}`,role:"update"}:e.type==="llm/retry"?{id:`${e.data.turn}:${e.data.step}`,role:"update"}:null,"match"),start:r((e,t)=>{if(t.event.type!=="step/start")throw new Error("assistant-step start requires step/start");return vt(t.event.data.turn,t.event.data.step)},"start"),update:r((e,t)=>t.event.type==="assistant/chunk"?fs(e.state,t):t.event.type==="assistant/message"?{...e.state,blocks:(0,O.toAssistantBlocks)(t.event.data.message.content),hidden:!1,final:t,usage:t.event.data.usage}:t.event.type==="llm/retry"?ms(e.state):e.state,"update"),publication:r(e=>{if(e.event.type==="step/start")return"none";if(e.event.type!=="assistant/chunk")return"immediate";const t=e.event.data.chunk.type;return t==="usage"||t==="finish"?"none":"animation-frame"},"publication"),buildLocationData:r((e,t)=>{if(t!=="step")return null;const n=vs(e);return n===void 0?null:{kind:"step",turn:n.data.turn,step:n.data.step,key:"assistant-step",value:n.data}},"buildLocationData"),buildViewNode:r(e=>{const t=vs(e);if(t===void 0)return null;if(t.settled===void 0&&!t.visible){const n=e.state??gs(e);if(n===void 0)return null;const s=e.current.get("chat");if(!n.hidden||s===void 0||s===null)return null}return ue(e,"assistant-step",t.anchorSeq,t.data,{visibility:t.settled?.interrupted===!0||t.visible?"visible":"hidden"})},"buildViewNode")};function Ai(e){e.conversationEvents.register(_i)}r(Ai,"registerAssistantConversationNode");function ji(e){return"kind"in e}r(ji,"isSettledTool");function Si(e){return!ji(e)}r(Si,"isRunningTool");const at=[],Ci=[],Te=[];function Ze(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}r(Ze,"sameReferences$1");var Wi=class{static{r(this,"MutableChatNodeStore")}byKey=new Map;valuesCache=Te;valuesDirty=!1;get(e){return this.byKey.get(e)}values(){return this.valuesDirty&&(this.valuesCache=[...this.byKey.values()],this.valuesDirty=!1),this.valuesCache}replace(e){this.byKey.clear();for(const t of e)this.byKey.set(t.key,t);this.valuesCache=[...this.byKey.values()],this.valuesDirty=!1}upsert(e){let t=!1;for(const n of e)this.byKey.get(n.key)!==n&&(this.byKey.set(n.key,n),t=!0);t&&(this.valuesDirty=!0)}},Ti=class{static{r(this,"MutableChatLocationIndex")}turns=new Map;steps=new Map;getTurn(e){return this.turns.get(e)??at}getStep(e,t){return this.steps.get(Bt(e,t))??at}rebuild(e,t){const n=new Map,s=new Map;for(const o of e){const a=t.get(o)?.location;if(a===void 0)continue;const l=Ft(a);if(l.turn===void 0)continue;const c=n.get(l.turn)??[];if(c.push(o),n.set(l.turn,c),l.step===void 0)continue;const d=Bt(l.turn,l.step),u=s.get(d)??[];u.push(o),s.set(d,u)}this.turns=xs(this.turns,n),this.steps=xs(this.steps,s)}touch(e){const t=new Set,n=new Set;for(const s of e){const o=Ft(s.location);o.turn===void 0||!this.turns.get(o.turn)?.includes(s.key)||(t.add(o.turn),o.step!==void 0&&n.add(Bt(o.turn,o.step)))}for(const s of t){const o=this.turns.get(s);o!==void 0&&this.turns.set(s,[...o])}for(const s of n){const o=this.steps.get(s);o!==void 0&&this.steps.set(s,[...o])}}};function xs(e,t){const n=new Map,s=new Set([...e.keys(),...t.keys()]);for(const o of s){const a=e.get(o)??at,l=t.get(o)??at,c=Ze(a,l)?a:l;l.length>0&&n.set(o,c)}return n}r(xs,"updateIndex");function Bt(e,t){return`${e}:${t}`}r(Bt,"stepKey");function Ft(e){return e.kind==="step"?{turn:e.turn.turn,step:e.step.step}:e.kind==="turn"?{turn:e.turn.turn}:{}}r(Ft,"locationCoordinates");function ys(e){return e.filter(t=>t.visibility==="visible").sort((t,n)=>t.anchorSeq-n.anchorSeq||t.key.localeCompare(n.key))}r(ys,"orderedVisible");const xt={anchorSeq:0,nodes:Te,partial:null,running:null};function bs(e){const t=e;if(e.visibility!=="visible"&&t.kind!=="assistant-step")return xt;switch(t.kind){case"user":case"steering":case"context":case"command":case"compaction":case"turn-error":case"turn-max-tokens":case"unknown":return{anchorSeq:t.anchorSeq,nodes:[t.data],partial:null,running:null};case"assistant-step":{const n=t.data;return n.status==="running"?e.visibility!=="visible"?xt:{anchorSeq:t.anchorSeq,nodes:Te,partial:{turn:n.turn,step:n.step,blocks:n.blocks},running:null}:{anchorSeq:t.anchorSeq,nodes:n.finalNode===void 0?Te:[n.finalNode],partial:null,running:null}}case"tool-call":{const n=t.data.root;return Si(n)?{anchorSeq:t.anchorSeq,nodes:Te,partial:null,running:n}:{anchorSeq:t.anchorSeq,nodes:[n],partial:null,running:null}}case"manual-compaction":{const n=t.data;return{anchorSeq:t.anchorSeq,nodes:n.compaction===null?[n.command]:[n.command,n.compaction],partial:null,running:null}}case"model-retry":return{anchorSeq:t.anchorSeq,nodes:t.data.attempts,partial:null,running:null};case"turn-tail":return xt;default:return xt}}r(bs,"legacyContribution");function Ei(e,t){return e!==void 0&&e.anchorSeq===t.anchorSeq&&e.partial?.blocks===t.partial?.blocks&&e.partial?.turn===t.partial?.turn&&e.partial?.step===t.partial?.step&&e.running===t.running&&Ze(e.nodes,t.nodes)}r(Ei,"sameContribution");var Ni=class{static{r(this,"LegacySliceBuilder")}contributions=new Map;finalizedContributions=new Map;runningContributions=new Map;partialContributions=new Map;finalized=Te;runningCalls=Te;partial=null;timeline;turnTimings=new Map;turnEnds=new Map;replace(e,t){this.contributions.clear(),this.finalizedContributions.clear(),this.runningContributions.clear(),this.partialContributions.clear();for(const n of e){const s=bs(n);this.contributions.set(n.key,s),this.indexContribution(n.key,s)}return this.rebuildFinalized(),this.rebuildRunning(),this.rebuildPartial(),this.updateTimeline(t),this.snapshot()}apply(e,t){let n=!1,s=!1,o=!1;for(const a of e){const l=bs(a),c=this.contributions.get(a.key);Ei(c,l)||(n||=qi(c,l),s||=Ii(c,l),o||=Li(c,l),this.contributions.set(a.key,l),this.indexContribution(a.key,l))}return n&&this.rebuildFinalized(),s&&this.rebuildRunning(),o&&this.rebuildPartial(),this.updateTimeline(t),this.snapshot()}indexContribution(e,t){Vt(this.finalizedContributions,e,t,t.nodes.length>0),Vt(this.runningContributions,e,t,t.running!==null),Vt(this.partialContributions,e,t,t.partial!==null)}rebuildFinalized(){const e=[...this.finalizedContributions.values()].flatMap(t=>t.nodes).sort((t,n)=>t.seq-n.seq);Ze(this.finalized,e)||(this.finalized=e)}rebuildRunning(){const e=[...this.runningContributions.values()].sort((t,n)=>t.anchorSeq-n.anchorSeq).flatMap(t=>t.running===null?[]:[t.running]);Ze(this.runningCalls,e)||(this.runningCalls=e)}rebuildPartial(){const e=[...this.partialContributions.values()].sort((t,n)=>t.anchorSeq-n.anchorSeq).findLast(t=>t.partial!==null)?.partial??null;(this.partial?.blocks!==e?.blocks||this.partial?.turn!==e?.turn||this.partial?.step!==e?.step)&&(this.partial=e)}updateTimeline(e){if(this.timeline===e)return;this.timeline=e;const t=new Map,n=new Map;for(const s of e.turns.values())s.start!==void 0&&t.set(s.turn,{startTime:s.start.time,...s.end===void 0?{}:{endTime:s.end.time}}),s.end!==void 0&&n.set(s.turn,s.end.seq);this.turnTimings=t,this.turnEnds=n}snapshot(){return{nodes:this.finalized,turnTimings:this.turnTimings,turnEnds:this.turnEnds,partial:this.partial,runningCalls:this.runningCalls}}};function Vt(e,t,n,s){s?e.set(t,n):e.delete(t)}r(Vt,"updateContributionIndex");function qi(e,t){const n=e?.nodes??Te;return!Ze(n,t.nodes)||(n.length>0||t.nodes.length>0)&&e?.anchorSeq!==t.anchorSeq}r(qi,"finalizedContributionChanged");function Ii(e,t){return e?.running!==t.running||(e.running!==null||t.running!==null)&&e.anchorSeq!==t.anchorSeq}r(Ii,"runningContributionChanged");function Li(e,t){return e?.partial?.blocks!==t.partial?.blocks||e?.partial?.turn!==t.partial?.turn||e?.partial?.step!==t.partial?.step||((e?.partial??null)!==null||t.partial!==null)&&e?.anchorSeq!==t.anchorSeq}r(Li,"partialContributionChanged");var Mi=class{static{r(this,"ChatSnapshotBuilder")}store=new Wi;locations=new Ti;legacy=new Ni;order=at;empty;constructor(){this.empty=this.snapshot({turnOrder:Ci,turns:new Map})}replace(e){return this.store.replace(e.nodes),this.order=ys(e.nodes).map(t=>t.key),this.locations.rebuild(this.order,this.store),this.snapshot(e.timeline,this.legacy.replace(e.nodes,e.timeline))}apply(e){let t=!1;const n=[];for(const s of e.upserts){const o=this.store.get(s.key),a=o===void 0||o.anchorSeq!==s.anchorSeq||o.visibility!==s.visibility||ws(o.location)!==ws(s.location);t||=a,a||n.push(s)}if(this.store.upsert(e.upserts),t){const s=ys(this.store.values()).map(o=>o.key);this.order=Ze(this.order,s)?this.order:s,this.locations.rebuild(this.order,this.store)}return this.locations.touch(n),this.snapshot(e.timeline,this.legacy.apply(e.upserts,e.timeline))}snapshot(e,t=this.legacy.replace(Te,e)){return{order:this.order,nodes:this.store,locations:this.locations,timeline:e,legacy:t}}};function ws(e){const t=Ft(e);return`${e.kind}:${t.turn??""}:${t.step??""}`}r(ws,"locationIdentity");const Ri={target:"chat",create:r(()=>new Mi,"create")};function Di(e){e.conversationViews.register(Ri)}r(Di,"registerChatConversationView");const Ui="compact";function Oi(e){if(e.event.type!=="command/run")throw new Error("command start requires command/run");const t=e.event.data;return{kind:"command",seq:e.event.seq,time:e.event.time,commandId:t.commandId,name:t.name,args:t.args??null,outcome:null}}r(Oi,"commandFromRun");function yt(e,t){if(e.event.type!=="command/done")throw new Error("command update requires command/done");const n=e.event.data,s=n.kind==="success"&&n.sourceEventSeq!==void 0&&Number.isSafeInteger(n.sourceEventSeq)&&n.sourceEventSeq>=0?n.sourceEventSeq:void 0;return{kind:"command",seq:t?.seq??e.event.seq,time:t?.time??e.event.time,commandId:n.commandId,name:t?.name??null,args:t?.args??null,outcome:{kind:n.kind,...n.text===void 0?{}:{text:n.text},...s===void 0?{}:{sourceEventSeq:s}}}}r(yt,"commandFromDone");function Ge(e){if(e.type!=="user/message"||!(0,O.isReplacementSurfaceEvent)(e))return;const t=e.data.source;if(!(t.kind!=="plugin"||t.plugin!==Ui||typeof t.compactionId!="string"))return{compactionId:t.compactionId,...t.sourceCommandId===void 0?{}:{sourceCommandId:t.sourceCommandId}}}r(Ge,"compactSource");function ks(e,t){let n=null,s=null,o=null;if(e?.event.type==="compaction/summary"){const a=e.event.data;if(Array.isArray(a.summary)){const l=a.summary.map(c=>c.type==="text"?c.text:"").join("");n=l.trim()===""?null:l}s=Array.isArray(a.shadowedSeqs)&&a.shadowedSeqs.every(l=>Number.isSafeInteger(l)&&l>=0)?a.shadowedSeqs.length:null,o=Number.isSafeInteger(a.shadowedTokenCount)&&a.shadowedTokenCount>=0?a.shadowedTokenCount:null}return{kind:"compaction",seq:t.event.seq,time:t.event.time,summary:n,summaryEventSeq:e?.event.seq??null,shadowedItemCount:s,shadowedTokenCount:o}}r(ks,"compactSummary");function Bi(e){const t=e.matches.find(a=>a.event.type==="command/done"),n=e.matches.find(a=>Ge(a.event)!==void 0),s=e.matches.find(a=>a.event.type==="compaction/summary");if(n===void 0)return t===void 0?void 0:{command:yt(t)};const o=Ge(n.event);return o?.sourceCommandId===void 0?t===void 0?void 0:{command:yt(t)}:{command:t===void 0?{kind:"command",seq:n.event.seq,time:n.event.time,commandId:o.sourceCommandId,name:"compact",args:null,outcome:null}:{...yt(t),name:"compact"},checkpoint:n,...s===void 0?{}:{summary:s}}}r(Bi,"fallbackState$3");function _s(e,t){return t.event.type==="compaction/summary"?{...e,summary:t}:Ge(t.event)!==void 0?{...e,checkpoint:t}:e}r(_s,"updateCompactionState");const Fi={kind:"command",target:"chat",match:r(e=>{if(e.type==="command/run")return{id:String(e.data.commandId),role:"start"};if(e.type==="command/done")return{id:String(e.data.commandId),role:"update"};const t=Ge(e);return t?.sourceCommandId!==void 0?{id:String(t.sourceCommandId),role:"update"}:(e.type==="compaction/start"||e.type==="compaction/summary"||e.type==="compaction/end")&&e.data.sourceCommandId!==void 0?{id:String(e.data.sourceCommandId),role:"update"}:null},"match"),start:r((e,t)=>({command:Oi(t)}),"start"),update:r((e,t)=>t.event.type==="command/done"?{...e.state,command:yt(t,e.state.command)}:_s(e.state,t),"update"),buildViewNode:r(e=>{const t=e.state??Bi(e);if(t===void 0)return null;if(t.command.name!=="compact")return ue(e,"command",t.command.seq,t.command);const n=t.checkpoint===void 0?null:ks(t.summary,t.checkpoint),s={command:t.command,compaction:n};return ue(e,"manual-compaction",n?.seq??t.command.seq,s)},"buildViewNode")};function Vi(e){e.conversationEvents.register(Fi)}r(Vi,"registerCommandConversationNode");function $i(e){const t=e.matches.find(s=>s.event.type==="compaction/summary"),n=e.matches.find(s=>Ge(s.event)!==void 0);return{...t===void 0?{}:{summary:t},...n===void 0?{}:{checkpoint:n}}}r($i,"fallbackState$2");const zi={kind:"compaction",target:"chat",match:r(e=>{const t=Ge(e);if(t!==void 0&&t.sourceCommandId===void 0)return{id:t.compactionId,role:"update"};if(e.type==="compaction/start"||e.type==="compaction/summary"||e.type==="compaction/end"){if(e.data.sourceCommandId!==void 0)return null;const n=e.data.compactionId;return typeof n!="string"||n===""?null:{id:n,role:e.type==="compaction/start"?"start":"update"}}return null},"match"),start:r(()=>({}),"start"),update:r((e,t)=>_s(e.state,t),"update"),buildViewNode:r(e=>{const t=e.state??$i(e);if(t.checkpoint===void 0)return null;const n=ks(t.summary,t.checkpoint);return ue(e,"compaction",n.seq,n)},"buildViewNode")};function Pi(e){e.conversationEvents.register(zi)}r(Pi,"registerCompactionConversationNode");const Zi={kind:"unknown-surface",target:"chat",match:r(e=>(0,O.isAppendSurfaceEvent)(e)?{id:String(e.seq),role:"start"}:null,"match"),start:r((e,t)=>({kind:"unknown",seq:t.event.seq,time:t.event.time,type:t.event.type,data:t.event.data}),"start"),update:r(e=>e.state,"update"),buildViewNode:r(e=>e.state===void 0?null:ue(e,"unknown",e.state.seq,e.state),"buildViewNode")};function Gi(e){e.conversationEvents.registerFallback(Zi)}r(Gi,"registerUnknownConversationFallback");function Hi(e,t){const n=[...e?.state.pending??[]],s=new Set(e?.state.claimed??[]),o=n.splice(t.start,t.removedCount??0,...t.inserted);for(const a of t.inserted)s.delete(a.id);if(t.target==="next-step"&&t.outcome!=="canceled")for(const a of o)s.add(a.id);return{pending:n,claimed:s}}r(Hi,"applySplice");function As(e){const t=`inbox-${e}`;return{kind:t,match:r(n=>n.type==="agent/inbox/spliced"&&n.data.target===e?{id:String(n.seq),role:"start"}:null,"match"),start:r((n,s,o)=>{if(s.event.type!=="agent/inbox/spliced")throw new Error(`${t} start requires agent/inbox/spliced`);return Hi(o.previous(t),s.event.data)},"start"),update:r(n=>n.state,"update"),publication:r(()=>"none","publication")}}r(As,"inboxDefinition");const Qi=As("next-turn"),Ji=As("next-step");function Ki(e){e.conversationEvents.register(Qi),e.conversationEvents.register(Ji)}r(Ki,"registerInboxConversationNodes");function Yi(e){if(e.type!=="user/message"||!(0,O.isReplacementSurfaceEvent)(e))return!1;const t=e.data.source;return t.kind==="plugin"&&t.plugin==="compact"}r(Yi,"isCompactionCheckpoint");const Xi={kind:"input-message",target:"chat",match:r(e=>e.type==="user/message"&&(0,O.isAppendSurfaceEvent)(e)&&!Yi(e)?{id:String(e.data.id),role:"start"}:null,"match"),start:r((e,t,n)=>{if(t.event.type!=="user/message")throw new Error("input-message start requires user/message");const s=t.event;return s.data.source.kind!=="user"?{kind:"context",seq:s.seq,time:s.time,content:s.data.content,source:s.data.source,provenance:(0,O.contextProvenance)(s.data.source),form:(0,O.contextForm)(s.data.source)}:n.previous("inbox-next-step")?.state.claimed.has(String(s.data.id))===!0?{kind:"steering",messageId:s.data.id,seq:s.seq,time:s.time,content:s.data.content,source:s.data.source}:{kind:"user",seq:s.seq,time:s.time,content:s.data.content,source:s.data.source}},"start"),update:r(e=>e.state,"update"),buildViewNode:r(e=>e.state===void 0?null:ue(e,e.state.kind,e.state.seq,e.state),"buildViewNode")};function ea(e){e.conversationEvents.register(Xi)}r(ea,"registerMessageConversationNode");function js(e){if(e.event.type==="llm/retry")return{kind:"model-retry",seq:e.event.seq,time:e.event.time,retryState:"scheduled",...e.event.data}}r(js,"scheduledNode");function ta(e){return e.kind==="step"&&e.step.status==="closed"||(e.kind==="step"||e.kind==="turn")&&e.turn.status==="closed"}r(ta,"isClosed");const na={kind:"model-retry",target:"chat",match:r(e=>{if(e.type==="llm/retry"){const t=e.data.retryId;return typeof t!="string"||t===""?null:{id:t,role:e.data.retry===1?"start":"update"}}if(e.type==="llm/retry-started"){const t=e.data.retryId;return typeof t=="string"&&t!==""?{id:t,role:"update"}:null}return null},"match"),start:r((e,t)=>{const n=js(t);if(n===void 0)throw new Error("model-retry start requires a valid llm/retry event");return{turn:n.turn,step:n.step,attempts:[n]}},"start"),update:r((e,t)=>{if(t.event.type==="llm/retry"){const s=js(t);return s===void 0?e.state:{...e.state,attempts:[...e.state.attempts,s]}}if(t.event.type!=="llm/retry-started")return e.state;const n=t.event.data.retry;return{...e.state,attempts:e.state.attempts.map(s=>s.retry===n?{...s,retryState:"started"}:s)}},"update"),buildViewNode:r(e=>{if(e.state===void 0||e.state.attempts.length===0)return null;const t=e.start?.location??e.matches[0]?.location??{kind:"unresolved"},n=e.state.attempts,s=n.map((l,c)=>c===n.length-1&&l.retryState==="scheduled"&&ta(t)?{...l,retryState:"cancelled"}:l),o=s.at(-1);if(o===void 0)return null;const a={attempts:s,current:o};return ue(e,"model-retry",s[0]?.seq??o.seq,a)},"buildViewNode")};function sa(e){e.conversationEvents.register(na)}r(sa,"registerRetryConversationNode");const Ss=256,Cs=new WeakMap;function Ws(e){return JSON.stringify(e)}r(Ws,"jsonArguments");function ra(e){if(e.event.type!=="tool/call")throw new Error("tool-call start requires tool/call");return{callId:String(e.event.data.callId),name:e.event.data.name,argsRaw:e.event.data.arguments,turn:e.event.data.turn,step:e.event.data.step,time:e.event.time,callView:e.view?.for==="call"?e.view.view:null,subCalls:[]}}r(ra,"rootCall");function Ts(e,t){if(e.event.type!=="tool/result")return;const n=e.event.data.message.content[0];return{kind:"tool-result",seq:e.event.seq,time:e.event.time,callId:String(e.event.data.message.source.callId),call:t===void 0?null:{name:t.name,argsRaw:t.argsRaw},callTime:t?.time??null,content:n.content,isError:n.isError===!0,...e.event.data.error===void 0?{}:{error:e.event.data.error},meta:e.event.data.meta,callView:t?.callView??null,resultView:e.view?.for==="result"?e.view.view:null,subCalls:[]}}r(Ts,"rootResult");function oa(e,t){return{callId:t.subCallId,name:t.name,argsRaw:Ws(t.arguments),turn:aa(e),step:la(e),time:e.event.time,callView:null,subCalls:[]}}r(oa,"childCall");function ia(e,t,n){return{kind:"tool-result",seq:e.event.seq,time:e.event.time,callId:t.subCallId,call:{name:t.name,argsRaw:Ws(t.arguments)},callTime:n?.time??null,content:t.content??[],isError:t.isError===!0,callView:null,resultView:null,subCalls:[]}}r(ia,"childResult");function aa(e){return e.location.kind==="step"||e.location.kind==="turn"?e.location.turn.turn:0}r(aa,"locationTurn");function la(e){return e.location.kind==="step"?e.location.step.step:0}r(la,"locationStep");function Es(e,t,n){if(t===n||e.parents.has(n))return!1;let s=t,o=0;const a=new Set;for(;s!==void 0;){if(s===n||a.has(s))return!1;a.add(s),o++,s=e.parents.get(s)}const l=[{callId:n,depth:1}],c=new Set;let d=0;for(const u of l){if(c.has(u.callId))return!1;c.add(u.callId),d=Math.max(d,u.depth);for(const f of e.children.get(u.callId)??[])l.push({callId:f.callId,depth:u.depth+1})}return o+d<=Ss}r(Es,"acceptsEdge");function Ns(e,t){const n=t.event;if(n.type!=="tool/code-dispatch-start"&&n.type!=="tool/code-dispatch")return e;const s=n.data,o=String(s.parentCallId),a=String(s.subCallId),l=e.children.get(o)??[],c=l.findIndex(m=>m.callId===a);if(n.type==="tool/code-dispatch-start"){if(c>=0||!Es(e,o,a))return e;const m=new Map(e.children);m.set(o,[...l,oa(t,s)]);const k=new Map(e.parents);return k.set(a,o),{...e,children:m,parents:k}}if(c<0&&!Es(e,o,a))return e;const d=ia(t,s,c<0?void 0:l[c]),u=new Map(e.children);u.set(o,c<0?[...l,d]:l.map((m,k)=>k===c?d:m));const f=new Map(e.parents);return c<0&&f.set(a,o),{...e,children:u,parents:f}}r(Ns,"updateDispatch");function qs(e,t,n,s=new Set,o=1){if(s.has(e.callId)||o>Ss)return{...e,subCalls:[]};const a=new Set(s);a.add(e.callId);const l=(t.children.get(e.callId)??e.subCalls).map(m=>qs(m,t,n,a,o+1)),c="kind"in e?void 0:n?.seq,d="kind"in e?void 0:n?.time,u=Cs.get(e);if(u!==void 0&&u.interruptionSeq===c&&u.interruptionTime===d&&Is(u.children,l))return u.value;const f="kind"in e||n===void 0?Is(e.subCalls,l)?e:{...e,subCalls:l}:{kind:"tool-result",seq:n.seq+it.interruptedFollowup,time:n.time,callId:e.callId,call:{name:e.name,argsRaw:e.argsRaw},callTime:e.time,content:[],isError:!0,error:{name:"Interrupted",code:"interrupted"},callView:e.callView,resultView:null,subCalls:l};return Cs.set(e,{children:l,interruptionSeq:c,interruptionTime:d,value:f}),f}r(qs,"projectBlock");function Is(e,t){return e.length===t.length&&e.every((n,s)=>n===t[s])}r(Is,"sameReferences");function ca(e){const t=e.start?.location;if(t?.kind==="step"&&t.step.status==="closed")return t.step.end;if((t?.kind==="step"||t?.kind==="turn")&&t.turn.status==="closed")return t.turn.end}r(ca,"interruption");function da(e){const t=e.matches.find(o=>o.event.type==="tool/result"),n=t===void 0?void 0:Ts(t);if(n===void 0)return;let s={root:n,children:new Map,parents:new Map};for(const o of e.matches)s=Ns(s,o);return s}r(da,"fallbackState$1");const ua={kind:"tool-call",target:"chat",match:r(e=>{if(e.type==="tool/call")return{id:String(e.data.callId),role:"start"};if(e.type==="tool/result"&&(0,O.isAppendSurfaceEvent)(e))return{id:String(e.data.message.source.callId),role:"update"};if(e.type==="tool/code-dispatch-start"||e.type==="tool/code-dispatch"){const t=e.data.rootCallId;return typeof t=="string"&&t!==""?{id:t,role:"update"}:null}return null},"match"),start:r((e,t)=>({root:ra(t),children:new Map,parents:new Map}),"start"),update:r((e,t)=>{if(t.event.type==="tool/result"){const n=Ts(t,"kind"in e.state.root?void 0:e.state.root);return n===void 0?e.state:{...e.state,root:n}}return Ns(e.state,t)},"update"),buildViewNode:r(e=>{const t=e.state??da(e);if(t===void 0)return null;const n=qs(t.root,t,ca(e));return ue(e,"tool-call",e.start?.event.seq??("kind"in t.root?t.root.seq:e.matches[0]?.event.seq??0),{root:n})},"buildViewNode")};function pa(e){e.conversationEvents.register(ua)}r(pa,"registerToolConversationNode");function ha(e){const t=e.start?.location??e.matches[0]?.location;return t?.kind!=="turn"&&t?.kind!=="step"?0:t.turn.steps.at(-1)?.step??0}r(ha,"lastStep$1");function $t(e){return e.type==="llm/retry"||e.type==="llm/retry-started"?e.data.turn:void 0}r($t,"retryTurn");function zt(e){if(e.event.type!=="turn/end"||e.event.data.reason.kind!=="error")return;const t=e.event.data.reason.error;return{seq:e.event.seq,time:e.event.time,message:(0,O.displayFailureMessage)(t),code:t.code}}r(zt,"failureFrom");function ma(e){const t=e.matches.find(o=>zt(o)!==void 0);if(t?.event.type!=="turn/end")return;const n=zt(t);if(n===void 0)return;const s=t.event.data.turn;return{turn:s,hidden:e.matches.some(o=>$t(o.event)===s),failure:n}}r(ma,"fallbackState");const fa={kind:"turn-error",target:"chat",match:r(e=>{if(e.type==="turn/start")return{id:String(e.data.turn),role:"start"};if(e.type==="turn/end"&&e.data.reason.kind==="error")return{id:String(e.data.turn),role:"update"};const t=$t(e);return t===void 0?null:{id:String(t),role:"update"}},"match"),start:r((e,t)=>{if(t.event.type!=="turn/start")throw new Error("turn-error start requires turn/start");return{turn:t.event.data.turn,hidden:!1}},"start"),update:r((e,t)=>{const n=zt(t);return n!==void 0?{...e.state,failure:n}:$t(t.event)===e.state.turn?{...e.state,hidden:!0}:e.state},"update"),buildViewNode:r(e=>{const t=e.state??ma(e);if(t?.failure===void 0)return null;const n=t.failure,s={kind:"turn-error",seq:n.seq,time:n.time,turn:t.turn,step:ha(e),message:n.message,...n.code===void 0?{}:{code:n.code}};if(!t.hidden)return ue(e,"turn-error",s.seq,s);const o=e.current.get("chat");return o==null?null:ue(e,"turn-error",s.seq,s,{visibility:"hidden"})},"buildViewNode")};function ga(e){e.conversationEvents.register(fa)}r(ga,"registerTurnErrorConversationNode");function va(e){const t=e.start?.location??e.matches[0]?.location;return t?.kind!=="turn"&&t?.kind!=="step"?0:t.turn.steps.at(-1)?.step??0}r(va,"lastStep");function xa(e,t){const n=e.start?.location??e.matches[0]?.location;if(n?.kind!=="turn"&&n?.kind!=="step")return t;const s=n.turn.data.get("turn-tail")?.closing;return s==null?t:s.finalNode.seq+it.maxTokensNotice}r(xa,"noticeAnchor");function ya(e){if(!(e.event.type!=="turn/end"||e.event.data.reason.kind!=="max-tokens"))return{turn:e.event.data.turn,seq:e.event.seq,time:e.event.time}}r(ya,"stateFrom");const ba={kind:"turn-max-tokens",target:"chat",match:r(e=>e.type==="turn/end"&&e.data.reason.kind==="max-tokens"?{id:String(e.data.turn),role:"start"}:null,"match"),start:r((e,t)=>{const n=ya(t);if(n===void 0)throw new Error("turn-max-tokens start requires a max-tokens turn/end");return n},"start"),update:r(e=>e.state,"update"),buildViewNode:r(e=>{const t=e.state;if(t===void 0)return null;const n={kind:"turn-max-tokens",seq:t.seq,time:t.time,turn:t.turn,step:va(e)};return ue(e,"turn-max-tokens",xa(e,t.seq),n)},"buildViewNode")};function wa(e){e.conversationEvents.register(ba)}r(wa,"registerTurnMaxTokensConversationNode");function ka(e){return e.type==="assistant/message"&&(0,O.isAppendSurfaceEvent)(e)&&(0,O.toAssistantBlocks)(e.data.message.content).some(t=>t.kind==="text"&&t.text.trim()!=="")}r(ka,"hasTextAssistant");function _a(e){if(e.type!=="assistant/chunk")return!1;const t=e.data.chunk;return t.type==="text-delta"?t.text.trim()!=="":t.type==="block-end"&&t.block.type==="text"&&t.block.text.trim()!==""}r(_a,"chunkHasText");function Ls(e){if(e.type==="assistant/message"||e.type==="assistant/chunk"||e.type==="step/end")return{turn:e.data.turn,step:e.data.step};if(e.type==="llm/retry")return{turn:e.data.turn,step:e.data.step}}r(Ls,"turnCoordinates");function Aa(e){let t=e.matches.find(s=>s.event.type==="turn/end")?.event.seq??e.start?.event.seq??e.matches[0]?.event.seq??0;const n=new Map;for(const s of e.matches){const o=s.event;if(o.type==="turn/end")continue;const a=Ls(o);if(a?.step===void 0)continue;const l=n.get(a.step)??{streamedText:!1,finalized:!1};if(o.type==="assistant/chunk"){n.set(a.step,{...l,streamedText:l.streamedText||_a(o)});continue}if(o.type==="assistant/message"){n.set(a.step,{streamedText:!1,finalized:!0}),ka(o)&&(t=o.seq+it.finalizedFollowup);continue}if(o.type==="llm/retry"){n.set(a.step,{streamedText:!1,finalized:!1});continue}o.type==="step/end"&&l.streamedText&&!l.finalized&&(t=o.seq+it.interruptedFollowup)}return t}r(Aa,"closingAnchor");function Ms(e){const t=e.start?.location??e.matches[0]?.location;return t?.kind==="turn"||t?.kind==="step"?t.turn:void 0}r(Ms,"turnLocation");function ja(e){return e.finalNode!==void 0&&e.blocks.some(t=>t.kind==="text"&&t.text.trim()!=="")}r(ja,"hasText");function Sa(e){const t=e.state?.end??e.matches.find(c=>c.event.type==="turn/end");if(t?.event.type!=="turn/end")return null;const n=Ms(e);if(n===void 0)return null;const s=n.steps.map(c=>c.data.get("assistant-step")).filter(c=>c!==void 0).filter(c=>c.finalNode!==void 0).sort((c,d)=>c.finalNode.seq-d.finalNode.seq),o=s.findLast(ja)??null;let a=s.at(-1)?.finalNode.seq;for(const c of e.matches){const d=c.event,u=d.type==="tool/call"||d.type==="tool/result"&&(0,O.isAppendSurfaceEvent)(d)||d.type==="turn/end"&&d.data.reason.kind==="error"||d.type==="llm/retry"?d.seq:void 0;u!==void 0&&(a===void 0||u>a)&&(a=u)}const l=Tr(s.map(c=>c.finalNode)).get(t.event.data.turn);return{turn:t.event.data.turn,seq:t.event.seq,time:t.event.time,closing:o,branchUnavailable:o===null||a!==o.finalNode.seq,...l?.ttftMs===void 0?{}:{ttftMs:l.ttftMs},...l?.tokensPerSecond===void 0?{}:{tokensPerSecond:l.tokensPerSecond}}}r(Sa,"tailData");const Ca={kind:"turn-tail",target:"chat",match:r(e=>{if(e.type==="turn/start")return{id:String(e.data.turn),role:"start"};if(e.type==="turn/end")return{id:String(e.data.turn),role:"update"};if(e.type==="tool/call"||e.type==="tool/result")return{id:String(e.data.turn),role:"update"};const t=Ls(e);return t!==void 0?{id:String(t.turn),role:"update"}:null},"match"),start:r((e,t)=>{if(t.event.type!=="turn/start")throw new Error("turn-tail start requires turn/start");return{turn:t.event.data.turn}},"start"),update:r((e,t)=>t.event.type==="turn/end"?{...e.state,end:t}:e.state,"update"),publication:r(e=>e.event.type==="turn/end"?"immediate":"none","publication"),buildLocationData:r((e,t)=>{if(t!=="turn")return null;const n=Sa(e);return n===null?null:{kind:"turn",turn:n.turn,key:"turn-tail",value:n}},"buildLocationData"),buildViewNode:r(e=>{const t=Ms(e)?.data.get("turn-tail");return t===void 0?null:ue(e,"turn-tail",Aa(e),t)},"buildViewNode")};function Wa(e){e.conversationEvents.register(Ca)}r(Wa,"registerTurnTailConversationNode");function Ta(e){Ki(e),ea(e),Ai(e),pa(e),Vi(e),Pi(e),sa(e),ga(e),wa(e),Wa(e),Gi(e),Di(e)}r(Ta,"registerConversationNodes");const Ea=3;function Na(e,t=Ea){const n=(0,h.useRef)(e);n.current=e;const s=(0,h.useRef)(null);return(0,h.useLayoutEffect)(()=>()=>{s.current!==null&&(cancelAnimationFrame(s.current),s.current=null)},[]),(0,h.useCallback)(()=>{if(s.current!==null)return;let o=t;const a=r(()=>{if(o-=1,o>0){s.current=requestAnimationFrame(a);return}s.current=null,n.current()},"advance");s.current=requestAnimationFrame(a)},[t])}r(Na,"useThrottledVisualUpdate");const qa="._3Tdcvq_visuallyHidden{clip:rect(0 0 0 0);white-space:nowrap;width:1px;height:1px;position:absolute;overflow:hidden}",Rs="@deepseek-ai/dsh-client-ui-conversation/accessibility.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Rs)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Rs,e.textContent=qa,document.head.appendChild(e)}var Pt={visuallyHidden:"_3Tdcvq_visuallyHidden"};const Ia='._9P1F9a_root{flex-direction:column;display:flex}._9P1F9a_row{position:relative;overflow:hidden}._9P1F9a_root[data-state=running] ._9P1F9a_row:after{content:"";inset-block:0;background:linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 55%, transparent 100%);pointer-events:none;width:300px;animation:2.6s ease-out infinite _9P1F9a_dsh-reasoning-row-sweep;position:absolute;left:0}@keyframes _9P1F9a_dsh-reasoning-row-sweep{0%{left:-300px}90%,to{left:100%}}._9P1F9a_leading{flex-shrink:0}._9P1F9a_chevron{color:var(--dsw-alias-label-secondary)}._9P1F9a_title{font-weight:400}._9P1F9a_separator{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}._9P1F9a_summary{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:14px;line-height:24px;overflow:hidden}._9P1F9a_summary[data-follow-end]{text-overflow:clip}._9P1F9a_thinkBody{color:var(--dsw-alias-label-tertiary);white-space:pre-wrap;word-break:break-word;padding:4px 0 4px 22px;font-size:14px;line-height:24px}@media (prefers-reduced-motion:reduce){._9P1F9a_root[data-state=running] ._9P1F9a_row:after{animation:none}}',Ds="@deepseek-ai/dsh-client-ui-conversation/ReasoningRow.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Ds)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Ds,e.textContent=Ia,document.head.appendChild(e)}var Le={root:"_9P1F9a_root",separator:"_9P1F9a_separator",leading:"_9P1F9a_leading",summary:"_9P1F9a_summary",title:"_9P1F9a_title",chevron:"_9P1F9a_chevron",thinkBody:"_9P1F9a_thinkBody",row:"_9P1F9a_row","dsh-reasoning-row-sweep":"_9P1F9a_dsh-reasoning-row-sweep"};function La(e){const t=e.indexOf(`
6
+ `);return t===-1?e:e.slice(0,t)}r(La,"firstLine");function Ma(e){const t=e.trimEnd(),n=t.lastIndexOf(`
7
+ `);return n===-1?t:t.slice(n+1)}r(Ma,"latestLine");function Ra({text:e,running:t,t:n}){const[s,o]=(0,h.useState)(!1),a=(0,h.useRef)(null),l=t?Ma(e):La(e),c=Na(()=>{const d=a.current;d!==null&&(d.scrollLeft=t?d.scrollWidth-d.clientWidth:0)});return(0,h.useEffect)(()=>{c()},[t,c,l]),(0,i.jsxs)("div",{className:Le.root,"data-variant":"think","data-state":t?"running":"ok",children:[t&&(0,i.jsx)("span",{className:Pt.visuallyHidden,children:n("row.running")}),(0,i.jsx)(_.DisclosureRow,{rowClassName:Le.row,leadingClassName:Le.leading,titleClassName:Le.title,chevronClassName:Le.chevron,icon:(0,i.jsx)(_.IconThinkOutline14,{size:14}),title:"Think",open:s,expandable:!0,expandOnRowClick:!0,onToggle:r(()=>{o(d=>!d)},"onToggle"),collapsedContent:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:Le.separator,"aria-hidden":!0}),(0,i.jsx)("span",{ref:a,className:Le.summary,"data-follow-end":t||void 0,children:l})]}),children:(0,i.jsx)("div",{className:Le.thinkBody,children:e})})]})}r(Ra,"ReasoningRow");const Da=".CzfJca_root{color:var(--dsw-alias-label-primary);flex-direction:column;font-size:16px;line-height:28px;display:flex}.CzfJca_body{flex-direction:column;gap:16px;display:flex}.CzfJca_stopped{background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-tertiary);border-radius:6px;align-self:flex-start;padding:0 6px;font-size:11px;line-height:18px}.CzfJca_actions{margin-top:16px;margin-left:-6px}",Us="@deepseek-ai/dsh-client-ui-conversation/AssistantMarkdown.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Us)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Us,e.textContent=Da,document.head.appendChild(e)}var Zt={actions:"CzfJca_actions",body:"CzfJca_body",root:"CzfJca_root",stopped:"CzfJca_stopped"};const Ua=(0,h.memo)(r(function({blocks:t,streaming:n,interrupted:s,loadImage:o,mentions:a,t:l}){const c=o??(()=>Promise.reject(new Error(l("image.serviceUnavailable")))),d=(0,h.useMemo)(()=>({copyLabel:l("copy"),copiedLabel:l("copied")}),[l]),u=t.length-1;if(!(n||s===!0||t.some(m=>m.kind!=="tool-call")))return null;const f=[];for(let m=0;m<t.length;m++){const k=t[m];if(k!==void 0)switch(k.kind){case"text":f.push((0,i.jsx)(_.MarkdownText,{text:k.text,streaming:n,codeLabels:d,fileMentions:a},m));break;case"reasoning":f.push((0,i.jsx)(Ra,{text:k.text,running:n&&m===u,t:l},m));break;case"image":{const g=m,x=[k];for(;m+1<t.length;){const b=t[m+1];if(b===void 0||b.kind!=="image")break;x.push(b),m+=1}f.push((0,i.jsx)(Xe.ImageGallery,{images:x,load:c,align:"start",labels:wn(l)},g));break}case"tool-call":break;default:f.push((0,i.jsx)(_.JsonBlock,{label:l("message.unknownBlock"),payload:k.block,truncatedLabel:r(g=>l("json.truncated",{total:g}),"truncatedLabel")},m))}}return(0,i.jsx)("div",{className:Zt.root,"data-streaming":n||void 0,children:(0,i.jsxs)("div",{className:Zt.body,children:[f,s&&(0,i.jsx)("span",{className:Zt.stopped,children:l("message.stopped")})]})})},"AssistantMarkdown")),Oa=(0,h.memo)(r(function({node:t,useTurnData:n,openFile:s,loadImage:o,fileMentions:a,t:l}){const c=t.data,d=t.location.kind==="turn"||t.location.kind==="step"?t.location.turn:void 0,u=n("turn-tail"),f=(0,h.useMemo)(()=>{if(!(d?.status!=="closed"||c.finalNode===void 0)&&u?.closing?.finalNode.seq===c.finalNode.seq)return{turn:d,seq:c.finalNode.seq,openFile:s}},[c.finalNode,s,u,d]),m=(0,h.useMemo)(()=>f===void 0?void 0:a(f),[a,f]);return(0,i.jsx)(Ua,{blocks:c.blocks,streaming:c.status==="running",interrupted:c.status==="interrupted",loadImage:o,mentions:m,t:l})},"AssistantNodeView")),Ba='.bKEaQq_root{flex-direction:column;display:flex}.bKEaQq_row{position:relative;overflow:hidden}.bKEaQq_root[data-state=running] .bKEaQq_row:after{content:"";inset-block:0;background:linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 55%, transparent 100%);pointer-events:none;width:300px;animation:2.6s ease-out infinite bKEaQq_dsh-command-row-sweep;position:absolute;left:0}@keyframes bKEaQq_dsh-command-row-sweep{0%{left:-300px}90%,to{left:100%}}.bKEaQq_leading{flex-shrink:0}.bKEaQq_chevron{color:var(--dsw-alias-label-secondary)}.bKEaQq_title{font-weight:400}.bKEaQq_separator{background:var(--dsw-alias-label-caption);border-radius:1px;flex:none;width:2px;height:2px;margin:0 8px}.bKEaQq_summary{min-width:0;color:var(--dsw-alias-label-tertiary);text-overflow:ellipsis;white-space:nowrap;flex:auto;font-size:14px;line-height:24px;overflow:hidden}.bKEaQq_summary[data-error],.bKEaQq_body[data-error]{color:var(--dsw-alias-state-error-primary)}.bKEaQq_body{border:1px solid var(--dsw-alias-border-l1);background:var(--dsw-alias-markdown-code-block);max-height:260px;color:var(--dsw-alias-label-primary);font:var(--dsw-font-markdown-code-block-small);white-space:pre-wrap;border-radius:12px;margin:4px 0 4px 4px;padding:12px 16px;overflow:auto}@media (prefers-reduced-motion:reduce){.bKEaQq_root[data-state=running] .bKEaQq_row:after{animation:none}}',Os="@deepseek-ai/dsh-client-ui-conversation/GenericCommandCard.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Os)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Os,e.textContent=Ba,document.head.appendChild(e)}var Me={root:"bKEaQq_root",body:"bKEaQq_body",title:"bKEaQq_title",separator:"bKEaQq_separator",row:"bKEaQq_row",chevron:"bKEaQq_chevron","dsh-command-row-sweep":"bKEaQq_dsh-command-row-sweep",summary:"bKEaQq_summary",leading:"bKEaQq_leading"};function Fa(e){return e===null?"running":e.kind==="error"?"error":"ok"}r(Fa,"stateOf");function Va(e){return e==="error"?(0,i.jsx)(_.StateDot,{state:"error"}):(0,i.jsx)(_.IconApiOutline14,{size:14})}r(Va,"leadingFor");function Gt({node:e,t,runningSummary:n}){const[s,o]=(0,h.useState)(!1),a=e.outcome?.text,l=e.outcome===null?n??t("command.running"):a??(e.outcome.kind==="error"?t("command.failed"):t("command.done")),c=e.name??t("command.title"),d=Fa(e.outcome),u=a!==void 0&&a.includes(`
8
+ `)?a:null,f=s&&u!==null;return(0,i.jsxs)("div",{className:Me.root,"data-variant":"others","data-state":d,children:[d==="running"&&(0,i.jsx)("span",{className:Pt.visuallyHidden,children:t("row.running")}),d==="error"&&(0,i.jsx)("span",{className:Pt.visuallyHidden,children:t("row.failed")}),(0,i.jsx)(_.DisclosureRow,{rowClassName:Me.row,leadingClassName:Me.leading,titleClassName:Me.title,chevronClassName:Me.chevron,icon:Va(d),title:c,open:f,expandable:u!==null,expandOnRowClick:!0,keepContentWhenOpen:!0,onToggle:r(()=>{o(m=>!m)},"onToggle"),collapsedContent:(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("span",{className:Me.separator,"aria-hidden":!0}),(0,i.jsx)("span",{className:Me.summary,"data-error":d==="error"||void 0,children:l})]}),children:(0,i.jsx)("pre",{className:Me.body,"data-error":d==="error"||void 0,children:u})})]})}r(Gt,"GenericCommandCard");function $a({node:e,compaction:t,t:n}){return t!==void 0?(0,i.jsx)(On,{node:t,title:"compact",fallbackSummary:e.outcome?.text??null,t:n}):e.outcome!==null?(0,i.jsx)(Gt,{node:e,t:n}):(0,i.jsx)(Gt,{node:e,t:n,runningSummary:n("message.compaction.running")})}r($a,"CompactionCommandCard");const za=(0,h.memo)(r(function({node:t,renderSlot:n,t:s}){const o=t.data,a=(0,h.useMemo)(()=>({node:o}),[o]);return(0,i.jsx)("div",{className:ae.callRow,children:n("conversation.chat.commandview",a,{entryKey:o.name??"",fallback:(0,i.jsx)(Gt,{...a,t:s})})})},"CommandNodeView")),Pa=(0,h.memo)(r(function({node:t,t:n}){const s=t.data;return(0,i.jsx)("div",{className:ae.callRow,children:(0,i.jsx)($a,{node:s.command,...s.compaction===null?{}:{compaction:s.compaction},t:n})})},"ManualCompactionNodeView"));function Za(e){return e.flatMap(t=>t.kind==="text"?[t.text]:[]).join("")}r(Za,"assistantText");const Ga=".hhmLwa_root{flex-direction:column;gap:16px;display:flex}.hhmLwa_actions{margin-left:-6px}",Bs="@deepseek-ai/dsh-client-ui-conversation/TurnTailNodeView.module.css";if(typeof document<"u"&&document.querySelector("style[data-plugin-css="+JSON.stringify(Bs)+"]")===null){const e=document.createElement("style");e.dataset.plugin="@deepseek-ai/dsh-client-ui-conversation",e.dataset.pluginCss=Bs,e.textContent=Ga,document.head.appendChild(e)}var Ht={root:"hhmLwa_root",actions:"hhmLwa_actions"};const Ha=(0,h.memo)(r(function({node:t,openFile:n,forkAt:s,renderSlot:o,renderSlotChain:a,t:l,useSession:c}){const d=t.data,u=c(w=>w.chat.locations.getTurn(d.turn).at(-1)!==t.key),f=t.location.kind==="turn"||t.location.kind==="step"?t.location.turn:void 0;if(f===void 0)return null;const m=d.closing,k=a("conversation.chat.turnTail",{turn:f,seq:m?.finalNode.seq??d.seq,openFile:n});if(m===null)return k===null?null:(0,i.jsx)("div",{className:Ht.root,children:k});const g=f.start===void 0||f.end===void 0?void 0:Math.max(0,f.end.time-f.start.time),x=m.finalNode.messageId,b=x===void 0?null:o("conversation.chat.assistant-actions",{messageId:x});return(0,i.jsxs)("div",{className:Ht.root,"data-turn-tail":d.turn,"data-time-hover-root":!0,children:[k,(0,i.jsx)(Ut,{text:Za(m.blocks),time:m.time,runMs:g,ttftMs:d.ttftMs,tokensPerSecond:d.tokensPerSecond,clock:"end",onBranch:r(()=>{s(m.finalNode.seq)},"onBranch"),branchUnavailable:d.branchUnavailable||u,className:Ht.actions,extraActions:b,t:l})]})},"TurnTailNodeView"));function Qa(e){e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"user",locale:V},Kn)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"steering",locale:V},Kn)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"context",locale:V},ko)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"assistant-step",locale:V},Oa)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"command",locale:V,children:{"conversation.chat.commandview":{kind:"keyed",scope:"session"}}},za)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"manual-compaction",locale:V},Pa)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"compaction",locale:V},_o)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"model-retry",locale:V},Ao)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"turn-error",locale:V},jo)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"turn-max-tokens",locale:V},So)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"turn-tail",locale:V,children:{"conversation.chat.turnTail":{kind:"chain",scope:"session"},"conversation.chat.assistant-actions":{kind:"list",scope:"session"}}},Ha)),e.slots.inject("conversation.chat.node",()=>e.slots.register({name:"conversation.chat.node",key:"unknown",locale:V},Co))}r(Qa,"registerChatNodeRenderers");const Ja=["slots","layout","sessions","workspaces","locale","connection","remote","settingsScope","conversationEvents","conversationViews"],Ka={getSnapshot:r(()=>null,"getSnapshot"),subscribe:r(()=>()=>{},"subscribe")},Ya={getSnapshot:r(()=>{},"getSnapshot"),subscribe:r(()=>()=>{},"subscribe")},Xa=new Map,el={getSnapshot:r(()=>Xa,"getSnapshot"),subscribe:r(()=>()=>{},"subscribe")},Fs={getSnapshot:r(()=>null,"getSnapshot"),subscribe:r(()=>()=>{},"subscribe")},tl={hooks:{turnData:r(({useSession:e},t)=>r(function(s){return e(o=>{const a=o.chat.nodes.get(t)?.location;return a?.kind==="turn"||a?.kind==="step"?a.turn.data.get(s):void 0})},"useTurnData"),"turnData")}};function Vs(e,t){const n=e.scope(t);if(n===void 0)throw new Error(`ui-conversation: session "${t}" resolved no scope`);const s=n.get("conversation");if(s===void 0)throw new Error("ui-conversation: conversation service unavailable through the session scope");return s}r(Vs,"scopedConversation");function Qt(e){const t=e.get("conversation");if(t===void 0)throw new Error("ui-conversation: conversation service unavailable");return t}r(Qt,"concreteConversation");function nl({interactions:e}){return e.find(t=>t.kind==="approval")??null}r(nl,"selectApproval");function sl(e){const t=e.sessions,n=e.workspaces,s=e.layout,o=e.slots;Ta(e),Qa(e),e.effect(()=>e.locale.register(V,{zh:Bo,en:Fo}),"ui-conversation: dictionaries");const a=e.locale.bind(V),l=tr(),c=new yr(e.settingsScope.bind({namespace:vr}));e.slots.inject("settings.general.item",()=>e.slots.register({name:"settings.general.item",id:"composer-enter",order:20,locale:V,inject:r(()=>({hooks:{busyEnter:c.busyEnter},setBusyEnter:r(g=>{c.setBusyEnter(g)},"setBusyEnter")}),"inject")},Hr));const d=new Map,f={list:r(()=>{const g=[];for(const x of o.entries("conversation.view"))x.options.id!==void 0&&g.push({id:x.options.id,label:(0,Xs.resolveSlotLabel)(x.options.label)??x.options.id});return g},"viewTabs"),subscribe:r(g=>o.subscribe("conversation.view",g),"subscribe"),version:r(()=>o.getVersion("conversation.view"),"version")},m=new ur(e,a),k=new sr;e.effect(()=>t.provide({hooks:["input"],props:["inputActions"],resolve:r(g=>{const x=m.shellFor(g);return{hooks:{input:x.state},props:{inputActions:x.actions}}},"resolve")}),"ui-conversation: input standard-kit provider"),o.register({name:"conversation",locale:V,children:{"conversation.session":{kind:"single",scope:"session"},"conversation.session.header":{kind:"single",scope:"session"},"conversation.composer":{kind:"chain",scope:"session"},"conversation.composer.bar":{kind:"single",scope:"session-maybe"},"conversation.input.overlay":{kind:"list",scope:"session"},"conversation.input.dock":{kind:"list",scope:"session"},"conversation.composer.dock":{kind:"list",scope:"session"},"conversation.input.left":{kind:"list",scope:"session"},"conversation.input.right":{kind:"list",scope:"session"},"conversation.hero.workspace":{kind:"single",scope:"root"},"conversation.hero.agentPreset":{kind:"single",scope:"root"}},inject:r(g=>({hooks:{composerBlock:g===void 0?Ya:k.storeFor(g)},selectWorkspace:r(async x=>{const b=await n.connectWorkspace(x);if(g!==void 0&&b!==g){const w=m.shell(g),C=w.snapshot.draft,y=w.snapshot.imageIds,A=m.shell(b);if((y.length===0||A.addImages(y))&&(C!==""&&(A.setDraft(C),w.setDraft("")),y.length>0))for(const j of y)w.removeImage(j)}t.open(b)},"selectWorkspace")}),"inject")},ai),o.register({name:"conversation.session",children:{"conversation.view":{kind:"list",scope:"session"}},store:l,inject:r((g,x)=>{const b=Qt(e);return{views:f,releaseSessionImages:r(w=>{b.releaseSessionImages(w)},"releaseSessionImages"),bindDraftMirror:r(w=>m.shell(g).bindMirror(w),"bindDraftMirror")}},"inject")},ui),o.register({name:"conversation.session.header",locale:V,children:{"conversation.session.header.actions":{kind:"list",scope:"session"},"conversation.session.header.utilities":{kind:"list",scope:"session"}},store:l,inject:r(()=>({views:f,open:r(g=>{t.open(g)},"open")}),"inject")},di),o.register({name:"conversation.composer.bar",locale:V,children:{"conversation.input.plan":{kind:"single",scope:"session"},"conversation.input.model":{kind:"single",scope:"session"}},inject:r(g=>{if(g===void 0)return{keyboard:void 0,addImages:void 0,removeImage:void 0,draftImages:void 0,resolveSubmitMode:r((C,y,A)=>c.resolve(C,y,A),"resolveSubmitMode"),toggleCommandMenu:void 0,stop:void 0,command:void 0,hooks:{notices:Ka,lexicon:el,menuLauncher:Fs}};const x=Qt(e),b=m.shell(g),w=m.inputTriggers(g);return{keyboard:b,addImages:r(C=>{try{const y=x.createDraftImages(C);return b.addImages(y.map(A=>A.id))||x.releaseDraftImages(y),null}catch(y){return y instanceof nn?a("image.unsupportedType"):y instanceof Error?y.message:String(y)}},"addImages"),removeImage:r(C=>{x.releaseDraftImage(C),b.removeImage(C)},"removeImage"),draftImages:r(C=>x.draftImages(C),"draftImages"),resolveSubmitMode:r((C,y,A)=>c.resolve(C,y,A),"resolveSubmitMode"),toggleCommandMenu:w===void 0?void 0:C=>{b.dismissPopup();const y=b.snapshot;w.toggleSource("command",{trigger:"/",query:"",position:y.draft.slice(0,C.start).trim()===""?"leading":"inline",span:{...C,draftRev:y.draftRev}})},stop:r(()=>{Vs(t,g).cancel().catch(()=>{})},"stop"),command:r(async C=>{const y=t.binding(g)?.session;if(y===void 0)return!1;const A=await y.command(C);return A.ok&&A.value.matched},"command"),hooks:{notices:b.notices,lexicon:b.lexicon,menuLauncher:w?.launcher??Fs}}},"inject")},Pr),o.register({name:"conversation.composer",select:nl,priority:1,locale:V},Uo),o.register({name:"conversation.view",id:"chat",order:0,label:r(()=>a("view.chat"),"label"),locale:V,children:{"conversation.chat.node":{kind:"keyed",scope:"session",inject:tl}},store:l,inject:r((g,x)=>{const b=Qt(e),w=Vs(t,g);return{openDetails:r(C=>{x.select(C),s.openDetails()},"openDetails"),fileMentions:r(C=>e.get("chatFileMentions")?.forClosing(C),"fileMentions"),openFile:r(C=>{const y=t.list.getSnapshot().byId[g]?.cwd;n.openPath((0,O.resolveWorkspacePath)(y,C)).catch(()=>{})},"openFile"),loadOlder:r(()=>{w.loadOlder()},"loadOlder"),loadImage:r(C=>b.resolveImage(g,C),"loadImage"),inspectCall:r(C=>{x.setInspect({callId:C}),x.setView("trajectory")},"inspectCall"),chatScroll:{save:r(C=>{C===null?d.delete(g):d.set(g,C)},"save"),read:r(()=>d.get(g)??null,"read")},forkAt:r(C=>{t.fork({sessionId:g,atSeq:C,increaseTitle:!0}).then(y=>{t.open(y)}).catch(()=>{})},"forkAt")}},"inject")},qo),o.register({name:"conversation.composer.dock",id:"stats",order:0,locale:V},Lr),e.plugin(sn,{input:m,blocks:k}),e.plugin(Ko),e.plugin(ei),o.register({name:"details",locale:V,children:{"conversation.details.tool":{kind:"single",scope:"session"}},store:l,inject:r(()=>({closeDetails:r(()=>{s.closeDetails()},"closeDetails")}),"inject")},xi)}return r(sl,"apply"),ut.ConversationController=sn,ut.apply=sl,ut.inject=Ja,dt.exports},"factory")});