@scalar/fastify-api-reference 1.25.130 → 1.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+ import { htmlRenderingConfigurationSchema, apiReferenceConfigurationSchema } from '@scalar/types/api-reference';
2
+
3
+ /**
4
+ * The HTML document to render the Scalar API reference.
5
+ *
6
+ * We must check the passed in configuration and not the parsedConfig for the theme as the parsedConfig will have it
7
+ * defaulted to 'default'
8
+ */
9
+ const getHtmlDocument = (configuration, customTheme = '') => {
10
+ const { cdn, pageTitle, ...rest } = configuration;
11
+ const parsedHtmlOptions = htmlRenderingConfigurationSchema.parse({ cdn, pageTitle, customTheme });
12
+ const parsedConfig = apiReferenceConfigurationSchema.parse(rest);
13
+ return `
14
+ <!DOCTYPE html>
15
+ <html>
16
+ <head>
17
+ <title>${parsedHtmlOptions.pageTitle}</title>
18
+ <meta charset="utf-8" />
19
+ <meta
20
+ name="viewport"
21
+ content="width=device-width, initial-scale=1" />
22
+ <style>
23
+ ${configuration.theme ? '' : customTheme}
24
+ </style>
25
+ </head>
26
+ <body>
27
+ ${getScriptTags(parsedConfig, parsedHtmlOptions.cdn)}
28
+ </body>
29
+ </html>
30
+ `;
31
+ };
32
+ /**
33
+ * The script tags to load the @scalar/api-reference package from the CDN.
34
+ */
35
+ function getScriptTags(configuration, cdn) {
36
+ return `
37
+ <script
38
+ id="api-reference"
39
+ type="application/json"
40
+ data-configuration="${getConfiguration(configuration)}">${getScriptTagContent(configuration)}</script>
41
+ <script src="${cdn}"></script>
42
+ `;
43
+ }
44
+ /**
45
+ * The configuration to pass to the @scalar/api-reference package.
46
+ */
47
+ const getConfiguration = (givenConfiguration) => {
48
+ // Clone before mutating
49
+ const configuration = {
50
+ ...givenConfiguration,
51
+ };
52
+ if (!configuration.spec?.url) {
53
+ delete configuration.spec;
54
+ }
55
+ else if (configuration.spec?.content) {
56
+ delete configuration.spec?.content;
57
+ }
58
+ return JSON.stringify(configuration).split('"').join('&quot;');
59
+ };
60
+ /**
61
+ * The content to pass to the @scalar/api-reference package as the <script> tag content.
62
+ */
63
+ const getScriptTagContent = (configuration) => configuration.spec?.content
64
+ ? typeof configuration.spec?.content === 'function'
65
+ ? JSON.stringify(configuration.spec?.content())
66
+ : JSON.stringify(configuration.spec?.content)
67
+ : '';
68
+
69
+ export { getConfiguration, getHtmlDocument, getScriptTagContent, getScriptTags };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=proxy.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proxy.test.d.ts","sourceRoot":"","sources":["../src/proxy.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ /**
6
+ * Read the JavaScript file.
7
+ */
8
+ function getJavaScriptFile() {
9
+ // Get the directory name
10
+ const dirname = path.dirname(fileURLToPath(import.meta.url));
11
+ // Find the JavaScript file
12
+ const filePath = [
13
+ path.resolve(`${dirname}/js/standalone.js`),
14
+ path.resolve(`${dirname}/../../dist/js/standalone.js`),
15
+ ].find((file) => fs.existsSync(file));
16
+ // Throw an error if the file is not found
17
+ if (filePath === undefined) {
18
+ throw new Error(`JavaScript file not found: ${path.resolve(`${dirname}/js/standalone.js`)}`);
19
+ }
20
+ return fs.readFileSync(filePath, 'utf8');
21
+ }
22
+
23
+ export { getJavaScriptFile };
package/package.json CHANGED
@@ -17,29 +17,32 @@
17
17
  "openapi",
18
18
  "swagger"
19
19
  ],
20
- "version": "1.25.130",
20
+ "version": "1.26.1",
21
21
  "engines": {
22
22
  "node": ">=18"
23
23
  },
24
24
  "type": "module",
25
- "main": "./dist/index.cjs",
26
- "types": "./dist/index.d.ts",
25
+ "main": "dist/index.js",
26
+ "types": "dist/index.d.ts",
27
27
  "exports": {
28
- "types": "./dist/index.d.ts",
29
- "import": "./dist/index.js",
30
- "require": "./dist/index.cjs"
28
+ ".": {
29
+ "import": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/index.js"
32
+ }
31
33
  },
32
34
  "files": [
33
- "dist",
35
+ "./dist",
34
36
  "CHANGELOG.md"
35
37
  ],
36
- "module": "./dist/index.js",
38
+ "module": "dist/index.js",
37
39
  "dependencies": {
38
40
  "fastify-plugin": "^4.5.1",
39
41
  "github-slugger": "^2.0.0",
40
- "@scalar/core": "0.1.0",
41
- "@scalar/openapi-parser": "0.10.9",
42
- "@scalar/openapi-types": "0.1.9"
42
+ "@scalar/types": "0.0.40",
43
+ "@scalar/openapi-types": "0.1.9",
44
+ "@scalar/core": "0.1.1",
45
+ "@scalar/openapi-parser": "0.10.10"
43
46
  },
44
47
  "devDependencies": {
45
48
  "@fastify/basic-auth": "^5.1.1",
@@ -53,18 +56,20 @@
53
56
  "vite-plugin-static-copy": "^1.0.2",
54
57
  "vitest": "^1.6.0",
55
58
  "yaml": "^2.4.5",
56
- "@scalar/build-tooling": "0.1.16"
59
+ "@scalar/build-tooling": "0.1.17",
60
+ "@scalar/api-reference": "1.26.1"
57
61
  },
