eve 0.84.0 → 0.84.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/src/channel/cross-channel-receive.d.ts +4 -1
  3. package/dist/src/channel/cross-channel-receive.js +1 -1
  4. package/dist/src/channel/delivery.js +1 -1
  5. package/dist/src/channel/session.js +1 -1
  6. package/dist/src/channel/types.d.ts +2 -0
  7. package/dist/src/chunks/{use-eve-agent-BbbguIdB.js → use-eve-agent-DMeP0JOF.js} +26 -10
  8. package/dist/src/chunks/{use-eve-agent-DWjyzplb.js → use-eve-agent-DP5Rso9C.js} +26 -10
  9. package/dist/src/cli/commands/init.js +1 -1
  10. package/dist/src/client/delivery.d.ts +2 -0
  11. package/dist/src/client/delivery.js +1 -1
  12. package/dist/src/client/optimistic-message-submissions.js +1 -1
  13. package/dist/src/client/session-store.js +1 -1
  14. package/dist/src/client/session.js +1 -1
  15. package/dist/src/client/sessions.d.ts +1 -0
  16. package/dist/src/client/sessions.js +1 -1
  17. package/dist/src/client/types.d.ts +2 -0
  18. package/dist/src/compiled/.vendor-stamp.json +2 -2
  19. package/dist/src/compiled/@chat-adapter/slack/index.js +13 -13
  20. package/dist/src/compiled/@vercel/sandbox/api-client/api-client.d.ts +75 -0
  21. package/dist/src/compiled/@vercel/sandbox/api-client/validators.d.ts +4 -0
  22. package/dist/src/compiled/@vercel/sandbox/command.d.ts +78 -0
  23. package/dist/src/compiled/@vercel/sandbox/drive.d.ts +41 -1
  24. package/dist/src/compiled/@vercel/sandbox/index.js +13 -13
  25. package/dist/src/compiled/@vercel/sandbox/network-policy.d.ts +35 -4
  26. package/dist/src/compiled/@vercel/sandbox/sandbox.d.ts +18 -4
  27. package/dist/src/compiled/@vercel/sandbox/session.d.ts +29 -3
  28. package/dist/src/compiled/@vercel/sandbox/utils/pipe-stdin.d.ts +19 -0
  29. package/dist/src/compiled/_chunks/client/{core-CspsxXR-.js → core-BsvaaMUJ.js} +1 -1
  30. package/dist/src/compiled/_chunks/node/{auth-Dztlx9pE.js → auth-v5pS3mLo.js} +1 -1
  31. package/dist/src/compiled/_chunks/node/is-stream-DsuQX_bd.js +1 -0
  32. package/dist/src/compiled/_chunks/node/token-DHGH-jVc.js +1 -0
  33. package/dist/src/compiled/_chunks/node/token-util-BH2pw9Qm.js +25 -0
  34. package/dist/src/compiled/_chunks/node/token-util-CcvxNv76.js +1 -0
  35. package/dist/src/compiled/_chunks/node/version-C2PfNyEv.js +1 -0
  36. package/dist/src/compiled/zod/index.js +1 -1
  37. package/dist/src/compiled/zod/v4/core.js +1 -1
  38. package/dist/src/compiled/zod-validation-error/index.js +1 -1
  39. package/dist/src/compiler/artifacts.d.ts +1 -0
  40. package/dist/src/compiler/artifacts.js +1 -1
  41. package/dist/src/compiler/manifest.d.ts +2 -2
  42. package/dist/src/compiler/manifest.js +1 -1
  43. package/dist/src/compiler/model-catalog.d.ts +8 -18
  44. package/dist/src/compiler/model-catalog.js +1 -1
  45. package/dist/src/compiler/normalize-agent-config.js +1 -1
  46. package/dist/src/compiler/normalize-manifest-types.d.ts +3 -0
  47. package/dist/src/compiler/normalize-manifest.js +1 -1
  48. package/dist/src/context/keys.d.ts +0 -8
  49. package/dist/src/context/keys.js +1 -1
  50. package/dist/src/eve-channel/index.js +1 -1
  51. package/dist/src/eve-channel/request.d.ts +1 -0
  52. package/dist/src/eve-channel/request.js +1 -1
  53. package/dist/src/eve-channel/support.js +1 -1
  54. package/dist/src/execution/agent-sessions/steps.js +1 -1
  55. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  56. package/dist/src/execution/sandbox/bindings/docker-cli.d.ts +2 -0
  57. package/dist/src/execution/sandbox/bindings/docker-cli.js +1 -1
  58. package/dist/src/execution/sandbox/bindings/docker-connection.js +1 -1
  59. package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
  60. package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
  61. package/dist/src/execution/sandbox/multiplexed-command.d.ts +11 -1
  62. package/dist/src/execution/sandbox/multiplexed-command.js +1 -1
  63. package/dist/src/execution/sandbox/session.js +1 -1
  64. package/dist/src/execution/session-inbox/address.d.ts +1 -0
  65. package/dist/src/execution/session-inbox/handle.d.ts +7 -0
  66. package/dist/src/execution/session-inbox/handle.js +1 -0
  67. package/dist/src/execution/session-inbox/owner.d.ts +4 -4
  68. package/dist/src/execution/session-inbox/owner.js +1 -1
  69. package/dist/src/execution/session-inbox/resume.d.ts +1 -0
  70. package/dist/src/execution/session-inbox/resume.js +1 -1
  71. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  72. package/dist/src/execution/workflow-runtime.js +1 -1
  73. package/dist/src/harness/model-call/call.d.ts +3 -1
  74. package/dist/src/harness/model-call/call.js +1 -1
  75. package/dist/src/harness/model-call/run.js +1 -1
  76. package/dist/src/harness/semantic-errors/rules/gateway.js +1 -1
  77. package/dist/src/internal/application/compiled-artifacts.d.ts +2 -0
  78. package/dist/src/internal/application/compiled-artifacts.js +2 -2
  79. package/dist/src/internal/application/optional-package-install.js +1 -1
  80. package/dist/src/internal/application/stamped-package-version.js +1 -1
  81. package/dist/src/internal/model-catalog.d.ts +39 -16
  82. package/dist/src/internal/model-catalog.js +1 -1
  83. package/dist/src/internal/nitro/host/dev-build-host.js +1 -1
  84. package/dist/src/internal/nitro/routes/channel-dispatch.js +1 -1
  85. package/dist/src/protocol/delivery.d.ts +1 -0
  86. package/dist/src/public/nuxt/module.js +1 -1
  87. package/dist/src/reactions/kinds/model.js +1 -1
  88. package/dist/src/reactions/kinds/subagent.js +1 -1
  89. package/dist/src/runtime/agent/resolve-model.d.ts +3 -4
  90. package/dist/src/runtime/agent/resolve-model.js +1 -1
  91. package/dist/src/runtime/loaders/artifact-paths.d.ts +1 -0
  92. package/dist/src/runtime/loaders/artifact-paths.js +1 -1
  93. package/dist/src/runtime/loaders/bundled-artifacts.d.ts +2 -0
  94. package/dist/src/runtime/loaders/bundled-artifacts.js +1 -1
  95. package/dist/src/runtime/loaders/model-metadata.d.ts +4 -0
  96. package/dist/src/runtime/loaders/model-metadata.js +1 -0
  97. package/dist/src/runtime/resolve-agent.js +1 -1
  98. package/dist/src/runtime/sessions/compiled-agent-cache.d.ts +3 -0
  99. package/dist/src/runtime/sessions/compiled-agent-cache.js +1 -1
  100. package/dist/src/runtime/subagents/dynamic-agent-config.d.ts +2 -2
  101. package/dist/src/runtime/subagents/dynamic-agent-config.js +1 -1
  102. package/dist/src/runtime/subagents/workflow.js +1 -1
  103. package/dist/src/sandbox/provider.d.ts +2 -0
  104. package/dist/src/setup/flows/model-source-change.js +1 -1
  105. package/dist/src/setup/scaffold/create/project.js +1 -1
  106. package/dist/src/shared/agent-definition.d.ts +0 -1
  107. package/dist/src/shared/sandbox-session.d.ts +4 -0
  108. package/dist/src/svelte/index.js +1 -1
  109. package/dist/src/svelte/use-eve-agent.js +1 -1
  110. package/dist/src/tools/provided/ask-question-workflow.js +1 -1
  111. package/dist/src/tools/provided/sleep-workflow.js +1 -1
  112. package/dist/src/vue/index.js +1 -1
  113. package/dist/src/vue/use-eve-agent.js +1 -1
  114. package/docs/agent-config.md +5 -4
  115. package/docs/concepts/default-harness.md +6 -0
  116. package/docs/evals/judge.mdx +13 -0
  117. package/docs/guides/client/overview.mdx +23 -1
  118. package/docs/reference/cli.md +1 -1
  119. package/docs/sandbox/custom-providers.mdx +1 -1
  120. package/docs/sandbox/index.mdx +1 -1
  121. package/docs/tools/workflows.mdx +4 -0
  122. package/package.json +2 -2
  123. package/dist/src/compiled/_chunks/node/token-Bedbhv5z.js +0 -1
  124. package/dist/src/compiled/_chunks/node/token-util-DpJNusVS.js +0 -1
  125. package/dist/src/compiled/_chunks/node/token-util-DwHQ2a3c.js +0 -1
  126. package/dist/src/compiled/_chunks/node/version-C__MqbLM.js +0 -1
  127. package/dist/src/runtime/agent/model-catalog.d.ts +0 -10
  128. package/dist/src/runtime/agent/model-catalog.js +0 -1
@@ -49,36 +49,67 @@ type NetworkPolicyMatch = {
49
49
  /** Match on request headers. */
50
50
  headers?: NetworkPolicyKeyValueMatcher[];
51
51
  };
52
+ /**
53
+ * A response the sandbox network proxy returns itself, without contacting the
54
+ * destination. Use it to deny the requests an allowed domain's earlier rules
55
+ * did not claim, since allowing a domain otherwise allows every request to it.
56
+ */
57
+ type NetworkPolicyResponse = {
58
+ /** Status code to answer with, between 200 and 599. */
59
+ statusCode: number;
60
+ /** Response headers. Proxy-managed headers are rejected. */
61
+ headers?: Record<string, string>;
62
+ /** Response body. Requires `contentType`, and is not allowed on 204, 205, or 304. */
63
+ body?: string;
64
+ /** Content type for `body`. Required whenever `body` is set. */
65
+ contentType?: string;
66
+ };
52
67
  /**
53
68
  * A rule applied to requests matching a domain in the network policy.
54
69
  */
