eve 0.27.11 → 0.27.13

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 (122) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/src/chunks/{use-eve-agent-CTJrwXM2.js → use-eve-agent-CWYe-vqE.js} +29 -18
  3. package/dist/src/chunks/{use-eve-agent-DaWxEtnE.js → use-eve-agent-CsSQOKnp.js} +29 -18
  4. package/dist/src/cli/commands/channels.js +1 -1
  5. package/dist/src/cli/commands/integration-setup.js +1 -1
  6. package/dist/src/cli/commands/register-registry-commands.js +1 -1
  7. package/dist/src/cli/commands/registry-setup-command.d.ts +5 -3
  8. package/dist/src/cli/commands/registry-setup-command.js +1 -1
  9. package/dist/src/cli/commands/registry.d.ts +9 -3
  10. package/dist/src/cli/commands/registry.js +1 -1
  11. package/dist/src/cli/dev/tui/remote-connection-probe.js +1 -1
  12. package/dist/src/cli/dev/tui/runner.js +1 -1
  13. package/dist/src/cli/dev/tui/target.d.ts +3 -15
  14. package/dist/src/cli/dev/tui/tui.js +1 -1
  15. package/dist/src/cli/invoke/command.d.ts +32 -0
  16. package/dist/src/cli/invoke/command.js +1 -0
  17. package/dist/src/cli/invoke/invoke.d.ts +27 -0
  18. package/dist/src/cli/invoke/invoke.js +1 -0
  19. package/dist/src/cli/invoke/result.d.ts +313 -0
  20. package/dist/src/cli/invoke/result.js +1 -0
  21. package/dist/src/cli/run.d.ts +2 -0
  22. package/dist/src/cli/run.js +3 -3
  23. package/dist/src/client/client.js +1 -1
  24. package/dist/src/client/message-response.js +1 -1
  25. package/dist/src/client/session-utils.d.ts +21 -15
  26. package/dist/src/client/session-utils.js +1 -1
  27. package/dist/src/client/session.js +1 -1
  28. package/dist/src/compiled/.vendor-stamp.json +5 -5
  29. package/dist/src/compiled/@workflow/core/capabilities.d.ts +6 -0
  30. package/dist/src/compiled/@workflow/core/encryption.d.ts +15 -2
  31. package/dist/src/compiled/@workflow/core/flushable-stream.d.ts +26 -0
  32. package/dist/src/compiled/@workflow/core/index.d.ts +1 -1
  33. package/dist/src/compiled/@workflow/core/index.js +2 -2
  34. package/dist/src/compiled/@workflow/core/private.d.ts +76 -33
  35. package/dist/src/compiled/@workflow/core/private.js +1 -1
  36. package/dist/src/compiled/@workflow/core/replay-payload-cache.d.ts +3 -2
  37. package/dist/src/compiled/@workflow/core/runtime/count-step-started-events.d.ts +52 -0
  38. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +41 -12
  39. package/dist/src/compiled/@workflow/core/runtime/resume-hook.d.ts +2 -2
  40. package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +9 -8
  41. package/dist/src/compiled/@workflow/core/runtime/world.d.ts +2 -7
  42. package/dist/src/compiled/@workflow/core/runtime.d.ts +1 -1
  43. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  44. package/dist/src/compiled/@workflow/core/sealed-box.d.ts +167 -0
  45. package/dist/src/compiled/@workflow/core/serialization/client.d.ts +3 -3
  46. package/dist/src/compiled/@workflow/core/serialization/codec.d.ts +6 -4
  47. package/dist/src/compiled/@workflow/core/serialization/encryption.d.ts +118 -17
  48. package/dist/src/compiled/@workflow/core/serialization/step.d.ts +4 -4
  49. package/dist/src/compiled/@workflow/core/serialization/types.d.ts +20 -0
  50. package/dist/src/compiled/@workflow/core/serialization-format.d.ts +44 -4
  51. package/dist/src/compiled/@workflow/core/serialization.d.ts +21 -21
  52. package/dist/src/compiled/@workflow/core/set-attributes.d.ts +2 -7
  53. package/dist/src/compiled/@workflow/core/step/context-storage.d.ts +2 -2
  54. package/dist/src/compiled/@workflow/core/symbols.d.ts +23 -10
  55. package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +4 -4
  56. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  57. package/dist/src/compiled/@workflow/core/workflow/abort-controller.d.ts +1 -1
  58. package/dist/src/compiled/@workflow/core/workflow/index.d.ts +1 -1
  59. package/dist/src/compiled/@workflow/core/workflow/set-attributes.d.ts +0 -9
  60. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  61. package/dist/src/compiled/@workflow/errors/index.d.ts +1 -1
  62. package/dist/src/compiled/@workflow/world/events.d.ts +5 -0
  63. package/dist/src/compiled/@workflow/world/hooks.d.ts +27 -0
  64. package/dist/src/compiled/@workflow/world/index.d.ts +2 -2
  65. package/dist/src/compiled/@workflow/world/interfaces.d.ts +8 -6
  66. package/dist/src/compiled/@workflow/world/queue.d.ts +30 -26
  67. package/dist/src/compiled/@workflow/world/runs.d.ts +5 -0
  68. package/dist/src/compiled/@workflow/world/spec-version.d.ts +3 -4
  69. package/dist/src/compiled/@workflow/world-local/index.js +4 -4
  70. package/dist/src/compiled/@workflow/world-vercel/index.js +5 -5
  71. package/dist/src/compiled/_chunks/workflow/{attribute-changes-B6ltn-ph.js → attribute-changes-DeZc2RZz.js} +2 -2
  72. package/dist/src/compiled/_chunks/workflow/{dist-D7ANgxe0.js → dist-WjtNsOyf.js} +1 -1
  73. package/dist/src/compiled/_chunks/workflow/private-Cre8uYkA.js +1 -0
  74. package/dist/src/compiled/_chunks/workflow/resume-hook-ip1hbn1b.js +1 -0
  75. package/dist/src/compiled/_chunks/workflow/run-CWytxfIp.js +1 -0
  76. package/dist/src/compiled/_chunks/workflow/sleep-BjrUxUcs.js +1 -0
  77. package/dist/src/compiled/_chunks/workflow/wait-until-De9yESQN.js +15 -0
  78. package/dist/src/compiled/_chunks/workflow/{workflow-routes-Pd-WKcx_.js → workflow-routes-CwqB063q.js} +1 -1
  79. package/dist/src/evals/cli/eval-client.js +1 -1
  80. package/dist/src/evals/session.js +1 -1
  81. package/dist/src/execution/web-fetch/request.js +1 -1
  82. package/dist/src/internal/application/compiled-artifacts.js +1 -1
  83. package/dist/src/internal/application/package.js +1 -1
  84. package/dist/src/internal/node-esm-compat-banner.js +1 -1
  85. package/dist/src/internal/workflow/builtins.d.ts +2 -2
  86. package/dist/src/internal/workflow/development-world-protocol.js +1 -1
  87. package/dist/src/internal/workflow-bundle/workflow-core-shim.d.ts +5 -5
  88. package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -1
  89. package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/world-target.js +1 -0
  90. package/dist/src/public/channels/linear/defaults.js +4 -2
  91. package/dist/src/runtime/attributes/emit.js +1 -1
  92. package/dist/src/services/dev-client/client-options.d.ts +2 -0
  93. package/dist/src/services/dev-client/client-options.js +1 -1
  94. package/dist/src/services/dev-client/target.d.ts +17 -0
  95. package/dist/src/services/dev-client/target.js +1 -0
  96. package/dist/src/setup/scaffold/create/project.js +1 -1
  97. package/dist/src/setup/verified-remote-client.d.ts +5 -1
  98. package/dist/src/setup/verified-remote-client.js +1 -1
  99. package/dist/src/svelte/index.js +1 -1
  100. package/dist/src/svelte/use-eve-agent.js +1 -1
  101. package/dist/src/vue/index.js +1 -1
  102. package/dist/src/vue/use-eve-agent.js +1 -1
  103. package/docs/channels/linear.mdx +4 -0
  104. package/docs/extensions.md +3 -1
  105. package/docs/install-integrations.mdx +76 -1
  106. package/docs/reference/cli.md +28 -1
  107. package/package.json +8 -8
  108. package/dist/src/compiled/@workflow/core/runtime/step-handler.d.ts +0 -2
  109. package/dist/src/compiled/_chunks/workflow/private-DolBHKOQ.js +0 -1
  110. package/dist/src/compiled/_chunks/workflow/resume-hook-D2AqAGjq.js +0 -1
  111. package/dist/src/compiled/_chunks/workflow/run-BMRZ6pA-.js +0 -1
  112. package/dist/src/compiled/_chunks/workflow/sleep-CrgsokmG.js +0 -1
  113. package/dist/src/compiled/_chunks/workflow/wait-until-B-1TiJji.js +0 -15
  114. package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/world-target.js +0 -1
  115. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/index.js +0 -0
  116. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/parse-name.js +0 -0
  117. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/pluralize.js +0 -0
  118. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/promise.js +0 -0
  119. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/time.js +0 -0
  120. /package/dist/src/node_modules/.pnpm/{@workflow_utils@5.0.0-beta.6 → @workflow_utils@5.0.0-beta.7}/node_modules/@workflow/utils/dist/workflow-routes.js +0 -0
  121. /package/dist/src/{cli/dev/tui → services/dev-client}/agent-info-probe.d.ts +0 -0
  122. /package/dist/src/{cli/dev/tui → services/dev-client}/agent-info-probe.js +0 -0
