prettier-plugin-brace-style
Version:
A Prettier plugin that can apply ESLint's brace-style rules.
1 lines • 71.2 kB
JavaScript
"use strict";var Ie=Object.defineProperty;var mt=Object.getOwnPropertyDescriptor;var gt=Object.getOwnPropertyNames;var yt=Object.prototype.hasOwnProperty;var vt=(t,e)=>{for(var r in e)Ie(t,r,{get:e[r],enumerable:!0})},_t=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of gt(e))!yt.call(t,s)&&s!==r&&Ie(t,s,{get:()=>e[s],enumerable:!(n=mt(e,s))||n.enumerable});return t};var bt=t=>_t(Ie({},"__esModule",{value:!0}),t);var Hr={};vt(Hr,{options:()=>We,parsers:()=>ft,printers:()=>ht});module.exports=bt(Hr);var We={braceStyle:{since:"0.1.0",type:"choice",category:"Format",default:"1tbs",description:"Enforces consistent brace style for blocks.",choices:[{value:"1tbs",description:"one true brace style"},{value:"stroustrup",description:"Stroustrup style"},{value:"allman",description:"Allman style"}]}};var ze=require("prettier"),Ue=require("prettier/plugins/babel"),Be=require("prettier/plugins/html"),Pe=require("prettier/plugins/postcss"),pt=require("prettier/plugins/typescript");var S;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function r(s){throw new Error}t.assertNever=r,t.arrayToEnum=s=>{let a={};for(let o of s)a[o]=o;return a},t.getValidEnumValues=s=>{let a=t.objectKeys(s).filter(i=>typeof s[s[i]]!="number"),o={};for(let i of a)o[i]=s[i];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&a.push(o);return a},t.find=(s,a)=>{for(let o of s)if(a(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(a)}t.joinValues=n,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(S||(S={}));var $e;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})($e||($e={}));var p=S.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),z=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}},l=S.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"]),Tt=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),E=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let r=e||function(a){return a.message},n={_errors:[]},s=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)n._errors.push(r(o));else{let i=n,u=0;for(;u<o.path.length;){let d=o.path[u];u===o.path.length-1?(i[d]=i[d]||{_errors:[]},i[d]._errors.push(r(o))):i[d]=i[d]||{_errors:[]},i=i[d],u++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,S.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},n=[];for(let s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};E.create=t=>new E(t);var ye=(t,e)=>{let r;switch(t.code){case l.invalid_type:t.received===p.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case l.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,S.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:r=`Unrecognized key(s) in object: ${S.joinValues(t.keys,", ")}`;break;case l.invalid_union:r="Invalid input";break;case l.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${S.joinValues(t.options)}`;break;case l.invalid_enum_value:r=`Invalid enum value. Expected ${S.joinValues(t.options)}, received '${t.received}'`;break;case l.invalid_arguments:r="Invalid function arguments";break;case l.invalid_return_type:r="Invalid function return type";break;case l.invalid_date:r="Invalid date";break;case l.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:S.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case l.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case l.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case l.custom:r="Invalid input";break;case l.invalid_intersection_types:r="Intersection results could not be merged";break;case l.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case l.not_finite:r="Number must be finite";break;default:r=e.defaultError,S.assertNever(t)}return{message:r}},Fe=ye;function Nt(t){Fe=t}function ke(){return Fe}var xe=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,a=[...r,...s.path||[]],o={...s,path:a},i="",u=n.filter(d=>!!d).slice().reverse();for(let d of u)i=d(o,{data:e,defaultError:i}).message;return{...s,path:a,message:s.message||i}},St=[];function h(t,e){let r=xe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ke(),ye].filter(n=>!!n)});t.common.issues.push(r)}var C=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let n=[];for(let s of r){if(s.status==="aborted")return y;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,r){let n=[];for(let s of r)n.push({key:await s.key,value:await s.value});return t.mergeObjectSync(e,n)}static mergeObjectSync(e,r){let n={};for(let s of r){let{key:a,value:o}=s;if(a.status==="aborted"||o.status==="aborted")return y;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(n[a.value]=o.value)}return{status:e.value,value:n}}},y=Object.freeze({status:"aborted"}),Ye=t=>({status:"dirty",value:t}),O=t=>({status:"valid",value:t}),Le=t=>t.status==="aborted",Me=t=>t.status==="dirty",ve=t=>t.status==="valid",we=t=>typeof Promise<"u"&&t instanceof Promise,m;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));var P=class{constructor(e,r,n,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=n,this._key=s}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}},qe=(t,e)=>{if(ve(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new E(t.common.issues);return this._error=r,this._error}}};function v(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:n,description:s}=t;if(e&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,i)=>o.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:n??i.defaultError}:{message:r??i.defaultError},description:s}}var _=class{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 z(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new C,ctx:{common:e.parent.common,data:e.data,parsedType:z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(we(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let n=this.safeParse(e,r);if(n.success)return n.data;throw n.error}safeParse(e,r){var n;let s={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:z(e)},a=this._parseSync({data:e,path:s.path,parent:s});return qe(s,a)}async parseAsync(e,r){let n=await this.safeParseAsync(e,r);if(n.success)return n.data;throw n.error}async safeParseAsync(e,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:z(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(we(s)?s:Promise.resolve(s));return qe(n,a)}refine(e,r){let n=s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r;return this._refinement((s,a)=>{let o=e(s),i=()=>a.addIssue({code:l.custom,...n(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,r){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(e){return new R({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Z.create(this,this._def)}nullable(){return D.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return V.create(this,this._def)}promise(){return q.create(this,this._def)}or(e){return K.create([this,e],this._def)}and(e){return ee.create(this,e,this._def)}transform(e){return new R({...v(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ae({...v(this._def),innerType:this,defaultValue:r,typeName:g.ZodDefault})}brand(){return new je({typeName:g.ZodBranded,type:this,...v(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new fe({...v(this._def),innerType:this,catchValue:r,typeName:g.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return _e.create(this,e)}readonly(){return me.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},kt=/^c[^\s-]{8,}$/i,xt=/^[a-z][a-z0-9]*$/,wt=/^[0-9A-HJKMNP-TV-Z]{26}$/,Ct=/^[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,Ot=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,At="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ze,jt=/^(((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}))$/,Et=/^(([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})))$/,Rt=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function Bt(t,e){return!!((e==="v4"||!e)&&jt.test(t)||(e==="v6"||!e)&&Et.test(t))}var U=class t extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:p.string,received:a.parsedType}),y}let n=new C,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(s=this._getOrReturnCtx(e,s),o?h(s,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&h(s,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")Ot.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"email",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Ze||(Ze=new RegExp(At,"u")),Ze.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"emoji",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")Ct.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"uuid",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")kt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")xt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"cuid2",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")wt.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ulid",code:l.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),h(s,{validation:"url",code:l.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"regex",code:l.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),h(s,{code:l.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:l.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),h(s,{code:l.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?Rt(a).test(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:l.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?Bt(e.data,a.version)||(s=this._getOrReturnCtx(e,s),h(s,{validation:"ip",code:l.invalid_string,message:a.message}),n.dirty()):S.assertNever(a);return{status:n.value,value:e.data}}_regex(e,r,n){return this.refinement(s=>e.test(s),{validation:r,code:l.invalid_string,...m.errToObj(n)})}_addCheck(e){return new t({...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)})}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)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}datetime(e){var r;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(r=e?.offset)!==null&&r!==void 0?r:!1,...m.errToObj(e?.message)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...m.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...m.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...m.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...m.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...m.errToObj(r)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};U.create=t=>{var e;return new U({checks:[],typeName:g.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...v(t)})};function Pt(t,e){let r=(t.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=r>n?r:n,a=parseInt(t.toFixed(s).replace(".","")),o=parseInt(e.toFixed(s).replace(".",""));return a%o/Math.pow(10,s)}var J=class t extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){let a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:p.number,received:a.parsedType}),y}let n,s=new C;for(let a of this._def.checks)a.kind==="int"?S.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:l.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:l.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:l.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?Pt(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),h(n,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),h(n,{code:l.not_finite,message:a.message}),s.dirty()):S.assertNever(a);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,m.toString(r))}gt(e,r){return this.setLimit("min",e,!1,m.toString(r))}lte(e,r){return this.setLimit("max",e,!0,m.toString(r))}lt(e,r){return this.setLimit("max",e,!1,m.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:m.toString(s)}]})}_addCheck(e){return new t({...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,r){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(r)})}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(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&S.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(r===null||n.value>r)&&(r=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(r)&&Number.isFinite(e)}};J.create=t=>new J({checks:[],typeName:g.ZodNumber,coerce:t?.coerce||!1,...v(t)});var F=class t extends _{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==p.bigint){let a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:p.bigint,received:a.parsedType}),y}let n,s=new C;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:l.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),h(n,{code:l.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),h(n,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):S.assertNever(a);return{status:s.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,m.toString(r))}gt(e,r){return this.setLimit("min",e,!1,m.toString(r))}lte(e,r){return this.setLimit("max",e,!0,m.toString(r))}lt(e,r){return this.setLimit("max",e,!1,m.toString(r))}setLimit(e,r,n,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:n,message:m.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message: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,r){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};F.create=t=>{var e;return new F({checks:[],typeName:g.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...v(t)})};var Y=class extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:p.boolean,received:n.parsedType}),y}return O(e.data)}};Y.create=t=>new Y({typeName:g.ZodBoolean,coerce:t?.coerce||!1,...v(t)});var G=class t extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:p.date,received:a.parsedType}),y}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_date}),y}let n=new C,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):S.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};G.create=t=>new G({checks:[],coerce:t?.coerce||!1,typeName:g.ZodDate,...v(t)});var de=class extends _{_parse(e){if(this._getType(e)!==p.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:p.symbol,received:n.parsedType}),y}return O(e.data)}};de.create=t=>new de({typeName:g.ZodSymbol,...v(t)});var X=class extends _{_parse(e){if(this._getType(e)!==p.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:p.undefined,received:n.parsedType}),y}return O(e.data)}};X.create=t=>new X({typeName:g.ZodUndefined,...v(t)});var Q=class extends _{_parse(e){if(this._getType(e)!==p.null){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:p.null,received:n.parsedType}),y}return O(e.data)}};Q.create=t=>new Q({typeName:g.ZodNull,...v(t)});var W=class extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return O(e.data)}};W.create=t=>new W({typeName:g.ZodAny,...v(t)});var M=class extends _{constructor(){super(...arguments),this._unknown=!0}_parse(e){return O(e.data)}};M.create=t=>new M({typeName:g.ZodUnknown,...v(t)});var $=class extends _{_parse(e){let r=this._getOrReturnCtx(e);return h(r,{code:l.invalid_type,expected:p.never,received:r.parsedType}),y}};$.create=t=>new $({typeName:g.ZodNever,...v(t)});var ue=class extends _{_parse(e){if(this._getType(e)!==p.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:p.void,received:n.parsedType}),y}return O(e.data)}};ue.create=t=>new ue({typeName:g.ZodVoid,...v(t)});var V=class t extends _{_parse(e){let{ctx:r,status:n}=this._processInputParams(e),s=this._def;if(r.parsedType!==p.array)return h(r,{code:l.invalid_type,expected:p.array,received:r.parsedType}),y;if(s.exactLength!==null){let o=r.data.length>s.exactLength.value,i=r.data.length<s.exactLength.value;(o||i)&&(h(r,{code:o?l.too_big:l.too_small,minimum:i?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(h(r,{code:l.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(h(r,{code:l.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all([...r.data].map((o,i)=>s.type._parseAsync(new P(r,o,r.path,i)))).then(o=>C.mergeArray(n,o));let a=[...r.data].map((o,i)=>s.type._parseSync(new P(r,o,r.path,i)));return C.mergeArray(n,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:m.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:m.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:m.toString(r)}})}nonempty(e){return this.min(1,e)}};V.create=(t,e)=>new V({type:t,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...v(e)});function ce(t){if(t instanceof A){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Z.create(ce(n))}return new A({...t._def,shape:()=>e})}else return t instanceof V?new V({...t._def,type:ce(t.element)}):t instanceof Z?Z.create(ce(t.unwrap())):t instanceof D?D.create(ce(t.unwrap())):t instanceof L?L.create(t.items.map(e=>ce(e))):t}var A=class t extends _{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=S.objectKeys(e);return this._cached={shape:e,keys:r}}_parse(e){if(this._getType(e)!==p.object){let d=this._getOrReturnCtx(e);return h(d,{code:l.invalid_type,expected:p.object,received:d.parsedType}),y}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof $&&this._def.unknownKeys==="strip"))for(let d in s.data)o.includes(d)||i.push(d);let u=[];for(let d of o){let f=a[d],N=s.data[d];u.push({key:{status:"valid",value:d},value:f._parse(new P(s,N,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof $){let d=this._def.unknownKeys;if(d==="passthrough")for(let f of i)u.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(d==="strict")i.length>0&&(h(s,{code:l.unrecognized_keys,keys:i}),n.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let f of i){let N=s.data[f];u.push({key:{status:"valid",value:f},value:d._parse(new P(s,N,s.path,f)),alwaysSet:f in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let d=[];for(let f of u){let N=await f.key;d.push({key:N,value:await f.value,alwaysSet:f.alwaysSet})}return d}).then(d=>C.mergeObjectSync(n,d)):C.mergeObjectSync(n,u)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,n)=>{var s,a,o,i;let u=(o=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,r,n).message)!==null&&o!==void 0?o:n.defaultError;return r.code==="unrecognized_keys"?{message:(i=m.errToObj(e).message)!==null&&i!==void 0?i:u}:{message:u}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};return S.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}omit(e){let r={};return S.objectKeys(this.shape).forEach(n=>{e[n]||(r[n]=this.shape[n])}),new t({...this._def,shape:()=>r})}deepPartial(){return ce(this)}partial(e){let r={};return S.objectKeys(this.shape).forEach(n=>{let s=this.shape[n];e&&!e[n]?r[n]=s:r[n]=s.optional()}),new t({...this._def,shape:()=>r})}required(e){let r={};return S.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])r[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof Z;)a=a._def.innerType;r[n]=a}}),new t({...this._def,shape:()=>r})}keyof(){return Ge(S.objectKeys(this.shape))}};A.create=(t,e)=>new A({shape:()=>t,unknownKeys:"strip",catchall:$.create(),typeName:g.ZodObject,...v(e)});A.strictCreate=(t,e)=>new A({shape:()=>t,unknownKeys:"strict",catchall:$.create(),typeName:g.ZodObject,...v(e)});A.lazycreate=(t,e)=>new A({shape:t,unknownKeys:"strip",catchall:$.create(),typeName:g.ZodObject,...v(e)});var K=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),n=this._def.options;function s(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return r.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(i=>new E(i.ctx.common.issues));return h(r,{code:l.invalid_union,unionErrors:o}),y}if(r.common.async)return Promise.all(n.map(async a=>{let o={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:o}),ctx:o}})).then(s);{let a,o=[];for(let u of n){let d={...r,common:{...r.common,issues:[]},parent:null},f=u._parseSync({data:r.data,path:r.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(u=>new E(u));return h(r,{code:l.invalid_union,unionErrors:i}),y}}get options(){return this._def.options}};K.create=(t,e)=>new K({options:t,typeName:g.ZodUnion,...v(e)});var Se=t=>t instanceof te?Se(t.schema):t instanceof R?Se(t.innerType()):t instanceof re?[t.value]:t instanceof ne?t.options:t instanceof se?Object.keys(t.enum):t instanceof ae?Se(t._def.innerType):t instanceof X?[void 0]:t instanceof Q?[null]:null,Ce=class t extends _{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return h(r,{code:l.invalid_type,expected:p.object,received:r.parsedType}),y;let n=this.discriminator,s=r.data[n],a=this.optionsMap.get(s);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(h(r,{code:l.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),y)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,n){let s=new Map;for(let a of r){let o=Se(a.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(s.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,a)}}return new t({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...v(n)})}};function Ve(t,e){let r=z(t),n=z(e);if(t===e)return{valid:!0,data:t};if(r===p.object&&n===p.object){let s=S.objectKeys(e),a=S.objectKeys(t).filter(i=>s.indexOf(i)!==-1),o={...t,...e};for(let i of a){let u=Ve(t[i],e[i]);if(!u.valid)return{valid:!1};o[i]=u.data}return{valid:!0,data:o}}else if(r===p.array&&n===p.array){if(t.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<t.length;a++){let o=t[a],i=e[a],u=Ve(o,i);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return r===p.date&&n===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var ee=class extends _{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(a,o)=>{if(Le(a)||Le(o))return y;let i=Ve(a.value,o.value);return i.valid?((Me(a)||Me(o))&&r.dirty(),{status:r.value,value:i.data}):(h(n,{code:l.invalid_intersection_types}),y)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,o])=>s(a,o)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};ee.create=(t,e,r)=>new ee({left:t,right:e,typeName:g.ZodIntersection,...v(r)});var L=class t extends _{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.array)return h(n,{code:l.invalid_type,expected:p.array,received:n.parsedType}),y;if(n.data.length<this._def.items.length)return h(n,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),y;!this._def.rest&&n.data.length>this._def.items.length&&(h(n,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...n.data].map((o,i)=>{let u=this._def.items[i]||this._def.rest;return u?u._parse(new P(n,o,n.path,i)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>C.mergeArray(r,o)):C.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};L.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new L({items:t,typeName:g.ZodTuple,rest:null,...v(e)})};var Oe=class t extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return h(n,{code:l.invalid_type,expected:p.object,received:n.parsedType}),y;let s=[],a=this._def.keyType,o=this._def.valueType;for(let i in n.data)s.push({key:a._parse(new P(n,i,n.path,i)),value:o._parse(new P(n,n.data[i],n.path,i))});return n.common.async?C.mergeObjectAsync(r,s):C.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(e,r,n){return r instanceof _?new t({keyType:e,valueType:r,typeName:g.ZodRecord,...v(n)}):new t({keyType:U.create(),valueType:e,typeName:g.ZodRecord,...v(r)})}},le=class extends _{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.map)return h(n,{code:l.invalid_type,expected:p.map,received:n.parsedType}),y;let s=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([i,u],d)=>({key:s._parse(new P(n,i,n.path,[d,"key"])),value:a._parse(new P(n,u,n.path,[d,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let u of o){let d=await u.key,f=await u.value;if(d.status==="aborted"||f.status==="aborted")return y;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),i.set(d.value,f.value)}return{status:r.value,value:i}})}else{let i=new Map;for(let u of o){let d=u.key,f=u.value;if(d.status==="aborted"||f.status==="aborted")return y;(d.status==="dirty"||f.status==="dirty")&&r.dirty(),i.set(d.value,f.value)}return{status:r.value,value:i}}}};le.create=(t,e,r)=>new le({valueType:e,keyType:t,typeName:g.ZodMap,...v(r)});var pe=class t extends _{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==p.set)return h(n,{code:l.invalid_type,expected:p.set,received:n.parsedType}),y;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(h(n,{code:l.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(h(n,{code:l.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let a=this._def.valueType;function o(u){let d=new Set;for(let f of u){if(f.status==="aborted")return y;f.status==="dirty"&&r.dirty(),d.add(f.value)}return{status:r.value,value:d}}let i=[...n.data.values()].map((u,d)=>a._parse(new P(n,u,n.path,d)));return n.common.async?Promise.all(i).then(u=>o(u)):o(i)}min(e,r){return new t({...this._def,minSize:{value:e,message:m.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:m.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};pe.create=(t,e)=>new pe({valueType:t,minSize:null,maxSize:null,typeName:g.ZodSet,...v(e)});var Ae=class t extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.function)return h(r,{code:l.invalid_type,expected:p.function,received:r.parsedType}),y;function n(i,u){return xe({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ke(),ye].filter(d=>!!d),issueData:{code:l.invalid_arguments,argumentsError:u}})}function s(i,u){return xe({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ke(),ye].filter(d=>!!d),issueData:{code:l.invalid_return_type,returnTypeError:u}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof q){let i=this;return O(async function(...u){let d=new E([]),f=await i._def.args.parseAsync(u,a).catch(b=>{throw d.addIssue(n(u,b)),d}),N=await Reflect.apply(o,this,f);return await i._def.returns._def.type.parseAsync(N,a).catch(b=>{throw d.addIssue(s(N,b)),d})})}else{let i=this;return O(function(...u){let d=i._def.args.safeParse(u,a);if(!d.success)throw new E([n(u,d.error)]);let f=Reflect.apply(o,this,d.data),N=i._def.returns.safeParse(f,a);if(!N.success)throw new E([s(f,N.error)]);return N.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:L.create(e).rest(M.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,n){return new t({args:e||L.create([]).rest(M.create()),returns:r||M.create(),typeName:g.ZodFunction,...v(n)})}},te=class extends _{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};te.create=(t,e)=>new te({getter:t,typeName:g.ZodLazy,...v(e)});var re=class extends _{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return h(r,{received:r.data,code:l.invalid_literal,expected:this._def.value}),y}return{status:"valid",value:e.data}}get value(){return this._def.value}};re.create=(t,e)=>new re({value:t,typeName:g.ZodLiteral,...v(e)});function Ge(t,e){return new ne({values:t,typeName:g.ZodEnum,...v(e)})}var ne=class t extends _{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),n=this._def.values;return h(r,{expected:S.joinValues(n),received:r.parsedType,code:l.invalid_type}),y}if(this._def.values.indexOf(e.data)===-1){let r=this._getOrReturnCtx(e),n=this._def.values;return h(r,{received:r.data,code:l.invalid_enum_value,options:n}),y}return O(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e){return t.create(e)}exclude(e){return t.create(this.options.filter(r=>!e.includes(r)))}};ne.create=Ge;var se=class extends _{_parse(e){let r=S.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==p.string&&n.parsedType!==p.number){let s=S.objectValues(r);return h(n,{expected:S.joinValues(s),received:n.parsedType,code:l.invalid_type}),y}if(r.indexOf(e.data)===-1){let s=S.objectValues(r);return h(n,{received:n.data,code:l.invalid_enum_value,options:s}),y}return O(e.data)}get enum(){return this._def.values}};se.create=(t,e)=>new se({values:t,typeName:g.ZodNativeEnum,...v(e)});var q=class extends _{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.promise&&r.common.async===!1)return h(r,{code:l.invalid_type,expected:p.promise,received:r.parsedType}),y;let n=r.parsedType===p.promise?r.data:Promise.resolve(r.data);return O(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};q.create=(t,e)=>new q({type:t,typeName:g.ZodPromise,...v(e)});var R=class extends _{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:o=>{h(n,o),o.fatal?r.abort():r.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let o=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(o).then(i=>this._def.schema._parseAsync({data:i,path:n.path,parent:n})):this._def.schema._parseSync({data:o,path:n.path,parent:n})}if(s.type==="refinement"){let o=i=>{let u=s.refinement(i,a);if(n.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(n.common.async===!1){let i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?y:(i.status==="dirty"&&r.dirty(),o(i.value),{status:r.value,value:i.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>i.status==="aborted"?y:(i.status==="dirty"&&r.dirty(),o(i.value).then(()=>({status:r.value,value:i.value}))))}if(s.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ve(o))return o;let i=s.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:i}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>ve(o)?Promise.resolve(s.transform(o.value,a)).then(i=>({status:r.value,value:i})):o);S.assertNever(s)}};R.create=(t,e,r)=>new R({schema:t,typeName:g.ZodEffects,effect:e,...v(r)});R.createWithPreprocess=(t,e,r)=>new R({schema:e,effect:{type:"preprocess",transform:t},typeName:g.ZodEffects,...v(r)});var Z=class extends _{_parse(e){return this._getType(e)===p.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z.create=(t,e)=>new Z({innerType:t,typeName:g.ZodOptional,...v(e)});var D=class extends _{_parse(e){return this._getType(e)===p.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};D.create=(t,e)=>new D({innerType:t,typeName:g.ZodNullable,...v(e)});var ae=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===p.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ae.create=(t,e)=>new ae({innerType:t,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});var fe=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),n={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return we(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new E(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new E(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};fe.create=(t,e)=>new fe({innerType:t,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});var he=class extends _{_parse(e){if(this._getType(e)!==p.nan){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:p.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}};he.create=t=>new he({typeName:g.ZodNaN,...v(t)});var It=Symbol("zod_brand"),je=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}},_e=class t extends _{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({