55
70
  type NetworkPolicyRule = {
56
71
  /**
57
- * Optional request matcher. When provided, transforms and forwarding rules
58
- * only apply to requests that match every specified dimension.
72
+ * Optional request matcher. When provided, the rule only applies to requests
73
+ * that match every specified dimension. A rule without `match` applies to
74
+ * every request to the domain.
59
75
  */
60
76
  match?: NetworkPolicyMatch;
61
77
  } & ({
62
78
  /**
63
79
  * Transforms to apply to matching requests.
64
80
  *
65
- * `transform` cannot be used together with `forwardURL`.
81
+ * `transform` cannot be used together with `forwardURL` or `response`.
66
82
  */
67
83
  transform: NetworkTransformer[];
68
84
  forwardURL?: never;
85
+ response?: never;
69
86
  } | {
70
87
  transform?: never;
88
+ response?: never;
71
89
  /**
72
90
  * HTTPS proxy URL to forward matching requests to. Must not include query string or fragment.
73
91
  *
74
92
  * You can use the `defineSandboxProxy` helper from `@vercel/sandbox/proxy` to implement the proxy handler
75
93
  * automatically, which handles authorization and extracts metadata about the request and sandbox.
76
94
  *
77
- * `forwardURL` cannot be used together with `transform`.
95
+ * `forwardURL` cannot be used together with `transform` or `response`.
78
96
  *
79
97
  * @see https://vercel.com/docs/vercel-sandbox/concepts/firewall#requests-proxying
80
98
  */
81
99
  forwardURL: string;
100
+ } | {
101
+ transform?: never;
102
+ forwardURL?: never;
103
+ /**
104
+ * Answer matching requests from the proxy instead of contacting the destination.
105
+ *
106
+ * Rules run in declaration order, so a trailing `response` rule with no `match`
107
+ * answers whatever the earlier rules did not claim. This is how you restrict an
108
+ * allowed domain to specific paths without running a proxy of your own.
109
+ *
110
+ * `response` cannot be used together with `transform` or `forwardURL`.
111
+ */
112
+ response: NetworkPolicyResponse;
82
113
  });
83
114
  /**
84
115
  * Network policy to define network restrictions for the sandbox.
@@ -71,6 +71,10 @@ interface BaseCreateSandboxParams {
71
71
  * Defaults to full internet access if not specified.
72
72
  */
73
73
  networkPolicy?: NetworkPolicy;
74
+ /**
75
+ * Connect network ID for the target Secure Compute private network.
76
+ */
77
+ networkId?: string;
74
78
  /**
75
79
  * Default environment variables for the sandbox.
76
80
  * These are inherited by all commands unless overridden with
@@ -211,6 +215,8 @@ type CreateSandboxParams = (BaseCreateSandboxParams & RuntimeOrImage) | (Omit<Ba
211
215
  * image, persistence, snapshot settings, and environment variables. Any field
212
216
  * set here acts as an override of the copied value. When the source has no
213
217
  * snapshot, its base environment is copied.
218
+ *
219
+ * Drive mounts are not inherited: set `mounts` to attach drives to the fork.
214
220
  * @inline
215
221
  */
