prettier-plugin-brace-style
Version:
A Prettier plugin that can apply ESLint's brace-style rules.
1 lines • 71.9 kB
JavaScript
"use strict";var Le=Object.defineProperty;var St=Object.getOwnPropertyDescriptor;var kt=Object.getOwnPropertyNames;var xt=Object.prototype.hasOwnProperty;var wt=(t,e)=>{for(var r in e)Le(t,r,{get:e[r],enumerable:!0})},Ct=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of kt(e))!xt.call(t,s)&&s!==r&&Le(t,s,{get:()=>e[s],enumerable:!(n=St(e,s))||n.enumerable});return t};var Ot=t=>Ct(Le({},"__esModule",{value:!0}),t);var Gr={};wt(Gr,{options:()=>Ge,parsers:()=>vt,printers:()=>_t});module.exports=Ot(Gr);var Ge={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 qe=require("prettier"),Je=require("prettier/plugins/babel"),Ze=require("prettier/plugins/html"),$e=require("prettier/plugins/postcss"),yt=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 Ve;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(Ve||(Ve={}));var f=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 f.undefined;case"string":return f.string;case"number":return isNaN(t)?f.nan:f.number;case"boolean":return f.boolean;case"function":return f.function;case"bigint":return f.bigint;case"symbol":return f.symbol;case"object":return Array.isArray(t)?f.array:t===null?f.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?f.promise:typeof Map<"u"&&t instanceof Map?f.map:typeof Set<"u"&&t instanceof Set?f.set:typeof Date<"u"&&t instanceof Date?f.date:f.object;default:return f.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"]),At=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),R=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,d=0;for(;d<o.path.length;){let u=o.path[d];d===o.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(r(o))):i[u]=i[u]||{_errors:[]},i=i[u],d++}}};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()}};R.create=t=>new R(t);var _e=(t,e)=>{let r;switch(t.code){case l.invalid_type:t.received===f.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}},Ke=_e;function jt(t){Ke=t}function Ce(){return Ke}var Oe=t=>{let{data:e,path:r,errorMaps:n,issueData:s}=t,a=[...r,...s.path||[]],o={...s,path:a},i="",d=n.filter(u=>!!u).slice().reverse();for(let u of d)i=u(o,{data:e,defaultError:i}).message;return{...s,path:a,message:s.message||i}},Et=[];function h(t,e){let r=Oe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ce(),_e].filter(n=>!!n)});t.common.issues.push(r)}var O=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"}),et=t=>({status:"dirty",value:t}),A=t=>({status:"valid",value:t}),De=t=>t.status==="aborted",He=t=>t.status==="dirty",be=t=>t.status==="valid",Ae=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 I=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}},Xe=(t,e)=>{if(be(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 R(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 O,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(Ae(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 Xe(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(Ae(s)?s:Promise.resolve(s));return Xe(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(d=>d?!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 B({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 ee.create([this,e],this._def)}and(e){return te.create(this,e,this._def)}transform(e){return new B({...v(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ie({...v(this._def),innerType:this,defaultValue:r,typeName:g.ZodDefault})}brand(){return new Be({typeName:g.ZodBranded,type:this,...v(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new me({...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 Te.create(this,e)}readonly(){return ye.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Rt=/^c[^\s-]{8,}$/i,Bt=/^[a-z][a-z0-9]*$/,Pt=/^[0-9A-HJKMNP-TV-Z]{26}$/,It=/^[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,Zt=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,$t="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Me,Lt=/^(((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}))$/,Mt=/^(([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})))$/,Vt=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 Dt(t,e){return!!((e==="v4"||!e)&&Lt.test(t)||(e==="v6"||!e)&&Mt.test(t))}var U=class t extends _{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==f.string){let a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:f.string,received:a.parsedType}),y}let n=new O,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")Zt.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")Me||(Me=new RegExp($t,"u")),Me.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")It.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")Rt.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")Bt.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")Pt.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"?Vt(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"?Dt(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 Ht(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 F=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)!==f.number){let a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:f.number,received:a.parsedType}),y}let n,s=new O;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"?Ht(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)}};F.create=t=>new F({checks:[],typeName:g.ZodNumber,coerce:t?.coerce||!1,...v(t)});var Y=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)!==f.bigint){let a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:f.bigint,received:a.parsedType}),y}let n,s=new O;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}};Y.create=t=>{var e;return new Y({checks:[],typeName:g.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...v(t)})};var G=class extends _{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==f.boolean){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:f.boolean,received:n.parsedType}),y}return A(e.data)}};G.create=t=>new G({typeName:g.ZodBoolean,coerce:t?.coerce||!1,...v(t)});var X=class t extends _{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==f.date){let a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:f.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 O,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}};X.create=t=>new X({checks:[],coerce:t?.coerce||!1,typeName:g.ZodDate,...v(t)});var le=class extends _{_parse(e){if(this._getType(e)!==f.symbol){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:f.symbol,received:n.parsedType}),y}return A(e.data)}};le.create=t=>new le({typeName:g.ZodSymbol,...v(t)});var Q=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:f.undefined,received:n.parsedType}),y}return A(e.data)}};Q.create=t=>new Q({typeName:g.ZodUndefined,...v(t)});var K=class extends _{_parse(e){if(this._getType(e)!==f.null){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:f.null,received:n.parsedType}),y}return A(e.data)}};K.create=t=>new K({typeName:g.ZodNull,...v(t)});var W=class extends _{constructor(){super(...arguments),this._any=!0}_parse(e){return A(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 A(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:f.never,received:r.parsedType}),y}};$.create=t=>new $({typeName:g.ZodNever,...v(t)});var pe=class extends _{_parse(e){if(this._getType(e)!==f.undefined){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:f.void,received:n.parsedType}),y}return A(e.data)}};pe.create=t=>new pe({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!==f.array)return h(r,{code:l.invalid_type,expected:f.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 I(r,o,r.path,i)))).then(o=>O.mergeArray(n,o));let a=[...r.data].map((o,i)=>s.type._parseSync(new I(r,o,r.path,i)));return O.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 ue(t){if(t instanceof E){let e={};for(let r in t.shape){let n=t.shape[r];e[r]=Z.create(ue(n))}return new E({...t._def,shape:()=>e})}else return t instanceof V?new V({...t._def,type:ue(t.element)}):t instanceof Z?Z.create(ue(t.unwrap())):t instanceof D?D.create(ue(t.unwrap())):t instanceof L?L.create(t.items.map(e=>ue(e))):t}var E=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)!==f.object){let u=this._getOrReturnCtx(e);return h(u,{code:l.invalid_type,expected:f.object,received:u.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 u in s.data)o.includes(u)||i.push(u);let d=[];for(let u of o){let p=a[u],N=s.data[u];d.push({key:{status:"valid",value:u},value:p._parse(new I(s,N,s.path,u)),alwaysSet:u in s.data})}if(this._def.catchall instanceof $){let u=this._def.unknownKeys;if(u==="passthrough")for(let p of i)d.push({key:{status:"valid",value:p},value:{status:"valid",value:s.data[p]}});else if(u==="strict")i.length>0&&(h(s,{code:l.unrecognized_keys,keys:i}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let p of i){let N=s.data[p];d.push({key:{status:"valid",value:p},value:u._parse(new I(s,N,s.path,p)),alwaysSet:p in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let u=[];for(let p of d){let N=await p.key;u.push({key:N,value:await p.value,alwaysSet:p.alwaysSet})}return u}).then(u=>O.mergeObjectSync(n,u)):O.mergeObjectSync(n,d)}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 d=(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:d}:{message:d}}}:{}})}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 ue(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 tt(S.objectKeys(this.shape))}};E.create=(t,e)=>new E({shape:()=>t,unknownKeys:"strip",catchall:$.create(),typeName:g.ZodObject,...v(e)});E.strictCreate=(t,e)=>new E({shape:()=>t,unknownKeys:"strict",catchall:$.create(),typeName:g.ZodObject,...v(e)});E.lazycreate=(t,e)=>new E({shape:t,unknownKeys:"strip",catchall:$.create(),typeName:g.ZodObject,...v(e)});var ee=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 R(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 d of n){let u={...r,common:{...r.common,issues:[]},parent:null},p=d._parseSync({data:r.data,path:r.path,parent:u});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(d=>new R(d));return h(r,{code:l.invalid_union,unionErrors:i}),y}}get options(){return this._def.options}};ee.create=(t,e)=>new ee({options:t,typeName:g.ZodUnion,...v(e)});var we=t=>t instanceof re?we(t.schema):t instanceof B?we(t.innerType()):t instanceof ne?[t.value]:t instanceof se?t.options:t instanceof ae?Object.keys(t.enum):t instanceof ie?we(t._def.innerType):t instanceof Q?[void 0]:t instanceof K?[null]:null,je=class t extends _{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.object)return h(r,{code:l.invalid_type,expected:f.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=we(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 ze(t,e){let r=z(t),n=z(e);if(t===e)return{valid:!0,data:t};if(r===f.object&&n===f.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 d=ze(t[i],e[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(r===f.array&&n===f.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],d=ze(o,i);if(!d.valid)return{valid:!1};s.push(d.data)}return{valid:!0,data:s}}else return r===f.date&&n===f.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var te=class extends _{_parse(e){let{status:r,ctx:n}=this._processInputParams(e),s=(a,o)=>{if(De(a)||De(o))return y;let i=ze(a.value,o.value);return i.valid?((He(a)||He(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}))}};te.create=(t,e,r)=>new te({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!==f.array)return h(n,{code:l.invalid_type,expected:f.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 d=this._def.items[i]||this._def.rest;return d?d._parse(new I(n,o,n.path,i)):null}).filter(o=>!!o);return n.common.async?Promise.all(a).then(o=>O.mergeArray(r,o)):O.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 Ee=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!==f.object)return h(n,{code:l.invalid_type,expected:f.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 I(n,i,n.path,i)),value:o._parse(new I(n,n.data[i],n.path,i))});return n.common.async?O.mergeObjectAsync(r,s):O.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)})}},fe=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!==f.map)return h(n,{code:l.invalid_type,expected:f.map,received:n.parsedType}),y;let s=this._def.keyType,a=this._def.valueType,o=[...n.data.entries()].map(([i,d],u)=>({key:s._parse(new I(n,i,n.path,[u,"key"])),value:a._parse(new I(n,d,n.path,[u,"value"]))}));if(n.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of o){let u=await d.key,p=await d.value;if(u.status==="aborted"||p.status==="aborted")return y;(u.status==="dirty"||p.status==="dirty")&&r.dirty(),i.set(u.value,p.value)}return{status:r.value,value:i}})}else{let i=new Map;for(let d of o){let u=d.key,p=d.value;if(u.status==="aborted"||p.status==="aborted")return y;(u.status==="dirty"||p.status==="dirty")&&r.dirty(),i.set(u.value,p.value)}return{status:r.value,value:i}}}};fe.create=(t,e,r)=>new fe({valueType:e,keyType:t,typeName:g.ZodMap,...v(r)});var he=class t extends _{_parse(e){let{status:r,ctx:n}=this._processInputParams(e);if(n.parsedType!==f.set)return h(n,{code:l.invalid_type,expected:f.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(d){let u=new Set;for(let p of d){if(p.status==="aborted")return y;p.status==="dirty"&&r.dirty(),u.add(p.value)}return{status:r.value,value:u}}let i=[...n.data.values()].map((d,u)=>a._parse(new I(n,d,n.path,u)));return n.common.async?Promise.all(i).then(d=>o(d)):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)}};he.create=(t,e)=>new he({valueType:t,minSize:null,maxSize:null,typeName:g.ZodSet,...v(e)});var Re=class t extends _{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==f.function)return h(r,{code:l.invalid_type,expected:f.function,received:r.parsedType}),y;function n(i,d){return Oe({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ce(),_e].filter(u=>!!u),issueData:{code:l.invalid_arguments,argumentsError:d}})}function s(i,d){return Oe({data:i,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,Ce(),_e].filter(u=>!!u),issueData:{code:l.invalid_return_type,returnTypeError:d}})}let a={errorMap:r.common.contextualErrorMap},o=r.data;if(this._def.returns instanceof q){let i=this;return A(async function(...d){let u=new R([]),p=await i._def.args.parseAsync(d,a).catch(b=>{throw u.addIssue(n(d,b)),u}),N=await Reflect.apply(o,this,p);return await i._def.returns._def.type.parseAsync(N,a).catch(b=>{throw u.addIssue(s(N,b)),u})})}else{let i=this;return A(function(...d){let u=i._def.args.safeParse(d,a);if(!u.success)throw new R([n(d,u.error)]);let p=Reflect.apply(o,this,u.data),N=i._def.returns.safeParse(p,a);if(!N.success)throw new R([s(p,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)})}},re=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})}};re.create=(t,e)=>new re({getter:t,typeName:g.ZodLazy,...v(e)});var ne=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}};ne.create=(t,e)=>new ne({value:t,typeName:g.ZodLiteral,...v(e)});function tt(t,e){return new se({values:t,typeName:g.ZodEnum,...v(e)})}var se=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 A(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)))}};se.create=tt;var ae=class extends _{_parse(e){let r=S.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==f.string&&n.parsedType!==f.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 A(e.data)}get enum(){return this._def.values}};ae.create=(t,e)=>new ae({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!==f.promise&&r.common.async===!1)return h(r,{code:l.invalid_type,expected:f.promise,received:r.parsedType}),y;let n=r.parsedType===f.promise?r.data:Promise.resolve(r.data);return A(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 B=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 d=s.refinement(i,a);if(n.common.async)return Promise.resolve(d);if(d 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(!be(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=>be(o)?Promise.resolve(s.transform(o.value,a)).then(i=>({status:r.value,value:i})):o);S.assertNever(s)}};B.create=(t,e,r)=>new B({schema:t,typeName:g.ZodEffects,effect:e,...v(r)});B.createWithPreprocess=(t,e,r)=>new B({schema:e,effect:{type:"preprocess",transform:t},typeName:g.ZodEffects,...v(r)});var Z=class extends _{_parse(e){return this._getType(e)===f.undefined?A(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)===f.null?A(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 ie=class extends _{_parse(e){let{ctx:r}=this._processInputParams(e),n=r.data;return r.parsedType===f.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ie.create=(t,e)=>new ie({innerType:t,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});var me=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 Ae(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new R(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new R(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};me.create=(t,e)=>new me({innerType:t,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});var ge=class extends _{_parse(e){if(this._getType(e)!==f.nan){let n=this._getOrReturnCtx(e);return h(n,{code:l.invalid_type,expected:f.nan,received:n.parsedType}),y}return{status:"valid",value:e.data}}};ge.create=t=>new ge({typeName:g.ZodNaN,...v(t)});var zt=Symbol("zod_brand"),Be=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}},Te=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._parseAsy