58
62
  "scripts": {
59
- "build": "scalar-build-vite",
63
+ "build": "scalar-build-rollup && pnpm copy:standalone",
60
64
  "build:playground": "cd playground && pnpm build",
65
+ "copy:standalone": "mkdir -p ./dist/js && cp ../../packages/api-reference/dist/browser/standalone.js ./dist/js/standalone.js",
61
66
  "dev": "cd playground && pnpm dev",
62
67
  "docker:build": "docker build --build-arg BASE_IMAGE=scalar-base -t fastify-api-reference -f Dockerfile .",
63
68
  "docker:run": "docker run -p 5053:5053 fastify-api-reference",
64
69
  "format": "scalar-format",
65
70
  "format:check": "scalar-format-check",
66
- "lint:check": "eslint .",
67
- "lint:fix": "eslint . --fix",
71
+ "lint:check": "scalar-lint-check",
72
+ "lint:fix": "scalar-lint-fix",
68
73
  "test": "vitest",
69
74
  "types:build": "scalar-types-build",
70
75
  "types:check": "scalar-types-check"
package/dist/index.cjs DELETED
@@ -1 +0,0 @@
1
- "use strict";const e=require("@scalar/openapi-parser"),t=require("@scalar/openapi-parser/plugins/fetch-urls"),a=require("fastify-plugin"),n=require("github-slugger"),r=require("node:fs"),s=require("node:path"),i=require("node:url");var o,d,c,u="undefined"!=typeof document?document.currentScript:null;(d=o||(o={})).assertEqual=e=>e,d.assertIs=function(e){},d.assertNever=function(e){throw new Error},d.arrayToEnum=e=>{const t={};for(const a of e)t[a]=a;return t},d.getValidEnumValues=e=>{const t=d.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),a={};for(const n of t)a[n]=e[n];return d.objectValues(a)},d.objectValues=e=>d.objectKeys(e).map((function(t){return e[t]})),d.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.push(a);return t},d.find=(e,t)=>{for(const a of e)if(t(a))return a},d.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,d.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},d.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(c||(c={})).mergeShapes=(e,t)=>({...e,...t});const l=o.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),p=e=>{switch(typeof e){case"undefined":return l.undefined;case"string":return l.string;case"number":return isNaN(e)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":return Array.isArray(e)?l.array:null===e?l.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?l.promise:"undefined"!=typeof Map&&e instanceof Map?l.map:"undefined"!=typeof Set&&e instanceof Set?l.set:"undefined"!=typeof Date&&e instanceof Date?l.date:l.object;default:return l.unknown}},h=o.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"]);class m extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},a={_errors:[]},n=e=>{for(const r of e.issues)if("invalid_union"===r.code)r.unionErrors.map(n);else if("invalid_return_type"===r.code)n(r.returnTypeError);else if("invalid_arguments"===r.code)n(r.argumentsError);else if(0===r.path.length)a._errors.push(t(r));else{let e=a,n=0;for(;n<r.path.length;){const a=r.path[n];n===r.path.length-1?(e[a]=e[a]||{_errors:[]},e[a]._errors.push(t(r))):e[a]=e[a]||{_errors:[]},e=e[a],n++}}};return n(this),a}static assert(e){if(!(e instanceof m))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,o.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},a=[];for(const n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):a.push(e(n));return{formErrors:a,fieldErrors:t}}get formErrors(){return this.flatten()}}m.create=e=>new m(e);const f=(e,t)=>{let a;switch(e.code){case h.invalid_type:a=e.received===l.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case h.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(e.expected,o.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:a=`Unrecognized key(s) in object: ${o.joinValues(e.keys,", ")}`;break;case h.invalid_union:a="Invalid input";break;case h.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${o.joinValues(e.options)}`;break;case h.invalid_enum_value:a=`Invalid enum value. Expected ${o.joinValues(e.options)}, received '${e.received}'`;break;case h.invalid_arguments:a="Invalid function arguments";break;case h.invalid_return_type:a="Invalid function return type";break;case h.invalid_date:a="Invalid date";break;case h.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(a=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(a=`${a} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?a=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?a=`Invalid input: must end with "${e.validation.endsWith}"`:o.assertNever(e.validation):a="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case h.too_small:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case h.too_big:a="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case h.custom:a="Invalid input";break;case h.invalid_intersection_types:a="Intersection results could not be merged";break;case h.not_multiple_of:a=`Number must be a multiple of ${e.multipleOf}`;break;case h.not_finite:a="Number must be finite";break;default:a=t.defaultError,o.assertNever(e)}return{message:a}};let g=f;function y(){return g}const v=e=>{const{data:t,path:a,errorMaps:n,issueData:r}=e,s=[...a,...r.path||[]],i={...r,path:s};if(void 0!==r.message)return{...r,path:s,message:r.message};let o="";const d=n.filter((e=>!!e)).slice().reverse();for(const c of d)o=c(i,{data:t,defaultError:o}).message;return{...r,path:s,message:o}};function _(e,t){const a=y(),n=v({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,a,a===f?void 0:f].filter((e=>!!e))});e.common.issues.push(n)}class b{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const a=[];for(const n of t){if("aborted"===n.status)return x;"dirty"===n.status&&e.dirty(),a.push(n.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,t){const a=[];for(const n of t){const e=await n.key,t=await n.value;a.push({key:e,value:t})}return b.mergeObjectSync(e,a)}static mergeObjectSync(e,t){const a={};for(const n of t){const{key:t,value:r}=n;if("aborted"===t.status)return x;if("aborted"===r.status)return x;"dirty"===t.status&&e.dirty(),"dirty"===r.status&&e.dirty(),"__proto__"===t.value||void 0===r.value&&!n.alwaysSet||(a[t.value]=r.value)}return{status:e.value,value:a}}}const x=Object.freeze({status:"aborted"}),k=e=>({status:"dirty",value:e}),w=e=>({status:"valid",value:e}),T=e=>"aborted"===e.status,Z=e=>"dirty"===e.status,C=e=>"valid"===e.status,S=e=>"undefined"!=typeof Promise&&e instanceof Promise;function j(e,t,a,n){if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function O(e,t,a,n,r){if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,a),a}var E,N,R,P;"function"==typeof SuppressedError&&SuppressedError,(N=E||(E={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},N.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ${constructor(e,t,a,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=a,this._key=n}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 A=(e,t)=>{if(C(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new m(e.common.issues);return this._error=t,this._error}}};function I(e){if(!e)return{};const{errorMap:t,invalid_type_error:a,required_error:n,description:r}=e;if(t&&(a||n))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:r};return{errorMap:(t,r)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:r.defaultError}:void 0===r.data?{message:null!==(s=null!=o?o:n)&&void 0!==s?s:r.defaultError}:"invalid_type"!==t.code?{message:r.defaultError}:{message:null!==(i=null!=o?o:a)&&void 0!==i?i:r.defaultError}},description:r}}class L{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)}get description(){return this._def.description}_getType(e){return p(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:p(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(S(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const a=this.safeParse(e,t);if(a.success)return a.data;throw a.error}safeParse(e,t){var a;const n={common:{issues:[],async:null!==(a=null==t?void 0:t.async)&&void 0!==a&&a,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(e)},r=this._parseSync({data:e,path:n.path,parent:n});return A(n,r)}async parseAsync(e,t){const a=await this.safeParseAsync(e,t);if(a.success)return a.data;throw a.error}async safeParseAsync(e,t){const a={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:p(e)},n=this._parse({data:e,path:a.path,parent:a}),r=await(S(n)?n:Promise.resolve(n));return A(a,r)}refine(e,t){const a=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const r=e(t),s=()=>n.addIssue({code:h.custom,...a(t)});return"undefined"!=typeof Promise&&r instanceof Promise?r.then((e=>!!e||(s(),!1))):!!r||(s(),!1)}))}refinement(e,t){return this._refinement(((a,n)=>!!e(a)||(n.addIssue("function"==typeof t?t(a,n):t),!1)))}_refinement(e){return new Ne({schema:this,typeName:Ke.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Re.create(this,this._def)}nullable(){return Pe.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return pe.create(this,this._def)}promise(){return Ee.create(this,this._def)}or(e){return fe.create([this,e],this._def)}and(e){return _e.create(this,e,this._def)}transform(e){return new Ne({...I(this._def),schema:this,typeName:Ke.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new $e({...I(this._def),innerType:this,defaultValue:t,typeName:Ke.ZodDefault})}brand(){return new Me({typeName:Ke.ZodBranded,type:this,...I(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new Ae({...I(this._def),innerType:this,catchValue:t,typeName:Ke.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return De.create(this,e)}readonly(){return Ue.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const M=/^c[^\s-]{8,}$/i,D=/^[0-9a-z]+$/,U=/^[0-9A-HJKMNP-TV-Z]{26}$/,z=/^[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,V=/^[a-z0-9_-]{21}$/i,K=/^[-+]?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)?)??$/,q=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let W;const B=/^(?:(?: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])$/,F=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,J=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Y="((\\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])))",G=new RegExp(`^${Y}$`);function H(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function X(e){let t=`${Y}T${H(e)}`;const a=[];return a.push(e.local?"Z?":"Z"),e.offset&&a.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${a.join("|")})`,new RegExp(`^${t}$`)}class Q extends L{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==l.string){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.string,received:t.parsedType}),x}const t=new b;let a;for(const i of this._def.checks)if("min"===i.kind)e.data.length<i.value&&(a=this._getOrReturnCtx(e,a),_(a,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("max"===i.kind)e.data.length>i.value&&(a=this._getOrReturnCtx(e,a),_(a,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),t.dirty());else if("length"===i.kind){const n=e.data.length>i.value,r=e.data.length<i.value;(n||r)&&(a=this._getOrReturnCtx(e,a),n?_(a,{code:h.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):r&&_(a,{code:h.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),t.dirty())}else if("email"===i.kind)q.test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{validation:"email",code:h.invalid_string,message:i.message}),t.dirty());else if("emoji"===i.kind)W||(W=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),W.test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{validation:"emoji",code:h.invalid_string,message:i.message}),t.dirty());else if("uuid"===i.kind)z.test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{validation:"uuid",code:h.invalid_string,message:i.message}),t.dirty());else if("nanoid"===i.kind)V.test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{validation:"nanoid",code:h.invalid_string,message:i.message}),t.dirty());else if("cuid"===i.kind)M.test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{validation:"cuid",code:h.invalid_string,message:i.message}),t.dirty());else if("cuid2"===i.kind)D.test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{validation:"cuid2",code:h.invalid_string,message:i.message}),t.dirty());else if("ulid"===i.kind)U.test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{validation:"ulid",code:h.invalid_string,message:i.message}),t.dirty());else if("url"===i.kind)try{new URL(e.data)}catch(s){a=this._getOrReturnCtx(e,a),_(a,{validation:"url",code:h.invalid_string,message:i.message}),t.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{validation:"regex",code:h.invalid_string,message:i.message}),t.dirty())}else if("trim"===i.kind)e.data=e.data.trim();else if("includes"===i.kind)e.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(e,a),_(a,{code:h.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),t.dirty());else if("toLowerCase"===i.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===i.kind)e.data=e.data.toUpperCase();else if("startsWith"===i.kind)e.data.startsWith(i.value)||(a=this._getOrReturnCtx(e,a),_(a,{code:h.invalid_string,validation:{startsWith:i.value},message:i.message}),t.dirty());else if("endsWith"===i.kind)e.data.endsWith(i.value)||(a=this._getOrReturnCtx(e,a),_(a,{code:h.invalid_string,validation:{endsWith:i.value},message:i.message}),t.dirty());else if("datetime"===i.kind){X(i).test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{code:h.invalid_string,validation:"datetime",message:i.message}),t.dirty())}else if("date"===i.kind){G.test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{code:h.invalid_string,validation:"date",message:i.message}),t.dirty())}else if("time"===i.kind){new RegExp(`^${H(i)}$`).test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{code:h.invalid_string,validation:"time",message:i.message}),t.dirty())}else"duration"===i.kind?K.test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{validation:"duration",code:h.invalid_string,message:i.message}),t.dirty()):"ip"===i.kind?(n=e.data,("v4"!==(r=i.version)&&r||!B.test(n))&&("v6"!==r&&r||!F.test(n))&&(a=this._getOrReturnCtx(e,a),_(a,{validation:"ip",code:h.invalid_string,message:i.message}),t.dirty())):"base64"===i.kind?J.test(e.data)||(a=this._getOrReturnCtx(e,a),_(a,{validation:"base64",code:h.invalid_string,message:i.message}),t.dirty()):o.assertNever(i);var n,r;return{status:t.value,value:e.data}}_regex(e,t,a){return this.refinement((t=>e.test(t)),{validation:t,code:h.invalid_string,...E.errToObj(a)})}_addCheck(e){return new Q({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...E.errToObj(e)})}url(e){return this._addCheck({kind:"url",...E.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...E.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...E.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...E.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...E.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...E.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...E.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...E.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...E.errToObj(e)})}datetime(e){var t,a;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(a=null==e?void 0:e.local)&&void 0!==a&&a,...E.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...E.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...E.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...E.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...E.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...E.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...E.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...E.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...E.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...E.errToObj(t)})}nonempty(e){return this.min(1,E.errToObj(e))}trim(){return new Q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function ee(e,t){const a=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,r=a>n?a:n;return parseInt(e.toFixed(r).replace(".",""))%parseInt(t.toFixed(r).replace(".",""))/Math.pow(10,r)}Q.create=e=>{var t;return new Q({checks:[],typeName:Ke.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...I(e)})};class te extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){this._def.coerce&&(e.data=Number(e.data));if(this._getType(e)!==l.number){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.number,received:t.parsedType}),x}let t;const a=new b;for(const n of this._def.checks)if("int"===n.kind)o.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),_(t,{code:h.invalid_type,expected:"integer",received:"float",message:n.message}),a.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),_(t,{code:h.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),_(t,{code:h.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),a.dirty())}else"multipleOf"===n.kind?0!==ee(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),_(t,{code:h.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),_(t,{code:h.not_finite,message:n.message}),a.dirty()):o.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,a,n){return new te({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:E.toString(n)}]})}_addCheck(e){return new te({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:E.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:E.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:E.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:E.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((e=>"int"===e.kind||"multipleOf"===e.kind&&o.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const a of this._def.checks){if("finite"===a.kind||"int"===a.kind||"multipleOf"===a.kind)return!0;"min"===a.kind?(null===t||a.value>t)&&(t=a.value):"max"===a.kind&&(null===e||a.value<e)&&(e=a.value)}return Number.isFinite(t)&&Number.isFinite(e)}}te.create=e=>new te({checks:[],typeName:Ke.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...I(e)});class ae extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){this._def.coerce&&(e.data=BigInt(e.data));if(this._getType(e)!==l.bigint){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.bigint,received:t.parsedType}),x}let t;const a=new b;for(const n of this._def.checks)if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),_(t,{code:h.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),_(t,{code:h.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),a.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),_(t,{code:h.not_multiple_of,multipleOf:n.value,message:n.message}),a.dirty()):o.assertNever(n);return{status:a.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,E.toString(t))}gt(e,t){return this.setLimit("min",e,!1,E.toString(t))}lte(e,t){return this.setLimit("max",e,!0,E.toString(t))}lt(e,t){return this.setLimit("max",e,!1,E.toString(t))}setLimit(e,t,a,n){return new ae({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:a,message:E.toString(n)}]})}_addCheck(e){return new ae({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:E.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:E.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:E.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:E.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:E.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ae.create=e=>{var t;return new ae({checks:[],typeName:Ke.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...I(e)})};class ne extends L{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==l.boolean){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.boolean,received:t.parsedType}),x}return w(e.data)}}ne.create=e=>new ne({typeName:Ke.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...I(e)});class re extends L{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==l.date){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.date,received:t.parsedType}),x}if(isNaN(e.data.getTime())){return _(this._getOrReturnCtx(e),{code:h.invalid_date}),x}const t=new b;let a;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(a=this._getOrReturnCtx(e,a),_(a,{code:h.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(a=this._getOrReturnCtx(e,a),_(a,{code:h.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):o.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new re({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:E.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:E.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}re.create=e=>new re({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Ke.ZodDate,...I(e)});class se extends L{_parse(e){if(this._getType(e)!==l.symbol){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.symbol,received:t.parsedType}),x}return w(e.data)}}se.create=e=>new se({typeName:Ke.ZodSymbol,...I(e)});class ie extends L{_parse(e){if(this._getType(e)!==l.undefined){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.undefined,received:t.parsedType}),x}return w(e.data)}}ie.create=e=>new ie({typeName:Ke.ZodUndefined,...I(e)});class oe extends L{_parse(e){if(this._getType(e)!==l.null){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.null,received:t.parsedType}),x}return w(e.data)}}oe.create=e=>new oe({typeName:Ke.ZodNull,...I(e)});class de extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return w(e.data)}}de.create=e=>new de({typeName:Ke.ZodAny,...I(e)});class ce extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return w(e.data)}}ce.create=e=>new ce({typeName:Ke.ZodUnknown,...I(e)});class ue extends L{_parse(e){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.never,received:t.parsedType}),x}}ue.create=e=>new ue({typeName:Ke.ZodNever,...I(e)});class le extends L{_parse(e){if(this._getType(e)!==l.undefined){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.void,received:t.parsedType}),x}return w(e.data)}}le.create=e=>new le({typeName:Ke.ZodVoid,...I(e)});class pe extends L{_parse(e){const{ctx:t,status:a}=this._processInputParams(e),n=this._def;if(t.parsedType!==l.array)return _(t,{code:h.invalid_type,expected:l.array,received:t.parsedType}),x;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,r=t.data.length<n.exactLength.value;(e||r)&&(_(t,{code:e?h.too_big:h.too_small,minimum:r?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),a.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(_(t,{code:h.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),a.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(_(t,{code:h.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),a.dirty()),t.common.async)return Promise.all([...t.data].map(((e,a)=>n.type._parseAsync(new $(t,e,t.path,a))))).then((e=>b.mergeArray(a,e)));const r=[...t.data].map(((e,a)=>n.type._parseSync(new $(t,e,t.path,a))));return b.mergeArray(a,r)}get element(){return this._def.type}min(e,t){return new pe({...this._def,minLength:{value:e,message:E.toString(t)}})}max(e,t){return new pe({...this._def,maxLength:{value:e,message:E.toString(t)}})}length(e,t){return new pe({...this._def,exactLength:{value:e,message:E.toString(t)}})}nonempty(e){return this.min(1,e)}}function he(e){if(e instanceof me){const t={};for(const a in e.shape){const n=e.shape[a];t[a]=Re.create(he(n))}return new me({...e._def,shape:()=>t})}return e instanceof pe?new pe({...e._def,type:he(e.element)}):e instanceof Re?Re.create(he(e.unwrap())):e instanceof Pe?Pe.create(he(e.unwrap())):e instanceof be?be.create(e.items.map((e=>he(e)))):e}pe.create=(e,t)=>new pe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Ke.ZodArray,...I(t)});class me extends L{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const e=this._def.shape(),t=o.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==l.object){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.object,received:t.parsedType}),x}const{status:t,ctx:a}=this._processInputParams(e),{shape:n,keys:r}=this._getCached(),s=[];if(!(this._def.catchall instanceof ue&&"strip"===this._def.unknownKeys))for(const o in a.data)r.includes(o)||s.push(o);const i=[];for(const o of r){const e=n[o],t=a.data[o];i.push({key:{status:"valid",value:o},value:e._parse(new $(a,t,a.path,o)),alwaysSet:o in a.data})}if(this._def.catchall instanceof ue){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of s)i.push({key:{status:"valid",value:t},value:{status:"valid",value:a.data[t]}});else if("strict"===e)s.length>0&&(_(a,{code:h.unrecognized_keys,keys:s}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of s){const n=a.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new $(a,n,a.path,t)),alwaysSet:t in a.data})}}return a.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of i){const a=await t.key,n=await t.value;e.push({key:a,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>b.mergeObjectSync(t,e))):b.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return E.errToObj,new me({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,a)=>{var n,r,s,i;const o=null!==(s=null===(r=(n=this._def).errorMap)||void 0===r?void 0:r.call(n,t,a).message)&&void 0!==s?s:a.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=E.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new me({...this._def,unknownKeys:"strip"})}passthrough(){return new me({...this._def,unknownKeys:"passthrough"})}extend(e){return new me({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new me({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Ke.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new me({...this._def,catchall:e})}pick(e){const t={};return o.objectKeys(e).forEach((a=>{e[a]&&this.shape[a]&&(t[a]=this.shape[a])})),new me({...this._def,shape:()=>t})}omit(e){const t={};return o.objectKeys(this.shape).forEach((a=>{e[a]||(t[a]=this.shape[a])})),new me({...this._def,shape:()=>t})}deepPartial(){return he(this)}partial(e){const t={};return o.objectKeys(this.shape).forEach((a=>{const n=this.shape[a];e&&!e[a]?t[a]=n:t[a]=n.optional()})),new me({...this._def,shape:()=>t})}required(e){const t={};return o.objectKeys(this.shape).forEach((a=>{if(e&&!e[a])t[a]=this.shape[a];else{let e=this.shape[a];for(;e instanceof Re;)e=e._def.innerType;t[a]=e}})),new me({...this._def,shape:()=>t})}keyof(){return Se(o.objectKeys(this.shape))}}me.create=(e,t)=>new me({shape:()=>e,unknownKeys:"strip",catchall:ue.create(),typeName:Ke.ZodObject,...I(t)}),me.strictCreate=(e,t)=>new me({shape:()=>e,unknownKeys:"strict",catchall:ue.create(),typeName:Ke.ZodObject,...I(t)}),me.lazycreate=(e,t)=>new me({shape:e,unknownKeys:"strip",catchall:ue.create(),typeName:Ke.ZodObject,...I(t)});class fe extends L{_parse(e){const{ctx:t}=this._processInputParams(e),a=this._def.options;if(t.common.async)return Promise.all(a.map((async e=>{const a={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:a}),ctx:a}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const n of e)if("dirty"===n.result.status)return t.common.issues.push(...n.ctx.common.issues),n.result;const a=e.map((e=>new m(e.ctx.common.issues)));return _(t,{code:h.invalid_union,unionErrors:a}),x}));{let e;const n=[];for(const s of a){const a={...t,common:{...t.common,issues:[]},parent:null},r=s._parseSync({data:t.data,path:t.path,parent:a});if("valid"===r.status)return r;"dirty"!==r.status||e||(e={result:r,ctx:a}),a.common.issues.length&&n.push(a.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const r=n.map((e=>new m(e)));return _(t,{code:h.invalid_union,unionErrors:r}),x}}get options(){return this._def.options}}fe.create=(e,t)=>new fe({options:e,typeName:Ke.ZodUnion,...I(t)});const ge=e=>e instanceof Ze?ge(e.schema):e instanceof Ne?ge(e.innerType()):e instanceof Ce?[e.value]:e instanceof je?e.options:e instanceof Oe?o.objectValues(e.enum):e instanceof $e?ge(e._def.innerType):e instanceof ie?[void 0]:e instanceof oe?[null]:e instanceof Re?[void 0,...ge(e.unwrap())]:e instanceof Pe?[null,...ge(e.unwrap())]:e instanceof Me||e instanceof Ue?ge(e.unwrap()):e instanceof Ae?ge(e._def.innerType):[];class ye extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.object)return _(t,{code:h.invalid_type,expected:l.object,received:t.parsedType}),x;const a=this.discriminator,n=t.data[a],r=this.optionsMap.get(n);return r?t.common.async?r._parseAsync({data:t.data,path:t.path,parent:t}):r._parseSync({data:t.data,path:t.path,parent:t}):(_(t,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),x)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,a){const n=new Map;for(const r of t){const t=ge(r.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of t){if(n.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);n.set(a,r)}}return new ye({typeName:Ke.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...I(a)})}}function ve(e,t){const a=p(e),n=p(t);if(e===t)return{valid:!0,data:e};if(a===l.object&&n===l.object){const a=o.objectKeys(t),n=o.objectKeys(e).filter((e=>-1!==a.indexOf(e))),r={...e,...t};for(const s of n){const a=ve(e[s],t[s]);if(!a.valid)return{valid:!1};r[s]=a.data}return{valid:!0,data:r}}if(a===l.array&&n===l.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let n=0;n<e.length;n++){const r=ve(e[n],t[n]);if(!r.valid)return{valid:!1};a.push(r.data)}return{valid:!0,data:a}}return a===l.date&&n===l.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class _e extends L{_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=(e,n)=>{if(T(e)||T(n))return x;const r=ve(e.value,n.value);return r.valid?((Z(e)||Z(n))&&t.dirty(),{status:t.value,value:r.data}):(_(a,{code:h.invalid_intersection_types}),x)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}}_e.create=(e,t,a)=>new _e({left:e,right:t,typeName:Ke.ZodIntersection,...I(a)});class be extends L{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==l.array)return _(a,{code:h.invalid_type,expected:l.array,received:a.parsedType}),x;if(a.data.length<this._def.items.length)return _(a,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),x;!this._def.rest&&a.data.length>this._def.items.length&&(_(a,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...a.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new $(a,e,a.path,t)):null})).filter((e=>!!e));return a.common.async?Promise.all(n).then((e=>b.mergeArray(t,e))):b.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new be({...this._def,rest:e})}}be.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new be({items:e,typeName:Ke.ZodTuple,rest:null,...I(t)})};class xe extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==l.object)return _(a,{code:h.invalid_type,expected:l.object,received:a.parsedType}),x;const n=[],r=this._def.keyType,s=this._def.valueType;for(const i in a.data)n.push({key:r._parse(new $(a,i,a.path,i)),value:s._parse(new $(a,a.data[i],a.path,i)),alwaysSet:i in a.data});return a.common.async?b.mergeObjectAsync(t,n):b.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,a){return new xe(t instanceof L?{keyType:e,valueType:t,typeName:Ke.ZodRecord,...I(a)}:{keyType:Q.create(),valueType:e,typeName:Ke.ZodRecord,...I(t)})}}class ke extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==l.map)return _(a,{code:h.invalid_type,expected:l.map,received:a.parsedType}),x;const n=this._def.keyType,r=this._def.valueType,s=[...a.data.entries()].map((([e,t],s)=>({key:n._parse(new $(a,e,a.path,[s,"key"])),value:r._parse(new $(a,t,a.path,[s,"value"]))})));if(a.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const a of s){const n=await a.key,r=await a.value;if("aborted"===n.status||"aborted"===r.status)return x;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const a of s){const n=a.key,r=a.value;if("aborted"===n.status||"aborted"===r.status)return x;"dirty"!==n.status&&"dirty"!==r.status||t.dirty(),e.set(n.value,r.value)}return{status:t.value,value:e}}}}ke.create=(e,t,a)=>new ke({valueType:t,keyType:e,typeName:Ke.ZodMap,...I(a)});class we extends L{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.parsedType!==l.set)return _(a,{code:h.invalid_type,expected:l.set,received:a.parsedType}),x;const n=this._def;null!==n.minSize&&a.data.size<n.minSize.value&&(_(a,{code:h.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&a.data.size>n.maxSize.value&&(_(a,{code:h.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const r=this._def.valueType;function s(e){const a=new Set;for(const n of e){if("aborted"===n.status)return x;"dirty"===n.status&&t.dirty(),a.add(n.value)}return{status:t.value,value:a}}const i=[...a.data.values()].map(((e,t)=>r._parse(new $(a,e,a.path,t))));return a.common.async?Promise.all(i).then((e=>s(e))):s(i)}min(e,t){return new we({...this._def,minSize:{value:e,message:E.toString(t)}})}max(e,t){return new we({...this._def,maxSize:{value:e,message:E.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}we.create=(e,t)=>new we({valueType:e,minSize:null,maxSize:null,typeName:Ke.ZodSet,...I(t)});class Te extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.function)return _(t,{code:h.invalid_type,expected:l.function,received:t.parsedType}),x;function a(e,a){return v({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,y(),f].filter((e=>!!e)),issueData:{code:h.invalid_arguments,argumentsError:a}})}function n(e,a){return v({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,y(),f].filter((e=>!!e)),issueData:{code:h.invalid_return_type,returnTypeError:a}})}const r={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof Ee){const e=this;return w((async function(...t){const i=new m([]),o=await e._def.args.parseAsync(t,r).catch((e=>{throw i.addIssue(a(t,e)),i})),d=await Reflect.apply(s,this,o);return await e._def.returns._def.type.parseAsync(d,r).catch((e=>{throw i.addIssue(n(d,e)),i}))}))}{const e=this;return w((function(...t){const i=e._def.args.safeParse(t,r);if(!i.success)throw new m([a(t,i.error)]);const o=Reflect.apply(s,this,i.data),d=e._def.returns.safeParse(o,r);if(!d.success)throw new m([n(o,d.error)]);return d.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Te({...this._def,args:be.create(e).rest(ce.create())})}returns(e){return new Te({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,a){return new Te({args:e||be.create([]).rest(ce.create()),returns:t||ce.create(),typeName:Ke.ZodFunction,...I(a)})}}class Ze extends L{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ze.create=(e,t)=>new Ze({getter:e,typeName:Ke.ZodLazy,...I(t)});class Ce extends L{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return _(t,{received:t.data,code:h.invalid_literal,expected:this._def.value}),x}return{status:"valid",value:e.data}}get value(){return this._def.value}}function Se(e,t){return new je({values:e,typeName:Ke.ZodEnum,...I(t)})}Ce.create=(e,t)=>new Ce({value:e,typeName:Ke.ZodLiteral,...I(t)});class je extends L{constructor(){super(...arguments),R.set(this,void 0)}_parse(e){if("string"!=typeof e.data){const t=this._getOrReturnCtx(e),a=this._def.values;return _(t,{expected:o.joinValues(a),received:t.parsedType,code:h.invalid_type}),x}if(j(this,R)||O(this,R,new Set(this._def.values)),!j(this,R).has(e.data)){const t=this._getOrReturnCtx(e),a=this._def.values;return _(t,{received:t.data,code:h.invalid_enum_value,options:a}),x}return w(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return je.create(e,{...this._def,...t})}exclude(e,t=this._def){return je.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}R=new WeakMap,je.create=Se;class Oe extends L{constructor(){super(...arguments),P.set(this,void 0)}_parse(e){const t=o.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==l.string&&a.parsedType!==l.number){const e=o.objectValues(t);return _(a,{expected:o.joinValues(e),received:a.parsedType,code:h.invalid_type}),x}if(j(this,P)||O(this,P,new Set(o.getValidEnumValues(this._def.values))),!j(this,P).has(e.data)){const e=o.objectValues(t);return _(a,{received:a.data,code:h.invalid_enum_value,options:e}),x}return w(e.data)}get enum(){return this._def.values}}P=new WeakMap,Oe.create=(e,t)=>new Oe({values:e,typeName:Ke.ZodNativeEnum,...I(t)});class Ee extends L{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.promise&&!1===t.common.async)return _(t,{code:h.invalid_type,expected:l.promise,received:t.parsedType}),x;const a=t.parsedType===l.promise?t.data:Promise.resolve(t.data);return w(a.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}Ee.create=(e,t)=>new Ee({type:e,typeName:Ke.ZodPromise,...I(t)});class Ne extends L{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Ke.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:a}=this._processInputParams(e),n=this._def.effect||null,r={addIssue:e=>{_(a,e),e.fatal?t.abort():t.dirty()},get path(){return a.path}};if(r.addIssue=r.addIssue.bind(r),"preprocess"===n.type){const e=n.transform(a.data,r);if(a.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===t.value)return x;const n=await this._def.schema._parseAsync({data:e,path:a.path,parent:a});return"aborted"===n.status?x:"dirty"===n.status||"dirty"===t.value?k(n.value):n}));{if("aborted"===t.value)return x;const n=this._def.schema._parseSync({data:e,path:a.path,parent:a});return"aborted"===n.status?x:"dirty"===n.status||"dirty"===t.value?k(n.value):n}}if("refinement"===n.type){const e=e=>{const t=n.refinement(e,r);if(a.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===a.common.async){const n=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===n.status?x:("dirty"===n.status&&t.dirty(),e(n.value),{status:t.value,value:n.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((a=>"aborted"===a.status?x:("dirty"===a.status&&t.dirty(),e(a.value).then((()=>({status:t.value,value:a.value}))))))}if("transform"===n.type){if(!1===a.common.async){const e=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!C(e))return e;const s=n.transform(e.value,r);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((e=>C(e)?Promise.resolve(n.transform(e.value,r)).then((e=>({status:t.value,value:e}))):e))}o.assertNever(n)}}Ne.create=(e,t,a)=>new Ne({schema:e,typeName:Ke.ZodEffects,effect:t,...I(a)}),Ne.createWithPreprocess=(e,t,a)=>new Ne({schema:t,effect:{type:"preprocess",transform:e},typeName:Ke.ZodEffects,...I(a)});class Re extends L{_parse(e){return this._getType(e)===l.undefined?w(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Re.create=(e,t)=>new Re({innerType:e,typeName:Ke.ZodOptional,...I(t)});class Pe extends L{_parse(e){return this._getType(e)===l.null?w(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Pe.create=(e,t)=>new Pe({innerType:e,typeName:Ke.ZodNullable,...I(t)});class $e extends L{_parse(e){const{ctx:t}=this._processInputParams(e);let a=t.data;return t.parsedType===l.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}$e.create=(e,t)=>new $e({innerType:e,typeName:Ke.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...I(t)});class Ae extends L{_parse(e){const{ctx:t}=this._processInputParams(e),a={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return S(n)?n.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new m(a.common.issues)},input:a.data})}))):{status:"valid",value:"valid"===n.status?n.value:this._def.catchValue({get error(){return new m(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}}Ae.create=(e,t)=>new Ae({innerType:e,typeName:Ke.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...I(t)});class Ie extends L{_parse(e){if(this._getType(e)!==l.nan){const t=this._getOrReturnCtx(e);return _(t,{code:h.invalid_type,expected:l.nan,received:t.parsedType}),x}return{status:"valid",value:e.data}}}Ie.create=e=>new Ie({typeName:Ke.ZodNaN,...I(e)});const Le=Symbol("zod_brand");class Me extends L{_parse(e){const{ctx:t}=this._processInputParams(e),a=t.data;return this._def.type._parse({data:a,path:t.path,parent:t})}unwrap(){return this._def.type}}class De extends L{_parse(e){const{status:t,ctx:a}=this._processInputParams(e);if(a.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?x:"dirty"===e.status?(t.dirty(),k(e.value)):this._def.out._parseAsync({data:e.value,path:a.path,parent:a})})()}{const e=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===e.status?x:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:a.path,parent:a})}}static create(e,t){return new De({in:e,out:t,typeName:Ke.ZodPipeline})}}class Ue extends L{_parse(e){const t=this._def.innerType._parse(e),a=e=>(C(e)&&(e.value=Object.freeze(e.value)),e);return S(t)?t.then((e=>a(e))):a(t)}unwrap(){return this._def.innerType}}function ze(e,t={},a){return e?de.create().superRefine(((n,r)=>{var s,i;if(!e(n)){const e="function"==typeof t?t(n):"string"==typeof t?{message:t}:t,o=null===(i=null!==(s=e.fatal)&&void 0!==s?s:a)||void 0===i||i,d="string"==typeof e?{message:e}:e;r.addIssue({code:"custom",...d,fatal:o})}})):de.create()}Ue.create=(e,t)=>new Ue({innerType:e,typeName:Ke.ZodReadonly,...I(t)});const Ve={object:me.lazycreate};var Ke,qe;(qe=Ke||(Ke={})).ZodString="ZodString",qe.ZodNumber="ZodNumber",qe.ZodNaN="ZodNaN",qe.ZodBigInt="ZodBigInt",qe.ZodBoolean="ZodBoolean",qe.ZodDate="ZodDate",qe.ZodSymbol="ZodSymbol",qe.ZodUndefined="ZodUndefined",qe.ZodNull="ZodNull",qe.ZodAny="ZodAny",qe.ZodUnknown="ZodUnknown",qe.ZodNever="ZodNever",qe.ZodVoid="ZodVoid",qe.ZodArray="ZodArray",qe.ZodObject="ZodObject",qe.ZodUnion="ZodUnion",qe.ZodDiscriminatedUnion="ZodDiscriminatedUnion",qe.ZodIntersection="ZodIntersection",qe.ZodTuple="ZodTuple",qe.ZodRecord="ZodRecord",qe.ZodMap="ZodMap",qe.ZodSet="ZodSet",qe.ZodFunction="ZodFunction",qe.ZodLazy="ZodLazy",qe.ZodLiteral="ZodLiteral",qe.ZodEnum="ZodEnum",qe.ZodEffects="ZodEffects",qe.ZodNativeEnum="ZodNativeEnum",qe.ZodOptional="ZodOptional",qe.ZodNullable="ZodNullable",qe.ZodDefault="ZodDefault",qe.ZodCatch="ZodCatch",qe.ZodPromise="ZodPromise",qe.ZodBranded="ZodBranded",qe.ZodPipeline="ZodPipeline",qe.ZodReadonly="ZodReadonly";const We=Q.create,Be=te.create,Fe=Ie.create,Je=ae.create,Ye=ne.create,Ge=re.create,He=se.create,Xe=ie.create,Qe=oe.create,et=de.create,tt=ce.create,at=ue.create,nt=le.create,rt=pe.create,st=me.create,it=me.strictCreate,ot=fe.create,dt=ye.create,ct=_e.create,ut=be.create,lt=xe.create,pt=ke.create,ht=we.create,mt=Te.create,ft=Ze.create,gt=Ce.create,yt=je.create,vt=Oe.create,_t=Ee.create,bt=Ne.create,xt=Re.create,kt=Pe.create,wt=Ne.createWithPreprocess,Tt=De.create,Zt={string:e=>Q.create({...e,coerce:!0}),number:e=>te.create({...e,coerce:!0}),boolean:e=>ne.create({...e,coerce:!0}),bigint:e=>ae.create({...e,coerce:!0}),date:e=>re.create({...e,coerce:!0})},Ct=x;var St=Object.freeze({__proto__:null,defaultErrorMap:f,setErrorMap:function(e){g=e},getErrorMap:y,makeIssue:v,EMPTY_PATH:[],addIssueToContext:_,ParseStatus:b,INVALID:x,DIRTY:k,OK:w,isAborted:T,isDirty:Z,isValid:C,isAsync:S,get util(){return o},get objectUtil(){return c},ZodParsedType:l,getParsedType:p,ZodType:L,datetimeRegex:X,ZodString:Q,ZodNumber:te,ZodBigInt:ae,ZodBoolean:ne,ZodDate:re,ZodSymbol:se,ZodUndefined:ie,ZodNull:oe,ZodAny:de,ZodUnknown:ce,ZodNever:ue,ZodVoid:le,ZodArray:pe,ZodObject:me,ZodUnion:fe,ZodDiscriminatedUnion:ye,ZodIntersection:_e,ZodTuple:be,ZodRecord:xe,ZodMap:ke,ZodSet:we,ZodFunction:Te,ZodLazy:Ze,ZodLiteral:Ce,ZodEnum:je,ZodNativeEnum:Oe,ZodPromise:Ee,ZodEffects:Ne,ZodTransformer:Ne,ZodOptional:Re,ZodNullable:Pe,ZodDefault:$e,ZodCatch:Ae,ZodNaN:Ie,BRAND:Le,ZodBranded:Me,ZodPipeline:De,ZodReadonly:Ue,custom:ze,Schema:L,ZodSchema:L,late:Ve,get ZodFirstPartyTypeKind(){return Ke},coerce:Zt,any:et,array:rt,bigint:Je,boolean:Ye,date:Ge,discriminatedUnion:dt,effect:bt,enum:yt,function:mt,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>ze((t=>t instanceof e),t),intersection:ct,lazy:ft,literal:gt,map:pt,nan:Fe,nativeEnum:vt,never:at,null:Qe,nullable:kt,number:Be,object:st,oboolean:()=>Ye().optional(),onumber:()=>Be().optional(),optional:xt,ostring:()=>We().optional(),pipeline:Tt,preprocess:wt,promise:_t,record:lt,set:ht,strictObject:it,string:We,symbol:He,transformer:bt,tuple:ut,undefined:Xe,union:ot,unknown:tt,void:nt,NEVER:Ct,ZodIssueCode:h,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:m});const jt=[["--theme-","--scalar-"],["--sidebar-","--scalar-sidebar-"]],Ot=jt.map((([e])=>e));const Et=St.enum(["alternate","default","moon","purple","solarized","bluePlanet","deepSpace","saturn","kepler","elysiajs","fastify","mars","none"]),Nt=St.enum(["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]),Rt=St.enum(["adonisjs","docusaurus","dotnet","elysiajs","express","fastapi","fastify","go","hono","html","laravel","litestar","nestjs","nextjs","nitro","nuxt","platformatic","react","rust","vue"]).nullable(),Pt=St.object({url:St.string().optional(),content:St.union([St.string(),St.record(St.any()),St.function().returns(St.record(St.any())),St.null()]).optional()}),$t=St.object({basePath:St.string()}),At=St.object({authentication:St.any().optional(),baseServerURL:St.string().optional(),hideClientButton:St.boolean().optional().default(!1).catch(!1),proxyUrl:St.string().optional(),searchHotKey:Nt.optional(),servers:St.array(St.any()).optional(),showSidebar:St.boolean().optional().default(!0).catch(!0),spec:Pt.optional(),theme:Et.optional().default("default").catch("default"),_integration:Rt.optional()}),It="https://api.scalar.com/request-proxy",Lt="https://proxy.scalar.com",Mt=At.merge(St.object({layout:St.enum(["modern","classic"]).optional().default("modern").catch("modern"),proxy:St.string().optional(),isEditable:St.boolean().optional().default(!1).catch(!1),hideModels:St.boolean().optional().default(!1).catch(!1),hideDownloadButton:St.boolean().optional().default(!1).catch(!1),hideTestRequestButton:St.boolean().optional().default(!1).catch(!1),hideSearch:St.boolean().optional().default(!1).catch(!1),darkMode:St.boolean().optional(),forceDarkModeState:St.enum(["dark","light"]).optional(),hideDarkModeToggle:St.boolean().optional().default(!1).catch(!1),metaData:St.any().optional(),favicon:St.string().optional(),hiddenClients:St.union([St.record(St.union([St.boolean(),St.array(St.string())])),St.array(St.string()),St.literal(!0)]).optional(),defaultHttpClient:St.object({targetKey:St.custom(),clientKey:St.string()}).optional(),customCss:St.string().optional(),onSpecUpdate:St.function().args(St.string()).returns(St.void()).optional(),onServerChange:St.function().args(St.string()).returns(St.void()).optional(),pathRouting:$t.optional(),generateHeadingSlug:St.function().args(St.object({slug:St.string().default("headingSlug")})).returns(St.string()).optional(),generateModelSlug:St.function().args(St.object({name:St.string().default("modelName")})).returns(St.string()).optional(),generateTagSlug:St.function().args(St.object({name:St.string().default("tagName")})).returns(St.string()).optional(),generateOperationSlug:St.function().args(St.object({path:St.string(),operationId:St.string().optional(),method:St.string(),summary:St.string().optional()})).returns(St.string()).optional(),generateWebhookSlug:St.function().args(St.object({name:St.string(),method:St.string().optional()})).returns(St.string()).optional(),onLoaded:St.union([St.function().returns(St.void()),St.undefined()]).optional(),redirect:St.function().args(St.string()).returns(St.string().nullable().optional()).optional(),withDefaultFonts:St.boolean().optional().default(!0).catch(!0),defaultOpenAllTags:St.boolean().optional(),tagsSorter:St.union([St.literal("alpha"),St.function().args(St.any(),St.any()).returns(St.number())]).optional(),operationsSorter:St.union([St.literal("alpha"),St.literal("method"),St.function().args(St.any(),St.any()).returns(St.number())]).optional()})).transform((e=>{const t={...e};var a;return t.customCss&&(t.customCss=(a=t.customCss,Ot.some((e=>a.includes(e)))?(console.warn("DEPRECATION WARNING: It looks like you're using legacy CSS variables in your custom CSS string. Please migrate them to use the updated prefixes. See https://github.com/scalar/scalar/blob/main/documentation/themes.md#theme-prefix-changes"),jt.reduce(((e,[t,a])=>e.replaceAll(t,a)),a)):a)),t.proxy&&(console.warn("[DEPRECATED] You’re using the deprecated 'proxy' attribute, rename it to 'proxyUrl' or update the package."),t.proxyUrl||(t.proxyUrl=t.proxy),delete t.proxy),t.proxyUrl===It&&(console.warn(`[DEPRECATED] Warning: configuration.proxyUrl points to our old proxy (${It}).`),console.warn(`[DEPRECATED] We are overwriting the value and use the new proxy URL (${Lt}) instead.`),console.warn(`[DEPRECATED] Action Required: You should manually update your configuration to use the new URL (${Lt}). Read more: https://github.com/scalar/scalar`),t.proxyUrl=Lt),t})),Dt=St.object({cdn:St.string().optional().default("https://cdn.jsdelivr.net/npm/@scalar/api-reference"),pageTitle:St.string().optional().default("Scalar API Reference")}),Ut=(e,t="")=>{const{cdn:a,pageTitle:n,...r}=e,s=Dt.parse({cdn:a,pageTitle:n,customTheme:t}),i=Mt.parse(r);return`\n <!DOCTYPE html>\n <html>\n <head>\n <title>${s.pageTitle}</title>\n <meta charset="utf-8" />\n <meta\n name="viewport"\n content="width=device-width, initial-scale=1" />\n <style>\n ${e.theme?"":t}\n </style>\n </head>\n <body>\n ${function(e,t){return`\n <script\n id="api-reference"\n type="application/json"\n data-configuration="${zt(e)}">${Vt(e)}<\/script>\n <script src="${t}"><\/script>\n `}(i,s.cdn)}\n </body>\n </html>\n `};const zt=e=>{var t,a,n;const r={...e};return(null==(t=r.spec)?void 0:t.url)?(null==(a=r.spec)?void 0:a.content)&&(null==(n=r.spec)||delete n.content):delete r.spec,JSON.stringify(r).split('"').join("&quot;")},Vt=e=>{var t,a,n,r;return(null==(t=e.spec)?void 0:t.content)?"function"==typeof(null==(a=e.spec)?void 0:a.content)?JSON.stringify(null==(n=e.spec)?void 0:n.content()):JSON.stringify(null==(r=e.spec)?void 0:r.content):""},Kt="js/scalar.js",qt={hide:!0},Wt=e=>{const t=e??"/reference";return t.endsWith("/")?t.slice(0,-1):t},Bt=e=>{const{json:t="/openapi.json",yaml:a="/openapi.yaml"}=e??{};return{json:t,yaml:a}},Ft={_integration:"fastify"},Jt=a((async(a,o)=>{const{configuration:d}=o;let c={...Ft,...d};const l=(()=>{const{content:e,url:t}=(null==c?void 0:c.spec)??{};return e?{type:"content",get:()=>"function"==typeof e?e():e}:t?{type:"url",get:()=>t}:a.hasPlugin("@fastify/swagger")?{type:"swagger",get:()=>a.swagger()}:void 0})();if(!l)return void a.log.warn("[@scalar/fastify-api-reference] You didn’t provide a spec.content or spec.url, and @fastify/swagger could not be found. Please provide one of these options.");const p=function(){const e=s.dirname(i.fileURLToPath("undefined"==typeof document?require("url").pathToFileURL(__filename).href:u&&"SCRIPT"===u.tagName.toUpperCase()&&u.src||new URL("index.cjs",document.baseURI).href)),t=[s.resolve(`${e}/js/standalone.js`),s.resolve(`${e}/../../dist/js/standalone.js`)].find((e=>r.existsSync(e)));if(void 0===t)throw new Error(`JavaScript file not found: ${s.resolve(`${e}/js/standalone.js`)}`);return r.readFileSync(t,"utf8")}(),h={};if(o.hooks){const e=["onRequest","preHandler"];for(const t of e)o.hooks[t]&&(h[t]=o.hooks[t])}const m=()=>e.openapi().load(l.get(),{plugins:[t.fetchUrls()]}),f=async e=>{var t,a;const r=await(null==e?void 0:e.get());return n.slug((null==(a=null==(t=null==r?void 0:r.specification)?void 0:t.info)?void 0:a.title)??"spec")},g=`${Wt(o.routePrefix)}${Bt(o.openApiDocumentEndpoints).json}`;a.route({method:"GET",url:g,schema:qt,...h,...o.logLevel&&{logLevel:o.logLevel},async handler(e,t){const a=m(),n=await f(a),r=JSON.parse(await a.toJson());return t.header("Content-Type","application/json").header("Content-Disposition",`filename=${n}.json`).header("Access-Control-Allow-Origin","*").header("Access-Control-Allow-Methods","*").send(r)}});const y=`${Wt(o.routePrefix)}${Bt(o.openApiDocumentEndpoints).yaml}`;a.route({method:"GET",url:y,schema:qt,...h,...o.logLevel&&{logLevel:o.logLevel},async handler(e,t){const a=m(),n=await f(a),r=await a.toYaml();return t.header("Content-Type","application/yaml").header("Content-Disposition",`filename=${n}.yaml`).header("Access-Control-Allow-Origin","*").header("Access-Control-Allow-Methods","*").send(r)}});var v;!0!==a.initialConfig.ignoreTrailingSlash&&Wt(o.routePrefix)&&a.route({method:"GET",url:Wt(o.routePrefix),schema:qt,...h,...o.logLevel&&{logLevel:o.logLevel},handler:(e,t)=>t.redirect(Wt(o.routePrefix)+"/",302)}),a.route({method:"GET",url:`${Wt(o.routePrefix)}/`,schema:qt,...h,...o.logLevel&&{logLevel:o.logLevel},handler(e,t){const a=new URL(e.url,`${e.protocol}://${e.hostname}`);return a.pathname.endsWith("/")?("url"!==l.type&&(c={...c,spec:{url:`.${Bt(o.openApiDocumentEndpoints).json}`}}),t.header("Content-Type","text/html; charset=utf-8").send(Ut({cdn:Kt,...c},"\n.light-mode {\n color-scheme: light;\n --scalar-color-1: #1c1e21;\n --scalar-color-2: #757575;\n --scalar-color-3: #8e8e8e;\n --scalar-color-disabled: #b4b1b1;\n --scalar-color-ghost: #a7a7a7;\n --scalar-color-accent: #2f8555;\n --scalar-background-1: #fff;\n --scalar-background-2: #f5f5f5;\n --scalar-background-3: #ededed;\n --scalar-background-4: rgba(0, 0, 0, 0.06);\n --scalar-background-accent: #2f85551f;\n\n --scalar-border-color: rgba(0, 0, 0, 0.1);\n --scalar-scrollbar-color: rgba(0, 0, 0, 0.18);\n --scalar-scrollbar-color-active: rgba(0, 0, 0, 0.36);\n --scalar-lifted-brightness: 1;\n --scalar-backdrop-brightness: 1;\n\n --scalar-shadow-1: 0 1px 3px 0 rgba(0, 0, 0, 0.11);\n --scalar-shadow-2: rgba(0, 0, 0, 0.08) 0px 13px 20px 0px,\n rgba(0, 0, 0, 0.08) 0px 3px 8px 0px, #eeeeed 0px 0 0 1px;\n\n --scalar-button-1: rgb(49 53 56);\n --scalar-button-1-color: #fff;\n --scalar-button-1-hover: rgb(28 31 33);\n\n --scalar-color-green: #007300;\n --scalar-color-red: #af272b;\n --scalar-color-yellow: #b38200;\n --scalar-color-blue: #3b8ba5;\n --scalar-color-orange: #fb892c;\n --scalar-color-purple: #5203d1;\n}\n\n.dark-mode {\n color-scheme: dark;\n --scalar-color-1: rgba(255, 255, 255, 0.9);\n --scalar-color-2: rgba(255, 255, 255, 0.62);\n --scalar-color-3: rgba(255, 255, 255, 0.44);\n --scalar-color-disabled: rgba(255, 255, 255, 0.34);\n --scalar-color-ghost: rgba(255, 255, 255, 0.26);\n --scalar-color-accent: #27c2a0;\n --scalar-background-1: #1b1b1d;\n --scalar-background-2: #242526;\n --scalar-background-3: #3b3b3b;\n --scalar-background-4: rgba(255, 255, 255, 0.06);\n --scalar-background-accent: #27c2a01f;\n\n --scalar-border-color: rgba(255, 255, 255, 0.1);\n --scalar-scrollbar-color: rgba(255, 255, 255, 0.24);\n --scalar-scrollbar-color-active: rgba(255, 255, 255, 0.48);\n --scalar-lifted-brightness: 1.45;\n --scalar-backdrop-brightness: 0.5;\n\n --scalar-shadow-1: 0 1px 3px 0 rgb(0, 0, 0, 0.1);\n --scalar-shadow-2: rgba(15, 15, 15, 0.2) 0px 3px 6px,\n rgba(15, 15, 15, 0.4) 0px 9px 24px, 0 0 0 1px rgba(255, 255, 255, 0.1);\n\n --scalar-button-1: #f6f6f6;\n --scalar-button-1-color: #000;\n --scalar-button-1-hover: #e7e7e7;\n\n --scalar-color-green: #26b226;\n --scalar-color-red: #fb565b;\n --scalar-color-yellow: #ffc426;\n --scalar-color-blue: #6ecfef;\n --scalar-color-orange: #ff8d4d;\n --scalar-color-purple: #b191f9;\n}\n"))):t.redirect(`${a.pathname}/`,301)}}),a.route({method:"GET",url:(v=o.routePrefix,`${Wt(v)}/${Kt}`.replace(/\/\//g,"/")),schema:qt,...h,...o.logLevel&&{logLevel:o.logLevel},handler:(e,t)=>t.header("Content-Type","application/javascript; charset=utf-8").send(p)})}),{name:"@scalar/fastify-api-reference"});module.exports=Jt;