eve 0.8.5 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/dist/src/compiled/.vendor-stamp.json +2 -2
- package/dist/src/compiled/@vercel/sandbox/index.d.ts +1 -0
- package/dist/src/compiled/@vercel/sandbox/index.js +19 -19
- package/dist/src/compiled/_chunks/node/auth-DF_ft5ea.js +2 -0
- package/dist/src/compiled/_chunks/node/version-TugPKZua.js +64 -0
- package/dist/src/execution/sandbox/bindings/docker-cli.d.ts +1 -1
- package/dist/src/execution/sandbox/bindings/docker-cli.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-network.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker-options.d.ts +4 -4
- package/dist/src/execution/sandbox/bindings/docker-options.js +1 -1
- package/dist/src/execution/sandbox/bindings/docker.d.ts +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/just-bash.d.ts +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-options.d.ts +2 -2
- package/dist/src/execution/sandbox/bindings/microsandbox-options.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-platform.d.ts +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-platform.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox-runtime.js +1 -1
- package/dist/src/execution/sandbox/bindings/microsandbox.d.ts +1 -1
- package/dist/src/execution/sandbox/bindings/{vercel-create-api.d.ts → vercel-create-sdk.d.ts} +4 -0
- package/dist/src/execution/sandbox/bindings/vercel-create-sdk.js +1 -0
- package/dist/src/execution/sandbox/bindings/vercel-credentials.d.ts +8 -0
- package/dist/src/execution/sandbox/bindings/vercel-credentials.js +1 -0
- package/dist/src/execution/sandbox/bindings/vercel-errors.d.ts +1 -0
- package/dist/src/execution/sandbox/bindings/vercel-errors.js +2 -0
- package/dist/src/execution/sandbox/bindings/vercel-lookup.d.ts +7 -0
- package/dist/src/execution/sandbox/bindings/vercel-lookup.js +1 -0
- package/dist/src/execution/sandbox/bindings/vercel.d.ts +5 -5
- package/dist/src/execution/sandbox/bindings/vercel.js +1 -1
- package/dist/src/execution/sandbox/ensure.d.ts +1 -1
- package/dist/src/execution/sandbox/lazy-backend.d.ts +2 -2
- package/dist/src/internal/application/package.js +1 -1
- package/dist/src/internal/authored-definition/sandbox.d.ts +1 -1
- package/dist/src/internal/authored-definition/sandbox.js +1 -1
- package/dist/src/internal/nitro/host/create-application-nitro.d.ts +1 -1
- package/dist/src/public/sandbox/backends/default.d.ts +10 -10
- package/dist/src/public/sandbox/backends/default.js +1 -1
- package/dist/src/public/sandbox/backends/docker.d.ts +1 -1
- package/dist/src/public/sandbox/backends/docker.js +1 -1
- package/dist/src/public/sandbox/backends/just-bash.d.ts +1 -1
- package/dist/src/public/sandbox/backends/just-bash.js +1 -1
- package/dist/src/public/sandbox/backends/microsandbox.d.ts +1 -1
- package/dist/src/public/sandbox/backends/microsandbox.js +1 -1
- package/dist/src/public/sandbox/backends/vercel.d.ts +1 -1
- package/dist/src/public/sandbox/backends/vercel.js +1 -1
- package/dist/src/public/sandbox/docker-sandbox.d.ts +6 -6
- package/dist/src/public/sandbox/docker.d.ts +2 -0
- package/dist/src/public/sandbox/docker.js +1 -0
- package/dist/src/public/sandbox/index.d.ts +1 -9
- package/dist/src/public/sandbox/index.js +1 -1
- package/dist/src/public/sandbox/just-bash-sandbox.d.ts +1 -1
- package/dist/src/public/sandbox/just-bash.d.ts +2 -0
- package/dist/src/public/sandbox/just-bash.js +1 -0
- package/dist/src/public/sandbox/microsandbox-sandbox.d.ts +3 -3
- package/dist/src/public/sandbox/microsandbox.d.ts +2 -0
- package/dist/src/public/sandbox/microsandbox.js +1 -0
- package/dist/src/public/sandbox/vercel-sandbox.d.ts +6 -2
- package/dist/src/public/sandbox/vercel.d.ts +2 -0
- package/dist/src/public/sandbox/vercel.js +1 -0
- package/dist/src/runtime/resolve-sandbox.d.ts +1 -1
- package/dist/src/runtime/resolve-sandbox.js +1 -1
- package/dist/src/runtime/sandbox/registry.d.ts +2 -2
- package/dist/src/runtime/sandbox/registry.js +1 -1
- package/dist/src/runtime/types.d.ts +2 -2
- package/dist/src/setup/scaffold/create/add-to-project.js +1 -1
- package/dist/src/setup/scaffold/create/project.js +2 -2
- package/dist/src/setup/scaffold/update/channels.js +1 -1
- package/dist/src/shared/sandbox-backend.d.ts +4 -4
- package/dist/src/shared/sandbox-definition.d.ts +4 -4
- package/docs/guides/deployment.md +4 -3
- package/docs/sandbox.mdx +22 -20
- package/package.json +22 -2
- package/dist/src/compiled/_chunks/node/auth-BsyzphzW.js +0 -2
- package/dist/src/compiled/_chunks/node/version-BGue04qw.js +0 -1
- package/dist/src/execution/sandbox/bindings/vercel-create-api.js +0 -1
package/docs/sandbox.mdx
CHANGED
|
@@ -90,10 +90,11 @@ To add setup, seed files, or pick a backend, author `defineSandbox`. There are t
|
|
|
90
90
|
- `agent/sandbox/sandbox.ts`: folder layout. Use it when you also seed `agent/sandbox/workspace/**`. If both exist, the folder layout wins.
|
|
91
91
|
|
|
92
92
|
```ts title="agent/sandbox/sandbox.ts"
|
|
93
|
-
import { defineSandbox
|
|
93
|
+
import { defineSandbox } from "eve/sandbox";
|
|
94
|
+
import { vercel } from "eve/sandbox/vercel";
|
|
94
95
|
|
|
95
96
|
export default defineSandbox({
|
|
96
|
-
backend:
|
|
97
|
+
backend: vercel({ runtime: "node24", resources: { vcpus: 2 } }),
|
|
97
98
|
revalidationKey: () => "repo-bootstrap-v1",
|
|
98
99
|
async bootstrap({ use }) {
|
|
99
100
|
const sandbox = await use();
|
|
@@ -105,21 +106,21 @@ export default defineSandbox({
|
|
|
105
106
|
});
|
|
106
107
|
```
|
|
107
108
|
|
|
108
|
-
`defineSandbox`
|
|
109
|
+
`defineSandbox` and `defaultBackend` live on `eve/sandbox`. Omit `backend` and the runtime falls back to `defaultBackend()` (see [Backends](#backends)).
|
|
109
110
|
|
|
110
111
|
## Backends
|
|
111
112
|
|
|
112
|
-
The backend decides where the sandbox runs. Eve ships four pinned factories plus an availability-aware default from `eve/sandbox`:
|
|
113
|
+
The backend decides where the sandbox runs. Eve ships four pinned factories from nested `eve/sandbox/*` imports plus an availability-aware default from `eve/sandbox`:
|
|
113
114
|
|
|
114
|
-
| Backend
|
|
115
|
-
|
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `defaultBackend()`
|
|
115
|
+
| Backend | Runs the sandbox |
|
|
116
|
+
| ------------------ | ---------------------------------------------------------------------------------------------- |
|
|
117
|
+
| `vercel()` | on [Vercel Sandbox](https://vercel.com/docs/sandbox). |
|
|
118
|
+
| `docker()` | locally in a Docker container, driven through the `docker` CLI. |
|
|
119
|
+
| `microsandbox()` | locally in a lightweight [microsandbox](https://www.npmjs.com/package/microsandbox) VM. |
|
|
120
|
+
| `justbash()` | locally in the pure-JS `just-bash` interpreter — no daemon or VM, but no real binaries either. |
|
|
121
|
+
| `defaultBackend()` | picks the best available: Vercel Sandbox on hosted Vercel → Docker → microsandbox → just-bash. |
|
|
121
122
|
|
|
122
|
-
Configuring a pinned factory uses that backend unconditionally — `
|
|
123
|
+
Configuring a pinned factory uses that backend unconditionally — `docker()` always requires a reachable Docker daemon, `vercel()` always creates hosted sandboxes (including from local dev, with Vercel credentials).
|
|
123
124
|
|
|
124
125
|
With `backend` omitted, Eve uses `defaultBackend()`, which resolves on first use in priority order:
|
|
125
126
|
|
|
@@ -136,7 +137,7 @@ import { defaultBackend, defineSandbox } from "eve/sandbox";
|
|
|
136
137
|
export default defineSandbox({
|
|
137
138
|
backend: defaultBackend({
|
|
138
139
|
vercel: { networkPolicy: "deny-all", resources: { vcpus: 4 } },
|
|
139
|
-
docker: { image: "
|
|
140
|
+
docker: { image: "ghcr.io/vercel/eve:latest" },
|
|
140
141
|
microsandbox: { memoryMiB: 2048 },
|
|
141
142
|
}),
|
|
142
143
|
});
|
|
@@ -144,15 +145,15 @@ export default defineSandbox({
|
|
|
144
145
|
|
|
145
146
|
### Docker
|
|
146
147
|
|
|
147
|
-
`
|
|
148
|
+
`docker()` drives the Docker CLI directly. The default base image is `ghcr.io/vercel/eve:latest`, Eve's published sandbox runtime image; Eve creates `/workspace` and verifies Bash during framework setup before authored bootstrap code runs. Configure it through `docker({ image, env, pullPolicy, networkPolicy })`; install authored runtime tools in sandbox bootstrap or provide them through a custom image. Templates are committed as local Docker images and reused across sessions when the sandbox source, seed files, `revalidationKey`, and Docker backend options still match; sessions run as long-lived containers whose filesystems persist `/workspace` changes across turns for the same durable session. `eve dev` prunes stale template images in the background.
|
|
148
149
|
|
|
149
150
|
### microsandbox
|
|
150
151
|
|
|
151
|
-
`
|
|
152
|
+
`microsandbox()` runs each sandbox in a lightweight local VM with snapshot-backed templates, a `vercel-sandbox` user, and a firewall capable of domain-level network policies and credential brokering — the closest local match to hosted Vercel Sandbox. The default base image is `ghcr.io/vercel/eve:latest`, Eve's published sandbox runtime image; Eve verifies Bash, creates `/workspace`, and creates the sandbox user during framework setup before authored bootstrap code runs. Install authored runtime tools in sandbox bootstrap or provide them through a custom image. Supported hosts: macOS on Apple Silicon, or Linux (glibc) with KVM. The `microsandbox` npm package and its VM runtime are not bundled with Eve: `eve dev` installs both automatically when missing (disable with `setup: { autoInstall: false }`); production processes fail with actionable install errors instead.
|
|
152
153
|
|
|
153
154
|
### just-bash
|
|
154
155
|
|
|
155
|
-
`
|
|
156
|
+
`justbash()` needs no daemon or VM, but commands run in a simulated bash with a virtual filesystem under `.eve/sandbox-cache/` — no real binaries (`git`, `node`, package managers) and no network isolation. The `just-bash` package is an optional peer dependency: `eve dev` installs it into your application automatically when missing (disable with `autoInstall: false`); production processes fail with an actionable install error instead.
|
|
156
157
|
|
|
157
158
|
You can write your own backend too: a `SandboxBackend` is just an object with a `name`, a `create`, and an optional `prewarm`. See the `SandboxBackend*` types on `eve/sandbox`.
|
|
158
159
|
|
|
@@ -164,10 +165,11 @@ There are two hooks, scoped differently:
|
|
|
164
165
|
- **`onSession({ use, ctx })`** is durable-session-scoped and runs once per session. This is where per-session setup goes: network policy, resources, timeout, per-user credentials, one-time markers. Because it runs inside the active runtime context, it can read `ctx.session` and derive the current principal without baking credentials into the template. Call `use(opts?)` to get a `SandboxSession`; `opts` flow to the backend's update path after create.
|
|
165
166
|
|
|
166
167
|
```ts
|
|
167
|
-
import { defineSandbox
|
|
168
|
+
import { defineSandbox } from "eve/sandbox";
|
|
169
|
+
import { vercel } from "eve/sandbox/vercel";
|
|
168
170
|
|
|
169
171
|
export default defineSandbox({
|
|
170
|
-
backend:
|
|
172
|
+
backend: vercel(),
|
|
171
173
|
async onSession({ use, ctx }) {
|
|
172
174
|
const sandbox = await use({ networkPolicy: "deny-all" });
|
|
173
175
|
const user = ctx.session.auth.current;
|
|
@@ -193,9 +195,9 @@ networkPolicy: {
|
|
|
193
195
|
};
|
|
194
196
|
```
|
|
195
197
|
|
|
196
|
-
Set it on the factory (`
|
|
198
|
+
Set it on the factory (`vercel({ networkPolicy: "deny-all" })`) and it applies before authored `bootstrap` code runs; framework-owned base setup may briefly keep egress open to install required packages. Set it in `onSession`'s `use()` to override per-session. The common pattern combines both: leave the factory open so `bootstrap` can `git clone`, then lock down in `onSession`. And to change the policy mid-turn, call `sandbox.setNetworkPolicy(...)` on the live handle.
|
|
197
199
|
|
|
198
|
-
Domain-level allow-lists and credential brokering are supported by `
|
|
200
|
+
Domain-level allow-lists and credential brokering are supported by `vercel()` and `microsandbox()`. The Docker backend honors only `"allow-all"` and `"deny-all"` (at creation and via `setNetworkPolicy`); the just-bash backend rejects `setNetworkPolicy` entirely.
|
|
199
201
|
|
|
200
202
|
## Credential brokering
|
|
201
203
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eve",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Filesystem-first framework for durable backend AI agents that run anywhere.",
|
|
6
6
|
"keywords": [
|
|
@@ -131,6 +131,26 @@
|
|
|
131
131
|
"import": "./dist/src/public/sandbox/index.js",
|
|
132
132
|
"default": "./dist/src/public/sandbox/index.js"
|
|
133
133
|
},
|
|
134
|
+
"./sandbox/docker": {
|
|
135
|
+
"types": "./dist/src/public/sandbox/docker.d.ts",
|
|
136
|
+
"import": "./dist/src/public/sandbox/docker.js",
|
|
137
|
+
"default": "./dist/src/public/sandbox/docker.js"
|
|
138
|
+
},
|
|
139
|
+
"./sandbox/just-bash": {
|
|
140
|
+
"types": "./dist/src/public/sandbox/just-bash.d.ts",
|
|
141
|
+
"import": "./dist/src/public/sandbox/just-bash.js",
|
|
142
|
+
"default": "./dist/src/public/sandbox/just-bash.js"
|
|
143
|
+
},
|
|
144
|
+
"./sandbox/microsandbox": {
|
|
145
|
+
"types": "./dist/src/public/sandbox/microsandbox.d.ts",
|
|
146
|
+
"import": "./dist/src/public/sandbox/microsandbox.js",
|
|
147
|
+
"default": "./dist/src/public/sandbox/microsandbox.js"
|
|
148
|
+
},
|
|
149
|
+
"./sandbox/vercel": {
|
|
150
|
+
"types": "./dist/src/public/sandbox/vercel.d.ts",
|
|
151
|
+
"import": "./dist/src/public/sandbox/vercel.js",
|
|
152
|
+
"default": "./dist/src/public/sandbox/vercel.js"
|
|
153
|
+
},
|
|
134
154
|
"./evals": {
|
|
135
155
|
"types": "./dist/src/evals/index.d.ts",
|
|
136
156
|
"import": "./dist/src/evals/index.js",
|
|
@@ -264,7 +284,7 @@
|
|
|
264
284
|
"@types/react": "19.2.15",
|
|
265
285
|
"@types/react-test-renderer": "19.1.0",
|
|
266
286
|
"@vercel/oidc": "3.5.0",
|
|
267
|
-
"@vercel/sandbox": "2.1
|
|
287
|
+
"@vercel/sandbox": "2.2.1",
|
|
268
288
|
"@workflow/core": "5.0.0-beta.15",
|
|
269
289
|
"@workflow/errors": "5.0.0-beta.7",
|
|
270
290
|
"@workflow/world": "5.0.0-beta.9",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{c as e,o as t,r as n}from"./dist-BdTs18CF.js";import{n as r,t as i}from"./version-BGue04qw.js";import*as a from"node:path";import o from"node:path";import{homedir as s}from"node:os";import c from"node:fs";import{setTimeout as l}from"node:timers/promises";import*as u from"node:fs/promises";import d from"os";const f=r.string().transform((e,t)=>{try{return JSON.parse(e)}catch(e){return t.addIssue({code:r.ZodIssueCode.custom,message:`Invalid JSON: ${e.message}`}),r.NEVER}});var p=n(((e,n)=>{let r=t(`os`),i=t(`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(((e,n)=>{let r=t(`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=e(n(((e,n)=>{let r=t(`path`),i=t(`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 e{constructor(n={name:null,suffix:null,isolated:!0}){let i=function(t={name:null,suffix:null,isolated:!0}){return new e(t)};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?!0:n.isolated;if(typeof u!=`boolean`)throw TypeError(`Expected boolean for "isolated" argument, got ${typeof u}`);a||=r.parse(process.pkg?process.execPath:t.main?t.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=r.number().transform(e=>new Date(e*1e3)),_=r.object({token:r.string().min(1).optional(),refreshToken:r.string().min(1).optional(),expiresAt:g.optional()}),v=f.pipe(_),y=e=>{try{return c.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,o.join(s(),`.now`),...(0,h.default)(`now`).dataDirs()].find(e=>y(e))||e[0]},x=()=>{try{let e=o.join(b(),`auth.json`);return v.parse(c.readFileSync(e,`utf8`))}catch{return null}};function S(e){let t=o.join(b(),`auth.json`);c.mkdirSync(o.dirname(t),{recursive:!0});let n={token:e.token,expiresAt:e.expiresAt&&Math.round(e.expiresAt.getTime()/1e3),refreshToken:e.refreshToken};c.writeFileSync(t,JSON.stringify(n)+`
|
|
2
|
-
`)}const C=`${d.hostname()} @ vercel/sandbox/${i} node-${process.version} ${d.platform()} (${d.arch()})`,w=new URL(`https://vercel.com`),T=`cl_HYyOPBNtFMfHhaUn9L4QPfTZz6TP47bp`,E=r.object({issuer:r.string().url(),device_authorization_endpoint:r.string().url(),token_endpoint:r.string().url(),revocation_endpoint:r.string().url(),jwks_uri:r.string().url(),introspection_endpoint:r.string().url()});let D;const O=r.object({device_code:r.string(),user_code:r.string(),verification_uri:r.string().url(),verification_uri_complete:r.string().url(),expires_in:r.number(),interval:r.number()}),k=r.object({active:r.literal(!0),client_id:r.string(),session_id:r.string()}).or(r.object({active:r.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: ${n.error.message}`,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(10*1e3)})]}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: ${n.error.message}`,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: ${r.error.message}`,n);return r.data}}}const M=r.object({access_token:r.string(),token_type:r.literal(`Bearer`),expires_in:r.number(),refresh_token:r.string().optional(),scope:r.string().optional()}),N=r.object({error:r.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:r.string().optional(),error_uri:r.string().optional()});function P(e){try{return N.parse(e)}catch(e){return e instanceof r.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){let e=`Unexpected server response: ${JSON.stringify(t)}`;this.cause=Error(e,{cause:n}),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 l(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 l(r,{signal:n.signal});continue;case`slow_down`:r+=5*1e3,yield{_tag:`SlowDown`,newInterval:r},await l(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(r.object({projectId:r.string(),orgId:r.string()}));async function V(e){let t=a.join(e,`.vercel`,`project.json`),n;try{n=await u.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=r.object({user:r.object({defaultTeamId:r.string().nullable(),username:r.string()})}),U=r.object({id:r.string(),slug:r.string(),updatedAt:r.number(),membership:r.object({role:r.string()}),billing:r.object({plan:r.string()})}),W=r.object({teams:r.array(U),pagination:r.object({count:r.number(),next:r.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:i}=(await z({token:e.token,endpoint:`/v2/user`}).then(H.parse)).user;if(n)try{let t=await J(e.token,n);try{let i=await z({token:e.token,endpoint:`/v2/teams/${encodeURIComponent(n)}`}).then(r.object({slug:r.string()}).parse);return{...t,teamSlug:i.slug}}catch{return t}}catch(e){if(!K(e))throw e}let a=null;do{let t=a===null?`/v2/teams?limit=20`:`/v2/teams?limit=20&until=${a}`,r=await z({token:e.token,endpoint:t}).then(W.parse);a=r.pagination.next;let o=r.teams.filter(e=>e.membership.role===`OWNER`&&e.billing.plan===`hobby`);if(o.length===0)continue;let s=o.find(e=>e.slug===i)??o.sort((e,t)=>t.updatedAt-e.updatedAt)[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(a!==null);try{return{...await J(e.token,i),teamSlug:i}}catch(e){if(!K(e))throw e}throw new R({statusCode:403,responseText:`Authenticated as "${i}" but none of the available teams allow sandbox creation. Specify a team explicitly with --scope <team-id-or-slug>.`})}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 i=t.startsWith(`team_`)?`teamId=${encodeURIComponent(t)}`:`slug=${encodeURIComponent(t)}`,[a,o]=await Promise.all([z({token:e,endpoint:`/v2/teams/${encodeURIComponent(t)}`}).then(r.object({slug:r.string()}).parse),z({token:e,endpoint:`/v2/projects/${encodeURIComponent(n)}?${i}`}).then(r.object({name:r.string()}).parse)]);return{teamSlug:a.slug,projectSlug:o.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e;(function(e){e.assertEqual=e=>e;function t(e){}e.assertIs=t;function n(e){throw Error()}e.assertNever=n,e.arrayToEnum=e=>{let t={};for(let n of e)t[n]=n;return t},e.getValidEnumValues=t=>{let n=e.objectKeys(t).filter(e=>typeof t[t[e]]!=`number`),r={};for(let e of n)r[e]=t[e];return e.objectValues(r)},e.objectValues=t=>e.objectKeys(t).map(function(e){return t[e]}),e.objectKeys=typeof Object.keys==`function`?e=>Object.keys(e):e=>{let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},e.find=(e,t)=>{for(let n of e)if(t(n))return n},e.isInteger=typeof Number.isInteger==`function`?e=>Number.isInteger(e):e=>typeof e==`number`&&isFinite(e)&&Math.floor(e)===e;function r(e,t=` | `){return e.map(e=>typeof e==`string`?`'${e}'`:e).join(t)}e.joinValues=r,e.jsonStringifyReplacer=(e,t)=>typeof t==`bigint`?t.toString():t})(e||={});var t;(function(e){e.mergeShapes=(e,t)=>({...e,...t})})(t||={});const n=e.arrayToEnum([`string`,`nan`,`number`,`integer`,`float`,`boolean`,`date`,`bigint`,`symbol`,`function`,`undefined`,`null`,`array`,`object`,`unknown`,`promise`,`void`,`never`,`map`,`set`]),r=e=>{switch(typeof e){case`undefined`:return n.undefined;case`string`:return n.string;case`number`:return isNaN(e)?n.nan:n.number;case`boolean`:return n.boolean;case`function`:return n.function;case`bigint`:return n.bigint;case`symbol`:return n.symbol;case`object`:return Array.isArray(e)?n.array:e===null?n.null:e.then&&typeof e.then==`function`&&e.catch&&typeof e.catch==`function`?n.promise:typeof Map<`u`&&e instanceof Map?n.map:typeof Set<`u`&&e instanceof Set?n.set:typeof Date<`u`&&e instanceof Date?n.date:n.object;default:return n.unknown}},i=e.arrayToEnum([`invalid_type`,`invalid_literal`,`custom`,`invalid_union`,`invalid_union_discriminator`,`invalid_enum_value`,`unrecognized_keys`,`invalid_arguments`,`invalid_return_type`,`invalid_date`,`invalid_string`,`too_small`,`too_big`,`invalid_intersection_types`,`not_multiple_of`,`not_finite`]),a=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,`$1:`);var o=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name=`ZodError`,this.issues=e}format(e){let t=e||function(e){return e.message},n={_errors:[]},r=e=>{for(let i of e.issues)if(i.code===`invalid_union`)i.unionErrors.map(r);else if(i.code===`invalid_return_type`)r(i.returnTypeError);else if(i.code===`invalid_arguments`)r(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let e=n,r=0;for(;r<i.path.length;){let n=i.path[r];r===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],r++}}};return r(this),n}static assert(e){if(!(e instanceof t))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=e=>e.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};o.create=e=>new o(e);const s=(t,r)=>{let a;switch(t.code){case i.invalid_type:a=t.received===n.undefined?`Required`:`Expected ${t.expected}, received ${t.received}`;break;case i.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case i.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,`, `)}`;break;case i.invalid_union:a=`Invalid input`;break;case i.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case i.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.received}'`;break;case i.invalid_arguments:a=`Invalid function arguments`;break;case i.invalid_return_type:a=`Invalid function return type`;break;case i.invalid_date:a=`Invalid date`;break;case i.invalid_string:typeof t.validation==`object`?`includes`in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position==`number`&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):`startsWith`in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:`endsWith`in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a=t.validation===`regex`?`Invalid`:`Invalid ${t.validation}`;break;case i.too_small:a=t.type===`array`?`Array must contain ${t.exact?`exactly`:t.inclusive?`at least`:`more than`} ${t.minimum} element(s)`:t.type===`string`?`String must contain ${t.exact?`exactly`:t.inclusive?`at least`:`over`} ${t.minimum} character(s)`:t.type===`number`?`Number must be ${t.exact?`exactly equal to `:t.inclusive?`greater than or equal to `:`greater than `}${t.minimum}`:t.type===`date`?`Date must be ${t.exact?`exactly equal to `:t.inclusive?`greater than or equal to `:`greater than `}${new Date(Number(t.minimum))}`:`Invalid input`;break;case i.too_big:a=t.type===`array`?`Array must contain ${t.exact?`exactly`:t.inclusive?`at most`:`less than`} ${t.maximum} element(s)`:t.type===`string`?`String must contain ${t.exact?`exactly`:t.inclusive?`at most`:`under`} ${t.maximum} character(s)`:t.type===`number`?`Number must be ${t.exact?`exactly`:t.inclusive?`less than or equal to`:`less than`} ${t.maximum}`:t.type===`bigint`?`BigInt must be ${t.exact?`exactly`:t.inclusive?`less than or equal to`:`less than`} ${t.maximum}`:t.type===`date`?`Date must be ${t.exact?`exactly`:t.inclusive?`smaller than or equal to`:`smaller than`} ${new Date(Number(t.maximum))}`:`Invalid input`;break;case i.custom:a=`Invalid input`;break;case i.invalid_intersection_types:a=`Intersection results could not be merged`;break;case i.not_multiple_of:a=`Number must be a multiple of ${t.multipleOf}`;break;case i.not_finite:a=`Number must be finite`;break;default:a=r.defaultError,e.assertNever(t)}return{message:a}};let c=s;function ee(e){c=e}function te(){return c}const ne=e=>{let{data:t,path:n,errorMaps:r,issueData:i}=e,a=[...n,...i.path||[]],o={...i,path:a};if(i.message!==void 0)return{...i,path:a,message:i.message};let s=``,c=r.filter(e=>!!e).slice().reverse();for(let e of c)s=e(o,{data:t,defaultError:s}).message;return{...i,path:a,message:s}},re=[];function l(e,t){let n=te(),r=ne({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===s?void 0:s].filter(e=>!!e)});e.common.issues.push(r)}var u=class e{constructor(){this.value=`valid`}dirty(){this.value===`valid`&&(this.value=`dirty`)}abort(){this.value!==`aborted`&&(this.value=`aborted`)}static mergeArray(e,t){let n=[];for(let r of t){if(r.status===`aborted`)return d;r.status===`dirty`&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(t,n){let r=[];for(let e of n){let t=await e.key,n=await e.value;r.push({key:t,value:n})}return e.mergeObjectSync(t,r)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:t,value:i}=r;if(t.status===`aborted`||i.status===`aborted`)return d;t.status===`dirty`&&e.dirty(),i.status===`dirty`&&e.dirty(),t.value!==`__proto__`&&(i.value!==void 0||r.alwaysSet)&&(n[t.value]=i.value)}return{status:e.value,value:n}}};const d=Object.freeze({status:`aborted`}),ie=e=>({status:`dirty`,value:e}),f=e=>({status:`valid`,value:e}),ae=e=>e.status===`aborted`,oe=e=>e.status===`dirty`,p=e=>e.status===`valid`,m=e=>typeof Promise<`u`&&e instanceof Promise;function h(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}function se(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}var g;(function(e){e.errToObj=e=>typeof e==`string`?{message:e}:e||{},e.toString=e=>typeof e==`string`?e:e?.message})(g||={});var _,v,y=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const ce=(e,t)=>{if(p(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error(`Validation failed but no issues detected.`);return{success:!1,get error(){if(this._error)return this._error;let t=new o(e.common.issues);return this._error=t,this._error}}};function b(e){if(!e)return{};let{errorMap:t,invalid_type_error:n,required_error:r,description:i}=e;if(t&&(n||r))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(t,i)=>{let{message:a}=e;return t.code===`invalid_enum_value`?{message:a??i.defaultError}:i.data===void 0?{message:a??r??i.defaultError}:t.code===`invalid_type`?{message:a??n??i.defaultError}:{message:i.defaultError}},description:i}}var x=class{get description(){return this._def.description}_getType(e){return r(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new u,ctx:{common:e.parent.common,data:e.data,parsedType:r(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(m(t))throw Error(`Synchronous parse encountered promise.`);return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){let n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)};return ce(n,this._parseSync({data:e,path:n.path,parent:n}))}"~validate"(e){let t={common:{issues:[],async:!!this[`~standard`].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)};if(!this[`~standard`].async)try{let n=this._parseSync({data:e,path:[],parent:t});return p(n)?{value:n.value}:{issues:t.common.issues}}catch(e){((e?.message)?.toLowerCase())?.includes(`encountered`)&&(this[`~standard`].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(e=>p(e)?{value:e.value}:{issues:t.common.issues})}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:r(e)},i=this._parse({data:e,path:n.path,parent:n});return ce(n,await(m(i)?i:Promise.resolve(i)))}refine(e,t){let n=e=>typeof t==`string`||t===void 0?{message:t}:typeof t==`function`?t(e):t;return this._refinement((t,r)=>{let a=e(t),o=()=>r.addIssue({code:i.custom,...n(t)});return typeof Promise<`u`&&a instanceof Promise?a.then(e=>e?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t==`function`?t(n,r):t),!1))}_refinement(e){return new q({schema:this,typeName:$.ZodEffects,effect:{type:`refinement`,refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this[`~standard`]={version:1,vendor:`zod`,validate:e=>this[`~validate`](e)}}optional(){return J.create(this,this._def)}nullable(){return Y.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return N.create(this)}promise(){return K.create(this,this._def)}or(e){return I.create([this,e],this._def)}and(e){return R.create(this,e,this._def)}transform(e){return new q({...b(this._def),schema:this,typeName:$.ZodEffects,effect:{type:`transform`,transform:e}})}default(e){let t=typeof e==`function`?e:()=>e;return new X({...b(this._def),innerType:this,defaultValue:t,typeName:$.ZodDefault})}brand(){return new Ve({typeName:$.ZodBranded,type:this,...b(this._def)})}catch(e){let t=typeof e==`function`?e:()=>e;return new Z({...b(this._def),innerType:this,catchValue:t,typeName:$.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return He.create(this,e)}readonly(){return Q.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const le=/^c[^\s-]{8,}$/i,ue=/^[0-9a-z]+$/,de=/^[0-9A-HJKMNP-TV-Z]{26}$/i,fe=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,pe=/^[a-z0-9_-]{21}$/i,me=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,he=/^[-+]?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)?)??$/,ge=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let _e;const ve=/^(?:(?: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])$/,ye=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,be=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,xe=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Se=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ce=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,we=`((\\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])))`,Te=RegExp(`^${we}$`);function Ee(e){let t=`[0-5]\\d`;e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision??(t=`${t}(\\.\\d+)?`);let n=e.precision?`+`:`?`;return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function De(e){return RegExp(`^${Ee(e)}$`)}function Oe(e){let t=`${we}T${Ee(e)}`,n=[];return n.push(e.local?`Z?`:`Z`),e.offset&&n.push(`([+-]\\d{2}:?\\d{2})`),t=`${t}(${n.join(`|`)})`,RegExp(`^${t}$`)}function ke(e,t){return!!((t===`v4`||!t)&&ve.test(e)||(t===`v6`||!t)&&be.test(e))}function Ae(e,t){if(!me.test(e))return!1;try{let[n]=e.split(`.`),r=n.replace(/-/g,`+`).replace(/_/g,`/`).padEnd(n.length+(4-n.length%4)%4,`=`),i=JSON.parse(atob(r));return!(typeof i!=`object`||!i||!i.typ||!i.alg||t&&i.alg!==t)}catch{return!1}}function je(e,t){return!!((t===`v4`||!t)&&ye.test(e)||(t===`v6`||!t)&&xe.test(e))}var S=class t extends x{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==n.string){let e=this._getOrReturnCtx(t);return l(e,{code:i.invalid_type,expected:n.string,received:e.parsedType}),d}let r=new u,a;for(let n of this._def.checks)if(n.kind===`min`)t.data.length<n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_small,minimum:n.value,type:`string`,inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind===`max`)t.data.length>n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_big,maximum:n.value,type:`string`,inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind===`length`){let e=t.data.length>n.value,o=t.data.length<n.value;(e||o)&&(a=this._getOrReturnCtx(t,a),e?l(a,{code:i.too_big,maximum:n.value,type:`string`,inclusive:!0,exact:!0,message:n.message}):o&&l(a,{code:i.too_small,minimum:n.value,type:`string`,inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind===`email`)ge.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`email`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`emoji`)_e||=RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`),_e.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`emoji`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`uuid`)fe.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`uuid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`nanoid`)pe.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`nanoid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`cuid`)le.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`cuid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`cuid2`)ue.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`cuid2`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`ulid`)de.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`ulid`,code:i.invalid_string,message:n.message}),r.dirty());else if(n.kind===`url`)try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),l(a,{validation:`url`,code:i.invalid_string,message:n.message}),r.dirty()}else n.kind===`regex`?(n.regex.lastIndex=0,n.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`regex`,code:i.invalid_string,message:n.message}),r.dirty())):n.kind===`trim`?t.data=t.data.trim():n.kind===`includes`?t.data.includes(n.value,n.position)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind===`toLowerCase`?t.data=t.data.toLowerCase():n.kind===`toUpperCase`?t.data=t.data.toUpperCase():n.kind===`startsWith`?t.data.startsWith(n.value)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind===`endsWith`?t.data.endsWith(n.value)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind===`datetime`?Oe(n).test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:`datetime`,message:n.message}),r.dirty()):n.kind===`date`?Te.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:`date`,message:n.message}),r.dirty()):n.kind===`time`?De(n).test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{code:i.invalid_string,validation:`time`,message:n.message}),r.dirty()):n.kind===`duration`?he.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`duration`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`ip`?ke(t.data,n.version)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`ip`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`jwt`?Ae(t.data,n.alg)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`jwt`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`cidr`?je(t.data,n.version)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`cidr`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`base64`?Se.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`base64`,code:i.invalid_string,message:n.message}),r.dirty()):n.kind===`base64url`?Ce.test(t.data)||(a=this._getOrReturnCtx(t,a),l(a,{validation:`base64url`,code:i.invalid_string,message:n.message}),r.dirty()):e.assertNever(n);return{status:r.value,value:t.data}}_regex(e,t,n){return this.refinement(t=>e.test(t),{validation:t,code:i.invalid_string,...g.errToObj(n)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:`email`,...g.errToObj(e)})}url(e){return this._addCheck({kind:`url`,...g.errToObj(e)})}emoji(e){return this._addCheck({kind:`emoji`,...g.errToObj(e)})}uuid(e){return this._addCheck({kind:`uuid`,...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:`nanoid`,...g.errToObj(e)})}cuid(e){return this._addCheck({kind:`cuid`,...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:`cuid2`,...g.errToObj(e)})}ulid(e){return this._addCheck({kind:`ulid`,...g.errToObj(e)})}base64(e){return this._addCheck({kind:`base64`,...g.errToObj(e)})}base64url(e){return this._addCheck({kind:`base64url`,...g.errToObj(e)})}jwt(e){return this._addCheck({kind:`jwt`,...g.errToObj(e)})}ip(e){return this._addCheck({kind:`ip`,...g.errToObj(e)})}cidr(e){return this._addCheck({kind:`cidr`,...g.errToObj(e)})}datetime(e){return typeof e==`string`?this._addCheck({kind:`datetime`,precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:`datetime`,precision:e?.precision===void 0?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...g.errToObj(e?.message)})}date(e){return this._addCheck({kind:`date`,message:e})}time(e){return typeof e==`string`?this._addCheck({kind:`time`,precision:null,message:e}):this._addCheck({kind:`time`,precision:e?.precision===void 0?null:e?.precision,...g.errToObj(e?.message)})}duration(e){return this._addCheck({kind:`duration`,...g.errToObj(e)})}regex(e,t){return this._addCheck({kind:`regex`,regex:e,...g.errToObj(t)})}includes(e,t){return this._addCheck({kind:`includes`,value:e,position:t?.position,...g.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:`startsWith`,value:e,...g.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:`endsWith`,value:e,...g.errToObj(t)})}min(e,t){return this._addCheck({kind:`min`,value:e,...g.errToObj(t)})}max(e,t){return this._addCheck({kind:`max`,value:e,...g.errToObj(t)})}length(e,t){return this._addCheck({kind:`length`,value:e,...g.errToObj(t)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:`trim`}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:`toLowerCase`}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:`toUpperCase`}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind===`datetime`)}get isDate(){return!!this._def.checks.find(e=>e.kind===`date`)}get isTime(){return!!this._def.checks.find(e=>e.kind===`time`)}get isDuration(){return!!this._def.checks.find(e=>e.kind===`duration`)}get isEmail(){return!!this._def.checks.find(e=>e.kind===`email`)}get isURL(){return!!this._def.checks.find(e=>e.kind===`url`)}get isEmoji(){return!!this._def.checks.find(e=>e.kind===`emoji`)}get isUUID(){return!!this._def.checks.find(e=>e.kind===`uuid`)}get isNANOID(){return!!this._def.checks.find(e=>e.kind===`nanoid`)}get isCUID(){return!!this._def.checks.find(e=>e.kind===`cuid`)}get isCUID2(){return!!this._def.checks.find(e=>e.kind===`cuid2`)}get isULID(){return!!this._def.checks.find(e=>e.kind===`ulid`)}get isIP(){return!!this._def.checks.find(e=>e.kind===`ip`)}get isCIDR(){return!!this._def.checks.find(e=>e.kind===`cidr`)}get isBase64(){return!!this._def.checks.find(e=>e.kind===`base64`)}get isBase64url(){return!!this._def.checks.find(e=>e.kind===`base64url`)}get minLength(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};S.create=e=>new S({checks:[],typeName:$.ZodString,coerce:e?.coerce??!1,...b(e)});function Me(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return parseInt(e.toFixed(i).replace(`.`,``))%parseInt(t.toFixed(i).replace(`.`,``))/10**i}var C=class t extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==n.number){let e=this._getOrReturnCtx(t);return l(e,{code:i.invalid_type,expected:n.number,received:e.parsedType}),d}let r,a=new u;for(let n of this._def.checks)n.kind===`int`?e.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),l(r,{code:i.invalid_type,expected:`integer`,received:`float`,message:n.message}),a.dirty()):n.kind===`min`?(n.inclusive?t.data<n.value:t.data<=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_small,minimum:n.value,type:`number`,inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind===`max`?(n.inclusive?t.data>n.value:t.data>=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_big,maximum:n.value,type:`number`,inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty()):n.kind===`multipleOf`?Me(t.data,n.value)!==0&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):n.kind===`finite`?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),l(r,{code:i.not_finite,message:n.message}),a.dirty()):e.assertNever(n);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit(`min`,e,!0,g.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,g.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,g.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,g.toString(t))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:`int`,message:g.toString(e)})}positive(e){return this._addCheck({kind:`min`,value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:g.toString(t)})}finite(e){return this._addCheck({kind:`finite`,message:g.toString(e)})}safe(e){return this._addCheck({kind:`min`,inclusive:!0,value:-(2**53-1),message:g.toString(e)})._addCheck({kind:`max`,inclusive:!0,value:2**53-1,message:g.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(t=>t.kind===`int`||t.kind===`multipleOf`&&e.isInteger(t.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks)if(n.kind===`finite`||n.kind===`int`||n.kind===`multipleOf`)return!0;else n.kind===`min`?(t===null||n.value>t)&&(t=n.value):n.kind===`max`&&(e===null||n.value<e)&&(e=n.value);return Number.isFinite(t)&&Number.isFinite(e)}};C.create=e=>new C({checks:[],typeName:$.ZodNumber,coerce:e?.coerce||!1,...b(e)});var w=class t extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==n.bigint)return this._getInvalidInput(t);let r,a=new u;for(let n of this._def.checks)n.kind===`min`?(n.inclusive?t.data<n.value:t.data<=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_small,type:`bigint`,minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind===`max`?(n.inclusive?t.data>n.value:t.data>=n.value)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.too_big,type:`bigint`,maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty()):n.kind===`multipleOf`?t.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),l(r,{code:i.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):e.assertNever(n);return{status:a.value,value:t.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.bigint,received:t.parsedType}),d}gte(e,t){return this.setLimit(`min`,e,!0,g.toString(t))}gt(e,t){return this.setLimit(`min`,e,!1,g.toString(t))}lte(e,t){return this.setLimit(`max`,e,!0,g.toString(t))}lt(e,t){return this.setLimit(`max`,e,!1,g.toString(t))}setLimit(e,n,r,i){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:g.toString(i)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:`max`,value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:`min`,value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,t){return this._addCheck({kind:`multipleOf`,value:e,message:g.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e}};w.create=e=>new w({checks:[],typeName:$.ZodBigInt,coerce:e?.coerce??!1,...b(e)});var T=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==n.boolean){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.boolean,received:t.parsedType}),d}return f(e.data)}};T.create=e=>new T({typeName:$.ZodBoolean,coerce:e?.coerce||!1,...b(e)});var E=class t extends x{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==n.date){let e=this._getOrReturnCtx(t);return l(e,{code:i.invalid_type,expected:n.date,received:e.parsedType}),d}if(isNaN(t.data.getTime()))return l(this._getOrReturnCtx(t),{code:i.invalid_date}),d;let r=new u,a;for(let n of this._def.checks)n.kind===`min`?t.data.getTime()<n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:`date`}),r.dirty()):n.kind===`max`?t.data.getTime()>n.value&&(a=this._getOrReturnCtx(t,a),l(a,{code:i.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:`date`}),r.dirty()):e.assertNever(n);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:`min`,value:e.getTime(),message:g.toString(t)})}max(e,t){return this._addCheck({kind:`max`,value:e.getTime(),message:g.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind===`min`&&(e===null||t.value>e)&&(e=t.value);return e==null?null:new Date(e)}get maxDate(){let e=null;for(let t of this._def.checks)t.kind===`max`&&(e===null||t.value<e)&&(e=t.value);return e==null?null:new Date(e)}};E.create=e=>new E({checks:[],coerce:e?.coerce||!1,typeName:$.ZodDate,...b(e)});var Ne=class extends x{_parse(e){if(this._getType(e)!==n.symbol){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.symbol,received:t.parsedType}),d}return f(e.data)}};Ne.create=e=>new Ne({typeName:$.ZodSymbol,...b(e)});var D=class extends x{_parse(e){if(this._getType(e)!==n.undefined){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.undefined,received:t.parsedType}),d}return f(e.data)}};D.create=e=>new D({typeName:$.ZodUndefined,...b(e)});var O=class extends x{_parse(e){if(this._getType(e)!==n.null){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.null,received:t.parsedType}),d}return f(e.data)}};O.create=e=>new O({typeName:$.ZodNull,...b(e)});var k=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return f(e.data)}};k.create=e=>new k({typeName:$.ZodAny,...b(e)});var A=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return f(e.data)}};A.create=e=>new A({typeName:$.ZodUnknown,...b(e)});var j=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.never,received:t.parsedType}),d}};j.create=e=>new j({typeName:$.ZodNever,...b(e)});var M=class extends x{_parse(e){if(this._getType(e)!==n.undefined){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.void,received:t.parsedType}),d}return f(e.data)}};M.create=e=>new M({typeName:$.ZodVoid,...b(e)});var N=class e extends x{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),a=this._def;if(t.parsedType!==n.array)return l(t,{code:i.invalid_type,expected:n.array,received:t.parsedType}),d;if(a.exactLength!==null){let e=t.data.length>a.exactLength.value,n=t.data.length<a.exactLength.value;(e||n)&&(l(t,{code:e?i.too_big:i.too_small,minimum:n?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:`array`,inclusive:!0,exact:!0,message:a.exactLength.message}),r.dirty())}if(a.minLength!==null&&t.data.length<a.minLength.value&&(l(t,{code:i.too_small,minimum:a.minLength.value,type:`array`,inclusive:!0,exact:!1,message:a.minLength.message}),r.dirty()),a.maxLength!==null&&t.data.length>a.maxLength.value&&(l(t,{code:i.too_big,maximum:a.maxLength.value,type:`array`,inclusive:!0,exact:!1,message:a.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,n)=>a.type._parseAsync(new y(t,e,t.path,n)))).then(e=>u.mergeArray(r,e));let o=[...t.data].map((e,n)=>a.type._parseSync(new y(t,e,t.path,n)));return u.mergeArray(r,o)}get element(){return this._def.type}min(t,n){return new e({...this._def,minLength:{value:t,message:g.toString(n)}})}max(t,n){return new e({...this._def,maxLength:{value:t,message:g.toString(n)}})}length(t,n){return new e({...this._def,exactLength:{value:t,message:g.toString(n)}})}nonempty(e){return this.min(1,e)}};N.create=(e,t)=>new N({type:e,minLength:null,maxLength:null,exactLength:null,typeName:$.ZodArray,...b(t)});function P(e){if(e instanceof F){let t={};for(let n in e.shape){let r=e.shape[n];t[n]=J.create(P(r))}return new F({...e._def,shape:()=>t})}else if(e instanceof N)return new N({...e._def,type:P(e.element)});else if(e instanceof J)return J.create(P(e.unwrap()));else if(e instanceof Y)return Y.create(P(e.unwrap()));else if(e instanceof z)return z.create(e.items.map(e=>P(e)));else return e}var F=class t extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(e){if(this._getType(e)!==n.object){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),d}let{status:t,ctx:r}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof j&&this._def.unknownKeys===`strip`))for(let e in r.data)o.includes(e)||s.push(e);let c=[];for(let e of o){let t=a[e],n=r.data[e];c.push({key:{status:`valid`,value:e},value:t._parse(new y(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof j){let e=this._def.unknownKeys;if(e===`passthrough`)for(let e of s)c.push({key:{status:`valid`,value:e},value:{status:`valid`,value:r.data[e]}});else if(e===`strict`)s.length>0&&(l(r,{code:i.unrecognized_keys,keys:s}),t.dirty());else if(e!==`strip`)throw Error(`Internal ZodObject error: invalid unknownKeys value.`)}else{let e=this._def.catchall;for(let t of s){let n=r.data[t];c.push({key:{status:`valid`,value:t},value:e._parse(new y(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of c){let n=await t.key,r=await t.value;e.push({key:n,value:r,alwaysSet:t.alwaysSet})}return e}).then(e=>u.mergeObjectSync(t,e)):u.mergeObjectSync(t,c)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new t({...this._def,unknownKeys:`strict`,...e===void 0?{}:{errorMap:(t,n)=>{var r;let i=(r=this._def).errorMap?.call(r,t,n).message??n.defaultError;return t.code===`unrecognized_keys`?{message:g.errToObj(e).message??i}:{message:i}}}})}strip(){return new t({...this._def,unknownKeys:`strip`})}passthrough(){return new t({...this._def,unknownKeys:`passthrough`})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:$.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new t({...this._def,catchall:e})}pick(n){let r={};return e.objectKeys(n).forEach(e=>{n[e]&&this.shape[e]&&(r[e]=this.shape[e])}),new t({...this._def,shape:()=>r})}omit(n){let r={};return e.objectKeys(this.shape).forEach(e=>{n[e]||(r[e]=this.shape[e])}),new t({...this._def,shape:()=>r})}deepPartial(){return P(this)}partial(n){let r={};return e.objectKeys(this.shape).forEach(e=>{let t=this.shape[e];n&&!n[e]?r[e]=t:r[e]=t.optional()}),new t({...this._def,shape:()=>r})}required(n){let r={};return e.objectKeys(this.shape).forEach(e=>{if(n&&!n[e])r[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof J;)t=t._def.innerType;r[e]=t}}),new t({...this._def,shape:()=>r})}keyof(){return Re(e.objectKeys(this.shape))}};F.create=(e,t)=>new F({shape:()=>e,unknownKeys:`strip`,catchall:j.create(),typeName:$.ZodObject,...b(t)}),F.strictCreate=(e,t)=>new F({shape:()=>e,unknownKeys:`strict`,catchall:j.create(),typeName:$.ZodObject,...b(t)}),F.lazycreate=(e,t)=>new F({shape:e,unknownKeys:`strip`,catchall:j.create(),typeName:$.ZodObject,...b(t)});var I=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(e){for(let t of e)if(t.result.status===`valid`)return t.result;for(let n of e)if(n.result.status===`dirty`)return t.common.issues.push(...n.ctx.common.issues),n.result;let n=e.map(e=>new o(e.ctx.common.issues));return l(t,{code:i.invalid_union,unionErrors:n}),d}if(t.common.async)return Promise.all(n.map(async e=>{let n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}})).then(r);{let e,r=[];for(let i of n){let n={...t,common:{...t.common,issues:[]},parent:null},a=i._parseSync({data:t.data,path:t.path,parent:n});if(a.status===`valid`)return a;a.status===`dirty`&&!e&&(e={result:a,ctx:n}),n.common.issues.length&&r.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let a=r.map(e=>new o(e));return l(t,{code:i.invalid_union,unionErrors:a}),d}}get options(){return this._def.options}};I.create=(e,t)=>new I({options:e,typeName:$.ZodUnion,...b(t)});const L=t=>t instanceof H?L(t.schema):t instanceof q?L(t.innerType()):t instanceof U?[t.value]:t instanceof W?t.options:t instanceof G?e.objectValues(t.enum):t instanceof X?L(t._def.innerType):t instanceof D?[void 0]:t instanceof O?[null]:t instanceof J?[void 0,...L(t.unwrap())]:t instanceof Y?[null,...L(t.unwrap())]:t instanceof Ve||t instanceof Q?L(t.unwrap()):t instanceof Z?L(t._def.innerType):[];var Pe=class e extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.object)return l(t,{code:i.invalid_type,expected:n.object,received:t.parsedType}),d;let r=this.discriminator,a=t.data[r],o=this.optionsMap.get(a);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(l(t,{code:i.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),d)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){let i=new Map;for(let e of n){let n=L(e.shape[t]);if(!n.length)throw Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let r of n){if(i.has(r))throw Error(`Discriminator property ${String(t)} has duplicate value ${String(r)}`);i.set(r,e)}}return new e({typeName:$.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:i,...b(r)})}};function Fe(t,i){let a=r(t),o=r(i);if(t===i)return{valid:!0,data:t};if(a===n.object&&o===n.object){let n=e.objectKeys(i),r=e.objectKeys(t).filter(e=>n.indexOf(e)!==-1),a={...t,...i};for(let e of r){let n=Fe(t[e],i[e]);if(!n.valid)return{valid:!1};a[e]=n.data}return{valid:!0,data:a}}else if(a===n.array&&o===n.array){if(t.length!==i.length)return{valid:!1};let e=[];for(let n=0;n<t.length;n++){let r=t[n],a=i[n],o=Fe(r,a);if(!o.valid)return{valid:!1};e.push(o.data)}return{valid:!0,data:e}}else if(a===n.date&&o===n.date&&+t==+i)return{valid:!0,data:t};else return{valid:!1}}var R=class extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(e,r)=>{if(ae(e)||ae(r))return d;let a=Fe(e.value,r.value);return a.valid?((oe(e)||oe(r))&&t.dirty(),{status:t.value,value:a.data}):(l(n,{code:i.invalid_intersection_types}),d)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([e,t])=>r(e,t)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};R.create=(e,t,n)=>new R({left:e,right:t,typeName:$.ZodIntersection,...b(n)});var z=class e extends x{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.array)return l(r,{code:i.invalid_type,expected:n.array,received:r.parsedType}),d;if(r.data.length<this._def.items.length)return l(r,{code:i.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),d;!this._def.rest&&r.data.length>this._def.items.length&&(l(r,{code:i.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:`array`}),t.dirty());let a=[...r.data].map((e,t)=>{let n=this._def.items[t]||this._def.rest;return n?n._parse(new y(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(a).then(e=>u.mergeArray(t,e)):u.mergeArray(t,a)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};z.create=(e,t)=>{if(!Array.isArray(e))throw Error(`You must pass an array of schemas to z.tuple([ ... ])`);return new z({items:e,typeName:$.ZodTuple,rest:null,...b(t)})};var Ie=class e extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.object)return l(r,{code:i.invalid_type,expected:n.object,received:r.parsedType}),d;let a=[],o=this._def.keyType,s=this._def.valueType;for(let e in r.data)a.push({key:o._parse(new y(r,e,r.path,e)),value:s._parse(new y(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?u.mergeObjectAsync(t,a):u.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(t,n,r){return n instanceof x?new e({keyType:t,valueType:n,typeName:$.ZodRecord,...b(r)}):new e({keyType:S.create(),valueType:t,typeName:$.ZodRecord,...b(n)})}},B=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.map)return l(r,{code:i.invalid_type,expected:n.map,received:r.parsedType}),d;let a=this._def.keyType,o=this._def.valueType,s=[...r.data.entries()].map(([e,t],n)=>({key:a._parse(new y(r,e,r.path,[n,`key`])),value:o._parse(new y(r,t,r.path,[n,`value`]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let n of s){let r=await n.key,i=await n.value;if(r.status===`aborted`||i.status===`aborted`)return d;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}})}else{let e=new Map;for(let n of s){let r=n.key,i=n.value;if(r.status===`aborted`||i.status===`aborted`)return d;(r.status===`dirty`||i.status===`dirty`)&&t.dirty(),e.set(r.value,i.value)}return{status:t.value,value:e}}}};B.create=(e,t,n)=>new B({valueType:t,keyType:e,typeName:$.ZodMap,...b(n)});var V=class e extends x{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==n.set)return l(r,{code:i.invalid_type,expected:n.set,received:r.parsedType}),d;let a=this._def;a.minSize!==null&&r.data.size<a.minSize.value&&(l(r,{code:i.too_small,minimum:a.minSize.value,type:`set`,inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),a.maxSize!==null&&r.data.size>a.maxSize.value&&(l(r,{code:i.too_big,maximum:a.maxSize.value,type:`set`,inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());let o=this._def.valueType;function s(e){let n=new Set;for(let r of e){if(r.status===`aborted`)return d;r.status===`dirty`&&t.dirty(),n.add(r.value)}return{status:t.value,value:n}}let c=[...r.data.values()].map((e,t)=>o._parse(new y(r,e,r.path,t)));return r.common.async?Promise.all(c).then(e=>s(e)):s(c)}min(t,n){return new e({...this._def,minSize:{value:t,message:g.toString(n)}})}max(t,n){return new e({...this._def,maxSize:{value:t,message:g.toString(n)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};V.create=(e,t)=>new V({valueType:e,minSize:null,maxSize:null,typeName:$.ZodSet,...b(t)});var Le=class e extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==n.function)return l(t,{code:i.invalid_type,expected:n.function,received:t.parsedType}),d;function r(e,n){return ne({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,te(),s].filter(e=>!!e),issueData:{code:i.invalid_arguments,argumentsError:n}})}function a(e,n){return ne({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,te(),s].filter(e=>!!e),issueData:{code:i.invalid_return_type,returnTypeError:n}})}let c={errorMap:t.common.contextualErrorMap},ee=t.data;if(this._def.returns instanceof K){let e=this;return f(async function(...t){let n=new o([]),i=await e._def.args.parseAsync(t,c).catch(e=>{throw n.addIssue(r(t,e)),n}),s=await Reflect.apply(ee,this,i);return await e._def.returns._def.type.parseAsync(s,c).catch(e=>{throw n.addIssue(a(s,e)),n})})}else{let e=this;return f(function(...t){let n=e._def.args.safeParse(t,c);if(!n.success)throw new o([r(t,n.error)]);let i=Reflect.apply(ee,this,n.data),s=e._def.returns.safeParse(i,c);if(!s.success)throw new o([a(i,s.error)]);return s.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:z.create(t).rest(A.create())})}returns(t){return new e({...this._def,returns:t})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(t,n,r){return new e({args:t||z.create([]).rest(A.create()),returns:n||A.create(),typeName:$.ZodFunction,...b(r)})}},H=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};H.create=(e,t)=>new H({getter:e,typeName:$.ZodLazy,...b(t)});var U=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:i.invalid_literal,expected:this._def.value}),d}return{status:`valid`,value:e.data}}get value(){return this._def.value}};U.create=(e,t)=>new U({value:e,typeName:$.ZodLiteral,...b(t)});function Re(e,t){return new W({values:e,typeName:$.ZodEnum,...b(t)})}var W=class t extends x{constructor(){super(...arguments),_.set(this,void 0)}_parse(t){if(typeof t.data!=`string`){let n=this._getOrReturnCtx(t),r=this._def.values;return l(n,{expected:e.joinValues(r),received:n.parsedType,code:i.invalid_type}),d}if(h(this,_,`f`)||se(this,_,new Set(this._def.values),`f`),!h(this,_,`f`).has(t.data)){let e=this._getOrReturnCtx(t),n=this._def.values;return l(e,{received:e.data,code:i.invalid_enum_value,options:n}),d}return f(t.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(t=>!e.includes(t)),{...this._def,...n})}};_=new WeakMap,W.create=Re;var G=class extends x{constructor(){super(...arguments),v.set(this,void 0)}_parse(t){let r=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==n.string&&a.parsedType!==n.number){let t=e.objectValues(r);return l(a,{expected:e.joinValues(t),received:a.parsedType,code:i.invalid_type}),d}if(h(this,v,`f`)||se(this,v,new Set(e.getValidEnumValues(this._def.values)),`f`),!h(this,v,`f`).has(t.data)){let t=e.objectValues(r);return l(a,{received:a.data,code:i.invalid_enum_value,options:t}),d}return f(t.data)}get enum(){return this._def.values}};v=new WeakMap,G.create=(e,t)=>new G({values:e,typeName:$.ZodNativeEnum,...b(t)});var K=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==n.promise&&t.common.async===!1?(l(t,{code:i.invalid_type,expected:n.promise,received:t.parsedType}),d):f((t.parsedType===n.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}};K.create=(e,t)=>new K({type:e,typeName:$.ZodPromise,...b(t)});var q=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===$.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:n,ctx:r}=this._processInputParams(t),i=this._def.effect||null,a={addIssue:e=>{l(r,e),e.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),i.type===`preprocess`){let e=i.transform(r.data,a);if(r.common.async)return Promise.resolve(e).then(async e=>{if(n.value===`aborted`)return d;let t=await this._def.schema._parseAsync({data:e,path:r.path,parent:r});return t.status===`aborted`?d:t.status===`dirty`||n.value===`dirty`?ie(t.value):t});{if(n.value===`aborted`)return d;let t=this._def.schema._parseSync({data:e,path:r.path,parent:r});return t.status===`aborted`?d:t.status===`dirty`||n.value===`dirty`?ie(t.value):t}}if(i.type===`refinement`){let e=e=>{let t=i.refinement(e,a);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error(`Async refinement encountered during synchronous parse operation. Use .parseAsync instead.`);return e};if(r.common.async===!1){let t=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return t.status===`aborted`?d:(t.status===`dirty`&&n.dirty(),e(t.value),{status:n.value,value:t.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(t=>t.status===`aborted`?d:(t.status===`dirty`&&n.dirty(),e(t.value).then(()=>({status:n.value,value:t.value}))))}if(i.type===`transform`)if(r.common.async===!1){let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!p(e))return e;let t=i.transform(e.value,a);if(t instanceof Promise)throw Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);return{status:n.value,value:t}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>p(e)?Promise.resolve(i.transform(e.value,a)).then(e=>({status:n.value,value:e})):e);e.assertNever(i)}};q.create=(e,t,n)=>new q({schema:e,typeName:$.ZodEffects,effect:t,...b(n)}),q.createWithPreprocess=(e,t,n)=>new q({schema:t,effect:{type:`preprocess`,transform:e},typeName:$.ZodEffects,...b(n)});var J=class extends x{_parse(e){return this._getType(e)===n.undefined?f(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};J.create=(e,t)=>new J({innerType:e,typeName:$.ZodOptional,...b(t)});var Y=class extends x{_parse(e){return this._getType(e)===n.null?f(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Y.create=(e,t)=>new Y({innerType:e,typeName:$.ZodNullable,...b(t)});var X=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===n.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};X.create=(e,t)=>new X({innerType:e,typeName:$.ZodDefault,defaultValue:typeof t.default==`function`?t.default:()=>t.default,...b(t)});var Z=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return m(r)?r.then(e=>({status:`valid`,value:e.status===`valid`?e.value:this._def.catchValue({get error(){return new o(n.common.issues)},input:n.data})})):{status:`valid`,value:r.status===`valid`?r.value:this._def.catchValue({get error(){return new o(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Z.create=(e,t)=>new Z({innerType:e,typeName:$.ZodCatch,catchValue:typeof t.catch==`function`?t.catch:()=>t.catch,...b(t)});var ze=class extends x{_parse(e){if(this._getType(e)!==n.nan){let t=this._getOrReturnCtx(e);return l(t,{code:i.invalid_type,expected:n.nan,received:t.parsedType}),d}return{status:`valid`,value:e.data}}};ze.create=e=>new ze({typeName:$.ZodNaN,...b(e)});const Be=Symbol(`zod_brand`);var Ve=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},He=class e extends x{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?d:e.status===`dirty`?(t.dirty(),ie(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})();{let e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return e.status===`aborted`?d:e.status===`dirty`?(t.dirty(),{status:`dirty`,value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(t,n){return new e({in:t,out:n,typeName:$.ZodPipeline})}},Q=class extends x{_parse(e){let t=this._def.innerType._parse(e),n=e=>(p(e)&&(e.value=Object.freeze(e.value)),e);return m(t)?t.then(e=>n(e)):n(t)}unwrap(){return this._def.innerType}};Q.create=(e,t)=>new Q({innerType:e,typeName:$.ZodReadonly,...b(t)});function Ue(e,t){let n=typeof e==`function`?e(t):typeof e==`string`?{message:e}:e;return typeof n==`string`?{message:n}:n}function We(e,t={},n){return e?k.create().superRefine((r,i)=>{let a=e(r);if(a instanceof Promise)return a.then(e=>{if(!e){let e=Ue(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}});if(!a){let e=Ue(t,r),a=e.fatal??n??!0;i.addIssue({code:`custom`,...e,fatal:a})}}):k.create()}const Ge={object:F.lazycreate};var $;(function(e){e.ZodString=`ZodString`,e.ZodNumber=`ZodNumber`,e.ZodNaN=`ZodNaN`,e.ZodBigInt=`ZodBigInt`,e.ZodBoolean=`ZodBoolean`,e.ZodDate=`ZodDate`,e.ZodSymbol=`ZodSymbol`,e.ZodUndefined=`ZodUndefined`,e.ZodNull=`ZodNull`,e.ZodAny=`ZodAny`,e.ZodUnknown=`ZodUnknown`,e.ZodNever=`ZodNever`,e.ZodVoid=`ZodVoid`,e.ZodArray=`ZodArray`,e.ZodObject=`ZodObject`,e.ZodUnion=`ZodUnion`,e.ZodDiscriminatedUnion=`ZodDiscriminatedUnion`,e.ZodIntersection=`ZodIntersection`,e.ZodTuple=`ZodTuple`,e.ZodRecord=`ZodRecord`,e.ZodMap=`ZodMap`,e.ZodSet=`ZodSet`,e.ZodFunction=`ZodFunction`,e.ZodLazy=`ZodLazy`,e.ZodLiteral=`ZodLiteral`,e.ZodEnum=`ZodEnum`,e.ZodEffects=`ZodEffects`,e.ZodNativeEnum=`ZodNativeEnum`,e.ZodOptional=`ZodOptional`,e.ZodNullable=`ZodNullable`,e.ZodDefault=`ZodDefault`,e.ZodCatch=`ZodCatch`,e.ZodPromise=`ZodPromise`,e.ZodBranded=`ZodBranded`,e.ZodPipeline=`ZodPipeline`,e.ZodReadonly=`ZodReadonly`})($||={});const Ke=(e,t={message:`Input not instance of ${e.name}`})=>We(t=>t instanceof e,t),qe=S.create,Je=C.create,Ye=ze.create,Xe=w.create,Ze=T.create,Qe=E.create,$e=Ne.create,et=D.create,tt=O.create,nt=k.create,rt=A.create,it=j.create,at=M.create,ot=N.create,st=F.create,ct=F.strictCreate,lt=I.create,ut=Pe.create,dt=R.create,ft=z.create,pt=Ie.create,mt=B.create,ht=V.create,gt=Le.create,_t=H.create,vt=U.create,yt=W.create,bt=G.create,xt=K.create,St=q.create,Ct=J.create,wt=Y.create,Tt=q.createWithPreprocess,Et=He.create;var Dt=Object.freeze({__proto__:null,defaultErrorMap:s,setErrorMap:ee,getErrorMap:te,makeIssue:ne,EMPTY_PATH:re,addIssueToContext:l,ParseStatus:u,INVALID:d,DIRTY:ie,OK:f,isAborted:ae,isDirty:oe,isValid:p,isAsync:m,get util(){return e},get objectUtil(){return t},ZodParsedType:n,getParsedType:r,ZodType:x,datetimeRegex:Oe,ZodString:S,ZodNumber:C,ZodBigInt:w,ZodBoolean:T,ZodDate:E,ZodSymbol:Ne,ZodUndefined:D,ZodNull:O,ZodAny:k,ZodUnknown:A,ZodNever:j,ZodVoid:M,ZodArray:N,ZodObject:F,ZodUnion:I,ZodDiscriminatedUnion:Pe,ZodIntersection:R,ZodTuple:z,ZodRecord:Ie,ZodMap:B,ZodSet:V,ZodFunction:Le,ZodLazy:H,ZodLiteral:U,ZodEnum:W,ZodNativeEnum:G,ZodPromise:K,ZodEffects:q,ZodTransformer:q,ZodOptional:J,ZodNullable:Y,ZodDefault:X,ZodCatch:Z,ZodNaN:ze,BRAND:Be,ZodBranded:Ve,ZodPipeline:He,ZodReadonly:Q,custom:We,Schema:x,ZodSchema:x,late:Ge,get ZodFirstPartyTypeKind(){return $},coerce:{string:(e=>S.create({...e,coerce:!0})),number:(e=>C.create({...e,coerce:!0})),boolean:(e=>T.create({...e,coerce:!0})),bigint:(e=>w.create({...e,coerce:!0})),date:(e=>E.create({...e,coerce:!0}))},any:nt,array:ot,bigint:Xe,boolean:Ze,date:Qe,discriminatedUnion:ut,effect:St,enum:yt,function:gt,instanceof:Ke,intersection:dt,lazy:_t,literal:vt,map:mt,nan:Ye,nativeEnum:bt,never:it,null:tt,nullable:wt,number:Je,object:st,oboolean:()=>Ze().optional(),onumber:()=>Je().optional(),optional:Ct,ostring:()=>qe().optional(),pipeline:Et,preprocess:Tt,promise:xt,record:pt,set:ht,strictObject:ct,string:qe,symbol:$e,transformer:St,tuple:ft,undefined:et,union:lt,unknown:rt,void:at,NEVER:d,ZodIssueCode:i,quotelessJson:a,ZodError:o});const Ot=`2.1.0`;export{Dt as n,Ot as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{getVercelOidcToken}from"#compiled/@vercel/oidc/index.js";async function createVercelEveImageSandbox(e){let t=await createVercelSandboxViaApi(e.createOptions),n=await e.sandboxModule.Sandbox.get({...t,fetch:getVercelSandboxFetch(e.createOptions),name:e.createOptions.name,onResume:e.createOptions.onResume,resume:!1,signal:e.createOptions.signal});if(n===null)throw Error(`Created Vercel sandbox "${e.createOptions.name}" but could not resume it.`);return n}async function createVercelSandboxViaApi(e){let r=await getVercelSandboxCredentials(e),i=new URL(`v2/sandboxes`,VERCEL_API_BASE_URL);i.searchParams.set(`teamId`,r.teamId);let a=await getVercelSandboxFetch(e)(i,{body:JSON.stringify({projectId:r.projectId,ports:e.ports??[],source:e.source,timeout:e.timeout,resources:e.resources,runtime:e.runtime,name:e.name,persistent:e.persistent,networkPolicy:e.networkPolicy===void 0?void 0:toVercelSandboxApiNetworkPolicy(e.networkPolicy),env:e.env,tags:e.tags,snapshotExpiration:e.snapshotExpiration,keepLastSnapshots:e.keepLastSnapshots,__image:VERCEL_EVE_SANDBOX_IMAGE}),headers:{authorization:`Bearer ${r.token}`,"content-type":`application/json`},method:`POST`,signal:e.signal});if(!a.ok){let e=await a.text().catch(()=>``);throw Error(`Vercel sandbox create API returned ${a.status}${e?`: ${e}`:``}`)}return r}function getVercelSandboxFetch(e){return e.fetch??globalThis.fetch}async function getVercelSandboxCredentials(t){let n=readNonEmptyString(t,`teamId`)??readNonEmptyEnvironmentVariable(`VERCEL_TEAM_ID`)??readNonEmptyEnvironmentVariable(`VERCEL_ORG_ID`),r=readNonEmptyString(t,`projectId`)??readNonEmptyEnvironmentVariable(`VERCEL_PROJECT_ID`),i=readNonEmptyString(t,`token`)??readNonEmptyEnvironmentVariable(`VERCEL_OIDC_TOKEN`)??readNonEmptyEnvironmentVariable(`VERCEL_TOKEN`);if(i&&n&&r)return{projectId:r,teamId:n,token:i};try{return getVercelSandboxCredentialsFromOidcToken(await getVercelOidcToken({project:r,team:n}))}catch(e){throw Error("Could not resolve Vercel sandbox credentials. Run `vercel login` and `vercel link` so Vercel OIDC can authenticate, set VERCEL_OIDC_TOKEN, or set VERCEL_TOKEN with VERCEL_TEAM_ID and VERCEL_PROJECT_ID.",{cause:e})}}function readNonEmptyString(e,t){let n=e[t];return typeof n==`string`&&n.trim().length>0?n.trim():void 0}function readNonEmptyEnvironmentVariable(e){let t=process.env[e];return typeof t==`string`&&t.trim().length>0?t.trim():void 0}function getVercelSandboxCredentialsFromOidcToken(e){let t=e.split(`.`)[1];if(t===void 0)throw Error(`Invalid Vercel OIDC token: missing payload.`);let n=JSON.parse(Buffer.from(base64UrlToBase64(t),`base64`).toString(`utf8`)),r=typeof n.owner_id==`string`?n.owner_id:void 0,i=typeof n.project_id==`string`?n.project_id:void 0;if(r===void 0||i===void 0)throw Error(`Invalid Vercel OIDC token: missing owner_id or project_id.`);return{projectId:i,teamId:r,token:e}}function base64UrlToBase64(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`);return t.padEnd(Math.ceil(t.length/4)*4,`=`)}function toVercelSandboxApiNetworkPolicy(e){return e===`allow-all`||e===`deny-all`?{mode:e}:e}const VERCEL_API_BASE_URL=`https://vercel.com/api/`,VERCEL_EVE_SANDBOX_IMAGE=`vercel/eve:latest`;export{createVercelEveImageSandbox};
|