eve 0.37.0 → 0.38.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 (410) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/src/channel/routes.d.ts +13 -3
  3. package/dist/src/channel/routes.js +1 -1
  4. package/dist/src/channel/session-callback.js +1 -1
  5. package/dist/src/channel/session.d.ts +2 -1
  6. package/dist/src/channel/session.js +1 -1
  7. package/dist/src/channel/types.d.ts +41 -0
  8. package/dist/src/chunks/{use-eve-agent-COmP-H8R.js → use-eve-agent-BbSsu99c.js} +79 -32
  9. package/dist/src/chunks/{use-eve-agent-CnppTEFk.js → use-eve-agent-Dt8Y5QtW.js} +78 -31
  10. package/dist/src/cli/acp/command.d.ts +2 -1
  11. package/dist/src/cli/acp/command.js +2 -2
  12. package/dist/src/cli/application-command.d.ts +8 -0
  13. package/dist/src/cli/application-command.js +1 -0
  14. package/dist/src/cli/application-root.d.ts +8 -0
  15. package/dist/src/cli/application-root.js +1 -0
  16. package/dist/src/cli/commands/build.d.ts +2 -1
  17. package/dist/src/cli/commands/build.js +1 -1
  18. package/dist/src/cli/commands/init-git.js +1 -1
  19. package/dist/src/cli/commands/init-recovery.d.ts +3 -0
  20. package/dist/src/cli/commands/init-recovery.js +3 -0
  21. package/dist/src/cli/commands/init-repl.js +1 -1
  22. package/dist/src/cli/commands/init-target.d.ts +21 -0
  23. package/dist/src/cli/commands/init-target.js +1 -0
  24. package/dist/src/cli/commands/init.js +1 -1
  25. package/dist/src/cli/commands/register-integration-commands.d.ts +2 -1
  26. package/dist/src/cli/commands/register-integration-commands.js +1 -1
  27. package/dist/src/cli/commands/register-project-commands.d.ts +2 -1
  28. package/dist/src/cli/commands/register-project-commands.js +1 -1
  29. package/dist/src/cli/commands/register-registry-commands.d.ts +2 -1
  30. package/dist/src/cli/commands/register-registry-commands.js +4 -1
  31. package/dist/src/cli/commands/registry-recovery.d.ts +14 -0
  32. package/dist/src/cli/commands/registry-recovery.js +1 -0
  33. package/dist/src/cli/commands/registry.d.ts +2 -5
  34. package/dist/src/cli/commands/registry.js +1 -1
  35. package/dist/src/cli/dev/diagnostic-dump.js +1 -1
  36. package/dist/src/cli/dev/environment.js +1 -1
  37. package/dist/src/cli/dev/tui/runner.d.ts +8 -0
  38. package/dist/src/cli/dev/tui/runner.js +1 -1
  39. package/dist/src/cli/dev/tui/subagent-pump.d.ts +27 -22
  40. package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
  41. package/dist/src/cli/dev/tui/terminal-renderer.d.ts +16 -0
  42. package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
  43. package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
  44. package/dist/src/cli/invoke/command.d.ts +3 -2
  45. package/dist/src/cli/invoke/command.js +1 -1
  46. package/dist/src/cli/run.d.ts +3 -2
  47. package/dist/src/cli/run.js +3 -3
  48. package/dist/src/client/eve-agent-store.d.ts +15 -3
  49. package/dist/src/client/eve-agent-store.js +2 -2
  50. package/dist/src/client/message-response.d.ts +10 -2
  51. package/dist/src/client/message-response.js +1 -1
  52. package/dist/src/client/open-stream.d.ts +2 -0
  53. package/dist/src/client/open-stream.js +1 -1
  54. package/dist/src/client/session.js +1 -1
  55. package/dist/src/compiled/.vendor-stamp.json +5 -1
  56. package/dist/src/compiled/@ai-sdk/otel/index.js +3 -3
  57. package/dist/src/compiled/@chat-adapter/slack/index.js +25 -25
  58. package/dist/src/compiled/@modelcontextprotocol/server/LICENSE +216 -0
  59. package/dist/src/compiled/@modelcontextprotocol/server/index.d.ts +98 -0
  60. package/dist/src/compiled/@modelcontextprotocol/server/index.js +80 -0
  61. package/dist/src/compiled/@opentelemetry/api/index.js +1 -1
  62. package/dist/src/compiled/@opentelemetry/otlp-transformer/index.js +1 -1
  63. package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +61 -61
  64. package/dist/src/compiled/@vercel/oidc/index.js +14 -14
  65. package/dist/src/compiled/@vercel/otel/index.js +1 -1
  66. package/dist/src/compiled/@vercel/sandbox/index.js +1 -1
  67. package/dist/src/compiled/@workflow/core/index.js +1 -1
  68. package/dist/src/compiled/@workflow/core/private.js +1 -1
  69. package/dist/src/compiled/@workflow/core/runtime.js +2 -2
  70. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  71. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  72. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  73. package/dist/src/compiled/@workflow/world-vercel/index.js +13 -13
  74. package/dist/src/compiled/_chunks/workflow/{attribute-changes-BoH7JsWp.js → attribute-changes-DZtQkszH.js} +1 -1
  75. package/dist/src/compiled/_chunks/workflow/chunk-5MU5Z6L3-B_3nkJFi.js +1 -0
  76. package/dist/src/compiled/_chunks/workflow/{chunk-NWCAEW5Y-Oxw40oRR.js → chunk-NWCAEW5Y-BgbcH0OK.js} +1 -1
  77. package/dist/src/compiled/_chunks/workflow/{dist-DlFv0aHY.js → dist-CPlyFOVo.js} +1 -1
  78. package/dist/src/compiled/_chunks/workflow/{dist-tJoQXAF6.js → dist-DpYyXbJv.js} +1 -1
  79. package/dist/src/compiled/_chunks/workflow/{dist-CRTn4Sg8.js → dist-xQXN70ED.js} +1 -1
  80. package/dist/src/compiled/_chunks/workflow/esm-seIr7a6j.js +1 -0
  81. package/dist/src/compiled/_chunks/workflow/{frames-CTpeJYEQ.js → frames-BBs-9k1d.js} +2 -2
  82. package/dist/src/compiled/_chunks/workflow/{functions-CeeNvKsq.js → functions-DAYiHNti.js} +1 -1
  83. package/dist/src/compiled/_chunks/workflow/{getMachineId-bsd-WEBNKY2R-CEYkx6Nv.js → getMachineId-bsd-WEBNKY2R-BTaxrQ52.js} +1 -1
  84. package/dist/src/compiled/_chunks/workflow/{getMachineId-darwin-LT47KAXP-DPwWlhif.js → getMachineId-darwin-LT47KAXP-DhYmwE_R.js} +1 -1
  85. package/dist/src/compiled/_chunks/workflow/{getMachineId-linux-LTVQO6VW-DAFXHwZp.js → getMachineId-linux-LTVQO6VW-Dru_L5ru.js} +1 -1
  86. package/dist/src/compiled/_chunks/workflow/{getMachineId-unsupported-UKWBA27G-BZKOI8mG.js → getMachineId-unsupported-UKWBA27G-DGfoqVW1.js} +1 -1
  87. package/dist/src/compiled/_chunks/workflow/{getMachineId-win-NLJKOPY6-r7_CJB5o.js → getMachineId-win-NLJKOPY6-CLM98q4X.js} +1 -1
  88. package/dist/src/compiled/_chunks/workflow/{private-tvMBynnC.js → private-UQtz8ZcW.js} +1 -1
  89. package/dist/src/compiled/_chunks/workflow/{resume-hook-BPQHjeY5.js → resume-hook-CYtSorp6.js} +1 -1
  90. package/dist/src/compiled/_chunks/workflow/{rolldown-runtime-DaDcL9Zw.js → rolldown-runtime-8V8biNmG.js} +1 -1
  91. package/dist/src/compiled/_chunks/workflow/{run-DQ5dOyjm.js → run-Cjo0A3NO.js} +1 -1
  92. package/dist/src/compiled/_chunks/workflow/{signal-exit-C8vsI6zj.js → signal-exit-o3IPQwwv.js} +1 -1
  93. package/dist/src/compiled/_chunks/workflow/sleep-C1P0OWBm.js +1 -0
  94. package/dist/src/compiled/_chunks/workflow/{token-DHD-q-fS.js → token-DGzfw-Vb.js} +1 -1
  95. package/dist/src/compiled/_chunks/workflow/{token-DtCUEpJs.js → token-DNbxVpeq.js} +1 -1
  96. package/dist/src/compiled/_chunks/workflow/token-util-BneBe0g5.js +27 -0
  97. package/dist/src/compiled/_chunks/workflow/{token-util-Ldar52H7.js → token-util-DjMgNdXS.js} +1 -1
  98. package/dist/src/compiled/_chunks/workflow/{undici-CUIybhQ2.js → undici-BBG5cZTy.js} +1 -1
  99. package/dist/src/compiled/_chunks/workflow/{wait-until-DK2lnH6U.js → wait-until-CT1ve8qB.js} +3 -3
  100. package/dist/src/compiled/_chunks/workflow/{wrapper-CMGju7QA.js → wrapper-CQNxP9mU.js} +3 -3
  101. package/dist/src/compiled/_chunks/workflow/{ws-transport-Csi6Cydc.js → ws-transport-beXxD0s_.js} +1 -1
  102. package/dist/src/compiled/env-runner/node-worker.js +1 -1
  103. package/dist/src/compiled/jose/index.js +1 -1
  104. package/dist/src/compiled/shadcn-registry/index.js +403 -403
  105. package/dist/src/compiler/artifacts.js +1 -1
  106. package/dist/src/compiler/compile-agent.js +2 -2
  107. package/dist/src/compiler/extension-compatibility.d.ts +20 -10
  108. package/dist/src/compiler/extension-compatibility.js +1 -1
  109. package/dist/src/compiler/manifest.js +1 -1
  110. package/dist/src/compiler/normalize-agent-config.js +1 -1
  111. package/dist/src/compiler/normalize-extension.d.ts +8 -5
  112. package/dist/src/compiler/normalize-extension.js +1 -1
  113. package/dist/src/compiler/normalize-manifest.js +1 -1
  114. package/dist/src/compiler/normalize-subagent.d.ts +1 -1
  115. package/dist/src/compiler/normalize-subagent.js +1 -1
  116. package/dist/src/context/serialized-dynamic-model-selection.d.ts +2 -0
  117. package/dist/src/context/serialized-dynamic-model-selection.js +1 -0
  118. package/dist/src/discover/discover-agent.js +1 -1
  119. package/dist/src/discover/extensions.d.ts +0 -6
  120. package/dist/src/discover/extensions.js +1 -1
  121. package/dist/src/evals/cli/eval.d.ts +1 -1
  122. package/dist/src/evals/cli/eval.js +1 -1
  123. package/dist/src/execution/agent-handle-dispatch.d.ts +15 -1
  124. package/dist/src/execution/agent-handle-dispatch.js +1 -1
  125. package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
  126. package/dist/src/execution/delegated-parent-notification.d.ts +17 -0
  127. package/dist/src/execution/delegated-parent-notification.js +1 -1
  128. package/dist/src/execution/deliver-payloads.js +1 -1
  129. package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +155 -0
  130. package/dist/src/execution/dispatch-runtime-actions-shared.js +1 -0
  131. package/dist/src/execution/dispatch-runtime-actions-step.d.ts +18 -14
  132. package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
  133. package/dist/src/execution/dispatch-workflow-runtime-actions-step.d.ts +7 -2
  134. package/dist/src/execution/dispatch-workflow-runtime-actions-step.js +1 -1
  135. package/dist/src/execution/effective-output-schema.d.ts +21 -0
  136. package/dist/src/execution/effective-output-schema.js +1 -0
  137. package/dist/src/execution/eve-workflow-attributes.d.ts +2 -0
  138. package/dist/src/execution/node-step.js +1 -1
  139. package/dist/src/execution/parked-delivery-wait.d.ts +8 -12
  140. package/dist/src/execution/parked-delivery-wait.js +1 -1
  141. package/dist/src/execution/{route-proxied-deliver-step.d.ts → proxied-deliver-step.d.ts} +7 -4
  142. package/dist/src/execution/proxied-deliver-step.js +1 -0
  143. package/dist/src/execution/remote-agent-dispatch.d.ts +32 -0
  144. package/dist/src/execution/remote-agent-dispatch.js +1 -1
  145. package/dist/src/execution/remote-agent-route-url.d.ts +2 -0
  146. package/dist/src/execution/remote-agent-route-url.js +1 -0
  147. package/dist/src/execution/route-child-delivery.d.ts +2 -1
  148. package/dist/src/execution/route-child-delivery.js +1 -1
  149. package/dist/src/execution/sandbox/bindings/docker-templates.js +1 -1
  150. package/dist/src/execution/sandbox/bindings/just-bash.js +1 -1
  151. package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +1 -1
  152. package/dist/src/execution/sandbox/prewarm.js +1 -1
  153. package/dist/src/execution/session-callback-step.d.ts +11 -0
  154. package/dist/src/execution/session-callback-step.js +1 -1
  155. package/dist/src/execution/session-command-wire.js +1 -1
  156. package/dist/src/execution/session-state-cursor.d.ts +25 -0
  157. package/dist/src/execution/session-state-cursor.js +1 -0
  158. package/dist/src/execution/settle-cancelled-turn-step.d.ts +2 -0
  159. package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
  160. package/dist/src/execution/subagent-event-proxy-step.d.ts +15 -0
  161. package/dist/src/execution/subagent-event-proxy-step.js +1 -1
  162. package/dist/src/execution/subagent-hitl-proxy.d.ts +14 -7
  163. package/dist/src/execution/subagent-hitl-proxy.js +1 -1
  164. package/dist/src/execution/subagent-start-local.d.ts +29 -0
  165. package/dist/src/execution/subagent-start-local.js +1 -0
  166. package/dist/src/execution/subagent-start-remote.d.ts +23 -0
  167. package/dist/src/execution/subagent-start-remote.js +1 -0
  168. package/dist/src/execution/task-event-callback.d.ts +13 -0
  169. package/dist/src/execution/task-event-callback.js +1 -0
  170. package/dist/src/execution/task-input-capability.d.ts +4 -0
  171. package/dist/src/execution/task-input-capability.js +1 -0
  172. package/dist/src/execution/tasks/child/steps.d.ts +46 -0
  173. package/dist/src/execution/tasks/child/steps.js +1 -0
  174. package/dist/src/execution/tasks/child/workflow.d.ts +31 -0
  175. package/dist/src/execution/tasks/child/workflow.js +1 -0
  176. package/dist/src/execution/tasks/parent/agent-identity.d.ts +13 -0
  177. package/dist/src/execution/tasks/parent/agent-identity.js +1 -0
  178. package/dist/src/execution/tasks/parent/agent-views.d.ts +6 -0
  179. package/dist/src/execution/tasks/parent/agent-views.js +1 -0
  180. package/dist/src/execution/tasks/parent/continuation-dispatch.d.ts +37 -0
  181. package/dist/src/execution/tasks/parent/continuation-dispatch.js +1 -0
  182. package/dist/src/execution/tasks/parent/control-shared.d.ts +36 -0
  183. package/dist/src/execution/tasks/parent/control-shared.js +1 -0
  184. package/dist/src/execution/tasks/parent/delegate.d.ts +70 -0
  185. package/dist/src/execution/tasks/parent/delegate.js +1 -0
  186. package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +19 -0
  187. package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -0
  188. package/dist/src/execution/tasks/parent/dispatch.d.ts +33 -0
  189. package/dist/src/execution/tasks/parent/dispatch.js +1 -0
  190. package/dist/src/execution/tasks/parent/hitl-proxy-steps.d.ts +29 -0
  191. package/dist/src/execution/tasks/parent/hitl-proxy-steps.js +1 -0
  192. package/dist/src/execution/tasks/parent/run-parent.d.ts +72 -0
  193. package/dist/src/execution/tasks/parent/run-parent.js +1 -0
  194. package/dist/src/execution/tasks/parent/send.d.ts +25 -0
  195. package/dist/src/execution/tasks/parent/send.js +1 -0
  196. package/dist/src/execution/tasks/workflow-target.d.ts +2 -0
  197. package/dist/src/execution/tasks/workflow-target.js +1 -0
  198. package/dist/src/execution/terminate-child-sessions-step.d.ts +1 -0
  199. package/dist/src/execution/terminate-child-sessions-step.js +1 -1
  200. package/dist/src/execution/turn-control-receiver.d.ts +10 -0
  201. package/dist/src/execution/turn-control-receiver.js +1 -1
  202. package/dist/src/execution/turn-dispatch.d.ts +2 -0
  203. package/dist/src/execution/turn-dispatch.js +1 -1
  204. package/dist/src/execution/turn-execution-cursor.d.ts +2 -8
  205. package/dist/src/execution/turn-execution-cursor.js +1 -1
  206. package/dist/src/execution/turn-workflow.js +1 -1
  207. package/dist/src/execution/workflow-callback-url.d.ts +5 -0
  208. package/dist/src/execution/workflow-callback-url.js +1 -1
  209. package/dist/src/execution/workflow-entry.js +1 -1
  210. package/dist/src/execution/workflow-runtime.d.ts +9 -0
  211. package/dist/src/execution/workflow-runtime.js +1 -1
  212. package/dist/src/execution/workflow-steps.d.ts +7 -21
  213. package/dist/src/execution/workflow-steps.js +1 -1
  214. package/dist/src/harness/advertised-tools.js +1 -1
  215. package/dist/src/harness/authorization.js +1 -1
  216. package/dist/src/harness/execute-tool.d.ts +7 -0
  217. package/dist/src/harness/handles/prompt.d.ts +12 -0
  218. package/dist/src/harness/handles/prompt.js +2 -1
  219. package/dist/src/harness/handles/query.js +1 -1
  220. package/dist/src/harness/handles/store.d.ts +9 -2
  221. package/dist/src/harness/handles/store.js +1 -1
  222. package/dist/src/harness/handles/transitions.d.ts +10 -1
  223. package/dist/src/harness/handles/transitions.js +1 -1
  224. package/dist/src/harness/instrumentation/providers.js +1 -1
  225. package/dist/src/harness/instrumentation/runtime-context.d.ts +2 -0
  226. package/dist/src/harness/instrumentation/runtime-context.js +1 -1
  227. package/dist/src/harness/instrumentation/runtime.d.ts +3 -1
  228. package/dist/src/harness/proxy-input-requests.d.ts +21 -4
  229. package/dist/src/harness/proxy-input-requests.js +1 -1
  230. package/dist/src/harness/runtime-actions.d.ts +2 -0
  231. package/dist/src/harness/runtime-actions.js +1 -1
  232. package/dist/src/harness/session-limit-enforcement.js +1 -1
  233. package/dist/src/harness/tool-loop.js +2 -2
  234. package/dist/src/harness/workflow-runtime-action-state.js +1 -1
  235. package/dist/src/internal/application/cache-metadata.js +1 -1
  236. package/dist/src/internal/application/compiled-artifacts.js +2 -2
  237. package/dist/src/internal/application/optional-package-install.js +1 -1
  238. package/dist/src/internal/application/output-publication-lock.js +1 -1
  239. package/dist/src/internal/application/package.js +1 -1
  240. package/dist/src/internal/application/paths.js +1 -1
  241. package/dist/src/internal/application/tsconfig-dependencies.js +1 -1
  242. package/dist/src/internal/authored-definition/core.js +1 -1
  243. package/dist/src/internal/authored-module-evaluation-error.js +4 -4
  244. package/dist/src/internal/authored-module-loader.js +3 -3
  245. package/dist/src/internal/authored-package-boundary.js +1 -1
  246. package/dist/src/internal/authored-relative-extension-resolver.js +1 -1
  247. package/dist/src/internal/bundler/extension-scope-plugin.js +1 -1
  248. package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
  249. package/dist/src/internal/instrumentation-layout.js +1 -1
  250. package/dist/src/internal/invocation/agent-invocation.d.ts +54 -0
  251. package/dist/src/internal/invocation/agent-invocation.js +1 -0
  252. package/dist/src/internal/invocation/attributes.d.ts +2 -0
  253. package/dist/src/internal/invocation/attributes.js +1 -0
  254. package/dist/src/internal/invocation/metadata.d.ts +9 -0
  255. package/dist/src/internal/invocation/metadata.js +1 -0
  256. package/dist/src/internal/invocation/workflow-execution.d.ts +32 -0
  257. package/dist/src/internal/invocation/workflow-execution.js +1 -0
  258. package/dist/src/internal/materialized-authored-modules.js +1 -1
  259. package/dist/src/internal/mcp/http-security.d.ts +12 -0
  260. package/dist/src/internal/mcp/http-security.js +1 -0
  261. package/dist/src/internal/mcp/protected-resource.d.ts +9 -0
  262. package/dist/src/internal/mcp/protected-resource.js +1 -0
  263. package/dist/src/internal/mcp/streamable-http-server.d.ts +51 -0
  264. package/dist/src/internal/mcp/streamable-http-server.js +1 -0
  265. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -1
  266. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  267. package/dist/src/internal/nitro/dev-runtime-source-snapshot-copy.js +1 -1
  268. package/dist/src/internal/nitro/dev-runtime-source-snapshot-local-roots.js +1 -1
  269. package/dist/src/internal/nitro/dev-runtime-source-snapshot.js +1 -1
  270. package/dist/src/internal/nitro/host/application-route-registry.d.ts +88 -0
  271. package/dist/src/internal/nitro/host/application-route-registry.js +1 -0
  272. package/dist/src/internal/nitro/host/build-application.js +1 -1
  273. package/dist/src/internal/nitro/host/build-extension.js +1 -1
  274. package/dist/src/internal/nitro/host/build-vercel-agent-summary.js +1 -1
  275. package/dist/src/internal/nitro/host/channel-routes.d.ts +4 -11
  276. package/dist/src/internal/nitro/host/channel-routes.js +3 -3
  277. package/dist/src/internal/nitro/host/configure-nitro-routes.js +3 -3
  278. package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
  279. package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
  280. package/dist/src/internal/nitro/host/dev-runner.js +1 -1
  281. package/dist/src/internal/nitro/host/dev-workspace-extensions.js +1 -1
  282. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  283. package/dist/src/internal/nitro/host/local-tracing-runtime-plugin.js +1 -1
  284. package/dist/src/internal/nitro/host/nitro-bundler-config.js +1 -1
  285. package/dist/src/internal/nitro/host/start-development-server.js +2 -2
  286. package/dist/src/internal/nitro/host/start-production-server.js +2 -2
  287. package/dist/src/internal/nitro/host/vercel-build-output-config.js +1 -1
  288. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  289. package/dist/src/internal/nitro/routes/channel-route-context.d.ts +14 -0
  290. package/dist/src/internal/nitro/routes/channel-route-context.js +1 -1
  291. package/dist/src/internal/nitro/routes/runtime-stack.d.ts +2 -0
  292. package/dist/src/internal/nitro/routes/runtime-stack.js +1 -1
  293. package/dist/src/internal/process/pnpm.js +1 -1
  294. package/dist/src/internal/vercel-agent-summary.d.ts +1 -1
  295. package/dist/src/internal/workflow/development-world-client.js +1 -1
  296. package/dist/src/internal/workflow/development-world-server.js +1 -1
  297. package/dist/src/internal/workflow-bundle/builder-support.d.ts +12 -8
  298. package/dist/src/internal/workflow-bundle/builder-support.js +8 -7
  299. package/dist/src/internal/workflow-bundle/builder.d.ts +1 -1
  300. package/dist/src/internal/workflow-bundle/builder.js +2 -3
  301. package/dist/src/internal/workflow-bundle/workflow-builders.js +1 -1
  302. package/dist/src/protocol/message.d.ts +28 -0
  303. package/dist/src/protocol/message.js +2 -2
  304. package/dist/src/protocol/routes.d.ts +14 -0
  305. package/dist/src/protocol/routes.js +1 -1
  306. package/dist/src/public/channels/auth.d.ts +36 -0
  307. package/dist/src/public/channels/auth.js +1 -1
  308. package/dist/src/public/channels/discord/discordChannel.d.ts +2 -0
  309. package/dist/src/public/channels/discord/discordChannel.js +1 -1
  310. package/dist/src/public/channels/eve.d.ts +2 -0
  311. package/dist/src/public/channels/eve.js +1 -1
  312. package/dist/src/public/channels/github/dispatch.js +1 -1
  313. package/dist/src/public/channels/github/githubChannel.d.ts +2 -0
  314. package/dist/src/public/channels/linear/linearChannel.d.ts +2 -0
  315. package/dist/src/public/channels/linear/linearChannel.js +1 -1
  316. package/dist/src/public/channels/mcp.d.ts +19 -0
  317. package/dist/src/public/channels/mcp.js +1 -0
  318. package/dist/src/public/channels/photon/photonIMessageChannel.d.ts +2 -0
  319. package/dist/src/public/channels/photon/photonIMessageChannel.js +1 -1
  320. package/dist/src/public/channels/slack/slackChannel.d.ts +3 -1
  321. package/dist/src/public/channels/slack/slackChannel.js +1 -1
  322. package/dist/src/public/channels/teams/teamsChannel.d.ts +2 -0
  323. package/dist/src/public/channels/teams/teamsChannel.js +1 -1
  324. package/dist/src/public/channels/telegram/telegramChannel.d.ts +2 -0
  325. package/dist/src/public/channels/telegram/telegramChannel.js +1 -1
  326. package/dist/src/public/channels/twilio/twilioChannel.d.ts +2 -0
  327. package/dist/src/public/channels/twilio/twilioChannel.js +1 -1
  328. package/dist/src/public/definitions/channel.d.ts +2 -2
  329. package/dist/src/public/definitions/channel.js +1 -1
  330. package/dist/src/public/instrumentation/index.d.ts +9 -3
  331. package/dist/src/public/next/server.js +1 -1
  332. package/dist/src/public/nuxt/dev-server.js +1 -1
  333. package/dist/src/public/sveltekit/dev-server.js +1 -1
  334. package/dist/src/react/use-eve-agent.d.ts +4 -4
  335. package/dist/src/react/use-eve-agent.js +1 -1
  336. package/dist/src/runtime/actions/types.d.ts +9 -0
  337. package/dist/src/runtime/actions/types.js +1 -1
  338. package/dist/src/runtime/agent/bootstrap.js +1 -1
  339. package/dist/src/runtime/connections/authorization-complete-page.js +70 -28
  340. package/dist/src/runtime/framework-channels/index.js +1 -1
  341. package/dist/src/runtime/framework-tools/index.js +1 -1
  342. package/dist/src/runtime/framework-tools/tasks.d.ts +95 -0
  343. package/dist/src/runtime/framework-tools/tasks.js +1 -0
  344. package/dist/src/runtime/prompt/compose.d.ts +1 -0
  345. package/dist/src/runtime/prompt/compose.js +1 -1
  346. package/dist/src/runtime/resolve-agent-graph.js +1 -1
  347. package/dist/src/runtime/resolve-agent.js +1 -1
  348. package/dist/src/runtime/session-callback-route.js +1 -1
  349. package/dist/src/runtime/task-input-response-route.d.ts +5 -0
  350. package/dist/src/runtime/task-input-response-route.js +1 -0
  351. package/dist/src/services/inspect-application.js +1 -1
  352. package/dist/src/setup/primitives/pm/pnpm.js +2 -2
  353. package/dist/src/setup/primitives/run-vercel.js +1 -1
  354. package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
  355. package/dist/src/setup/scaffold/create/extension.js +1 -1
  356. package/dist/src/setup/scaffold/create/project.js +1 -1
  357. package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
  358. package/dist/src/setup/scaffold/create/web-template.js +8 -86
  359. package/dist/src/setup/scaffold/version-tokens.js +1 -1
  360. package/dist/src/setup/scaffold/workspace-root.js +1 -1
  361. package/dist/src/shared/agent-definition.d.ts +7 -0
  362. package/dist/src/svelte/index.js +1 -1
  363. package/dist/src/svelte/use-eve-agent.d.ts +3 -3
  364. package/dist/src/svelte/use-eve-agent.js +1 -1
  365. package/dist/src/tasks/json.d.ts +88 -0
  366. package/dist/src/tasks/json.js +1 -0
  367. package/dist/src/tasks/session-index.d.ts +48 -0
  368. package/dist/src/tasks/session-index.js +1 -0
  369. package/dist/src/tasks/task-id.d.ts +34 -0
  370. package/dist/src/tasks/task-id.js +1 -0
  371. package/dist/src/tasks/transitions.d.ts +23 -0
  372. package/dist/src/tasks/transitions.js +1 -0
  373. package/dist/src/tasks/types.d.ts +295 -0
  374. package/dist/src/tasks/types.js +1 -0
  375. package/dist/src/tasks/wire.d.ts +26 -0
  376. package/dist/src/tasks/wire.js +1 -0
  377. package/dist/src/tracing/install-instrumentation-runtime.d.ts +2 -1
  378. package/dist/src/tracing/install-instrumentation-runtime.js +1 -1
  379. package/dist/src/tracing/otel-declaration.d.ts +32 -3
  380. package/dist/src/tracing/otel-declaration.js +1 -1
  381. package/dist/src/tracing/otel-registration.js +1 -1
  382. package/dist/src/vue/index.js +1 -1
  383. package/dist/src/vue/use-eve-agent.d.ts +3 -3
  384. package/dist/src/vue/use-eve-agent.js +1 -1
  385. package/docs/channels/custom.mdx +1 -1
  386. package/docs/channels/discord.mdx +1 -1
  387. package/docs/channels/eve.mdx +15 -2
  388. package/docs/channels/github.mdx +1 -1
  389. package/docs/channels/linear.mdx +1 -1
  390. package/docs/channels/overview.mdx +1 -1
  391. package/docs/channels/photon.mdx +1 -1
  392. package/docs/channels/slack.mdx +1 -1
  393. package/docs/channels/teams.mdx +1 -1
  394. package/docs/channels/telegram.mdx +1 -1
  395. package/docs/channels/twilio.mdx +1 -1
  396. package/docs/extensions.md +10 -6
  397. package/docs/guides/client/streaming.mdx +7 -6
  398. package/docs/guides/frontend/overview.mdx +10 -8
  399. package/docs/guides/frontend/use-eve-agent-svelte.mdx +10 -10
  400. package/docs/guides/frontend/use-eve-agent-vue.mdx +10 -10
  401. package/docs/install-integrations.mdx +4 -0
  402. package/docs/reference/cli.md +1 -1
  403. package/docs/schedules.mdx +2 -2
  404. package/docs/tools/human-in-the-loop.md +3 -1
  405. package/package.json +7 -1
  406. package/dist/src/compiled/_chunks/workflow/chunk-5MU5Z6L3-CaJgXkVg.js +0 -1
  407. package/dist/src/compiled/_chunks/workflow/sleep-CzdoBiqy.js +0 -1
  408. package/dist/src/compiled/_chunks/workflow/src-Cj3P1ChQ.js +0 -1
  409. package/dist/src/compiled/_chunks/workflow/token-util-DNwIAn_u.js +0 -27
  410. package/dist/src/execution/route-proxied-deliver-step.js +0 -1
