point-click-lib 0.0.6 → 0.0.8

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,20 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const aa=[{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 b;(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})(b||(b={}));var mt;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(mt||(mt={}));const h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),P=a=>{switch(typeof a){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(a)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(a)?h.array:a===null?h.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?h.promise:typeof Map<"u"&&a instanceof Map?h.map:typeof Set<"u"&&a instanceof Set?h.set:typeof Date<"u"&&a instanceof Date?h.date:h.object;default:return h.unknown}},d=b.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,f=0;for(;f<i.path.length;){const p=i.path[f];f===i.path.length-1?(o[p]=o[p]||{_errors:[]},o[p]._errors.push(t(i))):o[p]=o[p]||{_errors:[]},o=o[p],f++}}};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,b.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 Me=(a,e)=>{let t;switch(a.code){case d.invalid_type:a.received===h.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case d.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,b.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:t=`Unrecognized key(s) in object: ${b.joinValues(a.keys,", ")}`;break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${b.joinValues(a.options)}`;break;case d.invalid_enum_value:t=`Invalid enum value. Expected ${b.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}"`:b.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,b.assertNever(a)}return{message:t}};let na=Me;function sa(){return na}const ra=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 f=n.filter(p=>!!p).slice().reverse();for(const p of f)o=p(i,{data:e,defaultError:o}).message;return{...s,path:r,message:o}};function u(a,e){const t=sa(),n=ra({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===Me?void 0:Me].filter(s=>!!s)});a.common.issues.push(n)}class A{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 v;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 A.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 v;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 v=Object.freeze({status:"aborted"}),he=a=>({status:"dirty",value:a}),Z=a=>({status:"valid",value:a}),ft=a=>a.status==="aborted",pt=a=>a.status==="dirty",U=a=>a.status==="valid",xe=a=>typeof Promise<"u"&&a instanceof Promise;var m;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e?.message})(m||(m={}));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 yt=(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 x(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:f}=a;return i.code==="invalid_enum_value"?{message:f??o.defaultError}:typeof o.data>"u"?{message:f??n??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:f??t??o.defaultError}},description:s}}class S{get description(){return this._def.description}_getType(e){return P(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new A,ctx:{common:e.parent.common,data:e.data,parsedType:P(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(xe(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:P(e)},s=this._parseSync({data:e,path:n.path,parent:n});return yt(n,s)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:P(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:P(e)},s=this._parse({data:e,path:n.path,parent:n}),r=await(xe(s)?s:Promise.resolve(s));return yt(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(f=>f?!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 J({schema:this,typeName:g.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 $.create(this,this._def)}nullable(){return Y.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return q.create(this)}promise(){return we.create(this,this._def)}or(e){return ke.create([this,e],this._def)}and(e){return be.create(this,e,this._def)}transform(e){return new J({...x(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Ue({...x(this._def),innerType:this,defaultValue:t,typeName:g.ZodDefault})}brand(){return new Oa({typeName:g.ZodBranded,type:this,...x(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Ge({...x(this._def),innerType:this,catchValue:t,typeName:g.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Xe.create(this,e)}readonly(){return He.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ia=/^c[^\s-]{8,}$/i,oa=/^[0-9a-z]+$/,ca=/^[0-9A-HJKMNP-TV-Z]{26}$/i,da=/^[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,ua=/^[a-z0-9_-]{21}$/i,la=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ha=/^[-+]?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)?)??$/,ma=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,fa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Be;const 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])$/,ya=/^(?:(?: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])$/,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]))$/,va=/^(([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])$/,_a=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,xa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,It="((\\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(`^${It}$`);function Ot(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(`^${Ot(a)}$`)}function ba(a){let e=`${It}T${Ot(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 Ca(a,e){return!!((e==="v4"||!e)&&pa.test(a)||(e==="v6"||!e)&&ga.test(a))}function wa(a,e){if(!la.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 Ta(a,e){return!!((e==="v4"||!e)&&ya.test(a)||(e==="v6"||!e)&&va.test(a))}class D extends S{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.string,received:r.parsedType}),v}const n=new A;let s;for(const r of this._def.checks)if(r.kind==="min")e.data.length<r.value&&(s=this._getOrReturnCtx(e,s),u(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),u(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?u(s,{code:d.too_big,maximum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}):o&&u(s,{code:d.too_small,minimum:r.value,type:"string",inclusive:!0,exact:!0,message:r.message}),n.dirty())}else if(r.kind==="email")ma.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"email",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="emoji")Be||(Be=new RegExp(fa,"u")),Be.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"emoji",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="uuid")da.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"uuid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="nanoid")ua.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"nanoid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid")ia.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cuid",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="cuid2")oa.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cuid2",code:d.invalid_string,message:r.message}),n.dirty());else if(r.kind==="ulid")ca.test(e.data)||(s=this._getOrReturnCtx(e,s),u(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),u(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),u(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),u(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),u(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),u(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),u(s,{code:d.invalid_string,validation:"datetime",message:r.message}),n.dirty()):r.kind==="date"?Sa.test(e.data)||(s=this._getOrReturnCtx(e,s),u(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),u(s,{code:d.invalid_string,validation:"time",message:r.message}),n.dirty()):r.kind==="duration"?ha.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"duration",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="ip"?Ca(e.data,r.version)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"ip",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="jwt"?wa(e.data,r.alg)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"jwt",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="cidr"?Ta(e.data,r.version)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cidr",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="base64"?_a.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"base64",code:d.invalid_string,message:r.message}),n.dirty()):r.kind==="base64url"?xa.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"base64url",code:d.invalid_string,message:r.message}),n.dirty()):b.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,...m.errToObj(n)})}_addCheck(e){return new D({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...m.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...m.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...m.errToObj(e)})}datetime(e){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,...m.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,...m.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errToObj(t)})}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new D({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new D({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new D({...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}}D.create=a=>new D({checks:[],typeName:g.ZodString,coerce:a?.coerce??!1,...x(a)});function Ia(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 S{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)!==h.number){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.number,received:r.parsedType}),v}let n;const s=new A;for(const r of this._def.checks)r.kind==="int"?b.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),u(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),u(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),u(n,{code:d.too_big,maximum:r.value,type:"number",inclusive:r.inclusive,exact:!1,message:r.message}),s.dirty()):r.kind==="multipleOf"?Ia(e.data,r.value)!==0&&(n=this._getOrReturnCtx(e,n),u(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),u(n,{code:d.not_finite,message:r.message}),s.dirty()):b.assertNever(r);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,s){return new G({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.toString(s)}]})}_addCheck(e){return new G({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)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"&&b.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:g.ZodNumber,coerce:a?.coerce||!1,...x(a)});class fe extends S{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)!==h.bigint)return this._getInvalidInput(e);let n;const s=new A;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),u(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),u(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),u(n,{code:d.not_multiple_of,multipleOf:r.value,message:r.message}),s.dirty()):b.assertNever(r);return{status:s.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return u(t,{code:d.invalid_type,expected:h.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,n,s){return new fe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.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:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)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:g.ZodBigInt,coerce:a?.coerce??!1,...x(a)});class ze extends S{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.boolean,received:n.parsedType}),v}return Z(e.data)}}ze.create=a=>new ze({typeName:g.ZodBoolean,coerce:a?.coerce||!1,...x(a)});class Se extends S{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:h.date,received:r.parsedType}),v}if(Number.isNaN(e.data.getTime())){const r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_date}),v}const n=new A;let s;for(const r of this._def.checks)r.kind==="min"?e.data.getTime()<r.value&&(s=this._getOrReturnCtx(e,s),u(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),u(s,{code:d.too_big,message:r.message,inclusive:!0,exact:!1,maximum:r.value,type:"date"}),n.dirty()):b.assertNever(r);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Se({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)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}}Se.create=a=>new Se({checks:[],coerce:a?.coerce||!1,typeName:g.ZodDate,...x(a)});class gt extends S{_parse(e){if(this._getType(e)!==h.symbol){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.symbol,received:n.parsedType}),v}return Z(e.data)}}gt.create=a=>new gt({typeName:g.ZodSymbol,...x(a)});class Le extends S{_parse(e){if(this._getType(e)!==h.undefined){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.undefined,received:n.parsedType}),v}return Z(e.data)}}Le.create=a=>new Le({typeName:g.ZodUndefined,...x(a)});class vt extends S{_parse(e){if(this._getType(e)!==h.null){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.null,received:n.parsedType}),v}return Z(e.data)}}vt.create=a=>new vt({typeName:g.ZodNull,...x(a)});class _t extends S{constructor(){super(...arguments),this._any=!0}_parse(e){return Z(e.data)}}_t.create=a=>new _t({typeName:g.ZodAny,...x(a)});class xt extends S{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Z(e.data)}}xt.create=a=>new xt({typeName:g.ZodUnknown,...x(a)});class B extends S{_parse(e){const t=this._getOrReturnCtx(e);return u(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),v}}B.create=a=>new B({typeName:g.ZodNever,...x(a)});class St extends S{_parse(e){if(this._getType(e)!==h.undefined){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.void,received:n.parsedType}),v}return Z(e.data)}}St.create=a=>new St({typeName:g.ZodVoid,...x(a)});class q extends S{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==h.array)return u(t,{code:d.invalid_type,expected:h.array,received:t.parsedType}),v;if(s.exactLength!==null){const i=t.data.length>s.exactLength.value,o=t.data.length<s.exactLength.value;(i||o)&&(u(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&&(u(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&&(u(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=>A.mergeArray(n,i));const r=[...t.data].map((i,o)=>s.type._parseSync(new j(t,i,t.path,o)));return A.mergeArray(n,r)}get element(){return this._def.type}min(e,t){return new q({...this._def,minLength:{value:e,message:m.toString(t)}})}max(e,t){return new q({...this._def,maxLength:{value:e,message:m.toString(t)}})}length(e,t){return new q({...this._def,exactLength:{value:e,message:m.toString(t)}})}nonempty(e){return this.min(1,e)}}q.create=(a,e)=>new q({type:a,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...x(e)});function W(a){if(a instanceof O){const e={};for(const t in a.shape){const n=a.shape[t];e[t]=$.create(W(n))}return new O({...a._def,shape:()=>e})}else return a instanceof q?new q({...a._def,type:W(a.element)}):a instanceof $?$.create(W(a.unwrap())):a instanceof Y?Y.create(W(a.unwrap())):a instanceof L?L.create(a.items.map(e=>W(e))):a}class O extends S{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=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){const p=this._getOrReturnCtx(e);return u(p,{code:d.invalid_type,expected:h.object,received:p.parsedType}),v}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 p in s.data)i.includes(p)||o.push(p);const f=[];for(const p of i){const k=r[p],z=s.data[p];f.push({key:{status:"valid",value:p},value:k._parse(new j(s,z,s.path,p)),alwaysSet:p in s.data})}if(this._def.catchall instanceof B){const p=this._def.unknownKeys;if(p==="passthrough")for(const k of o)f.push({key:{status:"valid",value:k},value:{status:"valid",value:s.data[k]}});else if(p==="strict")o.length>0&&(u(s,{code:d.unrecognized_keys,keys:o}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const k of o){const z=s.data[k];f.push({key:{status:"valid",value:k},value:p._parse(new j(s,z,s.path,k)),alwaysSet:k in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const p=[];for(const k of f){const z=await k.key,Ve=await k.value;p.push({key:z,value:Ve,alwaysSet:k.alwaysSet})}return p}).then(p=>A.mergeObjectSync(n,p)):A.mergeObjectSync(n,f)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new O({...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:m.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new O({...this._def,unknownKeys:"strip"})}passthrough(){return new O({...this._def,unknownKeys:"passthrough"})}extend(e){return new O({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new O({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new O({...this._def,catchall:e})}pick(e){const t={};for(const n of b.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new O({...this._def,shape:()=>t})}omit(e){const t={};for(const n of b.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new O({...this._def,shape:()=>t})}deepPartial(){return W(this)}partial(e){const t={};for(const n of b.objectKeys(this.shape)){const s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}return new O({...this._def,shape:()=>t})}required(e){const t={};for(const n of b.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let r=this.shape[n];for(;r instanceof $;)r=r._def.innerType;t[n]=r}return new O({...this._def,shape:()=>t})}keyof(){return At(b.objectKeys(this.shape))}}O.create=(a,e)=>new O({shape:()=>a,unknownKeys:"strip",catchall:B.create(),typeName:g.ZodObject,...x(e)});O.strictCreate=(a,e)=>new O({shape:()=>a,unknownKeys:"strict",catchall:B.create(),typeName:g.ZodObject,...x(e)});O.lazycreate=(a,e)=>new O({shape:a,unknownKeys:"strip",catchall:B.create(),typeName:g.ZodObject,...x(e)});class ke extends S{_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 u(t,{code:d.invalid_union,unionErrors:i}),v}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 f of n){const p={...t,common:{...t.common,issues:[]},parent:null},k=f._parseSync({data:t.data,path:t.path,parent:p});if(k.status==="valid")return k;k.status==="dirty"&&!r&&(r={result:k,ctx:p}),p.common.issues.length&&i.push(p.common.issues)}if(r)return t.common.issues.push(...r.ctx.common.issues),r.result;const o=i.map(f=>new V(f));return u(t,{code:d.invalid_union,unionErrors:o}),v}}get options(){return this._def.options}}ke.create=(a,e)=>new ke({options:a,typeName:g.ZodUnion,...x(e)});function Fe(a,e){const t=P(a),n=P(e);if(a===e)return{valid:!0,data:a};if(t===h.object&&n===h.object){const s=b.objectKeys(e),r=b.objectKeys(a).filter(o=>s.indexOf(o)!==-1),i={...a,...e};for(const o of r){const f=Fe(a[o],e[o]);if(!f.valid)return{valid:!1};i[o]=f.data}return{valid:!0,data:i}}else if(t===h.array&&n===h.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],f=Fe(i,o);if(!f.valid)return{valid:!1};s.push(f.data)}return{valid:!0,data:s}}else return t===h.date&&n===h.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}class be extends S{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),s=(r,i)=>{if(ft(r)||ft(i))return v;const o=Fe(r.value,i.value);return o.valid?((pt(r)||pt(i))&&t.dirty(),{status:t.value,value:o.data}):(u(n,{code:d.invalid_intersection_types}),v)};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}))}}be.create=(a,e,t)=>new be({left:a,right:e,typeName:g.ZodIntersection,...x(t)});class L extends S{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.array)return u(n,{code:d.invalid_type,expected:h.array,received:n.parsedType}),v;if(n.data.length<this._def.items.length)return u(n,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&n.data.length>this._def.items.length&&(u(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 f=this._def.items[o]||this._def.rest;return f?f._parse(new j(n,i,n.path,o)):null}).filter(i=>!!i);return n.common.async?Promise.all(r).then(i=>A.mergeArray(t,i)):A.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:g.ZodTuple,rest:null,...x(e)})};class Ce extends S{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!==h.object)return u(n,{code:d.invalid_type,expected:h.object,received:n.parsedType}),v;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?A.mergeObjectAsync(t,s):A.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof S?new Ce({keyType:e,valueType:t,typeName:g.ZodRecord,...x(n)}):new Ce({keyType:D.create(),valueType:e,typeName:g.ZodRecord,...x(t)})}}class kt extends S{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!==h.map)return u(n,{code:d.invalid_type,expected:h.map,received:n.parsedType}),v;const s=this._def.keyType,r=this._def.valueType,i=[...n.data.entries()].map(([o,f],p)=>({key:s._parse(new j(n,o,n.path,[p,"key"])),value:r._parse(new j(n,f,n.path,[p,"value"]))}));if(n.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const f of i){const p=await f.key,k=await f.value;if(p.status==="aborted"||k.status==="aborted")return v;(p.status==="dirty"||k.status==="dirty")&&t.dirty(),o.set(p.value,k.value)}return{status:t.value,value:o}})}else{const o=new Map;for(const f of i){const p=f.key,k=f.value;if(p.status==="aborted"||k.status==="aborted")return v;(p.status==="dirty"||k.status==="dirty")&&t.dirty(),o.set(p.value,k.value)}return{status:t.value,value:o}}}}kt.create=(a,e,t)=>new kt({valueType:e,keyType:a,typeName:g.ZodMap,...x(t)});class pe extends S{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.set)return u(n,{code:d.invalid_type,expected:h.set,received:n.parsedType}),v;const s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(u(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&&(u(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(f){const p=new Set;for(const k of f){if(k.status==="aborted")return v;k.status==="dirty"&&t.dirty(),p.add(k.value)}return{status:t.value,value:p}}const o=[...n.data.values()].map((f,p)=>r._parse(new j(n,f,n.path,p)));return n.common.async?Promise.all(o).then(f=>i(f)):i(o)}min(e,t){return new pe({...this._def,minSize:{value:e,message:m.toString(t)}})}max(e,t){return new pe({...this._def,maxSize:{value:e,message:m.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}pe.create=(a,e)=>new pe({valueType:a,minSize:null,maxSize:null,typeName:g.ZodSet,...x(e)});class bt extends S{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})}}bt.create=(a,e)=>new bt({getter:a,typeName:g.ZodLazy,...x(e)});class We extends S{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return u(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}}We.create=(a,e)=>new We({value:a,typeName:g.ZodLiteral,...x(e)});function At(a,e){return new H({values:a,typeName:g.ZodEnum,...x(e)})}class H extends S{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return u(t,{expected:b.joinValues(n),received:t.parsedType,code:d.invalid_type}),v}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 u(t,{received:t.data,code:d.invalid_enum_value,options:n}),v}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 H.create(e,{...this._def,...t})}exclude(e,t=this._def){return H.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}H.create=At;class Ct extends S{_parse(e){const t=b.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.string&&n.parsedType!==h.number){const s=b.objectValues(t);return u(n,{expected:b.joinValues(s),received:n.parsedType,code:d.invalid_type}),v}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=b.objectValues(t);return u(n,{received:n.data,code:d.invalid_enum_value,options:s}),v}return Z(e.data)}get enum(){return this._def.values}}Ct.create=(a,e)=>new Ct({values:a,typeName:g.ZodNativeEnum,...x(e)});class we extends S{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return u(t,{code:d.invalid_type,expected:h.promise,received:t.parsedType}),v;const n=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return Z(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}}we.create=(a,e)=>new we({type:a,typeName:g.ZodPromise,...x(e)});class J extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.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=>{u(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 v;const f=await this._def.schema._parseAsync({data:o,path:n.path,parent:n});return f.status==="aborted"?v:f.status==="dirty"||t.value==="dirty"?he(f.value):f});{if(t.value==="aborted")return v;const o=this._def.schema._parseSync({data:i,path:n.path,parent:n});return o.status==="aborted"?v:o.status==="dirty"||t.value==="dirty"?he(o.value):o}}if(s.type==="refinement"){const i=o=>{const f=s.refinement(o,r);if(n.common.async)return Promise.resolve(f);if(f 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"?v:(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"?v:(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 v;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})):v);b.assertNever(s)}}J.create=(a,e,t)=>new J({schema:a,typeName:g.ZodEffects,effect:e,...x(t)});J.createWithPreprocess=(a,e,t)=>new J({schema:e,effect:{type:"preprocess",transform:a},typeName:g.ZodEffects,...x(t)});class $ extends S{_parse(e){return this._getType(e)===h.undefined?Z(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}$.create=(a,e)=>new $({innerType:a,typeName:g.ZodOptional,...x(e)});class Y extends S{_parse(e){return this._getType(e)===h.null?Z(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Y.create=(a,e)=>new Y({innerType:a,typeName:g.ZodNullable,...x(e)});class Ue extends S{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===h.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Ue.create=(a,e)=>new Ue({innerType:a,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...x(e)});class Ge extends S{_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 xe(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}}Ge.create=(a,e)=>new Ge({innerType:a,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...x(e)});class wt extends S{_parse(e){if(this._getType(e)!==h.nan){const n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:h.nan,received:n.parsedType}),v}return{status:"valid",value:e.data}}}wt.create=a=>new wt({typeName:g.ZodNaN,...x(a)});class Oa extends S{_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 Xe extends S{_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"?v:r.status==="dirty"?(t.dirty(),he(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"?v: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 Xe({in:e,out:t,typeName:g.ZodPipeline})}}class He extends S{_parse(e){const t=this._def.innerType._parse(e),n=s=>(U(s)&&(s.value=Object.freeze(s.value)),s);return xe(t)?t.then(s=>n(s)):n(t)}unwrap(){return this._def.innerType}}He.create=(a,e)=>new He({innerType:a,typeName:g.ZodReadonly,...x(e)});var g;(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"})(g||(g={}));const c=D.create,y=G.create,w=ze.create,Aa=Le.create;B.create;const R=q.create,l=O.create,Q=ke.create;be.create;const Qe=L.create,M=Ce.create,C=We.create,E=H.create;we.create;const _=$.create;Y.create;const Rt=()=>w().optional(),X=E(["left","right","up","down"]),Ra=X.options,Ie=l({type:c(),id:c(),name:_(c()),status:_(c())}),Nt=l({height:y(),width:y(),sprite:c().optional(),direction:_(X),filter:_(c())}),Zt=l({room:_(c()),x:y(),y:y()}),ye=l({imageId:c(),col:y().optional(),row:y().optional()}),I=l({text:c().array()}),Et=l({x:y(),y:y()}),Te=l({soundId:c(),volume:y().optional()}),Oe={_started:Rt(),narrative:I.optional(),startDirection:X.optional(),endDirection:X.optional(),endStatus:c().optional()},Na={_started:!0,narrative:!0,startDirection:!0,endDirection:!0,endStatus:!0,type:!0},Za=l({animation:_(c()),x:y(),y:y(),speed:_(y())}),qt=l({type:C("move"),roomId:c().optional(),pathIsSet:_(w()),doPendingInteractionWhenFinished:_(w()),steps:R(Za)}).extend(Oe),jt=l({type:C("goTo"),animation:_(c()),speed:_(y()),targetId:c()}).extend(Oe),Dt=l({type:C("say"),animation:_(c()),text:c(),time:y()}).extend(Oe),Ea=l({animation:_(c()),duration:y(),timeElapsed:_(y()),reverse:_(w())}),Vt=l({type:C("act"),steps:R(Ea)}).extend(Oe),ge=Q([qt,Vt,Dt,jt]),qa=ge.options.map(a=>a.shape.type.value),Ae=l({type:C("order"),actorId:c().optional(),orders:R(ge),replaceCurrentOrders:_(w()),narrative:I.optional()}),K=l({type:C("changeRoom"),roomId:c(),takePlayer:w(),x:_(y()),y:_(y()),narrative:I.optional()}),ee=l({type:C("inventory"),itemId:c(),actorId:c().optional(),addOrRemove:E(["ADD","REMOVE"]),narrative:I.optional()}),te=l({type:C("removeActor"),actorId:c(),narrative:I.optional()}),ae=l({type:C("changeStatus"),targetId:c(),targetType:E(["actor","item","hotspot"]),status:c(),narrative:I.optional()}),Re=l({type:C("sequence"),sequence:c(),narrative:I.optional()}),ne=l({type:C("conversation"),conversationId:c(),end:_(w()),narrative:I.optional()}),se=l({type:C("conversationChoice"),on:w(),conversationId:c(),branchId:c(),choiceRef:c(),narrative:I.optional()}),re=l({type:C("teleportActor"),actorId:c(),roomId:_(c()),x:y(),y:y(),narrative:I.optional()}),F=l({type:C("toggleZone"),roomId:_(c()),on:w(),ref:c(),zoneType:E(["hotspot","obstacle","walkable"]),narrative:I.optional()}),ie=l({type:C("soundEffect"),sound:c(),volume:y().optional(),narrative:I.optional()}),oe=l({type:C("backgroundMusic"),sound:c().optional(),roomId:c().optional(),volume:y().optional(),narrative:I.optional()}),ce=l({type:C("ambientNoise"),sound:c().optional(),roomId:c().optional(),volume:y().optional(),narrative:I.optional()}),de=l({type:C("flag"),on:w(),flag:c(),narrative:I.optional()}),ue=l({type:C("storyBoardConsequence"),storyBoardId:c(),narrative:I.optional()}),le=l({type:C("changePlayerCharacterConsequence"),actorId:c(),narrative:I.optional()}),ja=F.shape.zoneType.options,Pt=Q([Ae,K,ee,te,ae,Re,ne,re,F,ie,oe,ce,de,se,ue,le]),Da=E(["conversation","sequence","changeStatus","backgroundMusic","ambientNoise","removeActor","inventory","changeRoom","order","teleportActor","toggleZone","soundEffect","flag","conversationChoice","storyBoardConsequence","changePlayerCharacterConsequence"]),Va=Da.options,Pa={conversation:ne,sequence:Re,changeStatus:ae,removeActor:te,inventory:ee,changeRoom:K,order:Ae,teleportActor:re,toggleZone:F,soundEffect:ie,flag:de,conversationChoice:se,backgroundMusic:oe,ambientNoise:ce,storyBoardConsequence:ue,changePlayerCharacterConsequence:le},Ke=Q([te,ae,ee,ne,re,F,ie,de,K,se,oe,ce,ue,le]),$a=Ke.options.map(a=>a.shape.type.value),Ne=l({verbId:c(),targetId:c(),roomId:c().optional(),itemId:c().optional(),targetStatus:c().optional(),mustReachFirst:w().optional(),consequences:R(Pt),flagsThatMustBeFalse:R(c()).optional(),flagsThatMustBeTrue:R(c()).optional(),requiredInventory:R(c()).optional()}),et=l({actorOrders:_(M(c(),ge.array())),immediateConsequences:_(Ke.array()),narrative:I.optional(),_started:Rt()}),ve=l({id:c(),description:c().optional(),stages:et.array()}),Tt=l({conversationId:c().optional(),branchId:c().optional(),choiceRef:c().optional()}),tt=l({ref:c().optional(),text:c(),sequence:c().optional(),nextBranch:_(c()),once:_(w()),disabled:_(w()),enablesChoices:R(Tt).optional(),disablesChoices:R(Tt).optional(),end:_(w()),choiceSequence:ve.optional()}),$t=l({choices:R(tt)}),at=l({id:c(),branches:M(c(),_($t)),currentBranch:_(c()),defaultBranch:c()}),nt=l({id:c(),message:c(),imageId:c().optional(),imageWidth:y().optional()}),st=l({type:C("ending"),endingId:c(),narrative:I.optional()}),Ba=Q([Ae,K,ee,te,ae,Re,ne,re,F,ie,oe,ce,de,se,ue,le,st]),Bt=Q([te,ae,ee,ne,re,F,ie,de,K,se,oe,ce,ue,le,st]),rt=Ne.merge(l({consequences:R(Ba)})),Ze=ve.merge(l({stages:et.merge(l({immediateConsequences:_(Bt.array())})).array()})),Ma=tt.merge(l({choiceSequence:Ze.optional()})),za=l({choices:R(Ma)}),it=at.merge(l({branches:M(c(),_(za))})),Je=l({soundId:c(),frameIndex:y().optional(),volume:y().optional()}),La=M(c(),Je.or(Je.array()).or(Aa())),Ee=Ie.merge(Zt).merge(Nt).merge(l({type:C("actor"),isPlayer:_(w()),noInteraction:_(w()),speed:_(y()),baseline:_(y()),dialogueColor:_(c()),soundEffectMap:La.optional(),walkToX:y().optional(),walkToY:y().optional(),defaultFrame:ye.optional(),statusFrames:M(ye).optional()})),Mt=l({value:w(),default:w(),description:c().optional()}),ot=M(c(),Mt.optional()),_e=Ie.extend({type:C("item"),actorId:c().optional()}).and(ye.partial());E(["rect","circle","polygon"]);const Fa=R(Qe([y(),y()])),zt=l({type:c().optional(),x:y(),y:y(),path:_(c()),polygon:_(Fa),circle:_(y()),rect:_(Qe([y(),y()]))}),Ye=zt.merge(l({ref:c().optional(),disabled:w().optional()})),ct=zt.merge(Ie).merge(l({type:C("hotspot"),parallax:y(),walkToX:y().optional(),walkToY:y().optional()})),Wa=l({parallax:y(),imageId:c(),placement:l({x:y(),y:y(),width:y(),height:y()}).optional()}),Ua=R(Qe([y(),y()])),dt=l({id:c(),frameWidth:y(),frameHeight:y().optional(),width:y(),height:y(),background:Wa.array(),hotspots:ct.array().optional(),obstacleAreas:_(Ye.array()),walkableAreas:_(Ye.array()),scaling:_(Ua),backgroundColor:c().optional(),name:c().optional(),narrative:I.optional(),backgroundMusic:Te.optional(),ambientNoise:Te.optional()}),me=l({imageId:c(),row:y(),col:y()}),Ga=l({left:me.array().optional(),right:me.array().optional(),up:me.array().optional(),down:me.array().optional()}),ut=l({id:c(),defaultDirection:X,animations:M(c(),Ga)}),Lt=E(["center","left","right"]),Ft=E(["center","top","bottom"]),Ha=l({x:Lt,y:Ft,width:y().optional(),height:y().optional(),aspectRatio:Et.optional()}),Ja=Ha.merge(l({image:ye})),Wt=l({title:c(),narrative:I,pictures:Ja.array(),backgroundColor:c(),color:c()}),Ut=E(["sound","buttons"]),Gt=E(["serif","sans-serif","monospace","cursive","fantasy","math"]),lt=l({id:c(),isEndOfGame:w().optional(),pages:Wt.array(),font:Gt.optional(),sound:Te.optional(),progression:Ut.optional()}),qe=l({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()}),Ya=l({schemaVersion:y().optional(),rooms:dt.array(),items:_e.array(),actors:Ee.array(),interactions:rt.array(),conversations:it.array(),flagMap:ot,currentRoomId:c(),id:c(),description:c().optional().describe("a short description of your game"),thumbnailAssetId:c().optional()}),Xa=l({verbs:qe.array(),sequences:Ze.array(),sprites:ut.array(),endings:nt.array(),openingSequenceId:c().optional(),openingStoryboardId:c().optional(),storyBoards:lt.array().optional()}),Ht=Ya.and(Xa).describe("The game schema"),je=4,Jt=l({sequenceRunning:ve.optional(),currentStoryBoardId:c().optional(),actorOrders:M(c(),ge.array()),currentConversationId:c().optional(),pendingInteraction:Ne.optional(),gameNotBegun:w()}),De=l({schemaVersion:C(je),rooms:dt.array(),items:_e.array(),actors:Ee.array(),interactions:Ne.array(),conversations:at.array(),flagMap:ot,currentRoomId:c(),id:c(),description:c().optional().describe("a short description of your game"),thumbnailAssetId:c().optional()}),ht=l({verbs:qe.array(),sequences:ve.array(),sprites:ut.array(),openingSequenceId:c().optional(),openingStoryboardId:c().optional(),storyBoards:lt.array()}),Qa=De.and(Jt),Yt=De.and(ht).describe("The game schema"),Ka=E(["rooms","items","actors","conversations","sprites","sequences","verbs","storyBoards"]),en=De.merge(l({schemaVersion:C(3),interactions:rt.array(),conversations:it.array()})),tn=ht.merge(l({endings:nt.array(),sequences:Ze.array()})),Xt=en.and(tn).describe("The game schema"),Qt=Q([Ee,_e,ct]),an=l({verb:qe,target:Qt,item:_(_e)}),nn=a=>({...a,storyBoards:a.storyBoards??[],schemaVersion:3}),sn=a=>Kt(nn(a)),rn=(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]:[]}]}},on=(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()},Kt=a=>{const{storyBoards:e,interactions:t,sequences:n,conversations:s}=a,r=e.map(T=>T.id),i={},o=a.endings.map(T=>{const N=r.includes(T.id)?on(T.id,r):void 0;return N&&r.push(N),i[T.id]=N??T.id,rn(T,N)}),f=T=>T.type!=="ending"?T:{type:"storyBoardConsequence",storyBoardId:i[T.endingId]??T.endingId,narrative:T.narrative},p=T=>({...T,stages:T.stages.map(N=>({...N,immediateConsequences:N.immediateConsequences?.map(f)}))}),k=T=>{const{branches:N}=T;for(let ta in N){const Pe=N[ta];Pe&&(Pe.choices=Pe.choices.map($e=>({...$e,choiceSequence:$e.choiceSequence?p($e.choiceSequence):void 0})))}return{...T,branches:N}},z=t.map(T=>({...T,consequences:T.consequences.map(f)})),Ve=n.map(p),ea=s.map(k);return{...a,storyBoards:[...e,...o],interactions:z,sequences:Ve,conversations:ea,schemaVersion:je}},cn=a=>{const e=Yt.safeParse(a);if(e.success)return{success:!0,gameDesign:e.data,sourceVersion:je,updated:!1};const t=Xt.safeParse(a);if(t.success)return{success:!0,gameDesign:Kt(t.data),sourceVersion:3,updated:!0};const n=Ht.safeParse(a);return n.success?{success:!0,gameDesign:sn(n.data),sourceVersion:2,updated:!0}:{success:!1,failureMessage:n.error.message}};exports.ActOrderSchema=Vt;exports.ActorDataSchema=Ee;exports.AmbientNoiseConsequenceSchema=ce;exports.AspectRatioSchema=Et;exports.BackgroundMusicConsequenceSchema=oe;exports.BoardFontSchema=Gt;exports.BoardProgressionSchema=Ut;exports.ChangePlayerCharacterConsequenceSchema=le;exports.ChangeRoomConsequenceSchema=K;exports.ChangeStatusConsequenceSchema=ae;exports.CommandSchema=an;exports.CommandTargetSchema=Qt;exports.ConsequenceSchema=Pt;exports.ConversationBranchSchema=$t;exports.ConversationChoiceConsequenceSchema=se;exports.ConversationChoiceSchema=tt;exports.ConversationConsequenceSchema=ne;exports.ConversationSchema=at;exports.ConversationSchemaWithDeprecatedConsequences=it;exports.DB_VERSION=je;exports.DirectionEnum=X;exports.EndingConsequenceSchema=st;exports.EndingSchema=nt;exports.FixedGameInfoSchema=ht;exports.FlagConsequenceSchema=de;exports.FlagMapSchema=ot;exports.FlagSchema=Mt;exports.GameContentsDataSchema=De;exports.GameDataItemTypeEnum=Ka;exports.GameDataSchema=Qa;exports.GameDesignSchema=Yt;exports.GameHappeningsSchema=Jt;exports.GotoOrderSchema=jt;exports.HotspotZoneSchema=ct;exports.IdentSchema=Ie;exports.ImmediateConsequenceSchema=Ke;exports.ImmediateConsequenceSchemaWithDeprecated=Bt;exports.InteractionSchema=Ne;exports.InteractionSchemaWithDeprecatedConsequences=rt;exports.InventoryConsequenceSchema=ee;exports.ItemDataSchema=_e;exports.MoveOrderSchema=qt;exports.NarrativeSchema=I;exports.OrderConsequenceSchema=Ae;exports.PositionSchema=Zt;exports.RemoveActorConsequenceSchema=te;exports.RoomDataSchema=dt;exports.SayOrderSchema=Dt;exports.SequenceConsequenceSchema=Re;exports.SequenceSchema=ve;exports.SequenceSchemaWithDeprecatedConsequences=Ze;exports.SoundEffectConsequenceSchema=ie;exports.SoundValueSchema=Je;exports.SpriteDataSchema=ut;exports.SpriteFrameSchema=me;exports.SpriteParamsSchema=Nt;exports.StageSchema=et;exports.StaticFrameParamsSchema=ye;exports.StoryBoardConsequenceSchema=ue;exports.StoryBoardPageSchema=Wt;exports.StoryBoardSchema=lt;exports.TeleportActorConsequenceSchema=re;exports.ToggleZoneConsequenceSchema=F;exports.VerbSchema=qe;exports.ZoneSchema=Ye;exports.changeHistory=aa;exports.consequenceMap=Pa;exports.consequenceTypes=Va;exports.directions=Ra;exports.immediateConsequenceTypes=$a;exports.orderBaseOmits=Na;exports.orderSchema=ge;exports.orderTypes=qa;exports.parseAndUpgrade=cn;exports.soundInstanceSchema=Te;exports.v2GameDesignSchema=Ht;exports.v3GameDesignSchema=Xt;exports.xPlacement=Lt;exports.yPlacement=Ft;exports.zoneTypes=ja;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ev=[{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 se;(function(a){a.assertEqual=c=>{};function r(c){}a.assertIs=r;function i(c){throw new Error}a.assertNever=i,a.arrayToEnum=c=>{const f={};for(const p of c)f[p]=p;return f},a.getValidEnumValues=c=>{const f=a.objectKeys(c).filter(_=>typeof c[c[_]]!="number"),p={};for(const _ of f)p[_]=c[_];return a.objectValues(p)},a.objectValues=c=>a.objectKeys(c).map(function(f){return c[f]}),a.objectKeys=typeof Object.keys=="function"?c=>Object.keys(c):c=>{const f=[];for(const p in c)Object.prototype.hasOwnProperty.call(c,p)&&f.push(p);return f},a.find=(c,f)=>{for(const p of c)if(f(p))return p},a.isInteger=typeof Number.isInteger=="function"?c=>Number.isInteger(c):c=>typeof c=="number"&&Number.isFinite(c)&&Math.floor(c)===c;function o(c,f=" | "){return c.map(p=>typeof p=="string"?`'${p}'`:p).join(f)}a.joinValues=o,a.jsonStringifyReplacer=(c,f)=>typeof f=="bigint"?f.toString():f})(se||(se={}));var Na;(function(a){a.mergeShapes=(r,i)=>({...r,...i})})(Na||(Na={}));const P=se.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pt=a=>{switch(typeof a){case"undefined":return P.undefined;case"string":return P.string;case"number":return Number.isNaN(a)?P.nan:P.number;case"boolean":return P.boolean;case"function":return P.function;case"bigint":return P.bigint;case"symbol":return P.symbol;case"object":return Array.isArray(a)?P.array:a===null?P.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?P.promise:typeof Map<"u"&&a instanceof Map?P.map:typeof Set<"u"&&a instanceof Set?P.set:typeof Date<"u"&&a instanceof Date?P.date:P.object;default:return P.unknown}},O=se.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"]),Lv=a=>JSON.stringify(a,null,2).replace(/"([^"]+)":/g,"$1:");class Je extends Error{get errors(){return this.issues}constructor(r){super(),this.issues=[],this.addIssue=o=>{this.issues=[...this.issues,o]},this.addIssues=(o=[])=>{this.issues=[...this.issues,...o]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=r}format(r){const i=r||function(f){return f.message},o={_errors:[]},c=f=>{for(const p of f.issues)if(p.code==="invalid_union")p.unionErrors.map(c);else if(p.code==="invalid_return_type")c(p.returnTypeError);else if(p.code==="invalid_arguments")c(p.argumentsError);else if(p.path.length===0)o._errors.push(i(p));else{let _=o,w=0;for(;w<p.path.length;){const y=p.path[w];w===p.path.length-1?(_[y]=_[y]||{_errors:[]},_[y]._errors.push(i(p))):_[y]=_[y]||{_errors:[]},_=_[y],w++}}};return c(this),o}static assert(r){if(!(r instanceof Je))throw new Error(`Not a ZodError: ${r}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,se.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(r=i=>i.message){const i={},o=[];for(const c of this.issues)if(c.path.length>0){const f=c.path[0];i[f]=i[f]||[],i[f].push(r(c))}else o.push(r(c));return{formErrors:o,fieldErrors:i}}get formErrors(){return this.flatten()}}Je.create=a=>new Je(a);const Dn=(a,r)=>{let i;switch(a.code){case O.invalid_type:a.received===P.undefined?i="Required":i=`Expected ${a.expected}, received ${a.received}`;break;case O.invalid_literal:i=`Invalid literal value, expected ${JSON.stringify(a.expected,se.jsonStringifyReplacer)}`;break;case O.unrecognized_keys:i=`Unrecognized key(s) in object: ${se.joinValues(a.keys,", ")}`;break;case O.invalid_union:i="Invalid input";break;case O.invalid_union_discriminator:i=`Invalid discriminator value. Expected ${se.joinValues(a.options)}`;break;case O.invalid_enum_value:i=`Invalid enum value. Expected ${se.joinValues(a.options)}, received '${a.received}'`;break;case O.invalid_arguments:i="Invalid function arguments";break;case O.invalid_return_type:i="Invalid function return type";break;case O.invalid_date:i="Invalid date";break;case O.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(i=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(i=`${i} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?i=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?i=`Invalid input: must end with "${a.validation.endsWith}"`:se.assertNever(a.validation):a.validation!=="regex"?i=`Invalid ${a.validation}`:i="Invalid";break;case O.too_small:a.type==="array"?i=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?i=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?i=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="bigint"?i=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?i=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:i="Invalid input";break;case O.too_big:a.type==="array"?i=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?i=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?i=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?i=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?i=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:i="Invalid input";break;case O.custom:i="Invalid input";break;case O.invalid_intersection_types:i="Intersection results could not be merged";break;case O.not_multiple_of:i=`Number must be a multiple of ${a.multipleOf}`;break;case O.not_finite:i="Number must be finite";break;default:i=r.defaultError,se.assertNever(a)}return{message:i}};let nl=Dn;function Nv(a){nl=a}function Ui(){return nl}const Gi=a=>{const{data:r,path:i,errorMaps:o,issueData:c}=a,f=[...i,...c.path||[]],p={...c,path:f};if(c.message!==void 0)return{...c,path:f,message:c.message};let _="";const w=o.filter(y=>!!y).slice().reverse();for(const y of w)_=y(p,{data:r,defaultError:_}).message;return{...c,path:f,message:_}},Mv=[];function L(a,r){const i=Ui(),o=Gi({issueData:r,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,i,i===Dn?void 0:Dn].filter(c=>!!c)});a.common.issues.push(o)}class Me{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(r,i){const o=[];for(const c of i){if(c.status==="aborted")return G;c.status==="dirty"&&r.dirty(),o.push(c.value)}return{status:r.value,value:o}}static async mergeObjectAsync(r,i){const o=[];for(const c of i){const f=await c.key,p=await c.value;o.push({key:f,value:p})}return Me.mergeObjectSync(r,o)}static mergeObjectSync(r,i){const o={};for(const c of i){const{key:f,value:p}=c;if(f.status==="aborted"||p.status==="aborted")return G;f.status==="dirty"&&r.dirty(),p.status==="dirty"&&r.dirty(),f.value!=="__proto__"&&(typeof p.value<"u"||c.alwaysSet)&&(o[f.value]=p.value)}return{status:r.value,value:o}}}const G=Object.freeze({status:"aborted"}),Mn=a=>({status:"dirty",value:a}),We=a=>({status:"valid",value:a}),Ma=a=>a.status==="aborted",Pa=a=>a.status==="dirty",dn=a=>a.status==="valid",kr=a=>typeof Promise<"u"&&a instanceof Promise;var F;(function(a){a.errToObj=r=>typeof r=="string"?{message:r}:r||{},a.toString=r=>typeof r=="string"?r:r?.message})(F||(F={}));class St{constructor(r,i,o,c){this._cachedPath=[],this.parent=r,this.data=i,this._path=o,this._key=c}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 Pc=(a,r)=>{if(dn(r))return{success:!0,data:r.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 i=new Je(a.common.issues);return this._error=i,this._error}}};function Y(a){if(!a)return{};const{errorMap:r,invalid_type_error:i,required_error:o,description:c}=a;if(r&&(i||o))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return r?{errorMap:r,description:c}:{errorMap:(p,_)=>{const{message:w}=a;return p.code==="invalid_enum_value"?{message:w??_.defaultError}:typeof _.data>"u"?{message:w??o??_.defaultError}:p.code!=="invalid_type"?{message:_.defaultError}:{message:w??i??_.defaultError}},description:c}}class Q{get description(){return this._def.description}_getType(r){return Pt(r.data)}_getOrReturnCtx(r,i){return i||{common:r.parent.common,data:r.data,parsedType:Pt(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}_processInputParams(r){return{status:new Me,ctx:{common:r.parent.common,data:r.data,parsedType:Pt(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}}_parseSync(r){const i=this._parse(r);if(kr(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(r){const i=this._parse(r);return Promise.resolve(i)}parse(r,i){const o=this.safeParse(r,i);if(o.success)return o.data;throw o.error}safeParse(r,i){const o={common:{issues:[],async:i?.async??!1,contextualErrorMap:i?.errorMap},path:i?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:Pt(r)},c=this._parseSync({data:r,path:o.path,parent:o});return Pc(o,c)}"~validate"(r){const i={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:Pt(r)};if(!this["~standard"].async)try{const o=this._parseSync({data:r,path:[],parent:i});return dn(o)?{value:o.value}:{issues:i.common.issues}}catch(o){o?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),i.common={issues:[],async:!0}}return this._parseAsync({data:r,path:[],parent:i}).then(o=>dn(o)?{value:o.value}:{issues:i.common.issues})}async parseAsync(r,i){const o=await this.safeParseAsync(r,i);if(o.success)return o.data;throw o.error}async safeParseAsync(r,i){const o={common:{issues:[],contextualErrorMap:i?.errorMap,async:!0},path:i?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:Pt(r)},c=this._parse({data:r,path:o.path,parent:o}),f=await(kr(c)?c:Promise.resolve(c));return Pc(o,f)}refine(r,i){const o=c=>typeof i=="string"||typeof i>"u"?{message:i}:typeof i=="function"?i(c):i;return this._refinement((c,f)=>{const p=r(c),_=()=>f.addIssue({code:O.custom,...o(c)});return typeof Promise<"u"&&p instanceof Promise?p.then(w=>w?!0:(_(),!1)):p?!0:(_(),!1)})}refinement(r,i){return this._refinement((o,c)=>r(o)?!0:(c.addIssue(typeof i=="function"?i(o,c):i),!1))}_refinement(r){return new mt({schema:this,typeName:V.ZodEffects,effect:{type:"refinement",refinement:r}})}superRefine(r){return this._refinement(r)}constructor(r){this.spa=this.safeParseAsync,this._def=r,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:i=>this["~validate"](i)}}optional(){return wt.create(this,this._def)}nullable(){return jt.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return gt.create(this)}promise(){return Fn.create(this,this._def)}or(r){return Mr.create([this,r],this._def)}and(r){return Pr.create(this,r,this._def)}transform(r){return new mt({...Y(this._def),schema:this,typeName:V.ZodEffects,effect:{type:"transform",transform:r}})}default(r){const i=typeof r=="function"?r:()=>r;return new qr({...Y(this._def),innerType:this,defaultValue:i,typeName:V.ZodDefault})}brand(){return new Wa({typeName:V.ZodBranded,type:this,...Y(this._def)})}catch(r){const i=typeof r=="function"?r:()=>r;return new Zr({...Y(this._def),innerType:this,catchValue:i,typeName:V.ZodCatch})}describe(r){const i=this.constructor;return new i({...this._def,description:r})}pipe(r){return Vr.create(this,r)}readonly(){return Ur.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Pv=/^c[^\s-]{8,}$/i,Dv=/^[0-9a-z]+$/,Bv=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Fv=/^[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,Wv=/^[a-z0-9_-]{21}$/i,qv=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Zv=/^[-+]?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)?)??$/,Uv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Gv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Oa;const Vv=/^(?:(?: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])$/,Hv=/^(?:(?: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])$/,zv=/^(([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]))$/,$v=/^(([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])$/,Yv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Kv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,rl="((\\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])))",Xv=new RegExp(`^${rl}$`);function il(a){let r="[0-5]\\d";a.precision?r=`${r}\\.\\d{${a.precision}}`:a.precision==null&&(r=`${r}(\\.\\d+)?`);const i=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${r})${i}`}function Jv(a){return new RegExp(`^${il(a)}$`)}function sl(a){let r=`${rl}T${il(a)}`;const i=[];return i.push(a.local?"Z?":"Z"),a.offset&&i.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${i.join("|")})`,new RegExp(`^${r}$`)}function jv(a,r){return!!((r==="v4"||!r)&&Vv.test(a)||(r==="v6"||!r)&&zv.test(a))}function Qv(a,r){if(!qv.test(a))return!1;try{const[i]=a.split(".");if(!i)return!1;const o=i.replace(/-/g,"+").replace(/_/g,"/").padEnd(i.length+(4-i.length%4)%4,"="),c=JSON.parse(atob(o));return!(typeof c!="object"||c===null||"typ"in c&&c?.typ!=="JWT"||!c.alg||r&&c.alg!==r)}catch{return!1}}function ey(a,r){return!!((r==="v4"||!r)&&Hv.test(a)||(r==="v6"||!r)&&$v.test(a))}class pt extends Q{_parse(r){if(this._def.coerce&&(r.data=String(r.data)),this._getType(r)!==P.string){const f=this._getOrReturnCtx(r);return L(f,{code:O.invalid_type,expected:P.string,received:f.parsedType}),G}const o=new Me;let c;for(const f of this._def.checks)if(f.kind==="min")r.data.length<f.value&&(c=this._getOrReturnCtx(r,c),L(c,{code:O.too_small,minimum:f.value,type:"string",inclusive:!0,exact:!1,message:f.message}),o.dirty());else if(f.kind==="max")r.data.length>f.value&&(c=this._getOrReturnCtx(r,c),L(c,{code:O.too_big,maximum:f.value,type:"string",inclusive:!0,exact:!1,message:f.message}),o.dirty());else if(f.kind==="length"){const p=r.data.length>f.value,_=r.data.length<f.value;(p||_)&&(c=this._getOrReturnCtx(r,c),p?L(c,{code:O.too_big,maximum:f.value,type:"string",inclusive:!0,exact:!0,message:f.message}):_&&L(c,{code:O.too_small,minimum:f.value,type:"string",inclusive:!0,exact:!0,message:f.message}),o.dirty())}else if(f.kind==="email")Uv.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"email",code:O.invalid_string,message:f.message}),o.dirty());else if(f.kind==="emoji")Oa||(Oa=new RegExp(Gv,"u")),Oa.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"emoji",code:O.invalid_string,message:f.message}),o.dirty());else if(f.kind==="uuid")Fv.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"uuid",code:O.invalid_string,message:f.message}),o.dirty());else if(f.kind==="nanoid")Wv.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"nanoid",code:O.invalid_string,message:f.message}),o.dirty());else if(f.kind==="cuid")Pv.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"cuid",code:O.invalid_string,message:f.message}),o.dirty());else if(f.kind==="cuid2")Dv.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"cuid2",code:O.invalid_string,message:f.message}),o.dirty());else if(f.kind==="ulid")Bv.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"ulid",code:O.invalid_string,message:f.message}),o.dirty());else if(f.kind==="url")try{new URL(r.data)}catch{c=this._getOrReturnCtx(r,c),L(c,{validation:"url",code:O.invalid_string,message:f.message}),o.dirty()}else f.kind==="regex"?(f.regex.lastIndex=0,f.regex.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"regex",code:O.invalid_string,message:f.message}),o.dirty())):f.kind==="trim"?r.data=r.data.trim():f.kind==="includes"?r.data.includes(f.value,f.position)||(c=this._getOrReturnCtx(r,c),L(c,{code:O.invalid_string,validation:{includes:f.value,position:f.position},message:f.message}),o.dirty()):f.kind==="toLowerCase"?r.data=r.data.toLowerCase():f.kind==="toUpperCase"?r.data=r.data.toUpperCase():f.kind==="startsWith"?r.data.startsWith(f.value)||(c=this._getOrReturnCtx(r,c),L(c,{code:O.invalid_string,validation:{startsWith:f.value},message:f.message}),o.dirty()):f.kind==="endsWith"?r.data.endsWith(f.value)||(c=this._getOrReturnCtx(r,c),L(c,{code:O.invalid_string,validation:{endsWith:f.value},message:f.message}),o.dirty()):f.kind==="datetime"?sl(f).test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{code:O.invalid_string,validation:"datetime",message:f.message}),o.dirty()):f.kind==="date"?Xv.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{code:O.invalid_string,validation:"date",message:f.message}),o.dirty()):f.kind==="time"?Jv(f).test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{code:O.invalid_string,validation:"time",message:f.message}),o.dirty()):f.kind==="duration"?Zv.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"duration",code:O.invalid_string,message:f.message}),o.dirty()):f.kind==="ip"?jv(r.data,f.version)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"ip",code:O.invalid_string,message:f.message}),o.dirty()):f.kind==="jwt"?Qv(r.data,f.alg)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"jwt",code:O.invalid_string,message:f.message}),o.dirty()):f.kind==="cidr"?ey(r.data,f.version)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"cidr",code:O.invalid_string,message:f.message}),o.dirty()):f.kind==="base64"?Yv.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"base64",code:O.invalid_string,message:f.message}),o.dirty()):f.kind==="base64url"?Kv.test(r.data)||(c=this._getOrReturnCtx(r,c),L(c,{validation:"base64url",code:O.invalid_string,message:f.message}),o.dirty()):se.assertNever(f);return{status:o.value,value:r.data}}_regex(r,i,o){return this.refinement(c=>r.test(c),{validation:i,code:O.invalid_string,...F.errToObj(o)})}_addCheck(r){return new pt({...this._def,checks:[...this._def.checks,r]})}email(r){return this._addCheck({kind:"email",...F.errToObj(r)})}url(r){return this._addCheck({kind:"url",...F.errToObj(r)})}emoji(r){return this._addCheck({kind:"emoji",...F.errToObj(r)})}uuid(r){return this._addCheck({kind:"uuid",...F.errToObj(r)})}nanoid(r){return this._addCheck({kind:"nanoid",...F.errToObj(r)})}cuid(r){return this._addCheck({kind:"cuid",...F.errToObj(r)})}cuid2(r){return this._addCheck({kind:"cuid2",...F.errToObj(r)})}ulid(r){return this._addCheck({kind:"ulid",...F.errToObj(r)})}base64(r){return this._addCheck({kind:"base64",...F.errToObj(r)})}base64url(r){return this._addCheck({kind:"base64url",...F.errToObj(r)})}jwt(r){return this._addCheck({kind:"jwt",...F.errToObj(r)})}ip(r){return this._addCheck({kind:"ip",...F.errToObj(r)})}cidr(r){return this._addCheck({kind:"cidr",...F.errToObj(r)})}datetime(r){return typeof r=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:r}):this._addCheck({kind:"datetime",precision:typeof r?.precision>"u"?null:r?.precision,offset:r?.offset??!1,local:r?.local??!1,...F.errToObj(r?.message)})}date(r){return this._addCheck({kind:"date",message:r})}time(r){return typeof r=="string"?this._addCheck({kind:"time",precision:null,message:r}):this._addCheck({kind:"time",precision:typeof r?.precision>"u"?null:r?.precision,...F.errToObj(r?.message)})}duration(r){return this._addCheck({kind:"duration",...F.errToObj(r)})}regex(r,i){return this._addCheck({kind:"regex",regex:r,...F.errToObj(i)})}includes(r,i){return this._addCheck({kind:"includes",value:r,position:i?.position,...F.errToObj(i?.message)})}startsWith(r,i){return this._addCheck({kind:"startsWith",value:r,...F.errToObj(i)})}endsWith(r,i){return this._addCheck({kind:"endsWith",value:r,...F.errToObj(i)})}min(r,i){return this._addCheck({kind:"min",value:r,...F.errToObj(i)})}max(r,i){return this._addCheck({kind:"max",value:r,...F.errToObj(i)})}length(r,i){return this._addCheck({kind:"length",value:r,...F.errToObj(i)})}nonempty(r){return this.min(1,F.errToObj(r))}trim(){return new pt({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new pt({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new pt({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(r=>r.kind==="datetime")}get isDate(){return!!this._def.checks.find(r=>r.kind==="date")}get isTime(){return!!this._def.checks.find(r=>r.kind==="time")}get isDuration(){return!!this._def.checks.find(r=>r.kind==="duration")}get isEmail(){return!!this._def.checks.find(r=>r.kind==="email")}get isURL(){return!!this._def.checks.find(r=>r.kind==="url")}get isEmoji(){return!!this._def.checks.find(r=>r.kind==="emoji")}get isUUID(){return!!this._def.checks.find(r=>r.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(r=>r.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(r=>r.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(r=>r.kind==="cuid2")}get isULID(){return!!this._def.checks.find(r=>r.kind==="ulid")}get isIP(){return!!this._def.checks.find(r=>r.kind==="ip")}get isCIDR(){return!!this._def.checks.find(r=>r.kind==="cidr")}get isBase64(){return!!this._def.checks.find(r=>r.kind==="base64")}get isBase64url(){return!!this._def.checks.find(r=>r.kind==="base64url")}get minLength(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r}get maxLength(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r}}pt.create=a=>new pt({checks:[],typeName:V.ZodString,coerce:a?.coerce??!1,...Y(a)});function ty(a,r){const i=(a.toString().split(".")[1]||"").length,o=(r.toString().split(".")[1]||"").length,c=i>o?i:o,f=Number.parseInt(a.toFixed(c).replace(".","")),p=Number.parseInt(r.toFixed(c).replace(".",""));return f%p/10**c}class Kt extends Q{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(r){if(this._def.coerce&&(r.data=Number(r.data)),this._getType(r)!==P.number){const f=this._getOrReturnCtx(r);return L(f,{code:O.invalid_type,expected:P.number,received:f.parsedType}),G}let o;const c=new Me;for(const f of this._def.checks)f.kind==="int"?se.isInteger(r.data)||(o=this._getOrReturnCtx(r,o),L(o,{code:O.invalid_type,expected:"integer",received:"float",message:f.message}),c.dirty()):f.kind==="min"?(f.inclusive?r.data<f.value:r.data<=f.value)&&(o=this._getOrReturnCtx(r,o),L(o,{code:O.too_small,minimum:f.value,type:"number",inclusive:f.inclusive,exact:!1,message:f.message}),c.dirty()):f.kind==="max"?(f.inclusive?r.data>f.value:r.data>=f.value)&&(o=this._getOrReturnCtx(r,o),L(o,{code:O.too_big,maximum:f.value,type:"number",inclusive:f.inclusive,exact:!1,message:f.message}),c.dirty()):f.kind==="multipleOf"?ty(r.data,f.value)!==0&&(o=this._getOrReturnCtx(r,o),L(o,{code:O.not_multiple_of,multipleOf:f.value,message:f.message}),c.dirty()):f.kind==="finite"?Number.isFinite(r.data)||(o=this._getOrReturnCtx(r,o),L(o,{code:O.not_finite,message:f.message}),c.dirty()):se.assertNever(f);return{status:c.value,value:r.data}}gte(r,i){return this.setLimit("min",r,!0,F.toString(i))}gt(r,i){return this.setLimit("min",r,!1,F.toString(i))}lte(r,i){return this.setLimit("max",r,!0,F.toString(i))}lt(r,i){return this.setLimit("max",r,!1,F.toString(i))}setLimit(r,i,o,c){return new Kt({...this._def,checks:[...this._def.checks,{kind:r,value:i,inclusive:o,message:F.toString(c)}]})}_addCheck(r){return new Kt({...this._def,checks:[...this._def.checks,r]})}int(r){return this._addCheck({kind:"int",message:F.toString(r)})}positive(r){return this._addCheck({kind:"min",value:0,inclusive:!1,message:F.toString(r)})}negative(r){return this._addCheck({kind:"max",value:0,inclusive:!1,message:F.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:0,inclusive:!0,message:F.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:0,inclusive:!0,message:F.toString(r)})}multipleOf(r,i){return this._addCheck({kind:"multipleOf",value:r,message:F.toString(i)})}finite(r){return this._addCheck({kind:"finite",message:F.toString(r)})}safe(r){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:F.toString(r)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:F.toString(r)})}get minValue(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r}get maxValue(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r}get isInt(){return!!this._def.checks.find(r=>r.kind==="int"||r.kind==="multipleOf"&&se.isInteger(r.value))}get isFinite(){let r=null,i=null;for(const o of this._def.checks){if(o.kind==="finite"||o.kind==="int"||o.kind==="multipleOf")return!0;o.kind==="min"?(i===null||o.value>i)&&(i=o.value):o.kind==="max"&&(r===null||o.value<r)&&(r=o.value)}return Number.isFinite(i)&&Number.isFinite(r)}}Kt.create=a=>new Kt({checks:[],typeName:V.ZodNumber,coerce:a?.coerce||!1,...Y(a)});class Xt extends Q{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(r){if(this._def.coerce)try{r.data=BigInt(r.data)}catch{return this._getInvalidInput(r)}if(this._getType(r)!==P.bigint)return this._getInvalidInput(r);let o;const c=new Me;for(const f of this._def.checks)f.kind==="min"?(f.inclusive?r.data<f.value:r.data<=f.value)&&(o=this._getOrReturnCtx(r,o),L(o,{code:O.too_small,type:"bigint",minimum:f.value,inclusive:f.inclusive,message:f.message}),c.dirty()):f.kind==="max"?(f.inclusive?r.data>f.value:r.data>=f.value)&&(o=this._getOrReturnCtx(r,o),L(o,{code:O.too_big,type:"bigint",maximum:f.value,inclusive:f.inclusive,message:f.message}),c.dirty()):f.kind==="multipleOf"?r.data%f.value!==BigInt(0)&&(o=this._getOrReturnCtx(r,o),L(o,{code:O.not_multiple_of,multipleOf:f.value,message:f.message}),c.dirty()):se.assertNever(f);return{status:c.value,value:r.data}}_getInvalidInput(r){const i=this._getOrReturnCtx(r);return L(i,{code:O.invalid_type,expected:P.bigint,received:i.parsedType}),G}gte(r,i){return this.setLimit("min",r,!0,F.toString(i))}gt(r,i){return this.setLimit("min",r,!1,F.toString(i))}lte(r,i){return this.setLimit("max",r,!0,F.toString(i))}lt(r,i){return this.setLimit("max",r,!1,F.toString(i))}setLimit(r,i,o,c){return new Xt({...this._def,checks:[...this._def.checks,{kind:r,value:i,inclusive:o,message:F.toString(c)}]})}_addCheck(r){return new Xt({...this._def,checks:[...this._def.checks,r]})}positive(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:F.toString(r)})}negative(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:F.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:F.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:F.toString(r)})}multipleOf(r,i){return this._addCheck({kind:"multipleOf",value:r,message:F.toString(i)})}get minValue(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r}get maxValue(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r}}Xt.create=a=>new Xt({checks:[],typeName:V.ZodBigInt,coerce:a?.coerce??!1,...Y(a)});class Er extends Q{_parse(r){if(this._def.coerce&&(r.data=!!r.data),this._getType(r)!==P.boolean){const o=this._getOrReturnCtx(r);return L(o,{code:O.invalid_type,expected:P.boolean,received:o.parsedType}),G}return We(r.data)}}Er.create=a=>new Er({typeName:V.ZodBoolean,coerce:a?.coerce||!1,...Y(a)});class hn extends Q{_parse(r){if(this._def.coerce&&(r.data=new Date(r.data)),this._getType(r)!==P.date){const f=this._getOrReturnCtx(r);return L(f,{code:O.invalid_type,expected:P.date,received:f.parsedType}),G}if(Number.isNaN(r.data.getTime())){const f=this._getOrReturnCtx(r);return L(f,{code:O.invalid_date}),G}const o=new Me;let c;for(const f of this._def.checks)f.kind==="min"?r.data.getTime()<f.value&&(c=this._getOrReturnCtx(r,c),L(c,{code:O.too_small,message:f.message,inclusive:!0,exact:!1,minimum:f.value,type:"date"}),o.dirty()):f.kind==="max"?r.data.getTime()>f.value&&(c=this._getOrReturnCtx(r,c),L(c,{code:O.too_big,message:f.message,inclusive:!0,exact:!1,maximum:f.value,type:"date"}),o.dirty()):se.assertNever(f);return{status:o.value,value:new Date(r.data.getTime())}}_addCheck(r){return new hn({...this._def,checks:[...this._def.checks,r]})}min(r,i){return this._addCheck({kind:"min",value:r.getTime(),message:F.toString(i)})}max(r,i){return this._addCheck({kind:"max",value:r.getTime(),message:F.toString(i)})}get minDate(){let r=null;for(const i of this._def.checks)i.kind==="min"&&(r===null||i.value>r)&&(r=i.value);return r!=null?new Date(r):null}get maxDate(){let r=null;for(const i of this._def.checks)i.kind==="max"&&(r===null||i.value<r)&&(r=i.value);return r!=null?new Date(r):null}}hn.create=a=>new hn({checks:[],coerce:a?.coerce||!1,typeName:V.ZodDate,...Y(a)});class Vi extends Q{_parse(r){if(this._getType(r)!==P.symbol){const o=this._getOrReturnCtx(r);return L(o,{code:O.invalid_type,expected:P.symbol,received:o.parsedType}),G}return We(r.data)}}Vi.create=a=>new Vi({typeName:V.ZodSymbol,...Y(a)});class Lr extends Q{_parse(r){if(this._getType(r)!==P.undefined){const o=this._getOrReturnCtx(r);return L(o,{code:O.invalid_type,expected:P.undefined,received:o.parsedType}),G}return We(r.data)}}Lr.create=a=>new Lr({typeName:V.ZodUndefined,...Y(a)});class Nr extends Q{_parse(r){if(this._getType(r)!==P.null){const o=this._getOrReturnCtx(r);return L(o,{code:O.invalid_type,expected:P.null,received:o.parsedType}),G}return We(r.data)}}Nr.create=a=>new Nr({typeName:V.ZodNull,...Y(a)});class Bn extends Q{constructor(){super(...arguments),this._any=!0}_parse(r){return We(r.data)}}Bn.create=a=>new Bn({typeName:V.ZodAny,...Y(a)});class fn extends Q{constructor(){super(...arguments),this._unknown=!0}_parse(r){return We(r.data)}}fn.create=a=>new fn({typeName:V.ZodUnknown,...Y(a)});class Dt extends Q{_parse(r){const i=this._getOrReturnCtx(r);return L(i,{code:O.invalid_type,expected:P.never,received:i.parsedType}),G}}Dt.create=a=>new Dt({typeName:V.ZodNever,...Y(a)});class Hi extends Q{_parse(r){if(this._getType(r)!==P.undefined){const o=this._getOrReturnCtx(r);return L(o,{code:O.invalid_type,expected:P.void,received:o.parsedType}),G}return We(r.data)}}Hi.create=a=>new Hi({typeName:V.ZodVoid,...Y(a)});class gt extends Q{_parse(r){const{ctx:i,status:o}=this._processInputParams(r),c=this._def;if(i.parsedType!==P.array)return L(i,{code:O.invalid_type,expected:P.array,received:i.parsedType}),G;if(c.exactLength!==null){const p=i.data.length>c.exactLength.value,_=i.data.length<c.exactLength.value;(p||_)&&(L(i,{code:p?O.too_big:O.too_small,minimum:_?c.exactLength.value:void 0,maximum:p?c.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:c.exactLength.message}),o.dirty())}if(c.minLength!==null&&i.data.length<c.minLength.value&&(L(i,{code:O.too_small,minimum:c.minLength.value,type:"array",inclusive:!0,exact:!1,message:c.minLength.message}),o.dirty()),c.maxLength!==null&&i.data.length>c.maxLength.value&&(L(i,{code:O.too_big,maximum:c.maxLength.value,type:"array",inclusive:!0,exact:!1,message:c.maxLength.message}),o.dirty()),i.common.async)return Promise.all([...i.data].map((p,_)=>c.type._parseAsync(new St(i,p,i.path,_)))).then(p=>Me.mergeArray(o,p));const f=[...i.data].map((p,_)=>c.type._parseSync(new St(i,p,i.path,_)));return Me.mergeArray(o,f)}get element(){return this._def.type}min(r,i){return new gt({...this._def,minLength:{value:r,message:F.toString(i)}})}max(r,i){return new gt({...this._def,maxLength:{value:r,message:F.toString(i)}})}length(r,i){return new gt({...this._def,exactLength:{value:r,message:F.toString(i)}})}nonempty(r){return this.min(1,r)}}gt.create=(a,r)=>new gt({type:a,minLength:null,maxLength:null,exactLength:null,typeName:V.ZodArray,...Y(r)});function Nn(a){if(a instanceof _e){const r={};for(const i in a.shape){const o=a.shape[i];r[i]=wt.create(Nn(o))}return new _e({...a._def,shape:()=>r})}else return a instanceof gt?new gt({...a._def,type:Nn(a.element)}):a instanceof wt?wt.create(Nn(a.unwrap())):a instanceof jt?jt.create(Nn(a.unwrap())):a instanceof bt?bt.create(a.items.map(r=>Nn(r))):a}class _e extends Q{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const r=this._def.shape(),i=se.objectKeys(r);return this._cached={shape:r,keys:i},this._cached}_parse(r){if(this._getType(r)!==P.object){const y=this._getOrReturnCtx(r);return L(y,{code:O.invalid_type,expected:P.object,received:y.parsedType}),G}const{status:o,ctx:c}=this._processInputParams(r),{shape:f,keys:p}=this._getCached(),_=[];if(!(this._def.catchall instanceof Dt&&this._def.unknownKeys==="strip"))for(const y in c.data)p.includes(y)||_.push(y);const w=[];for(const y of p){const A=f[y],M=c.data[y];w.push({key:{status:"valid",value:y},value:A._parse(new St(c,M,c.path,y)),alwaysSet:y in c.data})}if(this._def.catchall instanceof Dt){const y=this._def.unknownKeys;if(y==="passthrough")for(const A of _)w.push({key:{status:"valid",value:A},value:{status:"valid",value:c.data[A]}});else if(y==="strict")_.length>0&&(L(c,{code:O.unrecognized_keys,keys:_}),o.dirty());else if(y!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const y=this._def.catchall;for(const A of _){const M=c.data[A];w.push({key:{status:"valid",value:A},value:y._parse(new St(c,M,c.path,A)),alwaysSet:A in c.data})}}return c.common.async?Promise.resolve().then(async()=>{const y=[];for(const A of w){const M=await A.key,ne=await A.value;y.push({key:M,value:ne,alwaysSet:A.alwaysSet})}return y}).then(y=>Me.mergeObjectSync(o,y)):Me.mergeObjectSync(o,w)}get shape(){return this._def.shape()}strict(r){return F.errToObj,new _e({...this._def,unknownKeys:"strict",...r!==void 0?{errorMap:(i,o)=>{const c=this._def.errorMap?.(i,o).message??o.defaultError;return i.code==="unrecognized_keys"?{message:F.errToObj(r).message??c}:{message:c}}}:{}})}strip(){return new _e({...this._def,unknownKeys:"strip"})}passthrough(){return new _e({...this._def,unknownKeys:"passthrough"})}extend(r){return new _e({...this._def,shape:()=>({...this._def.shape(),...r})})}merge(r){return new _e({unknownKeys:r._def.unknownKeys,catchall:r._def.catchall,shape:()=>({...this._def.shape(),...r._def.shape()}),typeName:V.ZodObject})}setKey(r,i){return this.augment({[r]:i})}catchall(r){return new _e({...this._def,catchall:r})}pick(r){const i={};for(const o of se.objectKeys(r))r[o]&&this.shape[o]&&(i[o]=this.shape[o]);return new _e({...this._def,shape:()=>i})}omit(r){const i={};for(const o of se.objectKeys(this.shape))r[o]||(i[o]=this.shape[o]);return new _e({...this._def,shape:()=>i})}deepPartial(){return Nn(this)}partial(r){const i={};for(const o of se.objectKeys(this.shape)){const c=this.shape[o];r&&!r[o]?i[o]=c:i[o]=c.optional()}return new _e({...this._def,shape:()=>i})}required(r){const i={};for(const o of se.objectKeys(this.shape))if(r&&!r[o])i[o]=this.shape[o];else{let f=this.shape[o];for(;f instanceof wt;)f=f._def.innerType;i[o]=f}return new _e({...this._def,shape:()=>i})}keyof(){return al(se.objectKeys(this.shape))}}_e.create=(a,r)=>new _e({shape:()=>a,unknownKeys:"strip",catchall:Dt.create(),typeName:V.ZodObject,...Y(r)});_e.strictCreate=(a,r)=>new _e({shape:()=>a,unknownKeys:"strict",catchall:Dt.create(),typeName:V.ZodObject,...Y(r)});_e.lazycreate=(a,r)=>new _e({shape:a,unknownKeys:"strip",catchall:Dt.create(),typeName:V.ZodObject,...Y(r)});class Mr extends Q{_parse(r){const{ctx:i}=this._processInputParams(r),o=this._def.options;function c(f){for(const _ of f)if(_.result.status==="valid")return _.result;for(const _ of f)if(_.result.status==="dirty")return i.common.issues.push(..._.ctx.common.issues),_.result;const p=f.map(_=>new Je(_.ctx.common.issues));return L(i,{code:O.invalid_union,unionErrors:p}),G}if(i.common.async)return Promise.all(o.map(async f=>{const p={...i,common:{...i.common,issues:[]},parent:null};return{result:await f._parseAsync({data:i.data,path:i.path,parent:p}),ctx:p}})).then(c);{let f;const p=[];for(const w of o){const y={...i,common:{...i.common,issues:[]},parent:null},A=w._parseSync({data:i.data,path:i.path,parent:y});if(A.status==="valid")return A;A.status==="dirty"&&!f&&(f={result:A,ctx:y}),y.common.issues.length&&p.push(y.common.issues)}if(f)return i.common.issues.push(...f.ctx.common.issues),f.result;const _=p.map(w=>new Je(w));return L(i,{code:O.invalid_union,unionErrors:_}),G}}get options(){return this._def.options}}Mr.create=(a,r)=>new Mr({options:a,typeName:V.ZodUnion,...Y(r)});const Mt=a=>a instanceof Br?Mt(a.schema):a instanceof mt?Mt(a.innerType()):a instanceof Fr?[a.value]:a instanceof Jt?a.options:a instanceof Wr?se.objectValues(a.enum):a instanceof qr?Mt(a._def.innerType):a instanceof Lr?[void 0]:a instanceof Nr?[null]:a instanceof wt?[void 0,...Mt(a.unwrap())]:a instanceof jt?[null,...Mt(a.unwrap())]:a instanceof Wa||a instanceof Ur?Mt(a.unwrap()):a instanceof Zr?Mt(a._def.innerType):[];class Ki extends Q{_parse(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==P.object)return L(i,{code:O.invalid_type,expected:P.object,received:i.parsedType}),G;const o=this.discriminator,c=i.data[o],f=this.optionsMap.get(c);return f?i.common.async?f._parseAsync({data:i.data,path:i.path,parent:i}):f._parseSync({data:i.data,path:i.path,parent:i}):(L(i,{code:O.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),G)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(r,i,o){const c=new Map;for(const f of i){const p=Mt(f.shape[r]);if(!p.length)throw new Error(`A discriminator value for key \`${r}\` could not be extracted from all schema options`);for(const _ of p){if(c.has(_))throw new Error(`Discriminator property ${String(r)} has duplicate value ${String(_)}`);c.set(_,f)}}return new Ki({typeName:V.ZodDiscriminatedUnion,discriminator:r,options:i,optionsMap:c,...Y(o)})}}function Da(a,r){const i=Pt(a),o=Pt(r);if(a===r)return{valid:!0,data:a};if(i===P.object&&o===P.object){const c=se.objectKeys(r),f=se.objectKeys(a).filter(_=>c.indexOf(_)!==-1),p={...a,...r};for(const _ of f){const w=Da(a[_],r[_]);if(!w.valid)return{valid:!1};p[_]=w.data}return{valid:!0,data:p}}else if(i===P.array&&o===P.array){if(a.length!==r.length)return{valid:!1};const c=[];for(let f=0;f<a.length;f++){const p=a[f],_=r[f],w=Da(p,_);if(!w.valid)return{valid:!1};c.push(w.data)}return{valid:!0,data:c}}else return i===P.date&&o===P.date&&+a==+r?{valid:!0,data:a}:{valid:!1}}class Pr extends Q{_parse(r){const{status:i,ctx:o}=this._processInputParams(r),c=(f,p)=>{if(Ma(f)||Ma(p))return G;const _=Da(f.value,p.value);return _.valid?((Pa(f)||Pa(p))&&i.dirty(),{status:i.value,value:_.data}):(L(o,{code:O.invalid_intersection_types}),G)};return o.common.async?Promise.all([this._def.left._parseAsync({data:o.data,path:o.path,parent:o}),this._def.right._parseAsync({data:o.data,path:o.path,parent:o})]).then(([f,p])=>c(f,p)):c(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}}Pr.create=(a,r,i)=>new Pr({left:a,right:r,typeName:V.ZodIntersection,...Y(i)});class bt extends Q{_parse(r){const{status:i,ctx:o}=this._processInputParams(r);if(o.parsedType!==P.array)return L(o,{code:O.invalid_type,expected:P.array,received:o.parsedType}),G;if(o.data.length<this._def.items.length)return L(o,{code:O.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G;!this._def.rest&&o.data.length>this._def.items.length&&(L(o,{code:O.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const f=[...o.data].map((p,_)=>{const w=this._def.items[_]||this._def.rest;return w?w._parse(new St(o,p,o.path,_)):null}).filter(p=>!!p);return o.common.async?Promise.all(f).then(p=>Me.mergeArray(i,p)):Me.mergeArray(i,f)}get items(){return this._def.items}rest(r){return new bt({...this._def,rest:r})}}bt.create=(a,r)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new bt({items:a,typeName:V.ZodTuple,rest:null,...Y(r)})};class Dr extends Q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:i,ctx:o}=this._processInputParams(r);if(o.parsedType!==P.object)return L(o,{code:O.invalid_type,expected:P.object,received:o.parsedType}),G;const c=[],f=this._def.keyType,p=this._def.valueType;for(const _ in o.data)c.push({key:f._parse(new St(o,_,o.path,_)),value:p._parse(new St(o,o.data[_],o.path,_)),alwaysSet:_ in o.data});return o.common.async?Me.mergeObjectAsync(i,c):Me.mergeObjectSync(i,c)}get element(){return this._def.valueType}static create(r,i,o){return i instanceof Q?new Dr({keyType:r,valueType:i,typeName:V.ZodRecord,...Y(o)}):new Dr({keyType:pt.create(),valueType:r,typeName:V.ZodRecord,...Y(i)})}}class zi extends Q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:i,ctx:o}=this._processInputParams(r);if(o.parsedType!==P.map)return L(o,{code:O.invalid_type,expected:P.map,received:o.parsedType}),G;const c=this._def.keyType,f=this._def.valueType,p=[...o.data.entries()].map(([_,w],y)=>({key:c._parse(new St(o,_,o.path,[y,"key"])),value:f._parse(new St(o,w,o.path,[y,"value"]))}));if(o.common.async){const _=new Map;return Promise.resolve().then(async()=>{for(const w of p){const y=await w.key,A=await w.value;if(y.status==="aborted"||A.status==="aborted")return G;(y.status==="dirty"||A.status==="dirty")&&i.dirty(),_.set(y.value,A.value)}return{status:i.value,value:_}})}else{const _=new Map;for(const w of p){const y=w.key,A=w.value;if(y.status==="aborted"||A.status==="aborted")return G;(y.status==="dirty"||A.status==="dirty")&&i.dirty(),_.set(y.value,A.value)}return{status:i.value,value:_}}}}zi.create=(a,r,i)=>new zi({valueType:r,keyType:a,typeName:V.ZodMap,...Y(i)});class pn extends Q{_parse(r){const{status:i,ctx:o}=this._processInputParams(r);if(o.parsedType!==P.set)return L(o,{code:O.invalid_type,expected:P.set,received:o.parsedType}),G;const c=this._def;c.minSize!==null&&o.data.size<c.minSize.value&&(L(o,{code:O.too_small,minimum:c.minSize.value,type:"set",inclusive:!0,exact:!1,message:c.minSize.message}),i.dirty()),c.maxSize!==null&&o.data.size>c.maxSize.value&&(L(o,{code:O.too_big,maximum:c.maxSize.value,type:"set",inclusive:!0,exact:!1,message:c.maxSize.message}),i.dirty());const f=this._def.valueType;function p(w){const y=new Set;for(const A of w){if(A.status==="aborted")return G;A.status==="dirty"&&i.dirty(),y.add(A.value)}return{status:i.value,value:y}}const _=[...o.data.values()].map((w,y)=>f._parse(new St(o,w,o.path,y)));return o.common.async?Promise.all(_).then(w=>p(w)):p(_)}min(r,i){return new pn({...this._def,minSize:{value:r,message:F.toString(i)}})}max(r,i){return new pn({...this._def,maxSize:{value:r,message:F.toString(i)}})}size(r,i){return this.min(r,i).max(r,i)}nonempty(r){return this.min(1,r)}}pn.create=(a,r)=>new pn({valueType:a,minSize:null,maxSize:null,typeName:V.ZodSet,...Y(r)});class Pn extends Q{constructor(){super(...arguments),this.validate=this.implement}_parse(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==P.function)return L(i,{code:O.invalid_type,expected:P.function,received:i.parsedType}),G;function o(_,w){return Gi({data:_,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,Ui(),Dn].filter(y=>!!y),issueData:{code:O.invalid_arguments,argumentsError:w}})}function c(_,w){return Gi({data:_,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,Ui(),Dn].filter(y=>!!y),issueData:{code:O.invalid_return_type,returnTypeError:w}})}const f={errorMap:i.common.contextualErrorMap},p=i.data;if(this._def.returns instanceof Fn){const _=this;return We(async function(...w){const y=new Je([]),A=await _._def.args.parseAsync(w,f).catch(K=>{throw y.addIssue(o(w,K)),y}),M=await Reflect.apply(p,this,A);return await _._def.returns._def.type.parseAsync(M,f).catch(K=>{throw y.addIssue(c(M,K)),y})})}else{const _=this;return We(function(...w){const y=_._def.args.safeParse(w,f);if(!y.success)throw new Je([o(w,y.error)]);const A=Reflect.apply(p,this,y.data),M=_._def.returns.safeParse(A,f);if(!M.success)throw new Je([c(A,M.error)]);return M.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...r){return new Pn({...this._def,args:bt.create(r).rest(fn.create())})}returns(r){return new Pn({...this._def,returns:r})}implement(r){return this.parse(r)}strictImplement(r){return this.parse(r)}static create(r,i,o){return new Pn({args:r||bt.create([]).rest(fn.create()),returns:i||fn.create(),typeName:V.ZodFunction,...Y(o)})}}class Br extends Q{get schema(){return this._def.getter()}_parse(r){const{ctx:i}=this._processInputParams(r);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}Br.create=(a,r)=>new Br({getter:a,typeName:V.ZodLazy,...Y(r)});class Fr extends Q{_parse(r){if(r.data!==this._def.value){const i=this._getOrReturnCtx(r);return L(i,{received:i.data,code:O.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:r.data}}get value(){return this._def.value}}Fr.create=(a,r)=>new Fr({value:a,typeName:V.ZodLiteral,...Y(r)});function al(a,r){return new Jt({values:a,typeName:V.ZodEnum,...Y(r)})}class Jt extends Q{_parse(r){if(typeof r.data!="string"){const i=this._getOrReturnCtx(r),o=this._def.values;return L(i,{expected:se.joinValues(o),received:i.parsedType,code:O.invalid_type}),G}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(r.data)){const i=this._getOrReturnCtx(r),o=this._def.values;return L(i,{received:i.data,code:O.invalid_enum_value,options:o}),G}return We(r.data)}get options(){return this._def.values}get enum(){const r={};for(const i of this._def.values)r[i]=i;return r}get Values(){const r={};for(const i of this._def.values)r[i]=i;return r}get Enum(){const r={};for(const i of this._def.values)r[i]=i;return r}extract(r,i=this._def){return Jt.create(r,{...this._def,...i})}exclude(r,i=this._def){return Jt.create(this.options.filter(o=>!r.includes(o)),{...this._def,...i})}}Jt.create=al;class Wr extends Q{_parse(r){const i=se.getValidEnumValues(this._def.values),o=this._getOrReturnCtx(r);if(o.parsedType!==P.string&&o.parsedType!==P.number){const c=se.objectValues(i);return L(o,{expected:se.joinValues(c),received:o.parsedType,code:O.invalid_type}),G}if(this._cache||(this._cache=new Set(se.getValidEnumValues(this._def.values))),!this._cache.has(r.data)){const c=se.objectValues(i);return L(o,{received:o.data,code:O.invalid_enum_value,options:c}),G}return We(r.data)}get enum(){return this._def.values}}Wr.create=(a,r)=>new Wr({values:a,typeName:V.ZodNativeEnum,...Y(r)});class Fn extends Q{unwrap(){return this._def.type}_parse(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==P.promise&&i.common.async===!1)return L(i,{code:O.invalid_type,expected:P.promise,received:i.parsedType}),G;const o=i.parsedType===P.promise?i.data:Promise.resolve(i.data);return We(o.then(c=>this._def.type.parseAsync(c,{path:i.path,errorMap:i.common.contextualErrorMap})))}}Fn.create=(a,r)=>new Fn({type:a,typeName:V.ZodPromise,...Y(r)});class mt extends Q{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===V.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){const{status:i,ctx:o}=this._processInputParams(r),c=this._def.effect||null,f={addIssue:p=>{L(o,p),p.fatal?i.abort():i.dirty()},get path(){return o.path}};if(f.addIssue=f.addIssue.bind(f),c.type==="preprocess"){const p=c.transform(o.data,f);if(o.common.async)return Promise.resolve(p).then(async _=>{if(i.value==="aborted")return G;const w=await this._def.schema._parseAsync({data:_,path:o.path,parent:o});return w.status==="aborted"?G:w.status==="dirty"||i.value==="dirty"?Mn(w.value):w});{if(i.value==="aborted")return G;const _=this._def.schema._parseSync({data:p,path:o.path,parent:o});return _.status==="aborted"?G:_.status==="dirty"||i.value==="dirty"?Mn(_.value):_}}if(c.type==="refinement"){const p=_=>{const w=c.refinement(_,f);if(o.common.async)return Promise.resolve(w);if(w instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return _};if(o.common.async===!1){const _=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return _.status==="aborted"?G:(_.status==="dirty"&&i.dirty(),p(_.value),{status:i.value,value:_.value})}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(_=>_.status==="aborted"?G:(_.status==="dirty"&&i.dirty(),p(_.value).then(()=>({status:i.value,value:_.value}))))}if(c.type==="transform")if(o.common.async===!1){const p=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!dn(p))return G;const _=c.transform(p.value,f);if(_ instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:_}}else return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then(p=>dn(p)?Promise.resolve(c.transform(p.value,f)).then(_=>({status:i.value,value:_})):G);se.assertNever(c)}}mt.create=(a,r,i)=>new mt({schema:a,typeName:V.ZodEffects,effect:r,...Y(i)});mt.createWithPreprocess=(a,r,i)=>new mt({schema:r,effect:{type:"preprocess",transform:a},typeName:V.ZodEffects,...Y(i)});class wt extends Q{_parse(r){return this._getType(r)===P.undefined?We(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}wt.create=(a,r)=>new wt({innerType:a,typeName:V.ZodOptional,...Y(r)});class jt extends Q{_parse(r){return this._getType(r)===P.null?We(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}jt.create=(a,r)=>new jt({innerType:a,typeName:V.ZodNullable,...Y(r)});class qr extends Q{_parse(r){const{ctx:i}=this._processInputParams(r);let o=i.data;return i.parsedType===P.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}qr.create=(a,r)=>new qr({innerType:a,typeName:V.ZodDefault,defaultValue:typeof r.default=="function"?r.default:()=>r.default,...Y(r)});class Zr extends Q{_parse(r){const{ctx:i}=this._processInputParams(r),o={...i,common:{...i.common,issues:[]}},c=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return kr(c)?c.then(f=>({status:"valid",value:f.status==="valid"?f.value:this._def.catchValue({get error(){return new Je(o.common.issues)},input:o.data})})):{status:"valid",value:c.status==="valid"?c.value:this._def.catchValue({get error(){return new Je(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}Zr.create=(a,r)=>new Zr({innerType:a,typeName:V.ZodCatch,catchValue:typeof r.catch=="function"?r.catch:()=>r.catch,...Y(r)});class $i extends Q{_parse(r){if(this._getType(r)!==P.nan){const o=this._getOrReturnCtx(r);return L(o,{code:O.invalid_type,expected:P.nan,received:o.parsedType}),G}return{status:"valid",value:r.data}}}$i.create=a=>new $i({typeName:V.ZodNaN,...Y(a)});const ny=Symbol("zod_brand");class Wa extends Q{_parse(r){const{ctx:i}=this._processInputParams(r),o=i.data;return this._def.type._parse({data:o,path:i.path,parent:i})}unwrap(){return this._def.type}}class Vr extends Q{_parse(r){const{status:i,ctx:o}=this._processInputParams(r);if(o.common.async)return(async()=>{const f=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return f.status==="aborted"?G:f.status==="dirty"?(i.dirty(),Mn(f.value)):this._def.out._parseAsync({data:f.value,path:o.path,parent:o})})();{const c=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return c.status==="aborted"?G:c.status==="dirty"?(i.dirty(),{status:"dirty",value:c.value}):this._def.out._parseSync({data:c.value,path:o.path,parent:o})}}static create(r,i){return new Vr({in:r,out:i,typeName:V.ZodPipeline})}}class Ur extends Q{_parse(r){const i=this._def.innerType._parse(r),o=c=>(dn(c)&&(c.value=Object.freeze(c.value)),c);return kr(i)?i.then(c=>o(c)):o(i)}unwrap(){return this._def.innerType}}Ur.create=(a,r)=>new Ur({innerType:a,typeName:V.ZodReadonly,...Y(r)});function Dc(a,r){const i=typeof a=="function"?a(r):typeof a=="string"?{message:a}:a;return typeof i=="string"?{message:i}:i}function ol(a,r={},i){return a?Bn.create().superRefine((o,c)=>{const f=a(o);if(f instanceof Promise)return f.then(p=>{if(!p){const _=Dc(r,o),w=_.fatal??i??!0;c.addIssue({code:"custom",..._,fatal:w})}});if(!f){const p=Dc(r,o),_=p.fatal??i??!0;c.addIssue({code:"custom",...p,fatal:_})}}):Bn.create()}const ry={object:_e.lazycreate};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 iy=(a,r={message:`Input not instance of ${a.name}`})=>ol(i=>i instanceof a,r),I=pt.create,W=Kt.create,sy=$i.create,ay=Xt.create,de=Er.create,oy=hn.create,uy=Vi.create,ul=Lr.create,cy=Nr.create,ly=Bn.create,fy=fn.create,dy=Dt.create,hy=Hi.create,Fe=gt.create,N=_e.create,py=_e.strictCreate,gn=Mr.create,gy=Ki.create,my=Pr.create,Xi=bt.create,Bt=Dr.create,_y=zi.create,vy=pn.create,yy=Pn.create,xy=Br.create,le=Fr.create,at=Jt.create,wy=Wr.create,Sy=Fn.create,Bc=mt.create,H=wt.create,by=jt.create,Cy=mt.createWithPreprocess,Iy=Vr.create,Ay=()=>I().optional(),Ty=()=>W().optional(),qa=()=>de().optional(),Oy={string:(a=>pt.create({...a,coerce:!0})),number:(a=>Kt.create({...a,coerce:!0})),boolean:(a=>Er.create({...a,coerce:!0})),bigint:(a=>Xt.create({...a,coerce:!0})),date:(a=>hn.create({...a,coerce:!0}))},Ry=G,Ra=Object.freeze(Object.defineProperty({__proto__:null,BRAND:ny,DIRTY:Mn,EMPTY_PATH:Mv,INVALID:G,NEVER:Ry,OK:We,ParseStatus:Me,Schema:Q,ZodAny:Bn,ZodArray:gt,ZodBigInt:Xt,ZodBoolean:Er,ZodBranded:Wa,ZodCatch:Zr,ZodDate:hn,ZodDefault:qr,ZodDiscriminatedUnion:Ki,ZodEffects:mt,ZodEnum:Jt,ZodError:Je,get ZodFirstPartyTypeKind(){return V},ZodFunction:Pn,ZodIntersection:Pr,ZodIssueCode:O,ZodLazy:Br,ZodLiteral:Fr,ZodMap:zi,ZodNaN:$i,ZodNativeEnum:Wr,ZodNever:Dt,ZodNull:Nr,ZodNullable:jt,ZodNumber:Kt,ZodObject:_e,ZodOptional:wt,ZodParsedType:P,ZodPipeline:Vr,ZodPromise:Fn,ZodReadonly:Ur,ZodRecord:Dr,ZodSchema:Q,ZodSet:pn,ZodString:pt,ZodSymbol:Vi,ZodTransformer:mt,ZodTuple:bt,ZodType:Q,ZodUndefined:Lr,ZodUnion:Mr,ZodUnknown:fn,ZodVoid:Hi,addIssueToContext:L,any:ly,array:Fe,bigint:ay,boolean:de,coerce:Oy,custom:ol,date:oy,datetimeRegex:sl,defaultErrorMap:Dn,discriminatedUnion:gy,effect:Bc,enum:at,function:yy,getErrorMap:Ui,getParsedType:Pt,instanceof:iy,intersection:my,isAborted:Ma,isAsync:kr,isDirty:Pa,isValid:dn,late:ry,lazy:xy,literal:le,makeIssue:Gi,map:_y,nan:sy,nativeEnum:wy,never:dy,null:cy,nullable:by,number:W,object:N,get objectUtil(){return Na},oboolean:qa,onumber:Ty,optional:H,ostring:Ay,pipeline:Iy,preprocess:Cy,promise:Sy,quotelessJson:Lv,record:Bt,set:vy,setErrorMap:Nv,strictObject:py,string:I,symbol:uy,transformer:Bc,tuple:Xi,undefined:ul,union:gn,unknown:fy,get util(){return se},void:hy},Symbol.toStringTag,{value:"Module"})),Wn=at(["left","right","up","down"]),ky=Wn.options,Ji=N({type:I(),id:I(),name:H(I()),status:H(I())}),cl=N({height:W(),width:W(),sprite:I().optional(),direction:H(Wn),filter:H(I())}),ll=N({room:H(I()),x:W(),y:W()}),Gr=N({imageId:I(),col:W().optional(),row:W().optional()}),xe=N({text:I().array()}),fl=N({x:W(),y:W()}),Yi=N({soundId:I(),volume:W().optional()}),ji={_started:qa(),narrative:xe.optional(),startDirection:Wn.optional(),endDirection:Wn.optional(),endStatus:I().optional()},Ey={_started:!0,narrative:!0,startDirection:!0,endDirection:!0,endStatus:!0,type:!0},Ly=N({animation:H(I()),x:W(),y:W(),speed:H(W())}),dl=N({type:le("move"),roomId:I().optional(),pathIsSet:H(de()),doPendingInteractionWhenFinished:H(de()),steps:Fe(Ly)}).extend(ji),hl=N({type:le("goTo"),animation:H(I()),speed:H(W()),targetId:I()}).extend(ji),pl=N({type:le("say"),animation:H(I()),text:I(),time:W()}).extend(ji),Ny=N({animation:H(I()),duration:W(),timeElapsed:H(W()),reverse:H(de())}),gl=N({type:le("act"),steps:Fe(Ny)}).extend(ji),Hr=gn([dl,gl,pl,hl]),My=Hr.options.map(a=>a.shape.type.value),Qi=N({type:le("order"),actorId:I().optional(),orders:Fe(Hr),replaceCurrentOrders:H(de()),narrative:xe.optional()}),qn=N({type:le("changeRoom"),roomId:I(),takePlayer:de(),x:H(W()),y:H(W()),narrative:xe.optional()}),Zn=N({type:le("inventory"),itemId:I(),actorId:I().optional(),addOrRemove:at(["ADD","REMOVE"]),narrative:xe.optional()}),Un=N({type:le("removeActor"),actorId:I(),narrative:xe.optional()}),Gn=N({type:le("changeStatus"),targetId:I(),targetType:at(["actor","item","hotspot"]),status:I(),narrative:xe.optional()}),es=N({type:le("sequence"),sequence:I(),narrative:xe.optional()}),Vn=N({type:le("conversation"),conversationId:I(),end:H(de()),narrative:xe.optional()}),Hn=N({type:le("conversationChoice"),on:de(),conversationId:I(),branchId:I(),choiceRef:I(),narrative:xe.optional()}),zn=N({type:le("teleportActor"),actorId:I(),roomId:H(I()),x:W(),y:W(),narrative:xe.optional()}),mn=N({type:le("toggleZone"),roomId:H(I()),on:de(),ref:I(),zoneType:at(["hotspot","obstacle","walkable"]),narrative:xe.optional()}),$n=N({type:le("soundEffect"),sound:I(),volume:W().optional(),narrative:xe.optional()}),Yn=N({type:le("backgroundMusic"),sound:I().optional(),roomId:I().optional(),volume:W().optional(),narrative:xe.optional()}),Kn=N({type:le("ambientNoise"),sound:I().optional(),roomId:I().optional(),volume:W().optional(),narrative:xe.optional()}),Xn=N({type:le("flag"),on:de(),flag:I(),narrative:xe.optional()}),Jn=N({type:le("storyBoardConsequence"),storyBoardId:I(),narrative:xe.optional()}),jn=N({type:le("changePlayerCharacter"),actorId:I(),narrative:xe.optional()}),Py=mn.shape.zoneType.options,ml=gn([Qi,qn,Zn,Un,Gn,es,Vn,zn,mn,$n,Yn,Kn,Xn,Hn,Jn,jn]),Dy=at(["conversation","sequence","changeStatus","backgroundMusic","ambientNoise","removeActor","inventory","changeRoom","order","teleportActor","toggleZone","soundEffect","flag","conversationChoice","storyBoardConsequence","changePlayerCharacter"]),By=Dy.options,Fy={conversation:Vn,sequence:es,changeStatus:Gn,removeActor:Un,inventory:Zn,changeRoom:qn,order:Qi,teleportActor:zn,toggleZone:mn,soundEffect:$n,flag:Xn,conversationChoice:Hn,backgroundMusic:Yn,ambientNoise:Kn,storyBoardConsequence:Jn,changePlayerCharacter:jn},Za=gn([Un,Gn,Zn,Vn,zn,mn,$n,Xn,qn,Hn,Yn,Kn,Jn,jn]),Wy=Za.options.map(a=>a.shape.type.value),ts=N({verbId:I(),targetId:I(),roomId:I().optional(),itemId:I().optional(),targetStatus:I().optional(),mustReachFirst:de().optional(),consequences:Fe(ml),flagsThatMustBeFalse:Fe(I()).optional(),flagsThatMustBeTrue:Fe(I()).optional(),requiredInventory:Fe(I()).optional()}),Ua=N({actorOrders:H(Bt(I(),Hr.array())),immediateConsequences:H(Za.array()),narrative:xe.optional(),_started:qa()}),zr=N({id:I(),description:I().optional(),stages:Ua.array()}),Fc=N({conversationId:I().optional(),branchId:I().optional(),choiceRef:I().optional()}),Ga=N({ref:I().optional(),text:I(),sequence:I().optional(),nextBranch:H(I()),once:H(de()),disabled:H(de()),enablesChoices:Fe(Fc).optional(),disablesChoices:Fe(Fc).optional(),end:H(de()),choiceSequence:zr.optional()}),_l=N({choices:Fe(Ga)}),Va=N({id:I(),branches:Bt(I(),H(_l)),currentBranch:H(I()),defaultBranch:I()}),Ha=N({id:I(),message:I(),imageId:I().optional(),imageWidth:W().optional()}),za=N({type:le("ending"),endingId:I(),narrative:xe.optional()}),qy=gn([Qi,qn,Zn,Un,Gn,es,Vn,zn,mn,$n,Yn,Kn,Xn,Hn,Jn,jn,za]),vl=gn([Un,Gn,Zn,Vn,zn,mn,$n,Xn,qn,Hn,Yn,Kn,Jn,jn,za]),$a=ts.merge(N({consequences:Fe(qy)})),ns=zr.merge(N({stages:Ua.merge(N({immediateConsequences:H(vl.array())})).array()})),Zy=Ga.merge(N({choiceSequence:ns.optional()})),Uy=N({choices:Fe(Zy)}),Ya=Va.merge(N({branches:Bt(I(),H(Uy))})),Ba=N({soundId:I(),frameIndex:W().optional(),volume:W().optional()}),Gy=Bt(I(),Ba.or(Ba.array()).or(ul())),rs=Ji.merge(ll).merge(cl).merge(N({type:le("actor"),isPlayer:H(de()),noInteraction:H(de()),speed:H(W()),baseline:H(W()),dialogueColor:H(I()),soundEffectMap:Gy.optional(),walkToX:W().optional(),walkToY:W().optional(),defaultFrame:Gr.optional(),statusFrames:Bt(Gr).optional()})),yl=N({value:de(),default:de(),description:I().optional()}),Ka=Bt(I(),yl.optional()),$r=Ji.extend({type:le("item"),actorId:I().optional()}).and(Gr.partial());at(["rect","circle","polygon"]);const Vy=Fe(Xi([W(),W()])),xl=N({type:I().optional(),x:W(),y:W(),path:H(I()),polygon:H(Vy),circle:H(W()),rect:H(Xi([W(),W()]))}),Fa=xl.merge(N({ref:I().optional(),disabled:de().optional()})),Xa=xl.merge(Ji).merge(N({type:le("hotspot"),parallax:W(),walkToX:W().optional(),walkToY:W().optional()})),Hy=N({parallax:W(),imageId:I(),placement:N({x:W(),y:W(),width:W(),height:W()}).optional()}),zy=Fe(Xi([W(),W()])),Ja=N({id:I(),frameWidth:W(),frameHeight:W().optional(),width:W(),height:W(),background:Hy.array(),hotspots:Xa.array().optional(),obstacleAreas:H(Fa.array()),walkableAreas:H(Fa.array()),scaling:H(zy),backgroundColor:I().optional(),name:I().optional(),narrative:xe.optional(),backgroundMusic:Yi.optional(),ambientNoise:Yi.optional()}),Or=N({imageId:I(),row:W(),col:W()}),$y=N({left:Or.array().optional(),right:Or.array().optional(),up:Or.array().optional(),down:Or.array().optional()}),ja=N({id:I(),defaultDirection:Wn,animations:Bt(I(),$y)}),wl=at(["center","left","right"]),Sl=at(["center","top","bottom"]),Yy=N({x:wl,y:Sl,width:W().optional(),height:W().optional(),aspectRatio:fl.optional()}),Ky=Yy.merge(N({image:Gr})),bl=N({title:I(),narrative:xe,pictures:Ky.array(),backgroundColor:I(),color:I()}),Cl=at(["sound","buttons"]),Il=at(["serif","sans-serif","monospace","cursive","fantasy","math"]),Qa=N({id:I(),isEndOfGame:de().optional(),pages:bl.array(),font:Il.optional(),sound:Yi.optional(),progression:Cl.optional()}),is=N({id:I(),label:I(),preposition:I().optional(),isMoveVerb:de().optional(),isNotForItems:de().optional(),isLookVerb:de().optional(),requiresItem:de().optional(),defaultResponseNoItem:I().optional(),defaultResponseWithItem:I().optional(),defaultResponseCannotReach:I().optional()}),Xy=N({schemaVersion:W().optional(),rooms:Ja.array(),items:$r.array(),actors:rs.array(),interactions:$a.array(),conversations:Ya.array(),flagMap:Ka,currentRoomId:I(),id:I(),description:I().optional().describe("a short description of your game"),thumbnailAssetId:I().optional()}),Jy=N({verbs:is.array(),sequences:ns.array(),sprites:ja.array(),endings:Ha.array(),openingSequenceId:I().optional(),openingStoryboardId:I().optional(),storyBoards:Qa.array().optional()}),Al=Xy.and(Jy).describe("The game schema"),Tl=Ra.union([Ra.literal(0),Ra.literal(1)]).array().array(),ss=4,Ol=N({sequenceRunning:zr.optional(),currentStoryBoardId:I().optional(),actorOrders:Bt(I(),Hr.array()),currentConversationId:I().optional(),pendingInteraction:ts.optional(),gameNotBegun:de(),cellMatrix:Tl.optional()}),as=N({schemaVersion:le(ss),rooms:Ja.array(),items:$r.array(),actors:rs.array(),interactions:ts.array(),conversations:Va.array(),flagMap:Ka,currentRoomId:I(),id:I(),description:I().optional().describe("a short description of your game"),thumbnailAssetId:I().optional()}),eo=N({verbs:is.array(),sequences:zr.array(),sprites:ja.array(),openingSequenceId:I().optional(),openingStoryboardId:I().optional(),storyBoards:Qa.array()}),jy=as.and(Ol),Rl=as.and(eo).describe("The game schema"),Qy=at(["rooms","items","actors","conversations","sprites","sequences","verbs","storyBoards"]),e0=as.merge(N({schemaVersion:le(3),interactions:$a.array(),conversations:Ya.array()})),t0=eo.merge(N({endings:Ha.array(),sequences:ns.array()})),kl=e0.and(t0).describe("The game schema"),El=gn([rs,$r,Xa]),n0=N({verb:is,target:El,item:H($r)});var Zi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},ln={},Xe={},Wc;function to(){return Wc||(Wc=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe._extreme=Xe._DEG=Xe._360_DEG=Xe._90_DEG_RIGHT=Xe._90_DEG_LEFT=void 0,Xe._90_DEG_LEFT=Math.PI*.5,Xe._90_DEG_RIGHT=Math.PI*-.5,Xe._360_DEG=Math.PI*2,Xe._DEG=Math.PI/180,Xe._extreme=Math.pow(10,30)),Xe}var ka={},qc;function Ll(){return qc||(qc=1,(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.expandRect=a.findRotationBetweenHeadings=a.findClosestAndDistance=a.doCircleIntersect=a.doRectsIntersect=a.isPointInsideRect=a.getDistance=a.translate=a.getHeadingFrom=a.getVectorFrom=a.normaliseHeading=a.getHeading=a.getXYVector=a.xy=void 0;const r=to();function i(k,R){return k*Math.sin(R)}function o(k,R){return k*Math.cos(R)}const c=(k,R)=>({x:k,y:R});a.xy=c;function f(k,R){return{x:i(k,R),y:o(k,R)}}a.getXYVector=f;const p=k=>{const{x:R,y:ve}=k;return R==0&&ve==0?0:ve==0&&R!=0?R<0?Math.PI*1.5:Math.PI*.5:R==0&&ve!=0?ve>0?0:Math.PI*1:ve>0?Math.atan(R/ve):Math.PI+Math.atan(R/ve)};a.getHeading=p;const _=k=>{const R=k%r._360_DEG;return R>0?R:r._360_DEG+R};a.normaliseHeading=_;const w=(k,R)=>({x:R.x-k.x,y:R.y-k.y});a.getVectorFrom=w;const y=(k,R)=>(0,a.getHeading)((0,a.getVectorFrom)(k,R));a.getHeadingFrom=y;const A=(k,R)=>({x:k.x+R.x,y:k.y+R.y});a.translate=A;const M=(k,R)=>Math.sqrt(Math.pow(k.x-R.x,2)+Math.pow(k.y-R.y,2));a.getDistance=M;const ne=(k,R)=>{const{top:ve,left:we,bottom:Re,right:Qn}=R;return!(k.y<=ve||k.y>=Re||k.x<=we||k.x>=Qn)};a.isPointInsideRect=ne;const K=(k,R)=>k.bottom<=R.bottom&&k.top>=R.top||R.bottom<=k.bottom&&R.top>=k.top,J=(k,R)=>k.right<=R.right&&k.left>=R.left||R.right<=k.right&&R.left>=k.left,pe=(k,R)=>(0,a.isPointInsideRect)({x:k.left,y:k.top},R)||(0,a.isPointInsideRect)({x:k.left,y:k.bottom},R)||(0,a.isPointInsideRect)({x:k.right,y:k.top},R)||(0,a.isPointInsideRect)({x:k.right,y:k.bottom},R)||(0,a.isPointInsideRect)({x:R.left,y:R.top},k)||(0,a.isPointInsideRect)({x:R.left,y:R.bottom},k)||(0,a.isPointInsideRect)({x:R.right,y:R.top},k)||(0,a.isPointInsideRect)({x:R.right,y:R.bottom},k)||J(k,R)&&K(k,R)||J(k,R)&&(k.top>=R.top&&k.top<=R.bottom||R.top>=k.top&&R.top<=k.bottom)||K(k,R)&&(k.left>=R.left&&k.left<=R.right||R.left>=k.left&&R.left<=k.right);a.doRectsIntersect=pe;const Te=(k,R)=>(0,a.getDistance)(k,R)<k.r+R.r;a.doCircleIntersect=Te;const Ce=(k,R)=>{if(k.length===0)return{distance:1/0};const ve=k.map(Re=>({item:Re,distance:(0,a.getDistance)(R,Re)}));let[we]=ve;return ve.forEach(Re=>{we.distance>Re.distance&&(we=Re)}),we};a.findClosestAndDistance=Ce;const Ft=(k,R)=>{const ve=(0,a.normaliseHeading)(k),we=(0,a.normaliseHeading)(R);let Re=we;return ve-we>r._360_DEG/2?Re=we+r._360_DEG:ve-we<-r._360_DEG/2&&(Re=we-r._360_DEG),Re-ve};a.findRotationBetweenHeadings=Ft;const ot=(k,R)=>({top:k.top-R,bottom:k.bottom+R,left:k.left-R,right:k.right+R});a.expandRect=ot})(ka)),ka}var Sr={},Zc;function r0(){if(Zc)return Sr;Zc=1,Object.defineProperty(Sr,"__esModule",{value:!0}),Sr.doesLineSegmentCrossCircleEdge=void 0;const a=Ll();function r(p,_){return(0,a.getDistance)(p,_)<=p.r}function i(p,_,w,y){return{x:(1-p)*w.x+p*y.x-_.x,y:(1-p)*w.y+p*y.y-_.y}}function o(p){return Math.pow(p.x,2)+Math.pow(p.y,2)}function c(p,_,w){const y={x:_.x-p.x,y:_.y-p.y},A={x:p.x-w.x,y:p.y-w.y},M=y.x*A.x+y.y*A.y,ne=Math.pow(y.x,2)+Math.pow(y.y,2),K=-M/ne;if(K>=0&&K<=1)return i(K,{x:0,y:0},p,_);const J=o(i(0,w,p,_)),pe=o(i(1,w,p,_));return J<=pe?p:_}function f(p,_){const w=r(_,p[0]),y=r(_,p[1]);return w&&y?!1:y!=w?!0:r(_,c(...p,_))}return Sr.doesLineSegmentCrossCircleEdge=f,Sr}var Ea={},Uc;function i0(){return Uc||(Uc=1,(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.isPointInsidePolygon=a.isPointOnLineSegment=void 0;const r=to();function i(w,y,A){return y.x<=Math.max(w.x,A.x)&&y.x>=Math.min(w.x,A.x)&&y.y<=Math.max(w.y,A.y)&&y.y>=Math.min(w.y,A.y)}var o;(function(w){w[w.Colinear=0]="Colinear",w[w.Clockwise=1]="Clockwise",w[w.Counterclockwise=2]="Counterclockwise"})(o||(o={}));function c(w,y,A){const M=(y.y-w.y)*(A.x-y.x)-(y.x-w.x)*(A.y-y.y);return M==0?o.Colinear:M>0?o.Clockwise:o.Counterclockwise}const f=(w,y)=>c(w,...y)===o.Colinear?i(y[0],w,y[1]):!1;a.isPointOnLineSegment=f;function p(w,y){const A=c(w[0],w[1],y[0]),M=c(w[0],w[1],y[1]),ne=c(y[0],y[1],w[0]),K=c(y[0],y[1],w[1]);return!!(A!=M&&ne!=K||A==0&&i(w[0],y[0],w[1])||M==0&&i(w[0],y[1],w[1])||ne==0&&i(y[0],w[0],y[1])||K==0&&i(y[0],w[1],y[1]))}function _(w,y){if(y.length<3)return!1;const M={y:w.y,x:r._extreme},ne=[w,M];let K=0,J,pe;for(let Ce=0;Ce<y.length;Ce++)J=y[Ce],pe=Ce+1>=y.length?y[0]:y[Ce+1],p(ne,[J,pe])&&K++;let Te=0;return y.forEach(Ce=>{(0,a.isPointOnLineSegment)(Ce,ne)&&Te++}),(K-Te)%2!==0}a.isPointInsidePolygon=_})(Ea)),Ea}var Gc;function s0(){return Gc||(Gc=1,(function(a){var r=ln&&ln.__createBinding||(Object.create?(function(o,c,f,p){p===void 0&&(p=f);var _=Object.getOwnPropertyDescriptor(c,f);(!_||("get"in _?!c.__esModule:_.writable||_.configurable))&&(_={enumerable:!0,get:function(){return c[f]}}),Object.defineProperty(o,p,_)}):(function(o,c,f,p){p===void 0&&(p=f),o[p]=c[f]})),i=ln&&ln.__exportStar||function(o,c){for(var f in o)f!=="default"&&!Object.prototype.hasOwnProperty.call(c,f)&&r(c,o,f)};Object.defineProperty(a,"__esModule",{value:!0}),i(to(),a),i(Ll(),a),i(r0(),a),i(i0(),a)})(ln)),ln}var a0=s0();function o0(a,r){const{x:i,y:o,width:c,height:f}=r;return a.x>=i&&a.x<=i+c&&a.y>=o&&a.y<=o+f}function u0(a,r){const{x:i,y:o,radius:c}=r;return Math.sqrt((a.x-i)**2+(a.y-o)**2)<=c}function c0(a,r,i,o,c){const f={x:(r+.5)*i,y:(a-.5)*i},p=Vc(f,o);if(c){const _=Vc(f,c);return p||!_}return p}function Vc(a,r){const{polygons:i,rectangles:o,circles:c}=r;return i.some(f=>a0.isPointInsidePolygon(a,f))||o.some(f=>o0(a,f))||c.some(f=>u0(a,f))}function Hc(a){return a.filter(r=>r.polygon).map(r=>{const{x:i,y:o,polygon:c=[]}=r;return c.map(f=>({x:i+f[0],y:o+f[1]}))})}function zc(a){return a.filter(r=>r.rect).map(r=>{const{x:i,y:o,rect:c}=r,[f,p]=c;return{x:i,y:o-p,width:f,height:p}})}function $c(a){return a.filter(r=>r.circle).map(r=>{const{x:i,y:o,circle:c}=r;return{x:i,y:o,radius:c}})}function l0(a,r){const{width:i,height:o,obstacleAreas:c=[],walkableAreas:f=[]}=a,p=f.length>0?{polygons:Hc(f.filter(M=>!M.disabled)),rectangles:zc(f.filter(M=>!M.disabled)),circles:$c(f.filter(M=>!M.disabled))}:null,_={polygons:Hc(c.filter(M=>!M.disabled)),rectangles:zc(c.filter(M=>!M.disabled)),circles:$c(c.filter(M=>!M.disabled))},w=Math.ceil(o/r),y=Math.ceil(i/r),A=[];for(let M=0;M<w;M++){const ne=[];for(let K=0;K<y;K++)ne.push(c0(w-M,K,r,_,p)?1:0);A.push(ne)}return A}var La={},br={},Rr={exports:{}};var f0=Rr.exports,Yc;function d0(){return Yc||(Yc=1,(function(a,r){(function(){var i,o="4.17.21",c=200,f="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",p="Expected a function",_="Invalid `variable` option passed into `_.template`",w="__lodash_hash_undefined__",y=500,A="__lodash_placeholder__",M=1,ne=2,K=4,J=1,pe=2,Te=1,Ce=2,Ft=4,ot=8,k=16,R=32,ve=64,we=128,Re=256,Qn=512,Pl=30,Dl="...",Bl=800,Fl=16,no=1,Wl=2,ql=3,Qt=1/0,Wt=9007199254740991,Zl=17976931348623157e292,Yr=NaN,_t=4294967295,Ul=_t-1,Gl=_t>>>1,Vl=[["ary",we],["bind",Te],["bindKey",Ce],["curry",ot],["curryRight",k],["flip",Qn],["partial",R],["partialRight",ve],["rearg",Re]],_n="[object Arguments]",Kr="[object Array]",Hl="[object AsyncFunction]",er="[object Boolean]",tr="[object Date]",zl="[object DOMException]",Xr="[object Error]",Jr="[object Function]",ro="[object GeneratorFunction]",ut="[object Map]",nr="[object Number]",$l="[object Null]",Ct="[object Object]",io="[object Promise]",Yl="[object Proxy]",rr="[object RegExp]",ct="[object Set]",ir="[object String]",jr="[object Symbol]",Kl="[object Undefined]",sr="[object WeakMap]",Xl="[object WeakSet]",ar="[object ArrayBuffer]",vn="[object DataView]",os="[object Float32Array]",us="[object Float64Array]",cs="[object Int8Array]",ls="[object Int16Array]",fs="[object Int32Array]",ds="[object Uint8Array]",hs="[object Uint8ClampedArray]",ps="[object Uint16Array]",gs="[object Uint32Array]",Jl=/\b__p \+= '';/g,jl=/\b(__p \+=) '' \+/g,Ql=/(__e\(.*?\)|\b__t\)) \+\n'';/g,so=/&(?:amp|lt|gt|quot|#39);/g,ao=/[&<>"']/g,ef=RegExp(so.source),tf=RegExp(ao.source),nf=/<%-([\s\S]+?)%>/g,rf=/<%([\s\S]+?)%>/g,oo=/<%=([\s\S]+?)%>/g,sf=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,af=/^\w*$/,of=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ms=/[\\^$.*+?()[\]{}|]/g,uf=RegExp(ms.source),_s=/^\s+/,cf=/\s/,lf=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ff=/\{\n\/\* \[wrapped with (.+)\] \*/,df=/,? & /,hf=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,pf=/[()=,{}\[\]\/\s]/,gf=/\\(\\)?/g,mf=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,uo=/\w*$/,_f=/^[-+]0x[0-9a-f]+$/i,vf=/^0b[01]+$/i,yf=/^\[object .+?Constructor\]$/,xf=/^0o[0-7]+$/i,wf=/^(?:0|[1-9]\d*)$/,Sf=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Qr=/($^)/,bf=/['\n\r\u2028\u2029\\]/g,ei="\\ud800-\\udfff",Cf="\\u0300-\\u036f",If="\\ufe20-\\ufe2f",Af="\\u20d0-\\u20ff",co=Cf+If+Af,lo="\\u2700-\\u27bf",fo="a-z\\xdf-\\xf6\\xf8-\\xff",Tf="\\xac\\xb1\\xd7\\xf7",Of="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Rf="\\u2000-\\u206f",kf=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",ho="A-Z\\xc0-\\xd6\\xd8-\\xde",po="\\ufe0e\\ufe0f",go=Tf+Of+Rf+kf,vs="['’]",Ef="["+ei+"]",mo="["+go+"]",ti="["+co+"]",_o="\\d+",Lf="["+lo+"]",vo="["+fo+"]",yo="[^"+ei+go+_o+lo+fo+ho+"]",ys="\\ud83c[\\udffb-\\udfff]",Nf="(?:"+ti+"|"+ys+")",xo="[^"+ei+"]",xs="(?:\\ud83c[\\udde6-\\uddff]){2}",ws="[\\ud800-\\udbff][\\udc00-\\udfff]",yn="["+ho+"]",wo="\\u200d",So="(?:"+vo+"|"+yo+")",Mf="(?:"+yn+"|"+yo+")",bo="(?:"+vs+"(?:d|ll|m|re|s|t|ve))?",Co="(?:"+vs+"(?:D|LL|M|RE|S|T|VE))?",Io=Nf+"?",Ao="["+po+"]?",Pf="(?:"+wo+"(?:"+[xo,xs,ws].join("|")+")"+Ao+Io+")*",Df="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Bf="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",To=Ao+Io+Pf,Ff="(?:"+[Lf,xs,ws].join("|")+")"+To,Wf="(?:"+[xo+ti+"?",ti,xs,ws,Ef].join("|")+")",qf=RegExp(vs,"g"),Zf=RegExp(ti,"g"),Ss=RegExp(ys+"(?="+ys+")|"+Wf+To,"g"),Uf=RegExp([yn+"?"+vo+"+"+bo+"(?="+[mo,yn,"$"].join("|")+")",Mf+"+"+Co+"(?="+[mo,yn+So,"$"].join("|")+")",yn+"?"+So+"+"+bo,yn+"+"+Co,Bf,Df,_o,Ff].join("|"),"g"),Gf=RegExp("["+wo+ei+co+po+"]"),Vf=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Hf=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],zf=-1,he={};he[os]=he[us]=he[cs]=he[ls]=he[fs]=he[ds]=he[hs]=he[ps]=he[gs]=!0,he[_n]=he[Kr]=he[ar]=he[er]=he[vn]=he[tr]=he[Xr]=he[Jr]=he[ut]=he[nr]=he[Ct]=he[rr]=he[ct]=he[ir]=he[sr]=!1;var fe={};fe[_n]=fe[Kr]=fe[ar]=fe[vn]=fe[er]=fe[tr]=fe[os]=fe[us]=fe[cs]=fe[ls]=fe[fs]=fe[ut]=fe[nr]=fe[Ct]=fe[rr]=fe[ct]=fe[ir]=fe[jr]=fe[ds]=fe[hs]=fe[ps]=fe[gs]=!0,fe[Xr]=fe[Jr]=fe[sr]=!1;var $f={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Yf={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Kf={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Xf={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Jf=parseFloat,jf=parseInt,Oo=typeof Zi=="object"&&Zi&&Zi.Object===Object&&Zi,Qf=typeof self=="object"&&self&&self.Object===Object&&self,ke=Oo||Qf||Function("return this")(),bs=r&&!r.nodeType&&r,en=bs&&!0&&a&&!a.nodeType&&a,Ro=en&&en.exports===bs,Cs=Ro&&Oo.process,je=(function(){try{var m=en&&en.require&&en.require("util").types;return m||Cs&&Cs.binding&&Cs.binding("util")}catch{}})(),ko=je&&je.isArrayBuffer,Eo=je&&je.isDate,Lo=je&&je.isMap,No=je&&je.isRegExp,Mo=je&&je.isSet,Po=je&&je.isTypedArray;function Ve(m,S,x){switch(x.length){case 0:return m.call(S);case 1:return m.call(S,x[0]);case 2:return m.call(S,x[0],x[1]);case 3:return m.call(S,x[0],x[1],x[2])}return m.apply(S,x)}function ed(m,S,x,D){for(var z=-1,ae=m==null?0:m.length;++z<ae;){var Ie=m[z];S(D,Ie,x(Ie),m)}return D}function Qe(m,S){for(var x=-1,D=m==null?0:m.length;++x<D&&S(m[x],x,m)!==!1;);return m}function td(m,S){for(var x=m==null?0:m.length;x--&&S(m[x],x,m)!==!1;);return m}function Do(m,S){for(var x=-1,D=m==null?0:m.length;++x<D;)if(!S(m[x],x,m))return!1;return!0}function qt(m,S){for(var x=-1,D=m==null?0:m.length,z=0,ae=[];++x<D;){var Ie=m[x];S(Ie,x,m)&&(ae[z++]=Ie)}return ae}function ni(m,S){var x=m==null?0:m.length;return!!x&&xn(m,S,0)>-1}function Is(m,S,x){for(var D=-1,z=m==null?0:m.length;++D<z;)if(x(S,m[D]))return!0;return!1}function ge(m,S){for(var x=-1,D=m==null?0:m.length,z=Array(D);++x<D;)z[x]=S(m[x],x,m);return z}function Zt(m,S){for(var x=-1,D=S.length,z=m.length;++x<D;)m[z+x]=S[x];return m}function As(m,S,x,D){var z=-1,ae=m==null?0:m.length;for(D&&ae&&(x=m[++z]);++z<ae;)x=S(x,m[z],z,m);return x}function nd(m,S,x,D){var z=m==null?0:m.length;for(D&&z&&(x=m[--z]);z--;)x=S(x,m[z],z,m);return x}function Ts(m,S){for(var x=-1,D=m==null?0:m.length;++x<D;)if(S(m[x],x,m))return!0;return!1}var rd=Os("length");function id(m){return m.split("")}function sd(m){return m.match(hf)||[]}function Bo(m,S,x){var D;return x(m,function(z,ae,Ie){if(S(z,ae,Ie))return D=ae,!1}),D}function ri(m,S,x,D){for(var z=m.length,ae=x+(D?1:-1);D?ae--:++ae<z;)if(S(m[ae],ae,m))return ae;return-1}function xn(m,S,x){return S===S?_d(m,S,x):ri(m,Fo,x)}function ad(m,S,x,D){for(var z=x-1,ae=m.length;++z<ae;)if(D(m[z],S))return z;return-1}function Fo(m){return m!==m}function Wo(m,S){var x=m==null?0:m.length;return x?ks(m,S)/x:Yr}function Os(m){return function(S){return S==null?i:S[m]}}function Rs(m){return function(S){return m==null?i:m[S]}}function qo(m,S,x,D,z){return z(m,function(ae,Ie,ce){x=D?(D=!1,ae):S(x,ae,Ie,ce)}),x}function od(m,S){var x=m.length;for(m.sort(S);x--;)m[x]=m[x].value;return m}function ks(m,S){for(var x,D=-1,z=m.length;++D<z;){var ae=S(m[D]);ae!==i&&(x=x===i?ae:x+ae)}return x}function Es(m,S){for(var x=-1,D=Array(m);++x<m;)D[x]=S(x);return D}function ud(m,S){return ge(S,function(x){return[x,m[x]]})}function Zo(m){return m&&m.slice(0,Ho(m)+1).replace(_s,"")}function He(m){return function(S){return m(S)}}function Ls(m,S){return ge(S,function(x){return m[x]})}function or(m,S){return m.has(S)}function Uo(m,S){for(var x=-1,D=m.length;++x<D&&xn(S,m[x],0)>-1;);return x}function Go(m,S){for(var x=m.length;x--&&xn(S,m[x],0)>-1;);return x}function cd(m,S){for(var x=m.length,D=0;x--;)m[x]===S&&++D;return D}var ld=Rs($f),fd=Rs(Yf);function dd(m){return"\\"+Xf[m]}function hd(m,S){return m==null?i:m[S]}function wn(m){return Gf.test(m)}function pd(m){return Vf.test(m)}function gd(m){for(var S,x=[];!(S=m.next()).done;)x.push(S.value);return x}function Ns(m){var S=-1,x=Array(m.size);return m.forEach(function(D,z){x[++S]=[z,D]}),x}function Vo(m,S){return function(x){return m(S(x))}}function Ut(m,S){for(var x=-1,D=m.length,z=0,ae=[];++x<D;){var Ie=m[x];(Ie===S||Ie===A)&&(m[x]=A,ae[z++]=x)}return ae}function ii(m){var S=-1,x=Array(m.size);return m.forEach(function(D){x[++S]=D}),x}function md(m){var S=-1,x=Array(m.size);return m.forEach(function(D){x[++S]=[D,D]}),x}function _d(m,S,x){for(var D=x-1,z=m.length;++D<z;)if(m[D]===S)return D;return-1}function vd(m,S,x){for(var D=x+1;D--;)if(m[D]===S)return D;return D}function Sn(m){return wn(m)?xd(m):rd(m)}function lt(m){return wn(m)?wd(m):id(m)}function Ho(m){for(var S=m.length;S--&&cf.test(m.charAt(S)););return S}var yd=Rs(Kf);function xd(m){for(var S=Ss.lastIndex=0;Ss.test(m);)++S;return S}function wd(m){return m.match(Ss)||[]}function Sd(m){return m.match(Uf)||[]}var bd=(function m(S){S=S==null?ke:bn.defaults(ke.Object(),S,bn.pick(ke,Hf));var x=S.Array,D=S.Date,z=S.Error,ae=S.Function,Ie=S.Math,ce=S.Object,Ms=S.RegExp,Cd=S.String,et=S.TypeError,si=x.prototype,Id=ae.prototype,Cn=ce.prototype,ai=S["__core-js_shared__"],oi=Id.toString,ue=Cn.hasOwnProperty,Ad=0,zo=(function(){var e=/[^.]+$/.exec(ai&&ai.keys&&ai.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""})(),ui=Cn.toString,Td=oi.call(ce),Od=ke._,Rd=Ms("^"+oi.call(ue).replace(ms,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ci=Ro?S.Buffer:i,Gt=S.Symbol,li=S.Uint8Array,$o=ci?ci.allocUnsafe:i,fi=Vo(ce.getPrototypeOf,ce),Yo=ce.create,Ko=Cn.propertyIsEnumerable,di=si.splice,Xo=Gt?Gt.isConcatSpreadable:i,ur=Gt?Gt.iterator:i,tn=Gt?Gt.toStringTag:i,hi=(function(){try{var e=on(ce,"defineProperty");return e({},"",{}),e}catch{}})(),kd=S.clearTimeout!==ke.clearTimeout&&S.clearTimeout,Ed=D&&D.now!==ke.Date.now&&D.now,Ld=S.setTimeout!==ke.setTimeout&&S.setTimeout,pi=Ie.ceil,gi=Ie.floor,Ps=ce.getOwnPropertySymbols,Nd=ci?ci.isBuffer:i,Jo=S.isFinite,Md=si.join,Pd=Vo(ce.keys,ce),Ae=Ie.max,Le=Ie.min,Dd=D.now,Bd=S.parseInt,jo=Ie.random,Fd=si.reverse,Ds=on(S,"DataView"),cr=on(S,"Map"),Bs=on(S,"Promise"),In=on(S,"Set"),lr=on(S,"WeakMap"),fr=on(ce,"create"),mi=lr&&new lr,An={},Wd=un(Ds),qd=un(cr),Zd=un(Bs),Ud=un(In),Gd=un(lr),_i=Gt?Gt.prototype:i,dr=_i?_i.valueOf:i,Qo=_i?_i.toString:i;function l(e){if(ye(e)&&!$(e)&&!(e instanceof re)){if(e instanceof tt)return e;if(ue.call(e,"__wrapped__"))return ec(e)}return new tt(e)}var Tn=(function(){function e(){}return function(t){if(!me(t))return{};if(Yo)return Yo(t);e.prototype=t;var n=new e;return e.prototype=i,n}})();function vi(){}function tt(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}l.templateSettings={escape:nf,evaluate:rf,interpolate:oo,variable:"",imports:{_:l}},l.prototype=vi.prototype,l.prototype.constructor=l,tt.prototype=Tn(vi.prototype),tt.prototype.constructor=tt;function re(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=_t,this.__views__=[]}function Vd(){var e=new re(this.__wrapped__);return e.__actions__=qe(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=qe(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=qe(this.__views__),e}function Hd(){if(this.__filtered__){var e=new re(this);e.__dir__=-1,e.__filtered__=!0}else e=this.clone(),e.__dir__*=-1;return e}function zd(){var e=this.__wrapped__.value(),t=this.__dir__,n=$(e),s=t<0,u=n?e.length:0,d=ip(0,u,this.__views__),h=d.start,g=d.end,v=g-h,b=s?g:h-1,C=this.__iteratees__,T=C.length,E=0,B=Le(v,this.__takeCount__);if(!n||!s&&u==v&&B==v)return bu(e,this.__actions__);var Z=[];e:for(;v--&&E<B;){b+=t;for(var j=-1,U=e[b];++j<T;){var te=C[j],ie=te.iteratee,Ye=te.type,Be=ie(U);if(Ye==Wl)U=Be;else if(!Be){if(Ye==no)continue e;break e}}Z[E++]=U}return Z}re.prototype=Tn(vi.prototype),re.prototype.constructor=re;function nn(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}function $d(){this.__data__=fr?fr(null):{},this.size=0}function Yd(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}function Kd(e){var t=this.__data__;if(fr){var n=t[e];return n===w?i:n}return ue.call(t,e)?t[e]:i}function Xd(e){var t=this.__data__;return fr?t[e]!==i:ue.call(t,e)}function Jd(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=fr&&t===i?w:t,this}nn.prototype.clear=$d,nn.prototype.delete=Yd,nn.prototype.get=Kd,nn.prototype.has=Xd,nn.prototype.set=Jd;function It(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}function jd(){this.__data__=[],this.size=0}function Qd(e){var t=this.__data__,n=yi(t,e);if(n<0)return!1;var s=t.length-1;return n==s?t.pop():di.call(t,n,1),--this.size,!0}function eh(e){var t=this.__data__,n=yi(t,e);return n<0?i:t[n][1]}function th(e){return yi(this.__data__,e)>-1}function nh(e,t){var n=this.__data__,s=yi(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this}It.prototype.clear=jd,It.prototype.delete=Qd,It.prototype.get=eh,It.prototype.has=th,It.prototype.set=nh;function At(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var s=e[t];this.set(s[0],s[1])}}function rh(){this.size=0,this.__data__={hash:new nn,map:new(cr||It),string:new nn}}function ih(e){var t=Ei(this,e).delete(e);return this.size-=t?1:0,t}function sh(e){return Ei(this,e).get(e)}function ah(e){return Ei(this,e).has(e)}function oh(e,t){var n=Ei(this,e),s=n.size;return n.set(e,t),this.size+=n.size==s?0:1,this}At.prototype.clear=rh,At.prototype.delete=ih,At.prototype.get=sh,At.prototype.has=ah,At.prototype.set=oh;function rn(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new At;++t<n;)this.add(e[t])}function uh(e){return this.__data__.set(e,w),this}function ch(e){return this.__data__.has(e)}rn.prototype.add=rn.prototype.push=uh,rn.prototype.has=ch;function ft(e){var t=this.__data__=new It(e);this.size=t.size}function lh(){this.__data__=new It,this.size=0}function fh(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function dh(e){return this.__data__.get(e)}function hh(e){return this.__data__.has(e)}function ph(e,t){var n=this.__data__;if(n instanceof It){var s=n.__data__;if(!cr||s.length<c-1)return s.push([e,t]),this.size=++n.size,this;n=this.__data__=new At(s)}return n.set(e,t),this.size=n.size,this}ft.prototype.clear=lh,ft.prototype.delete=fh,ft.prototype.get=dh,ft.prototype.has=hh,ft.prototype.set=ph;function eu(e,t){var n=$(e),s=!n&&cn(e),u=!n&&!s&&Yt(e),d=!n&&!s&&!u&&En(e),h=n||s||u||d,g=h?Es(e.length,Cd):[],v=g.length;for(var b in e)(t||ue.call(e,b))&&!(h&&(b=="length"||u&&(b=="offset"||b=="parent")||d&&(b=="buffer"||b=="byteLength"||b=="byteOffset")||kt(b,v)))&&g.push(b);return g}function tu(e){var t=e.length;return t?e[Ys(0,t-1)]:i}function gh(e,t){return Li(qe(e),sn(t,0,e.length))}function mh(e){return Li(qe(e))}function Fs(e,t,n){(n!==i&&!dt(e[t],n)||n===i&&!(t in e))&&Tt(e,t,n)}function hr(e,t,n){var s=e[t];(!(ue.call(e,t)&&dt(s,n))||n===i&&!(t in e))&&Tt(e,t,n)}function yi(e,t){for(var n=e.length;n--;)if(dt(e[n][0],t))return n;return-1}function _h(e,t,n,s){return Vt(e,function(u,d,h){t(s,u,n(u),h)}),s}function nu(e,t){return e&&yt(t,Oe(t),e)}function vh(e,t){return e&&yt(t,Ue(t),e)}function Tt(e,t,n){t=="__proto__"&&hi?hi(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}function Ws(e,t){for(var n=-1,s=t.length,u=x(s),d=e==null;++n<s;)u[n]=d?i:ya(e,t[n]);return u}function sn(e,t,n){return e===e&&(n!==i&&(e=e<=n?e:n),t!==i&&(e=e>=t?e:t)),e}function nt(e,t,n,s,u,d){var h,g=t&M,v=t&ne,b=t&K;if(n&&(h=u?n(e,s,u,d):n(e)),h!==i)return h;if(!me(e))return e;var C=$(e);if(C){if(h=ap(e),!g)return qe(e,h)}else{var T=Ne(e),E=T==Jr||T==ro;if(Yt(e))return Au(e,g);if(T==Ct||T==_n||E&&!u){if(h=v||E?{}:Hu(e),!g)return v?Kh(e,vh(h,e)):Yh(e,nu(h,e))}else{if(!fe[T])return u?e:{};h=op(e,T,g)}}d||(d=new ft);var B=d.get(e);if(B)return B;d.set(e,h),xc(e)?e.forEach(function(U){h.add(nt(U,t,n,U,e,d))}):vc(e)&&e.forEach(function(U,te){h.set(te,nt(U,t,n,te,e,d))});var Z=b?v?sa:ia:v?Ue:Oe,j=C?i:Z(e);return Qe(j||e,function(U,te){j&&(te=U,U=e[te]),hr(h,te,nt(U,t,n,te,e,d))}),h}function yh(e){var t=Oe(e);return function(n){return ru(n,e,t)}}function ru(e,t,n){var s=n.length;if(e==null)return!s;for(e=ce(e);s--;){var u=n[s],d=t[u],h=e[u];if(h===i&&!(u in e)||!d(h))return!1}return!0}function iu(e,t,n){if(typeof e!="function")throw new et(p);return xr(function(){e.apply(i,n)},t)}function pr(e,t,n,s){var u=-1,d=ni,h=!0,g=e.length,v=[],b=t.length;if(!g)return v;n&&(t=ge(t,He(n))),s?(d=Is,h=!1):t.length>=c&&(d=or,h=!1,t=new rn(t));e:for(;++u<g;){var C=e[u],T=n==null?C:n(C);if(C=s||C!==0?C:0,h&&T===T){for(var E=b;E--;)if(t[E]===T)continue e;v.push(C)}else d(t,T,s)||v.push(C)}return v}var Vt=Eu(vt),su=Eu(Zs,!0);function xh(e,t){var n=!0;return Vt(e,function(s,u,d){return n=!!t(s,u,d),n}),n}function xi(e,t,n){for(var s=-1,u=e.length;++s<u;){var d=e[s],h=t(d);if(h!=null&&(g===i?h===h&&!$e(h):n(h,g)))var g=h,v=d}return v}function wh(e,t,n,s){var u=e.length;for(n=X(n),n<0&&(n=-n>u?0:u+n),s=s===i||s>u?u:X(s),s<0&&(s+=u),s=n>s?0:Sc(s);n<s;)e[n++]=t;return e}function au(e,t){var n=[];return Vt(e,function(s,u,d){t(s,u,d)&&n.push(s)}),n}function Ee(e,t,n,s,u){var d=-1,h=e.length;for(n||(n=cp),u||(u=[]);++d<h;){var g=e[d];t>0&&n(g)?t>1?Ee(g,t-1,n,s,u):Zt(u,g):s||(u[u.length]=g)}return u}var qs=Lu(),ou=Lu(!0);function vt(e,t){return e&&qs(e,t,Oe)}function Zs(e,t){return e&&ou(e,t,Oe)}function wi(e,t){return qt(t,function(n){return Et(e[n])})}function an(e,t){t=zt(t,e);for(var n=0,s=t.length;e!=null&&n<s;)e=e[xt(t[n++])];return n&&n==s?e:i}function uu(e,t,n){var s=t(e);return $(e)?s:Zt(s,n(e))}function Pe(e){return e==null?e===i?Kl:$l:tn&&tn in ce(e)?rp(e):mp(e)}function Us(e,t){return e>t}function Sh(e,t){return e!=null&&ue.call(e,t)}function bh(e,t){return e!=null&&t in ce(e)}function Ch(e,t,n){return e>=Le(t,n)&&e<Ae(t,n)}function Gs(e,t,n){for(var s=n?Is:ni,u=e[0].length,d=e.length,h=d,g=x(d),v=1/0,b=[];h--;){var C=e[h];h&&t&&(C=ge(C,He(t))),v=Le(C.length,v),g[h]=!n&&(t||u>=120&&C.length>=120)?new rn(h&&C):i}C=e[0];var T=-1,E=g[0];e:for(;++T<u&&b.length<v;){var B=C[T],Z=t?t(B):B;if(B=n||B!==0?B:0,!(E?or(E,Z):s(b,Z,n))){for(h=d;--h;){var j=g[h];if(!(j?or(j,Z):s(e[h],Z,n)))continue e}E&&E.push(Z),b.push(B)}}return b}function Ih(e,t,n,s){return vt(e,function(u,d,h){t(s,n(u),d,h)}),s}function gr(e,t,n){t=zt(t,e),e=Ku(e,t);var s=e==null?e:e[xt(it(t))];return s==null?i:Ve(s,e,n)}function cu(e){return ye(e)&&Pe(e)==_n}function Ah(e){return ye(e)&&Pe(e)==ar}function Th(e){return ye(e)&&Pe(e)==tr}function mr(e,t,n,s,u){return e===t?!0:e==null||t==null||!ye(e)&&!ye(t)?e!==e&&t!==t:Oh(e,t,n,s,mr,u)}function Oh(e,t,n,s,u,d){var h=$(e),g=$(t),v=h?Kr:Ne(e),b=g?Kr:Ne(t);v=v==_n?Ct:v,b=b==_n?Ct:b;var C=v==Ct,T=b==Ct,E=v==b;if(E&&Yt(e)){if(!Yt(t))return!1;h=!0,C=!1}if(E&&!C)return d||(d=new ft),h||En(e)?Uu(e,t,n,s,u,d):tp(e,t,v,n,s,u,d);if(!(n&J)){var B=C&&ue.call(e,"__wrapped__"),Z=T&&ue.call(t,"__wrapped__");if(B||Z){var j=B?e.value():e,U=Z?t.value():t;return d||(d=new ft),u(j,U,n,s,d)}}return E?(d||(d=new ft),np(e,t,n,s,u,d)):!1}function Rh(e){return ye(e)&&Ne(e)==ut}function Vs(e,t,n,s){var u=n.length,d=u,h=!s;if(e==null)return!d;for(e=ce(e);u--;){var g=n[u];if(h&&g[2]?g[1]!==e[g[0]]:!(g[0]in e))return!1}for(;++u<d;){g=n[u];var v=g[0],b=e[v],C=g[1];if(h&&g[2]){if(b===i&&!(v in e))return!1}else{var T=new ft;if(s)var E=s(b,C,v,e,t,T);if(!(E===i?mr(C,b,J|pe,s,T):E))return!1}}return!0}function lu(e){if(!me(e)||fp(e))return!1;var t=Et(e)?Rd:yf;return t.test(un(e))}function kh(e){return ye(e)&&Pe(e)==rr}function Eh(e){return ye(e)&&Ne(e)==ct}function Lh(e){return ye(e)&&Fi(e.length)&&!!he[Pe(e)]}function fu(e){return typeof e=="function"?e:e==null?Ge:typeof e=="object"?$(e)?pu(e[0],e[1]):hu(e):Nc(e)}function Hs(e){if(!yr(e))return Pd(e);var t=[];for(var n in ce(e))ue.call(e,n)&&n!="constructor"&&t.push(n);return t}function Nh(e){if(!me(e))return gp(e);var t=yr(e),n=[];for(var s in e)s=="constructor"&&(t||!ue.call(e,s))||n.push(s);return n}function zs(e,t){return e<t}function du(e,t){var n=-1,s=Ze(e)?x(e.length):[];return Vt(e,function(u,d,h){s[++n]=t(u,d,h)}),s}function hu(e){var t=oa(e);return t.length==1&&t[0][2]?$u(t[0][0],t[0][1]):function(n){return n===e||Vs(n,e,t)}}function pu(e,t){return ca(e)&&zu(t)?$u(xt(e),t):function(n){var s=ya(n,e);return s===i&&s===t?xa(n,e):mr(t,s,J|pe)}}function Si(e,t,n,s,u){e!==t&&qs(t,function(d,h){if(u||(u=new ft),me(d))Mh(e,t,h,n,Si,s,u);else{var g=s?s(fa(e,h),d,h+"",e,t,u):i;g===i&&(g=d),Fs(e,h,g)}},Ue)}function Mh(e,t,n,s,u,d,h){var g=fa(e,n),v=fa(t,n),b=h.get(v);if(b){Fs(e,n,b);return}var C=d?d(g,v,n+"",e,t,h):i,T=C===i;if(T){var E=$(v),B=!E&&Yt(v),Z=!E&&!B&&En(v);C=v,E||B||Z?$(g)?C=g:Se(g)?C=qe(g):B?(T=!1,C=Au(v,!0)):Z?(T=!1,C=Tu(v,!0)):C=[]:wr(v)||cn(v)?(C=g,cn(g)?C=bc(g):(!me(g)||Et(g))&&(C=Hu(v))):T=!1}T&&(h.set(v,C),u(C,v,s,d,h),h.delete(v)),Fs(e,n,C)}function gu(e,t){var n=e.length;if(n)return t+=t<0?n:0,kt(t,n)?e[t]:i}function mu(e,t,n){t.length?t=ge(t,function(d){return $(d)?function(h){return an(h,d.length===1?d[0]:d)}:d}):t=[Ge];var s=-1;t=ge(t,He(q()));var u=du(e,function(d,h,g){var v=ge(t,function(b){return b(d)});return{criteria:v,index:++s,value:d}});return od(u,function(d,h){return $h(d,h,n)})}function Ph(e,t){return _u(e,t,function(n,s){return xa(e,s)})}function _u(e,t,n){for(var s=-1,u=t.length,d={};++s<u;){var h=t[s],g=an(e,h);n(g,h)&&_r(d,zt(h,e),g)}return d}function Dh(e){return function(t){return an(t,e)}}function $s(e,t,n,s){var u=s?ad:xn,d=-1,h=t.length,g=e;for(e===t&&(t=qe(t)),n&&(g=ge(e,He(n)));++d<h;)for(var v=0,b=t[d],C=n?n(b):b;(v=u(g,C,v,s))>-1;)g!==e&&di.call(g,v,1),di.call(e,v,1);return e}function vu(e,t){for(var n=e?t.length:0,s=n-1;n--;){var u=t[n];if(n==s||u!==d){var d=u;kt(u)?di.call(e,u,1):Js(e,u)}}return e}function Ys(e,t){return e+gi(jo()*(t-e+1))}function Bh(e,t,n,s){for(var u=-1,d=Ae(pi((t-e)/(n||1)),0),h=x(d);d--;)h[s?d:++u]=e,e+=n;return h}function Ks(e,t){var n="";if(!e||t<1||t>Wt)return n;do t%2&&(n+=e),t=gi(t/2),t&&(e+=e);while(t);return n}function ee(e,t){return da(Yu(e,t,Ge),e+"")}function Fh(e){return tu(Ln(e))}function Wh(e,t){var n=Ln(e);return Li(n,sn(t,0,n.length))}function _r(e,t,n,s){if(!me(e))return e;t=zt(t,e);for(var u=-1,d=t.length,h=d-1,g=e;g!=null&&++u<d;){var v=xt(t[u]),b=n;if(v==="__proto__"||v==="constructor"||v==="prototype")return e;if(u!=h){var C=g[v];b=s?s(C,v,g):i,b===i&&(b=me(C)?C:kt(t[u+1])?[]:{})}hr(g,v,b),g=g[v]}return e}var yu=mi?function(e,t){return mi.set(e,t),e}:Ge,qh=hi?function(e,t){return hi(e,"toString",{configurable:!0,enumerable:!1,value:Sa(t),writable:!0})}:Ge;function Zh(e){return Li(Ln(e))}function rt(e,t,n){var s=-1,u=e.length;t<0&&(t=-t>u?0:u+t),n=n>u?u:n,n<0&&(n+=u),u=t>n?0:n-t>>>0,t>>>=0;for(var d=x(u);++s<u;)d[s]=e[s+t];return d}function Uh(e,t){var n;return Vt(e,function(s,u,d){return n=t(s,u,d),!n}),!!n}function bi(e,t,n){var s=0,u=e==null?s:e.length;if(typeof t=="number"&&t===t&&u<=Gl){for(;s<u;){var d=s+u>>>1,h=e[d];h!==null&&!$e(h)&&(n?h<=t:h<t)?s=d+1:u=d}return u}return Xs(e,t,Ge,n)}function Xs(e,t,n,s){var u=0,d=e==null?0:e.length;if(d===0)return 0;t=n(t);for(var h=t!==t,g=t===null,v=$e(t),b=t===i;u<d;){var C=gi((u+d)/2),T=n(e[C]),E=T!==i,B=T===null,Z=T===T,j=$e(T);if(h)var U=s||Z;else b?U=Z&&(s||E):g?U=Z&&E&&(s||!B):v?U=Z&&E&&!B&&(s||!j):B||j?U=!1:U=s?T<=t:T<t;U?u=C+1:d=C}return Le(d,Ul)}function xu(e,t){for(var n=-1,s=e.length,u=0,d=[];++n<s;){var h=e[n],g=t?t(h):h;if(!n||!dt(g,v)){var v=g;d[u++]=h===0?0:h}}return d}function wu(e){return typeof e=="number"?e:$e(e)?Yr:+e}function ze(e){if(typeof e=="string")return e;if($(e))return ge(e,ze)+"";if($e(e))return Qo?Qo.call(e):"";var t=e+"";return t=="0"&&1/e==-Qt?"-0":t}function Ht(e,t,n){var s=-1,u=ni,d=e.length,h=!0,g=[],v=g;if(n)h=!1,u=Is;else if(d>=c){var b=t?null:Qh(e);if(b)return ii(b);h=!1,u=or,v=new rn}else v=t?[]:g;e:for(;++s<d;){var C=e[s],T=t?t(C):C;if(C=n||C!==0?C:0,h&&T===T){for(var E=v.length;E--;)if(v[E]===T)continue e;t&&v.push(T),g.push(C)}else u(v,T,n)||(v!==g&&v.push(T),g.push(C))}return g}function Js(e,t){return t=zt(t,e),e=Ku(e,t),e==null||delete e[xt(it(t))]}function Su(e,t,n,s){return _r(e,t,n(an(e,t)),s)}function Ci(e,t,n,s){for(var u=e.length,d=s?u:-1;(s?d--:++d<u)&&t(e[d],d,e););return n?rt(e,s?0:d,s?d+1:u):rt(e,s?d+1:0,s?u:d)}function bu(e,t){var n=e;return n instanceof re&&(n=n.value()),As(t,function(s,u){return u.func.apply(u.thisArg,Zt([s],u.args))},n)}function js(e,t,n){var s=e.length;if(s<2)return s?Ht(e[0]):[];for(var u=-1,d=x(s);++u<s;)for(var h=e[u],g=-1;++g<s;)g!=u&&(d[u]=pr(d[u]||h,e[g],t,n));return Ht(Ee(d,1),t,n)}function Cu(e,t,n){for(var s=-1,u=e.length,d=t.length,h={};++s<u;){var g=s<d?t[s]:i;n(h,e[s],g)}return h}function Qs(e){return Se(e)?e:[]}function ea(e){return typeof e=="function"?e:Ge}function zt(e,t){return $(e)?e:ca(e,t)?[e]:Qu(oe(e))}var Gh=ee;function $t(e,t,n){var s=e.length;return n=n===i?s:n,!t&&n>=s?e:rt(e,t,n)}var Iu=kd||function(e){return ke.clearTimeout(e)};function Au(e,t){if(t)return e.slice();var n=e.length,s=$o?$o(n):new e.constructor(n);return e.copy(s),s}function ta(e){var t=new e.constructor(e.byteLength);return new li(t).set(new li(e)),t}function Vh(e,t){var n=t?ta(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}function Hh(e){var t=new e.constructor(e.source,uo.exec(e));return t.lastIndex=e.lastIndex,t}function zh(e){return dr?ce(dr.call(e)):{}}function Tu(e,t){var n=t?ta(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ou(e,t){if(e!==t){var n=e!==i,s=e===null,u=e===e,d=$e(e),h=t!==i,g=t===null,v=t===t,b=$e(t);if(!g&&!b&&!d&&e>t||d&&h&&v&&!g&&!b||s&&h&&v||!n&&v||!u)return 1;if(!s&&!d&&!b&&e<t||b&&n&&u&&!s&&!d||g&&n&&u||!h&&u||!v)return-1}return 0}function $h(e,t,n){for(var s=-1,u=e.criteria,d=t.criteria,h=u.length,g=n.length;++s<h;){var v=Ou(u[s],d[s]);if(v){if(s>=g)return v;var b=n[s];return v*(b=="desc"?-1:1)}}return e.index-t.index}function Ru(e,t,n,s){for(var u=-1,d=e.length,h=n.length,g=-1,v=t.length,b=Ae(d-h,0),C=x(v+b),T=!s;++g<v;)C[g]=t[g];for(;++u<h;)(T||u<d)&&(C[n[u]]=e[u]);for(;b--;)C[g++]=e[u++];return C}function ku(e,t,n,s){for(var u=-1,d=e.length,h=-1,g=n.length,v=-1,b=t.length,C=Ae(d-g,0),T=x(C+b),E=!s;++u<C;)T[u]=e[u];for(var B=u;++v<b;)T[B+v]=t[v];for(;++h<g;)(E||u<d)&&(T[B+n[h]]=e[u++]);return T}function qe(e,t){var n=-1,s=e.length;for(t||(t=x(s));++n<s;)t[n]=e[n];return t}function yt(e,t,n,s){var u=!n;n||(n={});for(var d=-1,h=t.length;++d<h;){var g=t[d],v=s?s(n[g],e[g],g,n,e):i;v===i&&(v=e[g]),u?Tt(n,g,v):hr(n,g,v)}return n}function Yh(e,t){return yt(e,ua(e),t)}function Kh(e,t){return yt(e,Gu(e),t)}function Ii(e,t){return function(n,s){var u=$(n)?ed:_h,d=t?t():{};return u(n,e,q(s,2),d)}}function On(e){return ee(function(t,n){var s=-1,u=n.length,d=u>1?n[u-1]:i,h=u>2?n[2]:i;for(d=e.length>3&&typeof d=="function"?(u--,d):i,h&&De(n[0],n[1],h)&&(d=u<3?i:d,u=1),t=ce(t);++s<u;){var g=n[s];g&&e(t,g,s,d)}return t})}function Eu(e,t){return function(n,s){if(n==null)return n;if(!Ze(n))return e(n,s);for(var u=n.length,d=t?u:-1,h=ce(n);(t?d--:++d<u)&&s(h[d],d,h)!==!1;);return n}}function Lu(e){return function(t,n,s){for(var u=-1,d=ce(t),h=s(t),g=h.length;g--;){var v=h[e?g:++u];if(n(d[v],v,d)===!1)break}return t}}function Xh(e,t,n){var s=t&Te,u=vr(e);function d(){var h=this&&this!==ke&&this instanceof d?u:e;return h.apply(s?n:this,arguments)}return d}function Nu(e){return function(t){t=oe(t);var n=wn(t)?lt(t):i,s=n?n[0]:t.charAt(0),u=n?$t(n,1).join(""):t.slice(1);return s[e]()+u}}function Rn(e){return function(t){return As(Ec(kc(t).replace(qf,"")),e,"")}}function vr(e){return function(){var t=arguments;switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3]);case 5:return new e(t[0],t[1],t[2],t[3],t[4]);case 6:return new e(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new e(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var n=Tn(e.prototype),s=e.apply(n,t);return me(s)?s:n}}function Jh(e,t,n){var s=vr(e);function u(){for(var d=arguments.length,h=x(d),g=d,v=kn(u);g--;)h[g]=arguments[g];var b=d<3&&h[0]!==v&&h[d-1]!==v?[]:Ut(h,v);if(d-=b.length,d<n)return Fu(e,t,Ai,u.placeholder,i,h,b,i,i,n-d);var C=this&&this!==ke&&this instanceof u?s:e;return Ve(C,this,h)}return u}function Mu(e){return function(t,n,s){var u=ce(t);if(!Ze(t)){var d=q(n,3);t=Oe(t),n=function(g){return d(u[g],g,u)}}var h=e(t,n,s);return h>-1?u[d?t[h]:h]:i}}function Pu(e){return Rt(function(t){var n=t.length,s=n,u=tt.prototype.thru;for(e&&t.reverse();s--;){var d=t[s];if(typeof d!="function")throw new et(p);if(u&&!h&&ki(d)=="wrapper")var h=new tt([],!0)}for(s=h?s:n;++s<n;){d=t[s];var g=ki(d),v=g=="wrapper"?aa(d):i;v&&la(v[0])&&v[1]==(we|ot|R|Re)&&!v[4].length&&v[9]==1?h=h[ki(v[0])].apply(h,v[3]):h=d.length==1&&la(d)?h[g]():h.thru(d)}return function(){var b=arguments,C=b[0];if(h&&b.length==1&&$(C))return h.plant(C).value();for(var T=0,E=n?t[T].apply(this,b):C;++T<n;)E=t[T].call(this,E);return E}})}function Ai(e,t,n,s,u,d,h,g,v,b){var C=t&we,T=t&Te,E=t&Ce,B=t&(ot|k),Z=t&Qn,j=E?i:vr(e);function U(){for(var te=arguments.length,ie=x(te),Ye=te;Ye--;)ie[Ye]=arguments[Ye];if(B)var Be=kn(U),Ke=cd(ie,Be);if(s&&(ie=Ru(ie,s,u,B)),d&&(ie=ku(ie,d,h,B)),te-=Ke,B&&te<b){var be=Ut(ie,Be);return Fu(e,t,Ai,U.placeholder,n,ie,be,g,v,b-te)}var ht=T?n:this,Nt=E?ht[e]:e;return te=ie.length,g?ie=_p(ie,g):Z&&te>1&&ie.reverse(),C&&v<te&&(ie.length=v),this&&this!==ke&&this instanceof U&&(Nt=j||vr(Nt)),Nt.apply(ht,ie)}return U}function Du(e,t){return function(n,s){return Ih(n,e,t(s),{})}}function Ti(e,t){return function(n,s){var u;if(n===i&&s===i)return t;if(n!==i&&(u=n),s!==i){if(u===i)return s;typeof n=="string"||typeof s=="string"?(n=ze(n),s=ze(s)):(n=wu(n),s=wu(s)),u=e(n,s)}return u}}function na(e){return Rt(function(t){return t=ge(t,He(q())),ee(function(n){var s=this;return e(t,function(u){return Ve(u,s,n)})})})}function Oi(e,t){t=t===i?" ":ze(t);var n=t.length;if(n<2)return n?Ks(t,e):t;var s=Ks(t,pi(e/Sn(t)));return wn(t)?$t(lt(s),0,e).join(""):s.slice(0,e)}function jh(e,t,n,s){var u=t&Te,d=vr(e);function h(){for(var g=-1,v=arguments.length,b=-1,C=s.length,T=x(C+v),E=this&&this!==ke&&this instanceof h?d:e;++b<C;)T[b]=s[b];for(;v--;)T[b++]=arguments[++g];return Ve(E,u?n:this,T)}return h}function Bu(e){return function(t,n,s){return s&&typeof s!="number"&&De(t,n,s)&&(n=s=i),t=Lt(t),n===i?(n=t,t=0):n=Lt(n),s=s===i?t<n?1:-1:Lt(s),Bh(t,n,s,e)}}function Ri(e){return function(t,n){return typeof t=="string"&&typeof n=="string"||(t=st(t),n=st(n)),e(t,n)}}function Fu(e,t,n,s,u,d,h,g,v,b){var C=t&ot,T=C?h:i,E=C?i:h,B=C?d:i,Z=C?i:d;t|=C?R:ve,t&=~(C?ve:R),t&Ft||(t&=-4);var j=[e,t,u,B,T,Z,E,g,v,b],U=n.apply(i,j);return la(e)&&Xu(U,j),U.placeholder=s,Ju(U,e,t)}function ra(e){var t=Ie[e];return function(n,s){if(n=st(n),s=s==null?0:Le(X(s),292),s&&Jo(n)){var u=(oe(n)+"e").split("e"),d=t(u[0]+"e"+(+u[1]+s));return u=(oe(d)+"e").split("e"),+(u[0]+"e"+(+u[1]-s))}return t(n)}}var Qh=In&&1/ii(new In([,-0]))[1]==Qt?function(e){return new In(e)}:Ia;function Wu(e){return function(t){var n=Ne(t);return n==ut?Ns(t):n==ct?md(t):ud(t,e(t))}}function Ot(e,t,n,s,u,d,h,g){var v=t&Ce;if(!v&&typeof e!="function")throw new et(p);var b=s?s.length:0;if(b||(t&=-97,s=u=i),h=h===i?h:Ae(X(h),0),g=g===i?g:X(g),b-=u?u.length:0,t&ve){var C=s,T=u;s=u=i}var E=v?i:aa(e),B=[e,t,n,s,u,C,T,d,h,g];if(E&&pp(B,E),e=B[0],t=B[1],n=B[2],s=B[3],u=B[4],g=B[9]=B[9]===i?v?0:e.length:Ae(B[9]-b,0),!g&&t&(ot|k)&&(t&=-25),!t||t==Te)var Z=Xh(e,t,n);else t==ot||t==k?Z=Jh(e,t,g):(t==R||t==(Te|R))&&!u.length?Z=jh(e,t,n,s):Z=Ai.apply(i,B);var j=E?yu:Xu;return Ju(j(Z,B),e,t)}function qu(e,t,n,s){return e===i||dt(e,Cn[n])&&!ue.call(s,n)?t:e}function Zu(e,t,n,s,u,d){return me(e)&&me(t)&&(d.set(t,e),Si(e,t,i,Zu,d),d.delete(t)),e}function ep(e){return wr(e)?i:e}function Uu(e,t,n,s,u,d){var h=n&J,g=e.length,v=t.length;if(g!=v&&!(h&&v>g))return!1;var b=d.get(e),C=d.get(t);if(b&&C)return b==t&&C==e;var T=-1,E=!0,B=n&pe?new rn:i;for(d.set(e,t),d.set(t,e);++T<g;){var Z=e[T],j=t[T];if(s)var U=h?s(j,Z,T,t,e,d):s(Z,j,T,e,t,d);if(U!==i){if(U)continue;E=!1;break}if(B){if(!Ts(t,function(te,ie){if(!or(B,ie)&&(Z===te||u(Z,te,n,s,d)))return B.push(ie)})){E=!1;break}}else if(!(Z===j||u(Z,j,n,s,d))){E=!1;break}}return d.delete(e),d.delete(t),E}function tp(e,t,n,s,u,d,h){switch(n){case vn:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case ar:return!(e.byteLength!=t.byteLength||!d(new li(e),new li(t)));case er:case tr:case nr:return dt(+e,+t);case Xr:return e.name==t.name&&e.message==t.message;case rr:case ir:return e==t+"";case ut:var g=Ns;case ct:var v=s&J;if(g||(g=ii),e.size!=t.size&&!v)return!1;var b=h.get(e);if(b)return b==t;s|=pe,h.set(e,t);var C=Uu(g(e),g(t),s,u,d,h);return h.delete(e),C;case jr:if(dr)return dr.call(e)==dr.call(t)}return!1}function np(e,t,n,s,u,d){var h=n&J,g=ia(e),v=g.length,b=ia(t),C=b.length;if(v!=C&&!h)return!1;for(var T=v;T--;){var E=g[T];if(!(h?E in t:ue.call(t,E)))return!1}var B=d.get(e),Z=d.get(t);if(B&&Z)return B==t&&Z==e;var j=!0;d.set(e,t),d.set(t,e);for(var U=h;++T<v;){E=g[T];var te=e[E],ie=t[E];if(s)var Ye=h?s(ie,te,E,t,e,d):s(te,ie,E,e,t,d);if(!(Ye===i?te===ie||u(te,ie,n,s,d):Ye)){j=!1;break}U||(U=E=="constructor")}if(j&&!U){var Be=e.constructor,Ke=t.constructor;Be!=Ke&&"constructor"in e&&"constructor"in t&&!(typeof Be=="function"&&Be instanceof Be&&typeof Ke=="function"&&Ke instanceof Ke)&&(j=!1)}return d.delete(e),d.delete(t),j}function Rt(e){return da(Yu(e,i,rc),e+"")}function ia(e){return uu(e,Oe,ua)}function sa(e){return uu(e,Ue,Gu)}var aa=mi?function(e){return mi.get(e)}:Ia;function ki(e){for(var t=e.name+"",n=An[t],s=ue.call(An,t)?n.length:0;s--;){var u=n[s],d=u.func;if(d==null||d==e)return u.name}return t}function kn(e){var t=ue.call(l,"placeholder")?l:e;return t.placeholder}function q(){var e=l.iteratee||ba;return e=e===ba?fu:e,arguments.length?e(arguments[0],arguments[1]):e}function Ei(e,t){var n=e.__data__;return lp(t)?n[typeof t=="string"?"string":"hash"]:n.map}function oa(e){for(var t=Oe(e),n=t.length;n--;){var s=t[n],u=e[s];t[n]=[s,u,zu(u)]}return t}function on(e,t){var n=hd(e,t);return lu(n)?n:i}function rp(e){var t=ue.call(e,tn),n=e[tn];try{e[tn]=i;var s=!0}catch{}var u=ui.call(e);return s&&(t?e[tn]=n:delete e[tn]),u}var ua=Ps?function(e){return e==null?[]:(e=ce(e),qt(Ps(e),function(t){return Ko.call(e,t)}))}:Aa,Gu=Ps?function(e){for(var t=[];e;)Zt(t,ua(e)),e=fi(e);return t}:Aa,Ne=Pe;(Ds&&Ne(new Ds(new ArrayBuffer(1)))!=vn||cr&&Ne(new cr)!=ut||Bs&&Ne(Bs.resolve())!=io||In&&Ne(new In)!=ct||lr&&Ne(new lr)!=sr)&&(Ne=function(e){var t=Pe(e),n=t==Ct?e.constructor:i,s=n?un(n):"";if(s)switch(s){case Wd:return vn;case qd:return ut;case Zd:return io;case Ud:return ct;case Gd:return sr}return t});function ip(e,t,n){for(var s=-1,u=n.length;++s<u;){var d=n[s],h=d.size;switch(d.type){case"drop":e+=h;break;case"dropRight":t-=h;break;case"take":t=Le(t,e+h);break;case"takeRight":e=Ae(e,t-h);break}}return{start:e,end:t}}function sp(e){var t=e.match(ff);return t?t[1].split(df):[]}function Vu(e,t,n){t=zt(t,e);for(var s=-1,u=t.length,d=!1;++s<u;){var h=xt(t[s]);if(!(d=e!=null&&n(e,h)))break;e=e[h]}return d||++s!=u?d:(u=e==null?0:e.length,!!u&&Fi(u)&&kt(h,u)&&($(e)||cn(e)))}function ap(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]=="string"&&ue.call(e,"index")&&(n.index=e.index,n.input=e.input),n}function Hu(e){return typeof e.constructor=="function"&&!yr(e)?Tn(fi(e)):{}}function op(e,t,n){var s=e.constructor;switch(t){case ar:return ta(e);case er:case tr:return new s(+e);case vn:return Vh(e,n);case os:case us:case cs:case ls:case fs:case ds:case hs:case ps:case gs:return Tu(e,n);case ut:return new s;case nr:case ir:return new s(e);case rr:return Hh(e);case ct:return new s;case jr:return zh(e)}}function up(e,t){var n=t.length;if(!n)return e;var s=n-1;return t[s]=(n>1?"& ":"")+t[s],t=t.join(n>2?", ":" "),e.replace(lf,`{
2
+ /* [wrapped with `+t+`] */
3
+ `)}function cp(e){return $(e)||cn(e)||!!(Xo&&e&&e[Xo])}function kt(e,t){var n=typeof e;return t=t??Wt,!!t&&(n=="number"||n!="symbol"&&wf.test(e))&&e>-1&&e%1==0&&e<t}function De(e,t,n){if(!me(n))return!1;var s=typeof t;return(s=="number"?Ze(n)&&kt(t,n.length):s=="string"&&t in n)?dt(n[t],e):!1}function ca(e,t){if($(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||$e(e)?!0:af.test(e)||!sf.test(e)||t!=null&&e in ce(t)}function lp(e){var t=typeof e;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?e!=="__proto__":e===null}function la(e){var t=ki(e),n=l[t];if(typeof n!="function"||!(t in re.prototype))return!1;if(e===n)return!0;var s=aa(n);return!!s&&e===s[0]}function fp(e){return!!zo&&zo in e}var dp=ai?Et:Ta;function yr(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||Cn;return e===n}function zu(e){return e===e&&!me(e)}function $u(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==i||e in ce(n))}}function hp(e){var t=Di(e,function(s){return n.size===y&&n.clear(),s}),n=t.cache;return t}function pp(e,t){var n=e[1],s=t[1],u=n|s,d=u<(Te|Ce|we),h=s==we&&n==ot||s==we&&n==Re&&e[7].length<=t[8]||s==(we|Re)&&t[7].length<=t[8]&&n==ot;if(!(d||h))return e;s&Te&&(e[2]=t[2],u|=n&Te?0:Ft);var g=t[3];if(g){var v=e[3];e[3]=v?Ru(v,g,t[4]):g,e[4]=v?Ut(e[3],A):t[4]}return g=t[5],g&&(v=e[5],e[5]=v?ku(v,g,t[6]):g,e[6]=v?Ut(e[5],A):t[6]),g=t[7],g&&(e[7]=g),s&we&&(e[8]=e[8]==null?t[8]:Le(e[8],t[8])),e[9]==null&&(e[9]=t[9]),e[0]=t[0],e[1]=u,e}function gp(e){var t=[];if(e!=null)for(var n in ce(e))t.push(n);return t}function mp(e){return ui.call(e)}function Yu(e,t,n){return t=Ae(t===i?e.length-1:t,0),function(){for(var s=arguments,u=-1,d=Ae(s.length-t,0),h=x(d);++u<d;)h[u]=s[t+u];u=-1;for(var g=x(t+1);++u<t;)g[u]=s[u];return g[t]=n(h),Ve(e,this,g)}}function Ku(e,t){return t.length<2?e:an(e,rt(t,0,-1))}function _p(e,t){for(var n=e.length,s=Le(t.length,n),u=qe(e);s--;){var d=t[s];e[s]=kt(d,n)?u[d]:i}return e}function fa(e,t){if(!(t==="constructor"&&typeof e[t]=="function")&&t!="__proto__")return e[t]}var Xu=ju(yu),xr=Ld||function(e,t){return ke.setTimeout(e,t)},da=ju(qh);function Ju(e,t,n){var s=t+"";return da(e,up(s,vp(sp(s),n)))}function ju(e){var t=0,n=0;return function(){var s=Dd(),u=Fl-(s-n);if(n=s,u>0){if(++t>=Bl)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Li(e,t){var n=-1,s=e.length,u=s-1;for(t=t===i?s:t;++n<t;){var d=Ys(n,u),h=e[d];e[d]=e[n],e[n]=h}return e.length=t,e}var Qu=hp(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(""),e.replace(of,function(n,s,u,d){t.push(u?d.replace(gf,"$1"):s||n)}),t});function xt(e){if(typeof e=="string"||$e(e))return e;var t=e+"";return t=="0"&&1/e==-Qt?"-0":t}function un(e){if(e!=null){try{return oi.call(e)}catch{}try{return e+""}catch{}}return""}function vp(e,t){return Qe(Vl,function(n){var s="_."+n[0];t&n[1]&&!ni(e,s)&&e.push(s)}),e.sort()}function ec(e){if(e instanceof re)return e.clone();var t=new tt(e.__wrapped__,e.__chain__);return t.__actions__=qe(e.__actions__),t.__index__=e.__index__,t.__values__=e.__values__,t}function yp(e,t,n){(n?De(e,t,n):t===i)?t=1:t=Ae(X(t),0);var s=e==null?0:e.length;if(!s||t<1)return[];for(var u=0,d=0,h=x(pi(s/t));u<s;)h[d++]=rt(e,u,u+=t);return h}function xp(e){for(var t=-1,n=e==null?0:e.length,s=0,u=[];++t<n;){var d=e[t];d&&(u[s++]=d)}return u}function wp(){var e=arguments.length;if(!e)return[];for(var t=x(e-1),n=arguments[0],s=e;s--;)t[s-1]=arguments[s];return Zt($(n)?qe(n):[n],Ee(t,1))}var Sp=ee(function(e,t){return Se(e)?pr(e,Ee(t,1,Se,!0)):[]}),bp=ee(function(e,t){var n=it(t);return Se(n)&&(n=i),Se(e)?pr(e,Ee(t,1,Se,!0),q(n,2)):[]}),Cp=ee(function(e,t){var n=it(t);return Se(n)&&(n=i),Se(e)?pr(e,Ee(t,1,Se,!0),i,n):[]});function Ip(e,t,n){var s=e==null?0:e.length;return s?(t=n||t===i?1:X(t),rt(e,t<0?0:t,s)):[]}function Ap(e,t,n){var s=e==null?0:e.length;return s?(t=n||t===i?1:X(t),t=s-t,rt(e,0,t<0?0:t)):[]}function Tp(e,t){return e&&e.length?Ci(e,q(t,3),!0,!0):[]}function Op(e,t){return e&&e.length?Ci(e,q(t,3),!0):[]}function Rp(e,t,n,s){var u=e==null?0:e.length;return u?(n&&typeof n!="number"&&De(e,t,n)&&(n=0,s=u),wh(e,t,n,s)):[]}function tc(e,t,n){var s=e==null?0:e.length;if(!s)return-1;var u=n==null?0:X(n);return u<0&&(u=Ae(s+u,0)),ri(e,q(t,3),u)}function nc(e,t,n){var s=e==null?0:e.length;if(!s)return-1;var u=s-1;return n!==i&&(u=X(n),u=n<0?Ae(s+u,0):Le(u,s-1)),ri(e,q(t,3),u,!0)}function rc(e){var t=e==null?0:e.length;return t?Ee(e,1):[]}function kp(e){var t=e==null?0:e.length;return t?Ee(e,Qt):[]}function Ep(e,t){var n=e==null?0:e.length;return n?(t=t===i?1:X(t),Ee(e,t)):[]}function Lp(e){for(var t=-1,n=e==null?0:e.length,s={};++t<n;){var u=e[t];s[u[0]]=u[1]}return s}function ic(e){return e&&e.length?e[0]:i}function Np(e,t,n){var s=e==null?0:e.length;if(!s)return-1;var u=n==null?0:X(n);return u<0&&(u=Ae(s+u,0)),xn(e,t,u)}function Mp(e){var t=e==null?0:e.length;return t?rt(e,0,-1):[]}var Pp=ee(function(e){var t=ge(e,Qs);return t.length&&t[0]===e[0]?Gs(t):[]}),Dp=ee(function(e){var t=it(e),n=ge(e,Qs);return t===it(n)?t=i:n.pop(),n.length&&n[0]===e[0]?Gs(n,q(t,2)):[]}),Bp=ee(function(e){var t=it(e),n=ge(e,Qs);return t=typeof t=="function"?t:i,t&&n.pop(),n.length&&n[0]===e[0]?Gs(n,i,t):[]});function Fp(e,t){return e==null?"":Md.call(e,t)}function it(e){var t=e==null?0:e.length;return t?e[t-1]:i}function Wp(e,t,n){var s=e==null?0:e.length;if(!s)return-1;var u=s;return n!==i&&(u=X(n),u=u<0?Ae(s+u,0):Le(u,s-1)),t===t?vd(e,t,u):ri(e,Fo,u,!0)}function qp(e,t){return e&&e.length?gu(e,X(t)):i}var Zp=ee(sc);function sc(e,t){return e&&e.length&&t&&t.length?$s(e,t):e}function Up(e,t,n){return e&&e.length&&t&&t.length?$s(e,t,q(n,2)):e}function Gp(e,t,n){return e&&e.length&&t&&t.length?$s(e,t,i,n):e}var Vp=Rt(function(e,t){var n=e==null?0:e.length,s=Ws(e,t);return vu(e,ge(t,function(u){return kt(u,n)?+u:u}).sort(Ou)),s});function Hp(e,t){var n=[];if(!(e&&e.length))return n;var s=-1,u=[],d=e.length;for(t=q(t,3);++s<d;){var h=e[s];t(h,s,e)&&(n.push(h),u.push(s))}return vu(e,u),n}function ha(e){return e==null?e:Fd.call(e)}function zp(e,t,n){var s=e==null?0:e.length;return s?(n&&typeof n!="number"&&De(e,t,n)?(t=0,n=s):(t=t==null?0:X(t),n=n===i?s:X(n)),rt(e,t,n)):[]}function $p(e,t){return bi(e,t)}function Yp(e,t,n){return Xs(e,t,q(n,2))}function Kp(e,t){var n=e==null?0:e.length;if(n){var s=bi(e,t);if(s<n&&dt(e[s],t))return s}return-1}function Xp(e,t){return bi(e,t,!0)}function Jp(e,t,n){return Xs(e,t,q(n,2),!0)}function jp(e,t){var n=e==null?0:e.length;if(n){var s=bi(e,t,!0)-1;if(dt(e[s],t))return s}return-1}function Qp(e){return e&&e.length?xu(e):[]}function eg(e,t){return e&&e.length?xu(e,q(t,2)):[]}function tg(e){var t=e==null?0:e.length;return t?rt(e,1,t):[]}function ng(e,t,n){return e&&e.length?(t=n||t===i?1:X(t),rt(e,0,t<0?0:t)):[]}function rg(e,t,n){var s=e==null?0:e.length;return s?(t=n||t===i?1:X(t),t=s-t,rt(e,t<0?0:t,s)):[]}function ig(e,t){return e&&e.length?Ci(e,q(t,3),!1,!0):[]}function sg(e,t){return e&&e.length?Ci(e,q(t,3)):[]}var ag=ee(function(e){return Ht(Ee(e,1,Se,!0))}),og=ee(function(e){var t=it(e);return Se(t)&&(t=i),Ht(Ee(e,1,Se,!0),q(t,2))}),ug=ee(function(e){var t=it(e);return t=typeof t=="function"?t:i,Ht(Ee(e,1,Se,!0),i,t)});function cg(e){return e&&e.length?Ht(e):[]}function lg(e,t){return e&&e.length?Ht(e,q(t,2)):[]}function fg(e,t){return t=typeof t=="function"?t:i,e&&e.length?Ht(e,i,t):[]}function pa(e){if(!(e&&e.length))return[];var t=0;return e=qt(e,function(n){if(Se(n))return t=Ae(n.length,t),!0}),Es(t,function(n){return ge(e,Os(n))})}function ac(e,t){if(!(e&&e.length))return[];var n=pa(e);return t==null?n:ge(n,function(s){return Ve(t,i,s)})}var dg=ee(function(e,t){return Se(e)?pr(e,t):[]}),hg=ee(function(e){return js(qt(e,Se))}),pg=ee(function(e){var t=it(e);return Se(t)&&(t=i),js(qt(e,Se),q(t,2))}),gg=ee(function(e){var t=it(e);return t=typeof t=="function"?t:i,js(qt(e,Se),i,t)}),mg=ee(pa);function _g(e,t){return Cu(e||[],t||[],hr)}function vg(e,t){return Cu(e||[],t||[],_r)}var yg=ee(function(e){var t=e.length,n=t>1?e[t-1]:i;return n=typeof n=="function"?(e.pop(),n):i,ac(e,n)});function oc(e){var t=l(e);return t.__chain__=!0,t}function xg(e,t){return t(e),e}function Ni(e,t){return t(e)}var wg=Rt(function(e){var t=e.length,n=t?e[0]:0,s=this.__wrapped__,u=function(d){return Ws(d,e)};return t>1||this.__actions__.length||!(s instanceof re)||!kt(n)?this.thru(u):(s=s.slice(n,+n+(t?1:0)),s.__actions__.push({func:Ni,args:[u],thisArg:i}),new tt(s,this.__chain__).thru(function(d){return t&&!d.length&&d.push(i),d}))});function Sg(){return oc(this)}function bg(){return new tt(this.value(),this.__chain__)}function Cg(){this.__values__===i&&(this.__values__=wc(this.value()));var e=this.__index__>=this.__values__.length,t=e?i:this.__values__[this.__index__++];return{done:e,value:t}}function Ig(){return this}function Ag(e){for(var t,n=this;n instanceof vi;){var s=ec(n);s.__index__=0,s.__values__=i,t?u.__wrapped__=s:t=s;var u=s;n=n.__wrapped__}return u.__wrapped__=e,t}function Tg(){var e=this.__wrapped__;if(e instanceof re){var t=e;return this.__actions__.length&&(t=new re(this)),t=t.reverse(),t.__actions__.push({func:Ni,args:[ha],thisArg:i}),new tt(t,this.__chain__)}return this.thru(ha)}function Og(){return bu(this.__wrapped__,this.__actions__)}var Rg=Ii(function(e,t,n){ue.call(e,n)?++e[n]:Tt(e,n,1)});function kg(e,t,n){var s=$(e)?Do:xh;return n&&De(e,t,n)&&(t=i),s(e,q(t,3))}function Eg(e,t){var n=$(e)?qt:au;return n(e,q(t,3))}var Lg=Mu(tc),Ng=Mu(nc);function Mg(e,t){return Ee(Mi(e,t),1)}function Pg(e,t){return Ee(Mi(e,t),Qt)}function Dg(e,t,n){return n=n===i?1:X(n),Ee(Mi(e,t),n)}function uc(e,t){var n=$(e)?Qe:Vt;return n(e,q(t,3))}function cc(e,t){var n=$(e)?td:su;return n(e,q(t,3))}var Bg=Ii(function(e,t,n){ue.call(e,n)?e[n].push(t):Tt(e,n,[t])});function Fg(e,t,n,s){e=Ze(e)?e:Ln(e),n=n&&!s?X(n):0;var u=e.length;return n<0&&(n=Ae(u+n,0)),Wi(e)?n<=u&&e.indexOf(t,n)>-1:!!u&&xn(e,t,n)>-1}var Wg=ee(function(e,t,n){var s=-1,u=typeof t=="function",d=Ze(e)?x(e.length):[];return Vt(e,function(h){d[++s]=u?Ve(t,h,n):gr(h,t,n)}),d}),qg=Ii(function(e,t,n){Tt(e,n,t)});function Mi(e,t){var n=$(e)?ge:du;return n(e,q(t,3))}function Zg(e,t,n,s){return e==null?[]:($(t)||(t=t==null?[]:[t]),n=s?i:n,$(n)||(n=n==null?[]:[n]),mu(e,t,n))}var Ug=Ii(function(e,t,n){e[n?0:1].push(t)},function(){return[[],[]]});function Gg(e,t,n){var s=$(e)?As:qo,u=arguments.length<3;return s(e,q(t,4),n,u,Vt)}function Vg(e,t,n){var s=$(e)?nd:qo,u=arguments.length<3;return s(e,q(t,4),n,u,su)}function Hg(e,t){var n=$(e)?qt:au;return n(e,Bi(q(t,3)))}function zg(e){var t=$(e)?tu:Fh;return t(e)}function $g(e,t,n){(n?De(e,t,n):t===i)?t=1:t=X(t);var s=$(e)?gh:Wh;return s(e,t)}function Yg(e){var t=$(e)?mh:Zh;return t(e)}function Kg(e){if(e==null)return 0;if(Ze(e))return Wi(e)?Sn(e):e.length;var t=Ne(e);return t==ut||t==ct?e.size:Hs(e).length}function Xg(e,t,n){var s=$(e)?Ts:Uh;return n&&De(e,t,n)&&(t=i),s(e,q(t,3))}var Jg=ee(function(e,t){if(e==null)return[];var n=t.length;return n>1&&De(e,t[0],t[1])?t=[]:n>2&&De(t[0],t[1],t[2])&&(t=[t[0]]),mu(e,Ee(t,1),[])}),Pi=Ed||function(){return ke.Date.now()};function jg(e,t){if(typeof t!="function")throw new et(p);return e=X(e),function(){if(--e<1)return t.apply(this,arguments)}}function lc(e,t,n){return t=n?i:t,t=e&&t==null?e.length:t,Ot(e,we,i,i,i,i,t)}function fc(e,t){var n;if(typeof t!="function")throw new et(p);return e=X(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var ga=ee(function(e,t,n){var s=Te;if(n.length){var u=Ut(n,kn(ga));s|=R}return Ot(e,s,t,n,u)}),dc=ee(function(e,t,n){var s=Te|Ce;if(n.length){var u=Ut(n,kn(dc));s|=R}return Ot(t,s,e,n,u)});function hc(e,t,n){t=n?i:t;var s=Ot(e,ot,i,i,i,i,i,t);return s.placeholder=hc.placeholder,s}function pc(e,t,n){t=n?i:t;var s=Ot(e,k,i,i,i,i,i,t);return s.placeholder=pc.placeholder,s}function gc(e,t,n){var s,u,d,h,g,v,b=0,C=!1,T=!1,E=!0;if(typeof e!="function")throw new et(p);t=st(t)||0,me(n)&&(C=!!n.leading,T="maxWait"in n,d=T?Ae(st(n.maxWait)||0,t):d,E="trailing"in n?!!n.trailing:E);function B(be){var ht=s,Nt=u;return s=u=i,b=be,h=e.apply(Nt,ht),h}function Z(be){return b=be,g=xr(te,t),C?B(be):h}function j(be){var ht=be-v,Nt=be-b,Mc=t-ht;return T?Le(Mc,d-Nt):Mc}function U(be){var ht=be-v,Nt=be-b;return v===i||ht>=t||ht<0||T&&Nt>=d}function te(){var be=Pi();if(U(be))return ie(be);g=xr(te,j(be))}function ie(be){return g=i,E&&s?B(be):(s=u=i,h)}function Ye(){g!==i&&Iu(g),b=0,s=v=u=g=i}function Be(){return g===i?h:ie(Pi())}function Ke(){var be=Pi(),ht=U(be);if(s=arguments,u=this,v=be,ht){if(g===i)return Z(v);if(T)return Iu(g),g=xr(te,t),B(v)}return g===i&&(g=xr(te,t)),h}return Ke.cancel=Ye,Ke.flush=Be,Ke}var Qg=ee(function(e,t){return iu(e,1,t)}),em=ee(function(e,t,n){return iu(e,st(t)||0,n)});function tm(e){return Ot(e,Qn)}function Di(e,t){if(typeof e!="function"||t!=null&&typeof t!="function")throw new et(p);var n=function(){var s=arguments,u=t?t.apply(this,s):s[0],d=n.cache;if(d.has(u))return d.get(u);var h=e.apply(this,s);return n.cache=d.set(u,h)||d,h};return n.cache=new(Di.Cache||At),n}Di.Cache=At;function Bi(e){if(typeof e!="function")throw new et(p);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}function nm(e){return fc(2,e)}var rm=Gh(function(e,t){t=t.length==1&&$(t[0])?ge(t[0],He(q())):ge(Ee(t,1),He(q()));var n=t.length;return ee(function(s){for(var u=-1,d=Le(s.length,n);++u<d;)s[u]=t[u].call(this,s[u]);return Ve(e,this,s)})}),ma=ee(function(e,t){var n=Ut(t,kn(ma));return Ot(e,R,i,t,n)}),mc=ee(function(e,t){var n=Ut(t,kn(mc));return Ot(e,ve,i,t,n)}),im=Rt(function(e,t){return Ot(e,Re,i,i,i,t)});function sm(e,t){if(typeof e!="function")throw new et(p);return t=t===i?t:X(t),ee(e,t)}function am(e,t){if(typeof e!="function")throw new et(p);return t=t==null?0:Ae(X(t),0),ee(function(n){var s=n[t],u=$t(n,0,t);return s&&Zt(u,s),Ve(e,this,u)})}function om(e,t,n){var s=!0,u=!0;if(typeof e!="function")throw new et(p);return me(n)&&(s="leading"in n?!!n.leading:s,u="trailing"in n?!!n.trailing:u),gc(e,t,{leading:s,maxWait:t,trailing:u})}function um(e){return lc(e,1)}function cm(e,t){return ma(ea(t),e)}function lm(){if(!arguments.length)return[];var e=arguments[0];return $(e)?e:[e]}function fm(e){return nt(e,K)}function dm(e,t){return t=typeof t=="function"?t:i,nt(e,K,t)}function hm(e){return nt(e,M|K)}function pm(e,t){return t=typeof t=="function"?t:i,nt(e,M|K,t)}function gm(e,t){return t==null||ru(e,t,Oe(t))}function dt(e,t){return e===t||e!==e&&t!==t}var mm=Ri(Us),_m=Ri(function(e,t){return e>=t}),cn=cu((function(){return arguments})())?cu:function(e){return ye(e)&&ue.call(e,"callee")&&!Ko.call(e,"callee")},$=x.isArray,vm=ko?He(ko):Ah;function Ze(e){return e!=null&&Fi(e.length)&&!Et(e)}function Se(e){return ye(e)&&Ze(e)}function ym(e){return e===!0||e===!1||ye(e)&&Pe(e)==er}var Yt=Nd||Ta,xm=Eo?He(Eo):Th;function wm(e){return ye(e)&&e.nodeType===1&&!wr(e)}function Sm(e){if(e==null)return!0;if(Ze(e)&&($(e)||typeof e=="string"||typeof e.splice=="function"||Yt(e)||En(e)||cn(e)))return!e.length;var t=Ne(e);if(t==ut||t==ct)return!e.size;if(yr(e))return!Hs(e).length;for(var n in e)if(ue.call(e,n))return!1;return!0}function bm(e,t){return mr(e,t)}function Cm(e,t,n){n=typeof n=="function"?n:i;var s=n?n(e,t):i;return s===i?mr(e,t,i,n):!!s}function _a(e){if(!ye(e))return!1;var t=Pe(e);return t==Xr||t==zl||typeof e.message=="string"&&typeof e.name=="string"&&!wr(e)}function Im(e){return typeof e=="number"&&Jo(e)}function Et(e){if(!me(e))return!1;var t=Pe(e);return t==Jr||t==ro||t==Hl||t==Yl}function _c(e){return typeof e=="number"&&e==X(e)}function Fi(e){return typeof e=="number"&&e>-1&&e%1==0&&e<=Wt}function me(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}function ye(e){return e!=null&&typeof e=="object"}var vc=Lo?He(Lo):Rh;function Am(e,t){return e===t||Vs(e,t,oa(t))}function Tm(e,t,n){return n=typeof n=="function"?n:i,Vs(e,t,oa(t),n)}function Om(e){return yc(e)&&e!=+e}function Rm(e){if(dp(e))throw new z(f);return lu(e)}function km(e){return e===null}function Em(e){return e==null}function yc(e){return typeof e=="number"||ye(e)&&Pe(e)==nr}function wr(e){if(!ye(e)||Pe(e)!=Ct)return!1;var t=fi(e);if(t===null)return!0;var n=ue.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&oi.call(n)==Td}var va=No?He(No):kh;function Lm(e){return _c(e)&&e>=-Wt&&e<=Wt}var xc=Mo?He(Mo):Eh;function Wi(e){return typeof e=="string"||!$(e)&&ye(e)&&Pe(e)==ir}function $e(e){return typeof e=="symbol"||ye(e)&&Pe(e)==jr}var En=Po?He(Po):Lh;function Nm(e){return e===i}function Mm(e){return ye(e)&&Ne(e)==sr}function Pm(e){return ye(e)&&Pe(e)==Xl}var Dm=Ri(zs),Bm=Ri(function(e,t){return e<=t});function wc(e){if(!e)return[];if(Ze(e))return Wi(e)?lt(e):qe(e);if(ur&&e[ur])return gd(e[ur]());var t=Ne(e),n=t==ut?Ns:t==ct?ii:Ln;return n(e)}function Lt(e){if(!e)return e===0?e:0;if(e=st(e),e===Qt||e===-Qt){var t=e<0?-1:1;return t*Zl}return e===e?e:0}function X(e){var t=Lt(e),n=t%1;return t===t?n?t-n:t:0}function Sc(e){return e?sn(X(e),0,_t):0}function st(e){if(typeof e=="number")return e;if($e(e))return Yr;if(me(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=me(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Zo(e);var n=vf.test(e);return n||xf.test(e)?jf(e.slice(2),n?2:8):_f.test(e)?Yr:+e}function bc(e){return yt(e,Ue(e))}function Fm(e){return e?sn(X(e),-Wt,Wt):e===0?e:0}function oe(e){return e==null?"":ze(e)}var Wm=On(function(e,t){if(yr(t)||Ze(t)){yt(t,Oe(t),e);return}for(var n in t)ue.call(t,n)&&hr(e,n,t[n])}),Cc=On(function(e,t){yt(t,Ue(t),e)}),qi=On(function(e,t,n,s){yt(t,Ue(t),e,s)}),qm=On(function(e,t,n,s){yt(t,Oe(t),e,s)}),Zm=Rt(Ws);function Um(e,t){var n=Tn(e);return t==null?n:nu(n,t)}var Gm=ee(function(e,t){e=ce(e);var n=-1,s=t.length,u=s>2?t[2]:i;for(u&&De(t[0],t[1],u)&&(s=1);++n<s;)for(var d=t[n],h=Ue(d),g=-1,v=h.length;++g<v;){var b=h[g],C=e[b];(C===i||dt(C,Cn[b])&&!ue.call(e,b))&&(e[b]=d[b])}return e}),Vm=ee(function(e){return e.push(i,Zu),Ve(Ic,i,e)});function Hm(e,t){return Bo(e,q(t,3),vt)}function zm(e,t){return Bo(e,q(t,3),Zs)}function $m(e,t){return e==null?e:qs(e,q(t,3),Ue)}function Ym(e,t){return e==null?e:ou(e,q(t,3),Ue)}function Km(e,t){return e&&vt(e,q(t,3))}function Xm(e,t){return e&&Zs(e,q(t,3))}function Jm(e){return e==null?[]:wi(e,Oe(e))}function jm(e){return e==null?[]:wi(e,Ue(e))}function ya(e,t,n){var s=e==null?i:an(e,t);return s===i?n:s}function Qm(e,t){return e!=null&&Vu(e,t,Sh)}function xa(e,t){return e!=null&&Vu(e,t,bh)}var e_=Du(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ui.call(t)),e[t]=n},Sa(Ge)),t_=Du(function(e,t,n){t!=null&&typeof t.toString!="function"&&(t=ui.call(t)),ue.call(e,t)?e[t].push(n):e[t]=[n]},q),n_=ee(gr);function Oe(e){return Ze(e)?eu(e):Hs(e)}function Ue(e){return Ze(e)?eu(e,!0):Nh(e)}function r_(e,t){var n={};return t=q(t,3),vt(e,function(s,u,d){Tt(n,t(s,u,d),s)}),n}function i_(e,t){var n={};return t=q(t,3),vt(e,function(s,u,d){Tt(n,u,t(s,u,d))}),n}var s_=On(function(e,t,n){Si(e,t,n)}),Ic=On(function(e,t,n,s){Si(e,t,n,s)}),a_=Rt(function(e,t){var n={};if(e==null)return n;var s=!1;t=ge(t,function(d){return d=zt(d,e),s||(s=d.length>1),d}),yt(e,sa(e),n),s&&(n=nt(n,M|ne|K,ep));for(var u=t.length;u--;)Js(n,t[u]);return n});function o_(e,t){return Ac(e,Bi(q(t)))}var u_=Rt(function(e,t){return e==null?{}:Ph(e,t)});function Ac(e,t){if(e==null)return{};var n=ge(sa(e),function(s){return[s]});return t=q(t),_u(e,n,function(s,u){return t(s,u[0])})}function c_(e,t,n){t=zt(t,e);var s=-1,u=t.length;for(u||(u=1,e=i);++s<u;){var d=e==null?i:e[xt(t[s])];d===i&&(s=u,d=n),e=Et(d)?d.call(e):d}return e}function l_(e,t,n){return e==null?e:_r(e,t,n)}function f_(e,t,n,s){return s=typeof s=="function"?s:i,e==null?e:_r(e,t,n,s)}var Tc=Wu(Oe),Oc=Wu(Ue);function d_(e,t,n){var s=$(e),u=s||Yt(e)||En(e);if(t=q(t,4),n==null){var d=e&&e.constructor;u?n=s?new d:[]:me(e)?n=Et(d)?Tn(fi(e)):{}:n={}}return(u?Qe:vt)(e,function(h,g,v){return t(n,h,g,v)}),n}function h_(e,t){return e==null?!0:Js(e,t)}function p_(e,t,n){return e==null?e:Su(e,t,ea(n))}function g_(e,t,n,s){return s=typeof s=="function"?s:i,e==null?e:Su(e,t,ea(n),s)}function Ln(e){return e==null?[]:Ls(e,Oe(e))}function m_(e){return e==null?[]:Ls(e,Ue(e))}function __(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=st(n),n=n===n?n:0),t!==i&&(t=st(t),t=t===t?t:0),sn(st(e),t,n)}function v_(e,t,n){return t=Lt(t),n===i?(n=t,t=0):n=Lt(n),e=st(e),Ch(e,t,n)}function y_(e,t,n){if(n&&typeof n!="boolean"&&De(e,t,n)&&(t=n=i),n===i&&(typeof t=="boolean"?(n=t,t=i):typeof e=="boolean"&&(n=e,e=i)),e===i&&t===i?(e=0,t=1):(e=Lt(e),t===i?(t=e,e=0):t=Lt(t)),e>t){var s=e;e=t,t=s}if(n||e%1||t%1){var u=jo();return Le(e+u*(t-e+Jf("1e-"+((u+"").length-1))),t)}return Ys(e,t)}var x_=Rn(function(e,t,n){return t=t.toLowerCase(),e+(n?Rc(t):t)});function Rc(e){return wa(oe(e).toLowerCase())}function kc(e){return e=oe(e),e&&e.replace(Sf,ld).replace(Zf,"")}function w_(e,t,n){e=oe(e),t=ze(t);var s=e.length;n=n===i?s:sn(X(n),0,s);var u=n;return n-=t.length,n>=0&&e.slice(n,u)==t}function S_(e){return e=oe(e),e&&tf.test(e)?e.replace(ao,fd):e}function b_(e){return e=oe(e),e&&uf.test(e)?e.replace(ms,"\\$&"):e}var C_=Rn(function(e,t,n){return e+(n?"-":"")+t.toLowerCase()}),I_=Rn(function(e,t,n){return e+(n?" ":"")+t.toLowerCase()}),A_=Nu("toLowerCase");function T_(e,t,n){e=oe(e),t=X(t);var s=t?Sn(e):0;if(!t||s>=t)return e;var u=(t-s)/2;return Oi(gi(u),n)+e+Oi(pi(u),n)}function O_(e,t,n){e=oe(e),t=X(t);var s=t?Sn(e):0;return t&&s<t?e+Oi(t-s,n):e}function R_(e,t,n){e=oe(e),t=X(t);var s=t?Sn(e):0;return t&&s<t?Oi(t-s,n)+e:e}function k_(e,t,n){return n||t==null?t=0:t&&(t=+t),Bd(oe(e).replace(_s,""),t||0)}function E_(e,t,n){return(n?De(e,t,n):t===i)?t=1:t=X(t),Ks(oe(e),t)}function L_(){var e=arguments,t=oe(e[0]);return e.length<3?t:t.replace(e[1],e[2])}var N_=Rn(function(e,t,n){return e+(n?"_":"")+t.toLowerCase()});function M_(e,t,n){return n&&typeof n!="number"&&De(e,t,n)&&(t=n=i),n=n===i?_t:n>>>0,n?(e=oe(e),e&&(typeof t=="string"||t!=null&&!va(t))&&(t=ze(t),!t&&wn(e))?$t(lt(e),0,n):e.split(t,n)):[]}var P_=Rn(function(e,t,n){return e+(n?" ":"")+wa(t)});function D_(e,t,n){return e=oe(e),n=n==null?0:sn(X(n),0,e.length),t=ze(t),e.slice(n,n+t.length)==t}function B_(e,t,n){var s=l.templateSettings;n&&De(e,t,n)&&(t=i),e=oe(e),t=qi({},t,s,qu);var u=qi({},t.imports,s.imports,qu),d=Oe(u),h=Ls(u,d),g,v,b=0,C=t.interpolate||Qr,T="__p += '",E=Ms((t.escape||Qr).source+"|"+C.source+"|"+(C===oo?mf:Qr).source+"|"+(t.evaluate||Qr).source+"|$","g"),B="//# sourceURL="+(ue.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++zf+"]")+`
4
+ `;e.replace(E,function(U,te,ie,Ye,Be,Ke){return ie||(ie=Ye),T+=e.slice(b,Ke).replace(bf,dd),te&&(g=!0,T+=`' +
5
+ __e(`+te+`) +
6
+ '`),Be&&(v=!0,T+=`';
7
+ `+Be+`;
8
+ __p += '`),ie&&(T+=`' +
9
+ ((__t = (`+ie+`)) == null ? '' : __t) +
10
+ '`),b=Ke+U.length,U}),T+=`';
11
+ `;var Z=ue.call(t,"variable")&&t.variable;if(!Z)T=`with (obj) {
12
+ `+T+`
13
+ }
14
+ `;else if(pf.test(Z))throw new z(_);T=(v?T.replace(Jl,""):T).replace(jl,"$1").replace(Ql,"$1;"),T="function("+(Z||"obj")+`) {
15
+ `+(Z?"":`obj || (obj = {});
16
+ `)+"var __t, __p = ''"+(g?", __e = _.escape":"")+(v?`, __j = Array.prototype.join;
17
+ function print() { __p += __j.call(arguments, '') }
18
+ `:`;
19
+ `)+T+`return __p
20
+ }`;var j=Lc(function(){return ae(d,B+"return "+T).apply(i,h)});if(j.source=T,_a(j))throw j;return j}function F_(e){return oe(e).toLowerCase()}function W_(e){return oe(e).toUpperCase()}function q_(e,t,n){if(e=oe(e),e&&(n||t===i))return Zo(e);if(!e||!(t=ze(t)))return e;var s=lt(e),u=lt(t),d=Uo(s,u),h=Go(s,u)+1;return $t(s,d,h).join("")}function Z_(e,t,n){if(e=oe(e),e&&(n||t===i))return e.slice(0,Ho(e)+1);if(!e||!(t=ze(t)))return e;var s=lt(e),u=Go(s,lt(t))+1;return $t(s,0,u).join("")}function U_(e,t,n){if(e=oe(e),e&&(n||t===i))return e.replace(_s,"");if(!e||!(t=ze(t)))return e;var s=lt(e),u=Uo(s,lt(t));return $t(s,u).join("")}function G_(e,t){var n=Pl,s=Dl;if(me(t)){var u="separator"in t?t.separator:u;n="length"in t?X(t.length):n,s="omission"in t?ze(t.omission):s}e=oe(e);var d=e.length;if(wn(e)){var h=lt(e);d=h.length}if(n>=d)return e;var g=n-Sn(s);if(g<1)return s;var v=h?$t(h,0,g).join(""):e.slice(0,g);if(u===i)return v+s;if(h&&(g+=v.length-g),va(u)){if(e.slice(g).search(u)){var b,C=v;for(u.global||(u=Ms(u.source,oe(uo.exec(u))+"g")),u.lastIndex=0;b=u.exec(C);)var T=b.index;v=v.slice(0,T===i?g:T)}}else if(e.indexOf(ze(u),g)!=g){var E=v.lastIndexOf(u);E>-1&&(v=v.slice(0,E))}return v+s}function V_(e){return e=oe(e),e&&ef.test(e)?e.replace(so,yd):e}var H_=Rn(function(e,t,n){return e+(n?" ":"")+t.toUpperCase()}),wa=Nu("toUpperCase");function Ec(e,t,n){return e=oe(e),t=n?i:t,t===i?pd(e)?Sd(e):sd(e):e.match(t)||[]}var Lc=ee(function(e,t){try{return Ve(e,i,t)}catch(n){return _a(n)?n:new z(n)}}),z_=Rt(function(e,t){return Qe(t,function(n){n=xt(n),Tt(e,n,ga(e[n],e))}),e});function $_(e){var t=e==null?0:e.length,n=q();return e=t?ge(e,function(s){if(typeof s[1]!="function")throw new et(p);return[n(s[0]),s[1]]}):[],ee(function(s){for(var u=-1;++u<t;){var d=e[u];if(Ve(d[0],this,s))return Ve(d[1],this,s)}})}function Y_(e){return yh(nt(e,M))}function Sa(e){return function(){return e}}function K_(e,t){return e==null||e!==e?t:e}var X_=Pu(),J_=Pu(!0);function Ge(e){return e}function ba(e){return fu(typeof e=="function"?e:nt(e,M))}function j_(e){return hu(nt(e,M))}function Q_(e,t){return pu(e,nt(t,M))}var ev=ee(function(e,t){return function(n){return gr(n,e,t)}}),tv=ee(function(e,t){return function(n){return gr(e,n,t)}});function Ca(e,t,n){var s=Oe(t),u=wi(t,s);n==null&&!(me(t)&&(u.length||!s.length))&&(n=t,t=e,e=this,u=wi(t,Oe(t)));var d=!(me(n)&&"chain"in n)||!!n.chain,h=Et(e);return Qe(u,function(g){var v=t[g];e[g]=v,h&&(e.prototype[g]=function(){var b=this.__chain__;if(d||b){var C=e(this.__wrapped__),T=C.__actions__=qe(this.__actions__);return T.push({func:v,args:arguments,thisArg:e}),C.__chain__=b,C}return v.apply(e,Zt([this.value()],arguments))})}),e}function nv(){return ke._===this&&(ke._=Od),this}function Ia(){}function rv(e){return e=X(e),ee(function(t){return gu(t,e)})}var iv=na(ge),sv=na(Do),av=na(Ts);function Nc(e){return ca(e)?Os(xt(e)):Dh(e)}function ov(e){return function(t){return e==null?i:an(e,t)}}var uv=Bu(),cv=Bu(!0);function Aa(){return[]}function Ta(){return!1}function lv(){return{}}function fv(){return""}function dv(){return!0}function hv(e,t){if(e=X(e),e<1||e>Wt)return[];var n=_t,s=Le(e,_t);t=q(t),e-=_t;for(var u=Es(s,t);++n<e;)t(n);return u}function pv(e){return $(e)?ge(e,xt):$e(e)?[e]:qe(Qu(oe(e)))}function gv(e){var t=++Ad;return oe(e)+t}var mv=Ti(function(e,t){return e+t},0),_v=ra("ceil"),vv=Ti(function(e,t){return e/t},1),yv=ra("floor");function xv(e){return e&&e.length?xi(e,Ge,Us):i}function wv(e,t){return e&&e.length?xi(e,q(t,2),Us):i}function Sv(e){return Wo(e,Ge)}function bv(e,t){return Wo(e,q(t,2))}function Cv(e){return e&&e.length?xi(e,Ge,zs):i}function Iv(e,t){return e&&e.length?xi(e,q(t,2),zs):i}var Av=Ti(function(e,t){return e*t},1),Tv=ra("round"),Ov=Ti(function(e,t){return e-t},0);function Rv(e){return e&&e.length?ks(e,Ge):0}function kv(e,t){return e&&e.length?ks(e,q(t,2)):0}return l.after=jg,l.ary=lc,l.assign=Wm,l.assignIn=Cc,l.assignInWith=qi,l.assignWith=qm,l.at=Zm,l.before=fc,l.bind=ga,l.bindAll=z_,l.bindKey=dc,l.castArray=lm,l.chain=oc,l.chunk=yp,l.compact=xp,l.concat=wp,l.cond=$_,l.conforms=Y_,l.constant=Sa,l.countBy=Rg,l.create=Um,l.curry=hc,l.curryRight=pc,l.debounce=gc,l.defaults=Gm,l.defaultsDeep=Vm,l.defer=Qg,l.delay=em,l.difference=Sp,l.differenceBy=bp,l.differenceWith=Cp,l.drop=Ip,l.dropRight=Ap,l.dropRightWhile=Tp,l.dropWhile=Op,l.fill=Rp,l.filter=Eg,l.flatMap=Mg,l.flatMapDeep=Pg,l.flatMapDepth=Dg,l.flatten=rc,l.flattenDeep=kp,l.flattenDepth=Ep,l.flip=tm,l.flow=X_,l.flowRight=J_,l.fromPairs=Lp,l.functions=Jm,l.functionsIn=jm,l.groupBy=Bg,l.initial=Mp,l.intersection=Pp,l.intersectionBy=Dp,l.intersectionWith=Bp,l.invert=e_,l.invertBy=t_,l.invokeMap=Wg,l.iteratee=ba,l.keyBy=qg,l.keys=Oe,l.keysIn=Ue,l.map=Mi,l.mapKeys=r_,l.mapValues=i_,l.matches=j_,l.matchesProperty=Q_,l.memoize=Di,l.merge=s_,l.mergeWith=Ic,l.method=ev,l.methodOf=tv,l.mixin=Ca,l.negate=Bi,l.nthArg=rv,l.omit=a_,l.omitBy=o_,l.once=nm,l.orderBy=Zg,l.over=iv,l.overArgs=rm,l.overEvery=sv,l.overSome=av,l.partial=ma,l.partialRight=mc,l.partition=Ug,l.pick=u_,l.pickBy=Ac,l.property=Nc,l.propertyOf=ov,l.pull=Zp,l.pullAll=sc,l.pullAllBy=Up,l.pullAllWith=Gp,l.pullAt=Vp,l.range=uv,l.rangeRight=cv,l.rearg=im,l.reject=Hg,l.remove=Hp,l.rest=sm,l.reverse=ha,l.sampleSize=$g,l.set=l_,l.setWith=f_,l.shuffle=Yg,l.slice=zp,l.sortBy=Jg,l.sortedUniq=Qp,l.sortedUniqBy=eg,l.split=M_,l.spread=am,l.tail=tg,l.take=ng,l.takeRight=rg,l.takeRightWhile=ig,l.takeWhile=sg,l.tap=xg,l.throttle=om,l.thru=Ni,l.toArray=wc,l.toPairs=Tc,l.toPairsIn=Oc,l.toPath=pv,l.toPlainObject=bc,l.transform=d_,l.unary=um,l.union=ag,l.unionBy=og,l.unionWith=ug,l.uniq=cg,l.uniqBy=lg,l.uniqWith=fg,l.unset=h_,l.unzip=pa,l.unzipWith=ac,l.update=p_,l.updateWith=g_,l.values=Ln,l.valuesIn=m_,l.without=dg,l.words=Ec,l.wrap=cm,l.xor=hg,l.xorBy=pg,l.xorWith=gg,l.zip=mg,l.zipObject=_g,l.zipObjectDeep=vg,l.zipWith=yg,l.entries=Tc,l.entriesIn=Oc,l.extend=Cc,l.extendWith=qi,Ca(l,l),l.add=mv,l.attempt=Lc,l.camelCase=x_,l.capitalize=Rc,l.ceil=_v,l.clamp=__,l.clone=fm,l.cloneDeep=hm,l.cloneDeepWith=pm,l.cloneWith=dm,l.conformsTo=gm,l.deburr=kc,l.defaultTo=K_,l.divide=vv,l.endsWith=w_,l.eq=dt,l.escape=S_,l.escapeRegExp=b_,l.every=kg,l.find=Lg,l.findIndex=tc,l.findKey=Hm,l.findLast=Ng,l.findLastIndex=nc,l.findLastKey=zm,l.floor=yv,l.forEach=uc,l.forEachRight=cc,l.forIn=$m,l.forInRight=Ym,l.forOwn=Km,l.forOwnRight=Xm,l.get=ya,l.gt=mm,l.gte=_m,l.has=Qm,l.hasIn=xa,l.head=ic,l.identity=Ge,l.includes=Fg,l.indexOf=Np,l.inRange=v_,l.invoke=n_,l.isArguments=cn,l.isArray=$,l.isArrayBuffer=vm,l.isArrayLike=Ze,l.isArrayLikeObject=Se,l.isBoolean=ym,l.isBuffer=Yt,l.isDate=xm,l.isElement=wm,l.isEmpty=Sm,l.isEqual=bm,l.isEqualWith=Cm,l.isError=_a,l.isFinite=Im,l.isFunction=Et,l.isInteger=_c,l.isLength=Fi,l.isMap=vc,l.isMatch=Am,l.isMatchWith=Tm,l.isNaN=Om,l.isNative=Rm,l.isNil=Em,l.isNull=km,l.isNumber=yc,l.isObject=me,l.isObjectLike=ye,l.isPlainObject=wr,l.isRegExp=va,l.isSafeInteger=Lm,l.isSet=xc,l.isString=Wi,l.isSymbol=$e,l.isTypedArray=En,l.isUndefined=Nm,l.isWeakMap=Mm,l.isWeakSet=Pm,l.join=Fp,l.kebabCase=C_,l.last=it,l.lastIndexOf=Wp,l.lowerCase=I_,l.lowerFirst=A_,l.lt=Dm,l.lte=Bm,l.max=xv,l.maxBy=wv,l.mean=Sv,l.meanBy=bv,l.min=Cv,l.minBy=Iv,l.stubArray=Aa,l.stubFalse=Ta,l.stubObject=lv,l.stubString=fv,l.stubTrue=dv,l.multiply=Av,l.nth=qp,l.noConflict=nv,l.noop=Ia,l.now=Pi,l.pad=T_,l.padEnd=O_,l.padStart=R_,l.parseInt=k_,l.random=y_,l.reduce=Gg,l.reduceRight=Vg,l.repeat=E_,l.replace=L_,l.result=c_,l.round=Tv,l.runInContext=m,l.sample=zg,l.size=Kg,l.snakeCase=N_,l.some=Xg,l.sortedIndex=$p,l.sortedIndexBy=Yp,l.sortedIndexOf=Kp,l.sortedLastIndex=Xp,l.sortedLastIndexBy=Jp,l.sortedLastIndexOf=jp,l.startCase=P_,l.startsWith=D_,l.subtract=Ov,l.sum=Rv,l.sumBy=kv,l.template=B_,l.times=hv,l.toFinite=Lt,l.toInteger=X,l.toLength=Sc,l.toLower=F_,l.toNumber=st,l.toSafeInteger=Fm,l.toString=oe,l.toUpper=W_,l.trim=q_,l.trimEnd=Z_,l.trimStart=U_,l.truncate=G_,l.unescape=V_,l.uniqueId=gv,l.upperCase=H_,l.upperFirst=wa,l.each=uc,l.eachRight=cc,l.first=ic,Ca(l,(function(){var e={};return vt(l,function(t,n){ue.call(l.prototype,n)||(e[n]=t)}),e})(),{chain:!1}),l.VERSION=o,Qe(["bind","bindKey","curry","curryRight","partial","partialRight"],function(e){l[e].placeholder=l}),Qe(["drop","take"],function(e,t){re.prototype[e]=function(n){n=n===i?1:Ae(X(n),0);var s=this.__filtered__&&!t?new re(this):this.clone();return s.__filtered__?s.__takeCount__=Le(n,s.__takeCount__):s.__views__.push({size:Le(n,_t),type:e+(s.__dir__<0?"Right":"")}),s},re.prototype[e+"Right"]=function(n){return this.reverse()[e](n).reverse()}}),Qe(["filter","map","takeWhile"],function(e,t){var n=t+1,s=n==no||n==ql;re.prototype[e]=function(u){var d=this.clone();return d.__iteratees__.push({iteratee:q(u,3),type:n}),d.__filtered__=d.__filtered__||s,d}}),Qe(["head","last"],function(e,t){var n="take"+(t?"Right":"");re.prototype[e]=function(){return this[n](1).value()[0]}}),Qe(["initial","tail"],function(e,t){var n="drop"+(t?"":"Right");re.prototype[e]=function(){return this.__filtered__?new re(this):this[n](1)}}),re.prototype.compact=function(){return this.filter(Ge)},re.prototype.find=function(e){return this.filter(e).head()},re.prototype.findLast=function(e){return this.reverse().find(e)},re.prototype.invokeMap=ee(function(e,t){return typeof e=="function"?new re(this):this.map(function(n){return gr(n,e,t)})}),re.prototype.reject=function(e){return this.filter(Bi(q(e)))},re.prototype.slice=function(e,t){e=X(e);var n=this;return n.__filtered__&&(e>0||t<0)?new re(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(t=X(t),n=t<0?n.dropRight(-t):n.take(t-e)),n)},re.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},re.prototype.toArray=function(){return this.take(_t)},vt(re.prototype,function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),s=/^(?:head|last)$/.test(t),u=l[s?"take"+(t=="last"?"Right":""):t],d=s||/^find/.test(t);u&&(l.prototype[t]=function(){var h=this.__wrapped__,g=s?[1]:arguments,v=h instanceof re,b=g[0],C=v||$(h),T=function(te){var ie=u.apply(l,Zt([te],g));return s&&E?ie[0]:ie};C&&n&&typeof b=="function"&&b.length!=1&&(v=C=!1);var E=this.__chain__,B=!!this.__actions__.length,Z=d&&!E,j=v&&!B;if(!d&&C){h=j?h:new re(this);var U=e.apply(h,g);return U.__actions__.push({func:Ni,args:[T],thisArg:i}),new tt(U,E)}return Z&&j?e.apply(this,g):(U=this.thru(T),Z?s?U.value()[0]:U.value():U)})}),Qe(["pop","push","shift","sort","splice","unshift"],function(e){var t=si[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",s=/^(?:pop|shift)$/.test(e);l.prototype[e]=function(){var u=arguments;if(s&&!this.__chain__){var d=this.value();return t.apply($(d)?d:[],u)}return this[n](function(h){return t.apply($(h)?h:[],u)})}}),vt(re.prototype,function(e,t){var n=l[t];if(n){var s=n.name+"";ue.call(An,s)||(An[s]=[]),An[s].push({name:t,func:n})}}),An[Ai(i,Ce).name]=[{name:"wrapper",func:i}],re.prototype.clone=Vd,re.prototype.reverse=Hd,re.prototype.value=zd,l.prototype.at=wg,l.prototype.chain=Sg,l.prototype.commit=bg,l.prototype.next=Cg,l.prototype.plant=Ag,l.prototype.reverse=Tg,l.prototype.toJSON=l.prototype.valueOf=l.prototype.value=Og,l.prototype.first=l.prototype.head,ur&&(l.prototype[ur]=Ig),l}),bn=bd();en?((en.exports=bn)._=bn,bs._=bn):ke._=bn}).call(f0)})(Rr,Rr.exports)),Rr.exports}var Cr={},Kc;function h0(){if(Kc)return Cr;Kc=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.backtrace=void 0;function a(r,i,o){const c=[];let f=o?r:r.getParent();for(;f.getParent();)c.push([f.position.x,f.position.y]),f=f.getParent();return i&&c.push([f.position.x,f.position.y]),c.reverse()}return Cr.backtrace=a,Cr}var Ir={},Xc;function p0(){if(Xc)return Ir;Xc=1,Object.defineProperty(Ir,"__esModule",{value:!0}),Ir.calculateHeuristic=void 0;function a(r,i,o,c){const f=Math.abs(o.x-i.x),p=Math.abs(o.y-i.y);switch(r){case"Manhatten":case"Manhattan":return(f+p)*c;case"Euclidean":return Math.sqrt(f*f+p*p)*c;case"Chebyshev":return Math.max(f,p)*c;case"Octile":return(f+p-.58*Math.min(f,p))*c}}return Ir.calculateHeuristic=a,Ir}var Ar={},Tr={},Jc;function g0(){if(Jc)return Tr;Jc=1,Object.defineProperty(Tr,"__esModule",{value:!0}),Tr.Node=void 0;class a{constructor(i){this.id=i.id,this.position=i.position,this.hValue=0,this.gValue=0,this.fValue=0,this.parentNode=void 0,this.isOnClosedList=!1,this.isOnOpenList=!1,this.isWalkable=i.walkable||!0}calculateFValue(){this.fValue=this.gValue+this.hValue}setGValue(i){this.gValue=i,this.calculateFValue()}setHValue(i){this.hValue=i,this.calculateFValue()}setFGHValuesToZero(){this.fValue=this.gValue=this.hValue=0}getFValue(){return this.fValue}getGValue(){return this.gValue}getHValue(){return this.hValue}getParent(){return this.parentNode}getIsOnClosedList(){return this.isOnClosedList}getIsOnOpenList(){return this.isOnOpenList}getIsWalkable(){return this.isWalkable}setParent(i){this.parentNode=i}setIsOnClosedList(i){this.isOnClosedList=i}setIsOnOpenList(i){this.isOnOpenList=i}setIsWalkable(i){this.isWalkable=i}}return Tr.Node=a,Tr}var jc;function Nl(){if(jc)return Ar;jc=1,Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.Grid=void 0;const a=g0();class r{constructor(o){o.width&&o.height?(this.width=o.width,this.height=o.height,this.numberOfFields=this.width*this.height):o.matrix&&(this.width=o.matrix[0].length,this.height=o.matrix.length,this.numberOfFields=this.width*this.height),this.gridNodes=this.buildGridWithNodes(o.matrix||void 0,this.width,this.height,o.densityOfObstacles||0)}buildGridWithNodes(o,c,f,p){const _=[];let w=0;for(let y=0;y<f;y++){_[y]=[];for(let A=0;A<c;A++)_[y][A]=new a.Node({id:w,position:{x:A,y}}),w++}if(o===void 0){for(let y=0;y<f;y++)for(let A=0;A<c;A++)Math.floor(Math.random()*10)+1>10-p?_[y][A].setIsWalkable(!1):_[y][A].setIsWalkable(!0);return _}for(let y=0;y<f;y++)for(let A=0;A<c;A++)_[y][A].setIsWalkable(!o[y][A]);return _}getNodeAt(o){return this.gridNodes[o.y][o.x]}isWalkableAt(o){return this.gridNodes[o.y][o.x].getIsWalkable()}isOnTheGrid(o){return o.x>=0&&o.x<this.width&&o.y>=0&&o.y<this.height}getSurroundingNodes(o,c){const f=[],p=o.x-1,_=o.x+1,w=o.y-1,y=o.y+1;for(let A=w;A<=y;A++)for(let M=p;M<=_;M++)(M!==o.x||A!==o.y)&&this.isOnTheGrid({x:M,y:A})&&this.isWalkableAt({x:M,y:A})&&(c||M==o.x||A==o.y)&&f.push(this.getNodeAt({x:M,y:A}));return f}setGrid(o){this.gridNodes=o}resetGrid(){for(let o=0;o<this.gridNodes.length;o++)for(let c=0;c<this.gridNodes[o].length;c++)this.gridNodes[o][c].setIsOnClosedList(!1),this.gridNodes[o][c].setIsOnOpenList(!1),this.gridNodes[o][c].setParent(void 0),this.gridNodes[o][c].setFGHValuesToZero()}getGridNodes(){return this.gridNodes}clone(){const o=[];let c=0;for(let f=0;f<this.height;f++){o[f]=[];for(let p=0;p<this.width;p++)o[f][p]=new a.Node({id:c,position:{x:p,y:f},walkable:this.gridNodes[f][p].getIsWalkable()}),c++}return o}}return Ar.Grid=r,Ar}var Qc;function m0(){if(Qc)return br;Qc=1,Object.defineProperty(br,"__esModule",{value:!0}),br.AStarFinder=void 0;const a=d0(),r=h0(),i=p0(),o=Nl();class c{constructor(p){this.grid=new o.Grid({width:p.grid.width,height:p.grid.height,matrix:p.grid.matrix||void 0,densityOfObstacles:p.grid.densityOfObstacles||0}),this.closedList=[],this.openList=[],this.diagonalAllowed=p.diagonalAllowed!==void 0?p.diagonalAllowed:!0,this.heuristic=p.heuristic?p.heuristic:"Manhattan",this.includeStartNode=p.includeStartNode!==void 0?p.includeStartNode:!0,this.includeEndNode=p.includeEndNode!==void 0?p.includeEndNode:!0,this.allowPathAsCloseAsPossible=p.allowPathAsCloseAsPossible||!1,this.weight=p.weight||1}findPath(p,_){this.closedList=[],this.openList=[],this.grid.resetGrid();const w=this.grid.getNodeAt(p),y=this.grid.getNodeAt(_);if(!this.grid.isWalkableAt(_)||!this.grid.isWalkableAt(p))return[];w.setIsOnOpenList(!0),this.openList.push(w);for(let A=0;A<this.grid.height;A++)for(let M=0;M<this.grid.width;M++){let ne=this.grid.getNodeAt({x:M,y:A});this.grid.isWalkableAt({x:M,y:A})?ne.setHValue((0,i.calculateHeuristic)(this.heuristic,ne.position,y.position,this.weight)):(ne.setFGHValuesToZero(),ne.setIsOnClosedList(!0),this.closedList.push(ne))}for(;this.openList.length!==0;){const A=(0,a.minBy)(this.openList,ne=>ne.getFValue());if(A.setIsOnOpenList(!1),(0,a.remove)(this.openList,A),A.setIsOnClosedList(!0),this.closedList.push(A),A===y)return(0,r.backtrace)(y,this.includeStartNode,this.includeEndNode);const M=this.grid.getSurroundingNodes(A.position,this.diagonalAllowed);for(let ne in M){const K=M[ne];if(K.getIsOnClosedList())continue;const J=A.getGValue()+(K.position.x!==A.position.x||K.position.y==A.position.y?this.weight:this.weight*1.41421);(!K.getIsOnOpenList()||J<K.getGValue())&&(K.setGValue(J),K.setParent(A),K.getIsOnOpenList()?K.setParent(A):(K.setIsOnOpenList(!0),this.openList.push(K)))}}return this.allowPathAsCloseAsPossible?(0,r.backtrace)(this.closedList[this.closedList.length-1],this.includeStartNode,!1):[]}setHeuristic(p){this.heuristic=p}setWeight(p){this.weight=p}getGridClone(){return this.grid.clone()}getGrid(){return this.grid}}return br.AStarFinder=c,br}var el;function _0(){return el||(el=1,(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.Grid=a.AStarFinder=void 0;var r=m0();Object.defineProperty(a,"AStarFinder",{enumerable:!0,get:function(){return r.AStarFinder}});var i=Nl();Object.defineProperty(a,"Grid",{enumerable:!0,get:function(){return i.Grid}})})(La)),La}var v0=_0();const y0=a=>a.map(r=>r.map(i=>i)).reverse(),tl=(a,r)=>a.x>=r[0].length||a.y>=r.length||a.x<0||a.y<0;function x0(a,r,i,o){const c=ne=>({x:Math.floor(ne.x/o),y:Math.floor(ne.y/o)}),f=ne=>({x:(ne[0]+.5)*o,y:(ne[1]+.5)*o}),p=y0(i),_=c(a),w=c(r);if(tl(_,p))return[];if(tl(w,p))return[];const A=new v0.AStarFinder({grid:{matrix:p}}).findPath(_,w);return A.length===0?[]:A.map(f)}const w0=a=>({...a,storyBoards:a.storyBoards??[],schemaVersion:3}),S0=a=>Ml(w0(a)),b0=(a,r)=>{const i=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:r??a.id,isEndOfGame:!0,pages:[{title:a.message,narrative:{text:[]},color:"#FFFFFF",backgroundColor:"#000000",pictures:i?[i]:[]}]}},C0=(a,r)=>{const i=r.filter(c=>c.startsWith(a)),o=(c=1)=>{const f=`${a}_${c}`;return i.includes(f)?o(c+1):f};return o()},Ml=a=>{const{storyBoards:r,interactions:i,sequences:o,conversations:c}=a,f=r.map(J=>J.id),p={},_=a.endings.map(J=>{const pe=f.includes(J.id)?C0(J.id,f):void 0;return pe&&f.push(pe),p[J.id]=pe??J.id,b0(J,pe)}),w=J=>J.type!=="ending"?J:{type:"storyBoardConsequence",storyBoardId:p[J.endingId]??J.endingId,narrative:J.narrative},y=J=>({...J,stages:J.stages.map(pe=>({...pe,immediateConsequences:pe.immediateConsequences?.map(w)}))}),A=J=>{const{branches:pe}=J;for(let Te in pe){const Ce=pe[Te];Ce&&(Ce.choices=Ce.choices.map(Ft=>({...Ft,choiceSequence:Ft.choiceSequence?y(Ft.choiceSequence):void 0})))}return{...J,branches:pe}},M=i.map(J=>({...J,consequences:J.consequences.map(w)})),ne=o.map(y),K=c.map(A);return{...a,storyBoards:[...r,..._],interactions:M,sequences:ne,conversations:K,schemaVersion:ss}},I0=a=>{const r=Rl.safeParse(a);if(r.success)return{success:!0,gameDesign:r.data,sourceVersion:ss,updated:!1};const i=kl.safeParse(a);if(i.success)return{success:!0,gameDesign:Ml(i.data),sourceVersion:3,updated:!0};const o=Al.safeParse(a);return o.success?{success:!0,gameDesign:S0(o.data),sourceVersion:2,updated:!0}:{success:!1,failureMessage:o.error.message}};exports.ActOrderSchema=gl;exports.ActorDataSchema=rs;exports.AmbientNoiseConsequenceSchema=Kn;exports.AspectRatioSchema=fl;exports.BackgroundMusicConsequenceSchema=Yn;exports.BoardFontSchema=Il;exports.BoardProgressionSchema=Cl;exports.ChangePlayerCharacterConsequenceSchema=jn;exports.ChangeRoomConsequenceSchema=qn;exports.ChangeStatusConsequenceSchema=Gn;exports.CommandSchema=n0;exports.CommandTargetSchema=El;exports.ConsequenceSchema=ml;exports.ConversationBranchSchema=_l;exports.ConversationChoiceConsequenceSchema=Hn;exports.ConversationChoiceSchema=Ga;exports.ConversationConsequenceSchema=Vn;exports.ConversationSchema=Va;exports.ConversationSchemaWithDeprecatedConsequences=Ya;exports.DB_VERSION=ss;exports.DirectionEnum=Wn;exports.EndingConsequenceSchema=za;exports.EndingSchema=Ha;exports.FixedGameInfoSchema=eo;exports.FlagConsequenceSchema=Xn;exports.FlagMapSchema=Ka;exports.FlagSchema=yl;exports.GameContentsDataSchema=as;exports.GameDataItemTypeEnum=Qy;exports.GameDataSchema=jy;exports.GameDesignSchema=Rl;exports.GameHappeningsSchema=Ol;exports.GotoOrderSchema=hl;exports.HotspotZoneSchema=Xa;exports.IdentSchema=Ji;exports.ImmediateConsequenceSchema=Za;exports.ImmediateConsequenceSchemaWithDeprecated=vl;exports.InteractionSchema=ts;exports.InteractionSchemaWithDeprecatedConsequences=$a;exports.InventoryConsequenceSchema=Zn;exports.ItemDataSchema=$r;exports.MoveOrderSchema=dl;exports.NarrativeSchema=xe;exports.OrderConsequenceSchema=Qi;exports.PositionSchema=ll;exports.RemoveActorConsequenceSchema=Un;exports.RoomDataSchema=Ja;exports.SayOrderSchema=pl;exports.SequenceConsequenceSchema=es;exports.SequenceSchema=zr;exports.SequenceSchemaWithDeprecatedConsequences=ns;exports.SoundEffectConsequenceSchema=$n;exports.SoundValueSchema=Ba;exports.SpriteDataSchema=ja;exports.SpriteFrameSchema=Or;exports.SpriteParamsSchema=cl;exports.StageSchema=Ua;exports.StaticFrameParamsSchema=Gr;exports.StoryBoardConsequenceSchema=Jn;exports.StoryBoardPageSchema=bl;exports.StoryBoardSchema=Qa;exports.TeleportActorConsequenceSchema=zn;exports.ToggleZoneConsequenceSchema=mn;exports.VerbSchema=is;exports.ZoneSchema=Fa;exports.cellMatrixSchema=Tl;exports.changeHistory=Ev;exports.consequenceMap=Fy;exports.consequenceTypes=By;exports.directions=ky;exports.findPath=x0;exports.generateCellMatrix=l0;exports.immediateConsequenceTypes=Wy;exports.orderBaseOmits=Ey;exports.orderSchema=Hr;exports.orderTypes=My;exports.parseAndUpgrade=I0;exports.soundInstanceSchema=Yi;exports.v2GameDesignSchema=Al;exports.v3GameDesignSchema=kl;exports.xPlacement=wl;exports.yPlacement=Sl;exports.zoneTypes=Py;