point-click-lib 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- (function(u,he){typeof exports=="object"&&typeof module<"u"?he(exports):typeof define=="function"&&define.amd?define(["exports"],he):(u=typeof globalThis<"u"?globalThis:u||self,he(u.PointClickLib={}))})(this,(function(u){"use strict";const he=[{schemaVersion:3,changes:[{breaking:!1,description:"Designs have schemaVersion property"},{breaking:!1,description:"storyBoards array is required"}]},{schemaVersion:4,changes:[{breaking:!0,description:"Endings deprecated in favour of storyBoards. Any Endings have been converted to Storyboards."},{breaking:!1,description:"StoryBoards have end of game option."}]}];var C;(function(a){a.assertEqual=s=>{};function e(s){}a.assertIs=e;function t(s){throw new Error}a.assertNever=t,a.arrayToEnum=s=>{const r={};for(const i of s)r[i]=i;return r},a.getValidEnumValues=s=>{const r=a.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of r)i[o]=s[o];return a.objectValues(i)},a.objectValues=s=>a.objectKeys(s).map(function(r){return s[r]}),a.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const r=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&r.push(i);return r},a.find=(s,r)=>{for(const i of s)if(r(i))return i},a.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,r=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(r)}a.joinValues=n,a.jsonStringifyReplacer=(s,r)=>typeof r=="bigint"?r.toString():r})(C||(C={}));var ft;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(ft||(ft={}));const m=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),B=a=>{switch(typeof a){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(a)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(a)?m.array:a===null?m.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?m.promise:typeof Map<"u"&&a instanceof Map?m.map:typeof Set<"u"&&a instanceof Set?m.set:typeof Date<"u"&&a instanceof Date?m.date:m.object;default:return m.unknown}},d=C.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class V extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(r){return r.message},n={_errors:[]},s=r=>{for(const i of r.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,p=0;for(;p<i.path.length;){const y=i.path[p];p===i.path.length-1?(o[y]=o[y]||{_errors:[]},o[y]._errors.push(t(i))):o[y]=o[y]||{_errors:[]},o=o[y],p++}}};return s(this),n}static assert(e){if(!(e instanceof V))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const r=s.path[0];t[r]=t[r]||[],t[r].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}V.create=a=>new V(a);const $e=(a,e)=>{let t;switch(a.code){case d.invalid_type:a.received===m.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,C.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${C.joinValues(a.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${C.joinValues(a.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${C.joinValues(a.options)}, received '${a.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:C.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case d.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case d.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,C.assertNever(a)}return{message:t}};let ta=$e;function aa(){return ta}const na=a=>{const{data:e,path:t,errorMaps:n,issueData:s}=a,r=[...t,...s.path||[]],i={...s,path:r};if(s.message!==void 0)return{...s,path:r,message:s.message};let o="";const p=n.filter(y=>!!y).slice().reverse();for(const y of p)o=y(i,{data:e,defaultError:o}).message;return{...s,path:r,message:o}};function l(a,e){const t=aa(),n=na({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===$e?void 0:$e].filter(s=>!!s)});a.common.issues.push(n)}class R{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return _;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const r=await s.key,i=await s.value;n.push({key:r,value:i})}return R.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:r,value:i}=s;if(r.status==="aborted"||i.status==="aborted")return _;r.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[r.value]=i.value)}return{status:e.value,value:n}}}const _=Object.freeze({status:"aborted"}),me=a=>({status:"dirty",value:a}),Z=a=>({status:"valid",value:a}),pt=a=>a.status==="aborted",yt=a=>a.status==="dirty",U=a=>a.status==="valid",ke=a=>typeof Promise<"u"&&a instanceof Promise;var f;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(f||(f={}));class j{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const gt=(a,e)=>{if(U(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new V(a.common.issues);return this._error=t,this._error}}};function k(a){if(!a)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=a;if(e&&(t||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:(i,o)=>{const{message:p}=a;return i.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:p??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:p??t??o.defaultError}},description:s}}class b{get description(){return this._def.description}_getType(e){return B(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:B(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:B(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ke(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:B(e)},s=this._parseSync({data:e,path:n.path,parent:n});return gt(n,s)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:B(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return U(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>U(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:B(e)},s=this._parse({data:e,path:n.path,parent:n}),r=await(ke(s)?s:Promise.resolve(s));return gt(n,r)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,r)=>{const i=e(s),o=()=>r.addIssue({code:d.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(p=>p?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Y({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return P.create(this,this._def)}nullable(){return X.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return D.create(this)}promise(){return Te.create(this,this._def)}or(e){return xe.create([this,e],this._def)}and(e){return Ce.create(this,e,this._def)}transform(e){return new Y({...k(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Fe({...k(this._def),innerType:this,defaultValue:t,typeName:v.ZodDefault})}brand(){return new Ta({typeName:v.ZodBranded,type:this,...k(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new We({...k(this._def),innerType:this,catchValue:t,typeName:v.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ue.create(this,e)}readonly(){return Ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const sa=/^c[^\s-]{8,}$/i,ra=/^[0-9a-z]+$/,ia=/^[0-9A-HJKMNP-TV-Z]{26}$/i,oa=/^[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,ca=/^[a-z0-9_-]{21}$/i,da=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ua=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,la=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ha="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Be;const ma=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,fa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,pa=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ya=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,ga=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,va=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",_a=new RegExp(`^${vt}$`);function _t(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);const t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Sa(a){return new RegExp(`^${_t(a)}$`)}function ka(a){let e=`${vt}T${_t(a)}`;const t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ba(a,e){return!!((e==="v4"||!e)&&ma.test(a)||(e==="v6"||!e)&&pa.test(a))}function xa(a,e){if(!da.test(a))return!1;try{const[t]=a.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function Ca(a,e){return!!((e==="v4"||!e)&&fa.test(a)||(e==="v6"||!e)&&ya.test(a))}class $ extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_type,expected:m.string,received:r.parsedType}),_}const n=new R;let s;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")e.data.length>r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){const i=e.data.length>r.value,o=e.data.length<r.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?l(s,{code:d.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&l(s,{code:d.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")la.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")Be||(Be=new RegExp(ha,"u")),Be.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")oa.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")ca.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"nanoid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")sa.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")ra.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")ia.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:d.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:d.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?ka(r).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?_a.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?Sa(r).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?ua.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"duration",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?ba(e.data,r.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?xa(e.data,r.alg)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"jwt",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?Ca(e.data,r.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cidr",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?ga.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?va.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64url",code:d.invalid_string,message:r.message}),n.dirty()):C.assertNever(r);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...f.errToObj(n)})}_addCheck(e){return new $({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...f.errToObj(e)})}url(e){return this._addCheck({kind:"url",...f.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...f.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...f.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...f.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...f.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...f.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...f.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...f.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...f.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...f.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...f.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...f.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...f.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...f.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...f.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...f.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...f.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...f.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...f.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...f.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...f.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...f.errToObj(t)})}nonempty(e){return this.min(1,f.errToObj(e))}trim(){return new $({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new $({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new $({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}$.create=a=>new $({checks:[],typeName:v.ZodString,coerce:a?.coerce??!1,...k(a)});function wa(a,e){const t=(a.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,r=Number.parseInt(a.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return r%i/10**s}class G extends b{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)!==m.number){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_type,expected:m.number,received:r.parsedType}),_}let n;const s=new R;for(const r of this._def.checks)r.kind==="int"?C.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.invalid_type,expected:"integer",received:"float",message:r.message}),s.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="multipleOf"?wa(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_finite,message:r.message}),s.dirty()):C.assertNever(r);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,f.toString(t))}gt(e,t){return this.setLimit("min",e,!1,f.toString(t))}lte(e,t){return this.setLimit("max",e,!0,f.toString(t))}lt(e,t){return this.setLimit("max",e,!1,f.toString(t))}setLimit(e,t,n,s){return new G({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:f.toString(s)}]})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:f.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:f.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&C.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}G.create=a=>new G({checks:[],typeName:v.ZodNumber,coerce:a?.coerce||!1,...k(a)});class fe extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n;const s=new R;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):C.assertNever(r);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:m.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,f.toString(t))}gt(e,t){return this.setLimit("min",e,!1,f.toString(t))}lte(e,t){return this.setLimit("max",e,!0,f.toString(t))}lt(e,t){return this.setLimit("max",e,!1,f.toString(t))}setLimit(e,t,n,s){return new fe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:f.toString(s)}]})}_addCheck(e){return new fe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}fe.create=a=>new fe({checks:[],typeName:v.ZodBigInt,coerce:a?.coerce??!1,...k(a)});class Me extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.boolean,received:n.parsedType}),_}return Z(e.data)}}Me.create=a=>new Me({typeName:v.ZodBoolean,coerce:a?.coerce||!1,...k(a)});class be extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_type,expected:m.date,received:r.parsedType}),_}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_date}),_}const n=new R;let s;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):C.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new be({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:f.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:f.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}be.create=a=>new be({checks:[],coerce:a?.coerce||!1,typeName:v.ZodDate,...k(a)});class St extends b{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.symbol,received:n.parsedType}),_}return Z(e.data)}}St.create=a=>new St({typeName:v.ZodSymbol,...k(a)});class Pe extends b{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.undefined,received:n.parsedType}),_}return Z(e.data)}}Pe.create=a=>new Pe({typeName:v.ZodUndefined,...k(a)});class kt extends b{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.null,received:n.parsedType}),_}return Z(e.data)}}kt.create=a=>new kt({typeName:v.ZodNull,...k(a)});class bt extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}bt.create=a=>new bt({typeName:v.ZodAny,...k(a)});class xt extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}xt.create=a=>new xt({typeName:v.ZodUnknown,...k(a)});class M extends b{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:m.never,received:t.parsedType}),_}}M.create=a=>new M({typeName:v.ZodNever,...k(a)});class Ct extends b{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.void,received:n.parsedType}),_}return Z(e.data)}}Ct.create=a=>new Ct({typeName:v.ZodVoid,...k(a)});class D extends b{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return l(t,{code:d.invalid_type,expected:m.array,received:t.parsedType}),_;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(l(t,{code:i?d.too_big:d.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(l(t,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(l(t,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new j(t,i,t.path,o)))).then(i=>R.mergeArray(n,i));const r=[...t.data].map((i,o)=>s.type._parseSync(new j(t,i,t.path,o)));return R.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new D({...this._def,minLength:{value:e,message:f.toString(t)}})}max(e,t){return new D({...this._def,maxLength:{value:e,message:f.toString(t)}})}length(e,t){return new D({...this._def,exactLength:{value:e,message:f.toString(t)}})}nonempty(e){return this.min(1,e)}}D.create=(a,e)=>new D({type:a,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...k(e)});function H(a){if(a instanceof A){const e={};for(const t in a.shape){const n=a.shape[t];e[t]=P.create(H(n))}return new A({...a._def,shape:()=>e})}else return a instanceof D?new D({...a._def,type:H(a.element)}):a instanceof P?P.create(H(a.unwrap())):a instanceof X?X.create(H(a.unwrap())):a instanceof L?L.create(a.items.map(e=>H(e))):a}class A extends b{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=C.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const y=this._getOrReturnCtx(e);return l(y,{code:d.invalid_type,expected:m.object,received:y.parsedType}),_}const{status:n,ctx:s}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof M&&this._def.unknownKeys==="strip"))for(const y in s.data)i.includes(y)||o.push(y);const p=[];for(const y of i){const x=r[y],W=s.data[y];p.push({key:{status:"valid",value:y},value:x._parse(new j(s,W,s.path,y)),alwaysSet:y in s.data})}if(this._def.catchall instanceof M){const y=this._def.unknownKeys;if(y==="passthrough")for(const x of o)p.push({key:{status:"valid",value:x},value:{status:"valid",value:s.data[x]}});else if(y==="strict")o.length>0&&(l(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(y!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const y=this._def.catchall;for(const x of o){const W=s.data[x];p.push({key:{status:"valid",value:x},value:y._parse(new j(s,W,s.path,x)),alwaysSet:x in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const y=[];for(const x of p){const W=await x.key,lt=await x.value;y.push({key:W,value:lt,alwaysSet:x.alwaysSet})}return y}).then(y=>R.mergeObjectSync(n,y)):R.mergeObjectSync(n,p)}get shape(){return this._def.shape()}strict(e){return f.errToObj,new A({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{const s=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:f.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new A({...this._def,unknownKeys:"strip"})}passthrough(){return new A({...this._def,unknownKeys:"passthrough"})}extend(e){return new A({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new A({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new A({...this._def,catchall:e})}pick(e){const t={};for(const n of C.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}omit(e){const t={};for(const n of C.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}deepPartial(){return H(this)}partial(e){const t={};for(const n of C.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new A({...this._def,shape:()=>t})}required(e){const t={};for(const n of C.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let r=this.shape[n];for(;r instanceof P;)r=r._def.innerType;t[n]=r}return new A({...this._def,shape:()=>t})}keyof(){return It(C.objectKeys(this.shape))}}A.create=(a,e)=>new A({shape:()=>a,unknownKeys:"strip",catchall:M.create(),typeName:v.ZodObject,...k(e)}),A.strictCreate=(a,e)=>new A({shape:()=>a,unknownKeys:"strict",catchall:M.create(),typeName:v.ZodObject,...k(e)}),A.lazycreate=(a,e)=>new A({shape:a,unknownKeys:"strip",catchall:M.create(),typeName:v.ZodObject,...k(e)});class xe extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=r.map(o=>new V(o.ctx.common.issues));return l(t,{code:d.invalid_union,unionErrors:i}),_}if(t.common.async)return Promise.all(n.map(async r=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let r;const i=[];for(const p of n){const y={...t,common:{...t.common,issues:[]},parent:null},x=p._parseSync({data:t.data,path:t.path,parent:y});if(x.status==="valid")return x;x.status==="dirty"&&!r&&(r={result:x,ctx:y}),y.common.issues.length&&i.push(y.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(p=>new V(p));return l(t,{code:d.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}}xe.create=(a,e)=>new xe({options:a,typeName:v.ZodUnion,...k(e)});function ze(a,e){const t=B(a),n=B(e);if(a===e)return{valid:!0,data:a};if(t===m.object&&n===m.object){const s=C.objectKeys(e),r=C.objectKeys(a).filter(o=>s.indexOf(o)!==-1),i={...a,...e};for(const o of r){const p=ze(a[o],e[o]);if(!p.valid)return{valid:!1};i[o]=p.data}return{valid:!0,data:i}}else if(t===m.array&&n===m.array){if(a.length!==e.length)return{valid:!1};const s=[];for(let r=0;r<a.length;r++){const i=a[r],o=e[r],p=ze(i,o);if(!p.valid)return{valid:!1};s.push(p.data)}return{valid:!0,data:s}}else return t===m.date&&n===m.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}class Ce extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(r,i)=>{if(pt(r)||pt(i))return _;const o=ze(r.value,i.value);return o.valid?((yt(r)||yt(i))&&t.dirty(),{status:t.value,value:o.data}):(l(n,{code:d.invalid_intersection_types}),_)};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(([r,i])=>s(r,i)):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}))}}Ce.create=(a,e,t)=>new Ce({left:a,right:e,typeName:v.ZodIntersection,...k(t)});class L extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return l(n,{code:d.invalid_type,expected:m.array,received:n.parsedType}),_;if(n.data.length<this._def.items.length)return l(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((i,o)=>{const p=this._def.items[o]||this._def.rest;return p?p._parse(new j(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(r).then(i=>R.mergeArray(t,i)):R.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new L({...this._def,rest:e})}}L.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new L({items:a,typeName:v.ZodTuple,rest:null,...k(e)})};class we extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return l(n,{code:d.invalid_type,expected:m.object,received:n.parsedType}),_;const s=[],r=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:r._parse(new j(n,o,n.path,o)),value:i._parse(new j(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?R.mergeObjectAsync(t,s):R.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof b?new we({keyType:e,valueType:t,typeName:v.ZodRecord,...k(n)}):new we({keyType:$.create(),valueType:e,typeName:v.ZodRecord,...k(t)})}}class wt extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return l(n,{code:d.invalid_type,expected:m.map,received:n.parsedType}),_;const s=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([o,p],y)=>({key:s._parse(new j(n,o,n.path,[y,"key"])),value:r._parse(new j(n,p,n.path,[y,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const p of i){const y=await p.key,x=await p.value;if(y.status==="aborted"||x.status==="aborted")return _;(y.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(y.value,x.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const p of i){const y=p.key,x=p.value;if(y.status==="aborted"||x.status==="aborted")return _;(y.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(y.value,x.value)}return{status:t.value,value:o}}}}wt.create=(a,e,t)=>new wt({valueType:e,keyType:a,typeName:v.ZodMap,...k(t)});class pe extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return l(n,{code:d.invalid_type,expected:m.set,received:n.parsedType}),_;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(l(n,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(l(n,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const r=this._def.valueType;function i(p){const y=new Set;for(const x of p){if(x.status==="aborted")return _;x.status==="dirty"&&t.dirty(),y.add(x.value)}return{status:t.value,value:y}}const o=[...n.data.values()].map((p,y)=>r._parse(new j(n,p,n.path,y)));return n.common.async?Promise.all(o).then(p=>i(p)):i(o)}min(e,t){return new pe({...this._def,minSize:{value:e,message:f.toString(t)}})}max(e,t){return new pe({...this._def,maxSize:{value:e,message:f.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}pe.create=(a,e)=>new pe({valueType:a,minSize:null,maxSize:null,typeName:v.ZodSet,...k(e)});class Tt extends b{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Tt.create=(a,e)=>new Tt({getter:a,typeName:v.ZodLazy,...k(e)});class Le extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}Le.create=(a,e)=>new Le({value:a,typeName:v.ZodLiteral,...k(e)});function It(a,e){return new J({values:a,typeName:v.ZodEnum,...k(e)})}class J extends b{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{expected:C.joinValues(n),received:t.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{received:t.data,code:d.invalid_enum_value,options:n}),_}return Z(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return J.create(e,{...this._def,...t})}exclude(e,t=this._def){return J.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}J.create=It;class Ot extends b{_parse(e){const t=C.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const s=C.objectValues(t);return l(n,{expected:C.joinValues(s),received:n.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(C.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=C.objectValues(t);return l(n,{received:n.data,code:d.invalid_enum_value,options:s}),_}return Z(e.data)}get enum(){return this._def.values}}Ot.create=(a,e)=>new Ot({values:a,typeName:v.ZodNativeEnum,...k(e)});class Te extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return l(t,{code:d.invalid_type,expected:m.promise,received:t.parsedType}),_;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return Z(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Te.create=(a,e)=>new Te({type:a,typeName:v.ZodPromise,...k(e)});class Y extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,r={addIssue:i=>{l(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),s.type==="preprocess"){const i=s.transform(n.data,r);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return _;const p=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return p.status==="aborted"?_:p.status==="dirty"||t.value==="dirty"?me(p.value):p});{if(t.value==="aborted")return _;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?_:o.status==="dirty"||t.value==="dirty"?me(o.value):o}}if(s.type==="refinement"){const i=o=>{const p=s.refinement(o,r);if(n.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!U(i))return _;const o=s.transform(i.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>U(i)?Promise.resolve(s.transform(i.value,r)).then(o=>({status:t.value,value:o})):_);C.assertNever(s)}}Y.create=(a,e,t)=>new Y({schema:a,typeName:v.ZodEffects,effect:e,...k(t)}),Y.createWithPreprocess=(a,e,t)=>new Y({schema:e,effect:{type:"preprocess",transform:a},typeName:v.ZodEffects,...k(t)});class P extends b{_parse(e){return this._getType(e)===m.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}P.create=(a,e)=>new P({innerType:a,typeName:v.ZodOptional,...k(e)});class X extends b{_parse(e){return this._getType(e)===m.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}X.create=(a,e)=>new X({innerType:a,typeName:v.ZodNullable,...k(e)});class Fe extends b{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Fe.create=(a,e)=>new Fe({innerType:a,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...k(e)});class We extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ke(s)?s.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new V(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new V(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}We.create=(a,e)=>new We({innerType:a,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...k(e)});class At extends b{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.nan,received:n.parsedType}),_}return{status:"valid",value:e.data}}}At.create=a=>new At({typeName:v.ZodNaN,...k(a)});class Ta extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ue extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?_:r.status==="dirty"?(t.dirty(),me(r.value)):this._def.out._parseAsync({data:r.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?_:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Ue({in:e,out:t,typeName:v.ZodPipeline})}}class Ge extends b{_parse(e){const t=this._def.innerType._parse(e),n=s=>(U(s)&&(s.value=Object.freeze(s.value)),s);return ke(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}Ge.create=(a,e)=>new Ge({innerType:a,typeName:v.ZodReadonly,...k(e)});var v;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(v||(v={}));const c=$.create,g=G.create,w=Me.create,Ia=Pe.create;M.create;const N=D.create,h=A.create,Q=xe.create;Ce.create;const He=L.create,z=we.create,T=Le.create,q=J.create;Te.create;const S=P.create;X.create;const Rt=()=>w().optional(),K=q(["left","right","up","down"]),Oa=K.options,Ie=h({type:c(),id:c(),name:S(c()),status:S(c())}),Nt=h({height:g(),width:g(),sprite:c().optional(),direction:S(K),filter:S(c())}),Zt=h({room:S(c()),x:g(),y:g()}),ye=h({imageId:c(),col:g().optional(),row:g().optional()}),O=h({text:c().array()}),Et=h({x:g(),y:g()}),Oe=h({soundId:c(),volume:g().optional()}),Ae={_started:Rt(),narrative:O.optional(),startDirection:K.optional(),endDirection:K.optional(),endStatus:c().optional()},Aa={_started:!0,narrative:!0,startDirection:!0,endDirection:!0,endStatus:!0,type:!0},Ra=h({animation:S(c()),x:g(),y:g(),speed:S(g())}),qt=h({type:T("move"),roomId:c().optional(),pathIsSet:S(w()),doPendingInteractionWhenFinished:S(w()),steps:N(Ra)}).extend(Ae),jt=h({type:T("goTo"),animation:S(c()),speed:S(g()),targetId:c()}).extend(Ae),Dt=h({type:T("say"),animation:S(c()),text:c(),time:g()}).extend(Ae),Na=h({animation:S(c()),duration:g(),timeElapsed:S(g()),reverse:S(w())}),Vt=h({type:T("act"),steps:N(Na)}).extend(Ae),ge=Q([qt,Vt,Dt,jt]),Za=ge.options.map(a=>a.shape.type.value),Re=h({type:T("order"),actorId:c().optional(),orders:N(ge),replaceCurrentOrders:S(w()),narrative:O.optional()}),ee=h({type:T("changeRoom"),roomId:c(),takePlayer:w(),x:S(g()),y:S(g()),narrative:O.optional()}),te=h({type:T("inventory"),itemId:c(),actorId:c().optional(),addOrRemove:q(["ADD","REMOVE"]),narrative:O.optional()}),ae=h({type:T("removeActor"),actorId:c(),narrative:O.optional()}),ne=h({type:T("changeStatus"),targetId:c(),targetType:q(["actor","item","hotspot"]),status:c(),narrative:O.optional()}),Ne=h({type:T("sequence"),sequence:c(),narrative:O.optional()}),se=h({type:T("conversation"),conversationId:c(),end:S(w()),narrative:O.optional()}),re=h({type:T("conversationChoice"),on:w(),conversationId:c(),branchId:c(),choiceRef:c(),narrative:O.optional()}),ie=h({type:T("teleportActor"),actorId:c(),roomId:S(c()),x:g(),y:g(),narrative:O.optional()}),F=h({type:T("toggleZone"),roomId:S(c()),on:w(),ref:c(),zoneType:q(["hotspot","obstacle","walkable"]),narrative:O.optional()}),oe=h({type:T("soundEffect"),sound:c(),volume:g().optional(),narrative:O.optional()}),ce=h({type:T("backgroundMusic"),sound:c().optional(),roomId:c().optional(),volume:g().optional(),narrative:O.optional()}),de=h({type:T("ambientNoise"),sound:c().optional(),roomId:c().optional(),volume:g().optional(),narrative:O.optional()}),ue=h({type:T("flag"),on:w(),flag:c(),narrative:O.optional()}),le=h({type:T("storyBoardConsequence"),storyBoardId:c(),narrative:O.optional()}),Ea=F.shape.zoneType.options,$t=Q([Re,ee,te,ae,ne,Ne,se,ie,F,oe,ce,de,ue,re,le]),qa=q(["conversation","sequence","changeStatus","backgroundMusic","ambientNoise","removeActor","inventory","changeRoom","order","teleportActor","toggleZone","soundEffect","flag","conversationChoice","storyBoardConsequence"]).options,ja={conversation:se,sequence:Ne,changeStatus:ne,removeActor:ae,inventory:te,changeRoom:ee,order:Re,teleportActor:ie,toggleZone:F,soundEffect:oe,flag:ue,conversationChoice:re,backgroundMusic:ce,ambientNoise:de,storyBoardConsequence:le},Je=Q([ae,ne,te,se,ie,F,oe,ue,ee,re,ce,de,le]),Da=Je.options.map(a=>a.shape.type.value),Ze=h({verbId:c(),targetId:c(),roomId:c().optional(),itemId:c().optional(),targetStatus:c().optional(),mustReachFirst:w().optional(),consequences:N($t),flagsThatMustBeFalse:N(c()).optional(),flagsThatMustBeTrue:N(c()).optional(),requiredInventory:N(c()).optional()}),Ye=h({actorOrders:S(z(c(),ge.array())),immediateConsequences:S(Je.array()),narrative:O.optional(),_started:Rt()}),ve=h({id:c(),description:c().optional(),stages:Ye.array()}),Bt=h({conversationId:c().optional(),branchId:c().optional(),choiceRef:c().optional()}),Xe=h({ref:c().optional(),text:c(),sequence:c().optional(),nextBranch:S(c()),once:S(w()),disabled:S(w()),enablesChoices:N(Bt).optional(),disablesChoices:N(Bt).optional(),end:S(w()),choiceSequence:ve.optional()}),Mt=h({choices:N(Xe)}),Qe=h({id:c(),branches:z(c(),S(Mt)),currentBranch:S(c()),defaultBranch:c()}),Ke=h({id:c(),message:c(),imageId:c().optional(),imageWidth:g().optional()}),et=h({type:T("ending"),endingId:c(),narrative:O.optional()}),Va=Q([Re,ee,te,ae,ne,Ne,se,ie,F,oe,ce,de,ue,re,le,et]),Pt=Q([ae,ne,te,se,ie,F,oe,ue,ee,re,ce,de,le,et]),tt=Ze.merge(h({consequences:N(Va)})),Ee=ve.merge(h({stages:Ye.merge(h({immediateConsequences:S(Pt.array())})).array()})),$a=Xe.merge(h({choiceSequence:Ee.optional()})),Ba=h({choices:N($a)}),at=Qe.merge(h({branches:z(c(),S(Ba))})),nt=h({soundId:c(),frameIndex:g().optional(),volume:g().optional()}),Ma=z(c(),nt.or(nt.array()).or(Ia())),qe=Ie.merge(Zt).merge(Nt).merge(h({type:T("actor"),isPlayer:S(w()),noInteraction:S(w()),speed:S(g()),baseline:S(g()),dialogueColor:S(c()),soundEffectMap:Ma.optional(),walkToX:g().optional(),walkToY:g().optional(),defaultFrame:ye.optional(),statusFrames:z(ye).optional()})),zt=h({value:w(),default:w(),description:c().optional()}),st=z(c(),zt.optional()),_e=Ie.extend({type:T("item"),actorId:c().optional()}).and(ye.partial());q(["rect","circle","polygon"]);const Pa=N(He([g(),g()])),Lt=h({type:c().optional(),x:g(),y:g(),path:S(c()),polygon:S(Pa),circle:S(g()),rect:S(He([g(),g()]))}),rt=Lt.merge(h({ref:c().optional(),disabled:w().optional()})),it=Lt.merge(Ie).merge(h({type:T("hotspot"),parallax:g(),walkToX:g().optional(),walkToY:g().optional()})),za=h({parallax:g(),imageId:c(),placement:h({x:g(),y:g(),width:g(),height:g()}).optional()}),La=N(He([g(),g()])),ot=h({id:c(),frameWidth:g(),frameHeight:g().optional(),width:g(),height:g(),background:za.array(),hotspots:it.array().optional(),obstacleAreas:S(rt.array()),walkableAreas:S(rt.array()),scaling:S(La),backgroundColor:c().optional(),name:c().optional(),narrative:O.optional(),backgroundMusic:Oe.optional(),ambientNoise:Oe.optional()}),Se=h({imageId:c(),row:g(),col:g()}),Fa=h({left:Se.array().optional(),right:Se.array().optional(),up:Se.array().optional(),down:Se.array().optional()}),ct=h({id:c(),defaultDirection:K,animations:z(c(),Fa)}),Ft=q(["center","left","right"]),Wt=q(["center","top","bottom"]),Wa=h({x:Ft,y:Wt,width:g().optional(),height:g().optional(),aspectRatio:Et.optional()}).merge(h({image:ye})),Ut=h({title:c(),narrative:O,pictures:Wa.array(),backgroundColor:c(),color:c()}),Gt=q(["sound","buttons"]),Ht=q(["serif","sans-serif","monospace","cursive","fantasy","math"]),dt=h({id:c(),isEndOfGame:w().optional(),pages:Ut.array(),font:Ht.optional(),sound:Oe.optional(),progression:Gt.optional()}),je=h({id:c(),label:c(),preposition:c().optional(),isMoveVerb:w().optional(),isNotForItems:w().optional(),isLookVerb:w().optional(),requiresItem:w().optional(),defaultResponseNoItem:c().optional(),defaultResponseWithItem:c().optional(),defaultResponseCannotReach:c().optional()}),Ua=h({schemaVersion:g().optional(),rooms:ot.array(),items:_e.array(),actors:qe.array(),interactions:tt.array(),conversations:at.array(),flagMap:st,currentRoomId:c(),id:c(),description:c().optional().describe("a short description of your game"),thumbnailAssetId:c().optional()}),Ga=h({verbs:je.array(),sequences:Ee.array(),sprites:ct.array(),endings:Ke.array(),openingSequenceId:c().optional(),openingStoryboardId:c().optional(),storyBoards:dt.array().optional()}),Jt=Ua.and(Ga).describe("The game schema"),De=4,Yt=h({sequenceRunning:ve.optional(),currentStoryBoardId:c().optional(),actorOrders:z(c(),ge.array()),currentConversationId:c().optional(),pendingInteraction:Ze.optional(),gameNotBegun:w()}),Ve=h({schemaVersion:T(De),rooms:ot.array(),items:_e.array(),actors:qe.array(),interactions:Ze.array(),conversations:Qe.array(),flagMap:st,currentRoomId:c(),id:c(),description:c().optional().describe("a short description of your game"),thumbnailAssetId:c().optional()}),ut=h({verbs:je.array(),sequences:ve.array(),sprites:ct.array(),openingSequenceId:c().optional(),openingStoryboardId:c().optional(),storyBoards:dt.array()}),Ha=Ve.and(Yt),Xt=Ve.and(ut).describe("The game schema"),Ja=q(["rooms","items","actors","conversations","sprites","sequences","verbs","storyBoards"]),Ya=Ve.merge(h({schemaVersion:T(3),interactions:tt.array(),conversations:at.array()})),Xa=ut.merge(h({endings:Ke.array(),sequences:Ee.array()})),Qt=Ya.and(Xa).describe("The game schema"),Kt=Q([qe,_e,it]),Qa=h({verb:je,target:Kt,item:S(_e)}),Ka=a=>({...a,storyBoards:a.storyBoards??[],schemaVersion:3}),en=a=>ea(Ka(a)),tn=(a,e)=>{const t=a.imageId?{x:"center",y:"center",width:a.imageWidth?a.imageWidth/16:20,height:a.imageWidth?a.imageWidth/16:20,image:{imageId:a.imageId}}:void 0;return{id:e??a.id,isEndOfGame:!0,pages:[{title:a.message,narrative:{text:[]},color:"#FFFFFF",backgroundColor:"#000000",pictures:t?[t]:[]}]}},an=(a,e)=>{const t=e.filter(s=>s.startsWith(a)),n=(s=1)=>{const r=`${a}_${s}`;return t.includes(r)?n(s+1):r};return n()},ea=a=>{const{storyBoards:e,interactions:t,sequences:n,conversations:s}=a,r=e.map(I=>I.id),i={},o=a.endings.map(I=>{const E=r.includes(I.id)?an(I.id,r):void 0;return E&&r.push(E),i[I.id]=E??I.id,tn(I,E)}),p=I=>I.type!=="ending"?I:{type:"storyBoardConsequence",storyBoardId:i[I.endingId]??I.endingId,narrative:I.narrative},y=I=>({...I,stages:I.stages.map(E=>({...E,immediateConsequences:E.immediateConsequences?.map(p)}))}),x=I=>{const{branches:E}=I;for(let rn in E){const ht=E[rn];ht&&(ht.choices=ht.choices.map(mt=>({...mt,choiceSequence:mt.choiceSequence?y(mt.choiceSequence):void 0})))}return{...I,branches:E}},W=t.map(I=>({...I,consequences:I.consequences.map(p)})),lt=n.map(y),sn=s.map(x);return{...a,storyBoards:[...e,...o],interactions:W,sequences:lt,conversations:sn,schemaVersion:De}},nn=a=>{const e=Xt.safeParse(a);if(e.success)return{success:!0,gameDesign:e.data,sourceVersion:De,updated:!1};const t=Qt.safeParse(a);if(t.success)return{success:!0,gameDesign:ea(t.data),sourceVersion:3,updated:!0};const n=Jt.safeParse(a);return n.success?{success:!0,gameDesign:en(n.data),sourceVersion:2,updated:!0}:{success:!1,failureMessage:n.error.message}};u.ActOrderSchema=Vt,u.ActorDataSchema=qe,u.AmbientNoiseConsequenceSchema=de,u.AspectRatioSchema=Et,u.BackgroundMusicConsequenceSchema=ce,u.BoardFontSchema=Ht,u.BoardProgressionSchema=Gt,u.ChangeRoomConsequenceSchema=ee,u.ChangeStatusConsequenceSchema=ne,u.CommandSchema=Qa,u.CommandTargetSchema=Kt,u.ConsequenceSchema=$t,u.ConversationBranchSchema=Mt,u.ConversationChoiceConsequenceSchema=re,u.ConversationChoiceSchema=Xe,u.ConversationConsequenceSchema=se,u.ConversationSchema=Qe,u.ConversationSchemaWithDeprecatedConsequences=at,u.DB_VERSION=De,u.DirectionEnum=K,u.EndingConsequenceSchema=et,u.EndingSchema=Ke,u.FixedGameInfoSchema=ut,u.FlagConsequenceSchema=ue,u.FlagMapSchema=st,u.FlagSchema=zt,u.GameContentsDataSchema=Ve,u.GameDataItemTypeEnum=Ja,u.GameDataSchema=Ha,u.GameDesignSchema=Xt,u.GameHappeningsSchema=Yt,u.GotoOrderSchema=jt,u.HotspotZoneSchema=it,u.IdentSchema=Ie,u.ImmediateConsequenceSchema=Je,u.ImmediateConsequenceSchemaWithDeprecated=Pt,u.InteractionSchema=Ze,u.InteractionSchemaWithDeprecatedConsequences=tt,u.InventoryConsequenceSchema=te,u.ItemDataSchema=_e,u.MoveOrderSchema=qt,u.NarrativeSchema=O,u.OrderConsequenceSchema=Re,u.PositionSchema=Zt,u.RemoveActorConsequenceSchema=ae,u.RoomDataSchema=ot,u.SayOrderSchema=Dt,u.SequenceConsequenceSchema=Ne,u.SequenceSchema=ve,u.SequenceSchemaWithDeprecatedConsequences=Ee,u.SoundEffectConsequenceSchema=oe,u.SoundValueSchema=nt,u.SpriteDataSchema=ct,u.SpriteFrameSchema=Se,u.SpriteParamsSchema=Nt,u.StageSchema=Ye,u.StaticFrameParamsSchema=ye,u.StoryBoardConsequenceSchema=le,u.StoryBoardPageSchema=Ut,u.StoryBoardSchema=dt,u.TeleportActorConsequenceSchema=ie,u.ToggleZoneConsequenceSchema=F,u.VerbSchema=je,u.ZoneSchema=rt,u.changeHistory=he,u.consequenceMap=ja,u.consequenceTypes=qa,u.directions=Oa,u.immediateConsequenceTypes=Da,u.orderBaseOmits=Aa,u.orderSchema=ge,u.orderTypes=Za,u.parseAndUpgrade=nn,u.soundInstanceSchema=Oe,u.v2GameDesignSchema=Jt,u.v3GameDesignSchema=Qt,u.xPlacement=Ft,u.yPlacement=Wt,u.zoneTypes=Ea,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(u,me){typeof exports=="object"&&typeof module<"u"?me(exports):typeof define=="function"&&define.amd?define(["exports"],me):(u=typeof globalThis<"u"?globalThis:u||self,me(u.PointClickLib={}))})(this,(function(u){"use strict";const me=[{schemaVersion:3,changes:[{breaking:!1,description:"Designs have schemaVersion property"},{breaking:!1,description:"storyBoards array is required"}]},{schemaVersion:4,changes:[{breaking:!0,description:"Endings deprecated in favour of storyBoards. Any Endings have been converted to Storyboards."},{breaking:!1,description:"StoryBoards have end of game option."}]}];var C;(function(a){a.assertEqual=s=>{};function e(s){}a.assertIs=e;function t(s){throw new Error}a.assertNever=t,a.arrayToEnum=s=>{const r={};for(const i of s)r[i]=i;return r},a.getValidEnumValues=s=>{const r=a.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of r)i[o]=s[o];return a.objectValues(i)},a.objectValues=s=>a.objectKeys(s).map(function(r){return s[r]}),a.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const r=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&r.push(i);return r},a.find=(s,r)=>{for(const i of s)if(r(i))return i},a.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,r=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(r)}a.joinValues=n,a.jsonStringifyReplacer=(s,r)=>typeof r=="bigint"?r.toString():r})(C||(C={}));var pt;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(pt||(pt={}));const m=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=a=>{switch(typeof a){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(a)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(a)?m.array:a===null?m.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?m.promise:typeof Map<"u"&&a instanceof Map?m.map:typeof Set<"u"&&a instanceof Set?m.set:typeof Date<"u"&&a instanceof Date?m.date:m.object;default:return m.unknown}},d=C.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class V extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(r){return r.message},n={_errors:[]},s=r=>{for(const i of r.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)n._errors.push(t(i));else{let o=n,p=0;for(;p<i.path.length;){const y=i.path[p];p===i.path.length-1?(o[y]=o[y]||{_errors:[]},o[y]._errors.push(t(i))):o[y]=o[y]||{_errors:[]},o=o[y],p++}}};return s(this),n}static assert(e){if(!(e instanceof V))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const s of this.issues)if(s.path.length>0){const r=s.path[0];t[r]=t[r]||[],t[r].push(e(s))}else n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}V.create=a=>new V(a);const $e=(a,e)=>{let t;switch(a.code){case d.invalid_type:a.received===m.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,C.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${C.joinValues(a.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${C.joinValues(a.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${C.joinValues(a.options)}, received '${a.received}'`;break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:C.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case d.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case d.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,C.assertNever(a)}return{message:t}};let aa=$e;function na(){return aa}const sa=a=>{const{data:e,path:t,errorMaps:n,issueData:s}=a,r=[...t,...s.path||[]],i={...s,path:r};if(s.message!==void 0)return{...s,path:r,message:s.message};let o="";const p=n.filter(y=>!!y).slice().reverse();for(const y of p)o=y(i,{data:e,defaultError:o}).message;return{...s,path:r,message:o}};function l(a,e){const t=na(),n=sa({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===$e?void 0:$e].filter(s=>!!s)});a.common.issues.push(n)}class R{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const s of t){if(s.status==="aborted")return _;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const s of t){const r=await s.key,i=await s.value;n.push({key:r,value:i})}return R.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const s of t){const{key:r,value:i}=s;if(r.status==="aborted"||i.status==="aborted")return _;r.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),r.value!=="__proto__"&&(typeof i.value<"u"||s.alwaysSet)&&(n[r.value]=i.value)}return{status:e.value,value:n}}}const _=Object.freeze({status:"aborted"}),fe=a=>({status:"dirty",value:a}),Z=a=>({status:"valid",value:a}),yt=a=>a.status==="aborted",gt=a=>a.status==="dirty",U=a=>a.status==="valid",be=a=>typeof Promise<"u"&&a instanceof Promise;var f;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(f||(f={}));class j{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const vt=(a,e)=>{if(U(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new V(a.common.issues);return this._error=t,this._error}}};function k(a){if(!a)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:s}=a;if(e&&(t||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:(i,o)=>{const{message:p}=a;return i.code==="invalid_enum_value"?{message:p??o.defaultError}:typeof o.data>"u"?{message:p??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:p??t??o.defaultError}},description:s}}class b{get description(){return this._def.description}_getType(e){return $(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:$(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(be(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},s=this._parseSync({data:e,path:n.path,parent:n});return vt(n,s)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)};if(!this["~standard"].async)try{const n=this._parseSync({data:e,path:[],parent:t});return U(n)?{value:n.value}:{issues:t.common.issues}}catch(n){n?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(n=>U(n)?{value:n.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:$(e)},s=this._parse({data:e,path:n.path,parent:n}),r=await(be(s)?s:Promise.resolve(s));return vt(n,r)}refine(e,t){const n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,r)=>{const i=e(s),o=()=>r.addIssue({code:d.custom,...n(s)});return typeof Promise<"u"&&i instanceof Promise?i.then(p=>p?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new Y({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return M.create(this,this._def)}nullable(){return X.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return D.create(this)}promise(){return Ie.create(this,this._def)}or(e){return Ce.create([this,e],this._def)}and(e){return we.create(this,e,this._def)}transform(e){return new Y({...k(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new We({...k(this._def),innerType:this,defaultValue:t,typeName:v.ZodDefault})}brand(){return new Ia({typeName:v.ZodBranded,type:this,...k(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ue({...k(this._def),innerType:this,catchValue:t,typeName:v.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ge.create(this,e)}readonly(){return He.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ra=/^c[^\s-]{8,}$/i,ia=/^[0-9a-z]+$/,oa=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ca=/^[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,da=/^[a-z0-9_-]{21}$/i,ua=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,la=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,ha=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ma="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Be;const fa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,pa=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,ya=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,ga=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,va=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,_a=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,_t="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Sa=new RegExp(`^${_t}$`);function St(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);const t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ka(a){return new RegExp(`^${St(a)}$`)}function ba(a){let e=`${_t}T${St(a)}`;const t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function xa(a,e){return!!((e==="v4"||!e)&&fa.test(a)||(e==="v6"||!e)&&ya.test(a))}function Ca(a,e){if(!ua.test(a))return!1;try{const[t]=a.split(".");if(!t)return!1;const n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),s=JSON.parse(atob(n));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function wa(a,e){return!!((e==="v4"||!e)&&pa.test(a)||(e==="v6"||!e)&&ga.test(a))}class P extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_type,expected:m.string,received:r.parsedType}),_}const n=new R;let s;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="max")e.data.length>r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!1,message:r.message}),n.dirty());else if(r.kind==="length"){const i=e.data.length>r.value,o=e.data.length<r.value;(i||o)&&(s=this._getOrReturnCtx(e,s),i?l(s,{code:d.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&l(s,{code:d.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")ha.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"email",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")Be||(Be=new RegExp(ma,"u")),Be.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"emoji",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")ca.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"uuid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")da.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"nanoid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")ra.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")ia.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cuid2",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")oa.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ulid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),l(s,{validation:"url",code:d.invalid_string,message:r.message}),n.dirty()}else r.kind==="regex"?(r.regex.lastIndex=0,r.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"regex",code:d.invalid_string,message:r.message}),n.dirty())):r.kind==="trim"?e.data=e.data.trim():r.kind==="includes"?e.data.includes(r.value,r.position)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{includes:r.value,position:r.position},message:r.message}),n.dirty()):r.kind==="toLowerCase"?e.data=e.data.toLowerCase():r.kind==="toUpperCase"?e.data=e.data.toUpperCase():r.kind==="startsWith"?e.data.startsWith(r.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{startsWith:r.value},message:r.message}),n.dirty()):r.kind==="endsWith"?e.data.endsWith(r.value)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:{endsWith:r.value},message:r.message}),n.dirty()):r.kind==="datetime"?ba(r).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?Sa.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"date",message:r.message}),n.dirty()):r.kind==="time"?ka(r).test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:d.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?la.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"duration",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?xa(e.data,r.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"ip",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?Ca(e.data,r.alg)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"jwt",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?wa(e.data,r.version)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"cidr",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?va.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?_a.test(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{validation:"base64url",code:d.invalid_string,message:r.message}),n.dirty()):C.assertNever(r);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:d.invalid_string,...f.errToObj(n)})}_addCheck(e){return new P({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...f.errToObj(e)})}url(e){return this._addCheck({kind:"url",...f.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...f.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...f.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...f.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...f.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...f.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...f.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...f.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...f.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...f.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...f.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...f.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...f.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...f.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...f.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...f.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...f.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...f.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...f.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...f.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...f.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...f.errToObj(t)})}nonempty(e){return this.min(1,f.errToObj(e))}trim(){return new P({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new P({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}P.create=a=>new P({checks:[],typeName:v.ZodString,coerce:a?.coerce??!1,...k(a)});function Ta(a,e){const t=(a.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,r=Number.parseInt(a.toFixed(s).replace(".","")),i=Number.parseInt(e.toFixed(s).replace(".",""));return r%i/10**s}class G extends b{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)!==m.number){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_type,expected:m.number,received:r.parsedType}),_}let n;const s=new R;for(const r of this._def.checks)r.kind==="int"?C.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.invalid_type,expected:"integer",received:"float",message:r.message}),s.dirty()):r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,minimum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="multipleOf"?Ta(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):r.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_finite,message:r.message}),s.dirty()):C.assertNever(r);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,f.toString(t))}gt(e,t){return this.setLimit("min",e,!1,f.toString(t))}lte(e,t){return this.setLimit("max",e,!0,f.toString(t))}lt(e,t){return this.setLimit("max",e,!1,f.toString(t))}setLimit(e,t,n,s){return new G({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:f.toString(s)}]})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:f.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:f.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&C.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}G.create=a=>new G({checks:[],typeName:v.ZodNumber,coerce:a?.coerce||!1,...k(a)});class pe extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n;const s=new R;for(const r of this._def.checks)r.kind==="min"?(r.inclusive?e.data<r.value:e.data<=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_small,type:"bigint",minimum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="max"?(r.inclusive?e.data>r.value:e.data>=r.value)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.too_big,type:"bigint",maximum:r.value,inclusive:r.inclusive,message:r.message}),s.dirty()):r.kind==="multipleOf"?e.data%r.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),l(n,{code:d.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):C.assertNever(r);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:m.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,f.toString(t))}gt(e,t){return this.setLimit("min",e,!1,f.toString(t))}lte(e,t){return this.setLimit("max",e,!0,f.toString(t))}lt(e,t){return this.setLimit("max",e,!1,f.toString(t))}setLimit(e,t,n,s){return new pe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:f.toString(s)}]})}_addCheck(e){return new pe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}pe.create=a=>new pe({checks:[],typeName:v.ZodBigInt,coerce:a?.coerce??!1,...k(a)});class Me extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.boolean,received:n.parsedType}),_}return Z(e.data)}}Me.create=a=>new Me({typeName:v.ZodBoolean,coerce:a?.coerce||!1,...k(a)});class xe extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_type,expected:m.date,received:r.parsedType}),_}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return l(r,{code:d.invalid_date}),_}const n=new R;let s;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_small,message:r.message,inclusive:!0,exact:!1,minimum:r.value,type:"date"}),n.dirty()):r.kind==="max"?e.data.getTime()>r.value&&(s=this._getOrReturnCtx(e,s),l(s,{code:d.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):C.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new xe({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:f.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:f.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}xe.create=a=>new xe({checks:[],coerce:a?.coerce||!1,typeName:v.ZodDate,...k(a)});class kt extends b{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.symbol,received:n.parsedType}),_}return Z(e.data)}}kt.create=a=>new kt({typeName:v.ZodSymbol,...k(a)});class ze extends b{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.undefined,received:n.parsedType}),_}return Z(e.data)}}ze.create=a=>new ze({typeName:v.ZodUndefined,...k(a)});class bt extends b{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.null,received:n.parsedType}),_}return Z(e.data)}}bt.create=a=>new bt({typeName:v.ZodNull,...k(a)});class xt extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}xt.create=a=>new xt({typeName:v.ZodAny,...k(a)});class Ct extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}Ct.create=a=>new Ct({typeName:v.ZodUnknown,...k(a)});class B extends b{_parse(e){const t=this._getOrReturnCtx(e);return l(t,{code:d.invalid_type,expected:m.never,received:t.parsedType}),_}}B.create=a=>new B({typeName:v.ZodNever,...k(a)});class wt extends b{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.void,received:n.parsedType}),_}return Z(e.data)}}wt.create=a=>new wt({typeName:v.ZodVoid,...k(a)});class D extends b{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==m.array)return l(t,{code:d.invalid_type,expected:m.array,received:t.parsedType}),_;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(l(t,{code:i?d.too_big:d.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(l(t,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(l(t,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>s.type._parseAsync(new j(t,i,t.path,o)))).then(i=>R.mergeArray(n,i));const r=[...t.data].map((i,o)=>s.type._parseSync(new j(t,i,t.path,o)));return R.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new D({...this._def,minLength:{value:e,message:f.toString(t)}})}max(e,t){return new D({...this._def,maxLength:{value:e,message:f.toString(t)}})}length(e,t){return new D({...this._def,exactLength:{value:e,message:f.toString(t)}})}nonempty(e){return this.min(1,e)}}D.create=(a,e)=>new D({type:a,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...k(e)});function H(a){if(a instanceof A){const e={};for(const t in a.shape){const n=a.shape[t];e[t]=M.create(H(n))}return new A({...a._def,shape:()=>e})}else return a instanceof D?new D({...a._def,type:H(a.element)}):a instanceof M?M.create(H(a.unwrap())):a instanceof X?X.create(H(a.unwrap())):a instanceof L?L.create(a.items.map(e=>H(e))):a}class A extends b{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=C.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const y=this._getOrReturnCtx(e);return l(y,{code:d.invalid_type,expected:m.object,received:y.parsedType}),_}const{status:n,ctx:s}=this._processInputParams(e),{shape:r,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof B&&this._def.unknownKeys==="strip"))for(const y in s.data)i.includes(y)||o.push(y);const p=[];for(const y of i){const x=r[y],W=s.data[y];p.push({key:{status:"valid",value:y},value:x._parse(new j(s,W,s.path,y)),alwaysSet:y in s.data})}if(this._def.catchall instanceof B){const y=this._def.unknownKeys;if(y==="passthrough")for(const x of o)p.push({key:{status:"valid",value:x},value:{status:"valid",value:s.data[x]}});else if(y==="strict")o.length>0&&(l(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(y!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const y=this._def.catchall;for(const x of o){const W=s.data[x];p.push({key:{status:"valid",value:x},value:y._parse(new j(s,W,s.path,x)),alwaysSet:x in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const y=[];for(const x of p){const W=await x.key,ht=await x.value;y.push({key:W,value:ht,alwaysSet:x.alwaysSet})}return y}).then(y=>R.mergeObjectSync(n,y)):R.mergeObjectSync(n,p)}get shape(){return this._def.shape()}strict(e){return f.errToObj,new A({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{const s=this._def.errorMap?.(t,n).message??n.defaultError;return t.code==="unrecognized_keys"?{message:f.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new A({...this._def,unknownKeys:"strip"})}passthrough(){return new A({...this._def,unknownKeys:"passthrough"})}extend(e){return new A({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new A({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new A({...this._def,catchall:e})}pick(e){const t={};for(const n of C.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}omit(e){const t={};for(const n of C.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new A({...this._def,shape:()=>t})}deepPartial(){return H(this)}partial(e){const t={};for(const n of C.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new A({...this._def,shape:()=>t})}required(e){const t={};for(const n of C.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let r=this.shape[n];for(;r instanceof M;)r=r._def.innerType;t[n]=r}return new A({...this._def,shape:()=>t})}keyof(){return Ot(C.objectKeys(this.shape))}}A.create=(a,e)=>new A({shape:()=>a,unknownKeys:"strip",catchall:B.create(),typeName:v.ZodObject,...k(e)}),A.strictCreate=(a,e)=>new A({shape:()=>a,unknownKeys:"strict",catchall:B.create(),typeName:v.ZodObject,...k(e)}),A.lazycreate=(a,e)=>new A({shape:a,unknownKeys:"strip",catchall:B.create(),typeName:v.ZodObject,...k(e)});class Ce extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function s(r){for(const o of r)if(o.result.status==="valid")return o.result;for(const o of r)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=r.map(o=>new V(o.ctx.common.issues));return l(t,{code:d.invalid_union,unionErrors:i}),_}if(t.common.async)return Promise.all(n.map(async r=>{const i={...t,common:{...t.common,issues:[]},parent:null};return{result:await r._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(s);{let r;const i=[];for(const p of n){const y={...t,common:{...t.common,issues:[]},parent:null},x=p._parseSync({data:t.data,path:t.path,parent:y});if(x.status==="valid")return x;x.status==="dirty"&&!r&&(r={result:x,ctx:y}),y.common.issues.length&&i.push(y.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(p=>new V(p));return l(t,{code:d.invalid_union,unionErrors:o}),_}}get options(){return this._def.options}}Ce.create=(a,e)=>new Ce({options:a,typeName:v.ZodUnion,...k(e)});function Le(a,e){const t=$(a),n=$(e);if(a===e)return{valid:!0,data:a};if(t===m.object&&n===m.object){const s=C.objectKeys(e),r=C.objectKeys(a).filter(o=>s.indexOf(o)!==-1),i={...a,...e};for(const o of r){const p=Le(a[o],e[o]);if(!p.valid)return{valid:!1};i[o]=p.data}return{valid:!0,data:i}}else if(t===m.array&&n===m.array){if(a.length!==e.length)return{valid:!1};const s=[];for(let r=0;r<a.length;r++){const i=a[r],o=e[r],p=Le(i,o);if(!p.valid)return{valid:!1};s.push(p.data)}return{valid:!0,data:s}}else return t===m.date&&n===m.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}class we extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(r,i)=>{if(yt(r)||yt(i))return _;const o=Le(r.value,i.value);return o.valid?((gt(r)||gt(i))&&t.dirty(),{status:t.value,value:o.data}):(l(n,{code:d.invalid_intersection_types}),_)};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(([r,i])=>s(r,i)):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}))}}we.create=(a,e,t)=>new we({left:a,right:e,typeName:v.ZodIntersection,...k(t)});class L extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return l(n,{code:d.invalid_type,expected:m.array,received:n.parsedType}),_;if(n.data.length<this._def.items.length)return l(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&n.data.length>this._def.items.length&&(l(n,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const r=[...n.data].map((i,o)=>{const p=this._def.items[o]||this._def.rest;return p?p._parse(new j(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(r).then(i=>R.mergeArray(t,i)):R.mergeArray(t,r)}get items(){return this._def.items}rest(e){return new L({...this._def,rest:e})}}L.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new L({items:a,typeName:v.ZodTuple,rest:null,...k(e)})};class Te extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.object)return l(n,{code:d.invalid_type,expected:m.object,received:n.parsedType}),_;const s=[],r=this._def.keyType,i=this._def.valueType;for(const o in n.data)s.push({key:r._parse(new j(n,o,n.path,o)),value:i._parse(new j(n,n.data[o],n.path,o)),alwaysSet:o in n.data});return n.common.async?R.mergeObjectAsync(t,s):R.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof b?new Te({keyType:e,valueType:t,typeName:v.ZodRecord,...k(n)}):new Te({keyType:P.create(),valueType:e,typeName:v.ZodRecord,...k(t)})}}class Tt extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return l(n,{code:d.invalid_type,expected:m.map,received:n.parsedType}),_;const s=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([o,p],y)=>({key:s._parse(new j(n,o,n.path,[y,"key"])),value:r._parse(new j(n,p,n.path,[y,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const p of i){const y=await p.key,x=await p.value;if(y.status==="aborted"||x.status==="aborted")return _;(y.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(y.value,x.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const p of i){const y=p.key,x=p.value;if(y.status==="aborted"||x.status==="aborted")return _;(y.status==="dirty"||x.status==="dirty")&&t.dirty(),o.set(y.value,x.value)}return{status:t.value,value:o}}}}Tt.create=(a,e,t)=>new Tt({valueType:e,keyType:a,typeName:v.ZodMap,...k(t)});class ye extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return l(n,{code:d.invalid_type,expected:m.set,received:n.parsedType}),_;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(l(n,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(l(n,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());const r=this._def.valueType;function i(p){const y=new Set;for(const x of p){if(x.status==="aborted")return _;x.status==="dirty"&&t.dirty(),y.add(x.value)}return{status:t.value,value:y}}const o=[...n.data.values()].map((p,y)=>r._parse(new j(n,p,n.path,y)));return n.common.async?Promise.all(o).then(p=>i(p)):i(o)}min(e,t){return new ye({...this._def,minSize:{value:e,message:f.toString(t)}})}max(e,t){return new ye({...this._def,maxSize:{value:e,message:f.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ye.create=(a,e)=>new ye({valueType:a,minSize:null,maxSize:null,typeName:v.ZodSet,...k(e)});class It extends b{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}It.create=(a,e)=>new It({getter:a,typeName:v.ZodLazy,...k(e)});class Fe extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return l(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}Fe.create=(a,e)=>new Fe({value:a,typeName:v.ZodLiteral,...k(e)});function Ot(a,e){return new J({values:a,typeName:v.ZodEnum,...k(e)})}class J extends b{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{expected:C.joinValues(n),received:t.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return l(t,{received:t.data,code:d.invalid_enum_value,options:n}),_}return Z(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return J.create(e,{...this._def,...t})}exclude(e,t=this._def){return J.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}J.create=Ot;class At extends b{_parse(e){const t=C.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const s=C.objectValues(t);return l(n,{expected:C.joinValues(s),received:n.parsedType,code:d.invalid_type}),_}if(this._cache||(this._cache=new Set(C.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=C.objectValues(t);return l(n,{received:n.data,code:d.invalid_enum_value,options:s}),_}return Z(e.data)}get enum(){return this._def.values}}At.create=(a,e)=>new At({values:a,typeName:v.ZodNativeEnum,...k(e)});class Ie extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return l(t,{code:d.invalid_type,expected:m.promise,received:t.parsedType}),_;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return Z(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ie.create=(a,e)=>new Ie({type:a,typeName:v.ZodPromise,...k(e)});class Y extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,r={addIssue:i=>{l(n,i),i.fatal?t.abort():t.dirty()},get path(){return n.path}};if(r.addIssue=r.addIssue.bind(r),s.type==="preprocess"){const i=s.transform(n.data,r);if(n.common.async)return Promise.resolve(i).then(async o=>{if(t.value==="aborted")return _;const p=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return p.status==="aborted"?_:p.status==="dirty"||t.value==="dirty"?fe(p.value):p});{if(t.value==="aborted")return _;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?_:o.status==="dirty"||t.value==="dirty"?fe(o.value):o}}if(s.type==="refinement"){const i=o=>{const p=s.refinement(o,r);if(n.common.async)return Promise.resolve(p);if(p instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>o.status==="aborted"?_:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(s.type==="transform")if(n.common.async===!1){const i=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!U(i))return _;const o=s.transform(i.value,r);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(i=>U(i)?Promise.resolve(s.transform(i.value,r)).then(o=>({status:t.value,value:o})):_);C.assertNever(s)}}Y.create=(a,e,t)=>new Y({schema:a,typeName:v.ZodEffects,effect:e,...k(t)}),Y.createWithPreprocess=(a,e,t)=>new Y({schema:e,effect:{type:"preprocess",transform:a},typeName:v.ZodEffects,...k(t)});class M extends b{_parse(e){return this._getType(e)===m.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}M.create=(a,e)=>new M({innerType:a,typeName:v.ZodOptional,...k(e)});class X extends b{_parse(e){return this._getType(e)===m.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}X.create=(a,e)=>new X({innerType:a,typeName:v.ZodNullable,...k(e)});class We extends b{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}We.create=(a,e)=>new We({innerType:a,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...k(e)});class Ue extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return be(s)?s.then(r=>({status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new V(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new V(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Ue.create=(a,e)=>new Ue({innerType:a,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...k(e)});class Rt extends b{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return l(n,{code:d.invalid_type,expected:m.nan,received:n.parsedType}),_}return{status:"valid",value:e.data}}}Rt.create=a=>new Rt({typeName:v.ZodNaN,...k(a)});class Ia extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ge extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const r=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?_:r.status==="dirty"?(t.dirty(),fe(r.value)):this._def.out._parseAsync({data:r.value,path:n.path,parent:n})})();{const s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?_:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new Ge({in:e,out:t,typeName:v.ZodPipeline})}}class He extends b{_parse(e){const t=this._def.innerType._parse(e),n=s=>(U(s)&&(s.value=Object.freeze(s.value)),s);return be(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}He.create=(a,e)=>new He({innerType:a,typeName:v.ZodReadonly,...k(e)});var v;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(v||(v={}));const c=P.create,g=G.create,T=Me.create,Oa=ze.create;B.create;const N=D.create,h=A.create,Q=Ce.create;we.create;const Je=L.create,z=Te.create,w=Fe.create,q=J.create;Ie.create;const S=M.create;X.create;const Nt=()=>T().optional(),K=q(["left","right","up","down"]),Aa=K.options,Oe=h({type:c(),id:c(),name:S(c()),status:S(c())}),Zt=h({height:g(),width:g(),sprite:c().optional(),direction:S(K),filter:S(c())}),Et=h({room:S(c()),x:g(),y:g()}),ge=h({imageId:c(),col:g().optional(),row:g().optional()}),I=h({text:c().array()}),qt=h({x:g(),y:g()}),Ae=h({soundId:c(),volume:g().optional()}),Re={_started:Nt(),narrative:I.optional(),startDirection:K.optional(),endDirection:K.optional(),endStatus:c().optional()},Ra={_started:!0,narrative:!0,startDirection:!0,endDirection:!0,endStatus:!0,type:!0},Na=h({animation:S(c()),x:g(),y:g(),speed:S(g())}),jt=h({type:w("move"),roomId:c().optional(),pathIsSet:S(T()),doPendingInteractionWhenFinished:S(T()),steps:N(Na)}).extend(Re),Dt=h({type:w("goTo"),animation:S(c()),speed:S(g()),targetId:c()}).extend(Re),Vt=h({type:w("say"),animation:S(c()),text:c(),time:g()}).extend(Re),Za=h({animation:S(c()),duration:g(),timeElapsed:S(g()),reverse:S(T())}),Pt=h({type:w("act"),steps:N(Za)}).extend(Re),ve=Q([jt,Pt,Vt,Dt]),Ea=ve.options.map(a=>a.shape.type.value),Ne=h({type:w("order"),actorId:c().optional(),orders:N(ve),replaceCurrentOrders:S(T()),narrative:I.optional()}),ee=h({type:w("changeRoom"),roomId:c(),takePlayer:T(),x:S(g()),y:S(g()),narrative:I.optional()}),te=h({type:w("inventory"),itemId:c(),actorId:c().optional(),addOrRemove:q(["ADD","REMOVE"]),narrative:I.optional()}),ae=h({type:w("removeActor"),actorId:c(),narrative:I.optional()}),ne=h({type:w("changeStatus"),targetId:c(),targetType:q(["actor","item","hotspot"]),status:c(),narrative:I.optional()}),Ze=h({type:w("sequence"),sequence:c(),narrative:I.optional()}),se=h({type:w("conversation"),conversationId:c(),end:S(T()),narrative:I.optional()}),re=h({type:w("conversationChoice"),on:T(),conversationId:c(),branchId:c(),choiceRef:c(),narrative:I.optional()}),ie=h({type:w("teleportActor"),actorId:c(),roomId:S(c()),x:g(),y:g(),narrative:I.optional()}),F=h({type:w("toggleZone"),roomId:S(c()),on:T(),ref:c(),zoneType:q(["hotspot","obstacle","walkable"]),narrative:I.optional()}),oe=h({type:w("soundEffect"),sound:c(),volume:g().optional(),narrative:I.optional()}),ce=h({type:w("backgroundMusic"),sound:c().optional(),roomId:c().optional(),volume:g().optional(),narrative:I.optional()}),de=h({type:w("ambientNoise"),sound:c().optional(),roomId:c().optional(),volume:g().optional(),narrative:I.optional()}),ue=h({type:w("flag"),on:T(),flag:c(),narrative:I.optional()}),le=h({type:w("storyBoardConsequence"),storyBoardId:c(),narrative:I.optional()}),he=h({type:w("changePlayerCharacter"),actorId:c(),narrative:I.optional()}),qa=F.shape.zoneType.options,$t=Q([Ne,ee,te,ae,ne,Ze,se,ie,F,oe,ce,de,ue,re,le,he]),ja=q(["conversation","sequence","changeStatus","backgroundMusic","ambientNoise","removeActor","inventory","changeRoom","order","teleportActor","toggleZone","soundEffect","flag","conversationChoice","storyBoardConsequence","changePlayerCharacter"]).options,Da={conversation:se,sequence:Ze,changeStatus:ne,removeActor:ae,inventory:te,changeRoom:ee,order:Ne,teleportActor:ie,toggleZone:F,soundEffect:oe,flag:ue,conversationChoice:re,backgroundMusic:ce,ambientNoise:de,storyBoardConsequence:le,changePlayerCharacter:he},Ye=Q([ae,ne,te,se,ie,F,oe,ue,ee,re,ce,de,le,he]),Va=Ye.options.map(a=>a.shape.type.value),Ee=h({verbId:c(),targetId:c(),roomId:c().optional(),itemId:c().optional(),targetStatus:c().optional(),mustReachFirst:T().optional(),consequences:N($t),flagsThatMustBeFalse:N(c()).optional(),flagsThatMustBeTrue:N(c()).optional(),requiredInventory:N(c()).optional()}),Xe=h({actorOrders:S(z(c(),ve.array())),immediateConsequences:S(Ye.array()),narrative:I.optional(),_started:Nt()}),_e=h({id:c(),description:c().optional(),stages:Xe.array()}),Bt=h({conversationId:c().optional(),branchId:c().optional(),choiceRef:c().optional()}),Qe=h({ref:c().optional(),text:c(),sequence:c().optional(),nextBranch:S(c()),once:S(T()),disabled:S(T()),enablesChoices:N(Bt).optional(),disablesChoices:N(Bt).optional(),end:S(T()),choiceSequence:_e.optional()}),Mt=h({choices:N(Qe)}),Ke=h({id:c(),branches:z(c(),S(Mt)),currentBranch:S(c()),defaultBranch:c()}),et=h({id:c(),message:c(),imageId:c().optional(),imageWidth:g().optional()}),tt=h({type:w("ending"),endingId:c(),narrative:I.optional()}),Pa=Q([Ne,ee,te,ae,ne,Ze,se,ie,F,oe,ce,de,ue,re,le,he,tt]),zt=Q([ae,ne,te,se,ie,F,oe,ue,ee,re,ce,de,le,he,tt]),at=Ee.merge(h({consequences:N(Pa)})),qe=_e.merge(h({stages:Xe.merge(h({immediateConsequences:S(zt.array())})).array()})),$a=Qe.merge(h({choiceSequence:qe.optional()})),Ba=h({choices:N($a)}),nt=Ke.merge(h({branches:z(c(),S(Ba))})),st=h({soundId:c(),frameIndex:g().optional(),volume:g().optional()}),Ma=z(c(),st.or(st.array()).or(Oa())),je=Oe.merge(Et).merge(Zt).merge(h({type:w("actor"),isPlayer:S(T()),noInteraction:S(T()),speed:S(g()),baseline:S(g()),dialogueColor:S(c()),soundEffectMap:Ma.optional(),walkToX:g().optional(),walkToY:g().optional(),defaultFrame:ge.optional(),statusFrames:z(ge).optional()})),Lt=h({value:T(),default:T(),description:c().optional()}),rt=z(c(),Lt.optional()),Se=Oe.extend({type:w("item"),actorId:c().optional()}).and(ge.partial());q(["rect","circle","polygon"]);const za=N(Je([g(),g()])),Ft=h({type:c().optional(),x:g(),y:g(),path:S(c()),polygon:S(za),circle:S(g()),rect:S(Je([g(),g()]))}),it=Ft.merge(h({ref:c().optional(),disabled:T().optional()})),ot=Ft.merge(Oe).merge(h({type:w("hotspot"),parallax:g(),walkToX:g().optional(),walkToY:g().optional()})),La=h({parallax:g(),imageId:c(),placement:h({x:g(),y:g(),width:g(),height:g()}).optional()}),Fa=N(Je([g(),g()])),ct=h({id:c(),frameWidth:g(),frameHeight:g().optional(),width:g(),height:g(),background:La.array(),hotspots:ot.array().optional(),obstacleAreas:S(it.array()),walkableAreas:S(it.array()),scaling:S(Fa),backgroundColor:c().optional(),name:c().optional(),narrative:I.optional(),backgroundMusic:Ae.optional(),ambientNoise:Ae.optional()}),ke=h({imageId:c(),row:g(),col:g()}),Wa=h({left:ke.array().optional(),right:ke.array().optional(),up:ke.array().optional(),down:ke.array().optional()}),dt=h({id:c(),defaultDirection:K,animations:z(c(),Wa)}),Wt=q(["center","left","right"]),Ut=q(["center","top","bottom"]),Ua=h({x:Wt,y:Ut,width:g().optional(),height:g().optional(),aspectRatio:qt.optional()}).merge(h({image:ge})),Gt=h({title:c(),narrative:I,pictures:Ua.array(),backgroundColor:c(),color:c()}),Ht=q(["sound","buttons"]),Jt=q(["serif","sans-serif","monospace","cursive","fantasy","math"]),ut=h({id:c(),isEndOfGame:T().optional(),pages:Gt.array(),font:Jt.optional(),sound:Ae.optional(),progression:Ht.optional()}),De=h({id:c(),label:c(),preposition:c().optional(),isMoveVerb:T().optional(),isNotForItems:T().optional(),isLookVerb:T().optional(),requiresItem:T().optional(),defaultResponseNoItem:c().optional(),defaultResponseWithItem:c().optional(),defaultResponseCannotReach:c().optional()}),Ga=h({schemaVersion:g().optional(),rooms:ct.array(),items:Se.array(),actors:je.array(),interactions:at.array(),conversations:nt.array(),flagMap:rt,currentRoomId:c(),id:c(),description:c().optional().describe("a short description of your game"),thumbnailAssetId:c().optional()}),Ha=h({verbs:De.array(),sequences:qe.array(),sprites:dt.array(),endings:et.array(),openingSequenceId:c().optional(),openingStoryboardId:c().optional(),storyBoards:ut.array().optional()}),Yt=Ga.and(Ha).describe("The game schema"),Ve=4,Xt=h({sequenceRunning:_e.optional(),currentStoryBoardId:c().optional(),actorOrders:z(c(),ve.array()),currentConversationId:c().optional(),pendingInteraction:Ee.optional(),gameNotBegun:T()}),Pe=h({schemaVersion:w(Ve),rooms:ct.array(),items:Se.array(),actors:je.array(),interactions:Ee.array(),conversations:Ke.array(),flagMap:rt,currentRoomId:c(),id:c(),description:c().optional().describe("a short description of your game"),thumbnailAssetId:c().optional()}),lt=h({verbs:De.array(),sequences:_e.array(),sprites:dt.array(),openingSequenceId:c().optional(),openingStoryboardId:c().optional(),storyBoards:ut.array()}),Ja=Pe.and(Xt),Qt=Pe.and(lt).describe("The game schema"),Ya=q(["rooms","items","actors","conversations","sprites","sequences","verbs","storyBoards"]),Xa=Pe.merge(h({schemaVersion:w(3),interactions:at.array(),conversations:nt.array()})),Qa=lt.merge(h({endings:et.array(),sequences:qe.array()})),Kt=Xa.and(Qa).describe("The game schema"),ea=Q([je,Se,ot]),Ka=h({verb:De,target:ea,item:S(Se)}),en=a=>({...a,storyBoards:a.storyBoards??[],schemaVersion:3}),tn=a=>ta(en(a)),an=(a,e)=>{const t=a.imageId?{x:"center",y:"center",width:a.imageWidth?a.imageWidth/16:20,height:a.imageWidth?a.imageWidth/16:20,image:{imageId:a.imageId}}:void 0;return{id:e??a.id,isEndOfGame:!0,pages:[{title:a.message,narrative:{text:[]},color:"#FFFFFF",backgroundColor:"#000000",pictures:t?[t]:[]}]}},nn=(a,e)=>{const t=e.filter(s=>s.startsWith(a)),n=(s=1)=>{const r=`${a}_${s}`;return t.includes(r)?n(s+1):r};return n()},ta=a=>{const{storyBoards:e,interactions:t,sequences:n,conversations:s}=a,r=e.map(O=>O.id),i={},o=a.endings.map(O=>{const E=r.includes(O.id)?nn(O.id,r):void 0;return E&&r.push(E),i[O.id]=E??O.id,an(O,E)}),p=O=>O.type!=="ending"?O:{type:"storyBoardConsequence",storyBoardId:i[O.endingId]??O.endingId,narrative:O.narrative},y=O=>({...O,stages:O.stages.map(E=>({...E,immediateConsequences:E.immediateConsequences?.map(p)}))}),x=O=>{const{branches:E}=O;for(let on in E){const mt=E[on];mt&&(mt.choices=mt.choices.map(ft=>({...ft,choiceSequence:ft.choiceSequence?y(ft.choiceSequence):void 0})))}return{...O,branches:E}},W=t.map(O=>({...O,consequences:O.consequences.map(p)})),ht=n.map(y),rn=s.map(x);return{...a,storyBoards:[...e,...o],interactions:W,sequences:ht,conversations:rn,schemaVersion:Ve}},sn=a=>{const e=Qt.safeParse(a);if(e.success)return{success:!0,gameDesign:e.data,sourceVersion:Ve,updated:!1};const t=Kt.safeParse(a);if(t.success)return{success:!0,gameDesign:ta(t.data),sourceVersion:3,updated:!0};const n=Yt.safeParse(a);return n.success?{success:!0,gameDesign:tn(n.data),sourceVersion:2,updated:!0}:{success:!1,failureMessage:n.error.message}};u.ActOrderSchema=Pt,u.ActorDataSchema=je,u.AmbientNoiseConsequenceSchema=de,u.AspectRatioSchema=qt,u.BackgroundMusicConsequenceSchema=ce,u.BoardFontSchema=Jt,u.BoardProgressionSchema=Ht,u.ChangePlayerCharacterConsequenceSchema=he,u.ChangeRoomConsequenceSchema=ee,u.ChangeStatusConsequenceSchema=ne,u.CommandSchema=Ka,u.CommandTargetSchema=ea,u.ConsequenceSchema=$t,u.ConversationBranchSchema=Mt,u.ConversationChoiceConsequenceSchema=re,u.ConversationChoiceSchema=Qe,u.ConversationConsequenceSchema=se,u.ConversationSchema=Ke,u.ConversationSchemaWithDeprecatedConsequences=nt,u.DB_VERSION=Ve,u.DirectionEnum=K,u.EndingConsequenceSchema=tt,u.EndingSchema=et,u.FixedGameInfoSchema=lt,u.FlagConsequenceSchema=ue,u.FlagMapSchema=rt,u.FlagSchema=Lt,u.GameContentsDataSchema=Pe,u.GameDataItemTypeEnum=Ya,u.GameDataSchema=Ja,u.GameDesignSchema=Qt,u.GameHappeningsSchema=Xt,u.GotoOrderSchema=Dt,u.HotspotZoneSchema=ot,u.IdentSchema=Oe,u.ImmediateConsequenceSchema=Ye,u.ImmediateConsequenceSchemaWithDeprecated=zt,u.InteractionSchema=Ee,u.InteractionSchemaWithDeprecatedConsequences=at,u.InventoryConsequenceSchema=te,u.ItemDataSchema=Se,u.MoveOrderSchema=jt,u.NarrativeSchema=I,u.OrderConsequenceSchema=Ne,u.PositionSchema=Et,u.RemoveActorConsequenceSchema=ae,u.RoomDataSchema=ct,u.SayOrderSchema=Vt,u.SequenceConsequenceSchema=Ze,u.SequenceSchema=_e,u.SequenceSchemaWithDeprecatedConsequences=qe,u.SoundEffectConsequenceSchema=oe,u.SoundValueSchema=st,u.SpriteDataSchema=dt,u.SpriteFrameSchema=ke,u.SpriteParamsSchema=Zt,u.StageSchema=Xe,u.StaticFrameParamsSchema=ge,u.StoryBoardConsequenceSchema=le,u.StoryBoardPageSchema=Gt,u.StoryBoardSchema=ut,u.TeleportActorConsequenceSchema=ie,u.ToggleZoneConsequenceSchema=F,u.VerbSchema=De,u.ZoneSchema=it,u.changeHistory=me,u.consequenceMap=Da,u.consequenceTypes=ja,u.directions=Aa,u.immediateConsequenceTypes=Va,u.orderBaseOmits=Ra,u.orderSchema=ve,u.orderTypes=Ea,u.parseAndUpgrade=sn,u.soundInstanceSchema=Ae,u.v2GameDesignSchema=Yt,u.v3GameDesignSchema=Kt,u.xPlacement=Wt,u.yPlacement=Ut,u.zoneTypes=qa,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "point-click-lib",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {