eve 0.27.13 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/dist/src/channel/adapter.d.ts +5 -5
- package/dist/src/channel/session.d.ts +2 -2
- package/dist/src/channel/types.d.ts +16 -6
- package/dist/src/chunks/{use-eve-agent-CWYe-vqE.js → use-eve-agent-CyDt3Lny.js} +92 -1
- package/dist/src/chunks/{use-eve-agent-CsSQOKnp.js → use-eve-agent-DaH3cf8K.js} +92 -1
- package/dist/src/cli/commands/agent-prompt/collect-intent.md +1 -1
- package/dist/src/cli/commands/channels.d.ts +0 -17
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/deploy.js +1 -1
- package/dist/src/cli/commands/extension-init.js +1 -1
- package/dist/src/cli/commands/init.js +1 -1
- package/dist/src/cli/commands/integration-connect.d.ts +29 -0
- package/dist/src/cli/commands/integration-connect.js +1 -0
- package/dist/src/cli/commands/integration-setup.d.ts +2 -3
- package/dist/src/cli/commands/integration-setup.js +1 -1
- package/dist/src/cli/commands/register-integration-commands.js +1 -1
- package/dist/src/cli/commands/registry-setup-command.d.ts +13 -3
- package/dist/src/cli/commands/registry-setup-command.js +2 -1
- package/dist/src/cli/commands/registry.d.ts +35 -1
- package/dist/src/cli/commands/registry.js +1 -1
- package/dist/src/cli/commands/trace.js +1 -1
- package/dist/src/cli/dev/tui/agent-header.js +1 -1
- package/dist/src/cli/dev/tui/prompt-command-handler.js +1 -1
- package/dist/src/cli/dev/tui/prompt-commands.d.ts +1 -1
- package/dist/src/cli/dev/tui/prompt-commands.js +1 -1
- package/dist/src/cli/dev/tui/remote-auth-command.js +1 -1
- package/dist/src/cli/dev/tui/runner.d.ts +8 -7
- package/dist/src/cli/dev/tui/runner.js +1 -1
- package/dist/src/cli/dev/tui/setup-commands.d.ts +8 -13
- package/dist/src/cli/dev/tui/setup-commands.js +3 -2
- package/dist/src/cli/dev/tui/setup-flow.d.ts +14 -5
- package/dist/src/cli/dev/tui/setup-panel.d.ts +5 -1
- package/dist/src/cli/dev/tui/setup-panel.js +2 -2
- package/dist/src/cli/dev/tui/status-line.d.ts +1 -1
- package/dist/src/cli/dev/tui/status-line.js +1 -1
- package/dist/src/cli/dev/tui/subagent-pump.d.ts +8 -2
- package/dist/src/cli/dev/tui/subagent-pump.js +1 -1
- package/dist/src/cli/dev/tui/terminal-renderer.d.ts +2 -5
- package/dist/src/cli/dev/tui/terminal-renderer.js +12 -12
- package/dist/src/cli/dev/tui/test/fake-setup-flow-renderer.js +1 -1
- package/dist/src/cli/dev/tui/tui-prompter.js +1 -1
- package/dist/src/cli/dev/tui/tui.d.ts +2 -0
- package/dist/src/cli/dev/tui/tui.js +1 -1
- package/dist/src/cli/dev/tui/vercel-status.d.ts +1 -6
- package/dist/src/cli/dev/tui/vercel-status.js +1 -1
- package/dist/src/cli/invoke/result.d.ts +15 -0
- package/dist/src/cli/invoke/result.js +1 -1
- package/dist/src/cli/option-parsers.d.ts +11 -0
- package/dist/src/cli/option-parsers.js +1 -0
- package/dist/src/cli/run.d.ts +1 -12
- package/dist/src/cli/run.js +3 -3
- package/dist/src/cli/shutdown.d.ts +2 -0
- package/dist/src/cli/shutdown.js +1 -1
- package/dist/src/client/eve-agent-store.d.ts +7 -4
- package/dist/src/client/eve-agent-store.js +1 -1
- package/dist/src/client/index.d.ts +3 -3
- package/dist/src/client/index.js +1 -1
- package/dist/src/client/message-action-parts.js +1 -1
- package/dist/src/client/message-reducer-types.d.ts +5 -3
- package/dist/src/client/message-response.d.ts +4 -4
- package/dist/src/client/ndjson.d.ts +3 -3
- package/dist/src/client/open-stream.d.ts +2 -2
- package/dist/src/client/output-schema.d.ts +2 -2
- package/dist/src/client/reducer.d.ts +2 -2
- package/dist/src/client/session-utils.d.ts +5 -5
- package/dist/src/client/session.d.ts +2 -2
- package/dist/src/client/types.d.ts +2 -2
- package/dist/src/compiled/.vendor-stamp.json +5 -5
- package/dist/src/compiled/@workflow/core/index.js +1 -1
- package/dist/src/compiled/@workflow/core/private.d.ts +21 -5
- package/dist/src/compiled/@workflow/core/private.js +1 -1
- package/dist/src/compiled/@workflow/core/runtime/world.d.ts +10 -5
- package/dist/src/compiled/@workflow/core/runtime.js +3 -3
- package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +2 -2
- package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
- package/dist/src/compiled/@workflow/core/workflow.js +1 -1
- package/dist/src/compiled/@workflow/world-local/index.js +3 -3
- package/dist/src/compiled/@workflow/world-vercel/index.js +13 -13
- package/dist/src/compiled/_chunks/workflow/{attribute-changes-DeZc2RZz.js → attribute-changes-1LmTKuTT.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{private-Cre8uYkA.js → private-BcwCGTV5.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{resume-hook-ip1hbn1b.js → resume-hook-D1_5NCZ6.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/{run-CWytxfIp.js → run-C240Ctf4.js} +1 -1
- package/dist/src/compiled/_chunks/workflow/sleep-De802yfX.js +1 -0
- package/dist/src/compiled/_chunks/workflow/{wait-until-De9yESQN.js → wait-until-z48sPUjU.js} +2 -2
- package/dist/src/compiled/shadcn-registry/index.d.ts +1 -0
- package/dist/src/compiler/compile-from-memory.d.ts +1 -0
- package/dist/src/compiler/extension-compatibility.d.ts +8 -8
- package/dist/src/compiler/extension-compatibility.js +1 -1
- package/dist/src/compiler/manifest.d.ts +2 -2
- package/dist/src/compiler/manifest.js +1 -1
- package/dist/src/compiler/normalize-agent-config.js +1 -1
- package/dist/src/context/dynamic-instruction-lifecycle.d.ts +2 -2
- package/dist/src/context/dynamic-model-lifecycle.d.ts +2 -2
- package/dist/src/context/dynamic-skill-lifecycle.d.ts +2 -2
- package/dist/src/context/dynamic-tool-lifecycle.d.ts +2 -2
- package/dist/src/context/hook-lifecycle.d.ts +2 -2
- package/dist/src/evals/assertions/collector.d.ts +2 -10
- package/dist/src/evals/assertions/collector.js +1 -1
- package/dist/src/evals/assertions/run.d.ts +3 -3
- package/dist/src/evals/cli/eval.d.ts +6 -2
- package/dist/src/evals/cli/eval.js +2 -2
- package/dist/src/evals/cli/filter.d.ts +14 -0
- package/dist/src/evals/cli/filter.js +1 -0
- package/dist/src/evals/context.js +1 -1
- package/dist/src/evals/diagnostics.d.ts +8 -0
- package/dist/src/evals/diagnostics.js +1 -0
- package/dist/src/evals/expect/index.d.ts +1 -1
- package/dist/src/evals/expect/index.js +1 -1
- package/dist/src/evals/index.d.ts +1 -1
- package/dist/src/evals/judge.js +2 -1
- package/dist/src/evals/match.d.ts +4 -4
- package/dist/src/evals/runner/artifacts.js +1 -1
- package/dist/src/evals/runner/derive-run-facts.d.ts +2 -2
- package/dist/src/evals/runner/reporters/assertion-diagnostics.d.ts +3 -0
- package/dist/src/evals/runner/reporters/assertion-diagnostics.js +3 -0
- package/dist/src/evals/runner/reporters/braintrust.js +1 -1
- package/dist/src/evals/runner/reporters/console.js +1 -1
- package/dist/src/evals/runner/reporters/junit.js +2 -2
- package/dist/src/evals/session.d.ts +3 -3
- package/dist/src/evals/types.d.ts +33 -17
- package/dist/src/execution/cancel-descendant-turns-step.js +1 -1
- package/dist/src/execution/dispatch-runtime-actions-step.js +1 -1
- package/dist/src/execution/route-child-delivery.d.ts +4 -3
- package/dist/src/execution/route-child-delivery.js +1 -1
- package/dist/src/execution/session-delivery-hook.d.ts +1 -0
- package/dist/src/execution/session-delivery-hook.js +1 -1
- package/dist/src/execution/session-timeout-control.d.ts +9 -0
- package/dist/src/execution/session-timeout-control.js +1 -0
- package/dist/src/execution/session-timeout-steps.d.ts +13 -0
- package/dist/src/execution/session-timeout-steps.js +1 -0
- package/dist/src/execution/session-timeout-workflow.d.ts +6 -0
- package/dist/src/execution/session-timeout-workflow.js +1 -0
- package/dist/src/execution/session-timeout.d.ts +2 -0
- package/dist/src/execution/session-timeout.js +1 -0
- package/dist/src/execution/settle-cancelled-turn-step.js +1 -1
- package/dist/src/execution/subagent-event-proxy-step.js +1 -1
- package/dist/src/execution/subagent-hitl-proxy.d.ts +5 -1
- package/dist/src/execution/subagent-hitl-proxy.js +1 -1
- package/dist/src/execution/terminal-session-completion-step.d.ts +5 -0
- package/dist/src/execution/terminal-session-completion-step.js +1 -0
- package/dist/src/execution/terminal-session-failure-step.js +1 -1
- package/dist/src/execution/turn-cancellation-control.js +1 -1
- package/dist/src/execution/turn-workflow.js +1 -1
- package/dist/src/execution/workflow-entry.d.ts +1 -0
- package/dist/src/execution/workflow-entry.js +1 -1
- package/dist/src/execution/workflow-runtime.d.ts +4 -0
- package/dist/src/execution/workflow-runtime.js +1 -1
- package/dist/src/execution/workflow-steps.d.ts +12 -2
- package/dist/src/execution/workflow-steps.js +1 -1
- package/dist/src/harness/agent-otel-provider.js +1 -1
- package/dist/src/harness/ai-sdk-hook-bridge.js +1 -1
- package/dist/src/harness/input-extraction.js +1 -1
- package/dist/src/harness/input-request-class.d.ts +23 -0
- package/dist/src/harness/input-request-class.js +1 -0
- package/dist/src/harness/input-requests.d.ts +20 -9
- package/dist/src/harness/input-requests.js +1 -1
- package/dist/src/harness/instrumentation-lifecycle.d.ts +12 -1
- package/dist/src/harness/proxy-input-requests.d.ts +10 -4
- package/dist/src/harness/proxy-input-requests.js +1 -1
- package/dist/src/harness/session-limit-continuation.d.ts +0 -11
- package/dist/src/harness/session-limit-continuation.js +1 -1
- package/dist/src/harness/session-limit-enforcement.d.ts +3 -2
- package/dist/src/harness/session-limit-enforcement.js +1 -1
- package/dist/src/harness/session-token-limits.d.ts +41 -0
- package/dist/src/harness/session-token-limits.js +1 -0
- package/dist/src/harness/stale-input-responses.js +1 -1
- package/dist/src/harness/subagent-token-budget.d.ts +6 -4
- package/dist/src/harness/subagent-token-budget.js +1 -1
- package/dist/src/harness/tool-loop.js +1 -1
- package/dist/src/harness/turn-sleep.d.ts +12 -0
- package/dist/src/harness/turn-sleep.js +1 -0
- package/dist/src/harness/turn-tag-state.d.ts +26 -17
- package/dist/src/harness/turn-tag-state.js +1 -1
- package/dist/src/harness/types.d.ts +4 -4
- package/dist/src/harness/workflow-lifecycle.d.ts +2 -2
- package/dist/src/internal/application/compiled-artifacts.js +7 -7
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/core.js +1 -1
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.d.ts +4 -0
- package/dist/src/internal/nitro/host/dev-authored-source-watcher.js +1 -1
- package/dist/src/internal/nitro/host/start-development-server.js +2 -2
- package/dist/src/internal/workflow/development-world-protocol.js +1 -1
- package/dist/src/internal/workflow/world-target.d.ts +7 -0
- package/dist/src/internal/workflow/world-target.js +1 -0
- package/dist/src/internal/workflow-bundle/workflow-core-shim.d.ts +1 -1
- package/dist/src/internal/workflow-bundle/workflow-core-shim.js +1 -1
- package/dist/src/protocol/event-dedupe.d.ts +25 -0
- package/dist/src/protocol/event-dedupe.js +1 -0
- package/dist/src/protocol/event-id.d.ts +16 -0
- package/dist/src/protocol/event-id.js +1 -0
- package/dist/src/protocol/message.d.ts +39 -23
- package/dist/src/protocol/message.js +2 -2
- package/dist/src/protocol/routes.d.ts +4 -0
- package/dist/src/protocol/routes.js +1 -1
- package/dist/src/public/channels/discord/discordChannel.d.ts +3 -3
- package/dist/src/public/channels/github/githubChannel.d.ts +3 -3
- package/dist/src/public/channels/linear/linearChannel.d.ts +3 -3
- package/dist/src/public/channels/slack/hitl.js +1 -1
- package/dist/src/public/channels/slack/slackChannel.d.ts +3 -3
- package/dist/src/public/channels/teams/hitl.js +1 -1
- package/dist/src/public/channels/teams/teamsChannel.d.ts +3 -3
- package/dist/src/public/channels/telegram/telegramChannel.d.ts +3 -3
- package/dist/src/public/channels/twilio/twilioChannel.d.ts +3 -3
- package/dist/src/public/definitions/channel.d.ts +4 -4
- package/dist/src/public/definitions/hook.d.ts +2 -2
- package/dist/src/public/tools/sleep/index.d.ts +18 -0
- package/dist/src/public/tools/sleep/index.js +1 -0
- package/dist/src/react/use-eve-agent.d.ts +3 -2
- package/dist/src/runtime/framework-tools/ask-question.js +1 -1
- package/dist/src/runtime/framework-tools/sleep.d.ts +15 -0
- package/dist/src/runtime/framework-tools/sleep.js +1 -0
- package/dist/src/runtime/hooks/registry.d.ts +2 -2
- package/dist/src/runtime/input/types.d.ts +19 -4
- package/dist/src/runtime/input/types.js +1 -1
- package/dist/src/runtime/resolve-agent.js +1 -1
- package/dist/src/runtime/types.d.ts +2 -2
- package/dist/src/services/dev-client/runtime-artifacts.d.ts +7 -0
- package/dist/src/services/dev-client/runtime-artifacts.js +1 -1
- package/dist/src/setup/boxes/apply-ai-gateway-credential.js +1 -1
- package/dist/src/setup/boxes/deploy-project.d.ts +3 -3
- package/dist/src/setup/flows/deploy.js +1 -1
- package/dist/src/setup/flows/ensure-vercel-project.d.ts +17 -0
- package/dist/src/setup/flows/ensure-vercel-project.js +1 -0
- package/dist/src/setup/flows/in-project.d.ts +1 -1
- package/dist/src/setup/flows/link.js +1 -1
- package/dist/src/setup/flows/model.js +1 -1
- package/dist/src/setup/flows/provider.js +1 -1
- package/dist/src/setup/flows/registry.d.ts +20 -0
- package/dist/src/setup/flows/registry.js +1 -0
- package/dist/src/setup/index.d.ts +0 -1
- package/dist/src/setup/index.js +1 -1
- package/dist/src/setup/{channel-setup-environment.d.ts → integrations/channels/environment.d.ts} +2 -2
- package/dist/src/setup/integrations/channels/environment.js +1 -0
- package/dist/src/setup/{channel-setup-integrations.d.ts → integrations/channels/index.d.ts} +3 -3
- package/dist/src/setup/integrations/channels/index.js +1 -0
- package/dist/src/setup/{channel-setup-runner.d.ts → integrations/channels/runner.d.ts} +1 -1
- package/dist/src/setup/integrations/channels/runner.js +1 -0
- package/dist/src/setup/{boxes/add-channels.d.ts → integrations/channels/setup.d.ts} +32 -22
- package/dist/src/setup/integrations/channels/setup.js +2 -0
- package/dist/src/setup/{channel-setup-slack.d.ts → integrations/channels/slack.d.ts} +1 -1
- package/dist/src/setup/integrations/channels/slack.js +1 -0
- package/dist/src/setup/{channel-setup-integration.d.ts → integrations/channels/types.d.ts} +23 -7
- package/dist/src/setup/{channel-setup-ui.d.ts → integrations/channels/ui.d.ts} +2 -2
- package/dist/src/setup/integrations/channels/ui.js +2 -0
- package/dist/src/setup/{channel-setup-web.d.ts → integrations/channels/web.d.ts} +1 -1
- package/dist/src/setup/integrations/channels/web.js +1 -0
- package/dist/src/setup/primitives/run-vercel.d.ts +1 -0
- package/dist/src/setup/primitives/run-vercel.js +1 -1
- package/dist/src/setup/prompter.d.ts +16 -3
- package/dist/src/setup/prompter.js +1 -1
- package/dist/src/setup/registry-setup-client.d.ts +18 -0
- package/dist/src/setup/registry-setup-client.js +2 -0
- package/dist/src/setup/registry-setup-protocol.d.ts +93 -0
- package/dist/src/setup/registry-setup-protocol.js +1 -0
- package/dist/src/setup/scaffold/channels-catalog.d.ts +1 -1
- package/dist/src/setup/scaffold/create/extension.js +2 -2
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
- package/dist/src/setup/scaffold/create/web-template.js +2 -2
- package/dist/src/setup/scaffold/create-in-place.d.ts +1 -0
- package/dist/src/setup/scaffold/create-in-place.js +1 -0
- package/dist/src/setup/scaffold/index.js +1 -1
- package/dist/src/setup/scaffold/update/connections.js +3 -3
- package/dist/src/setup/scaffold/update/update-connection-connector.js +1 -1
- package/dist/src/setup/vercel-project-framework.d.ts +1 -1
- package/dist/src/setup/vercel-project-framework.js +1 -1
- package/dist/src/setup/vercel-project.d.ts +17 -2
- package/dist/src/setup/vercel-project.js +0 -0
- package/dist/src/shared/agent-definition.d.ts +12 -0
- package/dist/src/shared/dynamic-tool-definition.d.ts +2 -2
- package/dist/src/shared/ulid.d.ts +39 -0
- package/dist/src/shared/ulid.js +1 -0
- package/dist/src/svelte/index.js +1 -1
- package/dist/src/svelte/use-eve-agent.d.ts +4 -4
- 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.d.ts +4 -4
- package/dist/src/vue/use-eve-agent.js +1 -1
- package/docs/agent-config.md +28 -16
- package/docs/channels/overview.mdx +1 -1
- package/docs/channels/slack.mdx +2 -2
- package/docs/concepts/default-harness.md +12 -0
- package/docs/concepts/execution-model-and-durability.mdx +1 -1
- package/docs/concepts/sessions-runs-and-streaming.md +61 -0
- package/docs/evals/assertions.mdx +8 -1
- package/docs/evals/judge.mdx +11 -1
- package/docs/evals/reporters.mdx +1 -1
- package/docs/evals/running.mdx +3 -0
- package/docs/guides/client/streaming.mdx +9 -3
- package/docs/guides/dev-tui.md +9 -14
- package/docs/guides/frontend/overview.mdx +4 -2
- package/docs/guides/frontend/use-eve-agent-svelte.mdx +1 -1
- package/docs/guides/frontend/use-eve-agent-vue.mdx +10 -10
- package/docs/guides/hooks.md +40 -2
- package/docs/guides/instrumentation.md +5 -1
- package/docs/reference/cli.md +25 -38
- package/docs/reference/typescript-api.md +2 -1
- package/docs/tools/human-in-the-loop.md +5 -0
- package/docs/tutorial/ship-it.mdx +2 -2
- package/package.json +11 -6
- package/dist/src/compiled/@workflow/core/runtime/world-target.d.ts +0 -11
- package/dist/src/compiled/_chunks/workflow/sleep-BjrUxUcs.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/index.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/parse-name.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/promise.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/time.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/workflow-routes.js +0 -1
- package/dist/src/node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/world-target.js +0 -1
- package/dist/src/node_modules/.pnpm/ms@2.1.3/node_modules/ms/index.js +0 -1
- package/dist/src/setup/boxes/add-channels.js +0 -2
- package/dist/src/setup/boxes/add-connections.d.ts +0 -26
- package/dist/src/setup/boxes/add-connections.js +0 -1
- package/dist/src/setup/boxes/install-channel-registry-items.d.ts +0 -8
- package/dist/src/setup/boxes/install-channel-registry-items.js +0 -1
- package/dist/src/setup/boxes/one-shot-next-steps.d.ts +0 -18
- package/dist/src/setup/boxes/one-shot-next-steps.js +0 -2
- package/dist/src/setup/boxes/preflight.d.ts +0 -37
- package/dist/src/setup/boxes/preflight.js +0 -1
- package/dist/src/setup/boxes/resolve-target.d.ts +0 -58
- package/dist/src/setup/boxes/resolve-target.js +0 -1
- package/dist/src/setup/boxes/scaffold.d.ts +0 -40
- package/dist/src/setup/boxes/scaffold.js +0 -1
- package/dist/src/setup/boxes/select-channels.d.ts +0 -49
- package/dist/src/setup/boxes/select-channels.js +0 -1
- package/dist/src/setup/boxes/select-chat.d.ts +0 -38
- package/dist/src/setup/boxes/select-chat.js +0 -1
- package/dist/src/setup/boxes/select-connections.d.ts +0 -30
- package/dist/src/setup/boxes/select-connections.js +0 -1
- package/dist/src/setup/boxes/select-setup-mode.d.ts +0 -32
- package/dist/src/setup/boxes/select-setup-mode.js +0 -1
- package/dist/src/setup/channel-setup-deployment.d.ts +0 -11
- package/dist/src/setup/channel-setup-deployment.js +0 -1
- package/dist/src/setup/channel-setup-environment.js +0 -1
- package/dist/src/setup/channel-setup-integration.js +0 -1
- package/dist/src/setup/channel-setup-integrations.js +0 -1
- package/dist/src/setup/channel-setup-runner.js +0 -1
- package/dist/src/setup/channel-setup-slack.js +0 -1
- package/dist/src/setup/channel-setup-ui.js +0 -2
- package/dist/src/setup/channel-setup-web.js +0 -1
- package/dist/src/setup/flows/channels.d.ts +0 -57
- package/dist/src/setup/flows/channels.js +0 -1
- package/dist/src/setup/flows/connections.d.ts +0 -37
- package/dist/src/setup/flows/connections.js +0 -3
- package/dist/src/setup/onboarding.d.ts +0 -60
- package/dist/src/setup/onboarding.js +0 -1
- /package/dist/src/{node_modules/.pnpm/@workflow_utils@5.0.0-beta.7/node_modules/@workflow/utils/dist/pluralize.js → setup/integrations/channels/types.js} +0 -0
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import{i as e,n as t,o as n,r,t as i}from"../../_chunks/workflow/rolldown-runtime-DaDcL9Zw.js";import{D as a,T as o,_ as s,c,d as l,g as u,o as d,r as f}from"../../_chunks/workflow/dist-BeQ_csYA.js";import{$ as p,$a as m,$c as h,$i as g,$n as _,$o as v,$r as y,$s as b,$t as ee,Aa as te,Ac as ne,Ai as re,An as ie,Ao as ae,Ar as oe,As as se,At as ce,Ba as le,Bc as ue,Bi as de,Bn as fe,Bo as pe,Br as me,Bs as he,Bt as ge,C as _e,Ca as ve,Cc as ye,Ci as be,Cn as xe,Co as Se,Cr as Ce,Cs as we,Ct as Te,Da as Ee,Dc as De,Di as Oe,Dn as ke,Do as Ae,Dr as je,Ds as Me,Dt as Ne,E as Pe,Ea as Fe,Ec as Ie,Ei as Le,En as Re,Eo as ze,Er as Be,Es as Ve,Et as He,Fa as Ue,Fc as We,Fi as Ge,Fn as Ke,Fo as qe,Fr as Je,Fs as Ye,Ft as Xe,Ga as Ze,Gc as Qe,Gi as $e,Gn as et,Go as tt,Gr as nt,Gs as rt,Gt as it,H as at,Ha as ot,Hc as st,Hi as ct,Hn as lt,Ho as ut,Hr as dt,Hs as ft,Ht as pt,I as mt,Ia as ht,Ic as gt,Ii as _t,In as vt,Io as yt,Ir as bt,Is as xt,It as St,J as Ct,Ja as wt,Jc as Tt,Ji as Et,Jn as Dt,Jo as Ot,Jr as kt,Js as At,Jt as jt,Ka as Mt,Kc as Nt,Ki as Pt,Kn as Ft,Ko as It,Kr as Lt,Ks as Rt,Kt as zt,La as Bt,Lc as Vt,Li as Ht,Ln as Ut,Lo as Wt,Lr as Gt,Ls as Kt,Lt as qt,M as Jt,Ma as Yt,Mc as Xt,Mi as Zt,Mn as Qt,Mo as $t,Mr as en,Ms as tn,Mt as nn,N as rn,Na as an,Nc as on,Ni as sn,Nn as cn,No as ln,Nr as un,Ns as dn,Nt as fn,O as pn,Oa as mn,Oc as hn,Oi as gn,On as _n,Oo as vn,Or as yn,Os as bn,Ot as xn,P as Sn,Pa as Cn,Pc as wn,Pi as Tn,Pn as En,Po as Dn,Pr as On,Ps as kn,Pt as An,Q as jn,Qa as Mn,Qc as Nn,Qi as Pn,Qn as Fn,Qo as In,Qr as Ln,Qs as Rn,Qt as zn,Ra as Bn,Rc as Vn,Ri as Hn,Rn as Un,Ro as Wn,Rr as Gn,Rs as Kn,Rt as qn,S as Jn,Sa as Yn,Sc as Xn,Si as Zn,Sn as Qn,So as $n,Sr as er,Ss as tr,St as nr,Ta as rr,Tc as ir,Ti as ar,Tn as or,To as sr,Tr as cr,Ts as lr,Tt as ur,Ua as dr,Uc as fr,Ui as pr,Un as mr,Uo as hr,Ur as gr,Us as _r,Ut as vr,V as yr,Va as br,Vc as xr,Vi as Sr,Vn as Cr,Vo as wr,Vr as Tr,Vs as Er,Vt as Dr,Wa as Or,Wc as kr,Wi as Ar,Wn as jr,Wo as Mr,Wr as Nr,Ws as Pr,Wt as Fr,X as Ir,Xa as Lr,Xc as Rr,Xi as zr,Xn as Br,Xo as Vr,Xr as Hr,Xs as Ur,Xt as Wr,Ya as Gr,Yc as Kr,Yi as qr,Yn as Jr,Yo as Yr,Yr as Xr,Ys as Zr,Yt as Qr,Z as $r,Za as ei,Zc as ti,Zi as ni,Zn as ri,Zo as ii,Zr as ai,Zs as oi,Zt as si,_a as ci,_c as li,_i as ui,_l as di,_n as fi,_o as pi,_r as mi,_s as hi,_t as gi,aa as _i,ac as vi,ai as yi,al as bi,an as xi,ao as Si,ar as Ci,as as wi,at as Ti,b as Ei,ba as Di,bc as Oi,bi as ki,bn as Ai,bo as ji,br as Mi,bs as Ni,bt as Pi,c as Fi,ca as Ii,cc as Li,ci as Ri,cl as x,cn as zi,co as Bi,cr as Vi,cs as Hi,ct as Ui,da as Wi,dc as Gi,di as Ki,dl as qi,dn as Ji,do as Yi,dr as Xi,ds as Zi,dt as Qi,ea as $i,ec as ea,ei as ta,el as na,en as ra,eo as ia,er as aa,es as oa,et as sa,f as ca,fa as la,fc as ua,fi as da,fl as fa,fn as pa,fo as ma,fr as ha,fs as ga,ft as _a,ga as va,gc as ya,gi as ba,gl as xa,gn as Sa,go as Ca,gr as wa,gs as Ta,gt as Ea,ha as Da,hc as Oa,hi as ka,hl as Aa,hn as ja,ho as Ma,hr as Na,hs as Pa,ht as Fa,ia as Ia,ic as La,ii as Ra,il as za,in as Ba,io as Va,ir as Ha,is as Ua,it as Wa,j as Ga,ja as Ka,jc as qa,ji as Ja,jn as Ya,jo as Xa,jr as Za,js as Qa,jt as $a,ka as eo,kc as to,ki as no,kn as ro,ko as io,kr as ao,ks as oo,kt as so,la as co,lc as lo,li as uo,ll as S,ln as fo,lo as po,lr as mo,ls as ho,lt as go,m as _o,ma as vo,mc as yo,mi as bo,ml as xo,mn as So,mo as Co,mr as wo,ms as To,mt as Eo,na as Do,nc as Oo,ni as ko,nl as Ao,nn as jo,no as Mo,nr as No,ns as Po,nt as Fo,o as Io,oa as Lo,oc as Ro,oi as zo,ol as Bo,on as Vo,oo as Ho,or as Uo,os as Wo,ot as Go,p as Ko,pa as qo,pc as Jo,pi as Yo,pl as Xo,pn as Zo,po as Qo,pr as $o,ps as es,pt as ts,qa as ns,qc as rs,qi as is,qn as as,qo as os,qr as ss,qs as cs,qt as ls,r as us,ra as ds,rc as fs,ri as ps,rl as ms,rn as hs,ro as gs,rr as _s,rs as vs,rt as ys,s as bs,sa as xs,sc as Ss,si as Cs,sl as ws,sn as Ts,so as Es,sr as Ds,ss as Os,st as ks,ta as As,tc as js,ti as Ms,tl as Ns,tn as Ps,to as Fs,tr as Is,ts as Ls,tt as Rs,u as zs,ua as Bs,uc as Vs,ui as Hs,ul as C,un as Us,uo as Ws,ur as Gs,us as Ks,ut as qs,va as Js,vc as Ys,vi as Xs,vl as Zs,vn as Qs,vo as $s,vr as ec,vs as tc,vt as nc,w as rc,wa as ic,wc as ac,wi as oc,wn as sc,wo as cc,wr as lc,ws as uc,wt as dc,x as fc,xa as pc,xc as mc,xi as hc,xn as gc,xo as _c,xr as vc,xs as yc,xt as bc,y as xc,ya as Sc,yc as Cc,yi as wc,yn as Tc,yo as Ec,yr as Dc,ys as Oc,yt as kc,za as Ac,zc as jc,zi as Mc,zn as Nc,zo as Pc,zr as Fc,zs as Ic,zt as Lc}from"../../_chunks/workflow/dist-WjtNsOyf.js";import{t as Rc}from"../../_chunks/workflow/env-config-CYoX3muK.js";import{a as zc,i as Bc,n as Vc,o as Hc,r as Uc,s as Wc,t as Gc}from"../../_chunks/workflow/run-id-BdE0MZz9.js";import{t as Kc}from"../../_chunks/workflow/undici-DWL_MYmT.js";import{n as qc,r as Jc,t as Yc}from"../../_chunks/workflow/token-util-Ldar52H7.js";import{i as Xc,r as Zc,t as Qc}from"../../_chunks/workflow/token-util-DURSL1l8.js";import{createRequire as $c}from"module";import*as el from"path";import*as tl from"node:crypto";import{KeyObject as nl,constants as rl,createCipheriv as il,createDecipheriv as al,createHash as ol,createHmac as sl,createPrivateKey as cl,createPublicKey as ll,createSecretKey as ul,diffieHellman as dl,generateKeyPair as fl,getCiphers as pl,pbkdf2 as ml,privateDecrypt as hl,publicEncrypt as gl,randomFillSync as _l,timingSafeEqual as vl,webcrypto as yl}from"node:crypto";import*as bl from"node:util";import{deprecate as xl,inspect as Sl,promisify as Cl}from"node:util";import{AsyncLocalStorage as wl}from"node:async_hooks";import Tl from"node:os";import*as El from"node:http";import{once as Dl}from"node:events";import{Buffer as Ol}from"node:buffer";import*as kl from"fs";import*as Al from"net";import*as jl from"node:https";const Ml=()=>{let e={string:{unit:`حرف`,verb:`أن يحوي`},file:{unit:`بايت`,verb:`أن يحوي`},array:{unit:`عنصر`,verb:`أن يحوي`},set:{unit:`عنصر`,verb:`أن يحوي`}};function t(t){return e[t]??null}let n={regex:`مدخل`,email:`بريد إلكتروني`,url:`رابط`,emoji:`إيموجي`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`تاريخ ووقت بمعيار ISO`,date:`تاريخ بمعيار ISO`,time:`وقت بمعيار ISO`,duration:`مدة بمعيار ISO`,ipv4:`عنوان IPv4`,ipv6:`عنوان IPv6`,cidrv4:`مدى عناوين بصيغة IPv4`,cidrv6:`مدى عناوين بصيغة IPv6`,base64:`نَص بترميز base64-encoded`,base64url:`نَص بترميز base64url-encoded`,json_string:`نَص على هيئة JSON`,e164:`رقم هاتف بمعيار E.164`,jwt:`JWT`,template_literal:`مدخل`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`مدخلات غير مقبولة: يفترض إدخال instanceof ${e.expected}، ولكن تم إدخال ${i}`:`مدخلات غير مقبولة: يفترض إدخال ${t}، ولكن تم إدخال ${i}`}case`invalid_value`:return e.values.length===1?`مدخلات غير مقبولة: يفترض إدخال ${C(e.values[0])}`:`اختيار غير مقبول: يتوقع انتقاء أحد هذه الخيارات: ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?` أكبر من اللازم: يفترض أن تكون ${e.origin??`القيمة`} ${n} ${e.maximum.toString()} ${r.unit??`عنصر`}`:`أكبر من اللازم: يفترض أن تكون ${e.origin??`القيمة`} ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${n} ${e.minimum.toString()} ${r.unit}`:`أصغر من اللازم: يفترض لـ ${e.origin} أن يكون ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`نَص غير مقبول: يجب أن يبدأ بـ "${e.prefix}"`:t.format===`ends_with`?`نَص غير مقبول: يجب أن ينتهي بـ "${t.suffix}"`:t.format===`includes`?`نَص غير مقبول: يجب أن يتضمَّن "${t.includes}"`:t.format===`regex`?`نَص غير مقبول: يجب أن يطابق النمط ${t.pattern}`:`${n[t.format]??e.format} غير مقبول`}case`not_multiple_of`:return`رقم غير مقبول: يجب أن يكون من مضاعفات ${e.divisor}`;case`unrecognized_keys`:return`معرف${e.keys.length>1?`ات`:``} غريب${e.keys.length>1?`ة`:``}: ${x(e.keys,`، `)}`;case`invalid_key`:return`معرف غير مقبول في ${e.origin}`;case`invalid_union`:return`مدخل غير مقبول`;case`invalid_element`:return`مدخل غير مقبول في ${e.origin}`;default:return`مدخل غير مقبول`}}};function Nl(){return{localeError:Ml()}}const Pl=()=>{let e={string:{unit:`simvol`,verb:`olmalıdır`},file:{unit:`bayt`,verb:`olmalıdır`},array:{unit:`element`,verb:`olmalıdır`},set:{unit:`element`,verb:`olmalıdır`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Yanlış dəyər: gözlənilən instanceof ${e.expected}, daxil olan ${i}`:`Yanlış dəyər: gözlənilən ${t}, daxil olan ${i}`}case`invalid_value`:return e.values.length===1?`Yanlış dəyər: gözlənilən ${C(e.values[0])}`:`Yanlış seçim: aşağıdakılardan biri olmalıdır: ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Çox böyük: gözlənilən ${e.origin??`dəyər`} ${n}${e.maximum.toString()} ${r.unit??`element`}`:`Çox böyük: gözlənilən ${e.origin??`dəyər`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Çox kiçik: gözlənilən ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`Çox kiçik: gözlənilən ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Yanlış mətn: "${t.prefix}" ilə başlamalıdır`:t.format===`ends_with`?`Yanlış mətn: "${t.suffix}" ilə bitməlidir`:t.format===`includes`?`Yanlış mətn: "${t.includes}" daxil olmalıdır`:t.format===`regex`?`Yanlış mətn: ${t.pattern} şablonuna uyğun olmalıdır`:`Yanlış ${n[t.format]??e.format}`}case`not_multiple_of`:return`Yanlış ədəd: ${e.divisor} ilə bölünə bilən olmalıdır`;case`unrecognized_keys`:return`Tanınmayan açar${e.keys.length>1?`lar`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} daxilində yanlış açar`;case`invalid_union`:return`Yanlış dəyər`;case`invalid_element`:return`${e.origin} daxilində yanlış dəyər`;default:return`Yanlış dəyər`}}};function Fl(){return{localeError:Pl()}}function Il(e,t,n,r){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?t:a>=2&&a<=4?n:r}const Ll=()=>{let e={string:{unit:{one:`сімвал`,few:`сімвалы`,many:`сімвалаў`},verb:`мець`},array:{unit:{one:`элемент`,few:`элементы`,many:`элементаў`},verb:`мець`},set:{unit:{one:`элемент`,few:`элементы`,many:`элементаў`},verb:`мець`},file:{unit:{one:`байт`,few:`байты`,many:`байтаў`},verb:`мець`}};function t(t){return e[t]??null}let n={regex:`увод`,email:`email адрас`,url:`URL`,emoji:`эмодзі`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO дата і час`,date:`ISO дата`,time:`ISO час`,duration:`ISO працягласць`,ipv4:`IPv4 адрас`,ipv6:`IPv6 адрас`,cidrv4:`IPv4 дыяпазон`,cidrv6:`IPv6 дыяпазон`,base64:`радок у фармаце base64`,base64url:`радок у фармаце base64url`,json_string:`JSON радок`,e164:`нумар E.164`,jwt:`JWT`,template_literal:`увод`},r={nan:`NaN`,number:`лік`,array:`масіў`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Няправільны ўвод: чакаўся instanceof ${e.expected}, атрымана ${i}`:`Няправільны ўвод: чакаўся ${t}, атрымана ${i}`}case`invalid_value`:return e.values.length===1?`Няправільны ўвод: чакалася ${C(e.values[0])}`:`Няправільны варыянт: чакаўся адзін з ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=Il(Number(e.maximum),r.unit.one,r.unit.few,r.unit.many);return`Занадта вялікі: чакалася, што ${e.origin??`значэнне`} павінна ${r.verb} ${n}${e.maximum.toString()} ${t}`}return`Занадта вялікі: чакалася, што ${e.origin??`значэнне`} павінна быць ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=Il(Number(e.minimum),r.unit.one,r.unit.few,r.unit.many);return`Занадта малы: чакалася, што ${e.origin} павінна ${r.verb} ${n}${e.minimum.toString()} ${t}`}return`Занадта малы: чакалася, што ${e.origin} павінна быць ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Няправільны радок: павінен пачынацца з "${t.prefix}"`:t.format===`ends_with`?`Няправільны радок: павінен заканчвацца на "${t.suffix}"`:t.format===`includes`?`Няправільны радок: павінен змяшчаць "${t.includes}"`:t.format===`regex`?`Няправільны радок: павінен адпавядаць шаблону ${t.pattern}`:`Няправільны ${n[t.format]??e.format}`}case`not_multiple_of`:return`Няправільны лік: павінен быць кратным ${e.divisor}`;case`unrecognized_keys`:return`Нераспазнаны ${e.keys.length>1?`ключы`:`ключ`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Няправільны ключ у ${e.origin}`;case`invalid_union`:return`Няправільны ўвод`;case`invalid_element`:return`Няправільнае значэнне ў ${e.origin}`;default:return`Няправільны ўвод`}}};function Rl(){return{localeError:Ll()}}const zl=()=>{let e={string:{unit:`символа`,verb:`да съдържа`},file:{unit:`байта`,verb:`да съдържа`},array:{unit:`елемента`,verb:`да съдържа`},set:{unit:`елемента`,verb:`да съдържа`}};function t(t){return e[t]??null}let n={regex:`вход`,email:`имейл адрес`,url:`URL`,emoji:`емоджи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO време`,date:`ISO дата`,time:`ISO време`,duration:`ISO продължителност`,ipv4:`IPv4 адрес`,ipv6:`IPv6 адрес`,cidrv4:`IPv4 диапазон`,cidrv6:`IPv6 диапазон`,base64:`base64-кодиран низ`,base64url:`base64url-кодиран низ`,json_string:`JSON низ`,e164:`E.164 номер`,jwt:`JWT`,template_literal:`вход`},r={nan:`NaN`,number:`число`,array:`масив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Невалиден вход: очакван instanceof ${e.expected}, получен ${i}`:`Невалиден вход: очакван ${t}, получен ${i}`}case`invalid_value`:return e.values.length===1?`Невалиден вход: очакван ${C(e.values[0])}`:`Невалидна опция: очаквано едно от ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Твърде голямо: очаква се ${e.origin??`стойност`} да съдържа ${n}${e.maximum.toString()} ${r.unit??`елемента`}`:`Твърде голямо: очаква се ${e.origin??`стойност`} да бъде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Твърде малко: очаква се ${e.origin} да съдържа ${n}${e.minimum.toString()} ${r.unit}`:`Твърде малко: очаква се ${e.origin} да бъде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;if(t.format===`starts_with`)return`Невалиден низ: трябва да започва с "${t.prefix}"`;if(t.format===`ends_with`)return`Невалиден низ: трябва да завършва с "${t.suffix}"`;if(t.format===`includes`)return`Невалиден низ: трябва да включва "${t.includes}"`;if(t.format===`regex`)return`Невалиден низ: трябва да съвпада с ${t.pattern}`;let r=`Невалиден`;return t.format===`emoji`&&(r=`Невалидно`),t.format===`datetime`&&(r=`Невалидно`),t.format===`date`&&(r=`Невалидна`),t.format===`time`&&(r=`Невалидно`),t.format===`duration`&&(r=`Невалидна`),`${r} ${n[t.format]??e.format}`}case`not_multiple_of`:return`Невалидно число: трябва да бъде кратно на ${e.divisor}`;case`unrecognized_keys`:return`Неразпознат${e.keys.length>1?`и`:``} ключ${e.keys.length>1?`ове`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Невалиден ключ в ${e.origin}`;case`invalid_union`:return`Невалиден вход`;case`invalid_element`:return`Невалидна стойност в ${e.origin}`;default:return`Невалиден вход`}}};function Bl(){return{localeError:zl()}}const Vl=()=>{let e={string:{unit:`caràcters`,verb:`contenir`},file:{unit:`bytes`,verb:`contenir`},array:{unit:`elements`,verb:`contenir`},set:{unit:`elements`,verb:`contenir`}};function t(t){return e[t]??null}let n={regex:`entrada`,email:`adreça electrònica`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data i hora ISO`,date:`data ISO`,time:`hora ISO`,duration:`durada ISO`,ipv4:`adreça IPv4`,ipv6:`adreça IPv6`,cidrv4:`rang IPv4`,cidrv6:`rang IPv6`,base64:`cadena codificada en base64`,base64url:`cadena codificada en base64url`,json_string:`cadena JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Tipus invàlid: s'esperava instanceof ${e.expected}, s'ha rebut ${i}`:`Tipus invàlid: s'esperava ${t}, s'ha rebut ${i}`}case`invalid_value`:return e.values.length===1?`Valor invàlid: s'esperava ${C(e.values[0])}`:`Opció invàlida: s'esperava una de ${x(e.values,` o `)}`;case`too_big`:{let n=e.inclusive?`com a màxim`:`menys de`,r=t(e.origin);return r?`Massa gran: s'esperava que ${e.origin??`el valor`} contingués ${n} ${e.maximum.toString()} ${r.unit??`elements`}`:`Massa gran: s'esperava que ${e.origin??`el valor`} fos ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`com a mínim`:`més de`,r=t(e.origin);return r?`Massa petit: s'esperava que ${e.origin} contingués ${n} ${e.minimum.toString()} ${r.unit}`:`Massa petit: s'esperava que ${e.origin} fos ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Format invàlid: ha de començar amb "${t.prefix}"`:t.format===`ends_with`?`Format invàlid: ha d'acabar amb "${t.suffix}"`:t.format===`includes`?`Format invàlid: ha d'incloure "${t.includes}"`:t.format===`regex`?`Format invàlid: ha de coincidir amb el patró ${t.pattern}`:`Format invàlid per a ${n[t.format]??e.format}`}case`not_multiple_of`:return`Número invàlid: ha de ser múltiple de ${e.divisor}`;case`unrecognized_keys`:return`Clau${e.keys.length>1?`s`:``} no reconeguda${e.keys.length>1?`s`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Clau invàlida a ${e.origin}`;case`invalid_union`:return`Entrada invàlida`;case`invalid_element`:return`Element invàlid a ${e.origin}`;default:return`Entrada invàlida`}}};function Hl(){return{localeError:Vl()}}const Ul=()=>{let e={string:{unit:`znaků`,verb:`mít`},file:{unit:`bajtů`,verb:`mít`},array:{unit:`prvků`,verb:`mít`},set:{unit:`prvků`,verb:`mít`}};function t(t){return e[t]??null}let n={regex:`regulární výraz`,email:`e-mailová adresa`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`datum a čas ve formátu ISO`,date:`datum ve formátu ISO`,time:`čas ve formátu ISO`,duration:`doba trvání ISO`,ipv4:`IPv4 adresa`,ipv6:`IPv6 adresa`,cidrv4:`rozsah IPv4`,cidrv6:`rozsah IPv6`,base64:`řetězec zakódovaný ve formátu base64`,base64url:`řetězec zakódovaný ve formátu base64url`,json_string:`řetězec ve formátu JSON`,e164:`číslo E.164`,jwt:`JWT`,template_literal:`vstup`},r={nan:`NaN`,number:`číslo`,string:`řetězec`,function:`funkce`,array:`pole`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Neplatný vstup: očekáváno instanceof ${e.expected}, obdrženo ${i}`:`Neplatný vstup: očekáváno ${t}, obdrženo ${i}`}case`invalid_value`:return e.values.length===1?`Neplatný vstup: očekáváno ${C(e.values[0])}`:`Neplatná možnost: očekávána jedna z hodnot ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Hodnota je příliš velká: ${e.origin??`hodnota`} musí mít ${n}${e.maximum.toString()} ${r.unit??`prvků`}`:`Hodnota je příliš velká: ${e.origin??`hodnota`} musí být ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Hodnota je příliš malá: ${e.origin??`hodnota`} musí mít ${n}${e.minimum.toString()} ${r.unit??`prvků`}`:`Hodnota je příliš malá: ${e.origin??`hodnota`} musí být ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Neplatný řetězec: musí začínat na "${t.prefix}"`:t.format===`ends_with`?`Neplatný řetězec: musí končit na "${t.suffix}"`:t.format===`includes`?`Neplatný řetězec: musí obsahovat "${t.includes}"`:t.format===`regex`?`Neplatný řetězec: musí odpovídat vzoru ${t.pattern}`:`Neplatný formát ${n[t.format]??e.format}`}case`not_multiple_of`:return`Neplatné číslo: musí být násobkem ${e.divisor}`;case`unrecognized_keys`:return`Neznámé klíče: ${x(e.keys,`, `)}`;case`invalid_key`:return`Neplatný klíč v ${e.origin}`;case`invalid_union`:return`Neplatný vstup`;case`invalid_element`:return`Neplatná hodnota v ${e.origin}`;default:return`Neplatný vstup`}}};function Wl(){return{localeError:Ul()}}const Gl=()=>{let e={string:{unit:`tegn`,verb:`havde`},file:{unit:`bytes`,verb:`havde`},array:{unit:`elementer`,verb:`indeholdt`},set:{unit:`elementer`,verb:`indeholdt`}};function t(t){return e[t]??null}let n={regex:`input`,email:`e-mailadresse`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO dato- og klokkeslæt`,date:`ISO-dato`,time:`ISO-klokkeslæt`,duration:`ISO-varighed`,ipv4:`IPv4-område`,ipv6:`IPv6-område`,cidrv4:`IPv4-spektrum`,cidrv6:`IPv6-spektrum`,base64:`base64-kodet streng`,base64url:`base64url-kodet streng`,json_string:`JSON-streng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,string:`streng`,number:`tal`,boolean:`boolean`,array:`liste`,object:`objekt`,set:`sæt`,file:`fil`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ugyldigt input: forventede instanceof ${e.expected}, fik ${i}`:`Ugyldigt input: forventede ${t}, fik ${i}`}case`invalid_value`:return e.values.length===1?`Ugyldig værdi: forventede ${C(e.values[0])}`:`Ugyldigt valg: forventede en af følgende ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`For stor: forventede ${a??`value`} ${i.verb} ${n} ${e.maximum.toString()} ${i.unit??`elementer`}`:`For stor: forventede ${a??`value`} havde ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`For lille: forventede ${a} ${i.verb} ${n} ${e.minimum.toString()} ${i.unit}`:`For lille: forventede ${a} havde ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ugyldig streng: skal starte med "${t.prefix}"`:t.format===`ends_with`?`Ugyldig streng: skal ende med "${t.suffix}"`:t.format===`includes`?`Ugyldig streng: skal indeholde "${t.includes}"`:t.format===`regex`?`Ugyldig streng: skal matche mønsteret ${t.pattern}`:`Ugyldig ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ugyldigt tal: skal være deleligt med ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Ukendte nøgler`:`Ukendt nøgle`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Ugyldig nøgle i ${e.origin}`;case`invalid_union`:return`Ugyldigt input: matcher ingen af de tilladte typer`;case`invalid_element`:return`Ugyldig værdi i ${e.origin}`;default:return`Ugyldigt input`}}};function Kl(){return{localeError:Gl()}}const ql=()=>{let e={string:{unit:`Zeichen`,verb:`zu haben`},file:{unit:`Bytes`,verb:`zu haben`},array:{unit:`Elemente`,verb:`zu haben`},set:{unit:`Elemente`,verb:`zu haben`}};function t(t){return e[t]??null}let n={regex:`Eingabe`,email:`E-Mail-Adresse`,url:`URL`,emoji:`Emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-Datum und -Uhrzeit`,date:`ISO-Datum`,time:`ISO-Uhrzeit`,duration:`ISO-Dauer`,ipv4:`IPv4-Adresse`,ipv6:`IPv6-Adresse`,cidrv4:`IPv4-Bereich`,cidrv6:`IPv6-Bereich`,base64:`Base64-codierter String`,base64url:`Base64-URL-codierter String`,json_string:`JSON-String`,e164:`E.164-Nummer`,jwt:`JWT`,template_literal:`Eingabe`},r={nan:`NaN`,number:`Zahl`,array:`Array`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ungültige Eingabe: erwartet instanceof ${e.expected}, erhalten ${i}`:`Ungültige Eingabe: erwartet ${t}, erhalten ${i}`}case`invalid_value`:return e.values.length===1?`Ungültige Eingabe: erwartet ${C(e.values[0])}`:`Ungültige Option: erwartet eine von ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Zu groß: erwartet, dass ${e.origin??`Wert`} ${n}${e.maximum.toString()} ${r.unit??`Elemente`} hat`:`Zu groß: erwartet, dass ${e.origin??`Wert`} ${n}${e.maximum.toString()} ist`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Zu klein: erwartet, dass ${e.origin} ${n}${e.minimum.toString()} ${r.unit} hat`:`Zu klein: erwartet, dass ${e.origin} ${n}${e.minimum.toString()} ist`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ungültiger String: muss mit "${t.prefix}" beginnen`:t.format===`ends_with`?`Ungültiger String: muss mit "${t.suffix}" enden`:t.format===`includes`?`Ungültiger String: muss "${t.includes}" enthalten`:t.format===`regex`?`Ungültiger String: muss dem Muster ${t.pattern} entsprechen`:`Ungültig: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ungültige Zahl: muss ein Vielfaches von ${e.divisor} sein`;case`unrecognized_keys`:return`${e.keys.length>1?`Unbekannte Schlüssel`:`Unbekannter Schlüssel`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Ungültiger Schlüssel in ${e.origin}`;case`invalid_union`:return`Ungültige Eingabe`;case`invalid_element`:return`Ungültiger Wert in ${e.origin}`;default:return`Ungültige Eingabe`}}};function Jl(){return{localeError:ql()}}const Yl=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input);return`Invalid input: expected ${t}, received ${r[n]??n}`}case`invalid_value`:return e.values.length===1?`Invalid input: expected ${C(e.values[0])}`:`Invalid option: expected one of ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Xl(){return{localeError:Yl()}}const Zl=()=>{let e={string:{unit:`karaktrojn`,verb:`havi`},file:{unit:`bajtojn`,verb:`havi`},array:{unit:`elementojn`,verb:`havi`},set:{unit:`elementojn`,verb:`havi`}};function t(t){return e[t]??null}let n={regex:`enigo`,email:`retadreso`,url:`URL`,emoji:`emoĝio`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-datotempo`,date:`ISO-dato`,time:`ISO-tempo`,duration:`ISO-daŭro`,ipv4:`IPv4-adreso`,ipv6:`IPv6-adreso`,cidrv4:`IPv4-rango`,cidrv6:`IPv6-rango`,base64:`64-ume kodita karaktraro`,base64url:`URL-64-ume kodita karaktraro`,json_string:`JSON-karaktraro`,e164:`E.164-nombro`,jwt:`JWT`,template_literal:`enigo`},r={nan:`NaN`,number:`nombro`,array:`tabelo`,null:`senvalora`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Nevalida enigo: atendiĝis instanceof ${e.expected}, riceviĝis ${i}`:`Nevalida enigo: atendiĝis ${t}, riceviĝis ${i}`}case`invalid_value`:return e.values.length===1?`Nevalida enigo: atendiĝis ${C(e.values[0])}`:`Nevalida opcio: atendiĝis unu el ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Tro granda: atendiĝis ke ${e.origin??`valoro`} havu ${n}${e.maximum.toString()} ${r.unit??`elementojn`}`:`Tro granda: atendiĝis ke ${e.origin??`valoro`} havu ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Tro malgranda: atendiĝis ke ${e.origin} havu ${n}${e.minimum.toString()} ${r.unit}`:`Tro malgranda: atendiĝis ke ${e.origin} estu ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Nevalida karaktraro: devas komenciĝi per "${t.prefix}"`:t.format===`ends_with`?`Nevalida karaktraro: devas finiĝi per "${t.suffix}"`:t.format===`includes`?`Nevalida karaktraro: devas inkluzivi "${t.includes}"`:t.format===`regex`?`Nevalida karaktraro: devas kongrui kun la modelo ${t.pattern}`:`Nevalida ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nevalida nombro: devas esti oblo de ${e.divisor}`;case`unrecognized_keys`:return`Nekonata${e.keys.length>1?`j`:``} ŝlosilo${e.keys.length>1?`j`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Nevalida ŝlosilo en ${e.origin}`;case`invalid_union`:return`Nevalida enigo`;case`invalid_element`:return`Nevalida valoro en ${e.origin}`;default:return`Nevalida enigo`}}};function Ql(){return{localeError:Zl()}}const $l=()=>{let e={string:{unit:`caracteres`,verb:`tener`},file:{unit:`bytes`,verb:`tener`},array:{unit:`elementos`,verb:`tener`},set:{unit:`elementos`,verb:`tener`}};function t(t){return e[t]??null}let n={regex:`entrada`,email:`dirección de correo electrónico`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`fecha y hora ISO`,date:`fecha ISO`,time:`hora ISO`,duration:`duración ISO`,ipv4:`dirección IPv4`,ipv6:`dirección IPv6`,cidrv4:`rango IPv4`,cidrv6:`rango IPv6`,base64:`cadena codificada en base64`,base64url:`URL codificada en base64`,json_string:`cadena JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`,string:`texto`,number:`número`,boolean:`booleano`,array:`arreglo`,object:`objeto`,set:`conjunto`,file:`archivo`,date:`fecha`,bigint:`número grande`,symbol:`símbolo`,undefined:`indefinido`,null:`nulo`,function:`función`,map:`mapa`,record:`registro`,tuple:`tupla`,enum:`enumeración`,union:`unión`,literal:`literal`,promise:`promesa`,void:`vacío`,never:`nunca`,unknown:`desconocido`,any:`cualquiera`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrada inválida: se esperaba instanceof ${e.expected}, recibido ${i}`:`Entrada inválida: se esperaba ${t}, recibido ${i}`}case`invalid_value`:return e.values.length===1?`Entrada inválida: se esperaba ${C(e.values[0])}`:`Opción inválida: se esperaba una de ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Demasiado grande: se esperaba que ${a??`valor`} tuviera ${n}${e.maximum.toString()} ${i.unit??`elementos`}`:`Demasiado grande: se esperaba que ${a??`valor`} fuera ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,i=t(e.origin),a=r[e.origin]??e.origin;return i?`Demasiado pequeño: se esperaba que ${a} tuviera ${n}${e.minimum.toString()} ${i.unit}`:`Demasiado pequeño: se esperaba que ${a} fuera ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Cadena inválida: debe comenzar con "${t.prefix}"`:t.format===`ends_with`?`Cadena inválida: debe terminar en "${t.suffix}"`:t.format===`includes`?`Cadena inválida: debe incluir "${t.includes}"`:t.format===`regex`?`Cadena inválida: debe coincidir con el patrón ${t.pattern}`:`Inválido ${n[t.format]??e.format}`}case`not_multiple_of`:return`Número inválido: debe ser múltiplo de ${e.divisor}`;case`unrecognized_keys`:return`Llave${e.keys.length>1?`s`:``} desconocida${e.keys.length>1?`s`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Llave inválida en ${r[e.origin]??e.origin}`;case`invalid_union`:return`Entrada inválida`;case`invalid_element`:return`Valor inválido en ${r[e.origin]??e.origin}`;default:return`Entrada inválida`}}};function eu(){return{localeError:$l()}}const tu=()=>{let e={string:{unit:`کاراکتر`,verb:`داشته باشد`},file:{unit:`بایت`,verb:`داشته باشد`},array:{unit:`آیتم`,verb:`داشته باشد`},set:{unit:`آیتم`,verb:`داشته باشد`}};function t(t){return e[t]??null}let n={regex:`ورودی`,email:`آدرس ایمیل`,url:`URL`,emoji:`ایموجی`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`تاریخ و زمان ایزو`,date:`تاریخ ایزو`,time:`زمان ایزو`,duration:`مدت زمان ایزو`,ipv4:`IPv4 آدرس`,ipv6:`IPv6 آدرس`,cidrv4:`IPv4 دامنه`,cidrv6:`IPv6 دامنه`,base64:`base64-encoded رشته`,base64url:`base64url-encoded رشته`,json_string:`JSON رشته`,e164:`E.164 عدد`,jwt:`JWT`,template_literal:`ورودی`},r={nan:`NaN`,number:`عدد`,array:`آرایه`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ورودی نامعتبر: میبایست instanceof ${e.expected} میبود، ${i} دریافت شد`:`ورودی نامعتبر: میبایست ${t} میبود، ${i} دریافت شد`}case`invalid_value`:return e.values.length===1?`ورودی نامعتبر: میبایست ${C(e.values[0])} میبود`:`گزینه نامعتبر: میبایست یکی از ${x(e.values,`|`)} میبود`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`خیلی بزرگ: ${e.origin??`مقدار`} باید ${n}${e.maximum.toString()} ${r.unit??`عنصر`} باشد`:`خیلی بزرگ: ${e.origin??`مقدار`} باید ${n}${e.maximum.toString()} باشد`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`خیلی کوچک: ${e.origin} باید ${n}${e.minimum.toString()} ${r.unit} باشد`:`خیلی کوچک: ${e.origin} باید ${n}${e.minimum.toString()} باشد`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`رشته نامعتبر: باید با "${t.prefix}" شروع شود`:t.format===`ends_with`?`رشته نامعتبر: باید با "${t.suffix}" تمام شود`:t.format===`includes`?`رشته نامعتبر: باید شامل "${t.includes}" باشد`:t.format===`regex`?`رشته نامعتبر: باید با الگوی ${t.pattern} مطابقت داشته باشد`:`${n[t.format]??e.format} نامعتبر`}case`not_multiple_of`:return`عدد نامعتبر: باید مضرب ${e.divisor} باشد`;case`unrecognized_keys`:return`کلید${e.keys.length>1?`های`:``} ناشناس: ${x(e.keys,`, `)}`;case`invalid_key`:return`کلید ناشناس در ${e.origin}`;case`invalid_union`:return`ورودی نامعتبر`;case`invalid_element`:return`مقدار نامعتبر در ${e.origin}`;default:return`ورودی نامعتبر`}}};function nu(){return{localeError:tu()}}const ru=()=>{let e={string:{unit:`merkkiä`,subject:`merkkijonon`},file:{unit:`tavua`,subject:`tiedoston`},array:{unit:`alkiota`,subject:`listan`},set:{unit:`alkiota`,subject:`joukon`},number:{unit:``,subject:`luvun`},bigint:{unit:``,subject:`suuren kokonaisluvun`},int:{unit:``,subject:`kokonaisluvun`},date:{unit:``,subject:`päivämäärän`}};function t(t){return e[t]??null}let n={regex:`säännöllinen lauseke`,email:`sähköpostiosoite`,url:`URL-osoite`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-aikaleima`,date:`ISO-päivämäärä`,time:`ISO-aika`,duration:`ISO-kesto`,ipv4:`IPv4-osoite`,ipv6:`IPv6-osoite`,cidrv4:`IPv4-alue`,cidrv6:`IPv6-alue`,base64:`base64-koodattu merkkijono`,base64url:`base64url-koodattu merkkijono`,json_string:`JSON-merkkijono`,e164:`E.164-luku`,jwt:`JWT`,template_literal:`templaattimerkkijono`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Virheellinen tyyppi: odotettiin instanceof ${e.expected}, oli ${i}`:`Virheellinen tyyppi: odotettiin ${t}, oli ${i}`}case`invalid_value`:return e.values.length===1?`Virheellinen syöte: täytyy olla ${C(e.values[0])}`:`Virheellinen valinta: täytyy olla yksi seuraavista: ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Liian suuri: ${r.subject} täytyy olla ${n}${e.maximum.toString()} ${r.unit}`.trim():`Liian suuri: arvon täytyy olla ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Liian pieni: ${r.subject} täytyy olla ${n}${e.minimum.toString()} ${r.unit}`.trim():`Liian pieni: arvon täytyy olla ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Virheellinen syöte: täytyy alkaa "${t.prefix}"`:t.format===`ends_with`?`Virheellinen syöte: täytyy loppua "${t.suffix}"`:t.format===`includes`?`Virheellinen syöte: täytyy sisältää "${t.includes}"`:t.format===`regex`?`Virheellinen syöte: täytyy vastata säännöllistä lauseketta ${t.pattern}`:`Virheellinen ${n[t.format]??e.format}`}case`not_multiple_of`:return`Virheellinen luku: täytyy olla luvun ${e.divisor} monikerta`;case`unrecognized_keys`:return`${e.keys.length>1?`Tuntemattomat avaimet`:`Tuntematon avain`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Virheellinen avain tietueessa`;case`invalid_union`:return`Virheellinen unioni`;case`invalid_element`:return`Virheellinen arvo joukossa`;default:return`Virheellinen syöte`}}};function iu(){return{localeError:ru()}}const au=()=>{let e={string:{unit:`caractères`,verb:`avoir`},file:{unit:`octets`,verb:`avoir`},array:{unit:`éléments`,verb:`avoir`},set:{unit:`éléments`,verb:`avoir`}};function t(t){return e[t]??null}let n={regex:`entrée`,email:`adresse e-mail`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`date et heure ISO`,date:`date ISO`,time:`heure ISO`,duration:`durée ISO`,ipv4:`adresse IPv4`,ipv6:`adresse IPv6`,cidrv4:`plage IPv4`,cidrv6:`plage IPv6`,base64:`chaîne encodée en base64`,base64url:`chaîne encodée en base64url`,json_string:`chaîne JSON`,e164:`numéro E.164`,jwt:`JWT`,template_literal:`entrée`},r={nan:`NaN`,number:`nombre`,array:`tableau`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrée invalide : instanceof ${e.expected} attendu, ${i} reçu`:`Entrée invalide : ${t} attendu, ${i} reçu`}case`invalid_value`:return e.values.length===1?`Entrée invalide : ${C(e.values[0])} attendu`:`Option invalide : une valeur parmi ${x(e.values,`|`)} attendue`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Trop grand : ${e.origin??`valeur`} doit ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`élément(s)`}`:`Trop grand : ${e.origin??`valeur`} doit être ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Trop petit : ${e.origin} doit ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Trop petit : ${e.origin} doit être ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chaîne invalide : doit commencer par "${t.prefix}"`:t.format===`ends_with`?`Chaîne invalide : doit se terminer par "${t.suffix}"`:t.format===`includes`?`Chaîne invalide : doit inclure "${t.includes}"`:t.format===`regex`?`Chaîne invalide : doit correspondre au modèle ${t.pattern}`:`${n[t.format]??e.format} invalide`}case`not_multiple_of`:return`Nombre invalide : doit être un multiple de ${e.divisor}`;case`unrecognized_keys`:return`Clé${e.keys.length>1?`s`:``} non reconnue${e.keys.length>1?`s`:``} : ${x(e.keys,`, `)}`;case`invalid_key`:return`Clé invalide dans ${e.origin}`;case`invalid_union`:return`Entrée invalide`;case`invalid_element`:return`Valeur invalide dans ${e.origin}`;default:return`Entrée invalide`}}};function ou(){return{localeError:au()}}const su=()=>{let e={string:{unit:`caractères`,verb:`avoir`},file:{unit:`octets`,verb:`avoir`},array:{unit:`éléments`,verb:`avoir`},set:{unit:`éléments`,verb:`avoir`}};function t(t){return e[t]??null}let n={regex:`entrée`,email:`adresse courriel`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`date-heure ISO`,date:`date ISO`,time:`heure ISO`,duration:`durée ISO`,ipv4:`adresse IPv4`,ipv6:`adresse IPv6`,cidrv4:`plage IPv4`,cidrv6:`plage IPv6`,base64:`chaîne encodée en base64`,base64url:`chaîne encodée en base64url`,json_string:`chaîne JSON`,e164:`numéro E.164`,jwt:`JWT`,template_literal:`entrée`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Entrée invalide : attendu instanceof ${e.expected}, reçu ${i}`:`Entrée invalide : attendu ${t}, reçu ${i}`}case`invalid_value`:return e.values.length===1?`Entrée invalide : attendu ${C(e.values[0])}`:`Option invalide : attendu l'une des valeurs suivantes ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`≤`:`<`,r=t(e.origin);return r?`Trop grand : attendu que ${e.origin??`la valeur`} ait ${n}${e.maximum.toString()} ${r.unit}`:`Trop grand : attendu que ${e.origin??`la valeur`} soit ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`≥`:`>`,r=t(e.origin);return r?`Trop petit : attendu que ${e.origin} ait ${n}${e.minimum.toString()} ${r.unit}`:`Trop petit : attendu que ${e.origin} soit ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chaîne invalide : doit commencer par "${t.prefix}"`:t.format===`ends_with`?`Chaîne invalide : doit se terminer par "${t.suffix}"`:t.format===`includes`?`Chaîne invalide : doit inclure "${t.includes}"`:t.format===`regex`?`Chaîne invalide : doit correspondre au motif ${t.pattern}`:`${n[t.format]??e.format} invalide`}case`not_multiple_of`:return`Nombre invalide : doit être un multiple de ${e.divisor}`;case`unrecognized_keys`:return`Clé${e.keys.length>1?`s`:``} non reconnue${e.keys.length>1?`s`:``} : ${x(e.keys,`, `)}`;case`invalid_key`:return`Clé invalide dans ${e.origin}`;case`invalid_union`:return`Entrée invalide`;case`invalid_element`:return`Valeur invalide dans ${e.origin}`;default:return`Entrée invalide`}}};function cu(){return{localeError:su()}}const lu=()=>{let e={string:{label:`מחרוזת`,gender:`f`},number:{label:`מספר`,gender:`m`},boolean:{label:`ערך בוליאני`,gender:`m`},bigint:{label:`BigInt`,gender:`m`},date:{label:`תאריך`,gender:`m`},array:{label:`מערך`,gender:`m`},object:{label:`אובייקט`,gender:`m`},null:{label:`ערך ריק (null)`,gender:`m`},undefined:{label:`ערך לא מוגדר (undefined)`,gender:`m`},symbol:{label:`סימבול (Symbol)`,gender:`m`},function:{label:`פונקציה`,gender:`f`},map:{label:`מפה (Map)`,gender:`f`},set:{label:`קבוצה (Set)`,gender:`f`},file:{label:`קובץ`,gender:`m`},promise:{label:`Promise`,gender:`m`},NaN:{label:`NaN`,gender:`m`},unknown:{label:`ערך לא ידוע`,gender:`m`},value:{label:`ערך`,gender:`m`}},t={string:{unit:`תווים`,shortLabel:`קצר`,longLabel:`ארוך`},file:{unit:`בייטים`,shortLabel:`קטן`,longLabel:`גדול`},array:{unit:`פריטים`,shortLabel:`קטן`,longLabel:`גדול`},set:{unit:`פריטים`,shortLabel:`קטן`,longLabel:`גדול`},number:{unit:``,shortLabel:`קטן`,longLabel:`גדול`}},n=t=>t?e[t]:void 0,r=t=>{let r=n(t);return r?r.label:t??e.unknown.label},i=e=>`ה${r(e)}`,a=e=>(n(e)?.gender??`m`)===`f`?`צריכה להיות`:`צריך להיות`,o=e=>e?t[e]??null:null,s={regex:{label:`קלט`,gender:`m`},email:{label:`כתובת אימייל`,gender:`f`},url:{label:`כתובת רשת`,gender:`f`},emoji:{label:`אימוג'י`,gender:`m`},uuid:{label:`UUID`,gender:`m`},nanoid:{label:`nanoid`,gender:`m`},guid:{label:`GUID`,gender:`m`},cuid:{label:`cuid`,gender:`m`},cuid2:{label:`cuid2`,gender:`m`},ulid:{label:`ULID`,gender:`m`},xid:{label:`XID`,gender:`m`},ksuid:{label:`KSUID`,gender:`m`},datetime:{label:`תאריך וזמן ISO`,gender:`m`},date:{label:`תאריך ISO`,gender:`m`},time:{label:`זמן ISO`,gender:`m`},duration:{label:`משך זמן ISO`,gender:`m`},ipv4:{label:`כתובת IPv4`,gender:`f`},ipv6:{label:`כתובת IPv6`,gender:`f`},cidrv4:{label:`טווח IPv4`,gender:`m`},cidrv6:{label:`טווח IPv6`,gender:`m`},base64:{label:`מחרוזת בבסיס 64`,gender:`f`},base64url:{label:`מחרוזת בבסיס 64 לכתובות רשת`,gender:`f`},json_string:{label:`מחרוזת JSON`,gender:`f`},e164:{label:`מספר E.164`,gender:`m`},jwt:{label:`JWT`,gender:`m`},ends_with:{label:`קלט`,gender:`m`},includes:{label:`קלט`,gender:`m`},lowercase:{label:`קלט`,gender:`m`},starts_with:{label:`קלט`,gender:`m`},uppercase:{label:`קלט`,gender:`m`}},c={nan:`NaN`};return t=>{switch(t.code){case`invalid_type`:{let n=t.expected,i=c[n??``]??r(n),a=S(t.input),o=c[a]??e[a]?.label??a;return/^[A-Z]/.test(t.expected)?`קלט לא תקין: צריך להיות instanceof ${t.expected}, התקבל ${o}`:`קלט לא תקין: צריך להיות ${i}, התקבל ${o}`}case`invalid_value`:{if(t.values.length===1)return`ערך לא תקין: הערך חייב להיות ${C(t.values[0])}`;let e=t.values.map(e=>C(e));if(t.values.length===2)return`ערך לא תקין: האפשרויות המתאימות הן ${e[0]} או ${e[1]}`;let n=e[e.length-1];return`ערך לא תקין: האפשרויות המתאימות הן ${e.slice(0,-1).join(`, `)} או ${n}`}case`too_big`:{let e=o(t.origin),n=i(t.origin??`value`);if(t.origin===`string`)return`${e?.longLabel??`ארוך`} מדי: ${n} צריכה להכיל ${t.maximum.toString()} ${e?.unit??``} ${t.inclusive?`או פחות`:`לכל היותר`}`.trim();if(t.origin===`number`)return`גדול מדי: ${n} צריך להיות ${t.inclusive?`קטן או שווה ל-${t.maximum}`:`קטן מ-${t.maximum}`}`;if(t.origin===`array`||t.origin===`set`)return`גדול מדי: ${n} ${t.origin===`set`?`צריכה`:`צריך`} להכיל ${t.inclusive?`${t.maximum} ${e?.unit??``} או פחות`:`פחות מ-${t.maximum} ${e?.unit??``}`}`.trim();let r=t.inclusive?`<=`:`<`,s=a(t.origin??`value`);return e?.unit?`${e.longLabel} מדי: ${n} ${s} ${r}${t.maximum.toString()} ${e.unit}`:`${e?.longLabel??`גדול`} מדי: ${n} ${s} ${r}${t.maximum.toString()}`}case`too_small`:{let e=o(t.origin),n=i(t.origin??`value`);if(t.origin===`string`)return`${e?.shortLabel??`קצר`} מדי: ${n} צריכה להכיל ${t.minimum.toString()} ${e?.unit??``} ${t.inclusive?`או יותר`:`לפחות`}`.trim();if(t.origin===`number`)return`קטן מדי: ${n} צריך להיות ${t.inclusive?`גדול או שווה ל-${t.minimum}`:`גדול מ-${t.minimum}`}`;if(t.origin===`array`||t.origin===`set`){let r=t.origin===`set`?`צריכה`:`צריך`;return t.minimum===1&&t.inclusive?`קטן מדי: ${n} ${r} להכיל ${t.origin,`לפחות פריט אחד`}`:`קטן מדי: ${n} ${r} להכיל ${t.inclusive?`${t.minimum} ${e?.unit??``} או יותר`:`יותר מ-${t.minimum} ${e?.unit??``}`}`.trim()}let r=t.inclusive?`>=`:`>`,s=a(t.origin??`value`);return e?.unit?`${e.shortLabel} מדי: ${n} ${s} ${r}${t.minimum.toString()} ${e.unit}`:`${e?.shortLabel??`קטן`} מדי: ${n} ${s} ${r}${t.minimum.toString()}`}case`invalid_format`:{let e=t;if(e.format===`starts_with`)return`המחרוזת חייבת להתחיל ב "${e.prefix}"`;if(e.format===`ends_with`)return`המחרוזת חייבת להסתיים ב "${e.suffix}"`;if(e.format===`includes`)return`המחרוזת חייבת לכלול "${e.includes}"`;if(e.format===`regex`)return`המחרוזת חייבת להתאים לתבנית ${e.pattern}`;let n=s[e.format];return`${n?.label??e.format} לא ${(n?.gender??`m`)===`f`?`תקינה`:`תקין`}`}case`not_multiple_of`:return`מספר לא תקין: חייב להיות מכפלה של ${t.divisor}`;case`unrecognized_keys`:return`מפתח${t.keys.length>1?`ות`:``} לא מזוה${t.keys.length>1?`ים`:`ה`}: ${x(t.keys,`, `)}`;case`invalid_key`:return`שדה לא תקין באובייקט`;case`invalid_union`:return`קלט לא תקין`;case`invalid_element`:return`ערך לא תקין ב${i(t.origin??`array`)}`;default:return`קלט לא תקין`}}};function uu(){return{localeError:lu()}}const du=()=>{let e={string:{unit:`karakter`,verb:`legyen`},file:{unit:`byte`,verb:`legyen`},array:{unit:`elem`,verb:`legyen`},set:{unit:`elem`,verb:`legyen`}};function t(t){return e[t]??null}let n={regex:`bemenet`,email:`email cím`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO időbélyeg`,date:`ISO dátum`,time:`ISO idő`,duration:`ISO időintervallum`,ipv4:`IPv4 cím`,ipv6:`IPv6 cím`,cidrv4:`IPv4 tartomány`,cidrv6:`IPv6 tartomány`,base64:`base64-kódolt string`,base64url:`base64url-kódolt string`,json_string:`JSON string`,e164:`E.164 szám`,jwt:`JWT`,template_literal:`bemenet`},r={nan:`NaN`,number:`szám`,array:`tömb`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Érvénytelen bemenet: a várt érték instanceof ${e.expected}, a kapott érték ${i}`:`Érvénytelen bemenet: a várt érték ${t}, a kapott érték ${i}`}case`invalid_value`:return e.values.length===1?`Érvénytelen bemenet: a várt érték ${C(e.values[0])}`:`Érvénytelen opció: valamelyik érték várt ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Túl nagy: ${e.origin??`érték`} mérete túl nagy ${n}${e.maximum.toString()} ${r.unit??`elem`}`:`Túl nagy: a bemeneti érték ${e.origin??`érték`} túl nagy: ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Túl kicsi: a bemeneti érték ${e.origin} mérete túl kicsi ${n}${e.minimum.toString()} ${r.unit}`:`Túl kicsi: a bemeneti érték ${e.origin} túl kicsi ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Érvénytelen string: "${t.prefix}" értékkel kell kezdődnie`:t.format===`ends_with`?`Érvénytelen string: "${t.suffix}" értékkel kell végződnie`:t.format===`includes`?`Érvénytelen string: "${t.includes}" értéket kell tartalmaznia`:t.format===`regex`?`Érvénytelen string: ${t.pattern} mintának kell megfelelnie`:`Érvénytelen ${n[t.format]??e.format}`}case`not_multiple_of`:return`Érvénytelen szám: ${e.divisor} többszörösének kell lennie`;case`unrecognized_keys`:return`Ismeretlen kulcs${e.keys.length>1?`s`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Érvénytelen kulcs ${e.origin}`;case`invalid_union`:return`Érvénytelen bemenet`;case`invalid_element`:return`Érvénytelen érték: ${e.origin}`;default:return`Érvénytelen bemenet`}}};function fu(){return{localeError:du()}}function pu(e,t,n){return Math.abs(e)===1?t:n}function mu(e){if(!e)return``;let t=[`ա`,`ե`,`ը`,`ի`,`ո`,`ու`,`օ`],n=e[e.length-1];return e+(t.includes(n)?`ն`:`ը`)}const hu=()=>{let e={string:{unit:{one:`նշան`,many:`նշաններ`},verb:`ունենալ`},file:{unit:{one:`բայթ`,many:`բայթեր`},verb:`ունենալ`},array:{unit:{one:`տարր`,many:`տարրեր`},verb:`ունենալ`},set:{unit:{one:`տարր`,many:`տարրեր`},verb:`ունենալ`}};function t(t){return e[t]??null}let n={regex:`մուտք`,email:`էլ. հասցե`,url:`URL`,emoji:`էմոջի`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO ամսաթիվ և ժամ`,date:`ISO ամսաթիվ`,time:`ISO ժամ`,duration:`ISO տևողություն`,ipv4:`IPv4 հասցե`,ipv6:`IPv6 հասցե`,cidrv4:`IPv4 միջակայք`,cidrv6:`IPv6 միջակայք`,base64:`base64 ձևաչափով տող`,base64url:`base64url ձևաչափով տող`,json_string:`JSON տող`,e164:`E.164 համար`,jwt:`JWT`,template_literal:`մուտք`},r={nan:`NaN`,number:`թիվ`,array:`զանգված`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Սխալ մուտքագրում․ սպասվում էր instanceof ${e.expected}, ստացվել է ${i}`:`Սխալ մուտքագրում․ սպասվում էր ${t}, ստացվել է ${i}`}case`invalid_value`:return e.values.length===1?`Սխալ մուտքագրում․ սպասվում էր ${C(e.values[1])}`:`Սխալ տարբերակ․ սպասվում էր հետևյալներից մեկը՝ ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=pu(Number(e.maximum),r.unit.one,r.unit.many);return`Չափազանց մեծ արժեք․ սպասվում է, որ ${mu(e.origin??`արժեք`)} կունենա ${n}${e.maximum.toString()} ${t}`}return`Չափազանց մեծ արժեք․ սպասվում է, որ ${mu(e.origin??`արժեք`)} լինի ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=pu(Number(e.minimum),r.unit.one,r.unit.many);return`Չափազանց փոքր արժեք․ սպասվում է, որ ${mu(e.origin)} կունենա ${n}${e.minimum.toString()} ${t}`}return`Չափազանց փոքր արժեք․ սպասվում է, որ ${mu(e.origin)} լինի ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Սխալ տող․ պետք է սկսվի "${t.prefix}"-ով`:t.format===`ends_with`?`Սխալ տող․ պետք է ավարտվի "${t.suffix}"-ով`:t.format===`includes`?`Սխալ տող․ պետք է պարունակի "${t.includes}"`:t.format===`regex`?`Սխալ տող․ պետք է համապատասխանի ${t.pattern} ձևաչափին`:`Սխալ ${n[t.format]??e.format}`}case`not_multiple_of`:return`Սխալ թիվ․ պետք է բազմապատիկ լինի ${e.divisor}-ի`;case`unrecognized_keys`:return`Չճանաչված բանալի${e.keys.length>1?`ներ`:``}. ${x(e.keys,`, `)}`;case`invalid_key`:return`Սխալ բանալի ${mu(e.origin)}-ում`;case`invalid_union`:return`Սխալ մուտքագրում`;case`invalid_element`:return`Սխալ արժեք ${mu(e.origin)}-ում`;default:return`Սխալ մուտքագրում`}}};function gu(){return{localeError:hu()}}const _u=()=>{let e={string:{unit:`karakter`,verb:`memiliki`},file:{unit:`byte`,verb:`memiliki`},array:{unit:`item`,verb:`memiliki`},set:{unit:`item`,verb:`memiliki`}};function t(t){return e[t]??null}let n={regex:`input`,email:`alamat email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`tanggal dan waktu format ISO`,date:`tanggal format ISO`,time:`jam format ISO`,duration:`durasi format ISO`,ipv4:`alamat IPv4`,ipv6:`alamat IPv6`,cidrv4:`rentang alamat IPv4`,cidrv6:`rentang alamat IPv6`,base64:`string dengan enkode base64`,base64url:`string dengan enkode base64url`,json_string:`string JSON`,e164:`angka E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input tidak valid: diharapkan instanceof ${e.expected}, diterima ${i}`:`Input tidak valid: diharapkan ${t}, diterima ${i}`}case`invalid_value`:return e.values.length===1?`Input tidak valid: diharapkan ${C(e.values[0])}`:`Pilihan tidak valid: diharapkan salah satu dari ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Terlalu besar: diharapkan ${e.origin??`value`} memiliki ${n}${e.maximum.toString()} ${r.unit??`elemen`}`:`Terlalu besar: diharapkan ${e.origin??`value`} menjadi ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Terlalu kecil: diharapkan ${e.origin} memiliki ${n}${e.minimum.toString()} ${r.unit}`:`Terlalu kecil: diharapkan ${e.origin} menjadi ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`String tidak valid: harus dimulai dengan "${t.prefix}"`:t.format===`ends_with`?`String tidak valid: harus berakhir dengan "${t.suffix}"`:t.format===`includes`?`String tidak valid: harus menyertakan "${t.includes}"`:t.format===`regex`?`String tidak valid: harus sesuai pola ${t.pattern}`:`${n[t.format]??e.format} tidak valid`}case`not_multiple_of`:return`Angka tidak valid: harus kelipatan dari ${e.divisor}`;case`unrecognized_keys`:return`Kunci tidak dikenali ${e.keys.length>1?`s`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Kunci tidak valid di ${e.origin}`;case`invalid_union`:return`Input tidak valid`;case`invalid_element`:return`Nilai tidak valid di ${e.origin}`;default:return`Input tidak valid`}}};function vu(){return{localeError:_u()}}const yu=()=>{let e={string:{unit:`stafi`,verb:`að hafa`},file:{unit:`bæti`,verb:`að hafa`},array:{unit:`hluti`,verb:`að hafa`},set:{unit:`hluti`,verb:`að hafa`}};function t(t){return e[t]??null}let n={regex:`gildi`,email:`netfang`,url:`vefslóð`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO dagsetning og tími`,date:`ISO dagsetning`,time:`ISO tími`,duration:`ISO tímalengd`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded strengur`,base64url:`base64url-encoded strengur`,json_string:`JSON strengur`,e164:`E.164 tölugildi`,jwt:`JWT`,template_literal:`gildi`},r={nan:`NaN`,number:`númer`,array:`fylki`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Rangt gildi: Þú slóst inn ${i} þar sem á að vera instanceof ${e.expected}`:`Rangt gildi: Þú slóst inn ${i} þar sem á að vera ${t}`}case`invalid_value`:return e.values.length===1?`Rangt gildi: gert ráð fyrir ${C(e.values[0])}`:`Ógilt val: má vera eitt af eftirfarandi ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Of stórt: gert er ráð fyrir að ${e.origin??`gildi`} hafi ${n}${e.maximum.toString()} ${r.unit??`hluti`}`:`Of stórt: gert er ráð fyrir að ${e.origin??`gildi`} sé ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Of lítið: gert er ráð fyrir að ${e.origin} hafi ${n}${e.minimum.toString()} ${r.unit}`:`Of lítið: gert er ráð fyrir að ${e.origin} sé ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ógildur strengur: verður að byrja á "${t.prefix}"`:t.format===`ends_with`?`Ógildur strengur: verður að enda á "${t.suffix}"`:t.format===`includes`?`Ógildur strengur: verður að innihalda "${t.includes}"`:t.format===`regex`?`Ógildur strengur: verður að fylgja mynstri ${t.pattern}`:`Rangt ${n[t.format]??e.format}`}case`not_multiple_of`:return`Röng tala: verður að vera margfeldi af ${e.divisor}`;case`unrecognized_keys`:return`Óþekkt ${e.keys.length>1?`ir lyklar`:`ur lykill`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Rangur lykill í ${e.origin}`;case`invalid_union`:return`Rangt gildi`;case`invalid_element`:return`Rangt gildi í ${e.origin}`;default:return`Rangt gildi`}}};function bu(){return{localeError:yu()}}const xu=()=>{let e={string:{unit:`caratteri`,verb:`avere`},file:{unit:`byte`,verb:`avere`},array:{unit:`elementi`,verb:`avere`},set:{unit:`elementi`,verb:`avere`}};function t(t){return e[t]??null}let n={regex:`input`,email:`indirizzo email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data e ora ISO`,date:`data ISO`,time:`ora ISO`,duration:`durata ISO`,ipv4:`indirizzo IPv4`,ipv6:`indirizzo IPv6`,cidrv4:`intervallo IPv4`,cidrv6:`intervallo IPv6`,base64:`stringa codificata in base64`,base64url:`URL codificata in base64`,json_string:`stringa JSON`,e164:`numero E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`numero`,array:`vettore`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input non valido: atteso instanceof ${e.expected}, ricevuto ${i}`:`Input non valido: atteso ${t}, ricevuto ${i}`}case`invalid_value`:return e.values.length===1?`Input non valido: atteso ${C(e.values[0])}`:`Opzione non valida: atteso uno tra ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Troppo grande: ${e.origin??`valore`} deve avere ${n}${e.maximum.toString()} ${r.unit??`elementi`}`:`Troppo grande: ${e.origin??`valore`} deve essere ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Troppo piccolo: ${e.origin} deve avere ${n}${e.minimum.toString()} ${r.unit}`:`Troppo piccolo: ${e.origin} deve essere ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Stringa non valida: deve iniziare con "${t.prefix}"`:t.format===`ends_with`?`Stringa non valida: deve terminare con "${t.suffix}"`:t.format===`includes`?`Stringa non valida: deve includere "${t.includes}"`:t.format===`regex`?`Stringa non valida: deve corrispondere al pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Numero non valido: deve essere un multiplo di ${e.divisor}`;case`unrecognized_keys`:return`Chiav${e.keys.length>1?`i`:`e`} non riconosciut${e.keys.length>1?`e`:`a`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Chiave non valida in ${e.origin}`;case`invalid_union`:return`Input non valido`;case`invalid_element`:return`Valore non valido in ${e.origin}`;default:return`Input non valido`}}};function Su(){return{localeError:xu()}}const Cu=()=>{let e={string:{unit:`文字`,verb:`である`},file:{unit:`バイト`,verb:`である`},array:{unit:`要素`,verb:`である`},set:{unit:`要素`,verb:`である`}};function t(t){return e[t]??null}let n={regex:`入力値`,email:`メールアドレス`,url:`URL`,emoji:`絵文字`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO日時`,date:`ISO日付`,time:`ISO時刻`,duration:`ISO期間`,ipv4:`IPv4アドレス`,ipv6:`IPv6アドレス`,cidrv4:`IPv4範囲`,cidrv6:`IPv6範囲`,base64:`base64エンコード文字列`,base64url:`base64urlエンコード文字列`,json_string:`JSON文字列`,e164:`E.164番号`,jwt:`JWT`,template_literal:`入力値`},r={nan:`NaN`,number:`数値`,array:`配列`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`無効な入力: instanceof ${e.expected}が期待されましたが、${i}が入力されました`:`無効な入力: ${t}が期待されましたが、${i}が入力されました`}case`invalid_value`:return e.values.length===1?`無効な入力: ${C(e.values[0])}が期待されました`:`無効な選択: ${x(e.values,`、`)}のいずれかである必要があります`;case`too_big`:{let n=e.inclusive?`以下である`:`より小さい`,r=t(e.origin);return r?`大きすぎる値: ${e.origin??`値`}は${e.maximum.toString()}${r.unit??`要素`}${n}必要があります`:`大きすぎる値: ${e.origin??`値`}は${e.maximum.toString()}${n}必要があります`}case`too_small`:{let n=e.inclusive?`以上である`:`より大きい`,r=t(e.origin);return r?`小さすぎる値: ${e.origin}は${e.minimum.toString()}${r.unit}${n}必要があります`:`小さすぎる値: ${e.origin}は${e.minimum.toString()}${n}必要があります`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`無効な文字列: "${t.prefix}"で始まる必要があります`:t.format===`ends_with`?`無効な文字列: "${t.suffix}"で終わる必要があります`:t.format===`includes`?`無効な文字列: "${t.includes}"を含む必要があります`:t.format===`regex`?`無効な文字列: パターン${t.pattern}に一致する必要があります`:`無効な${n[t.format]??e.format}`}case`not_multiple_of`:return`無効な数値: ${e.divisor}の倍数である必要があります`;case`unrecognized_keys`:return`認識されていないキー${e.keys.length>1?`群`:``}: ${x(e.keys,`、`)}`;case`invalid_key`:return`${e.origin}内の無効なキー`;case`invalid_union`:return`無効な入力`;case`invalid_element`:return`${e.origin}内の無効な値`;default:return`無効な入力`}}};function wu(){return{localeError:Cu()}}const Tu=()=>{let e={string:{unit:`სიმბოლო`,verb:`უნდა შეიცავდეს`},file:{unit:`ბაიტი`,verb:`უნდა შეიცავდეს`},array:{unit:`ელემენტი`,verb:`უნდა შეიცავდეს`},set:{unit:`ელემენტი`,verb:`უნდა შეიცავდეს`}};function t(t){return e[t]??null}let n={regex:`შეყვანა`,email:`ელ-ფოსტის მისამართი`,url:`URL`,emoji:`ემოჯი`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`თარიღი-დრო`,date:`თარიღი`,time:`დრო`,duration:`ხანგრძლივობა`,ipv4:`IPv4 მისამართი`,ipv6:`IPv6 მისამართი`,cidrv4:`IPv4 დიაპაზონი`,cidrv6:`IPv6 დიაპაზონი`,base64:`base64-კოდირებული სტრინგი`,base64url:`base64url-კოდირებული სტრინგი`,json_string:`JSON სტრინგი`,e164:`E.164 ნომერი`,jwt:`JWT`,template_literal:`შეყვანა`},r={nan:`NaN`,number:`რიცხვი`,string:`სტრინგი`,boolean:`ბულეანი`,function:`ფუნქცია`,array:`მასივი`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`არასწორი შეყვანა: მოსალოდნელი instanceof ${e.expected}, მიღებული ${i}`:`არასწორი შეყვანა: მოსალოდნელი ${t}, მიღებული ${i}`}case`invalid_value`:return e.values.length===1?`არასწორი შეყვანა: მოსალოდნელი ${C(e.values[0])}`:`არასწორი ვარიანტი: მოსალოდნელია ერთ-ერთი ${x(e.values,`|`)}-დან`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ზედმეტად დიდი: მოსალოდნელი ${e.origin??`მნიშვნელობა`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit}`:`ზედმეტად დიდი: მოსალოდნელი ${e.origin??`მნიშვნელობა`} იყოს ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`ზედმეტად პატარა: მოსალოდნელი ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`ზედმეტად პატარა: მოსალოდნელი ${e.origin} იყოს ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`არასწორი სტრინგი: უნდა იწყებოდეს "${t.prefix}"-ით`:t.format===`ends_with`?`არასწორი სტრინგი: უნდა მთავრდებოდეს "${t.suffix}"-ით`:t.format===`includes`?`არასწორი სტრინგი: უნდა შეიცავდეს "${t.includes}"-ს`:t.format===`regex`?`არასწორი სტრინგი: უნდა შეესაბამებოდეს შაბლონს ${t.pattern}`:`არასწორი ${n[t.format]??e.format}`}case`not_multiple_of`:return`არასწორი რიცხვი: უნდა იყოს ${e.divisor}-ის ჯერადი`;case`unrecognized_keys`:return`უცნობი გასაღებ${e.keys.length>1?`ები`:`ი`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`არასწორი გასაღები ${e.origin}-ში`;case`invalid_union`:return`არასწორი შეყვანა`;case`invalid_element`:return`არასწორი მნიშვნელობა ${e.origin}-ში`;default:return`არასწორი შეყვანა`}}};function Eu(){return{localeError:Tu()}}const Du=()=>{let e={string:{unit:`តួអក្សរ`,verb:`គួរមាន`},file:{unit:`បៃ`,verb:`គួរមាន`},array:{unit:`ធាតុ`,verb:`គួរមាន`},set:{unit:`ធាតុ`,verb:`គួរមាន`}};function t(t){return e[t]??null}let n={regex:`ទិន្នន័យបញ្ចូល`,email:`អាសយដ្ឋានអ៊ីមែល`,url:`URL`,emoji:`សញ្ញាអារម្មណ៍`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`កាលបរិច្ឆេទ និងម៉ោង ISO`,date:`កាលបរិច្ឆេទ ISO`,time:`ម៉ោង ISO`,duration:`រយៈពេល ISO`,ipv4:`អាសយដ្ឋាន IPv4`,ipv6:`អាសយដ្ឋាន IPv6`,cidrv4:`ដែនអាសយដ្ឋាន IPv4`,cidrv6:`ដែនអាសយដ្ឋាន IPv6`,base64:`ខ្សែអក្សរអ៊ិកូដ base64`,base64url:`ខ្សែអក្សរអ៊ិកូដ base64url`,json_string:`ខ្សែអក្សរ JSON`,e164:`លេខ E.164`,jwt:`JWT`,template_literal:`ទិន្នន័យបញ្ចូល`},r={nan:`NaN`,number:`លេខ`,array:`អារេ (Array)`,null:`គ្មានតម្លៃ (null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ instanceof ${e.expected} ប៉ុន្តែទទួលបាន ${i}`:`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${t} ប៉ុន្តែទទួលបាន ${i}`}case`invalid_value`:return e.values.length===1?`ទិន្នន័យបញ្ចូលមិនត្រឹមត្រូវ៖ ត្រូវការ ${C(e.values[0])}`:`ជម្រើសមិនត្រឹមត្រូវ៖ ត្រូវជាមួយក្នុងចំណោម ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ធំពេក៖ ត្រូវការ ${e.origin??`តម្លៃ`} ${n} ${e.maximum.toString()} ${r.unit??`ធាតុ`}`:`ធំពេក៖ ត្រូវការ ${e.origin??`តម្លៃ`} ${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`តូចពេក៖ ត្រូវការ ${e.origin} ${n} ${e.minimum.toString()} ${r.unit}`:`តូចពេក៖ ត្រូវការ ${e.origin} ${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវចាប់ផ្តើមដោយ "${t.prefix}"`:t.format===`ends_with`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវបញ្ចប់ដោយ "${t.suffix}"`:t.format===`includes`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវមាន "${t.includes}"`:t.format===`regex`?`ខ្សែអក្សរមិនត្រឹមត្រូវ៖ ត្រូវតែផ្គូផ្គងនឹងទម្រង់ដែលបានកំណត់ ${t.pattern}`:`មិនត្រឹមត្រូវ៖ ${n[t.format]??e.format}`}case`not_multiple_of`:return`លេខមិនត្រឹមត្រូវ៖ ត្រូវតែជាពហុគុណនៃ ${e.divisor}`;case`unrecognized_keys`:return`រកឃើញសោមិនស្គាល់៖ ${x(e.keys,`, `)}`;case`invalid_key`:return`សោមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;case`invalid_union`:return`ទិន្នន័យមិនត្រឹមត្រូវ`;case`invalid_element`:return`ទិន្នន័យមិនត្រឹមត្រូវនៅក្នុង ${e.origin}`;default:return`ទិន្នន័យមិនត្រឹមត្រូវ`}}};function Ou(){return{localeError:Du()}}function ku(){return Ou()}const Au=()=>{let e={string:{unit:`문자`,verb:`to have`},file:{unit:`바이트`,verb:`to have`},array:{unit:`개`,verb:`to have`},set:{unit:`개`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`입력`,email:`이메일 주소`,url:`URL`,emoji:`이모지`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO 날짜시간`,date:`ISO 날짜`,time:`ISO 시간`,duration:`ISO 기간`,ipv4:`IPv4 주소`,ipv6:`IPv6 주소`,cidrv4:`IPv4 범위`,cidrv6:`IPv6 범위`,base64:`base64 인코딩 문자열`,base64url:`base64url 인코딩 문자열`,json_string:`JSON 문자열`,e164:`E.164 번호`,jwt:`JWT`,template_literal:`입력`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`잘못된 입력: 예상 타입은 instanceof ${e.expected}, 받은 타입은 ${i}입니다`:`잘못된 입력: 예상 타입은 ${t}, 받은 타입은 ${i}입니다`}case`invalid_value`:return e.values.length===1?`잘못된 입력: 값은 ${C(e.values[0])} 이어야 합니다`:`잘못된 옵션: ${x(e.values,`또는 `)} 중 하나여야 합니다`;case`too_big`:{let n=e.inclusive?`이하`:`미만`,r=n===`미만`?`이어야 합니다`:`여야 합니다`,i=t(e.origin),a=i?.unit??`요소`;return i?`${e.origin??`값`}이 너무 큽니다: ${e.maximum.toString()}${a} ${n}${r}`:`${e.origin??`값`}이 너무 큽니다: ${e.maximum.toString()} ${n}${r}`}case`too_small`:{let n=e.inclusive?`이상`:`초과`,r=n===`이상`?`이어야 합니다`:`여야 합니다`,i=t(e.origin),a=i?.unit??`요소`;return i?`${e.origin??`값`}이 너무 작습니다: ${e.minimum.toString()}${a} ${n}${r}`:`${e.origin??`값`}이 너무 작습니다: ${e.minimum.toString()} ${n}${r}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`잘못된 문자열: "${t.prefix}"(으)로 시작해야 합니다`:t.format===`ends_with`?`잘못된 문자열: "${t.suffix}"(으)로 끝나야 합니다`:t.format===`includes`?`잘못된 문자열: "${t.includes}"을(를) 포함해야 합니다`:t.format===`regex`?`잘못된 문자열: 정규식 ${t.pattern} 패턴과 일치해야 합니다`:`잘못된 ${n[t.format]??e.format}`}case`not_multiple_of`:return`잘못된 숫자: ${e.divisor}의 배수여야 합니다`;case`unrecognized_keys`:return`인식할 수 없는 키: ${x(e.keys,`, `)}`;case`invalid_key`:return`잘못된 키: ${e.origin}`;case`invalid_union`:return`잘못된 입력`;case`invalid_element`:return`잘못된 값: ${e.origin}`;default:return`잘못된 입력`}}};function ju(){return{localeError:Au()}}const Mu=e=>e.charAt(0).toUpperCase()+e.slice(1);function Nu(e){let t=Math.abs(e),n=t%10,r=t%100;return r>=11&&r<=19||n===0?`many`:n===1?`one`:`few`}const Pu=()=>{let e={string:{unit:{one:`simbolis`,few:`simboliai`,many:`simbolių`},verb:{smaller:{inclusive:`turi būti ne ilgesnė kaip`,notInclusive:`turi būti trumpesnė kaip`},bigger:{inclusive:`turi būti ne trumpesnė kaip`,notInclusive:`turi būti ilgesnė kaip`}}},file:{unit:{one:`baitas`,few:`baitai`,many:`baitų`},verb:{smaller:{inclusive:`turi būti ne didesnis kaip`,notInclusive:`turi būti mažesnis kaip`},bigger:{inclusive:`turi būti ne mažesnis kaip`,notInclusive:`turi būti didesnis kaip`}}},array:{unit:{one:`elementą`,few:`elementus`,many:`elementų`},verb:{smaller:{inclusive:`turi turėti ne daugiau kaip`,notInclusive:`turi turėti mažiau kaip`},bigger:{inclusive:`turi turėti ne mažiau kaip`,notInclusive:`turi turėti daugiau kaip`}}},set:{unit:{one:`elementą`,few:`elementus`,many:`elementų`},verb:{smaller:{inclusive:`turi turėti ne daugiau kaip`,notInclusive:`turi turėti mažiau kaip`},bigger:{inclusive:`turi turėti ne mažiau kaip`,notInclusive:`turi turėti daugiau kaip`}}}};function t(t,n,r,i){let a=e[t]??null;return a===null?a:{unit:a.unit[n],verb:a.verb[i][r?`inclusive`:`notInclusive`]}}let n={regex:`įvestis`,email:`el. pašto adresas`,url:`URL`,emoji:`jaustukas`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO data ir laikas`,date:`ISO data`,time:`ISO laikas`,duration:`ISO trukmė`,ipv4:`IPv4 adresas`,ipv6:`IPv6 adresas`,cidrv4:`IPv4 tinklo prefiksas (CIDR)`,cidrv6:`IPv6 tinklo prefiksas (CIDR)`,base64:`base64 užkoduota eilutė`,base64url:`base64url užkoduota eilutė`,json_string:`JSON eilutė`,e164:`E.164 numeris`,jwt:`JWT`,template_literal:`įvestis`},r={nan:`NaN`,number:`skaičius`,bigint:`sveikasis skaičius`,string:`eilutė`,boolean:`loginė reikšmė`,undefined:`neapibrėžta reikšmė`,function:`funkcija`,symbol:`simbolis`,array:`masyvas`,object:`objektas`,null:`nulinė reikšmė`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Gautas tipas ${i}, o tikėtasi - instanceof ${e.expected}`:`Gautas tipas ${i}, o tikėtasi - ${t}`}case`invalid_value`:return e.values.length===1?`Privalo būti ${C(e.values[0])}`:`Privalo būti vienas iš ${x(e.values,`|`)} pasirinkimų`;case`too_big`:{let n=r[e.origin]??e.origin,i=t(e.origin,Nu(Number(e.maximum)),e.inclusive??!1,`smaller`);if(i?.verb)return`${Mu(n??e.origin??`reikšmė`)} ${i.verb} ${e.maximum.toString()} ${i.unit??`elementų`}`;let a=e.inclusive?`ne didesnis kaip`:`mažesnis kaip`;return`${Mu(n??e.origin??`reikšmė`)} turi būti ${a} ${e.maximum.toString()} ${i?.unit}`}case`too_small`:{let n=r[e.origin]??e.origin,i=t(e.origin,Nu(Number(e.minimum)),e.inclusive??!1,`bigger`);if(i?.verb)return`${Mu(n??e.origin??`reikšmė`)} ${i.verb} ${e.minimum.toString()} ${i.unit??`elementų`}`;let a=e.inclusive?`ne mažesnis kaip`:`didesnis kaip`;return`${Mu(n??e.origin??`reikšmė`)} turi būti ${a} ${e.minimum.toString()} ${i?.unit}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Eilutė privalo prasidėti "${t.prefix}"`:t.format===`ends_with`?`Eilutė privalo pasibaigti "${t.suffix}"`:t.format===`includes`?`Eilutė privalo įtraukti "${t.includes}"`:t.format===`regex`?`Eilutė privalo atitikti ${t.pattern}`:`Neteisingas ${n[t.format]??e.format}`}case`not_multiple_of`:return`Skaičius privalo būti ${e.divisor} kartotinis.`;case`unrecognized_keys`:return`Neatpažint${e.keys.length>1?`i`:`as`} rakt${e.keys.length>1?`ai`:`as`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Rastas klaidingas raktas`;case`invalid_union`:return`Klaidinga įvestis`;case`invalid_element`:{let t=r[e.origin]??e.origin;return`${Mu(t??e.origin??`reikšmė`)} turi klaidingą įvestį`}default:return`Klaidinga įvestis`}}};function Fu(){return{localeError:Pu()}}const Iu=()=>{let e={string:{unit:`знаци`,verb:`да имаат`},file:{unit:`бајти`,verb:`да имаат`},array:{unit:`ставки`,verb:`да имаат`},set:{unit:`ставки`,verb:`да имаат`}};function t(t){return e[t]??null}let n={regex:`внес`,email:`адреса на е-пошта`,url:`URL`,emoji:`емоџи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO датум и време`,date:`ISO датум`,time:`ISO време`,duration:`ISO времетраење`,ipv4:`IPv4 адреса`,ipv6:`IPv6 адреса`,cidrv4:`IPv4 опсег`,cidrv6:`IPv6 опсег`,base64:`base64-енкодирана низа`,base64url:`base64url-енкодирана низа`,json_string:`JSON низа`,e164:`E.164 број`,jwt:`JWT`,template_literal:`внес`},r={nan:`NaN`,number:`број`,array:`низа`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Грешен внес: се очекува instanceof ${e.expected}, примено ${i}`:`Грешен внес: се очекува ${t}, примено ${i}`}case`invalid_value`:return e.values.length===1?`Invalid input: expected ${C(e.values[0])}`:`Грешана опција: се очекува една ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Премногу голем: се очекува ${e.origin??`вредноста`} да има ${n}${e.maximum.toString()} ${r.unit??`елементи`}`:`Премногу голем: се очекува ${e.origin??`вредноста`} да биде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Премногу мал: се очекува ${e.origin} да има ${n}${e.minimum.toString()} ${r.unit}`:`Премногу мал: се очекува ${e.origin} да биде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неважечка низа: мора да започнува со "${t.prefix}"`:t.format===`ends_with`?`Неважечка низа: мора да завршува со "${t.suffix}"`:t.format===`includes`?`Неважечка низа: мора да вклучува "${t.includes}"`:t.format===`regex`?`Неважечка низа: мора да одгоара на патернот ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Грешен број: мора да биде делив со ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Непрепознаени клучеви`:`Непрепознаен клуч`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Грешен клуч во ${e.origin}`;case`invalid_union`:return`Грешен внес`;case`invalid_element`:return`Грешна вредност во ${e.origin}`;default:return`Грешен внес`}}};function Lu(){return{localeError:Iu()}}const Ru=()=>{let e={string:{unit:`aksara`,verb:`mempunyai`},file:{unit:`bait`,verb:`mempunyai`},array:{unit:`elemen`,verb:`mempunyai`},set:{unit:`elemen`,verb:`mempunyai`}};function t(t){return e[t]??null}let n={regex:`input`,email:`alamat e-mel`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`tarikh masa ISO`,date:`tarikh ISO`,time:`masa ISO`,duration:`tempoh ISO`,ipv4:`alamat IPv4`,ipv6:`alamat IPv6`,cidrv4:`julat IPv4`,cidrv6:`julat IPv6`,base64:`string dikodkan base64`,base64url:`string dikodkan base64url`,json_string:`string JSON`,e164:`nombor E.164`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`nombor`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Input tidak sah: dijangka instanceof ${e.expected}, diterima ${i}`:`Input tidak sah: dijangka ${t}, diterima ${i}`}case`invalid_value`:return e.values.length===1?`Input tidak sah: dijangka ${C(e.values[0])}`:`Pilihan tidak sah: dijangka salah satu daripada ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Terlalu besar: dijangka ${e.origin??`nilai`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`elemen`}`:`Terlalu besar: dijangka ${e.origin??`nilai`} adalah ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Terlalu kecil: dijangka ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Terlalu kecil: dijangka ${e.origin} adalah ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`String tidak sah: mesti bermula dengan "${t.prefix}"`:t.format===`ends_with`?`String tidak sah: mesti berakhir dengan "${t.suffix}"`:t.format===`includes`?`String tidak sah: mesti mengandungi "${t.includes}"`:t.format===`regex`?`String tidak sah: mesti sepadan dengan corak ${t.pattern}`:`${n[t.format]??e.format} tidak sah`}case`not_multiple_of`:return`Nombor tidak sah: perlu gandaan ${e.divisor}`;case`unrecognized_keys`:return`Kunci tidak dikenali: ${x(e.keys,`, `)}`;case`invalid_key`:return`Kunci tidak sah dalam ${e.origin}`;case`invalid_union`:return`Input tidak sah`;case`invalid_element`:return`Nilai tidak sah dalam ${e.origin}`;default:return`Input tidak sah`}}};function zu(){return{localeError:Ru()}}const Bu=()=>{let e={string:{unit:`tekens`,verb:`heeft`},file:{unit:`bytes`,verb:`heeft`},array:{unit:`elementen`,verb:`heeft`},set:{unit:`elementen`,verb:`heeft`}};function t(t){return e[t]??null}let n={regex:`invoer`,email:`emailadres`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datum en tijd`,date:`ISO datum`,time:`ISO tijd`,duration:`ISO duur`,ipv4:`IPv4-adres`,ipv6:`IPv6-adres`,cidrv4:`IPv4-bereik`,cidrv6:`IPv6-bereik`,base64:`base64-gecodeerde tekst`,base64url:`base64 URL-gecodeerde tekst`,json_string:`JSON string`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`invoer`},r={nan:`NaN`,number:`getal`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ongeldige invoer: verwacht instanceof ${e.expected}, ontving ${i}`:`Ongeldige invoer: verwacht ${t}, ontving ${i}`}case`invalid_value`:return e.values.length===1?`Ongeldige invoer: verwacht ${C(e.values[0])}`:`Ongeldige optie: verwacht één van ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin),i=e.origin===`date`?`laat`:e.origin===`string`?`lang`:`groot`;return r?`Te ${i}: verwacht dat ${e.origin??`waarde`} ${n}${e.maximum.toString()} ${r.unit??`elementen`} ${r.verb}`:`Te ${i}: verwacht dat ${e.origin??`waarde`} ${n}${e.maximum.toString()} is`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin),i=e.origin===`date`?`vroeg`:e.origin===`string`?`kort`:`klein`;return r?`Te ${i}: verwacht dat ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ${r.verb}`:`Te ${i}: verwacht dat ${e.origin} ${n}${e.minimum.toString()} is`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ongeldige tekst: moet met "${t.prefix}" beginnen`:t.format===`ends_with`?`Ongeldige tekst: moet op "${t.suffix}" eindigen`:t.format===`includes`?`Ongeldige tekst: moet "${t.includes}" bevatten`:t.format===`regex`?`Ongeldige tekst: moet overeenkomen met patroon ${t.pattern}`:`Ongeldig: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ongeldig getal: moet een veelvoud van ${e.divisor} zijn`;case`unrecognized_keys`:return`Onbekende key${e.keys.length>1?`s`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Ongeldige key in ${e.origin}`;case`invalid_union`:return`Ongeldige invoer`;case`invalid_element`:return`Ongeldige waarde in ${e.origin}`;default:return`Ongeldige invoer`}}};function Vu(){return{localeError:Bu()}}const Hu=()=>{let e={string:{unit:`tegn`,verb:`å ha`},file:{unit:`bytes`,verb:`å ha`},array:{unit:`elementer`,verb:`å inneholde`},set:{unit:`elementer`,verb:`å inneholde`}};function t(t){return e[t]??null}let n={regex:`input`,email:`e-postadresse`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO dato- og klokkeslett`,date:`ISO-dato`,time:`ISO-klokkeslett`,duration:`ISO-varighet`,ipv4:`IPv4-område`,ipv6:`IPv6-område`,cidrv4:`IPv4-spekter`,cidrv6:`IPv6-spekter`,base64:`base64-enkodet streng`,base64url:`base64url-enkodet streng`,json_string:`JSON-streng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`tall`,array:`liste`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ugyldig input: forventet instanceof ${e.expected}, fikk ${i}`:`Ugyldig input: forventet ${t}, fikk ${i}`}case`invalid_value`:return e.values.length===1?`Ugyldig verdi: forventet ${C(e.values[0])}`:`Ugyldig valg: forventet en av ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`For stor(t): forventet ${e.origin??`value`} til å ha ${n}${e.maximum.toString()} ${r.unit??`elementer`}`:`For stor(t): forventet ${e.origin??`value`} til å ha ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`For lite(n): forventet ${e.origin} til å ha ${n}${e.minimum.toString()} ${r.unit}`:`For lite(n): forventet ${e.origin} til å ha ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ugyldig streng: må starte med "${t.prefix}"`:t.format===`ends_with`?`Ugyldig streng: må ende med "${t.suffix}"`:t.format===`includes`?`Ugyldig streng: må inneholde "${t.includes}"`:t.format===`regex`?`Ugyldig streng: må matche mønsteret ${t.pattern}`:`Ugyldig ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ugyldig tall: må være et multiplum av ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Ukjente nøkler`:`Ukjent nøkkel`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Ugyldig nøkkel i ${e.origin}`;case`invalid_union`:return`Ugyldig input`;case`invalid_element`:return`Ugyldig verdi i ${e.origin}`;default:return`Ugyldig input`}}};function Uu(){return{localeError:Hu()}}const Wu=()=>{let e={string:{unit:`harf`,verb:`olmalıdır`},file:{unit:`bayt`,verb:`olmalıdır`},array:{unit:`unsur`,verb:`olmalıdır`},set:{unit:`unsur`,verb:`olmalıdır`}};function t(t){return e[t]??null}let n={regex:`giren`,email:`epostagâh`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO hengâmı`,date:`ISO tarihi`,time:`ISO zamanı`,duration:`ISO müddeti`,ipv4:`IPv4 nişânı`,ipv6:`IPv6 nişânı`,cidrv4:`IPv4 menzili`,cidrv6:`IPv6 menzili`,base64:`base64-şifreli metin`,base64url:`base64url-şifreli metin`,json_string:`JSON metin`,e164:`E.164 sayısı`,jwt:`JWT`,template_literal:`giren`},r={nan:`NaN`,number:`numara`,array:`saf`,null:`gayb`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Fâsit giren: umulan instanceof ${e.expected}, alınan ${i}`:`Fâsit giren: umulan ${t}, alınan ${i}`}case`invalid_value`:return e.values.length===1?`Fâsit giren: umulan ${C(e.values[0])}`:`Fâsit tercih: mûteberler ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Fazla büyük: ${e.origin??`value`}, ${n}${e.maximum.toString()} ${r.unit??`elements`} sahip olmalıydı.`:`Fazla büyük: ${e.origin??`value`}, ${n}${e.maximum.toString()} olmalıydı.`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Fazla küçük: ${e.origin}, ${n}${e.minimum.toString()} ${r.unit} sahip olmalıydı.`:`Fazla küçük: ${e.origin}, ${n}${e.minimum.toString()} olmalıydı.`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Fâsit metin: "${t.prefix}" ile başlamalı.`:t.format===`ends_with`?`Fâsit metin: "${t.suffix}" ile bitmeli.`:t.format===`includes`?`Fâsit metin: "${t.includes}" ihtivâ etmeli.`:t.format===`regex`?`Fâsit metin: ${t.pattern} nakşına uymalı.`:`Fâsit ${n[t.format]??e.format}`}case`not_multiple_of`:return`Fâsit sayı: ${e.divisor} katı olmalıydı.`;case`unrecognized_keys`:return`Tanınmayan anahtar ${e.keys.length>1?`s`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} için tanınmayan anahtar var.`;case`invalid_union`:return`Giren tanınamadı.`;case`invalid_element`:return`${e.origin} için tanınmayan kıymet var.`;default:return`Kıymet tanınamadı.`}}};function Gu(){return{localeError:Wu()}}const Ku=()=>{let e={string:{unit:`توکي`,verb:`ولري`},file:{unit:`بایټس`,verb:`ولري`},array:{unit:`توکي`,verb:`ولري`},set:{unit:`توکي`,verb:`ولري`}};function t(t){return e[t]??null}let n={regex:`ورودي`,email:`بریښنالیک`,url:`یو آر ال`,emoji:`ایموجي`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`نیټه او وخت`,date:`نېټه`,time:`وخت`,duration:`موده`,ipv4:`د IPv4 پته`,ipv6:`د IPv6 پته`,cidrv4:`د IPv4 ساحه`,cidrv6:`د IPv6 ساحه`,base64:`base64-encoded متن`,base64url:`base64url-encoded متن`,json_string:`JSON متن`,e164:`د E.164 شمېره`,jwt:`JWT`,template_literal:`ورودي`},r={nan:`NaN`,number:`عدد`,array:`ارې`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ناسم ورودي: باید instanceof ${e.expected} وای, مګر ${i} ترلاسه شو`:`ناسم ورودي: باید ${t} وای, مګر ${i} ترلاسه شو`}case`invalid_value`:return e.values.length===1?`ناسم ورودي: باید ${C(e.values[0])} وای`:`ناسم انتخاب: باید یو له ${x(e.values,`|`)} څخه وای`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`ډیر لوی: ${e.origin??`ارزښت`} باید ${n}${e.maximum.toString()} ${r.unit??`عنصرونه`} ولري`:`ډیر لوی: ${e.origin??`ارزښت`} باید ${n}${e.maximum.toString()} وي`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`ډیر کوچنی: ${e.origin} باید ${n}${e.minimum.toString()} ${r.unit} ولري`:`ډیر کوچنی: ${e.origin} باید ${n}${e.minimum.toString()} وي`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`ناسم متن: باید د "${t.prefix}" سره پیل شي`:t.format===`ends_with`?`ناسم متن: باید د "${t.suffix}" سره پای ته ورسيږي`:t.format===`includes`?`ناسم متن: باید "${t.includes}" ولري`:t.format===`regex`?`ناسم متن: باید د ${t.pattern} سره مطابقت ولري`:`${n[t.format]??e.format} ناسم دی`}case`not_multiple_of`:return`ناسم عدد: باید د ${e.divisor} مضرب وي`;case`unrecognized_keys`:return`ناسم ${e.keys.length>1?`کلیډونه`:`کلیډ`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`ناسم کلیډ په ${e.origin} کې`;case`invalid_union`:return`ناسمه ورودي`;case`invalid_element`:return`ناسم عنصر په ${e.origin} کې`;default:return`ناسمه ورودي`}}};function qu(){return{localeError:Ku()}}const Ju=()=>{let e={string:{unit:`znaków`,verb:`mieć`},file:{unit:`bajtów`,verb:`mieć`},array:{unit:`elementów`,verb:`mieć`},set:{unit:`elementów`,verb:`mieć`}};function t(t){return e[t]??null}let n={regex:`wyrażenie`,email:`adres email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data i godzina w formacie ISO`,date:`data w formacie ISO`,time:`godzina w formacie ISO`,duration:`czas trwania ISO`,ipv4:`adres IPv4`,ipv6:`adres IPv6`,cidrv4:`zakres IPv4`,cidrv6:`zakres IPv6`,base64:`ciąg znaków zakodowany w formacie base64`,base64url:`ciąg znaków zakodowany w formacie base64url`,json_string:`ciąg znaków w formacie JSON`,e164:`liczba E.164`,jwt:`JWT`,template_literal:`wejście`},r={nan:`NaN`,number:`liczba`,array:`tablica`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Nieprawidłowe dane wejściowe: oczekiwano instanceof ${e.expected}, otrzymano ${i}`:`Nieprawidłowe dane wejściowe: oczekiwano ${t}, otrzymano ${i}`}case`invalid_value`:return e.values.length===1?`Nieprawidłowe dane wejściowe: oczekiwano ${C(e.values[0])}`:`Nieprawidłowa opcja: oczekiwano jednej z wartości ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Za duża wartość: oczekiwano, że ${e.origin??`wartość`} będzie mieć ${n}${e.maximum.toString()} ${r.unit??`elementów`}`:`Zbyt duż(y/a/e): oczekiwano, że ${e.origin??`wartość`} będzie wynosić ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Za mała wartość: oczekiwano, że ${e.origin??`wartość`} będzie mieć ${n}${e.minimum.toString()} ${r.unit??`elementów`}`:`Zbyt mał(y/a/e): oczekiwano, że ${e.origin??`wartość`} będzie wynosić ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Nieprawidłowy ciąg znaków: musi zaczynać się od "${t.prefix}"`:t.format===`ends_with`?`Nieprawidłowy ciąg znaków: musi kończyć się na "${t.suffix}"`:t.format===`includes`?`Nieprawidłowy ciąg znaków: musi zawierać "${t.includes}"`:t.format===`regex`?`Nieprawidłowy ciąg znaków: musi odpowiadać wzorcowi ${t.pattern}`:`Nieprawidłow(y/a/e) ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nieprawidłowa liczba: musi być wielokrotnością ${e.divisor}`;case`unrecognized_keys`:return`Nierozpoznane klucze${e.keys.length>1?`s`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Nieprawidłowy klucz w ${e.origin}`;case`invalid_union`:return`Nieprawidłowe dane wejściowe`;case`invalid_element`:return`Nieprawidłowa wartość w ${e.origin}`;default:return`Nieprawidłowe dane wejściowe`}}};function Yu(){return{localeError:Ju()}}const Xu=()=>{let e={string:{unit:`caracteres`,verb:`ter`},file:{unit:`bytes`,verb:`ter`},array:{unit:`itens`,verb:`ter`},set:{unit:`itens`,verb:`ter`}};function t(t){return e[t]??null}let n={regex:`padrão`,email:`endereço de e-mail`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`data e hora ISO`,date:`data ISO`,time:`hora ISO`,duration:`duração ISO`,ipv4:`endereço IPv4`,ipv6:`endereço IPv6`,cidrv4:`faixa de IPv4`,cidrv6:`faixa de IPv6`,base64:`texto codificado em base64`,base64url:`URL codificada em base64`,json_string:`texto JSON`,e164:`número E.164`,jwt:`JWT`,template_literal:`entrada`},r={nan:`NaN`,number:`número`,null:`nulo`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Tipo inválido: esperado instanceof ${e.expected}, recebido ${i}`:`Tipo inválido: esperado ${t}, recebido ${i}`}case`invalid_value`:return e.values.length===1?`Entrada inválida: esperado ${C(e.values[0])}`:`Opção inválida: esperada uma das ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Muito grande: esperado que ${e.origin??`valor`} tivesse ${n}${e.maximum.toString()} ${r.unit??`elementos`}`:`Muito grande: esperado que ${e.origin??`valor`} fosse ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Muito pequeno: esperado que ${e.origin} tivesse ${n}${e.minimum.toString()} ${r.unit}`:`Muito pequeno: esperado que ${e.origin} fosse ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Texto inválido: deve começar com "${t.prefix}"`:t.format===`ends_with`?`Texto inválido: deve terminar com "${t.suffix}"`:t.format===`includes`?`Texto inválido: deve incluir "${t.includes}"`:t.format===`regex`?`Texto inválido: deve corresponder ao padrão ${t.pattern}`:`${n[t.format]??e.format} inválido`}case`not_multiple_of`:return`Número inválido: deve ser múltiplo de ${e.divisor}`;case`unrecognized_keys`:return`Chave${e.keys.length>1?`s`:``} desconhecida${e.keys.length>1?`s`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Chave inválida em ${e.origin}`;case`invalid_union`:return`Entrada inválida`;case`invalid_element`:return`Valor inválido em ${e.origin}`;default:return`Campo inválido`}}};function Zu(){return{localeError:Xu()}}function Qu(e,t,n,r){let i=Math.abs(e),a=i%10,o=i%100;return o>=11&&o<=19?r:a===1?t:a>=2&&a<=4?n:r}const $u=()=>{let e={string:{unit:{one:`символ`,few:`символа`,many:`символов`},verb:`иметь`},file:{unit:{one:`байт`,few:`байта`,many:`байт`},verb:`иметь`},array:{unit:{one:`элемент`,few:`элемента`,many:`элементов`},verb:`иметь`},set:{unit:{one:`элемент`,few:`элемента`,many:`элементов`},verb:`иметь`}};function t(t){return e[t]??null}let n={regex:`ввод`,email:`email адрес`,url:`URL`,emoji:`эмодзи`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO дата и время`,date:`ISO дата`,time:`ISO время`,duration:`ISO длительность`,ipv4:`IPv4 адрес`,ipv6:`IPv6 адрес`,cidrv4:`IPv4 диапазон`,cidrv6:`IPv6 диапазон`,base64:`строка в формате base64`,base64url:`строка в формате base64url`,json_string:`JSON строка`,e164:`номер E.164`,jwt:`JWT`,template_literal:`ввод`},r={nan:`NaN`,number:`число`,array:`массив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Неверный ввод: ожидалось instanceof ${e.expected}, получено ${i}`:`Неверный ввод: ожидалось ${t}, получено ${i}`}case`invalid_value`:return e.values.length===1?`Неверный ввод: ожидалось ${C(e.values[0])}`:`Неверный вариант: ожидалось одно из ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);if(r){let t=Qu(Number(e.maximum),r.unit.one,r.unit.few,r.unit.many);return`Слишком большое значение: ожидалось, что ${e.origin??`значение`} будет иметь ${n}${e.maximum.toString()} ${t}`}return`Слишком большое значение: ожидалось, что ${e.origin??`значение`} будет ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);if(r){let t=Qu(Number(e.minimum),r.unit.one,r.unit.few,r.unit.many);return`Слишком маленькое значение: ожидалось, что ${e.origin} будет иметь ${n}${e.minimum.toString()} ${t}`}return`Слишком маленькое значение: ожидалось, что ${e.origin} будет ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неверная строка: должна начинаться с "${t.prefix}"`:t.format===`ends_with`?`Неверная строка: должна заканчиваться на "${t.suffix}"`:t.format===`includes`?`Неверная строка: должна содержать "${t.includes}"`:t.format===`regex`?`Неверная строка: должна соответствовать шаблону ${t.pattern}`:`Неверный ${n[t.format]??e.format}`}case`not_multiple_of`:return`Неверное число: должно быть кратным ${e.divisor}`;case`unrecognized_keys`:return`Нераспознанн${e.keys.length>1?`ые`:`ый`} ключ${e.keys.length>1?`и`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Неверный ключ в ${e.origin}`;case`invalid_union`:return`Неверные входные данные`;case`invalid_element`:return`Неверное значение в ${e.origin}`;default:return`Неверные входные данные`}}};function ed(){return{localeError:$u()}}const td=()=>{let e={string:{unit:`znakov`,verb:`imeti`},file:{unit:`bajtov`,verb:`imeti`},array:{unit:`elementov`,verb:`imeti`},set:{unit:`elementov`,verb:`imeti`}};function t(t){return e[t]??null}let n={regex:`vnos`,email:`e-poštni naslov`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datum in čas`,date:`ISO datum`,time:`ISO čas`,duration:`ISO trajanje`,ipv4:`IPv4 naslov`,ipv6:`IPv6 naslov`,cidrv4:`obseg IPv4`,cidrv6:`obseg IPv6`,base64:`base64 kodiran niz`,base64url:`base64url kodiran niz`,json_string:`JSON niz`,e164:`E.164 številka`,jwt:`JWT`,template_literal:`vnos`},r={nan:`NaN`,number:`število`,array:`tabela`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Neveljaven vnos: pričakovano instanceof ${e.expected}, prejeto ${i}`:`Neveljaven vnos: pričakovano ${t}, prejeto ${i}`}case`invalid_value`:return e.values.length===1?`Neveljaven vnos: pričakovano ${C(e.values[0])}`:`Neveljavna možnost: pričakovano eno izmed ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Preveliko: pričakovano, da bo ${e.origin??`vrednost`} imelo ${n}${e.maximum.toString()} ${r.unit??`elementov`}`:`Preveliko: pričakovano, da bo ${e.origin??`vrednost`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Premajhno: pričakovano, da bo ${e.origin} imelo ${n}${e.minimum.toString()} ${r.unit}`:`Premajhno: pričakovano, da bo ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Neveljaven niz: mora se začeti z "${t.prefix}"`:t.format===`ends_with`?`Neveljaven niz: mora se končati z "${t.suffix}"`:t.format===`includes`?`Neveljaven niz: mora vsebovati "${t.includes}"`:t.format===`regex`?`Neveljaven niz: mora ustrezati vzorcu ${t.pattern}`:`Neveljaven ${n[t.format]??e.format}`}case`not_multiple_of`:return`Neveljavno število: mora biti večkratnik ${e.divisor}`;case`unrecognized_keys`:return`Neprepoznan${e.keys.length>1?`i ključi`:` ključ`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Neveljaven ključ v ${e.origin}`;case`invalid_union`:return`Neveljaven vnos`;case`invalid_element`:return`Neveljavna vrednost v ${e.origin}`;default:return`Neveljaven vnos`}}};function nd(){return{localeError:td()}}const rd=()=>{let e={string:{unit:`tecken`,verb:`att ha`},file:{unit:`bytes`,verb:`att ha`},array:{unit:`objekt`,verb:`att innehålla`},set:{unit:`objekt`,verb:`att innehålla`}};function t(t){return e[t]??null}let n={regex:`reguljärt uttryck`,email:`e-postadress`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO-datum och tid`,date:`ISO-datum`,time:`ISO-tid`,duration:`ISO-varaktighet`,ipv4:`IPv4-intervall`,ipv6:`IPv6-intervall`,cidrv4:`IPv4-spektrum`,cidrv6:`IPv6-spektrum`,base64:`base64-kodad sträng`,base64url:`base64url-kodad sträng`,json_string:`JSON-sträng`,e164:`E.164-nummer`,jwt:`JWT`,template_literal:`mall-literal`},r={nan:`NaN`,number:`antal`,array:`lista`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ogiltig inmatning: förväntat instanceof ${e.expected}, fick ${i}`:`Ogiltig inmatning: förväntat ${t}, fick ${i}`}case`invalid_value`:return e.values.length===1?`Ogiltig inmatning: förväntat ${C(e.values[0])}`:`Ogiltigt val: förväntade en av ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`För stor(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.maximum.toString()} ${r.unit??`element`}`:`För stor(t): förväntat ${e.origin??`värdet`} att ha ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`För lite(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.minimum.toString()} ${r.unit}`:`För lite(t): förväntade ${e.origin??`värdet`} att ha ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ogiltig sträng: måste börja med "${t.prefix}"`:t.format===`ends_with`?`Ogiltig sträng: måste sluta med "${t.suffix}"`:t.format===`includes`?`Ogiltig sträng: måste innehålla "${t.includes}"`:t.format===`regex`?`Ogiltig sträng: måste matcha mönstret "${t.pattern}"`:`Ogiltig(t) ${n[t.format]??e.format}`}case`not_multiple_of`:return`Ogiltigt tal: måste vara en multipel av ${e.divisor}`;case`unrecognized_keys`:return`${e.keys.length>1?`Okända nycklar`:`Okänd nyckel`}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Ogiltig nyckel i ${e.origin??`värdet`}`;case`invalid_union`:return`Ogiltig input`;case`invalid_element`:return`Ogiltigt värde i ${e.origin??`värdet`}`;default:return`Ogiltig input`}}};function id(){return{localeError:rd()}}const ad=()=>{let e={string:{unit:`எழுத்துக்கள்`,verb:`கொண்டிருக்க வேண்டும்`},file:{unit:`பைட்டுகள்`,verb:`கொண்டிருக்க வேண்டும்`},array:{unit:`உறுப்புகள்`,verb:`கொண்டிருக்க வேண்டும்`},set:{unit:`உறுப்புகள்`,verb:`கொண்டிருக்க வேண்டும்`}};function t(t){return e[t]??null}let n={regex:`உள்ளீடு`,email:`மின்னஞ்சல் முகவரி`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO தேதி நேரம்`,date:`ISO தேதி`,time:`ISO நேரம்`,duration:`ISO கால அளவு`,ipv4:`IPv4 முகவரி`,ipv6:`IPv6 முகவரி`,cidrv4:`IPv4 வரம்பு`,cidrv6:`IPv6 வரம்பு`,base64:`base64-encoded சரம்`,base64url:`base64url-encoded சரம்`,json_string:`JSON சரம்`,e164:`E.164 எண்`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`,number:`எண்`,array:`அணி`,null:`வெறுமை`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது instanceof ${e.expected}, பெறப்பட்டது ${i}`:`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${t}, பெறப்பட்டது ${i}`}case`invalid_value`:return e.values.length===1?`தவறான உள்ளீடு: எதிர்பார்க்கப்பட்டது ${C(e.values[0])}`:`தவறான விருப்பம்: எதிர்பார்க்கப்பட்டது ${x(e.values,`|`)} இல் ஒன்று`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??`மதிப்பு`} ${n}${e.maximum.toString()} ${r.unit??`உறுப்புகள்`} ஆக இருக்க வேண்டும்`:`மிக பெரியது: எதிர்பார்க்கப்பட்டது ${e.origin??`மதிப்பு`} ${n}${e.maximum.toString()} ஆக இருக்க வேண்டும்`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ஆக இருக்க வேண்டும்`:`மிகச் சிறியது: எதிர்பார்க்கப்பட்டது ${e.origin} ${n}${e.minimum.toString()} ஆக இருக்க வேண்டும்`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`தவறான சரம்: "${t.prefix}" இல் தொடங்க வேண்டும்`:t.format===`ends_with`?`தவறான சரம்: "${t.suffix}" இல் முடிவடைய வேண்டும்`:t.format===`includes`?`தவறான சரம்: "${t.includes}" ஐ உள்ளடக்க வேண்டும்`:t.format===`regex`?`தவறான சரம்: ${t.pattern} முறைபாட்டுடன் பொருந்த வேண்டும்`:`தவறான ${n[t.format]??e.format}`}case`not_multiple_of`:return`தவறான எண்: ${e.divisor} இன் பலமாக இருக்க வேண்டும்`;case`unrecognized_keys`:return`அடையாளம் தெரியாத விசை${e.keys.length>1?`கள்`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} இல் தவறான விசை`;case`invalid_union`:return`தவறான உள்ளீடு`;case`invalid_element`:return`${e.origin} இல் தவறான மதிப்பு`;default:return`தவறான உள்ளீடு`}}};function od(){return{localeError:ad()}}const sd=()=>{let e={string:{unit:`ตัวอักษร`,verb:`ควรมี`},file:{unit:`ไบต์`,verb:`ควรมี`},array:{unit:`รายการ`,verb:`ควรมี`},set:{unit:`รายการ`,verb:`ควรมี`}};function t(t){return e[t]??null}let n={regex:`ข้อมูลที่ป้อน`,email:`ที่อยู่อีเมล`,url:`URL`,emoji:`อิโมจิ`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`วันที่เวลาแบบ ISO`,date:`วันที่แบบ ISO`,time:`เวลาแบบ ISO`,duration:`ช่วงเวลาแบบ ISO`,ipv4:`ที่อยู่ IPv4`,ipv6:`ที่อยู่ IPv6`,cidrv4:`ช่วง IP แบบ IPv4`,cidrv6:`ช่วง IP แบบ IPv6`,base64:`ข้อความแบบ Base64`,base64url:`ข้อความแบบ Base64 สำหรับ URL`,json_string:`ข้อความแบบ JSON`,e164:`เบอร์โทรศัพท์ระหว่างประเทศ (E.164)`,jwt:`โทเคน JWT`,template_literal:`ข้อมูลที่ป้อน`},r={nan:`NaN`,number:`ตัวเลข`,array:`อาร์เรย์ (Array)`,null:`ไม่มีค่า (null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น instanceof ${e.expected} แต่ได้รับ ${i}`:`ประเภทข้อมูลไม่ถูกต้อง: ควรเป็น ${t} แต่ได้รับ ${i}`}case`invalid_value`:return e.values.length===1?`ค่าไม่ถูกต้อง: ควรเป็น ${C(e.values[0])}`:`ตัวเลือกไม่ถูกต้อง: ควรเป็นหนึ่งใน ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`ไม่เกิน`:`น้อยกว่า`,r=t(e.origin);return r?`เกินกำหนด: ${e.origin??`ค่า`} ควรมี${n} ${e.maximum.toString()} ${r.unit??`รายการ`}`:`เกินกำหนด: ${e.origin??`ค่า`} ควรมี${n} ${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`อย่างน้อย`:`มากกว่า`,r=t(e.origin);return r?`น้อยกว่ากำหนด: ${e.origin} ควรมี${n} ${e.minimum.toString()} ${r.unit}`:`น้อยกว่ากำหนด: ${e.origin} ควรมี${n} ${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`รูปแบบไม่ถูกต้อง: ข้อความต้องขึ้นต้นด้วย "${t.prefix}"`:t.format===`ends_with`?`รูปแบบไม่ถูกต้อง: ข้อความต้องลงท้ายด้วย "${t.suffix}"`:t.format===`includes`?`รูปแบบไม่ถูกต้อง: ข้อความต้องมี "${t.includes}" อยู่ในข้อความ`:t.format===`regex`?`รูปแบบไม่ถูกต้อง: ต้องตรงกับรูปแบบที่กำหนด ${t.pattern}`:`รูปแบบไม่ถูกต้อง: ${n[t.format]??e.format}`}case`not_multiple_of`:return`ตัวเลขไม่ถูกต้อง: ต้องเป็นจำนวนที่หารด้วย ${e.divisor} ได้ลงตัว`;case`unrecognized_keys`:return`พบคีย์ที่ไม่รู้จัก: ${x(e.keys,`, `)}`;case`invalid_key`:return`คีย์ไม่ถูกต้องใน ${e.origin}`;case`invalid_union`:return`ข้อมูลไม่ถูกต้อง: ไม่ตรงกับรูปแบบยูเนียนที่กำหนดไว้`;case`invalid_element`:return`ข้อมูลไม่ถูกต้องใน ${e.origin}`;default:return`ข้อมูลไม่ถูกต้อง`}}};function cd(){return{localeError:sd()}}const ld=()=>{let e={string:{unit:`karakter`,verb:`olmalı`},file:{unit:`bayt`,verb:`olmalı`},array:{unit:`öğe`,verb:`olmalı`},set:{unit:`öğe`,verb:`olmalı`}};function t(t){return e[t]??null}let n={regex:`girdi`,email:`e-posta adresi`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO tarih ve saat`,date:`ISO tarih`,time:`ISO saat`,duration:`ISO süre`,ipv4:`IPv4 adresi`,ipv6:`IPv6 adresi`,cidrv4:`IPv4 aralığı`,cidrv6:`IPv6 aralığı`,base64:`base64 ile şifrelenmiş metin`,base64url:`base64url ile şifrelenmiş metin`,json_string:`JSON dizesi`,e164:`E.164 sayısı`,jwt:`JWT`,template_literal:`Şablon dizesi`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Geçersiz değer: beklenen instanceof ${e.expected}, alınan ${i}`:`Geçersiz değer: beklenen ${t}, alınan ${i}`}case`invalid_value`:return e.values.length===1?`Geçersiz değer: beklenen ${C(e.values[0])}`:`Geçersiz seçenek: aşağıdakilerden biri olmalı: ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Çok büyük: beklenen ${e.origin??`değer`} ${n}${e.maximum.toString()} ${r.unit??`öğe`}`:`Çok büyük: beklenen ${e.origin??`değer`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Çok küçük: beklenen ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`Çok küçük: beklenen ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Geçersiz metin: "${t.prefix}" ile başlamalı`:t.format===`ends_with`?`Geçersiz metin: "${t.suffix}" ile bitmeli`:t.format===`includes`?`Geçersiz metin: "${t.includes}" içermeli`:t.format===`regex`?`Geçersiz metin: ${t.pattern} desenine uymalı`:`Geçersiz ${n[t.format]??e.format}`}case`not_multiple_of`:return`Geçersiz sayı: ${e.divisor} ile tam bölünebilmeli`;case`unrecognized_keys`:return`Tanınmayan anahtar${e.keys.length>1?`lar`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} içinde geçersiz anahtar`;case`invalid_union`:return`Geçersiz değer`;case`invalid_element`:return`${e.origin} içinde geçersiz değer`;default:return`Geçersiz değer`}}};function ud(){return{localeError:ld()}}const dd=()=>{let e={string:{unit:`символів`,verb:`матиме`},file:{unit:`байтів`,verb:`матиме`},array:{unit:`елементів`,verb:`матиме`},set:{unit:`елементів`,verb:`матиме`}};function t(t){return e[t]??null}let n={regex:`вхідні дані`,email:`адреса електронної пошти`,url:`URL`,emoji:`емодзі`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`дата та час ISO`,date:`дата ISO`,time:`час ISO`,duration:`тривалість ISO`,ipv4:`адреса IPv4`,ipv6:`адреса IPv6`,cidrv4:`діапазон IPv4`,cidrv6:`діапазон IPv6`,base64:`рядок у кодуванні base64`,base64url:`рядок у кодуванні base64url`,json_string:`рядок JSON`,e164:`номер E.164`,jwt:`JWT`,template_literal:`вхідні дані`},r={nan:`NaN`,number:`число`,array:`масив`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Неправильні вхідні дані: очікується instanceof ${e.expected}, отримано ${i}`:`Неправильні вхідні дані: очікується ${t}, отримано ${i}`}case`invalid_value`:return e.values.length===1?`Неправильні вхідні дані: очікується ${C(e.values[0])}`:`Неправильна опція: очікується одне з ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Занадто велике: очікується, що ${e.origin??`значення`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`елементів`}`:`Занадто велике: очікується, що ${e.origin??`значення`} буде ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Занадто мале: очікується, що ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Занадто мале: очікується, що ${e.origin} буде ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Неправильний рядок: повинен починатися з "${t.prefix}"`:t.format===`ends_with`?`Неправильний рядок: повинен закінчуватися на "${t.suffix}"`:t.format===`includes`?`Неправильний рядок: повинен містити "${t.includes}"`:t.format===`regex`?`Неправильний рядок: повинен відповідати шаблону ${t.pattern}`:`Неправильний ${n[t.format]??e.format}`}case`not_multiple_of`:return`Неправильне число: повинно бути кратним ${e.divisor}`;case`unrecognized_keys`:return`Нерозпізнаний ключ${e.keys.length>1?`і`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`Неправильний ключ у ${e.origin}`;case`invalid_union`:return`Неправильні вхідні дані`;case`invalid_element`:return`Неправильне значення у ${e.origin}`;default:return`Неправильні вхідні дані`}}};function fd(){return{localeError:dd()}}function pd(){return fd()}const md=()=>{let e={string:{unit:`حروف`,verb:`ہونا`},file:{unit:`بائٹس`,verb:`ہونا`},array:{unit:`آئٹمز`,verb:`ہونا`},set:{unit:`آئٹمز`,verb:`ہونا`}};function t(t){return e[t]??null}let n={regex:`ان پٹ`,email:`ای میل ایڈریس`,url:`یو آر ایل`,emoji:`ایموجی`,uuid:`یو یو آئی ڈی`,uuidv4:`یو یو آئی ڈی وی 4`,uuidv6:`یو یو آئی ڈی وی 6`,nanoid:`نینو آئی ڈی`,guid:`جی یو آئی ڈی`,cuid:`سی یو آئی ڈی`,cuid2:`سی یو آئی ڈی 2`,ulid:`یو ایل آئی ڈی`,xid:`ایکس آئی ڈی`,ksuid:`کے ایس یو آئی ڈی`,datetime:`آئی ایس او ڈیٹ ٹائم`,date:`آئی ایس او تاریخ`,time:`آئی ایس او وقت`,duration:`آئی ایس او مدت`,ipv4:`آئی پی وی 4 ایڈریس`,ipv6:`آئی پی وی 6 ایڈریس`,cidrv4:`آئی پی وی 4 رینج`,cidrv6:`آئی پی وی 6 رینج`,base64:`بیس 64 ان کوڈڈ سٹرنگ`,base64url:`بیس 64 یو آر ایل ان کوڈڈ سٹرنگ`,json_string:`جے ایس او این سٹرنگ`,e164:`ای 164 نمبر`,jwt:`جے ڈبلیو ٹی`,template_literal:`ان پٹ`},r={nan:`NaN`,number:`نمبر`,array:`آرے`,null:`نل`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`غلط ان پٹ: instanceof ${e.expected} متوقع تھا، ${i} موصول ہوا`:`غلط ان پٹ: ${t} متوقع تھا، ${i} موصول ہوا`}case`invalid_value`:return e.values.length===1?`غلط ان پٹ: ${C(e.values[0])} متوقع تھا`:`غلط آپشن: ${x(e.values,`|`)} میں سے ایک متوقع تھا`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`بہت بڑا: ${e.origin??`ویلیو`} کے ${n}${e.maximum.toString()} ${r.unit??`عناصر`} ہونے متوقع تھے`:`بہت بڑا: ${e.origin??`ویلیو`} کا ${n}${e.maximum.toString()} ہونا متوقع تھا`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`بہت چھوٹا: ${e.origin} کے ${n}${e.minimum.toString()} ${r.unit} ہونے متوقع تھے`:`بہت چھوٹا: ${e.origin} کا ${n}${e.minimum.toString()} ہونا متوقع تھا`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`غلط سٹرنگ: "${t.prefix}" سے شروع ہونا چاہیے`:t.format===`ends_with`?`غلط سٹرنگ: "${t.suffix}" پر ختم ہونا چاہیے`:t.format===`includes`?`غلط سٹرنگ: "${t.includes}" شامل ہونا چاہیے`:t.format===`regex`?`غلط سٹرنگ: پیٹرن ${t.pattern} سے میچ ہونا چاہیے`:`غلط ${n[t.format]??e.format}`}case`not_multiple_of`:return`غلط نمبر: ${e.divisor} کا مضاعف ہونا چاہیے`;case`unrecognized_keys`:return`غیر تسلیم شدہ کی${e.keys.length>1?`ز`:``}: ${x(e.keys,`، `)}`;case`invalid_key`:return`${e.origin} میں غلط کی`;case`invalid_union`:return`غلط ان پٹ`;case`invalid_element`:return`${e.origin} میں غلط ویلیو`;default:return`غلط ان پٹ`}}};function hd(){return{localeError:md()}}const gd=()=>{let e={string:{unit:`belgi`,verb:`bo‘lishi kerak`},file:{unit:`bayt`,verb:`bo‘lishi kerak`},array:{unit:`element`,verb:`bo‘lishi kerak`},set:{unit:`element`,verb:`bo‘lishi kerak`}};function t(t){return e[t]??null}let n={regex:`kirish`,email:`elektron pochta manzili`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO sana va vaqti`,date:`ISO sana`,time:`ISO vaqt`,duration:`ISO davomiylik`,ipv4:`IPv4 manzil`,ipv6:`IPv6 manzil`,mac:`MAC manzil`,cidrv4:`IPv4 diapazon`,cidrv6:`IPv6 diapazon`,base64:`base64 kodlangan satr`,base64url:`base64url kodlangan satr`,json_string:`JSON satr`,e164:`E.164 raqam`,jwt:`JWT`,template_literal:`kirish`},r={nan:`NaN`,number:`raqam`,array:`massiv`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Noto‘g‘ri kirish: kutilgan instanceof ${e.expected}, qabul qilingan ${i}`:`Noto‘g‘ri kirish: kutilgan ${t}, qabul qilingan ${i}`}case`invalid_value`:return e.values.length===1?`Noto‘g‘ri kirish: kutilgan ${C(e.values[0])}`:`Noto‘g‘ri variant: quyidagilardan biri kutilgan ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Juda katta: kutilgan ${e.origin??`qiymat`} ${n}${e.maximum.toString()} ${r.unit} ${r.verb}`:`Juda katta: kutilgan ${e.origin??`qiymat`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Juda kichik: kutilgan ${e.origin} ${n}${e.minimum.toString()} ${r.unit} ${r.verb}`:`Juda kichik: kutilgan ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Noto‘g‘ri satr: "${t.prefix}" bilan boshlanishi kerak`:t.format===`ends_with`?`Noto‘g‘ri satr: "${t.suffix}" bilan tugashi kerak`:t.format===`includes`?`Noto‘g‘ri satr: "${t.includes}" ni o‘z ichiga olishi kerak`:t.format===`regex`?`Noto‘g‘ri satr: ${t.pattern} shabloniga mos kelishi kerak`:`Noto‘g‘ri ${n[t.format]??e.format}`}case`not_multiple_of`:return`Noto‘g‘ri raqam: ${e.divisor} ning karralisi bo‘lishi kerak`;case`unrecognized_keys`:return`Noma’lum kalit${e.keys.length>1?`lar`:``}: ${x(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} dagi kalit noto‘g‘ri`;case`invalid_union`:return`Noto‘g‘ri kirish`;case`invalid_element`:return`${e.origin} da noto‘g‘ri qiymat`;default:return`Noto‘g‘ri kirish`}}};function _d(){return{localeError:gd()}}const vd=()=>{let e={string:{unit:`ký tự`,verb:`có`},file:{unit:`byte`,verb:`có`},array:{unit:`phần tử`,verb:`có`},set:{unit:`phần tử`,verb:`có`}};function t(t){return e[t]??null}let n={regex:`đầu vào`,email:`địa chỉ email`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ngày giờ ISO`,date:`ngày ISO`,time:`giờ ISO`,duration:`khoảng thời gian ISO`,ipv4:`địa chỉ IPv4`,ipv6:`địa chỉ IPv6`,cidrv4:`dải IPv4`,cidrv6:`dải IPv6`,base64:`chuỗi mã hóa base64`,base64url:`chuỗi mã hóa base64url`,json_string:`chuỗi JSON`,e164:`số E.164`,jwt:`JWT`,template_literal:`đầu vào`},r={nan:`NaN`,number:`số`,array:`mảng`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Đầu vào không hợp lệ: mong đợi instanceof ${e.expected}, nhận được ${i}`:`Đầu vào không hợp lệ: mong đợi ${t}, nhận được ${i}`}case`invalid_value`:return e.values.length===1?`Đầu vào không hợp lệ: mong đợi ${C(e.values[0])}`:`Tùy chọn không hợp lệ: mong đợi một trong các giá trị ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Quá lớn: mong đợi ${e.origin??`giá trị`} ${r.verb} ${n}${e.maximum.toString()} ${r.unit??`phần tử`}`:`Quá lớn: mong đợi ${e.origin??`giá trị`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Quá nhỏ: mong đợi ${e.origin} ${r.verb} ${n}${e.minimum.toString()} ${r.unit}`:`Quá nhỏ: mong đợi ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Chuỗi không hợp lệ: phải bắt đầu bằng "${t.prefix}"`:t.format===`ends_with`?`Chuỗi không hợp lệ: phải kết thúc bằng "${t.suffix}"`:t.format===`includes`?`Chuỗi không hợp lệ: phải bao gồm "${t.includes}"`:t.format===`regex`?`Chuỗi không hợp lệ: phải khớp với mẫu ${t.pattern}`:`${n[t.format]??e.format} không hợp lệ`}case`not_multiple_of`:return`Số không hợp lệ: phải là bội số của ${e.divisor}`;case`unrecognized_keys`:return`Khóa không được nhận dạng: ${x(e.keys,`, `)}`;case`invalid_key`:return`Khóa không hợp lệ trong ${e.origin}`;case`invalid_union`:return`Đầu vào không hợp lệ`;case`invalid_element`:return`Giá trị không hợp lệ trong ${e.origin}`;default:return`Đầu vào không hợp lệ`}}};function yd(){return{localeError:vd()}}const bd=()=>{let e={string:{unit:`字符`,verb:`包含`},file:{unit:`字节`,verb:`包含`},array:{unit:`项`,verb:`包含`},set:{unit:`项`,verb:`包含`}};function t(t){return e[t]??null}let n={regex:`输入`,email:`电子邮件`,url:`URL`,emoji:`表情符号`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO日期时间`,date:`ISO日期`,time:`ISO时间`,duration:`ISO时长`,ipv4:`IPv4地址`,ipv6:`IPv6地址`,cidrv4:`IPv4网段`,cidrv6:`IPv6网段`,base64:`base64编码字符串`,base64url:`base64url编码字符串`,json_string:`JSON字符串`,e164:`E.164号码`,jwt:`JWT`,template_literal:`输入`},r={nan:`NaN`,number:`数字`,array:`数组`,null:`空值(null)`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`无效输入:期望 instanceof ${e.expected},实际接收 ${i}`:`无效输入:期望 ${t},实际接收 ${i}`}case`invalid_value`:return e.values.length===1?`无效输入:期望 ${C(e.values[0])}`:`无效选项:期望以下之一 ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`数值过大:期望 ${e.origin??`值`} ${n}${e.maximum.toString()} ${r.unit??`个元素`}`:`数值过大:期望 ${e.origin??`值`} ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`数值过小:期望 ${e.origin} ${n}${e.minimum.toString()} ${r.unit}`:`数值过小:期望 ${e.origin} ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`无效字符串:必须以 "${t.prefix}" 开头`:t.format===`ends_with`?`无效字符串:必须以 "${t.suffix}" 结尾`:t.format===`includes`?`无效字符串:必须包含 "${t.includes}"`:t.format===`regex`?`无效字符串:必须满足正则表达式 ${t.pattern}`:`无效${n[t.format]??e.format}`}case`not_multiple_of`:return`无效数字:必须是 ${e.divisor} 的倍数`;case`unrecognized_keys`:return`出现未知的键(key): ${x(e.keys,`, `)}`;case`invalid_key`:return`${e.origin} 中的键(key)无效`;case`invalid_union`:return`无效输入`;case`invalid_element`:return`${e.origin} 中包含无效值(value)`;default:return`无效输入`}}};function xd(){return{localeError:bd()}}const Sd=()=>{let e={string:{unit:`字元`,verb:`擁有`},file:{unit:`位元組`,verb:`擁有`},array:{unit:`項目`,verb:`擁有`},set:{unit:`項目`,verb:`擁有`}};function t(t){return e[t]??null}let n={regex:`輸入`,email:`郵件地址`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO 日期時間`,date:`ISO 日期`,time:`ISO 時間`,duration:`ISO 期間`,ipv4:`IPv4 位址`,ipv6:`IPv6 位址`,cidrv4:`IPv4 範圍`,cidrv6:`IPv6 範圍`,base64:`base64 編碼字串`,base64url:`base64url 編碼字串`,json_string:`JSON 字串`,e164:`E.164 數值`,jwt:`JWT`,template_literal:`輸入`},r={nan:`NaN`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`無效的輸入值:預期為 instanceof ${e.expected},但收到 ${i}`:`無效的輸入值:預期為 ${t},但收到 ${i}`}case`invalid_value`:return e.values.length===1?`無效的輸入值:預期為 ${C(e.values[0])}`:`無效的選項:預期為以下其中之一 ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`數值過大:預期 ${e.origin??`值`} 應為 ${n}${e.maximum.toString()} ${r.unit??`個元素`}`:`數值過大:預期 ${e.origin??`值`} 應為 ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`數值過小:預期 ${e.origin} 應為 ${n}${e.minimum.toString()} ${r.unit}`:`數值過小:預期 ${e.origin} 應為 ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`無效的字串:必須以 "${t.prefix}" 開頭`:t.format===`ends_with`?`無效的字串:必須以 "${t.suffix}" 結尾`:t.format===`includes`?`無效的字串:必須包含 "${t.includes}"`:t.format===`regex`?`無效的字串:必須符合格式 ${t.pattern}`:`無效的 ${n[t.format]??e.format}`}case`not_multiple_of`:return`無效的數字:必須為 ${e.divisor} 的倍數`;case`unrecognized_keys`:return`無法識別的鍵值${e.keys.length>1?`們`:``}:${x(e.keys,`、`)}`;case`invalid_key`:return`${e.origin} 中有無效的鍵值`;case`invalid_union`:return`無效的輸入值`;case`invalid_element`:return`${e.origin} 中有無效的值`;default:return`無效的輸入值`}}};function Cd(){return{localeError:Sd()}}const wd=()=>{let e={string:{unit:`àmi`,verb:`ní`},file:{unit:`bytes`,verb:`ní`},array:{unit:`nkan`,verb:`ní`},set:{unit:`nkan`,verb:`ní`}};function t(t){return e[t]??null}let n={regex:`ẹ̀rọ ìbáwọlé`,email:`àdírẹ́sì ìmẹ́lì`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`àkókò ISO`,date:`ọjọ́ ISO`,time:`àkókò ISO`,duration:`àkókò tó pé ISO`,ipv4:`àdírẹ́sì IPv4`,ipv6:`àdírẹ́sì IPv6`,cidrv4:`àgbègbè IPv4`,cidrv6:`àgbègbè IPv6`,base64:`ọ̀rọ̀ tí a kọ́ ní base64`,base64url:`ọ̀rọ̀ base64url`,json_string:`ọ̀rọ̀ JSON`,e164:`nọ́mbà E.164`,jwt:`JWT`,template_literal:`ẹ̀rọ ìbáwọlé`},r={nan:`NaN`,number:`nọ́mbà`,array:`akopọ`};return e=>{switch(e.code){case`invalid_type`:{let t=r[e.expected]??e.expected,n=S(e.input),i=r[n]??n;return/^[A-Z]/.test(e.expected)?`Ìbáwọlé aṣìṣe: a ní láti fi instanceof ${e.expected}, àmọ̀ a rí ${i}`:`Ìbáwọlé aṣìṣe: a ní láti fi ${t}, àmọ̀ a rí ${i}`}case`invalid_value`:return e.values.length===1?`Ìbáwọlé aṣìṣe: a ní láti fi ${C(e.values[0])}`:`Àṣàyàn aṣìṣe: yan ọ̀kan lára ${x(e.values,`|`)}`;case`too_big`:{let n=e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Tó pọ̀ jù: a ní láti jẹ́ pé ${e.origin??`iye`} ${r.verb} ${n}${e.maximum} ${r.unit}`:`Tó pọ̀ jù: a ní láti jẹ́ ${n}${e.maximum}`}case`too_small`:{let n=e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Kéré ju: a ní láti jẹ́ pé ${e.origin} ${r.verb} ${n}${e.minimum} ${r.unit}`:`Kéré ju: a ní láti jẹ́ ${n}${e.minimum}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bẹ̀rẹ̀ pẹ̀lú "${t.prefix}"`:t.format===`ends_with`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ parí pẹ̀lú "${t.suffix}"`:t.format===`includes`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ ní "${t.includes}"`:t.format===`regex`?`Ọ̀rọ̀ aṣìṣe: gbọ́dọ̀ bá àpẹẹrẹ mu ${t.pattern}`:`Aṣìṣe: ${n[t.format]??e.format}`}case`not_multiple_of`:return`Nọ́mbà aṣìṣe: gbọ́dọ̀ jẹ́ èyà pípín ti ${e.divisor}`;case`unrecognized_keys`:return`Bọtìnì àìmọ̀: ${x(e.keys,`, `)}`;case`invalid_key`:return`Bọtìnì aṣìṣe nínú ${e.origin}`;case`invalid_union`:return`Ìbáwọlé aṣìṣe`;case`invalid_element`:return`Iye aṣìṣe nínú ${e.origin}`;default:return`Ìbáwọlé aṣìṣe`}}};function Td(){return{localeError:wd()}}var Ed=r({ar:()=>Nl,az:()=>Fl,be:()=>Rl,bg:()=>Bl,ca:()=>Hl,cs:()=>Wl,da:()=>Kl,de:()=>Jl,en:()=>Xl,eo:()=>Ql,es:()=>eu,fa:()=>nu,fi:()=>iu,fr:()=>ou,frCA:()=>cu,he:()=>uu,hu:()=>fu,hy:()=>gu,id:()=>vu,is:()=>bu,it:()=>Su,ja:()=>wu,ka:()=>Eu,kh:()=>ku,km:()=>Ou,ko:()=>ju,lt:()=>Fu,mk:()=>Lu,ms:()=>zu,nl:()=>Vu,no:()=>Uu,ota:()=>Gu,pl:()=>Yu,ps:()=>qu,pt:()=>Zu,ru:()=>ed,sl:()=>nd,sv:()=>id,ta:()=>od,th:()=>cd,tr:()=>ud,ua:()=>pd,uk:()=>fd,ur:()=>hd,uz:()=>_d,vi:()=>yd,yo:()=>Td,zhCN:()=>xd,zhTW:()=>Cd}),Dd=class{get metadataRegistry(){return this.ctx.metadataRegistry}get target(){return this.ctx.target}get unrepresentable(){return this.ctx.unrepresentable}get override(){return this.ctx.override}get io(){return this.ctx.io}get counter(){return this.ctx.counter}set counter(e){this.ctx.counter=e}get seen(){return this.ctx.seen}constructor(e){let t=e?.target??`draft-2020-12`;t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),this.ctx=be({processors:ui,target:t,...e?.metadata&&{metadata:e.metadata},...e?.unrepresentable&&{unrepresentable:e.unrepresentable},...e?.override&&{override:e.override},...e?.io&&{io:e.io}})}process(e,t={path:[],schemaPath:[]}){return oc(e,this.ctx,t)}emit(e,t){t&&(t.cycles&&(this.ctx.cycles=t.cycles),t.reused&&(this.ctx.reused=t.reused),t.external&&(this.ctx.external=t.external)),hc(this.ctx,e);let{"~standard":n,...r}=Zn(this.ctx,e);return r}},Od=r({}),kd=r({$ZodAny:()=>Wt,$ZodArray:()=>Wn,$ZodAsyncError:()=>fa,$ZodBase64:()=>Pc,$ZodBase64URL:()=>pe,$ZodBigInt:()=>wr,$ZodBigIntFormat:()=>ut,$ZodBoolean:()=>hr,$ZodCIDRv4:()=>Mr,$ZodCIDRv6:()=>tt,$ZodCUID:()=>It,$ZodCUID2:()=>os,$ZodCatch:()=>Ot,$ZodCheck:()=>Ss,$ZodCheckBigIntFormat:()=>Li,$ZodCheckEndsWith:()=>lo,$ZodCheckGreaterThan:()=>Vs,$ZodCheckIncludes:()=>Gi,$ZodCheckLengthEquals:()=>ua,$ZodCheckLessThan:()=>Jo,$ZodCheckLowerCase:()=>yo,$ZodCheckMaxLength:()=>Oa,$ZodCheckMaxSize:()=>ya,$ZodCheckMimeType:()=>li,$ZodCheckMinLength:()=>Ys,$ZodCheckMinSize:()=>Cc,$ZodCheckMultipleOf:()=>Oi,$ZodCheckNumberFormat:()=>mc,$ZodCheckOverwrite:()=>Xn,$ZodCheckProperty:()=>ye,$ZodCheckRegex:()=>ac,$ZodCheckSizeEquals:()=>ir,$ZodCheckStartsWith:()=>Ie,$ZodCheckStringFormat:()=>De,$ZodCheckUpperCase:()=>hn,$ZodCodec:()=>Yr,$ZodCustom:()=>Vr,$ZodCustomStringFormat:()=>ii,$ZodDate:()=>In,$ZodDefault:()=>v,$ZodDiscriminatedUnion:()=>oa,$ZodE164:()=>Ls,$ZodEmail:()=>Po,$ZodEmoji:()=>vs,$ZodEncodeError:()=>Xo,$ZodEnum:()=>Ua,$ZodError:()=>na,$ZodExactOptional:()=>wi,$ZodFile:()=>Wo,$ZodFunction:()=>Os,$ZodGUID:()=>Hi,$ZodIPv4:()=>ho,$ZodIPv6:()=>Ks,$ZodISODate:()=>Zi,$ZodISODateTime:()=>ga,$ZodISODuration:()=>es,$ZodISOTime:()=>To,$ZodIntersection:()=>Pa,$ZodJWT:()=>Ta,$ZodKSUID:()=>hi,$ZodLazy:()=>tc,$ZodLiteral:()=>Oc,$ZodMAC:()=>Ni,$ZodMap:()=>yc,$ZodNaN:()=>tr,$ZodNanoID:()=>we,$ZodNever:()=>uc,$ZodNonOptional:()=>lr,$ZodNull:()=>Ve,$ZodNullable:()=>Me,$ZodNumber:()=>bn,$ZodNumberFormat:()=>oo,$ZodObject:()=>se,$ZodObjectJIT:()=>Qa,$ZodOptional:()=>tn,$ZodPipe:()=>dn,$ZodPrefault:()=>kn,$ZodPromise:()=>Ye,$ZodReadonly:()=>xt,$ZodRealError:()=>Ns,$ZodRecord:()=>Kt,$ZodRegistry:()=>$t,$ZodSet:()=>Kn,$ZodString:()=>Ic,$ZodStringFormat:()=>he,$ZodSuccess:()=>Er,$ZodSymbol:()=>ft,$ZodTemplateLiteral:()=>_r,$ZodTransform:()=>Pr,$ZodTuple:()=>rt,$ZodType:()=>Rt,$ZodULID:()=>cs,$ZodURL:()=>At,$ZodUUID:()=>Zr,$ZodUndefined:()=>Ur,$ZodUnion:()=>oi,$ZodUnknown:()=>Rn,$ZodVoid:()=>b,$ZodXID:()=>ea,$ZodXor:()=>js,$brand:()=>xo,$constructor:()=>Aa,$input:()=>ln,$output:()=>Dn,Doc:()=>Ro,JSONSchema:()=>Od,JSONSchemaGenerator:()=>Dd,NEVER:()=>xa,TimePrecision:()=>ar,_any:()=>Le,_array:()=>Oe,_base64:()=>gn,_base64url:()=>no,_bigint:()=>re,_boolean:()=>Ja,_catch:()=>Zt,_check:()=>sn,_cidrv4:()=>Tn,_cidrv6:()=>Ge,_coercedBigint:()=>_t,_coercedBoolean:()=>Ht,_coercedDate:()=>Hn,_coercedNumber:()=>Mc,_coercedString:()=>de,_cuid:()=>Sr,_cuid2:()=>ct,_custom:()=>pr,_date:()=>Ar,_decode:()=>ne,_decodeAsync:()=>qa,_default:()=>$e,_discriminatedUnion:()=>Pt,_e164:()=>is,_email:()=>Et,_emoji:()=>qr,_encode:()=>Xt,_encodeAsync:()=>on,_endsWith:()=>zr,_enum:()=>ni,_file:()=>Pn,_float32:()=>g,_float64:()=>$i,_gt:()=>As,_gte:()=>Do,_guid:()=>ds,_includes:()=>Ia,_int:()=>_i,_int32:()=>Lo,_int64:()=>xs,_intersection:()=>Ii,_ipv4:()=>co,_ipv6:()=>Bs,_isoDate:()=>Wi,_isoDateTime:()=>la,_isoDuration:()=>qo,_isoTime:()=>vo,_jwt:()=>Da,_ksuid:()=>va,_lazy:()=>ci,_length:()=>Js,_literal:()=>Sc,_lowercase:()=>Di,_lt:()=>pc,_lte:()=>Yn,_mac:()=>ve,_map:()=>ic,_max:()=>Yn,_maxLength:()=>rr,_maxSize:()=>Fe,_mime:()=>Ee,_min:()=>Do,_minLength:()=>mn,_minSize:()=>eo,_multipleOf:()=>te,_nan:()=>Ka,_nanoid:()=>Yt,_nativeEnum:()=>an,_negative:()=>Cn,_never:()=>Ue,_nonnegative:()=>ht,_nonoptional:()=>Bt,_nonpositive:()=>Bn,_normalize:()=>Ac,_null:()=>le,_nullable:()=>br,_number:()=>ot,_optional:()=>dr,_overwrite:()=>Or,_parse:()=>wn,_parseAsync:()=>We,_pipe:()=>Ze,_positive:()=>Mt,_promise:()=>ns,_property:()=>wt,_readonly:()=>Gr,_record:()=>Lr,_refine:()=>ei,_regex:()=>Mn,_safeDecode:()=>gt,_safeDecodeAsync:()=>Vt,_safeEncode:()=>Vn,_safeEncodeAsync:()=>jc,_safeParse:()=>ue,_safeParseAsync:()=>xr,_set:()=>m,_size:()=>ia,_slugify:()=>Fs,_startsWith:()=>Mo,_string:()=>gs,_stringFormat:()=>Va,_stringbool:()=>Si,_success:()=>Ho,_superRefine:()=>Es,_symbol:()=>Bi,_templateLiteral:()=>po,_toLowerCase:()=>Ws,_toUpperCase:()=>Yi,_transform:()=>ma,_trim:()=>Qo,_tuple:()=>Co,_uint32:()=>Ma,_uint64:()=>Ca,_ulid:()=>pi,_undefined:()=>$s,_union:()=>Ec,_unknown:()=>ji,_uppercase:()=>_c,_url:()=>$n,_uuid:()=>Se,_uuidv4:()=>cc,_uuidv6:()=>sr,_uuidv7:()=>ze,_void:()=>Ae,_xid:()=>vn,_xor:()=>io,clone:()=>ws,config:()=>di,createStandardJSONSchemaMethod:()=>wc,createToJSONSchemaMethod:()=>ki,decode:()=>st,decodeAsync:()=>fr,describe:()=>ae,encode:()=>kr,encodeAsync:()=>Qe,extractDefs:()=>hc,finalize:()=>Zn,flattenError:()=>Ao,formatError:()=>ms,globalConfig:()=>Zs,globalRegistry:()=>qe,initializeContext:()=>be,isValidBase64:()=>Oo,isValidBase64URL:()=>fs,isValidJWT:()=>La,locales:()=>Ed,meta:()=>Xa,parse:()=>Nt,parseAsync:()=>rs,prettifyError:()=>za,process:()=>oc,regexes:()=>to,registry:()=>yt,safeDecode:()=>Tt,safeDecodeAsync:()=>Kr,safeEncode:()=>Rr,safeEncodeAsync:()=>ti,safeParse:()=>Nn,safeParseAsync:()=>h,toDotPath:()=>bi,toJSONSchema:()=>Xs,treeifyError:()=>Bo,util:()=>qi,version:()=>vi}),Ad=r({endsWith:()=>zr,gt:()=>As,gte:()=>Do,includes:()=>Ia,length:()=>Js,lowercase:()=>Di,lt:()=>pc,lte:()=>Yn,maxLength:()=>rr,maxSize:()=>Fe,mime:()=>Ee,minLength:()=>mn,minSize:()=>eo,multipleOf:()=>te,negative:()=>Cn,nonnegative:()=>ht,nonpositive:()=>Bn,normalize:()=>Ac,overwrite:()=>Or,positive:()=>Mt,property:()=>wt,regex:()=>Mn,size:()=>ia,slugify:()=>Fs,startsWith:()=>Mo,toLowerCase:()=>Ws,toUpperCase:()=>Yi,trim:()=>Qo,uppercase:()=>_c});const jd={invalid_type:`invalid_type`,too_big:`too_big`,too_small:`too_small`,invalid_format:`invalid_format`,not_multiple_of:`not_multiple_of`,unrecognized_keys:`unrecognized_keys`,invalid_union:`invalid_union`,invalid_key:`invalid_key`,invalid_element:`invalid_element`,invalid_value:`invalid_value`,custom:`custom`};function Md(e){di({customError:e})}function Nd(){return di().customError}var Pd;Pd||={};const w={...yn,...Ad,iso:ba},Fd=new Set(`$schema.$ref.$defs.definitions.$id.id.$comment.$anchor.$vocabulary.$dynamicRef.$dynamicAnchor.type.enum.const.anyOf.oneOf.allOf.not.properties.required.additionalProperties.patternProperties.propertyNames.minProperties.maxProperties.items.prefixItems.additionalItems.minItems.maxItems.uniqueItems.contains.minContains.maxContains.minLength.maxLength.pattern.format.minimum.maximum.exclusiveMinimum.exclusiveMaximum.multipleOf.description.default.contentEncoding.contentMediaType.contentSchema.unevaluatedItems.unevaluatedProperties.if.then.else.dependentSchemas.dependentRequired.nullable.readOnly`.split(`.`));function Id(e,t){let n=e.$schema;return n===`https://json-schema.org/draft/2020-12/schema`?`draft-2020-12`:n===`http://json-schema.org/draft-07/schema#`?`draft-7`:n===`http://json-schema.org/draft-04/schema#`?`draft-4`:t??`draft-2020-12`}function Ld(e,t){if(!e.startsWith(`#`))throw Error(`External $ref is not supported, only local refs (#/...) are allowed`);let n=e.slice(1).split(`/`).filter(Boolean);if(n.length===0)return t.rootSchema;let r=t.version===`draft-2020-12`?`$defs`:`definitions`;if(n[0]===r){let r=n[1];if(!r||!t.defs[r])throw Error(`Reference not found: ${e}`);return t.defs[r]}throw Error(`Reference not found: ${e}`)}function Rd(e,t){if(e.not!==void 0){if(typeof e.not==`object`&&Object.keys(e.not).length===0)return w.never();throw Error(`not is not supported in Zod (except { not: {} } for never)`)}if(e.unevaluatedItems!==void 0)throw Error(`unevaluatedItems is not supported`);if(e.unevaluatedProperties!==void 0)throw Error(`unevaluatedProperties is not supported`);if(e.if!==void 0||e.then!==void 0||e.else!==void 0)throw Error(`Conditional schemas (if/then/else) are not supported`);if(e.dependentSchemas!==void 0||e.dependentRequired!==void 0)throw Error(`dependentSchemas and dependentRequired are not supported`);if(e.$ref){let n=e.$ref;if(t.refs.has(n))return t.refs.get(n);if(t.processing.has(n))return w.lazy(()=>{if(!t.refs.has(n))throw Error(`Circular reference not resolved: ${n}`);return t.refs.get(n)});t.processing.add(n);let r=zd(Ld(n,t),t);return t.refs.set(n,r),t.processing.delete(n),r}if(e.enum!==void 0){let n=e.enum;if(t.version===`openapi-3.0`&&e.nullable===!0&&n.length===1&&n[0]===null)return w.null();if(n.length===0)return w.never();if(n.length===1)return w.literal(n[0]);if(n.every(e=>typeof e==`string`))return w.enum(n);let r=n.map(e=>w.literal(e));return r.length<2?r[0]:w.union([r[0],r[1],...r.slice(2)])}if(e.const!==void 0)return w.literal(e.const);let n=e.type;if(Array.isArray(n)){let r=n.map(n=>Rd({...e,type:n},t));return r.length===0?w.never():r.length===1?r[0]:w.union(r)}if(!n)return w.any();let r;switch(n){case`string`:{let t=w.string();if(e.format){let n=e.format;n===`email`?t=t.check(w.email()):n===`uri`||n===`uri-reference`?t=t.check(w.url()):n===`uuid`||n===`guid`?t=t.check(w.uuid()):n===`date-time`?t=t.check(w.iso.datetime()):n===`date`?t=t.check(w.iso.date()):n===`time`?t=t.check(w.iso.time()):n===`duration`?t=t.check(w.iso.duration()):n===`ipv4`?t=t.check(w.ipv4()):n===`ipv6`?t=t.check(w.ipv6()):n===`mac`?t=t.check(w.mac()):n===`cidr`?t=t.check(w.cidrv4()):n===`cidr-v6`?t=t.check(w.cidrv6()):n===`base64`?t=t.check(w.base64()):n===`base64url`?t=t.check(w.base64url()):n===`e164`?t=t.check(w.e164()):n===`jwt`?t=t.check(w.jwt()):n===`emoji`?t=t.check(w.emoji()):n===`nanoid`?t=t.check(w.nanoid()):n===`cuid`?t=t.check(w.cuid()):n===`cuid2`?t=t.check(w.cuid2()):n===`ulid`?t=t.check(w.ulid()):n===`xid`?t=t.check(w.xid()):n===`ksuid`&&(t=t.check(w.ksuid()))}typeof e.minLength==`number`&&(t=t.min(e.minLength)),typeof e.maxLength==`number`&&(t=t.max(e.maxLength)),e.pattern&&(t=t.regex(new RegExp(e.pattern))),r=t;break}case`number`:case`integer`:{let t=n===`integer`?w.number().int():w.number();typeof e.minimum==`number`&&(t=t.min(e.minimum)),typeof e.maximum==`number`&&(t=t.max(e.maximum)),typeof e.exclusiveMinimum==`number`?t=t.gt(e.exclusiveMinimum):e.exclusiveMinimum===!0&&typeof e.minimum==`number`&&(t=t.gt(e.minimum)),typeof e.exclusiveMaximum==`number`?t=t.lt(e.exclusiveMaximum):e.exclusiveMaximum===!0&&typeof e.maximum==`number`&&(t=t.lt(e.maximum)),typeof e.multipleOf==`number`&&(t=t.multipleOf(e.multipleOf)),r=t;break}case`boolean`:r=w.boolean();break;case`null`:r=w.null();break;case`object`:{let n={},i=e.properties||{},a=new Set(e.required||[]);for(let[e,r]of Object.entries(i)){let i=zd(r,t);n[e]=a.has(e)?i:i.optional()}if(e.propertyNames){let i=zd(e.propertyNames,t),a=e.additionalProperties&&typeof e.additionalProperties==`object`?zd(e.additionalProperties,t):w.any();if(Object.keys(n).length===0){r=w.record(i,a);break}let o=w.object(n).passthrough(),s=w.looseRecord(i,a);r=w.intersection(o,s);break}if(e.patternProperties){let i=e.patternProperties,a=Object.keys(i),o=[];for(let e of a){let n=zd(i[e],t),r=w.string().regex(new RegExp(e));o.push(w.looseRecord(r,n))}let s=[];if(Object.keys(n).length>0&&s.push(w.object(n).passthrough()),s.push(...o),s.length===0)r=w.object({}).passthrough();else if(s.length===1)r=s[0];else{let e=w.intersection(s[0],s[1]);for(let t=2;t<s.length;t++)e=w.intersection(e,s[t]);r=e}break}let o=w.object(n);r=e.additionalProperties===!1?o.strict():typeof e.additionalProperties==`object`?o.catchall(zd(e.additionalProperties,t)):o.passthrough();break}case`array`:{let n=e.prefixItems,i=e.items;if(n&&Array.isArray(n)){let a=n.map(e=>zd(e,t)),o=i&&typeof i==`object`&&!Array.isArray(i)?zd(i,t):void 0;r=o?w.tuple(a).rest(o):w.tuple(a),typeof e.minItems==`number`&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(w.maxLength(e.maxItems)))}else if(Array.isArray(i)){let n=i.map(e=>zd(e,t)),a=e.additionalItems&&typeof e.additionalItems==`object`?zd(e.additionalItems,t):void 0;r=a?w.tuple(n).rest(a):w.tuple(n),typeof e.minItems==`number`&&(r=r.check(w.minLength(e.minItems))),typeof e.maxItems==`number`&&(r=r.check(w.maxLength(e.maxItems)))}else if(i!==void 0){let n=zd(i,t),a=w.array(n);typeof e.minItems==`number`&&(a=a.min(e.minItems)),typeof e.maxItems==`number`&&(a=a.max(e.maxItems)),r=a}else r=w.array(w.any());break}default:throw Error(`Unsupported type: ${n}`)}return e.description&&(r=r.describe(e.description)),e.default!==void 0&&(r=r.default(e.default)),r}function zd(e,t){if(typeof e==`boolean`)return e?w.any():w.never();let n=Rd(e,t),r=e.type||e.enum!==void 0||e.const!==void 0;if(e.anyOf&&Array.isArray(e.anyOf)){let i=e.anyOf.map(e=>zd(e,t)),a=w.union(i);n=r?w.intersection(n,a):a}if(e.oneOf&&Array.isArray(e.oneOf)){let i=e.oneOf.map(e=>zd(e,t)),a=w.xor(i);n=r?w.intersection(n,a):a}if(e.allOf&&Array.isArray(e.allOf))if(e.allOf.length===0)n=r?n:w.any();else{let i=r?n:zd(e.allOf[0],t),a=+!r;for(let n=a;n<e.allOf.length;n++)i=w.intersection(i,zd(e.allOf[n],t));n=i}e.nullable===!0&&t.version===`openapi-3.0`&&(n=w.nullable(n)),e.readOnly===!0&&(n=w.readonly(n));let i={};for(let t of[`$id`,`id`,`$comment`,`$anchor`,`$vocabulary`,`$dynamicRef`,`$dynamicAnchor`])t in e&&(i[t]=e[t]);for(let t of[`contentEncoding`,`contentMediaType`,`contentSchema`])t in e&&(i[t]=e[t]);for(let t of Object.keys(e))Fd.has(t)||(i[t]=e[t]);return Object.keys(i).length>0&&t.registry.add(n,i),n}function Bd(e,t){return typeof e==`boolean`?e?w.any():w.never():zd(e,{version:Id(e,t?.defaultTarget),defs:e.$defs||e.definitions||{},refs:new Map,processing:new Set,rootSchema:e,registry:t?.registry??qe})}var Vd=r({$brand:()=>xo,$input:()=>ln,$output:()=>Dn,NEVER:()=>xa,TimePrecision:()=>ar,ZodAny:()=>Ir,ZodArray:()=>$r,ZodBase64:()=>jn,ZodBase64URL:()=>p,ZodBigInt:()=>sa,ZodBigIntFormat:()=>Rs,ZodBoolean:()=>Fo,ZodCIDRv4:()=>ys,ZodCIDRv6:()=>Wa,ZodCUID:()=>Ti,ZodCUID2:()=>Go,ZodCatch:()=>ks,ZodCodec:()=>Ui,ZodCustom:()=>go,ZodCustomStringFormat:()=>qs,ZodDate:()=>Qi,ZodDefault:()=>_a,ZodDiscriminatedUnion:()=>ts,ZodE164:()=>Eo,ZodEmail:()=>Fa,ZodEmoji:()=>Ea,ZodEnum:()=>gi,ZodError:()=>Hs,ZodExactOptional:()=>nc,ZodFile:()=>kc,ZodFirstPartyTypeKind:()=>Pd,ZodFunction:()=>Pi,ZodGUID:()=>bc,ZodIPv4:()=>nr,ZodIPv6:()=>Te,ZodISODate:()=>da,ZodISODateTime:()=>Yo,ZodISODuration:()=>bo,ZodISOTime:()=>ka,ZodIntersection:()=>dc,ZodIssueCode:()=>jd,ZodJWT:()=>ur,ZodKSUID:()=>He,ZodLazy:()=>Ne,ZodLiteral:()=>xn,ZodMAC:()=>so,ZodMap:()=>ce,ZodNaN:()=>$a,ZodNanoID:()=>nn,ZodNever:()=>fn,ZodNonOptional:()=>An,ZodNull:()=>Xe,ZodNullable:()=>St,ZodNumber:()=>qt,ZodNumberFormat:()=>qn,ZodObject:()=>Lc,ZodOptional:()=>ge,ZodPipe:()=>Dr,ZodPrefault:()=>pt,ZodPromise:()=>vr,ZodReadonly:()=>Fr,ZodRealError:()=>Ki,ZodRecord:()=>it,ZodSet:()=>zt,ZodString:()=>ls,ZodStringFormat:()=>jt,ZodSuccess:()=>Qr,ZodSymbol:()=>Wr,ZodTemplateLiteral:()=>si,ZodTransform:()=>zn,ZodTuple:()=>ee,ZodType:()=>ra,ZodULID:()=>Ps,ZodURL:()=>jo,ZodUUID:()=>hs,ZodUndefined:()=>Ba,ZodUnion:()=>xi,ZodUnknown:()=>Vo,ZodVoid:()=>Ts,ZodXID:()=>zi,ZodXor:()=>fo,_ZodString:()=>Us,_default:()=>pa,_function:()=>So,any:()=>Tc,array:()=>Ai,base64:()=>gc,base64url:()=>Qn,bigint:()=>xe,boolean:()=>sc,catch:()=>Ji,check:()=>or,cidrv4:()=>Re,cidrv6:()=>ke,clone:()=>ws,codec:()=>_n,coerce:()=>Ct,config:()=>di,core:()=>kd,cuid:()=>ro,cuid2:()=>ie,custom:()=>Ya,date:()=>Qt,decode:()=>Ln,decodeAsync:()=>y,describe:()=>cn,discriminatedUnion:()=>En,e164:()=>Ke,email:()=>vt,emoji:()=>Ut,encode:()=>ta,encodeAsync:()=>Ms,endsWith:()=>zr,enum:()=>Zo,exactOptional:()=>Un,file:()=>Nc,flattenError:()=>Ao,float32:()=>fe,float64:()=>Cr,formatError:()=>ms,fromJSONSchema:()=>Bd,function:()=>So,getErrorMap:()=>Nd,globalRegistry:()=>qe,gt:()=>As,gte:()=>Do,guid:()=>lt,hash:()=>mr,hex:()=>jr,hostname:()=>et,httpUrl:()=>Ft,includes:()=>Ia,instanceof:()=>ja,int:()=>as,int32:()=>Dt,int64:()=>Jr,intersection:()=>Br,ipv4:()=>ri,ipv6:()=>Fn,iso:()=>ba,json:()=>_,jwt:()=>aa,keyof:()=>Is,ksuid:()=>No,lazy:()=>_s,length:()=>Js,literal:()=>Ha,locales:()=>Ed,looseObject:()=>Ci,looseRecord:()=>Uo,lowercase:()=>Di,lt:()=>pc,lte:()=>Yn,mac:()=>Ds,map:()=>Vi,maxLength:()=>rr,maxSize:()=>Fe,meta:()=>mo,mime:()=>Ee,minLength:()=>mn,minSize:()=>eo,multipleOf:()=>te,nan:()=>Gs,nanoid:()=>Xi,nativeEnum:()=>ha,negative:()=>Cn,never:()=>$o,nonnegative:()=>ht,nonoptional:()=>wo,nonpositive:()=>Bn,normalize:()=>Ac,null:()=>Sa,nullable:()=>Na,nullish:()=>wa,number:()=>mi,object:()=>ec,optional:()=>Dc,overwrite:()=>Or,parse:()=>ko,parseAsync:()=>ps,partialRecord:()=>Mi,pipe:()=>vc,positive:()=>Mt,prefault:()=>er,preprocess:()=>Ce,prettifyError:()=>za,promise:()=>lc,property:()=>wt,readonly:()=>cr,record:()=>Be,refine:()=>je,regex:()=>Mn,regexes:()=>to,registry:()=>yt,safeDecode:()=>Ra,safeDecodeAsync:()=>yi,safeEncode:()=>zo,safeEncodeAsync:()=>Cs,safeParse:()=>Ri,safeParseAsync:()=>uo,set:()=>ao,setErrorMap:()=>Md,size:()=>ia,slugify:()=>Fs,startsWith:()=>Mo,strictObject:()=>oe,string:()=>Za,stringFormat:()=>en,stringbool:()=>un,success:()=>On,superRefine:()=>Je,symbol:()=>bt,templateLiteral:()=>Gt,toJSONSchema:()=>Xs,toLowerCase:()=>Ws,toUpperCase:()=>Yi,transform:()=>Gn,treeifyError:()=>Bo,trim:()=>Qo,tuple:()=>Fc,uint32:()=>me,uint64:()=>Tr,ulid:()=>dt,undefined:()=>fi,union:()=>gr,unknown:()=>Nr,uppercase:()=>_c,url:()=>nt,util:()=>qi,uuid:()=>Lt,uuidv4:()=>ss,uuidv6:()=>kt,uuidv7:()=>Xr,void:()=>Qs,xid:()=>Hr,xor:()=>ai});di(Xl());var Hd=Vd,Ud=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),Wd=i(((e,t)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{getVercelOidcToken:()=>p,getVercelOidcTokenSync:()=>m}),t.exports=l(u);var d=Ud(),f=Jc();async function p(e){let t=``,r;try{t=m()}catch(e){r=e}try{let[{getTokenPayload:r,isExpired:i},{refreshToken:a}]=await Promise.all([await import(`../../_chunks/workflow/token-util-Ldar52H7.js`).then(e=>n(e.t())),await import(`../../_chunks/workflow/token-DHD-q-fS.js`).then(e=>n(e.default))]);(!t||i(r(t),e?.expirationBufferMs))&&(await a(e),t=m())}catch(e){let t=r instanceof Error?r.message:``;throw e instanceof Error&&(t=`${t}
|
|
2
2
|
${e.message}`),t?new f.VercelOidcTokenError(t):e}return t}function m(){let e=(0,d.getContext)().headers?.[`x-vercel-oidc-token`]??process.env.VERCEL_OIDC_TOKEN;if(!e)throw Error(`The 'x-vercel-oidc-token' header is missing from the request. Do you have the OIDC option enabled in the Vercel project settings?`);return e}0&&(t.exports={getVercelOidcToken:p,getVercelOidcTokenSync:m})})),Gd=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>f.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>f.RefreshAccessTokenFailedError,getContext:()=>d.getContext,getVercelOidcToken:()=>u.getVercelOidcToken,getVercelOidcTokenSync:()=>u.getVercelOidcTokenSync,getVercelToken:()=>p.getVercelToken}),t.exports=c(l);var u=Wd(),d=Ud(),f=qc(),p=Yc();0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,getContext,getVercelOidcToken,getVercelOidcTokenSync,getVercelToken})}))();let Kd;try{Kd=new TextDecoder}catch{}let T,qd,E=0;const Jd=[],Yd=57337,Xd={};let Zd=11281e4,Qd=1681e4,$d=Jd,ef=0,D={},O,tf,nf=0,rf=0,k,af,A=[],of=[],sf,cf,lf,uf={useRecords:!1,mapsAsObjects:!0},df=!1,ff=2;try{Function(``)}catch{ff=1/0}var pf=class e{constructor(e){if(e&&((e.keyMap||e._keyMap)&&!e.useRecords&&(e.useRecords=!1,e.mapsAsObjects=!0),e.useRecords===!1&&e.mapsAsObjects===void 0&&(e.mapsAsObjects=!0),e.getStructures&&(e.getShared=e.getStructures),e.getShared&&!e.structures&&((e.structures=[]).uninitialized=!0),e.keyMap)){this.mapKey=new Map;for(let[t,n]of Object.entries(e.keyMap))this.mapKey.set(n,t)}Object.assign(this,e)}decodeKey(e){return this.keyMap&&this.mapKey.get(e)||e}encodeKey(e){return this.keyMap&&this.keyMap.hasOwnProperty(e)?this.keyMap[e]:e}encodeKeys(e){if(!this._keyMap)return e;let t=new Map;for(let[n,r]of Object.entries(e))t.set(this._keyMap.hasOwnProperty(n)?this._keyMap[n]:n,r);return t}decodeKeys(e){if(!this._keyMap||e.constructor.name!=`Map`)return e;if(!this._mapKey){this._mapKey=new Map;for(let[e,t]of Object.entries(this._keyMap))this._mapKey.set(t,e)}let t={};return e.forEach((e,n)=>t[_f(this._mapKey.has(n)?this._mapKey.get(n):n)]=e),t}mapDecode(e,t){let n=this.decode(e);if(this._keyMap)switch(n.constructor.name){case`Array`:return n.map(e=>this.decodeKeys(e))}return n}decode(t,n){if(T)return Bf(()=>(Vf(),this?this.decode(t,n):e.prototype.decode.call(uf,t,n)));qd=n>-1?n:t.length,E=0,ef=0,rf=0,tf=null,$d=Jd,k=null,T=t;try{cf=t.dataView||=new DataView(t.buffer,t.byteOffset,t.byteLength)}catch(e){throw T=null,t instanceof Uint8Array?e:Error(`Source must be a Uint8Array or Buffer but was a `+(t&&typeof t==`object`?t.constructor.name:typeof t))}if(this instanceof e){if(D=this,sf=this.sharedValues&&(this.pack?Array(this.maxPrivatePackedValues||16).concat(this.sharedValues):this.sharedValues),this.structures)return O=this.structures,mf();(!O||O.length>0)&&(O=[])}else D=uf,(!O||O.length>0)&&(O=[]),sf=null;return mf()}decodeMultiple(e,t){let n,r=0;try{let i=e.length;df=!0;let a=this?this.decode(e,i):Uf.decode(e,i);if(t){if(t(a)===!1)return;for(;E<i;)if(r=E,t(mf())===!1)return}else{for(n=[a];E<i;)r=E,n.push(mf());return n}}catch(e){throw e.lastPosition=r,e.values=n,e}finally{df=!1,Vf()}}};function mf(){try{let e=j();if(k){if(E>=k.postBundlePosition){let e=Error(`Unexpected bundle position`);throw e.incomplete=!0,e}E=k.postBundlePosition,k=null}if(E==qd)O=null,T=null,af&&=null;else if(E>qd){let e=Error(`Unexpected end of CBOR data`);throw e.incomplete=!0,e}else if(!df)throw Error(`Data read, but end of buffer not reached`);return e}catch(e){throw Vf(),(e instanceof RangeError||e.message.startsWith(`Unexpected end of buffer`))&&(e.incomplete=!0),e}}function j(){let e=T[E++],t=e>>5;if(e&=31,e>23)switch(e){case 24:e=T[E++];break;case 25:if(t==7)return Ef();e=cf.getUint16(E),E+=2;break;case 26:if(t==7){let e=cf.getFloat32(E);if(D.useFloat32>2){let t=Hf[(T[E]&127)<<1|T[E+1]>>7];return E+=4,(t*e+(e>0?.5:-.5)>>0)/t}return E+=4,e}e=cf.getUint32(E),E+=4;break;case 27:if(t==7){let e=cf.getFloat64(E);return E+=8,e}if(t>1){if(cf.getUint32(E)>0)throw Error(`JavaScript does not support arrays, maps, or strings with length over 4294967295`);e=cf.getUint32(E+4)}else D.int64AsNumber?(e=cf.getUint32(E)*4294967296,e+=cf.getUint32(E+4)):e=cf.getBigUint64(E);E+=8;break;case 31:switch(t){case 2:case 3:throw Error(`Indefinite length not supported for byte or text strings`);case 4:let e=[],n,r=0;for(;(n=j())!=Xd;){if(r>=Zd)throw Error(`Array length exceeds ${Zd}`);e[r++]=n}return t==4?e:t==3?e.join(``):Buffer.concat(e);case 5:let i;if(D.mapsAsObjects){let e={},t=0;if(D.keyMap)for(;(i=j())!=Xd;){if(t++>=Qd)throw Error(`Property count exceeds ${Qd}`);e[_f(D.decodeKey(i))]=j()}else for(;(i=j())!=Xd;){if(t++>=Qd)throw Error(`Property count exceeds ${Qd}`);e[_f(i)]=j()}return e}else{lf&&=(D.mapsAsObjects=!0,!1);let e=new Map;if(D.keyMap){let t=0;for(;(i=j())!=Xd;){if(t++>=Qd)throw Error(`Map size exceeds ${Qd}`);e.set(D.decodeKey(i),j())}}else{let t=0;for(;(i=j())!=Xd;){if(t++>=Qd)throw Error(`Map size exceeds ${Qd}`);e.set(i,j())}}return e}case 7:return Xd;default:throw Error(`Invalid major type for indefinite length `+t)}default:throw Error(`Unknown token `+e)}switch(t){case 0:return e;case 1:return~e;case 2:return Cf(e);case 3:if(rf>=E)return tf.slice(E-nf,(E+=e)-nf);if(rf==0&&qd<140&&e<32){let t=e<16?Sf(e):xf(e);if(t!=null)return t}return vf(e);case 4:if(e>=Zd)throw Error(`Array length exceeds ${Zd}`);let t=Array(e);for(let n=0;n<e;n++)t[n]=j();return t;case 5:if(e>=Qd)throw Error(`Map size exceeds ${Zd}`);if(D.mapsAsObjects){let t={};if(D.keyMap)for(let n=0;n<e;n++)t[_f(D.decodeKey(j()))]=j();else for(let n=0;n<e;n++)t[_f(j())]=j();return t}else{lf&&=(D.mapsAsObjects=!0,!1);let t=new Map;if(D.keyMap)for(let n=0;n<e;n++)t.set(D.decodeKey(j()),j());else for(let n=0;n<e;n++)t.set(j(),j());return t}case 6:if(e>=Yd){let t=O[e&8191];if(t)return t.read||=gf(t),t.read();if(e<65536){if(e==57343){let e=Rf(),t=j(),n=j();Of(t,n);let r={};if(D.keyMap)for(let t=2;t<e;t++){let e=D.decodeKey(n[t-2]);r[_f(e)]=j()}else for(let t=2;t<e;t++){let e=n[t-2];r[_f(e)]=j()}return r}else if(e==57342){let e=Rf(),t=j();for(let n=2;n<e;n++)Of(t++,j());return j()}else if(e==Yd)return Lf();if(D.getShared&&(zf(),t=O[e&8191],t))return t.read||=gf(t),t.read()}}let n=A[e];if(n)return n.handlesRead?n(j):n(j());{let t=j();for(let n=0;n<of.length;n++){let r=of[n](e,t);if(r!==void 0)return r}return new Df(t,e)}case 7:switch(e){case 20:return!1;case 21:return!0;case 22:return null;case 23:return;default:let t=(sf||Mf())[e];if(t!==void 0)return t;throw Error(`Unknown token `+e)}default:if(isNaN(e)){let e=Error(`Unexpected end of CBOR data`);throw e.incomplete=!0,e}throw Error(`Unknown CBOR token `+e)}}const hf=/^[a-zA-Z_$][a-zA-Z\d_$]*$/;function gf(e){if(!e)throw Error(`Structure is required in record definition`);function t(){let e=T[E++];if(e&=31,e>23)switch(e){case 24:e=T[E++];break;case 25:e=cf.getUint16(E),E+=2;break;case 26:e=cf.getUint32(E),E+=4;break;default:throw Error(`Expected array header, but got `+T[E-1])}let t=this.compiledReader;for(;t;){if(t.propertyCount===e)return t(j);t=t.next}if(this.slowReads++>=ff){let n=this.length==e?this:this.slice(0,e);return t=D.keyMap?Function(`r`,`return {`+n.map(e=>D.decodeKey(e)).map(e=>hf.test(e)?_f(e)+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`}`):Function(`r`,`return {`+n.map(e=>hf.test(e)?_f(e)+`:r()`:`[`+JSON.stringify(e)+`]:r()`).join(`,`)+`}`),this.compiledReader&&(t.next=this.compiledReader),t.propertyCount=e,this.compiledReader=t,t(j)}let n={};if(D.keyMap)for(let t=0;t<e;t++)n[_f(D.decodeKey(this[t]))]=j();else for(let t=0;t<e;t++)n[_f(this[t])]=j();return n}return e.slowReads=0,t}function _f(e){if(typeof e==`string`)return e===`__proto__`?`__proto_`:e;if(typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`)return e.toString();if(e==null)return e+``;throw Error(`Invalid property name type `+typeof e)}let vf=bf;function yf(e){vf=t(1);function t(t){return function(t){let n=$d[ef++];if(n==null){if(k)return bf(t);let r=e(E,qd,t,T);if(typeof r==`string`)n=r,$d=Jd;else if($d=r,ef=1,rf=1,n=$d[0],n===void 0)throw Error(`Unexpected end of buffer`)}let r=n.length;return r<=t?(E+=t,n):(tf=n,nf=E,rf=E+r,E+=t,n.slice(0,t))}}}function bf(e){let t;if(e<16&&(t=Sf(e)))return t;if(e>64&&Kd)return Kd.decode(T.subarray(E,E+=e));let n=E+e,r=[];for(t=``;E<n;){let e=T[E++];if(!(e&128))r.push(e);else if((e&224)==192){let t=T[E++]&63;r.push((e&31)<<6|t)}else if((e&240)==224){let t=T[E++]&63,n=T[E++]&63;r.push((e&31)<<12|t<<6|n)}else if((e&248)==240){let t=T[E++]&63,n=T[E++]&63,i=T[E++]&63,a=(e&7)<<18|t<<12|n<<6|i;a>65535&&(a-=65536,r.push(a>>>10&1023|55296),a=56320|a&1023),r.push(a)}else r.push(e);r.length>=4096&&(t+=M.apply(String,r),r.length=0)}return r.length>0&&(t+=M.apply(String,r)),t}let M=String.fromCharCode;function xf(e){let t=E,n=Array(e);for(let r=0;r<e;r++){let e=T[E++];if((e&128)>0){E=t;return}n[r]=e}return M.apply(String,n)}function Sf(e){if(e<4)if(e<2){if(e===0)return``;{let e=T[E++];if((e&128)>1){--E;return}return M(e)}}else{let t=T[E++],n=T[E++];if((t&128)>0||(n&128)>0){E-=2;return}if(e<3)return M(t,n);let r=T[E++];if((r&128)>0){E-=3;return}return M(t,n,r)}else{let t=T[E++],n=T[E++],r=T[E++],i=T[E++];if((t&128)>0||(n&128)>0||(r&128)>0||(i&128)>0){E-=4;return}if(e<6){if(e===4)return M(t,n,r,i);{let e=T[E++];if((e&128)>0){E-=5;return}return M(t,n,r,i,e)}}else if(e<8){let a=T[E++],o=T[E++];if((a&128)>0||(o&128)>0){E-=6;return}if(e<7)return M(t,n,r,i,a,o);let s=T[E++];if((s&128)>0){E-=7;return}return M(t,n,r,i,a,o,s)}else{let a=T[E++],o=T[E++],s=T[E++],c=T[E++];if((a&128)>0||(o&128)>0||(s&128)>0||(c&128)>0){E-=8;return}if(e<10){if(e===8)return M(t,n,r,i,a,o,s,c);{let e=T[E++];if((e&128)>0){E-=9;return}return M(t,n,r,i,a,o,s,c,e)}}else if(e<12){let l=T[E++],u=T[E++];if((l&128)>0||(u&128)>0){E-=10;return}if(e<11)return M(t,n,r,i,a,o,s,c,l,u);let d=T[E++];if((d&128)>0){E-=11;return}return M(t,n,r,i,a,o,s,c,l,u,d)}else{let l=T[E++],u=T[E++],d=T[E++],f=T[E++];if((l&128)>0||(u&128)>0||(d&128)>0||(f&128)>0){E-=12;return}if(e<14){if(e===12)return M(t,n,r,i,a,o,s,c,l,u,d,f);{let e=T[E++];if((e&128)>0){E-=13;return}return M(t,n,r,i,a,o,s,c,l,u,d,f,e)}}else{let p=T[E++],m=T[E++];if((p&128)>0||(m&128)>0){E-=14;return}if(e<15)return M(t,n,r,i,a,o,s,c,l,u,d,f,p,m);let h=T[E++];if((h&128)>0){E-=15;return}return M(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h)}}}}}function Cf(e){return D.copyBuffers?Uint8Array.prototype.slice.call(T,E,E+=e):T.subarray(E,E+=e)}let wf=new Float32Array(1),Tf=new Uint8Array(wf.buffer,0,4);function Ef(){let e=T[E++],t=T[E++],n=(e&127)>>2;if(n===31)return t||e&3?NaN:e&128?-1/0:1/0;if(n===0){let n=((e&3)<<8|t)/(1<<24);return e&128?-n:n}return Tf[3]=e&128|(n>>1)+56,Tf[2]=(e&7)<<5|t>>3,Tf[1]=t<<5,Tf[0]=0,wf[0]}Array(4096);var Df=class{constructor(e,t){this.value=e,this.tag=t}};A[0]=e=>new Date(e),A[1]=e=>new Date(Math.round(e*1e3)),A[2]=e=>{let t=BigInt(0);for(let n=0,r=e.byteLength;n<r;n++)t=BigInt(e[n])+(t<<BigInt(8));return t},A[3]=e=>BigInt(-1)-A[2](e),A[4]=e=>+(e[1]+`e`+e[0]),A[5]=e=>e[1]*Math.exp(e[0]*Math.log(2));const Of=(e,t)=>{e-=57344;let n=O[e];n&&n.isShared&&((O.restoreStructures||=[])[e]=n),O[e]=t,t.read=gf(t)};A[105]=e=>{let t=e.length,n=e[1];Of(e[0],n);let r={};for(let i=2;i<t;i++){let t=n[i-2];r[_f(t)]=e[i]}return r},A[14]=e=>k?k[0].slice(k.position0,k.position0+=e):new Df(e,14),A[15]=e=>k?k[1].slice(k.position1,k.position1+=e):new Df(e,15);let kf={Error,RegExp};A[27]=e=>(kf[e[0]]||Error)(e[1],e[2]);const Af=e=>{if(T[E++]!=132){let e=Error(`Packed values structure must be followed by a 4 element array`);throw T.length<E&&(e.incomplete=!0),e}let t=e();if(!t||!t.length){let e=Error(`Packed values structure must be followed by a 4 element array`);throw e.incomplete=!0,e}return sf=sf?t.concat(sf.slice(t.length)):t,sf.prefixes=e(),sf.suffixes=e(),e()};Af.handlesRead=!0,A[51]=Af,A[6]=e=>{if(!sf)if(D.getShared)zf();else return new Df(e,6);if(typeof e==`number`)return sf[16+(e>=0?2*e:-2*e-1)];let t=Error(`No support for non-integer packed references yet`);throw e===void 0&&(t.incomplete=!0),t},A[28]=e=>{af||(af=new Map,af.id=0);let t=af.id++,n=E,r=T[E],i;i=r>>5==4?[]:{};let a={target:i};af.set(t,a);let o=e();return a.used?(Object.getPrototypeOf(i)!==Object.getPrototypeOf(o)&&(E=n,i=o,af.set(t,{target:i}),o=e()),Object.assign(i,o)):(a.target=o,o)},A[28].handlesRead=!0,A[29]=e=>{let t=af.get(e);return t.used=!0,t.target},A[258]=e=>new Set(e),(A[259]=e=>(D.mapsAsObjects&&(D.mapsAsObjects=!1,lf=!0),e())).handlesRead=!0;function jf(e,t){return typeof e==`string`?e+t:e instanceof Array?e.concat(t):Object.assign({},e,t)}function Mf(){if(!sf)if(D.getShared)zf();else throw Error(`No packed values available`);return sf}of.push((e,t)=>{if(e>=225&&e<=255)return jf(Mf().prefixes[e-224],t);if(e>=28704&&e<=32767)return jf(Mf().prefixes[e-28672],t);if(e>=1879052288&&e<=2147483647)return jf(Mf().prefixes[e-1879048192],t);if(e>=216&&e<=223)return jf(t,Mf().suffixes[e-216]);if(e>=27647&&e<=28671)return jf(t,Mf().suffixes[e-27639]);if(e>=1811940352&&e<=1879048191)return jf(t,Mf().suffixes[e-1811939328]);if(e==1399353956)return{packedValues:sf,structures:O.slice(0),version:t};if(e==55799)return t});const Nf=new Uint8Array(new Uint16Array([1]).buffer)[0]==1,Pf=[Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,typeof BigUint64Array>`u`?{name:`BigUint64Array`}:BigUint64Array,Int8Array,Int16Array,Int32Array,typeof BigInt64Array>`u`?{name:`BigInt64Array`}:BigInt64Array,Float32Array,Float64Array],Ff=[64,68,69,70,71,72,77,78,79,85,86];for(let e=0;e<Pf.length;e++)If(Pf[e],Ff[e]);function If(e,t){let n=`get`+e.name.slice(0,-5),r;typeof e==`function`?r=e.BYTES_PER_ELEMENT:e=null;for(let i=0;i<2;i++){if(!i&&r==1)continue;let a=r==2?1:r==4?2:r==8?3:0;A[i?t:t-4]=r==1||i==Nf?n=>{if(!e)throw Error(`Could not find typed array for code `+t);return!D.copyBuffers&&(r===1||r===2&&!(n.byteOffset&1)||r===4&&!(n.byteOffset&3)||r===8&&!(n.byteOffset&7))?new e(n.buffer,n.byteOffset,n.byteLength>>a):new e(Uint8Array.prototype.slice.call(n,0).buffer)}:r=>{if(!e)throw Error(`Could not find typed array for code `+t);let o=new DataView(r.buffer,r.byteOffset,r.byteLength),s=r.length>>a,c=new e(s),l=o[n];for(let e=0;e<s;e++)c[e]=l.call(o,e<<a,i);return c}}}function Lf(){let e=Rf(),t=E+j();for(let t=2;t<e;t++){let e=Rf();E+=e}let n=E;return E=t,k=[bf(Rf()),bf(Rf())],k.position0=0,k.position1=0,k.postBundlePosition=E,E=n,j()}function Rf(){let e=T[E++]&31;if(e>23)switch(e){case 24:e=T[E++];break;case 25:e=cf.getUint16(E),E+=2;break;case 26:e=cf.getUint32(E),E+=4;break}return e}function zf(){if(D.getShared){let e=Bf(()=>(T=null,D.getShared()))||{},t=e.structures||[];D.sharedVersion=e.version,sf=D.sharedValues=e.packedValues,O===!0?D.structures=O=t:O.splice.apply(O,[0,t.length].concat(t))}}function Bf(e){let t=qd,n=E,r=ef,i=nf,a=rf,o=tf,s=$d,c=af,l=k,u=new Uint8Array(T.slice(0,qd)),d=O,f=D,p=df,m=e();return qd=t,E=n,ef=r,nf=i,rf=a,tf=o,$d=s,af=c,k=l,T=u,df=p,O=d,D=f,cf=new DataView(T.buffer,T.byteOffset,T.byteLength),m}function Vf(){T=null,af=null,O=null}const Hf=Array(147);for(let e=0;e<256;e++)Hf[e]=+(`1e`+Math.floor(45.15-e*.30103));let Uf=new pf({useRecords:!1});const Wf=Uf.decode;Uf.decodeMultiple;const Gf={NEVER:0,ALWAYS:1,DECIMAL_ROUND:3,DECIMAL_FIT:4};let Kf;try{Kf=new TextEncoder}catch{}let qf,Jf;const Yf=typeof globalThis==`object`&&globalThis.Buffer,Xf=Yf!==void 0,Zf=Xf?Yf.allocUnsafeSlow:Uint8Array,Qf=Xf?Yf:Uint8Array,$f=Xf?4294967296:2144337920;let ep,N,P,F=0,tp,I=null;const np=/[\u0080-\uFFFF]/,rp=Symbol(`record-id`);var ip=class extends pf{constructor(e){super(e),this.offset=0;let t,n,r,i,a;e||={};let o=Qf.prototype.utf8Write?function(e,t,n){return N.utf8Write(e,t,n)}:Kf&&Kf.encodeInto?function(e,t){return Kf.encodeInto(e,N.subarray(t)).written}:!1,s=this,c=e.structures||e.saveStructures,l=e.maxSharedStructures;if(l??=c?128:0,l>8190)throw Error(`Maximum maxSharedStructure is 8190`);let u=e.sequential;u&&(l=0),this.structures||=[],this.saveStructures&&(this.saveShared=this.saveStructures);let d,f,p=e.sharedValues,m;if(p){m=Object.create(null);for(let e=0,t=p.length;e<t;e++)m[p[e]]=e}let h=[],g=0,_=0;this.mapEncode=function(e,t){if(this._keyMap&&!this._mapped)switch(e.constructor.name){case`Array`:e=e.map(e=>this.encodeKeys(e));break}return this.encode(e,t)},this.encode=function(o,c){if(N||(N=new Zf(8192),P=new DataView(N.buffer,0,8192),F=0),tp=N.length-10,tp-F<2048?(N=new Zf(N.length),P=new DataView(N.buffer,0,N.length),tp=N.length-10,F=0):c===512&&(F=F+7&2147483640),t=F,s.useSelfDescribedHeader&&(P.setUint32(F,3654940416),F+=3),a=s.structuredClone?new Map:null,s.bundleStrings&&typeof o!=`string`?(I=[],I.size=1/0):I=null,n=s.structures,n){if(n.uninitialized){let e=s.getShared()||{};s.structures=n=e.structures||[],s.sharedVersion=e.version;let t=s.sharedValues=e.packedValues;if(t){m={};for(let e=0,n=t.length;e<n;e++)m[t[e]]=e}}let e=n.length;if(e>l&&!u&&(e=l),!n.transitions){n.transitions=Object.create(null);for(let t=0;t<e;t++){let e=n[t];if(!e)continue;let r,i=n.transitions;for(let n=0,a=e.length;n<a;n++){i[rp]===void 0&&(i[rp]=t);let a=e[n];r=i[a],r||=i[a]=Object.create(null),i=r}i[rp]=t|1048576}}u||(n.nextId=e)}if(r&&=!1,i=n||[],f=m,e.pack){let t=new Map;if(t.values=[],t.encoder=s,t.maxValues=e.maxPrivatePackedValues||(m?16:1/0),t.objectMap=m||!1,t.samplingPackedValues=d,up(o,t),t.values.length>0){N[F++]=216,N[F++]=51,sp(4);let e=t.values;v(e),sp(0),sp(0),f=Object.create(m||null);for(let t=0,n=e.length;t<n;t++)f[e[t]]=t}}ep=c&Sp;try{if(ep)return;if(v(o),I&&hp(t,v),s.offset=F,a&&a.idsToInsert){F+=a.idsToInsert.length*2,F>tp&&b(F),s.offset=F;let e=mp(N.subarray(t,F),a.idsToInsert);return a=null,e}return c&512?(N.start=t,N.end=F,N):N.subarray(t,F)}finally{if(n){if(_<10&&_++,n.length>l&&(n.length=l),g>1e4)n.transitions=null,_=0,g=0,h.length>0&&(h=[]);else if(h.length>0&&!u){for(let e=0,t=h.length;e<t;e++)h[e][rp]=void 0;h=[]}}if(r&&s.saveShared){s.structures.length>l&&(s.structures=s.structures.slice(0,l));let e=N.subarray(t,F);return s.updateSharedData()===!1?s.encode(o):e}c&1024&&(F=t)}},this.findCommonStringsToPack=()=>(d=new Map,m||=Object.create(null),e=>{let t=e&&e.threshold||4,n=this.pack?e.maxPrivatePackedValues||16:0;p||=this.sharedValues=[];for(let[e,i]of d)i.count>t&&(m[e]=n++,p.push(e),r=!0);for(;this.saveShared&&this.updateSharedData()===!1;);d=null});let v=n=>{F>tp&&(N=b(F));var r=typeof n,i;if(r===`string`){if(f){let t=f[n];if(t>=0){t<16?N[F++]=t+224:(N[F++]=198,t&1?v(15-t>>1):v(t-16>>1));return}else if(d&&!e.pack){let e=d.get(n);e?e.count++:d.set(n,{count:1})}}let r=n.length;if(I&&r>=4&&r<1024){if((I.size+=r)>61440){let e,n=(I[0]?I[0].length*3+I[1].length:0)+10;F+n>tp&&(N=b(F+n)),N[F++]=217,N[F++]=223,N[F++]=249,N[F++]=I.position?132:130,N[F++]=26,e=F-t,F+=4,I.position&&hp(t,v),I=[``,``],I.size=0,I.position=e}let e=np.test(n);I[+!e]+=n,N[F++]=e?206:207,v(r);return}let a;a=r<32?1:r<256?2:r<65536?3:5;let s=r*3;if(F+s>tp&&(N=b(F+s)),r<64||!o){let e,t,o,s=F+a;for(e=0;e<r;e++)t=n.charCodeAt(e),t<128?N[s++]=t:t<2048?(N[s++]=t>>6|192,N[s++]=t&63|128):(t&64512)==55296&&((o=n.charCodeAt(e+1))&64512)==56320?(t=65536+((t&1023)<<10)+(o&1023),e++,N[s++]=t>>18|240,N[s++]=t>>12&63|128,N[s++]=t>>6&63|128,N[s++]=t&63|128):(N[s++]=t>>12|224,N[s++]=t>>6&63|128,N[s++]=t&63|128);i=s-F-a}else i=o(n,F+a,s);i<24?N[F++]=96|i:i<256?(a<2&&N.copyWithin(F+2,F+1,F+1+i),N[F++]=120,N[F++]=i):i<65536?(a<3&&N.copyWithin(F+3,F+2,F+2+i),N[F++]=121,N[F++]=i>>8,N[F++]=i&255):(a<5&&N.copyWithin(F+5,F+3,F+3+i),N[F++]=122,P.setUint32(F,i),F+=4),F+=i}else if(r===`number`)if(!this.alwaysUseFloat&&n>>>0===n)n<24?N[F++]=n:n<256?(N[F++]=24,N[F++]=n):n<65536?(N[F++]=25,N[F++]=n>>8,N[F++]=n&255):(N[F++]=26,P.setUint32(F,n),F+=4);else if(!this.alwaysUseFloat&&n>>0===n)n>=-24?N[F++]=31-n:n>=-256?(N[F++]=56,N[F++]=~n):n>=-65536?(N[F++]=57,P.setUint16(F,~n),F+=2):(N[F++]=58,P.setUint32(F,~n),F+=4);else{let e;if((e=this.useFloat32)>0&&n<4294967296&&n>=-2147483648){N[F++]=250,P.setFloat32(F,n);let t;if(e<4||(t=n*Hf[(N[F]&127)<<1|N[F+1]>>7])>>0===t){F+=4;return}else F--}N[F++]=251,P.setFloat64(F,n),F+=8}else if(r===`object`)if(!n)N[F++]=246;else{if(a){let e=a.get(n);if(e){if(N[F++]=216,N[F++]=29,N[F++]=25,!e.references){let t=a.idsToInsert||=[];e.references=[],t.push(e)}e.references.push(F-t),F+=2;return}else a.set(n,{offset:F-t})}let e=n.constructor;if(e===Object)y(n);else if(e===Array){i=n.length,i<24?N[F++]=128|i:sp(i);for(let e=0;e<i;e++)v(n[e])}else if(e===Map)if((this.mapsAsObjects?this.useTag259ForMaps!==!1:this.useTag259ForMaps)&&(N[F++]=217,N[F++]=1,N[F++]=3),i=n.size,i<24?N[F++]=160|i:i<256?(N[F++]=184,N[F++]=i):i<65536?(N[F++]=185,N[F++]=i>>8,N[F++]=i&255):(N[F++]=186,P.setUint32(F,i),F+=4),s.keyMap)for(let[e,t]of n)v(s.encodeKey(e)),v(t);else for(let[e,t]of n)v(e),v(t);else{for(let e=0,t=qf.length;e<t;e++){let t=Jf[e];if(n instanceof t){let t=qf[e],r=t.tag;r??=t.getTag&&t.getTag.call(this,n),r<24?N[F++]=192|r:r<256?(N[F++]=216,N[F++]=r):r<65536?(N[F++]=217,N[F++]=r>>8,N[F++]=r&255):r>-1&&(N[F++]=218,P.setUint32(F,r),F+=4),t.encode.call(this,n,v,b);return}}if(n[Symbol.iterator]){if(ep){let e=Error(`Iterable should be serialized as iterator`);throw e.iteratorNotHandled=!0,e}N[F++]=159;for(let e of n)v(e);N[F++]=255;return}if(n[Symbol.asyncIterator]||lp(n)){let e=Error(`Iterable/blob should be serialized as iterator`);throw e.iteratorNotHandled=!0,e}if(this.useToJSON&&n.toJSON){let e=n.toJSON();if(e!==n)return v(e)}y(n)}}else if(r===`boolean`)N[F++]=n?245:244;else if(r===`bigint`){if(n<BigInt(1)<<BigInt(64)&&n>=0)N[F++]=27,P.setBigUint64(F,n);else if(n>-(BigInt(1)<<BigInt(64))&&n<0)N[F++]=59,P.setBigUint64(F,-n-BigInt(1));else if(this.largeBigIntToFloat)N[F++]=251,P.setFloat64(F,Number(n));else{n>=BigInt(0)?N[F++]=194:(N[F++]=195,n=BigInt(-1)-n);let e=[];for(;n;)e.push(Number(n&BigInt(255))),n>>=BigInt(8);pp(new Uint8Array(e.reverse()),b);return}F+=8}else if(r===`undefined`)N[F++]=247;else throw Error(`Unknown type: `+r)},y=this.useRecords===!1?this.variableMapSize?e=>{let t=Object.keys(e),n=Object.values(e),r=t.length;if(r<24?N[F++]=160|r:r<256?(N[F++]=184,N[F++]=r):r<65536?(N[F++]=185,N[F++]=r>>8,N[F++]=r&255):(N[F++]=186,P.setUint32(F,r),F+=4),s.keyMap)for(let e=0;e<r;e++)v(s.encodeKey(t[e])),v(n[e]);else for(let e=0;e<r;e++)v(t[e]),v(n[e])}:e=>{N[F++]=185;let n=F-t;F+=2;let r=0;if(s.keyMap)for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(v(s.encodeKey(t)),v(e[t]),r++);else for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(v(t),v(e[t]),r++);N[n+++t]=r>>8,N[n+t]=r&255}:(e,t)=>{let n,a=i.transitions||=Object.create(null),o=0,s=0,c,u;if(this.keyMap){u=Object.keys(e).map(e=>this.encodeKey(e)),s=u.length;for(let e=0;e<s;e++){let t=u[e];n=a[t],n||(n=a[t]=Object.create(null),o++),a=n}}else for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&(n=a[t],n||(a[rp]&1048576&&(c=a[rp]&65535),n=a[t]=Object.create(null),o++),a=n,s++);let d=a[rp];if(d!==void 0)d&=65535,N[F++]=217,N[F++]=d>>8|224,N[F++]=d&255;else if(u||=a.__keys__||=Object.keys(e),c===void 0?(d=i.nextId++,d||(d=0,i.nextId=1),d>=256&&(i.nextId=(d=l)+1)):d=c,i[d]=u,d<l){N[F++]=217,N[F++]=d>>8|224,N[F++]=d&255,a=i.transitions;for(let e=0;e<s;e++)(a[rp]===void 0||a[rp]&1048576)&&(a[rp]=d),a=a[u[e]];a[rp]=d|1048576,r=!0}else{if(a[rp]=d,P.setUint32(F,3655335680),F+=3,o&&(g+=_*o),h.length>=256-l&&(h.shift()[rp]=void 0),h.push(a),sp(s+2),v(57344+d),v(u),t)return;for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&v(e[t]);return}if(s<24?N[F++]=128|s:sp(s),!t)for(let t in e)(typeof e.hasOwnProperty!=`function`||e.hasOwnProperty(t))&&v(e[t])},b=e=>{let n;if(e>16777216){if(e-t>$f)throw Error(`Encoded buffer would be larger than maximum buffer size`);n=Math.min($f,Math.round(Math.max((e-t)*(e>67108864?1.25:2),4194304)/4096)*4096)}else n=(Math.max(e-t<<2,N.length-1)>>12)+1<<12;let r=new Zf(n);return P=new DataView(r.buffer,0,n),N.copy?N.copy(r,0,t,e):r.set(N.slice(t,e)),F-=t,t=0,tp=r.length-10,N=r},ee=100,te=1e3;this.encodeAsIterable=function(e,t){return ae(e,t,ne)},this.encodeAsAsyncIterable=function(e,t){return ae(e,t,oe)};function*ne(e,n,r){let i=e.constructor;if(i===Object){let t=s.useRecords!==!1;t?y(e,!0):ap(Object.keys(e).length,160);for(let r in e){let i=e[r];t||v(r),i&&typeof i==`object`?n[r]?yield*ne(i,n[r]):yield*re(i,n,r):v(i)}}else if(i===Array){let r=e.length;sp(r);for(let i=0;i<r;i++){let r=e[i];r&&(typeof r==`object`||F-t>ee)?n.element?yield*ne(r,n.element):yield*re(r,n,`element`):v(r)}}else if(e[Symbol.iterator]&&!e.buffer){N[F++]=159;for(let r of e)r&&(typeof r==`object`||F-t>ee)?n.element?yield*ne(r,n.element):yield*re(r,n,`element`):v(r);N[F++]=255}else lp(e)?(ap(e.size,64),yield N.subarray(t,F),yield e,ie()):e[Symbol.asyncIterator]?(N[F++]=159,yield N.subarray(t,F),yield e,ie(),N[F++]=255):v(e);r&&F>t?yield N.subarray(t,F):F-t>ee&&(yield N.subarray(t,F),ie())}function*re(e,n,r){let i=F-t;try{v(e),F-t>ee&&(yield N.subarray(t,F),ie())}catch(a){if(a.iteratorNotHandled)n[r]={},F=t+i,yield*ne.call(this,e,n[r]);else throw a}}function ie(){ee=te,s.encode(null,Sp)}function ae(e,t,n){return ee=t&&t.chunkThreshold?te=t.chunkThreshold:100,e&&typeof e==`object`?(s.encode(null,Sp),n(e,s.iterateProperties||={},!0)):[s.encode(e)]}async function*oe(e,t){for(let n of ne(e,t,!0)){let e=n.constructor;if(e===Qf||e===Uint8Array)yield n;else if(lp(n)){let e=n.stream().getReader(),t;for(;!(t=await e.read()).done;)yield t.value}else if(n[Symbol.asyncIterator])for await(let e of n)ie(),e?yield*oe(e,t.async||={}):yield s.encode(e);else yield n}}}useBuffer(e){N=e,P=new DataView(N.buffer,N.byteOffset,N.byteLength),F=0}clearSharedData(){this.structures&&=[],this.sharedValues&&=void 0}updateSharedData(){let e=this.sharedVersion||0;this.sharedVersion=e+1;let t=this.structures.slice(0),n=new op(t,this.sharedValues,this.sharedVersion),r=this.saveShared(n,t=>(t&&t.version||0)==e);return r===!1?(n=this.getShared()||{},this.structures=n.structures||[],this.sharedValues=n.packedValues,this.sharedVersion=n.version,this.structures.nextId=this.structures.length):t.forEach((e,t)=>this.structures[t]=e),r}};function ap(e,t){e<24?N[F++]=t|e:e<256?(N[F++]=t|24,N[F++]=e):e<65536?(N[F++]=t|25,N[F++]=e>>8,N[F++]=e&255):(N[F++]=t|26,P.setUint32(F,e),F+=4)}var op=class{constructor(e,t,n){this.structures=e,this.packedValues=t,this.version=n}};function sp(e){e<24?N[F++]=128|e:e<256?(N[F++]=152,N[F++]=e):e<65536?(N[F++]=153,N[F++]=e>>8,N[F++]=e&255):(N[F++]=154,P.setUint32(F,e),F+=4)}const cp=typeof Blob>`u`?function(){}:Blob;function lp(e){if(e instanceof cp)return!0;let t=e[Symbol.toStringTag];return t===`Blob`||t===`File`}function up(e,t){switch(typeof e){case`string`:if(e.length>3){if(t.objectMap[e]>-1||t.values.length>=t.maxValues)return;let n=t.get(e);if(n)++n.count==2&&t.values.push(e);else if(t.set(e,{count:1}),t.samplingPackedValues){let n=t.samplingPackedValues.get(e);n?n.count++:t.samplingPackedValues.set(e,{count:1})}}break;case`object`:if(e)if(e instanceof Array)for(let n=0,r=e.length;n<r;n++)up(e[n],t);else{let r=!t.encoder.useRecords;for(var n in e)e.hasOwnProperty(n)&&(r&&up(n,t),up(e[n],t))}break;case`function`:console.log(e)}}const dp=new Uint8Array(new Uint16Array([1]).buffer)[0]==1;Jf=[Date,Set,Error,RegExp,Df,ArrayBuffer,Uint8Array,Uint8ClampedArray,Uint16Array,Uint32Array,typeof BigUint64Array>`u`?function(){}:BigUint64Array,Int8Array,Int16Array,Int32Array,typeof BigInt64Array>`u`?function(){}:BigInt64Array,Float32Array,Float64Array,op],qf=[{tag:1,encode(e,t){let n=e.getTime()/1e3;(this.useTimestamp32||e.getMilliseconds()===0)&&n>=0&&n<4294967296?(N[F++]=26,P.setUint32(F,n),F+=4):(N[F++]=251,P.setFloat64(F,n),F+=8)}},{tag:258,encode(e,t){t(Array.from(e))}},{tag:27,encode(e,t){t([e.name,e.message])}},{tag:27,encode(e,t){t([`RegExp`,e.source,e.flags])}},{getTag(e){return e.tag},encode(e,t){t(e.value)}},{encode(e,t,n){pp(e,n)}},{getTag(e){if(e.constructor===Uint8Array&&(this.tagUint8Array||Xf&&this.tagUint8Array!==!1))return 64},encode(e,t,n){pp(e,n)}},fp(68,1),fp(69,2),fp(70,4),fp(71,8),fp(72,1),fp(77,2),fp(78,4),fp(79,8),fp(85,4),fp(86,8),{encode(e,t){let n=e.packedValues||[],r=e.structures||[];if(n.values.length>0){N[F++]=216,N[F++]=51,sp(4);let e=n.values;t(e),sp(0),sp(0),packedObjectMap=Object.create(sharedPackedObjectMap||null);for(let t=0,n=e.length;t<n;t++)packedObjectMap[e[t]]=t}if(r){P.setUint32(F,3655335424),F+=3;let n=r.slice(0);n.unshift(57344),n.push(new Df(e.version,1399353956)),t(n)}else t(new Df(e.version,1399353956))}}];function fp(e,t){return!dp&&t>1&&(e-=4),{tag:e,encode:function(e,t){let n=e.byteLength,r=e.byteOffset||0,i=e.buffer||e;t(Xf?Yf.from(i,r,n):new Uint8Array(i,r,n))}}}function pp(e,t){let n=e.byteLength;n<24?N[F++]=64+n:n<256?(N[F++]=88,N[F++]=n):n<65536?(N[F++]=89,N[F++]=n>>8,N[F++]=n&255):(N[F++]=90,P.setUint32(F,n),F+=4),F+n>=N.length&&t(F+n),N.set(e.buffer?e:new Uint8Array(e),F),F+=n}function mp(e,t){let n,r=t.length*2,i=e.length-r;t.sort((e,t)=>e.offset>t.offset?1:-1);for(let n=0;n<t.length;n++){let r=t[n];r.id=n;for(let t of r.references)e[t++]=n>>8,e[t]=n&255}for(;n=t.pop();){let t=n.offset;e.copyWithin(t+r,t,i),r-=2;let a=t+r;e[a++]=216,e[a++]=28,i=t}return e}function hp(e,t){P.setUint32(I.position+e,F-I.position-e+1);let n=I;I=null,t(n[0]),t(n[1])}let gp=new ip({useRecords:!1});const _p=gp.encode;gp.encodeAsIterable,gp.encodeAsAsyncIterable;const{NEVER:vp,ALWAYS:yp,DECIMAL_ROUND:bp,DECIMAL_FIT:xp}=Gf,Sp=2048;var Cp=i(((e,t)=>{let n=()=>process.platform===`linux`,r=null;t.exports={isLinux:n,getReport:()=>{if(!r)if(n()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,r=process.report.getReport(),process.report.excludeNetwork=e}else r={};return r}}})),wp=i(((t,n)=>{let r=e(`fs`),i=2048;n.exports={LDD_PATH:`/usr/bin/ldd`,SELF_PATH:`/proc/self/exe`,readFileSync:e=>{let t=r.openSync(e,`r`),n=Buffer.alloc(i),a=r.readSync(t,n,0,i,0);return r.close(t,()=>{}),n.subarray(0,a)},readFile:e=>new Promise((t,n)=>{r.open(e,`r`,(e,a)=>{if(e)n(e);else{let e=Buffer.alloc(i);r.read(a,e,0,i,0,(n,i)=>{t(e.subarray(0,i)),r.close(a,()=>{})})}})})}})),Tp=i(((e,t)=>{t.exports={interpreterPath:e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let t=e.readUInt32LE(32),n=e.readUInt16LE(54),r=e.readUInt16LE(56);for(let i=0;i<r;i++){let r=t+i*n;if(e.readUInt32LE(r)===3){let t=e.readUInt32LE(r+8),n=e.readUInt32LE(r+32);return e.subarray(t,t+n).toString().replace(/\0.*$/g,``)}}return null}}})),Ep=i(((t,n)=>{let r=e(`child_process`),{isLinux:i,getReport:a}=Cp(),{LDD_PATH:o,SELF_PATH:s,readFile:c,readFileSync:l}=wp(),{interpreterPath:u}=Tp(),d,f,p,m=`getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true`,h=``,g=()=>h||new Promise(e=>{r.exec(m,(t,n)=>{h=t?` `:n,e(h)})}),_=()=>{if(!h)try{h=r.execSync(m,{encoding:`utf8`})}catch{h=` `}return h},v=`glibc`,y=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,b=`musl`,ee=e=>e.includes(`libc.musl-`)||e.includes(`ld-musl-`),te=()=>{let e=a();return e.header&&e.header.glibcVersionRuntime?v:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(ee)?b:null},ne=e=>{let[t,n]=e.split(/[\r\n]+/);return t&&t.includes(v)?v:n&&n.includes(b)?b:null},re=e=>{if(e){if(e.includes(`/ld-musl-`))return b;if(e.includes(`/ld-linux-`))return v}return null},ie=e=>(e=e.toString(),e.includes(`musl`)?b:e.includes(`GNU C Library`)?v:null),ae=async()=>{if(f!==void 0)return f;f=null;try{let e=await c(o);f=ie(e)}catch{}return f},oe=()=>{if(f!==void 0)return f;f=null;try{let e=l(o);f=ie(e)}catch{}return f},se=async()=>{if(d!==void 0)return d;d=null;try{let e=await c(s),t=u(e);d=re(t)}catch{}return d},ce=()=>{if(d!==void 0)return d;d=null;try{let e=l(s),t=u(e);d=re(t)}catch{}return d},le=async()=>{let e=null;if(i()&&(e=await se(),!e&&(e=await ae(),e||=te(),!e))){let t=await g();e=ne(t)}return e},ue=()=>{let e=null;if(i()&&(e=ce(),!e&&(e=oe(),e||=te(),!e))){let t=_();e=ne(t)}return e},de=async()=>i()&&await le()!==v,fe=()=>i()&&ue()!==v,pe=async()=>{if(p!==void 0)return p;p=null;try{let e=(await c(o)).match(y);e&&(p=e[1])}catch{}return p},me=()=>{if(p!==void 0)return p;p=null;try{let e=l(o).match(y);e&&(p=e[1])}catch{}return p},he=()=>{let e=a();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},ge=e=>e.trim().split(/\s+/)[1],_e=e=>{let[t,n,r]=e.split(/[\r\n]+/);return t&&t.includes(v)?ge(t):n&&r&&n.includes(b)?ge(r):null};n.exports={GLIBC:v,MUSL:b,family:le,familySync:ue,isNonGlibcLinux:de,isNonGlibcLinuxSync:fe,version:async()=>{let e=null;if(i()&&(e=await pe(),e||=he(),!e)){let t=await g();e=_e(t)}return e},versionSync:()=>{let e=null;if(i()&&(e=me(),e||=he(),!e)){let t=_();e=_e(t)}return e}}})),Dp=i(((t,n)=>{var r=e(`fs`),i=e(`path`),a=e(`url`),o=process.config&&process.config.variables||{},s=!!process.env.PREBUILDS_ONLY,c=process.versions,l=c.modules;(c.deno||process.isBun)&&(l=`unsupported`);var u=oe()?`electron`:`node`,d=process.arch,f=process.platform,p=process.env.LIBC||(se(f)?`musl`:`glibc`),m=process.env.ARM_VERSION||(d===`arm64`?`8`:o.arm_version)||``,h=(c.uv||``).split(`.`)[0];n.exports=g;function g(t){return typeof __webpack_require__==`function`?__non_webpack_require__(g.path(t)):e(g.path(t))}g.path=function(t){t=i.resolve(t||`.`);var n=``;try{n=typeof __webpack_require__==`function`?__non_webpack_require__(i.join(t,`package.json`)).name:e(i.join(t,`package.json`)).name;var r=n.toUpperCase().replace(/-/g,`_`)+`_PREBUILD`;process.env[r]&&(t=process.env[r])}catch{}if(!s){var o=v(i.join(t,`build/Release`),y);if(o)return o;var c=v(i.join(t,`build/Debug`),y);if(c)return c}var g=ce(t);if(g)return g;var ie=ce(i.dirname(process.execPath));if(ie)return ie;var oe=(n[0]==`@`?``:`@`+n+`/`)+n+`-`+f+`-`+d;try{return le(i.dirname(e(`module`).createRequire(a.pathToFileURL(i.join(t,`package.json`))).resolve(oe)))}catch{}var se=[`platform=`+f,`arch=`+d,`runtime=`+u,`abi=`+l,`uv=`+h,m?`armv=`+m:``,`libc=`+p,`node=`+process.versions.node,process.versions.electron?`electron=`+process.versions.electron:``,typeof __webpack_require__==`function`?`webpack=true`:``].filter(Boolean).join(` `);throw Error(`No native build was found for `+se+`
|
|
3
3
|
attempted loading from: `+t+` and package: `+oe+`
|
|
4
|
-
`);function ce(e){var t=_(i.join(e,`prebuilds`)).map(b).filter(ee(f,d)).sort(te)[0];if(t)return le(i.join(e,`prebuilds`,t.name))}function le(e){var t=_(e).map(ne).filter(re(u,l)).sort(ae(u))[0];if(t)return i.join(e,t.file)}};function _(e){try{return r.readdirSync(e)}catch{return[]}}function v(e,t){var n=_(e).filter(t);return n[0]&&i.join(e,n[0])}function y(e){return/\.node$/.test(e)}function b(e){var t=e.split(`-`);if(t.length===2){var n=t[0],r=t[1].split(`+`);if(n&&r.length&&r.every(Boolean))return{name:e,platform:n,architectures:r}}}function ee(e,t){return function(n){return n==null||n.platform!==e?!1:n.architectures.includes(t)}}function te(e,t){return e.architectures.length-t.architectures.length}function ne(e){var t=e.split(`.`),n=t.pop(),r={file:e,specificity:0};if(n===`node`){for(var i=0;i<t.length;i++){var a=t[i];if(a===`node`||a===`electron`||a===`node-webkit`)r.runtime=a;else if(a===`napi`)r.napi=!0;else if(a.slice(0,3)===`abi`)r.abi=a.slice(3);else if(a.slice(0,2)===`uv`)r.uv=a.slice(2);else if(a.slice(0,4)===`armv`)r.armv=a.slice(4);else if(a===`glibc`||a===`musl`)r.libc=a;else continue;r.specificity++}return r}}function re(e,t){return function(n){return!(n==null||n.runtime!==e&&!ie(n)||n.abi!==t&&!n.napi||n.uv&&n.uv!==h||n.armv&&n.armv!==m||n.libc&&n.libc!==p)}}function ie(e){return e.runtime===`node`&&e.napi}function ae(e){return function(t,n){return t.runtime===n.runtime?t.abi===n.abi?t.specificity===n.specificity?0:t.specificity>n.specificity?-1:1:t.abi?-1:1:t.runtime===e?-1:1}}function oe(){return process.versions&&process.versions.electron||process.env.ELECTRON_RUN_AS_NODE?!0:typeof window<`u`&&window.process&&window.process.type===`renderer`}function se(e){if(e!==`linux`)return!1;let{familySync:t,MUSL:n}=Ep();return t()===n}g.parseTags=ne,g.matchTags=re,g.compareTags=ae,g.parseTuple=b,g.matchTuple=ee,g.compareTuples=te})),Op=i(((e,t)=>{t.exports=Dp()(__dirname)}));if(!(process.env.CBOR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.CBOR_NATIVE_ACCELERATION_DISABLED.toLowerCase()===`true`)){let t;try{t=typeof e==`function`?Op():$c(import.meta.url)(`cbor-extract`),t&&yf(t.extractStrings)}catch{}}var kp=Kc();let Ap,jp,Mp,Np;const Pp={connections:8,keepAliveTimeout:1e4,pipelining:1},Fp={...Pp,allowH2:!1},Ip={...Pp,allowH2:!0},Lp={retryAfter:!0,statusCodes:[500,502,503,504]},Rp={retryAfter:!0,methods:[`PUT`],statusCodes:[429]},zp={retryAfter:!0,methods:[`PUT`],statusCodes:[429,500,502,503,504]};function Bp(e){return e?.dispatcher??Gp()}function Vp(e){return e?.dispatcher??Kp()}function Hp(e){return e?.dispatcher??qp()}function Up(e){return e?.dispatcher??Jp()}function Wp(e,t){return new kp.RetryAgent(new kp.Agent(e),t)}function Gp(){return Ap??=Wp(Fp,Lp),Ap}function Kp(){return jp??=Wp(Ip,Lp),jp}function qp(){return Mp??=Wp(Ip,Rp),Mp}function Jp(){return Np??=Wp(Ip,zp),Np}let Yp=null;async function Xp(){return Yp||=import(`../../_chunks/workflow/src-Cj3P1ChQ.js`).then(e=>n(e.t(),1)).catch(e=>(typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`)&&console.warn(`[workflow] @opentelemetry/api unavailable — world-vercel spans disabled:`,e instanceof Error?e.message:e),null)),Yp}let Zp=null;function Qp(){return typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`)}let $p=!1;function em(e,t){if(!($p||!Qp())){$p=!0;try{let n=globalThis[Symbol.for(`opentelemetry.js.api.1`)],r=e.trace.getTracerProvider(),i=r.getDelegate?.()??r,a=t.startSpan(`workflow.otel.probe.world_vercel`);console.warn(`[workflow:otel-diag] world-vercel`,JSON.stringify({globalRegistrationVersion:n?.version??null,providerCtor:r?.constructor?.name??null,delegateCtor:i?.constructor?.name??null,tracerCtor:t?.constructor?.name??null,probeCtor:a?.constructor?.name??null,probeRecording:a.isRecording()})),a.end()}catch(e){console.warn(`[workflow:otel-diag] world-vercel failed:`,e instanceof Error?e.message:e)}}}async function tm(){return Zp||=Xp().then(e=>{if(!e)return null;let t=e.trace.getTracer(`workflow`);return em(e,t),t}),Zp}async function nm(e,...t){let[n,r]=await Promise.all([tm(),Xp()]),{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}),t}finally{e.end()}})}async function rm(e){let t=await Xp();if(t)return t.SpanKind[e]}async function im(e){let t=await Xp();if(!t)return;let n={};t.propagation.inject(t.context.active(),n);for(let[t,r]of Object.entries(n))e.set(t,r)}function am(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const om=am(`http.request.method`),sm=am(`url.full`),cm=am(`server.address`),lm=am(`server.port`),um=am(`http.response.status_code`),dm=am(`error.type`),fm=am(`workflow.world.parse.format`),pm=am(`peer.service`),mm=am(`rpc.system`),hm=am(`rpc.service`),gm=am(`rpc.method`),_m=am(`workflow.run.id`),vm=am(`step.id`),ym=am(`workflow.stream.name`),bm=am(`workflow.stream.operation`),xm=am(`workflow.stream.start_index`),Sm=()=>Rc(`WORKFLOW_REQUEST_TIMEOUT_MS`,6e4,{integer:!0,min:1}),Cm=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`),wm=[`x-vercel-id`,`x-vercel-error`,`x-vercel-mitigated`];function Tm(e){return wm.flatMap(t=>{let n=e.get(t);return n?[`${t}=${n}`]:[]})}function Em(e){let t=Tm(e);return t.length>0?` (${t.join(`; `)})`:``}function Dm(e,t,n,r){if(!Cm)return;let i=Tm(n.headers),a=i.length>0?`; ${i.join(`; `)}`:``;console.debug(`[workflow:world-vercel:http] ${e} ${t} -> ${n.status} (${r}ms${a})`)}function Om(e,t,n){if(!process.env.DEBUG)return;let r=Array.from(n.entries()).filter(([e])=>e.toLowerCase()!==`authorization`).map(([e,t])=>`-H "${e}: ${t}"`).join(` `);console.error(`Failed to fetch, reproduce with:\ncurl -X ${e} ${r} "${t}"`)}function km(e){if(!e)return;let t=parseInt(e,10);return Number.isNaN(t)?void 0:t}function Am(e,t,n={}){let{retryAfter:r,code:i,url:o,mitigated:d}=n;return e===409?new f(t):e===410?new l(t):e===412?new c(t,{retryAfter:r}):e===425?new s(t,{retryAfter:r}):e===429?jm(e,d)?new a(`${t} (x-vercel-mitigated=challenge)`,{url:o,status:e,code:`TRANSPORT`,retryAfter:r}):new u(t,{retryAfter:r}):new a(t,{url:o,status:e,code:i,retryAfter:r})}function jm(e,t){return e===429&&t===`challenge`}async function Mm(e){return e?.token??process.env.VERCEL_TOKEN??await(0,Gd.getVercelOidcToken)().catch(()=>null)}function Nm(e){try{let t=new URL(e);return{serverAddress:t.hostname,serverPort:t.port?parseInt(t.port,10):t.protocol===`https:`?443:80}}catch{return{}}}function Pm(e){let{method:t,url:n,peerService:r}=e,{serverAddress:i,serverPort:a}=Nm(n);return{...om(t),...sm(n),...i?cm(i):{},...a?lm(a):{},...pm(r),...mm(`http`),...hm(r)}}async function Fm(e){let{method:t,url:n,headers:r,body:i,dispatcher:o,peerService:s=`workflow-server`,timeoutMs:c=Sm(),signal:l,injectTraceContext:u=!0,cacheBust:d=!0,logLabel:f,buildError:p,spanName:m,attributes:h,durationAttribute:g}=e,_=f??n;return nm(m??`http ${t}`,{kind:await rm(`CLIENT`)},async e=>{if(m&&Cm&&e){let t=e.spanContext();console.warn(`[workflow:otel-diag] span-open`,JSON.stringify({spanName:m,traceId:t.traceId,spanId:t.spanId,recording:e.isRecording()}))}e?.setAttributes(Pm({method:t,url:n,peerService:s})),h&&e?.setAttributes(h),u&&await im(r),d&&r.set(`X-Request-Time`,Date.now().toString());let f=c==null?void 0:AbortSignal.timeout(c),v=l&&f?AbortSignal.any([l,f]):l??f,y=Date.now(),b;try{b=await fetch(n,{method:t,headers:r,body:i,signal:v,dispatcher:o})}catch(r){let i=Date.now()-y;if(r instanceof Error&&(r.name===`TimeoutError`||r.name===`AbortError`)){let o=new a(`${t} ${_} timed out after ${i}ms`,{url:n,cause:r});throw e?.setAttributes({...dm(`TIMEOUT`)}),e?.recordException?.(o),o}throw r}let ee=Date.now()-y;if(Dm(t,_,b,ee),e?.setAttributes({...um(b.status)}),g&&e?.setAttributes({[g]:ee}),!b.ok){if(e?.setAttributes({...dm(`HTTP ${b.status}`)}),Om(t,n,r),p){let t=await p(b);throw e?.recordException?.(t),t}let i=await b.text().catch(()=>``),a=Am(b.status,`${t} ${_} -> HTTP ${b.status}: ${b.statusText}${i?` ${i}`:``}${Em(b.headers)}`,{url:n,retryAfter:km(b.headers.get(`Retry-After`))});throw e?.recordException?.(a),a}return b})}const Im=`5.0.0-beta.33`,Lm=new Set([`GET`,`HEAD`]),Rm=new Set([`UND_ERR_REQ_RETRY`,`UND_ERR_SOCKET`,`UND_ERR_CONNECT`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CLOSED`,`ECONNRESET`,`ECONNREFUSED`,`ENOTFOUND`,`EAI_AGAIN`,`EPIPE`]);function zm(e){let t=e;for(let e=0;t!=null&&e<5;e++){if(typeof t==`object`&&`code`in t){let e=t.code;if(typeof e==`string`&&Rm.has(e))return e}t=t?.cause}}const Bm=()=>process.env.VERCEL_WORKFLOW_SERVER_URL||``,Vm=()=>process.env.WORKFLOW_TEST_LIMIT_OVERRIDES?.trim()||``;function Hm(e){return e}const Um=(...e)=>e.filter(Boolean).join(` `),Wm=()=>{let e=process.env.VERCEL_DEPLOYMENT_ID;return e?`@workflow/world-vercel/${Im} node-${process.version} ${Tl.platform()} (${Tl.arch()}) ${e}`:`@workflow/world-vercel/${Im} node-${process.version} ${Tl.platform()} (${Tl.arch()})`},Gm=e=>{let t=e?.projectConfig,n=Bm()||`https://vercel-workflow.com`,r=process.env.WORKFLOW_VERCEL_BACKEND_URL,i=!!(t?.projectId&&t?.teamId);return{baseUrl:i?r||`https://api.vercel.com/v1/workflow`:`${n}/api`,usingProxy:i}},Km=(e,t)=>{let n=e?.projectConfig,r=new Headers(e?.headers);r.set(`User-Agent`,Um(Wm(),r.get(`User-Agent`)));let i=Vm();i&&r.set(`x-workflow-test-limit-overrides`,i),n&&(r.set(`x-vercel-environment`,n.environment||`production`),n.projectId&&r.set(`x-vercel-project-id`,n.projectId),n.teamId&&r.set(`x-vercel-team-id`,n.teamId));let a=Bm();return a&&t.usingProxy&&r.set(`x-vercel-workflow-api-url`,a),r};async function qm(e){let{baseUrl:t,usingProxy:n}=Gm(e),r=Km(e,{usingProxy:n});if(n){if(!e?.token)throw Error(`world-vercel: api-workflow proxy requested (${t}) but no Vercel auth token was provided. Pass one as \`config.token\` (the SDK reads it from \`WORKFLOW_VERCEL_AUTH_TOKEN\`).`);r.set(`Authorization`,`Bearer ${e.token}`)}else{let t;try{t=await(0,Gd.getVercelOidcToken)()}catch{}let n=e?.token??t;n&&r.set(`Authorization`,`Bearer ${n}`),t&&r.set(`x-vercel-trusted-oidc-idp-token`,t)}return{baseUrl:t,headers:r,usingProxy:n}}async function L({endpoint:e,options:t={},config:n={},schema:r,data:i,onResponse:o,retryConnectTimeout:s=!1}){let c=t.method||`GET`,{baseUrl:l,headers:u}=await qm(n),d=`${l}${e}`;return nm(`http ${c}`,{kind:await rm(`CLIENT`)},async l=>{l?.setAttributes(Pm({method:c,url:d,peerService:`workflow-server`})),u.set(`Accept`,`application/cbor`),await im(u);let f;i!==void 0&&(u.set(`Content-Type`,`application/cbor`),f=_p(i));let p=Lm.has(c.toUpperCase()),m,h=``;for(let r=0;;r++){u.set(`X-Request-Time`,Date.now().toString());let i=AbortSignal.timeout(Sm()),g=t.signal?AbortSignal.any([t.signal,i]):i,_=new Request(d,{...t,body:f,headers:u,signal:g}),v=Date.now(),y;try{y=await fetch(_,{dispatcher:Bp(n)})}catch(t){let n=Date.now()-v;if(t instanceof Error&&(t.name===`TimeoutError`||t.name===`AbortError`)){let r=new a(`${c} ${e} timed out after ${n}ms`,{url:d,code:`TIMEOUT`,cause:t});throw l?.setAttributes({...dm(`TIMEOUT`)}),l?.recordException?.(r),r}let i=zm(t);if(i){if(s&&p&&i===`UND_ERR_CONNECT_TIMEOUT`&&r===0){await new Promise(e=>setTimeout(e,100));continue}let o=new a(`${c} ${e} transport failure after ${n}ms (${i})`,{url:d,code:`TRANSPORT`,cause:t});throw l?.setAttributes({...dm(`TRANSPORT`)}),l?.recordException?.(o),o}throw t}let b=Date.now()-v;if(h=Em(y.headers),Dm(c,e,y,b),l?.setAttributes({...um(y.status)}),!y.ok){let t=await Ym(y).then(e=>e.data).catch(()=>({})),n=t.code??t.error;Om(_.method,d,u);let r=km(y.headers.get(`Retry-After`)),i=(t.message||`${_.method} ${e} -> HTTP ${y.status}: ${y.statusText}`)+h,a=Am(y.status,i,{url:d,code:n,retryAfter:r,mitigated:y.headers.get(`x-vercel-mitigated`)});throw l?.setAttributes({...dm(n||`HTTP ${y.status}`)}),l?.recordException?.(a),a}o?.(y);try{m=await nm(`world.parse`,async e=>{let t=await Ym(y),n=(y.headers.get(`Content-Type`)||``).includes(`application/cbor`);return e?.setAttributes({...fm(n?`cbor`:`json`)}),t});break}catch(t){if(p&&r<2){let n=100*2**r;l?.setAttributes({...dm(`PARSE_ERROR_RETRYING`)}),Cm&&console.debug(`[workflow:world-vercel:http] ${c} ${e} body parse failed (attempt ${r+1}/3); retrying in ${n}ms: ${t}`),await new Promise(e=>setTimeout(e,n));continue}let n=y.headers.get(`Content-Type`)||`unknown`;throw new a(`Failed to parse response body for ${c} ${e}${h} (Content-Type: ${n}):\n\n${t}`,{url:d,code:`PARSE_ERROR`,cause:t})}}return await nm(`world.validate`,async()=>{let t=r.safeParse(m.data);if(!t.success){let n=t.error.issues.map(e=>` ${e.path.length>0?e.path.join(`.`):`<root>`}: ${e.message}`).join(`
|
|
5
|
-
`),r=process.env.DEBUG?`\n\nResponse context: ${m.getDebugContext()}`:``;throw new a(`Schema validation failed for ${c} ${e}${h}:\n${n}${r}`,{url:d,code:`SCHEMA_VALIDATION`,cause:t.error})}return t.data})})}function
|
|
6
|
-
--${e}`),this.findPartialTailBoundary=
|
|
7
|
-
--${e}`),this.boundaryLength=4+e.length,this.findDoubleNewline=
|
|
4
|
+
`);function ce(e){var t=_(i.join(e,`prebuilds`)).map(b).filter(ee(f,d)).sort(te)[0];if(t)return le(i.join(e,`prebuilds`,t.name))}function le(e){var t=_(e).map(ne).filter(re(u,l)).sort(ae(u))[0];if(t)return i.join(e,t.file)}};function _(e){try{return r.readdirSync(e)}catch{return[]}}function v(e,t){var n=_(e).filter(t);return n[0]&&i.join(e,n[0])}function y(e){return/\.node$/.test(e)}function b(e){var t=e.split(`-`);if(t.length===2){var n=t[0],r=t[1].split(`+`);if(n&&r.length&&r.every(Boolean))return{name:e,platform:n,architectures:r}}}function ee(e,t){return function(n){return n==null||n.platform!==e?!1:n.architectures.includes(t)}}function te(e,t){return e.architectures.length-t.architectures.length}function ne(e){var t=e.split(`.`),n=t.pop(),r={file:e,specificity:0};if(n===`node`){for(var i=0;i<t.length;i++){var a=t[i];if(a===`node`||a===`electron`||a===`node-webkit`)r.runtime=a;else if(a===`napi`)r.napi=!0;else if(a.slice(0,3)===`abi`)r.abi=a.slice(3);else if(a.slice(0,2)===`uv`)r.uv=a.slice(2);else if(a.slice(0,4)===`armv`)r.armv=a.slice(4);else if(a===`glibc`||a===`musl`)r.libc=a;else continue;r.specificity++}return r}}function re(e,t){return function(n){return!(n==null||n.runtime!==e&&!ie(n)||n.abi!==t&&!n.napi||n.uv&&n.uv!==h||n.armv&&n.armv!==m||n.libc&&n.libc!==p)}}function ie(e){return e.runtime===`node`&&e.napi}function ae(e){return function(t,n){return t.runtime===n.runtime?t.abi===n.abi?t.specificity===n.specificity?0:t.specificity>n.specificity?-1:1:t.abi?-1:1:t.runtime===e?-1:1}}function oe(){return process.versions&&process.versions.electron||process.env.ELECTRON_RUN_AS_NODE?!0:typeof window<`u`&&window.process&&window.process.type===`renderer`}function se(e){if(e!==`linux`)return!1;let{familySync:t,MUSL:n}=Ep();return t()===n}g.parseTags=ne,g.matchTags=re,g.compareTags=ae,g.parseTuple=b,g.matchTuple=ee,g.compareTuples=te})),Op=i(((e,t)=>{t.exports=Dp()(__dirname)}));if(!(process.env.CBOR_NATIVE_ACCELERATION_DISABLED!==void 0&&process.env.CBOR_NATIVE_ACCELERATION_DISABLED.toLowerCase()===`true`)){let t;try{t=typeof e==`function`?Op():$c(import.meta.url)(`cbor-extract`),t&&yf(t.extractStrings)}catch{}}var kp=Kc();let Ap,jp,Mp,Np;const Pp={connections:8,keepAliveTimeout:1e4},Fp={...Pp,allowH2:!1,pipelining:1},Ip={...Pp,allowH2:!0,pipelining:100},Lp={...Pp,allowH2:!0,pipelining:1},Rp={retryAfter:!0,statusCodes:[500,502,503,504]},zp={retryAfter:!0,methods:[`PUT`],statusCodes:[429]},Bp={retryAfter:!0,methods:[`PUT`],statusCodes:[429,500,502,503,504]};function Vp(){return process.env.WORKFLOW_H2_MULTIPLEX!==`0`}function Hp(e){if(!e||typeof e!=`object`||Array.isArray(e))return NaN;let t=e,n=t[`content-length`]??t[`Content-Length`];return typeof n==`string`||typeof n==`number`?Number(n):NaN}function Up(e){return(t,n)=>{let r=t.body,i=!!r&&typeof r!=`string`&&!Buffer.isBuffer(r)&&typeof r[Symbol.asyncIterator]==`function`,a=Hp(t.headers);return!i||!(a>=0)||a>1048576?e({...t,idempotent:!0},n):((async()=>{try{let i=[];for await(let e of r)i.push(Buffer.from(e));e({...t,body:Buffer.concat(i),idempotent:!0},n)}catch(e){n.onError?.(e)}})(),!0)}}function Wp(e){return e?.dispatcher??Qp()}function Gp(e){return e?.dispatcher??$p()}function Kp(e){return e?.dispatcher??em()}function qp(e){return e?.dispatcher??tm()}function Jp(e,t){return new kp.RetryAgent(new kp.Agent(e),t)}function Yp(e){let t=new kp.RetryAgent(new kp.Agent({...Ip,...e}),Rp);return Vp()?Xp(t,t.compose(Up)):t}function Xp(e,t){return new Proxy(t,{get:(t,n)=>n===`close`||n===`destroy`?e[n].bind(e):t[n]})}function Zp(e,t){return new kp.RetryAgent(new kp.Agent({...Lp,...t}),e)}function Qp(){return Ap??=Jp(Fp,Rp),Ap}function $p(){return jp??=Yp(),jp}function em(){return Mp??=Zp(zp),Mp}function tm(){return Np??=Zp(Bp),Np}let nm=null;async function rm(){return nm||=import(`../../_chunks/workflow/src-Cj3P1ChQ.js`).then(e=>n(e.t(),1)).catch(e=>(typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`)&&console.warn(`[workflow] @opentelemetry/api unavailable — world-vercel spans disabled:`,e instanceof Error?e.message:e),null)),nm}let im=null;function am(){return typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`)}let om=!1;function sm(e,t){if(!(om||!am())){om=!0;try{let n=globalThis[Symbol.for(`opentelemetry.js.api.1`)],r=e.trace.getTracerProvider(),i=r.getDelegate?.()??r,a=t.startSpan(`workflow.otel.probe.world_vercel`);console.warn(`[workflow:otel-diag] world-vercel`,JSON.stringify({globalRegistrationVersion:n?.version??null,providerCtor:r?.constructor?.name??null,delegateCtor:i?.constructor?.name??null,tracerCtor:t?.constructor?.name??null,probeCtor:a?.constructor?.name??null,probeRecording:a.isRecording()})),a.end()}catch(e){console.warn(`[workflow:otel-diag] world-vercel failed:`,e instanceof Error?e.message:e)}}}async function cm(){return im||=rm().then(e=>{if(!e)return null;let t=e.trace.getTracer(`workflow`);return sm(e,t),t}),im}async function lm(e,...t){let[n,r]=await Promise.all([cm(),rm()]),{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}),t}finally{e.end()}})}async function um(e){let t=await rm();if(t)return t.SpanKind[e]}async function dm(e){let t=await rm();if(!t)return;let n={};t.propagation.inject(t.context.active(),n);for(let[t,r]of Object.entries(n))e.set(t,r)}function L(...e){return t=>Object.fromEntries(e.map(e=>[e,t]))}const fm=L(`http.request.method`),pm=L(`url.full`),mm=L(`server.address`),hm=L(`server.port`),gm=L(`http.response.status_code`),_m=L(`error.type`),vm=L(`workflow.world.parse.format`),ym=L(`peer.service`),bm=L(`rpc.system`),xm=L(`rpc.service`),Sm=L(`rpc.method`),Cm=L(`workflow.run.id`),wm=L(`step.id`),Tm=L(`workflow.stream.name`),Em=L(`workflow.stream.operation`),Dm=L(`workflow.stream.start_index`),Om=()=>Rc(`WORKFLOW_REQUEST_TIMEOUT_MS`,6e4,{integer:!0,min:1}),km=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`),Am=[`x-vercel-id`,`x-vercel-error`,`x-vercel-mitigated`];function jm(e){return Am.flatMap(t=>{let n=e.get(t);return n?[`${t}=${n}`]:[]})}function Mm(e){let t=jm(e);return t.length>0?` (${t.join(`; `)})`:``}function Nm(e,t,n,r){if(!km)return;let i=jm(n.headers),a=i.length>0?`; ${i.join(`; `)}`:``;console.debug(`[workflow:world-vercel:http] ${e} ${t} -> ${n.status} (${r}ms${a})`)}function Pm(e,t,n){if(!process.env.DEBUG)return;let r=Array.from(n.entries()).filter(([e])=>e.toLowerCase()!==`authorization`).map(([e,t])=>`-H "${e}: ${t}"`).join(` `);console.error(`Failed to fetch, reproduce with:\ncurl -X ${e} ${r} "${t}"`)}function Fm(e){if(!e)return;let t=parseInt(e,10);return Number.isNaN(t)?void 0:t}function Im(e,t,n={}){let{retryAfter:r,code:i,url:o,mitigated:d}=n;return e===409?new f(t):e===410?new l(t):e===412?new c(t,{retryAfter:r}):e===425?new s(t,{retryAfter:r}):e===429?Lm(e,d)?new a(`${t} (x-vercel-mitigated=challenge)`,{url:o,status:e,code:`TRANSPORT`,retryAfter:r}):new u(t,{retryAfter:r}):new a(t,{url:o,status:e,code:i,retryAfter:r})}function Lm(e,t){return e===429&&t===`challenge`}async function Rm(e){return e?.token??process.env.VERCEL_TOKEN??await(0,Gd.getVercelOidcToken)().catch(()=>null)}function zm(e){try{let t=new URL(e);return{serverAddress:t.hostname,serverPort:t.port?parseInt(t.port,10):t.protocol===`https:`?443:80}}catch{return{}}}function Bm(e){let{method:t,url:n,peerService:r}=e,{serverAddress:i,serverPort:a}=zm(n);return{...fm(t),...pm(n),...i?mm(i):{},...a?hm(a):{},...ym(r),...bm(`http`),...xm(r)}}async function Vm(e){let{method:t,url:n,headers:r,body:i,dispatcher:o,peerService:s=`workflow-server`,timeoutMs:c=Om(),signal:l,injectTraceContext:u=!0,cacheBust:d=!0,logLabel:f,buildError:p,spanName:m,attributes:h,durationAttribute:g}=e,_=f??n;return lm(m??`http ${t}`,{kind:await um(`CLIENT`)},async e=>{if(m&&km&&e){let t=e.spanContext();console.warn(`[workflow:otel-diag] span-open`,JSON.stringify({spanName:m,traceId:t.traceId,spanId:t.spanId,recording:e.isRecording()}))}e?.setAttributes(Bm({method:t,url:n,peerService:s})),h&&e?.setAttributes(h),u&&await dm(r),d&&r.set(`X-Request-Time`,Date.now().toString());let f=c==null?void 0:AbortSignal.timeout(c),v=l&&f?AbortSignal.any([l,f]):l??f,y=Date.now(),b;try{b=await fetch(n,{method:t,headers:r,body:i,signal:v,dispatcher:o})}catch(r){let i=Date.now()-y;if(r instanceof Error&&(r.name===`TimeoutError`||r.name===`AbortError`)){let o=new a(`${t} ${_} timed out after ${i}ms`,{url:n,cause:r});throw e?.setAttributes({..._m(`TIMEOUT`)}),e?.recordException?.(o),o}throw r}let ee=Date.now()-y;if(Nm(t,_,b,ee),e?.setAttributes({...gm(b.status)}),g&&e?.setAttributes({[g]:ee}),!b.ok){if(e?.setAttributes({..._m(`HTTP ${b.status}`)}),Pm(t,n,r),p){let t=await p(b);throw e?.recordException?.(t),t}let i=await b.text().catch(()=>``),a=Im(b.status,`${t} ${_} -> HTTP ${b.status}: ${b.statusText}${i?` ${i}`:``}${Mm(b.headers)}`,{url:n,retryAfter:Fm(b.headers.get(`Retry-After`))});throw e?.recordException?.(a),a}return b})}const Hm=`5.0.0-beta.34`,Um=new Set([`GET`,`HEAD`]),Wm=new Set([`UND_ERR_REQ_RETRY`,`UND_ERR_SOCKET`,`UND_ERR_CONNECT`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`UND_ERR_CLOSED`,`ECONNRESET`,`ECONNREFUSED`,`ENOTFOUND`,`EAI_AGAIN`,`EPIPE`]);function Gm(e){let t=e;for(let e=0;t!=null&&e<5;e++){if(typeof t==`object`&&`code`in t){let e=t.code;if(typeof e==`string`&&Wm.has(e))return e}t=t?.cause}}const Km=()=>process.env.VERCEL_WORKFLOW_SERVER_URL||``,qm=()=>process.env.WORKFLOW_TEST_LIMIT_OVERRIDES?.trim()||``;function Jm(e){return e}const Ym=(...e)=>e.filter(Boolean).join(` `),Xm=()=>{let e=process.env.VERCEL_DEPLOYMENT_ID;return e?`@workflow/world-vercel/${Hm} node-${process.version} ${Tl.platform()} (${Tl.arch()}) ${e}`:`@workflow/world-vercel/${Hm} node-${process.version} ${Tl.platform()} (${Tl.arch()})`},Zm=e=>{let t=e?.projectConfig,n=Km()||`https://vercel-workflow.com`,r=process.env.WORKFLOW_VERCEL_BACKEND_URL,i=!!(t?.projectId&&t?.teamId);return{baseUrl:i?r||`https://api.vercel.com/v1/workflow`:`${n}/api`,usingProxy:i}},Qm=(e,t)=>{let n=e?.projectConfig,r=new Headers(e?.headers);r.set(`User-Agent`,Ym(Xm(),r.get(`User-Agent`)));let i=qm();i&&r.set(`x-workflow-test-limit-overrides`,i),n&&(r.set(`x-vercel-environment`,n.environment||`production`),n.projectId&&r.set(`x-vercel-project-id`,n.projectId),n.teamId&&r.set(`x-vercel-team-id`,n.teamId));let a=Km();return a&&t.usingProxy&&r.set(`x-vercel-workflow-api-url`,a),r};async function $m(e){let{baseUrl:t,usingProxy:n}=Zm(e),r=Qm(e,{usingProxy:n});if(n){if(!e?.token)throw Error(`world-vercel: api-workflow proxy requested (${t}) but no Vercel auth token was provided. Pass one as \`config.token\` (the SDK reads it from \`WORKFLOW_VERCEL_AUTH_TOKEN\`).`);r.set(`Authorization`,`Bearer ${e.token}`)}else{let t;try{t=await(0,Gd.getVercelOidcToken)()}catch{}let n=e?.token??t;n&&r.set(`Authorization`,`Bearer ${n}`),t&&r.set(`x-vercel-trusted-oidc-idp-token`,t)}return{baseUrl:t,headers:r,usingProxy:n}}async function R({endpoint:e,options:t={},config:n={},schema:r,data:i,onResponse:o,retryConnectTimeout:s=!1}){let c=t.method||`GET`,{baseUrl:l,headers:u}=await $m(n),d=`${l}${e}`;return lm(`http ${c}`,{kind:await um(`CLIENT`)},async l=>{l?.setAttributes(Bm({method:c,url:d,peerService:`workflow-server`})),u.set(`Accept`,`application/cbor`),await dm(u);let f;i!==void 0&&(u.set(`Content-Type`,`application/cbor`),f=_p(i));let p=Um.has(c.toUpperCase()),m,h=``;for(let r=0;;r++){u.set(`X-Request-Time`,Date.now().toString());let i=AbortSignal.timeout(Om()),g=t.signal?AbortSignal.any([t.signal,i]):i,_=new Request(d,{...t,body:f,headers:u,signal:g}),v=Date.now(),y;try{y=await fetch(_,{dispatcher:Wp(n)})}catch(t){let n=Date.now()-v;if(t instanceof Error&&(t.name===`TimeoutError`||t.name===`AbortError`)){let r=new a(`${c} ${e} timed out after ${n}ms`,{url:d,code:`TIMEOUT`,cause:t});throw l?.setAttributes({..._m(`TIMEOUT`)}),l?.recordException?.(r),r}let i=Gm(t);if(i){if(s&&p&&i===`UND_ERR_CONNECT_TIMEOUT`&&r===0){await new Promise(e=>setTimeout(e,100));continue}let o=new a(`${c} ${e} transport failure after ${n}ms (${i})`,{url:d,code:`TRANSPORT`,cause:t});throw l?.setAttributes({..._m(`TRANSPORT`)}),l?.recordException?.(o),o}throw t}let b=Date.now()-v;if(h=Mm(y.headers),Nm(c,e,y,b),l?.setAttributes({...gm(y.status)}),!y.ok){let t=await th(y).then(e=>e.data).catch(()=>({})),n=t.code??t.error;Pm(_.method,d,u);let r=Fm(y.headers.get(`Retry-After`)),i=(t.message||`${_.method} ${e} -> HTTP ${y.status}: ${y.statusText}`)+h,a=Im(y.status,i,{url:d,code:n,retryAfter:r,mitigated:y.headers.get(`x-vercel-mitigated`)});throw l?.setAttributes({..._m(n||`HTTP ${y.status}`)}),l?.recordException?.(a),a}o?.(y);try{m=await lm(`world.parse`,async e=>{let t=await th(y),n=(y.headers.get(`Content-Type`)||``).includes(`application/cbor`);return e?.setAttributes({...vm(n?`cbor`:`json`)}),t});break}catch(t){if(p&&r<2){let n=100*2**r;l?.setAttributes({..._m(`PARSE_ERROR_RETRYING`)}),km&&console.debug(`[workflow:world-vercel:http] ${c} ${e} body parse failed (attempt ${r+1}/3); retrying in ${n}ms: ${t}`),await new Promise(e=>setTimeout(e,n));continue}let n=y.headers.get(`Content-Type`)||`unknown`;throw new a(`Failed to parse response body for ${c} ${e}${h} (Content-Type: ${n}):\n\n${t}`,{url:d,code:`PARSE_ERROR`,cause:t})}}return await lm(`world.validate`,async()=>{let t=r.safeParse(m.data);if(!t.success){let n=t.error.issues.map(e=>` ${e.path.length>0?e.path.join(`.`):`<root>`}: ${e.message}`).join(`
|
|
5
|
+
`),r=process.env.DEBUG?`\n\nResponse context: ${m.getDebugContext()}`:``;throw new a(`Schema validation failed for ${c} ${e}${h}:\n${n}${r}`,{url:d,code:`SCHEMA_VALIDATION`,cause:t.error})}return t.data})})}function eh(e){let t=Sl(e,{depth:3,maxArrayLength:10,breakLength:120});return t.length>500?`${t.slice(0,500)}...`:t}async function th(e){let t=e.headers.get(`Content-Type`)||``;if(t.includes(`application/cbor`)){let n=await e.arrayBuffer(),r=Wf(new Uint8Array(n));return{data:r,getDebugContext:()=>`Content-Type: ${t}, ${n.byteLength} bytes (CBOR), preview: ${eh(r)}`}}let n=await e.text(),r=JSON.parse(n);return{data:r,getDebugContext:()=>`Content-Type: ${t}, ${n.length} bytes, preview: ${eh(r)}`}}function nh(e,t){t?.limit&&e.set(`limit`,t.limit.toString()),t?.cursor&&e.set(`cursor`,t.cursor),t?.sortOrder&&e.set(`sortOrder`,t.sortOrder)}function rh(e){let t=e.toString();return t?`?${t}`:``}function ih(e,t){t.workflowName&&e.set(`workflowName`,t.workflowName),t.startTime&&t.endTime&&(e.set(`startTime`,t.startTime),e.set(`endTime`,t.endTime)),nh(e,t.pagination)}function ah(e){return{runs:{get(t){return R({endpoint:`/v2/analytics/runs/${encodeURIComponent(t)}`,config:e,schema:Jn})},list(t={}){let n=new URLSearchParams;return t.workflowName&&n.set(`workflowName`,t.workflowName),t.status&&n.set(`status`,t.status),t.startTime&&t.endTime&&(n.set(`startTime`,t.startTime),n.set(`endTime`,t.endTime)),t.attributes&&Object.keys(t.attributes).length>0&&n.set(`attributes`,JSON.stringify(t.attributes)),nh(n,t.pagination),R({endpoint:`/v2/analytics/runs${rh(n)}`,config:e,schema:bs(Jn)})}},attributes:{list(t={}){let n=new URLSearchParams;return ih(n,t),R({endpoint:`/v2/analytics/attributes${rh(n)}`,config:e,schema:bs(xc)})}},steps:{get(t,n){return R({endpoint:`/v2/analytics/runs/${encodeURIComponent(t)}/steps/${encodeURIComponent(n)}`,config:e,schema:_e})},list(t){let n=new URLSearchParams;return nh(n,t.pagination),R({endpoint:`/v2/analytics/runs/${encodeURIComponent(t.runId)}/steps${rh(n)}`,config:e,schema:bs(_e)})}},events:{get(t,n){return R({endpoint:`/v2/analytics/runs/${encodeURIComponent(t)}/events/${encodeURIComponent(n)}`,config:e,schema:Ei})},list(t){let n=new URLSearchParams;return t.eventType&&n.set(`eventType`,t.eventType),t.correlationId&&n.set(`correlationId`,t.correlationId),nh(n,t.pagination),R({endpoint:`/v2/analytics/runs/${encodeURIComponent(t.runId)}/events${rh(n)}`,config:e,schema:bs(Ei)})},listByCorrelationId(t){let n=new URLSearchParams;return n.set(`correlationId`,t.correlationId),nh(n,t.pagination),R({endpoint:`/v2/analytics/events${rh(n)}`,config:e,schema:bs(Ei)})}},hooks:{get(t,n){let r=new URLSearchParams;return n?.runId&&r.set(`runId`,n.runId),R({endpoint:`/v2/analytics/hooks/${encodeURIComponent(t)}${rh(r)}`,config:e,schema:fc})},list(t){let n=new URLSearchParams;return n.set(`runId`,t.runId),nh(n,t.pagination),R({endpoint:`/v2/analytics/hooks${rh(n)}`,config:e,schema:bs(fc)})}},waits:{get(t,n){return R({endpoint:`/v2/analytics/runs/${encodeURIComponent(t)}/waits/${encodeURIComponent(n)}`,config:e,schema:rc})},list(t){let n=new URLSearchParams;return t.status&&n.set(`status`,t.status),nh(n,t.pagination),R({endpoint:`/v2/analytics/runs/${encodeURIComponent(t.runId)}/waits${rh(n)}`,config:e,schema:bs(rc)})}}}}const oh=Io();let sh;function ch(e){let t=Wc(e),n=5,r=1;for(;n>=0&&r>0;){let e=t[n]+r;t[n]=e&255,r=e>>8,n--}if(r>0)throw Error(`ULID space exhausted`);return Hc(t)}function lh(e){return typeof e!=`string`||e===``||e===`unknown`?null:Object.hasOwn(Bc,e)?e:null}function uh(e){return lh(e?.region)??lh(process.env.VERCEL_REGION)??`iad1`}function dh(e){let t=Bc[uh(e)],n=Vc(oh(),t);if(sh!==void 0)for(;n<=sh;)n=Vc(ch(sh),t);return sh=n,n}function fh(e){let t=e.startsWith(`wrun_`)?e.slice(5):e;try{let e=Gc(t);return e.tagged&&e.region?e.region:Uc}catch{return null}}function ph(e){let t=e.runId;return typeof t!=`string`||t.length===0?null:{region:fh(t)}}async function mh(e,t,n){if(e.length!==32)throw Error(`Invalid deployment key length: expected 32 bytes for AES-256, got ${e.length} bytes`);if(!t||typeof t!=`string`)throw Error(`projectId must be a non-empty string`);let r=await yl.subtle.importKey(`raw`,e,`HKDF`,!1,[`deriveBits`]),i=new TextEncoder().encode(`${t}|${n}`),a=await yl.subtle.deriveBits({name:`HKDF`,hash:`SHA-256`,salt:new Uint8Array(32),info:i},r,256);return new Uint8Array(a)}async function hh(e,t,n,r){let i=await Rm({token:r?.token});if(!i)throw Error(`Cannot fetch run key: no OIDC token or VERCEL_TOKEN available`);let a=new URLSearchParams({projectId:t,runId:n});r?.teamId&&a.set(`teamId`,r.teamId);let o=await(await Vm({method:`GET`,url:`https://api.vercel.com/v1/workflow/run-key/${e}?${a}`,headers:new Headers({Authorization:`Bearer ${i}`}),dispatcher:Wp({dispatcher:r?.dispatcher}),peerService:`vercel-api`,timeoutMs:null,buildError:async t=>{let r;try{r=await t.text()}catch{r=`<unable to read response body>`}return Error(`Failed to fetch run key for ${n} (deployment ${e}): HTTP ${t.status} ${t.statusText}${r?` — ${r}`:``}`)}})).json(),s=ec({key:Za().nullable()}).safeParse(o);if(!s.success)throw Error(`Invalid response from Vercel API: expected { key: string | null }. Zod error: ${s.error.message}`);if(s.data.key!==null)return Buffer.from(s.data.key,`base64`)}function gh(e,t,n,r){if(!e)return;let i=process.env.VERCEL===`1`,a;function o(){if(a)return a;let e=process.env.VERCEL_DEPLOYMENT_KEY;if(e)return a=Buffer.from(e,`base64`),a}return async function(a,s){let c=typeof a==`string`?a:a.runId,l=typeof a==`string`?s?.deploymentId:a.deploymentId;if(i&&(!l||l===process.env.VERCEL_DEPLOYMENT_ID)){let t=o();return t?mh(t,e,c):void 0}if(l)return hh(l,e,c,{token:n,teamId:t,dispatcher:r})}}const _h={peerService:`workflow-server`,rpcSystem:`http`,rpcService:`workflow-server`},vh={"world.runs.get":0,"world.runs.experimentalSetAttributes":0,"world.steps.get":0,"world.events.create":0,"world.events.get":0},yh=new Set([`world.steps.list`,`world.events.list`,`world.hooks.list`]);function bh(e){if(e.length>=2&&typeof e[1]==`object`&&e[1]!==null){let t=e[1];if(typeof t.eventType==`string`)return t.eventType}}function xh(e,t){return typeof e[t]==`string`?e[t]:void 0}function Sh(e){if(typeof e!=`object`||!e)return;let t=e.runId;return typeof t==`string`?t:void 0}function Ch(e){if(typeof e!=`object`||!e)return;let t=e;if(typeof t.runId==`string`)return t.runId;for(let e of[`run`,`step`,`hook`,`wait`]){let n=t[e];if(typeof n==`object`&&n){let e=n.runId;if(typeof e==`string`)return e}}}function wh(e,t,n){let r=`${e}.${t}`,i={},a=vh[r],o=a===void 0?yh.has(r)?Sh(n[0]):void 0:xh(n,a);if(o&&Object.assign(i,Cm(o)),r===`world.steps.get`){let e=xh(n,1);e&&Object.assign(i,wm(e))}return i}function Th(e,t){let n={};for(let r of Object.keys(t))if(typeof t[r]!=`function`)n[r]=t[r];else{let i=t[r],a=String(r);n[r]=async(...t)=>{let n=`${e}.${a}`;if(e===`world.events`&&a===`create`){let r=bh(t);r&&(n=`${e}.${a} ${r}`)}return lm(n,{kind:await um(`CLIENT`)},async r=>{r?.setAttributes({...ym(_h.peerService),...bm(_h.rpcSystem),...xm(_h.rpcService),...Sm(n),...wh(e,a,t)});let o=await i(...t),s=Ch(o);return s&&r?.setAttributes(Cm(s)),o})}}return n}var z=class extends Error{constructor(e){super(e),this.name=`MultipartParseError`}};function Eh(e){let t=new TextEncoder().encode(e);return(e,n=0)=>Buffer.prototype.indexOf.call(e,t,n)}function Dh(e){let t=new TextEncoder().encode(e),n={};for(let e=0;e<t.length;++e){let r=t[e];n[r]===void 0&&(n[r]=[]),n[r].push(e)}return function(e){let r=e.length-1;if(e[r]in n){let i=n[e[r]];for(let n=i.length-1;n>=0;--n)for(let a=i[n],o=r;a>=0&&e[o]===t[a];--a,--o)if(a===0)return o}return-1}}function Oh(e){let t=new TextDecoder(`iso-8859-1`).decode(e).trim().split(/\r?\n/),n=[];for(let e of t){let t=e.indexOf(`:`);if(t>0){let r=e.slice(0,t).trim(),i=e.slice(t+1).trim();n.push([r,i])}}return new Headers(n)}function kh(e){let t=e.match(/boundary=(?:"([^"]+)"|([^;]+))/i);if(!t)throw new z(`No boundary found in Content-Type header`);return t[1]??t[2]}var Ah=class{queue=[];waiters=[];finished=!1;cancelled=!1;error=null;enqueue(e){this.finished||this.cancelled||(this.waiters.length>0?this.waiters.shift().resolve(e):this.queue.push(e))}finish(e){if(!this.finished)for(this.finished=!0,this.error=e||null;this.waiters.length>0;){let t=this.waiters.shift();e?t.reject(e):t.resolve(null)}}cancel(){if(!(this.cancelled||this.finished))for(this.cancelled=!0;this.waiters.length>0;)this.waiters.shift().resolve(null)}async dequeue(){if(this.queue.length>0)return this.queue.shift();if(this.finished||this.cancelled){if(this.error)throw this.error;return null}return new Promise((e,t)=>{this.waiters.push({resolve:e,reject:t})})}get isTerminal(){return this.finished||this.cancelled}};async function*jh(e,t){if(!e.body)throw new z(`Response body is null`);let n=e.headers.get(`content-type`);if(!n)throw new z(`Missing Content-Type header`);yield*new Mh(kh(n),t).parseStream(e.body)}var Mh=class{boundary;findOpeningBoundary;openingBoundaryLength;findBoundary;findPartialTailBoundary;boundaryLength;findDoubleNewline;maxHeaderSize;maxBoundaryBuffer;state=0;buffer=null;currentHeaders=new Headers;currentPayloadController=null;constructor(e,t={}){this.boundary=e,this.findOpeningBoundary=Eh(`--${e}`),this.openingBoundaryLength=2+e.length,this.findBoundary=Eh(`\r
|
|
6
|
+
--${e}`),this.findPartialTailBoundary=Dh(`\r
|
|
7
|
+
--${e}`),this.boundaryLength=4+e.length,this.findDoubleNewline=Eh(`\r
|
|
8
8
|
\r
|
|
9
|
-
`),this.maxHeaderSize=t.maxHeaderSize??65536,this.maxBoundaryBuffer=t.maxBoundaryBuffer??8192}async*parseStream(e){let t=e.getReader(),n=new
|
|
9
|
+
`),this.maxHeaderSize=t.maxHeaderSize??65536,this.maxBoundaryBuffer=t.maxBoundaryBuffer??8192}async*parseStream(e){let t=e.getReader(),n=new Ah,r=this.startProducer(t,n);try{yield*this.consumeMessages(n)}finally{n.cancel(),this.closeCurrentPayload();try{await t.cancel()}catch{}await r}}async startProducer(e,t){try{for(;!t.isTerminal;){let n;try{n=await e.read()}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.constructor.name===`AbortError`||e.name===`TimeoutError`||e.constructor.name===`TimeoutError`))break;throw e}let{done:r,value:i}=n;if(r){if(this.buffer!==null&&this.buffer.length>0){let e=this.write(new Uint8Array);for(let n of e){if(t.isTerminal)break;t.enqueue(n)}}if(this.state!==4)throw this.state===0?new z(`Invalid multipart stream: missing initial boundary`):new z(`Unexpected end of stream`);break}if(!(i instanceof Uint8Array))throw new z(`Invalid chunk type: expected Uint8Array, got ${typeof i}`);let a=this.write(i);for(let e of a){if(t.isTerminal)break;t.enqueue(e)}}t.isTerminal||t.finish()}catch(e){this.closeCurrentPayload(e),t.isTerminal||t.finish(e)}finally{try{e.releaseLock()}catch{}}}async*consumeMessages(e){for(;;){let t=await e.dequeue();if(t===null)break;yield t}}write(e){let t=[];if(this.state===4)throw new z(`Unexpected data after end of stream`);let n=0,r=e.length;if(this.buffer!==null){let t=this.buffer.length,n=t+r;if(this.state===2){if(n>this.maxHeaderSize)throw new z(`Buffer size limit exceeded: ${n} bytes > ${this.maxHeaderSize} bytes. This may indicate malformed multipart data with oversized headers.`)}else if(t>this.maxBoundaryBuffer)throw new z(`Boundary buffer limit exceeded: ${t} bytes > ${this.maxBoundaryBuffer} bytes. This may indicate malformed multipart data with invalid boundaries.`);let i=new Uint8Array(n);i.set(this.buffer,0),i.set(e,t),e=i,r=e.length,this.buffer=null}if(r===0&&this.state===0)throw new z(`Invalid multipart stream: missing initial boundary`);for(;;){if(this.state===3){if(r-n<this.boundaryLength){let t=e.subarray(n);if(t.length>this.maxBoundaryBuffer)throw new z(`Boundary buffer limit exceeded: ${t.length} > ${this.maxBoundaryBuffer}`);this.buffer=t;break}let t=this.findBoundary(e,n);if(t===-1){let t=this.findPartialTailBoundary(e);if(t===-1)this.writeBody(n===0?e:e.subarray(n));else{this.writeBody(e.subarray(n,t));let r=e.subarray(t);if(r.length>this.maxBoundaryBuffer)throw new z(`Partial boundary too large: ${r.length} > ${this.maxBoundaryBuffer}`);this.buffer=r}break}this.writeBody(e.subarray(n,t)),this.finishMessage(),n=t+this.boundaryLength,this.state=1}if(this.state===1){if(r-n<2){let t=e.subarray(n);if(t.length>this.maxBoundaryBuffer)throw new z(`After-boundary buffer limit exceeded: ${t.length} > ${this.maxBoundaryBuffer}`);this.buffer=t;break}if(e[n]===45&&e[n+1]===45){this.state=4;break}if(e[n]===13&&e[n+1]===10)n+=2;else if(e[n]===10)n+=1;else throw new z(`Invalid character after boundary: expected CRLF or LF, got 0x${e[n].toString(16)}`);this.state=2}if(this.state===2){if(r-n<4){let t=e.subarray(n);if(t.length>this.maxHeaderSize)throw new z(`Header buffer limit exceeded: ${t.length} > ${this.maxHeaderSize}`);this.buffer=t;break}let i=this.findDoubleNewline(e,n),a=4;if(i===-1&&(i=Eh(`
|
|
10
10
|
|
|
11
|
-
`)(e,n),a=2),i===-1){let t=e.subarray(n);if(t.length>this.maxHeaderSize)throw new R(`Headers too large: ${t.length} > ${this.maxHeaderSize} bytes`);this.buffer=t;break}let o=e.subarray(n,i);this.currentHeaders=Sh(o);let s=this.createStreamingMessage();t.push(s),n=i+a,this.state=3;continue}if(this.state===0){if(r<this.openingBoundaryLength){if(e.length>this.maxBoundaryBuffer)throw new R(`Initial chunk too large for boundary detection: ${e.length} > ${this.maxBoundaryBuffer}`);this.buffer=e;break}if(this.findOpeningBoundary(e)!==0)throw new R(`Invalid multipart stream: missing initial boundary`);n=this.openingBoundaryLength,this.state=1}}return t}createStreamingMessage(){let e=new Headers(this.currentHeaders),t=new ReadableStream({start:e=>{this.currentPayloadController=e}});return this.currentHeaders=new Headers,{headers:e,payload:t}}writeBody(e){this.currentPayloadController&&this.currentPayloadController.enqueue(e)}finishMessage(){this.currentPayloadController&&=(this.currentPayloadController.close(),null)}closeCurrentPayload(e){if(this.currentPayloadController){try{e?this.currentPayloadController.error(e):this.currentPayloadController.close()}catch{}this.currentPayloadController=null}}};const Dh=(e,t,n)=>{let r=e instanceof RegExp?Oh(e,n):e,i=t instanceof RegExp?Oh(t,n):t,a=r!==null&&i!=null&&kh(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},Oh=(e,t)=>{let n=t.match(e);return n?n[0]:null},kh=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},Ah=`\0SLASH`+Math.random()+`\0`,jh=`\0OPEN`+Math.random()+`\0`,Mh=`\0CLOSE`+Math.random()+`\0`,Nh=`\0COMMA`+Math.random()+`\0`,Ph=`\0PERIOD`+Math.random()+`\0`,Fh=new RegExp(Ah,`g`),Ih=new RegExp(jh,`g`),Lh=new RegExp(Mh,`g`),Rh=new RegExp(Nh,`g`),zh=new RegExp(Ph,`g`),Bh=/\\\\/g,Vh=/\\{/g,Hh=/\\}/g,Uh=/\\,/g,Wh=/\\\./g;function Gh(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function Kh(e){return e.replace(Bh,Ah).replace(Vh,jh).replace(Hh,Mh).replace(Uh,Nh).replace(Wh,Ph)}function qh(e){return e.replace(Fh,`\\`).replace(Ih,`{`).replace(Lh,`}`).replace(Rh,`,`).replace(zh,`.`)}function Jh(e){if(!e)return[``];let t=[],n=Dh(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=Jh(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function Yh(e,t={}){if(!e)return[];let{max:n=1e5}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),eg(Kh(e),n,!0).map(qh)}function Xh(e){return`{`+e+`}`}function Zh(e){return/^-?0\d/.test(e)}function Qh(e,t){return e<=t}function $h(e,t){return e>=t}function eg(e,t,n){let r=[];for(;;){let i=Dh(`{`,`}`,e);if(!i)return[e];let a=i.pre;if(/\$$/.test(i.pre)){let e=i.post.length?eg(i.post,t,!1):[``];for(let n=0;n<e.length&&n<t;n++){let t=a+`{`+i.body+`}`+e[n];r.push(t)}return r}let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),s=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=o||s,l=i.body.indexOf(`,`)>=0;if(!c&&!l){if(i.post.match(/,(?!,).*\}/)){e=i.pre+`{`+i.body+Mh+i.post,n=!0;continue}return[e]}let u=i.post.length?eg(i.post,t,!1):[``],d;if(c)d=i.body.split(/\.\./);else if(d=Jh(i.body),d.length===1&&d[0]!==void 0&&(d=eg(d[0],t,!1).map(Xh),d.length===1))return u.map(e=>i.pre+d[0]+e);let f;if(c&&d[0]!==void 0&&d[1]!==void 0){let e=Gh(d[0]),n=Gh(d[1]),r=Math.max(d[0].length,d[1].length),i=d.length===3&&d[2]!==void 0?Math.max(Math.abs(Gh(d[2])),1):1,a=Qh;n<e&&(i*=-1,a=$h);let o=d.some(Zh);f=[];for(let c=e;a(c,n)&&f.length<t;c+=i){let e;if(s)e=String.fromCharCode(c),e===`\\`&&(e=``);else if(e=String(c),o){let t=r-e.length;if(t>0){let n=Array(t+1).join(`0`);e=c<0?`-`+n+e.slice(1):n+e}}f.push(e)}}else{f=[];for(let e=0;e<d.length;e++)f.push.apply(f,eg(d[e],t,!1))}for(let e=0;e<f.length;e++)for(let i=0;i<u.length&&r.length<t;i++){let t=a+f[e]+u[i];(!n||c||t)&&r.push(t)}return r}}const tg=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},ng={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},rg=e=>e.replace(/[[\]\\-]/g,`\\$&`),ig=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),ag=e=>e.join(``),og=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(ng))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(rg(d)+`-`+rg(t)):t===d&&r.push(rg(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(rg(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(rg(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let e=r[0].length===2?r[0].slice(-1):r[0];return[ig(e),!1,u-n,!1]}let f=`[`+(l?`^`:``)+ag(r)+`]`,p=`[`+(l?``:`^`)+ag(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},sg=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\])\]/g,`$1$2`).replace(/\\([^/])/g,`$1`):t?e.replace(/\[([^/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,`$1$2`).replace(/\\([^/{}])/g,`$1`);var cg;const lg=new Set([`!`,`?`,`+`,`*`,`@`]),ug=e=>lg.has(e),dg=e=>ug(e.type),fg=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),pg=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),mg=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),hg=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),gg=`(?!\\.)`,_g=new Set([`[`,`.`]),vg=new Set([`..`,`.`]),yg=new Set(`().*{}+?[]^$\\!`),bg=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),xg=`[^/]+?`;let Sg=0;var Cg=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Sg;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof cg&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof cg&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new cg(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&ug(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new cg(n,t);u=cg.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new cg(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&ug(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new cg(n,d);d.push(o),u=cg.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new cg(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,pg)}#m(e,t=fg){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=mg){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new cg(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!hg.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=hg.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new cg(null,void 0,t);return cg.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!dg(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?cg.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&vg.has(this.#r[0]))){let n=_g,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?`(?!(?:^|/)\\.\\.?(?:$|/))`:o?gg:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,sg(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,sg(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?gg:``)+xg;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?gg:``)+`[^/]*?)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,sg(i),this.#t=!!this.#t,this.#n]}#x(){if(dg(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(yg.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?xg:`[^/]*?`,t=!0;continue}else o=!1;if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=og(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=`[^/]`,t=!0;continue}i+=bg(c)}return[i,sg(e),!!t,a]}};cg=Cg;const wg=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),z=(e,t,n={})=>(tg(t),!n.nocomment&&t.charAt(0)===`#`?!1:new Zg(t,n).match(e)),Tg=/^\*+([^+@!?*[(]*)$/,Eg=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Dg=e=>t=>t.endsWith(e),Og=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),kg=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Ag=/^\*+\.\*+$/,jg=e=>!e.startsWith(`.`)&&e.includes(`.`),Mg=e=>e!==`.`&&e!==`..`&&e.includes(`.`),Ng=/^\.\*+$/,Pg=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),Fg=/^\*+$/,Ig=e=>e.length!==0&&!e.startsWith(`.`),Lg=e=>e.length!==0&&e!==`.`&&e!==`..`,Rg=/^\?+([^+@!?*[(]*)?$/,zg=([e,t=``])=>{let n=Ug([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Bg=([e,t=``])=>{let n=Wg([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Vg=([e,t=``])=>{let n=Wg([e]);return t?e=>n(e)&&e.endsWith(t):n},Hg=([e,t=``])=>{let n=Ug([e]);return t?e=>n(e)&&e.endsWith(t):n},Ug=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},Wg=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},Gg=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,Kg={win32:{sep:`\\`},posix:{sep:`/`}};z.sep=Gg===`win32`?Kg.win32.sep:Kg.posix.sep;const B=Symbol(`globstar **`);z.GLOBSTAR=B,z.filter=(e,t={})=>n=>z(n,e,t);const qg=(e,t={})=>Object.assign({},e,t);z.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return z;let t=z;return Object.assign((n,r,i={})=>t(n,r,qg(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,qg(e,n))}static defaults(n){return t.defaults(qg(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,qg(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,qg(e,r))}},unescape:(n,r={})=>t.unescape(n,qg(e,r)),escape:(n,r={})=>t.escape(n,qg(e,r)),filter:(n,r={})=>t.filter(n,qg(e,r)),defaults:n=>t.defaults(qg(e,n)),makeRe:(n,r={})=>t.makeRe(n,qg(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,qg(e,r)),match:(n,r,i={})=>t.match(n,r,qg(e,i)),sep:t.sep,GLOBSTAR:B})};const Jg=(e,t={})=>(tg(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:Yh(e,{max:t.braceExpandMax}));z.braceExpand=Jg,z.makeRe=(e,t={})=>new Zg(e,t).makeRe(),z.match=(e,t,n={})=>{let r=new Zg(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};const Yg=/[?*]|[+@!]\(.*?\)|\[|\]/,Xg=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var Zg=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){tg(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Gg,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!Yg.test(e[2]))&&!Yg.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t of e)for(let e=0;e<t.length;e++)t[e]===`**`&&(t[e]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes(B)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf(B,i),o=t.lastIndexOf(B),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===B?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===B)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return Jg(this.pattern,this.options)}parse(e){tg(e);let t=this.options;if(e===`**`)return B;if(e===``)return``;let n,r=null;(n=e.match(Fg))?r=t.dot?Lg:Ig:(n=e.match(Tg))?r=(t.nocase?t.dot?kg:Og:t.dot?Dg:Eg)(n[1]):(n=e.match(Rg))?r=(t.nocase?t.dot?Bg:zg:t.dot?Vg:Hg)(n):(n=e.match(Ag))?r=t.dot?Mg:jg:(n=e.match(Ng))&&(r=Pg);let i=Cg.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?`[^/]*?`:t.dot?`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`:`(?:(?!(?:\\/|^)\\.).)*?`,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?Xg(e):e===B?B:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==B||a===B||(a===void 0?i!==void 0&&i!==B?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==B&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=B))});let i=t.filter(e=>e!==B);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e of i){let i=r;if(n.matchBase&&e.length===1&&(i=[a]),this.matchOne(i,e,t))return n.flipNegate?!0:!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return z.defaults(e).Minimatch}};z.AST=Cg,z.Minimatch=Zg,z.escape=wg,z.unescape=sg;var Qg=i(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),$g=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{version:()=>u}),t.exports=c(l);let u=`3.8.0`;0&&(t.exports={version:u})})),e_=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{exchangeVercelOidcToken:()=>p}),t.exports=c(l);var u=$g();let d=new class{constructor(e){this.maxEntries=e,this.entries=new Map}get(e){let t=this.entries.get(e);if(t!==void 0){if(t.expiresAt<=Date.now()){this.entries.delete(e);return}return this.entries.delete(e),this.entries.set(e,t),t.token}}set({key:e,token:t,expiresAt:n}){for(this.entries.delete(e),this.entries.set(e,{token:t,expiresAt:n});this.entries.size>this.maxEntries;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}}(1e3);async function f(e){let t=JSON.stringify([e.token,e.audience,e.jti]),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function p(e){let t=await f(e);if(!e.skipCache){let e=d.get(t);if(e!==void 0)return e}let n=await fetch(`https://oidc.vercel.com/~token`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,"User-Agent":`@vercel/oidc@${u.version}`},body:JSON.stringify({token:e.token,aud:e.audience,...e.jti?{jti:e.jti}:void 0})});if(!n.ok)throw Error(`Failed to exchange token: ${await m(n)}`);let r;try{r=await n.json()}catch{throw Error(`Failed to exchange token: response was not valid JSON`)}if(!r||typeof r!=`object`||!(`token`in r)||typeof r.token!=`string`)throw Error(`Failed to exchange token: response did not contain a token`);let{token:i}=r,a=`expiry`in r&&typeof r.expiry==`number`?r.expiry:void 0;if(a!==void 0){let e=a*1e3;e>Date.now()&&d.set({key:t,token:i,expiresAt:e})}return i}async function m(e){try{let t=await e.json();if(t&&typeof t==`object`&&`error`in t&&typeof t.error==`string`)return t.error}catch{}return e.statusText||`HTTP ${e.status}`}0&&(t.exports={exchangeVercelOidcToken:p})})),t_=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),n_=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getVercelOidcTokenSync:()=>d}),t.exports=c(l);var u=t_();function d(){let e=(0,u.getContext)().headers?.[`x-vercel-oidc-token`]??process.env.VERCEL_OIDC_TOKEN;if(!e)throw Error(`The 'x-vercel-oidc-token' header is missing from the request.`);return e}0&&(t.exports={getVercelOidcTokenSync:d})})),r_=i(((e,t)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{getVercelOidcToken:()=>m}),t.exports=l(u);var d=e_(),f=n_(),p=Xc();async function m(e){let t=``,r;try{t=(0,f.getVercelOidcTokenSync)()}catch(e){r=e}try{let[{getTokenPayload:r,isExpired:i},{refreshToken:a}]=await Promise.all([await import(`../../_chunks/workflow/token-util-DURSL1l8.js`).then(e=>n(e.t())),await import(`../../_chunks/workflow/token-hiUWkDKe.js`).then(e=>n(e.default))]);(!t||i(r(t),e?.expirationBufferMs))&&(await a(e),t=(0,f.getVercelOidcTokenSync)())}catch(e){let t=r instanceof Error?r.message:``;throw e instanceof Error&&(t=`${t}
|
|
12
|
-
${e.message}`),t?new p.VercelOidcTokenError(t):e}return e?.audience&&(t=await(0,d.exchangeVercelOidcToken)({token:t,audience:e.audience,jti:e.jti,skipCache:e.skipCache})),t}0&&(t.exports={getVercelOidcToken:m})})),i_,a_=t((()=>{i_=(e,t)=>ol(e).update(t).digest()}));function o_(...e){let t=e.reduce((e,{length:t})=>e+t,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function s_(e,t){return o_(V.encode(e),new Uint8Array([0]),t)}function c_(e,t,n){if(t<0||t>=m_)throw RangeError(`value must be >= 0 and <= ${m_-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,t&255],n)}function l_(e){let t=Math.floor(e/m_),n=e%m_,r=new Uint8Array(8);return c_(r,t,0),c_(r,n,4),r}function u_(e){let t=new Uint8Array(4);return c_(t,e),t}function d_(e){return o_(u_(e.length),e)}async function f_(e,t,n){let r=Math.ceil((t>>3)/32),i=new Uint8Array(r*32);for(let t=0;t<r;t++){let r=new Uint8Array(4+e.length+n.length);r.set(u_(t+1)),r.set(e,4),r.set(n,4+e.length),i.set(await i_(`sha256`,r),t*32)}return i.slice(0,t>>3)}var V,p_,m_,H=t((()=>{a_(),V=new TextEncoder,p_=new TextDecoder,m_=2**32}));function h_(e){let t=e;return t instanceof Uint8Array&&(t=p_.decode(t)),t}var U,W,g_=t((()=>{H(),U=e=>Ol.from(e).toString(`base64url`),W=e=>new Uint8Array(Ol.from(h_(e),`base64url`))})),__=r({JOSEAlgNotAllowed:()=>b_,JOSEError:()=>G,JOSENotSupported:()=>K,JWEDecryptionFailed:()=>x_,JWEInvalid:()=>q,JWKInvalid:()=>C_,JWKSInvalid:()=>w_,JWKSMultipleMatchingKeys:()=>E_,JWKSNoMatchingKey:()=>T_,JWKSTimeout:()=>D_,JWSInvalid:()=>J,JWSSignatureVerificationFailed:()=>O_,JWTClaimValidationFailed:()=>v_,JWTExpired:()=>y_,JWTInvalid:()=>S_}),G,v_,y_,b_,K,x_,q,J,S_,C_,w_,T_,E_,D_,O_,Y=t((()=>{G=class extends Error{static code=`ERR_JOSE_GENERIC`;code=`ERR_JOSE_GENERIC`;constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},v_=class extends G{static code=`ERR_JWT_CLAIM_VALIDATION_FAILED`;code=`ERR_JWT_CLAIM_VALIDATION_FAILED`;claim;reason;payload;constructor(e,t,n=`unspecified`,r=`unspecified`){super(e,{cause:{claim:n,reason:r,payload:t}}),this.claim=n,this.reason=r,this.payload=t}},y_=class extends G{static code=`ERR_JWT_EXPIRED`;code=`ERR_JWT_EXPIRED`;claim;reason;payload;constructor(e,t,n=`unspecified`,r=`unspecified`){super(e,{cause:{claim:n,reason:r,payload:t}}),this.claim=n,this.reason=r,this.payload=t}},b_=class extends G{static code=`ERR_JOSE_ALG_NOT_ALLOWED`;code=`ERR_JOSE_ALG_NOT_ALLOWED`},K=class extends G{static code=`ERR_JOSE_NOT_SUPPORTED`;code=`ERR_JOSE_NOT_SUPPORTED`},x_=class extends G{static code=`ERR_JWE_DECRYPTION_FAILED`;code=`ERR_JWE_DECRYPTION_FAILED`;constructor(e=`decryption operation failed`,t){super(e,t)}},q=class extends G{static code=`ERR_JWE_INVALID`;code=`ERR_JWE_INVALID`},J=class extends G{static code=`ERR_JWS_INVALID`;code=`ERR_JWS_INVALID`},S_=class extends G{static code=`ERR_JWT_INVALID`;code=`ERR_JWT_INVALID`},C_=class extends G{static code=`ERR_JWK_INVALID`;code=`ERR_JWK_INVALID`},w_=class extends G{static code=`ERR_JWKS_INVALID`;code=`ERR_JWKS_INVALID`},T_=class extends G{static code=`ERR_JWKS_NO_MATCHING_KEY`;code=`ERR_JWKS_NO_MATCHING_KEY`;constructor(e=`no applicable key found in the JSON Web Key Set`,t){super(e,t)}},E_=class extends G{[Symbol.asyncIterator];static code=`ERR_JWKS_MULTIPLE_MATCHING_KEYS`;code=`ERR_JWKS_MULTIPLE_MATCHING_KEYS`;constructor(e=`multiple matching keys found in the JSON Web Key Set`,t){super(e,t)}},D_=class extends G{static code=`ERR_JWKS_TIMEOUT`;code=`ERR_JWKS_TIMEOUT`;constructor(e=`request timed out`,t){super(e,t)}},O_=class extends G{static code=`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`;code=`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`;constructor(e=`signature verification failed`,t){super(e,t)}}})),k_=t((()=>{}));function A_(e){switch(e){case`A128GCM`:case`A128GCMKW`:case`A192GCM`:case`A192GCMKW`:case`A256GCM`:case`A256GCMKW`:return 96;case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return 128;default:throw new K(`Unsupported JWE Algorithm: ${e}`)}}var j_,M_=t((()=>{Y(),k_(),j_=e=>_l(new Uint8Array(A_(e)>>3))})),N_,P_=t((()=>{Y(),M_(),N_=(e,t)=>{if(t.length<<3!==A_(e))throw new q(`Invalid Initialization Vector length`)}})),F_,I_=t((()=>{F_=e=>bl.types.isKeyObject(e)})),L_,R_=t((()=>{Y(),I_(),L_=(e,t)=>{let n;switch(e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:n=parseInt(e.slice(-3),10);break;case`A128GCM`:case`A192GCM`:case`A256GCM`:n=parseInt(e.slice(1,4),10);break;default:throw new K(`Content Encryption Algorithm ${e} is not supported either by JOSE or your javascript runtime`)}if(t instanceof Uint8Array){let e=t.byteLength<<3;if(e!==n)throw new q(`Invalid Content Encryption Key length. Expected ${n} bits, got ${e} bits`);return}if(F_(t)&&t.type===`secret`){let e=t.symmetricKeySize<<3;if(e!==n)throw new q(`Invalid Content Encryption Key length. Expected ${n} bits, got ${e} bits`);return}throw TypeError(`Invalid Content Encryption Key type`)}})),z_,B_=t((()=>{z_=vl}));function V_(e,t,n,r,i,a){let o=o_(e,t,n,l_(e.length<<3)),s=sl(`sha${r}`,i);return s.update(o),s.digest().slice(0,a>>3)}var H_=t((()=>{H()})),U_,W_,G_=t((()=>{U_=tl.webcrypto,W_=e=>bl.types.isCryptoKey(e)}));function X(e,t=`algorithm.name`){return TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function K_(e,t){return e.name===t}function q_(e){return parseInt(e.name.slice(4),10)}function J_(e){switch(e){case`ES256`:return`P-256`;case`ES384`:return`P-384`;case`ES512`:return`P-521`;default:throw Error(`unreachable`)}}function Y_(e,t){if(t.length&&!t.some(t=>e.usages.includes(t))){let e=`CryptoKey does not support this operation, its usages must include `;if(t.length>2){let n=t.pop();e+=`one of ${t.join(`, `)}, or ${n}.`}else t.length===2?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw TypeError(e)}}function X_(e,t,...n){switch(t){case`HS256`:case`HS384`:case`HS512`:{if(!K_(e.algorithm,`HMAC`))throw X(`HMAC`);let n=parseInt(t.slice(2),10);if(q_(e.algorithm.hash)!==n)throw X(`SHA-${n}`,`algorithm.hash`);break}case`RS256`:case`RS384`:case`RS512`:{if(!K_(e.algorithm,`RSASSA-PKCS1-v1_5`))throw X(`RSASSA-PKCS1-v1_5`);let n=parseInt(t.slice(2),10);if(q_(e.algorithm.hash)!==n)throw X(`SHA-${n}`,`algorithm.hash`);break}case`PS256`:case`PS384`:case`PS512`:{if(!K_(e.algorithm,`RSA-PSS`))throw X(`RSA-PSS`);let n=parseInt(t.slice(2),10);if(q_(e.algorithm.hash)!==n)throw X(`SHA-${n}`,`algorithm.hash`);break}case`EdDSA`:if(e.algorithm.name!==`Ed25519`&&e.algorithm.name!==`Ed448`)throw X(`Ed25519 or Ed448`);break;case`Ed25519`:if(!K_(e.algorithm,`Ed25519`))throw X(`Ed25519`);break;case`ES256`:case`ES384`:case`ES512`:{if(!K_(e.algorithm,`ECDSA`))throw X(`ECDSA`);let n=J_(t);if(e.algorithm.namedCurve!==n)throw X(n,`algorithm.namedCurve`);break}default:throw TypeError(`CryptoKey does not support this operation`)}Y_(e,n)}function Z_(e,t,...n){switch(t){case`A128GCM`:case`A192GCM`:case`A256GCM`:{if(!K_(e.algorithm,`AES-GCM`))throw X(`AES-GCM`);let n=parseInt(t.slice(1,4),10);if(e.algorithm.length!==n)throw X(n,`algorithm.length`);break}case`A128KW`:case`A192KW`:case`A256KW`:{if(!K_(e.algorithm,`AES-KW`))throw X(`AES-KW`);let n=parseInt(t.slice(1,4),10);if(e.algorithm.length!==n)throw X(n,`algorithm.length`);break}case`ECDH`:switch(e.algorithm.name){case`ECDH`:case`X25519`:case`X448`:break;default:throw X(`ECDH, X25519, or X448`)}break;case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:if(!K_(e.algorithm,`PBKDF2`))throw X(`PBKDF2`);break;case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:{if(!K_(e.algorithm,`RSA-OAEP`))throw X(`RSA-OAEP`);let n=parseInt(t.slice(9),10)||1;if(q_(e.algorithm.hash)!==n)throw X(`SHA-${n}`,`algorithm.hash`);break}default:throw TypeError(`CryptoKey does not support this operation`)}Y_(e,n)}var Q_=t((()=>{}));function $_(e,t,...n){if(n=n.filter(Boolean),n.length>2){let t=n.pop();e+=`one of type ${n.join(`, `)}, or ${t}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t==`function`&&t.name?e+=` Received function ${t.name}`:typeof t==`object`&&t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}function ev(e,t,...n){return $_(`Key for the ${e} algorithm must be `,t,...n)}var tv,nv=t((()=>{tv=(e,...t)=>$_(`Key must be `,e,...t)})),rv,iv,av=t((()=>{iv=e=>(rv||=new Set(pl()),rv.has(e))})),ov,Z,sv=t((()=>{G_(),I_(),ov=e=>F_(e)||W_(e),Z=[`KeyObject`],(globalThis.CryptoKey||U_?.CryptoKey)&&Z.push(`CryptoKey`)}));function cv(e,t,n,r,i,a){let o=parseInt(e.slice(1,4),10);F_(t)&&(t=t.export());let s=t.subarray(o>>3),c=t.subarray(0,o>>3),l=parseInt(e.slice(-3),10),u=`aes-${o}-cbc`;if(!iv(u))throw new K(`alg ${e} is not supported by your javascript runtime`);let d=V_(a,r,n,l,c,o),f;try{f=z_(i,d)}catch{}if(!f)throw new x_;let p;try{let e=al(u,s,r);p=o_(e.update(n),e.final())}catch{}if(!p)throw new x_;return p}function lv(e,t,n,r,i,a){let o=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!iv(o))throw new K(`alg ${e} is not supported by your javascript runtime`);try{let e=al(o,t,r,{authTagLength:16});e.setAuthTag(i),a.byteLength&&e.setAAD(a,{plaintextLength:n.length});let s=e.update(n);return e.final(),s}catch{throw new x_}}var uv,dv=t((()=>{P_(),R_(),H(),Y(),B_(),H_(),G_(),Q_(),I_(),nv(),av(),sv(),uv=(e,t,n,r,i,a)=>{let o;if(W_(t))Z_(t,e,`decrypt`),o=nl.from(t);else if(t instanceof Uint8Array||F_(t))o=t;else throw TypeError(tv(t,...Z,`Uint8Array`));if(!r)throw new q(`JWE Initialization Vector missing`);if(!i)throw new q(`JWE Authentication Tag missing`);switch(L_(e,o),N_(e,r),e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return cv(e,o,n,r,i,a);case`A128GCM`:case`A192GCM`:case`A256GCM`:return lv(e,o,n,r,i,a);default:throw new K(`Unsupported JWE Content Encryption Algorithm`)}}})),fv,pv=t((()=>{fv=(...e)=>{let t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(let e of t){let t=Object.keys(e);if(!n||n.size===0){n=new Set(t);continue}for(let e of t){if(n.has(e))return!1;n.add(e)}}return!0}}));function mv(e){return typeof e==`object`&&!!e}function Q(e){if(!mv(e)||Object.prototype.toString.call(e)!==`[object Object]`)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var hv=t((()=>{}));function gv(e,t){if(e.symmetricKeySize<<3!==parseInt(t.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${t}`)}function _v(e,t,n){if(F_(e))return e;if(e instanceof Uint8Array)return ul(e);if(W_(e))return Z_(e,t,n),nl.from(e);throw TypeError(tv(e,...Z,`Uint8Array`))}var vv,yv,bv=t((()=>{Y(),H(),G_(),Q_(),I_(),nv(),av(),sv(),vv=(e,t,n)=>{let r=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!iv(r))throw new K(`alg ${e} is not supported either by JOSE or your javascript runtime`);let i=_v(t,e,`wrapKey`);gv(i,e);let a=il(r,i,Ol.alloc(8,166));return o_(a.update(n),a.final())},yv=(e,t,n)=>{let r=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!iv(r))throw new K(`alg ${e} is not supported either by JOSE or your javascript runtime`);let i=_v(t,e,`unwrapKey`);gv(i,e);let a=al(r,i,Ol.alloc(8,166));return o_(a.update(n),a.final())}}));function xv(e){return Q(e)&&typeof e.kty==`string`}function Sv(e){return e.kty!==`oct`&&typeof e.d==`string`}function Cv(e){return e.kty!==`oct`&&e.d===void 0}function wv(e){return xv(e)&&e.kty===`oct`&&typeof e.k==`string`}var Tv=t((()=>{hv()})),Ev,Dv,Ov=t((()=>{Y(),G_(),I_(),nv(),sv(),Tv(),Ev=e=>{switch(e){case`prime256v1`:return`P-256`;case`secp384r1`:return`P-384`;case`secp521r1`:return`P-521`;case`secp256k1`:return`secp256k1`;default:throw new K(`Unsupported key curve for this operation`)}},Dv=(e,t)=>{let n;if(W_(e))n=nl.from(e);else if(F_(e))n=e;else if(xv(e))return e.crv;else throw TypeError(tv(e,...Z));if(n.type===`secret`)throw TypeError(`only "private" or "public" type keys can be used for this operation`);switch(n.asymmetricKeyType){case`ed25519`:case`ed448`:return`Ed${n.asymmetricKeyType.slice(2)}`;case`x25519`:case`x448`:return`X${n.asymmetricKeyType.slice(1)}`;case`ec`:{let e=n.asymmetricKeyDetails.namedCurve;return t?e:Ev(e)}default:throw TypeError(`Invalid asymmetric key type for this operation`)}}}));async function kv(e,t,n,r,i=new Uint8Array,a=new Uint8Array){let o;if(W_(e))Z_(e,`ECDH`),o=nl.from(e);else if(F_(e))o=e;else throw TypeError(tv(e,...Z));let s;if(W_(t))Z_(t,`ECDH`,`deriveBits`),s=nl.from(t);else if(F_(t))s=t;else throw TypeError(tv(t,...Z));let c=o_(d_(V.encode(n)),d_(i),d_(a),u_(r));return f_(dl({privateKey:s,publicKey:o}),r,c)}async function Av(e){let t;if(W_(e))t=nl.from(e);else if(F_(e))t=e;else throw TypeError(tv(e,...Z));switch(t.asymmetricKeyType){case`x25519`:return jv(`x25519`);case`x448`:return jv(`x448`);case`ec`:{let e=Dv(t);return jv(`ec`,{namedCurve:e})}default:throw new K(`Invalid or unsupported EPK`)}}var jv,Mv,Nv=t((()=>{Ov(),H(),Y(),G_(),Q_(),I_(),nv(),sv(),jv=Cl(fl),Mv=e=>[`P-256`,`P-384`,`P-521`,`X25519`,`X448`].includes(Dv(e))}));function Pv(e){if(!(e instanceof Uint8Array)||e.length<8)throw new q(`PBES2 Salt Input must be 8 or more octets`)}var Fv=t((()=>{Y()}));function Iv(e,t){if(F_(e))return e.export();if(e instanceof Uint8Array)return e;if(W_(e))return Z_(e,t,`deriveBits`,`deriveKey`),nl.from(e).export();throw TypeError(tv(e,...Z,`Uint8Array`))}var Lv,Rv,zv,Bv=t((()=>{k_(),H(),g_(),bv(),Fv(),G_(),Q_(),I_(),nv(),sv(),Lv=Cl(ml),Rv=async(e,t,n,r=2048,i=_l(new Uint8Array(16)))=>{Pv(i);let a=s_(e,i),o=parseInt(e.slice(13,16),10)>>3,s=Iv(t,e),c=await Lv(s,a,r,o,`sha${e.slice(8,11)}`);return{encryptedKey:await vv(e.slice(-6),c,n),p2c:r,p2s:U(i)}},zv=async(e,t,n,r,i)=>{Pv(i);let a=s_(e,i),o=parseInt(e.slice(13,16),10)>>3,s=Iv(t,e),c=await Lv(s,a,r,o,`sha${e.slice(8,11)}`);return yv(e.slice(-6),c,n)}})),Vv,Hv=t((()=>{Vv=(e,t)=>{let n;try{n=e instanceof nl?e.asymmetricKeyDetails?.modulusLength:Buffer.from(e.n,`base64url`).byteLength<<3}catch{}if(typeof n!=`number`||n<2048)throw TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}}));function Uv(e,t,...n){if(F_(e))return e;if(W_(e))return Z_(e,t,...n),nl.from(e);throw TypeError(tv(e,...Z))}var Wv,Gv,Kv,qv,Jv,Yv,Xv=t((()=>{Hv(),G_(),Q_(),I_(),nv(),sv(),Wv=(e,t)=>{if(e.asymmetricKeyType!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa`);Vv(e,t)},Gv=xl(()=>rl.RSA_PKCS1_PADDING,`The RSA1_5 "alg" (JWE Algorithm) is deprecated and will be removed in the next major revision.`),Kv=e=>{switch(e){case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:return rl.RSA_PKCS1_OAEP_PADDING;case`RSA1_5`:return Gv();default:return}},qv=e=>{switch(e){case`RSA-OAEP`:return`sha1`;case`RSA-OAEP-256`:return`sha256`;case`RSA-OAEP-384`:return`sha384`;case`RSA-OAEP-512`:return`sha512`;default:return}},Jv=(e,t,n)=>{let r=Kv(e),i=qv(e),a=Uv(t,e,`wrapKey`,`encrypt`);return Wv(a,e),gl({key:a,oaepHash:i,padding:r},n)},Yv=(e,t,n)=>{let r=Kv(e),i=qv(e),a=Uv(t,e,`unwrapKey`,`decrypt`);return Wv(a,e),hl({key:a,oaepHash:i,padding:r},n)}})),Zv,Qv=t((()=>{Zv={}}));function $v(e){switch(e){case`A128GCM`:return 128;case`A192GCM`:return 192;case`A256GCM`:case`A128CBC-HS256`:return 256;case`A192CBC-HS384`:return 384;case`A256CBC-HS512`:return 512;default:throw new K(`Unsupported JWE Algorithm: ${e}`)}}var ey,ty=t((()=>{Y(),k_(),ey=e=>_l(new Uint8Array($v(e)>>3))})),ny,ry,iy,ay,oy,sy,cy=t((()=>{G_(),I_(),nv(),sv(),ny=(e,t,n)=>{let r;if(W_(n)){if(!n.extractable)throw TypeError(`CryptoKey is not extractable`);r=nl.from(n)}else if(F_(n))r=n;else throw TypeError(tv(n,...Z));if(r.type!==e)throw TypeError(`key is not a ${e} key`);return r.export({format:`pem`,type:t})},ry=e=>ny(`public`,`spki`,e),iy=e=>ny(`private`,`pkcs8`,e),ay=e=>cl({key:Ol.from(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,``),`base64`),type:`pkcs8`,format:`der`}),oy=e=>ll({key:Ol.from(e.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,``),`base64`),type:`spki`,format:`der`}),sy=e=>ll({key:e,type:`spki`,format:`pem`})})),ly,uy=t((()=>{ly=e=>e.d?cl({format:`jwk`,key:e}):ll({format:`jwk`,key:e})}));async function dy(e,t,n){if(typeof e!=`string`||e.indexOf(`-----BEGIN PUBLIC KEY-----`)!==0)throw TypeError(`"spki" must be SPKI formatted string`);return oy(e,t,n)}async function fy(e,t,n){if(typeof e!=`string`||e.indexOf(`-----BEGIN CERTIFICATE-----`)!==0)throw TypeError(`"x509" must be X.509 formatted string`);return sy(e,t,n)}async function py(e,t,n){if(typeof e!=`string`||e.indexOf(`-----BEGIN PRIVATE KEY-----`)!==0)throw TypeError(`"pkcs8" must be PKCS#8 formatted string`);return ay(e,t,n)}async function my(e,t){if(!Q(e))throw TypeError(`JWK must be an object`);switch(t||=e.alg,e.kty){case`oct`:if(typeof e.k!=`string`||!e.k)throw TypeError(`missing "k" (Key Value) Parameter value`);return W(e.k);case`RSA`:if(`oth`in e&&e.oth!==void 0)throw new K(`RSA JWK "oth" (Other Primes Info) Parameter value is not supported`);case`EC`:case`OKP`:return ly({...e,alg:t});default:throw new K(`Unsupported "kty" (Key Type) Parameter value`)}}var hy=t((()=>{g_(),cy(),uy(),Y(),hv()}));function gy(e,t,n,r){t.startsWith(`HS`)||t===`dir`||t.startsWith(`PBES2`)||/^A\d{3}(?:GCM)?KW$/.test(t)?yy(t,n,r,e):by(t,n,r,e)}var _y,vy,yy,by,xy,Sy,Cy=t((()=>{nv(),sv(),Tv(),_y=e=>e?.[Symbol.toStringTag],vy=(e,t,n)=>{if(t.use!==void 0&&t.use!==`sig`)throw TypeError(`Invalid key for this operation, when present its use must be sig`);if(t.key_ops!==void 0&&t.key_ops.includes?.(n)!==!0)throw TypeError(`Invalid key for this operation, when present its key_ops must include ${n}`);if(t.alg!==void 0&&t.alg!==e)throw TypeError(`Invalid key for this operation, when present its alg must be ${e}`);return!0},yy=(e,t,n,r)=>{if(!(t instanceof Uint8Array)){if(r&&xv(t)){if(wv(t)&&vy(e,t,n))return;throw TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`)}if(!ov(t))throw TypeError(ev(e,t,...Z,`Uint8Array`,r?`JSON Web Key`:null));if(t.type!==`secret`)throw TypeError(`${_y(t)} instances for symmetric algorithms must be of type "secret"`)}},by=(e,t,n,r)=>{if(r&&xv(t))switch(n){case`sign`:if(Sv(t)&&vy(e,t,n))return;throw TypeError(`JSON Web Key for this operation be a private JWK`);case`verify`:if(Cv(t)&&vy(e,t,n))return;throw TypeError(`JSON Web Key for this operation be a public JWK`)}if(!ov(t))throw TypeError(ev(e,t,...Z,r?`JSON Web Key`:null));if(t.type===`secret`)throw TypeError(`${_y(t)} instances for asymmetric algorithms must not be of type "secret"`);if(n===`sign`&&t.type===`public`)throw TypeError(`${_y(t)} instances for asymmetric algorithm signing must be of type "private"`);if(n===`decrypt`&&t.type===`public`)throw TypeError(`${_y(t)} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&n===`verify`&&t.type===`private`)throw TypeError(`${_y(t)} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&n===`encrypt`&&t.type===`private`)throw TypeError(`${_y(t)} instances for asymmetric algorithm encryption must be of type "public"`)},xy=gy.bind(void 0,!1),Sy=gy.bind(void 0,!0)}));function wy(e,t,n,r,i){let a=parseInt(e.slice(1,4),10);F_(n)&&(n=n.export());let o=n.subarray(a>>3),s=n.subarray(0,a>>3),c=`aes-${a}-cbc`;if(!iv(c))throw new K(`alg ${e} is not supported by your javascript runtime`);let l=il(c,o,r),u=o_(l.update(t),l.final());return{ciphertext:u,tag:V_(i,r,u,parseInt(e.slice(-3),10),s,a),iv:r}}function Ty(e,t,n,r,i){let a=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!iv(a))throw new K(`alg ${e} is not supported by your javascript runtime`);let o=il(a,n,r,{authTagLength:16});i.byteLength&&o.setAAD(i,{plaintextLength:t.length});let s=o.update(t);return o.final(),{ciphertext:s,tag:o.getAuthTag(),iv:r}}var Ey,Dy=t((()=>{P_(),R_(),H(),H_(),G_(),Q_(),I_(),nv(),M_(),Y(),av(),sv(),Ey=(e,t,n,r,i)=>{let a;if(W_(n))Z_(n,e,`encrypt`),a=nl.from(n);else if(n instanceof Uint8Array||F_(n))a=n;else throw TypeError(tv(n,...Z,`Uint8Array`));switch(L_(e,a),r?N_(e,r):r=j_(e),e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return wy(e,t,a,r,i);case`A128GCM`:case`A192GCM`:case`A256GCM`:return Ty(e,t,a,r,i);default:throw new K(`Unsupported JWE Content Encryption Algorithm`)}}}));async function Oy(e,t,n,r){let i=await Ey(e.slice(0,7),n,t,r,new Uint8Array);return{encryptedKey:i.ciphertext,iv:U(i.iv),tag:U(i.tag)}}async function ky(e,t,n,r,i){return uv(e.slice(0,7),t,n,r,i,new Uint8Array)}var Ay=t((()=>{Dy(),dv(),g_()}));async function jy(e,t,n,r,i){switch(xy(e,t,`decrypt`),t=await Zv.normalizePrivateKey?.(t,e)||t,e){case`dir`:if(n!==void 0)throw new q(`Encountered unexpected JWE Encrypted Key`);return t;case`ECDH-ES`:if(n!==void 0)throw new q(`Encountered unexpected JWE Encrypted Key`);case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{if(!Q(r.epk))throw new q(`JOSE Header "epk" (Ephemeral Public Key) missing or invalid`);if(!Mv(t))throw new K(`ECDH with the provided key is not allowed or not supported by your javascript runtime`);let i=await my(r.epk,e),a,o;if(r.apu!==void 0){if(typeof r.apu!=`string`)throw new q(`JOSE Header "apu" (Agreement PartyUInfo) invalid`);try{a=W(r.apu)}catch{throw new q(`Failed to base64url decode the apu`)}}if(r.apv!==void 0){if(typeof r.apv!=`string`)throw new q(`JOSE Header "apv" (Agreement PartyVInfo) invalid`);try{o=W(r.apv)}catch{throw new q(`Failed to base64url decode the apv`)}}let s=await kv(i,t,e===`ECDH-ES`?r.enc:e,e===`ECDH-ES`?$v(r.enc):parseInt(e.slice(-5,-2),10),a,o);if(e===`ECDH-ES`)return s;if(n===void 0)throw new q(`JWE Encrypted Key missing`);return yv(e.slice(-6),s,n)}case`RSA1_5`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:if(n===void 0)throw new q(`JWE Encrypted Key missing`);return Yv(e,t,n);case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:{if(n===void 0)throw new q(`JWE Encrypted Key missing`);if(typeof r.p2c!=`number`)throw new q(`JOSE Header "p2c" (PBES2 Count) missing or invalid`);let a=i?.maxPBES2Count||1e4;if(r.p2c>a)throw new q(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`);if(typeof r.p2s!=`string`)throw new q(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`);let o;try{o=W(r.p2s)}catch{throw new q(`Failed to base64url decode the p2s`)}return zv(e,t,n,r.p2c,o)}case`A128KW`:case`A192KW`:case`A256KW`:if(n===void 0)throw new q(`JWE Encrypted Key missing`);return yv(e,t,n);case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:{if(n===void 0)throw new q(`JWE Encrypted Key missing`);if(typeof r.iv!=`string`)throw new q(`JOSE Header "iv" (Initialization Vector) missing or invalid`);if(typeof r.tag!=`string`)throw new q(`JOSE Header "tag" (Authentication Tag) missing or invalid`);let i;try{i=W(r.iv)}catch{throw new q(`Failed to base64url decode the iv`)}let a;try{a=W(r.tag)}catch{throw new q(`Failed to base64url decode the tag`)}return ky(e,t,n,i,a)}default:throw new K(`Invalid or unsupported "alg" (JWE Algorithm) header value`)}}var My=t((()=>{bv(),Nv(),Bv(),Xv(),g_(),Qv(),Y(),ty(),hy(),Cy(),hv(),Ay()}));function Ny(e,t,n,r,i){if(i.crit!==void 0&&r?.crit===void 0)throw new e(`"crit" (Critical) Header Parameter MUST be integrity protected`);if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(e=>typeof e!=`string`||e.length===0))throw new e(`"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present`);let a;a=n===void 0?t:new Map([...Object.entries(n),...t.entries()]);for(let t of r.crit){if(!a.has(t))throw new K(`Extension Header Parameter "${t}" is not recognized`);if(i[t]===void 0)throw new e(`Extension Header Parameter "${t}" is missing`);if(a.get(t)&&r[t]===void 0)throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return new Set(r.crit)}var Py=t((()=>{Y()})),Fy,Iy=t((()=>{Fy=(e,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(e=>typeof e!=`string`)))throw TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}}));async function Ly(e,t,n){if(!Q(e))throw new q(`Flattened JWE must be an object`);if(e.protected===void 0&&e.header===void 0&&e.unprotected===void 0)throw new q(`JOSE Header missing`);if(e.iv!==void 0&&typeof e.iv!=`string`)throw new q(`JWE Initialization Vector incorrect type`);if(typeof e.ciphertext!=`string`)throw new q(`JWE Ciphertext missing or incorrect type`);if(e.tag!==void 0&&typeof e.tag!=`string`)throw new q(`JWE Authentication Tag incorrect type`);if(e.protected!==void 0&&typeof e.protected!=`string`)throw new q(`JWE Protected Header incorrect type`);if(e.encrypted_key!==void 0&&typeof e.encrypted_key!=`string`)throw new q(`JWE Encrypted Key incorrect type`);if(e.aad!==void 0&&typeof e.aad!=`string`)throw new q(`JWE AAD incorrect type`);if(e.header!==void 0&&!Q(e.header))throw new q(`JWE Shared Unprotected Header incorrect type`);if(e.unprotected!==void 0&&!Q(e.unprotected))throw new q(`JWE Per-Recipient Unprotected Header incorrect type`);let r;if(e.protected)try{let t=W(e.protected);r=JSON.parse(p_.decode(t))}catch{throw new q(`JWE Protected Header is invalid`)}if(!fv(r,e.header,e.unprotected))throw new q(`JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint`);let i={...r,...e.header,...e.unprotected};if(Ny(q,new Map,n?.crit,r,i),i.zip!==void 0)throw new K(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`);let{alg:a,enc:o}=i;if(typeof a!=`string`||!a)throw new q(`missing JWE Algorithm (alg) in JWE Header`);if(typeof o!=`string`||!o)throw new q(`missing JWE Encryption Algorithm (enc) in JWE Header`);let s=n&&Fy(`keyManagementAlgorithms`,n.keyManagementAlgorithms),c=n&&Fy(`contentEncryptionAlgorithms`,n.contentEncryptionAlgorithms);if(s&&!s.has(a)||!s&&a.startsWith(`PBES2`))throw new b_(`"alg" (Algorithm) Header Parameter value not allowed`);if(c&&!c.has(o))throw new b_(`"enc" (Encryption Algorithm) Header Parameter value not allowed`);let l;if(e.encrypted_key!==void 0)try{l=W(e.encrypted_key)}catch{throw new q(`Failed to base64url decode the encrypted_key`)}let u=!1;typeof t==`function`&&(t=await t(r,e),u=!0);let d;try{d=await jy(a,t,l,i,n)}catch(e){if(e instanceof TypeError||e instanceof q||e instanceof K)throw e;d=ey(o)}let f,p;if(e.iv!==void 0)try{f=W(e.iv)}catch{throw new q(`Failed to base64url decode the iv`)}if(e.tag!==void 0)try{p=W(e.tag)}catch{throw new q(`Failed to base64url decode the tag`)}let m=V.encode(e.protected??``),h;h=e.aad===void 0?m:o_(m,V.encode(`.`),V.encode(e.aad));let g;try{g=W(e.ciphertext)}catch{throw new q(`Failed to base64url decode the ciphertext`)}let _={plaintext:await uv(o,d,g,f,p,h)};if(e.protected!==void 0&&(_.protectedHeader=r),e.aad!==void 0)try{_.additionalAuthenticatedData=W(e.aad)}catch{throw new q(`Failed to base64url decode the aad`)}return e.unprotected!==void 0&&(_.sharedUnprotectedHeader=e.unprotected),e.header!==void 0&&(_.unprotectedHeader=e.header),u?{..._,key:t}:_}var Ry=t((()=>{g_(),dv(),Y(),pv(),hv(),My(),H(),ty(),Py(),Iy()}));async function zy(e,t,n){if(e instanceof Uint8Array&&(e=p_.decode(e)),typeof e!=`string`)throw new q(`Compact JWE must be a string or Uint8Array`);let{0:r,1:i,2:a,3:o,4:s,length:c}=e.split(`.`);if(c!==5)throw new q(`Invalid Compact JWE`);let l=await Ly({ciphertext:o,iv:a||void 0,protected:r,tag:s||void 0,encrypted_key:i||void 0},t,n),u={plaintext:l.plaintext,protectedHeader:l.protectedHeader};return typeof t==`function`?{...u,key:l.key}:u}var By=t((()=>{Ry(),Y(),H()}));async function Vy(e,t,n){if(!Q(e))throw new q(`General JWE must be an object`);if(!Array.isArray(e.recipients)||!e.recipients.every(Q))throw new q(`JWE Recipients missing or incorrect type`);if(!e.recipients.length)throw new q(`JWE Recipients has no members`);for(let r of e.recipients)try{return await Ly({aad:e.aad,ciphertext:e.ciphertext,encrypted_key:r.encrypted_key,header:r.header,iv:e.iv,protected:e.protected,tag:e.tag,unprotected:e.unprotected},t,n)}catch{}throw new x_}var Hy=t((()=>{Ry(),Y(),hv()})),Uy,Wy=t((()=>{Uy=Symbol()})),Gy,Ky=t((()=>{g_(),Y(),G_(),I_(),nv(),sv(),Gy=e=>{let t;if(W_(e)){if(!e.extractable)throw TypeError(`CryptoKey is not extractable`);t=nl.from(e)}else if(F_(e))t=e;else if(e instanceof Uint8Array)return{kty:`oct`,k:U(e)};else throw TypeError(tv(e,...Z,`Uint8Array`));if(t.type!==`secret`&&![`rsa`,`ec`,`ed25519`,`x25519`,`ed448`,`x448`].includes(t.asymmetricKeyType))throw new K(`Unsupported key asymmetricKeyType`);return t.export({format:`jwk`})}}));async function qy(e){return ry(e)}async function Jy(e){return iy(e)}async function Yy(e){return Gy(e)}var Xy=t((()=>{cy(),Ky()}));async function Zy(e,t,n,r,i={}){let a,o,s;switch(xy(e,n,`encrypt`),n=await Zv.normalizePublicKey?.(n,e)||n,e){case`dir`:s=n;break;case`ECDH-ES`:case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{if(!Mv(n))throw new K(`ECDH with the provided key is not allowed or not supported by your javascript runtime`);let{apu:c,apv:l}=i,{epk:u}=i;u||=(await Av(n)).privateKey;let{x:d,y:f,crv:p,kty:m}=await Yy(u),h=await kv(n,u,e===`ECDH-ES`?t:e,e===`ECDH-ES`?$v(t):parseInt(e.slice(-5,-2),10),c,l);if(o={epk:{x:d,crv:p,kty:m}},m===`EC`&&(o.epk.y=f),c&&(o.apu=U(c)),l&&(o.apv=U(l)),e===`ECDH-ES`){s=h;break}s=r||ey(t),a=await vv(e.slice(-6),h,s);break}case`RSA1_5`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:s=r||ey(t),a=await Jv(e,n,s);break;case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:{s=r||ey(t);let{p2c:c,p2s:l}=i;({encryptedKey:a,...o}=await Rv(e,n,s,c,l));break}case`A128KW`:case`A192KW`:case`A256KW`:s=r||ey(t),a=await vv(e,n,s);break;case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:{s=r||ey(t);let{iv:c}=i;({encryptedKey:a,...o}=await Oy(e,n,s,c));break}default:throw new K(`Invalid or unsupported "alg" (JWE Algorithm) header value`)}return{cek:s,encryptedKey:a,parameters:o}}var Qy=t((()=>{bv(),Nv(),Bv(),Xv(),g_(),Qv(),ty(),Y(),Xy(),Cy(),Ay()})),$y,eb=t((()=>{g_(),Wy(),Dy(),Qy(),Y(),pv(),H(),Py(),$y=class{_plaintext;_protectedHeader;_sharedUnprotectedHeader;_unprotectedHeader;_aad;_cek;_iv;_keyManagementParameters;constructor(e){if(!(e instanceof Uint8Array))throw TypeError(`plaintext must be an instance of Uint8Array`);this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError(`setKeyManagementParameters can only be called once`);return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw TypeError(`setSharedUnprotectedHeader can only be called once`);return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError(`setContentEncryptionKey can only be called once`);return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError(`setInitializationVector can only be called once`);return this._iv=e,this}async encrypt(e,t){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new q(`either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()`);if(!fv(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new q(`JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint`);let n={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(Ny(q,new Map,t?.crit,this._protectedHeader,n),n.zip!==void 0)throw new K(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`);let{alg:r,enc:i}=n;if(typeof r!=`string`||!r)throw new q(`JWE "alg" (Algorithm) Header Parameter missing or invalid`);if(typeof i!=`string`||!i)throw new q(`JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid`);let a;if(this._cek&&(r===`dir`||r===`ECDH-ES`))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${r}`);let o;{let n;({cek:o,encryptedKey:a,parameters:n}=await Zy(r,i,e,this._cek,this._keyManagementParameters)),n&&(t&&Uy in t?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...n}:this.setUnprotectedHeader(n):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...n}:this.setProtectedHeader(n))}let s,c,l;c=this._protectedHeader?V.encode(U(JSON.stringify(this._protectedHeader))):V.encode(``),this._aad?(l=U(this._aad),s=o_(c,V.encode(`.`),V.encode(l))):s=c;let{ciphertext:u,tag:d,iv:f}=await Ey(i,this._plaintext,o,this._iv,s),p={ciphertext:U(u)};return f&&(p.iv=U(f)),d&&(p.tag=U(d)),a&&(p.encrypted_key=U(a)),l&&(p.aad=l),this._protectedHeader&&(p.protected=p_.decode(c)),this._sharedUnprotectedHeader&&(p.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(p.header=this._unprotectedHeader),p}}})),tb,nb,rb=t((()=>{eb(),Wy(),Y(),ty(),pv(),Qy(),g_(),Py(),tb=class{parent;unprotectedHeader;key;options;constructor(e,t,n){this.parent=e,this.key=t,this.options=n}setUnprotectedHeader(e){if(this.unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this.unprotectedHeader=e,this}addRecipient(...e){return this.parent.addRecipient(...e)}encrypt(...e){return this.parent.encrypt(...e)}done(){return this.parent}},nb=class{_plaintext;_recipients=[];_protectedHeader;_unprotectedHeader;_aad;constructor(e){this._plaintext=e}addRecipient(e,t){let n=new tb(this,e,{crit:t?.crit});return this._recipients.push(n),n}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setSharedUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}async encrypt(){if(!this._recipients.length)throw new q(`at least one recipient must be added`);if(this._recipients.length===1){let[e]=this._recipients,t=await new $y(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(e.unprotectedHeader).encrypt(e.key,{...e.options}),n={ciphertext:t.ciphertext,iv:t.iv,recipients:[{}],tag:t.tag};return t.aad&&(n.aad=t.aad),t.protected&&(n.protected=t.protected),t.unprotected&&(n.unprotected=t.unprotected),t.encrypted_key&&(n.recipients[0].encrypted_key=t.encrypted_key),t.header&&(n.recipients[0].header=t.header),n}let e;for(let t=0;t<this._recipients.length;t++){let n=this._recipients[t];if(!fv(this._protectedHeader,this._unprotectedHeader,n.unprotectedHeader))throw new q(`JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint`);let r={...this._protectedHeader,...this._unprotectedHeader,...n.unprotectedHeader},{alg:i}=r;if(typeof i!=`string`||!i)throw new q(`JWE "alg" (Algorithm) Header Parameter missing or invalid`);if(i===`dir`||i===`ECDH-ES`)throw new q(`"dir" and "ECDH-ES" alg may only be used with a single recipient`);if(typeof r.enc!=`string`||!r.enc)throw new q(`JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid`);if(!e)e=r.enc;else if(e!==r.enc)throw new q(`JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients`);if(Ny(q,new Map,n.options.crit,this._protectedHeader,r),r.zip!==void 0)throw new K(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`)}let t=ey(e),n={ciphertext:``,iv:``,recipients:[],tag:``};for(let r=0;r<this._recipients.length;r++){let i=this._recipients[r],a={};n.recipients.push(a);let o={...this._protectedHeader,...this._unprotectedHeader,...i.unprotectedHeader}.alg.startsWith(`PBES2`)?2048+r:void 0;if(r===0){let e=await new $y(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(t).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(i.unprotectedHeader).setKeyManagementParameters({p2c:o}).encrypt(i.key,{...i.options,[Uy]:!0});n.ciphertext=e.ciphertext,n.iv=e.iv,n.tag=e.tag,e.aad&&(n.aad=e.aad),e.protected&&(n.protected=e.protected),e.unprotected&&(n.unprotected=e.unprotected),a.encrypted_key=e.encrypted_key,e.header&&(a.header=e.header);continue}let{encryptedKey:s,parameters:c}=await Zy(i.unprotectedHeader?.alg||this._protectedHeader?.alg||this._unprotectedHeader?.alg,e,i.key,t,{p2c:o});a.encrypted_key=U(s),(i.unprotectedHeader||c)&&(a.header={...i.unprotectedHeader,...c})}return n}}}));function ib(e){switch(e){case`PS256`:case`RS256`:case`ES256`:case`ES256K`:return`sha256`;case`PS384`:case`RS384`:case`ES384`:return`sha384`;case`PS512`:case`RS512`:case`ES512`:return`sha512`;case`Ed25519`:case`EdDSA`:return;default:throw new K(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}var ab=t((()=>{Y()}));function ob(e,t){let n,r,i;if(t instanceof nl)n=t.asymmetricKeyType,r=t.asymmetricKeyDetails;else switch(i=!0,t.kty){case`RSA`:n=`rsa`;break;case`EC`:n=`ec`;break;case`OKP`:if(t.crv===`Ed25519`){n=`ed25519`;break}if(t.crv===`Ed448`){n=`ed448`;break}throw TypeError(`Invalid key for this operation, its crv must be Ed25519 or Ed448`);default:throw TypeError(`Invalid key for this operation, its kty must be RSA, OKP, or EC`)}let a;switch(e){case`Ed25519`:if(n!==`ed25519`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be ed25519`);break;case`EdDSA`:if(![`ed25519`,`ed448`].includes(n))throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448`);break;case`RS256`:case`RS384`:case`RS512`:if(n!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa`);Vv(t,e);break;case`PS256`:case`PS384`:case`PS512`:if(n===`rsa-pss`){let{hashAlgorithm:t,mgf1HashAlgorithm:n,saltLength:i}=r,a=parseInt(e.slice(-3),10);if(t!==void 0&&(t!==`sha${a}`||n!==t))throw TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}`);if(i!==void 0&&i>a>>3)throw TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}`)}else if(n!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss`);Vv(t,e),a={padding:rl.RSA_PKCS1_PSS_PADDING,saltLength:rl.RSA_PSS_SALTLEN_DIGEST};break;case`ES256`:case`ES256K`:case`ES384`:case`ES512`:{if(n!==`ec`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be ec`);let r=Dv(t),i=sb.get(e);if(r!==i)throw TypeError(`Invalid key curve for the algorithm, its curve must be ${i}, got ${r}`);a={dsaEncoding:`ieee-p1363`};break}default:throw new K(`alg ${e} is not supported either by JOSE or your javascript runtime`)}return i?{format:`jwk`,key:t,...a}:a?{...a,key:t}:t}var sb,cb=t((()=>{Ov(),Y(),Hv(),sb=new Map([[`ES256`,`P-256`],[`ES256K`,`secp256k1`],[`ES384`,`P-384`],[`ES512`,`P-521`]])}));function lb(e){switch(e){case`HS256`:return`sha256`;case`HS384`:return`sha384`;case`HS512`:return`sha512`;default:throw new K(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}var ub=t((()=>{Y()}));function db(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith(`HS`))throw TypeError(tv(t,...Z));return ul(t)}if(t instanceof nl)return t;if(W_(t))return X_(t,e,n),nl.from(t);if(xv(t))return e.startsWith(`HS`)?ul(Buffer.from(t.k,`base64url`)):t;throw TypeError(tv(t,...Z,`Uint8Array`,`JSON Web Key`))}var fb=t((()=>{G_(),Q_(),nv(),sv(),Tv()})),pb,mb,hb=t((()=>{ab(),ub(),cb(),fb(),pb=Cl(tl.sign),mb=async(e,t,n)=>{let r=db(e,t,`sign`);if(e.startsWith(`HS`)){let t=tl.createHmac(lb(e),r);return t.update(n),t.digest()}return pb(ib(e),n,ob(e,r))}})),gb,_b,vb=t((()=>{ab(),cb(),hb(),fb(),gb=Cl(tl.verify),_b=async(e,t,n,r)=>{let i=db(e,t,`verify`);if(e.startsWith(`HS`)){let t=await mb(e,i,r),a=n;try{return tl.timingSafeEqual(a,t)}catch{return!1}}let a=ib(e),o=ob(e,i);try{return await gb(a,r,o,n)}catch{return!1}}}));async function yb(e,t,n){if(!Q(e))throw new J(`Flattened JWS must be an object`);if(e.protected===void 0&&e.header===void 0)throw new J(`Flattened JWS must have either of the "protected" or "header" members`);if(e.protected!==void 0&&typeof e.protected!=`string`)throw new J(`JWS Protected Header incorrect type`);if(e.payload===void 0)throw new J(`JWS Payload missing`);if(typeof e.signature!=`string`)throw new J(`JWS Signature missing or incorrect type`);if(e.header!==void 0&&!Q(e.header))throw new J(`JWS Unprotected Header incorrect type`);let r={};if(e.protected)try{let t=W(e.protected);r=JSON.parse(p_.decode(t))}catch{throw new J(`JWS Protected Header is invalid`)}if(!fv(r,e.header))throw new J(`JWS Protected and JWS Unprotected Header Parameter names must be disjoint`);let i={...r,...e.header},a=Ny(J,new Map([[`b64`,!0]]),n?.crit,r,i),o=!0;if(a.has(`b64`)&&(o=r.b64,typeof o!=`boolean`))throw new J(`The "b64" (base64url-encode payload) Header Parameter must be a boolean`);let{alg:s}=i;if(typeof s!=`string`||!s)throw new J(`JWS "alg" (Algorithm) Header Parameter missing or invalid`);let c=n&&Fy(`algorithms`,n.algorithms);if(c&&!c.has(s))throw new b_(`"alg" (Algorithm) Header Parameter value not allowed`);if(o){if(typeof e.payload!=`string`)throw new J(`JWS Payload must be a string`)}else if(typeof e.payload!=`string`&&!(e.payload instanceof Uint8Array))throw new J(`JWS Payload must be a string or an Uint8Array instance`);let l=!1;typeof t==`function`?(t=await t(r,e),l=!0,Sy(s,t,`verify`),xv(t)&&(t=await my(t,s))):Sy(s,t,`verify`);let u=o_(V.encode(e.protected??``),V.encode(`.`),typeof e.payload==`string`?V.encode(e.payload):e.payload),d;try{d=W(e.signature)}catch{throw new J(`Failed to base64url decode the signature`)}if(!await _b(s,t,d,u))throw new O_;let f;if(o)try{f=W(e.payload)}catch{throw new J(`Failed to base64url decode the payload`)}else f=typeof e.payload==`string`?V.encode(e.payload):e.payload;let p={payload:f};return e.protected!==void 0&&(p.protectedHeader=r),e.header!==void 0&&(p.unprotectedHeader=e.header),l?{...p,key:t}:p}var bb=t((()=>{g_(),vb(),Y(),H(),pv(),hv(),Cy(),Py(),Iy(),Tv(),hy()}));async function xb(e,t,n){if(e instanceof Uint8Array&&(e=p_.decode(e)),typeof e!=`string`)throw new J(`Compact JWS must be a string or Uint8Array`);let{0:r,1:i,2:a,length:o}=e.split(`.`);if(o!==3)throw new J(`Invalid Compact JWS`);let s=await yb({payload:i,protected:r,signature:a},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return typeof t==`function`?{...c,key:s.key}:c}var Sb=t((()=>{bb(),Y(),H()}));async function Cb(e,t,n){if(!Q(e))throw new J(`General JWS must be an object`);if(!Array.isArray(e.signatures)||!e.signatures.every(Q))throw new J(`JWS Signatures missing or incorrect type`);for(let r of e.signatures)try{return await yb({header:r.header,payload:e.payload,protected:r.protected,signature:r.signature},t,n)}catch{}throw new O_}var wb=t((()=>{bb(),Y(),hv()})),Tb,Eb=t((()=>{Tb=e=>Math.floor(e.getTime()/1e3)})),Db,Ob,kb,Ab,jb,Mb,Nb,Pb=t((()=>{Db=60,Ob=Db*60,kb=Ob*24,Ab=kb*7,jb=kb*365.25,Mb=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Nb=e=>{let t=Mb.exec(e);if(!t||t[4]&&t[1])throw TypeError(`Invalid time period format`);let n=parseFloat(t[2]),r=t[3].toLowerCase(),i;switch(r){case`sec`:case`secs`:case`second`:case`seconds`:case`s`:i=Math.round(n);break;case`minute`:case`minutes`:case`min`:case`mins`:case`m`:i=Math.round(n*Db);break;case`hour`:case`hours`:case`hr`:case`hrs`:case`h`:i=Math.round(n*Ob);break;case`day`:case`days`:case`d`:i=Math.round(n*kb);break;case`week`:case`weeks`:case`w`:i=Math.round(n*Ab);break;default:i=Math.round(n*jb);break}return t[1]===`-`||t[4]===`ago`?-i:i}})),Fb,Ib,Lb,Rb=t((()=>{Y(),H(),Eb(),Pb(),hv(),Fb=e=>e.toLowerCase().replace(/^application\//,``),Ib=(e,t)=>typeof e==`string`?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1,Lb=(e,t,n={})=>{let r;try{r=JSON.parse(p_.decode(t))}catch{}if(!Q(r))throw new S_(`JWT Claims Set must be a top-level JSON object`);let{typ:i}=n;if(i&&(typeof e.typ!=`string`||Fb(e.typ)!==Fb(i)))throw new v_(`unexpected "typ" JWT header value`,r,`typ`,`check_failed`);let{requiredClaims:a=[],issuer:o,subject:s,audience:c,maxTokenAge:l}=n,u=[...a];l!==void 0&&u.push(`iat`),c!==void 0&&u.push(`aud`),s!==void 0&&u.push(`sub`),o!==void 0&&u.push(`iss`);for(let e of new Set(u.reverse()))if(!(e in r))throw new v_(`missing required "${e}" claim`,r,e,`missing`);if(o&&!(Array.isArray(o)?o:[o]).includes(r.iss))throw new v_(`unexpected "iss" claim value`,r,`iss`,`check_failed`);if(s&&r.sub!==s)throw new v_(`unexpected "sub" claim value`,r,`sub`,`check_failed`);if(c&&!Ib(r.aud,typeof c==`string`?[c]:c))throw new v_(`unexpected "aud" claim value`,r,`aud`,`check_failed`);let d;switch(typeof n.clockTolerance){case`string`:d=Nb(n.clockTolerance);break;case`number`:d=n.clockTolerance;break;case`undefined`:d=0;break;default:throw TypeError(`Invalid clockTolerance option type`)}let{currentDate:f}=n,p=Tb(f||new Date);if((r.iat!==void 0||l)&&typeof r.iat!=`number`)throw new v_(`"iat" claim must be a number`,r,`iat`,`invalid`);if(r.nbf!==void 0){if(typeof r.nbf!=`number`)throw new v_(`"nbf" claim must be a number`,r,`nbf`,`invalid`);if(r.nbf>p+d)throw new v_(`"nbf" claim timestamp check failed`,r,`nbf`,`check_failed`)}if(r.exp!==void 0){if(typeof r.exp!=`number`)throw new v_(`"exp" claim must be a number`,r,`exp`,`invalid`);if(r.exp<=p-d)throw new y_(`"exp" claim timestamp check failed`,r,`exp`,`check_failed`)}if(l){let e=p-r.iat,t=typeof l==`number`?l:Nb(l);if(e-d>t)throw new y_(`"iat" claim timestamp check failed (too far in the past)`,r,`iat`,`check_failed`);if(e<0-d)throw new v_(`"iat" claim timestamp check failed (it should be in the past)`,r,`iat`,`check_failed`)}return r}}));async function zb(e,t,n){let r=await xb(e,t,n);if(r.protectedHeader.crit?.includes(`b64`)&&r.protectedHeader.b64===!1)throw new S_(`JWTs MUST NOT use unencoded payload`);let i={payload:Lb(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return typeof t==`function`?{...i,key:r.key}:i}var Bb=t((()=>{Sb(),Rb(),Y()}));async function Vb(e,t,n){let r=await zy(e,t,n),i=Lb(r.protectedHeader,r.plaintext,n),{protectedHeader:a}=r;if(a.iss!==void 0&&a.iss!==i.iss)throw new v_(`replicated "iss" claim header parameter mismatch`,i,`iss`,`mismatch`);if(a.sub!==void 0&&a.sub!==i.sub)throw new v_(`replicated "sub" claim header parameter mismatch`,i,`sub`,`mismatch`);if(a.aud!==void 0&&JSON.stringify(a.aud)!==JSON.stringify(i.aud))throw new v_(`replicated "aud" claim header parameter mismatch`,i,`aud`,`mismatch`);let o={payload:i,protectedHeader:a};return typeof t==`function`?{...o,key:r.key}:o}var Hb=t((()=>{By(),Rb(),Y()})),Ub,Wb=t((()=>{eb(),Ub=class{_flattened;constructor(e){this._flattened=new $y(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){let n=await this._flattened.encrypt(e,t);return[n.protected,n.encrypted_key,n.iv,n.ciphertext,n.tag].join(`.`)}}})),Gb,Kb=t((()=>{g_(),hb(),pv(),Y(),H(),Cy(),Py(),Gb=class{_payload;_protectedHeader;_unprotectedHeader;constructor(e){if(!(e instanceof Uint8Array))throw TypeError(`payload must be an instance of Uint8Array`);this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader)throw new J(`either setProtectedHeader or setUnprotectedHeader must be called before #sign()`);if(!fv(this._protectedHeader,this._unprotectedHeader))throw new J(`JWS Protected and JWS Unprotected Header Parameter names must be disjoint`);let n={...this._protectedHeader,...this._unprotectedHeader},r=Ny(J,new Map([[`b64`,!0]]),t?.crit,this._protectedHeader,n),i=!0;if(r.has(`b64`)&&(i=this._protectedHeader.b64,typeof i!=`boolean`))throw new J(`The "b64" (base64url-encode payload) Header Parameter must be a boolean`);let{alg:a}=n;if(typeof a!=`string`||!a)throw new J(`JWS "alg" (Algorithm) Header Parameter missing or invalid`);Sy(a,e,`sign`);let o=this._payload;i&&(o=V.encode(U(o)));let s;s=this._protectedHeader?V.encode(U(JSON.stringify(this._protectedHeader))):V.encode(``);let c={signature:U(await mb(a,e,o_(s,V.encode(`.`),o))),payload:``};return i&&(c.payload=p_.decode(o)),this._unprotectedHeader&&(c.header=this._unprotectedHeader),this._protectedHeader&&(c.protected=p_.decode(s)),c}}})),qb,Jb=t((()=>{Kb(),qb=class{_flattened;constructor(e){this._flattened=new Gb(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){let n=await this._flattened.sign(e,t);if(n.payload===void 0)throw TypeError(`use the flattened module for creating JWS with b64: false`);return`${n.protected}.${n.payload}.${n.signature}`}}})),Yb,Xb,Zb=t((()=>{Kb(),Y(),Yb=class{parent;protectedHeader;unprotectedHeader;options;key;constructor(e,t,n){this.parent=e,this.key=t,this.options=n}setProtectedHeader(e){if(this.protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this.protectedHeader=e,this}setUnprotectedHeader(e){if(this.unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this.unprotectedHeader=e,this}addSignature(...e){return this.parent.addSignature(...e)}sign(...e){return this.parent.sign(...e)}done(){return this.parent}},Xb=class{_payload;_signatures=[];constructor(e){this._payload=e}addSignature(e,t){let n=new Yb(this,e,t);return this._signatures.push(n),n}async sign(){if(!this._signatures.length)throw new J(`at least one signature must be added`);let e={signatures:[],payload:``};for(let t=0;t<this._signatures.length;t++){let n=this._signatures[t],r=new Gb(this._payload);r.setProtectedHeader(n.protectedHeader),r.setUnprotectedHeader(n.unprotectedHeader);let{payload:i,...a}=await r.sign(n.key,n.options);if(t===0)e.payload=i;else if(e.payload!==i)throw new J(`inconsistent use of JWS Unencoded Payload (RFC7797)`);e.signatures.push(a)}return e}}}));function Qb(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}var $b,ex=t((()=>{Eb(),hv(),Pb(),$b=class{_payload;constructor(e={}){if(!Q(e))throw TypeError(`JWT Claims Set MUST be an object`);this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return typeof e==`number`?this._payload={...this._payload,nbf:Qb(`setNotBefore`,e)}:e instanceof Date?this._payload={...this._payload,nbf:Qb(`setNotBefore`,Tb(e))}:this._payload={...this._payload,nbf:Tb(new Date)+Nb(e)},this}setExpirationTime(e){return typeof e==`number`?this._payload={...this._payload,exp:Qb(`setExpirationTime`,e)}:e instanceof Date?this._payload={...this._payload,exp:Qb(`setExpirationTime`,Tb(e))}:this._payload={...this._payload,exp:Tb(new Date)+Nb(e)},this}setIssuedAt(e){return e===void 0?this._payload={...this._payload,iat:Tb(new Date)}:e instanceof Date?this._payload={...this._payload,iat:Qb(`setIssuedAt`,Tb(e))}:typeof e==`string`?this._payload={...this._payload,iat:Qb(`setIssuedAt`,Tb(new Date)+Nb(e))}:this._payload={...this._payload,iat:Qb(`setIssuedAt`,e)},this}}})),tx,nx=t((()=>{Jb(),Y(),H(),ex(),tx=class extends $b{_protectedHeader;setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,t){let n=new qb(V.encode(JSON.stringify(this._payload)));if(n.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes(`b64`)&&this._protectedHeader.b64===!1)throw new S_(`JWTs MUST NOT use unencoded payload`);return n.sign(e,t)}}})),rx,ix=t((()=>{Wb(),H(),ex(),rx=class extends $b{_cek;_iv;_keyManagementParameters;_protectedHeader;_replicateIssuerAsHeader;_replicateSubjectAsHeader;_replicateAudienceAsHeader;setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError(`setKeyManagementParameters can only be called once`);return this._keyManagementParameters=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError(`setContentEncryptionKey can only be called once`);return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError(`setInitializationVector can only be called once`);return this._iv=e,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(e,t){let n=new Ub(V.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),n.setProtectedHeader(this._protectedHeader),this._iv&&n.setInitializationVector(this._iv),this._cek&&n.setContentEncryptionKey(this._cek),this._keyManagementParameters&&n.setKeyManagementParameters(this._keyManagementParameters),n.encrypt(e,t)}}}));async function ax(e,t){if(!Q(e))throw TypeError(`JWK must be an object`);if(t??=`sha256`,t!==`sha256`&&t!==`sha384`&&t!==`sha512`)throw TypeError(`digestAlgorithm must one of "sha256", "sha384", or "sha512"`);let n;switch(e.kty){case`EC`:sx(e.crv,`"crv" (Curve) Parameter`),sx(e.x,`"x" (X Coordinate) Parameter`),sx(e.y,`"y" (Y Coordinate) Parameter`),n={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case`OKP`:sx(e.crv,`"crv" (Subtype of Key Pair) Parameter`),sx(e.x,`"x" (Public Key) Parameter`),n={crv:e.crv,kty:e.kty,x:e.x};break;case`RSA`:sx(e.e,`"e" (Exponent) Parameter`),sx(e.n,`"n" (Modulus) Parameter`),n={e:e.e,kty:e.kty,n:e.n};break;case`oct`:sx(e.k,`"k" (Key Value) Parameter`),n={k:e.k,kty:e.kty};break;default:throw new K(`"kty" (Key Type) Parameter missing or unsupported`)}let r=V.encode(JSON.stringify(n));return U(await i_(t,r))}async function ox(e,t){t??=`sha256`;let n=await ax(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${n}`}var sx,cx=t((()=>{a_(),g_(),Y(),H(),hv(),sx=(e,t)=>{if(typeof e!=`string`||!e)throw new C_(`${t} missing or invalid`)}}));async function lx(e,t){let n={...e,...t?.header};if(!Q(n.jwk))throw new J(`"jwk" (JSON Web Key) Header Parameter must be a JSON object`);let r=await my({...n.jwk,ext:!0},n.alg);if(r instanceof Uint8Array||r.type!==`public`)throw new J(`"jwk" (JSON Web Key) Header Parameter must be a public key`);return r}var ux=t((()=>{hy(),hv(),Y()}));function dx(e){switch(typeof e==`string`&&e.slice(0,2)){case`RS`:case`PS`:return`RSA`;case`ES`:return`EC`;case`Ed`:return`OKP`;default:throw new K(`Unsupported "alg" value for a JSON Web Key Set`)}}function fx(e){return e&&typeof e==`object`&&Array.isArray(e.keys)&&e.keys.every(px)}function px(e){return Q(e)}function mx(e){return typeof structuredClone==`function`?structuredClone(e):JSON.parse(JSON.stringify(e))}async function hx(e,t,n){let r=e.get(t)||e.set(t,{}).get(t);if(r[n]===void 0){let e=await my({...t,ext:!0},n);if(e instanceof Uint8Array||e.type!==`public`)throw new w_(`JSON Web Key Set members must be public keys`);r[n]=e}return r[n]}function gx(e){let t=new _x(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>mx(t._jwks),enumerable:!0,configurable:!1,writable:!1}}),n}var _x,vx=t((()=>{hy(),Y(),hv(),_x=class{_jwks;_cached=new WeakMap;constructor(e){if(!fx(e))throw new w_(`JSON Web Key Set malformed`);this._jwks=mx(e)}async getKey(e,t){let{alg:n,kid:r}={...e,...t?.header},i=dx(n),a=this._jwks.keys.filter(e=>{let t=i===e.kty;if(t&&typeof r==`string`&&(t=r===e.kid),t&&typeof e.alg==`string`&&(t=n===e.alg),t&&typeof e.use==`string`&&(t=e.use===`sig`),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes(`verify`)),t)switch(n){case`ES256`:t=e.crv===`P-256`;break;case`ES256K`:t=e.crv===`secp256k1`;break;case`ES384`:t=e.crv===`P-384`;break;case`ES512`:t=e.crv===`P-521`;break;case`Ed25519`:t=e.crv===`Ed25519`;break;case`EdDSA`:t=e.crv===`Ed25519`||e.crv===`Ed448`;break}return t}),{0:o,length:s}=a;if(s===0)throw new T_;if(s!==1){let e=new E_,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(let e of a)try{yield await hx(t,e,n)}catch{}},e}return hx(this._cached,o,n)}}})),yx,bx=t((()=>{Y(),H(),yx=async(e,t,n)=>{let r;switch(e.protocol){case`https:`:r=jl.get;break;case`http:`:r=El.get;break;default:throw TypeError(`Unsupported URL protocol.`)}let{agent:i,headers:a}=n,o=r(e.href,{agent:i,timeout:t,headers:a}),[s]=await Promise.race([Dl(o,`response`),Dl(o,`timeout`)]);if(!s)throw o.destroy(),new D_;if(s.statusCode!==200)throw new G(`Expected 200 OK from the JSON Web Key Set HTTP response`);let c=[];for await(let e of s)c.push(e);try{return JSON.parse(p_.decode(o_(...c)))}catch{throw new G(`Failed to parse the JSON Web Key Set HTTP response as JSON`)}}}));function xx(){return typeof WebSocketPair<`u`||typeof navigator<`u`&&navigator.userAgent===`Cloudflare-Workers`||typeof EdgeRuntime<`u`&&EdgeRuntime===`vercel`}function Sx(e,t){return!(typeof e!=`object`||!e||!(`uat`in e)||typeof e.uat!=`number`||Date.now()-e.uat>=t||!(`jwks`in e)||!Q(e.jwks)||!Array.isArray(e.jwks.keys)||!Array.prototype.every.call(e.jwks.keys,Q))}function Cx(e,t){let n=new Ex(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!n._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>n._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}var wx,Tx,Ex,Dx,Ox=t((()=>{bx(),Y(),vx(),hv(),(typeof navigator>`u`||!navigator.userAgent?.startsWith?.(`Mozilla/5.0 `))&&(wx=`jose/v5.10.0`),Tx=Symbol(),Ex=class{_url;_timeoutDuration;_cooldownDuration;_cacheMaxAge;_jwksTimestamp;_pendingFetch;_options;_local;_cache;constructor(e,t){if(!(e instanceof URL))throw TypeError(`url must be an instance of URL`);this._url=new URL(e.href),this._options={agent:t?.agent,headers:t?.headers},this._timeoutDuration=typeof t?.timeoutDuration==`number`?t?.timeoutDuration:5e3,this._cooldownDuration=typeof t?.cooldownDuration==`number`?t?.cooldownDuration:3e4,this._cacheMaxAge=typeof t?.cacheMaxAge==`number`?t?.cacheMaxAge:6e5,t?.[Tx]!==void 0&&(this._cache=t?.[Tx],Sx(t?.[Tx],this._cacheMaxAge)&&(this._jwksTimestamp=this._cache.uat,this._local=gx(this._cache.jwks)))}coolingDown(){return typeof this._jwksTimestamp==`number`&&Date.now()<this._jwksTimestamp+this._cooldownDuration}fresh(){return typeof this._jwksTimestamp==`number`&&Date.now()<this._jwksTimestamp+this._cacheMaxAge}async getKey(e,t){(!this._local||!this.fresh())&&await this.reload();try{return await this._local(e,t)}catch(n){if(n instanceof T_&&this.coolingDown()===!1)return await this.reload(),this._local(e,t);throw n}}async reload(){this._pendingFetch&&xx()&&(this._pendingFetch=void 0);let e=new Headers(this._options.headers);wx&&!e.has(`User-Agent`)&&(e.set(`User-Agent`,wx),this._options.headers=Object.fromEntries(e.entries())),this._pendingFetch||=yx(this._url,this._timeoutDuration,this._options).then(e=>{this._local=gx(e),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=e),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(e=>{throw this._pendingFetch=void 0,e}),await this._pendingFetch}},Dx=Tx})),kx,Ax=t((()=>{g_(),H(),Y(),Rb(),ex(),kx=class extends $b{encode(){return`${U(JSON.stringify({alg:`none`}))}.${U(JSON.stringify(this._payload))}.`}static decode(e,t){if(typeof e!=`string`)throw new S_(`Unsecured JWT must be a string`);let{0:n,1:r,2:i,length:a}=e.split(`.`);if(a!==3||i!==``)throw new S_(`Invalid Unsecured JWT`);let o;try{if(o=JSON.parse(p_.decode(W(n))),o.alg!==`none`)throw Error()}catch{throw new S_(`Invalid Unsecured JWT`)}return{payload:Lb(o,W(r),t),header:o}}}})),jx=r({decode:()=>Nx,encode:()=>Mx}),Mx,Nx,Px=t((()=>{g_(),Mx=U,Nx=W}));function Fx(e){let t;if(typeof e==`string`){let n=e.split(`.`);(n.length===3||n.length===5)&&([t]=n)}else if(typeof e==`object`&&e)if(`protected`in e)t=e.protected;else throw TypeError(`Token does not contain a Protected Header`);try{if(typeof t!=`string`||!t)throw Error();let e=JSON.parse(p_.decode(Nx(t)));if(!Q(e))throw Error();return e}catch{throw TypeError(`Invalid Token or Protected Header formatting`)}}var Ix=t((()=>{Px(),H(),hv()}));function Lx(e){if(typeof e!=`string`)throw new S_(`JWTs must use Compact JWS serialization, JWT must be a string`);let{1:t,length:n}=e.split(`.`);if(n===5)throw new S_(`Only JWTs using Compact JWS serialization can be decoded`);if(n!==3)throw new S_(`Invalid JWT`);if(!t)throw new S_(`JWTs must contain a payload`);let r;try{r=Nx(t)}catch{throw new S_(`Failed to base64url decode the payload`)}let i;try{i=JSON.parse(p_.decode(r))}catch{throw new S_(`Failed to parse the decoded payload as JSON`)}if(!Q(i))throw new S_(`Invalid JWT Claims Set`);return i}var Rx=t((()=>{Px(),H(),hv(),Y()}));async function zx(e,t){let n;switch(e){case`HS256`:case`HS384`:case`HS512`:case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:n=parseInt(e.slice(-3),10);break;case`A128KW`:case`A192KW`:case`A256KW`:case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:case`A128GCM`:case`A192GCM`:case`A256GCM`:n=parseInt(e.slice(1,4),10);break;default:throw new K(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`)}return ul(_l(new Uint8Array(n>>3)))}async function Bx(e,t){switch(e){case`RS256`:case`RS384`:case`RS512`:case`PS256`:case`PS384`:case`PS512`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:case`RSA1_5`:{let e=t?.modulusLength??2048;if(typeof e!=`number`||e<2048)throw new K(`Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used`);return await Vx(`rsa`,{modulusLength:e,publicExponent:65537})}case`ES256`:return Vx(`ec`,{namedCurve:`P-256`});case`ES256K`:return Vx(`ec`,{namedCurve:`secp256k1`});case`ES384`:return Vx(`ec`,{namedCurve:`P-384`});case`ES512`:return Vx(`ec`,{namedCurve:`P-521`});case`Ed25519`:return Vx(`ed25519`);case`EdDSA`:switch(t?.crv){case void 0:case`Ed25519`:return Vx(`ed25519`);case`Ed448`:return Vx(`ed448`);default:throw new K(`Invalid or unsupported crv option provided, supported values are Ed25519 and Ed448`)}case`ECDH-ES`:case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{let e=t?.crv??`P-256`;switch(e){case void 0:case`P-256`:case`P-384`:case`P-521`:return Vx(`ec`,{namedCurve:e});case`X25519`:return Vx(`x25519`);case`X448`:return Vx(`x448`);default:throw new K(`Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448`)}}default:throw new K(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`)}}var Vx,Hx=t((()=>{k_(),Y(),Vx=Cl(fl)}));async function Ux(e,t){return Bx(e,t)}var Wx=t((()=>{Hx()}));async function Gx(e,t){return zx(e,t)}var Kx=t((()=>{Hx()})),qx,Jx=t((()=>{qx=`node:crypto`})),Yx,Xx=t((()=>{Jx(),Yx=qx})),Zx=r({CompactEncrypt:()=>Ub,CompactSign:()=>qb,EmbeddedJWK:()=>lx,EncryptJWT:()=>rx,FlattenedEncrypt:()=>$y,FlattenedSign:()=>Gb,GeneralEncrypt:()=>nb,GeneralSign:()=>Xb,SignJWT:()=>tx,UnsecuredJWT:()=>kx,base64url:()=>jx,calculateJwkThumbprint:()=>ax,calculateJwkThumbprintUri:()=>ox,compactDecrypt:()=>zy,compactVerify:()=>xb,createLocalJWKSet:()=>gx,createRemoteJWKSet:()=>Cx,cryptoRuntime:()=>Yx,decodeJwt:()=>Lx,decodeProtectedHeader:()=>Fx,errors:()=>__,experimental_jwksCache:()=>Dx,exportJWK:()=>Yy,exportPKCS8:()=>Jy,exportSPKI:()=>qy,flattenedDecrypt:()=>Ly,flattenedVerify:()=>yb,generalDecrypt:()=>Vy,generalVerify:()=>Cb,generateKeyPair:()=>Ux,generateSecret:()=>Gx,importJWK:()=>my,importPKCS8:()=>py,importSPKI:()=>dy,importX509:()=>fy,jwksCache:()=>Tx,jwtDecrypt:()=>Vb,jwtVerify:()=>zb}),Qx=t((()=>{By(),Ry(),Hy(),rb(),Sb(),bb(),wb(),Bb(),Hb(),Wb(),eb(),Jb(),Kb(),Zb(),nx(),ix(),cx(),ux(),vx(),Ox(),Ax(),Xy(),hy(),Ix(),Rx(),Y(),Wx(),Kx(),Px(),Xx()})),$x=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{verifyVercelOidcToken:()=>h}),t.exports=c(l);var u=(Qx(),c(Zx));let d=`https://oidc.vercel.com`,f=new URL(`https://oidc.vercel.com/.well-known/jwks`),p=[`RS256`],m=(0,u.createRemoteJWKSet)(f);async function h(e,t){let{algorithms:n,projectId:r=process.env.VERCEL_PROJECT_ID,environment:i=process.env.VERCEL_TARGET_ENV||process.env.VERCEL_ENV,ownerId:a,...o}=t??{};if(r===`*`&&a===void 0&&!g(o.audience))throw TypeError(`Expected ownerId or audience to be provided when projectId is '*'.`);let s=await(0,u.jwtVerify)(e,m,{...o,algorithms:n??p});return _(s.payload.iss),v({actual:s.payload.project_id,claim:`project_id`,env:`VERCEL_PROJECT_ID`,expected:r,option:`projectId`}),v({actual:s.payload.environment,claim:`environment`,env:`VERCEL_TARGET_ENV or VERCEL_ENV`,expected:i,option:`environment`}),y({actual:s.payload.owner_id,claim:`owner_id`,expected:a}),s}function g(e){return Array.isArray(e)?e.length>0:e!==void 0}function _(e){if(e!==d&&(typeof e!=`string`||!e.startsWith(`${d}/`)))throw TypeError(`Expected Vercel OIDC token iss claim to be "${d}" or to start with "${d}/".`)}function v({actual:e,claim:t,env:n,expected:r,option:i}){if(r!==`*`){if(r===void 0||r.length===0)throw TypeError(`Expected ${n} to be set or ${i} to be provided. Pass ${i}: '*' to allow any ${t} claim.`);if(!(Array.isArray(r)&&typeof e==`string`&&r.includes(e))&&e!==r)throw TypeError(Array.isArray(r)?`Expected Vercel OIDC token ${t} claim to be one of: ${r.map(e=>`"${e}"`).join(`, `)}.`:`Expected Vercel OIDC token ${t} claim to be "${r}".`)}}function y({actual:e,claim:t,expected:n}){if(n!==void 0&&e!==n)throw TypeError(`Expected Vercel OIDC token ${t} claim to be "${n}".`)}0&&(t.exports={verifyVercelOidcToken:h})})),eS=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>m.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>m.RefreshAccessTokenFailedError,exchangeVercelOidcToken:()=>h.exchangeVercelOidcToken,getContext:()=>f.getContext,getVercelOidcToken:()=>u.getVercelOidcToken,getVercelOidcTokenSync:()=>d.getVercelOidcTokenSync,getVercelToken:()=>g.getVercelToken,verifyVercelOidcToken:()=>p.verifyVercelOidcToken}),t.exports=c(l);var u=r_(),d=n_(),f=t_(),p=$x(),m=Zc(),h=e_(),g=Qc();0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,exchangeVercelOidcToken,getContext,getVercelOidcToken,getVercelOidcTokenSync,getVercelToken,verifyVercelOidcToken})})),tS=n(Qg(),1),nS=eS();async function rS(e){let t=0,n=e.getReader(),r=[];try{for(;;){let{done:e,value:i}=await n.read();if(e)break;r.push(i),t+=i.length}}finally{n.releaseLock()}return Buffer.concat(r,t)}var iS=class{contentType=`application/json`;replacer;reviver;constructor(e={}){this.replacer=e.replacer,this.reviver=e.reviver}serialize(e){return Buffer.from(JSON.stringify(e,this.replacer),`utf8`)}async deserialize(e){let t=await rS(e);return JSON.parse(t.toString(`utf8`),this.reviver)}},aS=class extends Error{constructor(e){super(`Message ${e} not found`),this.name=`MessageNotFoundError`}},oS=class extends Error{constructor(e,t){super(`Message ${e} not available for processing${t?`: ${t}`:``}`),this.name=`MessageNotAvailableError`}},sS=class extends Error{constructor(e,t){super(`Message ${e} is corrupted: ${t}`),this.name=`MessageCorruptedError`}},cS=class extends Error{retryAfter;constructor(e=`Too many requests`,t){super(e),this.name=`TooManyRequestsError`,this.retryAfter=t}},lS=class extends Error{constructor(e=`Missing or invalid authentication token`){super(e),this.name=`UnauthorizedError`}},uS=class extends Error{constructor(e=`Queue environment doesn't match token environment`){super(e),this.name=`ForbiddenError`}},dS=class extends Error{constructor(e){super(e),this.name=`BadRequestError`}},fS=class extends Error{constructor(e=`Unexpected server error`){super(e),this.name=`InternalServerError`}},pS=class extends Error{constructor(e,t=1,n=10){super(`Invalid limit: ${e}. Limit must be between ${t} and ${n}.`),this.name=`InvalidLimitError`}},mS=class extends Error{constructor(e){super(`Message ${e} has already been processed`),this.name=`MessageAlreadyProcessedError`}},hS=class extends Error{idempotencyKey;constructor(e,t){super(e),this.name=`DuplicateMessageError`,this.idempotencyKey=t}},gS=class extends Error{deploymentId;constructor(e,t){super(e),this.name=`ConsumerDiscoveryError`,this.deploymentId=t}},_S=class extends Error{constructor(e=`Consumer registry not configured`){super(e),this.name=`ConsumerRegistryNotConfiguredError`}},vS=300,yS=30,bS=60,xS=10,SS=3e3,CS=3,wS=250;function TS(e){return Math.min(bS,Math.max(xS,e/5))}var ES=class{client;topicName;consumerGroupName;visibilityTimeout;constructor(e,t,n,r={}){this.client=e,this.topicName=t,this.consumerGroupName=n,this.visibilityTimeout=Math.max(yS,r.visibilityTimeoutSeconds??vS)}isClientError(e){return e instanceof oS||e instanceof aS||e instanceof dS||e instanceof lS||e instanceof uS}isNetworkError(e){return e instanceof TypeError}async directiveCallWithRetries(e){let t;for(let n=1;n<=CS;n++)try{return await e()}catch(e){if(t=e,n===CS)throw e;if(e instanceof cS){if(e.retryAfter===void 0)throw e;await new Promise(t=>setTimeout(t,e.retryAfter*1e3));continue}if(!this.isNetworkError(e))throw e;let r=wS*n,i=r/2+r/2*Math.random();await new Promise(e=>setTimeout(e,i))}throw t}startVisibilityExtension(e,t){let n=!0,r=!1,i,a=null,o=TS(this.visibilityTimeout)*1e3,s=o;if(t?.visibilityDeadline){let e=t.visibilityDeadline.getTime()-Date.now();s=e>0?TS(e/1e3)*1e3:0}let c=new Promise(e=>{i=e}),l=()=>{r||(r=!0,i())},u=async()=>{if(!n){l();return}try{await this.client.changeVisibility({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e,visibilityTimeoutSeconds:this.visibilityTimeout}),n?a=setTimeout(()=>u(),o):l()}catch(t){if(this.isClientError(t)){console.error(`Visibility extension failed with client error for receipt handle ${e} (stopping retries):`,t),l();return}console.error(`Failed to extend visibility for receipt handle ${e} (will retry in ${SS/1e3}s):`,t),n?a=setTimeout(()=>u(),SS):l()}};return a=setTimeout(()=>u(),s),async(e=!1)=>{n=!1,a&&=(clearTimeout(a),null),e?await c:l()}}async finalizePayload(e){let t=this.client.getTransport();if(t.finalize&&e!=null)try{await t.finalize(e)}catch(e){console.warn(`Failed to finalize message payload:`,e)}}async processMessage(e,t,n){let r=this.startVisibilityExtension(e.receiptHandle,n),i={messageId:e.messageId,deliveryCount:e.deliveryCount,createdAt:e.createdAt,expiresAt:e.expiresAt??new Date(e.createdAt.getTime()+864e5),topicName:this.topicName,consumerGroup:this.consumerGroupName,region:this.client.getRegion()};try{await t(e.payload,i),await r(),await this.client.acknowledgeMessage({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle})}catch(t){if(await r(),n?.retry){let r;try{r=n.retry(t,i)}catch(e){console.warn(`retry handler threw:`,e)}if(r){if(`acknowledge`in r&&r.acknowledge){try{await this.directiveCallWithRetries(()=>this.client.acknowledgeMessage({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle}))}catch(e){console.warn(`Failed to acknowledge message:`,e)}await this.finalizePayload(e.payload);return}if(`afterSeconds`in r&&typeof r.afterSeconds==`number`){try{await this.directiveCallWithRetries(()=>this.client.changeVisibility({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle,visibilityTimeoutSeconds:r.afterSeconds}))}catch(e){console.warn(`Failed to reschedule message for retry:`,e)}await this.finalizePayload(e.payload);return}}}throw await this.finalizePayload(e.payload),t}}async consumeMessage(e,t,n){await this.processMessage(t,e,n)}async consume(e,t){let n=t?.retry;if(t&&`messageId`in t){let r=await this.client.receiveMessageById({queueName:this.topicName,consumerGroup:this.consumerGroupName,messageId:t.messageId,visibilityTimeoutSeconds:this.visibilityTimeout});return await this.processMessage(r.message,e,{retry:n}),1}else{let r=t&&`limit`in t?t.limit:1,i=0;for await(let t of this.client.receiveMessages({queueName:this.topicName,consumerGroup:this.consumerGroupName,visibilityTimeoutSeconds:this.visibilityTimeout,limit:r}))i++,await this.processMessage(t,e,{retry:n});return i}}get name(){return this.consumerGroupName}get topic(){return this.topicName}},DS=class{client;topicName;constructor(e,t){this.client=e,this.topicName=t}async publish(e,t){let n=await this.client.sendMessage({queueName:this.topicName,payload:e,idempotencyKey:t?.idempotencyKey,retentionSeconds:t?.retentionSeconds,delaySeconds:t?.delaySeconds,headers:t?.headers,telemetry:t?.telemetry});return n.messageId&&VS()&&DC(this.topicName,n.messageId,this.client.getRegion(),t?.delaySeconds,t?.retentionSeconds),{messageId:n.messageId}}consumerGroup(e,t){return new ES(this.client,this.topicName,e,t)}get name(){return this.topicName}},OS=`com.vercel.queue.v1beta`,kS=`com.vercel.queue.v2beta`;function AS(e,t){let n=t.slice(0,-1);return e.startsWith(n)}function jS(e){return typeof e==`object`&&!!e}function MS(e,t){if(!t||!t.includes(`application/cloudevents+json`))throw Error(`Invalid content type: expected 'application/cloudevents+json'`);if(!jS(e)||!e.type||!e.source||!e.id||!jS(e.data))throw Error(`Invalid CloudEvent: missing required fields`);if(e.type!==`com.vercel.queue.v1beta`)throw Error(`Invalid CloudEvent type: expected '${OS}', got '${String(e.type)}'`);let{data:n}=e,r=[];if(`queueName`in n||r.push(`queueName`),`consumerGroup`in n||r.push(`consumerGroup`),`messageId`in n||r.push(`messageId`),r.length>0)throw Error(`Missing required CloudEvent data fields: ${r.join(`, `)}`);return{queueName:String(n.queueName),consumerGroup:String(n.consumerGroup),messageId:String(n.messageId)}}function NS(e,t){if(e instanceof Headers)return e.get(t);let n=e[t];return Array.isArray(n)?n[0]??null:n??null}function PS(e){let t=NS(e,`ce-type`);if(t!==`com.vercel.queue.v2beta`)throw Error(`Invalid CloudEvent type: expected '${kS}', got '${t}'`);let n=NS(e,`ce-vqsqueuename`),r=NS(e,`ce-vqsconsumergroup`),i=NS(e,`ce-vqsmessageid`),a=[];if(n||a.push(`ce-vqsqueuename`),r||a.push(`ce-vqsconsumergroup`),i||a.push(`ce-vqsmessageid`),a.length>0)throw Error(`Missing required CloudEvent headers: ${a.join(`, `)}`);let o=NS(e,`ce-vqsregion`)??void 0;if(o!==void 0&&!/^[a-z]{2,5}[0-9]{1,2}$/.test(o))throw Error(`Invalid ce-vqsregion header: ${JSON.stringify(o)}. Region must match /^[a-z]{2,5}[0-9]{1,2}$/ (e.g. "iad1", "lhr1").`);let s={queueName:n,consumerGroup:r,messageId:i,region:o},c=NS(e,`ce-vqsreceipthandle`);if(!c)return s;let l={...s,receiptHandle:c},u=NS(e,`ce-vqsdeliverycount`);u&&(l.deliveryCount=parseInt(u,10));let d=NS(e,`ce-vqscreatedat`);d&&(l.createdAt=d);let f=NS(e,`ce-vqsexpiresat`);f&&(l.expiresAt=f);let p=NS(e,`content-type`);p&&(l.contentType=p);let m=NS(e,`ce-vqsvisibilitydeadline`);return m&&(l.visibilityDeadline=m),l}function FS(e,t){if(NS(t,`ce-type`)===`com.vercel.queue.v2beta`){let n=PS(t);return`receiptHandle`in n&&(n.parsedPayload=e),n}return MS(e,NS(t,`content-type`))}async function IS(e){if(e.headers.get(`ce-type`)===`com.vercel.queue.v2beta`){let t=PS(e.headers);return`receiptHandle`in t&&e.body&&(t.rawBody=e.body),t}let t;try{t=await e.json()}catch{throw Error(`Failed to parse CloudEvent from request body`)}let n={};return e.headers.forEach((e,t)=>{n[t]=e}),FS(t,n)}async function LS(e,t,n){let{queueName:r,consumerGroup:i,messageId:a}=t;if(!n?.client)throw Error(`HandleCallbackOptions.client is required`);let o=ow(n.client);t.region&&(o=o.withRegion(t.region));let s=new DS(o,r).consumerGroup(i,n?.visibilityTimeoutSeconds===void 0?void 0:{visibilityTimeoutSeconds:n.visibilityTimeoutSeconds});if(`receiptHandle`in t){let r=o.getTransport(),i;if(t.rawBody)i=await r.deserialize(t.rawBody);else if(t.parsedPayload!==void 0)i=t.parsedPayload;else throw Error(`Binary mode callback with receipt handle is missing payload`);let c={messageId:a,payload:i,deliveryCount:t.deliveryCount??1,createdAt:t.createdAt?new Date(t.createdAt):new Date,expiresAt:t.expiresAt?new Date(t.expiresAt):void 0,contentType:t.contentType??r.contentType,receiptHandle:t.receiptHandle},l=t.visibilityDeadline?new Date(t.visibilityDeadline):void 0;await s.consumeMessage(e,c,{visibilityDeadline:l,retry:n?.retry})}else await s.consume(e,{messageId:a,retry:n?.retry})}var $=tS.default.cyan(`[queue]`),RS=tS.default.green(`✓`),zS=tS.default.red(`✗`),BS=tS.default.yellow(`↻`);function VS(){return process.env.NODE_ENV===`development`&&process.env.VERCEL_DEPLOYMENT_ID===void 0}var HS=Symbol.for(`@vercel/queue.devRouteMappings`);function US(e){let t=``;for(let n of e)n===`_`?t+=`__`:n===`/`?t+=`_S`:n===`.`?t+=`_D`:/[A-Za-z0-9-]/.test(n)?t+=n:t+=`_`+n.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`);return t}function WS(){let e=globalThis;if(HS in e)return e[HS]??null;try{let t=el.join(process.cwd(),`vercel.json`);if(!kl.existsSync(t))return e[HS]=null,null;let n=JSON.parse(kl.readFileSync(t,`utf-8`));if(!n.functions)return e[HS]=null,null;let r=[];for(let[e,t]of Object.entries(n.functions))if(t.experimentalTriggers){for(let n of t.experimentalTriggers)if(!(!n.type?.startsWith(`queue/`)||!n.topic)){if(n.type!==`queue/v2beta`){console.warn(`${$} Unsupported trigger type "${n.type}" for topic "${n.topic}" in ${e}. Use "queue/v2beta" instead.`);continue}r.push({filePath:e,topic:n.topic,consumer:US(e),retryAfterSeconds:n.retryAfterSeconds})}}return e[HS]=r.length>0?r:null,e[HS]}catch(t){return console.warn(`${$} Failed to read vercel.json:`,t),e[HS]=null,null}}function GS(e){let t=WS();return t?t.filter(t=>t.topic.includes(`*`)?AS(e,t.topic):t.topic===e):[]}function KS(e,t){return GS(e).find(e=>e.consumer===t)?.retryAfterSeconds}function qS(e){return/^src\/(app|pages|server)\//.test(e)?e.slice(4):null}function JS(e,t){return e===t||z(e,t)}function YS(e){let t=WS();if(!t)return[];let n=process.cwd(),r;try{r=el.relative(n,e)}catch{return[]}let i=r.replace(/\\/g,`/`),a=qS(i);return t.filter(e=>JS(i,e.filePath)||a!==null&&JS(a,e.filePath))}function XS(e){let t=e.match(/\((.+?):\d+:\d+\)/);if(t||=e.match(/at\s+(.+?):\d+:\d+/),!t)return null;let n=t[1].trim();if(n===`native`||n.startsWith(`node:`)||n.startsWith(`internal`))return null;if(n.startsWith(`file://`))try{n=new URL(n).pathname}catch{return null}return/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(n)?null:(n.startsWith(`./`)&&(n=n.slice(2)),n)}var ZS;function QS(){if(ZS)return ZS;try{let e=typeof __dirname<`u`?__dirname:el.dirname(new URL(import.meta.url).pathname);ZS=el.resolve(e,`..`)}catch{ZS=``}return ZS}function $S(){let e=Error().stack;if(!e)return null;let t=e.split(`
|
|
13
|
-
`).slice(1),n=
|
|
11
|
+
`)(e,n),a=2),i===-1){let t=e.subarray(n);if(t.length>this.maxHeaderSize)throw new z(`Headers too large: ${t.length} > ${this.maxHeaderSize} bytes`);this.buffer=t;break}let o=e.subarray(n,i);this.currentHeaders=Oh(o);let s=this.createStreamingMessage();t.push(s),n=i+a,this.state=3;continue}if(this.state===0){if(r<this.openingBoundaryLength){if(e.length>this.maxBoundaryBuffer)throw new z(`Initial chunk too large for boundary detection: ${e.length} > ${this.maxBoundaryBuffer}`);this.buffer=e;break}if(this.findOpeningBoundary(e)!==0)throw new z(`Invalid multipart stream: missing initial boundary`);n=this.openingBoundaryLength,this.state=1}}return t}createStreamingMessage(){let e=new Headers(this.currentHeaders),t=new ReadableStream({start:e=>{this.currentPayloadController=e}});return this.currentHeaders=new Headers,{headers:e,payload:t}}writeBody(e){this.currentPayloadController&&this.currentPayloadController.enqueue(e)}finishMessage(){this.currentPayloadController&&=(this.currentPayloadController.close(),null)}closeCurrentPayload(e){if(this.currentPayloadController){try{e?this.currentPayloadController.error(e):this.currentPayloadController.close()}catch{}this.currentPayloadController=null}}};const Nh=(e,t,n)=>{let r=e instanceof RegExp?Ph(e,n):e,i=t instanceof RegExp?Ph(t,n):t,a=r!==null&&i!=null&&Fh(r,i,n);return a&&{start:a[0],end:a[1],pre:n.slice(0,a[0]),body:n.slice(a[0]+r.length,a[1]),post:n.slice(a[1]+i.length)}},Ph=(e,t)=>{let n=t.match(e);return n?n[0]:null},Fh=(e,t,n)=>{let r,i,a,o,s,c=n.indexOf(e),l=n.indexOf(t,c+1),u=c;if(c>=0&&l>0){if(e===t)return[c,l];for(r=[],a=n.length;u>=0&&!s;){if(u===c)r.push(u),c=n.indexOf(e,u+1);else if(r.length===1){let e=r.pop();e!==void 0&&(s=[e,l])}else i=r.pop(),i!==void 0&&i<a&&(a=i,o=l),l=n.indexOf(t,u+1);u=c<l&&c>=0?c:l}r.length&&o!==void 0&&(s=[a,o])}return s},Ih=`\0SLASH`+Math.random()+`\0`,Lh=`\0OPEN`+Math.random()+`\0`,Rh=`\0CLOSE`+Math.random()+`\0`,zh=`\0COMMA`+Math.random()+`\0`,Bh=`\0PERIOD`+Math.random()+`\0`,Vh=new RegExp(Ih,`g`),Hh=new RegExp(Lh,`g`),Uh=new RegExp(Rh,`g`),Wh=new RegExp(zh,`g`),Gh=new RegExp(Bh,`g`),Kh=/\\\\/g,qh=/\\{/g,Jh=/\\}/g,Yh=/\\,/g,Xh=/\\\./g;function Zh(e){return isNaN(e)?e.charCodeAt(0):parseInt(e,10)}function Qh(e){return e.replace(Kh,Ih).replace(qh,Lh).replace(Jh,Rh).replace(Yh,zh).replace(Xh,Bh)}function $h(e){return e.replace(Vh,`\\`).replace(Hh,`{`).replace(Uh,`}`).replace(Wh,`,`).replace(Gh,`.`)}function eg(e){if(!e)return[``];let t=[],n=Nh(`{`,`}`,e);if(!n)return e.split(`,`);let{pre:r,body:i,post:a}=n,o=r.split(`,`);o[o.length-1]+=`{`+i+`}`;let s=eg(a);return a.length&&(o[o.length-1]+=s.shift(),o.push.apply(o,s)),t.push.apply(t,o),t}function tg(e,t={}){if(!e)return[];let{max:n=1e5}=t;return e.slice(0,2)===`{}`&&(e=`\\{\\}`+e.slice(2)),og(Qh(e),n,!0).map($h)}function ng(e){return`{`+e+`}`}function rg(e){return/^-?0\d/.test(e)}function ig(e,t){return e<=t}function ag(e,t){return e>=t}function og(e,t,n){let r=[];for(;;){let i=Nh(`{`,`}`,e);if(!i)return[e];let a=i.pre;if(/\$$/.test(i.pre)){let e=i.post.length?og(i.post,t,!1):[``];for(let n=0;n<e.length&&n<t;n++){let t=a+`{`+i.body+`}`+e[n];r.push(t)}return r}let o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),s=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),c=o||s,l=i.body.indexOf(`,`)>=0;if(!c&&!l){if(i.post.match(/,(?!,).*\}/)){e=i.pre+`{`+i.body+Rh+i.post,n=!0;continue}return[e]}let u=i.post.length?og(i.post,t,!1):[``],d;if(c)d=i.body.split(/\.\./);else if(d=eg(i.body),d.length===1&&d[0]!==void 0&&(d=og(d[0],t,!1).map(ng),d.length===1))return u.map(e=>i.pre+d[0]+e);let f;if(c&&d[0]!==void 0&&d[1]!==void 0){let e=Zh(d[0]),n=Zh(d[1]),r=Math.max(d[0].length,d[1].length),i=d.length===3&&d[2]!==void 0?Math.max(Math.abs(Zh(d[2])),1):1,a=ig;n<e&&(i*=-1,a=ag);let o=d.some(rg);f=[];for(let c=e;a(c,n)&&f.length<t;c+=i){let e;if(s)e=String.fromCharCode(c),e===`\\`&&(e=``);else if(e=String(c),o){let t=r-e.length;if(t>0){let n=Array(t+1).join(`0`);e=c<0?`-`+n+e.slice(1):n+e}}f.push(e)}}else{f=[];for(let e=0;e<d.length;e++)f.push.apply(f,og(d[e],t,!1))}for(let e=0;e<f.length;e++)for(let i=0;i<u.length&&r.length<t;i++){let t=a+f[e]+u[i];(!n||c||t)&&r.push(t)}return r}}const sg=e=>{if(typeof e!=`string`)throw TypeError(`invalid pattern`);if(e.length>65536)throw TypeError(`pattern is too long`)},cg={"[:alnum:]":[`\\p{L}\\p{Nl}\\p{Nd}`,!0],"[:alpha:]":[`\\p{L}\\p{Nl}`,!0],"[:ascii:]":[`\\x00-\\x7f`,!1],"[:blank:]":[`\\p{Zs}\\t`,!0],"[:cntrl:]":[`\\p{Cc}`,!0],"[:digit:]":[`\\p{Nd}`,!0],"[:graph:]":[`\\p{Z}\\p{C}`,!0,!0],"[:lower:]":[`\\p{Ll}`,!0],"[:print:]":[`\\p{C}`,!0],"[:punct:]":[`\\p{P}`,!0],"[:space:]":[`\\p{Z}\\t\\r\\n\\v\\f`,!0],"[:upper:]":[`\\p{Lu}`,!0],"[:word:]":[`\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}`,!0],"[:xdigit:]":[`A-Fa-f0-9`,!1]},lg=e=>e.replace(/[[\]\\-]/g,`\\$&`),ug=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),dg=e=>e.join(``),fg=(e,t)=>{let n=t;if(e.charAt(n)!==`[`)throw Error(`not in a brace expression`);let r=[],i=[],a=n+1,o=!1,s=!1,c=!1,l=!1,u=n,d=``;WHILE:for(;a<e.length;){let t=e.charAt(a);if((t===`!`||t===`^`)&&a===n+1){l=!0,a++;continue}if(t===`]`&&o&&!c){u=a+1;break}if(o=!0,t===`\\`&&!c){c=!0,a++;continue}if(t===`[`&&!c){for(let[t,[o,c,l]]of Object.entries(cg))if(e.startsWith(t,a)){if(d)return[`$.`,!1,e.length-n,!0];a+=t.length,l?i.push(o):r.push(o),s||=c;continue WHILE}}if(c=!1,d){t>d?r.push(lg(d)+`-`+lg(t)):t===d&&r.push(lg(t)),d=``,a++;continue}if(e.startsWith(`-]`,a+1)){r.push(lg(t+`-`)),a+=2;continue}if(e.startsWith(`-`,a+1)){d=t,a+=2;continue}r.push(lg(t)),a++}if(u<a)return[``,!1,0,!1];if(!r.length&&!i.length)return[`$.`,!1,e.length-n,!0];if(i.length===0&&r.length===1&&/^\\?.$/.test(r[0])&&!l){let e=r[0].length===2?r[0].slice(-1):r[0];return[ug(e),!1,u-n,!1]}let f=`[`+(l?`^`:``)+dg(r)+`]`,p=`[`+(l?``:`^`)+dg(i)+`]`;return[r.length&&i.length?`(`+f+`|`+p+`)`:r.length?f:p,s,u-n,!0]},pg=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!0}={})=>n?t?e.replace(/\[([^/\\])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\])\]/g,`$1$2`).replace(/\\([^/])/g,`$1`):t?e.replace(/\[([^/\\{}])\]/g,`$1`):e.replace(/((?!\\).|^)\[([^/\\{}])\]/g,`$1$2`).replace(/\\([^/{}])/g,`$1`);var mg;const hg=new Set([`!`,`?`,`+`,`*`,`@`]),gg=e=>hg.has(e),_g=e=>gg(e.type),vg=new Map([[`!`,[`@`]],[`?`,[`?`,`@`]],[`@`,[`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`]]]),yg=new Map([[`!`,[`?`]],[`@`,[`?`]],[`+`,[`?`,`*`]]]),bg=new Map([[`!`,[`?`,`@`]],[`?`,[`?`,`@`]],[`@`,[`?`,`@`]],[`*`,[`*`,`+`,`?`,`@`]],[`+`,[`+`,`@`,`?`,`*`]]]),xg=new Map([[`!`,new Map([[`!`,`@`]])],[`?`,new Map([[`*`,`*`],[`+`,`*`]])],[`@`,new Map([[`!`,`!`],[`?`,`?`],[`@`,`@`],[`*`,`*`],[`+`,`+`]])],[`+`,new Map([[`?`,`*`],[`*`,`*`]])]]),Sg=`(?!\\.)`,Cg=new Set([`[`,`.`]),wg=new Set([`..`,`.`]),Tg=new Set(`().*{}+?[]^$\\!`),Eg=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`),Dg=`[^/]+?`;let Og=0;var kg=class{type;#e;#t;#n=!1;#r=[];#i;#a;#o;#s=!1;#c;#l;#u=!1;id=++Og;get depth(){return(this.#i?.depth??-1)+1}[Symbol.for(`nodejs.util.inspect.custom`)](){return{"@@type":`AST`,id:this.id,type:this.type,root:this.#e.id,parent:this.#i?.id,depth:this.depth,partsLength:this.#r.length,parts:this.#r}}constructor(e,t,n={}){this.type=e,e&&(this.#t=!0),this.#i=t,this.#e=this.#i?this.#i.#e:this,this.#c=this.#e===this?n:this.#e.#c,this.#o=this.#e===this?[]:this.#e.#o,e===`!`&&!this.#e.#s&&this.#o.push(this),this.#a=this.#i?this.#i.#r.length:0}get hasMagic(){if(this.#t!==void 0)return this.#t;for(let e of this.#r)if(typeof e!=`string`&&(e.type||e.hasMagic))return this.#t=!0;return this.#t}toString(){return this.#l===void 0?this.type?this.#l=this.type+`(`+this.#r.map(e=>String(e)).join(`|`)+`)`:this.#l=this.#r.map(e=>String(e)).join(``):this.#l}#d(){if(this!==this.#e)throw Error(`should only call on root`);if(this.#s)return this;this.toString(),this.#s=!0;let e;for(;e=this.#o.pop();){if(e.type!==`!`)continue;let t=e,n=t.#i;for(;n;){for(let r=t.#a+1;!n.type&&r<n.#r.length;r++)for(let t of e.#r){if(typeof t==`string`)throw Error(`string part in extglob AST??`);t.copyIn(n.#r[r])}t=n,n=t.#i}}return this}push(...e){for(let t of e)if(t!==``){if(typeof t!=`string`&&!(t instanceof mg&&t.#i===this))throw Error(`invalid part: `+t);this.#r.push(t)}}toJSON(){let e=this.type===null?this.#r.slice().map(e=>typeof e==`string`?e:e.toJSON()):[this.type,...this.#r.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#e||this.#e.#s&&this.#i?.type===`!`)&&e.push({}),e}isStart(){if(this.#e===this)return!0;if(!this.#i?.isStart())return!1;if(this.#a===0)return!0;let e=this.#i;for(let t=0;t<this.#a;t++){let n=e.#r[t];if(!(n instanceof mg&&n.type===`!`))return!1}return!0}isEnd(){if(this.#e===this||this.#i?.type===`!`)return!0;if(!this.#i?.isEnd())return!1;if(!this.type)return this.#i?.isEnd();let e=this.#i?this.#i.#r.length:0;return this.#a===e-1}copyIn(e){typeof e==`string`?this.push(e):this.push(e.clone(this))}clone(e){let t=new mg(this.type,e);for(let e of this.#r)t.copyIn(e);return t}static#f(e,t,n,r,i){let a=r.maxExtglobRecursion??2,o=!1,s=!1,c=-1,l=!1;if(t.type===null){let u=n,d=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,d+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),d+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,d+=n;continue}if(!r.noext&&gg(n)&&e.charAt(u)===`(`&&i<=a){t.push(d),d=``;let a=new mg(n,t);u=mg.#f(e,a,u,r,i+1),t.push(a);continue}d+=n}return t.push(d),u}let u=n+1,d=new mg(null,t),f=[],p=``;for(;u<e.length;){let n=e.charAt(u++);if(o||n===`\\`){o=!o,p+=n;continue}if(s){u===c+1?(n===`^`||n===`!`)&&(l=!0):n===`]`&&!(u===c+2&&l)&&(s=!1),p+=n;continue}else if(n===`[`){s=!0,c=u,l=!1,p+=n;continue}if(!r.noext&&gg(n)&&e.charAt(u)===`(`&&(i<=a||t&&t.#h(n))){let a=t&&t.#h(n)?0:1;d.push(p),p=``;let o=new mg(n,d);d.push(o),u=mg.#f(e,o,u,r,i+a);continue}if(n===`|`){d.push(p),p=``,f.push(d),d=new mg(null,t);continue}if(n===`)`)return p===``&&t.#r.length===0&&(t.#u=!0),d.push(p),p=``,t.push(...f,d),u;p+=n}return t.type=null,t.#t=void 0,t.#r=[e.substring(n-1)],u}#p(e){return this.#m(e,yg)}#m(e,t=vg){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null)return!1;let n=e.#r[0];return!n||typeof n!=`object`||n.type===null?!1:this.#h(n.type,t)}#h(e,t=bg){return!!t.get(this.type)?.includes(e)}#g(e,t){let n=e.#r[0],r=new mg(null,n,this.options);r.#r.push(``),n.push(r),this.#_(e,t)}#_(e,t){let n=e.#r[0];this.#r.splice(t,1,...n.#r);for(let e of n.#r)typeof e==`object`&&(e.#i=this);this.#l=void 0}#v(e){return!!xg.get(this.type)?.has(e)}#y(e){if(!e||typeof e!=`object`||e.type!==null||e.#r.length!==1||this.type===null||this.#r.length!==1)return!1;let t=e.#r[0];return!t||typeof t!=`object`||t.type===null?!1:this.#v(t.type)}#b(e){let t=xg.get(this.type),n=e.#r[0],r=t?.get(n.type);if(!r)return!1;this.#r=n.#r;for(let e of this.#r)typeof e==`object`&&(e.#i=this);this.type=r,this.#l=void 0,this.#u=!1}static fromGlob(e,t={}){let n=new mg(null,void 0,t);return mg.#f(e,n,0,t,0),n}toMMPattern(){if(this!==this.#e)return this.#e.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();if(!(r||this.#t||this.#c.nocase&&!this.#c.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()))return n;let a=(this.#c.nocase?`i`:``)+(i?`u`:``);return Object.assign(RegExp(`^${t}$`,a),{_src:t,_glob:e})}get options(){return this.#c}toRegExpSource(e){let t=e??!!this.#c.dot;if(this.#e===this&&(this.#x(),this.#d()),!_g(this)){let n=this.isStart()&&this.isEnd()&&!this.#r.some(e=>typeof e!=`string`),r=this.#r.map(t=>{let[r,i,a,o]=typeof t==`string`?mg.#C(t,this.#t,n):t.toRegExpSource(e);return this.#t=this.#t||a,this.#n=this.#n||o,r}).join(``),i=``;if(this.isStart()&&typeof this.#r[0]==`string`&&!(this.#r.length===1&&wg.has(this.#r[0]))){let n=Cg,a=t&&n.has(r.charAt(0))||r.startsWith(`\\.`)&&n.has(r.charAt(2))||r.startsWith(`\\.\\.`)&&n.has(r.charAt(4)),o=!t&&!e&&n.has(r.charAt(0));i=a?`(?!(?:^|/)\\.\\.?(?:$|/))`:o?Sg:``}let a=``;return this.isEnd()&&this.#e.#s&&this.#i?.type===`!`&&(a=`(?:$|\\/)`),[i+r+a,pg(r),this.#t=!!this.#t,this.#n]}let n=this.type===`*`||this.type===`+`,r=this.type===`!`?`(?:(?!(?:`:`(?:`,i=this.#S(t);if(this.isStart()&&this.isEnd()&&!i&&this.type!==`!`){let e=this.toString(),t=this;return t.#r=[e],t.type=null,t.#t=void 0,[e,pg(this.toString()),!1,!1]}let a=!n||e||t?``:this.#S(!0);a===i&&(a=``),a&&(i=`(?:${i})(?:${a})*?`);let o=``;if(this.type===`!`&&this.#u)o=(this.isStart()&&!t?Sg:``)+Dg;else{let n=this.type===`!`?`))`+(this.isStart()&&!t&&!e?Sg:``)+`[^/]*?)`:this.type===`@`?`)`:this.type===`?`?`)?`:this.type===`+`&&a?`)`:this.type===`*`&&a?`)?`:`)${this.type}`;o=r+i+n}return[o,pg(i),this.#t=!!this.#t,this.#n]}#x(){if(_g(this)){let e=0,t=!1;do{t=!0;for(let e=0;e<this.#r.length;e++){let n=this.#r[e];typeof n==`object`&&(n.#x(),this.#m(n)?(t=!1,this.#_(n,e)):this.#p(n)?(t=!1,this.#g(n,e)):this.#y(n)&&(t=!1,this.#b(n)))}}while(!t&&++e<10)}else for(let e of this.#r)typeof e==`object`&&e.#x();this.#l=void 0}#S(e){return this.#r.map(t=>{if(typeof t==`string`)throw Error(`string type in extglob ast??`);let[n,r,i,a]=t.toRegExpSource(e);return this.#n=this.#n||a,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join(`|`)}static#C(e,t,n=!1){let r=!1,i=``,a=!1,o=!1;for(let s=0;s<e.length;s++){let c=e.charAt(s);if(r){r=!1,i+=(Tg.has(c)?`\\`:``)+c;continue}if(c===`*`){if(o)continue;o=!0,i+=n&&/^[*]+$/.test(e)?Dg:`[^/]*?`,t=!0;continue}else o=!1;if(c===`\\`){s===e.length-1?i+=`\\\\`:r=!0;continue}if(c===`[`){let[n,r,o,c]=fg(e,s);if(o){i+=n,a||=r,s+=o-1,t||=c;continue}}if(c===`?`){i+=`[^/]`,t=!0;continue}i+=Eg(c)}return[i,pg(e),!!t,a]}};mg=kg;const Ag=(e,{windowsPathsNoEscape:t=!1,magicalBraces:n=!1}={})=>n?t?e.replace(/[?*()[\]{}]/g,`[$&]`):e.replace(/[?*()[\]\\{}]/g,`\\$&`):t?e.replace(/[?*()[\]]/g,`[$&]`):e.replace(/[?*()[\]\\]/g,`\\$&`),B=(e,t,n={})=>(sg(t),!n.nocomment&&t.charAt(0)===`#`?!1:new i_(t,n).match(e)),jg=/^\*+([^+@!?*[(]*)$/,Mg=e=>t=>!t.startsWith(`.`)&&t.endsWith(e),Ng=e=>t=>t.endsWith(e),Pg=e=>(e=e.toLowerCase(),t=>!t.startsWith(`.`)&&t.toLowerCase().endsWith(e)),Fg=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),Ig=/^\*+\.\*+$/,Lg=e=>!e.startsWith(`.`)&&e.includes(`.`),Rg=e=>e!==`.`&&e!==`..`&&e.includes(`.`),zg=/^\.\*+$/,Bg=e=>e!==`.`&&e!==`..`&&e.startsWith(`.`),Vg=/^\*+$/,Hg=e=>e.length!==0&&!e.startsWith(`.`),Ug=e=>e.length!==0&&e!==`.`&&e!==`..`,Wg=/^\?+([^+@!?*[(]*)?$/,Gg=([e,t=``])=>{let n=Yg([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},Kg=([e,t=``])=>{let n=Xg([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},qg=([e,t=``])=>{let n=Xg([e]);return t?e=>n(e)&&e.endsWith(t):n},Jg=([e,t=``])=>{let n=Yg([e]);return t?e=>n(e)&&e.endsWith(t):n},Yg=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(`.`)},Xg=([e])=>{let t=e.length;return e=>e.length===t&&e!==`.`&&e!==`..`},Zg=typeof process==`object`&&process?typeof process.env==`object`&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:`posix`,Qg={win32:{sep:`\\`},posix:{sep:`/`}};B.sep=Zg===`win32`?Qg.win32.sep:Qg.posix.sep;const $g=Symbol(`globstar **`);B.GLOBSTAR=$g,B.filter=(e,t={})=>n=>B(n,e,t);const e_=(e,t={})=>Object.assign({},e,t);B.defaults=e=>{if(!e||typeof e!=`object`||!Object.keys(e).length)return B;let t=B;return Object.assign((n,r,i={})=>t(n,r,e_(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,e_(e,n))}static defaults(n){return t.defaults(e_(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,e_(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,e_(e,r))}},unescape:(n,r={})=>t.unescape(n,e_(e,r)),escape:(n,r={})=>t.escape(n,e_(e,r)),filter:(n,r={})=>t.filter(n,e_(e,r)),defaults:n=>t.defaults(e_(e,n)),makeRe:(n,r={})=>t.makeRe(n,e_(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,e_(e,r)),match:(n,r,i={})=>t.match(n,r,e_(e,i)),sep:t.sep,GLOBSTAR:$g})};const t_=(e,t={})=>(sg(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e)?[e]:tg(e,{max:t.braceExpandMax}));B.braceExpand=t_,B.makeRe=(e,t={})=>new i_(e,t).makeRe(),B.match=(e,t,n={})=>{let r=new i_(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};const n_=/[?*]|[+@!]\(.*?\)|\[|\]/,r_=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,`\\$&`);var i_=class{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;maxGlobstarRecursion;regexp;constructor(e,t={}){sg(e),t||={},this.options=t,this.maxGlobstarRecursion=t.maxGlobstarRecursion??200,this.pattern=e,this.platform=t.platform||Zg,this.isWindows=this.platform===`win32`,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||t.allowWindowsEscape===!1,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,`/`)),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=t.windowsNoMagicRoot===void 0?!!(this.isWindows&&this.nocase):t.windowsNoMagicRoot,this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if(typeof t!=`string`)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)===`#`){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=e[0]===``&&e[1]===``&&(e[2]===`?`||!n_.test(e[2]))&&!n_.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>e.indexOf(!1)===-1),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];t[0]===``&&t[1]===``&&this.globParts[e][2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3])&&(t[2]=`?`)}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t of e)for(let e=0;e<t.length;e++)t[e]===`**`&&(t[e]=`*`);let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;(t=e.indexOf(`**`,t+1))!==-1;){let n=t;for(;e[n+1]===`**`;)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>(e=e.reduce((e,t)=>{let n=e[e.length-1];return t===`**`&&n===`**`?e:t===`..`&&n&&n!==`..`&&n!==`.`&&n!==`**`?(e.pop(),e):(e.push(t),e)},[]),e.length===0?[``]:e))}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];n===1&&r===``&&e[0]===``||(r===`.`||r===``)&&(t=!0,e.splice(n,1),n--)}e[0]===`.`&&e.length===2&&(e[1]===`.`||e[1]===``)&&(t=!0,e.pop())}let n=0;for(;(n=e.indexOf(`..`,n+1))!==-1;){let r=e[n-1];r&&r!==`.`&&r!==`..`&&r!==`**`&&!(this.isWindows&&/^[a-z]:$/i.test(r))&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return e.length===0?[``]:e}firstPhasePreProcess(e){let t=!1;do{t=!1;for(let n of e){let r=-1;for(;(r=n.indexOf(`**`,r+1))!==-1;){let i=r;for(;n[i+1]===`**`;)i++;i>r&&n.splice(r+1,i-r);let a=n[r+1],o=n[r+2],s=n[r+3];if(a!==`..`||!o||o===`.`||o===`..`||!s||s===`.`||s===`..`)continue;t=!0,n.splice(r,1);let c=n.slice(0);c[r]=`**`,e.push(c),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];e===1&&r===``&&n[0]===``||(r===`.`||r===``)&&(t=!0,n.splice(e,1),e--)}n[0]===`.`&&n.length===2&&(n[1]===`.`||n[1]===``)&&(t=!0,n.pop())}let i=0;for(;(i=n.indexOf(`..`,i+1))!==-1;){let e=n[i-1];if(e&&e!==`.`&&e!==`..`&&e!==`**`){t=!0;let e=i===1&&n[i+1]===`**`?[`.`]:[];n.splice(i-1,2,...e),n.length===0&&n.push(``),i-=2}}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,a=[],o=``;for(;r<e.length&&i<t.length;)if(e[r]===t[i])a.push(o===`b`?t[i]:e[r]),r++,i++;else if(n&&e[r]===`**`&&t[i]===e[r+1])a.push(e[r]),r++;else if(n&&t[i]===`**`&&e[r]===t[i+1])a.push(t[i]),i++;else if(e[r]===`*`&&t[i]&&(this.options.dot||!t[i].startsWith(`.`))&&t[i]!==`**`){if(o===`b`)return!1;o=`a`,a.push(e[r]),r++,i++}else if(t[i]===`*`&&e[r]&&(this.options.dot||!e[r].startsWith(`.`))&&e[r]!==`**`){if(o===`a`)return!1;o=`b`,a.push(t[i]),r++,i++}else return!1;return e.length===t.length&&a}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&e.charAt(r)===`!`;r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=0,i=0;if(this.isWindows){let n=typeof e[0]==`string`&&/^[a-z]:$/i.test(e[0]),a=!n&&e[0]===``&&e[1]===``&&e[2]===`?`&&/^[a-z]:$/i.test(e[3]),o=typeof t[0]==`string`&&/^[a-z]:$/i.test(t[0]),s=!o&&t[0]===``&&t[1]===``&&t[2]===`?`&&typeof t[3]==`string`&&/^[a-z]:$/i.test(t[3]),c=a?3:n?0:void 0,l=s?3:o?0:void 0;if(typeof c==`number`&&typeof l==`number`){let[n,a]=[e[c],t[l]];n.toLowerCase()===a.toLowerCase()&&(t[l]=n,i=l,r=c)}}let{optimizationLevel:a=1}=this.options;return a>=2&&(e=this.levelTwoFileOptimize(e)),t.includes($g)?this.#e(e,t,n,r,i):this.#n(e,t,n,r,i)}#e(e,t,n,r,i){let a=t.indexOf($g,i),o=t.lastIndexOf($g),[s,c,l]=n?[t.slice(i,a),t.slice(a+1),[]]:[t.slice(i,a),t.slice(a+1,o),t.slice(o+1)];if(s.length){let t=e.slice(r,r+s.length);if(!this.#n(t,s,n,0,0))return!1;r+=s.length,i+=s.length}let u=0;if(l.length){if(l.length+r>e.length)return!1;let t=e.length-l.length;if(this.#n(e,l,n,t,0))u=l.length;else{if(e[e.length-1]!==``||r+l.length===e.length||(t--,!this.#n(e,l,n,t,0)))return!1;u=l.length+1}}if(!c.length){let t=!!u;for(let n=r;n<e.length-u;n++){let r=String(e[n]);if(t=!0,r===`.`||r===`..`||!this.options.dot&&r.startsWith(`.`))return!1}return n||t}let d=[[[],0]],f=d[0],p=0,m=[0];for(let e of c)e===$g?(m.push(p),f=[[],0],d.push(f)):(f[0].push(e),p++);let h=d.length-1,g=e.length-u;for(let e of d)e[1]=g-(m[h--]+e[0].length);return!!this.#t(e,d,r,0,n,0,!!u)}#t(e,t,n,r,i,a,o){let s=t[r];if(!s){for(let t=n;t<e.length;t++){o=!0;let n=e[t];if(n===`.`||n===`..`||!this.options.dot&&n.startsWith(`.`))return!1}return o}let[c,l]=s;for(;n<=l;){if(this.#n(e.slice(0,n+c.length),c,i,n,0)&&a<this.maxGlobstarRecursion){let s=this.#t(e,t,n+c.length,r+1,i,a+1,o);if(s!==!1)return s}let s=e[n];if(s===`.`||s===`..`||!this.options.dot&&s.startsWith(`.`))return!1;n++}return i||null}#n(e,t,n,r,i){let a,o,s,c;for(a=r,o=i,c=e.length,s=t.length;a<c&&o<s;a++,o++){this.debug(`matchOne loop`);let n=t[o],r=e[a];if(this.debug(t,n,r),n===!1||n===$g)return!1;let i;if(typeof n==`string`?(i=r===n,this.debug(`string match`,n,r,i)):(i=n.test(r),this.debug(`pattern match`,n,r,i)),!i)return!1}if(a===c&&o===s)return!0;if(a===c)return n;if(o===s)return a===c-1&&e[a]===``;throw Error(`wtf?`)}braceExpand(){return t_(this.pattern,this.options)}parse(e){sg(e);let t=this.options;if(e===`**`)return $g;if(e===``)return``;let n,r=null;(n=e.match(Vg))?r=t.dot?Ug:Hg:(n=e.match(jg))?r=(t.nocase?t.dot?Fg:Pg:t.dot?Ng:Mg)(n[1]):(n=e.match(Wg))?r=(t.nocase?t.dot?Kg:Gg:t.dot?qg:Jg)(n):(n=e.match(Ig))?r=t.dot?Rg:Lg:(n=e.match(zg))&&(r=Bg);let i=kg.fromGlob(e,this.options).toMMPattern();return r&&typeof i==`object`&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?`[^/]*?`:t.dot?`(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?`:`(?:(?!(?:\\/|^)\\.).)*?`,r=new Set(t.nocase?[`i`]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(``))r.add(t);return typeof e==`string`?r_(e):e===$g?$g:e._src});t.forEach((e,r)=>{let i=t[r+1],a=t[r-1];e!==$g||a===$g||(a===void 0?i!==void 0&&i!==$g?t[r+1]=`(?:\\/|`+n+`\\/)?`+i:t[r]=n:i===void 0?t[r-1]=a+`(?:\\/|\\/`+n+`)?`:i!==$g&&(t[r-1]=a+`(?:\\/|\\/`+n+`\\/)`+i,t[r+1]=$g))});let i=t.filter(e=>e!==$g);if(this.partial&&i.length>=1){let e=[];for(let t=1;t<=i.length;t++)e.push(i.slice(0,t).join(`/`));return`(?:`+e.join(`|`)+`)`}return i.join(`/`)}).join(`|`),[a,o]=e.length>1?[`(?:`,`)`]:[``,``];i=`^`+a+i+o+`$`,this.partial&&(i=`^(?:\\/|`+a+i.slice(1,-1)+o+`)$`),this.negate&&(i=`^(?!`+i+`).+$`);try{this.regexp=new RegExp(i,[...r].join(``))}catch{this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split(`/`):this.isWindows&&/^\/\/[^/]+/.test(e)?[``,...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug(`match`,e,this.pattern),this.comment)return!1;if(this.empty)return e===``;if(e===`/`&&t)return!0;let n=this.options;this.isWindows&&(e=e.split(`\\`).join(`/`));let r=this.slashSplit(e);this.debug(this.pattern,`split`,r);let i=this.set;this.debug(this.pattern,`set`,i);let a=r[r.length-1];if(!a)for(let e=r.length-2;!a&&e>=0;e--)a=r[e];for(let e of i){let i=r;if(n.matchBase&&e.length===1&&(i=[a]),this.matchOne(i,e,t))return n.flipNegate?!0:!this.negate}return!n.flipNegate&&this.negate}static defaults(e){return B.defaults(e).Minimatch}};B.AST=kg,B.Minimatch=i_,B.escape=Ag,B.unescape=pg;var a_=i(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c})),o_=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{version:()=>u}),t.exports=c(l);let u=`3.8.0`;0&&(t.exports={version:u})})),s_=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{exchangeVercelOidcToken:()=>p}),t.exports=c(l);var u=o_();let d=new class{constructor(e){this.maxEntries=e,this.entries=new Map}get(e){let t=this.entries.get(e);if(t!==void 0){if(t.expiresAt<=Date.now()){this.entries.delete(e);return}return this.entries.delete(e),this.entries.set(e,t),t.token}}set({key:e,token:t,expiresAt:n}){for(this.entries.delete(e),this.entries.set(e,{token:t,expiresAt:n});this.entries.size>this.maxEntries;){let e=this.entries.keys().next().value;if(e===void 0)break;this.entries.delete(e)}}}(1e3);async function f(e){let t=JSON.stringify([e.token,e.audience,e.jti]),n=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(t));return Array.from(new Uint8Array(n)).map(e=>e.toString(16).padStart(2,`0`)).join(``)}async function p(e){let t=await f(e);if(!e.skipCache){let e=d.get(t);if(e!==void 0)return e}let n=await fetch(`https://oidc.vercel.com/~token`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json`,"User-Agent":`@vercel/oidc@${u.version}`},body:JSON.stringify({token:e.token,aud:e.audience,...e.jti?{jti:e.jti}:void 0})});if(!n.ok)throw Error(`Failed to exchange token: ${await m(n)}`);let r;try{r=await n.json()}catch{throw Error(`Failed to exchange token: response was not valid JSON`)}if(!r||typeof r!=`object`||!(`token`in r)||typeof r.token!=`string`)throw Error(`Failed to exchange token: response did not contain a token`);let{token:i}=r,a=`expiry`in r&&typeof r.expiry==`number`?r.expiry:void 0;if(a!==void 0){let e=a*1e3;e>Date.now()&&d.set({key:t,token:i,expiresAt:e})}return i}async function m(e){try{let t=await e.json();if(t&&typeof t==`object`&&`error`in t&&typeof t.error==`string`)return t.error}catch{}return e.statusText||`HTTP ${e.status}`}0&&(t.exports={exchangeVercelOidcToken:p})})),c_=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{SYMBOL_FOR_REQ_CONTEXT:()=>u,getContext:()=>d}),t.exports=c(l);let u=Symbol.for(`@vercel/request-context`);function d(){return globalThis[u]?.get?.()??{}}0&&(t.exports={SYMBOL_FOR_REQ_CONTEXT:u,getContext:d})})),l_=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{getVercelOidcTokenSync:()=>d}),t.exports=c(l);var u=c_();function d(){let e=(0,u.getContext)().headers?.[`x-vercel-oidc-token`]??process.env.VERCEL_OIDC_TOKEN;if(!e)throw Error(`The 'x-vercel-oidc-token' header is missing from the request.`);return e}0&&(t.exports={getVercelOidcTokenSync:d})})),u_=i(((e,t)=>{var r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,o=Object.prototype.hasOwnProperty,s=(e,t)=>{for(var n in t)r(e,n,{get:t[n],enumerable:!0})},c=(e,t,n,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of a(t))!o.call(e,c)&&c!==n&&r(e,c,{get:()=>t[c],enumerable:!(s=i(t,c))||s.enumerable});return e},l=e=>c(r({},`__esModule`,{value:!0}),e),u={};s(u,{getVercelOidcToken:()=>m}),t.exports=l(u);var d=s_(),f=l_(),p=Xc();async function m(e){let t=``,r;try{t=(0,f.getVercelOidcTokenSync)()}catch(e){r=e}try{let[{getTokenPayload:r,isExpired:i},{refreshToken:a}]=await Promise.all([await import(`../../_chunks/workflow/token-util-DURSL1l8.js`).then(e=>n(e.t())),await import(`../../_chunks/workflow/token-hiUWkDKe.js`).then(e=>n(e.default))]);(!t||i(r(t),e?.expirationBufferMs))&&(await a(e),t=(0,f.getVercelOidcTokenSync)())}catch(e){let t=r instanceof Error?r.message:``;throw e instanceof Error&&(t=`${t}
|
|
12
|
+
${e.message}`),t?new p.VercelOidcTokenError(t):e}return e?.audience&&(t=await(0,d.exchangeVercelOidcToken)({token:t,audience:e.audience,jti:e.jti,skipCache:e.skipCache})),t}0&&(t.exports={getVercelOidcToken:m})})),d_,f_=t((()=>{d_=(e,t)=>ol(e).update(t).digest()}));function p_(...e){let t=e.reduce((e,{length:t})=>e+t,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function m_(e,t){return p_(V.encode(e),new Uint8Array([0]),t)}function h_(e,t,n){if(t<0||t>=x_)throw RangeError(`value must be >= 0 and <= ${x_-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,t&255],n)}function g_(e){let t=Math.floor(e/x_),n=e%x_,r=new Uint8Array(8);return h_(r,t,0),h_(r,n,4),r}function __(e){let t=new Uint8Array(4);return h_(t,e),t}function v_(e){return p_(__(e.length),e)}async function y_(e,t,n){let r=Math.ceil((t>>3)/32),i=new Uint8Array(r*32);for(let t=0;t<r;t++){let r=new Uint8Array(4+e.length+n.length);r.set(__(t+1)),r.set(e,4),r.set(n,4+e.length),i.set(await d_(`sha256`,r),t*32)}return i.slice(0,t>>3)}var V,b_,x_,H=t((()=>{f_(),V=new TextEncoder,b_=new TextDecoder,x_=2**32}));function S_(e){let t=e;return t instanceof Uint8Array&&(t=b_.decode(t)),t}var U,W,C_=t((()=>{H(),U=e=>Ol.from(e).toString(`base64url`),W=e=>new Uint8Array(Ol.from(S_(e),`base64url`))})),w_=r({JOSEAlgNotAllowed:()=>D_,JOSEError:()=>G,JOSENotSupported:()=>K,JWEDecryptionFailed:()=>O_,JWEInvalid:()=>q,JWKInvalid:()=>A_,JWKSInvalid:()=>j_,JWKSMultipleMatchingKeys:()=>N_,JWKSNoMatchingKey:()=>M_,JWKSTimeout:()=>P_,JWSInvalid:()=>J,JWSSignatureVerificationFailed:()=>F_,JWTClaimValidationFailed:()=>T_,JWTExpired:()=>E_,JWTInvalid:()=>k_}),G,T_,E_,D_,K,O_,q,J,k_,A_,j_,M_,N_,P_,F_,Y=t((()=>{G=class extends Error{static code=`ERR_JOSE_GENERIC`;code=`ERR_JOSE_GENERIC`;constructor(e,t){super(e,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}},T_=class extends G{static code=`ERR_JWT_CLAIM_VALIDATION_FAILED`;code=`ERR_JWT_CLAIM_VALIDATION_FAILED`;claim;reason;payload;constructor(e,t,n=`unspecified`,r=`unspecified`){super(e,{cause:{claim:n,reason:r,payload:t}}),this.claim=n,this.reason=r,this.payload=t}},E_=class extends G{static code=`ERR_JWT_EXPIRED`;code=`ERR_JWT_EXPIRED`;claim;reason;payload;constructor(e,t,n=`unspecified`,r=`unspecified`){super(e,{cause:{claim:n,reason:r,payload:t}}),this.claim=n,this.reason=r,this.payload=t}},D_=class extends G{static code=`ERR_JOSE_ALG_NOT_ALLOWED`;code=`ERR_JOSE_ALG_NOT_ALLOWED`},K=class extends G{static code=`ERR_JOSE_NOT_SUPPORTED`;code=`ERR_JOSE_NOT_SUPPORTED`},O_=class extends G{static code=`ERR_JWE_DECRYPTION_FAILED`;code=`ERR_JWE_DECRYPTION_FAILED`;constructor(e=`decryption operation failed`,t){super(e,t)}},q=class extends G{static code=`ERR_JWE_INVALID`;code=`ERR_JWE_INVALID`},J=class extends G{static code=`ERR_JWS_INVALID`;code=`ERR_JWS_INVALID`},k_=class extends G{static code=`ERR_JWT_INVALID`;code=`ERR_JWT_INVALID`},A_=class extends G{static code=`ERR_JWK_INVALID`;code=`ERR_JWK_INVALID`},j_=class extends G{static code=`ERR_JWKS_INVALID`;code=`ERR_JWKS_INVALID`},M_=class extends G{static code=`ERR_JWKS_NO_MATCHING_KEY`;code=`ERR_JWKS_NO_MATCHING_KEY`;constructor(e=`no applicable key found in the JSON Web Key Set`,t){super(e,t)}},N_=class extends G{[Symbol.asyncIterator];static code=`ERR_JWKS_MULTIPLE_MATCHING_KEYS`;code=`ERR_JWKS_MULTIPLE_MATCHING_KEYS`;constructor(e=`multiple matching keys found in the JSON Web Key Set`,t){super(e,t)}},P_=class extends G{static code=`ERR_JWKS_TIMEOUT`;code=`ERR_JWKS_TIMEOUT`;constructor(e=`request timed out`,t){super(e,t)}},F_=class extends G{static code=`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`;code=`ERR_JWS_SIGNATURE_VERIFICATION_FAILED`;constructor(e=`signature verification failed`,t){super(e,t)}}})),I_=t((()=>{}));function L_(e){switch(e){case`A128GCM`:case`A128GCMKW`:case`A192GCM`:case`A192GCMKW`:case`A256GCM`:case`A256GCMKW`:return 96;case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return 128;default:throw new K(`Unsupported JWE Algorithm: ${e}`)}}var R_,z_=t((()=>{Y(),I_(),R_=e=>_l(new Uint8Array(L_(e)>>3))})),B_,V_=t((()=>{Y(),z_(),B_=(e,t)=>{if(t.length<<3!==L_(e))throw new q(`Invalid Initialization Vector length`)}})),H_,U_=t((()=>{H_=e=>bl.types.isKeyObject(e)})),W_,G_=t((()=>{Y(),U_(),W_=(e,t)=>{let n;switch(e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:n=parseInt(e.slice(-3),10);break;case`A128GCM`:case`A192GCM`:case`A256GCM`:n=parseInt(e.slice(1,4),10);break;default:throw new K(`Content Encryption Algorithm ${e} is not supported either by JOSE or your javascript runtime`)}if(t instanceof Uint8Array){let e=t.byteLength<<3;if(e!==n)throw new q(`Invalid Content Encryption Key length. Expected ${n} bits, got ${e} bits`);return}if(H_(t)&&t.type===`secret`){let e=t.symmetricKeySize<<3;if(e!==n)throw new q(`Invalid Content Encryption Key length. Expected ${n} bits, got ${e} bits`);return}throw TypeError(`Invalid Content Encryption Key type`)}})),K_,q_=t((()=>{K_=vl}));function J_(e,t,n,r,i,a){let o=p_(e,t,n,g_(e.length<<3)),s=sl(`sha${r}`,i);return s.update(o),s.digest().slice(0,a>>3)}var Y_=t((()=>{H()})),X_,Z_,Q_=t((()=>{X_=tl.webcrypto,Z_=e=>bl.types.isCryptoKey(e)}));function X(e,t=`algorithm.name`){return TypeError(`CryptoKey does not support this operation, its ${t} must be ${e}`)}function $_(e,t){return e.name===t}function ev(e){return parseInt(e.name.slice(4),10)}function tv(e){switch(e){case`ES256`:return`P-256`;case`ES384`:return`P-384`;case`ES512`:return`P-521`;default:throw Error(`unreachable`)}}function nv(e,t){if(t.length&&!t.some(t=>e.usages.includes(t))){let e=`CryptoKey does not support this operation, its usages must include `;if(t.length>2){let n=t.pop();e+=`one of ${t.join(`, `)}, or ${n}.`}else t.length===2?e+=`one of ${t[0]} or ${t[1]}.`:e+=`${t[0]}.`;throw TypeError(e)}}function rv(e,t,...n){switch(t){case`HS256`:case`HS384`:case`HS512`:{if(!$_(e.algorithm,`HMAC`))throw X(`HMAC`);let n=parseInt(t.slice(2),10);if(ev(e.algorithm.hash)!==n)throw X(`SHA-${n}`,`algorithm.hash`);break}case`RS256`:case`RS384`:case`RS512`:{if(!$_(e.algorithm,`RSASSA-PKCS1-v1_5`))throw X(`RSASSA-PKCS1-v1_5`);let n=parseInt(t.slice(2),10);if(ev(e.algorithm.hash)!==n)throw X(`SHA-${n}`,`algorithm.hash`);break}case`PS256`:case`PS384`:case`PS512`:{if(!$_(e.algorithm,`RSA-PSS`))throw X(`RSA-PSS`);let n=parseInt(t.slice(2),10);if(ev(e.algorithm.hash)!==n)throw X(`SHA-${n}`,`algorithm.hash`);break}case`EdDSA`:if(e.algorithm.name!==`Ed25519`&&e.algorithm.name!==`Ed448`)throw X(`Ed25519 or Ed448`);break;case`Ed25519`:if(!$_(e.algorithm,`Ed25519`))throw X(`Ed25519`);break;case`ES256`:case`ES384`:case`ES512`:{if(!$_(e.algorithm,`ECDSA`))throw X(`ECDSA`);let n=tv(t);if(e.algorithm.namedCurve!==n)throw X(n,`algorithm.namedCurve`);break}default:throw TypeError(`CryptoKey does not support this operation`)}nv(e,n)}function iv(e,t,...n){switch(t){case`A128GCM`:case`A192GCM`:case`A256GCM`:{if(!$_(e.algorithm,`AES-GCM`))throw X(`AES-GCM`);let n=parseInt(t.slice(1,4),10);if(e.algorithm.length!==n)throw X(n,`algorithm.length`);break}case`A128KW`:case`A192KW`:case`A256KW`:{if(!$_(e.algorithm,`AES-KW`))throw X(`AES-KW`);let n=parseInt(t.slice(1,4),10);if(e.algorithm.length!==n)throw X(n,`algorithm.length`);break}case`ECDH`:switch(e.algorithm.name){case`ECDH`:case`X25519`:case`X448`:break;default:throw X(`ECDH, X25519, or X448`)}break;case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:if(!$_(e.algorithm,`PBKDF2`))throw X(`PBKDF2`);break;case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:{if(!$_(e.algorithm,`RSA-OAEP`))throw X(`RSA-OAEP`);let n=parseInt(t.slice(9),10)||1;if(ev(e.algorithm.hash)!==n)throw X(`SHA-${n}`,`algorithm.hash`);break}default:throw TypeError(`CryptoKey does not support this operation`)}nv(e,n)}var av=t((()=>{}));function ov(e,t,...n){if(n=n.filter(Boolean),n.length>2){let t=n.pop();e+=`one of type ${n.join(`, `)}, or ${t}.`}else n.length===2?e+=`one of type ${n[0]} or ${n[1]}.`:e+=`of type ${n[0]}.`;return t==null?e+=` Received ${t}`:typeof t==`function`&&t.name?e+=` Received function ${t.name}`:typeof t==`object`&&t&&t.constructor?.name&&(e+=` Received an instance of ${t.constructor.name}`),e}function sv(e,t,...n){return ov(`Key for the ${e} algorithm must be `,t,...n)}var cv,lv=t((()=>{cv=(e,...t)=>ov(`Key must be `,e,...t)})),uv,dv,fv=t((()=>{dv=e=>(uv||=new Set(pl()),uv.has(e))})),pv,Z,mv=t((()=>{Q_(),U_(),pv=e=>H_(e)||Z_(e),Z=[`KeyObject`],(globalThis.CryptoKey||X_?.CryptoKey)&&Z.push(`CryptoKey`)}));function hv(e,t,n,r,i,a){let o=parseInt(e.slice(1,4),10);H_(t)&&(t=t.export());let s=t.subarray(o>>3),c=t.subarray(0,o>>3),l=parseInt(e.slice(-3),10),u=`aes-${o}-cbc`;if(!dv(u))throw new K(`alg ${e} is not supported by your javascript runtime`);let d=J_(a,r,n,l,c,o),f;try{f=K_(i,d)}catch{}if(!f)throw new O_;let p;try{let e=al(u,s,r);p=p_(e.update(n),e.final())}catch{}if(!p)throw new O_;return p}function gv(e,t,n,r,i,a){let o=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!dv(o))throw new K(`alg ${e} is not supported by your javascript runtime`);try{let e=al(o,t,r,{authTagLength:16});e.setAuthTag(i),a.byteLength&&e.setAAD(a,{plaintextLength:n.length});let s=e.update(n);return e.final(),s}catch{throw new O_}}var _v,vv=t((()=>{V_(),G_(),H(),Y(),q_(),Y_(),Q_(),av(),U_(),lv(),fv(),mv(),_v=(e,t,n,r,i,a)=>{let o;if(Z_(t))iv(t,e,`decrypt`),o=nl.from(t);else if(t instanceof Uint8Array||H_(t))o=t;else throw TypeError(cv(t,...Z,`Uint8Array`));if(!r)throw new q(`JWE Initialization Vector missing`);if(!i)throw new q(`JWE Authentication Tag missing`);switch(W_(e,o),B_(e,r),e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return hv(e,o,n,r,i,a);case`A128GCM`:case`A192GCM`:case`A256GCM`:return gv(e,o,n,r,i,a);default:throw new K(`Unsupported JWE Content Encryption Algorithm`)}}})),yv,bv=t((()=>{yv=(...e)=>{let t=e.filter(Boolean);if(t.length===0||t.length===1)return!0;let n;for(let e of t){let t=Object.keys(e);if(!n||n.size===0){n=new Set(t);continue}for(let e of t){if(n.has(e))return!1;n.add(e)}}return!0}}));function xv(e){return typeof e==`object`&&!!e}function Q(e){if(!xv(e)||Object.prototype.toString.call(e)!==`[object Object]`)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}var Sv=t((()=>{}));function Cv(e,t){if(e.symmetricKeySize<<3!==parseInt(t.slice(1,4),10))throw TypeError(`Invalid key size for alg: ${t}`)}function wv(e,t,n){if(H_(e))return e;if(e instanceof Uint8Array)return ul(e);if(Z_(e))return iv(e,t,n),nl.from(e);throw TypeError(cv(e,...Z,`Uint8Array`))}var Tv,Ev,Dv=t((()=>{Y(),H(),Q_(),av(),U_(),lv(),fv(),mv(),Tv=(e,t,n)=>{let r=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!dv(r))throw new K(`alg ${e} is not supported either by JOSE or your javascript runtime`);let i=wv(t,e,`wrapKey`);Cv(i,e);let a=il(r,i,Ol.alloc(8,166));return p_(a.update(n),a.final())},Ev=(e,t,n)=>{let r=`aes${parseInt(e.slice(1,4),10)}-wrap`;if(!dv(r))throw new K(`alg ${e} is not supported either by JOSE or your javascript runtime`);let i=wv(t,e,`unwrapKey`);Cv(i,e);let a=al(r,i,Ol.alloc(8,166));return p_(a.update(n),a.final())}}));function Ov(e){return Q(e)&&typeof e.kty==`string`}function kv(e){return e.kty!==`oct`&&typeof e.d==`string`}function Av(e){return e.kty!==`oct`&&e.d===void 0}function jv(e){return Ov(e)&&e.kty===`oct`&&typeof e.k==`string`}var Mv=t((()=>{Sv()})),Nv,Pv,Fv=t((()=>{Y(),Q_(),U_(),lv(),mv(),Mv(),Nv=e=>{switch(e){case`prime256v1`:return`P-256`;case`secp384r1`:return`P-384`;case`secp521r1`:return`P-521`;case`secp256k1`:return`secp256k1`;default:throw new K(`Unsupported key curve for this operation`)}},Pv=(e,t)=>{let n;if(Z_(e))n=nl.from(e);else if(H_(e))n=e;else if(Ov(e))return e.crv;else throw TypeError(cv(e,...Z));if(n.type===`secret`)throw TypeError(`only "private" or "public" type keys can be used for this operation`);switch(n.asymmetricKeyType){case`ed25519`:case`ed448`:return`Ed${n.asymmetricKeyType.slice(2)}`;case`x25519`:case`x448`:return`X${n.asymmetricKeyType.slice(1)}`;case`ec`:{let e=n.asymmetricKeyDetails.namedCurve;return t?e:Nv(e)}default:throw TypeError(`Invalid asymmetric key type for this operation`)}}}));async function Iv(e,t,n,r,i=new Uint8Array,a=new Uint8Array){let o;if(Z_(e))iv(e,`ECDH`),o=nl.from(e);else if(H_(e))o=e;else throw TypeError(cv(e,...Z));let s;if(Z_(t))iv(t,`ECDH`,`deriveBits`),s=nl.from(t);else if(H_(t))s=t;else throw TypeError(cv(t,...Z));let c=p_(v_(V.encode(n)),v_(i),v_(a),__(r));return y_(dl({privateKey:s,publicKey:o}),r,c)}async function Lv(e){let t;if(Z_(e))t=nl.from(e);else if(H_(e))t=e;else throw TypeError(cv(e,...Z));switch(t.asymmetricKeyType){case`x25519`:return Rv(`x25519`);case`x448`:return Rv(`x448`);case`ec`:{let e=Pv(t);return Rv(`ec`,{namedCurve:e})}default:throw new K(`Invalid or unsupported EPK`)}}var Rv,zv,Bv=t((()=>{Fv(),H(),Y(),Q_(),av(),U_(),lv(),mv(),Rv=Cl(fl),zv=e=>[`P-256`,`P-384`,`P-521`,`X25519`,`X448`].includes(Pv(e))}));function Vv(e){if(!(e instanceof Uint8Array)||e.length<8)throw new q(`PBES2 Salt Input must be 8 or more octets`)}var Hv=t((()=>{Y()}));function Uv(e,t){if(H_(e))return e.export();if(e instanceof Uint8Array)return e;if(Z_(e))return iv(e,t,`deriveBits`,`deriveKey`),nl.from(e).export();throw TypeError(cv(e,...Z,`Uint8Array`))}var Wv,Gv,Kv,qv=t((()=>{I_(),H(),C_(),Dv(),Hv(),Q_(),av(),U_(),lv(),mv(),Wv=Cl(ml),Gv=async(e,t,n,r=2048,i=_l(new Uint8Array(16)))=>{Vv(i);let a=m_(e,i),o=parseInt(e.slice(13,16),10)>>3,s=Uv(t,e),c=await Wv(s,a,r,o,`sha${e.slice(8,11)}`);return{encryptedKey:await Tv(e.slice(-6),c,n),p2c:r,p2s:U(i)}},Kv=async(e,t,n,r,i)=>{Vv(i);let a=m_(e,i),o=parseInt(e.slice(13,16),10)>>3,s=Uv(t,e),c=await Wv(s,a,r,o,`sha${e.slice(8,11)}`);return Ev(e.slice(-6),c,n)}})),Jv,Yv=t((()=>{Jv=(e,t)=>{let n;try{n=e instanceof nl?e.asymmetricKeyDetails?.modulusLength:Buffer.from(e.n,`base64url`).byteLength<<3}catch{}if(typeof n!=`number`||n<2048)throw TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}}));function Xv(e,t,...n){if(H_(e))return e;if(Z_(e))return iv(e,t,...n),nl.from(e);throw TypeError(cv(e,...Z))}var Zv,Qv,$v,ey,ty,ny,ry=t((()=>{Yv(),Q_(),av(),U_(),lv(),mv(),Zv=(e,t)=>{if(e.asymmetricKeyType!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa`);Jv(e,t)},Qv=xl(()=>rl.RSA_PKCS1_PADDING,`The RSA1_5 "alg" (JWE Algorithm) is deprecated and will be removed in the next major revision.`),$v=e=>{switch(e){case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:return rl.RSA_PKCS1_OAEP_PADDING;case`RSA1_5`:return Qv();default:return}},ey=e=>{switch(e){case`RSA-OAEP`:return`sha1`;case`RSA-OAEP-256`:return`sha256`;case`RSA-OAEP-384`:return`sha384`;case`RSA-OAEP-512`:return`sha512`;default:return}},ty=(e,t,n)=>{let r=$v(e),i=ey(e),a=Xv(t,e,`wrapKey`,`encrypt`);return Zv(a,e),gl({key:a,oaepHash:i,padding:r},n)},ny=(e,t,n)=>{let r=$v(e),i=ey(e),a=Xv(t,e,`unwrapKey`,`decrypt`);return Zv(a,e),hl({key:a,oaepHash:i,padding:r},n)}})),iy,ay=t((()=>{iy={}}));function oy(e){switch(e){case`A128GCM`:return 128;case`A192GCM`:return 192;case`A256GCM`:case`A128CBC-HS256`:return 256;case`A192CBC-HS384`:return 384;case`A256CBC-HS512`:return 512;default:throw new K(`Unsupported JWE Algorithm: ${e}`)}}var sy,cy=t((()=>{Y(),I_(),sy=e=>_l(new Uint8Array(oy(e)>>3))})),ly,uy,dy,fy,py,my,hy=t((()=>{Q_(),U_(),lv(),mv(),ly=(e,t,n)=>{let r;if(Z_(n)){if(!n.extractable)throw TypeError(`CryptoKey is not extractable`);r=nl.from(n)}else if(H_(n))r=n;else throw TypeError(cv(n,...Z));if(r.type!==e)throw TypeError(`key is not a ${e} key`);return r.export({format:`pem`,type:t})},uy=e=>ly(`public`,`spki`,e),dy=e=>ly(`private`,`pkcs8`,e),fy=e=>cl({key:Ol.from(e.replace(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g,``),`base64`),type:`pkcs8`,format:`der`}),py=e=>ll({key:Ol.from(e.replace(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g,``),`base64`),type:`spki`,format:`der`}),my=e=>ll({key:e,type:`spki`,format:`pem`})})),gy,_y=t((()=>{gy=e=>e.d?cl({format:`jwk`,key:e}):ll({format:`jwk`,key:e})}));async function vy(e,t,n){if(typeof e!=`string`||e.indexOf(`-----BEGIN PUBLIC KEY-----`)!==0)throw TypeError(`"spki" must be SPKI formatted string`);return py(e,t,n)}async function yy(e,t,n){if(typeof e!=`string`||e.indexOf(`-----BEGIN CERTIFICATE-----`)!==0)throw TypeError(`"x509" must be X.509 formatted string`);return my(e,t,n)}async function by(e,t,n){if(typeof e!=`string`||e.indexOf(`-----BEGIN PRIVATE KEY-----`)!==0)throw TypeError(`"pkcs8" must be PKCS#8 formatted string`);return fy(e,t,n)}async function xy(e,t){if(!Q(e))throw TypeError(`JWK must be an object`);switch(t||=e.alg,e.kty){case`oct`:if(typeof e.k!=`string`||!e.k)throw TypeError(`missing "k" (Key Value) Parameter value`);return W(e.k);case`RSA`:if(`oth`in e&&e.oth!==void 0)throw new K(`RSA JWK "oth" (Other Primes Info) Parameter value is not supported`);case`EC`:case`OKP`:return gy({...e,alg:t});default:throw new K(`Unsupported "kty" (Key Type) Parameter value`)}}var Sy=t((()=>{C_(),hy(),_y(),Y(),Sv()}));function Cy(e,t,n,r){t.startsWith(`HS`)||t===`dir`||t.startsWith(`PBES2`)||/^A\d{3}(?:GCM)?KW$/.test(t)?Ey(t,n,r,e):Dy(t,n,r,e)}var wy,Ty,Ey,Dy,Oy,ky,Ay=t((()=>{lv(),mv(),Mv(),wy=e=>e?.[Symbol.toStringTag],Ty=(e,t,n)=>{if(t.use!==void 0&&t.use!==`sig`)throw TypeError(`Invalid key for this operation, when present its use must be sig`);if(t.key_ops!==void 0&&t.key_ops.includes?.(n)!==!0)throw TypeError(`Invalid key for this operation, when present its key_ops must include ${n}`);if(t.alg!==void 0&&t.alg!==e)throw TypeError(`Invalid key for this operation, when present its alg must be ${e}`);return!0},Ey=(e,t,n,r)=>{if(!(t instanceof Uint8Array)){if(r&&Ov(t)){if(jv(t)&&Ty(e,t,n))return;throw TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`)}if(!pv(t))throw TypeError(sv(e,t,...Z,`Uint8Array`,r?`JSON Web Key`:null));if(t.type!==`secret`)throw TypeError(`${wy(t)} instances for symmetric algorithms must be of type "secret"`)}},Dy=(e,t,n,r)=>{if(r&&Ov(t))switch(n){case`sign`:if(kv(t)&&Ty(e,t,n))return;throw TypeError(`JSON Web Key for this operation be a private JWK`);case`verify`:if(Av(t)&&Ty(e,t,n))return;throw TypeError(`JSON Web Key for this operation be a public JWK`)}if(!pv(t))throw TypeError(sv(e,t,...Z,r?`JSON Web Key`:null));if(t.type===`secret`)throw TypeError(`${wy(t)} instances for asymmetric algorithms must not be of type "secret"`);if(n===`sign`&&t.type===`public`)throw TypeError(`${wy(t)} instances for asymmetric algorithm signing must be of type "private"`);if(n===`decrypt`&&t.type===`public`)throw TypeError(`${wy(t)} instances for asymmetric algorithm decryption must be of type "private"`);if(t.algorithm&&n===`verify`&&t.type===`private`)throw TypeError(`${wy(t)} instances for asymmetric algorithm verifying must be of type "public"`);if(t.algorithm&&n===`encrypt`&&t.type===`private`)throw TypeError(`${wy(t)} instances for asymmetric algorithm encryption must be of type "public"`)},Oy=Cy.bind(void 0,!1),ky=Cy.bind(void 0,!0)}));function jy(e,t,n,r,i){let a=parseInt(e.slice(1,4),10);H_(n)&&(n=n.export());let o=n.subarray(a>>3),s=n.subarray(0,a>>3),c=`aes-${a}-cbc`;if(!dv(c))throw new K(`alg ${e} is not supported by your javascript runtime`);let l=il(c,o,r),u=p_(l.update(t),l.final());return{ciphertext:u,tag:J_(i,r,u,parseInt(e.slice(-3),10),s,a),iv:r}}function My(e,t,n,r,i){let a=`aes-${parseInt(e.slice(1,4),10)}-gcm`;if(!dv(a))throw new K(`alg ${e} is not supported by your javascript runtime`);let o=il(a,n,r,{authTagLength:16});i.byteLength&&o.setAAD(i,{plaintextLength:t.length});let s=o.update(t);return o.final(),{ciphertext:s,tag:o.getAuthTag(),iv:r}}var Ny,Py=t((()=>{V_(),G_(),H(),Y_(),Q_(),av(),U_(),lv(),z_(),Y(),fv(),mv(),Ny=(e,t,n,r,i)=>{let a;if(Z_(n))iv(n,e,`encrypt`),a=nl.from(n);else if(n instanceof Uint8Array||H_(n))a=n;else throw TypeError(cv(n,...Z,`Uint8Array`));switch(W_(e,a),r?B_(e,r):r=R_(e),e){case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:return jy(e,t,a,r,i);case`A128GCM`:case`A192GCM`:case`A256GCM`:return My(e,t,a,r,i);default:throw new K(`Unsupported JWE Content Encryption Algorithm`)}}}));async function Fy(e,t,n,r){let i=await Ny(e.slice(0,7),n,t,r,new Uint8Array);return{encryptedKey:i.ciphertext,iv:U(i.iv),tag:U(i.tag)}}async function Iy(e,t,n,r,i){return _v(e.slice(0,7),t,n,r,i,new Uint8Array)}var Ly=t((()=>{Py(),vv(),C_()}));async function Ry(e,t,n,r,i){switch(Oy(e,t,`decrypt`),t=await iy.normalizePrivateKey?.(t,e)||t,e){case`dir`:if(n!==void 0)throw new q(`Encountered unexpected JWE Encrypted Key`);return t;case`ECDH-ES`:if(n!==void 0)throw new q(`Encountered unexpected JWE Encrypted Key`);case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{if(!Q(r.epk))throw new q(`JOSE Header "epk" (Ephemeral Public Key) missing or invalid`);if(!zv(t))throw new K(`ECDH with the provided key is not allowed or not supported by your javascript runtime`);let i=await xy(r.epk,e),a,o;if(r.apu!==void 0){if(typeof r.apu!=`string`)throw new q(`JOSE Header "apu" (Agreement PartyUInfo) invalid`);try{a=W(r.apu)}catch{throw new q(`Failed to base64url decode the apu`)}}if(r.apv!==void 0){if(typeof r.apv!=`string`)throw new q(`JOSE Header "apv" (Agreement PartyVInfo) invalid`);try{o=W(r.apv)}catch{throw new q(`Failed to base64url decode the apv`)}}let s=await Iv(i,t,e===`ECDH-ES`?r.enc:e,e===`ECDH-ES`?oy(r.enc):parseInt(e.slice(-5,-2),10),a,o);if(e===`ECDH-ES`)return s;if(n===void 0)throw new q(`JWE Encrypted Key missing`);return Ev(e.slice(-6),s,n)}case`RSA1_5`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:if(n===void 0)throw new q(`JWE Encrypted Key missing`);return ny(e,t,n);case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:{if(n===void 0)throw new q(`JWE Encrypted Key missing`);if(typeof r.p2c!=`number`)throw new q(`JOSE Header "p2c" (PBES2 Count) missing or invalid`);let a=i?.maxPBES2Count||1e4;if(r.p2c>a)throw new q(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`);if(typeof r.p2s!=`string`)throw new q(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`);let o;try{o=W(r.p2s)}catch{throw new q(`Failed to base64url decode the p2s`)}return Kv(e,t,n,r.p2c,o)}case`A128KW`:case`A192KW`:case`A256KW`:if(n===void 0)throw new q(`JWE Encrypted Key missing`);return Ev(e,t,n);case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:{if(n===void 0)throw new q(`JWE Encrypted Key missing`);if(typeof r.iv!=`string`)throw new q(`JOSE Header "iv" (Initialization Vector) missing or invalid`);if(typeof r.tag!=`string`)throw new q(`JOSE Header "tag" (Authentication Tag) missing or invalid`);let i;try{i=W(r.iv)}catch{throw new q(`Failed to base64url decode the iv`)}let a;try{a=W(r.tag)}catch{throw new q(`Failed to base64url decode the tag`)}return Iy(e,t,n,i,a)}default:throw new K(`Invalid or unsupported "alg" (JWE Algorithm) header value`)}}var zy=t((()=>{Dv(),Bv(),qv(),ry(),C_(),ay(),Y(),cy(),Sy(),Ay(),Sv(),Ly()}));function By(e,t,n,r,i){if(i.crit!==void 0&&r?.crit===void 0)throw new e(`"crit" (Critical) Header Parameter MUST be integrity protected`);if(!r||r.crit===void 0)return new Set;if(!Array.isArray(r.crit)||r.crit.length===0||r.crit.some(e=>typeof e!=`string`||e.length===0))throw new e(`"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present`);let a;a=n===void 0?t:new Map([...Object.entries(n),...t.entries()]);for(let t of r.crit){if(!a.has(t))throw new K(`Extension Header Parameter "${t}" is not recognized`);if(i[t]===void 0)throw new e(`Extension Header Parameter "${t}" is missing`);if(a.get(t)&&r[t]===void 0)throw new e(`Extension Header Parameter "${t}" MUST be integrity protected`)}return new Set(r.crit)}var Vy=t((()=>{Y()})),Hy,Uy=t((()=>{Hy=(e,t)=>{if(t!==void 0&&(!Array.isArray(t)||t.some(e=>typeof e!=`string`)))throw TypeError(`"${e}" option must be an array of strings`);if(t)return new Set(t)}}));async function Wy(e,t,n){if(!Q(e))throw new q(`Flattened JWE must be an object`);if(e.protected===void 0&&e.header===void 0&&e.unprotected===void 0)throw new q(`JOSE Header missing`);if(e.iv!==void 0&&typeof e.iv!=`string`)throw new q(`JWE Initialization Vector incorrect type`);if(typeof e.ciphertext!=`string`)throw new q(`JWE Ciphertext missing or incorrect type`);if(e.tag!==void 0&&typeof e.tag!=`string`)throw new q(`JWE Authentication Tag incorrect type`);if(e.protected!==void 0&&typeof e.protected!=`string`)throw new q(`JWE Protected Header incorrect type`);if(e.encrypted_key!==void 0&&typeof e.encrypted_key!=`string`)throw new q(`JWE Encrypted Key incorrect type`);if(e.aad!==void 0&&typeof e.aad!=`string`)throw new q(`JWE AAD incorrect type`);if(e.header!==void 0&&!Q(e.header))throw new q(`JWE Shared Unprotected Header incorrect type`);if(e.unprotected!==void 0&&!Q(e.unprotected))throw new q(`JWE Per-Recipient Unprotected Header incorrect type`);let r;if(e.protected)try{let t=W(e.protected);r=JSON.parse(b_.decode(t))}catch{throw new q(`JWE Protected Header is invalid`)}if(!yv(r,e.header,e.unprotected))throw new q(`JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint`);let i={...r,...e.header,...e.unprotected};if(By(q,new Map,n?.crit,r,i),i.zip!==void 0)throw new K(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`);let{alg:a,enc:o}=i;if(typeof a!=`string`||!a)throw new q(`missing JWE Algorithm (alg) in JWE Header`);if(typeof o!=`string`||!o)throw new q(`missing JWE Encryption Algorithm (enc) in JWE Header`);let s=n&&Hy(`keyManagementAlgorithms`,n.keyManagementAlgorithms),c=n&&Hy(`contentEncryptionAlgorithms`,n.contentEncryptionAlgorithms);if(s&&!s.has(a)||!s&&a.startsWith(`PBES2`))throw new D_(`"alg" (Algorithm) Header Parameter value not allowed`);if(c&&!c.has(o))throw new D_(`"enc" (Encryption Algorithm) Header Parameter value not allowed`);let l;if(e.encrypted_key!==void 0)try{l=W(e.encrypted_key)}catch{throw new q(`Failed to base64url decode the encrypted_key`)}let u=!1;typeof t==`function`&&(t=await t(r,e),u=!0);let d;try{d=await Ry(a,t,l,i,n)}catch(e){if(e instanceof TypeError||e instanceof q||e instanceof K)throw e;d=sy(o)}let f,p;if(e.iv!==void 0)try{f=W(e.iv)}catch{throw new q(`Failed to base64url decode the iv`)}if(e.tag!==void 0)try{p=W(e.tag)}catch{throw new q(`Failed to base64url decode the tag`)}let m=V.encode(e.protected??``),h;h=e.aad===void 0?m:p_(m,V.encode(`.`),V.encode(e.aad));let g;try{g=W(e.ciphertext)}catch{throw new q(`Failed to base64url decode the ciphertext`)}let _={plaintext:await _v(o,d,g,f,p,h)};if(e.protected!==void 0&&(_.protectedHeader=r),e.aad!==void 0)try{_.additionalAuthenticatedData=W(e.aad)}catch{throw new q(`Failed to base64url decode the aad`)}return e.unprotected!==void 0&&(_.sharedUnprotectedHeader=e.unprotected),e.header!==void 0&&(_.unprotectedHeader=e.header),u?{..._,key:t}:_}var Gy=t((()=>{C_(),vv(),Y(),bv(),Sv(),zy(),H(),cy(),Vy(),Uy()}));async function Ky(e,t,n){if(e instanceof Uint8Array&&(e=b_.decode(e)),typeof e!=`string`)throw new q(`Compact JWE must be a string or Uint8Array`);let{0:r,1:i,2:a,3:o,4:s,length:c}=e.split(`.`);if(c!==5)throw new q(`Invalid Compact JWE`);let l=await Wy({ciphertext:o,iv:a||void 0,protected:r,tag:s||void 0,encrypted_key:i||void 0},t,n),u={plaintext:l.plaintext,protectedHeader:l.protectedHeader};return typeof t==`function`?{...u,key:l.key}:u}var qy=t((()=>{Gy(),Y(),H()}));async function Jy(e,t,n){if(!Q(e))throw new q(`General JWE must be an object`);if(!Array.isArray(e.recipients)||!e.recipients.every(Q))throw new q(`JWE Recipients missing or incorrect type`);if(!e.recipients.length)throw new q(`JWE Recipients has no members`);for(let r of e.recipients)try{return await Wy({aad:e.aad,ciphertext:e.ciphertext,encrypted_key:r.encrypted_key,header:r.header,iv:e.iv,protected:e.protected,tag:e.tag,unprotected:e.unprotected},t,n)}catch{}throw new O_}var Yy=t((()=>{Gy(),Y(),Sv()})),Xy,Zy=t((()=>{Xy=Symbol()})),Qy,$y=t((()=>{C_(),Y(),Q_(),U_(),lv(),mv(),Qy=e=>{let t;if(Z_(e)){if(!e.extractable)throw TypeError(`CryptoKey is not extractable`);t=nl.from(e)}else if(H_(e))t=e;else if(e instanceof Uint8Array)return{kty:`oct`,k:U(e)};else throw TypeError(cv(e,...Z,`Uint8Array`));if(t.type!==`secret`&&![`rsa`,`ec`,`ed25519`,`x25519`,`ed448`,`x448`].includes(t.asymmetricKeyType))throw new K(`Unsupported key asymmetricKeyType`);return t.export({format:`jwk`})}}));async function eb(e){return uy(e)}async function tb(e){return dy(e)}async function nb(e){return Qy(e)}var rb=t((()=>{hy(),$y()}));async function ib(e,t,n,r,i={}){let a,o,s;switch(Oy(e,n,`encrypt`),n=await iy.normalizePublicKey?.(n,e)||n,e){case`dir`:s=n;break;case`ECDH-ES`:case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{if(!zv(n))throw new K(`ECDH with the provided key is not allowed or not supported by your javascript runtime`);let{apu:c,apv:l}=i,{epk:u}=i;u||=(await Lv(n)).privateKey;let{x:d,y:f,crv:p,kty:m}=await nb(u),h=await Iv(n,u,e===`ECDH-ES`?t:e,e===`ECDH-ES`?oy(t):parseInt(e.slice(-5,-2),10),c,l);if(o={epk:{x:d,crv:p,kty:m}},m===`EC`&&(o.epk.y=f),c&&(o.apu=U(c)),l&&(o.apv=U(l)),e===`ECDH-ES`){s=h;break}s=r||sy(t),a=await Tv(e.slice(-6),h,s);break}case`RSA1_5`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:s=r||sy(t),a=await ty(e,n,s);break;case`PBES2-HS256+A128KW`:case`PBES2-HS384+A192KW`:case`PBES2-HS512+A256KW`:{s=r||sy(t);let{p2c:c,p2s:l}=i;({encryptedKey:a,...o}=await Gv(e,n,s,c,l));break}case`A128KW`:case`A192KW`:case`A256KW`:s=r||sy(t),a=await Tv(e,n,s);break;case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:{s=r||sy(t);let{iv:c}=i;({encryptedKey:a,...o}=await Fy(e,n,s,c));break}default:throw new K(`Invalid or unsupported "alg" (JWE Algorithm) header value`)}return{cek:s,encryptedKey:a,parameters:o}}var ab=t((()=>{Dv(),Bv(),qv(),ry(),C_(),ay(),cy(),Y(),rb(),Ay(),Ly()})),ob,sb=t((()=>{C_(),Zy(),Py(),ab(),Y(),bv(),H(),Vy(),ob=class{_plaintext;_protectedHeader;_sharedUnprotectedHeader;_unprotectedHeader;_aad;_cek;_iv;_keyManagementParameters;constructor(e){if(!(e instanceof Uint8Array))throw TypeError(`plaintext must be an instance of Uint8Array`);this._plaintext=e}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError(`setKeyManagementParameters can only be called once`);return this._keyManagementParameters=e,this}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._sharedUnprotectedHeader)throw TypeError(`setSharedUnprotectedHeader can only be called once`);return this._sharedUnprotectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError(`setContentEncryptionKey can only be called once`);return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError(`setInitializationVector can only be called once`);return this._iv=e,this}async encrypt(e,t){if(!this._protectedHeader&&!this._unprotectedHeader&&!this._sharedUnprotectedHeader)throw new q(`either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()`);if(!yv(this._protectedHeader,this._unprotectedHeader,this._sharedUnprotectedHeader))throw new q(`JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint`);let n={...this._protectedHeader,...this._unprotectedHeader,...this._sharedUnprotectedHeader};if(By(q,new Map,t?.crit,this._protectedHeader,n),n.zip!==void 0)throw new K(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`);let{alg:r,enc:i}=n;if(typeof r!=`string`||!r)throw new q(`JWE "alg" (Algorithm) Header Parameter missing or invalid`);if(typeof i!=`string`||!i)throw new q(`JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid`);let a;if(this._cek&&(r===`dir`||r===`ECDH-ES`))throw TypeError(`setContentEncryptionKey cannot be called with JWE "alg" (Algorithm) Header ${r}`);let o;{let n;({cek:o,encryptedKey:a,parameters:n}=await ib(r,i,e,this._cek,this._keyManagementParameters)),n&&(t&&Xy in t?this._unprotectedHeader?this._unprotectedHeader={...this._unprotectedHeader,...n}:this.setUnprotectedHeader(n):this._protectedHeader?this._protectedHeader={...this._protectedHeader,...n}:this.setProtectedHeader(n))}let s,c,l;c=this._protectedHeader?V.encode(U(JSON.stringify(this._protectedHeader))):V.encode(``),this._aad?(l=U(this._aad),s=p_(c,V.encode(`.`),V.encode(l))):s=c;let{ciphertext:u,tag:d,iv:f}=await Ny(i,this._plaintext,o,this._iv,s),p={ciphertext:U(u)};return f&&(p.iv=U(f)),d&&(p.tag=U(d)),a&&(p.encrypted_key=U(a)),l&&(p.aad=l),this._protectedHeader&&(p.protected=b_.decode(c)),this._sharedUnprotectedHeader&&(p.unprotected=this._sharedUnprotectedHeader),this._unprotectedHeader&&(p.header=this._unprotectedHeader),p}}})),cb,lb,ub=t((()=>{sb(),Zy(),Y(),cy(),bv(),ab(),C_(),Vy(),cb=class{parent;unprotectedHeader;key;options;constructor(e,t,n){this.parent=e,this.key=t,this.options=n}setUnprotectedHeader(e){if(this.unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this.unprotectedHeader=e,this}addRecipient(...e){return this.parent.addRecipient(...e)}encrypt(...e){return this.parent.encrypt(...e)}done(){return this.parent}},lb=class{_plaintext;_recipients=[];_protectedHeader;_unprotectedHeader;_aad;constructor(e){this._plaintext=e}addRecipient(e,t){let n=new cb(this,e,{crit:t?.crit});return this._recipients.push(n),n}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setSharedUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setSharedUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}setAdditionalAuthenticatedData(e){return this._aad=e,this}async encrypt(){if(!this._recipients.length)throw new q(`at least one recipient must be added`);if(this._recipients.length===1){let[e]=this._recipients,t=await new ob(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(e.unprotectedHeader).encrypt(e.key,{...e.options}),n={ciphertext:t.ciphertext,iv:t.iv,recipients:[{}],tag:t.tag};return t.aad&&(n.aad=t.aad),t.protected&&(n.protected=t.protected),t.unprotected&&(n.unprotected=t.unprotected),t.encrypted_key&&(n.recipients[0].encrypted_key=t.encrypted_key),t.header&&(n.recipients[0].header=t.header),n}let e;for(let t=0;t<this._recipients.length;t++){let n=this._recipients[t];if(!yv(this._protectedHeader,this._unprotectedHeader,n.unprotectedHeader))throw new q(`JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint`);let r={...this._protectedHeader,...this._unprotectedHeader,...n.unprotectedHeader},{alg:i}=r;if(typeof i!=`string`||!i)throw new q(`JWE "alg" (Algorithm) Header Parameter missing or invalid`);if(i===`dir`||i===`ECDH-ES`)throw new q(`"dir" and "ECDH-ES" alg may only be used with a single recipient`);if(typeof r.enc!=`string`||!r.enc)throw new q(`JWE "enc" (Encryption Algorithm) Header Parameter missing or invalid`);if(!e)e=r.enc;else if(e!==r.enc)throw new q(`JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients`);if(By(q,new Map,n.options.crit,this._protectedHeader,r),r.zip!==void 0)throw new K(`JWE "zip" (Compression Algorithm) Header Parameter is not supported.`)}let t=sy(e),n={ciphertext:``,iv:``,recipients:[],tag:``};for(let r=0;r<this._recipients.length;r++){let i=this._recipients[r],a={};n.recipients.push(a);let o={...this._protectedHeader,...this._unprotectedHeader,...i.unprotectedHeader}.alg.startsWith(`PBES2`)?2048+r:void 0;if(r===0){let e=await new ob(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(t).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(i.unprotectedHeader).setKeyManagementParameters({p2c:o}).encrypt(i.key,{...i.options,[Xy]:!0});n.ciphertext=e.ciphertext,n.iv=e.iv,n.tag=e.tag,e.aad&&(n.aad=e.aad),e.protected&&(n.protected=e.protected),e.unprotected&&(n.unprotected=e.unprotected),a.encrypted_key=e.encrypted_key,e.header&&(a.header=e.header);continue}let{encryptedKey:s,parameters:c}=await ib(i.unprotectedHeader?.alg||this._protectedHeader?.alg||this._unprotectedHeader?.alg,e,i.key,t,{p2c:o});a.encrypted_key=U(s),(i.unprotectedHeader||c)&&(a.header={...i.unprotectedHeader,...c})}return n}}}));function db(e){switch(e){case`PS256`:case`RS256`:case`ES256`:case`ES256K`:return`sha256`;case`PS384`:case`RS384`:case`ES384`:return`sha384`;case`PS512`:case`RS512`:case`ES512`:return`sha512`;case`Ed25519`:case`EdDSA`:return;default:throw new K(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}var fb=t((()=>{Y()}));function pb(e,t){let n,r,i;if(t instanceof nl)n=t.asymmetricKeyType,r=t.asymmetricKeyDetails;else switch(i=!0,t.kty){case`RSA`:n=`rsa`;break;case`EC`:n=`ec`;break;case`OKP`:if(t.crv===`Ed25519`){n=`ed25519`;break}if(t.crv===`Ed448`){n=`ed448`;break}throw TypeError(`Invalid key for this operation, its crv must be Ed25519 or Ed448`);default:throw TypeError(`Invalid key for this operation, its kty must be RSA, OKP, or EC`)}let a;switch(e){case`Ed25519`:if(n!==`ed25519`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be ed25519`);break;case`EdDSA`:if(![`ed25519`,`ed448`].includes(n))throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be ed25519 or ed448`);break;case`RS256`:case`RS384`:case`RS512`:if(n!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa`);Jv(t,e);break;case`PS256`:case`PS384`:case`PS512`:if(n===`rsa-pss`){let{hashAlgorithm:t,mgf1HashAlgorithm:n,saltLength:i}=r,a=parseInt(e.slice(-3),10);if(t!==void 0&&(t!==`sha${a}`||n!==t))throw TypeError(`Invalid key for this operation, its RSA-PSS parameters do not meet the requirements of "alg" ${e}`);if(i!==void 0&&i>a>>3)throw TypeError(`Invalid key for this operation, its RSA-PSS parameter saltLength does not meet the requirements of "alg" ${e}`)}else if(n!==`rsa`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be rsa or rsa-pss`);Jv(t,e),a={padding:rl.RSA_PKCS1_PSS_PADDING,saltLength:rl.RSA_PSS_SALTLEN_DIGEST};break;case`ES256`:case`ES256K`:case`ES384`:case`ES512`:{if(n!==`ec`)throw TypeError(`Invalid key for this operation, its asymmetricKeyType must be ec`);let r=Pv(t),i=mb.get(e);if(r!==i)throw TypeError(`Invalid key curve for the algorithm, its curve must be ${i}, got ${r}`);a={dsaEncoding:`ieee-p1363`};break}default:throw new K(`alg ${e} is not supported either by JOSE or your javascript runtime`)}return i?{format:`jwk`,key:t,...a}:a?{...a,key:t}:t}var mb,hb=t((()=>{Fv(),Y(),Yv(),mb=new Map([[`ES256`,`P-256`],[`ES256K`,`secp256k1`],[`ES384`,`P-384`],[`ES512`,`P-521`]])}));function gb(e){switch(e){case`HS256`:return`sha256`;case`HS384`:return`sha384`;case`HS512`:return`sha512`;default:throw new K(`alg ${e} is not supported either by JOSE or your javascript runtime`)}}var _b=t((()=>{Y()}));function vb(e,t,n){if(t instanceof Uint8Array){if(!e.startsWith(`HS`))throw TypeError(cv(t,...Z));return ul(t)}if(t instanceof nl)return t;if(Z_(t))return rv(t,e,n),nl.from(t);if(Ov(t))return e.startsWith(`HS`)?ul(Buffer.from(t.k,`base64url`)):t;throw TypeError(cv(t,...Z,`Uint8Array`,`JSON Web Key`))}var yb=t((()=>{Q_(),av(),lv(),mv(),Mv()})),bb,xb,Sb=t((()=>{fb(),_b(),hb(),yb(),bb=Cl(tl.sign),xb=async(e,t,n)=>{let r=vb(e,t,`sign`);if(e.startsWith(`HS`)){let t=tl.createHmac(gb(e),r);return t.update(n),t.digest()}return bb(db(e),n,pb(e,r))}})),Cb,wb,Tb=t((()=>{fb(),hb(),Sb(),yb(),Cb=Cl(tl.verify),wb=async(e,t,n,r)=>{let i=vb(e,t,`verify`);if(e.startsWith(`HS`)){let t=await xb(e,i,r),a=n;try{return tl.timingSafeEqual(a,t)}catch{return!1}}let a=db(e),o=pb(e,i);try{return await Cb(a,r,o,n)}catch{return!1}}}));async function Eb(e,t,n){if(!Q(e))throw new J(`Flattened JWS must be an object`);if(e.protected===void 0&&e.header===void 0)throw new J(`Flattened JWS must have either of the "protected" or "header" members`);if(e.protected!==void 0&&typeof e.protected!=`string`)throw new J(`JWS Protected Header incorrect type`);if(e.payload===void 0)throw new J(`JWS Payload missing`);if(typeof e.signature!=`string`)throw new J(`JWS Signature missing or incorrect type`);if(e.header!==void 0&&!Q(e.header))throw new J(`JWS Unprotected Header incorrect type`);let r={};if(e.protected)try{let t=W(e.protected);r=JSON.parse(b_.decode(t))}catch{throw new J(`JWS Protected Header is invalid`)}if(!yv(r,e.header))throw new J(`JWS Protected and JWS Unprotected Header Parameter names must be disjoint`);let i={...r,...e.header},a=By(J,new Map([[`b64`,!0]]),n?.crit,r,i),o=!0;if(a.has(`b64`)&&(o=r.b64,typeof o!=`boolean`))throw new J(`The "b64" (base64url-encode payload) Header Parameter must be a boolean`);let{alg:s}=i;if(typeof s!=`string`||!s)throw new J(`JWS "alg" (Algorithm) Header Parameter missing or invalid`);let c=n&&Hy(`algorithms`,n.algorithms);if(c&&!c.has(s))throw new D_(`"alg" (Algorithm) Header Parameter value not allowed`);if(o){if(typeof e.payload!=`string`)throw new J(`JWS Payload must be a string`)}else if(typeof e.payload!=`string`&&!(e.payload instanceof Uint8Array))throw new J(`JWS Payload must be a string or an Uint8Array instance`);let l=!1;typeof t==`function`?(t=await t(r,e),l=!0,ky(s,t,`verify`),Ov(t)&&(t=await xy(t,s))):ky(s,t,`verify`);let u=p_(V.encode(e.protected??``),V.encode(`.`),typeof e.payload==`string`?V.encode(e.payload):e.payload),d;try{d=W(e.signature)}catch{throw new J(`Failed to base64url decode the signature`)}if(!await wb(s,t,d,u))throw new F_;let f;if(o)try{f=W(e.payload)}catch{throw new J(`Failed to base64url decode the payload`)}else f=typeof e.payload==`string`?V.encode(e.payload):e.payload;let p={payload:f};return e.protected!==void 0&&(p.protectedHeader=r),e.header!==void 0&&(p.unprotectedHeader=e.header),l?{...p,key:t}:p}var Db=t((()=>{C_(),Tb(),Y(),H(),bv(),Sv(),Ay(),Vy(),Uy(),Mv(),Sy()}));async function Ob(e,t,n){if(e instanceof Uint8Array&&(e=b_.decode(e)),typeof e!=`string`)throw new J(`Compact JWS must be a string or Uint8Array`);let{0:r,1:i,2:a,length:o}=e.split(`.`);if(o!==3)throw new J(`Invalid Compact JWS`);let s=await Eb({payload:i,protected:r,signature:a},t,n),c={payload:s.payload,protectedHeader:s.protectedHeader};return typeof t==`function`?{...c,key:s.key}:c}var kb=t((()=>{Db(),Y(),H()}));async function Ab(e,t,n){if(!Q(e))throw new J(`General JWS must be an object`);if(!Array.isArray(e.signatures)||!e.signatures.every(Q))throw new J(`JWS Signatures missing or incorrect type`);for(let r of e.signatures)try{return await Eb({header:r.header,payload:e.payload,protected:r.protected,signature:r.signature},t,n)}catch{}throw new F_}var jb=t((()=>{Db(),Y(),Sv()})),Mb,Nb=t((()=>{Mb=e=>Math.floor(e.getTime()/1e3)})),Pb,Fb,Ib,Lb,Rb,zb,Bb,Vb=t((()=>{Pb=60,Fb=Pb*60,Ib=Fb*24,Lb=Ib*7,Rb=Ib*365.25,zb=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,Bb=e=>{let t=zb.exec(e);if(!t||t[4]&&t[1])throw TypeError(`Invalid time period format`);let n=parseFloat(t[2]),r=t[3].toLowerCase(),i;switch(r){case`sec`:case`secs`:case`second`:case`seconds`:case`s`:i=Math.round(n);break;case`minute`:case`minutes`:case`min`:case`mins`:case`m`:i=Math.round(n*Pb);break;case`hour`:case`hours`:case`hr`:case`hrs`:case`h`:i=Math.round(n*Fb);break;case`day`:case`days`:case`d`:i=Math.round(n*Ib);break;case`week`:case`weeks`:case`w`:i=Math.round(n*Lb);break;default:i=Math.round(n*Rb);break}return t[1]===`-`||t[4]===`ago`?-i:i}})),Hb,Ub,Wb,Gb=t((()=>{Y(),H(),Nb(),Vb(),Sv(),Hb=e=>e.toLowerCase().replace(/^application\//,``),Ub=(e,t)=>typeof e==`string`?t.includes(e):Array.isArray(e)?t.some(Set.prototype.has.bind(new Set(e))):!1,Wb=(e,t,n={})=>{let r;try{r=JSON.parse(b_.decode(t))}catch{}if(!Q(r))throw new k_(`JWT Claims Set must be a top-level JSON object`);let{typ:i}=n;if(i&&(typeof e.typ!=`string`||Hb(e.typ)!==Hb(i)))throw new T_(`unexpected "typ" JWT header value`,r,`typ`,`check_failed`);let{requiredClaims:a=[],issuer:o,subject:s,audience:c,maxTokenAge:l}=n,u=[...a];l!==void 0&&u.push(`iat`),c!==void 0&&u.push(`aud`),s!==void 0&&u.push(`sub`),o!==void 0&&u.push(`iss`);for(let e of new Set(u.reverse()))if(!(e in r))throw new T_(`missing required "${e}" claim`,r,e,`missing`);if(o&&!(Array.isArray(o)?o:[o]).includes(r.iss))throw new T_(`unexpected "iss" claim value`,r,`iss`,`check_failed`);if(s&&r.sub!==s)throw new T_(`unexpected "sub" claim value`,r,`sub`,`check_failed`);if(c&&!Ub(r.aud,typeof c==`string`?[c]:c))throw new T_(`unexpected "aud" claim value`,r,`aud`,`check_failed`);let d;switch(typeof n.clockTolerance){case`string`:d=Bb(n.clockTolerance);break;case`number`:d=n.clockTolerance;break;case`undefined`:d=0;break;default:throw TypeError(`Invalid clockTolerance option type`)}let{currentDate:f}=n,p=Mb(f||new Date);if((r.iat!==void 0||l)&&typeof r.iat!=`number`)throw new T_(`"iat" claim must be a number`,r,`iat`,`invalid`);if(r.nbf!==void 0){if(typeof r.nbf!=`number`)throw new T_(`"nbf" claim must be a number`,r,`nbf`,`invalid`);if(r.nbf>p+d)throw new T_(`"nbf" claim timestamp check failed`,r,`nbf`,`check_failed`)}if(r.exp!==void 0){if(typeof r.exp!=`number`)throw new T_(`"exp" claim must be a number`,r,`exp`,`invalid`);if(r.exp<=p-d)throw new E_(`"exp" claim timestamp check failed`,r,`exp`,`check_failed`)}if(l){let e=p-r.iat,t=typeof l==`number`?l:Bb(l);if(e-d>t)throw new E_(`"iat" claim timestamp check failed (too far in the past)`,r,`iat`,`check_failed`);if(e<0-d)throw new T_(`"iat" claim timestamp check failed (it should be in the past)`,r,`iat`,`check_failed`)}return r}}));async function Kb(e,t,n){let r=await Ob(e,t,n);if(r.protectedHeader.crit?.includes(`b64`)&&r.protectedHeader.b64===!1)throw new k_(`JWTs MUST NOT use unencoded payload`);let i={payload:Wb(r.protectedHeader,r.payload,n),protectedHeader:r.protectedHeader};return typeof t==`function`?{...i,key:r.key}:i}var qb=t((()=>{kb(),Gb(),Y()}));async function Jb(e,t,n){let r=await Ky(e,t,n),i=Wb(r.protectedHeader,r.plaintext,n),{protectedHeader:a}=r;if(a.iss!==void 0&&a.iss!==i.iss)throw new T_(`replicated "iss" claim header parameter mismatch`,i,`iss`,`mismatch`);if(a.sub!==void 0&&a.sub!==i.sub)throw new T_(`replicated "sub" claim header parameter mismatch`,i,`sub`,`mismatch`);if(a.aud!==void 0&&JSON.stringify(a.aud)!==JSON.stringify(i.aud))throw new T_(`replicated "aud" claim header parameter mismatch`,i,`aud`,`mismatch`);let o={payload:i,protectedHeader:a};return typeof t==`function`?{...o,key:r.key}:o}var Yb=t((()=>{qy(),Gb(),Y()})),Xb,Zb=t((()=>{sb(),Xb=class{_flattened;constructor(e){this._flattened=new ob(e)}setContentEncryptionKey(e){return this._flattened.setContentEncryptionKey(e),this}setInitializationVector(e){return this._flattened.setInitializationVector(e),this}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}setKeyManagementParameters(e){return this._flattened.setKeyManagementParameters(e),this}async encrypt(e,t){let n=await this._flattened.encrypt(e,t);return[n.protected,n.encrypted_key,n.iv,n.ciphertext,n.tag].join(`.`)}}})),Qb,$b=t((()=>{C_(),Sb(),bv(),Y(),H(),Ay(),Vy(),Qb=class{_payload;_protectedHeader;_unprotectedHeader;constructor(e){if(!(e instanceof Uint8Array))throw TypeError(`payload must be an instance of Uint8Array`);this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this._unprotectedHeader=e,this}async sign(e,t){if(!this._protectedHeader&&!this._unprotectedHeader)throw new J(`either setProtectedHeader or setUnprotectedHeader must be called before #sign()`);if(!yv(this._protectedHeader,this._unprotectedHeader))throw new J(`JWS Protected and JWS Unprotected Header Parameter names must be disjoint`);let n={...this._protectedHeader,...this._unprotectedHeader},r=By(J,new Map([[`b64`,!0]]),t?.crit,this._protectedHeader,n),i=!0;if(r.has(`b64`)&&(i=this._protectedHeader.b64,typeof i!=`boolean`))throw new J(`The "b64" (base64url-encode payload) Header Parameter must be a boolean`);let{alg:a}=n;if(typeof a!=`string`||!a)throw new J(`JWS "alg" (Algorithm) Header Parameter missing or invalid`);ky(a,e,`sign`);let o=this._payload;i&&(o=V.encode(U(o)));let s;s=this._protectedHeader?V.encode(U(JSON.stringify(this._protectedHeader))):V.encode(``);let c={signature:U(await xb(a,e,p_(s,V.encode(`.`),o))),payload:``};return i&&(c.payload=b_.decode(o)),this._unprotectedHeader&&(c.header=this._unprotectedHeader),this._protectedHeader&&(c.protected=b_.decode(s)),c}}})),ex,tx=t((()=>{$b(),ex=class{_flattened;constructor(e){this._flattened=new Qb(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,t){let n=await this._flattened.sign(e,t);if(n.payload===void 0)throw TypeError(`use the flattened module for creating JWS with b64: false`);return`${n.protected}.${n.payload}.${n.signature}`}}})),nx,rx,ix=t((()=>{$b(),Y(),nx=class{parent;protectedHeader;unprotectedHeader;options;key;constructor(e,t,n){this.parent=e,this.key=t,this.options=n}setProtectedHeader(e){if(this.protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this.protectedHeader=e,this}setUnprotectedHeader(e){if(this.unprotectedHeader)throw TypeError(`setUnprotectedHeader can only be called once`);return this.unprotectedHeader=e,this}addSignature(...e){return this.parent.addSignature(...e)}sign(...e){return this.parent.sign(...e)}done(){return this.parent}},rx=class{_payload;_signatures=[];constructor(e){this._payload=e}addSignature(e,t){let n=new nx(this,e,t);return this._signatures.push(n),n}async sign(){if(!this._signatures.length)throw new J(`at least one signature must be added`);let e={signatures:[],payload:``};for(let t=0;t<this._signatures.length;t++){let n=this._signatures[t],r=new Qb(this._payload);r.setProtectedHeader(n.protectedHeader),r.setUnprotectedHeader(n.unprotectedHeader);let{payload:i,...a}=await r.sign(n.key,n.options);if(t===0)e.payload=i;else if(e.payload!==i)throw new J(`inconsistent use of JWS Unencoded Payload (RFC7797)`);e.signatures.push(a)}return e}}}));function ax(e,t){if(!Number.isFinite(t))throw TypeError(`Invalid ${e} input`);return t}var ox,sx=t((()=>{Nb(),Sv(),Vb(),ox=class{_payload;constructor(e={}){if(!Q(e))throw TypeError(`JWT Claims Set MUST be an object`);this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return typeof e==`number`?this._payload={...this._payload,nbf:ax(`setNotBefore`,e)}:e instanceof Date?this._payload={...this._payload,nbf:ax(`setNotBefore`,Mb(e))}:this._payload={...this._payload,nbf:Mb(new Date)+Bb(e)},this}setExpirationTime(e){return typeof e==`number`?this._payload={...this._payload,exp:ax(`setExpirationTime`,e)}:e instanceof Date?this._payload={...this._payload,exp:ax(`setExpirationTime`,Mb(e))}:this._payload={...this._payload,exp:Mb(new Date)+Bb(e)},this}setIssuedAt(e){return e===void 0?this._payload={...this._payload,iat:Mb(new Date)}:e instanceof Date?this._payload={...this._payload,iat:ax(`setIssuedAt`,Mb(e))}:typeof e==`string`?this._payload={...this._payload,iat:ax(`setIssuedAt`,Mb(new Date)+Bb(e))}:this._payload={...this._payload,iat:ax(`setIssuedAt`,e)},this}}})),cx,lx=t((()=>{tx(),Y(),H(),sx(),cx=class extends ox{_protectedHeader;setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,t){let n=new ex(V.encode(JSON.stringify(this._payload)));if(n.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes(`b64`)&&this._protectedHeader.b64===!1)throw new k_(`JWTs MUST NOT use unencoded payload`);return n.sign(e,t)}}})),ux,dx=t((()=>{Zb(),H(),sx(),ux=class extends ox{_cek;_iv;_keyManagementParameters;_protectedHeader;_replicateIssuerAsHeader;_replicateSubjectAsHeader;_replicateAudienceAsHeader;setProtectedHeader(e){if(this._protectedHeader)throw TypeError(`setProtectedHeader can only be called once`);return this._protectedHeader=e,this}setKeyManagementParameters(e){if(this._keyManagementParameters)throw TypeError(`setKeyManagementParameters can only be called once`);return this._keyManagementParameters=e,this}setContentEncryptionKey(e){if(this._cek)throw TypeError(`setContentEncryptionKey can only be called once`);return this._cek=e,this}setInitializationVector(e){if(this._iv)throw TypeError(`setInitializationVector can only be called once`);return this._iv=e,this}replicateIssuerAsHeader(){return this._replicateIssuerAsHeader=!0,this}replicateSubjectAsHeader(){return this._replicateSubjectAsHeader=!0,this}replicateAudienceAsHeader(){return this._replicateAudienceAsHeader=!0,this}async encrypt(e,t){let n=new Xb(V.encode(JSON.stringify(this._payload)));return this._replicateIssuerAsHeader&&(this._protectedHeader={...this._protectedHeader,iss:this._payload.iss}),this._replicateSubjectAsHeader&&(this._protectedHeader={...this._protectedHeader,sub:this._payload.sub}),this._replicateAudienceAsHeader&&(this._protectedHeader={...this._protectedHeader,aud:this._payload.aud}),n.setProtectedHeader(this._protectedHeader),this._iv&&n.setInitializationVector(this._iv),this._cek&&n.setContentEncryptionKey(this._cek),this._keyManagementParameters&&n.setKeyManagementParameters(this._keyManagementParameters),n.encrypt(e,t)}}}));async function fx(e,t){if(!Q(e))throw TypeError(`JWK must be an object`);if(t??=`sha256`,t!==`sha256`&&t!==`sha384`&&t!==`sha512`)throw TypeError(`digestAlgorithm must one of "sha256", "sha384", or "sha512"`);let n;switch(e.kty){case`EC`:mx(e.crv,`"crv" (Curve) Parameter`),mx(e.x,`"x" (X Coordinate) Parameter`),mx(e.y,`"y" (Y Coordinate) Parameter`),n={crv:e.crv,kty:e.kty,x:e.x,y:e.y};break;case`OKP`:mx(e.crv,`"crv" (Subtype of Key Pair) Parameter`),mx(e.x,`"x" (Public Key) Parameter`),n={crv:e.crv,kty:e.kty,x:e.x};break;case`RSA`:mx(e.e,`"e" (Exponent) Parameter`),mx(e.n,`"n" (Modulus) Parameter`),n={e:e.e,kty:e.kty,n:e.n};break;case`oct`:mx(e.k,`"k" (Key Value) Parameter`),n={k:e.k,kty:e.kty};break;default:throw new K(`"kty" (Key Type) Parameter missing or unsupported`)}let r=V.encode(JSON.stringify(n));return U(await d_(t,r))}async function px(e,t){t??=`sha256`;let n=await fx(e,t);return`urn:ietf:params:oauth:jwk-thumbprint:sha-${t.slice(-3)}:${n}`}var mx,hx=t((()=>{f_(),C_(),Y(),H(),Sv(),mx=(e,t)=>{if(typeof e!=`string`||!e)throw new A_(`${t} missing or invalid`)}}));async function gx(e,t){let n={...e,...t?.header};if(!Q(n.jwk))throw new J(`"jwk" (JSON Web Key) Header Parameter must be a JSON object`);let r=await xy({...n.jwk,ext:!0},n.alg);if(r instanceof Uint8Array||r.type!==`public`)throw new J(`"jwk" (JSON Web Key) Header Parameter must be a public key`);return r}var _x=t((()=>{Sy(),Sv(),Y()}));function vx(e){switch(typeof e==`string`&&e.slice(0,2)){case`RS`:case`PS`:return`RSA`;case`ES`:return`EC`;case`Ed`:return`OKP`;default:throw new K(`Unsupported "alg" value for a JSON Web Key Set`)}}function yx(e){return e&&typeof e==`object`&&Array.isArray(e.keys)&&e.keys.every(bx)}function bx(e){return Q(e)}function xx(e){return typeof structuredClone==`function`?structuredClone(e):JSON.parse(JSON.stringify(e))}async function Sx(e,t,n){let r=e.get(t)||e.set(t,{}).get(t);if(r[n]===void 0){let e=await xy({...t,ext:!0},n);if(e instanceof Uint8Array||e.type!==`public`)throw new j_(`JSON Web Key Set members must be public keys`);r[n]=e}return r[n]}function Cx(e){let t=new wx(e),n=async(e,n)=>t.getKey(e,n);return Object.defineProperties(n,{jwks:{value:()=>xx(t._jwks),enumerable:!0,configurable:!1,writable:!1}}),n}var wx,Tx=t((()=>{Sy(),Y(),Sv(),wx=class{_jwks;_cached=new WeakMap;constructor(e){if(!yx(e))throw new j_(`JSON Web Key Set malformed`);this._jwks=xx(e)}async getKey(e,t){let{alg:n,kid:r}={...e,...t?.header},i=vx(n),a=this._jwks.keys.filter(e=>{let t=i===e.kty;if(t&&typeof r==`string`&&(t=r===e.kid),t&&typeof e.alg==`string`&&(t=n===e.alg),t&&typeof e.use==`string`&&(t=e.use===`sig`),t&&Array.isArray(e.key_ops)&&(t=e.key_ops.includes(`verify`)),t)switch(n){case`ES256`:t=e.crv===`P-256`;break;case`ES256K`:t=e.crv===`secp256k1`;break;case`ES384`:t=e.crv===`P-384`;break;case`ES512`:t=e.crv===`P-521`;break;case`Ed25519`:t=e.crv===`Ed25519`;break;case`EdDSA`:t=e.crv===`Ed25519`||e.crv===`Ed448`;break}return t}),{0:o,length:s}=a;if(s===0)throw new M_;if(s!==1){let e=new N_,{_cached:t}=this;throw e[Symbol.asyncIterator]=async function*(){for(let e of a)try{yield await Sx(t,e,n)}catch{}},e}return Sx(this._cached,o,n)}}})),Ex,Dx=t((()=>{Y(),H(),Ex=async(e,t,n)=>{let r;switch(e.protocol){case`https:`:r=jl.get;break;case`http:`:r=El.get;break;default:throw TypeError(`Unsupported URL protocol.`)}let{agent:i,headers:a}=n,o=r(e.href,{agent:i,timeout:t,headers:a}),[s]=await Promise.race([Dl(o,`response`),Dl(o,`timeout`)]);if(!s)throw o.destroy(),new P_;if(s.statusCode!==200)throw new G(`Expected 200 OK from the JSON Web Key Set HTTP response`);let c=[];for await(let e of s)c.push(e);try{return JSON.parse(b_.decode(p_(...c)))}catch{throw new G(`Failed to parse the JSON Web Key Set HTTP response as JSON`)}}}));function Ox(){return typeof WebSocketPair<`u`||typeof navigator<`u`&&navigator.userAgent===`Cloudflare-Workers`||typeof EdgeRuntime<`u`&&EdgeRuntime===`vercel`}function kx(e,t){return!(typeof e!=`object`||!e||!(`uat`in e)||typeof e.uat!=`number`||Date.now()-e.uat>=t||!(`jwks`in e)||!Q(e.jwks)||!Array.isArray(e.jwks.keys)||!Array.prototype.every.call(e.jwks.keys,Q))}function Ax(e,t){let n=new Nx(e,t),r=async(e,t)=>n.getKey(e,t);return Object.defineProperties(r,{coolingDown:{get:()=>n.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>n.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>n.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!n._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>n._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),r}var jx,Mx,Nx,Px,Fx=t((()=>{Dx(),Y(),Tx(),Sv(),(typeof navigator>`u`||!navigator.userAgent?.startsWith?.(`Mozilla/5.0 `))&&(jx=`jose/v5.10.0`),Mx=Symbol(),Nx=class{_url;_timeoutDuration;_cooldownDuration;_cacheMaxAge;_jwksTimestamp;_pendingFetch;_options;_local;_cache;constructor(e,t){if(!(e instanceof URL))throw TypeError(`url must be an instance of URL`);this._url=new URL(e.href),this._options={agent:t?.agent,headers:t?.headers},this._timeoutDuration=typeof t?.timeoutDuration==`number`?t?.timeoutDuration:5e3,this._cooldownDuration=typeof t?.cooldownDuration==`number`?t?.cooldownDuration:3e4,this._cacheMaxAge=typeof t?.cacheMaxAge==`number`?t?.cacheMaxAge:6e5,t?.[Mx]!==void 0&&(this._cache=t?.[Mx],kx(t?.[Mx],this._cacheMaxAge)&&(this._jwksTimestamp=this._cache.uat,this._local=Cx(this._cache.jwks)))}coolingDown(){return typeof this._jwksTimestamp==`number`&&Date.now()<this._jwksTimestamp+this._cooldownDuration}fresh(){return typeof this._jwksTimestamp==`number`&&Date.now()<this._jwksTimestamp+this._cacheMaxAge}async getKey(e,t){(!this._local||!this.fresh())&&await this.reload();try{return await this._local(e,t)}catch(n){if(n instanceof M_&&this.coolingDown()===!1)return await this.reload(),this._local(e,t);throw n}}async reload(){this._pendingFetch&&Ox()&&(this._pendingFetch=void 0);let e=new Headers(this._options.headers);jx&&!e.has(`User-Agent`)&&(e.set(`User-Agent`,jx),this._options.headers=Object.fromEntries(e.entries())),this._pendingFetch||=Ex(this._url,this._timeoutDuration,this._options).then(e=>{this._local=Cx(e),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=e),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(e=>{throw this._pendingFetch=void 0,e}),await this._pendingFetch}},Px=Mx})),Ix,Lx=t((()=>{C_(),H(),Y(),Gb(),sx(),Ix=class extends ox{encode(){return`${U(JSON.stringify({alg:`none`}))}.${U(JSON.stringify(this._payload))}.`}static decode(e,t){if(typeof e!=`string`)throw new k_(`Unsecured JWT must be a string`);let{0:n,1:r,2:i,length:a}=e.split(`.`);if(a!==3||i!==``)throw new k_(`Invalid Unsecured JWT`);let o;try{if(o=JSON.parse(b_.decode(W(n))),o.alg!==`none`)throw Error()}catch{throw new k_(`Invalid Unsecured JWT`)}return{payload:Wb(o,W(r),t),header:o}}}})),Rx=r({decode:()=>Bx,encode:()=>zx}),zx,Bx,Vx=t((()=>{C_(),zx=U,Bx=W}));function Hx(e){let t;if(typeof e==`string`){let n=e.split(`.`);(n.length===3||n.length===5)&&([t]=n)}else if(typeof e==`object`&&e)if(`protected`in e)t=e.protected;else throw TypeError(`Token does not contain a Protected Header`);try{if(typeof t!=`string`||!t)throw Error();let e=JSON.parse(b_.decode(Bx(t)));if(!Q(e))throw Error();return e}catch{throw TypeError(`Invalid Token or Protected Header formatting`)}}var Ux=t((()=>{Vx(),H(),Sv()}));function Wx(e){if(typeof e!=`string`)throw new k_(`JWTs must use Compact JWS serialization, JWT must be a string`);let{1:t,length:n}=e.split(`.`);if(n===5)throw new k_(`Only JWTs using Compact JWS serialization can be decoded`);if(n!==3)throw new k_(`Invalid JWT`);if(!t)throw new k_(`JWTs must contain a payload`);let r;try{r=Bx(t)}catch{throw new k_(`Failed to base64url decode the payload`)}let i;try{i=JSON.parse(b_.decode(r))}catch{throw new k_(`Failed to parse the decoded payload as JSON`)}if(!Q(i))throw new k_(`Invalid JWT Claims Set`);return i}var Gx=t((()=>{Vx(),H(),Sv(),Y()}));async function Kx(e,t){let n;switch(e){case`HS256`:case`HS384`:case`HS512`:case`A128CBC-HS256`:case`A192CBC-HS384`:case`A256CBC-HS512`:n=parseInt(e.slice(-3),10);break;case`A128KW`:case`A192KW`:case`A256KW`:case`A128GCMKW`:case`A192GCMKW`:case`A256GCMKW`:case`A128GCM`:case`A192GCM`:case`A256GCM`:n=parseInt(e.slice(1,4),10);break;default:throw new K(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`)}return ul(_l(new Uint8Array(n>>3)))}async function qx(e,t){switch(e){case`RS256`:case`RS384`:case`RS512`:case`PS256`:case`PS384`:case`PS512`:case`RSA-OAEP`:case`RSA-OAEP-256`:case`RSA-OAEP-384`:case`RSA-OAEP-512`:case`RSA1_5`:{let e=t?.modulusLength??2048;if(typeof e!=`number`||e<2048)throw new K(`Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used`);return await Jx(`rsa`,{modulusLength:e,publicExponent:65537})}case`ES256`:return Jx(`ec`,{namedCurve:`P-256`});case`ES256K`:return Jx(`ec`,{namedCurve:`secp256k1`});case`ES384`:return Jx(`ec`,{namedCurve:`P-384`});case`ES512`:return Jx(`ec`,{namedCurve:`P-521`});case`Ed25519`:return Jx(`ed25519`);case`EdDSA`:switch(t?.crv){case void 0:case`Ed25519`:return Jx(`ed25519`);case`Ed448`:return Jx(`ed448`);default:throw new K(`Invalid or unsupported crv option provided, supported values are Ed25519 and Ed448`)}case`ECDH-ES`:case`ECDH-ES+A128KW`:case`ECDH-ES+A192KW`:case`ECDH-ES+A256KW`:{let e=t?.crv??`P-256`;switch(e){case void 0:case`P-256`:case`P-384`:case`P-521`:return Jx(`ec`,{namedCurve:e});case`X25519`:return Jx(`x25519`);case`X448`:return Jx(`x448`);default:throw new K(`Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448`)}}default:throw new K(`Invalid or unsupported JWK "alg" (Algorithm) Parameter value`)}}var Jx,Yx=t((()=>{I_(),Y(),Jx=Cl(fl)}));async function Xx(e,t){return qx(e,t)}var Zx=t((()=>{Yx()}));async function Qx(e,t){return Kx(e,t)}var $x=t((()=>{Yx()})),eS,tS=t((()=>{eS=`node:crypto`})),nS,rS=t((()=>{tS(),nS=eS})),iS=r({CompactEncrypt:()=>Xb,CompactSign:()=>ex,EmbeddedJWK:()=>gx,EncryptJWT:()=>ux,FlattenedEncrypt:()=>ob,FlattenedSign:()=>Qb,GeneralEncrypt:()=>lb,GeneralSign:()=>rx,SignJWT:()=>cx,UnsecuredJWT:()=>Ix,base64url:()=>Rx,calculateJwkThumbprint:()=>fx,calculateJwkThumbprintUri:()=>px,compactDecrypt:()=>Ky,compactVerify:()=>Ob,createLocalJWKSet:()=>Cx,createRemoteJWKSet:()=>Ax,cryptoRuntime:()=>nS,decodeJwt:()=>Wx,decodeProtectedHeader:()=>Hx,errors:()=>w_,experimental_jwksCache:()=>Px,exportJWK:()=>nb,exportPKCS8:()=>tb,exportSPKI:()=>eb,flattenedDecrypt:()=>Wy,flattenedVerify:()=>Eb,generalDecrypt:()=>Jy,generalVerify:()=>Ab,generateKeyPair:()=>Xx,generateSecret:()=>Qx,importJWK:()=>xy,importPKCS8:()=>by,importSPKI:()=>vy,importX509:()=>yy,jwksCache:()=>Mx,jwtDecrypt:()=>Jb,jwtVerify:()=>Kb}),aS=t((()=>{qy(),Gy(),Yy(),ub(),kb(),Db(),jb(),qb(),Yb(),Zb(),sb(),tx(),$b(),ix(),lx(),dx(),hx(),_x(),Tx(),Fx(),Lx(),rb(),Sy(),Ux(),Gx(),Y(),Zx(),$x(),Vx(),rS()})),oS=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{verifyVercelOidcToken:()=>h}),t.exports=c(l);var u=(aS(),c(iS));let d=`https://oidc.vercel.com`,f=new URL(`https://oidc.vercel.com/.well-known/jwks`),p=[`RS256`],m=(0,u.createRemoteJWKSet)(f);async function h(e,t){let{algorithms:n,projectId:r=process.env.VERCEL_PROJECT_ID,environment:i=process.env.VERCEL_TARGET_ENV||process.env.VERCEL_ENV,ownerId:a,...o}=t??{};if(r===`*`&&a===void 0&&!g(o.audience))throw TypeError(`Expected ownerId or audience to be provided when projectId is '*'.`);let s=await(0,u.jwtVerify)(e,m,{...o,algorithms:n??p});return _(s.payload.iss),v({actual:s.payload.project_id,claim:`project_id`,env:`VERCEL_PROJECT_ID`,expected:r,option:`projectId`}),v({actual:s.payload.environment,claim:`environment`,env:`VERCEL_TARGET_ENV or VERCEL_ENV`,expected:i,option:`environment`}),y({actual:s.payload.owner_id,claim:`owner_id`,expected:a}),s}function g(e){return Array.isArray(e)?e.length>0:e!==void 0}function _(e){if(e!==d&&(typeof e!=`string`||!e.startsWith(`${d}/`)))throw TypeError(`Expected Vercel OIDC token iss claim to be "${d}" or to start with "${d}/".`)}function v({actual:e,claim:t,env:n,expected:r,option:i}){if(r!==`*`){if(r===void 0||r.length===0)throw TypeError(`Expected ${n} to be set or ${i} to be provided. Pass ${i}: '*' to allow any ${t} claim.`);if(!(Array.isArray(r)&&typeof e==`string`&&r.includes(e))&&e!==r)throw TypeError(Array.isArray(r)?`Expected Vercel OIDC token ${t} claim to be one of: ${r.map(e=>`"${e}"`).join(`, `)}.`:`Expected Vercel OIDC token ${t} claim to be "${r}".`)}}function y({actual:e,claim:t,expected:n}){if(n!==void 0&&e!==n)throw TypeError(`Expected Vercel OIDC token ${t} claim to be "${n}".`)}0&&(t.exports={verifyVercelOidcToken:h})})),sS=i(((e,t)=>{var n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,o=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},s=(e,t,o,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let c of i(t))!a.call(e,c)&&c!==o&&n(e,c,{get:()=>t[c],enumerable:!(s=r(t,c))||s.enumerable});return e},c=e=>s(n({},`__esModule`,{value:!0}),e),l={};o(l,{AccessTokenMissingError:()=>m.AccessTokenMissingError,RefreshAccessTokenFailedError:()=>m.RefreshAccessTokenFailedError,exchangeVercelOidcToken:()=>h.exchangeVercelOidcToken,getContext:()=>f.getContext,getVercelOidcToken:()=>u.getVercelOidcToken,getVercelOidcTokenSync:()=>d.getVercelOidcTokenSync,getVercelToken:()=>g.getVercelToken,verifyVercelOidcToken:()=>p.verifyVercelOidcToken}),t.exports=c(l);var u=u_(),d=l_(),f=c_(),p=oS(),m=Zc(),h=s_(),g=Qc();0&&(t.exports={AccessTokenMissingError,RefreshAccessTokenFailedError,exchangeVercelOidcToken,getContext,getVercelOidcToken,getVercelOidcTokenSync,getVercelToken,verifyVercelOidcToken})})),cS=n(a_(),1),lS=sS();async function uS(e){let t=0,n=e.getReader(),r=[];try{for(;;){let{done:e,value:i}=await n.read();if(e)break;r.push(i),t+=i.length}}finally{n.releaseLock()}return Buffer.concat(r,t)}var dS=class{contentType=`application/json`;replacer;reviver;constructor(e={}){this.replacer=e.replacer,this.reviver=e.reviver}serialize(e){return Buffer.from(JSON.stringify(e,this.replacer),`utf8`)}async deserialize(e){let t=await uS(e);return JSON.parse(t.toString(`utf8`),this.reviver)}},fS=class extends Error{constructor(e){super(`Message ${e} not found`),this.name=`MessageNotFoundError`}},pS=class extends Error{constructor(e,t){super(`Message ${e} not available for processing${t?`: ${t}`:``}`),this.name=`MessageNotAvailableError`}},mS=class extends Error{constructor(e,t){super(`Message ${e} is corrupted: ${t}`),this.name=`MessageCorruptedError`}},hS=class extends Error{retryAfter;constructor(e=`Too many requests`,t){super(e),this.name=`TooManyRequestsError`,this.retryAfter=t}},gS=class extends Error{constructor(e=`Missing or invalid authentication token`){super(e),this.name=`UnauthorizedError`}},_S=class extends Error{constructor(e=`Queue environment doesn't match token environment`){super(e),this.name=`ForbiddenError`}},vS=class extends Error{constructor(e){super(e),this.name=`BadRequestError`}},yS=class extends Error{constructor(e=`Unexpected server error`){super(e),this.name=`InternalServerError`}},bS=class extends Error{constructor(e,t=1,n=10){super(`Invalid limit: ${e}. Limit must be between ${t} and ${n}.`),this.name=`InvalidLimitError`}},xS=class extends Error{constructor(e){super(`Message ${e} has already been processed`),this.name=`MessageAlreadyProcessedError`}},SS=class extends Error{idempotencyKey;constructor(e,t){super(e),this.name=`DuplicateMessageError`,this.idempotencyKey=t}},CS=class extends Error{deploymentId;constructor(e,t){super(e),this.name=`ConsumerDiscoveryError`,this.deploymentId=t}},wS=class extends Error{constructor(e=`Consumer registry not configured`){super(e),this.name=`ConsumerRegistryNotConfiguredError`}},TS=300,ES=30,DS=60,OS=10,kS=3e3,AS=3,jS=250;function MS(e){return Math.min(DS,Math.max(OS,e/5))}var NS=class{client;topicName;consumerGroupName;visibilityTimeout;constructor(e,t,n,r={}){this.client=e,this.topicName=t,this.consumerGroupName=n,this.visibilityTimeout=Math.max(ES,r.visibilityTimeoutSeconds??TS)}isClientError(e){return e instanceof pS||e instanceof fS||e instanceof vS||e instanceof gS||e instanceof _S}isNetworkError(e){return e instanceof TypeError}async directiveCallWithRetries(e){let t;for(let n=1;n<=AS;n++)try{return await e()}catch(e){if(t=e,n===AS)throw e;if(e instanceof hS){if(e.retryAfter===void 0)throw e;await new Promise(t=>setTimeout(t,e.retryAfter*1e3));continue}if(!this.isNetworkError(e))throw e;let r=jS*n,i=r/2+r/2*Math.random();await new Promise(e=>setTimeout(e,i))}throw t}startVisibilityExtension(e,t){let n=!0,r=!1,i,a=null,o=MS(this.visibilityTimeout)*1e3,s=o;if(t?.visibilityDeadline){let e=t.visibilityDeadline.getTime()-Date.now();s=e>0?MS(e/1e3)*1e3:0}let c=new Promise(e=>{i=e}),l=()=>{r||(r=!0,i())},u=async()=>{if(!n){l();return}try{await this.client.changeVisibility({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e,visibilityTimeoutSeconds:this.visibilityTimeout}),n?a=setTimeout(()=>u(),o):l()}catch(t){if(this.isClientError(t)){console.error(`Visibility extension failed with client error for receipt handle ${e} (stopping retries):`,t),l();return}console.error(`Failed to extend visibility for receipt handle ${e} (will retry in ${kS/1e3}s):`,t),n?a=setTimeout(()=>u(),kS):l()}};return a=setTimeout(()=>u(),s),async(e=!1)=>{n=!1,a&&=(clearTimeout(a),null),e?await c:l()}}async finalizePayload(e){let t=this.client.getTransport();if(t.finalize&&e!=null)try{await t.finalize(e)}catch(e){console.warn(`Failed to finalize message payload:`,e)}}async processMessage(e,t,n){let r=this.startVisibilityExtension(e.receiptHandle,n),i={messageId:e.messageId,deliveryCount:e.deliveryCount,createdAt:e.createdAt,expiresAt:e.expiresAt??new Date(e.createdAt.getTime()+864e5),topicName:this.topicName,consumerGroup:this.consumerGroupName,region:this.client.getRegion()};try{await t(e.payload,i),await r(),await this.client.acknowledgeMessage({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle})}catch(t){if(await r(),n?.retry){let r;try{r=n.retry(t,i)}catch(e){console.warn(`retry handler threw:`,e)}if(r){if(`acknowledge`in r&&r.acknowledge){try{await this.directiveCallWithRetries(()=>this.client.acknowledgeMessage({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle}))}catch(e){console.warn(`Failed to acknowledge message:`,e)}await this.finalizePayload(e.payload);return}if(`afterSeconds`in r&&typeof r.afterSeconds==`number`){try{await this.directiveCallWithRetries(()=>this.client.changeVisibility({queueName:this.topicName,consumerGroup:this.consumerGroupName,receiptHandle:e.receiptHandle,visibilityTimeoutSeconds:r.afterSeconds}))}catch(e){console.warn(`Failed to reschedule message for retry:`,e)}await this.finalizePayload(e.payload);return}}}throw await this.finalizePayload(e.payload),t}}async consumeMessage(e,t,n){await this.processMessage(t,e,n)}async consume(e,t){let n=t?.retry;if(t&&`messageId`in t){let r=await this.client.receiveMessageById({queueName:this.topicName,consumerGroup:this.consumerGroupName,messageId:t.messageId,visibilityTimeoutSeconds:this.visibilityTimeout});return await this.processMessage(r.message,e,{retry:n}),1}else{let r=t&&`limit`in t?t.limit:1,i=0;for await(let t of this.client.receiveMessages({queueName:this.topicName,consumerGroup:this.consumerGroupName,visibilityTimeoutSeconds:this.visibilityTimeout,limit:r}))i++,await this.processMessage(t,e,{retry:n});return i}}get name(){return this.consumerGroupName}get topic(){return this.topicName}},PS=class{client;topicName;constructor(e,t){this.client=e,this.topicName=t}async publish(e,t){let n=await this.client.sendMessage({queueName:this.topicName,payload:e,idempotencyKey:t?.idempotencyKey,retentionSeconds:t?.retentionSeconds,delaySeconds:t?.delaySeconds,headers:t?.headers,telemetry:t?.telemetry});return n.messageId&&JS()&&PC(this.topicName,n.messageId,this.client.getRegion(),t?.delaySeconds,t?.retentionSeconds),{messageId:n.messageId}}consumerGroup(e,t){return new NS(this.client,this.topicName,e,t)}get name(){return this.topicName}},FS=`com.vercel.queue.v1beta`,IS=`com.vercel.queue.v2beta`;function LS(e,t){let n=t.slice(0,-1);return e.startsWith(n)}function RS(e){return typeof e==`object`&&!!e}function zS(e,t){if(!t||!t.includes(`application/cloudevents+json`))throw Error(`Invalid content type: expected 'application/cloudevents+json'`);if(!RS(e)||!e.type||!e.source||!e.id||!RS(e.data))throw Error(`Invalid CloudEvent: missing required fields`);if(e.type!==`com.vercel.queue.v1beta`)throw Error(`Invalid CloudEvent type: expected '${FS}', got '${String(e.type)}'`);let{data:n}=e,r=[];if(`queueName`in n||r.push(`queueName`),`consumerGroup`in n||r.push(`consumerGroup`),`messageId`in n||r.push(`messageId`),r.length>0)throw Error(`Missing required CloudEvent data fields: ${r.join(`, `)}`);return{queueName:String(n.queueName),consumerGroup:String(n.consumerGroup),messageId:String(n.messageId)}}function BS(e,t){if(e instanceof Headers)return e.get(t);let n=e[t];return Array.isArray(n)?n[0]??null:n??null}function VS(e){let t=BS(e,`ce-type`);if(t!==`com.vercel.queue.v2beta`)throw Error(`Invalid CloudEvent type: expected '${IS}', got '${t}'`);let n=BS(e,`ce-vqsqueuename`),r=BS(e,`ce-vqsconsumergroup`),i=BS(e,`ce-vqsmessageid`),a=[];if(n||a.push(`ce-vqsqueuename`),r||a.push(`ce-vqsconsumergroup`),i||a.push(`ce-vqsmessageid`),a.length>0)throw Error(`Missing required CloudEvent headers: ${a.join(`, `)}`);let o=BS(e,`ce-vqsregion`)??void 0;if(o!==void 0&&!/^[a-z]{2,5}[0-9]{1,2}$/.test(o))throw Error(`Invalid ce-vqsregion header: ${JSON.stringify(o)}. Region must match /^[a-z]{2,5}[0-9]{1,2}$/ (e.g. "iad1", "lhr1").`);let s={queueName:n,consumerGroup:r,messageId:i,region:o},c=BS(e,`ce-vqsreceipthandle`);if(!c)return s;let l={...s,receiptHandle:c},u=BS(e,`ce-vqsdeliverycount`);u&&(l.deliveryCount=parseInt(u,10));let d=BS(e,`ce-vqscreatedat`);d&&(l.createdAt=d);let f=BS(e,`ce-vqsexpiresat`);f&&(l.expiresAt=f);let p=BS(e,`content-type`);p&&(l.contentType=p);let m=BS(e,`ce-vqsvisibilitydeadline`);return m&&(l.visibilityDeadline=m),l}function HS(e,t){if(BS(t,`ce-type`)===`com.vercel.queue.v2beta`){let n=VS(t);return`receiptHandle`in n&&(n.parsedPayload=e),n}return zS(e,BS(t,`content-type`))}async function US(e){if(e.headers.get(`ce-type`)===`com.vercel.queue.v2beta`){let t=VS(e.headers);return`receiptHandle`in t&&e.body&&(t.rawBody=e.body),t}let t;try{t=await e.json()}catch{throw Error(`Failed to parse CloudEvent from request body`)}let n={};return e.headers.forEach((e,t)=>{n[t]=e}),HS(t,n)}async function WS(e,t,n){let{queueName:r,consumerGroup:i,messageId:a}=t;if(!n?.client)throw Error(`HandleCallbackOptions.client is required`);let o=pw(n.client);t.region&&(o=o.withRegion(t.region));let s=new PS(o,r).consumerGroup(i,n?.visibilityTimeoutSeconds===void 0?void 0:{visibilityTimeoutSeconds:n.visibilityTimeoutSeconds});if(`receiptHandle`in t){let r=o.getTransport(),i;if(t.rawBody)i=await r.deserialize(t.rawBody);else if(t.parsedPayload!==void 0)i=t.parsedPayload;else throw Error(`Binary mode callback with receipt handle is missing payload`);let c={messageId:a,payload:i,deliveryCount:t.deliveryCount??1,createdAt:t.createdAt?new Date(t.createdAt):new Date,expiresAt:t.expiresAt?new Date(t.expiresAt):void 0,contentType:t.contentType??r.contentType,receiptHandle:t.receiptHandle},l=t.visibilityDeadline?new Date(t.visibilityDeadline):void 0;await s.consumeMessage(e,c,{visibilityDeadline:l,retry:n?.retry})}else await s.consume(e,{messageId:a,retry:n?.retry})}var $=cS.default.cyan(`[queue]`),GS=cS.default.green(`✓`),KS=cS.default.red(`✗`),qS=cS.default.yellow(`↻`);function JS(){return process.env.NODE_ENV===`development`&&process.env.VERCEL_DEPLOYMENT_ID===void 0}var YS=Symbol.for(`@vercel/queue.devRouteMappings`);function XS(e){let t=``;for(let n of e)n===`_`?t+=`__`:n===`/`?t+=`_S`:n===`.`?t+=`_D`:/[A-Za-z0-9-]/.test(n)?t+=n:t+=`_`+n.charCodeAt(0).toString(16).toUpperCase().padStart(2,`0`);return t}function ZS(){let e=globalThis;if(YS in e)return e[YS]??null;try{let t=el.join(process.cwd(),`vercel.json`);if(!kl.existsSync(t))return e[YS]=null,null;let n=JSON.parse(kl.readFileSync(t,`utf-8`));if(!n.functions)return e[YS]=null,null;let r=[];for(let[e,t]of Object.entries(n.functions))if(t.experimentalTriggers){for(let n of t.experimentalTriggers)if(!(!n.type?.startsWith(`queue/`)||!n.topic)){if(n.type!==`queue/v2beta`){console.warn(`${$} Unsupported trigger type "${n.type}" for topic "${n.topic}" in ${e}. Use "queue/v2beta" instead.`);continue}r.push({filePath:e,topic:n.topic,consumer:XS(e),retryAfterSeconds:n.retryAfterSeconds})}}return e[YS]=r.length>0?r:null,e[YS]}catch(t){return console.warn(`${$} Failed to read vercel.json:`,t),e[YS]=null,null}}function QS(e){let t=ZS();return t?t.filter(t=>t.topic.includes(`*`)?LS(e,t.topic):t.topic===e):[]}function $S(e,t){return QS(e).find(e=>e.consumer===t)?.retryAfterSeconds}function eC(e){return/^src\/(app|pages|server)\//.test(e)?e.slice(4):null}function tC(e,t){return e===t||B(e,t)}function nC(e){let t=ZS();if(!t)return[];let n=process.cwd(),r;try{r=el.relative(n,e)}catch{return[]}let i=r.replace(/\\/g,`/`),a=eC(i);return t.filter(e=>tC(i,e.filePath)||a!==null&&tC(a,e.filePath))}function rC(e){let t=e.match(/\((.+?):\d+:\d+\)/);if(t||=e.match(/at\s+(.+?):\d+:\d+/),!t)return null;let n=t[1].trim();if(n===`native`||n.startsWith(`node:`)||n.startsWith(`internal`))return null;if(n.startsWith(`file://`))try{n=new URL(n).pathname}catch{return null}return/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(n)?null:(n.startsWith(`./`)&&(n=n.slice(2)),n)}var iC;function aC(){if(iC)return iC;try{let e=typeof __dirname<`u`?__dirname:el.dirname(new URL(import.meta.url).pathname);iC=el.resolve(e,`..`)}catch{iC=``}return iC}function oC(){let e=Error().stack;if(!e)return null;let t=e.split(`
|
|
13
|
+
`).slice(1),n=aC();for(let e of t){let t=rC(e);if(!t)continue;let r=el.isAbsolute(t)?t:el.resolve(process.cwd(),t),i;try{i=kl.realpathSync(r)}catch{i=r}if(!(n&&i.startsWith(n)))return i}return null}var sC=Symbol.for(`@vercel/queue.devHandlerRegistry`);function cC(){let e=globalThis;return e[sC]||(e[sC]=new Map),e[sC]}function lC(e,t,n,r){let i=nC(el.isAbsolute(e)?e:el.resolve(process.cwd(),e));if(i.length===0)return!1;let a=cC();for(let e of i){let i=e.topic,o=a.get(i)??[],s={consumerGroup:e.consumer,handler:t,client:n,options:r},c=o.findIndex(t=>t.consumerGroup===e.consumer);c>=0?o[c]=s:o.push(s),a.set(i,o)}return!0}function uC(e,t,n,r){let i=r??oC();if(!i){console.warn(`${$} Could not determine caller file path for handler registration.`);return}if(!lC(i,e,t,n)){let e=ZS();if(e&&e.length>0)return;let t=process.cwd(),n;try{n=el.relative(t,i).replace(/\\/g,`/`)}catch{n=i}console.warn(`${$} handleCallback() in ${n} has no matching experimentalTriggers in vercel.json. This handler won't receive messages.
|
|
14
14
|
|
|
15
15
|
Add a trigger to vercel.json:
|
|
16
16
|
"${n}": {
|
|
17
17
|
"experimentalTriggers": [{ "type": "queue/v2beta", "topic": "your-topic" }]
|
|
18
|
-
}`)}}function
|
|
18
|
+
}`)}}function dC(e){let t=cC(),n=[];for(let[r,i]of t)(r.includes(`*`)?LS(e,r):r===e)&&n.push(...i);return n}var fC=50,pC=5e3,mC=2,hC=250,gC=[`PORT`,`NEXT_PORT`,`NEXTJS_PORT`,`NUXT_PORT`,`NITRO_PORT`,`SVELTEKIT_PORT`,`VITE_PORT`,`DEV_PORT`,`npm_config_port`],_C=[`__NEXT_PRIVATE_ORIGIN`,`NUXT_PUBLIC_SITE_URL`,`URL`];function vC(e){return e instanceof Error?e.message:String(e)}function yC(e){return e instanceof fS||e instanceof Error&&e.name===`MessageNotFoundError`}function bC(e){if(!e)return null;let t=Number.parseInt(e,10);return!Number.isFinite(t)||t<1||t>65535?null:t}function xC(e){if(!e)return null;try{let t=new URL(e).port;return bC(t)}catch{return null}}function SC(){let e=[],t=new Set,n=n=>{n&&!t.has(n)&&(t.add(n),e.push(n))};for(let e of gC)n(bC(process.env[e]));for(let e of _C)n(xC(process.env[e]));return e}function CC(e){return new Promise(t=>{let n=Al.connect({host:`localhost`,port:e}),r=!1,i=e=>{r||(r=!0,n.destroy(),t(e))};n.once(`connect`,()=>i(!0)),n.once(`error`,()=>i(!1)),n.setTimeout(hC,()=>i(!1))})}async function wC(e,t,n){let r=0,i=fC;for(;;)try{await WS(e,t,n);return}catch(e){if(yC(e)&&r<pC){await new Promise(e=>setTimeout(e,i)),r+=i,i=Math.min(i*mC,pC-r);continue}throw e}}function TC(e){let t=e.replace(/^src\/app\//,`/`).replace(/^src\/pages\//,`/`).replace(/^src\/server\//,`/`).replace(/^src\/routes\//,`/`).replace(/^app\//,`/`).replace(/^pages\//,`/`).replace(/^server\//,`/`).replace(/\/route\.(ts|mts|js|mjs|tsx|jsx)$/,``).replace(/\/\+server\.(ts|mts|js|mjs|tsx|jsx)$/,``).replace(/\.(ts|mts|js|mjs|tsx|jsx)$/,``);return t.startsWith(`/`)||(t=`/`+t),t}async function EC(e,t={}){let n={triedPorts:SC(),listeningPorts:[],unavailablePorts:[],importFailures:[],primeFailures:[]},r=QS(e);if(r.length===0)return n;let i=t.refreshRegistered===!0;for(let e of n.triedPorts)await CC(e)?n.listeningPorts.push(e):n.unavailablePorts.push(e);for(let t of r){let r=OC(e,t.consumer);if(!(r&&!i)){if(!r){let r=el.resolve(process.cwd(),t.filePath);try{await import(r)}catch(e){n.importFailures.push({filePath:t.filePath,reason:vC(e)})}if(OC(e,t.consumer))continue}for(let r of n.listeningPorts){let i=`http://localhost:${r}${TC(t.filePath)}`;try{let r=await fetch(i,{method:`POST`,headers:{"x-vercel-queue-prime":`1`,"x-vercel-queue-prime-file":t.filePath}});try{await r.text()}catch{}if(OC(e,t.consumer))break;n.primeFailures.push({filePath:t.filePath,url:i,reason:`HTTP ${r.status}${r.statusText?` ${r.statusText}`:``}`.trim()})}catch(e){n.primeFailures.push({filePath:t.filePath,url:i,reason:vC(e)})}}}}return n}function DC(e,t,n){let r=t.map(e=>e.filePath),i=n.listeningPorts[0]??n.triedPorts[0],a=i?t.map(e=>`http://localhost:${i}${TC(e.filePath)}`):[],o;if(n.triedPorts.length===0)o=`No local dev port detected from env. Set PORT (or NEXT_PORT/NUXT_PORT/VITE_PORT).`;else if(n.listeningPorts.length===0)o=`Detected env ports: [${n.triedPorts.join(`, `)}], but none are listening.`;else{let e=n.unavailablePorts.length>0?` Not listening: [${n.unavailablePorts.join(`, `)}].`:``;o=`Detected env ports: [${n.triedPorts.join(`, `)}]. Listening: [${n.listeningPorts.join(`, `)}].`+e}let s=n.importFailures.length>0?`
|
|
19
19
|
Import failures: `+n.importFailures.slice(0,2).map(e=>`${e.filePath} (${e.reason})`).join(`; `):``,c=n.primeFailures.length>0?`
|
|
20
20
|
Prime failures: `+n.primeFailures.slice(0,3).map(e=>`${e.url} (${e.reason})`).join(`; `):``;return`${$} No registered handler for topic "${e}". vercel.json maps this topic to [${r.join(`, `)}] but auto-loading failed.
|
|
21
21
|
${o}${s}${c}
|
|
22
22
|
Ensure your dev server is running, set PORT if needed, and confirm mapped route files call handleCallback()/handleNodeCallback() at module scope.
|
|
23
|
-
`+(a.length>0?`Try opening: ${a.join(` or `)}`:`Set PORT (or NEXT_PORT/NUXT_PORT/VITE_PORT) and try sending again.`)}function
|
|
24
|
-
Ensure vercel.json has a matching experimentalTriggers entry and the route file calls handleCallback().`);return}let o=r.map(e=>e.consumerGroup);console.log(`${$} Invoking handlers for topic="${e}" messageId="${t}" \u2192 consumers: [${o.join(`, `)}]`);let s=i??
|
|
23
|
+
`+(a.length>0?`Try opening: ${a.join(` or `)}`:`Set PORT (or NEXT_PORT/NUXT_PORT/VITE_PORT) and try sending again.`)}function OC(e,t){return dC(e).some(e=>e.consumerGroup===t)}var kC=10,AC=2,jC=10,MC=86400;function NC(e,t){let n=Math.min(Math.max(t,0),kC);console.log(`${$} ${qS} Scheduling re-delivery in ${n}s: topic="${e.topicName}" consumer="${e.consumerGroup}" messageId="${e.messageId}"`),setTimeout(async()=>{let t=e.deliveryCount+1,n=new Date(e.createdAt.getTime()+e.retentionSeconds*1e3);if(Date.now()>=n.getTime()){console.log(`${$} Message expired, stopping retries: topic="${e.topicName}" messageId="${e.messageId}"`);return}if(t>jC){console.log(`${$} Max re-deliveries (${jC}) reached: topic="${e.topicName}" messageId="${e.messageId}"`);return}let r={messageId:e.messageId,deliveryCount:t,createdAt:e.createdAt,expiresAt:n,topicName:e.topicName,consumerGroup:e.consumerGroup,region:e.region};console.log(`${$} Re-delivering: topic="${e.topicName}" consumer="${e.consumerGroup}" messageId="${e.messageId}" deliveryCount=${t}`);let i=!0,a=null,o=!1;try{await e.handler(e.payload,r)}catch(t){if(i=!1,e.retry){let n;try{n=e.retry(t,r)}catch(e){console.warn(`${$} retry handler threw:`,e)}n&&`afterSeconds`in n?a=n.afterSeconds:n&&`acknowledge`in n&&(o=!0)}o||console.error(`${$} ${KS} Handler error on re-delivery: topic="${e.topicName}" messageId="${e.messageId}"`,t)}if(i)console.log(`${$} ${GS} Message processed on re-delivery: topic="${e.topicName}" consumer="${e.consumerGroup}" messageId="${e.messageId}"`);else if(o)console.log(`${$} ${GS} Message acknowledged (will not retry): topic="${e.topicName}" consumer="${e.consumerGroup}" messageId="${e.messageId}"`);else{let n=a??e.defaultRetryDelayS;NC({...e,deliveryCount:t},n)}},n*1e3)}function PC(e,t,n,r,i){if(r&&r>0){console.log(`${$} Message sent with delay: topic="${e}" messageId="${t}" delay=${r}s`),setTimeout(()=>{PC(e,t,n,void 0,i)},r*1e3);return}console.log(`${$} Message sent: topic="${e}" messageId="${t}"`),(async()=>{let r=dC(e),a=null;if(r.length>0?(await EC(e,{refreshRegistered:!0}),r=dC(e)):(a=await EC(e),r=dC(e)),r.length===0){let t=QS(e);if(t.length>0){let n=a??{triedPorts:SC(),listeningPorts:[],unavailablePorts:[],importFailures:[],primeFailures:[]};console.warn(DC(e,t,n))}else console.warn(`${$} No registered handler for topic "${e}".
|
|
24
|
+
Ensure vercel.json has a matching experimentalTriggers entry and the route file calls handleCallback().`);return}let o=r.map(e=>e.consumerGroup);console.log(`${$} Invoking handlers for topic="${e}" messageId="${t}" \u2192 consumers: [${o.join(`, `)}]`);let s=i??MC;for(let i of r){let r,a=new Date,o=1,c=!0,l=null,u=!1,d=async(e,t)=>{r=e,a=t.createdAt,o=t.deliveryCount;try{await i.handler(e,t)}catch(e){throw c=!1,e}},f=i.options?.retry?(e,t)=>{let n=i.options.retry(e,t);return n&&`afterSeconds`in n?l=n.afterSeconds:n&&`acknowledge`in n&&(u=!0),n}:void 0,p={queueName:e,consumerGroup:i.consumerGroup,messageId:t,region:n},m={client:i.client,visibilityTimeoutSeconds:i.options?.visibilityTimeoutSeconds,retry:f},h=Math.min($S(e,i.consumerGroup)??AC,kC),g=()=>({handler:i.handler,retry:i.options?.retry,payload:r,topicName:e,consumerGroup:i.consumerGroup,messageId:t,region:n,createdAt:a,retentionSeconds:s,deliveryCount:o,defaultRetryDelayS:h});try{if(await wC(d,p,m),c)console.log(`${$} ${GS} Message processed: topic="${e}" consumer="${i.consumerGroup}" messageId="${t}"`);else if(u)console.log(`${$} ${GS} Message acknowledged (will not retry): topic="${e}" consumer="${i.consumerGroup}" messageId="${t}"`);else if(l!==null){let e=Math.min(l,kC);NC(g(),e)}}catch(n){console.error(`${$} ${KS} Handler failed: topic="${e}" consumer="${i.consumerGroup}" messageId="${t}"`,n),c||NC(g(),h)}}})()}function FC(){let e=globalThis;delete e[YS],delete e[sC]}(process.env.NODE_ENV===`test`||process.env.VITEST)&&(globalThis.__clearDevState=FC,globalThis.__filePathToConsumerGroup=XS,globalThis.__filePathToUrlPath=TC,globalThis.__matchesFunctionsPattern=tC,globalThis.__stripSrcPrefix=eC);function IC(e,t){let n={...e?.metadata,...t?.metadata};return{isEnabled:t?.isEnabled??e?.isEnabled??!0,tracer:e?.tracer,metadata:Object.keys(n).length>0?n:void 0}}var LC;function RC(){return LC||=import(`../../_chunks/workflow/src-Cj3P1ChQ.js`).then(e=>n(e.t(),1)).then(e=>e,()=>null),LC}function zC(){let e=process.env.VERCEL_QUEUE_TRACE_PROPAGATION?.toLowerCase();return e===`off`||e===`0`||e===`false`}var BC=[`traceparent`,`tracestate`,`baggage`];async function VC(e,t){if(zC()||t&&!t.isEnabled)return;let n=await RC();if(n)try{let t={};n.propagation.inject(n.context.active(),t);for(let n of BC){let r=t[n];r!==void 0&&e.set(n,r)}}catch{}}function HC(e,t,n){try{t.setStatus({code:e.SpanStatusCode.ERROR,message:n instanceof Error?n.message:String(n)})}catch{}}function UC(e){try{e.end()}catch{}}async function WC(e,t,n){if(zC()||n&&!n.isEnabled)return t(null);let r=await RC();if(!r)return t(null);let i=null;try{let t=n?.tracer??r.trace.getTracer(`@vercel/queue`),a={"messaging.system":`vercel-queue`,"messaging.destination.name":e};if(n?.metadata)for(let[e,t]of Object.entries(n.metadata))a[`vqs.metadata.${e}`]=t;let o=t.startSpan(`vqs.send`,{kind:r.SpanKind.PRODUCER,attributes:a});i={span:o,ctx:r.trace.setSpan(r.context.active(),o)}}catch{}if(!i)return t(null);let{span:a,ctx:o}=i;try{return await r.context.with(o,()=>t({setMessageId(e){try{a.setAttribute(`messaging.message.id`,e)}catch{}}}))}catch(e){throw HC(r,a,e),e}finally{UC(a)}}var GC=`x-vercel-queue-traceparent`,KC=`x-vercel-queue-tracestate`,qC=`x-vercel-queue-baggage`;async function JC(e,t,n){if(zC()||n&&!n.isEnabled)return t();let r=await RC();if(!r)return t();let i=null;try{let t=YC(r,XC(e)),a=n?.tracer??r.trace.getTracer(`@vercel/queue`),o={"messaging.system":`vercel-queue`,"messaging.operation":`process`};if(n?.metadata)for(let[e,t]of Object.entries(n.metadata))o[`vqs.metadata.${e}`]=t;let s=a.startSpan(`vqs.process`,{kind:r.SpanKind.CONSUMER,attributes:o,links:t});i={span:s,ctx:r.trace.setSpan(r.context.active(),s)}}catch{}if(!i)return t();let{span:a,ctx:o}=i;try{return await r.context.with(o,t)}catch(e){throw HC(r,a,e),e}finally{UC(a)}}function YC(e,t){let n=t[GC];if(!n)return[];let r={traceparent:n},i=t[KC];i&&(r.tracestate=i);let a=t[qC];a&&(r.baggage=a);let o=e.propagation.extract(e.ROOT_CONTEXT,r),s=e.trace.getSpanContext(o);return!s||!e.trace.isSpanContextValid(s)?[]:[{context:s}]}function XC(e){let t={};if(e instanceof Headers)return e.forEach((e,n)=>{t[n.toLowerCase()]=e}),t;for(let[n,r]of Object.entries(e)){let e=Array.isArray(r)?r[0]:r;e!==void 0&&(t[n.toLowerCase()]=e)}return t}function ZC(){return process.env.VERCEL_QUEUE_DEBUG===`1`||process.env.VERCEL_QUEUE_DEBUG===`true`}async function QC(e){let t=e.getReader();try{for(;;){let{done:e}=await t.read();if(e)break}}finally{t.releaseLock()}}function $C(e){if(!e)return;let t=Number(e);if(Number.isFinite(t)&&t>=0)return t;let n=Date.parse(e);if(!Number.isNaN(n))return Math.max(0,(n-Date.now())/1e3)}function ew(e,t,n,r,i=`Invalid parameters`,a){throw e===400?new vS(n||i):e===429?new hS(n||`Too many requests: ${r}`,$C(a)):e===401?new gS(n||void 0):e===403?new _S(n||void 0):e>=500?new yS(n||`Server error: ${e} ${t}`):Error(`Failed to ${r}: ${e} ${t}`)}function tw(e){let t=e.get(`Vqs-Message-Id`),n=e.get(`Vqs-Delivery-Count`)||`0`,r=e.get(`Vqs-Timestamp`),i=e.get(`Content-Type`)||`application/octet-stream`,a=e.get(`Vqs-Receipt-Handle`),o=e.get(`Vqs-Expires-At`);if(!t||!r||!a)return null;let s=parseInt(n,10);return Number.isNaN(s)?null:{messageId:t,deliveryCount:s,createdAt:new Date(r),expiresAt:o?new Date(o):void 0,contentType:i,receiptHandle:a}}var nw=/^[a-z]{2,5}[0-9]{1,2}$/;function rw(e){if(!nw.test(e))throw Error(`Invalid region code: ${JSON.stringify(e)}. Region must match the pattern /^[a-z]{2,5}[0-9]{1,2}$/ (e.g. "iad1", "lhr1").`)}var iw=e=>new URL(`https://${e}.vercel-queue.com`);function aw(e,t){return(t??iw)(e)}var ow=`/api/v3/topic`,sw=class e{baseUrl;customHeaders;providedToken;resolvedDeploymentId;pinSends;explicitlyUnpinned;transport;region;baseUrlResolver;dispatcher;telemetry;constructor(e){rw(e.region),this.region=e.region,this.baseUrlResolver=e.resolveBaseUrl,this.baseUrl=aw(this.region,this.baseUrlResolver),this.customHeaders=e.headers||{},this.providedToken=e.token,this.transport=e.transport||new dS,this.dispatcher=e.dispatcher,this.telemetry=e.telemetry,e.deploymentId===null?(this.pinSends=!1,this.explicitlyUnpinned=!0):(this.resolvedDeploymentId=e.deploymentId||process.env.VERCEL_DEPLOYMENT_ID,this.pinSends=!0,this.explicitlyUnpinned=!1)}withRegion(t){return new e({region:t,resolveBaseUrl:this.baseUrlResolver,token:this.providedToken,headers:{...this.customHeaders},deploymentId:this.explicitlyUnpinned?null:this.resolvedDeploymentId,transport:this.transport,dispatcher:this.dispatcher,telemetry:this.telemetry})}getRegion(){return this.region}getTransport(){return this.transport}getTelemetry(){return this.telemetry}requireDeploymentId(){if(!(JS()||this.explicitlyUnpinned||this.resolvedDeploymentId))throw Error(`No deployment ID available. VERCEL_DEPLOYMENT_ID is not set.
|
|
25
25
|
|
|
26
26
|
This usually means the code is running outside a Vercel deployment (e.g. during build or in a non-Vercel environment).
|
|
27
27
|
|
|
28
28
|
To fix this, create a client with an explicit deploymentId:
|
|
29
29
|
new QueueClient({ deploymentId: "dpl_xxx" })
|
|
30
30
|
Or explicitly opt out of deployment pinning:
|
|
31
|
-
new QueueClient({ deploymentId: null })`)}getSendDeploymentId(){if(!
|
|
31
|
+
new QueueClient({ deploymentId: null })`)}getSendDeploymentId(){if(!JS())return this.requireDeploymentId(),this.pinSends?this.resolvedDeploymentId:void 0}getConsumeDeploymentId(){if(!JS())return this.requireDeploymentId(),this.resolvedDeploymentId}async getToken(){if(this.providedToken)return this.providedToken;try{return await(0,lS.getVercelOidcToken)()}catch(e){let t=e instanceof Error?e.message:String(e);throw Error(JS()?`Failed to get OIDC token for local development.
|
|
32
32
|
|
|
33
33
|
To fix this, pull your environment variables with Vercel CLI:
|
|
34
34
|
\`vercel env pull\`
|
|
@@ -39,4 +39,4 @@ To fix this, either:
|
|
|
39
39
|
- Deploy to Vercel (OIDC tokens are provisioned automatically)
|
|
40
40
|
- Provide a token explicitly: \`new QueueClient({ token: '...' })\`
|
|
41
41
|
|
|
42
|
-
Cause: ${t}`)}}buildUrl(e,...t){let n=encodeURIComponent(e),r=t.map(e=>encodeURIComponent(e)),i=r.length>0?`/`+r.join(`/`):``,a=this.baseUrl.pathname.replace(/\/+$/,``);return`${this.baseUrl.origin}${a}${$C}/${n}${i}`}async fetch(e,t){let n=t.method||`GET`;if(WC()){let r={method:n,url:e,headers:t.headers},i=t.body;i!=null&&(i instanceof ArrayBuffer||i instanceof Uint8Array?r.bodySize=i.byteLength:typeof i==`string`?r.bodySize=i.length:r.bodyType=typeof i),console.debug(`[VQS Debug] Request:`,JSON.stringify(r,null,2))}t.headers.set(`User-Agent`,`@vercel/queue/0.4.0`),t.headers.set(`Vqs-Client-Ts`,new Date().toISOString());let r=this.dispatcher?{...t,dispatcher:this.dispatcher}:t,i=await fetch(e,r);if(WC()){let t={method:n,url:e,status:i.status,statusText:i.statusText,headers:i.headers};console.debug(`[VQS Debug] Response:`,JSON.stringify(t,null,2))}return i}async sendMessage(e){let t=this.transport,{queueName:n,payload:r,idempotencyKey:i,retentionSeconds:a,delaySeconds:o,headers:s,telemetry:c}=e,l=new Headers;if(this.customHeaders)for(let[e,t]of Object.entries(this.customHeaders))l.append(e,t);if(s){let e=new Set([`authorization`,`content-type`]),t=t=>{let n=t.toLowerCase();return e.has(n)?!0:n.startsWith(`vqs-`)};for(let[e,n]of Object.entries(s))!t(e)&&n!==void 0&&l.append(e,n)}l.set(`Authorization`,`Bearer ${await this.getToken()}`),l.set(`Content-Type`,t.contentType);let u=this.getSendDeploymentId();u&&l.set(`Vqs-Deployment-Id`,u),i&&l.set(`Vqs-Idempotency-Key`,i),a!==void 0&&l.set(`Vqs-Retention-Seconds`,a.toString()),o!==void 0&&l.set(`Vqs-Delay-Seconds`,o.toString());let d=t.serialize(r),f=Buffer.isBuffer(d)?new Uint8Array(d):d,p=kC(this.telemetry,c);return LC(n,async e=>{await PC(l,p);let t=await this.fetch(this.buildUrl(n),{method:`POST`,body:f,headers:l});if(!t.ok){let e=await t.text();if(t.status===409)throw new hS(e||`Duplicate idempotency key detected`,i);if(t.status===502)throw new gS(e||`Consumer discovery failed`,u);if(t.status===503)throw new _S(e||`Consumer registry not configured`);qC(t.status,t.statusText,e,`send message`)}if(t.status===202)return await t.text(),{messageId:null};let r=await t.json();return e&&r.messageId&&e.setMessageId(r.messageId),r},p)}async*receiveMessages(e){let t=this.transport,{queueName:n,consumerGroup:r,visibilityTimeoutSeconds:i,limit:a}=e;if(a!==void 0&&(a<1||a>10))throw new pS(a);let o=new Headers({Authorization:`Bearer ${await this.getToken()}`,Accept:`multipart/mixed`,...this.customHeaders});i!==void 0&&o.set(`Vqs-Visibility-Timeout-Seconds`,i.toString()),a!==void 0&&o.set(`Vqs-Max-Messages`,a.toString());let s=this.getConsumeDeploymentId();s&&o.set(`Vqs-Deployment-Id`,s);let c=await this.fetch(this.buildUrl(n,`consumer`,r),{method:`POST`,headers:o});if(c.status===204){await c.text();return}if(!c.ok){let e=await c.text();qC(c.status,c.statusText,e,`receive messages`)}for await(let e of Th(c))try{let n=JC(e.headers);if(!n){console.warn(`Missing required queue headers in multipart part`),await GC(e.payload);continue}let r=await t.deserialize(e.payload);yield{...n,payload:r}}catch(t){console.warn(`Failed to process multipart message:`,t),await GC(e.payload)}}async receiveMessageById(e){let t=this.transport,{queueName:n,consumerGroup:r,messageId:i,visibilityTimeoutSeconds:a}=e,o=new Headers({Authorization:`Bearer ${await this.getToken()}`,Accept:`multipart/mixed`,...this.customHeaders});a!==void 0&&o.set(`Vqs-Visibility-Timeout-Seconds`,a.toString());let s=this.getConsumeDeploymentId();s&&o.set(`Vqs-Deployment-Id`,s);let c=await this.fetch(this.buildUrl(n,`consumer`,r,`id`,i),{method:`POST`,headers:o});if(!c.ok){let e=await c.text();if(c.status===404)throw new aS(i);if(c.status===409){let t={};try{t=JSON.parse(e)}catch{}throw t.originalMessageId?new oS(i,`This message was a duplicate - use originalMessageId: ${t.originalMessageId}`):new oS(i)}if(c.status===410)throw new mS(i);qC(c.status,c.statusText,e,`receive message by ID`)}for await(let e of Th(c)){let n=JC(e.headers);if(!n)throw await GC(e.payload),new sS(i,`Missing required queue headers in response`);let r=await t.deserialize(e.payload);return{message:{...n,payload:r}}}throw new aS(i)}async acknowledgeMessage(e){let{queueName:t,consumerGroup:n,receiptHandle:r}=e,i=new Headers({Authorization:`Bearer ${await this.getToken()}`,...this.customHeaders}),a=this.getConsumeDeploymentId();a&&i.set(`Vqs-Deployment-Id`,a);let o=await this.fetch(this.buildUrl(t,`consumer`,n,`lease`,r),{method:`DELETE`,headers:i});if(!o.ok){let e=await o.text();if(o.status===404)throw new aS(r);if(o.status===409)throw new oS(r,e||`Invalid receipt handle, message not in correct state, or already processed`);qC(o.status,o.statusText,e,`acknowledge message`,`Missing or invalid receipt handle`,o.headers?.get(`Retry-After`)??null)}return await o.text(),{acknowledged:!0}}async changeVisibility(e){let{queueName:t,consumerGroup:n,receiptHandle:r,visibilityTimeoutSeconds:i}=e,a=new Headers({Authorization:`Bearer ${await this.getToken()}`,"Content-Type":`application/json`,...this.customHeaders}),o=this.getConsumeDeploymentId();o&&a.set(`Vqs-Deployment-Id`,o);let s=await this.fetch(this.buildUrl(t,`consumer`,n,`lease`,r),{method:`PATCH`,headers:a,body:JSON.stringify({visibilityTimeoutSeconds:i})});if(!s.ok){let e=await s.text();if(s.status===404)throw new aS(r);if(s.status===409)throw new oS(r,e||`Invalid receipt handle, message not in correct state, or already processed`);qC(s.status,s.statusText,e,`change visibility`,`Missing receipt handle or invalid visibility timeout`,s.headers?.get(`Retry-After`)??null)}return await s.text(),{success:!0}}},tw=new WeakMap,nw=Symbol.for(`@vercel/queue.apiClient`);function rw(e,t){tw.set(e,t),Object.defineProperty(e,nw,{value:t,writable:!1,enumerable:!1,configurable:!1})}function iw(e){let t=tw.get(e);if(t)return t;let n=e[nw];if(typeof n==`object`&&n){let t=n;return tw.set(e,t),t}throw Error(`QueueClient not initialized. This may happen when multiple bundled copies of @vercel/queue are loaded in local dev.`)}function aw(e){return`request`in e?e.request:e}function ow(e){return iw(e)}var sw=`iad1`;function cw(e){return e||process.env.VERCEL_REGION||(VS()||console.warn(`[QueueClient] Region not detected \u2014 defaulting to "${sw}". On Vercel this is set automatically via VERCEL_REGION. To silence this warning, pass region explicitly: new QueueClient({ region: "iad1" })`),sw)}var lw=class{constructor(e={}){let t=cw(e.region);rw(this,new ew({...e,region:t}))}send=async(e,t,n)=>{let r=iw(this),i=await r.sendMessage({queueName:e,payload:t,idempotencyKey:n?.idempotencyKey,retentionSeconds:n?.retentionSeconds,delaySeconds:n?.delaySeconds,headers:n?.headers,telemetry:n?.telemetry});return i.messageId&&VS()&&DC(e,i.messageId,r.getRegion(),n?.delaySeconds,n?.retentionSeconds),{messageId:i.messageId}};handleCallback=(e,t)=>{VS()&&rC(e,this,t);let n=kC(iw(this).getTelemetry?.());return async r=>{let i=aw(r);if(VS()&&i.headers.get(`x-vercel-queue-prime`)===`1`){let n=i.headers.get(`x-vercel-queue-prime-file`);return n&&rC(e,this,t,n),Response.json({status:`primed`})}try{let r=await IS(i);return await VC(i.headers,()=>LS(e,r,{client:this,visibilityTimeoutSeconds:t?.visibilityTimeoutSeconds,retry:t?.retry}),n),Response.json({status:`success`})}catch(e){return console.error(`Queue callback error:`,e),e instanceof Error&&(e.message.includes(`Invalid content type`)||e.message.includes(`Invalid CloudEvent`)||e.message.includes(`Missing required CloudEvent`)||e.message.includes(`Failed to parse CloudEvent`)||e.message.includes(`Binary mode callback`))?Response.json({error:e.message},{status:400}):Response.json({error:`Failed to process queue message`},{status:500})}}};handleNodeCallback=(e,t)=>{VS()&&rC(e,this,t);let n=kC(iw(this).getTelemetry?.());return async(r,i)=>{if(r.method!==`POST`){i.status(200).end();return}let a=r.headers[`x-vercel-queue-prime`];if(VS()&&a===`1`){let n=r.headers[`x-vercel-queue-prime-file`],a=Array.isArray(n)?n[0]:n;a&&rC(e,this,t,a),i.status(200).json({status:`primed`});return}try{let a=FS(r.body,r.headers);await VC(r.headers,()=>LS(e,a,{client:this,visibilityTimeoutSeconds:t?.visibilityTimeoutSeconds,retry:t?.retry}),n),i.status(200).json({status:`success`})}catch(e){if(console.error(`Queue callback error:`,e),e instanceof Error&&(e.message.includes(`Invalid content type`)||e.message.includes(`Invalid CloudEvent`)||e.message.includes(`Missing required CloudEvent`)||e.message.includes(`Failed to parse CloudEvent`)||e.message.includes(`Binary mode callback`))){i.status(400).json({error:e.message});return}i.status(500).json({error:`Failed to process queue message`})}}}};function uw(e){return`${e} requires VERCEL_DEPLOYMENT_ID, which Vercel sets in every deployment, so this process is not running inside one. The Vercel world was selected when the app was built (and compiled into the server bundles), which happens whenever the build environment looks like Vercel — including a production server started locally or in CI with an env file from \`vercel env pull\`. To run that build against the local filesystem world instead, set WORKFLOW_TARGET_WORLD=local and rebuild.`}var dw=class{contentType=`application/cbor`;serialize(e){return Buffer.from(_p(e))}async deserialize(e){let t=[],n=e.getReader();for(;;){let{done:e,value:r}=await n.read();if(e)break;r&&t.push(r)}return Wf(Buffer.concat(t))}},fw=class{contentType=`application/json`;serialize(e){return Buffer.from(JSON.stringify(e))}async deserialize(e){let t=[],n=e.getReader();for(;;){let{done:e,value:r}=await n.read();if(e)break;r&&t.push(r)}return JSON.parse(Buffer.concat(t).toString())}},pw=class{contentType=`application/cbor`;serialize(e){return Buffer.from(_p(e))}async deserialize(e){let t=[],n=e.getReader();for(;;){let{done:e,value:r}=await n.read();if(e)break;r&&t.push(r)}let r=Buffer.concat(t);try{return Wf(r)}catch{return JSON.parse(r.toString())}}};const mw=new wl,hw=ec({payload:Ko,queueName:_o,deploymentId:Za().optional()}),gw=Number(process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS||82800);function _w(e){let t=Math.min(Math.max(1,2**(e-1)),900),n=Math.floor(Math.random()*(Math.ceil(t*.25)+1));return Math.max(1,t-n)}function vw(e){if(`runId`in e&&typeof e.runId==`string`)return e.runId}function yw(e){if(!e)return;let t=e.startsWith(`wrun_`)?e.slice(5):e;try{let e=Gc(t);return!e.tagged||e.regionId===Bc.unknown?void 0:e.region??void 0}catch{return}}function bw(e,t){if(zc(t?.region))return t.region;let n=yw(vw(e));if(n)return n;let r=process.env.VERCEL_REGION;return zc(r)?r:`iad1`}function xw(e){let t={};return`runId`in e&&typeof e.runId==`string`&&(t[`x-vercel-workflow-run-id`]=e.runId),`stepId`in e&&typeof e.stepId==`string`&&(t[`x-vercel-workflow-step-id`]=e.stepId),Object.keys(t).length>0?t:void 0}const Sw=/^__([a-z][a-z0-9]*_)?wkf_workflow_/;let Cw=!1;function ww(){return process.env.WORKFLOW_SEQUENTIAL_REPLAYS===`1`}function Tw(e,t){return!ww()||!Sw.test(e)?e:(Cw||(Cw=!0,console.warn(`[workflow] WORKFLOW_SEQUENTIAL_REPLAYS=1: routing flow messages to per-run queue topics`)),`__healthCheck`in t&&typeof t.correlationId==`string`?`${e}_${t.correlationId}`:`runId`in t&&typeof t.runId==`string`?`stepId`in t&&typeof t.stepId==`string`?`${e}_${t.runId}_${t.stepId}`:`${e}_${t.runId}`:e)}function Ew(e){let{baseUrl:t,usingProxy:n}=Gm(e),r=Km(e,{usingProxy:n}),i=new dw,a=new fw,o=new pw,s={dispatcher:Bp(e),transport:o,...n&&{resolveBaseUrl:()=>new URL(`${t}/queues-proxy`),token:e?.token},headers:Object.fromEntries(r.entries())},c=async(e,t,r)=>{let o=r?.deploymentId??process.env.VERCEL_DEPLOYMENT_ID;if(!o)throw Error(`${uw(`Enqueuing a workflow message`)} Callers outside a deployment can instead pass an explicit deploymentId in options.`);let c=(r?.specVersion??5)>=3?i:a,l=bw(t,r),u=new lw({...s,...n&&{headers:{...s.headers,"x-vercel-queue-region":l}},region:l,deploymentId:o,transport:c}),d={payload:t,queueName:e,deploymentId:r?.deploymentId},f=Tw(e,t).replace(/[^A-Za-z0-9-_]/g,`-`);try{let{messageId:e}=await u.send(f,d,{idempotencyKey:r?.idempotencyKey,delaySeconds:r?.delaySeconds,headers:{...xw(t),...r?.headers}});return{messageId:e?ca.parse(e):null}}catch(e){if(e instanceof hS)return{messageId:ca.parse(`msg_duplicate_${e.idempotencyKey??r?.idempotencyKey??`unknown`}`)};throw e}};return{queue:c,createQueueHandler:(e,t)=>{let n=new lw(s).handleCallback(async(e,n)=>{if(!e||!n)return;let r=mw.getStore(),{payload:i,queueName:a,deploymentId:o}=hw.parse(e),s=await t(i,{queueName:a,messageId:ca.parse(n.messageId),attempt:n.deliveryCount,requestId:r});if(typeof s?.timeoutSeconds==`number`){let e=s.timeoutSeconds>0?Math.min(s.timeoutSeconds,gw):void 0;await c(a,i,{deploymentId:o,delaySeconds:e})}},{retry:(e,{messageId:t,deliveryCount:n})=>{let r=_w(n);return console.error(`[workflow] Queue handler failed for message "${t}" on delivery attempt ${n}; retrying in ${r}s:`,e),{afterSeconds:r}}});return async e=>{let t=e.headers.get(`x-vercel-id`)?.trim()||void 0;return mw.run(t,()=>n(e))}},getDeploymentId:async()=>{let e=process.env.VERCEL_DEPLOYMENT_ID;if(!e)throw Error(uw(`Starting a workflow run`));return e}}}const Dw=ec({id:Za()});function Ow(e){return async function(){let t=process.env.VERCEL_DEPLOYMENT_ID;if(!t)throw Error(uw(`Resolving the latest deployment for deploymentId: 'latest'`));let n=await Mm(e);if(!n)throw Error(`Cannot resolve latest deployment: no OIDC token or VERCEL_TOKEN available`);let r=await(await Fm({method:`GET`,url:`https://api.vercel.com/v1/workflow/resolve-latest-deployment/${encodeURIComponent(t)}`,headers:new Headers({Authorization:`Bearer ${n}`}),dispatcher:Bp(e),peerService:`vercel-api`,timeoutMs:null,buildError:async e=>{let n;try{n=await e.text()}catch{n=`<unable to read response body>`}return Error(`Failed to resolve latest deployment for ${t}: HTTP ${e.status} ${e.statusText}${n?` — ${n}`:``}`)}})).json(),i=Dw.safeParse(r);if(!i.success)throw Error(`Invalid response from Vercel API: expected { id: string }. Zod error: ${i.error.message}`);return i.data.id}}const kw={run_created:{retryable:!0,reason:`conditional create → 409 if exists`},step_created:{retryable:!0,reason:`conditional create → 409 if exists`},wait_created:{retryable:!0,reason:`conditional create → 409 if exists`},hook_created:{retryable:!0,reason:`transactional token uniqueness → 409 if exists`},run_started:{retryable:!0,reason:`early-returns if already running, no duplicate row`},run_completed:{retryable:!0,reason:`terminal-state guard → 409, no duplicate row`},run_failed:{retryable:!0,reason:`terminal-state guard → 409, no duplicate row`},run_cancelled:{retryable:!0,reason:`terminal-state guard → 409, no duplicate row`},step_completed:{retryable:!0,reason:`terminal-state guard → 409, no duplicate row`},step_failed:{retryable:!0,reason:`terminal-state guard → 409, no duplicate row`},wait_completed:{retryable:!0,reason:`waiting-state guard → 409, no duplicate row`},hook_disposed:{retryable:!0,reason:`conditional delete (exists) → 409, no duplicate row`},attr_set:{retryable:!0,reason:`correlationId constraint reuses eventId (idempotent replay)`},step_started:{retryable:!1,reason:`unconditional attempt increment → a retry double-counts attempts`},step_retrying:{retryable:!1,reason:`no duplicate guard → a retry appends a second event row`},hook_received:{retryable:!1,reason:`no server guard → a retry duplicates the row / re-delivers payload`},hook_conflict:{retryable:!1,reason:`server-originated; never POSTed by the SDK`}},Aw=new Set([`ECONNRESET`,`ECONNREFUSED`,`ENOTFOUND`,`ENETDOWN`,`ENETUNREACH`,`EHOSTDOWN`,`EHOSTUNREACH`,`EPIPE`,`ETIMEDOUT`,`UND_ERR_SOCKET`,`UND_ERR_REQ_RETRY`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`TimeoutError`,`RequestRetryError`]);function jw(e,t=0){if(t>5||typeof e!=`object`||!e)return[];let n=[],r=e;return typeof r.code==`string`&&n.push(r.code),typeof r.name==`string`&&n.push(r.name),r.cause&&n.push(...jw(r.cause,t+1)),n}function Mw(e){if(f.is(e)||l.is(e)||s.is(e)||u.is(e))return!1;if(a.is(e)){if(e.code===`PARSE_ERROR`)return!0;if(typeof e.status==`number`)return e.status>=500&&e.status<=599}return jw(e).some(e=>Aw.has(e))}const Nw=e=>new Promise(t=>setTimeout(t,e)),Pw=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`);function Fw(e,t){if(!Pw)return;let n=Object.entries(t).map(([e,t])=>`${e}=${t}`).join(` `);console.debug(`[workflow:world-vercel:event-retry] ${e} ${n}`)}function Iw(e){return a.is(e)?e.code??(e.status==null?e.name:`status_${e.status}`):jw(e)[0]??(e instanceof Error?e.name:`unknown`)}async function Lw(e,t){let n=kw[t]?.retryable??!1;for(let r=0;;r++)try{return await e()}catch(e){let i=n&&Mw(e);if(i&&r<2){let n=100*2**r+Math.floor(Math.random()*50);Fw(`retrying event POST after transient failure`,{eventType:t,attempt:r+1,backoffMs:n,error:Iw(e)}),await Nw(n);continue}throw i&&Fw(`exhausted in-process retries; surfacing for queue redelivery`,{eventType:t,attempts:r+1,error:Iw(e)}),e}}const Rw=`application/vnd.workflow.v4-frames`;function zw(e,t){let n=new Uint8Array(_p(e)),r=new Uint8Array(4+n.byteLength+4+t.byteLength),i=new DataView(r.buffer);return i.setUint32(0,n.byteLength,!1),r.set(n,4),i.setUint32(4+n.byteLength,t.byteLength,!1),r.set(t,4+n.byteLength+4),r}async function*Bw(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():Hw(e.getReader()),n=new Uint8Array,r=async e=>{for(;n.byteLength<e;){let{done:e,value:r}=await t.next();if(e)return!1;if(!r||r.byteLength===0)continue;let i=new Uint8Array(n.byteLength+r.byteLength);i.set(n,0),i.set(r,n.byteLength),n=i}return!0},i=e=>{let t=n.subarray(0,e);return n=n.subarray(e),t};try{for(;;){if(!await r(4))return;let e=new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(i(4),!await r(e))throw Error(`decodeFrames: truncated meta block`);let t=Wf(i(e));if(!await r(4))throw Error(`decodeFrames: truncated body length`);let a=new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(i(4),a>0&&!await r(a))throw Error(`decodeFrames: truncated body bytes`);if(yield{meta:t,body:n.slice(0,a)},i(a),t._end===1)return}}finally{Vw(()=>t.return?.())}}function Vw(e){try{Promise.resolve(e()).catch(()=>{})}catch{}}async function*Hw(e){try{for(;;){let{done:t,value:n}=await e.read();if(t)return;n&&(yield n)}}finally{Vw(()=>e.cancel())}}async function Uw(e,t,n,r){return Fm({method:t.method,url:e,headers:t.headers,body:t.body,dispatcher:Vp(n),timeoutMs:null,logLabel:r,buildError:async t=>qw(t.status,Ww(t.headers),await t.text(),r,e)})}function Ww(e){let t={};return e.forEach((e,n)=>{t[n]=e}),t}const Gw={eventId:`x-wf-event-id`,runId:`x-wf-run-id`,createdAt:`x-wf-created-at`};function Kw(e){let t={eventType:e.eventType,specVersion:e.specVersion};return e.correlationId!==void 0&&(t.correlationId=e.correlationId),e.vercelId!==void 0&&(t.vercelId=e.vercelId),e.occurredAt!==void 0&&(t.occurredAt=e.occurredAt),e.remoteRefBehavior!==void 0&&(t.remoteRefBehavior=e.remoteRefBehavior),e.deploymentId!==void 0&&(t.deploymentId=e.deploymentId),e.workflowName!==void 0&&(t.workflowName=e.workflowName),e.stepName!==void 0&&(t.stepName=e.stepName),e.attempt!==void 0&&(t.attempt=e.attempt),e.resumeAt!==void 0&&(t.resumeAt=e.resumeAt),e.retryAfter!==void 0&&(t.retryAfter=e.retryAfter),e.hookToken!==void 0&&(t.hookToken=e.hookToken),e.hookTokenRetentionUntil!==void 0&&(t.hookTokenRetentionUntil=e.hookTokenRetentionUntil),e.hookIsWebhook!==void 0&&(t.hookIsWebhook=e.hookIsWebhook),e.hookIsSystem!==void 0&&(t.hookIsSystem=e.hookIsSystem),e.errorCode!==void 0&&(t.errorCode=e.errorCode),e.cancelReason!==void 0&&(t.cancelReason=e.cancelReason),e.ownerMessageId!==void 0&&(t.ownerMessageId=e.ownerMessageId),e.executionContext!==void 0&&(t.executionContext=e.executionContext),e.attributes!==void 0&&(t.attributes=e.attributes),e.changes!==void 0&&(t.changes=e.changes),e.writer!==void 0&&(t.writer=e.writer),e.allowReservedAttributes!==void 0&&(t.allowReservedAttributes=e.allowReservedAttributes),e.encryptionPublicKey!==void 0&&(t.encryptionPublicKey=e.encryptionPublicKey),e.ttfs!==void 0&&(t.ttfs=e.ttfs),e.stso!==void 0&&(t.stso=e.stso),e.stepCount!==void 0&&(t.stepCount=e.stepCount),e.eventCount!==void 0&&(t.eventCount=e.eventCount),e.rsfs!==void 0&&(t.rsfs=e.rsfs),e.finalSchedulingReplay!==void 0&&(t.finalSchedulingReplay=e.finalSchedulingReplay),e.optimizations!==void 0&&(t.optimizations=e.optimizations),e.sinceCursor!==void 0&&(t.sinceCursor=e.sinceCursor),e.skipPreload!==void 0&&(t.skipPreload=e.skipPreload),e.stateUpdatedAt!==void 0&&(t.stateUpdatedAt=e.stateUpdatedAt),t}function qw(e,t,n,r,i){let a=`v4 ${r} failed: HTTP ${e}`,o;try{let e=JSON.parse(n);typeof e.message==`string`&&(a=e.message),typeof e.code==`string`&&(o=e.code)}catch{n&&(a+=` ${n}`)}let s=km(Yw(t,`retry-after`));return Am(e,a,{retryAfter:s,code:o,url:i,mitigated:Yw(t,`x-vercel-mitigated`)})}async function Jw(e,t){let{baseUrl:n,headers:r}=await qm(t),i=new Headers(r);i.set(`Content-Type`,`application/octet-stream`);let a=zw(Kw(e),e.payload??new Uint8Array),o=await Uw(`${n}/v4/runs/${encodeURIComponent(e.runId)}/events/${encodeURIComponent(e.eventType)}`,{method:`POST`,headers:i,body:a},t,`createEvent`),s=o.headers.get(Gw.eventId),c=o.headers.get(Gw.runId),l=o.headers.get(Gw.createdAt);if(typeof s!=`string`||typeof c!=`string`||typeof l!=`string`)throw Error(`v4 createEvent: response missing required x-wf-* headers`);let u=new Uint8Array(await o.arrayBuffer());return{eventId:s,runId:c,createdAt:l,body:u.byteLength>0?Wf(u):{}}}function Yw(e,t){let n=e[t];if(typeof n==`string`)return n;if(Array.isArray(n)&&n.length>0)return n[0]}async function Xw(e,t,n){let{baseUrl:r,headers:i}=await qm(n),a=await Uw(`${r}/v4/runs/${encodeURIComponent(e)}/events/${encodeURIComponent(t)}`,{method:`GET`,headers:i},n,`getEvent`),o=a.headers.get(`content-type`);if(!o?.startsWith(`application/vnd.workflow.v4-frames`))throw Error(`v4 getEvent: expected ${Rw}, got ${o??`(none)`}`);let s=a.body;for await(let e of Bw(s))return{event:e.meta,body:e.body};throw Error(`v4 getEvent: empty frame stream for ${t}`)}async function Zw(e,t,n,r){let i=await Uw(e,{method:`GET`,headers:t},n,r),a=i.headers.get(`content-type`);if(!a?.startsWith(`application/vnd.workflow.v4-frames`))throw Error(`v4 ${r}: expected ${Rw}, got ${a??`(none)`}`);let o=i.body,s=[],c,l,u=!1;for await(let e of Bw(o)){if(e.meta._end===1){typeof e.meta.next==`string`&&(c=e.meta.next),typeof e.meta.hasMore==`boolean`&&(l=e.meta.hasMore),u=!0;break}s.push({event:e.meta,body:e.body})}if(!u)throw Error(`v4 ${r}: frame stream ended without the end-of-stream sentinel (${s.length} events read) — truncated response?`);return{events:s,...c?{next:c}:{},...l===void 0?{}:{hasMore:l}}}function Qw(e,t){t.cursor&&e.set(`cursor`,t.cursor),t.limit!==void 0&&e.set(`limit`,String(t.limit)),t.sortOrder&&e.set(`sortOrder`,t.sortOrder),t.remoteRefBehavior&&e.set(`remoteRefBehavior`,t.remoteRefBehavior)}function $w(e){let t=new URLSearchParams;Qw(t,e);let n=t.toString();return n?`?${n}`:``}async function eT(e,t={},n){let{baseUrl:r,headers:i}=await qm(n);return Zw(`${r}/v4/runs/${encodeURIComponent(e)}/events`+$w(t),i,n,`listEvents`)}async function tT(e,t={},n){let{baseUrl:r,headers:i}=await qm(n),a=new URLSearchParams;return a.set(`correlationId`,e),Qw(a,t),Zw(`${r}/v4/events?${a.toString()}`,i,n,`listEventsByCorrelationId`)}const nT=`gzip`,rT=`zstd`,iT=new TextDecoder,aT=new Set([`devl`,`encr`,nT,rT]);function oT(){try{return globalThis.process?.getBuiltinModule?.(`node:zlib`)}catch{return}}function sT(e){return!(e instanceof Uint8Array)||e.byteLength<4?null:iT.decode(e.subarray(0,4))}function cT(e){let t=sT(e);return t!==null&&aT.has(t)}function lT(e,t){let n=oT(),r=e===rT?n?.zstdDecompressSync:n?.gunzipSync;if(!r)throw new a(`Received ${e}-compressed workflow data, but this Node.js runtime does not support ${e} decompression. Use a compatible Node.js runtime or request unresolved data.`);return new Uint8Array(r(t))}function uT(e){let t=sT(e);return t!==rT&&t!==nT?e:lT(t,e.subarray(4))}function dT(e){return{...e,input:uT(e.input),output:uT(e.output),error:uT(e.error)}}function fT(e){return{...e,input:uT(e.input),output:uT(e.output),error:uT(e.error)}}function pT(e){return{...e,metadata:uT(e.metadata)}}function mT(e){let t=e.eventData;if(!t||typeof t!=`object`)return e;let n=Sn(typeof e.eventType==`string`?e.eventType:``);if(n.length===0)return e;let r={...t},i=!1;for(let e of n){if(!(e in r))continue;let t=r[e],n=uT(t);n!==t&&(r[e]=n,i=!0)}return i?{...e,eventData:r}:e}const hT=pn.omit({error:!0,errorCode:!0}).extend({error:gr([at,Tc()]).optional(),errorCode:Za().optional(),blobStorageBytes:mi().optional(),streamStorageBytes:mi().optional()}),gT=hT,_T=hT.omit({input:!0,output:!0}).extend({inputRef:Tc().optional(),outputRef:Tc().optional(),input:gr([ja(Uint8Array),Tc()]).optional(),output:gr([ja(Uint8Array),Tc()]).optional()});function vT(e,t){if(t===`none`){let{inputRef:t,outputRef:n,...r}=e;return{...dT(Hm(r)),input:void 0,output:void 0}}return dT(Hm(e))}async function yT(e={},t){let{workflowName:n,status:r,pagination:i,resolveData:a=`all`}=e,o=new URLSearchParams;n&&o.set(`workflowName`,n),r&&o.set(`status`,r),i?.limit&&o.set(`limit`,i.limit.toString()),i?.cursor&&o.set(`cursor`,i.cursor),i?.sortOrder&&o.set(`sortOrder`,i.sortOrder);let s=a===`none`?`lazy`:`resolve`;o.set(`remoteRefBehavior`,s);let c=o.toString(),l=await L({endpoint:`/v2/runs${c?`?${c}`:``}`,options:{method:`GET`},config:t,schema:bs(s===`lazy`?_T:gT)});return{...l,data:l.data.map(e=>vT(e,a))}}async function bT(e,t){return Hm(await L({endpoint:`/v1/runs/create`,options:{method:`POST`},data:e,config:t,schema:gT}))}async function xT(e,t,n){let r=t?.resolveData??`all`,i=r===`none`?`lazy`:`resolve`,s=new URLSearchParams;s.set(`remoteRefBehavior`,i);let c=s.toString(),l=`/v2/runs/${encodeURIComponent(e)}${c?`?${c}`:``}`;try{return vT(await L({endpoint:l,options:{method:`GET`},config:n,retryConnectTimeout:!0,schema:i===`lazy`?_T:gT}),r)}catch(t){throw t instanceof a&&t.status===404?new o(e):t}}async function ST(e,t,n){let r=[...new Set(e)],i=await Promise.all(r.map(async e=>{try{return await xT(e,t,n)}catch(e){if(e instanceof o)return null;throw e}})),a=new Map(r.map((e,t)=>[e,i[t]]));return e.map(e=>a.get(e)??null)}async function CT(e,t,n){let r=t?.resolveData??`all`,i=r===`none`?`lazy`:`resolve`,s=new URLSearchParams;s.set(`remoteRefBehavior`,i);let c=s.toString(),l=`/v1/runs/${encodeURIComponent(e)}/cancel${c?`?${c}`:``}`;try{return vT(await L({endpoint:l,options:{method:`PUT`},config:n,schema:i===`lazy`?_T:gT}),r)}catch(t){throw t instanceof a&&t.status===404?new o(e):t}}const wT=ec({attributes:Be(Za(),Za())});async function TT(e,t,n,r){try{return{attributes:(await L({endpoint:`/v2/runs/${encodeURIComponent(e)}/attributes`,options:{method:`POST`},data:n?.allowReservedAttributes?{changes:t,allowReservedAttributes:!0}:{changes:t},config:r,schema:wT})).attributes}}catch(t){throw t instanceof a&&t.status===404?new o(e):t}}const ET=Pe.omit({error:!0}).extend({error:gr([at,Tc()]).optional(),errorRef:Tc().optional()}),DT=ET.omit({input:!0,output:!0}).extend({inputRef:Tc().optional(),outputRef:Tc().optional(),input:ja(Uint8Array).optional(),output:ja(Uint8Array).optional()});function OT(e){let{error:t,errorRef:n,...r}=e,i={...r},a=t??n;return a!=null&&(i.error=a),i}function kT(e,t){if(t===`none`){let{inputRef:t,outputRef:n,...r}=e;return{...fT(OT(r)),input:void 0,output:void 0}}return fT(OT(e))}async function AT(e,t){let{runId:n,pagination:r,resolveData:i=`all`}=e,a=new URLSearchParams;r?.cursor&&a.set(`cursor`,r.cursor),r?.limit&&a.set(`limit`,r.limit.toString()),r?.sortOrder&&a.set(`sortOrder`,r.sortOrder);let o=i===`none`?`lazy`:`resolve`;a.set(`remoteRefBehavior`,o);let s=a.toString(),c=await L({endpoint:`/v2/runs/${encodeURIComponent(n)}/steps${s?`?${s}`:``}`,options:{method:`GET`},config:t,schema:bs(o===`lazy`?DT:ET)});return{...c,data:c.data.map(e=>kT(e,i))}}async function jT(e,t,n,r){let i=n?.resolveData??`all`,a=i===`none`?`lazy`:`resolve`,o=new URLSearchParams;o.set(`remoteRefBehavior`,a);let s=o.toString();return kT(await L({endpoint:`/v2/runs/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}${s?`?${s}`:``}`,options:{method:`GET`},config:r,schema:a===`lazy`?DT:ET}),i)}function MT(e){let t=e.startsWith(`wrun_`)?e.slice(5):e;try{return us(`wrun_${Gc(t).ulid}`,`wrun_`)}catch{return us(e,`wrun_`)}}const NT=new Set([`run_created`,`run_started`,`step_started`]),PT=new Set([`run_failed`,`step_failed`,`step_retrying`]);function FT(e){let t=e.eventData??{},n=rn(e.eventType),r={};if(typeof t.deploymentId==`string`&&(r.deploymentId=t.deploymentId),typeof t.workflowName==`string`&&(r.workflowName=t.workflowName),typeof t.stepName==`string`&&(r.stepName=t.stepName),typeof t.attempt==`number`&&(r.attempt=t.attempt),t.resumeAt instanceof Date)r.resumeAt=t.resumeAt;else if(typeof t.resumeAt==`string`){let e=new Date(t.resumeAt);Number.isNaN(e.getTime())||(r.resumeAt=e)}if(t.retryAfter instanceof Date)r.retryAfter=t.retryAfter;else if(typeof t.retryAfter==`string`){let e=new Date(t.retryAfter);Number.isNaN(e.getTime())||(r.retryAfter=e)}typeof t.token==`string`&&(r.hookToken=t.token),t.tokenRetentionUntil instanceof Date&&(r.hookTokenRetentionUntil=t.tokenRetentionUntil),typeof t.isWebhook==`boolean`&&(r.hookIsWebhook=t.isWebhook),typeof t.isSystem==`boolean`&&(r.hookIsSystem=t.isSystem),typeof t.errorCode==`string`&&(r.errorCode=t.errorCode),typeof t.cancelReason==`string`&&(r.cancelReason=t.cancelReason),typeof t.ownerMessageId==`string`&&(r.ownerMessageId=t.ownerMessageId),t.executionContext!==void 0&&t.executionContext!==null&&typeof t.executionContext==`object`&&(r.executionContext=t.executionContext),t.attributes!==void 0&&t.attributes!==null&&typeof t.attributes==`object`&&(r.attributes=t.attributes),Array.isArray(t.changes)&&(r.changes=t.changes),t.writer!==void 0&&t.writer!==null&&typeof t.writer==`object`&&(r.writer=t.writer),typeof t.allowReservedAttributes==`boolean`&&(r.allowReservedAttributes=t.allowReservedAttributes),typeof t.encryptionPublicKey==`string`&&(r.encryptionPublicKey=t.encryptionPublicKey),typeof t.ttfs==`number`&&(r.ttfs=t.ttfs),typeof t.stso==`number`&&(r.stso=t.stso),typeof t.stepCount==`number`&&Number.isSafeInteger(t.stepCount)&&t.stepCount>0&&(r.stepCount=t.stepCount),typeof t.eventCount==`number`&&Number.isSafeInteger(t.eventCount)&&t.eventCount>0&&(r.eventCount=t.eventCount),typeof t.rsfs==`number`&&(r.rsfs=t.rsfs),typeof t.finalSchedulingReplay==`number`&&(r.finalSchedulingReplay=t.finalSchedulingReplay),Array.isArray(t.optimizations)&&t.optimizations.every(e=>typeof e==`string`)&&(r.optimizations=t.optimizations);let i;if(n&&n in t){let r=t[n];if(r!==void 0){if(!(r instanceof Uint8Array))throw TypeError(`world-vercel v4: eventData.${n} for ${e.eventType} must be a Uint8Array (the runtime's dehydrated wire form); got ${typeof r==`object`?r===null?`null`:r.constructor?.name??typeof r:typeof r}.`);i=r}}return{payload:i,meta:r}}function IT(e){let t=Ga.safeParse(e);return t.success?t.data:(Jt.safeParse(e.eventType).success&&console.debug(`[workflow:world-vercel] v4 event ${e.eventId} failed EventSchema parse for known eventType '${e.eventType}'; passing through unparsed: ${t.error.message}`),e)}function LT(e){return IT(mT(e))}function RT(e){if(cT(e))return e;try{let t=Fi.safeParse(Wf(e.slice()));return t.success?t.data:e}catch{return e}}function zT(e,t,n){let r=e.eventData??{};if(t.byteLength>0){let n=rn(e.eventType),i=uT(t);n&&i instanceof Uint8Array&&(r[n]=PT.has(e.eventType)?RT(i):i)}let i=LT({eventId:e.eventId,runId:e.runId,eventType:e.eventType,createdAt:e.createdAt instanceof Date?e.createdAt:new Date(e.createdAt),...e.occurredAt===void 0?{}:{occurredAt:e.occurredAt instanceof Date?e.occurredAt:new Date(e.occurredAt)},...e.correlationId?{correlationId:e.correlationId}:{},eventData:r,...e.specVersion===void 0?{}:{specVersion:e.specVersion}});return n===`none`?yr(i,`none`):i}async function BT(e,t,n,r){let i=n?.resolveData??`all`,{event:a,body:o}=await Xw(e,t,r);return zT(a,o,i)}async function VT(e,t){let{pagination:n,resolveData:r=`all`}=e,i={cursor:n?.cursor??void 0,limit:n?.limit,sortOrder:n?.sortOrder,remoteRefBehavior:r===`none`?`lazy`:`resolve`},a=await(`correlationId`in e?tT(e.correlationId,i,t):eT(e.runId,i,t));return{data:a.events.map(e=>zT(e.event,e.body,r)),cursor:a.next??null,hasMore:typeof a.hasMore==`boolean`?a.hasMore:!!a.next}}async function HT(e,t,n,r){try{return await Lw(()=>UT(e,t,n,r),t.eventType)}catch(e){throw mt(t.eventType)&&a.is(e)&&e.status===404&&t.correlationId?new d(t.correlationId):e}}async function UT(e,t,n,r){if(n?.v1Compat){if(t.eventType===`run_cancelled`&&e)return{run:await CT(e,n,r)};if(t.eventType===`run_created`)return{run:await bT(t.eventData,r)};if(e===null)throw new a(`world-vercel: v1Compat=true requires a runId for ${t.eventType}`,{status:400});return{event:await L({endpoint:`/v1/runs/${encodeURIComponent(e)}/events`,options:{method:`POST`},data:t,config:r,schema:Ga})}}if(e===null)throw new a(`world-vercel v4: createWorkflowRunEvent requires a client-generated runId for run_created (the runId is part of the payload storage ref key). Generate a wrun_ ULID before calling.`,{status:400});if(t.eventType===`run_created`){let t=MT(e);if(t)throw new a(t,{status:400})}let i=NT.has(t.eventType)?`resolve`:`lazy`,{payload:o,meta:s}=FT(t),c=await Jw({runId:e,eventType:t.eventType,specVersion:t.specVersion??2,...t.correlationId?{correlationId:t.correlationId}:{},...n?.requestId?{vercelId:n.requestId}:{},...n?.stateUpdatedAt===void 0?{}:{stateUpdatedAt:n.stateUpdatedAt},occurredAt:n?.occurredAt??new Date,...n?.sinceCursor?{sinceCursor:n.sinceCursor}:{},...n?.skipPreload?{skipPreload:!0}:{},remoteRefBehavior:i,payload:o,...s},r),l=n?.resolveData??`all`,u=c.body;return{event:u.event?yr(IT(u.event),l):void 0,run:u.run?Hm(u.run):void 0,step:u.step?OT(u.step):void 0,hook:u.hook,wait:u.wait,events:u.events?u.events.map(IT):void 0,cursor:u.cursor??void 0,hasMore:u.hasMore,...u.stepCreated?{stepCreated:!0}:{},...typeof u.maxEvents==`number`?{maxEvents:u.maxEvents}:{}}}function WT(e,t){if(t===`none`){let{metadataRef:t,...n}=e;return n}return pT(e)}const GT=zs.omit({metadata:!0}).extend({metadataRef:Hd.any().optional()});async function KT(e,t){let{runId:n,pagination:r,resolveData:i=`all`}=e,a=new URLSearchParams;r?.limit&&a.set(`limit`,r.limit.toString()),r?.cursor&&a.set(`cursor`,r.cursor),r?.sortOrder&&a.set(`sortOrder`,r.sortOrder);let o=i===`none`?`lazy`:`resolve`;a.set(`remoteRefBehavior`,o),n&&a.set(`runId`,n);let s=a.toString(),c=await L({endpoint:`/v2/hooks${s?`?${s}`:``}`,options:{method:`GET`},config:t,schema:bs(o===`lazy`?GT:zs)});return{...c,data:c.data.map(e=>WT(e,i))}}async function qT(e,t,n){let r=t?.resolveData||`all`;return WT(await L({endpoint:`/v2/hooks/${encodeURIComponent(e)}`,options:{method:`GET`},config:n,schema:zs}),r)}async function JT(e,t){try{return await L({endpoint:`/v2/hooks/by-token?token=${encodeURIComponent(e)}`,options:{method:`GET`},config:t,schema:zs})}catch(t){throw a.is(t)&&t.status===404?new d(e):t}}function YT(e){let t={runs:{get:((t,n)=>xT(t,n,e)),getMany:((t,n)=>ST(t,n,e)),list:(t=>yT(t,e)),experimentalSetAttributes:(t,n,r)=>TT(t,n,r,e)},steps:{get:((t,n,r)=>jT(t,n,r,e)),list:(t=>AT(t,e))},events:{create:(t,n,r)=>HT(t,n,r,e),get:(t,n,r)=>BT(t,n,r,e),list:t=>VT(t,e),listByCorrelationId:t=>VT(t,e)},hooks:{get:(t,n)=>qT(t,n,e),getByToken:t=>JT(t,e),list:t=>KT(t,e)}};return{runs:yh(`world.runs`,t.runs),steps:yh(`world.steps`,t.steps),events:yh(`world.events`,t.events),hooks:yh(`world.hooks`,t.hooks)}}const XT=()=>Rc(`WORKFLOW_MAX_CHUNKS_PER_REQUEST`,1e3,{integer:!0,min:1});function ZT(e,t,n){return new URL(`${n.baseUrl}/v2/runs/${encodeURIComponent(t)}/stream/${encodeURIComponent(e)}`)}function QT(e,t,n){return new URL(`${n.baseUrl}/v3/runs/${encodeURIComponent(t)}/stream/${encodeURIComponent(e)}`)}function $T(e){return{..._m(e.runId),...ym(e.name),...bm(e.operation),...typeof e.startIndex==`number`?xm(e.startIndex):{}}}function eE(e,t,n,r){let i=[`PUT ${t.origin}${t.pathname}`,...Tm(n.headers)];return Error(`Stream ${e} failed: HTTP ${n.status} (${i.join(`; `)}): ${r}`)}function tE(e){let t=new TextEncoder,n=[],r=0;for(let i of e){let e=typeof i==`string`?t.encode(i):i;n.push(e),r+=4+e.length}let i=new Uint8Array(r),a=new DataView(i.buffer),o=0;for(let e of n)a.setUint32(o,e.length,!1),o+=4,i.set(e,o),o+=e.length;return i}const nE=ec({tailIndex:mi(),done:sc()}),rE=ec({data:Ai(ec({index:mi(),data:ja(Uint8Array)})),cursor:Za().nullable(),hasMore:sc(),done:sc()});function iE(e){return{streams:{async write(t,n,r){let i=await t,a=await qm(e),o=ZT(n,i,a);await(await Fm({method:`PUT`,url:o.toString(),body:r,headers:a.headers,dispatcher:Hp(e),timeoutMs:null,logLabel:o.pathname,spanName:`workflow.stream.write`,durationAttribute:`workflow.stream.write.chunk_rtt`,attributes:$T({runId:i,name:n,operation:`write`}),buildError:async e=>eE(`write`,o,e,await e.text())})).text()},async writeMulti(t,n,r){if(r.length===0)return;let i=await t,a=await qm(e);a.headers.set(`X-Stream-Multi`,`true`);let o=XT();for(let t=0;t<r.length;t+=o){let s=tE(r.slice(t,t+o)),c=ZT(n,i,a);await(await Fm({method:`PUT`,url:c.toString(),body:s,headers:a.headers,dispatcher:Hp(e),timeoutMs:null,logLabel:c.pathname,spanName:`workflow.stream.write`,durationAttribute:`workflow.stream.write.chunk_rtt`,attributes:$T({runId:i,name:n,operation:`write_multi`}),buildError:async e=>eE(`write`,c,e,await e.text())})).text()}},async close(t,n){let r=await t,i=await qm(e);i.headers.set(`X-Stream-Done`,`true`);let a=ZT(n,r,i);await(await Fm({method:`PUT`,url:a.toString(),headers:i.headers,dispatcher:Up(e),timeoutMs:null,logLabel:a.pathname,spanName:`workflow.stream.write`,durationAttribute:`workflow.stream.write.chunk_rtt`,attributes:$T({runId:r,name:n,operation:`close`}),buildError:async e=>eE(`close`,a,e,await e.text())})).text()},async get(t,n,r){let i=await qm(e),a=QT(n,t,i);typeof r==`number`&&a.searchParams.set(`startIndex`,String(r));let o=await Fm({method:`GET`,url:a.toString(),headers:i.headers,dispatcher:void 0,timeoutMs:null,logLabel:a.pathname,spanName:`workflow.stream.read.connect`,attributes:$T({runId:t,name:n,operation:`read`,startIndex:r}),buildError:e=>Error(`Failed to fetch stream: ${e.status}`)});if(!o.body)throw Error(`No response body for stream`);return o.body},async getChunks(t,n,r){let i=new URLSearchParams;r?.limit!=null&&i.set(`limit`,String(r.limit)),r?.cursor&&i.set(`cursor`,r.cursor);let a=i.toString();return L({endpoint:`/v2/runs/${encodeURIComponent(t)}/streams/${encodeURIComponent(n)}/chunks${a?`?${a}`:``}`,config:e,schema:rE})},async getInfo(t,n){return L({endpoint:`/v2/runs/${encodeURIComponent(t)}/streams/${encodeURIComponent(n)}/info`,config:e,schema:nE})},async list(t){let n=await qm(e),r=new URL(`${n.baseUrl}/v2/runs/${encodeURIComponent(t)}/streams`);return await(await Fm({method:`GET`,url:r.toString(),headers:n.headers,dispatcher:void 0,timeoutMs:null,logLabel:r.pathname,buildError:e=>Error(`Failed to list streams: ${e.status}`)})).json()}}}}function aE(e){let t=e?.projectConfig?.projectId||process.env.VERCEL_PROJECT_ID;return{specVersion:5,capabilities:{preconditionGuard:!0,maxConcurrency:!0},processExitTriggersQueueRedelivery:!0,...Ew(e),...YT(e),analytics:process.env.WORKFLOW_DISABLE_ANALYTICS_READS===`1`?void 0:$m(e),...yh(`world.streams`,iE(e)),createRunId:ah,describeRun:sh,getEncryptionKeyForRun:uh(t,e?.projectConfig?.teamId,e?.token,e?.dispatcher),resolveLatestDeploymentId:Ow(e)}}export{$m as createAnalytics,uh as createGetEncryptionKeyForRun,Ew as createQueue,ah as createRunId,YT as createStorage,iE as createStreamer,aE as createWorld,ch as deriveRunKey,sh as describeRun,lh as fetchRunKey,oh as regionForRunId};
|
|
42
|
+
Cause: ${t}`)}}buildUrl(e,...t){let n=encodeURIComponent(e),r=t.map(e=>encodeURIComponent(e)),i=r.length>0?`/`+r.join(`/`):``,a=this.baseUrl.pathname.replace(/\/+$/,``);return`${this.baseUrl.origin}${a}${ow}/${n}${i}`}async fetch(e,t){let n=t.method||`GET`;if(ZC()){let r={method:n,url:e,headers:t.headers},i=t.body;i!=null&&(i instanceof ArrayBuffer||i instanceof Uint8Array?r.bodySize=i.byteLength:typeof i==`string`?r.bodySize=i.length:r.bodyType=typeof i),console.debug(`[VQS Debug] Request:`,JSON.stringify(r,null,2))}t.headers.set(`User-Agent`,`@vercel/queue/0.4.0`),t.headers.set(`Vqs-Client-Ts`,new Date().toISOString());let r=this.dispatcher?{...t,dispatcher:this.dispatcher}:t,i=await fetch(e,r);if(ZC()){let t={method:n,url:e,status:i.status,statusText:i.statusText,headers:i.headers};console.debug(`[VQS Debug] Response:`,JSON.stringify(t,null,2))}return i}async sendMessage(e){let t=this.transport,{queueName:n,payload:r,idempotencyKey:i,retentionSeconds:a,delaySeconds:o,headers:s,telemetry:c}=e,l=new Headers;if(this.customHeaders)for(let[e,t]of Object.entries(this.customHeaders))l.append(e,t);if(s){let e=new Set([`authorization`,`content-type`]),t=t=>{let n=t.toLowerCase();return e.has(n)?!0:n.startsWith(`vqs-`)};for(let[e,n]of Object.entries(s))!t(e)&&n!==void 0&&l.append(e,n)}l.set(`Authorization`,`Bearer ${await this.getToken()}`),l.set(`Content-Type`,t.contentType);let u=this.getSendDeploymentId();u&&l.set(`Vqs-Deployment-Id`,u),i&&l.set(`Vqs-Idempotency-Key`,i),a!==void 0&&l.set(`Vqs-Retention-Seconds`,a.toString()),o!==void 0&&l.set(`Vqs-Delay-Seconds`,o.toString());let d=t.serialize(r),f=Buffer.isBuffer(d)?new Uint8Array(d):d,p=IC(this.telemetry,c);return WC(n,async e=>{await VC(l,p);let t=await this.fetch(this.buildUrl(n),{method:`POST`,body:f,headers:l});if(!t.ok){let e=await t.text();if(t.status===409)throw new SS(e||`Duplicate idempotency key detected`,i);if(t.status===502)throw new CS(e||`Consumer discovery failed`,u);if(t.status===503)throw new wS(e||`Consumer registry not configured`);ew(t.status,t.statusText,e,`send message`)}if(t.status===202)return await t.text(),{messageId:null};let r=await t.json();return e&&r.messageId&&e.setMessageId(r.messageId),r},p)}async*receiveMessages(e){let t=this.transport,{queueName:n,consumerGroup:r,visibilityTimeoutSeconds:i,limit:a}=e;if(a!==void 0&&(a<1||a>10))throw new bS(a);let o=new Headers({Authorization:`Bearer ${await this.getToken()}`,Accept:`multipart/mixed`,...this.customHeaders});i!==void 0&&o.set(`Vqs-Visibility-Timeout-Seconds`,i.toString()),a!==void 0&&o.set(`Vqs-Max-Messages`,a.toString());let s=this.getConsumeDeploymentId();s&&o.set(`Vqs-Deployment-Id`,s);let c=await this.fetch(this.buildUrl(n,`consumer`,r),{method:`POST`,headers:o});if(c.status===204){await c.text();return}if(!c.ok){let e=await c.text();ew(c.status,c.statusText,e,`receive messages`)}for await(let e of jh(c))try{let n=tw(e.headers);if(!n){console.warn(`Missing required queue headers in multipart part`),await QC(e.payload);continue}let r=await t.deserialize(e.payload);yield{...n,payload:r}}catch(t){console.warn(`Failed to process multipart message:`,t),await QC(e.payload)}}async receiveMessageById(e){let t=this.transport,{queueName:n,consumerGroup:r,messageId:i,visibilityTimeoutSeconds:a}=e,o=new Headers({Authorization:`Bearer ${await this.getToken()}`,Accept:`multipart/mixed`,...this.customHeaders});a!==void 0&&o.set(`Vqs-Visibility-Timeout-Seconds`,a.toString());let s=this.getConsumeDeploymentId();s&&o.set(`Vqs-Deployment-Id`,s);let c=await this.fetch(this.buildUrl(n,`consumer`,r,`id`,i),{method:`POST`,headers:o});if(!c.ok){let e=await c.text();if(c.status===404)throw new fS(i);if(c.status===409){let t={};try{t=JSON.parse(e)}catch{}throw t.originalMessageId?new pS(i,`This message was a duplicate - use originalMessageId: ${t.originalMessageId}`):new pS(i)}if(c.status===410)throw new xS(i);ew(c.status,c.statusText,e,`receive message by ID`)}for await(let e of jh(c)){let n=tw(e.headers);if(!n)throw await QC(e.payload),new mS(i,`Missing required queue headers in response`);let r=await t.deserialize(e.payload);return{message:{...n,payload:r}}}throw new fS(i)}async acknowledgeMessage(e){let{queueName:t,consumerGroup:n,receiptHandle:r}=e,i=new Headers({Authorization:`Bearer ${await this.getToken()}`,...this.customHeaders}),a=this.getConsumeDeploymentId();a&&i.set(`Vqs-Deployment-Id`,a);let o=await this.fetch(this.buildUrl(t,`consumer`,n,`lease`,r),{method:`DELETE`,headers:i});if(!o.ok){let e=await o.text();if(o.status===404)throw new fS(r);if(o.status===409)throw new pS(r,e||`Invalid receipt handle, message not in correct state, or already processed`);ew(o.status,o.statusText,e,`acknowledge message`,`Missing or invalid receipt handle`,o.headers?.get(`Retry-After`)??null)}return await o.text(),{acknowledged:!0}}async changeVisibility(e){let{queueName:t,consumerGroup:n,receiptHandle:r,visibilityTimeoutSeconds:i}=e,a=new Headers({Authorization:`Bearer ${await this.getToken()}`,"Content-Type":`application/json`,...this.customHeaders}),o=this.getConsumeDeploymentId();o&&a.set(`Vqs-Deployment-Id`,o);let s=await this.fetch(this.buildUrl(t,`consumer`,n,`lease`,r),{method:`PATCH`,headers:a,body:JSON.stringify({visibilityTimeoutSeconds:i})});if(!s.ok){let e=await s.text();if(s.status===404)throw new fS(r);if(s.status===409)throw new pS(r,e||`Invalid receipt handle, message not in correct state, or already processed`);ew(s.status,s.statusText,e,`change visibility`,`Missing receipt handle or invalid visibility timeout`,s.headers?.get(`Retry-After`)??null)}return await s.text(),{success:!0}}},cw=new WeakMap,lw=Symbol.for(`@vercel/queue.apiClient`);function uw(e,t){cw.set(e,t),Object.defineProperty(e,lw,{value:t,writable:!1,enumerable:!1,configurable:!1})}function dw(e){let t=cw.get(e);if(t)return t;let n=e[lw];if(typeof n==`object`&&n){let t=n;return cw.set(e,t),t}throw Error(`QueueClient not initialized. This may happen when multiple bundled copies of @vercel/queue are loaded in local dev.`)}function fw(e){return`request`in e?e.request:e}function pw(e){return dw(e)}var mw=`iad1`;function hw(e){return e||process.env.VERCEL_REGION||(JS()||console.warn(`[QueueClient] Region not detected \u2014 defaulting to "${mw}". On Vercel this is set automatically via VERCEL_REGION. To silence this warning, pass region explicitly: new QueueClient({ region: "iad1" })`),mw)}var gw=class{constructor(e={}){let t=hw(e.region);uw(this,new sw({...e,region:t}))}send=async(e,t,n)=>{let r=dw(this),i=await r.sendMessage({queueName:e,payload:t,idempotencyKey:n?.idempotencyKey,retentionSeconds:n?.retentionSeconds,delaySeconds:n?.delaySeconds,headers:n?.headers,telemetry:n?.telemetry});return i.messageId&&JS()&&PC(e,i.messageId,r.getRegion(),n?.delaySeconds,n?.retentionSeconds),{messageId:i.messageId}};handleCallback=(e,t)=>{JS()&&uC(e,this,t);let n=IC(dw(this).getTelemetry?.());return async r=>{let i=fw(r);if(JS()&&i.headers.get(`x-vercel-queue-prime`)===`1`){let n=i.headers.get(`x-vercel-queue-prime-file`);return n&&uC(e,this,t,n),Response.json({status:`primed`})}try{let r=await US(i);return await JC(i.headers,()=>WS(e,r,{client:this,visibilityTimeoutSeconds:t?.visibilityTimeoutSeconds,retry:t?.retry}),n),Response.json({status:`success`})}catch(e){return console.error(`Queue callback error:`,e),e instanceof Error&&(e.message.includes(`Invalid content type`)||e.message.includes(`Invalid CloudEvent`)||e.message.includes(`Missing required CloudEvent`)||e.message.includes(`Failed to parse CloudEvent`)||e.message.includes(`Binary mode callback`))?Response.json({error:e.message},{status:400}):Response.json({error:`Failed to process queue message`},{status:500})}}};handleNodeCallback=(e,t)=>{JS()&&uC(e,this,t);let n=IC(dw(this).getTelemetry?.());return async(r,i)=>{if(r.method!==`POST`){i.status(200).end();return}let a=r.headers[`x-vercel-queue-prime`];if(JS()&&a===`1`){let n=r.headers[`x-vercel-queue-prime-file`],a=Array.isArray(n)?n[0]:n;a&&uC(e,this,t,a),i.status(200).json({status:`primed`});return}try{let a=HS(r.body,r.headers);await JC(r.headers,()=>WS(e,a,{client:this,visibilityTimeoutSeconds:t?.visibilityTimeoutSeconds,retry:t?.retry}),n),i.status(200).json({status:`success`})}catch(e){if(console.error(`Queue callback error:`,e),e instanceof Error&&(e.message.includes(`Invalid content type`)||e.message.includes(`Invalid CloudEvent`)||e.message.includes(`Missing required CloudEvent`)||e.message.includes(`Failed to parse CloudEvent`)||e.message.includes(`Binary mode callback`))){i.status(400).json({error:e.message});return}i.status(500).json({error:`Failed to process queue message`})}}}};function _w(e){return`${e} requires VERCEL_DEPLOYMENT_ID, which Vercel sets in every deployment, so this process is not running inside one. The Vercel world is only selected automatically when that variable is set, so it was requested explicitly here — most often by WORKFLOW_TARGET_WORLD=vercel in a process that is not a deployment, such as a production server started locally or in CI. To use the local filesystem world instead, set WORKFLOW_TARGET_WORLD=local or unset it.`}var vw=class{contentType=`application/cbor`;serialize(e){return Buffer.from(_p(e))}async deserialize(e){let t=[],n=e.getReader();for(;;){let{done:e,value:r}=await n.read();if(e)break;r&&t.push(r)}return Wf(Buffer.concat(t))}},yw=class{contentType=`application/json`;serialize(e){return Buffer.from(JSON.stringify(e))}async deserialize(e){let t=[],n=e.getReader();for(;;){let{done:e,value:r}=await n.read();if(e)break;r&&t.push(r)}return JSON.parse(Buffer.concat(t).toString())}},bw=class{contentType=`application/cbor`;serialize(e){return Buffer.from(_p(e))}async deserialize(e){let t=[],n=e.getReader();for(;;){let{done:e,value:r}=await n.read();if(e)break;r&&t.push(r)}let r=Buffer.concat(t);try{return Wf(r)}catch{return JSON.parse(r.toString())}}};const xw=new wl,Sw=ec({payload:Ko,queueName:_o,deploymentId:Za().optional()}),Cw=Number(process.env.VERCEL_QUEUE_MAX_DELAY_SECONDS||82800);function ww(e){let t=Math.min(Math.max(1,2**(e-1)),900),n=Math.floor(Math.random()*(Math.ceil(t*.25)+1));return Math.max(1,t-n)}function Tw(e){if(`runId`in e&&typeof e.runId==`string`)return e.runId}function Ew(e){if(!e)return;let t=e.startsWith(`wrun_`)?e.slice(5):e;try{let e=Gc(t);return!e.tagged||e.regionId===Bc.unknown?void 0:e.region??void 0}catch{return}}function Dw(e,t){if(zc(t?.region))return t.region;let n=Ew(Tw(e));if(n)return n;let r=process.env.VERCEL_REGION;return zc(r)?r:`iad1`}function Ow(e){let t={};return`runId`in e&&typeof e.runId==`string`&&(t[`x-vercel-workflow-run-id`]=e.runId),`stepId`in e&&typeof e.stepId==`string`&&(t[`x-vercel-workflow-step-id`]=e.stepId),Object.keys(t).length>0?t:void 0}const kw=/^__([a-z][a-z0-9]*_)?wkf_workflow_/;let Aw=!1;function jw(){return process.env.WORKFLOW_SEQUENTIAL_REPLAYS===`1`}function Mw(e,t){return!jw()||!kw.test(e)?e:(Aw||(Aw=!0,console.warn(`[workflow] WORKFLOW_SEQUENTIAL_REPLAYS=1: routing flow messages to per-run queue topics`)),`__healthCheck`in t&&typeof t.correlationId==`string`?`${e}_${t.correlationId}`:`runId`in t&&typeof t.runId==`string`?`stepId`in t&&typeof t.stepId==`string`?`${e}_${t.runId}_${t.stepId}`:`${e}_${t.runId}`:e)}function Nw(e){let{baseUrl:t,usingProxy:n}=Zm(e),r=Qm(e,{usingProxy:n}),i=new vw,a=new yw,o=new bw,s={dispatcher:Wp(e),transport:o,...n&&{resolveBaseUrl:()=>new URL(`${t}/queues-proxy`),token:e?.token},headers:Object.fromEntries(r.entries())},c=async(e,t,r)=>{let o=r?.deploymentId??process.env.VERCEL_DEPLOYMENT_ID;if(!o)throw Error(`${_w(`Enqueuing a workflow message`)} Callers outside a deployment can instead pass an explicit deploymentId in options.`);let c=(r?.specVersion??5)>=3?i:a,l=Dw(t,r),u=new gw({...s,...n&&{headers:{...s.headers,"x-vercel-queue-region":l}},region:l,deploymentId:o,transport:c}),d={payload:t,queueName:e,deploymentId:r?.deploymentId},f=Mw(e,t).replace(/[^A-Za-z0-9-_]/g,`-`);try{let{messageId:e}=await u.send(f,d,{idempotencyKey:r?.idempotencyKey,delaySeconds:r?.delaySeconds,headers:{...Ow(t),...r?.headers}});return{messageId:e?ca.parse(e):null}}catch(e){if(e instanceof SS)return{messageId:ca.parse(`msg_duplicate_${e.idempotencyKey??r?.idempotencyKey??`unknown`}`)};throw e}};return{queue:c,createQueueHandler:(e,t)=>{let n=new gw(s).handleCallback(async(e,n)=>{if(!e||!n)return;let r=xw.getStore(),{payload:i,queueName:a,deploymentId:o}=Sw.parse(e),s=await t(i,{queueName:a,messageId:ca.parse(n.messageId),attempt:n.deliveryCount,requestId:r});if(typeof s?.timeoutSeconds==`number`){let e=s.timeoutSeconds>0?Math.min(s.timeoutSeconds,Cw):void 0;await c(a,i,{deploymentId:o,delaySeconds:e})}},{retry:(e,{messageId:t,deliveryCount:n})=>{let r=ww(n);return console.error(`[workflow] Queue handler failed for message "${t}" on delivery attempt ${n}; retrying in ${r}s:`,e),{afterSeconds:r}}});return async e=>{let t=e.headers.get(`x-vercel-id`)?.trim()||void 0;return xw.run(t,()=>n(e))}},getDeploymentId:async()=>{let e=process.env.VERCEL_DEPLOYMENT_ID;if(!e)throw Error(_w(`Starting a workflow run`));return e}}}const Pw=ec({id:Za()});function Fw(e){return async function(){let t=process.env.VERCEL_DEPLOYMENT_ID;if(!t)throw Error(_w(`Resolving the latest deployment for deploymentId: 'latest'`));let n=await Rm(e);if(!n)throw Error(`Cannot resolve latest deployment: no OIDC token or VERCEL_TOKEN available`);let r=await(await Vm({method:`GET`,url:`https://api.vercel.com/v1/workflow/resolve-latest-deployment/${encodeURIComponent(t)}`,headers:new Headers({Authorization:`Bearer ${n}`}),dispatcher:Wp(e),peerService:`vercel-api`,timeoutMs:null,buildError:async e=>{let n;try{n=await e.text()}catch{n=`<unable to read response body>`}return Error(`Failed to resolve latest deployment for ${t}: HTTP ${e.status} ${e.statusText}${n?` — ${n}`:``}`)}})).json(),i=Pw.safeParse(r);if(!i.success)throw Error(`Invalid response from Vercel API: expected { id: string }. Zod error: ${i.error.message}`);return i.data.id}}const Iw={run_created:{retryable:!0,reason:`conditional create → 409 if exists`},step_created:{retryable:!0,reason:`conditional create → 409 if exists`},wait_created:{retryable:!0,reason:`conditional create → 409 if exists`},hook_created:{retryable:!0,reason:`transactional token uniqueness → 409 if exists`},run_started:{retryable:!0,reason:`early-returns if already running, no duplicate row`},run_completed:{retryable:!0,reason:`terminal-state guard → 409, no duplicate row`},run_failed:{retryable:!0,reason:`terminal-state guard → 409, no duplicate row`},run_cancelled:{retryable:!0,reason:`terminal-state guard → 409, no duplicate row`},step_completed:{retryable:!0,reason:`terminal-state guard → 409, no duplicate row`},step_failed:{retryable:!0,reason:`terminal-state guard → 409, no duplicate row`},wait_completed:{retryable:!0,reason:`waiting-state guard → 409, no duplicate row`},hook_disposed:{retryable:!0,reason:`conditional delete (exists) → 409, no duplicate row`},attr_set:{retryable:!0,reason:`correlationId constraint reuses eventId (idempotent replay)`},step_started:{retryable:!1,reason:`unconditional attempt increment → a retry double-counts attempts`},step_retrying:{retryable:!1,reason:`no duplicate guard → a retry appends a second event row`},hook_received:{retryable:!1,reason:`no server guard → a retry duplicates the row / re-delivers payload`},hook_conflict:{retryable:!1,reason:`server-originated; never POSTed by the SDK`}},Lw=new Set([`ECONNRESET`,`ECONNREFUSED`,`ENOTFOUND`,`ENETDOWN`,`ENETUNREACH`,`EHOSTDOWN`,`EHOSTUNREACH`,`EPIPE`,`ETIMEDOUT`,`UND_ERR_SOCKET`,`UND_ERR_REQ_RETRY`,`UND_ERR_CONNECT_TIMEOUT`,`UND_ERR_HEADERS_TIMEOUT`,`UND_ERR_BODY_TIMEOUT`,`TimeoutError`,`RequestRetryError`]);function Rw(e,t=0){if(t>5||typeof e!=`object`||!e)return[];let n=[],r=e;return typeof r.code==`string`&&n.push(r.code),typeof r.name==`string`&&n.push(r.name),r.cause&&n.push(...Rw(r.cause,t+1)),n}function zw(e){if(f.is(e)||l.is(e)||s.is(e)||u.is(e))return!1;if(a.is(e)){if(e.code===`PARSE_ERROR`)return!0;if(typeof e.status==`number`)return e.status>=500&&e.status<=599}return Rw(e).some(e=>Lw.has(e))}const Bw=e=>new Promise(t=>setTimeout(t,e)),Vw=typeof process<`u`&&typeof process.env.DEBUG==`string`&&(process.env.DEBUG.includes(`workflow:`)||process.env.DEBUG===`*`);function Hw(e,t){if(!Vw)return;let n=Object.entries(t).map(([e,t])=>`${e}=${t}`).join(` `);console.debug(`[workflow:world-vercel:event-retry] ${e} ${n}`)}function Uw(e){return a.is(e)?e.code??(e.status==null?e.name:`status_${e.status}`):Rw(e)[0]??(e instanceof Error?e.name:`unknown`)}async function Ww(e,t){let n=Iw[t]?.retryable??!1;for(let r=0;;r++)try{return await e()}catch(e){let i=n&&zw(e);if(i&&r<2){let n=100*2**r+Math.floor(Math.random()*50);Hw(`retrying event POST after transient failure`,{eventType:t,attempt:r+1,backoffMs:n,error:Uw(e)}),await Bw(n);continue}throw i&&Hw(`exhausted in-process retries; surfacing for queue redelivery`,{eventType:t,attempts:r+1,error:Uw(e)}),e}}const Gw=`application/vnd.workflow.v4-frames`;function Kw(e,t){let n=new Uint8Array(_p(e)),r=new Uint8Array(4+n.byteLength+4+t.byteLength),i=new DataView(r.buffer);return i.setUint32(0,n.byteLength,!1),r.set(n,4),i.setUint32(4+n.byteLength,t.byteLength,!1),r.set(t,4+n.byteLength+4),r}async function*qw(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():Yw(e.getReader()),n=new Uint8Array,r=async e=>{for(;n.byteLength<e;){let{done:e,value:r}=await t.next();if(e)return!1;if(!r||r.byteLength===0)continue;let i=new Uint8Array(n.byteLength+r.byteLength);i.set(n,0),i.set(r,n.byteLength),n=i}return!0},i=e=>{let t=n.subarray(0,e);return n=n.subarray(e),t};try{for(;;){if(!await r(4))return;let e=new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(i(4),!await r(e))throw Error(`decodeFrames: truncated meta block`);let t=Wf(i(e));if(!await r(4))throw Error(`decodeFrames: truncated body length`);let a=new DataView(n.buffer,n.byteOffset,4).getUint32(0,!1);if(i(4),a>0&&!await r(a))throw Error(`decodeFrames: truncated body bytes`);if(yield{meta:t,body:n.slice(0,a)},i(a),t._end===1)return}}finally{Jw(()=>t.return?.())}}function Jw(e){try{Promise.resolve(e()).catch(()=>{})}catch{}}async function*Yw(e){try{for(;;){let{done:t,value:n}=await e.read();if(t)return;n&&(yield n)}}finally{Jw(()=>e.cancel())}}async function Xw(e,t,n,r){return Vm({method:t.method,url:e,headers:t.headers,body:t.body,dispatcher:Gp(n),timeoutMs:null,logLabel:r,buildError:async t=>eT(t.status,Zw(t.headers),await t.text(),r,e)})}function Zw(e){let t={};return e.forEach((e,n)=>{t[n]=e}),t}const Qw={eventId:`x-wf-event-id`,runId:`x-wf-run-id`,createdAt:`x-wf-created-at`};function $w(e){let t={eventType:e.eventType,specVersion:e.specVersion};return e.correlationId!==void 0&&(t.correlationId=e.correlationId),e.vercelId!==void 0&&(t.vercelId=e.vercelId),e.occurredAt!==void 0&&(t.occurredAt=e.occurredAt),e.remoteRefBehavior!==void 0&&(t.remoteRefBehavior=e.remoteRefBehavior),e.deploymentId!==void 0&&(t.deploymentId=e.deploymentId),e.workflowName!==void 0&&(t.workflowName=e.workflowName),e.stepName!==void 0&&(t.stepName=e.stepName),e.attempt!==void 0&&(t.attempt=e.attempt),e.resumeAt!==void 0&&(t.resumeAt=e.resumeAt),e.retryAfter!==void 0&&(t.retryAfter=e.retryAfter),e.hookToken!==void 0&&(t.hookToken=e.hookToken),e.hookTokenRetentionUntil!==void 0&&(t.hookTokenRetentionUntil=e.hookTokenRetentionUntil),e.hookIsWebhook!==void 0&&(t.hookIsWebhook=e.hookIsWebhook),e.hookIsSystem!==void 0&&(t.hookIsSystem=e.hookIsSystem),e.errorCode!==void 0&&(t.errorCode=e.errorCode),e.cancelReason!==void 0&&(t.cancelReason=e.cancelReason),e.ownerMessageId!==void 0&&(t.ownerMessageId=e.ownerMessageId),e.executionContext!==void 0&&(t.executionContext=e.executionContext),e.attributes!==void 0&&(t.attributes=e.attributes),e.changes!==void 0&&(t.changes=e.changes),e.writer!==void 0&&(t.writer=e.writer),e.allowReservedAttributes!==void 0&&(t.allowReservedAttributes=e.allowReservedAttributes),e.encryptionPublicKey!==void 0&&(t.encryptionPublicKey=e.encryptionPublicKey),e.ttfs!==void 0&&(t.ttfs=e.ttfs),e.stso!==void 0&&(t.stso=e.stso),e.stepCount!==void 0&&(t.stepCount=e.stepCount),e.eventCount!==void 0&&(t.eventCount=e.eventCount),e.rsfs!==void 0&&(t.rsfs=e.rsfs),e.finalSchedulingReplay!==void 0&&(t.finalSchedulingReplay=e.finalSchedulingReplay),e.optimizations!==void 0&&(t.optimizations=e.optimizations),e.sinceCursor!==void 0&&(t.sinceCursor=e.sinceCursor),e.skipPreload!==void 0&&(t.skipPreload=e.skipPreload),e.stateUpdatedAt!==void 0&&(t.stateUpdatedAt=e.stateUpdatedAt),t}function eT(e,t,n,r,i){let a=`v4 ${r} failed: HTTP ${e}`,o;try{let e=JSON.parse(n);typeof e.message==`string`&&(a=e.message),typeof e.code==`string`&&(o=e.code)}catch{n&&(a+=` ${n}`)}let s=Fm(nT(t,`retry-after`));return Im(e,a,{retryAfter:s,code:o,url:i,mitigated:nT(t,`x-vercel-mitigated`)})}async function tT(e,t){let{baseUrl:n,headers:r}=await $m(t),i=new Headers(r);i.set(`Content-Type`,`application/octet-stream`);let a=Kw($w(e),e.payload??new Uint8Array),o=await Xw(`${n}/v4/runs/${encodeURIComponent(e.runId)}/events/${encodeURIComponent(e.eventType)}`,{method:`POST`,headers:i,body:a},t,`createEvent`),s=o.headers.get(Qw.eventId),c=o.headers.get(Qw.runId),l=o.headers.get(Qw.createdAt);if(typeof s!=`string`||typeof c!=`string`||typeof l!=`string`)throw Error(`v4 createEvent: response missing required x-wf-* headers`);let u=new Uint8Array(await o.arrayBuffer());return{eventId:s,runId:c,createdAt:l,body:u.byteLength>0?Wf(u):{}}}function nT(e,t){let n=e[t];if(typeof n==`string`)return n;if(Array.isArray(n)&&n.length>0)return n[0]}async function rT(e,t,n){let{baseUrl:r,headers:i}=await $m(n),a=await Xw(`${r}/v4/runs/${encodeURIComponent(e)}/events/${encodeURIComponent(t)}`,{method:`GET`,headers:i},n,`getEvent`),o=a.headers.get(`content-type`);if(!o?.startsWith(`application/vnd.workflow.v4-frames`))throw Error(`v4 getEvent: expected ${Gw}, got ${o??`(none)`}`);let s=a.body;for await(let e of qw(s))return{event:e.meta,body:e.body};throw Error(`v4 getEvent: empty frame stream for ${t}`)}async function iT(e,t,n,r){let i=await Xw(e,{method:`GET`,headers:t},n,r),a=i.headers.get(`content-type`);if(!a?.startsWith(`application/vnd.workflow.v4-frames`))throw Error(`v4 ${r}: expected ${Gw}, got ${a??`(none)`}`);let o=i.body,s=[],c,l,u=!1;for await(let e of qw(o)){if(e.meta._end===1){typeof e.meta.next==`string`&&(c=e.meta.next),typeof e.meta.hasMore==`boolean`&&(l=e.meta.hasMore),u=!0;break}s.push({event:e.meta,body:e.body})}if(!u)throw Error(`v4 ${r}: frame stream ended without the end-of-stream sentinel (${s.length} events read) — truncated response?`);return{events:s,...c?{next:c}:{},...l===void 0?{}:{hasMore:l}}}function aT(e,t){t.cursor&&e.set(`cursor`,t.cursor),t.limit!==void 0&&e.set(`limit`,String(t.limit)),t.sortOrder&&e.set(`sortOrder`,t.sortOrder),t.remoteRefBehavior&&e.set(`remoteRefBehavior`,t.remoteRefBehavior)}function oT(e){let t=new URLSearchParams;aT(t,e);let n=t.toString();return n?`?${n}`:``}async function sT(e,t={},n){let{baseUrl:r,headers:i}=await $m(n);return iT(`${r}/v4/runs/${encodeURIComponent(e)}/events`+oT(t),i,n,`listEvents`)}async function cT(e,t={},n){let{baseUrl:r,headers:i}=await $m(n),a=new URLSearchParams;return a.set(`correlationId`,e),aT(a,t),iT(`${r}/v4/events?${a.toString()}`,i,n,`listEventsByCorrelationId`)}const lT=`gzip`,uT=`zstd`,dT=new TextDecoder,fT=new Set([`devl`,`encr`,lT,uT]);function pT(){try{return globalThis.process?.getBuiltinModule?.(`node:zlib`)}catch{return}}function mT(e){return!(e instanceof Uint8Array)||e.byteLength<4?null:dT.decode(e.subarray(0,4))}function hT(e){let t=mT(e);return t!==null&&fT.has(t)}function gT(e,t){let n=pT(),r=e===uT?n?.zstdDecompressSync:n?.gunzipSync;if(!r)throw new a(`Received ${e}-compressed workflow data, but this Node.js runtime does not support ${e} decompression. Use a compatible Node.js runtime or request unresolved data.`);return new Uint8Array(r(t))}function _T(e){let t=mT(e);return t!==uT&&t!==lT?e:gT(t,e.subarray(4))}function vT(e){return{...e,input:_T(e.input),output:_T(e.output),error:_T(e.error)}}function yT(e){return{...e,input:_T(e.input),output:_T(e.output),error:_T(e.error)}}function bT(e){return{...e,metadata:_T(e.metadata)}}function xT(e){let t=e.eventData;if(!t||typeof t!=`object`)return e;let n=Sn(typeof e.eventType==`string`?e.eventType:``);if(n.length===0)return e;let r={...t},i=!1;for(let e of n){if(!(e in r))continue;let t=r[e],n=_T(t);n!==t&&(r[e]=n,i=!0)}return i?{...e,eventData:r}:e}const ST=pn.omit({error:!0,errorCode:!0}).extend({error:gr([at,Tc()]).optional(),errorCode:Za().optional(),blobStorageBytes:mi().optional(),streamStorageBytes:mi().optional()}),CT=ST,wT=ST.omit({input:!0,output:!0}).extend({inputRef:Tc().optional(),outputRef:Tc().optional(),input:gr([ja(Uint8Array),Tc()]).optional(),output:gr([ja(Uint8Array),Tc()]).optional()});function TT(e,t){if(t===`none`){let{inputRef:t,outputRef:n,...r}=e;return{...vT(Jm(r)),input:void 0,output:void 0}}return vT(Jm(e))}async function ET(e={},t){let{workflowName:n,status:r,pagination:i,resolveData:a=`all`}=e,o=new URLSearchParams;n&&o.set(`workflowName`,n),r&&o.set(`status`,r),i?.limit&&o.set(`limit`,i.limit.toString()),i?.cursor&&o.set(`cursor`,i.cursor),i?.sortOrder&&o.set(`sortOrder`,i.sortOrder);let s=a===`none`?`lazy`:`resolve`;o.set(`remoteRefBehavior`,s);let c=o.toString(),l=await R({endpoint:`/v2/runs${c?`?${c}`:``}`,options:{method:`GET`},config:t,schema:bs(s===`lazy`?wT:CT)});return{...l,data:l.data.map(e=>TT(e,a))}}async function DT(e,t){return Jm(await R({endpoint:`/v1/runs/create`,options:{method:`POST`},data:e,config:t,schema:CT}))}async function OT(e,t,n){let r=t?.resolveData??`all`,i=r===`none`?`lazy`:`resolve`,s=new URLSearchParams;s.set(`remoteRefBehavior`,i);let c=s.toString(),l=`/v2/runs/${encodeURIComponent(e)}${c?`?${c}`:``}`;try{return TT(await R({endpoint:l,options:{method:`GET`},config:n,retryConnectTimeout:!0,schema:i===`lazy`?wT:CT}),r)}catch(t){throw t instanceof a&&t.status===404?new o(e):t}}async function kT(e,t,n){let r=[...new Set(e)],i=await Promise.all(r.map(async e=>{try{return await OT(e,t,n)}catch(e){if(e instanceof o)return null;throw e}})),a=new Map(r.map((e,t)=>[e,i[t]]));return e.map(e=>a.get(e)??null)}async function AT(e,t,n){let r=t?.resolveData??`all`,i=r===`none`?`lazy`:`resolve`,s=new URLSearchParams;s.set(`remoteRefBehavior`,i);let c=s.toString(),l=`/v1/runs/${encodeURIComponent(e)}/cancel${c?`?${c}`:``}`;try{return TT(await R({endpoint:l,options:{method:`PUT`},config:n,schema:i===`lazy`?wT:CT}),r)}catch(t){throw t instanceof a&&t.status===404?new o(e):t}}const jT=ec({attributes:Be(Za(),Za())});async function MT(e,t,n,r){try{return{attributes:(await R({endpoint:`/v2/runs/${encodeURIComponent(e)}/attributes`,options:{method:`POST`},data:n?.allowReservedAttributes?{changes:t,allowReservedAttributes:!0}:{changes:t},config:r,schema:jT})).attributes}}catch(t){throw t instanceof a&&t.status===404?new o(e):t}}const NT=Pe.omit({error:!0}).extend({error:gr([at,Tc()]).optional(),errorRef:Tc().optional()}),PT=NT.omit({input:!0,output:!0}).extend({inputRef:Tc().optional(),outputRef:Tc().optional(),input:ja(Uint8Array).optional(),output:ja(Uint8Array).optional()});function FT(e){let{error:t,errorRef:n,...r}=e,i={...r},a=t??n;return a!=null&&(i.error=a),i}function IT(e,t){if(t===`none`){let{inputRef:t,outputRef:n,...r}=e;return{...yT(FT(r)),input:void 0,output:void 0}}return yT(FT(e))}async function LT(e,t){let{runId:n,pagination:r,resolveData:i=`all`}=e,a=new URLSearchParams;r?.cursor&&a.set(`cursor`,r.cursor),r?.limit&&a.set(`limit`,r.limit.toString()),r?.sortOrder&&a.set(`sortOrder`,r.sortOrder);let o=i===`none`?`lazy`:`resolve`;a.set(`remoteRefBehavior`,o);let s=a.toString(),c=await R({endpoint:`/v2/runs/${encodeURIComponent(n)}/steps${s?`?${s}`:``}`,options:{method:`GET`},config:t,schema:bs(o===`lazy`?PT:NT)});return{...c,data:c.data.map(e=>IT(e,i))}}async function RT(e,t,n,r){let i=n?.resolveData??`all`,a=i===`none`?`lazy`:`resolve`,o=new URLSearchParams;o.set(`remoteRefBehavior`,a);let s=o.toString();return IT(await R({endpoint:`/v2/runs/${encodeURIComponent(e)}/steps/${encodeURIComponent(t)}${s?`?${s}`:``}`,options:{method:`GET`},config:r,schema:a===`lazy`?PT:NT}),i)}function zT(e){let t=e.startsWith(`wrun_`)?e.slice(5):e;try{return us(`wrun_${Gc(t).ulid}`,`wrun_`)}catch{return us(e,`wrun_`)}}const BT=new Set([`run_created`,`run_started`,`step_started`]),VT=new Set([`run_failed`,`step_failed`,`step_retrying`]);function HT(e){let t=e.eventData??{},n=rn(e.eventType),r={};if(typeof t.deploymentId==`string`&&(r.deploymentId=t.deploymentId),typeof t.workflowName==`string`&&(r.workflowName=t.workflowName),typeof t.stepName==`string`&&(r.stepName=t.stepName),typeof t.attempt==`number`&&(r.attempt=t.attempt),t.resumeAt instanceof Date)r.resumeAt=t.resumeAt;else if(typeof t.resumeAt==`string`){let e=new Date(t.resumeAt);Number.isNaN(e.getTime())||(r.resumeAt=e)}if(t.retryAfter instanceof Date)r.retryAfter=t.retryAfter;else if(typeof t.retryAfter==`string`){let e=new Date(t.retryAfter);Number.isNaN(e.getTime())||(r.retryAfter=e)}typeof t.token==`string`&&(r.hookToken=t.token),t.tokenRetentionUntil instanceof Date&&(r.hookTokenRetentionUntil=t.tokenRetentionUntil),typeof t.isWebhook==`boolean`&&(r.hookIsWebhook=t.isWebhook),typeof t.isSystem==`boolean`&&(r.hookIsSystem=t.isSystem),typeof t.errorCode==`string`&&(r.errorCode=t.errorCode),typeof t.cancelReason==`string`&&(r.cancelReason=t.cancelReason),typeof t.ownerMessageId==`string`&&(r.ownerMessageId=t.ownerMessageId),t.executionContext!==void 0&&t.executionContext!==null&&typeof t.executionContext==`object`&&(r.executionContext=t.executionContext),t.attributes!==void 0&&t.attributes!==null&&typeof t.attributes==`object`&&(r.attributes=t.attributes),Array.isArray(t.changes)&&(r.changes=t.changes),t.writer!==void 0&&t.writer!==null&&typeof t.writer==`object`&&(r.writer=t.writer),typeof t.allowReservedAttributes==`boolean`&&(r.allowReservedAttributes=t.allowReservedAttributes),typeof t.encryptionPublicKey==`string`&&(r.encryptionPublicKey=t.encryptionPublicKey),typeof t.ttfs==`number`&&(r.ttfs=t.ttfs),typeof t.stso==`number`&&(r.stso=t.stso),typeof t.stepCount==`number`&&Number.isSafeInteger(t.stepCount)&&t.stepCount>0&&(r.stepCount=t.stepCount),typeof t.eventCount==`number`&&Number.isSafeInteger(t.eventCount)&&t.eventCount>0&&(r.eventCount=t.eventCount),typeof t.rsfs==`number`&&(r.rsfs=t.rsfs),typeof t.finalSchedulingReplay==`number`&&(r.finalSchedulingReplay=t.finalSchedulingReplay),Array.isArray(t.optimizations)&&t.optimizations.every(e=>typeof e==`string`)&&(r.optimizations=t.optimizations);let i;if(n&&n in t){let r=t[n];if(r!==void 0){if(!(r instanceof Uint8Array))throw TypeError(`world-vercel v4: eventData.${n} for ${e.eventType} must be a Uint8Array (the runtime's dehydrated wire form); got ${typeof r==`object`?r===null?`null`:r.constructor?.name??typeof r:typeof r}.`);i=r}}return{payload:i,meta:r}}function UT(e){let t=Ga.safeParse(e);return t.success?t.data:(Jt.safeParse(e.eventType).success&&console.debug(`[workflow:world-vercel] v4 event ${e.eventId} failed EventSchema parse for known eventType '${e.eventType}'; passing through unparsed: ${t.error.message}`),e)}function WT(e){return UT(xT(e))}function GT(e){if(hT(e))return e;try{let t=Fi.safeParse(Wf(e.slice()));return t.success?t.data:e}catch{return e}}function KT(e,t,n){let r=e.eventData??{};if(t.byteLength>0){let n=rn(e.eventType),i=_T(t);n&&i instanceof Uint8Array&&(r[n]=VT.has(e.eventType)?GT(i):i)}let i=WT({eventId:e.eventId,runId:e.runId,eventType:e.eventType,createdAt:e.createdAt instanceof Date?e.createdAt:new Date(e.createdAt),...e.occurredAt===void 0?{}:{occurredAt:e.occurredAt instanceof Date?e.occurredAt:new Date(e.occurredAt)},...e.correlationId?{correlationId:e.correlationId}:{},eventData:r,...e.specVersion===void 0?{}:{specVersion:e.specVersion}});return n===`none`?yr(i,`none`):i}async function qT(e,t,n,r){let i=n?.resolveData??`all`,{event:a,body:o}=await rT(e,t,r);return KT(a,o,i)}async function JT(e,t){let{pagination:n,resolveData:r=`all`}=e,i={cursor:n?.cursor??void 0,limit:n?.limit,sortOrder:n?.sortOrder,remoteRefBehavior:r===`none`?`lazy`:`resolve`},a=await(`correlationId`in e?cT(e.correlationId,i,t):sT(e.runId,i,t));return{data:a.events.map(e=>KT(e.event,e.body,r)),cursor:a.next??null,hasMore:typeof a.hasMore==`boolean`?a.hasMore:!!a.next}}async function YT(e,t,n,r){try{return await Ww(()=>XT(e,t,n,r),t.eventType)}catch(e){throw mt(t.eventType)&&a.is(e)&&e.status===404&&t.correlationId?new d(t.correlationId):e}}async function XT(e,t,n,r){if(n?.v1Compat){if(t.eventType===`run_cancelled`&&e)return{run:await AT(e,n,r)};if(t.eventType===`run_created`)return{run:await DT(t.eventData,r)};if(e===null)throw new a(`world-vercel: v1Compat=true requires a runId for ${t.eventType}`,{status:400});return{event:await R({endpoint:`/v1/runs/${encodeURIComponent(e)}/events`,options:{method:`POST`},data:t,config:r,schema:Ga})}}if(e===null)throw new a(`world-vercel v4: createWorkflowRunEvent requires a client-generated runId for run_created (the runId is part of the payload storage ref key). Generate a wrun_ ULID before calling.`,{status:400});if(t.eventType===`run_created`){let t=zT(e);if(t)throw new a(t,{status:400})}let i=BT.has(t.eventType)?`resolve`:`lazy`,{payload:o,meta:s}=HT(t),c=await tT({runId:e,eventType:t.eventType,specVersion:t.specVersion??2,...t.correlationId?{correlationId:t.correlationId}:{},...n?.requestId?{vercelId:n.requestId}:{},...n?.stateUpdatedAt===void 0?{}:{stateUpdatedAt:n.stateUpdatedAt},occurredAt:n?.occurredAt??new Date,...n?.sinceCursor?{sinceCursor:n.sinceCursor}:{},...n?.skipPreload?{skipPreload:!0}:{},remoteRefBehavior:i,payload:o,...s},r),l=n?.resolveData??`all`,u=c.body;return{event:u.event?yr(UT(u.event),l):void 0,run:u.run?Jm(u.run):void 0,step:u.step?FT(u.step):void 0,hook:u.hook,wait:u.wait,events:u.events?u.events.map(UT):void 0,cursor:u.cursor??void 0,hasMore:u.hasMore,...u.stepCreated?{stepCreated:!0}:{},...typeof u.maxEvents==`number`?{maxEvents:u.maxEvents}:{}}}function ZT(e,t){if(t===`none`){let{metadataRef:t,...n}=e;return n}return bT(e)}const QT=zs.omit({metadata:!0}).extend({metadataRef:Hd.any().optional()});async function $T(e,t){let{runId:n,pagination:r,resolveData:i=`all`}=e,a=new URLSearchParams;r?.limit&&a.set(`limit`,r.limit.toString()),r?.cursor&&a.set(`cursor`,r.cursor),r?.sortOrder&&a.set(`sortOrder`,r.sortOrder);let o=i===`none`?`lazy`:`resolve`;a.set(`remoteRefBehavior`,o),n&&a.set(`runId`,n);let s=a.toString(),c=await R({endpoint:`/v2/hooks${s?`?${s}`:``}`,options:{method:`GET`},config:t,schema:bs(o===`lazy`?QT:zs)});return{...c,data:c.data.map(e=>ZT(e,i))}}async function eE(e,t,n){let r=t?.resolveData||`all`;return ZT(await R({endpoint:`/v2/hooks/${encodeURIComponent(e)}`,options:{method:`GET`},config:n,schema:zs}),r)}async function tE(e,t){try{return await R({endpoint:`/v2/hooks/by-token?token=${encodeURIComponent(e)}`,options:{method:`GET`},config:t,schema:zs})}catch(t){throw a.is(t)&&t.status===404?new d(e):t}}function nE(e){let t={runs:{get:((t,n)=>OT(t,n,e)),getMany:((t,n)=>kT(t,n,e)),list:(t=>ET(t,e)),experimentalSetAttributes:(t,n,r)=>MT(t,n,r,e)},steps:{get:((t,n,r)=>RT(t,n,r,e)),list:(t=>LT(t,e))},events:{create:(t,n,r)=>YT(t,n,r,e),get:(t,n,r)=>qT(t,n,r,e),list:t=>JT(t,e),listByCorrelationId:t=>JT(t,e)},hooks:{get:(t,n)=>eE(t,n,e),getByToken:t=>tE(t,e),list:t=>$T(t,e)}};return{runs:Th(`world.runs`,t.runs),steps:Th(`world.steps`,t.steps),events:Th(`world.events`,t.events),hooks:Th(`world.hooks`,t.hooks)}}const rE=()=>Rc(`WORKFLOW_MAX_CHUNKS_PER_REQUEST`,1e3,{integer:!0,min:1});function iE(e,t,n){return new URL(`${n.baseUrl}/v2/runs/${encodeURIComponent(t)}/stream/${encodeURIComponent(e)}`)}function aE(e,t,n){return new URL(`${n.baseUrl}/v3/runs/${encodeURIComponent(t)}/stream/${encodeURIComponent(e)}`)}function oE(e){return{...Cm(e.runId),...Tm(e.name),...Em(e.operation),...typeof e.startIndex==`number`?Dm(e.startIndex):{}}}function sE(e,t,n,r){let i=[`PUT ${t.origin}${t.pathname}`,...jm(n.headers)];return Error(`Stream ${e} failed: HTTP ${n.status} (${i.join(`; `)}): ${r}`)}function cE(e){let t=new TextEncoder,n=[],r=0;for(let i of e){let e=typeof i==`string`?t.encode(i):i;n.push(e),r+=4+e.length}let i=new Uint8Array(r),a=new DataView(i.buffer),o=0;for(let e of n)a.setUint32(o,e.length,!1),o+=4,i.set(e,o),o+=e.length;return i}const lE=ec({tailIndex:mi(),done:sc()}),uE=ec({data:Ai(ec({index:mi(),data:ja(Uint8Array)})),cursor:Za().nullable(),hasMore:sc(),done:sc()});function dE(e){return{streams:{async write(t,n,r){let i=await t,a=await $m(e),o=iE(n,i,a);await(await Vm({method:`PUT`,url:o.toString(),body:r,headers:a.headers,dispatcher:Kp(e),timeoutMs:null,logLabel:o.pathname,spanName:`workflow.stream.write`,durationAttribute:`workflow.stream.write.chunk_rtt`,attributes:oE({runId:i,name:n,operation:`write`}),buildError:async e=>sE(`write`,o,e,await e.text())})).text()},async writeMulti(t,n,r){if(r.length===0)return;let i=await t,a=await $m(e);a.headers.set(`X-Stream-Multi`,`true`);let o=rE();for(let t=0;t<r.length;t+=o){let s=cE(r.slice(t,t+o)),c=iE(n,i,a);await(await Vm({method:`PUT`,url:c.toString(),body:s,headers:a.headers,dispatcher:Kp(e),timeoutMs:null,logLabel:c.pathname,spanName:`workflow.stream.write`,durationAttribute:`workflow.stream.write.chunk_rtt`,attributes:oE({runId:i,name:n,operation:`write_multi`}),buildError:async e=>sE(`write`,c,e,await e.text())})).text()}},async close(t,n){let r=await t,i=await $m(e);i.headers.set(`X-Stream-Done`,`true`);let a=iE(n,r,i);await(await Vm({method:`PUT`,url:a.toString(),headers:i.headers,dispatcher:qp(e),timeoutMs:null,logLabel:a.pathname,spanName:`workflow.stream.write`,durationAttribute:`workflow.stream.write.chunk_rtt`,attributes:oE({runId:r,name:n,operation:`close`}),buildError:async e=>sE(`close`,a,e,await e.text())})).text()},async get(t,n,r){let i=await $m(e),a=aE(n,t,i);typeof r==`number`&&a.searchParams.set(`startIndex`,String(r));let o=await Vm({method:`GET`,url:a.toString(),headers:i.headers,dispatcher:void 0,timeoutMs:null,logLabel:a.pathname,spanName:`workflow.stream.read.connect`,attributes:oE({runId:t,name:n,operation:`read`,startIndex:r}),buildError:e=>Error(`Failed to fetch stream: ${e.status}`)});if(!o.body)throw Error(`No response body for stream`);return o.body},async getChunks(t,n,r){let i=new URLSearchParams;r?.limit!=null&&i.set(`limit`,String(r.limit)),r?.cursor&&i.set(`cursor`,r.cursor);let a=i.toString();return R({endpoint:`/v2/runs/${encodeURIComponent(t)}/streams/${encodeURIComponent(n)}/chunks${a?`?${a}`:``}`,config:e,schema:uE})},async getInfo(t,n){return R({endpoint:`/v2/runs/${encodeURIComponent(t)}/streams/${encodeURIComponent(n)}/info`,config:e,schema:lE})},async list(t){let n=await $m(e),r=new URL(`${n.baseUrl}/v2/runs/${encodeURIComponent(t)}/streams`);return await(await Vm({method:`GET`,url:r.toString(),headers:n.headers,dispatcher:void 0,timeoutMs:null,logLabel:r.pathname,buildError:e=>Error(`Failed to list streams: ${e.status}`)})).json()}}}}function fE(e){let t=e?.projectConfig?.projectId||process.env.VERCEL_PROJECT_ID;return{specVersion:5,capabilities:{preconditionGuard:!0,maxConcurrency:!0},processExitTriggersQueueRedelivery:!0,...Nw(e),...nE(e),analytics:process.env.WORKFLOW_DISABLE_ANALYTICS_READS===`1`?void 0:ah(e),...Th(`world.streams`,dE(e)),createRunId:dh,describeRun:ph,getEncryptionKeyForRun:gh(t,e?.projectConfig?.teamId,e?.token,e?.dispatcher),resolveLatestDeploymentId:Fw(e)}}export{ah as createAnalytics,gh as createGetEncryptionKeyForRun,Nw as createQueue,dh as createRunId,nE as createStorage,dE as createStreamer,fE as createWorld,mh as deriveRunKey,ph as describeRun,hh as fetchRunKey,fh as regionForRunId};
|