@@ -1,4 +1,4 @@
1
- import{o as e,t}from"./rolldown-runtime-DaDcL9Zw.js";import{A as n,D as r,O as i,S as a,a as o,b as s,c,g as l,h as u,i as d,k as f,l as p,m,p as h,s as g,t as _,u as v}from"./dist-CRTn4Sg8.js";import{a as y,c as b,l as ee,n as te,t as ne}from"./private-tvMBynnC.js";import"./dist-tJoQXAF6.js";import{S as re,b as ie,c as ae,h as x,n as oe,o as se}from"./dist-DlFv0aHY.js";import{t as S}from"./env-config-DxamfI7T.js";import{types as C}from"node:util";import{AsyncLocalStorage as ce}from"node:async_hooks";function le(e,t){if(typeof t!=`string`)return null;let[n,r,...i]=t.split(`//`);if(n!==e||!r||i.length===0)return null;let a=i.join(`//`),o=a.split(`/`).at(-1)??``,s=``;return s=r.startsWith(`./`)?r.split(`/`).at(-1)??``:(r.split(`@`).slice(0,-1).join(`@`)||r.split(`@`)[0])?.split(`/`).at(-1)??``,[`default`,`__default`].includes(o)&&s&&(o=s),{shortName:o,moduleSpecifier:r,functionName:a}}function ue(e){return le(`workflow`,e)}function de(e){return le(`step`,e)}function fe(e){return _e(de(e),e)}function pe(e){return _e(ue(e),e)}function me(e){return ue(e)?.shortName??ge(`workflow`,e)??e}function he(e){return de(e)?.shortName??ge(`step`,e)??e}function ge(e,t){if(!t.startsWith(`${e}--`))return null;let n=t.split(`--`).filter(Boolean),r=n.at(-1)?.split(`-`).filter(Boolean).at(-1)??``;if([`default`,`__default`].includes(r)){let t=n.at(-2)?.split(`-`).filter(Boolean).at(-1);t&&t!==e&&(r=t)}return r||null}function _e(e,t){return e?`${e.shortName} (${e.moduleSpecifier})`:t}const ve=(()=>{let e=globalThis.process;return e?.env?e.env.FORCE_COLOR&&e.env.FORCE_COLOR!==`0`?!0:!e.env.NO_COLOR&&!!e.stdout?.isTTY:!1})(),ye=(e,t)=>n=>ve?`\x1b[${e}m${n}\x1b[${t}m`:n,w={bold:ye(1,22),dim:ye(2,22),italic:ye(3,23),red:ye(31,39),blue:ye(34,39),cyan:ye(36,39),yellow:ye(33,39),magenta:ye(35,39)},be={info:w.blue,help:w.cyan,warn:w.yellow,error:w.red};function xe(e){let t=Array.isArray(e)?e.join(`
1
+ import{a as e,t}from"./rolldown-runtime-8V8biNmG.js";import{A as n,D as r,O as i,S as a,a as o,b as s,c,g as l,h as u,i as d,k as f,l as p,m,p as h,s as g,t as _,u as v}from"./dist-xQXN70ED.js";import{a as y,c as b,l as ee,n as te,t as ne}from"./private-UQtz8ZcW.js";import"./dist-DpYyXbJv.js";import{S as re,b as ie,c as ae,h as x,n as oe,o as se}from"./dist-CPlyFOVo.js";import{t as S}from"./env-config-DxamfI7T.js";import{types as C}from"node:util";import{AsyncLocalStorage as ce}from"node:async_hooks";function le(e,t){if(typeof t!=`string`)return null;let[n,r,...i]=t.split(`//`);if(n!==e||!r||i.length===0)return null;let a=i.join(`//`),o=a.split(`/`).at(-1)??``,s=``;return s=r.startsWith(`./`)?r.split(`/`).at(-1)??``:(r.split(`@`).slice(0,-1).join(`@`)||r.split(`@`)[0])?.split(`/`).at(-1)??``,[`default`,`__default`].includes(o)&&s&&(o=s),{shortName:o,moduleSpecifier:r,functionName:a}}function ue(e){return le(`workflow`,e)}function de(e){return le(`step`,e)}function fe(e){return _e(de(e),e)}function pe(e){return _e(ue(e),e)}function me(e){return ue(e)?.shortName??ge(`workflow`,e)??e}function he(e){return de(e)?.shortName??ge(`step`,e)??e}function ge(e,t){if(!t.startsWith(`${e}--`))return null;let n=t.split(`--`).filter(Boolean),r=n.at(-1)?.split(`-`).filter(Boolean).at(-1)??``;if([`default`,`__default`].includes(r)){let t=n.at(-2)?.split(`-`).filter(Boolean).at(-1);t&&t!==e&&(r=t)}return r||null}function _e(e,t){return e?`${e.shortName} (${e.moduleSpecifier})`:t}const ve=(()=>{let e=globalThis.process;return e?.env?e.env.FORCE_COLOR&&e.env.FORCE_COLOR!==`0`?!0:!e.env.NO_COLOR&&!!e.stdout?.isTTY:!1})(),ye=(e,t)=>n=>ve?`\x1b[${e}m${n}\x1b[${t}m`:n,w={bold:ye(1,22),dim:ye(2,22),italic:ye(3,23),red:ye(31,39),blue:ye(34,39),cyan:ye(36,39),yellow:ye(33,39),magenta:ye(35,39)},be={info:w.blue,help:w.cyan,warn:w.yellow,error:w.red};function xe(e){let t=Array.isArray(e)?e.join(`
2
2
  `):e;return be.info(`${w.bold(`hint:`)} ${t}`)}function Se(e){return be.info(`${w.bold(`docs:`)} ${e}`)}function Ce(e){return w.italic(`${w.dim("`")}${e}${w.dim("`")}`)}function T(e){return w.dim(e)}function we(e){return w.bold(e)}function Te(e){return w.red(e)}function Ee(e){return w.magenta(e)}function De(e,t){let n=[e];return t.forEach((e,r)=>{let i=e.split(`
3
3
  `),a=r===t.length-1,o=a?`╰▶ `:`├▶ `,s=a?` `:`│ `,c=i.map((e,t)=>`${t===0?o:s}${e}`);n.push(...c)}),n.join(`
4
4
  `)}var Oe=t(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),ke=t(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),Ae=t(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=Oe(),a=ke();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),je=t(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),Me=t(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),E=t(((e,t)=>{let n=ke(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=Oe(),{safeRe:a,t:o}=Ae(),s=je(),{compareIdentifiers:c}=Me();t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=+!!Number(n);if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];n===!1&&(r=[t]),c(this.prerelease[0],t)===0?isNaN(this.prerelease[1])&&(this.prerelease=r):this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),Ne=t(((e,t)=>{let n=E();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),Pe=t(((e,t)=>{let n=Ne();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),Fe=t(((e,t)=>{let n=Ne();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Ie=t(((e,t)=>{let n=E();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),Le=t(((e,t)=>{let n=Ne();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),Re=t(((e,t)=>{let n=E();t.exports=(e,t)=>new n(e,t).major})),ze=t(((e,t)=>{let n=E();t.exports=(e,t)=>new n(e,t).minor})),Be=t(((e,t)=>{let n=E();t.exports=(e,t)=>new n(e,t).patch})),Ve=t(((e,t)=>{let n=Ne();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),D=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),He=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(t,e,r)})),Ue=t(((e,t)=>{let n=D();t.exports=(e,t)=>n(e,t,!0)})),We=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Ge=t(((e,t)=>{let n=We();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),Ke=t(((e,t)=>{let n=We();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),qe=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)>0})),Je=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)<0})),Ye=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)===0})),Xe=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)!==0})),Ze=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)>=0})),Qe=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>n(e,t,r)<=0})),$e=t(((e,t)=>{let n=Ye(),r=Xe(),i=qe(),a=Ze(),o=Je(),s=Qe();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),et=t(((e,t)=>{let n=E(),r=Ne(),{safeRe:i,t:a}=Ae();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2],c=o[3]||`0`,l=o[4]||`0`,u=t.includePrerelease&&o[5]?`-${o[5]}`:``,d=t.includePrerelease&&o[6]?`+${o[6]}`:``;return r(`${s}.${c}.${l}${u}${d}`,t)}})),tt=t(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),O=t(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!h(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&g(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&p)|(this.options.loose&&m))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[l.HYPHENRANGELOOSE]:c[l.HYPHENRANGE];e=e.replace(s,oe(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[l.COMPARATORTRIM],u),o(`comparator trim`,e),e=e.replace(c[l.TILDETRIM],d),o(`tilde trim`,e),e=e.replace(c[l.CARETTRIM],f),o(`caret trim`,e);let g=e.split(` `).map(e=>v(e,this.options)).join(` `).split(/\s+/).map(e=>x(e,this.options));i&&(g=g.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[l.COMPARATORLOOSE])))),o(`range list`,g);let _=new Map,y=g.map(e=>new a(e,this.options));for(let e of y){if(h(e))return[e];_.set(e.value,e)}_.size>1&&_.has(``)&&_.delete(``);let b=[..._.values()];return r.set(t,b),b}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>_(e,n)&&t.set.some(t=>_(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(se(this.set[t],e,this.options))return!0;return!1}};let r=new(tt()),i=je(),a=nt(),o=ke(),s=E(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=Ae(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=Oe(),h=e=>e.value===`<0.0.0-0`,g=e=>e.value===``,_=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},v=(e,t)=>(e=e.replace(c[l.BUILD],``),o(`comp`,e,t),e=te(e,t),o(`caret`,e),e=b(e,t),o(`tildes`,e),e=re(e,t),o(`xrange`,e),e=ae(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,b=(e,t)=>e.trim().split(/\s+/).map(e=>ee(e,t)).join(` `),ee=(e,t)=>{let n=t.loose?c[l.TILDELOOSE]:c[l.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return y(n)?s=``:y(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:y(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},te=(e,t)=>e.trim().split(/\s+/).map(e=>ne(e,t)).join(` `),ne=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[l.CARETLOOSE]:c[l.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return y(n)?c=``:y(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:y(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a}${r} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},re=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ie(e,t)).join(` `)),ie=(e,t)=>{e=e.trim();let n=t.loose?c[l.XRANGELOOSE]:c[l.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=y(i),u=l||y(a),d=u||y(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},ae=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),x=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),oe=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=y(r)?``:y(i)?`>=${r}.0.0${e?`-0`:``}`:y(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=y(l)?``:y(u)?`<${+l+1}.0.0-0`:y(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),se=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),nt=t(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``||new l(t.value,n).test(this.value):t.operator===``?t.value===``||new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=je(),{safeRe:i,t:a}=Ae(),o=$e(),s=ke(),c=E(),l=O()})),rt=t(((e,t)=>{let n=O();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),it=t(((e,t)=>{let n=O();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),at=t(((e,t)=>{let n=E(),r=O();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),ot=t(((e,t)=>{let n=E(),r=O();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),st=t(((e,t)=>{let n=E(),r=O(),i=qe();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),ct=t(((e,t)=>{let n=O();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),lt=t(((e,t)=>{let n=E(),r=nt(),{ANY:i}=r,a=O(),o=rt(),s=qe(),c=Je(),l=Qe(),u=Ze();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),ut=t(((e,t)=>{let n=lt();t.exports=(e,t,r)=>n(e,t,`>`,r)})),dt=t(((e,t)=>{let n=lt();t.exports=(e,t,r)=>n(e,t,`<`,r)})),ft=t(((e,t)=>{let n=O();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),pt=t(((e,t)=>{let n=rt(),r=D();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),mt=t(((e,t)=>{let n=O(),r=nt(),{ANY:i}=r,a=rt(),o=D(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!a(s.semver,String(e),n))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!a(u.semver,String(e),n))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),ht=t(((e,t)=>{let n=Ae(),r=Oe(),i=E(),a=Me();t.exports={parse:Ne(),valid:Pe(),clean:Fe(),inc:Ie(),diff:Le(),major:Re(),minor:ze(),patch:Be(),prerelease:Ve(),compare:D(),rcompare:He(),compareLoose:Ue(),compareBuild:We(),sort:Ge(),rsort:Ke(),gt:qe(),lt:Je(),eq:Ye(),neq:Xe(),gte:Ze(),lte:Qe(),cmp:$e(),coerce:et(),Comparator:nt(),Range:O(),satisfies:rt(),toComparators:it(),maxSatisfying:at(),minSatisfying:ot(),minVersion:st(),validRange:ct(),outside:lt(),gtr:ut(),ltr:dt(),intersects:ft(),simplifyRange:pt(),subset:mt(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}));const gt=2**32-1,_t=gt-1;var k=class extends Error{constructor(e,t,n,r){super(e),this.name=`DevalueError`,this.path=t.join(``),this.value=n,this.root=r}};const vt=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function yt(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getPrototypeOf(t)===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===vt}function bt(e){return Object.prototype.toString.call(e).slice(8,-1)}function xt(e){switch(e){case`"`:return`\\"`;case`<`:return`\\u003C`;case`\\`:return`\\\\`;case`
@@ -11,5 +11,5 @@ import{o as e,t}from"./rolldown-runtime-DaDcL9Zw.js";import{A as n,D as r,O as i
11
11
  `)}function Yi(e){let t=e.trimStart();return t.startsWith(`at `)?!!(t.includes(`node:internal/`)||t.includes(`node_modules/.pnpm/`)||t.includes(`node_modules__pnpm_`)||t.includes(`_next_dist_`)||t.includes(`node_modules/next/`)||t.includes(`node_modules/@opentelemetry/`)||t.includes(`node_modules/vitest/`)||t.includes(`node_modules/@vitest/`)):!1}function Xi(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function Zi(e){return T(e.padEnd(6))}function Qi(e,t,n,r){let i=t||T(`—`),a=n&&(e===`run`?ue(n):de(n))?`${T(`·`)} ${r(n)}`:``;return` ${Zi(e)} ${i}${a?` `+a:``}`}function $i(e){if(typeof e==`string`)return e.includes(`
12
12
  `)?e.split(`
13
13
  `).map((e,t)=>t===0?e:` ${e}`).join(`
14
- `):e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}var ea=class e extends Error{steps;globalThis;stepCount;hookCount;waitCount;attributeCount;hookDisposedCount;abortCount;constructor(e,t){let r=[...e.values()],i=0,a=0,o=0,s=0,c=0,l=0;for(let e of r)e.type===`step`?i++:e.type===`hook`?e.disposed?c++:e.abortRequested?l++:a++:e.type===`wait`?o++:e.type===`attribute`&&s++;let u=[];i>0&&u.push(`${i} ${n(`step`,`steps`,i)}`),a>0&&u.push(`${a} ${n(`hook`,`hooks`,a)}`),o>0&&u.push(`${o} ${n(`wait`,`waits`,o)}`),s>0&&u.push(`${s} ${n(`attribute write`,`attribute writes`,s)}`),c>0&&u.push(`${c} hook ${n(`disposal`,`disposals`,c)}`);let d=n(`has`,`have`,i+a+o+s+c),f=+(i>0)+ +(a>0)+ +(o>0)+ +(s>0)+ +(c>0),p;p=f>1?`processed`:i>0?`run`:a>0||o>0?`created`:s>0?`written`:c>0?`processed`:`received`;let m=u.length>0?`${u.join(` and `)} ${d} not been ${p} yet`:`0 steps have not been run yet`;super(m),this.name=`WorkflowSuspension`,this.steps=r,this.globalThis=t,this.stepCount=i,this.hookCount=a,this.waitCount=o,this.attributeCount=s,this.hookDisposedCount=c,this.abortCount=l}static is(t){return t instanceof e}};function ta(){throw new r(`This API is not available inside a workflow function. Workflow functions run in a deterministic VM; move the call to a step function for full Node.js access.`)}function J(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const na=J(`workflow.name`),ra=J(`workflow.operation`),ia=J(`workflow.run.id`),aa=J(`workflow.run.status`),oa=J(`workflow.started_at`),sa=J(`workflow.events.count`),ca=J(`workflow.execution.mode`),la=J(`workflow.events.parked.count`),ua=J(`workflow.events.parked.event_id`),da=J(`workflow.events.parked.event_type`),fa=J(`workflow.arguments.count`),pa=J(`workflow.result.type`),ma=J(`workflow.trace.propagated`),ha=J(`workflow.trace.mode`),ga=J(`workflow.turbo`),_a=J(`workflow.error.name`),va=J(`workflow.error.message`),ya=J(`workflow.error.code`),ba=J(`workflow.steps.created`),xa=J(`workflow.hooks.created`),Sa=J(`workflow.waits.created`),Ca=J(`workflow.inline_ownership.owned_recovery_steps`),wa=J(`workflow.inline_ownership.backstop_wakes_armed`),Ta=J(`workflow.route.type`),Ea=J(`workflow.route.handler_cached`),Da=J(`workflow.route.invocation_count`),Oa=J(`workflow.route.entrypoint_age_ms`),ka=J(`workflow.route.module_body_init_ms`),Aa=J(`faas.instance`),ja=J(`step.name`),Ma=J(`step.id`),Na=J(`step.attempt`),Pa=J(`step.status`),Fa=J(`step.max_retries`),Ia=J(`step.ttfs_ms`),La=J(`step.stso_ms`),Ra=J(`step.rsfs_ms`),za=J(`step.final_scheduling_replay_ms`),Ba=J(`step.latency_optimizations`),Va=J(`step.skipped`),Ha=J(`step.skip_reason`),Ua=J(`step.arguments.count`),Wa=J(`step.result.type`),Ga=J(`step.error.name`),Ka=J(`step.error.message`),qa=J(`step.fatal_error`),Ja=J(`step.retry.exhausted`),Ya=J(`step.retry.timeout_seconds`),Xa=J(`step.retry.will_retry`),Za=J(`messaging.system`),Qa=J(`messaging.destination.name`),$a=J(`messaging.message.id`),eo=J(`messaging.operation.type`),to=J(`workflow.queue.overhead_ms`),no=J(`deployment.id`),ro=J(`workflow.deployment.pinned_id`),io=J(`workflow.deployment_mismatch.retry_count`),ao=J(`workflow.deployment_mismatch.recovered`),oo=J(`workflow.hook.token`),so=J(`workflow.hook.id`),co=J(`workflow.hook.found`),lo=J(`workflow.hook.resilient_resume`),uo=J(`workflow.hook.resilient_resume_materialized`),fo=J(`workflow.resume_setup_source`),po=J(`workflow.suspension.state`),mo=J(`workflow.suspension.hook_count`),ho=J(`workflow.suspension.step_count`),go=J(`workflow.suspension.wait_count`),_o=J(`http.request.method`),vo=J(`http.route`),yo=J(`http.response.status_code`),bo=J(`error.type`),xo=J(`workflow.events.pages_loaded`),So=J(`workflow.queue.deserialize_time_ms`),Co=J(`workflow.queue.execution_time_ms`),wo=J(`workflow.queue.serialize_time_ms`),To=J(`workflow.serialization.operation`),Eo=J(`workflow.serialization.compressed`),Do=J(`workflow.serialization.codec`),Oo=J(`workflow.serialization.uncompressed_bytes`),ko=J(`workflow.serialization.stored_bytes`),Ao=J(`workflow.serialization.compression_ratio`),jo=J(`workflow.serialization.guest_code_executions`),Mo=J(`workflow.serialization.guest_code_details`),No=J(`peer.service`),Po=J(`rpc.system`),Fo=J(`rpc.service`),Io=J(`rpc.method`),Lo=J(`error.retryable`),Ro=J(`error.category`),zo=new Set;function Bo(){let e=process.env.WORKFLOW_TRACE_MODE;return e===`continuous`?`continuous`:(e&&e!==`linked`&&!zo.has(e)&&(zo.add(e),X.warn(`Unrecognized WORKFLOW_TRACE_MODE value "${e}"; expected "linked" or "continuous". Falling back to "linked".`)),`linked`)}function Vo(e){return e!==void 0&&Object.keys(e).length>0}function Ho(e,t){return e===`linked`&&Vo(t)?Promise.resolve(t):Wo()}async function Uo(e,t){if(e!==`linked`)return rs();let n=await is(Vo(t)?t:void 0);return n?[n]:void 0}async function Wo(){let e=await Y.value;if(!e)return{};let t={};return e.propagation.inject(e.context.active(),t),t}async function Go(e){let t=await Y.value;if(t)return t.propagation.extract(t.context.active(),e)}async function Ko(e,t){if(!e)return t();let n=await Y.value;if(!n)return t();let r=await Go(e);return r?n.context.with(r,async()=>await t()):t()}const Y=b(async()=>{try{return await import(`./src-Cj3P1ChQ.js`).then(t=>e(t.t(),1))}catch{return X.info(`OpenTelemetry not available, tracing will be disabled`),null}}),qo=b(async()=>{let e=await Y.value;if(!e)return null;let t=e.trace.getTracer(`workflow`);return Yo(e,t),t});let Jo=!1;function Yo(e,t){let n=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`);if(!(Jo||!n)){Jo=!0;try{let n=globalThis[Symbol.for(`opentelemetry.js.api.1`)],r=e.trace.getTracerProvider(),i=r.getDelegate?.()??r,a=t.startSpan(`workflow.otel.probe.core`);console.warn(`[workflow:otel-diag] core`,JSON.stringify({globalRegistrationVersion:n?.version??null,providerCtor:r?.constructor?.name??null,delegateCtor:i?.constructor?.name??null,tracerCtor:t?.constructor?.name??null,probeCtor:a?.constructor?.name??null,probeRecording:a.isRecording()})),a.end()}catch(e){console.warn(`[workflow:otel-diag] core failed:`,e instanceof Error?e.message:e)}}}async function Xo(e,...t){let[n,r]=await Promise.all([qo.value,Y.value]),{fn:i,opts:a}=typeof t[0]==`function`?{fn:t[0],opts:{}}:{fn:t[1],opts:t[0]};if(!i)throw Error(`Function to trace must be provided`);return!n||!r?await i():n.startActiveSpan(e,a,async e=>{try{let t=await i(e);return e.setStatus({code:r.SpanStatusCode.OK}),t}catch(t){throw ea.is(t)?(e.setStatus({code:r.SpanStatusCode.OK}),Qo(t,e)):e.setStatus({code:r.SpanStatusCode.ERROR,message:t.message}),t}finally{e.end()}})}async function Zo(e,t,n){let r=await qo.value;r&&r.startSpan(e,{...n,startTime:t}).end()}function Qo(e,t){t.setAttributes({...po(`suspended`),...ho(e.stepCount),...mo(e.hookCount),...go(e.waitCount)})}async function $o(e){let[t,n]=await Promise.all([Go(e),Y.value]);if(!(!t||!n))return n.trace.getSpanContext(t)}async function es(){return await ns(e=>e.trace.getActiveSpan())}async function ts(e){return ns(t=>t.SpanKind[e])}async function ns(e){let t=await Y.value;if(t)return await e(t)}function rs(){return ns(e=>{let t=e.trace.getActiveSpan()?.spanContext();if(t)return[{context:t}]})}async function is(e){if(!e)return;let[t,n]=await Promise.all([$o(e),Y.value]);if(!(!t||!n)&&n.trace.isSpanContextValid(t))return{context:t}}async function as(e,t){let n=await Y.value;if(!n)return t();let r=n.propagation.createBaggage({"workflow.run_id":{value:e.workflowRunId},"workflow.name":{value:e.workflowName}}),i=n.propagation.setBaggage(n.context.active(),r);return n.context.with(i,()=>t())}function os(e,t){if(!t)return!1;let n=!1;for(let r of t.split(`,`)){let t=r.trim();if(!t)continue;let i=t.startsWith(`-`),a=i?t.slice(1):t;RegExp(`^${a.replace(/[|\\{}()[\]^$+?.]/g,`\\$&`).replace(/\*/g,`.*`)}$`).test(e)&&(n=!i)}return n}function ss(e,t={}){let n=r=>{let i=n=>t.debugNamespace??`workflow:${e}:${n}`,a=t=>{let n=i(t);return(i,a)=>{let o=Object.keys(r).length>0,s=a&&Object.keys(a).length>0,c=o||s?{...r,...a??{}}:void 0;(t===`error`||t===`warn`)&&(t===`error`?console.error:console.warn)(Ki(`[workflow-sdk]`,i,c)),os(n,process.env.DEBUG)&&(console.debug(`[${n}] ${i}`,c??``),es().then(n=>{n?.addEvent(`${t}.${e}`,{message:i,...c})}).catch(()=>{}))}};return{debug:a(`debug`),info:a(`info`),warn:a(`warn`),error:a(`error`),child:e=>n({...r,...e}),forRun:(e,t,i)=>n({...r,workflowRunId:e,...t===void 0?{}:{workflowName:t},...i??{}})}};return n({})}const cs=ss(`step`),X=ss(`runtime`),ls=ss(`webhook`),us=ss(`events`);ss(`adapter`),ss(`build`,{debugNamespace:`workflow:build`});function ds(e){if(h.is(e))throw e}function Z(e,t){let n=e.includes(`return value`)?`returning`:`passing`,r=`Failed to serialize ${e}`;t instanceof k&&t.path&&(r+=` at path "${t.path}"`);let i=`Ensure you're ${n} workflow serializable types. Check the serialization docs to see what's serializable: https://workflow-sdk.dev/docs/foundations/serialization`;return t instanceof k&&t.value!==void 0&&X.error(`Serialization failed`,{context:e,problematicValue:t.value}),{message:r,hint:i}}async function fs(e,t,n){try{let r=G.serialize(e,`client`,n);return Ui(await Mi(K(W.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){ds(e);let{message:t,hint:n}=Z(`client value`,e);throw new m(t,{hint:n,cause:e})}}async function ps(e,t,n){let r=await Ni(await Gi(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(G.deserializeLegacy)return G.deserializeLegacy(r,`client`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=q(r);if(i===W.DEVALUE_V1)return G.deserialize(a,`client`,n);throw Error(`Unsupported serialization format: ${i}`)}async function ms(e,t,n){try{let r=G.serialize(e,`step`,n);return Ui(await Mi(K(W.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){ds(e);let{message:t,hint:n}=Z(`step value`,e);throw new m(t,{hint:n,cause:e})}}async function hs(e,t,n){let r=await Ni(await Gi(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(G.deserializeLegacy)return G.deserializeLegacy(r,`step`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=q(r);if(i===W.DEVALUE_V1)return G.deserialize(a,`step`,n);throw Error(`Unsupported serialization format: ${i}`)}function gs(e,t){if(!(e instanceof Uint8Array)){if(G.deserializeLegacy)return G.deserializeLegacy(e,`workflow`,t);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:n,payload:r}=q(e);if(n===W.DEVALUE_V1)return G.deserialize(r,`workflow`,t);throw Error(`Unsupported serialization format: ${n}`)}const _s=Symbol.for(`WORKFLOW_STEP_CONTEXT_STORAGE`),vs=(()=>{let e=globalThis;return e[_s]??=new ce,e[_s]})();function ys(e,t,r){if(e===0&&t===0&&r===0)return null;let i=[];e>0&&i.push(`${e} ${n(`step`,`steps`,e)}`),t>0&&i.push(`${t} ${n(`hook`,`hooks`,t)}`),r>0&&i.push(`${r} ${n(`timer`,`timers`,r)}`);let a=[];e>0&&a.push(`steps are completed`),t>0&&a.push(`hooks are received`),r>0&&a.push(`timers have elapsed`);let o=a.join(` and `);return`${i.join(` and `)} to be enqueued\n Workflow will suspend and resume when ${o}`}function bs(e,t){let n=`${e.replace(`wrun_`,`strm_`)}_user`;return t?`${n}_${Buffer.from(t,`utf-8`).toString(`base64url`)}`:n}function xs(e){return`strm_${e}_system_abort`}function Ss(e){if(!e.startsWith(`abrt_`))throw Error(`Invalid abort hook token format: expected "abrt_" prefix, got "${e}"`);return xs(e.slice(5))}const Cs=()=>S(`WORKFLOW_DEFERRED_CHECK_DELAY_MS`,100,{integer:!0,min:10}),ws=new Set([`hook_received`,`hook_conflict`,`wait_completed`,`attr_set`,`run_cancelled`]),Ts=new Set([`wait_completed`]);function Es(e,t){return`${e}:${t}`}const Ds=new Set([`run_completed`,`run_failed`,`run_cancelled`]);var Q;(function(e){e[e.Consumed=0]=`Consumed`,e[e.NotConsumed=1]=`NotConsumed`,e[e.Finished=2]=`Finished`})(Q||={});var Os=class{eventIndex;events;callbacks=[];parked=[];resolved=new Set;onConsumedEvent;onUnconsumedEvent;getPromiseQueue;isDeliveryIdle;pendingUnconsumedCheck=null;pendingUnconsumedTimeout=null;unconsumedCheckVersion=0;constructor(e,t){this.events=[...e],this.eventIndex=0,this.onConsumedEvent=t.onConsumedEvent,this.onUnconsumedEvent=t.onUnconsumedEvent,this.getPromiseQueue=t.getPromiseQueue,this.isDeliveryIdle=t.isDeliveryIdle}get strandedEvent(){return this.parked[0]?.event}get parkedSummary(){let e=this.parked[0]?.event;if(e)return{count:this.parked.length,eventId:e.eventId,eventType:e.eventType}}append(e){for(let t of e)this.events.push(t);process.nextTick(this.consume)}subscribe(e){this.callbacks.push(e),this.pendingUnconsumedCheck!==null&&(this.unconsumedCheckVersion++,this.pendingUnconsumedCheck=null,this.pendingUnconsumedTimeout!==null&&(clearTimeout(this.pendingUnconsumedTimeout),this.pendingUnconsumedTimeout=null)),process.nextTick(this.consume)}notifyConsumedEvent(e){if(this.onConsumedEvent)try{this.onConsumedEvent(e)}catch(e){us.error(`onConsumedEvent callback threw an error`,{error:e})}}consume=()=>{for(;;){this.drainParked();let e=this.events[this.eventIndex]??null,t=this.offer(e);if(t&&this.eventIndex++,e===null){t||this.handleEndOfLog();return}if(!t){this.scheduleUnconsumedCheck(e,!0);return}}};offer(e){for(let t=0;t<this.callbacks.length;t++){let n=this.callbacks[t],r=Q.NotConsumed;try{r=n(e)}catch(e){us.error(`EventConsumer callback threw an error`,{error:e})}if(!(r!==Q.Consumed&&r!==Q.Finished))return e!==null&&(e.correlationId&&Ts.has(e.eventType)&&this.resolved.add(Es(e.eventType,e.correlationId)),this.notifyConsumedEvent(e)),r===Q.Finished&&this.callbacks.splice(t,1),!0}return!1}drainParked(){let e=this.parked.length>0;for(;e;){e=!1;for(let t=0;t<this.parked.length;t++){let n=this.parked[t],r=this.eventIndex;this.eventIndex=n.index;let i;try{i=this.offer(n.event)}finally{this.eventIndex=r}if(i){this.parked.splice(t,1),e=this.parked.length>0;break}}}}park(e){return!ws.has(e.eventType)||e.correlationId&&this.resolved.has(Es(e.eventType,e.correlationId))?!1:(this.parked.push({event:e,index:this.eventIndex}),this.eventIndex++,us.debug(`Parked an unclaimed event for later delivery`,{eventId:e.eventId,eventType:e.eventType,correlationId:e.correlationId,parked:this.parked.length}),!0)}handleEndOfLog(){if(this.parked.length===0)return;let e=this.events.at(-1);if(!e||!Ds.has(e.eventType)){us.debug(`Reached the end of the log still holding events`,{eventId:this.parked[0].event.eventId,eventType:this.parked[0].event.eventType,correlationId:this.parked[0].event.correlationId,parked:this.parked.length});return}this.scheduleUnconsumedCheck(this.parked[0].event,!1)}scheduleUnconsumedCheck(e,t){let n=++this.unconsumedCheckVersion;this.pendingUnconsumedCheck=this.getPromiseQueue().then(()=>new Promise(e=>setTimeout(e,0))).then(()=>this.getPromiseQueue()).then(()=>{this.whenDeliveryIdle(n,()=>{this.pendingUnconsumedTimeout=setTimeout(()=>{if(this.pendingUnconsumedTimeout=null,this.unconsumedCheckVersion===n){if(this.pendingUnconsumedCheck=null,t){if(this.events[this.eventIndex]!==e)return;if(this.park(e)){this.consume();return}}this.onUnconsumedEvent(e)}},Cs())})})}whenDeliveryIdle(e,t){let n=()=>{if(this.pendingUnconsumedTimeout=null,this.unconsumedCheckVersion===e){if(this.isDeliveryIdle()){t();return}this.getPromiseQueue().then(()=>{this.unconsumedCheckVersion===e&&(this.pendingUnconsumedTimeout=setTimeout(n,0))})}};n()}},ks=class{aborted=!1;reason=void 0;[P];[F];#e=[];#t=null;get onabort(){return this.#t}set onabort(e){this.#t=e,e&&this.aborted&&e.call(this)}constructor(e,t){this[P]=e,this[F]=t}_setAborted(e){if(!this.aborted){this.aborted=!0,this.reason=e,this.#t&&this.#t.call(this);for(let e of this.#e)e();this.#e=[]}}addEventListener(e,t){if(e===`abort`){if(this.aborted){t();return}this.#e.push(t)}}removeEventListener(e,t){e===`abort`&&(this.#e=this.#e.filter(e=>e!==t))}throwIfAborted(){if(this.aborted)throw this.reason??new DOMException(`The operation was aborted.`,`AbortError`)}};function As(e){return class{signal;[P];[F];constructor(){let t=e.generateUlid(),n=xs(t),r=`abrt_${t}`;this[P]=n,this[F]=r,this.signal=new ks(n,r);let i=`hook_${e.generateUlid()}`;e.invocationsQueue.set(i,{type:`hook`,correlationId:i,token:r,isWebhook:!1,isSystem:!0}),e.eventsConsumer.subscribe(t=>{if(!t||t.correlationId!==i)return Q.NotConsumed;let n=`eventData`in t&&t.eventData&&`token`in t.eventData?t.eventData.token:void 0;if(typeof n==`string`&&n!==this[F])return e.promiseQueue=e.promiseQueue.then(()=>{e.onWorkflowError(new p(`Replay divergence: abort hook event ${t.eventType} for ${i} belongs to token "${n}", but the current abort hook expects "${this[F]}"`,{eventId:t.eventId}))}),Q.Finished;if(t.eventType===`hook_created`){let t=e.invocationsQueue.get(i);return t&&t.type===`hook`&&(t.hasCreatedEvent=!0),Q.Consumed}if(t.eventType===`hook_received`){let n=t.eventData?.payload,r=e.eventsConsumer.eventIndex,a=y(e,r,`hook`),o=ne(e,r,`hook`);return e.pendingDeliveries++,e.promiseQueue=e.promiseQueue.then(async()=>{let r;try{if(n!==void 0)try{let i=await e.replayPayloadCache.prepareEventPayload(t.eventId,`payload`,n),a=await jc(n,e.runId,e.encryptionKey,e.globalThis,{},i);a&&typeof a==`object`&&`reason`in a&&(r=a.reason)}catch{}}finally{e.pendingDeliveries--}o.then(()=>{a.markDelivered(),this.signal._setAborted(r)})}),e.invocationsQueue.delete(i),Q.Consumed}return t.eventType===`hook_disposed`?(e.invocationsQueue.delete(i),Q.Finished):Q.NotConsumed})}abort(t){if(!this.signal.aborted){this.signal._setAborted(t);for(let[,n]of e.invocationsQueue)if(n.type===`hook`&&n.token===this[F]){n.abortRequested=!0,n.abortReason=t;break}}}}}function js(){return{abort(e){let t=new ks(``,``);return t._setAborted(e??new DOMException(`The operation was aborted.`,`AbortError`)),t},any(e){let t=new ks(``,``),n=Array.from(e);for(let e of n)if(e.aborted)return t._setAborted(e.reason),t;let r=[],i=()=>{for(let{signal:e,listener:t}of r)e.removeEventListener&&e.removeEventListener(`abort`,t);r.length=0};for(let e of n){if(!e.addEventListener)continue;let n=()=>{t.aborted||(t._setAborted(e.reason),i())};r.push({signal:e,listener:n}),e.addEventListener(`abort`,n)}return t},timeout(){throw Error(`AbortSignal.timeout() is not supported in workflow functions. Use sleep() with an AbortController instead. See: /docs/errors/abort-signal-timeout-in-workflow`)}}}const Ms=se();function Ns(e){try{return e.getReader({mode:`byob`}).releaseLock(),`bytes`}catch{}}function Ps(e){return ds(e),e instanceof m&&e.cause!==void 0||e instanceof r&&e.cause!==void 0?e.cause:e}async function $(e,t){if(e.recorded)try{let n=await es();if(!n)return;let r=e.uncompressedBytes??0,i=e.storedBytes??0;n.setAttributes({...To(t),...Eo(e.compressed??!1),...Do(e.codec??`none`),...Oo(r),...ko(i),...e.compressed&&r>0?Ao(1-i/r):{}})}catch{}}async function Fs(e){if(e.executions.length!==0)try{let t=await es();if(!t)return;let n=[...new Set(e.executions.map(e=>e.detail?`${e.kind} (${e.detail})`:e.kind))];t.setAttributes({...jo(e.executions.length),...Mo(n)})}catch{}}function Is(e,t){let n=new TextEncoder,r={resolved:!1,key:void 0},i;return new TransformStream({async transform(a,o){try{r.resolved||(r.key=await Hi(t),r.resolved=!0,zi(r.key)&&(i=Zn(r.key.recipientPublicKey,r.key.aad)));let s=j(a,e),c=n.encode(s),l=K(W.DEVALUE_V1,c);i?l=K(W.SEALED,await i.seal(l)):r.key&&(l=await Ui(l,r.key));let u=new Uint8Array(4+l.length);new DataView(u.buffer).setUint32(0,l.length,!1),u.set(l,4),o.enqueue(u)}catch(e){if(h.is(e)){o.error(e);return}let{message:t,hint:n}=Z(`stream chunk`,e);o.error(new m(t,{hint:n,cause:e}))}}})}function Ls(e,t){let n=new TextDecoder,r=new Uint8Array,i={resolved:!1,key:void 0},a;function o(e){let t=new Uint8Array(r.length+e.length);t.set(r,0),t.set(e,r.length),r=t}async function s(o){for(i.resolved||(i.key=await Hi(t),i.resolved=!0,Bi(i.key)&&(a=Qn(i.key.keyPair,i.key.aad)));r.length>=4;){let t=new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,!1);if(r.length<4+t)break;let s=r.slice(4,4+t);r=r.slice(4+t);let{format:c,payload:l}=q(s);if(c===W.ENCRYPTED||c===W.SEALED){let e=c===W.SEALED;if(!(e?Bi(i.key):Vi(i.key)!==void 0)){o.error(new h(e?`Sealed stream data encountered but no run keypair is available. Opening a sealed frame requires the run's own encryption key material.`:`Encrypted stream data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.`,{context:{operation:`decrypt`,byteLength:l.byteLength,formatPrefix:e?`encp`:`encr`}}));return}let t;try{t=e?await a.open(q(s).payload):await Gi(s,i.key)}catch(e){throw h.is(e)&&e.context&&(e.context.formatPrefix=c),e}({format:c,payload:l}=q(t))}if(c===W.DEVALUE_V1){let t=n.decode(l);o.enqueue(Gt(t,e))}}}return new TransformStream({async transform(t,i){if(r.length===0&&t.length>=4){let e=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(0,!1);if(e>0&&e<1e8){o(t),await s(i);return}}else if(r.length>0){o(t),await s(i);return}let a=n.decode(t).split(`
15
- `);for(let t of a)t.length>0&&i.enqueue(Gt(t,e))},async flush(e){r.length>0&&await s(e)}})}const Rs=1e8;function zs(){return new TransformStream({transform(e,t){if(e.length===0)return;if(e.length>Rs){t.error(new r(`Byte-stream chunk of ${e.length} bytes exceeds the maximum framed chunk size (${Rs}). Split the data into smaller chunks before writing.`,{slug:`serialization-failed`}));return}let n=new Uint8Array(4+e.length);new DataView(n.buffer).setUint32(0,e.length,!1),n.set(e,4),t.enqueue(n)}})}function Bs(){let e=new Uint8Array;function t(t){let n=new Uint8Array(e.length+t.length);n.set(e,0),n.set(t,e.length),e=n}return new TransformStream({transform(n,i){for(n.length>0&&t(n);e.length>=4;){let t=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!1);if(t>Rs){i.error(new r(`Byte-stream frame length ${t} exceeds maximum (${Rs}). This usually means a non-framed byte stream is being read as framed.`,{slug:`serialization-failed`}));return}let n=4+t;if(e.length<n)break;i.enqueue(e.slice(4,n)),e=e.slice(n)}},flush(t){e.length>0&&t.error(new r(`Byte-stream ended with ${e.length} bytes of incomplete frame data. The stream was truncated mid-frame.`,{slug:`serialization-failed`}))}})}function Vs(e,t,n,r,i){(async()=>{await Zo(`workflow.stream.read`,e,{kind:await ts(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`read`,"workflow.stream.read.ttfc_ms":Date.now()-e,...typeof i==`number`?{"workflow.stream.read.connect_ms":i}:{},...typeof r==`number`?{"workflow.stream.start_index":r}:{}}})})()}function Hs(e,t,n,r,i,a){(async()=>{await Zo(`workflow.stream.read.complete`,e,{kind:await ts(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`read_complete`,"workflow.stream.read.total_ms":Date.now()-e,"workflow.stream.read.chunks":r,"workflow.stream.read.bytes":i,...typeof a==`number`?{"workflow.stream.read.reconnects":a}:{}}})})()}var Us=class extends ReadableStream{#e;constructor(e,t,n){if(typeof t!=`string`||t.length===0)throw new r(`"name" is required, got "${t}"`);let i,a=!1,o,s=0,c=0;super({type:`bytes`,pull:async r=>{let l=this.#e;if(!l){i===void 0&&(i=Date.now());let r=await Nn(),a=Date.now(),s=await r.streams.get(e,t,n);o=Date.now()-a,l=this.#e=s.getReader()}if(!l){r.error(Error(`Failed to get reader`));return}let u=await l.read();u.done?(this.#e=void 0,i!==void 0&&Hs(i,e,t,s,c),r.close()):(!a&&u.value.byteLength>0&&i!==void 0&&(a=!0,Vs(i,e,t,n,o)),s+=1,c+=u.value.byteLength,r.enqueue(u.value))},cancel:async e=>{this.#e&&=(await this.#e.cancel(e).catch(()=>{}),void 0)}})}};const Ws=()=>S(`WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`,50,{integer:!0,min:1}),Gs=()=>S(`WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`,1e3,{integer:!0,min:1});function Ks(e,t,n){let r=n===void 0||n>=0,i=n??0,a=0,o=0,s=0,c,l=new Uint8Array,u,d,f=!1,p=0,m=0;async function h(){let o=await Nn(),s=r?i+a:n,l=Date.now(),u=await o.streams.get(e,t,s);d===void 0&&(d=Date.now()-l),c=u.getReader()}async function g(){c&&=(await c.cancel().catch(()=>{}),void 0),i+=a,a=0,l=new Uint8Array;let e=Ws(),n=Gs();for(;;){if(o++,s++,o>e)throw Error(`Stream "${t}" exceeded maximum reconnection attempts (${e})`);if(s>n)throw Error(`Stream "${t}" exceeded maximum total reconnection attempts (${n})`);try{await h();return}catch{}}}return new ReadableStream({pull:async i=>{for(u===void 0&&(u=Date.now());;){if(!c)try{await h()}catch(e){i.error(e);return}let _;try{_=await c.read()}catch(e){if(!r){i.error(e);return}try{await g()}catch(e){i.error(e);return}continue}if(_.done||!_.value){c=void 0,u!==void 0&&Hs(u,e,t,p,m,s),i.close();return}let v=_.value;if(v.length>0){let e=new Uint8Array(l.length+v.length);e.set(l,0),e.set(v,l.length),l=e}let y=!1;for(;l.length>=4;){let r=4+new DataView(l.buffer,l.byteOffset,l.byteLength).getUint32(0,!1);if(l.length<r)break;i.enqueue(l.slice(0,r)),l=l.slice(r),a++,p++,m+=r,!f&&u!==void 0&&(f=!0,Vs(u,e,t,n,d)),y=!0}if(y){o=0;return}}},cancel:async()=>{c&&=(await c.cancel().catch(e=>{console.warn(`Error closing ReadableStream reader:`,e)}),void 0)}})}const qs=()=>{let e=S(`WORKFLOW_STREAM_FLUSH_INTERVAL_MS`,NaN,{integer:!0});return Number.isNaN(e)?void 0:e};function Js(e,t,n,r,i,a,o){(async()=>{await Zo(`workflow.stream.flush`,e,{kind:await ts(`CLIENT`),attributes:{"workflow.run.id":n,"workflow.stream.name":r,"workflow.stream.operation":`flush`,"workflow.stream.flush.buffer_dwell_ms":t-e,"workflow.stream.flush.chunks":i,"workflow.stream.flush.bytes":a,"workflow.stream.write.chunk_rtt":o}})})()}function Ys(e,t,n){(async()=>{await Zo(`workflow.stream.close`,e,{kind:await ts(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`close`,"workflow.stream.close.rpc_ms":Date.now()-e}})})()}var Xs=class extends WritableStream{constructor(e,t,n){if(typeof e!=`string`)throw new r(`"runId" must be a string, got "${typeof e}"`);if(typeof t!=`string`||t.length===0)throw new r(`"name" is required, got "${t}"`);let i=Nn(),a=n,o=async()=>{if(a){try{await a}catch{}a=void 0}},s=[],c=0,l=0,u=0,d=null,f=null,p,m=qs(),h=null,g=_n(),_=vn(),v=gn(),y=yn(),b,ee=[],te=[],ne=e=>{let t=[...ee,...te];ee=[],te=[];for(let n of t)n.reject(e)},re=()=>{let e=0,t=0;for(let n of s){if(e>=g||e>0&&t+n.byteLength>_)break;e++,t+=n.byteLength}let n=s.slice(0,e);return s=s.slice(e),c-=t,{group:n,bytes:t}},ie=async(n,r,a)=>{await o();let s=await i,c=Date.now();if(typeof s.streams.writeMulti==`function`&&n.length>1)await s.streams.writeMulti(e,t,n);else for(let r of n)await s.streams.write(e,t,r);a!==void 0&&Js(a,c,e,t,n.length,r,Date.now()-c)},ae=async()=>{for(;s.length>0;){d&&=(clearTimeout(d),null);let e=b,t=Date.now(),{group:n,bytes:r}=re();l=n.length,u=r,b=s.length>0?t:void 0;try{await ie(n,r,e),l=0,u=0}catch(t){throw s=n.concat(s),c+=r,l=0,u=0,b=e!==void 0&&b!==void 0?Math.min(e,b):e??b,t}let i=ee;ee=[];for(let e of i)e.resolve()}},x=()=>{f||p!==void 0||s.length===0||(f=ae().then(()=>{if(f=null,s.length>0){x();return}let e=te;te=[];for(let t of e)t.resolve()},e=>{f=null,p??=e,ne(p)}))},oe=()=>{if(!(d||f)){if(m===void 0){h??=Promise.resolve(i).then(e=>{m=e.streamFlushIntervalMs??0},()=>{m=0}).then(()=>{s.length>0&&oe()});return}if(m<=0){x();return}d=setTimeout(()=>{d=null,x()},m)}},se=async()=>{for(;;){if(p!==void 0)throw p;if(s.length===0&&!f)return;x(),await new Promise((e,t)=>{te.push({resolve:e,reject:t})})}};super({async write(e){if(p!==void 0)throw p;for(b===void 0&&(b=Date.now()),s.push(e),c+=e.byteLength,s.length>=g||c>=_?x():oe();p===void 0&&(s.length+l>=v||c+u>=y);)x(),await new Promise((e,t)=>{ee.push({resolve:e,reject:t})});if(p!==void 0)throw p},async close(){await se(),await o();let n=await i,r=Date.now();await n.streams.close(e,t),Ys(r,e,t)},async abort(e){try{await se()}catch{}d&&=(clearTimeout(d),null),s=[],c=0,p??=e??Error(`Stream aborted`),ne(p)}}),Object.defineProperty(this,un,{value:se,enumerable:!1,writable:!1})}};function Zs(e=globalThis){let t=b(()=>nc(e,`Request`)),n=b(()=>nc(e,`Response`));return{...$r(),...ui(),...ci(e),Request:e=>{if(!V(e,t.value))return!1;let n={method:B(e,`method`),url:B(e,`url`),headers:B(e,`headers`),body:B(e,`body`),duplex:B(e,`duplex`)},r=B(e,fn);r&&(n.responseWritable=r);let i=B(e,`signal`);return i&&(B(i,`aborted`)||B(i,P))&&(n.signal=i),n},Response:e=>V(e,n.value)?{type:B(e,`type`),url:B(e,`url`),status:B(e,`status`),statusText:B(e,`statusText`),headers:B(e,`headers`),body:B(e,`body`),redirected:B(e,`redirected`)}:!1}}function Qs(e,t,n,r,i,a){let o=t[P],s=t[F];if(!o){let e=(n[an]||Ms)();o=xs(e),s=`abrt_${e}`,t[P]=o,t[F]=s,t.signal&&(t.signal[P]=o,t.signal[F]=s)}return ec(e,o,i,a,r),{streamName:o,hookToken:s,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function $s(e,t){let n=t[P]??t.signal?.[P],r=t[F]??t.signal?.[F];if(!n)throw Error(`AbortController/AbortSignal stream name is not set`);return{streamName:n,hookToken:r,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function ec(e,t,n,r,i){e.aborted||e[mn]||(e[mn]=!0,e.addEventListener(`abort`,()=>{i.push((async()=>{try{let i=await Hi(r),a=await wc({aborted:!0,reason:e.reason},n,i),o=new Xs(n,t).getWriter();await o.write(a),await o.close()}catch{}})())},{once:!0}))}function tc(e=globalThis,t,n,r,i=!1,a){return{...Zs(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new m(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=`strm_${(e[an]||Ms)()}`,c=Ns(o),l=new Xs(n,s,a);c===`bytes`?i?t.push(o.pipeThrough(zs()).pipeTo(l)):t.push(o.pipeTo(l)):t.push(o.pipeThrough(Is(tc(e,t,n,r,i,a),r)).pipeTo(l));let u={name:s};return c&&(u.type=c),c===`bytes`&&i&&(u.framing=`framed-v1`),u},WritableStream:r=>{if(!(r instanceof e.WritableStream))return!1;let i=r[M],a=r[cn];if(typeof i==`string`&&typeof a==`string`){let e={name:i,runId:a},t=r[N];typeof t==`string`&&(e.encryptionPublicKey=t);let n=r[ln];return typeof n==`string`&&(e.deploymentId=n),e}let o=`strm_${(e[an]||Ms)()}`,s=new Us(n,o);return t.push(s.pipeTo(r)),{name:o}},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Qs(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Qs(i,i,e,t,n,r)}}function nc(e,t){let n=B(e,t)??B(globalThis,t);if(typeof n==`function`)return B(n,`prototype`)}function rc(e=globalThis){let t=b(()=>nc(e,`ReadableStream`)),n=b(()=>nc(e,`WritableStream`)),i=b(()=>nc(e,`AbortController`)),a=b(()=>nc(e,`AbortSignal`));return{...Zs(e),ReadableStream:e=>{if(!V(e,t.value))return!1;let n=B(e,dn);if(n!==void 0)return{bodyInit:n};let i=B(e,M);if(!i)throw new r("ReadableStream `name` is not set");let a={name:i},o=B(e,on);o&&(a.type=o);let s=B(e,sn);return s&&(a.framing=s),a},WritableStream:e=>{if(!V(e,n.value))return!1;let t=B(e,M);if(!t)throw new r("WritableStream `name` is not set");let i={name:t},a=B(e,cn);typeof a==`string`&&(i.runId=a);let o=B(e,ln);typeof o==`string`&&(i.deploymentId=o);let s=B(e,N);return typeof s==`string`&&(i.encryptionPublicKey=s),i},AbortController:e=>{if(typeof e!=`object`||!e)return!1;let t=e,n=B(e,P),r=V(e,i.value);if(n===void 0&&!r){let t=B(e,`signal`);if(typeof t!=`object`||!t||B(t,P)===void 0)return!1}let a=B(e,`signal`);return a?$s(a,t):!1},AbortSignal:e=>{if(typeof e!=`object`||!e)return!1;let t=B(e,P)!==void 0,n=V(e,a.value);return!t&&!n?!1:$s(e,e)}}}function ic(e=globalThis,t,n,r,i=!1,a){return{...Zs(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new m(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=o[M],c=o[on],l=o[sn];if(!s){s=`strm_${(e[an]||Ms)()}`,c=Ns(o),l=c===`bytes`&&i?`framed-v1`:l;let u=new Xs(n,s,a);c===`bytes`?l===`framed-v1`?t.push(o.pipeThrough(zs()).pipeTo(u)):t.push(o.pipeTo(u)):t.push(o.pipeThrough(Is(ic(e,t,n,r,i,a),r)).pipeTo(u))}let u={name:s};return c&&(u.type=c),l&&(u.framing=l),u},WritableStream:i=>{if(!(i instanceof e.WritableStream))return!1;let a=i[M],o=i[cn];a||(a=`strm_${(e[an]||Ms)()}`,t.push(new Us(n,a).pipeThrough(Ls(hc(e,t,n,r),r)).pipeTo(i)));let s={name:a};typeof o==`string`&&(s.runId=o);let c=i[N];typeof c==`string`&&(s.encryptionPublicKey=c);let l=i[ln];return typeof l==`string`&&(s.deploymentId=l),s},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Qs(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Qs(i,i,e,t,n,r)}}function ac(...e){let t=new WeakSet;function n(e){let t=e[hn];t&&!t.signal.aborted&&t.abort()}function r(e){if(!(typeof e!=`object`||!e)&&!t.has(e)){if(t.add(e),e instanceof AbortController){n(e),n(e.signal);return}if(e instanceof AbortSignal){n(e);return}if(Array.isArray(e)){for(let t of e)r(t);return}if(e instanceof Map){for(let t of e.values())r(t);return}if(e instanceof Set){for(let t of e)r(t);return}if(typeof Request<`u`&&e instanceof Request){r(e.signal);return}for(let t of Object.values(e))r(t)}}for(let t of e)r(t)}function oc(e,t,n,r){let i=new AbortController;return r.push((async()=>{try{let r=new Us(t,n).getReader(),a=await Promise.race([r.read(),new Promise(e=>{if(i.signal.aborted){e({value:void 0,done:!0});return}i.signal.addEventListener(`abort`,()=>e({value:void 0,done:!0}),{once:!0})})]);if(a.value&&!a.done){try{r.releaseLock()}catch{}try{let n=vs.getStore(),r=await Tc(a.value,t,n?.encryptionKey);e.abort(r?.reason)}catch{e.abort()}}else r.cancel().catch(()=>{})}catch{}})()),i}function sc(e,t,n){let r=e,i=e.signal;r[P]=t.streamName,r[F]=t.hookToken,i[P]=t.streamName,i[F]=t.hookToken,n&&(r[hn]=n,i[hn]=n)}function cc(e,t){let n=e,r=t;n[P]!==void 0&&(r[P]=n[P]),n[F]!==void 0&&(r[F]=n[F]),n[hn]!==void 0&&(r[hn]=n[hn])}function lc(e,t,n){let r=new AbortController;e.aborted?(sc(r,e),r.abort(e.reason)):e.streamName?sc(r,e,oc(r,n,e.streamName,t)):sc(r,e);let i=r.abort.bind(r);return r.abort=t=>{if(r.signal.aborted)return;i(t);let n=vs.getStore();if(n&&(n.ops.push((async()=>{try{let r=await wc({aborted:!0,reason:t},n.workflowMetadata.workflowRunId,n.encryptionKey),i=new Xs(n.workflowMetadata.workflowRunId,e.streamName).getWriter();await i.write(r),await i.close()}catch{}})()),e.hookToken)){let r=(async()=>{try{let{resumeHook:n}=await import(`./resume-hook-BPQHjeY5.js`).then(e=>e.i);await n(e.hookToken,{aborted:!0,reason:t})}catch{}})();n.preCompletionOps.push(r)}},r}function uc(e,t,n){let r=new AbortController;return e.aborted?(sc(r,e),r.abort(e.reason)):e.streamName?sc(r,e,oc(r,n,e.streamName,t)):sc(r,e),r.signal}function dc(e=globalThis){return{...ei(e),...li(e)}}async function fc(e,t,n){let r=er(n);if(r)return Ii(r);let i=await Nn();if(!i.getEncryptionKeyForRun)return;let a=t?await i.getEncryptionKeyForRun(e,{deploymentId:t}):await i.getEncryptionKeyForRun(await i.runs.get(e));return a?await Xt(a,[`encrypt`]):void 0}function pc(e=globalThis,t,n,r){return{...dc(e),StepFunction:()=>{throw new m(`Step functions cannot be deserialized in client context. Step functions should not be returned from workflows.`,{hint:`A step function reference reached the client. Return a serializable value (e.g. the step result) instead of the step itself.`})},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Request:t=>{let n={method:t.method,headers:new e.Headers(t.headers),body:t.body,duplex:t.duplex};t.signal&&(n.signal=t.signal);let r=new e.Request(t.url,n);return t.signal&&cc(t.signal,r.signal),r},Response:t=>new e.Response(t.body,{status:t.status,statusText:t.statusText,headers:new e.Headers(t.headers)}),ReadableStream:i=>{if(`bodyInit`in i){let t=i.bodyInit;return new e.Response(t).body}if(i.type===`bytes`){let r=new Us(n,i.name,i.startIndex),a=xn();t.push(a.promise);let{readable:o,writable:s}=i.framing===`framed-v1`?Bs():new e.TransformStream;return Dn(r,s,a).catch(()=>{}),En(o,a),o}else{let a=Ks(n,i.name,i.startIndex),o=Ls(pc(e,t,n,r),r),s=xn();return t.push(s.promise),Dn(a,o.writable,s).catch(()=>{}),En(o.readable,s),o.readable}},WritableStream:i=>{let a=typeof i.runId==`string`?i.runId:n,o=a===n?r:fc(a,i.deploymentId,i.encryptionPublicKey),s=Is(tc(e,t,a,o),o),c=new Xs(a,i.name),l=xn();return t.push(l.promise),Dn(s.readable,c,l).catch(()=>{}),Tn(s.writable,l),Object.defineProperty(s.writable,M,{value:i.name,writable:!1}),Object.defineProperty(s.writable,cn,{value:a,writable:!1}),typeof i.deploymentId==`string`&&Object.defineProperty(s.writable,ln,{value:i.deploymentId,writable:!1}),typeof i.encryptionPublicKey==`string`&&Object.defineProperty(s.writable,N,{value:i.encryptionPublicKey,writable:!1}),s.writable},AbortController:e=>lc(e,t,n),AbortSignal:e=>uc(e,t,n)}}function mc(e=globalThis){return{...dc(e),...di(e),Request:t=>{Object.setPrototypeOf(t,e.Request.prototype);let n=t.responseWritable;return n&&(t[fn]=n,delete t.responseWritable,t.respondWith=()=>{throw new m("`respondWith()` must be called from within a step function.",{hint:'Move the `respondWith(...)` call inside a `"use step"` function — it cannot be invoked from a workflow context.'})}),t},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Response:t=>(Object.setPrototypeOf(t,e.Response.prototype),t),ReadableStream:t=>`bodyInit`in t?Object.create(e.ReadableStream.prototype,{[dn]:{value:t.bodyInit,writable:!1}}):Object.create(e.ReadableStream.prototype,{[M]:{value:t.name,writable:!1},[on]:{value:t.type,writable:!1},[sn]:{value:t.framing,writable:!1}}),WritableStream:t=>{let n={[M]:{value:t.name,writable:!1}};return typeof t.runId==`string`&&(n[cn]={value:t.runId,writable:!1}),typeof t.deploymentId==`string`&&(n[ln]={value:t.deploymentId,writable:!1}),typeof t.encryptionPublicKey==`string`&&(n[N]={value:t.encryptionPublicKey,writable:!1}),Object.create(e.WritableStream.prototype,n)},AbortController:e=>{let t=new ks(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),{[P]:e.streamName,[F]:e.hookToken,signal:t,abort:()=>{}}},AbortSignal:e=>{let t=new ks(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),t}}}function hc(e=globalThis,t,n,i,a){return{...dc(e),StepFunction:e=>{let t=e.stepId,n=e.closureVars,i=`boundThis`in e,a=i?e.boundThis:void 0,o=Array.isArray(e.boundArgs)?e.boundArgs:[],s=te(t);if(!s)throw new m(`Step function "${t}" not found. Make sure the step function is registered.`,{hint:`Make sure the step file is included in your build (i.e. it is listed in the workflow manifest), and that the SWC plugin is configured for the file.`});if(!n&&!i&&o.length===0)return s;let c=function(...e){let t=i?a:this,c=o.length>0?[...o,...e]:e;if(n){let e=vs.getStore();if(!e)throw new r(`Cannot call step function with closure variables outside step context`);let i={...e,closureVars:n};return vs.run(i,()=>s.apply(t,c))}return s.apply(t,c)};return Object.defineProperty(c,"name",{value:s.name}),Object.defineProperty(c,"stepId",{value:t,writable:!1,enumerable:!1,configurable:!1}),s.maxRetries!==void 0&&(c.maxRetries=s.maxRetries),c},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Request:t=>{let n=t.responseWritable,r={method:t.method,headers:new e.Headers(t.headers),body:t.body,duplex:t.duplex};t.signal&&(r.signal=t.signal);let i=new e.Request(t.url,r);return t.signal&&cc(t.signal,i.signal),n&&(i.respondWith=async e=>{let t=n.getWriter();await t.write(e),await t.close()}),i},Response:t=>new e.Response(t.body,{status:t.status,statusText:t.statusText,headers:new e.Headers(t.headers)}),ReadableStream:r=>{if(`bodyInit`in r){let t=r.bodyInit;return new e.Response(t).body}let o=new Us(n,r.name);if(r.type===`bytes`){let n=xn();t.push(n.promise);let{readable:i,writable:a}=r.framing===`framed-v1`?Bs():new e.TransformStream;return Dn(o,a,n).catch(()=>{}),En(i,n),i}else{let r=Ls(hc(e,t,n,i,a),i),s=xn();return t.push(s.promise),Dn(o,r.writable,s).catch(()=>{}),En(r.readable,s),r.readable}},WritableStream:r=>{let o=typeof r.runId==`string`?r.runId:n,s=typeof r.deploymentId==`string`?r.deploymentId:o===n?a:void 0,c=o===n?i:fc(o,s,r.encryptionPublicKey),l=Is(ic(e,t,o,c),c),u=new Xs(o,r.name),d=xn();return t.push(d.promise),Dn(l.readable,u,d).catch(()=>{}),Tn(l.writable,d),Object.defineProperty(l.writable,M,{value:r.name,writable:!1}),Object.defineProperty(l.writable,cn,{value:o,writable:!1}),s&&Object.defineProperty(l.writable,ln,{value:s,writable:!1}),typeof r.encryptionPublicKey!=`string`&&o===n&&Bi(i)&&Object.defineProperty(l.writable,N,{value:Un(i.keyPair.publicKey),writable:!1}),typeof r.encryptionPublicKey==`string`&&Object.defineProperty(l.writable,N,{value:r.encryptionPublicKey,writable:!1}),l.writable},AbortController:e=>lc(e,t,n),AbortSignal:e=>uc(e,t,n)}}async function gc(e,t){return await Ui(e,t)}const _c=async(e,t)=>{let n={},r=await Ni(await Gi(e,t),n);return await $(n,`deserialize`),{data:r}};function vc(e,t=globalThis,n={}){return gs(e.data,{global:t,extraRevivers:{...Pc(mc(t)),...n}})}function yc(e,t=globalThis,n={}){let{data:r}=e;if(!(r instanceof Uint8Array))return Kt(r,{...mc(t),...n});let{format:i,payload:a}=q(r);if(i===W.DEVALUE_V1)return Gt(new TextDecoder().decode(a),{...mc(t),...n});throw Error(`Unsupported serialization format: ${i}`)}async function bc(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1){if(a)return ni(j(e,tc(i,r,t,n,o)));try{let a={},c=await fs(e,n,{global:i,extraReducers:Nc(tc(i,r,t,n,o)),compression:s,compressionStats:a});return await $(a,`serialize`),c}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`workflow arguments`,t);throw new m(n,{hint:r,cause:t})}}async function xc(e,t,n,r=globalThis,i={},a){return vc(a??await _c(e,n),r,i)}async function Sc(e,t,n,r=globalThis,i=!1,a=!1,o){if(i)return ni(j(e,rc(r)));try{let t={},i=o??{executions:[]},s=await ms(e,n,{global:r,extraReducers:Nc(rc(r)),compression:a,compressionStats:t,guestCodeStats:i});return await $(t,`serialize`),await Fs(i),s}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`workflow return value`,t);throw new m(n,{hint:r,cause:t})}}async function Cc(e,t,n,r=[],i=globalThis,a={}){let o={},s=await ps(e,n,{global:i,extraRevivers:{...Pc(pc(i,r,t,n)),...a},compressionStats:o});return await $(o,`deserialize`),s}async function wc(e,t,n,r=globalThis,i=!1,a=!1,o){if(i)return ni(j(e,rc(r)));try{let t={},i=o??{executions:[]},s=await ms(e,n,{global:r,extraReducers:Nc(rc(r)),compression:a,compressionStats:t,guestCodeStats:i});return await $(t,`serialize`),await Fs(i),s}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`step arguments`,t);throw new m(n,{hint:r,cause:t})}}async function Tc(e,t,n,r=[],i=globalThis,a={},o){let s={},c=await hs(e,n,{global:i,extraRevivers:{...Pc(hc(i,r,t,n,o)),...a},compressionStats:s});return await $(s,`deserialize`),c}async function Ec(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c){if(a)return ni(j(e,ic(i,r,t,n,o,c)));try{let a={},l=await ms(e,n,{global:i,extraReducers:Nc(ic(i,r,t,n,o,c)),compression:s,compressionStats:a});return await $(a,`serialize`),l}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`step return value`,t);throw new m(n,{hint:r,cause:t})}}async function Dc(e,t,n,r=[],i=globalThis,a=!1){try{let o=j(e,ic(i,r,t,n)),s=new TextEncoder().encode(o),c=K(W.DEVALUE_V1,s),l={},u=await gc(await Mi(c,a,l),n);return await $(l,`serialize`),u}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`step error`,t);throw new m(n,{hint:r,cause:t})}}async function Oc(e,t,n,r=globalThis,i={},a){return yc(a??await _c(e,n),r,i)}async function kc(e,t,n,r=globalThis,i=!1){try{let t=j(e,rc(r)),a=new TextEncoder().encode(t),o=K(W.DEVALUE_V1,a),s={},c=await gc(await Mi(o,i,s),n);return await $(s,`serialize`),c}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`run error`,t);throw new m(n,{hint:r,cause:t})}}async function Ac(e,t,n,r=[],i=globalThis,a={}){let o={},s=await Ni(await Gi(e,n),o);if(await $(o,`deserialize`),!(s instanceof Uint8Array))return Kt(s,{...pc(i,r,t,n),...a});let{format:c,payload:l}=q(s);if(c===W.DEVALUE_V1)return Gt(new TextDecoder().decode(l),{...pc(i,r,t,n),...a});throw Error(`Unsupported serialization format: ${c}`)}async function jc(e,t,n,r=globalThis,i={},a){return vc(a??await _c(e,n),r,i)}const Mc=[`ReadableStream`,`WritableStream`,`Request`,`Response`,`StepFunction`,`AbortController`,`AbortSignal`];function Nc(e){let t={};for(let n of Mc)n in e&&(t[n]=e[n]);return t}function Pc(e){let t={};for(let n of Mc)n in e&&(t[n]=e[n]);return t}const Fc=[{format:W.ENCRYPTED,minVersion:`4.2.0-beta.64`},{format:W.GZIP,minVersion:`5.0.0-beta.18`},{format:W.ZSTD,minVersion:`5.0.0-beta.18`},{format:W.SEALED,minVersion:`5.0.0-beta.37`}],Ic=[{capability:`framedByteStreams`,minVersion:`5.0.0-beta.15`}],Lc=new Set([W.DEVALUE_V1]);function Rc(e){if(!e||!Yt.default.valid(e))return{supportedFormats:Lc,framedByteStreams:!1};let t=new Set(Lc);for(let{format:n,minVersion:r}of Fc)Yt.default.gte(e,r)&&t.add(n);let n={supportedFormats:t,framedByteStreams:!1};for(let{capability:t,minVersion:r}of Ic)Yt.default.gte(e,r)&&(n[t]=!0);return n}const zc=new Set([`PARSE_ERROR`,`SCHEMA_VALIDATION`,f.WORLD_CONTRACT_ERROR]),Bc=new Set([`TRANSPORT`,`TIMEOUT`]),Vc=[r.is,u.is,a.is,h.is];function Hc(e){if(!i.is(e)||e.status!==void 0)return!1;let t=`cause`in e?e.cause:void 0;return e.code!==void 0&&zc.has(e.code)||e.message.startsWith(`Failed to parse response body for `)||e.message.startsWith(`Schema validation failed for `)||typeof t==`object`&&!!t&&`name`in t&&t.name===`ZodError`}function Uc(e){return l.is(e)?!0:i.is(e)?e.status!==void 0&&e.status>=500||e.code!==void 0&&Bc.has(e.code):!1}function Wc(e){if(p.is(e))return f.REPLAY_DIVERGENCE;if(_.is(e))return f.CORRUPTED_EVENT_LOG;if(g.is(e))return f.MAX_EVENTS_EXCEEDED;if(s.is(e))return f.DEPLOYMENT_MISMATCH;if(Hc(e)||Uc(e))return f.WORLD_CONTRACT_ERROR;for(let t of Vc)if(t(e))return f.RUNTIME_ERROR;return f.USER_ERROR}const Gc=`5.0.0-beta.41`,Kc=/^[a-zA-Z0-9_\-./@]+$/;function qc(e,t){if(!Kc.test(e))throw Error(`Invalid workflow name "${e}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);return`${ie(`workflow`,re(t))}${e}`}const Jc=se();function Yc(e){return`__health_check__${e}`}function Xc(e){let t=x.safeParse(e);if(t.success)return t.data}function Zc(e){return`wrun_hc_${e}`}async function Qc(e,t){let n=await Nn(),r=Yc(e.correlationId),i;if(e.runId)try{let t=await n.getEncryptionKeyForRun?.(e.runId);t&&(i=Un((await Rn(t)).publicKey))}catch(t){X.warn(`Health check could not derive a run public key; the caller will fall back to a key lookup`,{correlationId:e.correlationId,error:t instanceof Error?t.message:String(t)})}let a=JSON.stringify({healthy:!0,correlationId:e.correlationId,specVersion:t??5,workflowCoreVersion:Gc,hookResumeInputVersion:1,...i?{encryptionPublicKey:i}:{},timestamp:Date.now()}),o=Zc(e.correlationId);await n.streams.write(o,r,a),await n.streams.close(o,r)}function $c(e,t){let n;return Promise.race([e,new Promise((e,r)=>{n=setTimeout(()=>r(Error(`Operation timed out after ${t}ms`)),t)})]).finally(()=>clearTimeout(n))}async function el(e,t){let n=[],r=!1,i=!1;for(;!r&&!i;){let a=e.read(),o=new Promise(e=>setTimeout(()=>{i=!0,e({done:!0,value:void 0})},t)),s=await Promise.race([a,o]);r=s.done,s.value&&n.push(s.value)}return{chunks:n,timedOut:i}}function tl(e){if(e.length===0)return null;let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;let i=new TextDecoder().decode(n),a;try{a=JSON.parse(i)}catch{return i.length>0?{healthy:!0}:null}if(typeof a!=`object`||!a||!(`healthy`in a)||typeof a.healthy!=`boolean`)return null;let o=a,s={healthy:o.healthy};return typeof o.specVersion==`number`&&(s.specVersion=o.specVersion),typeof o.workflowCoreVersion==`string`&&(s.workflowCoreVersion=o.workflowCoreVersion),typeof o.encryptionPublicKey==`string`&&(s.encryptionPublicKey=o.encryptionPublicKey),typeof o.hookResumeInputVersion==`number`&&(s.hookResumeInputVersion=o.hookResumeInputVersion),s}async function nl(e,t){let n=t?.timeout??3e4,r=e.createRunId?.()??Jc(),i=Yc(r),a=`${ie(`workflow`,re(t?.namespace))}health_check`,o=Date.now();try{for(await e.queue(a,{__healthCheck:!0,correlationId:r,...t?.runId?{runId:t.runId}:{}},{specVersion:1,deploymentId:t?.deploymentId});Date.now()-o<n;)try{let t=n-(Date.now()-o),a=(await $c(e.streams.get(Zc(r),i),t)).getReader(),{chunks:s,timedOut:c}=await el(a,500);if(c){try{a.cancel()}catch{}await new Promise(e=>setTimeout(e,100));continue}let l=tl(s);if(l)return{...l,latencyMs:Date.now()-o};await new Promise(e=>setTimeout(e,100))}catch{await new Promise(e=>setTimeout(e,100))}return{healthy:!1,error:`Health check timed out after ${n}ms`}}catch(e){return{healthy:!1,error:e instanceof Error?e.message:String(e)}}}function rl(e,t){return new i(`Event pagination ${t} for workflow run "${e}".`,{code:f.WORLD_CONTRACT_ERROR})}function il(e,t,n){if(t){if(n.has(t))throw rl(e,`did not advance`);n.add(t)}}function al(e,t,n){if(t.length===0)return;let r=n??new Set(e.map(e=>e.eventId));for(let n of t)r.has(n.eventId)||(r.add(n.eventId),e.push(n))}function ol(e,t){let n=e.length;for(;n>0;){let r=e[n-1];if(r.eventId===t.eventId)return;if(r.eventId<t.eventId)break;n--}e.splice(n,0,t)}function sl(e,t,n,r){if(t){if(n===null)throw rl(e,`returned more pages without a cursor`);if(r.has(n))throw rl(e,`repeated a cursor`)}}function cl(e,t,n){return t!==null&&!n&&i.is(e)&&e.status===400}async function ll(e,t){let n=t!==void 0;return Xo(n?`workflow.loadNewEvents`:`workflow.loadEvents`,async r=>{r?.setAttributes({...ia(e)});let i=[],a=new Set,o=new Set,s=t??null,c=!0,l=0,u=!1,d=await Nn(),f=Date.now();for(;c;){let t=Date.now(),r=s;il(e,r,o);let f;try{f=await d.events.list({runId:e,pagination:{sortOrder:`asc`,cursor:r??void 0}})}catch(t){if(cl(t,r,u)){X.warn(`Event cursor was rejected; retrying with a full event reload.`,{workflowRunId:e}),i.length=0,a.clear(),o.clear(),s=null,u=!0;continue}throw t}al(i,f.data,a),c=f.hasMore,sl(e,c,f.cursor,o),s=f.cursor??s,l++,X.debug(`Loaded event page`,{workflowRunId:e,incremental:n,page:l,pageEvents:f.data.length,totalEvents:i.length,hasMore:c,pageMs:Date.now()-t})}return X.debug(`Event load complete`,{workflowRunId:e,incremental:n,totalEvents:i.length,pagesLoaded:l,totalMs:Date.now()-f}),r?.setAttributes({...sa(i.length),...xo(l)}),{events:i,cursor:s}})}function ul(){return process.env.WORKFLOW_PRECONDITION_GUARD!==`0`}function dl(){return process.env.WORKFLOW_SLOT_GAP_CHECK!==`0`}function fl(e){let t;for(let n of e)(t===void 0||n.eventId>t)&&(t=n.eventId);if(t===void 0)return;let n=t,r=n.lastIndexOf(`_`),i=oe(r===-1?n:n.slice(r+1))?.getTime();if(i===void 0){X.debug(`Precondition guard: latest event id is not a decodable ULID; sending no snapshot`,{eventId:n});return}return i}function pl(e,t){let n=e.length;al(e,t);let r=e.length-n;return r>0&&ml(e)!==void 0&&e.sort((e,t)=>e.eventId<t.eventId?-1:+(e.eventId>t.eventId)),r}function ml(e){let t;for(let n of e){let e=ae(n.eventId);if(e===null)return;(t===void 0||e>t)&&(t=e)}return t}function hl(e){let t=new Set,n=0;for(let r of e){let e=ae(r.eventId);if(e===null)return;t.add(e),e>n&&(n=e)}if(n===0)return;let r=t.has(1)?1:2;if(t.size===n-r+1)return;let i,a=0;for(let e=r;e<=n;e++)t.has(e)||(i??=e,a++);if(i!==void 0)return{firstMissingSlot:i,missingCount:a,maxSlot:n}}async function gl(e,t){let n=t,r=hl(n.events);for(let t=0;r!==void 0&&t<3;t++)await new Promise(e=>setTimeout(e,25*2**t)),n=await ll(e),r=hl(n.events);return{log:n,gap:r}}function _l(e,t){if(!ul())return{};let n=ml(e);if(n!==void 0)return{eventCount:n};let r=fl(e);return r===void 0?{}:{stateUpdatedAt:r,stateEventCount:e.length,...t?{stateCursor:t}:{}}}function vl(e,t){if(!c.is(e))return null;let n=e.details;if(typeof n!=`object`||!n)return null;let{events:r,cursor:i}=n;if(!Array.isArray(r)||r.length===0)return null;for(let e of r)if(typeof e!=`object`||!e||typeof e.eventId!=`string`||e.runId!==t)return null;return{events:r,cursor:typeof i==`string`?i:null}}const yl={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS, GET, HEAD`,"Access-Control-Allow-Headers":`Content-Type`};function bl(e,t){return async n=>{let r=new URL(n.url);return r.searchParams.has(`__health`)?n.method===`OPTIONS`?new Response(null,{status:204,headers:yl}):new Response(JSON.stringify({healthy:!0,endpoint:r.pathname,specVersion:t??5,workflowCoreVersion:Gc}),{status:200,headers:{"Content-Type":`application/json`,...yl}}):await e(n)}}async function xl(e,...t){let n=t[0];await Xo(`queue.publish`,{attributes:{...Za(`vercel-queue`),...Qa(n),...eo(`publish`),...No(`vercel-queue`),...Po(`vercel-queue`),...Fo(`vqs`),...Io(`publish`)},kind:await ts(`PRODUCER`)},async n=>{let{messageId:r}=await e.queue(...t);r&&n?.setAttributes($a(r))})}function Sl(e){if(e.requestedAt)try{return to(Date.now()-e.requestedAt.getTime())}catch{return}}function Cl(e,t){let n;return()=>(n||=(async()=>{let n=await e.getEncryptionKeyForRun?.(t);return n?await Ri(n):void 0})(),n)}function wl(t){import(`./functions-CeeNvKsq.js`).then(t=>e(t.default,1)).then(({waitUntil:e})=>{e(t)})}function Tl(e,t){wl(e.catch(e=>{if(!(e?.name===`AbortError`||e?.name===`ResponseAborted`))try{t(e)}catch{}}))}async function El(e){let t=e();return wl(t.catch(()=>{})),t}export{ls as $,N as $n,wa as $t,Ec as A,ea as An,Co as At,xc as B,ar as Bn,Fa as Bt,Hc as C,oa as Cn,yo as Ct,kc as D,ga as Dn,eo as Dt,ac as E,ma as En,$a as Et,Is as F,Xr as Fn,Ga as Ft,Q as G,kn as Gn,Xa as Gt,_c as H,er as Hn,Wa as Ht,Ac as I,Zr as In,qa as It,Ss as J,Tn as Jn,Va as Jt,Os as K,xn as Kn,Ra as Kt,Tc as L,Qr as Ln,za as Lt,Sc as M,Bi as Mn,Ua as Mt,tc as N,Ii as Nn,Na as Nt,wc as O,Sa as On,Za as Ot,pc as P,W as Pn,Ka as Pt,cs as Q,ln as Qn,fa as Qt,Oc as R,Jr as Rn,Ma as Rt,Uc as S,aa as Sn,_o as St,Xs as T,ha as Tn,Qa as Tt,js as U,Rn as Un,Ja as Ut,Cc as V,Un as Vn,ja as Vt,As as W,Nn as Wn,Ya as Wt,vs as X,an as Xn,La as Xt,bs as Y,dn as Yn,Pa as Yt,X as Z,M as Zn,Ia as Zt,xl as _,Da as _n,so as _t,qc as a,sa as an,nn as ar,Vo as at,Gc as b,ia as bn,fo as bt,ol as c,na as cn,Ce as cr,Xo as ct,ll as d,ua as dn,De as dr,no as dt,ao as en,cn as er,Qo as et,Cl as f,da as fn,ue as fr,Ro as ft,_l as g,Ea as gn,co as gt,vl as h,Oa as hn,Aa as ht,Sl as i,_a as in,en as ir,Bo as it,bc as j,Ri as jn,wo as jt,Dc as k,ta as kn,So as kt,ul as l,ra as ln,T as lr,Ko as lt,Xc as m,pa as mn,me as mr,bo as mt,El as n,ya as nn,tn as nr,Ho as nt,Qc as o,ca as on,$t as or,is as ot,pl as p,la as pn,he as pr,Lo as pt,ys as q,Dn as qn,Ha as qt,al as r,va as rn,rn as rr,ts as rt,nl as s,xa as sn,Xt as sr,Wo as st,Tl as t,io as tn,fn as tr,Uo as tt,dl as u,Ca as un,Se as ur,as as ut,gl as v,ka as vn,lo as vt,Rc as w,ba as wn,vo as wt,Wc as x,ro as xn,oo as xt,bl as y,Ta as yn,uo as yt,jc as z,qr as zn,Ba as zt};
14
+ `):e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}var ea=class e extends Error{steps;globalThis;stepCount;hookCount;waitCount;attributeCount;hookDisposedCount;abortCount;constructor(e,t){let r=[...e.values()],i=0,a=0,o=0,s=0,c=0,l=0;for(let e of r)e.type===`step`?i++:e.type===`hook`?e.disposed?c++:e.abortRequested?l++:a++:e.type===`wait`?o++:e.type===`attribute`&&s++;let u=[];i>0&&u.push(`${i} ${n(`step`,`steps`,i)}`),a>0&&u.push(`${a} ${n(`hook`,`hooks`,a)}`),o>0&&u.push(`${o} ${n(`wait`,`waits`,o)}`),s>0&&u.push(`${s} ${n(`attribute write`,`attribute writes`,s)}`),c>0&&u.push(`${c} hook ${n(`disposal`,`disposals`,c)}`);let d=n(`has`,`have`,i+a+o+s+c),f=+(i>0)+ +(a>0)+ +(o>0)+ +(s>0)+ +(c>0),p;p=f>1?`processed`:i>0?`run`:a>0||o>0?`created`:s>0?`written`:c>0?`processed`:`received`;let m=u.length>0?`${u.join(` and `)} ${d} not been ${p} yet`:`0 steps have not been run yet`;super(m),this.name=`WorkflowSuspension`,this.steps=r,this.globalThis=t,this.stepCount=i,this.hookCount=a,this.waitCount=o,this.attributeCount=s,this.hookDisposedCount=c,this.abortCount=l}static is(t){return t instanceof e}};function ta(){throw new r(`This API is not available inside a workflow function. Workflow functions run in a deterministic VM; move the call to a step function for full Node.js access.`)}function J(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const na=J(`workflow.name`),ra=J(`workflow.operation`),ia=J(`workflow.run.id`),aa=J(`workflow.run.status`),oa=J(`workflow.started_at`),sa=J(`workflow.events.count`),ca=J(`workflow.execution.mode`),la=J(`workflow.events.parked.count`),ua=J(`workflow.events.parked.event_id`),da=J(`workflow.events.parked.event_type`),fa=J(`workflow.arguments.count`),pa=J(`workflow.result.type`),ma=J(`workflow.trace.propagated`),ha=J(`workflow.trace.mode`),ga=J(`workflow.turbo`),_a=J(`workflow.error.name`),va=J(`workflow.error.message`),ya=J(`workflow.error.code`),ba=J(`workflow.steps.created`),xa=J(`workflow.hooks.created`),Sa=J(`workflow.waits.created`),Ca=J(`workflow.inline_ownership.owned_recovery_steps`),wa=J(`workflow.inline_ownership.backstop_wakes_armed`),Ta=J(`workflow.route.type`),Ea=J(`workflow.route.handler_cached`),Da=J(`workflow.route.invocation_count`),Oa=J(`workflow.route.entrypoint_age_ms`),ka=J(`workflow.route.module_body_init_ms`),Aa=J(`faas.instance`),ja=J(`step.name`),Ma=J(`step.id`),Na=J(`step.attempt`),Pa=J(`step.status`),Fa=J(`step.max_retries`),Ia=J(`step.ttfs_ms`),La=J(`step.stso_ms`),Ra=J(`step.rsfs_ms`),za=J(`step.final_scheduling_replay_ms`),Ba=J(`step.latency_optimizations`),Va=J(`step.skipped`),Ha=J(`step.skip_reason`),Ua=J(`step.arguments.count`),Wa=J(`step.result.type`),Ga=J(`step.error.name`),Ka=J(`step.error.message`),qa=J(`step.fatal_error`),Ja=J(`step.retry.exhausted`),Ya=J(`step.retry.timeout_seconds`),Xa=J(`step.retry.will_retry`),Za=J(`messaging.system`),Qa=J(`messaging.destination.name`),$a=J(`messaging.message.id`),eo=J(`messaging.operation.type`),to=J(`workflow.queue.overhead_ms`),no=J(`deployment.id`),ro=J(`workflow.deployment.pinned_id`),io=J(`workflow.deployment_mismatch.retry_count`),ao=J(`workflow.deployment_mismatch.recovered`),oo=J(`workflow.hook.token`),so=J(`workflow.hook.id`),co=J(`workflow.hook.found`),lo=J(`workflow.hook.resilient_resume`),uo=J(`workflow.hook.resilient_resume_materialized`),fo=J(`workflow.resume_setup_source`),po=J(`workflow.suspension.state`),mo=J(`workflow.suspension.hook_count`),ho=J(`workflow.suspension.step_count`),go=J(`workflow.suspension.wait_count`),_o=J(`http.request.method`),vo=J(`http.route`),yo=J(`http.response.status_code`),bo=J(`error.type`),xo=J(`workflow.events.pages_loaded`),So=J(`workflow.queue.deserialize_time_ms`),Co=J(`workflow.queue.execution_time_ms`),wo=J(`workflow.queue.serialize_time_ms`),To=J(`workflow.serialization.operation`),Eo=J(`workflow.serialization.compressed`),Do=J(`workflow.serialization.codec`),Oo=J(`workflow.serialization.uncompressed_bytes`),ko=J(`workflow.serialization.stored_bytes`),Ao=J(`workflow.serialization.compression_ratio`),jo=J(`workflow.serialization.guest_code_executions`),Mo=J(`workflow.serialization.guest_code_details`),No=J(`peer.service`),Po=J(`rpc.system`),Fo=J(`rpc.service`),Io=J(`rpc.method`),Lo=J(`error.retryable`),Ro=J(`error.category`),zo=new Set;function Bo(){let e=process.env.WORKFLOW_TRACE_MODE;return e===`continuous`?`continuous`:(e&&e!==`linked`&&!zo.has(e)&&(zo.add(e),X.warn(`Unrecognized WORKFLOW_TRACE_MODE value "${e}"; expected "linked" or "continuous". Falling back to "linked".`)),`linked`)}function Vo(e){return e!==void 0&&Object.keys(e).length>0}function Ho(e,t){return e===`linked`&&Vo(t)?Promise.resolve(t):Wo()}async function Uo(e,t){if(e!==`linked`)return rs();let n=await is(Vo(t)?t:void 0);return n?[n]:void 0}async function Wo(){let e=await Y.value;if(!e)return{};let t={};return e.propagation.inject(e.context.active(),t),t}async function Go(e){let t=await Y.value;if(t)return t.propagation.extract(t.context.active(),e)}async function Ko(e,t){if(!e)return t();let n=await Y.value;if(!n)return t();let r=await Go(e);return r?n.context.with(r,async()=>await t()):t()}const Y=b(async()=>{try{return await import(`../../@opentelemetry/api/index.js`)}catch{return X.info(`OpenTelemetry not available, tracing will be disabled`),null}}),qo=b(async()=>{let e=await Y.value;if(!e)return null;let t=e.trace.getTracer(`workflow`);return Yo(e,t),t});let Jo=!1;function Yo(e,t){let n=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`);if(!(Jo||!n)){Jo=!0;try{let n=globalThis[Symbol.for(`opentelemetry.js.api.1`)],r=e.trace.getTracerProvider(),i=r.getDelegate?.()??r,a=t.startSpan(`workflow.otel.probe.core`);console.warn(`[workflow:otel-diag] core`,JSON.stringify({globalRegistrationVersion:n?.version??null,providerCtor:r?.constructor?.name??null,delegateCtor:i?.constructor?.name??null,tracerCtor:t?.constructor?.name??null,probeCtor:a?.constructor?.name??null,probeRecording:a.isRecording()})),a.end()}catch(e){console.warn(`[workflow:otel-diag] core failed:`,e instanceof Error?e.message:e)}}}async function Xo(e,...t){let[n,r]=await Promise.all([qo.value,Y.value]),{fn:i,opts:a}=typeof t[0]==`function`?{fn:t[0],opts:{}}:{fn:t[1],opts:t[0]};if(!i)throw Error(`Function to trace must be provided`);return!n||!r?await i():n.startActiveSpan(e,a,async e=>{try{let t=await i(e);return e.setStatus({code:r.SpanStatusCode.OK}),t}catch(t){throw ea.is(t)?(e.setStatus({code:r.SpanStatusCode.OK}),Qo(t,e)):e.setStatus({code:r.SpanStatusCode.ERROR,message:t.message}),t}finally{e.end()}})}async function Zo(e,t,n){let r=await qo.value;r&&r.startSpan(e,{...n,startTime:t}).end()}function Qo(e,t){t.setAttributes({...po(`suspended`),...ho(e.stepCount),...mo(e.hookCount),...go(e.waitCount)})}async function $o(e){let[t,n]=await Promise.all([Go(e),Y.value]);if(!(!t||!n))return n.trace.getSpanContext(t)}async function es(){return await ns(e=>e.trace.getActiveSpan())}async function ts(e){return ns(t=>t.SpanKind[e])}async function ns(e){let t=await Y.value;if(t)return await e(t)}function rs(){return ns(e=>{let t=e.trace.getActiveSpan()?.spanContext();if(t)return[{context:t}]})}async function is(e){if(!e)return;let[t,n]=await Promise.all([$o(e),Y.value]);if(!(!t||!n)&&n.trace.isSpanContextValid(t))return{context:t}}async function as(e,t){let n=await Y.value;if(!n)return t();let r=n.propagation.createBaggage({"workflow.run_id":{value:e.workflowRunId},"workflow.name":{value:e.workflowName}}),i=n.propagation.setBaggage(n.context.active(),r);return n.context.with(i,()=>t())}function os(e,t){if(!t)return!1;let n=!1;for(let r of t.split(`,`)){let t=r.trim();if(!t)continue;let i=t.startsWith(`-`),a=i?t.slice(1):t;RegExp(`^${a.replace(/[|\\{}()[\]^$+?.]/g,`\\$&`).replace(/\*/g,`.*`)}$`).test(e)&&(n=!i)}return n}function ss(e,t={}){let n=r=>{let i=n=>t.debugNamespace??`workflow:${e}:${n}`,a=t=>{let n=i(t);return(i,a)=>{let o=Object.keys(r).length>0,s=a&&Object.keys(a).length>0,c=o||s?{...r,...a??{}}:void 0;(t===`error`||t===`warn`)&&(t===`error`?console.error:console.warn)(Ki(`[workflow-sdk]`,i,c)),os(n,process.env.DEBUG)&&(console.debug(`[${n}] ${i}`,c??``),es().then(n=>{n?.addEvent(`${t}.${e}`,{message:i,...c})}).catch(()=>{}))}};return{debug:a(`debug`),info:a(`info`),warn:a(`warn`),error:a(`error`),child:e=>n({...r,...e}),forRun:(e,t,i)=>n({...r,workflowRunId:e,...t===void 0?{}:{workflowName:t},...i??{}})}};return n({})}const cs=ss(`step`),X=ss(`runtime`),ls=ss(`webhook`),us=ss(`events`);ss(`adapter`),ss(`build`,{debugNamespace:`workflow:build`});function ds(e){if(h.is(e))throw e}function Z(e,t){let n=e.includes(`return value`)?`returning`:`passing`,r=`Failed to serialize ${e}`;t instanceof k&&t.path&&(r+=` at path "${t.path}"`);let i=`Ensure you're ${n} workflow serializable types. Check the serialization docs to see what's serializable: https://workflow-sdk.dev/docs/foundations/serialization`;return t instanceof k&&t.value!==void 0&&X.error(`Serialization failed`,{context:e,problematicValue:t.value}),{message:r,hint:i}}async function fs(e,t,n){try{let r=G.serialize(e,`client`,n);return Ui(await Mi(K(W.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){ds(e);let{message:t,hint:n}=Z(`client value`,e);throw new m(t,{hint:n,cause:e})}}async function ps(e,t,n){let r=await Ni(await Gi(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(G.deserializeLegacy)return G.deserializeLegacy(r,`client`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=q(r);if(i===W.DEVALUE_V1)return G.deserialize(a,`client`,n);throw Error(`Unsupported serialization format: ${i}`)}async function ms(e,t,n){try{let r=G.serialize(e,`step`,n);return Ui(await Mi(K(W.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){ds(e);let{message:t,hint:n}=Z(`step value`,e);throw new m(t,{hint:n,cause:e})}}async function hs(e,t,n){let r=await Ni(await Gi(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(G.deserializeLegacy)return G.deserializeLegacy(r,`step`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=q(r);if(i===W.DEVALUE_V1)return G.deserialize(a,`step`,n);throw Error(`Unsupported serialization format: ${i}`)}function gs(e,t){if(!(e instanceof Uint8Array)){if(G.deserializeLegacy)return G.deserializeLegacy(e,`workflow`,t);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:n,payload:r}=q(e);if(n===W.DEVALUE_V1)return G.deserialize(r,`workflow`,t);throw Error(`Unsupported serialization format: ${n}`)}const _s=Symbol.for(`WORKFLOW_STEP_CONTEXT_STORAGE`),vs=(()=>{let e=globalThis;return e[_s]??=new ce,e[_s]})();function ys(e,t,r){if(e===0&&t===0&&r===0)return null;let i=[];e>0&&i.push(`${e} ${n(`step`,`steps`,e)}`),t>0&&i.push(`${t} ${n(`hook`,`hooks`,t)}`),r>0&&i.push(`${r} ${n(`timer`,`timers`,r)}`);let a=[];e>0&&a.push(`steps are completed`),t>0&&a.push(`hooks are received`),r>0&&a.push(`timers have elapsed`);let o=a.join(` and `);return`${i.join(` and `)} to be enqueued\n Workflow will suspend and resume when ${o}`}function bs(e,t){let n=`${e.replace(`wrun_`,`strm_`)}_user`;return t?`${n}_${Buffer.from(t,`utf-8`).toString(`base64url`)}`:n}function xs(e){return`strm_${e}_system_abort`}function Ss(e){if(!e.startsWith(`abrt_`))throw Error(`Invalid abort hook token format: expected "abrt_" prefix, got "${e}"`);return xs(e.slice(5))}const Cs=()=>S(`WORKFLOW_DEFERRED_CHECK_DELAY_MS`,100,{integer:!0,min:10}),ws=new Set([`hook_received`,`hook_conflict`,`wait_completed`,`attr_set`,`run_cancelled`]),Ts=new Set([`wait_completed`]);function Es(e,t){return`${e}:${t}`}const Ds=new Set([`run_completed`,`run_failed`,`run_cancelled`]);var Q;(function(e){e[e.Consumed=0]=`Consumed`,e[e.NotConsumed=1]=`NotConsumed`,e[e.Finished=2]=`Finished`})(Q||={});var Os=class{eventIndex;events;callbacks=[];parked=[];resolved=new Set;onConsumedEvent;onUnconsumedEvent;getPromiseQueue;isDeliveryIdle;pendingUnconsumedCheck=null;pendingUnconsumedTimeout=null;unconsumedCheckVersion=0;constructor(e,t){this.events=[...e],this.eventIndex=0,this.onConsumedEvent=t.onConsumedEvent,this.onUnconsumedEvent=t.onUnconsumedEvent,this.getPromiseQueue=t.getPromiseQueue,this.isDeliveryIdle=t.isDeliveryIdle}get strandedEvent(){return this.parked[0]?.event}get parkedSummary(){let e=this.parked[0]?.event;if(e)return{count:this.parked.length,eventId:e.eventId,eventType:e.eventType}}append(e){for(let t of e)this.events.push(t);process.nextTick(this.consume)}subscribe(e){this.callbacks.push(e),this.pendingUnconsumedCheck!==null&&(this.unconsumedCheckVersion++,this.pendingUnconsumedCheck=null,this.pendingUnconsumedTimeout!==null&&(clearTimeout(this.pendingUnconsumedTimeout),this.pendingUnconsumedTimeout=null)),process.nextTick(this.consume)}notifyConsumedEvent(e){if(this.onConsumedEvent)try{this.onConsumedEvent(e)}catch(e){us.error(`onConsumedEvent callback threw an error`,{error:e})}}consume=()=>{for(;;){this.drainParked();let e=this.events[this.eventIndex]??null,t=this.offer(e);if(t&&this.eventIndex++,e===null){t||this.handleEndOfLog();return}if(!t){this.scheduleUnconsumedCheck(e,!0);return}}};offer(e){for(let t=0;t<this.callbacks.length;t++){let n=this.callbacks[t],r=Q.NotConsumed;try{r=n(e)}catch(e){us.error(`EventConsumer callback threw an error`,{error:e})}if(!(r!==Q.Consumed&&r!==Q.Finished))return e!==null&&(e.correlationId&&Ts.has(e.eventType)&&this.resolved.add(Es(e.eventType,e.correlationId)),this.notifyConsumedEvent(e)),r===Q.Finished&&this.callbacks.splice(t,1),!0}return!1}drainParked(){let e=this.parked.length>0;for(;e;){e=!1;for(let t=0;t<this.parked.length;t++){let n=this.parked[t],r=this.eventIndex;this.eventIndex=n.index;let i;try{i=this.offer(n.event)}finally{this.eventIndex=r}if(i){this.parked.splice(t,1),e=this.parked.length>0;break}}}}park(e){return!ws.has(e.eventType)||e.correlationId&&this.resolved.has(Es(e.eventType,e.correlationId))?!1:(this.parked.push({event:e,index:this.eventIndex}),this.eventIndex++,us.debug(`Parked an unclaimed event for later delivery`,{eventId:e.eventId,eventType:e.eventType,correlationId:e.correlationId,parked:this.parked.length}),!0)}handleEndOfLog(){if(this.parked.length===0)return;let e=this.events.at(-1);if(!e||!Ds.has(e.eventType)){us.debug(`Reached the end of the log still holding events`,{eventId:this.parked[0].event.eventId,eventType:this.parked[0].event.eventType,correlationId:this.parked[0].event.correlationId,parked:this.parked.length});return}this.scheduleUnconsumedCheck(this.parked[0].event,!1)}scheduleUnconsumedCheck(e,t){let n=++this.unconsumedCheckVersion;this.pendingUnconsumedCheck=this.getPromiseQueue().then(()=>new Promise(e=>setTimeout(e,0))).then(()=>this.getPromiseQueue()).then(()=>{this.whenDeliveryIdle(n,()=>{this.pendingUnconsumedTimeout=setTimeout(()=>{if(this.pendingUnconsumedTimeout=null,this.unconsumedCheckVersion===n){if(this.pendingUnconsumedCheck=null,t){if(this.events[this.eventIndex]!==e)return;if(this.park(e)){this.consume();return}}this.onUnconsumedEvent(e)}},Cs())})})}whenDeliveryIdle(e,t){let n=()=>{if(this.pendingUnconsumedTimeout=null,this.unconsumedCheckVersion===e){if(this.isDeliveryIdle()){t();return}this.getPromiseQueue().then(()=>{this.unconsumedCheckVersion===e&&(this.pendingUnconsumedTimeout=setTimeout(n,0))})}};n()}},ks=class{aborted=!1;reason=void 0;[P];[F];#e=[];#t=null;get onabort(){return this.#t}set onabort(e){this.#t=e,e&&this.aborted&&e.call(this)}constructor(e,t){this[P]=e,this[F]=t}_setAborted(e){if(!this.aborted){this.aborted=!0,this.reason=e,this.#t&&this.#t.call(this);for(let e of this.#e)e();this.#e=[]}}addEventListener(e,t){if(e===`abort`){if(this.aborted){t();return}this.#e.push(t)}}removeEventListener(e,t){e===`abort`&&(this.#e=this.#e.filter(e=>e!==t))}throwIfAborted(){if(this.aborted)throw this.reason??new DOMException(`The operation was aborted.`,`AbortError`)}};function As(e){return class{signal;[P];[F];constructor(){let t=e.generateUlid(),n=xs(t),r=`abrt_${t}`;this[P]=n,this[F]=r,this.signal=new ks(n,r);let i=`hook_${e.generateUlid()}`;e.invocationsQueue.set(i,{type:`hook`,correlationId:i,token:r,isWebhook:!1,isSystem:!0}),e.eventsConsumer.subscribe(t=>{if(!t||t.correlationId!==i)return Q.NotConsumed;let n=`eventData`in t&&t.eventData&&`token`in t.eventData?t.eventData.token:void 0;if(typeof n==`string`&&n!==this[F])return e.promiseQueue=e.promiseQueue.then(()=>{e.onWorkflowError(new p(`Replay divergence: abort hook event ${t.eventType} for ${i} belongs to token "${n}", but the current abort hook expects "${this[F]}"`,{eventId:t.eventId}))}),Q.Finished;if(t.eventType===`hook_created`){let t=e.invocationsQueue.get(i);return t&&t.type===`hook`&&(t.hasCreatedEvent=!0),Q.Consumed}if(t.eventType===`hook_received`){let n=t.eventData?.payload,r=e.eventsConsumer.eventIndex,a=y(e,r,`hook`),o=ne(e,r,`hook`);return e.pendingDeliveries++,e.promiseQueue=e.promiseQueue.then(async()=>{let r;try{if(n!==void 0)try{let i=await e.replayPayloadCache.prepareEventPayload(t.eventId,`payload`,n),a=await jc(n,e.runId,e.encryptionKey,e.globalThis,{},i);a&&typeof a==`object`&&`reason`in a&&(r=a.reason)}catch{}}finally{e.pendingDeliveries--}o.then(()=>{a.markDelivered(),this.signal._setAborted(r)})}),e.invocationsQueue.delete(i),Q.Consumed}return t.eventType===`hook_disposed`?(e.invocationsQueue.delete(i),Q.Finished):Q.NotConsumed})}abort(t){if(!this.signal.aborted){this.signal._setAborted(t);for(let[,n]of e.invocationsQueue)if(n.type===`hook`&&n.token===this[F]){n.abortRequested=!0,n.abortReason=t;break}}}}}function js(){return{abort(e){let t=new ks(``,``);return t._setAborted(e??new DOMException(`The operation was aborted.`,`AbortError`)),t},any(e){let t=new ks(``,``),n=Array.from(e);for(let e of n)if(e.aborted)return t._setAborted(e.reason),t;let r=[],i=()=>{for(let{signal:e,listener:t}of r)e.removeEventListener&&e.removeEventListener(`abort`,t);r.length=0};for(let e of n){if(!e.addEventListener)continue;let n=()=>{t.aborted||(t._setAborted(e.reason),i())};r.push({signal:e,listener:n}),e.addEventListener(`abort`,n)}return t},timeout(){throw Error(`AbortSignal.timeout() is not supported in workflow functions. Use sleep() with an AbortController instead. See: /docs/errors/abort-signal-timeout-in-workflow`)}}}const Ms=se();function Ns(e){try{return e.getReader({mode:`byob`}).releaseLock(),`bytes`}catch{}}function Ps(e){return ds(e),e instanceof m&&e.cause!==void 0||e instanceof r&&e.cause!==void 0?e.cause:e}async function $(e,t){if(e.recorded)try{let n=await es();if(!n)return;let r=e.uncompressedBytes??0,i=e.storedBytes??0;n.setAttributes({...To(t),...Eo(e.compressed??!1),...Do(e.codec??`none`),...Oo(r),...ko(i),...e.compressed&&r>0?Ao(1-i/r):{}})}catch{}}async function Fs(e){if(e.executions.length!==0)try{let t=await es();if(!t)return;let n=[...new Set(e.executions.map(e=>e.detail?`${e.kind} (${e.detail})`:e.kind))];t.setAttributes({...jo(e.executions.length),...Mo(n)})}catch{}}function Is(e,t){let n=new TextEncoder,r={resolved:!1,key:void 0},i;return new TransformStream({async transform(a,o){try{r.resolved||(r.key=await Hi(t),r.resolved=!0,zi(r.key)&&(i=Zn(r.key.recipientPublicKey,r.key.aad)));let s=j(a,e),c=n.encode(s),l=K(W.DEVALUE_V1,c);i?l=K(W.SEALED,await i.seal(l)):r.key&&(l=await Ui(l,r.key));let u=new Uint8Array(4+l.length);new DataView(u.buffer).setUint32(0,l.length,!1),u.set(l,4),o.enqueue(u)}catch(e){if(h.is(e)){o.error(e);return}let{message:t,hint:n}=Z(`stream chunk`,e);o.error(new m(t,{hint:n,cause:e}))}}})}function Ls(e,t){let n=new TextDecoder,r=new Uint8Array,i={resolved:!1,key:void 0},a;function o(e){let t=new Uint8Array(r.length+e.length);t.set(r,0),t.set(e,r.length),r=t}async function s(o){for(i.resolved||(i.key=await Hi(t),i.resolved=!0,Bi(i.key)&&(a=Qn(i.key.keyPair,i.key.aad)));r.length>=4;){let t=new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,!1);if(r.length<4+t)break;let s=r.slice(4,4+t);r=r.slice(4+t);let{format:c,payload:l}=q(s);if(c===W.ENCRYPTED||c===W.SEALED){let e=c===W.SEALED;if(!(e?Bi(i.key):Vi(i.key)!==void 0)){o.error(new h(e?`Sealed stream data encountered but no run keypair is available. Opening a sealed frame requires the run's own encryption key material.`:`Encrypted stream data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.`,{context:{operation:`decrypt`,byteLength:l.byteLength,formatPrefix:e?`encp`:`encr`}}));return}let t;try{t=e?await a.open(q(s).payload):await Gi(s,i.key)}catch(e){throw h.is(e)&&e.context&&(e.context.formatPrefix=c),e}({format:c,payload:l}=q(t))}if(c===W.DEVALUE_V1){let t=n.decode(l);o.enqueue(Gt(t,e))}}}return new TransformStream({async transform(t,i){if(r.length===0&&t.length>=4){let e=new DataView(t.buffer,t.byteOffset,t.byteLength).getUint32(0,!1);if(e>0&&e<1e8){o(t),await s(i);return}}else if(r.length>0){o(t),await s(i);return}let a=n.decode(t).split(`
15
+ `);for(let t of a)t.length>0&&i.enqueue(Gt(t,e))},async flush(e){r.length>0&&await s(e)}})}const Rs=1e8;function zs(){return new TransformStream({transform(e,t){if(e.length===0)return;if(e.length>Rs){t.error(new r(`Byte-stream chunk of ${e.length} bytes exceeds the maximum framed chunk size (${Rs}). Split the data into smaller chunks before writing.`,{slug:`serialization-failed`}));return}let n=new Uint8Array(4+e.length);new DataView(n.buffer).setUint32(0,e.length,!1),n.set(e,4),t.enqueue(n)}})}function Bs(){let e=new Uint8Array;function t(t){let n=new Uint8Array(e.length+t.length);n.set(e,0),n.set(t,e.length),e=n}return new TransformStream({transform(n,i){for(n.length>0&&t(n);e.length>=4;){let t=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!1);if(t>Rs){i.error(new r(`Byte-stream frame length ${t} exceeds maximum (${Rs}). This usually means a non-framed byte stream is being read as framed.`,{slug:`serialization-failed`}));return}let n=4+t;if(e.length<n)break;i.enqueue(e.slice(4,n)),e=e.slice(n)}},flush(t){e.length>0&&t.error(new r(`Byte-stream ended with ${e.length} bytes of incomplete frame data. The stream was truncated mid-frame.`,{slug:`serialization-failed`}))}})}function Vs(e,t,n,r,i){(async()=>{await Zo(`workflow.stream.read`,e,{kind:await ts(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`read`,"workflow.stream.read.ttfc_ms":Date.now()-e,...typeof i==`number`?{"workflow.stream.read.connect_ms":i}:{},...typeof r==`number`?{"workflow.stream.start_index":r}:{}}})})()}function Hs(e,t,n,r,i,a){(async()=>{await Zo(`workflow.stream.read.complete`,e,{kind:await ts(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`read_complete`,"workflow.stream.read.total_ms":Date.now()-e,"workflow.stream.read.chunks":r,"workflow.stream.read.bytes":i,...typeof a==`number`?{"workflow.stream.read.reconnects":a}:{}}})})()}var Us=class extends ReadableStream{#e;constructor(e,t,n){if(typeof t!=`string`||t.length===0)throw new r(`"name" is required, got "${t}"`);let i,a=!1,o,s=0,c=0;super({type:`bytes`,pull:async r=>{let l=this.#e;if(!l){i===void 0&&(i=Date.now());let r=await Nn(),a=Date.now(),s=await r.streams.get(e,t,n);o=Date.now()-a,l=this.#e=s.getReader()}if(!l){r.error(Error(`Failed to get reader`));return}let u=await l.read();u.done?(this.#e=void 0,i!==void 0&&Hs(i,e,t,s,c),r.close()):(!a&&u.value.byteLength>0&&i!==void 0&&(a=!0,Vs(i,e,t,n,o)),s+=1,c+=u.value.byteLength,r.enqueue(u.value))},cancel:async e=>{this.#e&&=(await this.#e.cancel(e).catch(()=>{}),void 0)}})}};const Ws=()=>S(`WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`,50,{integer:!0,min:1}),Gs=()=>S(`WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`,1e3,{integer:!0,min:1});function Ks(e,t,n){let r=n===void 0||n>=0,i=n??0,a=0,o=0,s=0,c,l=new Uint8Array,u,d,f=!1,p=0,m=0;async function h(){let o=await Nn(),s=r?i+a:n,l=Date.now(),u=await o.streams.get(e,t,s);d===void 0&&(d=Date.now()-l),c=u.getReader()}async function g(){c&&=(await c.cancel().catch(()=>{}),void 0),i+=a,a=0,l=new Uint8Array;let e=Ws(),n=Gs();for(;;){if(o++,s++,o>e)throw Error(`Stream "${t}" exceeded maximum reconnection attempts (${e})`);if(s>n)throw Error(`Stream "${t}" exceeded maximum total reconnection attempts (${n})`);try{await h();return}catch{}}}return new ReadableStream({pull:async i=>{for(u===void 0&&(u=Date.now());;){if(!c)try{await h()}catch(e){i.error(e);return}let _;try{_=await c.read()}catch(e){if(!r){i.error(e);return}try{await g()}catch(e){i.error(e);return}continue}if(_.done||!_.value){c=void 0,u!==void 0&&Hs(u,e,t,p,m,s),i.close();return}let v=_.value;if(v.length>0){let e=new Uint8Array(l.length+v.length);e.set(l,0),e.set(v,l.length),l=e}let y=!1;for(;l.length>=4;){let r=4+new DataView(l.buffer,l.byteOffset,l.byteLength).getUint32(0,!1);if(l.length<r)break;i.enqueue(l.slice(0,r)),l=l.slice(r),a++,p++,m+=r,!f&&u!==void 0&&(f=!0,Vs(u,e,t,n,d)),y=!0}if(y){o=0;return}}},cancel:async()=>{c&&=(await c.cancel().catch(e=>{console.warn(`Error closing ReadableStream reader:`,e)}),void 0)}})}const qs=()=>{let e=S(`WORKFLOW_STREAM_FLUSH_INTERVAL_MS`,NaN,{integer:!0});return Number.isNaN(e)?void 0:e};function Js(e,t,n,r,i,a,o){(async()=>{await Zo(`workflow.stream.flush`,e,{kind:await ts(`CLIENT`),attributes:{"workflow.run.id":n,"workflow.stream.name":r,"workflow.stream.operation":`flush`,"workflow.stream.flush.buffer_dwell_ms":t-e,"workflow.stream.flush.chunks":i,"workflow.stream.flush.bytes":a,"workflow.stream.write.chunk_rtt":o}})})()}function Ys(e,t,n){(async()=>{await Zo(`workflow.stream.close`,e,{kind:await ts(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`close`,"workflow.stream.close.rpc_ms":Date.now()-e}})})()}var Xs=class extends WritableStream{constructor(e,t,n){if(typeof e!=`string`)throw new r(`"runId" must be a string, got "${typeof e}"`);if(typeof t!=`string`||t.length===0)throw new r(`"name" is required, got "${t}"`);let i=Nn(),a=n,o=async()=>{if(a){try{await a}catch{}a=void 0}},s=[],c=0,l=0,u=0,d=null,f=null,p,m=qs(),h=null,g=_n(),_=vn(),v=gn(),y=yn(),b,ee=[],te=[],ne=e=>{let t=[...ee,...te];ee=[],te=[];for(let n of t)n.reject(e)},re=()=>{let e=0,t=0;for(let n of s){if(e>=g||e>0&&t+n.byteLength>_)break;e++,t+=n.byteLength}let n=s.slice(0,e);return s=s.slice(e),c-=t,{group:n,bytes:t}},ie=async(n,r,a)=>{await o();let s=await i,c=Date.now();if(typeof s.streams.writeMulti==`function`&&n.length>1)await s.streams.writeMulti(e,t,n);else for(let r of n)await s.streams.write(e,t,r);a!==void 0&&Js(a,c,e,t,n.length,r,Date.now()-c)},ae=async()=>{for(;s.length>0;){d&&=(clearTimeout(d),null);let e=b,t=Date.now(),{group:n,bytes:r}=re();l=n.length,u=r,b=s.length>0?t:void 0;try{await ie(n,r,e),l=0,u=0}catch(t){throw s=n.concat(s),c+=r,l=0,u=0,b=e!==void 0&&b!==void 0?Math.min(e,b):e??b,t}let i=ee;ee=[];for(let e of i)e.resolve()}},x=()=>{f||p!==void 0||s.length===0||(f=ae().then(()=>{if(f=null,s.length>0){x();return}let e=te;te=[];for(let t of e)t.resolve()},e=>{f=null,p??=e,ne(p)}))},oe=()=>{if(!(d||f)){if(m===void 0){h??=Promise.resolve(i).then(e=>{m=e.streamFlushIntervalMs??0},()=>{m=0}).then(()=>{s.length>0&&oe()});return}if(m<=0){x();return}d=setTimeout(()=>{d=null,x()},m)}},se=async()=>{for(;;){if(p!==void 0)throw p;if(s.length===0&&!f)return;x(),await new Promise((e,t)=>{te.push({resolve:e,reject:t})})}};super({async write(e){if(p!==void 0)throw p;for(b===void 0&&(b=Date.now()),s.push(e),c+=e.byteLength,s.length>=g||c>=_?x():oe();p===void 0&&(s.length+l>=v||c+u>=y);)x(),await new Promise((e,t)=>{ee.push({resolve:e,reject:t})});if(p!==void 0)throw p},async close(){await se(),await o();let n=await i,r=Date.now();await n.streams.close(e,t),Ys(r,e,t)},async abort(e){try{await se()}catch{}d&&=(clearTimeout(d),null),s=[],c=0,p??=e??Error(`Stream aborted`),ne(p)}}),Object.defineProperty(this,un,{value:se,enumerable:!1,writable:!1})}};function Zs(e=globalThis){let t=b(()=>nc(e,`Request`)),n=b(()=>nc(e,`Response`));return{...$r(),...ui(),...ci(e),Request:e=>{if(!V(e,t.value))return!1;let n={method:B(e,`method`),url:B(e,`url`),headers:B(e,`headers`),body:B(e,`body`),duplex:B(e,`duplex`)},r=B(e,fn);r&&(n.responseWritable=r);let i=B(e,`signal`);return i&&(B(i,`aborted`)||B(i,P))&&(n.signal=i),n},Response:e=>V(e,n.value)?{type:B(e,`type`),url:B(e,`url`),status:B(e,`status`),statusText:B(e,`statusText`),headers:B(e,`headers`),body:B(e,`body`),redirected:B(e,`redirected`)}:!1}}function Qs(e,t,n,r,i,a){let o=t[P],s=t[F];if(!o){let e=(n[an]||Ms)();o=xs(e),s=`abrt_${e}`,t[P]=o,t[F]=s,t.signal&&(t.signal[P]=o,t.signal[F]=s)}return ec(e,o,i,a,r),{streamName:o,hookToken:s,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function $s(e,t){let n=t[P]??t.signal?.[P],r=t[F]??t.signal?.[F];if(!n)throw Error(`AbortController/AbortSignal stream name is not set`);return{streamName:n,hookToken:r,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function ec(e,t,n,r,i){e.aborted||e[mn]||(e[mn]=!0,e.addEventListener(`abort`,()=>{i.push((async()=>{try{let i=await Hi(r),a=await wc({aborted:!0,reason:e.reason},n,i),o=new Xs(n,t).getWriter();await o.write(a),await o.close()}catch{}})())},{once:!0}))}function tc(e=globalThis,t,n,r,i=!1,a){return{...Zs(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new m(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=`strm_${(e[an]||Ms)()}`,c=Ns(o),l=new Xs(n,s,a);c===`bytes`?i?t.push(o.pipeThrough(zs()).pipeTo(l)):t.push(o.pipeTo(l)):t.push(o.pipeThrough(Is(tc(e,t,n,r,i,a),r)).pipeTo(l));let u={name:s};return c&&(u.type=c),c===`bytes`&&i&&(u.framing=`framed-v1`),u},WritableStream:r=>{if(!(r instanceof e.WritableStream))return!1;let i=r[M],a=r[cn];if(typeof i==`string`&&typeof a==`string`){let e={name:i,runId:a},t=r[N];typeof t==`string`&&(e.encryptionPublicKey=t);let n=r[ln];return typeof n==`string`&&(e.deploymentId=n),e}let o=`strm_${(e[an]||Ms)()}`,s=new Us(n,o);return t.push(s.pipeTo(r)),{name:o}},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Qs(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Qs(i,i,e,t,n,r)}}function nc(e,t){let n=B(e,t)??B(globalThis,t);if(typeof n==`function`)return B(n,`prototype`)}function rc(e=globalThis){let t=b(()=>nc(e,`ReadableStream`)),n=b(()=>nc(e,`WritableStream`)),i=b(()=>nc(e,`AbortController`)),a=b(()=>nc(e,`AbortSignal`));return{...Zs(e),ReadableStream:e=>{if(!V(e,t.value))return!1;let n=B(e,dn);if(n!==void 0)return{bodyInit:n};let i=B(e,M);if(!i)throw new r("ReadableStream `name` is not set");let a={name:i},o=B(e,on);o&&(a.type=o);let s=B(e,sn);return s&&(a.framing=s),a},WritableStream:e=>{if(!V(e,n.value))return!1;let t=B(e,M);if(!t)throw new r("WritableStream `name` is not set");let i={name:t},a=B(e,cn);typeof a==`string`&&(i.runId=a);let o=B(e,ln);typeof o==`string`&&(i.deploymentId=o);let s=B(e,N);return typeof s==`string`&&(i.encryptionPublicKey=s),i},AbortController:e=>{if(typeof e!=`object`||!e)return!1;let t=e,n=B(e,P),r=V(e,i.value);if(n===void 0&&!r){let t=B(e,`signal`);if(typeof t!=`object`||!t||B(t,P)===void 0)return!1}let a=B(e,`signal`);return a?$s(a,t):!1},AbortSignal:e=>{if(typeof e!=`object`||!e)return!1;let t=B(e,P)!==void 0,n=V(e,a.value);return!t&&!n?!1:$s(e,e)}}}function ic(e=globalThis,t,n,r,i=!1,a){return{...Zs(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new m(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=o[M],c=o[on],l=o[sn];if(!s){s=`strm_${(e[an]||Ms)()}`,c=Ns(o),l=c===`bytes`&&i?`framed-v1`:l;let u=new Xs(n,s,a);c===`bytes`?l===`framed-v1`?t.push(o.pipeThrough(zs()).pipeTo(u)):t.push(o.pipeTo(u)):t.push(o.pipeThrough(Is(ic(e,t,n,r,i,a),r)).pipeTo(u))}let u={name:s};return c&&(u.type=c),l&&(u.framing=l),u},WritableStream:i=>{if(!(i instanceof e.WritableStream))return!1;let a=i[M],o=i[cn];a||(a=`strm_${(e[an]||Ms)()}`,t.push(new Us(n,a).pipeThrough(Ls(hc(e,t,n,r),r)).pipeTo(i)));let s={name:a};typeof o==`string`&&(s.runId=o);let c=i[N];typeof c==`string`&&(s.encryptionPublicKey=c);let l=i[ln];return typeof l==`string`&&(s.deploymentId=l),s},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Qs(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Qs(i,i,e,t,n,r)}}function ac(...e){let t=new WeakSet;function n(e){let t=e[hn];t&&!t.signal.aborted&&t.abort()}function r(e){if(!(typeof e!=`object`||!e)&&!t.has(e)){if(t.add(e),e instanceof AbortController){n(e),n(e.signal);return}if(e instanceof AbortSignal){n(e);return}if(Array.isArray(e)){for(let t of e)r(t);return}if(e instanceof Map){for(let t of e.values())r(t);return}if(e instanceof Set){for(let t of e)r(t);return}if(typeof Request<`u`&&e instanceof Request){r(e.signal);return}for(let t of Object.values(e))r(t)}}for(let t of e)r(t)}function oc(e,t,n,r){let i=new AbortController;return r.push((async()=>{try{let r=new Us(t,n).getReader(),a=await Promise.race([r.read(),new Promise(e=>{if(i.signal.aborted){e({value:void 0,done:!0});return}i.signal.addEventListener(`abort`,()=>e({value:void 0,done:!0}),{once:!0})})]);if(a.value&&!a.done){try{r.releaseLock()}catch{}try{let n=vs.getStore(),r=await Tc(a.value,t,n?.encryptionKey);e.abort(r?.reason)}catch{e.abort()}}else r.cancel().catch(()=>{})}catch{}})()),i}function sc(e,t,n){let r=e,i=e.signal;r[P]=t.streamName,r[F]=t.hookToken,i[P]=t.streamName,i[F]=t.hookToken,n&&(r[hn]=n,i[hn]=n)}function cc(e,t){let n=e,r=t;n[P]!==void 0&&(r[P]=n[P]),n[F]!==void 0&&(r[F]=n[F]),n[hn]!==void 0&&(r[hn]=n[hn])}function lc(e,t,n){let r=new AbortController;e.aborted?(sc(r,e),r.abort(e.reason)):e.streamName?sc(r,e,oc(r,n,e.streamName,t)):sc(r,e);let i=r.abort.bind(r);return r.abort=t=>{if(r.signal.aborted)return;i(t);let n=vs.getStore();if(n&&(n.ops.push((async()=>{try{let r=await wc({aborted:!0,reason:t},n.workflowMetadata.workflowRunId,n.encryptionKey),i=new Xs(n.workflowMetadata.workflowRunId,e.streamName).getWriter();await i.write(r),await i.close()}catch{}})()),e.hookToken)){let r=(async()=>{try{let{resumeHook:n}=await import(`./resume-hook-CYtSorp6.js`).then(e=>e.i);await n(e.hookToken,{aborted:!0,reason:t})}catch{}})();n.preCompletionOps.push(r)}},r}function uc(e,t,n){let r=new AbortController;return e.aborted?(sc(r,e),r.abort(e.reason)):e.streamName?sc(r,e,oc(r,n,e.streamName,t)):sc(r,e),r.signal}function dc(e=globalThis){return{...ei(e),...li(e)}}async function fc(e,t,n){let r=er(n);if(r)return Ii(r);let i=await Nn();if(!i.getEncryptionKeyForRun)return;let a=t?await i.getEncryptionKeyForRun(e,{deploymentId:t}):await i.getEncryptionKeyForRun(await i.runs.get(e));return a?await Xt(a,[`encrypt`]):void 0}function pc(e=globalThis,t,n,r){return{...dc(e),StepFunction:()=>{throw new m(`Step functions cannot be deserialized in client context. Step functions should not be returned from workflows.`,{hint:`A step function reference reached the client. Return a serializable value (e.g. the step result) instead of the step itself.`})},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Request:t=>{let n={method:t.method,headers:new e.Headers(t.headers),body:t.body,duplex:t.duplex};t.signal&&(n.signal=t.signal);let r=new e.Request(t.url,n);return t.signal&&cc(t.signal,r.signal),r},Response:t=>new e.Response(t.body,{status:t.status,statusText:t.statusText,headers:new e.Headers(t.headers)}),ReadableStream:i=>{if(`bodyInit`in i){let t=i.bodyInit;return new e.Response(t).body}if(i.type===`bytes`){let r=new Us(n,i.name,i.startIndex),a=xn();t.push(a.promise);let{readable:o,writable:s}=i.framing===`framed-v1`?Bs():new e.TransformStream;return Dn(r,s,a).catch(()=>{}),En(o,a),o}else{let a=Ks(n,i.name,i.startIndex),o=Ls(pc(e,t,n,r),r),s=xn();return t.push(s.promise),Dn(a,o.writable,s).catch(()=>{}),En(o.readable,s),o.readable}},WritableStream:i=>{let a=typeof i.runId==`string`?i.runId:n,o=a===n?r:fc(a,i.deploymentId,i.encryptionPublicKey),s=Is(tc(e,t,a,o),o),c=new Xs(a,i.name),l=xn();return t.push(l.promise),Dn(s.readable,c,l).catch(()=>{}),Tn(s.writable,l),Object.defineProperty(s.writable,M,{value:i.name,writable:!1}),Object.defineProperty(s.writable,cn,{value:a,writable:!1}),typeof i.deploymentId==`string`&&Object.defineProperty(s.writable,ln,{value:i.deploymentId,writable:!1}),typeof i.encryptionPublicKey==`string`&&Object.defineProperty(s.writable,N,{value:i.encryptionPublicKey,writable:!1}),s.writable},AbortController:e=>lc(e,t,n),AbortSignal:e=>uc(e,t,n)}}function mc(e=globalThis){return{...dc(e),...di(e),Request:t=>{Object.setPrototypeOf(t,e.Request.prototype);let n=t.responseWritable;return n&&(t[fn]=n,delete t.responseWritable,t.respondWith=()=>{throw new m("`respondWith()` must be called from within a step function.",{hint:'Move the `respondWith(...)` call inside a `"use step"` function — it cannot be invoked from a workflow context.'})}),t},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Response:t=>(Object.setPrototypeOf(t,e.Response.prototype),t),ReadableStream:t=>`bodyInit`in t?Object.create(e.ReadableStream.prototype,{[dn]:{value:t.bodyInit,writable:!1}}):Object.create(e.ReadableStream.prototype,{[M]:{value:t.name,writable:!1},[on]:{value:t.type,writable:!1},[sn]:{value:t.framing,writable:!1}}),WritableStream:t=>{let n={[M]:{value:t.name,writable:!1}};return typeof t.runId==`string`&&(n[cn]={value:t.runId,writable:!1}),typeof t.deploymentId==`string`&&(n[ln]={value:t.deploymentId,writable:!1}),typeof t.encryptionPublicKey==`string`&&(n[N]={value:t.encryptionPublicKey,writable:!1}),Object.create(e.WritableStream.prototype,n)},AbortController:e=>{let t=new ks(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),{[P]:e.streamName,[F]:e.hookToken,signal:t,abort:()=>{}}},AbortSignal:e=>{let t=new ks(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),t}}}function hc(e=globalThis,t,n,i,a){return{...dc(e),StepFunction:e=>{let t=e.stepId,n=e.closureVars,i=`boundThis`in e,a=i?e.boundThis:void 0,o=Array.isArray(e.boundArgs)?e.boundArgs:[],s=te(t);if(!s)throw new m(`Step function "${t}" not found. Make sure the step function is registered.`,{hint:`Make sure the step file is included in your build (i.e. it is listed in the workflow manifest), and that the SWC plugin is configured for the file.`});if(!n&&!i&&o.length===0)return s;let c=function(...e){let t=i?a:this,c=o.length>0?[...o,...e]:e;if(n){let e=vs.getStore();if(!e)throw new r(`Cannot call step function with closure variables outside step context`);let i={...e,closureVars:n};return vs.run(i,()=>s.apply(t,c))}return s.apply(t,c)};return Object.defineProperty(c,"name",{value:s.name}),Object.defineProperty(c,"stepId",{value:t,writable:!1,enumerable:!1,configurable:!1}),s.maxRetries!==void 0&&(c.maxRetries=s.maxRetries),c},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Request:t=>{let n=t.responseWritable,r={method:t.method,headers:new e.Headers(t.headers),body:t.body,duplex:t.duplex};t.signal&&(r.signal=t.signal);let i=new e.Request(t.url,r);return t.signal&&cc(t.signal,i.signal),n&&(i.respondWith=async e=>{let t=n.getWriter();await t.write(e),await t.close()}),i},Response:t=>new e.Response(t.body,{status:t.status,statusText:t.statusText,headers:new e.Headers(t.headers)}),ReadableStream:r=>{if(`bodyInit`in r){let t=r.bodyInit;return new e.Response(t).body}let o=new Us(n,r.name);if(r.type===`bytes`){let n=xn();t.push(n.promise);let{readable:i,writable:a}=r.framing===`framed-v1`?Bs():new e.TransformStream;return Dn(o,a,n).catch(()=>{}),En(i,n),i}else{let r=Ls(hc(e,t,n,i,a),i),s=xn();return t.push(s.promise),Dn(o,r.writable,s).catch(()=>{}),En(r.readable,s),r.readable}},WritableStream:r=>{let o=typeof r.runId==`string`?r.runId:n,s=typeof r.deploymentId==`string`?r.deploymentId:o===n?a:void 0,c=o===n?i:fc(o,s,r.encryptionPublicKey),l=Is(ic(e,t,o,c),c),u=new Xs(o,r.name),d=xn();return t.push(d.promise),Dn(l.readable,u,d).catch(()=>{}),Tn(l.writable,d),Object.defineProperty(l.writable,M,{value:r.name,writable:!1}),Object.defineProperty(l.writable,cn,{value:o,writable:!1}),s&&Object.defineProperty(l.writable,ln,{value:s,writable:!1}),typeof r.encryptionPublicKey!=`string`&&o===n&&Bi(i)&&Object.defineProperty(l.writable,N,{value:Un(i.keyPair.publicKey),writable:!1}),typeof r.encryptionPublicKey==`string`&&Object.defineProperty(l.writable,N,{value:r.encryptionPublicKey,writable:!1}),l.writable},AbortController:e=>lc(e,t,n),AbortSignal:e=>uc(e,t,n)}}async function gc(e,t){return await Ui(e,t)}const _c=async(e,t)=>{let n={},r=await Ni(await Gi(e,t),n);return await $(n,`deserialize`),{data:r}};function vc(e,t=globalThis,n={}){return gs(e.data,{global:t,extraRevivers:{...Pc(mc(t)),...n}})}function yc(e,t=globalThis,n={}){let{data:r}=e;if(!(r instanceof Uint8Array))return Kt(r,{...mc(t),...n});let{format:i,payload:a}=q(r);if(i===W.DEVALUE_V1)return Gt(new TextDecoder().decode(a),{...mc(t),...n});throw Error(`Unsupported serialization format: ${i}`)}async function bc(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1){if(a)return ni(j(e,tc(i,r,t,n,o)));try{let a={},c=await fs(e,n,{global:i,extraReducers:Nc(tc(i,r,t,n,o)),compression:s,compressionStats:a});return await $(a,`serialize`),c}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`workflow arguments`,t);throw new m(n,{hint:r,cause:t})}}async function xc(e,t,n,r=globalThis,i={},a){return vc(a??await _c(e,n),r,i)}async function Sc(e,t,n,r=globalThis,i=!1,a=!1,o){if(i)return ni(j(e,rc(r)));try{let t={},i=o??{executions:[]},s=await ms(e,n,{global:r,extraReducers:Nc(rc(r)),compression:a,compressionStats:t,guestCodeStats:i});return await $(t,`serialize`),await Fs(i),s}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`workflow return value`,t);throw new m(n,{hint:r,cause:t})}}async function Cc(e,t,n,r=[],i=globalThis,a={}){let o={},s=await ps(e,n,{global:i,extraRevivers:{...Pc(pc(i,r,t,n)),...a},compressionStats:o});return await $(o,`deserialize`),s}async function wc(e,t,n,r=globalThis,i=!1,a=!1,o){if(i)return ni(j(e,rc(r)));try{let t={},i=o??{executions:[]},s=await ms(e,n,{global:r,extraReducers:Nc(rc(r)),compression:a,compressionStats:t,guestCodeStats:i});return await $(t,`serialize`),await Fs(i),s}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`step arguments`,t);throw new m(n,{hint:r,cause:t})}}async function Tc(e,t,n,r=[],i=globalThis,a={},o){let s={},c=await hs(e,n,{global:i,extraRevivers:{...Pc(hc(i,r,t,n,o)),...a},compressionStats:s});return await $(s,`deserialize`),c}async function Ec(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c){if(a)return ni(j(e,ic(i,r,t,n,o,c)));try{let a={},l=await ms(e,n,{global:i,extraReducers:Nc(ic(i,r,t,n,o,c)),compression:s,compressionStats:a});return await $(a,`serialize`),l}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`step return value`,t);throw new m(n,{hint:r,cause:t})}}async function Dc(e,t,n,r=[],i=globalThis,a=!1){try{let o=j(e,ic(i,r,t,n)),s=new TextEncoder().encode(o),c=K(W.DEVALUE_V1,s),l={},u=await gc(await Mi(c,a,l),n);return await $(l,`serialize`),u}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`step error`,t);throw new m(n,{hint:r,cause:t})}}async function Oc(e,t,n,r=globalThis,i={},a){return yc(a??await _c(e,n),r,i)}async function kc(e,t,n,r=globalThis,i=!1){try{let t=j(e,rc(r)),a=new TextEncoder().encode(t),o=K(W.DEVALUE_V1,a),s={},c=await gc(await Mi(o,i,s),n);return await $(s,`serialize`),c}catch(e){let t=Ps(e),{message:n,hint:r}=Z(`run error`,t);throw new m(n,{hint:r,cause:t})}}async function Ac(e,t,n,r=[],i=globalThis,a={}){let o={},s=await Ni(await Gi(e,n),o);if(await $(o,`deserialize`),!(s instanceof Uint8Array))return Kt(s,{...pc(i,r,t,n),...a});let{format:c,payload:l}=q(s);if(c===W.DEVALUE_V1)return Gt(new TextDecoder().decode(l),{...pc(i,r,t,n),...a});throw Error(`Unsupported serialization format: ${c}`)}async function jc(e,t,n,r=globalThis,i={},a){return vc(a??await _c(e,n),r,i)}const Mc=[`ReadableStream`,`WritableStream`,`Request`,`Response`,`StepFunction`,`AbortController`,`AbortSignal`];function Nc(e){let t={};for(let n of Mc)n in e&&(t[n]=e[n]);return t}function Pc(e){let t={};for(let n of Mc)n in e&&(t[n]=e[n]);return t}const Fc=[{format:W.ENCRYPTED,minVersion:`4.2.0-beta.64`},{format:W.GZIP,minVersion:`5.0.0-beta.18`},{format:W.ZSTD,minVersion:`5.0.0-beta.18`},{format:W.SEALED,minVersion:`5.0.0-beta.37`}],Ic=[{capability:`framedByteStreams`,minVersion:`5.0.0-beta.15`}],Lc=new Set([W.DEVALUE_V1]);function Rc(e){if(!e||!Yt.default.valid(e))return{supportedFormats:Lc,framedByteStreams:!1};let t=new Set(Lc);for(let{format:n,minVersion:r}of Fc)Yt.default.gte(e,r)&&t.add(n);let n={supportedFormats:t,framedByteStreams:!1};for(let{capability:t,minVersion:r}of Ic)Yt.default.gte(e,r)&&(n[t]=!0);return n}const zc=new Set([`PARSE_ERROR`,`SCHEMA_VALIDATION`,f.WORLD_CONTRACT_ERROR]),Bc=new Set([`TRANSPORT`,`TIMEOUT`]),Vc=[r.is,u.is,a.is,h.is];function Hc(e){if(!i.is(e)||e.status!==void 0)return!1;let t=`cause`in e?e.cause:void 0;return e.code!==void 0&&zc.has(e.code)||e.message.startsWith(`Failed to parse response body for `)||e.message.startsWith(`Schema validation failed for `)||typeof t==`object`&&!!t&&`name`in t&&t.name===`ZodError`}function Uc(e){return l.is(e)?!0:i.is(e)?e.status!==void 0&&e.status>=500||e.code!==void 0&&Bc.has(e.code):!1}function Wc(e){if(p.is(e))return f.REPLAY_DIVERGENCE;if(_.is(e))return f.CORRUPTED_EVENT_LOG;if(g.is(e))return f.MAX_EVENTS_EXCEEDED;if(s.is(e))return f.DEPLOYMENT_MISMATCH;if(Hc(e)||Uc(e))return f.WORLD_CONTRACT_ERROR;for(let t of Vc)if(t(e))return f.RUNTIME_ERROR;return f.USER_ERROR}const Gc=`5.0.0-beta.41`,Kc=/^[a-zA-Z0-9_\-./@]+$/;function qc(e,t){if(!Kc.test(e))throw Error(`Invalid workflow name "${e}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);return`${ie(`workflow`,re(t))}${e}`}const Jc=se();function Yc(e){return`__health_check__${e}`}function Xc(e){let t=x.safeParse(e);if(t.success)return t.data}function Zc(e){return`wrun_hc_${e}`}async function Qc(e,t){let n=await Nn(),r=Yc(e.correlationId),i;if(e.runId)try{let t=await n.getEncryptionKeyForRun?.(e.runId);t&&(i=Un((await Rn(t)).publicKey))}catch(t){X.warn(`Health check could not derive a run public key; the caller will fall back to a key lookup`,{correlationId:e.correlationId,error:t instanceof Error?t.message:String(t)})}let a=JSON.stringify({healthy:!0,correlationId:e.correlationId,specVersion:t??5,workflowCoreVersion:Gc,hookResumeInputVersion:1,...i?{encryptionPublicKey:i}:{},timestamp:Date.now()}),o=Zc(e.correlationId);await n.streams.write(o,r,a),await n.streams.close(o,r)}function $c(e,t){let n;return Promise.race([e,new Promise((e,r)=>{n=setTimeout(()=>r(Error(`Operation timed out after ${t}ms`)),t)})]).finally(()=>clearTimeout(n))}async function el(e,t){let n=[],r=!1,i=!1;for(;!r&&!i;){let a=e.read(),o=new Promise(e=>setTimeout(()=>{i=!0,e({done:!0,value:void 0})},t)),s=await Promise.race([a,o]);r=s.done,s.value&&n.push(s.value)}return{chunks:n,timedOut:i}}function tl(e){if(e.length===0)return null;let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;let i=new TextDecoder().decode(n),a;try{a=JSON.parse(i)}catch{return i.length>0?{healthy:!0}:null}if(typeof a!=`object`||!a||!(`healthy`in a)||typeof a.healthy!=`boolean`)return null;let o=a,s={healthy:o.healthy};return typeof o.specVersion==`number`&&(s.specVersion=o.specVersion),typeof o.workflowCoreVersion==`string`&&(s.workflowCoreVersion=o.workflowCoreVersion),typeof o.encryptionPublicKey==`string`&&(s.encryptionPublicKey=o.encryptionPublicKey),typeof o.hookResumeInputVersion==`number`&&(s.hookResumeInputVersion=o.hookResumeInputVersion),s}async function nl(e,t){let n=t?.timeout??3e4,r=e.createRunId?.()??Jc(),i=Yc(r),a=`${ie(`workflow`,re(t?.namespace))}health_check`,o=Date.now();try{for(await e.queue(a,{__healthCheck:!0,correlationId:r,...t?.runId?{runId:t.runId}:{}},{specVersion:1,deploymentId:t?.deploymentId});Date.now()-o<n;)try{let t=n-(Date.now()-o),a=(await $c(e.streams.get(Zc(r),i),t)).getReader(),{chunks:s,timedOut:c}=await el(a,500);if(c){try{a.cancel()}catch{}await new Promise(e=>setTimeout(e,100));continue}let l=tl(s);if(l)return{...l,latencyMs:Date.now()-o};await new Promise(e=>setTimeout(e,100))}catch{await new Promise(e=>setTimeout(e,100))}return{healthy:!1,error:`Health check timed out after ${n}ms`}}catch(e){return{healthy:!1,error:e instanceof Error?e.message:String(e)}}}function rl(e,t){return new i(`Event pagination ${t} for workflow run "${e}".`,{code:f.WORLD_CONTRACT_ERROR})}function il(e,t,n){if(t){if(n.has(t))throw rl(e,`did not advance`);n.add(t)}}function al(e,t,n){if(t.length===0)return;let r=n??new Set(e.map(e=>e.eventId));for(let n of t)r.has(n.eventId)||(r.add(n.eventId),e.push(n))}function ol(e,t){let n=e.length;for(;n>0;){let r=e[n-1];if(r.eventId===t.eventId)return;if(r.eventId<t.eventId)break;n--}e.splice(n,0,t)}function sl(e,t,n,r){if(t){if(n===null)throw rl(e,`returned more pages without a cursor`);if(r.has(n))throw rl(e,`repeated a cursor`)}}function cl(e,t,n){return t!==null&&!n&&i.is(e)&&e.status===400}async function ll(e,t){let n=t!==void 0;return Xo(n?`workflow.loadNewEvents`:`workflow.loadEvents`,async r=>{r?.setAttributes({...ia(e)});let i=[],a=new Set,o=new Set,s=t??null,c=!0,l=0,u=!1,d=await Nn(),f=Date.now();for(;c;){let t=Date.now(),r=s;il(e,r,o);let f;try{f=await d.events.list({runId:e,pagination:{sortOrder:`asc`,cursor:r??void 0}})}catch(t){if(cl(t,r,u)){X.warn(`Event cursor was rejected; retrying with a full event reload.`,{workflowRunId:e}),i.length=0,a.clear(),o.clear(),s=null,u=!0;continue}throw t}al(i,f.data,a),c=f.hasMore,sl(e,c,f.cursor,o),s=f.cursor??s,l++,X.debug(`Loaded event page`,{workflowRunId:e,incremental:n,page:l,pageEvents:f.data.length,totalEvents:i.length,hasMore:c,pageMs:Date.now()-t})}return X.debug(`Event load complete`,{workflowRunId:e,incremental:n,totalEvents:i.length,pagesLoaded:l,totalMs:Date.now()-f}),r?.setAttributes({...sa(i.length),...xo(l)}),{events:i,cursor:s}})}function ul(){return process.env.WORKFLOW_PRECONDITION_GUARD!==`0`}function dl(){return process.env.WORKFLOW_SLOT_GAP_CHECK!==`0`}function fl(e){let t;for(let n of e)(t===void 0||n.eventId>t)&&(t=n.eventId);if(t===void 0)return;let n=t,r=n.lastIndexOf(`_`),i=oe(r===-1?n:n.slice(r+1))?.getTime();if(i===void 0){X.debug(`Precondition guard: latest event id is not a decodable ULID; sending no snapshot`,{eventId:n});return}return i}function pl(e,t){let n=e.length;al(e,t);let r=e.length-n;return r>0&&ml(e)!==void 0&&e.sort((e,t)=>e.eventId<t.eventId?-1:+(e.eventId>t.eventId)),r}function ml(e){let t;for(let n of e){let e=ae(n.eventId);if(e===null)return;(t===void 0||e>t)&&(t=e)}return t}function hl(e){let t=new Set,n=0;for(let r of e){let e=ae(r.eventId);if(e===null)return;t.add(e),e>n&&(n=e)}if(n===0)return;let r=t.has(1)?1:2;if(t.size===n-r+1)return;let i,a=0;for(let e=r;e<=n;e++)t.has(e)||(i??=e,a++);if(i!==void 0)return{firstMissingSlot:i,missingCount:a,maxSlot:n}}async function gl(e,t){let n=t,r=hl(n.events);for(let t=0;r!==void 0&&t<3;t++)await new Promise(e=>setTimeout(e,25*2**t)),n=await ll(e),r=hl(n.events);return{log:n,gap:r}}function _l(e,t){if(!ul())return{};let n=ml(e);if(n!==void 0)return{eventCount:n};let r=fl(e);return r===void 0?{}:{stateUpdatedAt:r,stateEventCount:e.length,...t?{stateCursor:t}:{}}}function vl(e,t){if(!c.is(e))return null;let n=e.details;if(typeof n!=`object`||!n)return null;let{events:r,cursor:i}=n;if(!Array.isArray(r)||r.length===0)return null;for(let e of r)if(typeof e!=`object`||!e||typeof e.eventId!=`string`||e.runId!==t)return null;return{events:r,cursor:typeof i==`string`?i:null}}const yl={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS, GET, HEAD`,"Access-Control-Allow-Headers":`Content-Type`};function bl(e,t){return async n=>{let r=new URL(n.url);return r.searchParams.has(`__health`)?n.method===`OPTIONS`?new Response(null,{status:204,headers:yl}):new Response(JSON.stringify({healthy:!0,endpoint:r.pathname,specVersion:t??5,workflowCoreVersion:Gc}),{status:200,headers:{"Content-Type":`application/json`,...yl}}):await e(n)}}async function xl(e,...t){let n=t[0];await Xo(`queue.publish`,{attributes:{...Za(`vercel-queue`),...Qa(n),...eo(`publish`),...No(`vercel-queue`),...Po(`vercel-queue`),...Fo(`vqs`),...Io(`publish`)},kind:await ts(`PRODUCER`)},async n=>{let{messageId:r}=await e.queue(...t);r&&n?.setAttributes($a(r))})}function Sl(e){if(e.requestedAt)try{return to(Date.now()-e.requestedAt.getTime())}catch{return}}function Cl(e,t){let n;return()=>(n||=(async()=>{let n=await e.getEncryptionKeyForRun?.(t);return n?await Ri(n):void 0})(),n)}function wl(t){import(`./functions-DAYiHNti.js`).then(t=>e(t.default,1)).then(({waitUntil:e})=>{e(t)})}function Tl(e,t){wl(e.catch(e=>{if(!(e?.name===`AbortError`||e?.name===`ResponseAborted`))try{t(e)}catch{}}))}async function El(e){let t=e();return wl(t.catch(()=>{})),t}export{ls as $,N as $n,wa as $t,Ec as A,ea as An,Co as At,xc as B,ar as Bn,Fa as Bt,Hc as C,oa as Cn,yo as Ct,kc as D,ga as Dn,eo as Dt,ac as E,ma as En,$a as Et,Is as F,Xr as Fn,Ga as Ft,Q as G,kn as Gn,Xa as Gt,_c as H,er as Hn,Wa as Ht,Ac as I,Zr as In,qa as It,Ss as J,Tn as Jn,Va as Jt,Os as K,xn as Kn,Ra as Kt,Tc as L,Qr as Ln,za as Lt,Sc as M,Bi as Mn,Ua as Mt,tc as N,Ii as Nn,Na as Nt,wc as O,Sa as On,Za as Ot,pc as P,W as Pn,Ka as Pt,cs as Q,ln as Qn,fa as Qt,Oc as R,Jr as Rn,Ma as Rt,Uc as S,aa as Sn,_o as St,Xs as T,ha as Tn,Qa as Tt,js as U,Rn as Un,Ja as Ut,Cc as V,Un as Vn,ja as Vt,As as W,Nn as Wn,Ya as Wt,vs as X,an as Xn,La as Xt,bs as Y,dn as Yn,Pa as Yt,X as Z,M as Zn,Ia as Zt,xl as _,Da as _n,so as _t,qc as a,sa as an,nn as ar,Vo as at,Gc as b,ia as bn,fo as bt,ol as c,na as cn,Ce as cr,Xo as ct,ll as d,ua as dn,De as dr,no as dt,ao as en,cn as er,Qo as et,Cl as f,da as fn,ue as fr,Ro as ft,_l as g,Ea as gn,co as gt,vl as h,Oa as hn,Aa as ht,Sl as i,_a as in,en as ir,Bo as it,bc as j,Ri as jn,wo as jt,Dc as k,ta as kn,So as kt,ul as l,ra as ln,T as lr,Ko as lt,Xc as m,pa as mn,me as mr,bo as mt,El as n,ya as nn,tn as nr,Ho as nt,Qc as o,ca as on,$t as or,is as ot,pl as p,la as pn,he as pr,Lo as pt,ys as q,Dn as qn,Ha as qt,al as r,va as rn,rn as rr,ts as rt,nl as s,xa as sn,Xt as sr,Wo as st,Tl as t,io as tn,fn as tr,Uo as tt,dl as u,Ca as un,Se as ur,as as ut,gl as v,ka as vn,lo as vt,Rc as w,ba as wn,vo as wt,Wc as x,ro as xn,oo as xt,bl as y,Ta as yn,uo as yt,jc as z,qr as zn,Ba as zt};