eve 0.22.1 → 0.22.3
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.
- package/CHANGELOG.md +38 -0
- package/dist/src/chunks/{use-eve-agent-CM24ZUEI.js → use-eve-agent-Cojyfr4X.js} +25 -13
- package/dist/src/chunks/{use-eve-agent-CxcKypLZ.js → use-eve-agent-D-S1TPCW.js} +25 -13
- package/dist/src/cli/commands/init-repl.d.ts +6 -5
- package/dist/src/cli/dev/url.js +1 -1
- package/dist/src/client/client-error.d.ts +5 -1
- package/dist/src/client/client-error.js +1 -1
- package/dist/src/client/client.js +1 -1
- package/dist/src/client/open-stream.js +1 -1
- package/dist/src/client/session.js +1 -1
- package/dist/src/client/types.d.ts +2 -1
- package/dist/src/client/url.js +1 -1
- package/dist/src/compiled/.vendor-stamp.json +6 -4
- package/dist/src/compiled/@workflow/core/create-hook.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/events-consumer.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/index.js +2 -2
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +14 -0
- package/dist/src/compiled/@workflow/core/runtime/get-world-lazy.d.ts +3 -12
- package/dist/src/compiled/@workflow/core/runtime/wait-continuation.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/runtime/world-compatibility.d.ts +5 -0
- package/dist/src/compiled/@workflow/core/runtime/world-init.d.ts +16 -41
- package/dist/src/compiled/@workflow/core/runtime/world-target.d.ts +11 -0
- package/dist/src/compiled/@workflow/core/runtime/world.d.ts +21 -9
- package/dist/src/compiled/@workflow/core/runtime.d.ts +2 -1
- package/dist/src/compiled/@workflow/core/runtime.js +3 -141
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow/world-init-stub.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/errors/index.js +1 -1
- package/dist/src/compiled/@workflow/world/analytics.d.ts +182 -0
- package/dist/src/compiled/@workflow/world/env-config.d.ts +39 -0
- package/dist/src/compiled/@workflow/world/events.d.ts +25 -0
- package/dist/src/compiled/@workflow/world/index.d.ts +6 -3
- package/dist/src/compiled/@workflow/world/interfaces.d.ts +14 -7
- package/dist/src/compiled/@workflow/world/runs.d.ts +9 -1
- package/dist/src/compiled/@workflow/world/shared.d.ts +15 -0
- package/dist/src/compiled/@workflow/world/steps.d.ts +8 -0
- package/dist/src/compiled/@workflow/world-local/LICENSE.md +201 -0
- package/dist/src/compiled/@workflow/world-local/index.js +4 -0
- package/dist/src/compiled/@workflow/world-vercel/LICENSE.md +201 -0
- package/dist/src/compiled/@workflow/world-vercel/index.js +42 -0
- package/dist/src/compiled/_chunks/workflow/attribute-changes-BnKD8Y3m.js +20 -0
- package/dist/src/compiled/_chunks/workflow/{dist-FLIfyJ4Y.js → dist-CttsoN4D.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/dist-DJU_7R9s.js +40 -0
- package/dist/src/compiled/_chunks/workflow/dist-DpDDcpTl.js +3 -0
- package/dist/src/compiled/_chunks/workflow/resume-hook-DjPY9VGg.js +1 -0
- package/dist/src/compiled/_chunks/workflow/run-BSANnUPR.js +1 -0
- package/dist/src/compiled/_chunks/workflow/sleep-phozDCW8.js +1 -0
- package/dist/src/compiled/_chunks/workflow/token-CaY0nA5J.js +1 -0
- package/dist/src/compiled/_chunks/workflow/token-D4VIwGlD.js +1 -0
- package/dist/src/compiled/_chunks/workflow/undici-fb54XL8i.js +95 -0
- package/dist/src/compiler/manifest.d.ts +40 -2
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/module-map.js +2 -2
- package/dist/src/compiler/normalize-extension.d.ts +68 -0
- package/dist/src/compiler/normalize-extension.js +1 -0
- package/dist/src/compiler/normalize-manifest.js +2 -2
- package/dist/src/compiler/workspace-resources.js +1 -1
- package/dist/src/context/dynamic-skill-lifecycle.js +1 -1
- package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
- package/dist/src/discover/discover-agent.d.ts +14 -1
- package/dist/src/discover/discover-agent.js +1 -1
- package/dist/src/discover/extension-specifier.d.ts +15 -0
- package/dist/src/discover/extension-specifier.js +1 -0
- package/dist/src/discover/extensions.d.ts +109 -0
- package/dist/src/discover/extensions.js +1 -0
- package/dist/src/discover/filesystem.d.ts +1 -1
- package/dist/src/discover/filesystem.js +1 -1
- package/dist/src/discover/grammar.d.ts +27 -0
- package/dist/src/discover/grammar.js +1 -1
- package/dist/src/discover/manifest.d.ts +46 -0
- package/dist/src/discover/manifest.js +1 -1
- package/dist/src/evals/assertions/run.d.ts +3 -2
- package/dist/src/evals/assertions/run.js +2 -2
- package/dist/src/evals/index.d.ts +1 -1
- package/dist/src/evals/loaders/yaml.js +1 -1
- package/dist/src/evals/match.d.ts +11 -6
- package/dist/src/execution/sandbox/bindings/microsandbox-network.js +1 -1
- package/dist/src/harness/emission.js +1 -1
- package/dist/src/harness/model-call-error.d.ts +5 -0
- package/dist/src/harness/model-call-error.js +1 -1
- package/dist/src/harness/prompt-cache.d.ts +18 -9
- package/dist/src/harness/prompt-cache.js +1 -1
- package/dist/src/harness/tool-loop.js +1 -1
- package/dist/src/internal/application/compiled-artifacts.d.ts +4 -0
- package/dist/src/internal/application/compiled-artifacts.js +5 -4
- package/dist/src/internal/application/package.d.ts +9 -5
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-module-loader.d.ts +14 -0
- package/dist/src/internal/authored-module-loader.js +2 -2
- package/dist/src/internal/authored-module-map-loader.js +1 -1
- package/dist/src/internal/bundler/extension-scope-plugin.d.ts +37 -0
- package/dist/src/internal/bundler/extension-scope-plugin.js +3 -0
- package/dist/src/internal/helpers/gray-matter.d.ts +25 -0
- package/dist/src/internal/helpers/gray-matter.js +1 -0
- package/dist/src/internal/helpers/markdown.js +1 -1
- package/dist/src/internal/nitro/dev-runtime-source-snapshot-copy.js +1 -1
- package/dist/src/internal/nitro/host/build-application.js +1 -1
- package/dist/src/internal/nitro/host/build-extension.d.ts +24 -0
- package/dist/src/internal/nitro/host/build-extension.js +4 -0
- package/dist/src/internal/nitro/host/configure-nitro-routes.js +2 -2
- package/dist/src/internal/nitro/host/create-application-nitro.js +1 -1
- package/dist/src/internal/nitro/routes/health.d.ts +3 -3
- package/dist/src/internal/workflow/runtime.js +1 -1
- package/dist/src/internal/workflow/validate-world.d.ts +16 -0
- package/dist/src/internal/workflow/validate-world.js +1 -0
- package/dist/src/internal/workflow/world-compatibility.d.ts +1 -12
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/index.js +1 -0
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/parse-name.js +1 -0
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/pluralize.js +1 -0
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/promise.js +1 -0
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/time.js +1 -0
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/workflow-routes.js +1 -0
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.6/node_modules/@workflow/utils/dist/world-target.js +1 -0
- package/dist/src/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +1 -0
- package/dist/src/public/channels/discord/discordChannel.js +1 -1
- package/dist/src/public/channels/slack/action-status.d.ts +19 -0
- package/dist/src/public/channels/slack/action-status.js +1 -0
- package/dist/src/public/channels/slack/api.js +1 -1
- package/dist/src/public/channels/slack/defaults.js +2 -2
- package/dist/src/public/channels/slack/index.d.ts +1 -0
- package/dist/src/public/channels/slack/index.js +1 -1
- package/dist/src/public/channels/slack/mrkdwn.d.ts +0 -2
- package/dist/src/public/channels/slack/mrkdwn.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +1 -1
- package/dist/src/public/definitions/extension.d.ts +68 -0
- package/dist/src/public/definitions/extension.js +1 -0
- package/dist/src/public/extension/index.d.ts +10 -0
- package/dist/src/public/extension/index.js +1 -0
- package/dist/src/public/next/index.d.ts +9 -9
- package/dist/src/public/next/index.js +1 -1
- package/dist/src/public/next/vercel-output-config.js +1 -1
- package/dist/src/runtime/connections/openapi-client.js +1 -1
- package/dist/src/runtime/connections/openapi-spec.js +1 -1
- package/dist/src/runtime/resolve-dynamic-skill.js +1 -1
- package/dist/src/runtime/resolve-dynamic-tool.js +1 -1
- package/dist/src/runtime/types.d.ts +10 -0
- package/dist/src/services/dev-client/vercel-auth-error.d.ts +2 -2
- package/dist/src/services/dev-client/vercel-auth-error.js +3 -3
- package/dist/src/setup/scaffold/create/project.js +4 -4
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.js +1 -1
- package/dist/src/vue/index.js +1 -1
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/agent-config.md +1 -1
- package/docs/channels/custom.mdx +2 -2
- package/docs/channels/github.mdx +35 -2
- package/docs/channels/linear.mdx +36 -6
- package/docs/channels/slack.mdx +5 -3
- package/docs/concepts/context-control.md +1 -1
- package/docs/concepts/execution-model-and-durability.md +1 -1
- package/docs/connections/openapi.mdx +3 -1
- package/docs/evals/assertions.mdx +4 -2
- package/docs/extensions.md +155 -0
- package/docs/guides/client/overview.mdx +1 -1
- package/docs/guides/deployment.md +1 -1
- package/docs/guides/dev-tui.md +4 -0
- package/docs/guides/dynamic-capabilities.md +3 -3
- package/docs/guides/frontend/nextjs.mdx +7 -7
- package/docs/guides/instrumentation.md +1 -1
- package/docs/guides/state.md +3 -3
- package/docs/instructions.mdx +1 -1
- package/docs/meta.json +1 -0
- package/docs/patterns/dynamic-scheduling.md +11 -11
- package/docs/patterns/multi-tenant-approvals.md +6 -6
- package/docs/patterns/multi-tenant-auth.md +13 -13
- package/docs/patterns/multi-tenant-memory.md +9 -9
- package/docs/schedules.mdx +1 -1
- package/docs/subagents.mdx +2 -0
- package/docs/tutorial/guard-the-spend.mdx +2 -2
- package/docs/tutorial/query-sample-data.mdx +1 -1
- package/docs/tutorial/remember-definitions.mdx +2 -2
- package/docs/tutorial/ship-it.mdx +1 -1
- package/package.json +12 -5
- package/dist/src/compiled/_chunks/workflow/attribute-changes-zAifvEhb.js +0 -59
- package/dist/src/compiled/_chunks/workflow/dist-Dxrjttr2.js +0 -3
- package/dist/src/compiled/_chunks/workflow/resume-hook-C15uJ2ik.js +0 -1
- package/dist/src/compiled/_chunks/workflow/run-BJUPZ0Ni.js +0 -1
- package/dist/src/compiled/_chunks/workflow/sleep-C8B-TYir.js +0 -1
- package/dist/src/compiled/_chunks/workflow/token-Bm-WLAUB.js +0 -1
- package/dist/src/compiled/_chunks/workflow/token-J7YP0s9a.js +0 -1
- package/dist/src/internal/workflow/configure-world.d.ts +0 -18
- package/dist/src/internal/workflow/configure-world.js +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import{a as e,t}from"./chunk-BHKSVoKr.js";import{c as n,d as r,f as i,l as a,p as o,s,u as c}from"./dist-CttsoN4D.js";import{E as l,T as u,a as d,c as f,d as p,f as m,i as h,s as g,w as _}from"./dist-DpDDcpTl.js";import{L as v,_ as y,a as ee,h as te,u as ne,y as re,z as ie}from"./dist-DJU_7R9s.js";import{getStepFunction as ae}from"../../@workflow/core/private.js";import{types as oe}from"node:util";import{AsyncLocalStorage as se}from"node:async_hooks";function ce(e,t){let n=Error.captureStackTrace;n?.(e,t)}const le=(()=>{let e=globalThis.process;return e?.env?e.env.FORCE_COLOR&&e.env.FORCE_COLOR!==`0`?!0:e.env.NO_COLOR?!1:!!e.stdout?.isTTY:!1})(),b=(e,t)=>n=>le?`\x1b[${e}m${n}\x1b[${t}m`:n,x={bold:b(1,22),dim:b(2,22),italic:b(3,23),red:b(31,39),blue:b(34,39),cyan:b(36,39),yellow:b(33,39),magenta:b(35,39)},ue={info:x.blue,help:x.cyan,warn:x.yellow,error:x.red};function de(e){let t=Array.isArray(e)?e.join(`
|
|
2
|
+
`):e;return ue.info(`${x.bold(`hint:`)} ${t}`)}function fe(e){return ue.info(`${x.bold(`docs:`)} ${e}`)}function pe(e){return x.italic(`${x.dim("`")}${e}${x.dim("`")}`)}function S(e){return x.dim(e)}function me(e){return x.bold(e)}function he(e){return x.red(e)}function ge(e){return x.magenta(e)}function _e(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
|
+
`)}const ve=Symbol.for(`nodejs.util.inspect.custom`);function ye(e){return`code`in e?`\`${e.code}\``:`dim`in e?e.dim:e.text}function be(e){return`code`in e?pe(e.code):`dim`in e?S(e.dim):e.text}function xe(e){return e.type===`docs`?`docs: ${e.url}`:e.segments.map(ye).join(``)}function Se(e){return e.type===`docs`?fe(e.url):e.segments.map(be).join(``)}function Ce(e){let t=[e.title.map(ye).join(``)];return e.details.forEach((n,r)=>{let i=r===e.details.length-1,a=i?`╰▶ `:`├▶ `,o=i?` `:`│ `;xe(n).split(`
|
|
5
|
+
`).forEach((e,n)=>t.push(`${n===0?a:o}${e}`))}),t.join(`
|
|
6
|
+
`)}function we(e){return _e(e.title.map(be).join(``),e.details.map(Se))}var Te=class extends Error{fatal=!0;#e;constructor(e){super(Ce(e)),this.#e=e}[ve](){let e=we(this.#e),t=this.message.split(`
|
|
7
|
+
`).length,n=(this.stack??``).split(`
|
|
8
|
+
`).slice(t).join(`
|
|
9
|
+
`);return n?`${this.name}: ${e}\n${n}`:`${this.name}: ${e}`}toString(){return`${this.name}: ${we(this.#e)}`}},Ee=class extends Te{name=`NotInWorkflowContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a workflow function`}],details:[{type:`docs`,url:t}]})}},De=class extends Te{name=`NotInStepContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a step function`}],details:[{type:`docs`,url:t}]})}},Oe=class extends Te{name=`NotInWorkflowOrStepContextError`;constructor(e,t){super({title:[{code:e},{text:` can only be called inside a workflow or step function`}],details:[{type:`docs`,url:t}]})}};const ke=Symbol.for(`WORKFLOW_CONTEXT`);function Ae(){let e=globalThis[ke];if(!e){let e=new Oe(`getWorkflowMetadata()`,`https://workflow-sdk.dev/docs/api-reference/workflow/get-workflow-metadata`);throw ce(e,Ae),e}return e}var je=class extends Te{name=`UnavailableInWorkflowContextError`;constructor(e,t){let n=globalThis[ke]?.workflowName,r=(()=>{if(!n)return null;let e=n.match(/^(workflow\/|step\/)(.*)$/);return e?[{dim:e[1]},{text:e[2]}]:[{text:n}]})(),i=r?{type:`plain`,segments:[{text:`this call was made from the `},...r,{text:` workflow context.`}]}:{type:`plain`,segments:[{text:`this call was made from a workflow context.`}]};super({title:[{code:e},{text:` cannot be called from a workflow context.`}],details:[{type:`plain`,segments:[{text:`calling this in a workflow context can cause determinism issues.`}]},i,{type:`docs`,url:t}]})}};function Me(e,t,n){let r=new Ee(e,t);throw ce(r,n),r}function Ne(e,t,n){let r=new De(e,t);throw ce(r,n),r}function Pe(e,t,n){let r=new Oe(e,t);throw ce(r,n),r}function Fe(e,t,n){let r=new je(e,t);throw ce(r,n),r}var Ie=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}})),Le=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):()=>{}})),Re=t(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=Ie(),a=Le();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*$`)})),ze=t(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),Be=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)}})),C=t(((e,t)=>{let n=Le(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=Ie(),{safeRe:a,t:o}=Re(),s=ze(),{compareIdentifiers:c}=Be();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}}})),w=t(((e,t)=>{let n=C();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}}})),Ve=t(((e,t)=>{let n=w();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),He=t(((e,t)=>{let n=w();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Ue=t(((e,t)=>{let n=C();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}}})),We=t(((e,t)=>{let n=w();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`}})),Ge=t(((e,t)=>{let n=C();t.exports=(e,t)=>new n(e,t).major})),Ke=t(((e,t)=>{let n=C();t.exports=(e,t)=>new n(e,t).minor})),qe=t(((e,t)=>{let n=C();t.exports=(e,t)=>new n(e,t).patch})),Je=t(((e,t)=>{let n=w();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),T=t(((e,t)=>{let n=C();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Ye=t(((e,t)=>{let n=T();t.exports=(e,t,r)=>n(t,e,r)})),Xe=t(((e,t)=>{let n=T();t.exports=(e,t)=>n(e,t,!0)})),Ze=t(((e,t)=>{let n=C();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Qe=t(((e,t)=>{let n=Ze();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),$e=t(((e,t)=>{let n=Ze();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),et=t(((e,t)=>{let n=T();t.exports=(e,t,r)=>n(e,t,r)>0})),tt=t(((e,t)=>{let n=T();t.exports=(e,t,r)=>n(e,t,r)<0})),nt=t(((e,t)=>{let n=T();t.exports=(e,t,r)=>n(e,t,r)===0})),rt=t(((e,t)=>{let n=T();t.exports=(e,t,r)=>n(e,t,r)!==0})),it=t(((e,t)=>{let n=T();t.exports=(e,t,r)=>n(e,t,r)>=0})),at=t(((e,t)=>{let n=T();t.exports=(e,t,r)=>n(e,t,r)<=0})),ot=t(((e,t)=>{let n=nt(),r=rt(),i=et(),a=it(),o=tt(),s=at();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}`)}}})),st=t(((e,t)=>{let n=C(),r=w(),{safeRe:i,t:a}=Re();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];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),ct=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}}})),E=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,ce(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=>se(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 ee=[..._.values()];return r.set(t,ee),ee}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(le(this.set[t],e,this.options))return!0;return!1}};let r=new(ct()),i=ze(),a=lt(),o=Le(),s=C(),{safeRe:c,t:l,comparatorTrimReplace:u,tildeTrimReplace:d,caretTrimReplace:f}=Re(),{FLAG_INCLUDE_PRERELEASE:p,FLAG_LOOSE:m}=Ie(),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=ne(e,t),o(`caret`,e),e=ee(e,t),o(`tildes`,e),e=ie(e,t),o(`xrange`,e),e=oe(e,t),o(`stars`,e),e),y=e=>!e||e.toLowerCase()===`x`||e===`*`,ee=(e,t)=>e.trim().split(/\s+/).map(e=>te(e,t)).join(` `),te=(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})},ne=(e,t)=>e.trim().split(/\s+/).map(e=>re(e,t)).join(` `),re=(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})},ie=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ae(e,t)).join(` `)),ae=(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})},oe=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[l.STAR],``)),se=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?l.GTE0PRE:l.GTE0],``)),ce=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()),le=(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}})),lt=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===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0: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=ze(),{safeRe:i,t:a}=Re(),o=ot(),s=Le(),c=C(),l=E()})),ut=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),dt=t(((e,t)=>{let n=E();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),ft=t(((e,t)=>{let n=C(),r=E();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}})),pt=t(((e,t)=>{let n=C(),r=E();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}})),mt=t(((e,t)=>{let n=C(),r=E(),i=et();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}})),ht=t(((e,t)=>{let n=E();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),gt=t(((e,t)=>{let n=C(),r=lt(),{ANY:i}=r,a=E(),o=ut(),s=et(),c=tt(),l=at(),u=it();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}})),_t=t(((e,t)=>{let n=gt();t.exports=(e,t,r)=>n(e,t,`>`,r)})),vt=t(((e,t)=>{let n=gt();t.exports=(e,t,r)=>n(e,t,`<`,r)})),yt=t(((e,t)=>{let n=E();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),bt=t(((e,t)=>{let n=ut(),r=T();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}})),xt=t(((e,t)=>{let n=E(),r=lt(),{ANY:i}=r,a=ut(),o=T(),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=Re(),r=Ie(),i=C(),a=Be();t.exports={parse:w(),valid:Ve(),clean:He(),inc:Ue(),diff:We(),major:Ge(),minor:Ke(),patch:qe(),prerelease:Je(),compare:T(),rcompare:Ye(),compareLoose:Xe(),compareBuild:Ze(),sort:Qe(),rsort:$e(),gt:et(),lt:tt(),eq:nt(),neq:rt(),gte:it(),lte:at(),cmp:ot(),coerce:st(),Comparator:lt(),Range:E(),satisfies:ut(),toComparators:dt(),maxSatisfying:ft(),minSatisfying:pt(),minVersion:mt(),validRange:ht(),outside:gt(),gtr:_t(),ltr:vt(),intersects:yt(),simplifyRange:bt(),subset:xt(),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}}));function Ct(e){return new Uint8Array(e).toBase64()}function wt(e){return Uint8Array.fromBase64(e).buffer}function Tt(e){return Buffer.from(e).toString(`base64`)}function Et(e){return Uint8Array.from(Buffer.from(e,`base64`)).buffer}function Dt(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 Ot(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 kt=typeof Uint8Array.fromBase64==`function`,At=typeof process==`object`&&process.versions?.node!==void 0,jt=kt?Ct:At?Tt:Dt,Mt=kt?wt:At?Et:Ot,Nt=2**32-1,Pt=Nt-1;var D=class extends Error{constructor(e,t,n,r){super(e),this.name=`DevalueError`,this.path=t.join(``),this.value=n,this.root=r}};function Ft(e){return e===null||typeof e!=`object`&&typeof e!=`function`}const It=Object.getOwnPropertyNames(Object.prototype).sort().join(`\0`);function Lt(e){let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null||Object.getPrototypeOf(t)===null||Object.getOwnPropertyNames(t).sort().join(`\0`)===It}function Rt(e){return Object.prototype.toString.call(e).slice(8,-1)}function zt(e){switch(e){case`"`:return`\\"`;case`<`:return`\\u003C`;case`\\`:return`\\\\`;case`
|
|
10
|
+
`: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 O(e){let t=``,n=0,r=e.length;for(let i=0;i<r;i+=1){let r=e[i],a=zt(r);a&&(t+=e.slice(n,i)+a,n=i+1)}return`"${n===0?e:t+e.slice(n)}"`}function Bt(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.getOwnPropertyDescriptor(e,t).enumerable)}const Vt=/^[a-zA-Z_$][a-zA-Z_$0-9]*$/;function Ht(e){return Vt.test(e)?`.`+e:`[`+JSON.stringify(e)+`]`}function Ut(e){return!(!Number.isInteger(e)||e<0||e>Pt)}function Wt(e){return!(!Number.isInteger(e)||e<0||e>Nt)}function Gt(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 Ut(+e)}function Kt(e){let t=Object.keys(e);for(var n=t.length-1;n>=0&&!Gt(t[n]);n--);return t.length=n+1,t}function qt(e,t){return Jt(JSON.parse(e),t)}function Jt(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`);r[e]=Mt(t);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`:r[e]=new URL(s[1]);break;case`URLSearchParams`:r[e]=new URLSearchParams(s[1]);break;default:throw Error(`Unknown type ${o}`)}}else if(s[0]===-7){let t=s[1];if(!Wt(t))throw Error(`Invalid input`);let n=[];r[e]=n,n[Pt]=void 0,delete n[Pt];for(let e=2;e<s.length;e+=2){let r=s[e];if(!Ut(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 k(e,t){let n=Yt(!1,e,t);return typeof n==`string`?n:`[${n.join(`,`)}]`}function Yt(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 D(`Cannot stringify a function`,o,n,t);if(typeof n==`symbol`)throw new D(`Cannot stringify a Symbol primitive`,o,n,t);let u=``;if(Ft(n))u=Xt(n);else if(typeof n.then==`function`){if(!e)throw new D(`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=Rt(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",${O(n.toString())}]`;break;case`URLSearchParams`:u=`["URLSearchParams",${O(n.toString())}]`;break;case`RegExp`:let{source:r,flags:i}=n;u=i?`["RegExp",${O(r)},"${i}"]`:`["RegExp",${O(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=Kt(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(${Ft(e)?Xt(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","${jt(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}",${O(n.toString())}]`;break;default:if(!Lt(n))throw new D(`Cannot stringify arbitrary non-POJOs`,o,n,t);if(Bt(n).length>0)throw new D(`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 D(`Cannot stringify objects with __proto__ keys`,o,n,t);o.push(Ht(e)),u+=`,${O(e)},${c(n[e])}`,o.pop()}u+=`]`}else{u=`{`;let e=!1;for(let r of Object.keys(n)){if(r===`__proto__`)throw new D(`Cannot stringify objects with __proto__ keys`,o,n,t);e&&(u+=`,`),e=!0,o.push(Ht(r)),u+=`${O(r)}:${c(n[r])}`,o.pop()}u+=`}`}}}return r[l]=u,l}let l=c(t);return l<0?`${l}`:r}function Xt(e){let t=typeof e;return t===`string`?O(e):e===void 0?`-1`:e===0&&1/e<0?`-6`:t===`bigint`?`["BigInt","${e}"]`:String(e)}var Zt=e(St(),1);async function Qt(e,t=[`encrypt`,`decrypt`]){if(e.byteLength!==32)throw new _(`Encryption key must be exactly 32 bytes, got ${e.byteLength}`);return globalThis.crypto.subtle.importKey(`raw`,e,`AES-GCM`,!1,t)}async function $t(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 en(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 tn=()=>re(`WORKFLOW_LOCK_POLL_INTERVAL_MS`,10,{integer:!0,min:1});function A(){let e={...n(),pendingOps:0,doneResolved:!1,streamEnded:!1};return e.promise.catch(()=>{}),e}function nn(e){if(e.locked)return!1;let t;try{t=e.getWriter()}catch{return!1}try{t.releaseLock()}catch{return!1}return!0}function rn(e){if(e.locked)return!1;let t;try{t=e.getReader()}catch{return!1}try{t.releaseLock()}catch{return!1}return!0}function an(e,t){if(t.writablePollingInterval!==void 0)return;let n=setInterval(()=>{if(t.doneResolved||t.streamEnded){clearInterval(n),t.writablePollingInterval=void 0;return}nn(e)&&t.pendingOps===0&&(t.doneResolved=!0,t.resolve(),clearInterval(n),t.writablePollingInterval=void 0)},tn());t.writablePollingInterval=n}function on(e,t){if(t.readablePollingInterval!==void 0)return;let n=setInterval(()=>{if(t.doneResolved||t.streamEnded){clearInterval(n),t.readablePollingInterval=void 0;return}rn(e)&&t.pendingOps===0&&(t.doneResolved=!0,t.resolve(),clearInterval(n),t.readablePollingInterval=void 0)},tn());t.readablePollingInterval=n}async function j(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 _(`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 sn(e){if(e.specVersion!==5)throw new _(`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 cn=Symbol.for(`@workflow/world//cache`),ln=Symbol.for(`@workflow/world//cachePromise`),un=Symbol.for(`@workflow/world//getWorldFn`);async function M(){let e=globalThis;if(e[cn])return sn(e[cn]),e[cn];if(e[ln])return e[cn]=await e[ln],sn(e[cn]),e[cn];let t=e[un];if(t){let e=await t();return sn(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 dn=Symbol.for(`workflow-serialize`),fn=Symbol.for(`workflow-deserialize`),pn=Symbol.for(`WORKFLOW_USE_STEP`),mn=Symbol.for(`WORKFLOW_SET_ATTRIBUTES`),hn=Symbol.for(`WORKFLOW_CREATE_HOOK`),gn=Symbol.for(`WORKFLOW_SLEEP`),_n=Symbol.for(`WORKFLOW_GET_STREAM_ID`),vn=Symbol.for(`WORKFLOW_STABLE_ULID`),N=Symbol.for(`WORKFLOW_STREAM_NAME`),yn=Symbol.for(`WORKFLOW_STREAM_TYPE`),bn=Symbol.for(`WORKFLOW_STREAM_FRAMING`),P=Symbol.for(`WORKFLOW_STREAM_SERVER_RUN_ID`),F=Symbol.for(`WORKFLOW_STREAM_SERVER_DEPLOYMENT_ID`),xn=Symbol.for(`BODY_INIT`),Sn=Symbol.for(`WEBHOOK_RESPONSE_WRITABLE`),Cn=Symbol.for(`workflow-class-registry`),I=Symbol.for(`WORKFLOW_ABORT_STREAM_NAME`),L=Symbol.for(`WORKFLOW_ABORT_HOOK_TOKEN`),wn=Symbol.for(`WORKFLOW_ABORT_LISTENER_ATTACHED`),Tn=Symbol.for(`WORKFLOW_ABORT_READER_CANCEL`);function En(e=globalThis){let t=e,n=t[Cn];return n||(n=new Map,t[Cn]=n),n}const Dn=`class//workflow//Run`;function On(e,t,n=globalThis){En(n).set(e,t)}function kn(e,t){return En(t).get(e)}function An(){return{Class:e=>{if(typeof e!=`function`)return!1;let t=e.classId;return typeof t==`string`?{classId:t}:!1},Instance:e=>{if(typeof e!=`object`||!e)return!1;let t=e.constructor;if(!t||typeof t!=`function`)return!1;let n=t[dn];if(typeof n!=`function`)return!1;let r=t.classId;if(typeof r!=`string`)throw Error(`Class "${t.name}" with ${String(dn)} must have a static "classId" property.`);return{classId:r,data:n.call(t,e)}}}}function jn(e=globalThis){return{Class:t=>{let n=t.classId,r=kn(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=kn(n,e);if(!i)throw Error(`Class "${n}" not found. Make sure the class is registered with registerSerializationClass.`);let a=i[fn];if(typeof a!=`function`)throw Error(`Class "${n}" does not have a static ${String(fn)} method.`);return a.call(i,r)}}}function Mn(e,t,n){if(n===0)return`.`;let r=new Uint8Array(e,t,n);return Buffer.from(r).toString(`base64`)}function R(e){return Mn(e.buffer,e.byteOffset,e.byteLength)}function z(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 Nn(e){return JSON.parse(e)}function Pn(e){if(!oe.isNativeError(e))return!1;let t={message:e.message,stack:e.stack};return`cause`in e&&(t.cause=e.cause),t}function Fn(e,t){return!oe.isNativeError(t)||t.name!==e?!1:Pn(t)}function B(e){return t=>Fn(e,t)||!1}function In(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 Ln(e=globalThis){return{ArrayBuffer:t=>t instanceof e.ArrayBuffer&&Mn(t,0,t.byteLength),BigInt:e=>typeof e==`bigint`&&e.toString(),BigInt64Array:t=>t instanceof e.BigInt64Array&&R(t),BigUint64Array:t=>t instanceof e.BigUint64Array&&R(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:B(`EvalError`),FatalError:B(`FatalError`),HookConflictError:e=>{let t=Fn(`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:B(`RangeError`),ReferenceError:B(`ReferenceError`),RetryableError:e=>{let t=Fn(`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=Fn(`RuntimeDecryptionError`,e);if(!t)return!1;let n={...t},r=e.context;return r!==void 0&&(n.context=r),n},SyntaxError:B(`SyntaxError`),TypeError:B(`TypeError`),URIError:B(`URIError`),AggregateError:e=>{let t=Fn(`AggregateError`,e);return t?{...t,errors:e.errors}:!1},Error:e=>{if(!oe.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&&R(t),Float64Array:t=>t instanceof e.Float64Array&&R(t),Headers:t=>t instanceof e.Headers&&Array.from(t),Int8Array:t=>t instanceof e.Int8Array&&R(t),Int16Array:t=>t instanceof e.Int16Array&&R(t),Int32Array:t=>t instanceof e.Int32Array&&R(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}:!1},URLSearchParams:t=>t instanceof e.URLSearchParams?t.size===0?`.`:String(t):!1,Uint8Array:t=>t instanceof e.Uint8Array&&R(t),Uint8ClampedArray:t=>t instanceof e.Uint8ClampedArray&&R(t),Uint16Array:t=>t instanceof e.Uint16Array&&R(t),Uint32Array:t=>t instanceof e.Uint32Array&&R(t)}}function Rn(e=globalThis){return{ArrayBuffer:t=>z(t,e),BigInt:t=>e.BigInt(t),BigInt64Array:t=>new e.BigInt64Array(z(t,e)),BigUint64Array:t=>new e.BigUint64Array(z(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:In(e,`EvalError`),FatalError:t=>{let n=new(e[Symbol.for(`@workflow/errors//FatalError`)]??h)(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`)]??d)(t.token,t.conflictingRunId);return t.stack!==void 0&&(n.stack=t.stack),`cause`in t&&(n.cause=t.cause),n},RangeError:In(e,`RangeError`),ReferenceError:In(e,`ReferenceError`),RetryableError:t=>{let n=new(e[Symbol.for(`@workflow/errors//RetryableError`)]??f)(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:In(e,`SyntaxError`),TypeError:In(e,`TypeError`),URIError:In(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(z(t,e)),Float64Array:t=>new e.Float64Array(z(t,e)),Headers:t=>new e.Headers(t),Int8Array:t=>new e.Int8Array(z(t,e)),Int16Array:t=>new e.Int16Array(z(t,e)),Int32Array:t=>new e.Int32Array(z(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(z(t,e)),Uint8ClampedArray:t=>new e.Uint8ClampedArray(z(t,e)),Uint16Array:t=>new e.Uint16Array(z(t,e)),Uint32Array:t=>new e.Uint32Array(z(t,e))}}function zn(){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 Bn(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 Vn(e){return e.length===4&&/^[a-z0-9]{4}$/.test(e)}const V={DEVALUE_V1:`devl`,ENCRYPTED:`encr`,GZIP:`gzip`,ZSTD:`zstd`},Hn=new TextEncoder,Un=new TextDecoder;function Wn(e,t=globalThis,n){let r;switch(e){case`workflow`:r={...An(),...zn(),...Ln(t)};break;case`step`:r={...An(),...Ln(t)};break;case`client`:r={...An(),...Ln(t)};break}return n?{...r,...n}:r}function Gn(e,t=globalThis,n){let r;switch(e){case`workflow`:r={...jn(t),...Bn(t),...Rn(t)};break;case`step`:r={...jn(t),...Rn(t)};break;case`client`:r={...jn(t),...Rn(t),StepFunction:()=>{throw Error(`Step functions cannot be deserialized in client context.`)}};break}return n?{...r,...n}:r}const H={formatPrefix:V.DEVALUE_V1,serialize(e,t,n){let r=k(e,Wn(t,n?.global,n?.extraReducers));return Hn.encode(r)},deserialize(e,t,n){let r=Gn(t,n?.global,n?.extraRevivers);return qt(Un.decode(e),r)},deserializeLegacy(e,t,n){return Jt(e,Gn(t,n?.global,n?.extraRevivers))}},Kn=new TextEncoder,qn=new TextDecoder;function U(e,t){if(!(t instanceof Uint8Array))return t;let n=Kn.encode(e),r=new Uint8Array(4+t.length);return r.set(n,0),r.set(t,4),r}function Jn(e){if(!(e instanceof Uint8Array)||e.length<4)return null;let t=e.subarray(0,4),n=qn.decode(t);return Vn(n)?n:null}function W(e){if(!(e instanceof Uint8Array))return{format:V.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=qn.decode(t);if(!Vn(n))throw Error(`Invalid format prefix: "${n}". Must be 4 characters of [a-z0-9].`);return{format:n,payload:e.subarray(4)}}function Yn(){try{return typeof process<`u`&&process.env?.WORKFLOW_DISABLE_COMPRESSION===`1`}catch{return!1}}function Xn(){try{let e=process.env?.WORKFLOW_COMPRESSION_CODEC;return e===`gzip`||e===`zstd`?e:void 0}catch{return}}function Zn(){try{return globalThis.process?.getBuiltinModule?.(`node:zlib`)}catch{return}}function Qn(){let e=Zn();return typeof e?.zstdCompressSync==`function`&&typeof e?.zstdDecompressSync==`function`}function $n(){return typeof CompressionStream==`function`&&typeof DecompressionStream==`function`}async function er(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 tr(e){return er(e,new CompressionStream(`gzip`))}async function nr(e){return er(e,new DecompressionStream(`gzip`))}function rr(e){let t=Zn(),n=t?.constants?.ZSTD_c_compressionLevel,r=n===void 0?void 0:{params:{[n]:3}};return new Uint8Array(t.zstdCompressSync(e,r))}function ir(e){let t=Zn();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 G(e,t,n,r){e&&(e.recorded=!0,e.compressed=t!==`none`,e.codec=t,e.uncompressedBytes=n,e.storedBytes=r)}function ar(){return Xn()===`gzip`?$n()?`gzip`:`none`:Qn()?`zstd`:$n()?`gzip`:`none`}async function or(e,t,n){if(!(e instanceof Uint8Array))return e;if(!t||e.length<1024||Yn())return G(n,`none`,e.length,e.length),e;let r=ar();if(r===`none`)return G(n,`none`,e.length,e.length),e;let i=r===`zstd`?rr(e):await tr(e),a=r===`zstd`?V.ZSTD:V.GZIP,o=4+i.length;return o>=e.length*.95?(G(n,`none`,e.length,e.length),e):(G(n,r,e.length,o),U(a,i))}async function sr(e,t){if(!(e instanceof Uint8Array))return e;let n=Jn(e);if(n===V.ZSTD){let{payload:n}=W(e),r=ir(n);return G(t,`zstd`,r.length,e.length),r}if(n===V.GZIP){if(!$n())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}=W(e),r=await nr(n);return G(t,`gzip`,r.length,e.length),r}return G(t,`none`,e.length,e.length),e}async function cr(e){return typeof e==`function`?e():e}async function lr(e,t){if(!t||!(e instanceof Uint8Array))return e;let n=await $t(t,e);return U(V.ENCRYPTED,n)}async function ur(e,t){if(!(e instanceof Uint8Array))return e;let n=Jn(e);if(n===V.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!==V.ENCRYPTED)return e;let{payload:r}=W(e);try{return await en(t,r)}catch(e){throw p.is(e)&&e.context&&(e.context.formatPrefix=n),e}}function dr(e,t,n){let[r,...i]=t.split(`
|
|
11
|
+
`),a=i.join(`
|
|
12
|
+
`),o=fr(r??``,n),s=pr(a),c=[`${e} ${r??``}`];return o&&c.push(o),s&&c.push(s),c.join(`
|
|
13
|
+
`)}function fr(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 i=new Set([`workflowRunId`,`workflowName`,`stepId`,`stepName`,`errorAttribution`,`errorCode`,`errorName`,`errorMessage`,`errorStack`,`hint`,`attempt`,`retryCount`]),a=[],o=K(t,`errorName`),s=K(t,`errorAttribution`);if(o||s){let e=s?s===`sdk`?ge(`sdk error`):he(`user error`):``,t=o?me(o):``,n=e&&t?S(` · `):``;a.push(` ${e}${n}${t}`)}let l=K(t,`workflowRunId`),u=K(t,`workflowName`);l?a.push(gr(`run`,l,u,r)):u&&a.push(gr(`run`,null,u,r));let d=K(t,`stepId`),f=K(t,`stepName`);if((d||f)&&a.push(gr(`step`,d,f,c)),t.attempt!==void 0||t.retryCount!==void 0){let e=t.attempt,n=t.retryCount;e!==void 0&&n!==void 0?a.push(` ${hr(`retry`)} ${e} ${S(`attempts ·`)} ${n} ${S(`max retries`)}`):e!==void 0&&a.push(` ${hr(`retry`)} ${e} ${S(`attempts`)}`)}let p=K(t,`errorCode`);p&&p!==o&&a.push(` ${hr(`code`)} ${S(p)}`);let m=K(t,`hint`);m&&a.push(` ${de(m)}`);let h=Object.entries(t).filter(([e,t])=>!i.has(e)&&!n.has(e)&&t!=null).sort(([e],[t])=>e.localeCompare(t));for(let[e,t]of h)a.push(` ${hr(e)} ${_r(t)}`);return a.length?a.join(`
|
|
14
|
+
`):null}function pr(e){if(!e)return null;let t=e.split(`
|
|
15
|
+
`),n=[],r=0,i=0,a=0,o=()=>{r>0&&(n.push(S(` … ${r} more ${r===1?`frame`:`frames`} in framework internals`)),r=0)};for(let e of t){let t=e.trimStart().startsWith(`at `);if(t&&mr(e)){r++;continue}if(t&&i>=6){a++;continue}o(),n.push(e),t&&i++}return o(),a>0&&n.push(S(` … ${a} more ${a===1?`frame`:`frames`} (run \`pnpm wf inspect run <id>\` for the full stack)`)),n.join(`
|
|
16
|
+
`)}function mr(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 K(e,t){let n=e[t];return typeof n==`string`&&n.length>0?n:null}function hr(e){return S(e.padEnd(6))}function gr(e,t,n,r){let a=t||S(`—`),s=n&&(e===`run`?o(n):i(n))?`${S(`·`)} ${r(n)}`:``;return` ${hr(e)} ${a}${s?` `+s:``}`}function _r(e){if(typeof e==`string`)return e.includes(`
|
|
17
|
+
`)?e.split(`
|
|
18
|
+
`).map((e,t)=>t===0?e:` ${e}`).join(`
|
|
19
|
+
`):e;if(typeof e==`number`||typeof e==`boolean`)return String(e);try{return JSON.stringify(e)}catch{return String(e)}}var vr=class e extends Error{steps;globalThis;stepCount;hookCount;waitCount;attributeCount;hookDisposedCount;abortCount;constructor(e,t){let n=[...e.values()],r=0,i=0,o=0,s=0,c=0,l=0;for(let e of n)e.type===`step`?r++:e.type===`hook`?e.disposed?c++:e.abortRequested?l++:i++:e.type===`wait`?o++:e.type===`attribute`&&s++;let u=[];r>0&&u.push(`${r} ${a(`step`,`steps`,r)}`),i>0&&u.push(`${i} ${a(`hook`,`hooks`,i)}`),o>0&&u.push(`${o} ${a(`wait`,`waits`,o)}`),s>0&&u.push(`${s} ${a(`attribute write`,`attribute writes`,s)}`),c>0&&u.push(`${c} hook ${a(`disposal`,`disposals`,c)}`);let d=a(`has`,`have`,r+i+o+s+c),f=+(r>0)+ +(i>0)+ +(o>0)+ +(s>0)+ +(c>0),p;p=f>1?`processed`:r>0?`run`:i>0||o>0?`created`:s>0?`written`:c>0?`processed`:`received`;let m=u.length>0?`${u.join(` and `)} ${d} not been ${p} yet`:`0 steps have not been run yet`;super(m),this.name=`WorkflowSuspension`,this.steps=n,this.globalThis=t,this.stepCount=r,this.hookCount=i,this.waitCount=o,this.attributeCount=s,this.hookDisposedCount=c,this.abortCount=l}static is(t){return t instanceof e}};function yr(){throw new _(`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 q(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const br=q(`workflow.name`),xr=q(`workflow.operation`),Sr=q(`workflow.run.id`),Cr=q(`workflow.run.status`),wr=q(`workflow.started_at`),Tr=q(`workflow.events.count`),Er=q(`workflow.arguments.count`),Dr=q(`workflow.result.type`),Or=q(`workflow.trace.propagated`),kr=q(`workflow.trace.mode`),Ar=q(`workflow.turbo`),jr=q(`workflow.error.name`),Mr=q(`workflow.error.message`),Nr=q(`workflow.error.code`),Pr=q(`workflow.steps.created`),Fr=q(`workflow.hooks.created`),Ir=q(`workflow.waits.created`),Lr=q(`workflow.route.type`),Rr=q(`workflow.route.handler_cached`),zr=q(`workflow.route.invocation_count`),Br=q(`workflow.route.entrypoint_age_ms`),Vr=q(`workflow.route.module_body_init_ms`),Hr=q(`step.name`),Ur=q(`step.id`),Wr=q(`step.attempt`),Gr=q(`step.status`),Kr=q(`step.max_retries`),qr=q(`step.skipped`),Jr=q(`step.skip_reason`),Yr=q(`step.arguments.count`),Xr=q(`step.result.type`),Zr=q(`step.error.name`),Qr=q(`step.error.message`),$r=q(`step.fatal_error`),ei=q(`step.retry.exhausted`),ti=q(`step.retry.timeout_seconds`),ni=q(`step.retry.will_retry`),ri=q(`messaging.system`),ii=q(`messaging.destination.name`),ai=q(`messaging.message.id`),oi=q(`messaging.operation.type`),si=q(`workflow.queue.overhead_ms`),ci=q(`deployment.id`),li=q(`workflow.hook.token`),ui=q(`workflow.hook.id`),di=q(`workflow.hook.found`),fi=q(`workflow.suspension.state`),pi=q(`workflow.suspension.hook_count`),mi=q(`workflow.suspension.step_count`),hi=q(`workflow.suspension.wait_count`),gi=q(`http.request.method`),_i=q(`http.route`),vi=q(`http.response.status_code`),yi=q(`error.type`),bi=q(`workflow.events.pages_loaded`),xi=q(`workflow.queue.deserialize_time_ms`),Si=q(`workflow.queue.execution_time_ms`),Ci=q(`workflow.queue.serialize_time_ms`),wi=q(`workflow.serialization.operation`),Ti=q(`workflow.serialization.compressed`),Ei=q(`workflow.serialization.codec`),Di=q(`workflow.serialization.uncompressed_bytes`),Oi=q(`workflow.serialization.stored_bytes`),ki=q(`workflow.serialization.compression_ratio`),Ai=q(`peer.service`),ji=q(`rpc.system`),Mi=q(`rpc.service`),Ni=q(`rpc.method`),Pi=q(`error.retryable`),Fi=q(`error.category`),Ii=new Set;function Li(){let e=process.env.WORKFLOW_TRACE_MODE;return e===`continuous`?`continuous`:(e&&e!==`linked`&&!Ii.has(e)&&(Ii.add(e),Y.warn(`Unrecognized WORKFLOW_TRACE_MODE value "${e}"; expected "linked" or "continuous". Falling back to "linked".`)),`linked`)}function Ri(e){return e!==void 0&&Object.keys(e).length>0}function zi(e,t){return e===`linked`&&Ri(t)?Promise.resolve(t):Vi()}async function Bi(e,t){if(e!==`linked`)return Zi();let n=await Qi(Ri(t)?t:void 0);return n?[n]:void 0}async function Vi(){let e=await J.value;if(!e)return{};let t={};return e.propagation.inject(e.context.active(),t),t}async function Hi(e){let t=await J.value;if(t)return t.propagation.extract(t.context.active(),e)}async function Ui(e,t){if(!e)return t();let n=await J.value;if(!n)return t();let r=await Hi(e);return r?n.context.with(r,async()=>await t()):t()}const J=s(async()=>{try{return await import(`./src-CQuMexnO.js`).then(t=>e(t.t(),1))}catch{return Y.info(`OpenTelemetry not available, tracing will be disabled`),null}}),Wi=s(async()=>{let e=await J.value;return e?e.trace.getTracer(`workflow`):null});async function Gi(e,...t){let[n,r]=await Promise.all([Wi.value,J.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}),Ki(t,r,e),t}finally{e.end()}})}function Ki(e,t,n){!e||!vr.is(e)||(n.setStatus({code:t.SpanStatusCode.OK}),n.setAttributes({...fi(`suspended`),...mi(e.stepCount),...pi(e.hookCount),...hi(e.waitCount)}))}async function qi(e){let[t,n]=await Promise.all([Hi(e),J.value]);if(!(!t||!n))return n.trace.getSpanContext(t)}async function Ji(){return await Xi(e=>e.trace.getActiveSpan())}async function Yi(e){return Xi(t=>t.SpanKind[e])}async function Xi(e){let t=await J.value;if(t)return await e(t)}function Zi(){return Xi(e=>{let t=e.trace.getActiveSpan()?.spanContext();if(t)return[{context:t}]})}async function Qi(e){if(!e)return;let[t,n]=await Promise.all([qi(e),J.value]);if(!(!t||!n)&&n.trace.isSpanContextValid(t))return{context:t}}async function $i(e,t){let n=await J.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 ea(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 ta(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)(dr(`[workflow-sdk]`,i,c)),ea(n,process.env.DEBUG)&&(console.debug(`[${n}] ${i}`,c??``),Ji().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 na=ta(`step`),Y=ta(`runtime`),ra=ta(`webhook`),ia=ta(`events`);ta(`adapter`),ta(`build`,{debugNamespace:`workflow:build`});function aa(e){if(p.is(e))throw e}function X(e,t){let n=e.includes(`return value`)?`returning`:`passing`,r=`Failed to serialize ${e}`;t instanceof D&&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 D&&t.value!==void 0&&Y.error(`Serialization failed`,{context:e,problematicValue:t.value}),{message:r,hint:i}}async function oa(e,t,n){try{let r=H.serialize(e,`client`,n);return lr(await or(U(V.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){aa(e);let{message:t,hint:n}=X(`client value`,e);throw new m(t,{hint:n,cause:e})}}async function sa(e,t,n){let r=await sr(await ur(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(H.deserializeLegacy)return H.deserializeLegacy(r,`client`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=W(r);if(i===V.DEVALUE_V1)return H.deserialize(a,`client`,n);throw Error(`Unsupported serialization format: ${i}`)}async function ca(e,t,n){try{let r=H.serialize(e,`step`,n);return lr(await or(U(V.DEVALUE_V1,r),n?.compression===!0,n?.compressionStats),t)}catch(e){aa(e);let{message:t,hint:n}=X(`step value`,e);throw new m(t,{hint:n,cause:e})}}async function la(e,t,n){let r=await sr(await ur(e,t),n?.compressionStats);if(!(r instanceof Uint8Array)){if(H.deserializeLegacy)return H.deserializeLegacy(r,`step`,n);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:i,payload:a}=W(r);if(i===V.DEVALUE_V1)return H.deserialize(a,`step`,n);throw Error(`Unsupported serialization format: ${i}`)}function ua(e,t){if(!(e instanceof Uint8Array)){if(H.deserializeLegacy)return H.deserializeLegacy(e,`workflow`,t);throw Error(`Cannot deserialize non-binary data without legacy support`)}let{format:n,payload:r}=W(e);if(n===V.DEVALUE_V1)return H.deserialize(r,`workflow`,t);throw Error(`Unsupported serialization format: ${n}`)}const da=Symbol.for(`WORKFLOW_STEP_CONTEXT_STORAGE`),fa=globalThis[da]??(globalThis[da]=new se);function pa(e,t,n){if(e===0&&t===0&&n===0)return null;let r=[];e>0&&r.push(`${e} ${a(`step`,`steps`,e)}`),t>0&&r.push(`${t} ${a(`hook`,`hooks`,t)}`),n>0&&r.push(`${n} ${a(`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 o=i.join(` and `);return`${r.join(` and `)} to be enqueued\n Workflow will suspend and resume when ${o}`}function ma(e,t){let n=`${e.replace(`wrun_`,`strm_`)}_user`;return t?`${n}_${Buffer.from(t,`utf-8`).toString(`base64url`)}`:n}function ha(e){return`strm_${e}_system_abort`}function ga(e){if(!e.startsWith(`abrt_`))throw Error(`Invalid abort hook token format: expected "abrt_" prefix, got "${e}"`);return ha(e.slice(5))}const _a=()=>re(`WORKFLOW_DEFERRED_CHECK_DELAY_MS`,100,{integer:!0,min:10});var Z;(function(e){e[e.Consumed=0]=`Consumed`,e[e.NotConsumed=1]=`NotConsumed`,e[e.Finished=2]=`Finished`})(Z||={});var va=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){ia.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=Z.NotConsumed;try{r=n(e)}catch(e){ia.error(`EventConsumer callback threw an error`,{error:e})}if(!(r!==Z.Consumed&&r!==Z.Finished))return e!==null&&this.notifyConsumedEvent(e),this.eventIndex++,r===Z.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))},_a())})}}},ya=class{aborted=!1;reason=void 0;[I];[L];#e=[];#t=null;get onabort(){return this.#t}set onabort(e){this.#t=e,e&&this.aborted&&e.call(this)}constructor(e,t){this[I]=e,this[L]=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 ba(e){return class{signal;[I];[L];constructor(){let t=e.generateUlid(),n=ha(t),r=`abrt_${t}`;this[I]=n,this[L]=r,this.signal=new ya(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 Z.NotConsumed;let n=`eventData`in t&&t.eventData&&`token`in t.eventData?t.eventData.token:void 0;if(typeof n==`string`&&n!==this[L])return e.promiseQueue=e.promiseQueue.then(()=>{e.onWorkflowError(new g(`Replay divergence: abort hook event ${t.eventType} for ${i} belongs to token "${n}", but the current abort hook expects "${this[L]}"`,{eventId:t.eventId}))}),Z.Finished;if(t.eventType===`hook_created`){let t=e.invocationsQueue.get(i);return t&&t.type===`hook`&&(t.hasCreatedEvent=!0),Z.Consumed}if(t.eventType===`hook_received`){let n=t.eventData?.payload;return e.pendingDeliveries++,e.promiseQueue=e.promiseQueue.then(async()=>{let t;try{if(n!==void 0)try{let r=await po(n,e.runId,e.encryptionKey,e.globalThis);r&&typeof r==`object`&&`reason`in r&&(t=r.reason)}catch{}this.signal._setAborted(t)}finally{e.pendingDeliveries--}}),e.invocationsQueue.delete(i),Z.Consumed}return t.eventType===`hook_disposed`?(e.invocationsQueue.delete(i),Z.Finished):Z.NotConsumed})}abort(t){if(!this.signal.aborted){this.signal._setAborted(t);for(let[,n]of e.invocationsQueue)if(n.type===`hook`&&n.token===this[L]){n.abortRequested=!0,n.abortReason=t;break}}}}}function xa(){return{abort(e){let t=new ya(``,``);return t._setAborted(e??new DOMException(`The operation was aborted.`,`AbortError`)),t},any(e){let t=new ya(``,``),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 Sa=ee();function Ca(e){try{return e.getReader({mode:`byob`}).releaseLock(),`bytes`}catch{}}function wa(e){return aa(e),e instanceof m&&e.cause!==void 0||e instanceof _&&e.cause!==void 0?e.cause:e}async function Q(e,t){if(e.recorded)try{let n=await Ji();if(!n)return;let r=e.uncompressedBytes??0,i=e.storedBytes??0;n.setAttributes({...wi(t),...Ti(e.compressed??!1),...Ei(e.codec??`none`),...Di(r),...Oi(i),...e.compressed&&r>0?ki(1-i/r):{}})}catch{}}function Ta(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 cr(t),!0);let o=k(i,e),s=n.encode(o),c=U(V.DEVALUE_V1,s);if(r.key){let e=await $t(r.key,c);c=U(V.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}=X(`stream chunk`,e);a.error(new m(t,{hint:n,cause:e}))}}})}function Ea(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 cr(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}=W(o);if(s===V.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 en(i.key,c)}catch(e){throw p.is(e)&&e.context&&(e.context.formatPrefix=s),e}({format:s,payload:c}=W(e))}if(s===V.DEVALUE_V1){let t=n.decode(c);a.enqueue(qt(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(`
|
|
20
|
+
`);for(let t of s)t.length>0&&i.enqueue(qt(t,e))},async flush(e){r.length>0&&await o(e)}})}const Da=1e8;function Oa(){return new TransformStream({transform(e,t){if(e.length===0)return;if(e.length>Da){t.error(new _(`Byte-stream chunk of ${e.length} bytes exceeds the maximum framed chunk size (${Da}). 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 ka(){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>Da){r.error(new _(`Byte-stream frame length ${t} exceeds maximum (${Da}). 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 _(`Byte-stream ended with ${e.length} bytes of incomplete frame data. The stream was truncated mid-frame.`,{slug:`serialization-failed`}))}})}var Aa=class extends ReadableStream{#e;constructor(e,t,n){if(typeof t!=`string`||t.length===0)throw new _(`"name" is required, got "${t}"`);super({type:`bytes`,pull:async r=>{let i=this.#e;if(!i){let r=await(await M()).streams.get(e,t,n);i=this.#e=r.getReader()}if(!i){r.error(Error(`Failed to get reader`));return}let a=await i.read();a.done?(this.#e=void 0,r.close()):r.enqueue(a.value)},cancel:async e=>{this.#e&&=(await this.#e.cancel(e).catch(()=>{}),void 0)}})}};const ja=()=>re(`WORKFLOW_FRAMED_STREAM_MAX_RECONNECTS`,50,{integer:!0,min:1}),Ma=()=>re(`WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS`,1e3,{integer:!0,min:1});function Na(e,t,n){let r=n===void 0||n>=0,i=n??0,a=0,o=0,s=0,c,l=new Uint8Array;async function u(){let o=await M(),s=r?i+a:n;c=(await o.streams.get(e,t,s)).getReader()}async function d(){c&&=(await c.cancel().catch(()=>{}),void 0),i+=a,a=0,l=new Uint8Array;let e=ja(),n=Ma();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 u();return}catch{}}}return new ReadableStream({pull:async e=>{for(;;){if(!c)try{await u()}catch(t){e.error(t);return}let t;try{t=await c.read()}catch(t){if(!r){e.error(t);return}try{await d()}catch(t){e.error(t);return}continue}if(t.done||!t.value){c=void 0,e.close();return}let n=t.value;if(n.length>0){let e=new Uint8Array(l.length+n.length);e.set(l,0),e.set(n,l.length),l=e}let i=!1;for(;l.length>=4;){let t=4+new DataView(l.buffer,l.byteOffset,l.byteLength).getUint32(0,!1);if(l.length<t)break;e.enqueue(l.slice(0,t)),l=l.slice(t),a++,i=!0}if(i){o=0;return}}},cancel:async()=>{c&&=(await c.cancel().catch(e=>{console.warn(`Error closing ReadableStream reader:`,e)}),void 0)}})}const Pa=()=>re(`WORKFLOW_STREAM_FLUSH_INTERVAL_MS`,10,{integer:!0});var $=class extends WritableStream{constructor(e,t,n){if(typeof e!=`string`)throw new _(`"runId" must be a string, got "${typeof e}"`);if(typeof t!=`string`||t.length===0)throw new _(`"name" is required, got "${t}"`);let r=M(),i=n,a=async()=>{if(i){try{await i}catch{}i=void 0}},o=[],s=null,c=null,l,u=async()=>{if(s&&=(clearTimeout(s),null),o.length===0)return;await a();let n=o.slice(),i=await r;if(l===void 0&&(l=i.streamFlushIntervalMs??Pa()),typeof i.streams.writeMulti==`function`&&n.length>1)await i.streams.writeMulti(e,t,n);else for(let r of n)await i.streams.write(e,t,r);o=[]},d=[],f=()=>{s||=setTimeout(()=>{s=null;let e=d;d=[],c=u().then(()=>{for(let t of e)t.resolve()},t=>{for(let n of e)n.reject(t)})},l??Pa())};super({async write(e){c&&=(await c,null),o.push(e),f(),await new Promise((e,t)=>{d.push({resolve:e,reject:t})})},async close(){c&&=(await c,null),await u(),await a(),await(await r).streams.close(e,t)},abort(e){s&&=(clearTimeout(s),null),o=[];let t=d;d=[];let n=e??Error(`Stream aborted`);for(let e of t)e.reject(n)}})}};function Fa(e=globalThis){return{...An(),...zn(),...Ln(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[Sn];return r&&(n.responseWritable=r),t.signal&&(t.signal.aborted||t.signal[I])&&(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}:!1}}function Ia(e,t,n,r,i,a){let o=t[I],s=t[L];if(!o){let e=(n[vn]||Sa)();o=ha(e),s=`abrt_${e}`,t[I]=o,t[L]=s,t.signal&&(t.signal[I]=o,t.signal[L]=s)}return Ra(e,o,i,a,r),{streamName:o,hookToken:s,aborted:e.aborted,reason:e.aborted?e.reason:void 0}}function La(e,t){let n=t[I]??t.signal?.[I],r=t[L]??t.signal?.[L];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 Ra(e,t,n,r,i){e.aborted||e[wn]||(e[wn]=!0,e.addEventListener(`abort`,()=>{i.push((async()=>{try{let i=await cr(r),a=await ao({aborted:!0,reason:e.reason},n,i),o=new $(n,t).getWriter();await o.write(a),await o.close()}catch{}})())},{once:!0}))}function za(e=globalThis,t,n,r,i=!1,a){return{...Fa(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new m(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=`strm_${(e[vn]||Sa)()}`,c=Ca(o),l=new $(n,s,a);c===`bytes`?i?t.push(o.pipeThrough(Oa()).pipeTo(l)):t.push(o.pipeTo(l)):t.push(o.pipeThrough(Ta(za(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[N],a=r[P];if(typeof i==`string`&&typeof a==`string`){let e={name:i,runId:a},t=r[F];return typeof t==`string`&&(e.deploymentId=t),e}let o=`strm_${(e[vn]||Sa)()}`,s=new Aa(n,o);return t.push(s.pipeTo(r)),{name:o}},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Ia(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Ia(i,i,e,t,n,r)}}function Ba(e=globalThis){return{...Fa(e),ReadableStream:t=>{if(!(t instanceof e.ReadableStream))return!1;let n=t[xn];if(n!==void 0)return{bodyInit:n};let r=t[N];if(!r)throw new _("ReadableStream `name` is not set");let i={name:r},a=t[yn];a&&(i.type=a);let o=t[bn];return o&&(i.framing=o),i},WritableStream:t=>{if(!(t instanceof e.WritableStream))return!1;let n=t[N];if(!n)throw new _("WritableStream `name` is not set");let r={name:n},i=t[P];typeof i==`string`&&(r.runId=i);let a=t[F];return typeof a==`string`&&(r.deploymentId=a),r},AbortController:t=>{if(!t||!t.signal)return!1;let n=t,r=n[I]??n.signal?.[I],i=e.AbortController&&typeof e.AbortController==`function`&&t instanceof e.AbortController;return!r&&!i?!1:La(t.signal,n)},AbortSignal:t=>{let n=t?.[I],r=e.AbortSignal&&typeof e.AbortSignal==`function`&&t instanceof e.AbortSignal;return!n&&!r?!1:La(t,t)}}}function Va(e=globalThis,t,n,r,i=!1,a){return{...Fa(e),ReadableStream:o=>{if(!(o instanceof e.ReadableStream))return!1;if(o.locked)throw new m(`ReadableStream is locked and cannot be passed across a workflow boundary.`,{hint:`Pass the stream before calling .getReader() / .pipeThrough() / .pipeTo(), or tee it with .tee() and pass one of the branches.`});let s=o[N],c=o[yn],l=o[bn];if(!s){s=`strm_${(e[vn]||Sa)()}`,c=Ca(o),l=c===`bytes`&&i?`framed-v1`:l;let u=new $(n,s,a);c===`bytes`?l===`framed-v1`?t.push(o.pipeThrough(Oa()).pipeTo(u)):t.push(o.pipeTo(u)):t.push(o.pipeThrough(Ta(Va(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[N],o=i[P];a||(a=`strm_${(e[vn]||Sa)()}`,t.push(new Aa(n,a).pipeThrough(Ea(Qa(e,t,n,r),r)).pipeTo(i)));let s={name:a};typeof o==`string`&&(s.runId=o);let c=i[F];return typeof c==`string`&&(s.deploymentId=c),s},AbortController:i=>!e.AbortController||typeof e.AbortController!=`function`||!(i instanceof e.AbortController)?!1:Ia(i.signal,i,e,t,n,r),AbortSignal:i=>!e.AbortSignal||typeof e.AbortSignal!=`function`||!(i instanceof e.AbortSignal)?!1:Ia(i,i,e,t,n,r)}}function Ha(...e){let t=new WeakSet;function n(e){let t=e[Tn];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 Ua(e,t,n,r){let i=new AbortController;return r.push((async()=>{try{let r=new Aa(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=fa.getStore(),r=await oo(a.value,t,n?.encryptionKey);e.abort(r?.reason)}catch{e.abort()}}else r.cancel().catch(()=>{})}catch{}})()),i}function Wa(e,t,n){let r=e,i=e.signal;r[I]=t.streamName,r[L]=t.hookToken,i[I]=t.streamName,i[L]=t.hookToken,n&&(r[Tn]=n,i[Tn]=n)}function Ga(e,t){let n=e,r=t;n[I]!==void 0&&(r[I]=n[I]),n[L]!==void 0&&(r[L]=n[L]),n[Tn]!==void 0&&(r[Tn]=n[Tn])}function Ka(e,t,n){let r=new AbortController;e.aborted?(Wa(r,e),r.abort(e.reason)):e.streamName?Wa(r,e,Ua(r,n,e.streamName,t)):Wa(r,e);let i=r.abort.bind(r);return r.abort=t=>{if(r.signal.aborted)return;i(t);let n=fa.getStore();if(n&&(n.ops.push((async()=>{try{let r=await ao({aborted:!0,reason:t},n.workflowMetadata.workflowRunId,n.encryptionKey),i=new $(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-DjPY9VGg.js`).then(e=>e.i);await n(e.hookToken,{aborted:!0,reason:t})}catch{}})();n.preCompletionOps.push(r)}},r}function qa(e,t,n){let r=new AbortController;return e.aborted?(Wa(r,e),r.abort(e.reason)):e.streamName?Wa(r,e,Ua(r,n,e.streamName,t)):Wa(r,e),r.signal}function Ja(e=globalThis){return{...jn(e),...Rn(e)}}async function Ya(e,t){let n=await M();if(!n.getEncryptionKeyForRun)return;let r=t?await n.getEncryptionKeyForRun(e,{deploymentId:t}):await n.getEncryptionKeyForRun(await n.runs.get(e));return r?await Qt(r,[`encrypt`]):void 0}function Xa(e=globalThis,t,n,r){return{...Ja(e),StepFunction:()=>{throw new m(`Step functions cannot be deserialized in client context. Step functions should not be returned from workflows.`,{hint:`A step function reference reached the client. Return a serializable value (e.g. the step result) instead of the step itself.`})},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Request:t=>{let n={method:t.method,headers:new e.Headers(t.headers),body:t.body,duplex:t.duplex};t.signal&&(n.signal=t.signal);let r=new e.Request(t.url,n);return t.signal&&Ga(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 Aa(n,i.name,i.startIndex),a=A();t.push(a.promise);let{readable:o,writable:s}=i.framing===`framed-v1`?ka():new e.TransformStream;return j(r,s,a).catch(()=>{}),on(o,a),o}else{let a=Na(n,i.name,i.startIndex),o=Ea(Xa(e,t,n,r),r),s=A();return t.push(s.promise),j(a,o.writable,s).catch(()=>{}),on(o.readable,s),o.readable}},WritableStream:i=>{let a=typeof i.runId==`string`?i.runId:n,o=a===n?r:Ya(a,i.deploymentId),s=Ta(za(e,t,a,o),o),c=new $(a,i.name),l=A();return t.push(l.promise),j(s.readable,c,l).catch(()=>{}),an(s.writable,l),Object.defineProperty(s.writable,N,{value:i.name,writable:!1}),Object.defineProperty(s.writable,P,{value:a,writable:!1}),typeof i.deploymentId==`string`&&Object.defineProperty(s.writable,F,{value:i.deploymentId,writable:!1}),s.writable},AbortController:e=>Ka(e,t,n),AbortSignal:e=>qa(e,t,n)}}function Za(e=globalThis){return{...Ja(e),...Bn(e),Request:t=>{Object.setPrototypeOf(t,e.Request.prototype);let n=t.responseWritable;return n&&(t[Sn]=n,delete t.responseWritable,t.respondWith=()=>{throw new m("`respondWith()` must be called from within a step function.",{hint:'Move the `respondWith(...)` call inside a `"use step"` function — it cannot be invoked from a workflow context.'})}),t},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Response:t=>(Object.setPrototypeOf(t,e.Response.prototype),t),ReadableStream:t=>`bodyInit`in t?Object.create(e.ReadableStream.prototype,{[xn]:{value:t.bodyInit,writable:!1}}):Object.create(e.ReadableStream.prototype,{[N]:{value:t.name,writable:!1},[yn]:{value:t.type,writable:!1},[bn]:{value:t.framing,writable:!1}}),WritableStream:t=>{let n={[N]:{value:t.name,writable:!1}};return typeof t.runId==`string`&&(n[P]={value:t.runId,writable:!1}),typeof t.deploymentId==`string`&&(n[F]={value:t.deploymentId,writable:!1}),Object.create(e.WritableStream.prototype,n)},AbortController:e=>{let t=new ya(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),{[I]:e.streamName,[L]:e.hookToken,signal:t,abort:()=>{}}},AbortSignal:e=>{let t=new ya(e.streamName,e.hookToken);return e.aborted&&t._setAborted(e.reason),t}}}function Qa(e=globalThis,t,n,r,i){return{...Ja(e),StepFunction:e=>{let t=e.stepId,n=e.closureVars,r=`boundThis`in e,i=r?e.boundThis:void 0,a=Array.isArray(e.boundArgs)?e.boundArgs:[],o=ae(t);if(!o)throw new m(`Step function "${t}" not found. Make sure the step function is registered.`,{hint:`Make sure the step file is included in your build (i.e. it is listed in the workflow manifest), and that the SWC plugin is configured for the file.`});if(!n&&!r&&a.length===0)return o;let s=function(...e){let t=r?i:this,s=a.length>0?[...a,...e]:e;if(n){let e=fa.getStore();if(!e)throw new _(`Cannot call step function with closure variables outside step context`);let r={...e,closureVars:n};return fa.run(r,()=>o.apply(t,s))}return o.apply(t,s)};return Object.defineProperty(s,"name",{value:o.name}),Object.defineProperty(s,"stepId",{value:t,writable:!1,enumerable:!1,configurable:!1}),o.maxRetries!==void 0&&(s.maxRetries=o.maxRetries),s},WorkflowFunction:e=>Object.assign(()=>{throw new m(`Workflow functions cannot be called directly. Use start() to invoke them.`,{hint:"Wrap the workflow with `start(workflowFn, { ... })` from `workflow` to begin a run instead of invoking it like a normal function."})},{workflowId:e.workflowId}),Request:t=>{let n=t.responseWritable,r={method:t.method,headers:new e.Headers(t.headers),body:t.body,duplex:t.duplex};t.signal&&(r.signal=t.signal);let i=new e.Request(t.url,r);return t.signal&&Ga(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:a=>{if(`bodyInit`in a){let t=a.bodyInit;return new e.Response(t).body}let o=new Aa(n,a.name);if(a.type===`bytes`){let n=A();t.push(n.promise);let{readable:r,writable:i}=a.framing===`framed-v1`?ka():new e.TransformStream;return j(o,i,n).catch(()=>{}),on(r,n),r}else{let a=Ea(Qa(e,t,n,r,i),r),s=A();return t.push(s.promise),j(o,a.writable,s).catch(()=>{}),on(a.readable,s),a.readable}},WritableStream:a=>{let o=typeof a.runId==`string`?a.runId:n,s=typeof a.deploymentId==`string`?a.deploymentId:o===n?i:void 0,c=o===n?r:Ya(o,s),l=Ta(Va(e,t,o,c),c),u=new $(o,a.name),d=A();return t.push(d.promise),j(l.readable,u,d).catch(()=>{}),an(l.writable,d),Object.defineProperty(l.writable,N,{value:a.name,writable:!1}),Object.defineProperty(l.writable,P,{value:o,writable:!1}),s&&Object.defineProperty(l.writable,F,{value:s,writable:!1}),l.writable},AbortController:e=>Ka(e,t,n),AbortSignal:e=>qa(e,t,n)}}async function $a(e,t){return await lr(e,t)}async function eo(e,t){return ur(e,t)}async function to(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1){if(a)return Nn(k(e,za(i,r,t,n,o)));try{let a={},c=await oa(e,n,{global:i,extraReducers:ho(za(i,r,t,n,o)),compression:s,compressionStats:a});return await Q(a,`serialize`),c}catch(e){let t=wa(e),{message:n,hint:r}=X(`workflow arguments`,t);throw new m(n,{hint:r,cause:t})}}async function no(e,t,n,r=globalThis,i={}){let a={},o=await sr(await eo(e,n),a);return await Q(a,`deserialize`),ua(o,{global:r,extraRevivers:{...go(Za(r)),...i}})}async function ro(e,t,n,r=globalThis,i=!1,a=!1){if(i)return Nn(k(e,Ba(r)));try{let t={},i=await ca(e,n,{global:r,extraReducers:ho(Ba(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=wa(e),{message:n,hint:r}=X(`workflow return value`,t);throw new m(n,{hint:r,cause:t})}}async function io(e,t,n,r=[],i=globalThis,a={}){let o={},s=await sa(e,n,{global:i,extraRevivers:{...go(Xa(i,r,t,n)),...a},compressionStats:o});return await Q(o,`deserialize`),s}async function ao(e,t,n,r=globalThis,i=!1,a=!1){if(i)return Nn(k(e,Ba(r)));try{let t={},i=await ca(e,n,{global:r,extraReducers:ho(Ba(r)),compression:a,compressionStats:t});return await Q(t,`serialize`),i}catch(e){let t=wa(e),{message:n,hint:r}=X(`step arguments`,t);throw new m(n,{hint:r,cause:t})}}async function oo(e,t,n,r=[],i=globalThis,a={},o){let s={},c=await la(e,n,{global:i,extraRevivers:{...go(Qa(i,r,t,n,o)),...a},compressionStats:s});return await Q(s,`deserialize`),c}async function so(e,t,n,r=[],i=globalThis,a=!1,o=!1,s=!1,c){if(a)return Nn(k(e,Va(i,r,t,n,o,c)));try{let a={},l=await ca(e,n,{global:i,extraReducers:ho(Va(i,r,t,n,o,c)),compression:s,compressionStats:a});return await Q(a,`serialize`),l}catch(e){let t=wa(e),{message:n,hint:r}=X(`step return value`,t);throw new m(n,{hint:r,cause:t})}}async function co(e,t,n,r=[],i=globalThis,a=!1){try{let o=k(e,Va(i,r,t,n)),s=new TextEncoder().encode(o),c=U(V.DEVALUE_V1,s),l={},u=await $a(await or(c,a,l),n);return await Q(l,`serialize`),u}catch(e){let t=wa(e),{message:n,hint:r}=X(`step error`,t);throw new m(n,{hint:r,cause:t})}}async function lo(e,t,n,r=globalThis,i={}){let a={},o=await sr(await eo(e,n),a);if(await Q(a,`deserialize`),!(o instanceof Uint8Array))return Jt(o,{...Za(r),...i});let{format:s,payload:c}=W(o);if(s===V.DEVALUE_V1)return qt(new TextDecoder().decode(c),{...Za(r),...i});throw Error(`Unsupported serialization format: ${s}`)}async function uo(e,t,n,r=globalThis,i=!1){try{let t=k(e,Ba(r)),a=new TextEncoder().encode(t),o=U(V.DEVALUE_V1,a),s={},c=await $a(await or(o,i,s),n);return await Q(s,`serialize`),c}catch(e){let t=wa(e),{message:n,hint:r}=X(`run error`,t);throw new m(n,{hint:r,cause:t})}}async function fo(e,t,n,r=[],i=globalThis,a={}){let o={},s=await sr(await eo(e,n),o);if(await Q(o,`deserialize`),!(s instanceof Uint8Array))return Jt(s,{...Xa(i,r,t,n),...a});let{format:c,payload:l}=W(s);if(c===V.DEVALUE_V1)return qt(new TextDecoder().decode(l),{...Xa(i,r,t,n),...a});throw Error(`Unsupported serialization format: ${c}`)}async function po(e,t,n,r=globalThis,i={}){let a={},o=await sr(await eo(e,n),a);return await Q(a,`deserialize`),ua(o,{global:r,extraRevivers:{...go(Za(r)),...i}})}const mo=[`ReadableStream`,`WritableStream`,`Request`,`Response`,`StepFunction`,`AbortController`,`AbortSignal`];function ho(e){let t={};for(let n of mo)n in e&&(t[n]=e[n]);return t}function go(e){let t={};for(let n of mo)n in e&&(t[n]=e[n]);return t}const _o=[{format:V.ENCRYPTED,minVersion:`4.2.0-beta.64`},{format:V.GZIP,minVersion:`5.0.0-beta.18`},{format:V.ZSTD,minVersion:`5.0.0-beta.18`}],vo=[{capability:`framedByteStreams`,minVersion:`5.0.0-beta.15`}],yo=new Set([V.DEVALUE_V1]);function bo(e){if(!e||!Zt.default.valid(e))return{supportedFormats:yo,framedByteStreams:!1};let t=new Set(yo);for(let{format:n,minVersion:r}of _o)Zt.default.gte(e,r)&&t.add(n);let n={supportedFormats:t,framedByteStreams:!1};for(let{capability:t,minVersion:r}of vo)Zt.default.gte(e,r)&&(n[t]=!0);return n}const xo=`5.0.0-beta.28`,So=/^[a-zA-Z0-9_\-./@]+$/;function Co(e,t){if(!So.test(e))throw Error(`Invalid workflow name "${e}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, or at signs`);return`${te(`workflow`,y(t))}${e}`}const wo=ee();function To(e){return`__health_check__${e}`}function Eo(e){let t=ne.safeParse(e);if(t.success)return t.data}function Do(e){return`wrun_hc_${e}`}async function Oo(e,t,n){let r=await M(),i=To(e.correlationId),a=JSON.stringify({healthy:!0,endpoint:t,correlationId:e.correlationId,specVersion:n??5,workflowCoreVersion:xo,timestamp:Date.now()}),o=Do(e.correlationId);await r.streams.write(o,i,a),await r.streams.close(o,i)}async function ko(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 Ao(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 jo(e,t,n){let r=n?.timeout??3e4,i=wo(),a=To(i),o=`${te(t,y(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=(await e.streams.get(Do(i),a)).getReader(),{chunks:n,timedOut:r}=await ko(t,500);if(r){try{t.cancel()}catch{}await new Promise(e=>setTimeout(e,100));continue}let o=Ao(n);if(o)return{...o,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 Mo(e,t){return new u(`Event pagination ${t} for workflow run "${e}".`,{code:l.WORLD_CONTRACT_ERROR})}function No(e,t,n){if(t){if(n.has(t))throw Mo(e,`did not advance`);n.add(t)}}function Po(e,t,n){for(let r of n)t.has(r.eventId)||(t.add(r.eventId),e.push(r))}function Fo(e,t,n,r){if(t){if(n===null)throw Mo(e,`returned more pages without a cursor`);if(r.has(n))throw Mo(e,`repeated a cursor`)}}function Io(e,t,n){return t!==null&&!n&&u.is(e)&&e.status===400}async function Lo(e,t){let n=t!==void 0;return Gi(n?`workflow.loadNewEvents`:`workflow.loadEvents`,async r=>{r?.setAttributes({...Sr(e)});let i=[],a=new Set,o=new Set,s=t??null,c=!0,l=0,u=!1,d=await M(),f=Date.now();for(;c;){let t=Date.now(),r=s;No(e,r,o);let f;try{f=await d.events.list({runId:e,pagination:{sortOrder:`asc`,cursor:r??void 0}})}catch(t){if(Io(t,r,u)){Y.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}Po(i,a,f.data),c=f.hasMore,Fo(e,c,f.cursor,o),s=f.cursor??s,l++,Y.debug(`Loaded event page`,{workflowRunId:e,incremental:n,page:l,pageEvents:f.data.length,totalEvents:i.length,hasMore:c,pageMs:Date.now()-t})}return Y.debug(`Event load complete`,{workflowRunId:e,incremental:n,totalEvents:i.length,pagesLoaded:l,totalMs:Date.now()-f}),r?.setAttributes({...Tr(i.length),...bi(l)}),{events:i,cursor:s}})}const Ro={"Access-Control-Allow-Origin":`*`,"Access-Control-Allow-Methods":`POST, OPTIONS, GET, HEAD`,"Access-Control-Allow-Headers":`Content-Type`};function zo(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:Ro}):new Response(JSON.stringify({healthy:!0,endpoint:r.pathname,specVersion:t??5,workflowCoreVersion:xo}),{status:200,headers:{"Content-Type":`application/json`,...Ro}}):await e(n)}}async function Bo(e,...t){let n=t[0];await Gi(`queue.publish`,{attributes:{...ri(`vercel-queue`),...ii(n),...oi(`publish`),...Ai(`vercel-queue`),...ji(`vercel-queue`),...Mi(`vqs`),...Ni(`publish`)},kind:await Yi(`PRODUCER`)},async n=>{let{messageId:r}=await e.queue(...t);r&&n?.setAttributes(ai(r))})}function Vo(e){if(e.requestedAt)try{return si(Date.now()-e.requestedAt.getTime())}catch{return}}function Ho(e,t){let n;return()=>(n||=(async()=>{let n=await e.getEncryptionKeyForRun?.(t);return n?await Qt(n):void 0})(),n)}function Uo(t){import(`./functions-CnVBREsg.js`).then(t=>e(t.default,1)).then(({waitUntil:e})=>{e(t)})}function Wo(e,t){Uo(e.catch(e=>{if(!(e?.name===`AbortError`||e?.name===`ResponseAborted`))try{t(e)}catch{}}))}async function Go(e){let t=e();return Uo(t.catch(()=>{})),t}function Ko(e,t={}){if(typeof e!=`object`||!e||Array.isArray(e))throw new h(`experimental_setAttributes requires a plain object, got ${e===null?`null`:Array.isArray(e)?`array`:typeof e}`);let n=Object.entries(e).map(([e,t])=>({key:e,value:t===void 0?null:t}));if(n.length===0)return n;let r=t.allowReservedAttributes===!0;try{ie(n,{allowReservedAttributes:r})}catch(e){throw e instanceof v?new h(e.message):e}return n}export{ci as $,yr as $t,no as A,Ae as An,Gr as At,Y as B,Br as Bt,za as C,Qt as Cn,Hr as Ct,oo as D,Pe as Dn,ni as Dt,fo as E,Me as En,ti as Et,va as F,Tr as Ft,Yi as G,Sr as Gt,ra as H,zr as Ht,pa as I,Fr as It,Qi as J,Pr as Jt,Li as K,Cr as Kt,ga as L,br as Lt,xa as M,Ee as Mn,Nr as Mt,ba as N,Oe as Nn,Mr as Nt,lo as O,Fe as On,Jr as Ot,Z as P,jr as Pt,$i as Q,Ir as Qt,ma as R,xr as Rt,ro as S,an as Sn,Kr as St,Ta as T,Ne as Tn,ei as Tt,Bi as U,Vr as Ut,na as V,Rr as Vt,zi as W,Lr as Wt,Gi as X,Or as Xt,Vi as Y,kr as Yt,Ui as Z,Ar as Zt,uo as _,dn as _n,Wr as _t,Co as a,xn as an,li as at,so as b,A as bn,$r as bt,Lo as c,F as cn,_i as ct,Bo as d,hn as dn,oi as dt,vr as en,Fi as et,zo as f,_n as fn,ri as ft,Ha as g,fn as gn,Yr as gt,$ as h,pn as hn,Ci as ht,Vo as i,kn as in,ui as it,io as j,De as jn,Er as jt,po as k,ke as kn,qr as kt,Ho as l,P as ln,ii as lt,bo as m,gn as mn,Si as mt,Wo as n,Dn as nn,yi as nt,Oo as o,vn as on,gi as ot,xo as p,mn as pn,xi as pt,Ri as q,wr as qt,Go as r,On as rn,di as rt,jo as s,N as sn,vi as st,Ko as t,V as tn,Pi as tt,Eo as u,Sn as un,ai as ut,ao as v,M as vn,Qr as vt,Xa as w,je as wn,Xr as wt,to as x,j as xn,Ur as xt,co as y,sn as yn,Zr as yt,fa as z,Dr as zt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,t}from"./chunk-BHKSVoKr.js";function n(e,t
|
|
1
|
+
import{a as e,t}from"./chunk-BHKSVoKr.js";function n(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 r(e){return n(`workflow`,e)}function i(e){return n(`step`,e)}function a(e){return u(i(e),e)}function o(e){return u(r(e),e)}function s(e){return r(e)?.shortName??l(`workflow`,e)??e}function c(e){return i(e)?.shortName??l(`step`,e)??e}function l(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 u(e,t){return e?`${e.shortName} (${e.moduleSpecifier})`:t}function d(e,t,n){return n===1?e:t}function f(){let e,t;return{promise:new Promise((n,r)=>{e=n,t=r}),resolve:e,reject:t}}function p(e){let t={get value(){let n=e();return Object.defineProperty(t,"value",{value:n}),n}};return t}var m=e(t(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}}))(),1);function h(e){if(typeof e==`string`){let t=(0,m.default)(e);if(typeof t!=`number`||t<0)throw Error(`Invalid duration: "${e}". Expected a valid duration string like "1s", "1m", "1h", etc.`);return new Date(Date.now()+t)}else if(typeof e==`number`){if(e<0||!Number.isFinite(e))throw Error(`Invalid duration: ${e}. Expected a non-negative finite number of milliseconds.`);return new Date(Date.now()+e)}else if(e instanceof Date||e&&typeof e==`object`&&typeof e.getTime==`function`)return e instanceof Date?e:new Date(e.getTime());else throw Error(`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.`)}const g=`/.well-known/workflow/v1`,_=Symbol.for(`@workflow/core/basePath`),v=globalThis;function y(e){v[_]=e??``}function b(){return v[_]??``}function x(e){return new URL(e),`${e.replace(/[?#].*$/,``).replace(/\/+$/,``)}${b()}`}function S(e,t){let n=new URL(e);return n.pathname=`${n.pathname.replace(/\/+$/,``)}${g}/${C(t)}`,n.search=t.type===`health`?`__health`:``,n.hash=``,n.toString()}function C(e){switch(e.type){case`flow`:case`health`:return`flow`;case`step`:return`step`;case`manifest`:return`manifest.json`;case`webhook`:return`webhook/${encodeURIComponent(e.token)}`}return e}function w(){return`${b()}${g}/flow?__health`}export{y as a,f as c,o as d,i as f,s as h,S as i,d as l,c as m,x as n,h as o,r as p,w as r,p as s,g as t,a as u};
|