216
222
  type ForkSandboxParams = Omit<BaseCreateSandboxParams, "source"> & {
@@ -344,6 +350,10 @@ declare class Sandbox implements ExecutionContext {
344
350
  * it does not fail over.
345
351
  */
346
352
  get failoverRegions(): string[];
353
+ /**
354
+ * Connect network ID for the target Secure Compute private network.
355
+ */
356
+ get networkId(): string | undefined;
347
357
  /**
348
358
  * Number of virtual CPUs allocated.
349
359
  */
@@ -487,6 +497,7 @@ declare class Sandbox implements ExecutionContext {
487
497
  status: "pending" | "running" | "stopping" | "stopped" | "failed" | "aborted" | "snapshotting";
488
498
  region?: string | undefined;
489
499
  failoverRegions?: string[] | undefined;
500
+ networkId?: string | undefined;
490
501
  vcpus?: number | undefined;
491
502
  memory?: number | undefined;
492
503
  runtime?: string | undefined;
@@ -740,10 +751,6 @@ declare class Sandbox implements ExecutionContext {
740
751
  */
741
752
  private resume;
742
753
  private doResume;
743
- /**
744
- * Poll until the current session reaches a terminal state, then resume.
745
- */
746
- private waitForStopAndResume;
747
754
  /**
748
755
  * Execute `fn`, and if the session is stopped/stopping/snapshotting, resume and retry.
749
756
  */
@@ -1087,6 +1094,11 @@ declare class Sandbox implements ExecutionContext {
1087
1094
  * When `timeout` is increased and a session is currently running, the running
1088
1095
  * session's deadline is also extended.
1089
1096
  *
1097
+ * When `networkPolicy` is provided and a session is active, the policy is
1098
+ * applied to that session before saving the configuration and tags. If applying
1099
+ * the policy fails, the update rejects without saving tags. These operations
1100
+ * are not atomic.
1101
+ *
1090
1102
  * `region` and `failoverRegions` apply to the next session; the currently
1091
1103
  * running session keeps the region it started in. Pass an empty
1092
1104
  * `failoverRegions` array to remove all failover regions.
@@ -1104,6 +1116,8 @@ declare class Sandbox implements ExecutionContext {
1104
1116
  };
1105
1117
  timeout?: number;
1106
1118
  networkPolicy?: NetworkPolicy;
1119
+ /** Set to `null` to remove the sandbox from Secure Compute. */
1120
+ networkId?: string | null;
1107
1121
  tags?: Record<string, string>;
1108
1122
  ports?: number[];
1109
1123
  snapshotExpiration?: number;
@@ -7,7 +7,7 @@ import { Snapshot } from "./snapshot.js";
7
7
  import { SandboxSnapshot } from "./utils/sandbox-snapshot.js";
8
8
  import { ExecutionContext } from "./execution-context.js";
9
9
  import { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE } from "./_workflow-serde.js";
10
- import { Writable } from "stream";
10
+ import { Readable, Writable } from "stream";
11
11
 
12
12
  //#region src/session.d.ts
13
13
  /**
@@ -17,8 +17,7 @@ interface SerializedSession {
17
17
  session: SandboxSnapshot;
18
18
  routes: SandboxRouteData[];
19
19
  }
20
- /** @inline */
21
- interface RunCommandParams {
20
+ interface RunCommandParamsBase {
22
21
  /**
23
22
  * The command to execute
24
23
  */
@@ -43,6 +42,21 @@ interface RunCommandParams {
43
42
  * If true, the command will return without waiting for `exitCode`
44
43
  */
45
44
  detached?: boolean;
45
+ /**
46
+ * If true, keep the command's stdin open so it can be written to with
47
+ * {@link Command.writeStdin} and closed with {@link Command.closeStdin}.
48
+ * Requires `detached: true`.
49
+ *
50
+ * A `Readable` stream is written to the command's stdin, and stdin is
51
+ * closed when the stream ends. The stream is never ended or destroyed. If a
52
+ * write fails, reading stops and the command result rejects
53
+ * ({@link Command.wait} when detached). Without `detached`, the command is
54
+ * also killed, since there is no handle to stop it. If the command exits
55
+ * first, reading stops.
56
+ *
57
+ * When unset or false, the command reads from an empty stdin.
58
+ */
59
+ stdin?: boolean | Readable;
46
60
  /**
47
61
  * A `Writable` stream where `stdout` from the command will be piped
48
62
  */
@@ -62,6 +76,18 @@ interface RunCommandParams {
62
76
  */
63
77
  timeoutMs?: number;
64
78
  }
79
+ /** @inline */
80
+ type RunCommandParams = RunCommandParamsBase & ({
81
+ onStart?: never;
82
+ } | {
83
+ detached?: false;
84
+ /**
85
+ * The onStart hook is called as soon as the command is started, before it exits.
86
+ * This hook is awaited before `runCommand` resolves and is useful to be notified
87
+ * as soon as a command is started.
88
+ */
89
+ onStart?: (command: Command) => void | Promise<void>;
90
+ });
65
91
  /**
66
92
  * A Session represents a running VM instance within a {@link Sandbox}.
67
93
  *
@@ -0,0 +1,19 @@
1
+ import { Readable } from "stream";
2
+
3
+ //#region src/utils/pipe-stdin.d.ts
4
+
5
+ interface StdinPipe {
6
+ /**
7
+ * Resolves once the stream has ended and stdin is closed, or once the
8
+ * command stops accepting input. Rejects if a write fails or the stream
9
+ * errors.
10
+ */
11
+ done: Promise<void>;
12
+ /**
13
+ * Stops reading the stream, for when the command has exited.
14
+ */
15
+ stop(): void;
16
+ }
17
+ //#endregion
18
+ export { StdinPipe };
19
+ //# sourceMappingURL=pipe-stdin.d.ts.map
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";var t=e({BIGINT_FORMAT_RANGES:()=>ve,CONSTANT_CATCH:()=>Ze,Class:()=>Ve,NUMBER_FORMAT_RANGES:()=>_e,aborted:()=>w,allowsEval:()=>le,assert:()=>s,assertEqual:()=>n,assertIs:()=>a,assertNever:()=>o,assertNotEqual:()=>r,assignProp:()=>g,attachSchema:()=>Oe,base64ToUint8Array:()=>Fe,base64urlToUint8Array:()=>Le,cached:()=>d,captureStackTrace:()=>se,cleanEnum:()=>Pe,cleanRegex:()=>p,clone:()=>x,cloneDef:()=>ne,codePointLength:()=>je,constantCatch:()=>Qe,createTransparentProxy:()=>he,defineLazy:()=>h,defineLazyInternal:()=>O,esc:()=>v,escapeRegex:()=>b,explicitlyAborted:()=>Ee,extend:()=>xe,finalizeIssue:()=>E,floatSafeRemainder:()=>m,getElementAtPath:()=>re,getEnumValues:()=>c,getLengthableOrigin:()=>Me,getParsedType:()=>fe,getSizableOrigin:()=>ke,hexToUint8Array:()=>ze,hide:()=>We,installLazyProp:()=>Xe,isObject:()=>ce,isPlainObject:()=>y,issue:()=>Ne,joinValues:()=>l,jsonStringifyReplacer:()=>u,members:()=>He,merge:()=>Ce,mergeDefs:()=>_,normalizeParams:()=>S,nullish:()=>f,numKeys:()=>de,objectClone:()=>te,omit:()=>be,optionalKeys:()=>ge,own:()=>Ue,parsedType:()=>D,partial:()=>we,pick:()=>ye,prefixIssues:()=>T,primitiveTypes:()=>me,promiseAllObject:()=>ie,propertyKeyTypes:()=>pe,randomString:()=>ae,required:()=>Te,safeExtend:()=>Se,shallowClone:()=>ue,slugify:()=>oe,stringifyPrimitive:()=>C,toZod:()=>i,uint8ArrayToBase64:()=>Ie,uint8ArrayToBase64url:()=>Re,uint8ArrayToHex:()=>Be,unwrapMessage:()=>De});function n(e){return e}function r(e){return e}function i(){return e=>e}function a(e){}function o(e){throw Error(`Unexpected value in exhaustive check`)}function s(e){}function c(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function l(e,t=`|`){return e.map(e=>C(e)).join(t)}function u(e,t){return typeof t==`bigint`?t.toString():t}function d(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function f(e){return e==null}function p(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function m(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const ee=Symbol(`evaluating`);function h(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ee)return r===void 0&&(r=ee,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function te(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function g(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function _(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ne(e){return _(e._zod.def)}function re(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function ie(e){let t=Object.keys(e),n=t.map(t=>e[t]);return Promise.all(n).then(e=>{let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n})}function ae(e=10){let t=``;for(let n=0;n<e;n++)t+=`abcdefghijklmnopqrstuvwxyz`[Math.floor(Math.random()*26)];return t}function v(e){return JSON.stringify(e)}function oe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const se=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ce(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const le=d(()=>{if(j.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function y(e){if(ce(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ce(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ue(e){return y(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function de(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const fe=e=>{let t=typeof e;switch(t){case`undefined`:return`undefined`;case`string`:return`string`;case`number`:return Number.isNaN(e)?`nan`:`number`;case`boolean`:return`boolean`;case`function`:return`function`;case`bigint`:return`bigint`;case`symbol`:return`symbol`;case`object`:return Array.isArray(e)?`array`:e===null?`null`:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?`promise`:typeof Map<`u`&&e instanceof Map?`map`:typeof Set<`u`&&e instanceof Set?`set`:typeof Date<`u`&&e instanceof Date?`date`:typeof File<`u`&&e instanceof File?`file`:`object`;default:throw Error(`Unknown data type: ${t}`)}},pe=new Set([`string`,`number`,`symbol`]),me=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function b(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function x(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function S(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function he(e){let t;return new Proxy({},{get(n,r,i){return t??=e(),Reflect.get(t,r,i)},set(n,r,i,a){return t??=e(),Reflect.set(t,r,i,a)},has(n,r){return t??=e(),Reflect.has(t,r)},deleteProperty(n,r){return t??=e(),Reflect.deleteProperty(t,r)},ownKeys(n){return t??=e(),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??=e(),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??=e(),Reflect.defineProperty(t,r,i)}})}function C(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const _e={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ve={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function ye(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return x(e,_(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&g(e,r,n.shape[r])}return g(this,`shape`,e),e},checks:[]}))}function be(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return x(e,_(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return g(this,`shape`,r),r},checks:[]}))}function xe(e,t){if(!y(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return x(e,_(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return g(this,`shape`,n),n}}))}function Se(e,t){if(!y(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return x(e,_(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return g(this,`shape`,n),n}}))}function Ce(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return x(e,_(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return g(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function we(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return x(t,_(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return g(this,`shape`,i),i},checks:[]}))}function Te(e,t,n){return x(t,_(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return g(this,`shape`,i),i}}))}function w(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ee(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function T(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function De(e){return typeof e==`string`?e:e?.message}function Oe(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function E(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:De(e.inst?._zod.def?.error?.(e))??De(a?.(e))??De(t?.error?.(e))??De(n.customError?.(e))??De(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}function ke(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}const Ae=/[\uD800-\uDBFF]/;function je(e){let t=e.length;if(!Ae.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Me(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function D(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ne(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Pe(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Fe(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function Ie(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Le(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return Fe(t+`=`.repeat((4-t.length%4)%4))}function Re(e){return Ie(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function ze(e){let t=e.replace(/^0x/,``);if(t.length%2!=0)throw Error(`Invalid hex string length`);let n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=Number.parseInt(t.slice(e,e+2),16);return n}function Be(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var Ve=class{constructor(...e){}};function He(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ge(e,n,r.value)}}function Ue(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function We(e,t,n){return Ue(e,t,n,!1)}function Ge(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ue(this,t,n.bind(this))},set(e){Ue(this,t,e)}})}function Ke(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let qe,Je=!1;const Ye={configurable:!0,get(){Je=!0}};function O(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&qe!==e._zod){qe=void 0;return}qe=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ye);let e=Je;Je=!1;try{let r=n(this);return Je?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Je||=e,r}catch(n){throw delete this[t],Je||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Xe(e,t,n,r){let i=Ke(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}const Ze=`~constantCatch`;function Qe(e){let t=()=>e;return t[Ze]=!0,t}var $e;const et=Object.freeze({status:`aborted`}),tt={value:void 0,enumerable:!1};let nt=`captureStackTrace`in Error?Error:null;function rt(e){let t=nt;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return nt=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function k(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){tt.value=new a(r);try{Object.defineProperty(n,"_zod",tt)}finally{tt.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),He(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?rt(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}const it=Symbol(`zod_brand`);var A=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},at=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};($e=globalThis).__zod_globalConfig??($e.__zod_globalConfig={});const j=globalThis.__zod_globalConfig;function M(e){return e&&Object.assign(j,e),j}function ot(){let e=this._zod;return e.message??=JSON.stringify(e.def,u,2),e.message}function st(e){this._zod.message=e}const ct={get:ot,set:st,enumerable:!0,configurable:!0},lt={value:void 0,enumerable:!1},ut={value:void 0,enumerable:!1},dt=new WeakSet([Object.prototype,Error.prototype]),ft=(e,t)=>{e.name=`$ZodError`,lt.value=e._zod,Object.defineProperty(e,"_zod",lt),ut.value=t,Object.defineProperty(e,"issues",ut),lt.value=void 0,ut.value=void 0,Object.defineProperty(e,"message",ct);let n=Object.getPrototypeOf(e);dt.has(n)||(dt.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},pt=k(`$ZodError`,ft),N=k(`$ZodError`,ft,void 0,{Parent:Error});function mt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ht(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?mt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function gt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function _t(e,t=e=>e.message){let n={errors:[]},r=(e,i=[])=>{var a;for(let o of e.issues)if(o.code===`invalid_union`&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if(o.code===`invalid_key`)r({issues:o.issues},[...i,...o.path]);else if(o.code===`invalid_element`)r({issues:o.issues},[...i,...o.path]);else{let e=[...i,...o.path];if(e.length===0){n.errors.push(t(o));continue}let r=n,s=0;for(;s<e.length;){let n=e[s],i=s===e.length-1;typeof n==`string`?(r.properties??(r.properties={}),Object.prototype.hasOwnProperty.call(r.properties,n)||Object.defineProperty(r.properties,n,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),r=r.properties[n]):(r.items??(r.items=[]),(a=r.items)[n]??(a[n]={errors:[]}),r=r.items[n]),i&&r.errors.push(t(o)),s++}}};return r(e),n}function vt(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function yt(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${vt(e.path)}`);return t.join(`
1
+ import{t as e}from"./rolldown-runtime-DK3Fl9T5.js";var t=e({BIGINT_FORMAT_RANGES:()=>ve,CONSTANT_CATCH:()=>Ze,Class:()=>Ve,NUMBER_FORMAT_RANGES:()=>_e,aborted:()=>w,allowsEval:()=>le,assert:()=>s,assertEqual:()=>n,assertIs:()=>a,assertNever:()=>o,assertNotEqual:()=>r,assignProp:()=>g,attachSchema:()=>Oe,base64ToUint8Array:()=>Fe,base64urlToUint8Array:()=>Le,cached:()=>d,captureStackTrace:()=>se,cleanEnum:()=>Pe,cleanRegex:()=>p,clone:()=>x,cloneDef:()=>ne,codePointLength:()=>je,constantCatch:()=>Qe,createTransparentProxy:()=>he,defineLazy:()=>h,defineLazyInternal:()=>O,esc:()=>v,escapeRegex:()=>b,explicitlyAborted:()=>Ee,extend:()=>xe,finalizeIssue:()=>E,floatSafeRemainder:()=>m,getElementAtPath:()=>re,getEnumValues:()=>c,getLengthableOrigin:()=>Me,getParsedType:()=>fe,getSizableOrigin:()=>ke,hexToUint8Array:()=>ze,hide:()=>We,installLazyProp:()=>Xe,isObject:()=>ce,isPlainObject:()=>y,issue:()=>Ne,joinValues:()=>l,jsonStringifyReplacer:()=>u,members:()=>He,merge:()=>Ce,mergeDefs:()=>_,normalizeParams:()=>S,nullish:()=>f,numKeys:()=>de,objectClone:()=>te,omit:()=>be,optionalKeys:()=>ge,own:()=>Ue,parsedType:()=>D,partial:()=>we,pick:()=>ye,prefixIssues:()=>T,primitiveTypes:()=>me,promiseAllObject:()=>ie,propertyKeyTypes:()=>pe,randomString:()=>ae,required:()=>Te,safeExtend:()=>Se,shallowClone:()=>ue,slugify:()=>oe,stringifyPrimitive:()=>C,toZod:()=>i,uint8ArrayToBase64:()=>Ie,uint8ArrayToBase64url:()=>Re,uint8ArrayToHex:()=>Be,unwrapMessage:()=>De});function n(e){return e}function r(e){return e}function i(){return e=>e}function a(e){}function o(e){throw Error(`Unexpected value in exhaustive check`)}function s(e){}function c(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function l(e,t=`|`){return e.map(e=>C(e)).join(t)}function u(e,t){return typeof t==`bigint`?t.toString():t}function d(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function f(e){return e==null}function p(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function m(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}const ee=Symbol(`evaluating`);function h(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==ee)return r===void 0&&(r=ee,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function te(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function g(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function _(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ne(e){return _(e._zod.def)}function re(e,t){return t?t.reduce((e,t)=>e?.[t],e):e}function ie(e){let t=Object.keys(e),n=t.map(t=>e[t]);return Promise.all(n).then(e=>{let n={};for(let r=0;r<t.length;r++)n[t[r]]=e[r];return n})}function ae(e=10){let t=``;for(let n=0;n<e;n++)t+=`abcdefghijklmnopqrstuvwxyz`[Math.floor(Math.random()*26)];return t}function v(e){return JSON.stringify(e)}function oe(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}const se=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ce(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const le=d(()=>(j.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`),!1));function y(e){if(ce(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ce(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ue(e){return y(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function de(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}const fe=e=>{let t=typeof e;switch(t){case`undefined`:return`undefined`;case`string`:return`string`;case`number`:return Number.isNaN(e)?`nan`:`number`;case`boolean`:return`boolean`;case`function`:return`function`;case`bigint`:return`bigint`;case`symbol`:return`symbol`;case`object`:return Array.isArray(e)?`array`:e===null?`null`:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?`promise`:typeof Map<`u`&&e instanceof Map?`map`:typeof Set<`u`&&e instanceof Set?`set`:typeof Date<`u`&&e instanceof Date?`date`:typeof File<`u`&&e instanceof File?`file`:`object`;default:throw Error(`Unknown data type: ${t}`)}},pe=new Set([`string`,`number`,`symbol`]),me=new Set([`string`,`number`,`bigint`,`boolean`,`symbol`,`undefined`]);function b(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function x(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function S(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function he(e){let t;return new Proxy({},{get(n,r,i){return t??=e(),Reflect.get(t,r,i)},set(n,r,i,a){return t??=e(),Reflect.set(t,r,i,a)},has(n,r){return t??=e(),Reflect.has(t,r)},deleteProperty(n,r){return t??=e(),Reflect.deleteProperty(t,r)},ownKeys(n){return t??=e(),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??=e(),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,i){return t??=e(),Reflect.defineProperty(t,r,i)}})}function C(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}const _e={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ve={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function ye(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return x(e,_(e._zod.def,{get shape(){let e={};for(let r of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,r))throw Error(`Unrecognized key: "${String(r)}"`);t[r]&&g(e,r,n.shape[r])}return g(this,`shape`,e),e},checks:[]}))}function be(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return x(e,_(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e of Reflect.ownKeys(t)){if(!Object.prototype.hasOwnProperty.call(n.shape,e))throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&delete r[e]}return g(this,`shape`,r),r},checks:[]}))}function xe(e,t){if(!y(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return x(e,_(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return g(this,`shape`,n),n}}))}function Se(e,t){if(!y(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return x(e,_(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return g(this,`shape`,n),n}}))}function Ce(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return x(e,_(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return g(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function we(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);return x(t,_(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(r,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t of Reflect.ownKeys(r))i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return g(this,`shape`,i),i},checks:[]}))}function Te(e,t,n){return x(t,_(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t of Reflect.ownKeys(n)){if(!Object.prototype.hasOwnProperty.call(i,t))throw Error(`Unrecognized key: "${String(t)}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t of Reflect.ownKeys(r))i[t]=new e({type:`nonoptional`,innerType:r[t]});return g(this,`shape`,i),i}}))}function w(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function Ee(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function T(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function De(e){return typeof e==`string`?e:e?.message}function Oe(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function E(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:De(e.inst?._zod.def?.error?.(e))??De(a?.(e))??De(t?.error?.(e))??De(n.customError?.(e))??De(n.localeError?.(e))??`Invalid input`,{inst:s,schema:c,continue:l,input:u,...d}=e;return d.path??=[],d.message=o,t?.reportInput&&(d.input=u),d}function ke(e){return e instanceof Set?`set`:e instanceof Map?`map`:e instanceof File?`file`:`unknown`}const Ae=/[\uD800-\uDBFF]/;function je(e){let t=e.length;if(!Ae.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Me(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function D(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Ne(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function Pe(e){return Object.entries(e).filter(([e,t])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function Fe(e){let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function Ie(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Le(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return Fe(t+`=`.repeat((4-t.length%4)%4))}function Re(e){return Ie(e).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function ze(e){let t=e.replace(/^0x/,``);if(t.length%2!=0)throw Error(`Invalid hex string length`);let n=new Uint8Array(t.length/2);for(let e=0;e<t.length;e+=2)n[e/2]=Number.parseInt(t.slice(e,e+2),16);return n}function Be(e){return Array.from(e).map(e=>e.toString(16).padStart(2,`0`)).join(``)}var Ve=class{constructor(...e){}};function He(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Ge(e,n,r.value)}}function Ue(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function We(e,t,n){return Ue(e,t,n,!1)}function Ge(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ue(this,t,n.bind(this))},set(e){Ue(this,t,e)}})}function Ke(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let qe,Je=!1;const Ye={configurable:!0,get(){Je=!0}};function O(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&qe!==e._zod){qe=void 0;return}qe=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,Ye);let e=Je;Je=!1;try{let r=n(this);return Je?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),Je||=e,r}catch(n){throw delete this[t],Je||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function Xe(e,t,n,r){let i=Ke(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}const Ze=`~constantCatch`;function Qe(e){let t=()=>e;return t[Ze]=!0,t}var $e;const et=Object.freeze({status:`aborted`}),tt={value:void 0,enumerable:!1};let nt=`captureStackTrace`in Error?Error:null;function rt(e){let t=nt;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return nt=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function k(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){tt.value=new a(r);try{Object.defineProperty(n,"_zod",tt)}finally{tt.value=void 0}}if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),He(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?rt(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}const it=Symbol(`zod_brand`);var A=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},at=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};($e=globalThis).__zod_globalConfig??($e.__zod_globalConfig={});const j=globalThis.__zod_globalConfig;function M(e){return e&&Object.assign(j,e),j}function ot(){let e=this._zod;return e.message??=JSON.stringify(e.def,u,2),e.message}function st(e){this._zod.message=e}const ct={get:ot,set:st,enumerable:!0,configurable:!0},lt={value:void 0,enumerable:!1},ut={value:void 0,enumerable:!1},dt=new WeakSet([Object.prototype,Error.prototype]),ft=(e,t)=>{e.name=`$ZodError`,lt.value=e._zod,Object.defineProperty(e,"_zod",lt),ut.value=t,Object.defineProperty(e,"issues",ut),lt.value=void 0,ut.value=void 0,Object.defineProperty(e,"message",ct);let n=Object.getPrototypeOf(e);dt.has(n)||(dt.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},pt=k(`$ZodError`,ft),N=k(`$ZodError`,ft,void 0,{Parent:Error});function mt(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function ht(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?mt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function gt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function _t(e,t=e=>e.message){let n={errors:[]},r=(e,i=[])=>{var a;for(let o of e.issues)if(o.code===`invalid_union`&&o.errors.length)o.errors.map(e=>r({issues:e},[...i,...o.path]));else if(o.code===`invalid_key`)r({issues:o.issues},[...i,...o.path]);else if(o.code===`invalid_element`)r({issues:o.issues},[...i,...o.path]);else{let e=[...i,...o.path];if(e.length===0){n.errors.push(t(o));continue}let r=n,s=0;for(;s<e.length;){let n=e[s],i=s===e.length-1;typeof n==`string`?(r.properties??(r.properties={}),Object.prototype.hasOwnProperty.call(r.properties,n)||Object.defineProperty(r.properties,n,{value:{errors:[]},enumerable:!0,writable:!0,configurable:!0}),r=r.properties[n]):(r.items??(r.items=[]),(a=r.items)[n]??(a[n]={errors:[]}),r=r.items[n]),i&&r.errors.push(t(o)),s++}}};return r(e),n}function vt(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function yt(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${vt(e.path)}`);return t.join(`
2
2
  `)}function bt(e,t){return{callee:t?.callee??e,Err:t?.Err}}const xt=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new A;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>E(e,o,M())));throw se(n,a?.callee??t),n}return s.value};return t},St=xt(N),Ct=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>E(e,o,M())));throw se(n,a?.callee??t),n}return s.value};return t},wt=Ct(N),Tt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new A;return a.issues.length?{success:!1,error:new(e??pt)(a.issues.map(e=>E(e,i,M())))}:{success:!0,data:a.value}},Et=Tt(N),Dt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>E(e,i,M())))}:{success:!0,data:a.value}},Ot=Dt(N),kt=Symbol.for(`zod.compile.invalid`),At=Symbol.for(`zod.compile.fallback`),jt=((e,t,n)=>{let r=e._zod.bag.validator;return r!==void 0&&r(t)!==kt||Mt(e,t,n)});function Mt(e,t,n){let r=n?{...n,async:!1}:{async:!1},i=e._zod.bag.fallbackRun,a;if(i?(r[At]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new A;return a.issues.length===0}const Nt=async(e,t,n)=>{let r=n?{...n,async:!0}:{async:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Pt=e=>{let t=xt(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,bt(n,a))};return n},Ft=Pt(N),It=e=>{let t=xt(e),n=(e,r,i,a)=>t(e,r,i,bt(n,a));return n},Lt=It(N),Rt=e=>{let t=Ct(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,bt(n,a))};return n},zt=Rt(N),Bt=e=>{let t=Ct(e),n=async(e,r,i,a)=>await t(e,r,i,bt(n,a));return n},Vt=Bt(N),Ht=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Tt(e)(t,n,i)},Ut=Ht(N),Wt=e=>(t,n,r)=>Tt(e)(t,n,r),Gt=Wt(N),Kt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Dt(e)(t,n,i)},qt=Kt(N),Jt=e=>async(t,n,r)=>Dt(e)(t,n,r),Yt=Jt(N);var Xt=e({base64:()=>wn,base64url:()=>Tn,bigint:()=>Rn,boolean:()=>Vn,browserEmail:()=>_n,cidrv4:()=>Sn,cidrv6:()=>Cn,creditCard:()=>An,cuid:()=>Zt,cuid2:()=>Qt,date:()=>Nn,datetime:()=>In,domain:()=>Dn,duration:()=>an,e164:()=>kn,email:()=>fn,emoji:()=>vn,extendedDuration:()=>on,guid:()=>sn,hex:()=>Kn,hostname:()=>En,html5Email:()=>pn,httpProtocol:()=>On,idnEmail:()=>gn,integer:()=>zn,ipv4:()=>yn,ipv6:()=>bn,ksuid:()=>tn,lowercase:()=>Wn,mac:()=>xn,md5_base64:()=>Xn,md5_base64url:()=>Zn,md5_hex:()=>Yn,nanoid:()=>nn,nanoidOfLength:()=>rn,null:()=>Hn,number:()=>Bn,rfc5322Email:()=>mn,sha1_base64:()=>$n,sha1_base64url:()=>er,sha1_hex:()=>Qn,sha256_base64:()=>nr,sha256_base64url:()=>rr,sha256_hex:()=>tr,sha384_base64:()=>ar,sha384_base64url:()=>or,sha384_hex:()=>ir,sha512_base64:()=>cr,sha512_base64url:()=>lr,sha512_hex:()=>sr,string:()=>Ln,time:()=>Fn,ulid:()=>$t,undefined:()=>Un,unicodeEmail:()=>hn,uppercase:()=>Gn,uuid:()=>cn,uuid4:()=>ln,uuid6:()=>un,uuid7:()=>dn,xid:()=>en});const Zt=/^[cC][0-9a-z]{6,}$/,Qt=/^[0-9a-z]+$/,$t=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,en=/^[0-9a-vA-V]{20}$/,tn=/^[A-Za-z0-9]{27}$/,nn=/^[a-zA-Z0-9_-]{21}$/;function rn(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}const an=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,on=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,sn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,cn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,ln=cn(4),un=cn(6),dn=cn(7),fn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,pn=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,mn=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/,hn=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,gn=hn,_n=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;function vn(){return RegExp(`^[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`,`u`)}const yn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,bn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,xn=e=>{let t=b(e??`:`);return RegExp(`^(?:[0-9A-F]{2}${t}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${t}){5}[0-9a-f]{2}$`)},Sn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Cn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,wn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Tn=/^[A-Za-z0-9_-]*$/,En=/^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/,Dn=/^(?=.{1,253}$)([a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,63}$/,On=/^https?$/,kn=/^\+[1-9]\d{6,14}$/,An=/^\d(?:[ -]?\d){11,18}$/,jn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function Mn(e){return RegExp(`^${e}$`)}const Nn=Mn(jn);function Pn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Fn(e){return RegExp(`^${Pn(e)}$`)}function In(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${Pn({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${Pn({precision:e.precision})}`:n;return RegExp(`^${jn}T(?:${r})$`)}const Ln=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},Rn=/^-?\d+n?$/,zn=/^-?\d+$/,Bn=/^-?\d+(?:\.\d+)?$/,Vn=/^(?:true|false)$/i,Hn=/^null$/i,Un=/^undefined$/i,Wn=/^[^A-Z]*$/,Gn=/^[^a-z]*$/,Kn=/^[0-9a-fA-F]*$/;function qn(e,t){return RegExp(`^[A-Za-z0-9+/]{${e}}${t}$`)}function Jn(e){return RegExp(`^[A-Za-z0-9_-]{${e}}$`)}const Yn=/^[0-9a-fA-F]{32}$/,Xn=qn(22,`==`),Zn=Jn(22),Qn=/^[0-9a-fA-F]{40}$/,$n=qn(27,`=`),er=Jn(27),tr=/^[0-9a-fA-F]{64}$/,nr=qn(43,`=`),rr=Jn(43),ir=/^[0-9a-fA-F]{96}$/,ar=qn(64,``),or=Jn(64),sr=/^[0-9a-fA-F]{128}$/,cr=qn(86,`==`),lr=Jn(86),P=k(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),ur=e=>{let t=e.value;return!f(t)&&t.size!==void 0},dr=e=>{let t=e.value;return!f(t)&&t.length!==void 0},fr={number:`number`,bigint:`bigint`,object:`date`},pr=k(`$ZodCheckLessThan`,(e,t)=>{P.init(e,t);let n=fr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:fr[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),mr=k(`$ZodCheckGreaterThan`,(e,t)=>{P.init(e,t);let n=fr[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:fr[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),hr=k(`$ZodCheckMultipleOf`,(e,t)=>{P.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):m(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),gr=k(`$ZodCheckNumberFormat`,(e,t)=>{P.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=_e[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=zn)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),_r=k(`$ZodCheckBigIntFormat`,(e,t)=>{P.init(e,t);let[n,r]=ve[t.format];e._zod.onattach.push(e=>{let i=e._zod.bag;i.format=t.format,i.minimum=n,i.maximum=r}),e._zod.check=i=>{let a=i.value;a<n&&i.issues.push({origin:`bigint`,input:a,code:`too_small`,minimum:n,inclusive:!0,inst:e,continue:!t.abort}),a>r&&i.issues.push({origin:`bigint`,input:a,code:`too_big`,maximum:r,inclusive:!0,inst:e,continue:!t.abort})}}),vr=k(`$ZodCheckMaxSize`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=ur),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;r.size<=t.maximum||n.issues.push({origin:ke(r),code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),yr=k(`$ZodCheckMinSize`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=ur),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;r.size>=t.minimum||n.issues.push({origin:ke(r),code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),br=k(`$ZodCheckSizeEquals`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=ur),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.size,n.maximum=t.size,n.size=t.size}),e._zod.check=n=>{let r=n.value,i=r.size;if(i===t.size)return;let a=i>t.size;n.issues.push({origin:ke(r),...a?{code:`too_big`,maximum:t.size}:{code:`too_small`,minimum:t.size},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),xr=k(`$ZodCheckMaxLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=dr),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?je(r):i)<=t.maximum)return;let a=Me(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Sr=k(`$ZodCheckMinLength`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=dr),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?je(r):i)>=t.minimum)return;let a=Me(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Cr=k(`$ZodCheckLengthEquals`,(e,t)=>{var n;P.init(e,t),(n=e._zod.def).when??(n.when=dr),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?je(r):i;if(a===t.length)return;let o=Me(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),wr=k(`$ZodCheckStringFormat`,(e,t)=>{var n,r;P.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Tr=k(`$ZodCheckRegex`,(e,t)=>{wr.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Er=k(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Wn,wr.init(e,t)}),Dr=k(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Gn,wr.init(e,t)}),Or=k(`$ZodCheckIncludes`,(e,t)=>{P.init(e,t);let n=b(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),kr=k(`$ZodCheckStartsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`^${b(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Ar=k(`$ZodCheckEndsWith`,(e,t)=>{P.init(e,t);let n=RegExp(`.*${b(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}});function jr(e,t,n){e.issues.length&&t.issues.push(...T(n,e.issues))}const Mr=k(`$ZodCheckProperty`,(e,t)=>{P.init(e,t),e._zod.check=e=>{let n=t.schema._zod.run({value:e.value[t.property],issues:[]},{});if(n instanceof Promise)return n.then(n=>jr(n,e,t.property));jr(n,e,t.property)}}),Nr=k(`$ZodCheckMimeType`,(e,t)=>{P.init(e,t);let n=new Set(t.mime);e._zod.onattach.push(e=>{e._zod.bag.mime=t.mime}),e._zod.check=r=>{n.has(r.value.type)||r.issues.push({code:`invalid_value`,values:t.mime,input:r.value.type,inst:e,continue:!t.abort})}}),Pr=k(`$ZodCheckOverwrite`,(e,t)=>{P.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Fr=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
3
3
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
4
4
  `)}\n};`)(...Object.values(this.closed))}};const Ir={major:4,minor:5,patch:4},F=k(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ir;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=w(t),a;for(let o of n){if(o._zod.def.when){if(Ee(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new A;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Oe(t.issues,n,e),i||=w(t,n))});else{if(t.issues.length===n)continue;Oe(t.issues,n,e),i||=w(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(w(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new A;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new A;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return We(this,`~standard`,Rr(this))},set"~standard"(e){Ue(this,`~standard`,e)}}),Lr=e=>e.success?{value:e.data}:{issues:e.error?.issues};function Rr(e){return{validate:t=>{try{return Lr(Et(e,t))}catch{return Ot(e,t).then(Lr)}},vendor:`zod`,version:1}}const zr=k(`$ZodString`,(e,t)=>{F.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??Ln(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),I=k(`$ZodStringFormat`,(e,t)=>{wr.init(e,t),zr.init(e,t)}),Br=k(`$ZodGUID`,(e,t)=>{t.pattern??=sn,I.init(e,t)}),Vr=k(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=cn(e)}else t.pattern??=cn();I.init(e,t)}),Hr=k(`$ZodEmail`,(e,t)=>{t.pattern??=fn,I.init(e,t)}),Ur=1,Wr=2;function Gr(e,t){if(!t.normalize&&t.protocol?.source===On.source&&!/^https?:\/\//i.test(e))return 1;try{return new URL(e)}catch{return 2}}const Kr=/[\t\n\r]/g;function qr(e){return e.replace(Kr,``)}function Jr(e,t){return t.lastIndex=0,t.test(e.hostname)}function Yr(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const Xr=k(`$ZodURL`,(e,t)=>{I.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Gr(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}t.hostname&&!Jr(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Yr(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:qr(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Zr=k(`$ZodEmoji`,(e,t)=>{t.pattern??=vn(),I.init(e,t)}),Qr=k(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?nn:rn(t.length),I.init(e,t)}),$r=k(`$ZodCUID`,(e,t)=>{t.pattern??=Zt,I.init(e,t)}),ei=k(`$ZodCUID2`,(e,t)=>{t.pattern??=Qt,I.init(e,t)}),ti=k(`$ZodULID`,(e,t)=>{t.pattern??=$t,I.init(e,t)}),ni=k(`$ZodXID`,(e,t)=>{t.pattern??=en,I.init(e,t)}),ri=k(`$ZodKSUID`,(e,t)=>{t.pattern??=tn,I.init(e,t)}),ii=k(`$ZodISODateTime`,(e,t)=>{t.pattern??=In(t),I.init(e,t),(t.local||t.precision===-1)&&(e._zod.bag.laxFormat=!0,e._zod.onattach.push(e=>{e._zod.bag.laxFormat=!0}))}),ai=k(`$ZodISODate`,(e,t)=>{t.pattern??=Nn,I.init(e,t)}),oi=k(`$ZodISOTime`,(e,t)=>{t.pattern??=Fn(t),I.init(e,t)}),si=k(`$ZodISODuration`,(e,t)=>{t.pattern??=an,I.init(e,t)}),ci=k(`$ZodIPv4`,(e,t)=>{t.pattern??=yn,I.init(e,t),e._zod.bag.format=`ipv4`}),li=/^[0-9a-fA-F:.]+$/;function ui(e){if(!li.test(e))return!1;try{return new URL(`http://[${e}]`),!0}catch{return!1}}const di=k(`$ZodIPv6`,(e,t)=>{t.pattern??=bn,I.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{ui(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),fi=k(`$ZodMAC`,(e,t)=>{t.pattern??=xn(t.delimiter),I.init(e,t),e._zod.bag.format=`mac`}),pi=k(`$ZodCIDRv4`,(e,t)=>{t.pattern??=Sn,I.init(e,t)});function mi(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:ui(n)}const hi=k(`$ZodCIDRv6`,(e,t)=>{t.pattern??=Cn,I.init(e,t),e._zod.check=n=>{mi(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function gi(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const _i=k(`$ZodBase64`,(e,t)=>{t.pattern??=wn,I.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{gi(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function vi(e){if(!Tn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return gi(t.padEnd(Math.ceil(t.length/4)*4,`=`))}const yi=k(`$ZodBase64URL`,(e,t)=>{t.pattern??=Tn,I.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{vi(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),bi=k(`$ZodE164`,(e,t)=>{t.pattern??=kn,I.init(e,t)}),xi=/[- ]/g;function Si(e){let t=e.length,n=1,r=0;for(;t;){let i=+e[--t];n^=1,r+=n?[0,2,4,6,8,1,3,5,7,9][i]:i}return r%10==0}function Ci(e){return An.test(e)?Si(e.replace(xi,``)):!1}const wi=k(`$ZodCreditCard`,(e,t)=>{t.pattern??=An,I.init(e,t),e._zod.check=n=>{Ci(n.value)||n.issues.push({code:`invalid_format`,format:`credit_card`,input:n.value,inst:e,continue:!t.abort})}});function Ti(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}const Ei=k(`$ZodJWT`,(e,t)=>{I.init(e,t),e._zod.check=n=>{Ti(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Di=k(`$ZodCustomStringFormat`,(e,t)=>{I.init(e,t),e._zod.check=n=>{t.fn(n.value)||n.issues.push({code:`invalid_format`,format:t.format,input:n.value,inst:e,continue:!t.abort})}}),Oi=k(`$ZodNumber`,(e,t)=>{F.init(e,t),e._zod.pattern=e._zod.bag.pattern??Bn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),ki=k(`$ZodNumberFormat`,(e,t)=>{gr.init(e,t),Oi.init(e,t)}),Ai=k(`$ZodBoolean`,(e,t)=>{F.init(e,t),e._zod.pattern=Vn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),ji=k(`$ZodBigInt`,(e,t)=>{F.init(e,t),e._zod.pattern=Rn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value==`bigint`||n.issues.push({expected:`bigint`,code:`invalid_type`,input:n.value,inst:e}),n}}),Mi=k(`$ZodBigIntFormat`,(e,t)=>{_r.init(e,t),ji.init(e,t)}),Ni=k(`$ZodSymbol`,(e,t)=>{F.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return typeof r==`symbol`||t.issues.push({expected:`symbol`,code:`invalid_type`,input:r,inst:e}),t}}),Pi=k(`$ZodUndefined`,(e,t)=>{F.init(e,t),e._zod.pattern=Un,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),Fi=k(`$ZodNull`,(e,t)=>{F.init(e,t),e._zod.pattern=Hn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),Ii=k(`$ZodAny`,(e,t)=>{F.init(e,t),e._zod.parse=e=>e}),Li=k(`$ZodUnknown`,(e,t)=>{F.init(e,t),e._zod.parse=e=>e}),Ri=k(`$ZodNever`,(e,t)=>{F.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),zi=k(`$ZodVoid`,(e,t)=>{F.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}}),Bi=k(`$ZodDate`,(e,t)=>{F.init(e,t),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=new Date(n.value)}catch{}let i=n.value,a=i instanceof Date;return a&&!Number.isNaN(i.getTime())||n.issues.push({expected:`date`,code:`invalid_type`,input:i,...a?{received:`Invalid Date`}:{},inst:e}),n}});function Vi(e,t,n){e.issues.length&&t.issues.push(...T(n,e.issues)),t.value[n]=e.value}const Hi=k(`$ZodArray`,(e,t)=>{F.init(e,t);let n=j.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[];for(let e=0;e<a.length;e++){let n=a[e],s=t.element._zod.run({value:n,issues:[]},i);s instanceof Promise?o.push(s.then(t=>Vi(t,r,e))):Vi(s,r,e)}return o.length?Promise.all(o).then(()=>r):r}});function Ui(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...T(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}}const Wi=[];function Gi(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Wi,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=ge(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Ki(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin,d=c.optout;for(let i in t){if(s.has(i))continue;if(i===`__proto__`){l===`never`&&o.push(i);continue}if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Ui(e,n,i,t,u,d))):Ui(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const qi=new WeakMap,Ji=k(`$ZodObject`,(e,t)=>{if(F.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;qi.set(t,e),Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),qi.set(t,n),n}})}let n=d(()=>Gi(t));O(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||g(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let r=ce,i=t.catchall,a,o=j.memoizer;o?.attach(e),e._zod.parse=(t,s)=>{a??=n.value;let c=t.value;if(!r(c))return t.issues.push({expected:`object`,code:`invalid_type`,input:c,inst:e}),t;t.value=o?o.alloc(e,t,{},s):{};let l=[],u=a.shape;for(let e of a.allKeys){if(e===`__proto__`)continue;let n=u[e],r=n._zod.optin,i=n._zod.optout,a=n._zod.run({value:c[e],issues:[]},s);a instanceof Promise?l.push(a.then(n=>Ui(n,t,e,c,r,i))):Ui(a,t,e,c,r,i)}return i?Ki(l,c,t,s,n.value,e):l.length?Promise.all(l).then(()=>t):t}}),Yi=k(`$ZodObjectJIT`,(e,t)=>{Ji.init(e,t);let n=e._zod.parse,r=d(()=>Gi(t)),i=j.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Fr([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
@@ -1,2 +1,2 @@
1
- import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.js";import{t as r}from"./version-C__MqbLM.js";import*as i from"node:path";import a from"node:path";import{homedir as o}from"node:os";import s from"node:fs";import*as c from"node:fs/promises";import{z as l}from"#compiled/zod/index.js";import u from"os";import{setTimeout as d}from"node:timers/promises";const f=l.string().transform((e,t)=>{try{return JSON.parse(e)}catch(e){return t.addIssue({code:l.ZodIssueCode.custom,message:`Invalid JSON: ${e.message}`}),l.NEVER}});var p=n(((t,n)=>{let r=e(`os`),i=e(`path`),a=/^win/i.test(process.platform);function o(e){return i.normalize(i.join(e,`.`))}let s=()=>{let{env:e}=process,t={};return t.home=()=>o(r.homedir?r.homedir():e.HOME),t.temp=()=>o(r.tmpdir?r.tmpdir():e.TMPDIR||e.TEMP||e.TMP),t},c=()=>{let{env:e}=process,t={};return t.home=()=>o(r.homedir?r.homedir():e.USERPROFILE||i.join(e.HOMEDRIVE,e.HOMEPATH)||e.HOME),t.temp=()=>o(r.tmpdir?r.tmpdir():e.TEMP||e.TMP||i.join(e.LOCALAPPDATA||e.SystemRoot||e.windir,`Temp`)),t};n.exports=new class e{constructor(){let t=function(){return new e};this._fn=t;let n=a?c():s();return Object.keys(n).forEach(e=>{this._fn[e]=n[e]}),this._fn}}})),m=n(((t,n)=>{let r=e(`path`),i=p(),a=()=>{let e={};return e.cache=()=>process.env.XDG_CACHE_HOME||r.join(i.home()||i.temp(),`.cache`),e.config=()=>process.env.XDG_CONFIG_HOME||r.join(i.home()||i.temp(),`.config`),e.data=()=>process.env.XDG_DATA_HOME||r.join(i.home()||i.temp(),`.local`,`share`),e.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,e.state=()=>process.env.XDG_STATE_HOME||r.join(i.home()||i.temp(),`.local`,`state`),e},o=()=>{let e={};return e.cache=()=>process.env.XDG_CACHE_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`Caches`),e.config=()=>process.env.XDG_CONFIG_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`Preferences`),e.data=()=>process.env.XDG_DATA_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`Application Support`),e.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,e.state=()=>process.env.XDG_STATE_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`State`),e},s=()=>{let e={};return e.cache=()=>{let e=process.env.LOCALAPPDATA||r.join(i.home()||i.temp(),`AppData`,`Local`);return process.env.XDG_CACHE_HOME||r.join(e,`xdg.cache`)},e.config=()=>{let e=process.env.APPDATA||r.join(i.home()||i.temp(),`AppData`,`Roaming`);return process.env.XDG_CONFIG_HOME||r.join(e,`xdg.config`)},e.data=()=>{let e=process.env.APPDATA||r.join(i.home()||i.temp(),`AppData`,`Roaming`);return process.env.XDG_DATA_HOME||r.join(e,`xdg.data`)},e.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,e.state=()=>{let e=process.env.LOCALAPPDATA||r.join(i.home()||i.temp(),`AppData`,`Local`);return process.env.XDG_STATE_HOME||r.join(e,`xdg.state`)},e},c=()=>{let e=function(){return c()},t={};return t=/^darwin$/i.test(process.platform)?o():/^win/i.test(process.platform)?s():a(),t.configDirs=()=>{let e=[];return e.push(t.config()),process.env.XDG_CONFIG_DIRS&&e.push(...process.env.XDG_CONFIG_DIRS.split(r.delimiter)),e},t.dataDirs=()=>{let e=[];return e.push(t.data()),process.env.XDG_DATA_DIRS&&e.push(...process.env.XDG_DATA_DIRS.split(r.delimiter)),e},Object.keys(t).forEach(n=>{e[n]=t[n]}),e};n.exports=c()})),h=t(n(((t,n)=>{let r=e(`path`),i=e(`os`),a=m(),o=/^win/i.test(process.platform);function s(e,t){if(e||={},typeof e!=`object`&&(e={isolated:e}),e.isolated=e.isolated===void 0||e.isolated===null?t:e.isolated,typeof e.isolated!=`boolean`)throw TypeError(`Expected boolean for "isolated" argument, got ${typeof e.isolated}`);return e}let c=(e,t)=>{let n={};return n.cache=(n={isolated:null})=>(n=s(n,t),r.join(a.cache(),n.isolated?e:``)),n.config=(n={isolated:null})=>(n=s(n,t),r.join(a.config(),n.isolated?e:``)),n.data=(n={isolated:null})=>(n=s(n,t),r.join(a.data(),n.isolated?e:``)),n.runtime=(n={isolated:null})=>(n=s(n,t),a.runtime()?r.join(a.runtime(),n.isolated?e:``):void 0),n.state=(n={isolated:null})=>(n=s(n,t),r.join(a.state(),n.isolated?e:``)),n.configDirs=(n={isolated:null})=>(n=s(n,t),a.configDirs().map(t=>r.join(t,n.isolated?e:``))),n.dataDirs=(n={isolated:null})=>(n=s(n,t),a.dataDirs().map(t=>r.join(t,n.isolated?e:``))),n},l=(e,t)=>{let{env:n}=process,o=i.homedir(),c=i.tmpdir(),l=n.APPDATA||r.join(o||c,`AppData`,`Roaming`),u=n.LOCALAPPDATA||r.join(o||c,`AppData`,`Local`),d={};return d.cache=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_CACHE_HOME?r.join(a.cache(),i.isolated?e:``):r.join(u,i.isolated?e:``,`Cache`)),d.config=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_CONFIG_HOME?r.join(a.config(),i.isolated?e:``):r.join(l,i.isolated?e:``,`Config`)),d.data=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_DATA_HOME?r.join(a.data(),i.isolated?e:``):r.join(l,i.isolated?e:``,`Data`)),d.runtime=(n={isolated:null})=>(n=s(n,t),a.runtime()?r.join(a.runtime(),n.isolated?e:``):void 0),d.state=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_STATE_HOME?r.join(a.state(),i.isolated?e:``):r.join(u,i.isolated?e:``,`State`)),d.configDirs=(i={isolated:null})=>{i=s(i,t);let a=[d.config(i)];return n.XDG_CONFIG_DIRS&&a.push(...n.XDG_CONFIG_DIRS.split(r.delimiter).map(t=>r.join(t,i.isolated?e:``))),a},d.dataDirs=(i={isolated:null})=>{i=s(i,t);let a=[d.data(i)];return n.XDG_DATA_DIRS&&a.push(...n.XDG_DATA_DIRS.split(r.delimiter).map(t=>r.join(t,i.isolated?e:``))),a},d};n.exports=new class t{constructor(n={name:null,suffix:null,isolated:!0}){let i=function(e={name:null,suffix:null,isolated:!0}){return new t(e)};this._fn=i,n||={},typeof n!=`object`&&(n={name:n});let a=n.name||``;if(typeof a!=`string`)throw TypeError(`Expected string for "name" argument, got ${typeof a}`);let s=n.suffix||``;if(typeof s!=`string`)throw TypeError(`Expected string for "suffix" argument, got ${typeof s}`);let u=n.isolated===void 0||n.isolated===null||n.isolated;if(typeof u!=`boolean`)throw TypeError(`Expected boolean for "isolated" argument, got ${typeof u}`);a||=r.parse(process.pkg?process.execPath:e.main?e.main.filename:process.argv[0]).name,s&&(a+=s),this._fn.$name=()=>a,this._fn.$isolated=()=>u;let d=o?l(a,u):c(a,u);return Object.keys(d).forEach(e=>{this._fn[e]=d[e]}),this._fn}}}))(),1);const g=l.number().transform(e=>new Date(e*1e3)),_=l.object({token:l.string().min(1).optional(),refreshToken:l.string().min(1).optional(),expiresAt:g.optional()}),v=f.pipe(_),y=e=>{try{return s.lstatSync(e).isDirectory()}catch{return!1}},b=()=>{if(process.env.VERCEL_AUTH_CONFIG_DIR)return process.env.VERCEL_AUTH_CONFIG_DIR;let e=(0,h.default)(`com.vercel.cli`).dataDirs();return[...e,a.join(o(),`.now`),...(0,h.default)(`now`).dataDirs()].find(e=>y(e))||e[0]},x=()=>{try{let e=a.join(b(),`auth.json`);return v.parse(s.readFileSync(e,`utf8`))}catch{return null}};function S(e){let t=a.join(b(),`auth.json`);s.mkdirSync(a.dirname(t),{recursive:!0});let n={token:e.token,expiresAt:e.expiresAt&&Math.round(e.expiresAt.getTime()/1e3),refreshToken:e.refreshToken};s.writeFileSync(t,JSON.stringify(n)+`
1
+ import{i as e,o as t,t as n}from"./rolldown-runtime-tZXQYakl.js";import{t as r}from"./version-C2PfNyEv.js";import*as i from"node:path";import a from"node:path";import{homedir as o}from"node:os";import s from"node:fs";import*as c from"node:fs/promises";import{z as l}from"#compiled/zod/index.js";import u from"os";import{setTimeout as d}from"node:timers/promises";const f=l.string().transform((e,t)=>{try{return JSON.parse(e)}catch(e){return t.addIssue({code:l.ZodIssueCode.custom,message:`Invalid JSON: ${e.message}`}),l.NEVER}});var p=n(((t,n)=>{let r=e(`os`),i=e(`path`),a=/^win/i.test(process.platform);function o(e){return i.normalize(i.join(e,`.`))}let s=()=>{let{env:e}=process,t={};return t.home=()=>o(r.homedir?r.homedir():e.HOME),t.temp=()=>o(r.tmpdir?r.tmpdir():e.TMPDIR||e.TEMP||e.TMP),t},c=()=>{let{env:e}=process,t={};return t.home=()=>o(r.homedir?r.homedir():e.USERPROFILE||i.join(e.HOMEDRIVE,e.HOMEPATH)||e.HOME),t.temp=()=>o(r.tmpdir?r.tmpdir():e.TEMP||e.TMP||i.join(e.LOCALAPPDATA||e.SystemRoot||e.windir,`Temp`)),t};n.exports=new class e{constructor(){let t=function(){return new e};this._fn=t;let n=a?c():s();return Object.keys(n).forEach(e=>{this._fn[e]=n[e]}),this._fn}}})),m=n(((t,n)=>{let r=e(`path`),i=p(),a=()=>{let e={};return e.cache=()=>process.env.XDG_CACHE_HOME||r.join(i.home()||i.temp(),`.cache`),e.config=()=>process.env.XDG_CONFIG_HOME||r.join(i.home()||i.temp(),`.config`),e.data=()=>process.env.XDG_DATA_HOME||r.join(i.home()||i.temp(),`.local`,`share`),e.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,e.state=()=>process.env.XDG_STATE_HOME||r.join(i.home()||i.temp(),`.local`,`state`),e},o=()=>{let e={};return e.cache=()=>process.env.XDG_CACHE_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`Caches`),e.config=()=>process.env.XDG_CONFIG_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`Preferences`),e.data=()=>process.env.XDG_DATA_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`Application Support`),e.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,e.state=()=>process.env.XDG_STATE_HOME||r.join(r.join(i.home()||i.temp(),`Library`),`State`),e},s=()=>{let e={};return e.cache=()=>{let e=process.env.LOCALAPPDATA||r.join(i.home()||i.temp(),`AppData`,`Local`);return process.env.XDG_CACHE_HOME||r.join(e,`xdg.cache`)},e.config=()=>{let e=process.env.APPDATA||r.join(i.home()||i.temp(),`AppData`,`Roaming`);return process.env.XDG_CONFIG_HOME||r.join(e,`xdg.config`)},e.data=()=>{let e=process.env.APPDATA||r.join(i.home()||i.temp(),`AppData`,`Roaming`);return process.env.XDG_DATA_HOME||r.join(e,`xdg.data`)},e.runtime=()=>process.env.XDG_RUNTIME_DIR||void 0,e.state=()=>{let e=process.env.LOCALAPPDATA||r.join(i.home()||i.temp(),`AppData`,`Local`);return process.env.XDG_STATE_HOME||r.join(e,`xdg.state`)},e},c=()=>{let e=function(){return c()},t={};return t=/^darwin$/i.test(process.platform)?o():/^win/i.test(process.platform)?s():a(),t.configDirs=()=>{let e=[];return e.push(t.config()),process.env.XDG_CONFIG_DIRS&&e.push(...process.env.XDG_CONFIG_DIRS.split(r.delimiter)),e},t.dataDirs=()=>{let e=[];return e.push(t.data()),process.env.XDG_DATA_DIRS&&e.push(...process.env.XDG_DATA_DIRS.split(r.delimiter)),e},Object.keys(t).forEach(n=>{e[n]=t[n]}),e};n.exports=c()})),h=t(n(((t,n)=>{let r=e(`path`),i=e(`os`),a=m(),o=/^win/i.test(process.platform);function s(e,t){if(e||={},typeof e!=`object`&&(e={isolated:e}),e.isolated=e.isolated===void 0||e.isolated===null?t:e.isolated,typeof e.isolated!=`boolean`)throw TypeError(`Expected boolean for "isolated" argument, got ${typeof e.isolated}`);return e}let c=(e,t)=>{let n={};return n.cache=(n={isolated:null})=>(n=s(n,t),r.join(a.cache(),n.isolated?e:``)),n.config=(n={isolated:null})=>(n=s(n,t),r.join(a.config(),n.isolated?e:``)),n.data=(n={isolated:null})=>(n=s(n,t),r.join(a.data(),n.isolated?e:``)),n.runtime=(n={isolated:null})=>(n=s(n,t),a.runtime()?r.join(a.runtime(),n.isolated?e:``):void 0),n.state=(n={isolated:null})=>(n=s(n,t),r.join(a.state(),n.isolated?e:``)),n.configDirs=(n={isolated:null})=>(n=s(n,t),a.configDirs().map(t=>r.join(t,n.isolated?e:``))),n.dataDirs=(n={isolated:null})=>(n=s(n,t),a.dataDirs().map(t=>r.join(t,n.isolated?e:``))),n},l=(e,t)=>{let{env:n}=process,o=i.homedir(),c=i.tmpdir(),l=n.APPDATA||r.join(o||c,`AppData`,`Roaming`),u=n.LOCALAPPDATA||r.join(o||c,`AppData`,`Local`),d={};return d.cache=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_CACHE_HOME?r.join(a.cache(),i.isolated?e:``):r.join(u,i.isolated?e:``,`Cache`)),d.config=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_CONFIG_HOME?r.join(a.config(),i.isolated?e:``):r.join(l,i.isolated?e:``,`Config`)),d.data=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_DATA_HOME?r.join(a.data(),i.isolated?e:``):r.join(l,i.isolated?e:``,`Data`)),d.runtime=(n={isolated:null})=>(n=s(n,t),a.runtime()?r.join(a.runtime(),n.isolated?e:``):void 0),d.state=(i={isolated:null})=>(i=s(i,t),!i.isolated||n.XDG_STATE_HOME?r.join(a.state(),i.isolated?e:``):r.join(u,i.isolated?e:``,`State`)),d.configDirs=(i={isolated:null})=>{i=s(i,t);let a=[d.config(i)];return n.XDG_CONFIG_DIRS&&a.push(...n.XDG_CONFIG_DIRS.split(r.delimiter).map(t=>r.join(t,i.isolated?e:``))),a},d.dataDirs=(i={isolated:null})=>{i=s(i,t);let a=[d.data(i)];return n.XDG_DATA_DIRS&&a.push(...n.XDG_DATA_DIRS.split(r.delimiter).map(t=>r.join(t,i.isolated?e:``))),a},d};n.exports=new class t{constructor(n={name:null,suffix:null,isolated:!0}){let i=function(e={name:null,suffix:null,isolated:!0}){return new t(e)};this._fn=i,n||={},typeof n!=`object`&&(n={name:n});let a=n.name||``;if(typeof a!=`string`)throw TypeError(`Expected string for "name" argument, got ${typeof a}`);let s=n.suffix||``;if(typeof s!=`string`)throw TypeError(`Expected string for "suffix" argument, got ${typeof s}`);let u=n.isolated===void 0||n.isolated===null||n.isolated;if(typeof u!=`boolean`)throw TypeError(`Expected boolean for "isolated" argument, got ${typeof u}`);a||=r.parse(process.pkg?process.execPath:e.main?e.main.filename:process.argv[0]).name,s&&(a+=s),this._fn.$name=()=>a,this._fn.$isolated=()=>u;let d=o?l(a,u):c(a,u);return Object.keys(d).forEach(e=>{this._fn[e]=d[e]}),this._fn}}}))(),1);const g=l.number().transform(e=>new Date(e*1e3)),_=l.object({token:l.string().min(1).optional(),refreshToken:l.string().min(1).optional(),expiresAt:g.optional()}),v=f.pipe(_),y=e=>{try{return s.lstatSync(e).isDirectory()}catch{return!1}},b=()=>{if(process.env.VERCEL_AUTH_CONFIG_DIR)return process.env.VERCEL_AUTH_CONFIG_DIR;let e=(0,h.default)(`com.vercel.cli`).dataDirs();return[...e,a.join(o(),`.now`),...(0,h.default)(`now`).dataDirs()].find(e=>y(e))||e[0]},x=()=>{try{let e=a.join(b(),`auth.json`);return v.parse(s.readFileSync(e,`utf8`))}catch{return null}};function S(e){let t=a.join(b(),`auth.json`);s.mkdirSync(a.dirname(t),{recursive:!0});let n={token:e.token,expiresAt:e.expiresAt&&Math.round(e.expiresAt.getTime()/1e3),refreshToken:e.refreshToken};s.writeFileSync(t,JSON.stringify(n)+`
2
2
  `)}const C=`${u.hostname()} @ vercel/sandbox/${r} node-${process.version} ${u.platform()} (${u.arch()})`,w=new URL(`https://vercel.com`),T=`cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp`,E=l.object({issuer:l.string().url(),device_authorization_endpoint:l.string().url(),token_endpoint:l.string().url(),revocation_endpoint:l.string().url(),jwks_uri:l.string().url(),introspection_endpoint:l.string().url()});let D;const O=l.object({device_code:l.string(),user_code:l.string(),verification_uri:l.string().url(),verification_uri_complete:l.string().url(),expires_in:l.number(),interval:l.number()}),k=l.object({active:l.literal(!0),client_id:l.string(),session_id:l.string()}).or(l.object({active:l.literal(!1)}));async function A(){if(D)return D;let e=await fetch(new URL(`.well-known/openid-configuration`,w),{headers:{"Content-Type":`application/json`,"user-agent":C}});return D=E.parse(await e.json()),D}async function j(){let e=await A();return{async deviceAuthorizationRequest(){let t=await(await fetch(e.device_authorization_endpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":C},body:new URLSearchParams({client_id:T,scope:`openid offline_access`})})).json(),n=O.safeParse(t);if(!n.success)throw new F(`Failed to parse device authorization response from the Vercel authorization server.`,t);return{device_code:n.data.device_code,user_code:n.data.user_code,verification_uri:n.data.verification_uri,verification_uri_complete:n.data.verification_uri_complete,expiresAt:Date.now()+n.data.expires_in*1e3,interval:n.data.interval}},async deviceAccessTokenRequest(t){try{return[null,await fetch(e.token_endpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":C},body:new URLSearchParams({client_id:T,grant_type:`urn:ietf:params:oauth:grant-type:device_code`,device_code:t}),signal:AbortSignal.timeout(1e4)})]}catch(e){return e instanceof Error?[e]:[Error(`An unknown error occurred. See the logs for details.`,{cause:e})]}},async processTokenResponse(e){let t=await e.json(),n=M.safeParse(t);return n.success?[null,n.data]:[new F(`Failed to parse token response from the Vercel authorization server.`,t)]},async revokeToken(t){let n=await fetch(e.revocation_endpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":C},body:new URLSearchParams({token:t,client_id:T})});if(!n.ok)return new F(`Revocation request failed`,await n.json())},async refreshToken(t){let n=await fetch(e.token_endpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":C},body:new URLSearchParams({client_id:T,grant_type:`refresh_token`,refresh_token:t})}),[r,i]=await this.processTokenResponse(n);if(r)throw r;return i},async introspectToken(t){let n=await(await fetch(e.introspection_endpoint,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`,"user-agent":C},body:new URLSearchParams({token:t})})).json(),r=k.safeParse(n);if(!r.success)throw new F(`Failed to parse introspection response from the Vercel authorization server.`,n);return r.data}}}const M=l.object({access_token:l.string(),token_type:l.literal(`Bearer`),expires_in:l.number(),refresh_token:l.string().optional(),scope:l.string().optional()}),N=l.object({error:l.enum([`invalid_request`,`invalid_client`,`invalid_grant`,`unauthorized_client`,`unsupported_grant_type`,`invalid_scope`,`server_error`,`authorization_pending`,`slow_down`,`access_denied`,`expired_token`,`unsupported_token_type`]),error_description:l.string().optional(),error_uri:l.string().optional()});function P(e){try{return N.parse(e)}catch(e){return e instanceof l.ZodError?TypeError(`Invalid OAuth error response: ${e.message}`):TypeError(`Failed to parse OAuth error response`)}}var F=class extends Error{constructor(e,t){super(e),this.name=`OAuthError`;let n=P(t);if(n instanceof TypeError){this.cause=Error(`Unexpected response from the Vercel authorization server.`),this.code=`server_error`;return}let r=n.error;n.error_description&&(r+=`: ${n.error_description}`),n.error_uri&&(r+=` (${n.error_uri})`),this.cause=Error(r),this.code=n.error}};function I(e){return e instanceof F}async function*L({request:e,oauth:t}){let n=new AbortController;try{let r=e.interval*1e3;for(;Date.now()<e.expiresAt;){let[i,a]=await t.deviceAccessTokenRequest(e.device_code);if(i){if(i.message.includes(`timeout`)){r*=2,yield{_tag:`Timeout`,newInterval:r},await d(r,{signal:n.signal});continue}yield{_tag:`Error`,error:i};return}yield{_tag:`Response`,response:a.clone()};let[o,s]=await t.processTokenResponse(a);if(I(o)){let{code:e}=o;switch(e){case`authorization_pending`:await d(r,{signal:n.signal});continue;case`slow_down`:r+=5e3,yield{_tag:`SlowDown`,newInterval:r},await d(r,{signal:n.signal});continue;default:yield{_tag:`Error`,error:o.cause};return}}if(o){yield{_tag:`Error`,error:o};return}S({token:s.access_token,expiresAt:new Date(Date.now()+s.expires_in*1e3),refreshToken:s.refresh_token});return}yield{_tag:`Error`,error:Error(`Timed out waiting for authentication. Please try again.`)};return}finally{n.abort()}}var R=class extends Error{constructor(e){super(`HTTP ${e.statusCode}: ${e.responseText}`),this.name=`NotOk`,this.response=e}};async function z(e){let t=await fetch(`https://vercel.com/api${e.endpoint}`,{method:e.method,body:e.body,headers:{Authorization:`Bearer ${e.token}`,"Content-Type":`application/json`}});if(!t.ok){let e=await t.text();try{let{error:t}=JSON.parse(e);e=`${t.code.toUpperCase()}: ${t.message}`}catch{}throw new R({responseText:e,statusCode:t.status})}return await t.json()}const B=f.pipe(l.object({projectId:l.string(),orgId:l.string()}));async function V(e){let t=i.join(e,`.vercel`,`project.json`),n;try{n=await c.readFile(t,`utf-8`)}catch{return null}let r=B.safeParse(n);return r.success?{projectId:r.data.projectId,teamId:r.data.orgId}:null}const H=l.object({user:l.object({defaultTeamId:l.string().nullable(),username:l.string()})}),U=l.object({id:l.string(),slug:l.string(),updatedAt:l.number().optional(),membership:l.object({role:l.string()}),billing:l.object({plan:l.string()})}),W=l.object({teams:l.array(l.unknown()).transform(e=>e.flatMap(e=>{let t=U.safeParse(e);return t.success?[t.data]:[]})),pagination:l.object({count:l.number(),next:l.number().nullable()})}),G=`vercel-sandbox-default-project`;function K(e){return e instanceof R&&(e.response.statusCode===402||e.response.statusCode===403)}async function q(e){let t=await V(e.cwd??process.cwd());if(t){let n=await Y(e.token,t.teamId,t.projectId);return{...t,created:!1,...n}}if(e.teamId)return J(e.token,e.teamId);let{defaultTeamId:n,username:r}=(await z({token:e.token,endpoint:`/v2/user`}).then(H.parse)).user;if(n)try{let t=await J(e.token,n);try{let r=await z({token:e.token,endpoint:`/v2/teams/${encodeURIComponent(n)}`}).then(l.object({slug:l.string()}).parse);return{...t,teamSlug:r.slug}}catch{return t}}catch(e){if(!K(e))throw e}let i=null;do{let t=i===null?`/v2/teams?limit=20`:`/v2/teams?limit=20&until=${i}`,a=await z({token:e.token,endpoint:t}).then(W.parse);i=a.pagination.next;let o=a.teams.filter(e=>e.membership.role===`OWNER`&&e.billing.plan===`hobby`);if(o.length===0)continue;let s=o.find(e=>e.slug===r)??o.sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0))[0];if(s&&s.id!==n)try{return{...await J(e.token,s.id),teamSlug:s.slug}}catch(e){if(!K(e))throw e}}while(i!==null);try{return{...await J(e.token,r),teamSlug:r}}catch(e){if(!K(e))throw e}throw new R({statusCode:403,responseText:`Authenticated as "${r}" but none of the available teams allow sandbox creation.`})}async function J(e,t){let n=t.startsWith(`team_`)?`teamId=${encodeURIComponent(t)}`:`slug=${encodeURIComponent(t)}`,r=!1;try{await z({token:e,endpoint:`/v2/projects/vercel-sandbox-default-project?${n}`})}catch(t){if(!(t instanceof R)||t.response.statusCode!==404)throw t;await z({token:e,endpoint:`/v11/projects?${n}`,method:`POST`,body:JSON.stringify({name:G})}),r=!0}return{projectId:G,teamId:t,created:r}}async function Y(e,t,n){try{let r=t.startsWith(`team_`)?`teamId=${encodeURIComponent(t)}`:`slug=${encodeURIComponent(t)}`,[i,a]=await Promise.all([z({token:e,endpoint:`/v2/teams/${encodeURIComponent(t)}`}).then(l.object({slug:l.string()}).parse),z({token:e,endpoint:`/v2/projects/${encodeURIComponent(n)}?${r}`}).then(l.object({name:l.string()}).parse)]);return{teamSlug:i.slug,projectSlug:a.name}}catch{return{}}}export{R as NotOk,j as OAuth,x as getAuth,q as inferScope,I as isOAuthError,L as pollForToken,S as updateAuthConfig};
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-tZXQYakl.js";var t=e(((e,t)=>{let n=e=>typeof e==`object`&&!!e&&typeof e.pipe==`function`;n.writable=e=>n(e)&&e.writable!==!1&&typeof e._write==`function`&&typeof e._writableState==`object`,n.readable=e=>n(e)&&e.readable!==!1&&typeof e._read==`function`&&typeof e._readableState==`object`,n.duplex=e=>n.writable(e)&&n.readable(e),n.transform=e=>n.duplex(e)&&typeof e._transform==`function`,t.exports=n}));export{t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./rolldown-runtime-tZXQYakl.js";import{i as t,n,t as r}from"./token-util-BH2pw9Qm.js";var i=e(((e,i)=>{var a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,c=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)a(e,n,{get:t[n],enumerable:!0})},u=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of s(t))!c.call(e,i)&&i!==n&&a(e,i,{get:()=>t[i],enumerable:!(r=o(t,i))||r.enumerable});return e},d=e=>u(a({},`__esModule`,{value:!0}),e),f={};l(f,{refreshToken:()=>g}),i.exports=d(f);var p=n(),m=t(),h=r();async function g(e){let t=e?.project,n=e?.team;if(!t&&!n){let e=(0,h.findProjectInfo)();t=e.projectId,n=e.teamId}else if(!t||!n){let e=(0,h.findProjectInfo)();t??=e.projectId,n??=e.teamId}if(!t)throw new m.VercelOidcTokenError("Failed to refresh OIDC token: No project specified. Try re-linking your project with `vc link`");let r=(0,h.loadToken)(t);if(!r||(0,h.isExpired)((0,h.getTokenPayload)(r.token),e?.expirationBufferMs)){let i=(0,p.getGlobalPathConfig)();if((0,p.getLikelyEffectiveCredStorage)(i)===`keyring`)r=await(0,h.getVercelOidcTokenFromCli)(t,n);else{let i=await(0,h.getVercelToken)({expirationBufferMs:e?.expirationBufferMs});r=await(0,h.getVercelOidcToken)(i,t,n)}if(!r)throw new m.VercelOidcTokenError(`Failed to refresh OIDC token`);(0,h.saveToken)(r,t)}process.env.VERCEL_OIDC_TOKEN=r.token}0&&(i.exports={refreshToken:g})}));export default i();export{};