@@ -1,15 +0,0 @@
1
- import{o as e,t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,o as r,s as i}from"./private-DolBHKOQ.js";import"./dist-B-vbuNqP.js";import{D as a,E as o,O as s,a as c,c as l,i as u,l as d,m as f,p,u as m}from"./dist-BeQ_csYA.js";import{_ as h,h as g,n as _,o as v,u as y}from"./dist-D7ANgxe0.js";import{t as b}from"./env-config-CYoX3muK.js";import{types as ee}from"node:util";import{AsyncLocalStorage as te}from"node:async_hooks";function ne(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 re(e){return ne(`workflow`,e)}function ie(e){return ne(`step`,e)}function ae(e){return ue(ie(e),e)}function oe(e){return ue(re(e),e)}function se(e){return re(e)?.shortName??le(`workflow`,e)??e}function ce(e){return ie(e)?.shortName??le(`step`,e)??e}function le(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 ue(e,t){return e?`${e.shortName} (${e.moduleSpecifier})`:t}function x(e,t,n){return n===1?e:t}const de=(()=>{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})(),S=(e,t)=>n=>de?`\x1b[${e}m${n}\x1b[${t}m`:n,C={bold:S(1,22),dim:S(2,22),italic:S(3,23),red:S(31,39),blue:S(34,39),cyan:S(36,39),yellow:S(33,39),magenta:S(35,39)},fe={info:C.blue,help:C.cyan,warn:C.yellow,error:C.red};function pe(e){let t=Array.isArray(e)?e.join(`
2
- `):e;return fe.info(`${C.bold(`hint:`)} ${t}`)}function me(e){return fe.info(`${C.bold(`docs:`)} ${e}`)}function he(e){return C.italic(`${C.dim("`")}${e}${C.dim("`")}`)}function w(e){return C.dim(e)}function ge(e){return C.bold(e)}function _e(e){return C.red(e)}function ve(e){return C.magenta(e)}function ye(e,t){let n=[e];return t.forEach((e,r)=>{let i=e.split(`
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
- `)}var be=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}})),xe=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):()=>{}})),Se=t(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=be(),a=xe();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*$`)})),Ce=t(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),we=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)}})),T=t(((e,t)=>{let n=xe(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=be(),{safeRe:a,t:o}=Se(),s=Ce(),{compareIdentifiers:c}=we();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}}})),Te=t(((e,t)=>{let n=T();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}}})),Ee=t(((e,t)=>{let n=Te();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),De=t(((e,t)=>{let n=Te();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Oe=t(((e,t)=>{let n=T();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}}})),ke=t(((e,t)=>{let n=Te();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`}})),Ae=t(((e,t)=>{let n=T();t.exports=(e,t)=>new n(e,t).major})),je=t(((e,t)=>{let n=T();t.exports=(e,t)=>new n(e,t).minor})),Me=t(((e,t)=>{let n=T();t.exports=(e,t)=>new n(e,t).patch})),Ne=t(((e,t)=>{let n=Te();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),E=t(((e,t)=>{let n=T();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Pe=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>n(t,e,r)})),Fe=t(((e,t)=>{let n=E();t.exports=(e,t)=>n(e,t,!0)})),Ie=t(((e,t)=>{let n=T();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Le=t(((e,t)=>{let n=Ie();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),Re=t(((e,t)=>{let n=Ie();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),ze=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>n(e,t,r)>0})),Be=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>n(e,t,r)<0})),Ve=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>n(e,t,r)===0})),He=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>n(e,t,r)!==0})),Ue=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>n(e,t,r)>=0})),We=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>n(e,t,r)<=0})),Ge=t(((e,t)=>{let n=Ve(),r=He(),i=ze(),a=Ue(),o=Be(),s=We();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}`)}}})),Ke=t(((e,t)=>{let n=T(),r=Te(),{safeRe:i,t:a}=Se();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)}})),qe=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}}})),D=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,se(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=>oe(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(ce(this.set[t],e,this.options))return!0;return!1}};let r=new(qe()),i=Ce(),a=Je(),o=xe(),s=T(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=Se(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=be(),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],``)),oe=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),se=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()),ce=(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}})),Je=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=Ce(),{safeRe:i,t:a}=Se(),o=Ge(),s=xe(),c=T(),l=D()})),Ye=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),Xe=t(((e,t)=>{let n=D();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),Ze=t(((e,t)=>{let n=T(),r=D();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}})),Qe=t(((e,t)=>{let n=T(),r=D();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}})),$e=t(((e,t)=>{let n=T(),r=D(),i=ze();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}})),et=t(((e,t)=>{let n=D();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),tt=t(((e,t)=>{let n=T(),r=Je(),{ANY:i}=r,a=D(),o=Ye(),s=ze(),c=Be(),l=We(),u=Ue();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}})),nt=t(((e,t)=>{let n=tt();t.exports=(e,t,r)=>n(e,t,`>`,r)})),rt=t(((e,t)=>{let n=tt();t.exports=(e,t,r)=>n(e,t,`<`,r)})),it=t(((e,t)=>{let n=D();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),at=t(((e,t)=>{let n=Ye(),r=E();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}})),ot=t(((e,t)=>{let n=D(),r=Je(),{ANY:i}=r,a=Ye(),o=E(),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})),st=t(((e,t)=>{let n=Se(),r=be(),i=T(),a=we();t.exports={parse:Te(),valid:Ee(),clean:De(),inc:Oe(),diff:ke(),major:Ae(),minor:je(),patch:Me(),prerelease:Ne(),compare:E(),rcompare:Pe(),compareLoose:Fe(),compareBuild:Ie(),sort:Le(),rsort:Re(),gt:ze(),lt:Be(),eq:Ve(),neq:He(),gte:Ue(),lte:We(),cmp:Ge(),coerce:Ke(),Comparator:Je(),Range:D(),satisfies:Ye(),toComparators:Xe(),maxSatisfying:Ze(),minSatisfying:Qe(),minVersion:$e(),validRange:et(),outside:tt(),gtr:nt(),ltr:rt(),intersects:it(),simplifyRange:at(),subset:ot(),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 ct=2**32-1,lt=ct-1;var O=class extends Error{constructor(e,t,n,r){super(e),this.name=`DevalueError`,this.path=t.join(``),this.value=n,this.root=r}};function ut(e){return e===null||typeof e!=`object`&&typeof e!=`function`}const dt=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function ft(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getPrototypeOf(t)===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===dt}function pt(e){return Object.prototype.toString.call(e).slice(8,-1)}function mt(e){switch(e){case`"`:return`\\"`;case`<`:return`\\u003C`;case`\\`:return`\\\\`;case`
5
- `:return`\\n`;case`\r`:return`\\r`;case` `:return`\\t`;case`\b`:return`\\b`;case`\f`:return`\\f`;case`\u2028`:return`\\u2028`;case`\u2029`:return`\\u2029`;default:return e<` `?`\\u${e.charCodeAt(0).toString(16).padStart(4,`0`)}`:``}}function k(e){let t=``,n=0,r=e.length;for(let i=0;i<r;i+=1){let r=e[i],a=mt(r);a&&(t+=e.slice(n,i)+a,n=i+1)}return`"${n===0?e:t+e.slice(n)}"`}function ht(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)}const gt=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function _t(e){return gt.test(e)?`.`+e:`[`+JSON.stringify(e)+`]`}function vt(e){return!(!Number.isInteger(e)||e<0||e>lt)}function yt(e){return!(!Number.isInteger(e)||e<0||e>ct)}function bt(e){if(e.length===0||e.length>1&&e.charCodeAt(0)===48)return!1;for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<48||n>57)return!1}return vt(+e)}function xt(e){let t=Object.keys(e);for(var n=t.length-1;n>=0&&!bt(t[n]);n--);return t.length=n+1,t}function St(e){return new Uint8Array(e).toBase64()}function Ct(e){return Uint8Array.fromBase64(e).buffer}function wt(e){return Buffer.from(e).toString(`base64`)}function Tt(e){return Uint8Array.from(Buffer.from(e,`base64`)).buffer}function Et(e){let t=new Uint8Array(e),n=``,r=32768;for(let e=0;e<t.length;e+=r){let i=t.subarray(e,e+r);n+=String.fromCharCode.apply(null,i)}return btoa(n)}function Dt(e){let t=atob(e),n=t.length,r=new Uint8Array(n);for(let e=0;e<n;e++)r[e]=t.charCodeAt(e);return r.buffer}const Ot=typeof Uint8Array.fromBase64==`function`,kt=typeof process==`object`&&process.versions?.node!==void 0,At=Ot?St:kt?wt:Et,jt=Ot?Ct:kt?Tt:Dt;function Mt(e,t){return Nt(JSON.parse(e),t)}function Nt(e,t){if(typeof e==`number`)return a(e,!0);if(!Array.isArray(e)||e.length===0)throw Error(`Invalid input`);let n=e,r=Array(n.length),i=null;function a(e,o=!1){if(e===-1)return;if(e===-3)return NaN;if(e===-4)return 1/0;if(e===-5)return-1/0;if(e===-6)return-0;if(o||typeof e!=`number`)throw Error(`Invalid input`);if(e in r)return r[e];let s=n[e];if(!s||typeof s!=`object`)r[e]=s;else if(Array.isArray(s))if(typeof s[0]==`string`){let o=s[0],c=t&&Object.hasOwn(t,o)?t[o]:void 0;if(c){let t=s[1];if(typeof t!=`number`&&(t=n.push(s[1])-1),i??=new Set,i.has(t))throw Error(`Invalid circular reference`);return i.add(t),r[e]=c(a(t)),i.delete(t),r[e]}switch(o){case`Date`:r[e]=new Date(s[1]);break;case`Set`:let t=new Set;r[e]=t;for(let e=1;e<s.length;e+=1)t.add(a(s[e]));break;case`Map`:let i=new Map;r[e]=i;for(let e=1;e<s.length;e+=2)i.set(a(s[e]),a(s[e+1]));break;case`RegExp`:r[e]=new RegExp(s[1],s[2]);break;case`Object`:{let t=s[1];if(typeof n[t]==`object`&&n[t][0]!==`BigInt`)throw Error(`Invalid input`);r[e]=Object(a(t));break}case`BigInt`:r[e]=BigInt(s[1]);break;case`null`:let c=Object.create(null);r[e]=c;for(let e=1;e<s.length;e+=2){if(s[e]===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");c[s[e]]=a(s[e+1])}break;case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:case`Int16Array`:case`Uint16Array`:case`Float16Array`:case`Int32Array`:case`Uint32Array`:case`Float32Array`:case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:case`DataView`:{if(n[s[1]][0]!==`ArrayBuffer`)throw Error(`Invalid data`);let t=globalThis[o],i=a(s[1]);r[e]=s[2]===void 0?new t(i):new t(i,s[2],s[3]);break}case`ArrayBuffer`:{let t=s[1];if(typeof t!=`string`)throw Error(`Invalid ArrayBuffer encoding`);let n=jt(t);r[e]=n;break}case`Temporal.Duration`:case`Temporal.Instant`:case`Temporal.PlainDate`:case`Temporal.PlainTime`:case`Temporal.PlainDateTime`:case`Temporal.PlainMonthDay`:case`Temporal.PlainYearMonth`:case`Temporal.ZonedDateTime`:{let t=o.slice(9);r[e]=Temporal[t].from(s[1]);break}case`URL`:{let t=new URL(s[1]);r[e]=t;break}case`URLSearchParams`:{let t=new URLSearchParams(s[1]);r[e]=t;break}default:throw Error(`Unknown type ${o}`)}}else if(s[0]===-7){let t=s[1];if(!yt(t))throw Error(`Invalid input`);let n=[];r[e]=n,n[lt]=void 0,delete n[lt];for(let e=2;e<s.length;e+=2){let r=s[e];if(!vt(r)||r>=t)throw Error(`Invalid input`);n[r]=a(s[e+1])}n.length=t}else{let t=Array(s.length);r[e]=t;for(let e=0;e<s.length;e+=1){let n=s[e];n!==-2&&(t[e]=a(n))}}else{let t={};r[e]=t;for(let e of Object.keys(s)){if(e===`__proto__`)throw Error("Cannot parse an object with a `__proto__` property");let n=s[e];t[e]=a(n)}}return r[e]}return a(0)}function A(e,t){let n=Pt(!1,e,t);return typeof n==`string`?n:`[${n.join(`,`)}]`}function Pt(e,t,n){let r=[],i=new Map,a=[];if(n)for(let e of Object.getOwnPropertyNames(n))a.push({key:e,fn:n[e]});let o=[],s=0;function c(n,l){if(n===void 0)return-1;if(Number.isNaN(n))return-3;if(n===1/0)return-4;if(n===-1/0)return-5;if(n===0&&1/n<0)return-6;if(i.has(n))return i.get(n);l??=s++,i.set(n,l);for(let{key:e,fn:t}of a){let i=t(n);if(i)return r[l]=`["${e}",${c(i)}]`,l}if(typeof n==`function`)throw new O(`Cannot stringify a function`,o,n,t);if(typeof n==`symbol`)throw new O(`Cannot stringify a Symbol primitive`,o,n,t);let u=``;if(ut(n))u=Ft(n);else if(typeof n.then==`function`){if(!e)throw new O(`Cannot stringify a Promise or thenable — use stringifyAsync instead`,o,n,t);u=Promise.resolve(n).then(e=>{let t=c(e,l);t<0&&(r[l]=t)})}else{let e=pt(n);switch(e){case`Number`:case`String`:case`Boolean`:case`BigInt`:u=`["Object",${c(n.valueOf())}]`;break;case`Date`:u=`["Date","${isNaN(n.getDate())?``:n.toISOString()}"]`;break;case`URL`:u=`["URL",${k(n.toString())}]`;break;case`URLSearchParams`:u=`["URLSearchParams",${k(n.toString())}]`;break;case`RegExp`:let{source:r,flags:i}=n;u=i?`["RegExp",${k(r)},"${i}"]`:`["RegExp",${k(r)}]`;break;case`Array`:{let e=!1;u=`[`;for(let t=0;t<n.length;t+=1)if(t>0&&(u+=`,`),Object.hasOwn(n,t))o.push(`[${t}]`),u+=c(n[t]),o.pop();else if(e)u+=-2;else{let t=xt(n),r=t.length,i=String(n.length).length;if((n.length-r)*3>4+i+r*(i+1)){u=`[-7,`+n.length;for(let e=0;e<t.length;e++){let r=t[e];o.push(`[${r}]`),u+=`,`+r+`,`+c(n[r]),o.pop()}break}else e=!0,u+=-2}u+=`]`;break}case`Set`:u=`["Set"`;for(let e of n)u+=`,${c(e)}`;u+=`]`;break;case`Map`:u=`["Map"`;for(let[e,t]of n)o.push(`.get(${ut(e)?Ft(e):`...`})`),u+=`,${c(e)},${c(t)}`,o.pop();u+=`]`;break;case`Int8Array`:case`Uint8Array`:case`Uint8ClampedArray`:case`Int16Array`:case`Uint16Array`:case`Float16Array`:case`Int32Array`:case`Uint32Array`:case`Float32Array`:case`Float64Array`:case`BigInt64Array`:case`BigUint64Array`:case`DataView`:{let t=n;u=`["`+e+`",`+c(t.buffer),t.byteLength!==t.buffer.byteLength&&(u+=`,${t.byteOffset},${t.length}`),u+=`]`;break}case`ArrayBuffer`:u=`["ArrayBuffer","${At(n)}"]`;break;case`Temporal.Duration`:case`Temporal.Instant`:case`Temporal.PlainDate`:case`Temporal.PlainTime`:case`Temporal.PlainDateTime`:case`Temporal.PlainMonthDay`:case`Temporal.PlainYearMonth`:case`Temporal.ZonedDateTime`:u=`["${e}",${k(n.toString())}]`;break;default:if(!ft(n))throw new O(`Cannot stringify arbitrary non-POJOs`,o,n,t);if(ht(n).length>0)throw new O(`Cannot stringify POJOs with symbolic keys`,o,n,t);if(Object.getPrototypeOf(n)===null){u=`["null"`;for(let e of Object.keys(n)){if(e===`__proto__`)throw new O(`Cannot stringify objects with __proto__ keys`,o,n,t);o.push(_t(e)),u+=`,${k(e)},${c(n[e])}`,o.pop()}u+=`]`}else{u=`{`;let e=!1;for(let r of Object.keys(n)){if(r===`__proto__`)throw new O(`Cannot stringify objects with __proto__ keys`,o,n,t);e&&(u+=`,`),e=!0,o.push(_t(r)),u+=`${k(r)}:${c(n[r])}`,o.pop()}u+=`}`}}}return r[l]=u,l}let l=c(t);return l<0?`${l}`:r}function Ft(e){let t=typeof e;return t===`string`?k(e):e===void 0?`-1`:e===0&&1/e<0?`-6`:t===`bigint`?`["BigInt","${e}"]`:String(e)}var It=e(st(),1);async function Lt(e,t=[`encrypt`,`decrypt`]){if(e.byteLength!==32)throw new o(`Encryption key must be exactly 32 bytes, got ${e.byteLength}`);return globalThis.crypto.subtle.importKey(`raw`,e,`AES-GCM`,!1,t)}async function Rt(e,t){let n=globalThis.crypto.getRandomValues(new Uint8Array(12)),r;try{r=await globalThis.crypto.subtle.encrypt({name:`AES-GCM`,iv:n,tagLength:128},e,t)}catch(e){throw new p(`AES-256-GCM encryption failed: ${e instanceof Error?e.message:String(e)}`,{cause:e,context:{operation:`encrypt`,byteLength:t.byteLength}})}let i=new Uint8Array(12+r.byteLength);return i.set(n,0),i.set(new Uint8Array(r),12),i}async function zt(e,t){if(t.byteLength<28)throw new p(`Encrypted data too short: expected at least 28 bytes, got ${t.byteLength}`,{context:{operation:`decrypt`,byteLength:t.byteLength}});let n=t.subarray(0,12),r=t.subarray(12),i;try{i=await globalThis.crypto.subtle.decrypt({name:`AES-GCM`,iv:n,tagLength:128},e,r)}catch(e){throw new p(`AES-256-GCM decryption failed: ${e instanceof Error?e.message:String(e)}`,{cause:e,context:{operation:`decrypt`,byteLength:t.byteLength}})}return new Uint8Array(i)}const Bt=Symbol.for(`WORKFLOW_USE_STEP`),Vt=Symbol.for(`WORKFLOW_SET_ATTRIBUTES`),Ht=Symbol.for(`WORKFLOW_CREATE_HOOK`),Ut=Symbol.for(`WORKFLOW_SLEEP`),Wt=Symbol.for(`WORKFLOW_GET_STREAM_ID`),Gt=Symbol.for(`WORKFLOW_STABLE_ULID`),j=Symbol.for(`WORKFLOW_STREAM_NAME`),Kt=Symbol.for(`WORKFLOW_STREAM_TYPE`),qt=Symbol.for(`WORKFLOW_STREAM_FRAMING`),M=Symbol.for(`WORKFLOW_STREAM_SERVER_RUN_ID`),N=Symbol.for(`WORKFLOW_STREAM_SERVER_DEPLOYMENT_ID`),Jt=Symbol.for(`WORKFLOW_STREAM_WRITE_BATCH`),Yt=Symbol.for(`BODY_INIT`),Xt=Symbol.for(`WEBHOOK_RESPONSE_WRITABLE`),Zt=Symbol.for(`workflow-class-registry`),P=Symbol.for(`WORKFLOW_ABORT_STREAM_NAME`),F=Symbol.for(`WORKFLOW_ABORT_HOOK_TOKEN`),Qt=Symbol.for(`WORKFLOW_ABORT_LISTENER_ATTACHED`),$t=Symbol.for(`WORKFLOW_ABORT_READER_CANCEL`),en=()=>b(`WORKFLOW_STREAM_MAX_INFLIGHT_CHUNKS`,1e3,{integer:!0,min:1}),tn=()=>b(`WORKFLOW_STREAM_MAX_CHUNKS_PER_BATCH`,1e3,{integer:!0,min:1}),nn=()=>b(`WORKFLOW_STREAM_MAX_BYTES_PER_BATCH`,1048576,{integer:!0,min:1}),rn=()=>b(`WORKFLOW_LOCK_POLL_INTERVAL_MS`,10,{integer:!0,min:1});function I(){let e={...i(),pendingOps:0,doneResolved:!1,streamEnded:!1};return e.promise.catch(()=>{}),e}function an(e){if(e.locked)return!1;let t;try{t=e.getWriter()}catch{return!1}try{t.releaseLock()}catch{return!1}return!0}function on(e){if(e.locked)return!1;let t;try{t=e.getReader()}catch{return!1}try{t.releaseLock()}catch{return!1}return!0}function sn(e,t){if(t.writablePollingInterval!==void 0)return;let n=setInterval(()=>{if(t.doneResolved||t.streamEnded){clearInterval(n),t.writablePollingInterval=void 0;return}an(e)&&t.pendingOps===0&&(t.doneResolved=!0,t.resolve(),clearInterval(n),t.writablePollingInterval=void 0)},rn());t.writablePollingInterval=n}function cn(e,t){if(t.readablePollingInterval!==void 0)return;let n=setInterval(()=>{if(t.doneResolved||t.streamEnded){clearInterval(n),t.readablePollingInterval=void 0;return}on(e)&&t.pendingOps===0&&(t.doneResolved=!0,t.resolve(),clearInterval(n),t.readablePollingInterval=void 0)},rn());t.readablePollingInterval=n}function L(e,t,n){let r=t[Jt];return typeof r==`function`?hn(e,t,n,r):ln(e,t,n)}async function ln(e,t,n){let r=e.getReader(),i=t.getWriter(),a;try{for(;;){if(n.streamEnded)return;let e=await Promise.race([r.read(),i.closed.then(()=>{throw new o(`Writable stream closed prematurely`)})]);if(n.streamEnded)return;if(e.done){n.streamEnded=!0,await i.close(),n.doneResolved||(n.doneResolved=!0,n.resolve());return}n.pendingOps++;try{await i.write(e.value)}finally{n.pendingOps--}}}catch(e){throw n.streamEnded=!0,a=e,n.doneResolved||(n.doneResolved=!0,n.reject(e)),e}finally{r.cancel(a).catch(()=>{}),r.releaseLock(),i.releaseLock()}}function un(e,t){let n=e[t];n&&(e[t]=null,n())}function dn(e){let t=0,n=0;for(let r of e.queue){if(t>=e.maxChunksPerBatch||t>0&&n+r.byteLength>e.maxBytesPerBatch)break;t++,n+=r.byteLength}return t}async function fn(e){for(;;){if(e.queue.length===0){if(e.sourceDone)return;await new Promise(t=>{e.wakeConsumer=t});continue}let t=dn(e),n=e.queue.slice(0,t);e.queue=e.queue.slice(t),await e.batchWrite(n),e.state.pendingOps-=n.length,un(e,`wakeProducer`)}}function pn(e,t,n){return Promise.race([e.read(),t.closed.then(()=>{throw new o(`Writable stream closed prematurely`)}),n.then(()=>{throw new o(`Stream consumer ended prematurely`)},e=>{throw e})])}async function mn(e,t,n){e.state.pendingOps<n||await Promise.race([new Promise(t=>{e.wakeProducer=t}),t.then(()=>void 0,()=>void 0)])}async function hn(e,t,n,r){let i=e.getReader(),a=t.getWriter(),o=en(),s,c={state:n,batchWrite:r,queue:[],sourceDone:!1,wakeConsumer:null,wakeProducer:null,maxChunksPerBatch:tn(),maxBytesPerBatch:nn()},l=fn(c);try{for(;!n.streamEnded;){let e=await pn(i,a,l);if(n.streamEnded)return;if(e.done){c.sourceDone=!0,un(c,`wakeConsumer`),await l,n.streamEnded=!0,await a.close(),n.doneResolved||(n.doneResolved=!0,n.resolve());return}c.queue.push(e.value),n.pendingOps++,un(c,`wakeConsumer`),await mn(c,l,o)}}catch(e){throw n.streamEnded=!0,s=e,c.sourceDone=!0,un(c,`wakeConsumer`),await l.catch(()=>{}),n.doneResolved||(n.doneResolved=!0,n.reject(e)),e}finally{i.cancel(s).catch(()=>{}),i.releaseLock(),a.releaseLock()}}function gn(e){if(e.specVersion!==5)throw new o(`This Workflow runtime requires a World with matching spec version 5, but the configured World declares spec version ${e.specVersion??`none`}. Install a World package version compatible with the current Workflow runtime.`)}const _n=Symbol.for(`@workflow/world//cache`),vn=Symbol.for(`@workflow/world//cachePromise`),yn=Symbol.for(`@workflow/world//getWorldFn`);async function R(){let e=globalThis;if(e[_n])return gn(e[_n]),e[_n];if(e[vn])return e[_n]=await e[vn],gn(e[_n]),e[_n];let t=e[yn];if(t){let e=await t();return gn(e),e}throw Error("Workflow world runtime was not initialized. Import from the host workflow entrypoints (`workflow`, `workflow/api`, or `workflow/runtime`) so @workflow/core/runtime/world-init can register getWorld before getWorldLazy() is used.")}const bn=Symbol.for(`workflow-serialize`),xn=Symbol.for(`workflow-deserialize`);function Sn(e=globalThis){let t=e,n=t[Zt];return n||(n=new Map,t[Zt]=n),n}const Cn=`class//workflow//Run`;function wn(e,t,n=globalThis){Sn(n).set(e,t)}function Tn(e,t){return Sn(t).get(e)}function En(){return{Class:e=>{if(typeof e!=`function`)return!1;let t=e.classId;return typeof t==`string`&&{classId:t}},Instance:e=>{if(typeof e!=`object`||!e)return!1;let t=e.constructor;if(!t||typeof t!=`function`)return!1;let n=t[bn];if(typeof n!=`function`)return!1;let r=t.classId;if(typeof r!=`string`)throw Error(`Class "${t.name}" with ${String(bn)} must have a static "classId" property.`);return{classId:r,data:n.call(t,e)}}}}function Dn(e=globalThis){return{Class:t=>{let n=t.classId,r=Tn(n,e);if(!r)throw Error(`Class "${n}" not found. Make sure the class is registered with registerSerializationClass.`);return r},Instance:t=>{let n=t.classId,r=t.data,i=Tn(n,e);if(!i)throw Error(`Class "${n}" not found. Make sure the class is registered with registerSerializationClass.`);let a=i[xn];if(typeof a!=`function`)throw Error(`Class "${n}" does not have a static ${String(xn)} method.`);return a.call(i,r)}}}function On(e,t,n){if(n===0)return`.`;let r=new Uint8Array(e,t,n);return Buffer.from(r).toString(`base64`)}function z(e){return On(e.buffer,e.byteOffset,e.byteLength)}function B(e,t){let n=e===`.`?``:e,r=Buffer.from(n,`base64`),i=new t.ArrayBuffer(r.length);return new t.Uint8Array(i).set(r),i}function kn(e){return JSON.parse(e)}function An(e){if(!ee.isNativeError(e))return!1;let t={message:e.message,stack:e.stack};return`cause`in e&&(t.cause=e.cause),t}function jn(e,t){return!ee.isNativeError(t)||t.name!==e?!1:An(t)}function V(e){return t=>jn(e,t)||!1}function Mn(e,t){return n=>{let r=n,i=`cause`in r?{cause:r.cause}:void 0,a=e[t],o=new a(r.message,i);return r.stack!==void 0&&(o.stack=r.stack),o}}function Nn(e=globalThis){return{ArrayBuffer:t=>t instanceof e.ArrayBuffer&&On(t,0,t.byteLength),BigInt:e=>typeof e==`bigint`&&e.toString(),BigInt64Array:t=>t instanceof e.BigInt64Array&&z(t),BigUint64Array:t=>t instanceof e.BigUint64Array&&z(t),Date:t=>t instanceof e.Date?Number.isNaN(t.getDate())?`.`:t.toISOString():!1,DOMException:e=>{if(typeof e!=`object`||!e||e.constructor?.name!==`DOMException`)return!1;let t=e,n={message:t.message,name:t.name,stack:t.stack};return`cause`in t&&(n.cause=t.cause),n},EvalError:V(`EvalError`),FatalError:V(`FatalError`),HookConflictError:e=>{let t=jn(`HookConflictError`,e);if(!t)return!1;let n=e,r={...t,token:n.token};return n.conflictingRunId!==void 0&&(r.conflictingRunId=n.conflictingRunId),r},RangeError:V(`RangeError`),ReferenceError:V(`ReferenceError`),RetryableError:e=>{let t=jn(`RetryableError`,e);if(!t)return!1;let n=e.retryAfter,r;if(n&&typeof n==`object`&&typeof n.getTime==`function`){let e=n.getTime();r=Number.isNaN(e)?Date.now()+1e3:e}else if(typeof n==`string`||typeof n==`number`){let e=new Date(n).getTime();r=Number.isNaN(e)?Date.now()+1e3:e}else r=Date.now()+1e3;return{...t,retryAfter:r}},RuntimeDecryptionError:e=>{let t=jn(`RuntimeDecryptionError`,e);if(!t)return!1;let n={...t},r=e.context;return r!==void 0&&(n.context=r),n},SyntaxError:V(`SyntaxError`),TypeError:V(`TypeError`),URIError:V(`URIError`),AggregateError:e=>{let t=jn(`AggregateError`,e);return t?{...t,errors:e.errors}:!1},Error:e=>{if(!ee.isNativeError(e))return!1;let t={name:e.name,message:e.message,stack:e.stack};return`cause`in e&&(t.cause=e.cause),t},Float32Array:t=>t instanceof e.Float32Array&&z(t),Float64Array:t=>t instanceof e.Float64Array&&z(t),Headers:t=>t instanceof e.Headers&&Array.from(t),Int8Array:t=>t instanceof e.Int8Array&&z(t),Int16Array:t=>t instanceof e.Int16Array&&z(t),Int32Array:t=>t instanceof e.Int32Array&&z(t),Map:t=>t instanceof e.Map&&Array.from(t),RegExp:t=>t instanceof e.RegExp&&{source:t.source,flags:t.flags},Set:t=>t instanceof e.Set&&Array.from(t),URL:t=>t instanceof e.URL&&t.href,WorkflowFunction:e=>{if(typeof e!=`function`)return!1;let t=e.workflowId;return typeof t==`string`&&{workflowId:t}},URLSearchParams:t=>t instanceof e.URLSearchParams?t.size===0?`.`:String(t):!1,Uint8Array:t=>t instanceof e.Uint8Array&&z(t),Uint8ClampedArray:t=>t instanceof e.Uint8ClampedArray&&z(t),Uint16Array:t=>t instanceof e.Uint16Array&&z(t),Uint32Array:t=>t instanceof e.Uint32Array&&z(t)}}function Pn(e=globalThis){return{ArrayBuffer:t=>B(t,e),BigInt:t=>e.BigInt(t),BigInt64Array:t=>new e.BigInt64Array(B(t,e)),BigUint64Array:t=>new e.BigUint64Array(B(t,e)),Date:t=>new e.Date(t),DOMException:t=>{let n=new e.DOMException(t.message,t.name);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},EvalError:Mn(e,`EvalError`),FatalError:t=>{let n=new(e[Symbol.for(`@workflow/errors//FatalError`)]??u)(t.message);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},HookConflictError:t=>{let n=new(e[Symbol.for(`@workflow/errors//HookConflictError`)]??c)(t.token,t.conflictingRunId);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},RangeError:Mn(e,`RangeError`),ReferenceError:Mn(e,`ReferenceError`),RetryableError:t=>{let n=new(e[Symbol.for(`@workflow/errors//RetryableError`)]??m)(t.message,{retryAfter:new e.Date(t.retryAfter)});return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},RuntimeDecryptionError:t=>{let n=e[Symbol.for(`@workflow/errors//RuntimeDecryptionError`)]??p,r={};`cause`in t&&(r.cause=t.cause),t.context!==void 0&&(r.context=t.context);let i=new n(t.message,r);return t.stack!==void 0&&(i.stack=t.stack),i},SyntaxError:Mn(e,`SyntaxError`),TypeError:Mn(e,`TypeError`),URIError:Mn(e,`URIError`),AggregateError:t=>{let n=`cause`in t?{cause:t.cause}:void 0,r=new e.AggregateError(t.errors,t.message,n);return t.stack!==void 0&&(r.stack=t.stack),r},Error:t=>{let n=`cause`in t?{cause:t.cause}:void 0,r=new e.Error(t.message,n);return r.name=t.name,t.stack!==void 0&&(r.stack=t.stack),r},Float32Array:t=>new e.Float32Array(B(t,e)),Float64Array:t=>new e.Float64Array(B(t,e)),Headers:t=>new e.Headers(t),Int8Array:t=>new e.Int8Array(B(t,e)),Int16Array:t=>new e.Int16Array(B(t,e)),Int32Array:t=>new e.Int32Array(B(t,e)),Map:t=>new e.Map(t),RegExp:t=>new e.RegExp(t.source,t.flags),Set:t=>new e.Set(t),URL:t=>new e.URL(t),WorkflowFunction:e=>Object.assign(()=>{throw Error(`Workflow functions cannot be called directly. Use start() to invoke them.`)},{workflowId:e.workflowId}),URLSearchParams:t=>new e.URLSearchParams(t===`.`?``:t),Uint8Array:t=>new e.Uint8Array(B(t,e)),Uint8ClampedArray:t=>new e.Uint8ClampedArray(B(t,e)),Uint16Array:t=>new e.Uint16Array(B(t,e)),Uint32Array:t=>new e.Uint32Array(B(t,e))}}function Fn(){return{StepFunction:e=>{if(typeof e!=`function`)return!1;let t=e.stepId;if(typeof t!=`string`)return!1;let n=e.__closureVarsFn,r=n&&typeof n==`function`?n():void 0,i=`__boundThis`in e,a=i?e.__boundThis:void 0,o=e.__boundArgs,s={stepId:t};return r!==void 0&&(s.closureVars=r),i&&(s.boundThis=a),Array.isArray(o)&&o.length>0&&(s.boundArgs=o),s}}}function In(e=globalThis){let t=e[Symbol.for(`WORKFLOW_USE_STEP`)];return{StepFunction:e=>{let n=e.stepId,r=e.closureVars;if(!t)throw Error(`WORKFLOW_USE_STEP not found on global object. Step functions cannot be deserialized outside workflow context.`);let i=r?t(n,()=>r):t(n);if(`boundThis`in e){let t=Array.isArray(e.boundArgs)?e.boundArgs:[];return i.bind(e.boundThis,...t)}return i}}}function Ln(e){return e.length===4&&/^[a-z0-9]{4}$/.test(e)}const H={DEVALUE_V1:`devl`,ENCRYPTED:`encr`,GZIP:`gzip`,ZSTD:`zstd`},Rn=new TextEncoder,zn=new TextDecoder;function Bn(e,t=globalThis,n){let r;switch(e){case`workflow`:r={...En(),...Fn(),...Nn(t)};break;case`step`:r={...En(),...Nn(t)};break;case`client`:r={...En(),...Nn(t)};break}return n?{...r,...n}:r}function Vn(e,t=globalThis,n){let r;switch(e){case`workflow`:r={...Dn(t),...In(t),...Pn(t)};break;case`step`:r={...Dn(t),...Pn(t)};break;case`client`:r={...Dn(t),...Pn(t),StepFunction:()=>{throw Error(`Step functions cannot be deserialized in client context.`)}};break}return n?{...r,...n}:r}const U={formatPrefix:H.DEVALUE_V1,serialize(e,t,n){let r=A(e,Bn(t,n?.global,n?.extraReducers));return Rn.encode(r)},deserialize(e,t,n){let r=Vn(t,n?.global,n?.extraRevivers);return Mt(zn.decode(e),r)},deserializeLegacy(e,t,n){return Nt(e,Vn(t,n?.global,n?.extraRevivers))}},Hn=new TextEncoder,Un=new TextDecoder;function W(e,t){if(!(t instanceof Uint8Array))return t;let n=Hn.encode(e),r=new Uint8Array(4+t.length);return r.set(n,0),r.set(t,4),r}function Wn(e){if(!(e instanceof Uint8Array)||e.length<4)return null;let t=e.subarray(0,4),n=Un.decode(t);return Ln(n)?n:null}function G(e){if(!(e instanceof Uint8Array))return{format:H.DEVALUE_V1,payload:new TextEncoder().encode(JSON.stringify(e))};if(e.length<4)throw Error(`Data too short to contain format prefix: expected at least 4 bytes, got ${e.length}`);let t=e.subarray(0,4),n=Un.decode(t);if(!Ln(n))throw Error(`Invalid format prefix: "${n}". Must be 4 characters of [a-z0-9].`);return{format:n,payload:e.subarray(4)}}function Gn(){try{return typeof process<`u`&&process.env?.WORKFLOW_DISABLE_COMPRESSION===`1`}catch{return!1}}function Kn(){try{let e=process.env?.WORKFLOW_COMPRESSION_CODEC;return e===`gzip`||e===`zstd`?e:void 0}catch{return}}function qn(){try{return globalThis.process?.getBuiltinModule?.(`node:zlib`)}catch{return}}function Jn(){let e=qn();return typeof e?.zstdCompressSync==`function`&&typeof e?.zstdDecompressSync==`function`}function Yn(){return typeof CompressionStream==`function`&&typeof DecompressionStream==`function`}async function Xn(e,t){let n=t.writable.getWriter(),r=n.write(e).then(()=>n.close());r.catch(()=>{});let i=[],a=0,o=t.readable.getReader();for(;;){let{done:e,value:t}=await o.read();if(e)break;i.push(t),a+=t.length}await r;let s=new Uint8Array(a),c=0;for(let e of i)s.set(e,c),c+=e.length;return s}async function Zn(e){return Xn(e,new CompressionStream(`gzip`))}async function Qn(e){return Xn(e,new DecompressionStream(`gzip`))}function $n(e){let t=qn(),n=t?.constants?.ZSTD_c_compressionLevel,r=n===void 0?void 0:{params:{[n]:3}};return new Uint8Array(t.zstdCompressSync(e,r))}function er(e){let t=qn();if(!t?.zstdDecompressSync)throw Error(`Compressed (zstd) workflow data encountered but node:zlib zstd support is not available in this runtime (requires Node.js 22.15+). In the browser, register a zstd decoder via registerZstdDecoder (serialization-format.ts).`);return new Uint8Array(t.zstdDecompressSync(e))}function K(e,t,n,r){e&&(e.recorded=!0,e.compressed=t!==`none`,e.codec=t,e.uncompressedBytes=n,e.storedBytes=r)}function tr(){return Kn()===`gzip`?Yn()?`gzip`:`none`:Jn()?`zstd`:Yn()?`gzip`:`none`}async function nr(e,t,n){if(!(e instanceof Uint8Array))return e;if(!t||e.length<1024||Gn())return K(n,`none`,e.length,e.length),e;let r=tr();if(r===`none`)return K(n,`none`,e.length,e.length),e;let i=r===`zstd`?$n(e):await Zn(e),a=r===`zstd`?H.ZSTD:H.GZIP,o=4+i.length;return o>=e.length*.95?(K(n,`none`,e.length,e.length),e):(K(n,r,e.length,o),W(a,i))}async function rr(e,t){if(!(e instanceof Uint8Array))return e;let n=Wn(e);if(n===H.ZSTD){let{payload:n}=G(e),r=er(n);return K(t,`zstd`,r.length,e.length),r}if(n===H.GZIP){if(!Yn())throw Error(`Compressed (gzip) workflow data encountered but DecompressionStream is not available in this runtime. Node.js 18+, browsers, and edge runtimes all support it.`);let{payload:n}=G(e),r=await Qn(n);return K(t,`gzip`,r.length,e.length),r}return K(t,`none`,e.length,e.length),e}async function ir(e){return typeof e==`function`?e():e}async function ar(e,t){if(!t||!(e instanceof Uint8Array))return e;let n=await Rt(t,e);return W(H.ENCRYPTED,n)}async function or(e,t){if(!(e instanceof Uint8Array))return e;let n=Wn(e);if(n===H.ENCRYPTED&&!t)throw new p(`Encrypted data encountered but no encryption key is available. Encryption is not configured or no key was provided for this run.`,{context:{operation:`decrypt`,byteLength:e.byteLength,formatPrefix:`encr`}});if(n!==H.ENCRYPTED)return e;let{payload:r}=G(e);try{return await zt(t,r)}catch(e){throw p.is(e)&&e.context&&(e.context.formatPrefix=n),e}}function sr(e,t,n){let[r,...i]=t.split(`
6
- `),a=i.join(`
7
- `),o=cr(r??``,n),s=lr(a),c=[`${e} ${r??``}`];return o&&c.push(o),s&&c.push(s),c.join(`
8
- `)}function cr(e,t){if(!t||Object.keys(t).length===0)return null;let n=new Set;n.add(`errorStack`),typeof t.errorMessage==`string`&&e.includes(t.errorMessage)&&n.add(`errorMessage`);let r=new Set([`workflowRunId`,`workflowName`,`stepId`,`stepName`,`errorAttribution`,`errorCode`,`errorName`,`errorMessage`,`errorStack`,`hint`,`attempt`,`retryCount`]),i=[],a=q(t,`errorName`),o=q(t,`errorAttribution`);if(a||o){let e=o?o===`sdk`?ve(`sdk error`):_e(`user error`):``,t=a?ge(a):``,n=e&&t?w(` · `):``;i.push(` ${e}${n}${t}`)}let s=q(t,`workflowRunId`),c=q(t,`workflowName`);s?i.push(fr(`run`,s,c,oe)):c&&i.push(fr(`run`,null,c,oe));let l=q(t,`stepId`),u=q(t,`stepName`);if((l||u)&&i.push(fr(`step`,l,u,ae)),t.attempt!==void 0||t.retryCount!==void 0){let e=t.attempt,n=t.retryCount;e!==void 0&&n!==void 0?i.push(` ${dr(`retry`)} ${e} ${w(`attempts ·`)} ${n} ${w(`max retries`)}`):e!==void 0&&i.push(` ${dr(`retry`)} ${e} ${w(`attempts`)}`)}let d=q(t,`errorCode`);d&&d!==a&&i.push(` ${dr(`code`)} ${w(d)}`);let f=q(t,`hint`);f&&i.push(` ${pe(f)}`);let p=Object.entries(t).filter(([e,t])=>!r.has(e)&&!n.has(e)&&t!=null).sort(([e],[t])=>e.localeCompare(t));for(let[e,t]of p)i.push(` ${dr(e)} ${pr(t)}`);return i.length?i.join(`
9
- `):null}function lr(e){if(!e)return null;let t=e.split(`
10
- `),n=[],r=0,i=0,a=0,o=()=>{r>0&&(n.push(w(` … ${r} more ${r===1?`frame`:`frames`} in framework internals`)),r=0)};for(let e of t){let t=e.trimStart().startsWith(`at `);if(t&&ur(e)){r++;continue}if(t&&i>=6){a++;continue}o(),n.push(e),t&&i++}return o(),a>0&&n.push(w(` … ${a} more ${a===1?`frame`:`frames`} (run \`pnpm wf inspect run <id>\` for the full stack)`)),n.join(`
11
- `)}function ur(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 q(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function dr(e){return w(e.padEnd(6))}function fr(e,t,n,r){let i=t||w(`—`),a=n&&(e===`run`?re(n):ie(n))?`${w(`·`)} ${r(n)}`:``;return` ${dr(e)} ${i}${a?` `+a:``}`}function pr(e){if(typeof e==`string`)return e.includes(`
12
- `)?e.split(`
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 mr=class e extends Error{steps;globalThis;stepCount;hookCount;waitCount;attributeCount;hookDisposedCount;abortCount;constructor(e,t){let n=[...e.values()],r=0,i=0,a=0,o=0,s=0,c=0;for(let e of n)e.type===`step`?r++:e.type===`hook`?e.disposed?s++:e.abortRequested?c++:i++:e.type===`wait`?a++:e.type===`attribute`&&o++;let l=[];r>0&&l.push(`${r} ${x(`step`,`steps`,r)}`),i>0&&l.push(`${i} ${x(`hook`,`hooks`,i)}`),a>0&&l.push(`${a} ${x(`wait`,`waits`,a)}`),o>0&&l.push(`${o} ${x(`attribute write`,`attribute writes`,o)}`),s>0&&l.push(`${s} hook ${x(`disposal`,`disposals`,s)}`);let u=x(`has`,`have`,r+i+a+o+s),d=+(r>0)+ +(i>0)+ +(a>0)+ +(o>0)+ +(s>0),f;f=d>1?`processed`:r>0?`run`:i>0||a>0?`created`:o>0?`written`:s>0?`processed`:`received`;let p=l.length>0?`${l.join(` and `)} ${u} not been ${f} yet`:`0 steps have not been run yet`;super(p),this.name=`WorkflowSuspension`,this.steps=n,this.globalThis=t,this.stepCount=r,this.hookCount=i,this.waitCount=a,this.attributeCount=o,this.hookDisposedCount=s,this.abortCount=c}static is(t){return t instanceof e}};function hr(){throw new o(`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 gr=J(`workflow.name`),_r=J(`workflow.operation`),vr=J(`workflow.run.id`),yr=J(`workflow.run.status`),br=J(`workflow.started_at`),xr=J(`workflow.events.count`),Sr=J(`workflow.arguments.count`),Cr=J(`workflow.result.type`),wr=J(`workflow.trace.propagated`),Tr=J(`workflow.trace.mode`),Er=J(`workflow.turbo`),Dr=J(`workflow.error.name`),Or=J(`workflow.error.message`),kr=J(`workflow.error.code`),Ar=J(`workflow.steps.created`),jr=J(`workflow.hooks.created`),Mr=J(`workflow.waits.created`),Nr=J(`workflow.inline_ownership.owned_recovery_steps`),Pr=J(`workflow.inline_ownership.backstop_wakes_armed`),Fr=J(`workflow.route.type`),Ir=J(`workflow.route.handler_cached`),Lr=J(`workflow.route.invocation_count`),Rr=J(`workflow.route.entrypoint_age_ms`),zr=J(`workflow.route.module_body_init_ms`),Br=J(`step.name`),Vr=J(`step.id`),Hr=J(`step.attempt`),Ur=J(`step.status`),Wr=J(`step.max_retries`),Gr=J(`step.ttfs_ms`),Kr=J(`step.stso_ms`),qr=J(`step.rsfs_ms`),Jr=J(`step.final_scheduling_replay_ms`),Yr=J(`step.latency_optimizations`),Xr=J(`step.skipped`),Zr=J(`step.skip_reason`),Qr=J(`step.arguments.count`),$r=J(`step.result.type`),ei=J(`step.error.name`),ti=J(`step.error.message`),ni=J(`step.fatal_error`),ri=J(`step.retry.exhausted`),ii=J(`step.retry.timeout_seconds`),ai=J(`step.retry.will_retry`),oi=J(`messaging.system`),si=J(`messaging.destination.name`),ci=J(`messaging.message.id`),li=J(`messaging.operation.type`),ui=J(`workflow.queue.overhead_ms`),di=J(`deployment.id`),fi=J(`workflow.hook.token`),pi=J(`workflow.hook.id`),mi=J(`workflow.hook.found`),hi=J(`workflow.suspension.state`),gi=J(`workflow.suspension.hook_count`),_i=J(`workflow.suspension.step_count`),vi=J(`workflow.suspension.wait_count`),yi=J(`http.request.method`),bi=J(`http.route`),xi=J(`http.response.status_code`),Si=J(`error.type`),Ci=J(`workflow.events.pages_loaded`),wi=J(`workflow.queue.deserialize_time_ms`),Ti=J(`workflow.queue.execution_time_ms`),Ei=J(`workflow.queue.serialize_time_ms`),Di=J(`workflow.serialization.operation`),Oi=J(`workflow.serialization.compressed`),ki=J(`workflow.serialization.codec`),Ai=J(`workflow.serialization.uncompressed_bytes`),ji=J(`workflow.serialization.stored_bytes`),Mi=J(`workflow.serialization.compression_ratio`),Ni=J(`peer.service`),Pi=J(`rpc.system`),Fi=J(`rpc.service`),Ii=J(`rpc.method`),Li=J(`error.retryable`),Ri=J(`error.category`),zi=new Set;function Bi(){let e=process.env.WORKFLOW_TRACE_MODE;return e===`continuous`?`continuous`:(e&&e!==`linked`&&!zi.has(e)&&(zi.add(e),X.warn(`Unrecognized WORKFLOW_TRACE_MODE value "${e}"; expected "linked" or "continuous". Falling back to "linked".`)),`linked`)}function Vi(e){return e!==void 0&&Object.keys(e).length>0}function Hi(e,t){return e===`linked`&&Vi(t)?Promise.resolve(t):Wi()}async function Ui(e,t){if(e!==`linked`)return ra();let n=await ia(Vi(t)?t:void 0);return n?[n]:void 0}async function Wi(){let e=await Y.value;if(!e)return{};let t={};return e.propagation.inject(e.context.active(),t),t}async function Gi(e){let t=await Y.value;if(t)return t.propagation.extract(t.context.active(),e)}async function Ki(e,t){if(!e)return t();let n=await Y.value;if(!n)return t();let r=await Gi(e);return r?n.context.with(r,async()=>await t()):t()}const Y=r(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}}),qi=r(async()=>{let e=await Y.value;if(!e)return null;let t=e.trace.getTracer(`workflow`);return Yi(e,t),t});let Ji=!1;function Yi(e,t){let n=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`);if(!(Ji||!n)){Ji=!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 Xi(e,...t){let[n,r]=await Promise.all([qi.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 e.setStatus({code:r.SpanStatusCode.ERROR,message:t.message}),Qi(t,r,e),t}finally{e.end()}})}async function Zi(e,t,n){let r=await qi.value;r&&r.startSpan(e,{...n,startTime:t}).end()}function Qi(e,t,n){!e||!mr.is(e)||(n.setStatus({code:t.SpanStatusCode.OK}),n.setAttributes({...hi(`suspended`),..._i(e.stepCount),...gi(e.hookCount),...vi(e.waitCount)}))}async function $i(e){let[t,n]=await Promise.all([Gi(e),Y.value]);if(!(!t||!n))return n.trace.getSpanContext(t)}async function ea(){return await na(e=>e.trace.getActiveSpan())}async function ta(e){return na(t=>t.SpanKind[e])}async function na(e){let t=await Y.value;if(t)return await e(t)}function ra(){return na(e=>{let t=e.trace.getActiveSpan()?.spanContext();if(t)return[{context:t}]})}async function ia(e){if(!e)return;let[t,n]=await Promise.all([$i(e),Y.value]);if(!(!t||!n)&&n.trace.isSpanContextValid(t))return{context:t}}async function aa(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 oa(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 sa(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)(sr(`[workflow-sdk]`,i,c)),oa(n,process.env.DEBUG)&&(console.debug(`[${n}] ${i}`,c??``),ea().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 ca=sa(`step`),X=sa(`runtime`),la=sa(`webhook`),ua=sa(`events`);sa(`adapter`),sa(`build`,{debugNamespace:`workflow:build`});function da(e){if(p.is(e))throw e}function Z(e,t){let n=e.includes(`return value`)?`returning`:`passing`,r=`Failed to serialize ${e}`;t instanceof O&&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 O&&t.value!==void 0&&X.error(`Serialization failed`,{context:e,problematicValue:t.value}),{message:r,hint:i}}async function fa(e,t,n){try{let r=U.serialize(e,`client`,n);return ar(await nr(W(H.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){da(e);let{message:t,hint:n}=Z(`client value`,e);throw new f(t,{hint:n,cause:e})}}async function pa(e,t,n){let r=await rr(await or(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(U.deserializeLegacy)return U.deserializeLegacy(r,`client`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=G(r);if(i===H.DEVALUE_V1)return U.deserialize(a,`client`,n);throw Error(`Unsupported serialization format: ${i}`)}async function ma(e,t,n){try{let r=U.serialize(e,`step`,n);return ar(await nr(W(H.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){da(e);let{message:t,hint:n}=Z(`step value`,e);throw new f(t,{hint:n,cause:e})}}async function ha(e,t,n){let r=await rr(await or(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(U.deserializeLegacy)return U.deserializeLegacy(r,`step`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=G(r);if(i===H.DEVALUE_V1)return U.deserialize(a,`step`,n);throw Error(`Unsupported serialization format: ${i}`)}function ga(e,t){if(!(e instanceof Uint8Array)){if(U.deserializeLegacy)return U.deserializeLegacy(e,`workflow`,t);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:n,payload:r}=G(e);if(n===H.DEVALUE_V1)return U.deserialize(r,`workflow`,t);throw Error(`Unsupported serialization format: ${n}`)}const _a=Symbol.for(`WORKFLOW_STEP_CONTEXT_STORAGE`),va=globalThis[_a]??(globalThis[_a]=new te);function ya(e,t,n){if(e===0&&t===0&&n===0)return null;let r=[];e>0&&r.push(`${e} ${x(`step`,`steps`,e)}`),t>0&&r.push(`${t} ${x(`hook`,`hooks`,t)}`),n>0&&r.push(`${n} ${x(`timer`,`timers`,n)}`);let i=[];e>0&&i.push(`steps are completed`),t>0&&i.push(`hooks are received`),n>0&&i.push(`timers have elapsed`);let a=i.join(` and `);return`${r.join(` and `)} to be enqueued\n Workflow will suspend and resume when ${a}`}function ba(e,t){let n=`${e.replace(`wrun_`,`strm_`)}_user`;return t?`${n}_${Buffer.from(t,`utf-8`).toString(`base64url`)}`:n}function xa(e){return`strm_${e}_system_abort`}function Sa(e){if(!e.startsWith(`abrt_`))throw Error(`Invalid abort hook token format: expected "abrt_" prefix, got "${e}"`);return xa(e.slice(5))}const Ca=()=>b(`WORKFLOW_DEFERRED_CHECK_DELAY_MS`,100,{integer:!0,min:10});var Q;(function(e){e[e.Consumed=0]=`Consumed`,e[e.NotConsumed=1]=`NotConsumed`,e[e.Finished=2]=`Finished`})(Q||={});var wa=class{eventIndex;events=[];callbacks=[];onConsumedEvent;onUnconsumedEvent;getPromiseQueue;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}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){ua.error(`onConsumedEvent callback threw an error`,{error:e})}}consume=()=>{for(;;){let e=this.events[this.eventIndex]??null;if(!this.consumeOne(e)){this.handleUnconsumed(e);return}}};consumeOne(e){for(let t=0;t<this.callbacks.length;t++){let n=this.callbacks[t],r=Q.NotConsumed;try{r=n(e)}catch(e){ua.error(`EventConsumer callback threw an error`,{error:e})}if(!(r!==Q.Consumed&&r!==Q.Finished))return e!==null&&this.notifyConsumedEvent(e),this.eventIndex++,r===Q.Finished&&this.callbacks.splice(t,1),e!==null}return!1}handleUnconsumed(e){if(e!==null){let t=++this.unconsumedCheckVersion;this.pendingUnconsumedCheck=this.getPromiseQueue().then(()=>new Promise(e=>setTimeout(e,0))).then(()=>this.getPromiseQueue()).then(()=>{this.pendingUnconsumedTimeout=setTimeout(()=>{this.pendingUnconsumedTimeout=null,this.unconsumedCheckVersion===t&&(this.pendingUnconsumedCheck=null,this.onUnconsumedEvent(e))},Ca())})}}},Ta=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 Ea(e){return class{signal;[P];[F];constructor(){let t=e.generateUlid(),n=xa(t),r=`abrt_${t}`;this[P]=n,this[F]=r,this.signal=new Ta(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 d(`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;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 Eo(n,e.runId,e.encryptionKey,e.globalThis,{},i);a&&typeof a==`object`&&`reason`in a&&(r=a.reason)}catch{}this.signal._setAborted(r)}finally{e.pendingDeliveries--}}),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 Da(){return{abort(e){let t=new Ta(``,``);return t._setAborted(e??new DOMException(`The operation was aborted.`,`AbortError`)),t},any(e){let t=new Ta(``,``),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 Oa=v();function ka(e){try{return e.getReader({mode:`byob`}).releaseLock(),`bytes`}catch{}}function Aa(e){return da(e),e instanceof f&&e.cause!==void 0||e instanceof o&&e.cause!==void 0?e.cause:e}async function $(e,t){if(e.recorded)try{let n=await ea();if(!n)return;let r=e.uncompressedBytes??0,i=e.storedBytes??0;n.setAttributes({...Di(t),...Oi(e.compressed??!1),...ki(e.codec??`none`),...Ai(r),...ji(i),...e.compressed&&r>0?Mi(1-i/r):{}})}catch{}}function ja(e,t){let n=new TextEncoder,r={resolved:!1,key:void 0};return new TransformStream({async transform(i,a){try{r.resolved||=(r.key=await ir(t),!0);let o=A(i,e),s=n.encode(o),c=W(H.DEVALUE_V1,s);if(r.key){let e=await Rt(r.key,c);c=W(H.ENCRYPTED,e)}let l=new Uint8Array(4+c.length);new DataView(l.buffer).setUint32(0,c.length,!1),l.set(c,4),a.enqueue(l)}catch(e){if(p.is(e)){a.error(e);return}let{message:t,hint:n}=Z(`stream chunk`,e);a.error(new f(t,{hint:n,cause:e}))}}})}function Ma(e,t){let n=new TextDecoder,r=new Uint8Array,i={resolved:!1,key:void 0};function a(e){let t=new Uint8Array(r.length+e.length);t.set(r,0),t.set(e,r.length),r=t}async function o(a){for(i.resolved||=(i.key=await ir(t),!0);r.length>=4;){let t=new DataView(r.buffer,r.byteOffset,r.byteLength).getUint32(0,!1);if(r.length<4+t)break;let o=r.slice(4,4+t);r=r.slice(4+t);let{format:s,payload:c}=G(o);if(s===H.ENCRYPTED){if(!i.key){a.error(new p(`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:c.byteLength,formatPrefix:`encr`}}));return}let e;try{e=await zt(i.key,c)}catch(e){throw p.is(e)&&e.context&&(e.context.formatPrefix=s),e}({format:s,payload:c}=G(e))}if(s===H.DEVALUE_V1){let t=n.decode(c);a.enqueue(Mt(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){a(t),await o(i);return}}else if(r.length>0){a(t),await o(i);return}let s=n.decode(t).split(`
15
- `);for(let t of s)t.length>0&&i.enqueue(Mt(t,e))},async flush(e){r.length>0&&await o(e)}})}const Na=1e8;function Pa(){return new TransformStream({transform(e,t){if(e.length===0)return;if(e.length>Na){t.error(new o(`Byte-stream chunk of ${e.length} bytes exceeds the maximum framed chunk size (${Na}). 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 Fa(){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,r){for(n.length>0&&t(n);e.length>=4;){let t=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(0,!1);if(t>Na){r.error(new o(`Byte-stream frame length ${t} exceeds maximum (${Na}). 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;r.enqueue(e.slice(4,n)),e=e.slice(n)}},flush(t){e.length>0&&t.error(new o(`Byte-stream ended with ${e.length} bytes of incomplete frame data. The stream was truncated mid-frame.`,{slug:`serialization-failed`}))}})}function Ia(e,t,n,r,i){(async()=>{await Zi(`workflow.stream.read`,e,{kind:await ta(`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 La(e,t,n,r,i,a){(async()=>{await Zi(`workflow.stream.read.complete`,e,{kind:await ta(`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 Ra=class extends ReadableStream{#e;constructor(e,t,n){if(typeof t!=`string`||t.length===0)throw new o(`"name" is required, got "${t}"`);let r,i=!1,a,s=0,c=0;super({type:`bytes`,pull:async o=>{let l=this.#e;if(!l){r===void 0&&(r=Date.now());let i=await R(),o=Date.now(),s=await i.streams.get(e,t,n);a=Date.now()-o,l=this.#e=s.getReader()}if(!l){o.error(Error(`Failed to get reader`));return}let u=await l.read();u.done?(this.#e=void 0,r!==void 0&&La(r,e,t,s,c),o.close()):(!i&&u.value.byteLength>0&&r!==void 0&&(i=!0,Ia(r,e,t,n,a)),s+=1,c+=u.value.byteLength,o.enqueue(u.value))},cancel:async e=>{this.#e&&=(await this.#e.cancel(e).catch(()=>{}),void 0)}})}};const za=()=>b(`WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`,50,{integer:!0,min:1}),Ba=()=>b(`WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`,1e3,{integer:!0,min:1});function Va(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 R(),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=za(),n=Ba();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&&La(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,Ia(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 Ha=()=>b(`WORKFLOW_STREAM_FLUSH_INTERVAL_MS`,10,{integer:!0});function Ua(e,t,n,r,i,a,o){(async()=>{await Zi(`workflow.stream.flush`,e,{kind:await ta(`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 Wa(e,t,n){(async()=>{await Zi(`workflow.stream.close`,e,{kind:await ta(`CLIENT`),attributes:{"workflow.run.id":t,"workflow.stream.name":n,"workflow.stream.operation":`close`,"workflow.stream.close.rpc_ms":Date.now()-e}})})()}var Ga=class extends WritableStream{constructor(e,t,n){if(typeof e!=`string`)throw new o(`"runId" must be a string, got "${typeof e}"`);if(typeof t!=`string`||t.length===0)throw new o(`"name" is required, got "${t}"`);let r=R(),i=n,a=async()=>{if(i){try{await i}catch{}i=void 0}},s=[],c=null,l=null,u,d,f=async()=>{if(c&&=(clearTimeout(c),null),s.length===0)return;await a();let n=s.slice(),i=d;d=void 0;let o=Date.now(),l=await r;u===void 0&&(u=l.streamFlushIntervalMs??Ha());let f=Date.now();try{if(typeof l.streams.writeMulti==`function`&&n.length>1)await l.streams.writeMulti(e,t,n);else for(let r of n)await l.streams.write(e,t,r)}catch(e){throw i!==void 0&&(d=d===void 0?i:Math.min(d,i)),e}i!==void 0&&Ua(i,o,e,t,n.length,n.reduce((e,t)=>e+t.byteLength,0),Date.now()-f),s=[]},p=[],m=()=>{c||=setTimeout(()=>{c=null;let e=p;p=[],l=f().then(()=>{for(let t of e)t.resolve()},t=>{for(let n of e)n.reject(t)})},u??Ha())};super({async write(e){d===void 0&&(d=Date.now()),l&&=(await l,null),s.push(e),m(),await new Promise((e,t)=>{p.push({resolve:e,reject:t})})},async close(){l&&=(await l,null),await f(),await a();let n=await r,i=Date.now();await n.streams.close(e,t),Wa(i,e,t)},abort(e){c&&=(clearTimeout(c),null),s=[];let t=p;p=[];let n=e??Error(`Stream aborted`);for(let e of t)e.reject(n)}}),Object.defineProperty(this,Jt,{value:async e=>{if(e.length!==0){d===void 0&&(d=Date.now());for(let t of e)s.push(t);await f()}},enumerable:!1,writable:!1})}};function Ka(e=globalThis){return{...En(),...Fn(),...Nn(e),Request:t=>{if(!(t instanceof e.Request))return!1;let n={method:t.method,url:t.url,headers:t.headers,body:t.body,duplex:t.duplex},r=t[Xt];return r&&(n.responseWritable=r),t.signal&&(t.signal.aborted||t.signal[P])&&(n.signal=t.signal),n},Response:t=>t instanceof e.Response&&{type:t.type,url:t.url,status:t.status,statusText:t.statusText,headers:t.headers,body:t.body,redirected:t.redirected}}}function qa(e,t,n,r,i,a){let o=t[P],s=t[F];if(!o){let e=(n[Gt]||Oa)();o=xa(e),s=`abrt_${e}`,t[P]=o,t[F]=s,t.signal&&(t.signal[P]=o,t.signal[F]=s)}return Ya(e,o,i,a,r),{streamName:o,hookToken:s,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function Ja(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 Ya(e,t,n,r,i){e.aborted||e[Qt]||(e[Qt]=!0,e.addEventListener(`abort`,()=>{i.push((async()=>{try{let i=await ir(r),a=await yo({aborted:!0,reason:e.reason},n,i),o=new Ga(n,t).getWriter();await o.write(a),await o.close()}catch{}})())},{once:!0}))}function Xa(e=globalThis,t,n,r,i=!1,a){return{...Ka(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new f(`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[Gt]||Oa)()}`,c=ka(o),l=new Ga(n,s,a);c===`bytes`?i?t.push(o.pipeThrough(Pa()).pipeTo(l)):t.push(o.pipeTo(l)):t.push(o.pipeThrough(ja(Xa(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[j],a=r[M];if(typeof i==`string`&&typeof a==`string`){let e={name:i,runId:a},t=r[N];return typeof t==`string`&&(e.deploymentId=t),e}let o=`strm_${(e[Gt]||Oa)()}`,s=new Ra(n,o);return t.push(s.pipeTo(r)),{name:o}},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:qa(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:qa(i,i,e,t,n,r)}}function Za(e=globalThis){return{...Ka(e),ReadableStream:t=>{if(!(t instanceof e.ReadableStream))return!1;let n=t[Yt];if(n!==void 0)return{bodyInit:n};let r=t[j];if(!r)throw new o("ReadableStream `name` is not set");let i={name:r},a=t[Kt];a&&(i.type=a);let s=t[qt];return s&&(i.framing=s),i},WritableStream:t=>{if(!(t instanceof e.WritableStream))return!1;let n=t[j];if(!n)throw new o("WritableStream `name` is not set");let r={name:n},i=t[M];typeof i==`string`&&(r.runId=i);let a=t[N];return typeof a==`string`&&(r.deploymentId=a),r},AbortController:t=>{if(!t||!t.signal)return!1;let n=t,r=n[P]??n.signal?.[P],i=e.AbortController&&typeof e.AbortController==`function`&&t instanceof e.AbortController;return!r&&!i?!1:Ja(t.signal,n)},AbortSignal:t=>{let n=t?.[P],r=e.AbortSignal&&typeof e.AbortSignal==`function`&&t instanceof e.AbortSignal;return!n&&!r?!1:Ja(t,t)}}}function Qa(e=globalThis,t,n,r,i=!1,a){return{...Ka(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new f(`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[j],c=o[Kt],l=o[qt];if(!s){s=`strm_${(e[Gt]||Oa)()}`,c=ka(o),l=c===`bytes`&&i?`framed-v1`:l;let u=new Ga(n,s,a);c===`bytes`?l===`framed-v1`?t.push(o.pipeThrough(Pa()).pipeTo(u)):t.push(o.pipeTo(u)):t.push(o.pipeThrough(ja(Qa(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[j],o=i[M];a||(a=`strm_${(e[Gt]||Oa)()}`,t.push(new Ra(n,a).pipeThrough(Ma(lo(e,t,n,r),r)).pipeTo(i)));let s={name:a};typeof o==`string`&&(s.runId=o);let c=i[N];return typeof c==`string`&&(s.deploymentId=c),s},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:qa(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:qa(i,i,e,t,n,r)}}function $a(...e){let t=new WeakSet;function n(e){let t=e[$t];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 eo(e,t,n,r){let i=new AbortController;return r.push((async()=>{try{let r=new Ra(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=va.getStore(),r=await bo(a.value,t,n?.encryptionKey);e.abort(r?.reason)}catch{e.abort()}}else r.cancel().catch(()=>{})}catch{}})()),i}function to(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[$t]=n,i[$t]=n)}function no(e,t){let n=e,r=t;n[P]!==void 0&&(r[P]=n[P]),n[F]!==void 0&&(r[F]=n[F]),n[$t]!==void 0&&(r[$t]=n[$t])}function ro(e,t,n){let r=new AbortController;e.aborted?(to(r,e),r.abort(e.reason)):e.streamName?to(r,e,eo(r,n,e.streamName,t)):to(r,e);let i=r.abort.bind(r);return r.abort=t=>{if(r.signal.aborted)return;i(t);let n=va.getStore();if(n&&(n.ops.push((async()=>{try{let r=await yo({aborted:!0,reason:t},n.workflowMetadata.workflowRunId,n.encryptionKey),i=new Ga(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-D2AqAGjq.js`).then(e=>e.i);await n(e.hookToken,{aborted:!0,reason:t})}catch{}})();n.preCompletionOps.push(r)}},r}function io(e,t,n){let r=new AbortController;return e.aborted?(to(r,e),r.abort(e.reason)):e.streamName?to(r,e,eo(r,n,e.streamName,t)):to(r,e),r.signal}function ao(e=globalThis){return{...Dn(e),...Pn(e)}}async function oo(e,t){let n=await R();if(!n.getEncryptionKeyForRun)return;let r=t?await n.getEncryptionKeyForRun(e,{deploymentId:t}):await n.getEncryptionKeyForRun(await n.runs.get(e));return r?await Lt(r,[`encrypt`]):void 0}function so(e=globalThis,t,n,r){return{...ao(e),StepFunction:()=>{throw new f(`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 f(`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&&no(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 Ra(n,i.name,i.startIndex),a=I();t.push(a.promise);let{readable:o,writable:s}=i.framing===`framed-v1`?Fa():new e.TransformStream;return L(r,s,a).catch(()=>{}),cn(o,a),o}else{let a=Va(n,i.name,i.startIndex),o=Ma(so(e,t,n,r),r),s=I();return t.push(s.promise),L(a,o.writable,s).catch(()=>{}),cn(o.readable,s),o.readable}},WritableStream:i=>{let a=typeof i.runId==`string`?i.runId:n,o=a===n?r:oo(a,i.deploymentId),s=ja(Xa(e,t,a,o),o),c=new Ga(a,i.name),l=I();return t.push(l.promise),L(s.readable,c,l).catch(()=>{}),sn(s.writable,l),Object.defineProperty(s.writable,j,{value:i.name,writable:!1}),Object.defineProperty(s.writable,M,{value:a,writable:!1}),typeof i.deploymentId==`string`&&Object.defineProperty(s.writable,N,{value:i.deploymentId,writable:!1}),s.writable},AbortController:e=>ro(e,t,n),AbortSignal:e=>io(e,t,n)}}function co(e=globalThis){return{...ao(e),...In(e),Request:t=>{Object.setPrototypeOf(t,e.Request.prototype);let n=t.responseWritable;return n&&(t[Xt]=n,delete t.responseWritable,t.respondWith=()=>{throw new f("`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 f(`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,{[Yt]:{value:t.bodyInit,writable:!1}}):Object.create(e.ReadableStream.prototype,{[j]:{value:t.name,writable:!1},[Kt]:{value:t.type,writable:!1},[qt]:{value:t.framing,writable:!1}}),WritableStream:t=>{let n={[j]:{value:t.name,writable:!1}};return typeof t.runId==`string`&&(n[M]={value:t.runId,writable:!1}),typeof t.deploymentId==`string`&&(n[N]={value:t.deploymentId,writable:!1}),Object.create(e.WritableStream.prototype,n)},AbortController:e=>{let t=new Ta(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 Ta(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),t}}}function lo(e=globalThis,t,r,i,a){return{...ao(e),StepFunction:e=>{let t=e.stepId,r=e.closureVars,i=`boundThis`in e,a=i?e.boundThis:void 0,s=Array.isArray(e.boundArgs)?e.boundArgs:[],c=n(t);if(!c)throw new f(`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(!r&&!i&&s.length===0)return c;let l=function(...e){let t=i?a:this,n=s.length>0?[...s,...e]:e;if(r){let e=va.getStore();if(!e)throw new o(`Cannot call step function with closure variables outside step context`);let i={...e,closureVars:r};return va.run(i,()=>c.apply(t,n))}return c.apply(t,n)};return Object.defineProperty(l,"name",{value:c.name}),Object.defineProperty(l,"stepId",{value:t,writable:!1,enumerable:!1,configurable:!1}),c.maxRetries!==void 0&&(l.maxRetries=c.maxRetries),l},WorkflowFunction:e=>Object.assign(()=>{throw new f(`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&&no(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:n=>{if(`bodyInit`in n){let t=n.bodyInit;return new e.Response(t).body}let o=new Ra(r,n.name);if(n.type===`bytes`){let r=I();t.push(r.promise);let{readable:i,writable:a}=n.framing===`framed-v1`?Fa():new e.TransformStream;return L(o,a,r).catch(()=>{}),cn(i,r),i}else{let n=Ma(lo(e,t,r,i,a),i),s=I();return t.push(s.promise),L(o,n.writable,s).catch(()=>{}),cn(n.readable,s),n.readable}},WritableStream:n=>{let o=typeof n.runId==`string`?n.runId:r,s=typeof n.deploymentId==`string`?n.deploymentId:o===r?a:void 0,c=o===r?i:oo(o,s),l=ja(Qa(e,t,o,c),c),u=new Ga(o,n.name),d=I();return t.push(d.promise),L(l.readable,u,d).catch(()=>{}),sn(l.writable,d),Object.defineProperty(l.writable,j,{value:n.name,writable:!1}),Object.defineProperty(l.writable,M,{value:o,writable:!1}),s&&Object.defineProperty(l.writable,N,{value:s,writable:!1}),l.writable},AbortController:e=>ro(e,t,r),AbortSignal:e=>io(e,t,r)}}async function uo(e,t){return await ar(e,t)}const fo=async(e,t)=>{let n={},r=await rr(await or(e,t),n);return await $(n,`deserialize`),{data:r}};function po(e,t=globalThis,n={}){return ga(e.data,{global:t,extraRevivers:{...ko(co(t)),...n}})}function mo(e,t=globalThis,n={}){let{data:r}=e;if(!(r instanceof Uint8Array))return Nt(r,{...co(t),...n});let{format:i,payload:a}=G(r);if(i===H.DEVALUE_V1)return Mt(new TextDecoder().decode(a),{...co(t),...n});throw Error(`Unsupported serialization format: ${i}`)}async function ho(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1){if(a)return kn(A(e,Xa(i,r,t,n,o)));try{let a={},c=await fa(e,n,{global:i,extraReducers:Oo(Xa(i,r,t,n,o)),compression:s,compressionStats:a});return await $(a,`serialize`),c}catch(e){let t=Aa(e),{message:n,hint:r}=Z(`workflow arguments`,t);throw new f(n,{hint:r,cause:t})}}async function go(e,t,n,r=globalThis,i={},a){return po(a??await fo(e,n),r,i)}async function _o(e,t,n,r=globalThis,i=!1,a=!1){if(i)return kn(A(e,Za(r)));try{let t={},i=await ma(e,n,{global:r,extraReducers:Oo(Za(r)),compression:a,compressionStats:t});return await $(t,`serialize`),i}catch(e){let t=Aa(e),{message:n,hint:r}=Z(`workflow return value`,t);throw new f(n,{hint:r,cause:t})}}async function vo(e,t,n,r=[],i=globalThis,a={}){let o={},s=await pa(e,n,{global:i,extraRevivers:{...ko(so(i,r,t,n)),...a},compressionStats:o});return await $(o,`deserialize`),s}async function yo(e,t,n,r=globalThis,i=!1,a=!1){if(i)return kn(A(e,Za(r)));try{let t={},i=await ma(e,n,{global:r,extraReducers:Oo(Za(r)),compression:a,compressionStats:t});return await $(t,`serialize`),i}catch(e){let t=Aa(e),{message:n,hint:r}=Z(`step arguments`,t);throw new f(n,{hint:r,cause:t})}}async function bo(e,t,n,r=[],i=globalThis,a={},o){let s={},c=await ha(e,n,{global:i,extraRevivers:{...ko(lo(i,r,t,n,o)),...a},compressionStats:s});return await $(s,`deserialize`),c}async function xo(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c){if(a)return kn(A(e,Qa(i,r,t,n,o,c)));try{let a={},l=await ma(e,n,{global:i,extraReducers:Oo(Qa(i,r,t,n,o,c)),compression:s,compressionStats:a});return await $(a,`serialize`),l}catch(e){let t=Aa(e),{message:n,hint:r}=Z(`step return value`,t);throw new f(n,{hint:r,cause:t})}}async function So(e,t,n,r=[],i=globalThis,a=!1){try{let o=A(e,Qa(i,r,t,n)),s=new TextEncoder().encode(o),c=W(H.DEVALUE_V1,s),l={},u=await uo(await nr(c,a,l),n);return await $(l,`serialize`),u}catch(e){let t=Aa(e),{message:n,hint:r}=Z(`step error`,t);throw new f(n,{hint:r,cause:t})}}async function Co(e,t,n,r=globalThis,i={},a){return mo(a??await fo(e,n),r,i)}async function wo(e,t,n,r=globalThis,i=!1){try{let t=A(e,Za(r)),a=new TextEncoder().encode(t),o=W(H.DEVALUE_V1,a),s={},c=await uo(await nr(o,i,s),n);return await $(s,`serialize`),c}catch(e){let t=Aa(e),{message:n,hint:r}=Z(`run error`,t);throw new f(n,{hint:r,cause:t})}}async function To(e,t,n,r=[],i=globalThis,a={}){let o={},s=await rr(await or(e,n),o);if(await $(o,`deserialize`),!(s instanceof Uint8Array))return Nt(s,{...so(i,r,t,n),...a});let{format:c,payload:l}=G(s);if(c===H.DEVALUE_V1)return Mt(new TextDecoder().decode(l),{...so(i,r,t,n),...a});throw Error(`Unsupported serialization format: ${c}`)}async function Eo(e,t,n,r=globalThis,i={},a){return po(a??await fo(e,n),r,i)}const Do=[`ReadableStream`,`WritableStream`,`Request`,`Response`,`StepFunction`,`AbortController`,`AbortSignal`];function Oo(e){let t={};for(let n of Do)n in e&&(t[n]=e[n]);return t}function ko(e){let t={};for(let n of Do)n in e&&(t[n]=e[n]);return t}const Ao=[{format:H.ENCRYPTED,minVersion:`4.2.0-beta.64`},{format:H.GZIP,minVersion:`5.0.0-beta.18`},{format:H.ZSTD,minVersion:`5.0.0-beta.18`}],jo=[{capability:`framedByteStreams`,minVersion:`5.0.0-beta.15`}],Mo=new Set([H.DEVALUE_V1]);function No(e){if(!e||!It.default.valid(e))return{supportedFormats:Mo,framedByteStreams:!1};let t=new Set(Mo);for(let{format:n,minVersion:r}of Ao)It.default.gte(e,r)&&t.add(n);let n={supportedFormats:t,framedByteStreams:!1};for(let{capability:t,minVersion:r}of jo)It.default.gte(e,r)&&(n[t]=!0);return n}const Po=`5.0.0-beta.36`,Fo=/^[a-zA-Z0-9_\-./@]+$/;function Io(e,t){if(!Fo.test(e))throw Error(`Invalid workflow name "${e}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);return`${g(`workflow`,h(t))}${e}`}const Lo=v();function Ro(e){return`__health_check__${e}`}function zo(e){let t=y.safeParse(e);if(t.success)return t.data}function Bo(e){return`wrun_hc_${e}`}async function Vo(e,t,n){let r=await R(),i=Ro(e.correlationId),a=JSON.stringify({healthy:!0,endpoint:t,correlationId:e.correlationId,specVersion:n??5,workflowCoreVersion:Po,timestamp:Date.now()}),o=Bo(e.correlationId);await r.streams.write(o,i,a),await r.streams.close(o,i)}function Ho(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 Uo(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 Wo(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),s}async function Go(e,t,n){let r=n?.timeout??3e4,i=e.createRunId?.()??Lo(),a=Ro(i),o=`${g(t,h(n?.namespace))}health_check`,s=Date.now();try{for(await e.queue(o,{__healthCheck:!0,correlationId:i},{specVersion:1,deploymentId:n?.deploymentId});Date.now()-s<r;)try{let t=r-(Date.now()-s),n=(await Ho(e.streams.get(Bo(i),a),t)).getReader(),{chunks:o,timedOut:c}=await Uo(n,500);if(c){try{n.cancel()}catch{}await new Promise(e=>setTimeout(e,100));continue}let l=Wo(o);if(l)return{...l,latencyMs:Date.now()-s};await new Promise(e=>setTimeout(e,100))}catch{await new Promise(e=>setTimeout(e,100))}return{healthy:!1,error:`Health check timed out after ${r}ms`}}catch(e){return{healthy:!1,error:e instanceof Error?e.message:String(e)}}}function Ko(e,t){return new a(`Event pagination ${t} for workflow run "${e}".`,{code:s.WORLD_CONTRACT_ERROR})}function qo(e,t,n){if(t){if(n.has(t))throw Ko(e,`did not advance`);n.add(t)}}function Jo(e,t,n){for(let r of n)t.has(r.eventId)||(t.add(r.eventId),e.push(r))}function Yo(e,t,n,r){if(t){if(n===null)throw Ko(e,`returned more pages without a cursor`);if(r.has(n))throw Ko(e,`repeated a cursor`)}}function Xo(e,t,n){return t!==null&&!n&&a.is(e)&&e.status===400}async function Zo(e,t){let n=t!==void 0;return Xi(n?`workflow.loadNewEvents`:`workflow.loadEvents`,async r=>{r?.setAttributes({...vr(e)});let i=[],a=new Set,o=new Set,s=t??null,c=!0,l=0,u=!1,d=await R(),f=Date.now();for(;c;){let t=Date.now(),r=s;qo(e,r,o);let f;try{f=await d.events.list({runId:e,pagination:{sortOrder:`asc`,cursor:r??void 0}})}catch(t){if(Xo(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}Jo(i,a,f.data),c=f.hasMore,Yo(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({...xr(i.length),...Ci(l)}),{events:i,cursor:s}})}function Qo(){return process.env.WORKFLOW_PRECONDITION_GUARD!==`0`}function $o(e){let t=e[e.length-1];if(!t)return;let n=t.eventId,r=n.lastIndexOf(`_`),i=_(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 es(e){return Qo()?$o(e):void 0}async function ts(e,t,n){for(let r=0;;r++)try{return await n(es(t.events))}catch(n){if(!l.is(n)||r>=2)throw n;X.info(`Event creation rejected as stale; reloading event log and retrying`,{workflowRunId:e,attempt:r+1,maxRetries:2});let i=await Zo(e,t.cursor??void 0);Jo(t.events,new Set(t.events.map(e=>e.eventId)),i.events),t.cursor=i.cursor??t.cursor}}const ns={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS, GET, HEAD`,"Access-Control-Allow-Headers":`Content-Type`};function rs(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:ns}):new Response(JSON.stringify({healthy:!0,endpoint:r.pathname,specVersion:t??5,workflowCoreVersion:Po}),{status:200,headers:{"Content-Type":`application/json`,...ns}}):await e(n)}}async function is(e,...t){let n=t[0];await Xi(`queue.publish`,{attributes:{...oi(`vercel-queue`),...si(n),...li(`publish`),...Ni(`vercel-queue`),...Pi(`vercel-queue`),...Fi(`vqs`),...Ii(`publish`)},kind:await ta(`PRODUCER`)},async n=>{let{messageId:r}=await e.queue(...t);r&&n?.setAttributes(ci(r))})}function as(e){if(e.requestedAt)try{return ui(Date.now()-e.requestedAt.getTime())}catch{return}}function os(e,t){let n;return()=>(n||=(async()=>{let n=await e.getEncryptionKeyForRun?.(t);return n?await Lt(n):void 0})(),n)}function ss(t){import(`./functions-CiVUVDNB.js`).then(t=>e(t.default,1)).then(({waitUntil:e})=>{e(t)})}function cs(e,t){ss(e.catch(e=>{if(!(e?.name===`AbortError`||e?.name===`ResponseAborted`))try{t(e)}catch{}}))}async function ls(e){let t=e();return ss(t.catch(()=>{})),t}export{Xi as $,zr as $t,Co as A,Vt as An,ri as At,Sa as B,ce as Bn,Pr as Bt,ho as C,Gt as Cn,ni as Ct,ja as D,Xt as Dn,Wr as Dt,so as E,M as En,Yr as Et,Da as F,w as Fn,Xr as Ft,la as G,jr as Gt,va as H,Or as Ht,Ea as I,me as In,Ur as It,ta as J,Nr as Jt,Ui as K,gr as Kt,Q as L,ye as Ln,Kr as Lt,go as M,Bt as Mn,ai as Mt,vo as N,Lt as Nn,qr as Nt,To as O,Ht as On,Br as Ot,fo as P,he as Pn,Zr as Pt,Wi as Q,Lr as Qt,wa as R,x as Rn,Gr as Rt,xo as S,Yt as Sn,ei as St,Xa as T,N as Tn,Vr as Tt,X as U,Dr as Ut,ba as V,se as Vn,kr as Vt,ca as W,xr as Wt,Vi as X,Rr as Xt,Bi as Y,Cr as Yt,ia as Z,Ir as Zt,Ga as _,R as _n,Ti as _t,Vo as a,Tr as an,Si as at,yo as b,L as bn,Hr as bt,Zo as c,Mr as cn,fi as ct,is as d,H as dn,bi as dt,Fr as en,Ki as et,es as f,Cn as fn,si as ft,No as g,bn as gn,wi as gt,Po as h,xn as hn,oi as ht,Io as i,Ar as in,Li as it,Eo as j,Ut as jn,ii as jt,bo as k,Wt as kn,$r as kt,os as l,hr as ln,yi as lt,ts as m,Tn as mn,li as mt,ls as n,yr as nn,di as nt,Go as o,wr as on,mi as ot,rs as p,wn as pn,ci as pt,Hi as q,_r as qt,as as r,br as rn,Ri as rt,Qo as s,Er as sn,pi as st,cs as t,vr as tn,aa as tt,zo as u,mr as un,xi as ut,$a as v,gn as vn,Ei as vt,_o as w,j as wn,Jr as wt,So as x,sn as xn,ti as xt,wo as y,I as yn,Qr as yt,ya as z,re as zn,Sr as zt};
@@ -1 +0,0 @@
1
- function normalizeWorkflowTargetWorldImport(e){if(e)return e===`local`?`@workflow/world-local`:e===`vercel`?`@workflow/world-vercel`:e}function resolveWorkflowTargetWorld(e=process.env){return e.WORKFLOW_TARGET_WORLD||(e.VERCEL_DEPLOYMENT_ID?`vercel`:`local`)}function getWorldImport(e=process.env){return normalizeWorkflowTargetWorldImport(e.WORKFLOW_TARGET_WORLD)??(e.VERCEL_DEPLOYMENT_ID?`@workflow/world-vercel`:`@workflow/world-local`)}function isVercelWorldTarget(e){return e===`vercel`||e===`@workflow/world-vercel`}export{getWorldImport,isVercelWorldTarget,normalizeWorkflowTargetWorldImport,resolveWorkflowTargetWorld};