UNPKG

shadcn-theme-editor

Version:
3 lines 92.3 kB
"use client"; import "./index.css"; "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("clsx"),n=require("class-variance-authority"),a=require("next-themes");function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var i=s(t),o=function(){return o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},o.apply(this,arguments)};function d(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(e);a<n.length;a++)t.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(e,n[a])&&(r[n[a]]=e[n[a]])}return r}"function"==typeof SuppressedError&&SuppressedError;var c=[{title:"Primary",variable:"--primary"},{title:"Primary Foreground",variable:"--primary-foreground"},{title:"Secondary",variable:"--secondary"},{title:"Secondary Foreground",variable:"--secondary-foreground"},{title:"Background",variable:"--background"},{title:"Foreground",variable:"--foreground"},{title:"Card",variable:"--card"},{title:"Card Foreground",variable:"--card-foreground"},{title:"Popover",variable:"--popover"},{title:"Popover Foreground",variable:"--popover-foreground"},{title:"Muted",variable:"--muted"},{title:"Muted Foreground",variable:"--muted-foreground"},{title:"Accent",variable:"--accent"},{title:"Accent Foreground",variable:"--accent-foreground"},{title:"Destructive",variable:"--destructive"},{title:"Destructive Foreground",variable:"--destructive-foreground"},{title:"Border",variable:"--border"},{title:"Input",variable:"--input"},{title:"Ring",variable:"--ring"}];function u(e){var t=c.find((function(t){return t.variable===e}));return t?t.title:void 0}var l,h,p=["light","dark"],f="shadcnTheme";!function(e){e.assertEqual=e=>e,e.assertIs=function(e){},e.assertNever=function(e){throw new Error},e.arrayToEnum=e=>{const t={};for(const r of e)t[r]=r;return t},e.getValidEnumValues=t=>{const r=e.objectKeys(t).filter((e=>"number"!=typeof t[t[e]])),n={};for(const e of r)n[e]=t[e];return e.objectValues(n)},e.objectValues=t=>e.objectKeys(t).map((function(e){return t[e]})),e.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},e.find=(e,t)=>{for(const r of e)if(t(r))return r},e.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,e.joinValues=function(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},e.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t}(l||(l={})),function(e){e.mergeShapes=(e,t)=>({...e,...t})}(h||(h={}));const m=l.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),v=e=>{switch(typeof e){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(e)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(e)?m.array:null===e?m.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?m.promise:"undefined"!=typeof Map&&e instanceof Map?m.map:"undefined"!=typeof Set&&e instanceof Set?m.set:"undefined"!=typeof Date&&e instanceof Date?m.date:m.object;default:return m.unknown}},g=l.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 y 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]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(e){return e.message},r={_errors:[]},n=e=>{for(const a of e.issues)if("invalid_union"===a.code)a.unionErrors.map(n);else if("invalid_return_type"===a.code)n(a.returnTypeError);else if("invalid_arguments"===a.code)n(a.argumentsError);else if(0===a.path.length)r._errors.push(t(a));else{let e=r,n=0;for(;n<a.path.length;){const r=a.path[n];n===a.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(a))):e[r]=e[r]||{_errors:[]},e=e[r],n++}}};return n(this),r}static assert(e){if(!(e instanceof y))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,l.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const t={},r=[];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))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}y.create=e=>new y(e);const _=(e,t)=>{let r;switch(e.code){case g.invalid_type:r=e.received===m.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case g.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,l.jsonStringifyReplacer)}`;break;case g.unrecognized_keys:r=`Unrecognized key(s) in object: ${l.joinValues(e.keys,", ")}`;break;case g.invalid_union:r="Invalid input";break;case g.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${l.joinValues(e.options)}`;break;case g.invalid_enum_value:r=`Invalid enum value. Expected ${l.joinValues(e.options)}, received '${e.received}'`;break;case g.invalid_arguments:r="Invalid function arguments";break;case g.invalid_return_type:r="Invalid function return type";break;case g.invalid_date:r="Invalid date";break;case g.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:l.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case g.too_small:r="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 g.too_big:r="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 g.custom:r="Invalid input";break;case g.invalid_intersection_types:r="Intersection results could not be merged";break;case g.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case g.not_finite:r="Number must be finite";break;default:r=t.defaultError,l.assertNever(e)}return{message:r}};let b=_;function x(){return b}const k=e=>{const{data:t,path:r,errorMaps:n,issueData:a}=e,s=[...r,...a.path||[]],i={...a,path:s};if(void 0!==a.message)return{...a,path:s,message:a.message};let o="";const d=n.filter((e=>!!e)).slice().reverse();for(const e of d)o=e(i,{data:t,defaultError:o}).message;return{...a,path:s,message:o}};function w(e,t){const r=x(),n=k({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===_?void 0:_].filter((e=>!!e))});e.common.issues.push(n)}class j{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const r=[];for(const n of t){if("aborted"===n.status)return N;"dirty"===n.status&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){const r=[];for(const e of t){const t=await e.key,n=await e.value;r.push({key:t,value:n})}return j.mergeObjectSync(e,r)}static mergeObjectSync(e,t){const r={};for(const n of t){const{key:t,value:a}=n;if("aborted"===t.status)return N;if("aborted"===a.status)return N;"dirty"===t.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===t.value||void 0===a.value&&!n.alwaysSet||(r[t.value]=a.value)}return{status:e.value,value:r}}}const N=Object.freeze({status:"aborted"}),Z=e=>({status:"dirty",value:e}),T=e=>({status:"valid",value:e}),O=e=>"aborted"===e.status,C=e=>"dirty"===e.status,S=e=>"valid"===e.status,E=e=>"undefined"!=typeof Promise&&e instanceof Promise;function A(e,t,r,n){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function I(e,t,r,n,a){if("function"==typeof t||!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,r),r}var M,R,P;"function"==typeof SuppressedError&&SuppressedError,function(e){e.errToObj=e=>"string"==typeof e?{message:e}:e||{},e.toString=e=>"string"==typeof e?e:null==e?void 0:e.message}(M||(M={}));class F{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,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 z=(e,t)=>{if(S(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 y(e.common.issues);return this._error=t,this._error}}};function $(e){if(!e)return{};const{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||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:a};return{errorMap:(t,a)=>{var s,i;const{message:o}=e;return"invalid_enum_value"===t.code?{message:null!=o?o:a.defaultError}:void 0===a.data?{message:null!==(s=null!=o?o:n)&&void 0!==s?s:a.defaultError}:"invalid_type"!==t.code?{message:a.defaultError}:{message:null!==(i=null!=o?o:r)&&void 0!==i?i:a.defaultError}},description:a}}class L{get description(){return this._def.description}_getType(e){return v(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:v(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new j,ctx:{common:e.parent.common,data:e.data,parsedType:v(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(E(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 r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;const n={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)},a=this._parseSync({data:e,path:n.path,parent:n});return z(n,a)}"~validate"(e){var t,r;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:v(e)};if(!this["~standard"].async)try{const t=this._parseSync({data:e,path:[],parent:n});return S(t)?{value:t.value}:{issues:n.common.issues}}catch(e){(null===(r=null===(t=null==e?void 0:e.message)||void 0===t?void 0:t.toLowerCase())||void 0===r?void 0:r.includes("encountered"))&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then((e=>S(e)?{value:e.value}:{issues:n.common.issues}))}async parseAsync(e,t){const r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){const r={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:v(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(E(n)?n:Promise.resolve(n));return z(r,a)}refine(e,t){const r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const a=e(t),s=()=>n.addIssue({code:g.custom,...r(t)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then((e=>!!e||(s(),!1))):!!a||(s(),!1)}))}refinement(e,t){return this._refinement(((r,n)=>!!e(r)||(n.addIssue("function"==typeof t?t(r,n):t),!1)))}_refinement(e){return new Le({schema:this,typeName:Xe.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 De.create(this,this._def)}nullable(){return Ve.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xe.create(this)}promise(){return $e.create(this,this._def)}or(e){return je.create([this,e],this._def)}and(e){return Oe.create(this,e,this._def)}transform(e){return new Le({...$(this._def),schema:this,typeName:Xe.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new Be({...$(this._def),innerType:this,defaultValue:t,typeName:Xe.ZodDefault})}brand(){return new qe({typeName:Xe.ZodBranded,type:this,...$(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new We({...$(this._def),innerType:this,catchValue:t,typeName:Xe.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return He.create(this,e)}readonly(){return Je.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const D=/^c[^\s-]{8,}$/i,V=/^[0-9a-z]+$/,B=/^[0-9A-HJKMNP-TV-Z]{26}$/i,W=/^[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,U=/^[a-z0-9_-]{21}$/i,K=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,q=/^[-+]?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)?)??$/,H=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let J;const Y=/^(?:(?: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])$/,G=/^(?:(?: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])$/,X=/^(([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]))$/,Q=/^(([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])$/,ee=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,te=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,re="((\\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])))",ne=new RegExp(`^${re}$`);function ae(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 se(e){let t=`${re}T${ae(e)}`;const r=[];return r.push(e.local?"Z?":"Z"),e.offset&&r.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function ie(e,t){if(!K.test(e))return!1;try{const[r]=e.split("."),n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),a=JSON.parse(atob(n));return"object"==typeof a&&null!==a&&(!(!a.typ||!a.alg)&&(!t||a.alg===t))}catch(e){return!1}}function oe(e,t){return!("v4"!==t&&t||!G.test(e))||!("v6"!==t&&t||!Q.test(e))}class de extends L{_parse(e){this._def.coerce&&(e.data=String(e.data));if(this._getType(e)!==m.string){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.string,received:t.parsedType}),N}const t=new j;let r;for(const s of this._def.checks)if("min"===s.kind)e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),w(r,{code:g.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("max"===s.kind)e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),w(r,{code:g.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),t.dirty());else if("length"===s.kind){const n=e.data.length>s.value,a=e.data.length<s.value;(n||a)&&(r=this._getOrReturnCtx(e,r),n?w(r,{code:g.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):a&&w(r,{code:g.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),t.dirty())}else if("email"===s.kind)H.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"email",code:g.invalid_string,message:s.message}),t.dirty());else if("emoji"===s.kind)J||(J=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),J.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"emoji",code:g.invalid_string,message:s.message}),t.dirty());else if("uuid"===s.kind)W.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"uuid",code:g.invalid_string,message:s.message}),t.dirty());else if("nanoid"===s.kind)U.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"nanoid",code:g.invalid_string,message:s.message}),t.dirty());else if("cuid"===s.kind)D.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"cuid",code:g.invalid_string,message:s.message}),t.dirty());else if("cuid2"===s.kind)V.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"cuid2",code:g.invalid_string,message:s.message}),t.dirty());else if("ulid"===s.kind)B.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"ulid",code:g.invalid_string,message:s.message}),t.dirty());else if("url"===s.kind)try{new URL(e.data)}catch(n){r=this._getOrReturnCtx(e,r),w(r,{validation:"url",code:g.invalid_string,message:s.message}),t.dirty()}else if("regex"===s.kind){s.regex.lastIndex=0;s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"regex",code:g.invalid_string,message:s.message}),t.dirty())}else if("trim"===s.kind)e.data=e.data.trim();else if("includes"===s.kind)e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),w(r,{code:g.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),t.dirty());else if("toLowerCase"===s.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===s.kind)e.data=e.data.toUpperCase();else if("startsWith"===s.kind)e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),w(r,{code:g.invalid_string,validation:{startsWith:s.value},message:s.message}),t.dirty());else if("endsWith"===s.kind)e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),w(r,{code:g.invalid_string,validation:{endsWith:s.value},message:s.message}),t.dirty());else if("datetime"===s.kind){se(s).test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{code:g.invalid_string,validation:"datetime",message:s.message}),t.dirty())}else if("date"===s.kind){ne.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{code:g.invalid_string,validation:"date",message:s.message}),t.dirty())}else if("time"===s.kind){new RegExp(`^${ae(s)}$`).test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{code:g.invalid_string,validation:"time",message:s.message}),t.dirty())}else"duration"===s.kind?q.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"duration",code:g.invalid_string,message:s.message}),t.dirty()):"ip"===s.kind?(n=e.data,("v4"!==(a=s.version)&&a||!Y.test(n))&&("v6"!==a&&a||!X.test(n))&&(r=this._getOrReturnCtx(e,r),w(r,{validation:"ip",code:g.invalid_string,message:s.message}),t.dirty())):"jwt"===s.kind?ie(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"jwt",code:g.invalid_string,message:s.message}),t.dirty()):"cidr"===s.kind?oe(e.data,s.version)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"cidr",code:g.invalid_string,message:s.message}),t.dirty()):"base64"===s.kind?ee.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"base64",code:g.invalid_string,message:s.message}),t.dirty()):"base64url"===s.kind?te.test(e.data)||(r=this._getOrReturnCtx(e,r),w(r,{validation:"base64url",code:g.invalid_string,message:s.message}),t.dirty()):l.assertNever(s);var n,a;return{status:t.value,value:e.data}}_regex(e,t,r){return this.refinement((t=>e.test(t)),{validation:t,code:g.invalid_string,...M.errToObj(r)})}_addCheck(e){return new de({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...M.errToObj(e)})}url(e){return this._addCheck({kind:"url",...M.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...M.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...M.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...M.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...M.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...M.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...M.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...M.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...M.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...M.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...M.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...M.errToObj(e)})}datetime(e){var t,r;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!==(r=null==e?void 0:e.local)&&void 0!==r&&r,...M.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,...M.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...M.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...M.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...M.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...M.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...M.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...M.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...M.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...M.errToObj(t)})}nonempty(e){return this.min(1,M.errToObj(e))}trim(){return new de({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new de({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new de({...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 isCIDR(){return!!this._def.checks.find((e=>"cidr"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get isBase64url(){return!!this._def.checks.find((e=>"base64url"===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 ce(e,t){const r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n;return parseInt(e.toFixed(a).replace(".",""))%parseInt(t.toFixed(a).replace(".",""))/Math.pow(10,a)}de.create=e=>{var t;return new de({checks:[],typeName:Xe.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$(e)})};class ue 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)!==m.number){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.number,received:t.parsedType}),N}let t;const r=new j;for(const n of this._def.checks)if("int"===n.kind)l.isInteger(e.data)||(t=this._getOrReturnCtx(e,t),w(t,{code:g.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty());else if("min"===n.kind){(n.inclusive?e.data<n.value:e.data<=n.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:g.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:g.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty())}else"multipleOf"===n.kind?0!==ce(e.data,n.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:g.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):"finite"===n.kind?Number.isFinite(e.data)||(t=this._getOrReturnCtx(e,t),w(t,{code:g.not_finite,message:n.message}),r.dirty()):l.assertNever(n);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,M.toString(t))}gt(e,t){return this.setLimit("min",e,!1,M.toString(t))}lte(e,t){return this.setLimit("max",e,!0,M.toString(t))}lt(e,t){return this.setLimit("max",e,!1,M.toString(t))}setLimit(e,t,r,n){return new ue({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:M.toString(n)}]})}_addCheck(e){return new ue({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:M.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:M.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:M.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:M.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:M.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:M.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:M.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:M.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:M.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&&l.isInteger(e.value)))}get isFinite(){let e=null,t=null;for(const r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ue.create=e=>new ue({checks:[],typeName:Xe.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...$(e)});class le extends L{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(t){return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let t;const r=new j;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),w(t,{code:g.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else if("max"===n.kind){(n.inclusive?e.data>n.value:e.data>=n.value)&&(t=this._getOrReturnCtx(e,t),w(t,{code:g.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty())}else"multipleOf"===n.kind?e.data%n.value!==BigInt(0)&&(t=this._getOrReturnCtx(e,t),w(t,{code:g.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):l.assertNever(n);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.bigint,received:t.parsedType}),N}gte(e,t){return this.setLimit("min",e,!0,M.toString(t))}gt(e,t){return this.setLimit("min",e,!1,M.toString(t))}lte(e,t){return this.setLimit("max",e,!0,M.toString(t))}lt(e,t){return this.setLimit("max",e,!1,M.toString(t))}setLimit(e,t,r,n){return new le({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:M.toString(n)}]})}_addCheck(e){return new le({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:M.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:M.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:M.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:M.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:M.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}}le.create=e=>{var t;return new le({checks:[],typeName:Xe.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...$(e)})};class he extends L{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==m.boolean){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.boolean,received:t.parsedType}),N}return T(e.data)}}he.create=e=>new he({typeName:Xe.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...$(e)});class pe extends L{_parse(e){this._def.coerce&&(e.data=new Date(e.data));if(this._getType(e)!==m.date){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.date,received:t.parsedType}),N}if(isNaN(e.data.getTime())){return w(this._getOrReturnCtx(e),{code:g.invalid_date}),N}const t=new j;let r;for(const n of this._def.checks)"min"===n.kind?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),w(r,{code:g.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),t.dirty()):"max"===n.kind?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),w(r,{code:g.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),t.dirty()):l.assertNever(n);return{status:t.value,value:new Date(e.data.getTime())}}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:M.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:M.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}}pe.create=e=>new pe({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:Xe.ZodDate,...$(e)});class fe extends L{_parse(e){if(this._getType(e)!==m.symbol){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.symbol,received:t.parsedType}),N}return T(e.data)}}fe.create=e=>new fe({typeName:Xe.ZodSymbol,...$(e)});class me extends L{_parse(e){if(this._getType(e)!==m.undefined){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.undefined,received:t.parsedType}),N}return T(e.data)}}me.create=e=>new me({typeName:Xe.ZodUndefined,...$(e)});class ve extends L{_parse(e){if(this._getType(e)!==m.null){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.null,received:t.parsedType}),N}return T(e.data)}}ve.create=e=>new ve({typeName:Xe.ZodNull,...$(e)});class ge extends L{constructor(){super(...arguments),this._any=!0}_parse(e){return T(e.data)}}ge.create=e=>new ge({typeName:Xe.ZodAny,...$(e)});class ye extends L{constructor(){super(...arguments),this._unknown=!0}_parse(e){return T(e.data)}}ye.create=e=>new ye({typeName:Xe.ZodUnknown,...$(e)});class _e extends L{_parse(e){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.never,received:t.parsedType}),N}}_e.create=e=>new _e({typeName:Xe.ZodNever,...$(e)});class be extends L{_parse(e){if(this._getType(e)!==m.undefined){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.void,received:t.parsedType}),N}return T(e.data)}}be.create=e=>new be({typeName:Xe.ZodVoid,...$(e)});class xe extends L{_parse(e){const{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==m.array)return w(t,{code:g.invalid_type,expected:m.array,received:t.parsedType}),N;if(null!==n.exactLength){const e=t.data.length>n.exactLength.value,a=t.data.length<n.exactLength.value;(e||a)&&(w(t,{code:e?g.too_big:g.too_small,minimum:a?n.exactLength.value:void 0,maximum:e?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(null!==n.minLength&&t.data.length<n.minLength.value&&(w(t,{code:g.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),null!==n.maxLength&&t.data.length>n.maxLength.value&&(w(t,{code:g.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map(((e,r)=>n.type._parseAsync(new F(t,e,t.path,r))))).then((e=>j.mergeArray(r,e)));const a=[...t.data].map(((e,r)=>n.type._parseSync(new F(t,e,t.path,r))));return j.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new xe({...this._def,minLength:{value:e,message:M.toString(t)}})}max(e,t){return new xe({...this._def,maxLength:{value:e,message:M.toString(t)}})}length(e,t){return new xe({...this._def,exactLength:{value:e,message:M.toString(t)}})}nonempty(e){return this.min(1,e)}}function ke(e){if(e instanceof we){const t={};for(const r in e.shape){const n=e.shape[r];t[r]=De.create(ke(n))}return new we({...e._def,shape:()=>t})}return e instanceof xe?new xe({...e._def,type:ke(e.element)}):e instanceof De?De.create(ke(e.unwrap())):e instanceof Ve?Ve.create(ke(e.unwrap())):e instanceof Ce?Ce.create(e.items.map((e=>ke(e)))):e}xe.create=(e,t)=>new xe({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Xe.ZodArray,...$(t)});class we 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=l.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==m.object){const t=this._getOrReturnCtx(e);return w(t,{code:g.invalid_type,expected:m.object,received:t.parsedType}),N}const{status:t,ctx:r}=this._processInputParams(e),{shape:n,keys:a}=this._getCached(),s=[];if(!(this._def.catchall instanceof _e&&"strip"===this._def.unknownKeys))for(const e in r.data)a.includes(e)||s.push(e);const i=[];for(const e of a){const t=n[e],a=r.data[e];i.push({key:{status:"valid",value:e},value:t._parse(new F(r,a,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof _e){const e=this._def.unknownKeys;if("passthrough"===e)for(const e of s)i.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)s.length>0&&(w(r,{code:g.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=r.data[t];i.push({key:{status:"valid",value:t},value:e._parse(new F(r,n,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of i){const r=await t.key,n=await t.value;e.push({key:r,value:n,alwaysSet:t.alwaysSet})}return e})).then((e=>j.mergeObjectSync(t,e))):j.mergeObjectSync(t,i)}get shape(){return this._def.shape()}strict(e){return M.errToObj,new we({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var n,a,s,i;const o=null!==(s=null===(a=(n=this._def).errorMap)||void 0===a?void 0:a.call(n,t,r).message)&&void 0!==s?s:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(i=M.errToObj(e).message)&&void 0!==i?i:o}:{message:o}}}:{}})}strip(){return new we({...this._def,unknownKeys:"strip"})}passthrough(){return new we({...this._def,unknownKeys:"passthrough"})}extend(e){return new we({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new we({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Xe.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new we({...this._def,catchall:e})}pick(e){const t={};return l.objectKeys(e).forEach((r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])})),new we({...this._def,shape:()=>t})}omit(e){const t={};return l.objectKeys(this.shape).forEach((r=>{e[r]||(t[r]=this.shape[r])})),new we({...this._def,shape:()=>t})}deepPartial(){return ke(this)}partial(e){const t={};return l.objectKeys(this.shape).forEach((r=>{const n=this.shape[r];e&&!e[r]?t[r]=n:t[r]=n.optional()})),new we({...this._def,shape:()=>t})}required(e){const t={};return l.objectKeys(this.shape).forEach((r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof De;)e=e._def.innerType;t[r]=e}})),new we({...this._def,shape:()=>t})}keyof(){return Pe(l.objectKeys(this.shape))}}we.create=(e,t)=>new we({shape:()=>e,unknownKeys:"strip",catchall:_e.create(),typeName:Xe.ZodObject,...$(t)}),we.strictCreate=(e,t)=>new we({shape:()=>e,unknownKeys:"strict",catchall:_e.create(),typeName:Xe.ZodObject,...$(t)}),we.lazycreate=(e,t)=>new we({shape:e,unknownKeys:"strip",catchall:_e.create(),typeName:Xe.ZodObject,...$(t)});class je extends L{_parse(e){const{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map((async e=>{const r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}}))).then((function(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;const r=e.map((e=>new y(e.ctx.common.issues)));return w(t,{code:g.invalid_union,unionErrors:r}),N}));{let e;const n=[];for(const a of r){const r={...t,common:{...t.common,issues:[]},parent:null},s=a._parseSync({data:t.data,path:t.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&n.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=n.map((e=>new y(e)));return w(t,{code:g.invalid_union,unionErrors:a}),N}}get options(){return this._def.options}}je.create=(e,t)=>new je({options:e,typeName:Xe.ZodUnion,...$(t)});const Ne=e=>e instanceof Me?Ne(e.schema):e instanceof Le?Ne(e.innerType()):e instanceof Re?[e.value]:e instanceof Fe?e.options:e instanceof ze?l.objectValues(e.enum):e instanceof Be?Ne(e._def.innerType):e instanceof me?[void 0]:e instanceof ve?[null]:e instanceof De?[void 0,...Ne(e.unwrap())]:e instanceof Ve?[null,...Ne(e.unwrap())]:e instanceof qe||e instanceof Je?Ne(e.unwrap()):e instanceof We?Ne(e._def.innerType):[];class Ze extends L{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.object)return w(t,{code:g.invalid_type,expected:m.object,received:t.parsedType}),N;const r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(w(t,{code:g.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),N)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){const n=new Map;for(const r of t){const t=Ne(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 Ze({typeName:Xe.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...$(r)})}}function Te(e,t){const r=v(e),n=v(t);if(e===t)return{valid:!0,data:e};if(r===m.object&&n===m.object){const r=l.objectKeys(t),n=l.objectKeys(e).filter((e=>-1!==r.indexOf(e))),a={...e,...t};for(const r of n){const n=Te(e[r],t[r]);if(!n.valid)return{valid:!1};a[r]=n.data}return{valid:!0,data:a}}if(r===m.array&&n===m.array){if(e.length!==t.length)return{valid:!1};const r=[];for(let n=0;n<e.length;n++){const a=Te(e[n],t[n]);if(!a.valid)return{valid:!1};r.push(a.data)}return{valid:!0,data:r}}return r===m.date&&n===m.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Oe extends L{_parse(e){const{status:t,ctx:r}=this._processInputParams(e),n=(e,n)=>{if(O(e)||O(n))return N;const a=Te(e.value,n.value);return a.valid?((C(e)||C(n))&&t.dirty(),{status:t.value,value:a.data}):(w(r,{code:g.invalid_intersection_types}),N)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then((([e,t])=>n(e,t))):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Oe.create=(e,t,r)=>new Oe({left:e,right:t,typeName:Xe.ZodIntersection,...$(r)});class Ce extends L{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.array)return w(r,{code:g.invalid_type,expected:m.array,received:r.parsedType}),N;if(r.data.length<this._def.items.length)return w(r,{code:g.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),N;!this._def.rest&&r.data.length>this._def.items.length&&(w(r,{code:g.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const n=[...r.data].map(((e,t)=>{const n=this._def.items[t]||this._def.rest;return n?n._parse(new F(r,e,r.path,t)):null})).filter((e=>!!e));return r.common.async?Promise.all(n).then((e=>j.mergeArray(t,e))):j.mergeArray(t,n)}get items(){return this._def.items}rest(e){return new Ce({...this._def,rest:e})}}Ce.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ce({items:e,typeName:Xe.ZodTuple,rest:null,...$(t)})};class Se extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.object)return w(r,{code:g.invalid_type,expected:m.object,received:r.parsedType}),N;const n=[],a=this._def.keyType,s=this._def.valueType;for(const e in r.data)n.push({key:a._parse(new F(r,e,r.path,e)),value:s._parse(new F(r,r.data[e],r.path,e)),alwaysSet:e in r.data});return r.common.async?j.mergeObjectAsync(t,n):j.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return new Se(t instanceof L?{keyType:e,valueType:t,typeName:Xe.ZodRecord,...$(r)}:{keyType:de.create(),valueType:e,typeName:Xe.ZodRecord,...$(t)})}}class Ee extends L{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.map)return w(r,{code:g.invalid_type,expected:m.map,received:r.parsedType}),N;const n=this._def.keyType,a=this._def.valueType,s=[...r.data.entries()].map((([e,t],s)=>({key:n._parse(new F(r,e,r.path,[s,"key"])),value:a._parse(new F(r,t,r.path,[s,"value"]))})));if(r.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const r of s){const n=await r.key,a=await r.value;if("aborted"===n.status||"aborted"===a.status)return N;"dirty"!==n.status&&"dirty"!==a.status||t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const r of s){const n=r.key,a=r.value;if("aborted"===n.status||"aborted"===a.status)return N;"dirty"!==n.status&&"dirty"!==a.status||t.dirty(),e.set(n.value,a.value)}return{status:t.value,value:e}}}}Ee.create=(e,t,r)=>new Ee({valueType:t,keyType:e,typeName:Xe.ZodMap,...$(r)});class Ae extends L{_parse(e){const{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==m.set)return w(r,{code:g.invalid_type,expected:m.set,received:r.parsedType}),N;const n=this._def;null!==n.minSize&&r.data.size<n.minSize.value&&(w(r,{code:g.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),null!==n.maxSize&&r.data.size>n.maxSize.value&&(w(r,{code:g.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());const a=this._def.valueType;function s(e){const r=new Set;for(const n of e){if("aborted"===n.status)return N;"dirty"===n.status&&t.dirty(),r.add(n.value)}return{status:t.value,value:r}}const i=[...r.data.values()].map(((e,t)=>a._parse(new F(r,e,r.path,t))));return r.common.async?Promise.all(i).then((e=>s(e))):s(i)}min(e,t){return new Ae({...this._def,minSize:{value:e,message:M.toString(t)}})}max(e,t){return new Ae({...this._def,maxSize:{value:e,message:M.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ae.create=(e,t)=>new Ae({valueType:e,minSize:null,maxSize:null,typeName:Xe.ZodSet,...$(t)});class Ie extends L{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return w(t,{