@reservamos/browser-analytics 1.0.12 → 1.0.14

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,4 +1,4 @@
1
- "use strict";var e,i,o;(i=e||(e={})).assertEqual=e=>e,i.assertIs=function assertIs(e){},i.assertNever=function assertNever(e){throw new Error},i.arrayToEnum=e=>{const i={};for(const o of e)i[o]=o;return i},i.getValidEnumValues=e=>{const o=i.objectKeys(e).filter((i=>"number"!=typeof e[e[i]])),s={};for(const i of o)s[i]=e[i];return i.objectValues(s)},i.objectValues=e=>i.objectKeys(e).map((function(i){return e[i]})),i.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const i=[];for(const o in e)Object.prototype.hasOwnProperty.call(e,o)&&i.push(o);return i},i.find=(e,i)=>{for(const o of e)if(i(o))return o},i.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,i.joinValues=function joinValues(e,i=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(i)},i.jsonStringifyReplacer=(e,i)=>"bigint"==typeof i?i.toString():i,(o||(o={})).mergeShapes=(e,i)=>({...e,...i});const s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},a=e.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 ZodError extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const i=e||function(e){return e.message},o={_errors:[]},processError=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(processError);else if("invalid_return_type"===s.code)processError(s.returnTypeError);else if("invalid_arguments"===s.code)processError(s.argumentsError);else if(0===s.path.length)o._errors.push(i(s));else{let e=o,a=0;for(;a<s.path.length;){const o=s.path[a];a===s.path.length-1?(e[o]=e[o]||{_errors:[]},e[o]._errors.push(i(s))):e[o]=e[o]||{_errors:[]},e=e[o],a++}}};return processError(this),o}static assert(e){if(!(e instanceof ZodError))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const i={},o=[];for(const s of this.issues)s.path.length>0?(i[s.path[0]]=i[s.path[0]]||[],i[s.path[0]].push(e(s))):o.push(e(s));return{formErrors:o,fieldErrors:i}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(i,o)=>{let h;switch(i.code){case a.invalid_type:h=i.received===s.undefined?"Required":`Expected ${i.expected}, received ${i.received}`;break;case a.invalid_literal:h=`Invalid literal value, expected ${JSON.stringify(i.expected,e.jsonStringifyReplacer)}`;break;case a.unrecognized_keys:h=`Unrecognized key(s) in object: ${e.joinValues(i.keys,", ")}`;break;case a.invalid_union:h="Invalid input";break;case a.invalid_union_discriminator:h=`Invalid discriminator value. Expected ${e.joinValues(i.options)}`;break;case a.invalid_enum_value:h=`Invalid enum value. Expected ${e.joinValues(i.options)}, received '${i.received}'`;break;case a.invalid_arguments:h="Invalid function arguments";break;case a.invalid_return_type:h="Invalid function return type";break;case a.invalid_date:h="Invalid date";break;case a.invalid_string:"object"==typeof i.validation?"includes"in i.validation?(h=`Invalid input: must include "${i.validation.includes}"`,"number"==typeof i.validation.position&&(h=`${h} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?h=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?h=`Invalid input: must end with "${i.validation.endsWith}"`:e.assertNever(i.validation):h="regex"!==i.validation?`Invalid ${i.validation}`:"Invalid";break;case a.too_small:h="array"===i.type?`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`:"string"===i.type?`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`:"number"===i.type?`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:"date"===i.type?`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`:"Invalid input";break;case a.too_big:h="array"===i.type?`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`:"string"===i.type?`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`:"number"===i.type?`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:"bigint"===i.type?`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:"date"===i.type?`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`:"Invalid input";break;case a.custom:h="Invalid input";break;case a.invalid_intersection_types:h="Intersection results could not be merged";break;case a.not_multiple_of:h=`Number must be a multiple of ${i.multipleOf}`;break;case a.not_finite:h="Number must be finite";break;default:h=o.defaultError,e.assertNever(i)}return{message:h}};let h=errorMap;function getErrorMap(){return h}const makeIssue=e=>{const{data:i,path:o,errorMaps:s,issueData:a}=e,h=[...o,...a.path||[]],f={...a,path:h};if(void 0!==a.message)return{...a,path:h,message:a.message};let g="";const _=s.filter((e=>!!e)).slice().reverse();for(const v of _)g=v(f,{data:i,defaultError:g}).message;return{...a,path:h,message:g}};function addIssueToContext(e,i){const o=getErrorMap(),s=makeIssue({issueData:i,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,o,o===errorMap?void 0:errorMap].filter((e=>!!e))});e.common.issues.push(s)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,i){const o=[];for(const s of i){if("aborted"===s.status)return f;"dirty"===s.status&&e.dirty(),o.push(s.value)}return{status:e.value,value:o}}static async mergeObjectAsync(e,i){const o=[];for(const s of i){const e=await s.key,i=await s.value;o.push({key:e,value:i})}return ParseStatus.mergeObjectSync(e,o)}static mergeObjectSync(e,i){const o={};for(const s of i){const{key:i,value:a}=s;if("aborted"===i.status)return f;if("aborted"===a.status)return f;"dirty"===i.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===i.value||void 0===a.value&&!s.alwaysSet||(o[i.value]=a.value)}return{status:e.value,value:o}}}const f=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;function __classPrivateFieldGet(e,i,o,s){if("function"==typeof i?e!==i||!s:!i.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i.get(e)}function __classPrivateFieldSet(e,i,o,s,a){if("function"==typeof i?e!==i||!a:!i.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i.set(e,o),o}var g,_,v,b;"function"==typeof SuppressedError&&SuppressedError,(_=g||(g={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},_.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,i,o,s){this._cachedPath=[],this.parent=e,this.data=i,this._path=o,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,i)=>{if(isValid(i))return{success:!0,data:i.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const i=new ZodError(e.common.issues);return this._error=i,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:i,invalid_type_error:o,required_error:s,description:a}=e;if(i&&(o||s))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(i)return{errorMap:i,description:a};return{errorMap:(i,a)=>{var h,f;const{message:g}=e;return"invalid_enum_value"===i.code?{message:null!=g?g:a.defaultError}:void 0===a.data?{message:null!==(h=null!=g?g:s)&&void 0!==h?h:a.defaultError}:"invalid_type"!==i.code?{message:a.defaultError}:{message:null!==(f=null!=g?g:o)&&void 0!==f?f:a.defaultError}},description:a}}class ZodType{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,i){return i||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const i=this._parse(e);if(isAsync(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(e){const i=this._parse(e);return Promise.resolve(i)}parse(e,i){const o=this.safeParse(e,i);if(o.success)return o.data;throw o.error}safeParse(e,i){var o;const s={common:{issues:[],async:null!==(o=null==i?void 0:i.async)&&void 0!==o&&o,contextualErrorMap:null==i?void 0:i.errorMap},path:(null==i?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},a=this._parseSync({data:e,path:s.path,parent:s});return handleResult(s,a)}async parseAsync(e,i){const o=await this.safeParseAsync(e,i);if(o.success)return o.data;throw o.error}async safeParseAsync(e,i){const o={common:{issues:[],contextualErrorMap:null==i?void 0:i.errorMap,async:!0},path:(null==i?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},s=this._parse({data:e,path:o.path,parent:o}),a=await(isAsync(s)?s:Promise.resolve(s));return handleResult(o,a)}refine(e,i){const getIssueProperties=e=>"string"==typeof i||void 0===i?{message:i}:"function"==typeof i?i(e):i;return this._refinement(((i,o)=>{const s=e(i),setError=()=>o.addIssue({code:a.custom,...getIssueProperties(i)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(setError(),!1))):!!s||(setError(),!1)}))}refinement(e,i){return this._refinement(((o,s)=>!!e(o)||(s.addIssue("function"==typeof i?i(o,s):i),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:B.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const i="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:i,typeName:B.ZodDefault})}brand(){return new ZodBranded({typeName:B.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const i="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:i,typeName:B.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const S=/^c[^\s-]{8,}$/i,I=/^[0-9a-z]+$/,x=/^[0-9A-HJKMNP-TV-Z]{26}$/,T=/^[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,O=/^[a-z0-9_-]{21}$/i,R=/^[-+]?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)?)??$/,N=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let P;const D=/^(?:(?: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])$/,Z=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,A=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,L="((\\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])))",j=new RegExp(`^${L}$`);function timeRegexSource(e){let i="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?i=`${i}\\.\\d{${e.precision}}`:null==e.precision&&(i=`${i}(\\.\\d+)?`),i}function datetimeRegex(e){let i=`${L}T${timeRegexSource(e)}`;const o=[];return o.push(e.local?"Z?":"Z"),e.offset&&o.push("([+-]\\d{2}:?\\d{2})"),i=`${i}(${o.join("|")})`,new RegExp(`^${i}$`)}class ZodString extends ZodType{_parse(i){this._def.coerce&&(i.data=String(i.data));if(this._getType(i)!==s.string){const e=this._getOrReturnCtx(i);return addIssueToContext(e,{code:a.invalid_type,expected:s.string,received:e.parsedType}),f}const o=new ParseStatus;let h;for(const s of this._def.checks)if("min"===s.kind)i.data.length<s.value&&(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{code:a.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if("max"===s.kind)i.data.length>s.value&&(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{code:a.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),o.dirty());else if("length"===s.kind){const e=i.data.length>s.value,f=i.data.length<s.value;(e||f)&&(h=this._getOrReturnCtx(i,h),e?addIssueToContext(h,{code:a.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):f&&addIssueToContext(h,{code:a.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),o.dirty())}else if("email"===s.kind)N.test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"email",code:a.invalid_string,message:s.message}),o.dirty());else if("emoji"===s.kind)P||(P=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),P.test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"emoji",code:a.invalid_string,message:s.message}),o.dirty());else if("uuid"===s.kind)T.test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"uuid",code:a.invalid_string,message:s.message}),o.dirty());else if("nanoid"===s.kind)O.test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"nanoid",code:a.invalid_string,message:s.message}),o.dirty());else if("cuid"===s.kind)S.test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"cuid",code:a.invalid_string,message:s.message}),o.dirty());else if("cuid2"===s.kind)I.test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"cuid2",code:a.invalid_string,message:s.message}),o.dirty());else if("ulid"===s.kind)x.test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"ulid",code:a.invalid_string,message:s.message}),o.dirty());else if("url"===s.kind)try{new URL(i.data)}catch(v){h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"url",code:a.invalid_string,message:s.message}),o.dirty()}else if("regex"===s.kind){s.regex.lastIndex=0;s.regex.test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"regex",code:a.invalid_string,message:s.message}),o.dirty())}else if("trim"===s.kind)i.data=i.data.trim();else if("includes"===s.kind)i.data.includes(s.value,s.position)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{code:a.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),o.dirty());else if("toLowerCase"===s.kind)i.data=i.data.toLowerCase();else if("toUpperCase"===s.kind)i.data=i.data.toUpperCase();else if("startsWith"===s.kind)i.data.startsWith(s.value)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{code:a.invalid_string,validation:{startsWith:s.value},message:s.message}),o.dirty());else if("endsWith"===s.kind)i.data.endsWith(s.value)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{code:a.invalid_string,validation:{endsWith:s.value},message:s.message}),o.dirty());else if("datetime"===s.kind){datetimeRegex(s).test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{code:a.invalid_string,validation:"datetime",message:s.message}),o.dirty())}else if("date"===s.kind){j.test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{code:a.invalid_string,validation:"date",message:s.message}),o.dirty())}else if("time"===s.kind){new RegExp(`^${timeRegexSource(s)}$`).test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{code:a.invalid_string,validation:"time",message:s.message}),o.dirty())}else"duration"===s.kind?R.test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"duration",code:a.invalid_string,message:s.message}),o.dirty()):"ip"===s.kind?(g=i.data,("v4"!==(_=s.version)&&_||!D.test(g))&&("v6"!==_&&_||!Z.test(g))&&(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"ip",code:a.invalid_string,message:s.message}),o.dirty())):"base64"===s.kind?A.test(i.data)||(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{validation:"base64",code:a.invalid_string,message:s.message}),o.dirty()):e.assertNever(s);var g,_;return{status:o.value,value:i.data}}_regex(e,i,o){return this.refinement((i=>e.test(i)),{validation:i,code:a.invalid_string,...g.errToObj(o)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...g.errToObj(e)})}url(e){return this._addCheck({kind:"url",...g.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...g.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...g.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...g.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...g.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...g.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...g.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...g.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...g.errToObj(e)})}datetime(e){var i,o;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(i=null==e?void 0:e.offset)&&void 0!==i&&i,local:null!==(o=null==e?void 0:e.local)&&void 0!==o&&o,...g.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,...g.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...g.errToObj(e)})}regex(e,i){return this._addCheck({kind:"regex",regex:e,...g.errToObj(i)})}includes(e,i){return this._addCheck({kind:"includes",value:e,position:null==i?void 0:i.position,...g.errToObj(null==i?void 0:i.message)})}startsWith(e,i){return this._addCheck({kind:"startsWith",value:e,...g.errToObj(i)})}endsWith(e,i){return this._addCheck({kind:"endsWith",value:e,...g.errToObj(i)})}min(e,i){return this._addCheck({kind:"min",value:e,...g.errToObj(i)})}max(e,i){return this._addCheck({kind:"max",value:e,...g.errToObj(i)})}length(e,i){return this._addCheck({kind:"length",value:e,...g.errToObj(i)})}nonempty(e){return this.min(1,g.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const i of this._def.checks)"min"===i.kind&&(null===e||i.value>e)&&(e=i.value);return e}get maxLength(){let e=null;for(const i of this._def.checks)"max"===i.kind&&(null===e||i.value<e)&&(e=i.value);return e}}function floatSafeRemainder(e,i){const o=(e.toString().split(".")[1]||"").length,s=(i.toString().split(".")[1]||"").length,a=o>s?o:s;return parseInt(e.toFixed(a).replace(".",""))%parseInt(i.toFixed(a).replace(".",""))/Math.pow(10,a)}ZodString.create=e=>{var i;return new ZodString({checks:[],typeName:B.ZodString,coerce:null!==(i=null==e?void 0:e.coerce)&&void 0!==i&&i,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(i){this._def.coerce&&(i.data=Number(i.data));if(this._getType(i)!==s.number){const e=this._getOrReturnCtx(i);return addIssueToContext(e,{code:a.invalid_type,expected:s.number,received:e.parsedType}),f}let o;const h=new ParseStatus;for(const s of this._def.checks)if("int"===s.kind)e.isInteger(i.data)||(o=this._getOrReturnCtx(i,o),addIssueToContext(o,{code:a.invalid_type,expected:"integer",received:"float",message:s.message}),h.dirty());else if("min"===s.kind){(s.inclusive?i.data<s.value:i.data<=s.value)&&(o=this._getOrReturnCtx(i,o),addIssueToContext(o,{code:a.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),h.dirty())}else if("max"===s.kind){(s.inclusive?i.data>s.value:i.data>=s.value)&&(o=this._getOrReturnCtx(i,o),addIssueToContext(o,{code:a.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),h.dirty())}else"multipleOf"===s.kind?0!==floatSafeRemainder(i.data,s.value)&&(o=this._getOrReturnCtx(i,o),addIssueToContext(o,{code:a.not_multiple_of,multipleOf:s.value,message:s.message}),h.dirty()):"finite"===s.kind?Number.isFinite(i.data)||(o=this._getOrReturnCtx(i,o),addIssueToContext(o,{code:a.not_finite,message:s.message}),h.dirty()):e.assertNever(s);return{status:h.value,value:i.data}}gte(e,i){return this.setLimit("min",e,!0,g.toString(i))}gt(e,i){return this.setLimit("min",e,!1,g.toString(i))}lte(e,i){return this.setLimit("max",e,!0,g.toString(i))}lt(e,i){return this.setLimit("max",e,!1,g.toString(i))}setLimit(e,i,o,s){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:i,inclusive:o,message:g.toString(s)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:g.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:g.toString(e)})}multipleOf(e,i){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(i)})}finite(e){return this._addCheck({kind:"finite",message:g.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:g.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:g.toString(e)})}get minValue(){let e=null;for(const i of this._def.checks)"min"===i.kind&&(null===e||i.value>e)&&(e=i.value);return e}get maxValue(){let e=null;for(const i of this._def.checks)"max"===i.kind&&(null===e||i.value<e)&&(e=i.value);return e}get isInt(){return!!this._def.checks.find((i=>"int"===i.kind||"multipleOf"===i.kind&&e.isInteger(i.value)))}get isFinite(){let e=null,i=null;for(const o of this._def.checks){if("finite"===o.kind||"int"===o.kind||"multipleOf"===o.kind)return!0;"min"===o.kind?(null===i||o.value>i)&&(i=o.value):"max"===o.kind&&(null===e||o.value<e)&&(e=o.value)}return Number.isFinite(i)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:B.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(i){this._def.coerce&&(i.data=BigInt(i.data));if(this._getType(i)!==s.bigint){const e=this._getOrReturnCtx(i);return addIssueToContext(e,{code:a.invalid_type,expected:s.bigint,received:e.parsedType}),f}let o;const h=new ParseStatus;for(const s of this._def.checks)if("min"===s.kind){(s.inclusive?i.data<s.value:i.data<=s.value)&&(o=this._getOrReturnCtx(i,o),addIssueToContext(o,{code:a.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),h.dirty())}else if("max"===s.kind){(s.inclusive?i.data>s.value:i.data>=s.value)&&(o=this._getOrReturnCtx(i,o),addIssueToContext(o,{code:a.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),h.dirty())}else"multipleOf"===s.kind?i.data%s.value!==BigInt(0)&&(o=this._getOrReturnCtx(i,o),addIssueToContext(o,{code:a.not_multiple_of,multipleOf:s.value,message:s.message}),h.dirty()):e.assertNever(s);return{status:h.value,value:i.data}}gte(e,i){return this.setLimit("min",e,!0,g.toString(i))}gt(e,i){return this.setLimit("min",e,!1,g.toString(i))}lte(e,i){return this.setLimit("max",e,!0,g.toString(i))}lt(e,i){return this.setLimit("max",e,!1,g.toString(i))}setLimit(e,i,o,s){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:i,inclusive:o,message:g.toString(s)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:g.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:g.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:g.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:g.toString(e)})}multipleOf(e,i){return this._addCheck({kind:"multipleOf",value:e,message:g.toString(i)})}get minValue(){let e=null;for(const i of this._def.checks)"min"===i.kind&&(null===e||i.value>e)&&(e=i.value);return e}get maxValue(){let e=null;for(const i of this._def.checks)"max"===i.kind&&(null===e||i.value<e)&&(e=i.value);return e}}ZodBigInt.create=e=>{var i;return new ZodBigInt({checks:[],typeName:B.ZodBigInt,coerce:null!==(i=null==e?void 0:e.coerce)&&void 0!==i&&i,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const i=this._getOrReturnCtx(e);return addIssueToContext(i,{code:a.invalid_type,expected:s.boolean,received:i.parsedType}),f}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:B.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(i){this._def.coerce&&(i.data=new Date(i.data));if(this._getType(i)!==s.date){const e=this._getOrReturnCtx(i);return addIssueToContext(e,{code:a.invalid_type,expected:s.date,received:e.parsedType}),f}if(isNaN(i.data.getTime())){return addIssueToContext(this._getOrReturnCtx(i),{code:a.invalid_date}),f}const o=new ParseStatus;let h;for(const s of this._def.checks)"min"===s.kind?i.data.getTime()<s.value&&(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{code:a.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),o.dirty()):"max"===s.kind?i.data.getTime()>s.value&&(h=this._getOrReturnCtx(i,h),addIssueToContext(h,{code:a.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),o.dirty()):e.assertNever(s);return{status:o.value,value:new Date(i.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,i){return this._addCheck({kind:"min",value:e.getTime(),message:g.toString(i)})}max(e,i){return this._addCheck({kind:"max",value:e.getTime(),message:g.toString(i)})}get minDate(){let e=null;for(const i of this._def.checks)"min"===i.kind&&(null===e||i.value>e)&&(e=i.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const i of this._def.checks)"max"===i.kind&&(null===e||i.value<e)&&(e=i.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:B.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==s.symbol){const i=this._getOrReturnCtx(e);return addIssueToContext(i,{code:a.invalid_type,expected:s.symbol,received:i.parsedType}),f}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:B.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==s.undefined){const i=this._getOrReturnCtx(e);return addIssueToContext(i,{code:a.invalid_type,expected:s.undefined,received:i.parsedType}),f}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:B.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==s.null){const i=this._getOrReturnCtx(e);return addIssueToContext(i,{code:a.invalid_type,expected:s.null,received:i.parsedType}),f}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:B.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:B.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:B.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const i=this._getOrReturnCtx(e);return addIssueToContext(i,{code:a.invalid_type,expected:s.never,received:i.parsedType}),f}}ZodNever.create=e=>new ZodNever({typeName:B.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==s.undefined){const i=this._getOrReturnCtx(e);return addIssueToContext(i,{code:a.invalid_type,expected:s.void,received:i.parsedType}),f}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:B.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:i,status:o}=this._processInputParams(e),h=this._def;if(i.parsedType!==s.array)return addIssueToContext(i,{code:a.invalid_type,expected:s.array,received:i.parsedType}),f;if(null!==h.exactLength){const e=i.data.length>h.exactLength.value,s=i.data.length<h.exactLength.value;(e||s)&&(addIssueToContext(i,{code:e?a.too_big:a.too_small,minimum:s?h.exactLength.value:void 0,maximum:e?h.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:h.exactLength.message}),o.dirty())}if(null!==h.minLength&&i.data.length<h.minLength.value&&(addIssueToContext(i,{code:a.too_small,minimum:h.minLength.value,type:"array",inclusive:!0,exact:!1,message:h.minLength.message}),o.dirty()),null!==h.maxLength&&i.data.length>h.maxLength.value&&(addIssueToContext(i,{code:a.too_big,maximum:h.maxLength.value,type:"array",inclusive:!0,exact:!1,message:h.maxLength.message}),o.dirty()),i.common.async)return Promise.all([...i.data].map(((e,o)=>h.type._parseAsync(new ParseInputLazyPath(i,e,i.path,o))))).then((e=>ParseStatus.mergeArray(o,e)));const g=[...i.data].map(((e,o)=>h.type._parseSync(new ParseInputLazyPath(i,e,i.path,o))));return ParseStatus.mergeArray(o,g)}get element(){return this._def.type}min(e,i){return new ZodArray({...this._def,minLength:{value:e,message:g.toString(i)}})}max(e,i){return new ZodArray({...this._def,maxLength:{value:e,message:g.toString(i)}})}length(e,i){return new ZodArray({...this._def,exactLength:{value:e,message:g.toString(i)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const i={};for(const o in e.shape){const s=e.shape[o];i[o]=ZodOptional.create(deepPartialify(s))}return new ZodObject({...e._def,shape:()=>i})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,i)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...processCreateParams(i)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const i=this._def.shape(),o=e.objectKeys(i);return this._cached={shape:i,keys:o}}_parse(e){if(this._getType(e)!==s.object){const i=this._getOrReturnCtx(e);return addIssueToContext(i,{code:a.invalid_type,expected:s.object,received:i.parsedType}),f}const{status:i,ctx:o}=this._processInputParams(e),{shape:h,keys:g}=this._getCached(),_=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const s in o.data)g.includes(s)||_.push(s);const v=[];for(const s of g){const e=h[s],i=o.data[s];v.push({key:{status:"valid",value:s},value:e._parse(new ParseInputLazyPath(o,i,o.path,s)),alwaysSet:s in o.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const i of _)v.push({key:{status:"valid",value:i},value:{status:"valid",value:o.data[i]}});else if("strict"===e)_.length>0&&(addIssueToContext(o,{code:a.unrecognized_keys,keys:_}),i.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const i of _){const s=o.data[i];v.push({key:{status:"valid",value:i},value:e._parse(new ParseInputLazyPath(o,s,o.path,i)),alwaysSet:i in o.data})}}return o.common.async?Promise.resolve().then((async()=>{const e=[];for(const i of v){const o=await i.key,s=await i.value;e.push({key:o,value:s,alwaysSet:i.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(i,e))):ParseStatus.mergeObjectSync(i,v)}get shape(){return this._def.shape()}strict(e){return g.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(i,o)=>{var s,a,h,f;const _=null!==(h=null===(a=(s=this._def).errorMap)||void 0===a?void 0:a.call(s,i,o).message)&&void 0!==h?h:o.defaultError;return"unrecognized_keys"===i.code?{message:null!==(f=g.errToObj(e).message)&&void 0!==f?f:_}:{message:_}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,i){return this.augment({[e]:i})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(i){const o={};return e.objectKeys(i).forEach((e=>{i[e]&&this.shape[e]&&(o[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>o})}omit(i){const o={};return e.objectKeys(this.shape).forEach((e=>{i[e]||(o[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>o})}deepPartial(){return deepPartialify(this)}partial(i){const o={};return e.objectKeys(this.shape).forEach((e=>{const s=this.shape[e];i&&!i[e]?o[e]=s:o[e]=s.optional()})),new ZodObject({...this._def,shape:()=>o})}required(i){const o={};return e.objectKeys(this.shape).forEach((e=>{if(i&&!i[e])o[e]=this.shape[e];else{let i=this.shape[e];for(;i instanceof ZodOptional;)i=i._def.innerType;o[e]=i}})),new ZodObject({...this._def,shape:()=>o})}keyof(){return createZodEnum(e.objectKeys(this.shape))}}ZodObject.create=(e,i)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:B.ZodObject,...processCreateParams(i)}),ZodObject.strictCreate=(e,i)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:B.ZodObject,...processCreateParams(i)}),ZodObject.lazycreate=(e,i)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:B.ZodObject,...processCreateParams(i)});class ZodUnion extends ZodType{_parse(e){const{ctx:i}=this._processInputParams(e),o=this._def.options;if(i.common.async)return Promise.all(o.map((async e=>{const o={...i,common:{...i.common,issues:[]},parent:null};return{result:await e._parseAsync({data:i.data,path:i.path,parent:o}),ctx:o}}))).then((function handleResults(e){for(const i of e)if("valid"===i.result.status)return i.result;for(const s of e)if("dirty"===s.result.status)return i.common.issues.push(...s.ctx.common.issues),s.result;const o=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(i,{code:a.invalid_union,unionErrors:o}),f}));{let e;const s=[];for(const a of o){const o={...i,common:{...i.common,issues:[]},parent:null},h=a._parseSync({data:i.data,path:i.path,parent:o});if("valid"===h.status)return h;"dirty"!==h.status||e||(e={result:h,ctx:o}),o.common.issues.length&&s.push(o.common.issues)}if(e)return i.common.issues.push(...e.ctx.common.issues),e.result;const h=s.map((e=>new ZodError(e)));return addIssueToContext(i,{code:a.invalid_union,unionErrors:h}),f}}get options(){return this._def.options}}ZodUnion.create=(e,i)=>new ZodUnion({options:e,typeName:B.ZodUnion,...processCreateParams(i)});const getDiscriminator=i=>i instanceof ZodLazy?getDiscriminator(i.schema):i instanceof ZodEffects?getDiscriminator(i.innerType()):i instanceof ZodLiteral?[i.value]:i instanceof ZodEnum?i.options:i instanceof ZodNativeEnum?e.objectValues(i.enum):i instanceof ZodDefault?getDiscriminator(i._def.innerType):i instanceof ZodUndefined?[void 0]:i instanceof ZodNull?[null]:i instanceof ZodOptional?[void 0,...getDiscriminator(i.unwrap())]:i instanceof ZodNullable?[null,...getDiscriminator(i.unwrap())]:i instanceof ZodBranded||i instanceof ZodReadonly?getDiscriminator(i.unwrap()):i instanceof ZodCatch?getDiscriminator(i._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:i}=this._processInputParams(e);if(i.parsedType!==s.object)return addIssueToContext(i,{code:a.invalid_type,expected:s.object,received:i.parsedType}),f;const o=this.discriminator,h=i.data[o],g=this.optionsMap.get(h);return g?i.common.async?g._parseAsync({data:i.data,path:i.path,parent:i}):g._parseSync({data:i.data,path:i.path,parent:i}):(addIssueToContext(i,{code:a.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[o]}),f)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,i,o){const s=new Map;for(const a of i){const i=getDiscriminator(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new ZodDiscriminatedUnion({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:i,optionsMap:s,...processCreateParams(o)})}}function mergeValues(i,o){const a=getParsedType(i),h=getParsedType(o);if(i===o)return{valid:!0,data:i};if(a===s.object&&h===s.object){const s=e.objectKeys(o),a=e.objectKeys(i).filter((e=>-1!==s.indexOf(e))),h={...i,...o};for(const e of a){const s=mergeValues(i[e],o[e]);if(!s.valid)return{valid:!1};h[e]=s.data}return{valid:!0,data:h}}if(a===s.array&&h===s.array){if(i.length!==o.length)return{valid:!1};const e=[];for(let s=0;s<i.length;s++){const a=mergeValues(i[s],o[s]);if(!a.valid)return{valid:!1};e.push(a.data)}return{valid:!0,data:e}}return a===s.date&&h===s.date&&+i==+o?{valid:!0,data:i}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:i,ctx:o}=this._processInputParams(e),handleParsed=(e,s)=>{if(isAborted(e)||isAborted(s))return f;const h=mergeValues(e.value,s.value);return h.valid?((isDirty(e)||isDirty(s))&&i.dirty(),{status:i.value,value:h.data}):(addIssueToContext(o,{code:a.invalid_intersection_types}),f)};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((([e,i])=>handleParsed(e,i))):handleParsed(this._def.left._parseSync({data:o.data,path:o.path,parent:o}),this._def.right._parseSync({data:o.data,path:o.path,parent:o}))}}ZodIntersection.create=(e,i,o)=>new ZodIntersection({left:e,right:i,typeName:B.ZodIntersection,...processCreateParams(o)});class ZodTuple extends ZodType{_parse(e){const{status:i,ctx:o}=this._processInputParams(e);if(o.parsedType!==s.array)return addIssueToContext(o,{code:a.invalid_type,expected:s.array,received:o.parsedType}),f;if(o.data.length<this._def.items.length)return addIssueToContext(o,{code:a.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;!this._def.rest&&o.data.length>this._def.items.length&&(addIssueToContext(o,{code:a.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const h=[...o.data].map(((e,i)=>{const s=this._def.items[i]||this._def.rest;return s?s._parse(new ParseInputLazyPath(o,e,o.path,i)):null})).filter((e=>!!e));return o.common.async?Promise.all(h).then((e=>ParseStatus.mergeArray(i,e))):ParseStatus.mergeArray(i,h)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,i)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:B.ZodTuple,rest:null,...processCreateParams(i)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:i,ctx:o}=this._processInputParams(e);if(o.parsedType!==s.object)return addIssueToContext(o,{code:a.invalid_type,expected:s.object,received:o.parsedType}),f;const h=[],g=this._def.keyType,_=this._def.valueType;for(const s in o.data)h.push({key:g._parse(new ParseInputLazyPath(o,s,o.path,s)),value:_._parse(new ParseInputLazyPath(o,o.data[s],o.path,s)),alwaysSet:s in o.data});return o.common.async?ParseStatus.mergeObjectAsync(i,h):ParseStatus.mergeObjectSync(i,h)}get element(){return this._def.valueType}static create(e,i,o){return new ZodRecord(i instanceof ZodType?{keyType:e,valueType:i,typeName:B.ZodRecord,...processCreateParams(o)}:{keyType:ZodString.create(),valueType:e,typeName:B.ZodRecord,...processCreateParams(i)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:i,ctx:o}=this._processInputParams(e);if(o.parsedType!==s.map)return addIssueToContext(o,{code:a.invalid_type,expected:s.map,received:o.parsedType}),f;const h=this._def.keyType,g=this._def.valueType,_=[...o.data.entries()].map((([e,i],s)=>({key:h._parse(new ParseInputLazyPath(o,e,o.path,[s,"key"])),value:g._parse(new ParseInputLazyPath(o,i,o.path,[s,"value"]))})));if(o.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const o of _){const s=await o.key,a=await o.value;if("aborted"===s.status||"aborted"===a.status)return f;"dirty"!==s.status&&"dirty"!==a.status||i.dirty(),e.set(s.value,a.value)}return{status:i.value,value:e}}))}{const e=new Map;for(const o of _){const s=o.key,a=o.value;if("aborted"===s.status||"aborted"===a.status)return f;"dirty"!==s.status&&"dirty"!==a.status||i.dirty(),e.set(s.value,a.value)}return{status:i.value,value:e}}}}ZodMap.create=(e,i,o)=>new ZodMap({valueType:i,keyType:e,typeName:B.ZodMap,...processCreateParams(o)});class ZodSet extends ZodType{_parse(e){const{status:i,ctx:o}=this._processInputParams(e);if(o.parsedType!==s.set)return addIssueToContext(o,{code:a.invalid_type,expected:s.set,received:o.parsedType}),f;const h=this._def;null!==h.minSize&&o.data.size<h.minSize.value&&(addIssueToContext(o,{code:a.too_small,minimum:h.minSize.value,type:"set",inclusive:!0,exact:!1,message:h.minSize.message}),i.dirty()),null!==h.maxSize&&o.data.size>h.maxSize.value&&(addIssueToContext(o,{code:a.too_big,maximum:h.maxSize.value,type:"set",inclusive:!0,exact:!1,message:h.maxSize.message}),i.dirty());const g=this._def.valueType;function finalizeSet(e){const o=new Set;for(const s of e){if("aborted"===s.status)return f;"dirty"===s.status&&i.dirty(),o.add(s.value)}return{status:i.value,value:o}}const _=[...o.data.values()].map(((e,i)=>g._parse(new ParseInputLazyPath(o,e,o.path,i))));return o.common.async?Promise.all(_).then((e=>finalizeSet(e))):finalizeSet(_)}min(e,i){return new ZodSet({...this._def,minSize:{value:e,message:g.toString(i)}})}max(e,i){return new ZodSet({...this._def,maxSize:{value:e,message:g.toString(i)}})}size(e,i){return this.min(e,i).max(e,i)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,i)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:B.ZodSet,...processCreateParams(i)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:i}=this._processInputParams(e);if(i.parsedType!==s.function)return addIssueToContext(i,{code:a.invalid_type,expected:s.function,received:i.parsedType}),f;function makeArgsIssue(e,o){return makeIssue({data:e,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:a.invalid_arguments,argumentsError:o}})}function makeReturnsIssue(e,o){return makeIssue({data:e,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:a.invalid_return_type,returnTypeError:o}})}const o={errorMap:i.common.contextualErrorMap},h=i.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...i){const s=new ZodError([]),a=await e._def.args.parseAsync(i,o).catch((e=>{throw s.addIssue(makeArgsIssue(i,e)),s})),f=await Reflect.apply(h,this,a);return await e._def.returns._def.type.parseAsync(f,o).catch((e=>{throw s.addIssue(makeReturnsIssue(f,e)),s}))}))}{const e=this;return OK((function(...i){const s=e._def.args.safeParse(i,o);if(!s.success)throw new ZodError([makeArgsIssue(i,s.error)]);const a=Reflect.apply(h,this,s.data),f=e._def.returns.safeParse(a,o);if(!f.success)throw new ZodError([makeReturnsIssue(a,f.error)]);return f.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,i,o){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:i||ZodUnknown.create(),typeName:B.ZodFunction,...processCreateParams(o)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:i}=this._processInputParams(e);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}ZodLazy.create=(e,i)=>new ZodLazy({getter:e,typeName:B.ZodLazy,...processCreateParams(i)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const i=this._getOrReturnCtx(e);return addIssueToContext(i,{received:i.data,code:a.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,i){return new ZodEnum({values:e,typeName:B.ZodEnum,...processCreateParams(i)})}ZodLiteral.create=(e,i)=>new ZodLiteral({value:e,typeName:B.ZodLiteral,...processCreateParams(i)});class ZodEnum extends ZodType{constructor(){super(...arguments),v.set(this,void 0)}_parse(i){if("string"!=typeof i.data){const o=this._getOrReturnCtx(i),s=this._def.values;return addIssueToContext(o,{expected:e.joinValues(s),received:o.parsedType,code:a.invalid_type}),f}if(__classPrivateFieldGet(this,v)||__classPrivateFieldSet(this,v,new Set(this._def.values)),!__classPrivateFieldGet(this,v).has(i.data)){const e=this._getOrReturnCtx(i),o=this._def.values;return addIssueToContext(e,{received:e.data,code:a.invalid_enum_value,options:o}),f}return OK(i.data)}get options(){return this._def.values}get enum(){const e={};for(const i of this._def.values)e[i]=i;return e}get Values(){const e={};for(const i of this._def.values)e[i]=i;return e}get Enum(){const e={};for(const i of this._def.values)e[i]=i;return e}extract(e,i=this._def){return ZodEnum.create(e,{...this._def,...i})}exclude(e,i=this._def){return ZodEnum.create(this.options.filter((i=>!e.includes(i))),{...this._def,...i})}}v=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),b.set(this,void 0)}_parse(i){const o=e.getValidEnumValues(this._def.values),h=this._getOrReturnCtx(i);if(h.parsedType!==s.string&&h.parsedType!==s.number){const i=e.objectValues(o);return addIssueToContext(h,{expected:e.joinValues(i),received:h.parsedType,code:a.invalid_type}),f}if(__classPrivateFieldGet(this,b)||__classPrivateFieldSet(this,b,new Set(e.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,b).has(i.data)){const i=e.objectValues(o);return addIssueToContext(h,{received:h.data,code:a.invalid_enum_value,options:i}),f}return OK(i.data)}get enum(){return this._def.values}}b=new WeakMap,ZodNativeEnum.create=(e,i)=>new ZodNativeEnum({values:e,typeName:B.ZodNativeEnum,...processCreateParams(i)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:i}=this._processInputParams(e);if(i.parsedType!==s.promise&&!1===i.common.async)return addIssueToContext(i,{code:a.invalid_type,expected:s.promise,received:i.parsedType}),f;const o=i.parsedType===s.promise?i.data:Promise.resolve(i.data);return OK(o.then((e=>this._def.type.parseAsync(e,{path:i.path,errorMap:i.common.contextualErrorMap}))))}}ZodPromise.create=(e,i)=>new ZodPromise({type:e,typeName:B.ZodPromise,...processCreateParams(i)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(i){const{status:o,ctx:s}=this._processInputParams(i),a=this._def.effect||null,h={addIssue:e=>{addIssueToContext(s,e),e.fatal?o.abort():o.dirty()},get path(){return s.path}};if(h.addIssue=h.addIssue.bind(h),"preprocess"===a.type){const e=a.transform(s.data,h);if(s.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===o.value)return f;const i=await this._def.schema._parseAsync({data:e,path:s.path,parent:s});return"aborted"===i.status?f:"dirty"===i.status||"dirty"===o.value?DIRTY(i.value):i}));{if("aborted"===o.value)return f;const i=this._def.schema._parseSync({data:e,path:s.path,parent:s});return"aborted"===i.status?f:"dirty"===i.status||"dirty"===o.value?DIRTY(i.value):i}}if("refinement"===a.type){const executeRefinement=e=>{const i=a.refinement(e,h);if(s.common.async)return Promise.resolve(i);if(i instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?f:("dirty"===e.status&&o.dirty(),executeRefinement(e.value),{status:o.value,value:e.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>"aborted"===e.status?f:("dirty"===e.status&&o.dirty(),executeRefinement(e.value).then((()=>({status:o.value,value:e.value}))))))}if("transform"===a.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!isValid(e))return e;const i=a.transform(e.value,h);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:o.value,value:i}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>isValid(e)?Promise.resolve(a.transform(e.value,h)).then((e=>({status:o.value,value:e}))):e))}e.assertNever(a)}}ZodEffects.create=(e,i,o)=>new ZodEffects({schema:e,typeName:B.ZodEffects,effect:i,...processCreateParams(o)}),ZodEffects.createWithPreprocess=(e,i,o)=>new ZodEffects({schema:i,effect:{type:"preprocess",transform:e},typeName:B.ZodEffects,...processCreateParams(o)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===s.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,i)=>new ZodOptional({innerType:e,typeName:B.ZodOptional,...processCreateParams(i)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===s.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,i)=>new ZodNullable({innerType:e,typeName:B.ZodNullable,...processCreateParams(i)});class ZodDefault extends ZodType{_parse(e){const{ctx:i}=this._processInputParams(e);let o=i.data;return i.parsedType===s.undefined&&(o=this._def.defaultValue()),this._def.innerType._parse({data:o,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,i)=>new ZodDefault({innerType:e,typeName:B.ZodDefault,defaultValue:"function"==typeof i.default?i.default:()=>i.default,...processCreateParams(i)});class ZodCatch extends ZodType{_parse(e){const{ctx:i}=this._processInputParams(e),o={...i,common:{...i.common,issues:[]}},s=this._def.innerType._parse({data:o.data,path:o.path,parent:{...o}});return isAsync(s)?s.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(o.common.issues)},input:o.data})}))):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new ZodError(o.common.issues)},input:o.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,i)=>new ZodCatch({innerType:e,typeName:B.ZodCatch,catchValue:"function"==typeof i.catch?i.catch:()=>i.catch,...processCreateParams(i)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==s.nan){const i=this._getOrReturnCtx(e);return addIssueToContext(i,{code:a.invalid_type,expected:s.nan,received:i.parsedType}),f}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:B.ZodNaN,...processCreateParams(e)});const q=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:i}=this._processInputParams(e),o=i.data;return this._def.type._parse({data:o,path:i.path,parent:i})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:i,ctx:o}=this._processInputParams(e);if(o.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:o.data,path:o.path,parent:o});return"aborted"===e.status?f:"dirty"===e.status?(i.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:o.path,parent:o})})()}{const e=this._def.in._parseSync({data:o.data,path:o.path,parent:o});return"aborted"===e.status?f:"dirty"===e.status?(i.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:o.path,parent:o})}}static create(e,i){return new ZodPipeline({in:e,out:i,typeName:B.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const i=this._def.innerType._parse(e),freeze=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(i)?i.then((e=>freeze(e))):freeze(i)}unwrap(){return this._def.innerType}}function custom(e,i={},o){return e?ZodAny.create().superRefine(((s,a)=>{var h,f;if(!e(s)){const e="function"==typeof i?i(s):"string"==typeof i?{message:i}:i,g=null===(f=null!==(h=e.fatal)&&void 0!==h?h:o)||void 0===f||f,_="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",..._,fatal:g})}})):ZodAny.create()}ZodReadonly.create=(e,i)=>new ZodReadonly({innerType:e,typeName:B.ZodReadonly,...processCreateParams(i)});const U={object:ZodObject.lazycreate};var B,z;(z=B||(B={})).ZodString="ZodString",z.ZodNumber="ZodNumber",z.ZodNaN="ZodNaN",z.ZodBigInt="ZodBigInt",z.ZodBoolean="ZodBoolean",z.ZodDate="ZodDate",z.ZodSymbol="ZodSymbol",z.ZodUndefined="ZodUndefined",z.ZodNull="ZodNull",z.ZodAny="ZodAny",z.ZodUnknown="ZodUnknown",z.ZodNever="ZodNever",z.ZodVoid="ZodVoid",z.ZodArray="ZodArray",z.ZodObject="ZodObject",z.ZodUnion="ZodUnion",z.ZodDiscriminatedUnion="ZodDiscriminatedUnion",z.ZodIntersection="ZodIntersection",z.ZodTuple="ZodTuple",z.ZodRecord="ZodRecord",z.ZodMap="ZodMap",z.ZodSet="ZodSet",z.ZodFunction="ZodFunction",z.ZodLazy="ZodLazy",z.ZodLiteral="ZodLiteral",z.ZodEnum="ZodEnum",z.ZodEffects="ZodEffects",z.ZodNativeEnum="ZodNativeEnum",z.ZodOptional="ZodOptional",z.ZodNullable="ZodNullable",z.ZodDefault="ZodDefault",z.ZodCatch="ZodCatch",z.ZodPromise="ZodPromise",z.ZodBranded="ZodBranded",z.ZodPipeline="ZodPipeline",z.ZodReadonly="ZodReadonly";const W=ZodString.create,K=ZodNumber.create,H=ZodNaN.create,G=ZodBigInt.create,J=ZodBoolean.create,Y=ZodDate.create,X=ZodSymbol.create,Q=ZodUndefined.create,ee=ZodNull.create,te=ZodAny.create,re=ZodUnknown.create,ne=ZodNever.create,ie=ZodVoid.create,oe=ZodArray.create,se=ZodObject.create,ae=ZodObject.strictCreate,ce=ZodUnion.create,de=ZodDiscriminatedUnion.create,ue=ZodIntersection.create,le=ZodTuple.create,pe=ZodRecord.create,he=ZodMap.create,fe=ZodSet.create,me=ZodFunction.create,ge=ZodLazy.create,_e=ZodLiteral.create,ye=ZodEnum.create,ve=ZodNativeEnum.create,be=ZodPromise.create,Se=ZodEffects.create,ke=ZodOptional.create,we=ZodNullable.create,Ie=ZodEffects.createWithPreprocess,xe=ZodPipeline.create,Ce={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},Ee=f;var Te=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:function setErrorMap(e){h=e},getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:[],addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:f,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return e},get objectUtil(){return o},ZodParsedType:s,getParsedType:getParsedType,ZodType:ZodType,datetimeRegex:datetimeRegex,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:q,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:U,get ZodFirstPartyTypeKind(){return B},coerce:Ce,any:te,array:oe,bigint:G,boolean:J,date:Y,discriminatedUnion:de,effect:Se,enum:ye,function:me,instanceof:(e,i={message:`Input not instance of ${e.name}`})=>custom((i=>i instanceof e),i),intersection:ue,lazy:ge,literal:_e,map:he,nan:H,nativeEnum:ve,never:ne,null:ee,nullable:we,number:K,object:se,oboolean:()=>J().optional(),onumber:()=>K().optional(),optional:ke,ostring:()=>W().optional(),pipeline:xe,preprocess:Ie,promise:be,record:pe,set:fe,strictObject:ae,string:W,symbol:X,transformer:Se,tuple:le,undefined:Q,union:ce,unknown:re,void:ie,NEVER:Ee,ZodIssueCode:a,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:ZodError});const Oe=Te.union([Te.string(),Te.boolean(),Te.number(),Te.undefined()]),Re=Te.record(Te.string(),Te.union([Oe,Te.array(Oe)])),Me=Te.string().min(1,"Event name is required");var __assign=function(){return __assign=Object.assign||function __assign2(e){for(var i,o=1,s=arguments.length;o<s;o++)for(var a in i=arguments[o])Object.prototype.hasOwnProperty.call(i,a)&&(e[a]=i[a]);return e},__assign.apply(this,arguments)};function __awaiter$1(e,i,o,s){return new(o||(o=Promise))((function(a,h){function fulfilled(e){try{step(s.next(e))}catch(i){h(i)}}function rejected(e){try{step(s.throw(e))}catch(i){h(i)}}function step(e){e.done?a(e.value):function adopt(e){return e instanceof o?e:new o((function(i){i(e)}))}(e.value).then(fulfilled,rejected)}step((s=s.apply(e,i||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var Ne={default:"endpoint"},Pe={default:"tlsEndpoint"},De="Client timeout",Ze="Network connection error",Ae="Network request aborted",Le="Response cannot be parsed",je="Blocked by CSP",Fe="The endpoint parameter is not a valid URL";function E$1(e){for(var i="",o=0;o<e.length;++o)if(o>0){var s=e[o].toLowerCase();s!==e[o]?i+=" ".concat(s):i+=e[o]}else i+=e[o].toUpperCase();return i}var $e=E$1("WrongRegion"),qe=E$1("SubscriptionNotActive"),Ue=E$1("UnsupportedVersion"),Be=E$1("InstallationMethodRestricted"),ze=E$1("HostnameRestricted"),Ve=E$1("IntegrationFailed"),We="API key required",Ke="API key not found",He="API key expired",Ge="Request cannot be parsed",Je="Request failed",Ye="Request failed to process",Xe="Too many requests, rate limit exceeded",Qe="Not available for this origin",et="Not available with restricted header",tt=We,rt=Ke,nt=He,it="Failed to load the JS script of the agent",ot="9319";function M(e,i){var o,s,a,h,f,g=[],_=(f=function __spreadArray(e,i,o){if(o||2===arguments.length)for(var s,a=0,h=i.length;a<h;a++)!s&&a in i||(s||(s=Array.prototype.slice.call(i,0,a)),s[a]=i[a]);return e.concat(s||Array.prototype.slice.call(i))}([],e,!0),o={current:function(){return f[0]},postpone:function(){var e=f.shift();void 0!==e&&f.push(e)},exclude:function(){f.shift()}},h=0,s=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,h++))},a=new Set,[o.current(),function(e,i){var h,f=i instanceof Error?i.message:"";if(f===je||f===Fe)o.exclude(),h=0;else if(f===ot)o.exclude();else if(f===it){var g=Date.now()-e.getTime()<50,_=o.current();_&&g&&!a.has(_)&&(a.add(_),h=0),o.postpone()}else o.postpone();var v=o.current();return void 0===v?void 0:[v,null!=h?h:e.getTime()+s()-Date.now()]}]),v=_[0],b=_[1];if(void 0===v)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var p2=function(e){var o=new Date,r3=function(i){return g.push({url:e,startedAt:o,finishedAt:new Date,error:i})},s=i(e);return s.then((function(){return r3()}),r3),s.catch((function(e){if(g.length>=5)throw e;var i=b(o,e);if(!i)throw e;var s,a=i[0],h=i[1];return(s=h,new Promise((function(e){return setTimeout(e,s)}))).then((function(){return p2(a)}))}))};return p2(v).then((function(e){return[e,g]}))}var st="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",at=st;function F(e){var i;e.scriptUrlPattern;var o,s,a,h,f,g,_,v=e.token,b=e.apiKey,S=void 0===b?v:b,I=function __rest$1(e,i){var o={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.indexOf(s)<0&&(o[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(s=Object.getOwnPropertySymbols(e);a<s.length;a++)i.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(o[s[a]]=e[s[a]])}return o}(e,["scriptUrlPattern","token","apiKey"]),x=null!==(i=function r$3(e,i){return o=e,s=i,Object.prototype.hasOwnProperty.call(o,s)?e[i]:void 0;var o,s}(e,"scriptUrlPattern"))&&void 0!==i?i:st,T=(f=[],g=function(){f.push({time:new Date,state:document.visibilityState})},o=document,s="visibilitychange",a=g,o.addEventListener(s,a,h),_=function(){return o.removeEventListener(s,a,h)},g(),[f,_]),O=T[0],R=T[1];return Promise.resolve().then((function(){if(!S||"string"!=typeof S)throw new Error(We);var e=function(e,i){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,i){var o=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?o(i):"<loaderVersion>"===e?o("3.11.1"):e}))}(String(e),i)}))}(x,S);return M(e,V)})).catch((function(e){throw R(),function(e){return e instanceof Error&&e.message===ot?new Error(it):e}(e)})).then((function(e){var i=e[0],o=e[1];return R(),i.load(__assign(__assign({},I),{ldi:{attempts:o,visibilityStates:O}}))}))}function V(e){return function o$1(e,i,o,s){var a,h=document,f="securitypolicyviolation",u2=function(i){var o=new URL(e,location.href),s=i.blockedURI;s!==o.href&&s!==o.protocol.slice(0,-1)&&s!==o.origin||(a=i,R2())};h.addEventListener(f,u2);var R2=function(){return h.removeEventListener(f,u2)};return Promise.resolve().then(i).then((function(e){return R2(),e}),(function(e){return new Promise((function(e){var i=new MessageChannel;i.port1.onmessage=function(){return e()},i.port2.postMessage(null)})).then((function(){if(R2(),a)return o(a);throw e}))}))}(e,(function(){return i=e,new Promise((function(e,o){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(i){if(i instanceof Error&&"TypeError"===i.name)return!0;throw i}}(i))throw new Error(Fe);var s=document.createElement("script"),o2=function(){var e;return null===(e=s.parentNode)||void 0===e?void 0:e.removeChild(s)},a=document.head||document.getElementsByTagName("head")[0];s.onload=function(){o2(),e()},s.onerror=function(){o2(),o(new Error(it))},s.async=!0,s.src=i,a.appendChild(s)}));var i}),(function(){throw new Error(je)})).then(k)}function k(){var e,i,o,s,a=window,h="__fpjs_p_l_b",f=a[h];if(e=a,i=h,(null==(s=null===(o=Object.getOwnPropertyDescriptor)||void 0===o?void 0:o.call(Object,e,i))?void 0:s.configurable)?delete e[i]:s&&!s.writable||(e[i]=void 0),"function"!=typeof(null==f?void 0:f.load))throw new Error(ot);return f}var ct={load:F,defaultScriptUrlPattern:at,ERROR_SCRIPT_LOAD_FAIL:it,ERROR_API_KEY_EXPIRED:He,ERROR_API_KEY_INVALID:Ke,ERROR_API_KEY_MISSING:We,ERROR_BAD_REQUEST_FORMAT:Ge,ERROR_BAD_RESPONSE_FORMAT:Le,ERROR_CLIENT_TIMEOUT:De,ERROR_CSP_BLOCK:je,ERROR_FORBIDDEN_ENDPOINT:ze,ERROR_FORBIDDEN_HEADER:et,ERROR_FORBIDDEN_ORIGIN:Qe,ERROR_GENERAL_SERVER_FAILURE:Je,ERROR_INSTALLATION_METHOD_RESTRICTED:Be,ERROR_INTEGRATION_FAILURE:Ve,ERROR_INVALID_ENDPOINT:Fe,ERROR_NETWORK_ABORT:Ae,ERROR_NETWORK_CONNECTION:Ze,ERROR_RATE_LIMIT:Xe,ERROR_SERVER_TIMEOUT:Ye,ERROR_SUBSCRIPTION_NOT_ACTIVE:qe,ERROR_TOKEN_EXPIRED:nt,ERROR_TOKEN_INVALID:rt,ERROR_TOKEN_MISSING:tt,ERROR_UNSUPPORTED_VERSION:Ue,ERROR_WRONG_REGION:$e,defaultEndpoint:Ne,defaultTlsEndpoint:Pe};const dt=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:He,ERROR_API_KEY_INVALID:Ke,ERROR_API_KEY_MISSING:We,ERROR_BAD_REQUEST_FORMAT:Ge,ERROR_BAD_RESPONSE_FORMAT:Le,ERROR_CLIENT_TIMEOUT:De,ERROR_CSP_BLOCK:je,ERROR_FORBIDDEN_ENDPOINT:ze,ERROR_FORBIDDEN_HEADER:et,ERROR_FORBIDDEN_ORIGIN:Qe,ERROR_GENERAL_SERVER_FAILURE:Je,ERROR_INSTALLATION_METHOD_RESTRICTED:Be,ERROR_INTEGRATION_FAILURE:Ve,ERROR_INVALID_ENDPOINT:Fe,ERROR_NETWORK_ABORT:Ae,ERROR_NETWORK_CONNECTION:Ze,ERROR_RATE_LIMIT:Xe,ERROR_SCRIPT_LOAD_FAIL:it,ERROR_SERVER_TIMEOUT:Ye,ERROR_SUBSCRIPTION_NOT_ACTIVE:qe,ERROR_TOKEN_EXPIRED:nt,ERROR_TOKEN_INVALID:rt,ERROR_TOKEN_MISSING:tt,ERROR_UNSUPPORTED_VERSION:Ue,ERROR_WRONG_REGION:$e,default:ct,defaultEndpoint:Ne,defaultScriptUrlPattern:at,defaultTlsEndpoint:Pe,load:F},Symbol.toStringTag,{value:"Module"})),ut="@fpjs@client@",DEFAULT_NOW_PROVIDER=()=>Date.now();class CacheKey{constructor(e){var i;this.tag=e.tag||null,this.linkedId=e.linkedId||null,this.extendedResult=null!==(i=e.extendedResult)&&void 0!==i&&i}toKey(){return`${JSON.stringify(this.tag)}__${JSON.stringify(this.linkedId)}__${this.extendedResult}`}}function getKeyWithPrefix(e,i){return`${i}__${e}`}function removePrefixFromKey(e,i){return e.replace(`${i}__`,"")}class LocalStorageCache{constructor(e=ut){this.prefix=e}set(e,i){window.localStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(i))}get(e){const i=window.localStorage.getItem(getKeyWithPrefix(e,this.prefix));if(i)try{return JSON.parse(i)}catch(o){return}}remove(e){window.localStorage.removeItem(getKeyWithPrefix(e,this.prefix))}allKeys(){return Object.keys(window.localStorage).filter((e=>e.startsWith(this.prefix))).map((e=>removePrefixFromKey(e,this.prefix)))}}class SessionStorageCache{constructor(e=ut){this.prefix=e}set(e,i){window.sessionStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(i))}get(e){const i=window.sessionStorage.getItem(getKeyWithPrefix(e,this.prefix));if(i)try{return JSON.parse(i)}catch(o){return}}remove(e){window.sessionStorage.removeItem(getKeyWithPrefix(e,this.prefix))}allKeys(){return Object.keys(window.sessionStorage).filter((e=>e.startsWith(this.prefix))).map((e=>removePrefixFromKey(e,this.prefix)))}}class CacheManager{constructor(e,i=3600,o){this.cache=e,this.cacheTime=i,this.nowProvider=o||DEFAULT_NOW_PROVIDER}get(e){return __awaiter$1(this,void 0,void 0,(function*(){const i=yield this.cache.get(e.toKey());if(!i)return;const o=yield this.nowProvider(),s=Math.floor(o/1e3);if(!(i.expiresAt<s))return i.body;yield this.cache.remove(e.toKey())}))}set(e,i){return __awaiter$1(this,void 0,void 0,(function*(){const o=yield this.wrapCacheEntry(i);yield this.cache.set(e.toKey(),o)}))}clearCache(){return __awaiter$1(this,void 0,void 0,(function*(){const e=yield this.cache.allKeys();yield Promise.all(e.map((e=>this.cache.remove(e))))}))}wrapCacheEntry(e){return __awaiter$1(this,void 0,void 0,(function*(){const i=yield this.nowProvider(),o=Math.floor(i/1e3)+this.cacheTime;return{body:e,expiresAt:o}}))}}class InMemoryCache{constructor(){this.enclosedCache=function(){const e={};return{set(i,o){e[i]=o},get(i){const o=e[i];if(o)return o},remove(i){delete e[i]},allKeys:()=>Object.keys(e)}}()}}class CacheStub{set(){}get(){}remove(){}allKeys(){return[]}}var lt,pt;(pt=lt||(lt={})).Memory="memory",pt.LocalStorage="localstorage",pt.SessionStorage="sessionstorage",pt.NoCache="nocache";const ht={[lt.Memory]:()=>(new InMemoryCache).enclosedCache,[lt.LocalStorage]:e=>new LocalStorageCache(e),[lt.SessionStorage]:e=>new SessionStorageCache(e),[lt.NoCache]:()=>new CacheStub},cacheFactory=e=>ht[e];class FpjsClient{constructor(e){var i;let o;if(this.inFlightRequests=new Map,this.agentPromise=null,this.customAgent=null==e?void 0:e.customAgent,this.agent={get:()=>{throw new Error("FPJSAgent hasn't loaded yet. Make sure to call the init() method first.")}},this.loadOptions=null==e?void 0:e.loadOptions,(null==e?void 0:e.cache)&&(null==e?void 0:e.cacheLocation)&&console.warn("Both `cache` and `cacheLocation` options have been specified in the FpjsClient configuration; ignoring `cacheLocation` and using `cache`."),null==e?void 0:e.cache)o=e.cache;else{if(this.cacheLocation=(null==e?void 0:e.cacheLocation)||lt.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(e=>{switch(e){case lt.SessionStorage:try{window.sessionStorage.getItem("item")}catch(i){return!1}return!0;case lt.LocalStorage:try{window.localStorage.getItem("item")}catch(i){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=lt.Memory),o=cacheFactory(this.cacheLocation)(null==e?void 0:e.cachePrefix)}if((null==e?void 0:e.cacheTimeInSeconds)&&e.cacheTimeInSeconds>86400)throw new Error("Cache time cannot exceed 86400 seconds (24 hours)");const s=null!==(i=null==e?void 0:e.cacheTimeInSeconds)&&void 0!==i?i:3600;this.cacheManager=new CacheManager(o,s)}init(e){return __awaiter$1(this,void 0,void 0,(function*(){var i,o;if(!this.loadOptions&&!e)throw new TypeError("No load options provided");const s=Object.assign(Object.assign(Object.assign({},this.loadOptions),e),{integrationInfo:[...(null===(i=this.loadOptions)||void 0===i?void 0:i.integrationInfo)||[],...(null==e?void 0:e.integrationInfo)||[],"fingerprintjs-pro-spa/1.3.2"]});if(!this.agentPromise){const e=null!==(o=this.customAgent)&&void 0!==o?o:dt;this.agentPromise=e.load(s).then((e=>(this.agent=e,e))).catch((e=>{throw this.agentPromise=null,e}))}return this.agentPromise}))}getVisitorData(){return __awaiter$1(this,arguments,void 0,(function*(e={},i=!1){const o=FpjsClient.makeCacheKey(e).toKey();if(!this.inFlightRequests.has(o)){const s=this._identify(e,i).finally((()=>{this.inFlightRequests.delete(o)}));this.inFlightRequests.set(o,s)}return yield this.inFlightRequests.get(o)}))}getVisitorDataFromCache(){return __awaiter$1(this,arguments,void 0,(function*(e={}){const i=FpjsClient.makeCacheKey(e),o=yield this.cacheManager.get(i);return o?Object.assign(Object.assign({},o),{cacheHit:!0}):void 0}))}isInCache(){return __awaiter$1(this,arguments,void 0,(function*(e={}){return Boolean(yield this.getVisitorDataFromCache(e))}))}clearCache(){return __awaiter$1(this,void 0,void 0,(function*(){yield this.cacheManager.clearCache()}))}static makeCacheKey(e){return new CacheKey(e)}_identify(e){return __awaiter$1(this,arguments,void 0,(function*(e,i=!1){const o=FpjsClient.makeCacheKey(e);if(!i){const e=yield this.cacheManager.get(o);if(e)return Object.assign(Object.assign({},e),{cacheHit:!0})}const s=yield this.agent.get(e);return yield this.cacheManager.set(o,s),Object.assign(Object.assign({},s),{cacheHit:!1})}))}}const ft="default_fingerprint_cache",mt=7,gt="apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",getExpirationDate=e=>new Date((new Date).getTime()+24*e*60*60*1e3).getTime(),getCachedFingerprint=()=>{const{cacheName:e=ft}=window.fingerprintConfig;try{const i=JSON.parse(localStorage.getItem(e)||"null");return i&&i.expiresAt>Date.now()?i.fingerprint:(localStorage.removeItem(e),null)}catch{return null}};function isFingerprintReady(){return void 0!==window.fpClient}const _t={initFingerprint:async function initFingerprint(e,i){const o=[Ne],s=[at];i&&(o.unshift(i),s.unshift(function buildProxyUrl(e){return`${e}?${gt}`}(i))),window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:e,endpoint:o,scriptUrlPattern:s}});try{await window.fpClient.init()}catch(Or){throw console.error("Error initializing identification service:",Or),Or}},getFingerprint:async function getFingerprint(e=!1){if(!window.fingerprintConfig)throw new Error("Fingerprint configuration is not initialized.");const i=getCachedFingerprint();if(i)return i;if(e)return"";if(!isFingerprintReady())throw new Error("Identification service is not initialized.");try{const e=window.fpClient,{visitorId:i}=await e.getVisitorData();return(e=>{const{cacheName:i=ft,cacheTimeInDays:o=mt}=window.fingerprintConfig,s={fingerprint:e,expiresAt:getExpirationDate(o)};localStorage.setItem(i,JSON.stringify(s))})(i),i}catch(Or){throw console.error("Error retrieving fingerprint:",Or),Or}},isFingerprintReady:isFingerprintReady,getCachedFingerprint:getCachedFingerprint},yt={sandbox:{search:"https://search.resertravel.com/api",purchase:"https://purchases.resertravel.com/api",core:""},production:{search:"https://search.reservamos.mx/api",purchase:"https://compras.reservamos.mx/api",core:""}},vt="sandbox",bt={env:vt,headers:{},searchUrl:yt[vt].search,purchaseUrl:yt[vt].purchase,coreUrl:yt[vt].core,version:"v2",coreVersion:"v1",apiKey:void 0,userAuthToken:void 0,withCredentials:!1};let St=Object.assign({},bt);const kt={1:{code:200,message:"Operación no autorizada"}},wt={3:{code:300,message:"Parámetros incorrectos"},7:{code:301,message:"Fecha inválida"}},It={10:{code:400,message:"No existe el viaje"},20:{code:60,message:"No se encontró el viaje"},21:{code:60,message:"Tarifa no disponible"},22:{code:60,message:"Tarifa no disponible"}},n$1=e=>({11:{code:500,message:e},12:{code:501,message:e}}),xt={23:{code:60,message:"Estudiante no disponible"},24:{code:60,message:"Profesor no disponible"},25:{code:60,message:"Menor no disponible"},26:{code:60,message:"Capacidades diferentes no disponible"},27:{code:60,message:"INSEN no disponible"},28:{code:60,message:"General no disponible"},29:{code:60,message:"Error desconocido"}},c$1=e=>({30:{code:30,message:e}}),Ct={50:{code:50,message:"Unknow Error"}},i$2=e=>({...kt,...wt,...It,...n$1(e),...xt,...Ct,...c$1(e)});let Et=class t extends Error{constructor(e=-100,i="Unknown error"){super(i),this.code=e,this.stack=(new Error).stack}};function l$1(e){const i=e.json();if(e.ok)return i;if(![404,422,500].includes(e.status))throw new Et(e.status,e.statusText);switch(e.status){case 404:throw new Et(100,"Not found");case 422:return i;case 500:throw new Et(101,"Server error");default:throw new Et}}function w(e){if(e.errors instanceof Array){const{code:i=-100,message:o="Unknown error"}=e.errors[0]||{},s=i$2(o)[i];throw s?new Et(s.code,s.message):new Et(i,o)}return e}function c(e,i={},o={},s){const{apiKey:a,withCredentials:h,userAuthToken:f,headers:g}=St,_={Accept:"application/json",Authorization:`Token token=${o.apiKey||a}`,"Content-Type":"application/json"};return f&&(_.Authorization=`Token ${o.apiKey||a}, Bearer ${f}`),i.headers=function y(...e){const i=Object.keys(Object.assign({},...e)).reduce(((i,o)=>({...i,[o]:e.map((e=>o in e&&e[o])).filter(Boolean)})),{});return new Headers(i)}(g,_),i.credentials=h?"include":"omit","string"!=typeof i.body&&(i.body=JSON.stringify(i.body)),fetch(e,i).then(l$1).then(w).catch(s)}class u{constructor({url:e,watch:i,expect:o,maxRetries:s=30,interval:a=2e3,eachCall:h=null}){this.url=e,this.watch=i,this.expect=o instanceof Array?o:[o],this.interval=a,this.maxRetries=s,this.eachCall=h&&h.bind(this),this.aborted=!1,this.timers=[],this.execute=this.execute.bind(this),this.executeEachCall=this.executeEachCall.bind(this)}start(){return this.execute(this.maxRetries)}abort(){this.aborted=!0}execute(e){return function E(e,i={},o){return c(e,i,{},o)}(this.url,{},(e=>this.executeEachCall("error",e))).then((i=>{if(this.expect.includes(i[this.watch])||1===e||this.aborted){let o=i[this.watch];1===e?o="retries_exceeded":this.aborted&&(o="aborted"),this.timers.forEach(clearInterval),this.executeEachCall(o,i)}else if("failed"===i[this.watch])this.timers.forEach(clearInterval),this.executeEachCall("failed",i);else{this.executeEachCall("pending",i);const o=window.setTimeout(this.execute,this.interval,e-1);this.timers.push(o)}}))}executeEachCall(e,i){this.eachCall instanceof Function&&this.eachCall({status:e,payload:i})&&this.abort()}}const Tt=function C({apiName:e,defaultApiVersion:i}){let o,s,a={"Content-Type":"application/json"};function u$12(){if(!o)throw new Error(`Base URL is not set for ${e} API.`)}const h={body:{}};return{get:async function y2(e,s={}){u$12();const{headers:a={},apiVersion:h=i}=s,f=`${o}/${h}/${e}`;return(await fetch(f,{headers:a})).json()},post:async function $(e,f=h){u$12();const{body:g,headers:_={},apiVersion:v=i}=f,b=`${o}/${v}/${e}`,S={...a,..._,...s?{Authorization:s}:{}};return(await fetch(b,{method:"POST",body:JSON.stringify(g),headers:S})).json()},setAuthorizationHeader:function p2(e){s=e},setConfig:function f2(e){o=e.baseUrl,a={...a,...e.defaultHeaders||{}}},poll:function w2(e,s){const a={url:`${o}/${i}/${e}`,watch:s.watch,expect:s.expect,eachCall:s.onEachResponse};return new u(a)}}}({apiName:"Core",defaultApiVersion:"v1"});const Ot={getFrequentPassengers:async function r(e){return Tt.get(`passengers/${e}`)},createFrequentPassengers:async function n(e){return Tt.post("passengers",{body:e})}};const Rt={createAnonymousProfile:async function t2(e){const{data:i}=await Tt.post("anonymous_profiles/identify",{body:e});return i}};const Mt={getRecommendedTrips:function d({searchId:e,userIdentifier:i}){return Tt.get(`trip_recommendations/${e}/${i}`)},createRecommendedPlaces:async function l(e){return Tt.post("profiles",{body:e})},pollRecommendedPlaces:function p(e,i){const{start:o,onEachResponse:s}=i,a=`profiles/${e}`,h={watch:"state",expect:"finished",onEachResponse:s},f=Tt.poll(a,h);return o&&f.start(),f},createRecommendedSeats:function i$1(e){return Tt.post("seat_recommendations",{body:e})},getRecommendedSeats:function m({distinct_id:e,...i}){return Tt.post(`seat_recommendations/${e}`,{body:i})}},Nt={setConfig:Tt.setConfig,recommendations:Mt,profiles:Rt,preferences:Ot};let Pt;const Dt=window.location.origin,Zt={sandbox:{baseUrl:"https://datalake-api-dev.reservamossaas.com/api",defaultHeaders:{Origin:Dt,Authorization:"Bearer 753bf0710dc920a84236d42241d4f487"}},prod:{baseUrl:"https://data-lake.reservamossaas.com/api",defaultHeaders:{Origin:Dt,Authorization:"Bearer 753bf0710dc920a84236d42241d4f487"}}};const At={setEnvironment:function setEnvironment(e){Pt=e},getCoreAPIConfig:function getCoreAPIConfig(){if(!Pt)throw new Error("Unable to get core API config, environment not set. Use configService.setEnvironment(environment) to set the environment.");return Zt[Pt]}};var Lt,jt;function isShadowRoot(e){const i=null==e?void 0:e.host;return Boolean((null==i?void 0:i.shadowRoot)===e)}function isNativeShadowDom(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function stringifyStylesheet(e){try{const i=e.rules||e.cssRules;return i?function fixBrowserCompatibilityIssuesInCSS(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}(Array.from(i,stringifyRule).join("")):null}catch(Or){return null}}function stringifyRule(e){let i;if(function isCSSImportRule(e){return"styleSheet"in e}(e))try{i=stringifyStylesheet(e.styleSheet)||function escapeImportStatement(e){const{cssText:i}=e;if(i.split('"').length<3)return i;const o=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?o.push("layer"):e.layerName&&o.push(`layer(${e.layerName})`),e.supportsText&&o.push(`supports(${e.supportsText})`),e.media.length&&o.push(e.media.mediaText),o.join(" ")+";"}(e)}catch(Or){}else if(function isCSSStyleRule(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function fixSafariColons(e){const i=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(i,"$1\\$2")}(e.cssText);return i||e.cssText}(jt=Lt||(Lt={}))[jt.Document=0]="Document",jt[jt.DocumentType=1]="DocumentType",jt[jt.Element=2]="Element",jt[jt.Text=3]="Text",jt[jt.CDATA=4]="CDATA",jt[jt.Comment=5]="Comment";class Mirror{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var i;if(!e)return-1;const o=null===(i=this.getMeta(e))||void 0===i?void 0:i.id;return null!=o?o:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const i=this.getId(e);this.idNodeMap.delete(i),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,i){const o=i.id;this.idNodeMap.set(o,e),this.nodeMetaMap.set(e,i)}replace(e,i){const o=this.getNode(e);if(o){const e=this.nodeMetaMap.get(o);e&&this.nodeMetaMap.set(i,e)}this.idNodeMap.set(e,i)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function maskInputValue({element:e,maskInputOptions:i,tagName:o,type:s,value:a,maskInputFn:h}){let f=a||"";const g=s&&toLowerCase(s);return(i[o.toLowerCase()]||g&&i[g])&&(f=h?h(f,e):"*".repeat(f.length)),f}function toLowerCase(e){return e.toLowerCase()}const Ft="__rrweb_original__";function getInputType(e){const i=e.type;return e.hasAttribute("data-rr-is-password")?"password":i?toLowerCase(i):null}function extractFileExtension(e,i){var o;let s;try{s=new URL(e,null!=i?i:window.location.href)}catch(h){return null}const a=s.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(o=null==a?void 0:a[1])&&void 0!==o?o:null}let $t=1;const qt=new RegExp("[^a-z0-9-_:]"),Ut=-2;function genId(){return $t++}let Bt,zt;const Vt=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Wt=/^(?:[a-z+]+:)?\/\//i,Kt=/^www\..*/i,Ht=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,i){return(e||"").replace(Vt,((e,o,s,a,h,f)=>{const g=s||h||f,_=o||a||"";if(!g)return e;if(Wt.test(g)||Kt.test(g))return`url(${_}${g}${_})`;if(Ht.test(g))return`url(${_}${g}${_})`;if("/"===g[0])return`url(${_}${function extractOrigin(e){let i="";return i=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],i=i.split("?")[0],i}(i)+g}${_})`;const v=i.split("/"),b=g.split("/");v.pop();for(const i of b)"."!==i&&(".."===i?v.pop():v.push(i));return`url(${_}${v.join("/")}${_})`}))}const Gt=/^[^ \t\n\r\u000c]+/,Jt=/^[, \t\n\r\u000c]+/;function absoluteToDoc(e,i){if(!i||""===i.trim())return i;const o=e.createElement("a");return o.href=i,o.href}function isSVGElement(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function getHref(){const e=document.createElement("a");return e.href="",e.href}function transformAttribute(e,i,o,s){return s?"src"===o||"href"===o&&("use"!==i||"#"!==s[0])||"xlink:href"===o&&"#"!==s[0]?absoluteToDoc(e,s):"background"!==o||"table"!==i&&"td"!==i&&"th"!==i?"srcset"===o?function getAbsoluteSrcsetString(e,i){if(""===i.trim())return i;let o=0;function collectCharacters(e){let s;const a=e.exec(i.substring(o));return a?(s=a[0],o+=s.length,s):""}const s=[];for(;collectCharacters(Jt),!(o>=i.length);){let a=collectCharacters(Gt);if(","===a.slice(-1))a=absoluteToDoc(e,a.substring(0,a.length-1)),s.push(a);else{let h="";a=absoluteToDoc(e,a);let f=!1;for(;;){const e=i.charAt(o);if(""===e){s.push((a+h).trim());break}if(f)")"===e&&(f=!1);else{if(","===e){o+=1,s.push((a+h).trim());break}"("===e&&(f=!0)}h+=e,o+=1}}}return s.join(", ")}(e,s):"style"===o?absoluteToStylesheet(s,getHref()):"object"===i&&"data"===o?absoluteToDoc(e,s):s:absoluteToDoc(e,s):s}function ignoreAttribute(e,i,o){return("video"===e||"audio"===e)&&"autoplay"===i}function classMatchesRegex(e,i,o){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!o&&classMatchesRegex(e.parentNode,i,o);for(let s=e.classList.length;s--;){const o=e.classList[s];if(i.test(o))return!0}return!!o&&classMatchesRegex(e.parentNode,i,o)}function needMaskingText(e,i,o,s){try{const a=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===a)return!1;if("string"==typeof i){if(s){if(a.closest(`.${i}`))return!0}else if(a.classList.contains(i))return!0}else if(classMatchesRegex(a,i,s))return!0;if(o)if(s){if(a.closest(o))return!0}else if(a.matches(o))return!0}catch(a){}return!1}function serializeNode(e,i){const{doc:o,mirror:s,blockClass:a,blockSelector:h,needsMask:f,inlineStylesheet:g,maskInputOptions:_={},maskTextFn:v,maskInputFn:b,dataURLOptions:S={},inlineImages:I,recordCanvas:x,keepIframeSrcFn:T,newlyAddedElement:O=!1}=i,R=function getRootId(e,i){if(!i.hasNode(e))return;const o=i.getId(e);return 1===o?void 0:o}(o,s);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Lt.Document,childNodes:[],compatMode:e.compatMode}:{type:Lt.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Lt.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:R};case e.ELEMENT_NODE:return function serializeElementNode(e,i){const{doc:o,blockClass:s,blockSelector:a,inlineStylesheet:h,maskInputOptions:f={},maskInputFn:g,dataURLOptions:_={},inlineImages:v,recordCanvas:b,keepIframeSrcFn:S,newlyAddedElement:I=!1,rootId:x}=i,T=function _isBlockedElement(e,i,o){try{if("string"==typeof i){if(e.classList.contains(i))return!0}else for(let o=e.classList.length;o--;){const s=e.classList[o];if(i.test(s))return!0}if(o)return e.matches(o)}catch(s){}return!1}(e,s,a),O=function getValidTagName(e){if(e instanceof HTMLFormElement)return"form";const i=toLowerCase(e.tagName);return qt.test(i)?"div":i}(e);let R={};const N=e.attributes.length;for(let Z=0;Z<N;Z++){const i=e.attributes[Z];ignoreAttribute(O,i.name,i.value)||(R[i.name]=transformAttribute(o,O,toLowerCase(i.name),i.value))}if("link"===O&&h){const i=Array.from(o.styleSheets).find((i=>i.href===e.href));let s=null;i&&(s=stringifyStylesheet(i)),s&&(delete R.rel,delete R.href,R._cssText=absoluteToStylesheet(s,i.href))}if("style"===O&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const i=stringifyStylesheet(e.sheet);i&&(R._cssText=absoluteToStylesheet(i,getHref()))}if("input"===O||"textarea"===O||"select"===O){const i=e.value,o=e.checked;"radio"!==R.type&&"checkbox"!==R.type&&"submit"!==R.type&&"button"!==R.type&&i?R.value=maskInputValue({element:e,type:getInputType(e),tagName:O,value:i,maskInputOptions:f,maskInputFn:g}):o&&(R.checked=o)}"option"===O&&(e.selected&&!f.select?R.selected=!0:delete R.selected);if("canvas"===O&&b)if("2d"===e.__context)(function is2DCanvasBlank(e){const i=e.getContext("2d");if(!i)return!0;for(let o=0;o<e.width;o+=50)for(let s=0;s<e.height;s+=50){const a=i.getImageData,h=Ft in a?a[Ft]:a;if(new Uint32Array(h.call(i,o,s,Math.min(50,e.width-o),Math.min(50,e.height-s)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(R.rr_dataURL=e.toDataURL(_.type,_.quality));else if(!("__context"in e)){const i=e.toDataURL(_.type,_.quality),o=document.createElement("canvas");o.width=e.width,o.height=e.height;i!==o.toDataURL(_.type,_.quality)&&(R.rr_dataURL=i)}if("img"===O&&v){Bt||(Bt=o.createElement("canvas"),zt=Bt.getContext("2d"));const i=e,s=i.crossOrigin;i.crossOrigin="anonymous";const recordInlineImage=()=>{i.removeEventListener("load",recordInlineImage);try{Bt.width=i.naturalWidth,Bt.height=i.naturalHeight,zt.drawImage(i,0,0),R.rr_dataURL=Bt.toDataURL(_.type,_.quality)}catch(e){console.warn(`Cannot inline img src=${i.currentSrc}! Error: ${e}`)}s?R.crossOrigin=s:i.removeAttribute("crossorigin")};i.complete&&0!==i.naturalWidth?recordInlineImage():i.addEventListener("load",recordInlineImage)}if("audio"===O||"video"===O){const i=R;i.rr_mediaState=e.paused?"paused":"played",i.rr_mediaCurrentTime=e.currentTime,i.rr_mediaPlaybackRate=e.playbackRate,i.rr_mediaMuted=e.muted,i.rr_mediaLoop=e.loop,i.rr_mediaVolume=e.volume}I||(e.scrollLeft&&(R.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(R.rr_scrollTop=e.scrollTop));if(T){const{width:i,height:o}=e.getBoundingClientRect();R={class:R.class,rr_width:`${i}px`,rr_height:`${o}px`}}"iframe"!==O||S(R.src)||(e.contentDocument||(R.rr_src=R.src),delete R.src);let P;try{customElements.get(O)&&(P=!0)}catch(D){}return{type:Lt.Element,tagName:O,attributes:R,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:T,rootId:x,isCustom:P}}(e,{doc:o,blockClass:a,blockSelector:h,inlineStylesheet:g,maskInputOptions:_,maskInputFn:b,dataURLOptions:S,inlineImages:I,recordCanvas:x,keepIframeSrcFn:T,newlyAddedElement:O,rootId:R});case e.TEXT_NODE:return function serializeTextNode(e,i){var o;const{needsMask:s,maskTextFn:a,rootId:h}=i,f=e.parentNode&&e.parentNode.tagName;let g=e.textContent;const _="STYLE"===f||void 0,v="SCRIPT"===f||void 0;if(_&&g){try{e.nextSibling||e.previousSibling||(null===(o=e.parentNode.sheet)||void 0===o?void 0:o.cssRules)&&(g=stringifyStylesheet(e.parentNode.sheet))}catch(b){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${b}`,e)}g=absoluteToStylesheet(g,getHref())}v&&(g="SCRIPT_PLACEHOLDER");!_&&!v&&g&&s&&(g=a?a(g,e.parentElement):g.replace(/[\S]/g,"*"));return{type:Lt.Text,textContent:g||"",isStyle:_,rootId:h}}(e,{needsMask:f,maskTextFn:v,rootId:R});case e.CDATA_SECTION_NODE:return{type:Lt.CDATA,textContent:"",rootId:R};case e.COMMENT_NODE:return{type:Lt.Comment,textContent:e.textContent||"",rootId:R};default:return!1}}function lowerIfExists(e){return null==e?"":e.toLowerCase()}function serializeNodeWithId(e,i){const{doc:o,mirror:s,blockClass:a,blockSelector:h,maskTextClass:f,maskTextSelector:g,skipChild:_=!1,inlineStylesheet:v=!0,maskInputOptions:b={},maskTextFn:S,maskInputFn:I,slimDOMOptions:x,dataURLOptions:T={},inlineImages:O=!1,recordCanvas:R=!1,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D=5e3,onStylesheetLoad:Z,stylesheetLoadTimeout:A=5e3,keepIframeSrcFn:L=()=>!1,newlyAddedElement:j=!1}=i;let{needsMask:q}=i,{preserveWhiteSpace:U=!0}=i;if(!q&&e.childNodes){q=needMaskingText(e,f,g,void 0===q)}const B=serializeNode(e,{doc:o,mirror:s,blockClass:a,blockSelector:h,needsMask:q,inlineStylesheet:v,maskInputOptions:b,maskTextFn:S,maskInputFn:I,dataURLOptions:T,inlineImages:O,recordCanvas:R,keepIframeSrcFn:L,newlyAddedElement:j});if(!B)return console.warn(e,"not serialized"),null;let z;z=s.hasNode(e)?s.getId(e):!function slimDOMExcluded(e,i){if(i.comment&&e.type===Lt.Comment)return!0;if(e.type===Lt.Element){if(i.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===extractFileExtension(e.attributes.href)))return!0;if(i.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(lowerIfExists(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===lowerIfExists(e.attributes.name)||"icon"===lowerIfExists(e.attributes.rel)||"apple-touch-icon"===lowerIfExists(e.attributes.rel)||"shortcut icon"===lowerIfExists(e.attributes.rel))))return!0;if("meta"===e.tagName){if(i.headMetaDescKeywords&&lowerIfExists(e.attributes.name).match(/^description|keywords$/))return!0;if(i.headMetaSocial&&(lowerIfExists(e.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===lowerIfExists(e.attributes.name)))return!0;if(i.headMetaRobots&&("robots"===lowerIfExists(e.attributes.name)||"googlebot"===lowerIfExists(e.attributes.name)||"bingbot"===lowerIfExists(e.attributes.name)))return!0;if(i.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(i.headMetaAuthorship&&("author"===lowerIfExists(e.attributes.name)||"generator"===lowerIfExists(e.attributes.name)||"framework"===lowerIfExists(e.attributes.name)||"publisher"===lowerIfExists(e.attributes.name)||"progid"===lowerIfExists(e.attributes.name)||lowerIfExists(e.attributes.property).match(/^article:/)||lowerIfExists(e.attributes.property).match(/^product:/)))return!0;if(i.headMetaVerification&&("google-site-verification"===lowerIfExists(e.attributes.name)||"yandex-verification"===lowerIfExists(e.attributes.name)||"csrf-token"===lowerIfExists(e.attributes.name)||"p:domain_verify"===lowerIfExists(e.attributes.name)||"verify-v1"===lowerIfExists(e.attributes.name)||"verification"===lowerIfExists(e.attributes.name)||"shopify-checkout-api-token"===lowerIfExists(e.attributes.name)))return!0}}return!1}(B,x)&&(U||B.type!==Lt.Text||B.isStyle||B.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():Ut;const W=Object.assign(B,{id:z});if(s.add(e,W),z===Ut)return null;N&&N(e);let K=!_;if(W.type===Lt.Element){K=K&&!W.needBlock,delete W.needBlock;const i=e.shadowRoot;i&&isNativeShadowDom(i)&&(W.isShadowHost=!0)}if((W.type===Lt.Document||W.type===Lt.Element)&&K){x.headWhitespace&&W.type===Lt.Element&&"head"===W.tagName&&(U=!1);const i={doc:o,mirror:s,blockClass:a,blockSelector:h,needsMask:q,maskTextClass:f,maskTextSelector:g,skipChild:_,inlineStylesheet:v,maskInputOptions:b,maskTextFn:S,maskInputFn:I,slimDOMOptions:x,dataURLOptions:T,inlineImages:O,recordCanvas:R,preserveWhiteSpace:U,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D,onStylesheetLoad:Z,stylesheetLoadTimeout:A,keepIframeSrcFn:L};if(W.type===Lt.Element&&"textarea"===W.tagName&&void 0!==W.attributes.value);else for(const o of Array.from(e.childNodes)){const e=serializeNodeWithId(o,i);e&&W.childNodes.push(e)}if(function isElement(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(const o of Array.from(e.shadowRoot.childNodes)){const s=serializeNodeWithId(o,i);s&&(isNativeShadowDom(e.shadowRoot)&&(s.isShadow=!0),W.childNodes.push(s))}}return e.parentNode&&isShadowRoot(e.parentNode)&&isNativeShadowDom(e.parentNode)&&(W.isShadow=!0),W.type===Lt.Element&&"iframe"===W.tagName&&function onceIframeLoaded(e,i,o){const s=e.contentWindow;if(!s)return;let a,h=!1;try{a=s.document.readyState}catch(Or){return}if("complete"!==a){const s=setTimeout((()=>{h||(i(),h=!0)}),o);return void e.addEventListener("load",(()=>{clearTimeout(s),h=!0,i()}))}const f="about:blank";if(s.location.href!==f||e.src===f||""===e.src)return setTimeout(i,0),e.addEventListener("load",i);e.addEventListener("load",i)}(e,(()=>{const i=e.contentDocument;if(i&&P){const o=serializeNodeWithId(i,{doc:i,mirror:s,blockClass:a,blockSelector:h,needsMask:q,maskTextClass:f,maskTextSelector:g,skipChild:!1,inlineStylesheet:v,maskInputOptions:b,maskTextFn:S,maskInputFn:I,slimDOMOptions:x,dataURLOptions:T,inlineImages:O,recordCanvas:R,preserveWhiteSpace:U,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D,onStylesheetLoad:Z,stylesheetLoadTimeout:A,keepIframeSrcFn:L});o&&P(e,o)}}),D),W.type===Lt.Element&&"link"===W.tagName&&"string"==typeof W.attributes.rel&&("stylesheet"===W.attributes.rel||"preload"===W.attributes.rel&&"string"==typeof W.attributes.href&&"css"===extractFileExtension(W.attributes.href))&&function onceStylesheetLoaded(e,i,o){let s,a=!1;try{s=e.sheet}catch(Or){return}if(s)return;const h=setTimeout((()=>{a||(i(),a=!0)}),o);e.addEventListener("load",(()=>{clearTimeout(h),a=!0,i()}))}(e,(()=>{if(Z){const i=serializeNodeWithId(e,{doc:o,mirror:s,blockClass:a,blockSelector:h,needsMask:q,maskTextClass:f,maskTextSelector:g,skipChild:!1,inlineStylesheet:v,maskInputOptions:b,maskTextFn:S,maskInputFn:I,slimDOMOptions:x,dataURLOptions:T,inlineImages:O,recordCanvas:R,preserveWhiteSpace:U,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D,onStylesheetLoad:Z,stylesheetLoadTimeout:A,keepIframeSrcFn:L});i&&Z(e,i)}}),A),W}function on(e,i,o=document){const s={capture:!0,passive:!0};return o.addEventListener(e,i,s),()=>o.removeEventListener(e,i,s)}const Yt="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let Xt={map:{},getId:()=>(console.error(Yt),-1),getNode:()=>(console.error(Yt),null),removeNodeFromMap(){console.error(Yt)},has:()=>(console.error(Yt),!1),reset(){console.error(Yt)}};function throttle(e,i,o={}){let s=null,a=0;return function(...h){const f=Date.now();a||!1!==o.leading||(a=f);const g=i-(f-a),_=this;g<=0||g>i?(s&&(clearTimeout(s),s=null),a=f,e.apply(_,h)):s||!1===o.trailing||(s=setTimeout((()=>{a=!1===o.leading?0:Date.now(),s=null,e.apply(_,h)}),g))}}function hookSetter(e,i,o,s,a=window){const h=a.Object.getOwnPropertyDescriptor(e,i);return a.Object.defineProperty(e,i,s?o:{set(e){setTimeout((()=>{o.set.call(this,e)}),0),h&&h.set&&h.set.call(this,e)}}),()=>hookSetter(e,i,h||{},!0)}function patch(e,i,o){try{if(!(i in e))return()=>{};const s=e[i],a=o(s);return"function"==typeof a&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__rrweb_original__:{enumerable:!1,value:s}})),e[i]=a,()=>{e[i]=s}}catch(s){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Xt=new Proxy(Xt,{get:(e,i,o)=>("map"===i&&console.error(Yt),Reflect.get(e,i,o))}));let Qt=Date.now;function getWindowScroll(e){var i,o,s,a,h,f;const g=e.document;return{left:g.scrollingElement?g.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==g?void 0:g.documentElement.scrollLeft)||(null===(o=null===(i=null==g?void 0:g.body)||void 0===i?void 0:i.parentElement)||void 0===o?void 0:o.scrollLeft)||(null===(s=null==g?void 0:g.body)||void 0===s?void 0:s.scrollLeft)||0,top:g.scrollingElement?g.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==g?void 0:g.documentElement.scrollTop)||(null===(h=null===(a=null==g?void 0:g.body)||void 0===a?void 0:a.parentElement)||void 0===h?void 0:h.scrollTop)||(null===(f=null==g?void 0:g.body)||void 0===f?void 0:f.scrollTop)||0}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function closestElementOfNode(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function isBlocked(e,i,o,s){if(!e)return!1;const a=closestElementOfNode(e);if(!a)return!1;try{if("string"==typeof i){if(a.classList.contains(i))return!0;if(s&&null!==a.closest("."+i))return!0}else if(classMatchesRegex(a,i,s))return!0}catch(h){}if(o){if(a.matches(o))return!0;if(s&&null!==a.closest(o))return!0}return!1}function isIgnored(e,i){return i.getId(e)===Ut}function isAncestorRemoved(e,i){if(isShadowRoot(e))return!1;const o=i.getId(e);return!i.has(o)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||isAncestorRemoved(e.parentNode,i))}function legacy_isTouchEvent(e){return Boolean(e.changedTouches)}function isSerializedIframe(e,i){return Boolean("IFRAME"===e.nodeName&&i.getMeta(e))}function isSerializedStylesheet(e,i){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&i.getMeta(e))}function hasShadowRoot(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Qt=()=>(new Date).getTime());class StyleSheetMirror{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var i;return null!==(i=this.styleIDMap.get(e))&&void 0!==i?i:-1}has(e){return this.styleIDMap.has(e)}add(e,i){if(this.has(e))return this.getId(e);let o;return o=void 0===i?this.id++:i,this.styleIDMap.set(e,o),this.idStyleMap.set(o,e),o}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function getShadowHost(e){var i,o;let s=null;return(null===(o=null===(i=e.getRootNode)||void 0===i?void 0:i.call(e))||void 0===o?void 0:o.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(s=e.getRootNode().host),s}function shadowHostInDom(e){const i=e.ownerDocument;if(!i)return!1;const o=function getRootShadowHost(e){let i,o=e;for(;i=getShadowHost(o);)o=i;return o}(e);return i.contains(o)}function inDom(e){const i=e.ownerDocument;return!!i&&(i.contains(e)||shadowHostInDom(e))}var er=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(er||{}),tr=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(tr||{}),rr=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(rr||{}),nr=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(nr||{}),ir=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ir||{});function isNodeInLinkedList(e){return"__ln"in e}class DoubleLinkedList{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let i=this.head;for(let o=0;o<e;o++)i=(null==i?void 0:i.next)||null;return i}addNode(e){const i={value:e,previous:null,next:null};if(e.__ln=i,e.previousSibling&&isNodeInLinkedList(e.previousSibling)){const o=e.previousSibling.__ln.next;i.next=o,i.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=i,o&&(o.previous=i)}else if(e.nextSibling&&isNodeInLinkedList(e.nextSibling)&&e.nextSibling.__ln.previous){const o=e.nextSibling.__ln.previous;i.previous=o,i.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=i,o&&(o.next=i)}else this.head&&(this.head.previous=i),i.next=this.head,this.head=i;null===i.next&&(this.tail=i),this.length++}removeNode(e){const i=e.__ln;this.head&&(i.previous?(i.previous.next=i.next,i.next?i.next.previous=i.previous:this.tail=i.previous):(this.head=i.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const moveKey=(e,i)=>`${e}@${i}`;class MutationBuffer{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],i=new Set,o=new DoubleLinkedList,getNextId=e=>{let i=e,o=Ut;for(;o===Ut;)i=i&&i.nextSibling,o=i&&this.mirror.getId(i);return o},pushAdd=s=>{if(!s.parentNode||!inDom(s)||"TEXTAREA"===s.parentNode.tagName)return;const a=isShadowRoot(s.parentNode)?this.mirror.getId(getShadowHost(s)):this.mirror.getId(s.parentNode),h=getNextId(s);if(-1===a||-1===h)return o.addNode(s);const f=serializeNodeWithId(s,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{isSerializedIframe(e,this.mirror)&&this.iframeManager.addIframe(e),isSerializedStylesheet(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),hasShadowRoot(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc)},onIframeLoad:(e,i)=>{this.iframeManager.attachIframe(e,i),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,i)=>{this.stylesheetManager.attachLinkElement(e,i)}});f&&(e.push({parentId:a,nextId:h,node:f}),i.add(f.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const h of this.movedSet)isParentRemoved(this.removes,h,this.mirror)&&!this.movedSet.has(h.parentNode)||pushAdd(h);for(const h of this.addedSet)isAncestorInSet(this.droppedSet,h)||isParentRemoved(this.removes,h,this.mirror)?isAncestorInSet(this.movedSet,h)?pushAdd(h):this.droppedSet.add(h):pushAdd(h);let s=null;for(;o.length;){let e=null;if(s){const i=this.mirror.getId(s.value.parentNode),o=getNextId(s.value);-1!==i&&-1!==o&&(e=s)}if(!e){let i=o.tail;for(;i;){const o=i;if(i=i.previous,o){const i=this.mirror.getId(o.value.parentNode);if(-1===getNextId(o.value))continue;if(-1!==i){e=o;break}{const i=o.value;if(i.parentNode&&i.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const s=i.parentNode.host;if(-1!==this.mirror.getId(s)){e=o;break}}}}}}if(!e){for(;o.head;)o.removeNode(o.head.value);break}s=e.previous,o.removeNode(e.value),pushAdd(e.value)}const a={texts:this.texts.map((e=>{const i=e.node;return i.parentNode&&"TEXTAREA"===i.parentNode.tagName&&this.genTextAreaValueMutation(i.parentNode),{id:this.mirror.getId(i),value:e.value}})).filter((e=>!i.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:i}=e;if("string"==typeof i.style){const o=JSON.stringify(e.styleDiff),s=JSON.stringify(e._unchangedStyles);o.length<i.style.length&&(o+s).split("var(").length===i.style.split("var(").length&&(i.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:i}})).filter((e=>!i.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.genTextAreaValueMutation=e=>{let i=this.attributeMap.get(e);i||(i={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(e,i)),i.attributes.value=Array.from(e.childNodes,(e=>e.textContent||"")).join("")},this.processMutation=e=>{if(!isIgnored(e.target,this.mirror))switch(e.type){case"characterData":{const i=e.target.textContent;isBlocked(e.target,this.blockClass,this.blockSelector,!1)||i===e.oldValue||this.texts.push({value:needMaskingText(e.target,this.maskTextClass,this.maskTextSelector,!0)&&i?this.maskTextFn?this.maskTextFn(i,closestElementOfNode(e.target)):i.replace(/[\S]/g,"*"):i,node:e.target});break}case"attributes":{const o=e.target;let s=e.attributeName,a=e.target.getAttribute(s);if("value"===s){const e=getInputType(o);a=maskInputValue({element:o,maskInputOptions:this.maskInputOptions,tagName:o.tagName,type:e,value:a,maskInputFn:this.maskInputFn})}if(isBlocked(e.target,this.blockClass,this.blockSelector,!1)||a===e.oldValue)return;let h=this.attributeMap.get(e.target);if("IFRAME"===o.tagName&&"src"===s&&!this.keepIframeSrcFn(a)){if(o.contentDocument)return;s="rr_src"}if(h||(h={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(h),this.attributeMap.set(e.target,h)),"type"===s&&"INPUT"===o.tagName&&"password"===(e.oldValue||"").toLowerCase()&&o.setAttribute("data-rr-is-password","true"),!ignoreAttribute(o.tagName,s)&&(h.attributes[s]=transformAttribute(this.doc,toLowerCase(o.tagName),toLowerCase(s),a),"style"===s)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(i){this.unattachedDoc=this.doc}const s=this.unattachedDoc.createElement("span");e.oldValue&&s.setAttribute("style",e.oldValue);for(const e of Array.from(o.style)){const i=o.style.getPropertyValue(e),a=o.style.getPropertyPriority(e);i!==s.style.getPropertyValue(e)||a!==s.style.getPropertyPriority(e)?h.styleDiff[e]=""===a?i:[i,a]:h._unchangedStyles[e]=[i,a]}for(const e of Array.from(s.style))""===o.style.getPropertyValue(e)&&(h.styleDiff[e]=!1)}break}case"childList":if(isBlocked(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((i=>this.genAdds(i,e.target))),e.removedNodes.forEach((i=>{const o=this.mirror.getId(i),s=isShadowRoot(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);isBlocked(e.target,this.blockClass,this.blockSelector,!1)||isIgnored(i,this.mirror)||!function isSerialized(e,i){return-1!==i.getId(e)}(i,this.mirror)||(this.addedSet.has(i)?(deepDelete(this.addedSet,i),this.droppedSet.add(i)):this.addedSet.has(e.target)&&-1===o||isAncestorRemoved(e.target,this.mirror)||(this.movedSet.has(i)&&this.movedMap[moveKey(o,s)]?deepDelete(this.movedSet,i):this.removes.push({parentId:s,id:o,isShadow:!(!isShadowRoot(e.target)||!isNativeShadowDom(e.target))||void 0})),this.mapRemoves.push(i))}))}},this.genAdds=(e,i)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(isIgnored(e,this.mirror))return;this.movedSet.add(e);let o=null;i&&this.mirror.hasNode(i)&&(o=this.mirror.getId(i)),o&&-1!==o&&(this.movedMap[moveKey(this.mirror.getId(e),o)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);isBlocked(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),hasShadowRoot(e)&&e.shadowRoot.childNodes.forEach((i=>{this.processedNodeManager.add(i,this),this.genAdds(i,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((i=>{this[i]=e[i]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function deepDelete(e,i){e.delete(i),i.childNodes.forEach((i=>deepDelete(e,i)))}function isParentRemoved(e,i,o){return 0!==e.length&&_isParentRemoved(e,i,o)}function _isParentRemoved(e,i,o){const{parentNode:s}=i;if(!s)return!1;const a=o.getId(s);return!!e.some((e=>e.id===a))||_isParentRemoved(e,s,o)}function isAncestorInSet(e,i){return 0!==e.size&&_isAncestorInSet(e,i)}function _isAncestorInSet(e,i){const{parentNode:o}=i;return!!o&&(!!e.has(o)||_isAncestorInSet(e,o))}let or;const callbackWrapper=e=>{if(!or)return e;return(...i)=>{try{return e(...i)}catch(Or){if(or&&!0===or(Or))return;throw Or}}},sr=[];function getEventTarget(e){try{if("composedPath"in e){const i=e.composedPath();if(i.length)return i[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(i){}return e&&e.target}function initMutationObserver(e,i){var o,s;const a=new MutationBuffer;sr.push(a),a.init(e);let h=window.MutationObserver||window.__rrMutationObserver;const f=null===(s=null===(o=null===window||void 0===window?void 0:window.Zone)||void 0===o?void 0:o.__symbol__)||void 0===s?void 0:s.call(o,"MutationObserver");f&&window[f]&&(h=window[f]);const g=new h(callbackWrapper(a.processMutations.bind(a)));return g.observe(i,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),g}function initMouseInteractionObserver({mouseInteractionCb:e,doc:i,mirror:o,blockClass:s,blockSelector:a,sampling:h}){if(!1===h.mouseInteraction)return()=>{};const f=!0===h.mouseInteraction||void 0===h.mouseInteraction?{}:h.mouseInteraction,g=[];let _=null;return Object.keys(rr).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==f[e])).forEach((h=>{let f=toLowerCase(h);const v=(i=>h=>{const f=getEventTarget(h);if(isBlocked(f,s,a,!0))return;let g=null,v=i;if("pointerType"in h){switch(h.pointerType){case"mouse":g=nr.Mouse;break;case"touch":g=nr.Touch;break;case"pen":g=nr.Pen}g===nr.Touch?rr[i]===rr.MouseDown?v="TouchStart":rr[i]===rr.MouseUp&&(v="TouchEnd"):nr.Pen}else legacy_isTouchEvent(h)&&(g=nr.Touch);null!==g?(_=g,(v.startsWith("Touch")&&g===nr.Touch||v.startsWith("Mouse")&&g===nr.Mouse)&&(g=null)):rr[i]===rr.Click&&(g=_,_=null);const b=legacy_isTouchEvent(h)?h.changedTouches[0]:h;if(!b)return;const S=o.getId(f),{clientX:I,clientY:x}=b;callbackWrapper(e)(Object.assign({type:rr[v],id:S,x:I,y:x},null!==g&&{pointerType:g}))})(h);if(window.PointerEvent)switch(rr[h]){case rr.MouseDown:case rr.MouseUp:f=f.replace("mouse","pointer");break;case rr.TouchStart:case rr.TouchEnd:return}g.push(on(f,v,i))})),callbackWrapper((()=>{g.forEach((e=>e()))}))}function initScrollObserver({scrollCb:e,doc:i,mirror:o,blockClass:s,blockSelector:a,sampling:h}){return on("scroll",callbackWrapper(throttle(callbackWrapper((h=>{const f=getEventTarget(h);if(!f||isBlocked(f,s,a,!0))return;const g=o.getId(f);if(f===i&&i.defaultView){const o=getWindowScroll(i.defaultView);e({id:g,x:o.left,y:o.top})}else e({id:g,x:f.scrollLeft,y:f.scrollTop})})),h.scroll||100)),i)}const ar=["INPUT","TEXTAREA","SELECT"],cr=new WeakMap;function getNestedCSSRulePositions(e){return function recurse(e,i){if(hasNestedCSSRule("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||hasNestedCSSRule("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||hasNestedCSSRule("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||hasNestedCSSRule("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const o=Array.from(e.parentRule.cssRules).indexOf(e);i.unshift(o)}else if(e.parentStyleSheet){const o=Array.from(e.parentStyleSheet.cssRules).indexOf(e);i.unshift(o)}return i}(e,[])}function getIdAndStyleId(e,i,o){let s,a;return e?(e.ownerNode?s=i.getId(e.ownerNode):a=o.getId(e),{styleId:a,id:s}):{}}function initAdoptedStyleSheetObserver({mirror:e,stylesheetManager:i},o){var s,a,h;let f=null;f="#document"===o.nodeName?e.getId(o):e.getId(o.host);const g="#document"===o.nodeName?null===(s=o.defaultView)||void 0===s?void 0:s.Document:null===(h=null===(a=o.ownerDocument)||void 0===a?void 0:a.defaultView)||void 0===h?void 0:h.ShadowRoot,_=(null==g?void 0:g.prototype)?Object.getOwnPropertyDescriptor(null==g?void 0:g.prototype,"adoptedStyleSheets"):void 0;return null!==f&&-1!==f&&g&&_?(Object.defineProperty(o,"adoptedStyleSheets",{configurable:_.configurable,enumerable:_.enumerable,get(){var e;return null===(e=_.get)||void 0===e?void 0:e.call(this)},set(e){var o;const s=null===(o=_.set)||void 0===o?void 0:o.call(this,e);if(null!==f&&-1!==f)try{i.adoptStyleSheets(e,f)}catch(a){}return s}}),callbackWrapper((()=>{Object.defineProperty(o,"adoptedStyleSheets",{configurable:_.configurable,enumerable:_.enumerable,get:_.get,set:_.set})}))):()=>{}}function initObservers(e,i={}){const o=e.doc.defaultView;if(!o)return()=>{};let s;!function mergeHooks(e,i){const{mutationCb:o,mousemoveCb:s,mouseInteractionCb:a,scrollCb:h,viewportResizeCb:f,inputCb:g,mediaInteractionCb:_,styleSheetRuleCb:v,styleDeclarationCb:b,canvasMutationCb:S,fontCb:I,selectionCb:x,customElementCb:T}=e;e.mutationCb=(...e)=>{i.mutation&&i.mutation(...e),o(...e)},e.mousemoveCb=(...e)=>{i.mousemove&&i.mousemove(...e),s(...e)},e.mouseInteractionCb=(...e)=>{i.mouseInteraction&&i.mouseInteraction(...e),a(...e)},e.scrollCb=(...e)=>{i.scroll&&i.scroll(...e),h(...e)},e.viewportResizeCb=(...e)=>{i.viewportResize&&i.viewportResize(...e),f(...e)},e.inputCb=(...e)=>{i.input&&i.input(...e),g(...e)},e.mediaInteractionCb=(...e)=>{i.mediaInteaction&&i.mediaInteaction(...e),_(...e)},e.styleSheetRuleCb=(...e)=>{i.styleSheetRule&&i.styleSheetRule(...e),v(...e)},e.styleDeclarationCb=(...e)=>{i.styleDeclaration&&i.styleDeclaration(...e),b(...e)},e.canvasMutationCb=(...e)=>{i.canvasMutation&&i.canvasMutation(...e),S(...e)},e.fontCb=(...e)=>{i.font&&i.font(...e),I(...e)},e.selectionCb=(...e)=>{i.selection&&i.selection(...e),x(...e)},e.customElementCb=(...e)=>{i.customElement&&i.customElement(...e),T(...e)}}(e,i),e.recordDOM&&(s=initMutationObserver(e,e.doc));const a=function initMoveObserver({mousemoveCb:e,sampling:i,doc:o,mirror:s}){if(!1===i.mousemove)return()=>{};const a="number"==typeof i.mousemove?i.mousemove:50,h="number"==typeof i.mousemoveCallback?i.mousemoveCallback:500;let f,g=[];const _=throttle(callbackWrapper((i=>{const o=Date.now()-f;e(g.map((e=>(e.timeOffset-=o,e))),i),g=[],f=null})),h),v=callbackWrapper(throttle(callbackWrapper((e=>{const i=getEventTarget(e),{clientX:o,clientY:a}=legacy_isTouchEvent(e)?e.changedTouches[0]:e;f||(f=Qt()),g.push({x:o,y:a,id:s.getId(i),timeOffset:Qt()-f}),_("undefined"!=typeof DragEvent&&e instanceof DragEvent?tr.Drag:e instanceof MouseEvent?tr.MouseMove:tr.TouchMove)})),a,{trailing:!1})),b=[on("mousemove",v,o),on("touchmove",v,o),on("drag",v,o)];return callbackWrapper((()=>{b.forEach((e=>e()))}))}(e),h=initMouseInteractionObserver(e),f=initScrollObserver(e),g=function initViewportResizeObserver({viewportResizeCb:e},{win:i}){let o=-1,s=-1;return on("resize",callbackWrapper(throttle(callbackWrapper((()=>{const i=getWindowHeight(),a=getWindowWidth();o===i&&s===a||(e({width:Number(a),height:Number(i)}),o=i,s=a)})),200)),i)}(e,{win:o}),_=function initInputObserver({inputCb:e,doc:i,mirror:o,blockClass:s,blockSelector:a,ignoreClass:h,ignoreSelector:f,maskInputOptions:g,maskInputFn:_,sampling:v,userTriggeredOnInput:b}){function eventHandler(e){let o=getEventTarget(e);const v=e.isTrusted,S=o&&o.tagName;if(o&&"OPTION"===S&&(o=o.parentElement),!o||!S||ar.indexOf(S)<0||isBlocked(o,s,a,!0))return;if(o.classList.contains(h)||f&&o.matches(f))return;let I=o.value,x=!1;const T=getInputType(o)||"";"radio"===T||"checkbox"===T?x=o.checked:(g[S.toLowerCase()]||g[T])&&(I=maskInputValue({element:o,maskInputOptions:g,tagName:S,type:T,value:I,maskInputFn:_})),cbWithDedup(o,b?{text:I,isChecked:x,userTriggered:v}:{text:I,isChecked:x});const O=o.name;"radio"===T&&O&&x&&i.querySelectorAll(`input[type="radio"][name="${O}"]`).forEach((e=>{if(e!==o){const i=e.value;cbWithDedup(e,b?{text:i,isChecked:!x,userTriggered:!1}:{text:i,isChecked:!x})}}))}function cbWithDedup(i,s){const a=cr.get(i);if(!a||a.text!==s.text||a.isChecked!==s.isChecked){cr.set(i,s);const a=o.getId(i);callbackWrapper(e)(Object.assign(Object.assign({},s),{id:a}))}}const S=("last"===v.input?["change"]:["input","change"]).map((e=>on(e,callbackWrapper(eventHandler),i))),I=i.defaultView;if(!I)return()=>{S.forEach((e=>e()))};const x=I.Object.getOwnPropertyDescriptor(I.HTMLInputElement.prototype,"value"),T=[[I.HTMLInputElement.prototype,"value"],[I.HTMLInputElement.prototype,"checked"],[I.HTMLSelectElement.prototype,"value"],[I.HTMLTextAreaElement.prototype,"value"],[I.HTMLSelectElement.prototype,"selectedIndex"],[I.HTMLOptionElement.prototype,"selected"]];return x&&x.set&&S.push(...T.map((e=>hookSetter(e[0],e[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,I)))),callbackWrapper((()=>{S.forEach((e=>e()))}))}(e),v=function initMediaInteractionObserver({mediaInteractionCb:e,blockClass:i,blockSelector:o,mirror:s,sampling:a,doc:h}){const f=callbackWrapper((h=>throttle(callbackWrapper((a=>{const f=getEventTarget(a);if(!f||isBlocked(f,i,o,!0))return;const{currentTime:g,volume:_,muted:v,playbackRate:b,loop:S}=f;e({type:h,id:s.getId(f),currentTime:g,volume:_,muted:v,playbackRate:b,loop:S})})),a.media||500))),g=[on("play",f(0),h),on("pause",f(1),h),on("seeked",f(2),h),on("volumechange",f(3),h),on("ratechange",f(4),h)];return callbackWrapper((()=>{g.forEach((e=>e()))}))}(e);let styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};e.recordDOM&&(styleSheetObserver=function initStyleSheetObserver({styleSheetRuleCb:e,mirror:i,stylesheetManager:o},{win:s}){if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};const a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:callbackWrapper(((s,a,h)=>{const[f,g]=h,{id:_,styleId:v}=getIdAndStyleId(a,i,o.styleMirror);return(_&&-1!==_||v&&-1!==v)&&e({id:_,styleId:v,adds:[{rule:f,index:g}]}),s.apply(a,h)}))});const h=s.CSSStyleSheet.prototype.deleteRule;let f,g;s.CSSStyleSheet.prototype.deleteRule=new Proxy(h,{apply:callbackWrapper(((s,a,h)=>{const[f]=h,{id:g,styleId:_}=getIdAndStyleId(a,i,o.styleMirror);return(g&&-1!==g||_&&-1!==_)&&e({id:g,styleId:_,removes:[{index:f}]}),s.apply(a,h)}))}),s.CSSStyleSheet.prototype.replace&&(f=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(f,{apply:callbackWrapper(((s,a,h)=>{const[f]=h,{id:g,styleId:_}=getIdAndStyleId(a,i,o.styleMirror);return(g&&-1!==g||_&&-1!==_)&&e({id:g,styleId:_,replace:f}),s.apply(a,h)}))})),s.CSSStyleSheet.prototype.replaceSync&&(g=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(g,{apply:callbackWrapper(((s,a,h)=>{const[f]=h,{id:g,styleId:_}=getIdAndStyleId(a,i,o.styleMirror);return(g&&-1!==g||_&&-1!==_)&&e({id:g,styleId:_,replaceSync:f}),s.apply(a,h)}))}));const _={};canMonkeyPatchNestedCSSRule("CSSGroupingRule")?_.CSSGroupingRule=s.CSSGroupingRule:(canMonkeyPatchNestedCSSRule("CSSMediaRule")&&(_.CSSMediaRule=s.CSSMediaRule),canMonkeyPatchNestedCSSRule("CSSConditionRule")&&(_.CSSConditionRule=s.CSSConditionRule),canMonkeyPatchNestedCSSRule("CSSSupportsRule")&&(_.CSSSupportsRule=s.CSSSupportsRule));const v={};return Object.entries(_).forEach((([s,a])=>{v[s]={insertRule:a.prototype.insertRule,deleteRule:a.prototype.deleteRule},a.prototype.insertRule=new Proxy(v[s].insertRule,{apply:callbackWrapper(((s,a,h)=>{const[f,g]=h,{id:_,styleId:v}=getIdAndStyleId(a.parentStyleSheet,i,o.styleMirror);return(_&&-1!==_||v&&-1!==v)&&e({id:_,styleId:v,adds:[{rule:f,index:[...getNestedCSSRulePositions(a),g||0]}]}),s.apply(a,h)}))}),a.prototype.deleteRule=new Proxy(v[s].deleteRule,{apply:callbackWrapper(((s,a,h)=>{const[f]=h,{id:g,styleId:_}=getIdAndStyleId(a.parentStyleSheet,i,o.styleMirror);return(g&&-1!==g||_&&-1!==_)&&e({id:g,styleId:_,removes:[{index:[...getNestedCSSRulePositions(a),f]}]}),s.apply(a,h)}))})})),callbackWrapper((()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=h,f&&(s.CSSStyleSheet.prototype.replace=f),g&&(s.CSSStyleSheet.prototype.replaceSync=g),Object.entries(_).forEach((([e,i])=>{i.prototype.insertRule=v[e].insertRule,i.prototype.deleteRule=v[e].deleteRule}))}))}(e,{win:o}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(e,e.doc),styleDeclarationObserver=function initStyleDeclarationObserver({styleDeclarationCb:e,mirror:i,ignoreCSSAttributes:o,stylesheetManager:s},{win:a}){const h=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(h,{apply:callbackWrapper(((a,f,g)=>{var _;const[v,b,S]=g;if(o.has(v))return h.apply(f,[v,b,S]);const{id:I,styleId:x}=getIdAndStyleId(null===(_=f.parentRule)||void 0===_?void 0:_.parentStyleSheet,i,s.styleMirror);return(I&&-1!==I||x&&-1!==x)&&e({id:I,styleId:x,set:{property:v,value:b,priority:S},index:getNestedCSSRulePositions(f.parentRule)}),a.apply(f,g)}))});const f=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(f,{apply:callbackWrapper(((a,h,g)=>{var _;const[v]=g;if(o.has(v))return f.apply(h,[v]);const{id:b,styleId:S}=getIdAndStyleId(null===(_=h.parentRule)||void 0===_?void 0:_.parentStyleSheet,i,s.styleMirror);return(b&&-1!==b||S&&-1!==S)&&e({id:b,styleId:S,remove:{property:v},index:getNestedCSSRulePositions(h.parentRule)}),a.apply(h,g)}))}),callbackWrapper((()=>{a.CSSStyleDeclaration.prototype.setProperty=h,a.CSSStyleDeclaration.prototype.removeProperty=f}))}(e,{win:o}),e.collectFonts&&(fontObserver=function initFontObserver({fontCb:e,doc:i}){const o=i.defaultView;if(!o)return()=>{};const s=[],a=new WeakMap,h=o.FontFace;o.FontFace=function FontFace(e,i,o){const s=new h(e,i,o);return a.set(s,{family:e,buffer:"string"!=typeof i,descriptors:o,fontSource:"string"==typeof i?i:JSON.stringify(Array.from(new Uint8Array(i)))}),s};const f=patch(i.fonts,"add",(function(i){return function(o){return setTimeout(callbackWrapper((()=>{const i=a.get(o);i&&(e(i),a.delete(o))})),0),i.apply(this,[o])}}));return s.push((()=>{o.FontFace=h})),s.push(f),callbackWrapper((()=>{s.forEach((e=>e()))}))}(e)));const b=function initSelectionObserver(e){const{doc:i,mirror:o,blockClass:s,blockSelector:a,selectionCb:h}=e;let f=!0;const g=callbackWrapper((()=>{const e=i.getSelection();if(!e||f&&(null==e?void 0:e.isCollapsed))return;f=e.isCollapsed||!1;const g=[],_=e.rangeCount||0;for(let i=0;i<_;i++){const h=e.getRangeAt(i),{startContainer:f,startOffset:_,endContainer:v,endOffset:b}=h;isBlocked(f,s,a,!0)||isBlocked(v,s,a,!0)||g.push({start:o.getId(f),startOffset:_,end:o.getId(v),endOffset:b})}h({ranges:g})}));return g(),on("selectionchange",g)}(e),S=function initCustomElementObserver({doc:e,customElementCb:i}){const o=e.defaultView;return o&&o.customElements?patch(o.customElements,"define",(function(e){return function(o,s,a){try{i({define:{name:o}})}catch(h){console.warn(`Custom element callback failed for ${o}`)}return e.apply(this,[o,s,a])}})):()=>{}}(e),I=[];for(const x of e.plugins)I.push(x.observer(x.callback,o,x.options));return callbackWrapper((()=>{sr.forEach((e=>e.reset())),null==s||s.disconnect(),a(),h(),f(),g(),_(),v(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),b(),S(),I.forEach((e=>e()))}))}function hasNestedCSSRule(e){return void 0!==window[e]}function canMonkeyPatchNestedCSSRule(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class CrossOriginIframeMirror{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,i,o,s){const a=o||this.getIdToRemoteIdMap(e),h=s||this.getRemoteIdToIdMap(e);let f=a.get(i);return f||(f=this.generateIdFn(),a.set(i,f),h.set(f,i)),f}getIds(e,i){const o=this.getIdToRemoteIdMap(e),s=this.getRemoteIdToIdMap(e);return i.map((i=>this.getId(e,i,o,s)))}getRemoteId(e,i,o){const s=o||this.getRemoteIdToIdMap(e);if("number"!=typeof i)return i;const a=s.get(i);return a||-1}getRemoteIds(e,i){const o=this.getRemoteIdToIdMap(e);return i.map((i=>this.getRemoteId(e,i,o)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let i=this.iframeIdToRemoteIdMap.get(e);return i||(i=new Map,this.iframeIdToRemoteIdMap.set(e,i)),i}getRemoteIdToIdMap(e){let i=this.iframeRemoteIdToIdMap.get(e);return i||(i=new Map,this.iframeRemoteIdToIdMap.set(e,i)),i}}class IframeManager{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new CrossOriginIframeMirror(genId),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,i){var o;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:i}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(o=this.loadListener)||void 0===o||o.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const i=e;if("rrweb"!==i.data.type||i.origin!==i.data.origin)return;if(!e.source)return;const o=this.crossOriginIframeMap.get(e.source);if(!o)return;const s=this.transformCrossOriginEvent(o,i.data.event);s&&this.wrappedEmit(s,i.data.isCheckout)}transformCrossOriginEvent(e,i){var o;switch(i.type){case er.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(i.data.node,e);const o=i.data.node.id;return this.crossOriginIframeRootIdMap.set(e,o),this.patchRootIdOnNode(i.data.node,o),{timestamp:i.timestamp,type:er.IncrementalSnapshot,data:{source:tr.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:i.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case er.Meta:case er.Load:case er.DomContentLoaded:return!1;case er.Plugin:return i;case er.Custom:return this.replaceIds(i.data.payload,e,["id","parentId","previousId","nextId"]),i;case er.IncrementalSnapshot:switch(i.data.source){case tr.Mutation:return i.data.adds.forEach((i=>{this.replaceIds(i,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,e);const o=this.crossOriginIframeRootIdMap.get(e);o&&this.patchRootIdOnNode(i.node,o)})),i.data.removes.forEach((i=>{this.replaceIds(i,e,["parentId","id"])})),i.data.attributes.forEach((i=>{this.replaceIds(i,e,["id"])})),i.data.texts.forEach((i=>{this.replaceIds(i,e,["id"])})),i;case tr.Drag:case tr.TouchMove:case tr.MouseMove:return i.data.positions.forEach((i=>{this.replaceIds(i,e,["id"])})),i;case tr.ViewportResize:return!1;case tr.MediaInteraction:case tr.MouseInteraction:case tr.Scroll:case tr.CanvasMutation:case tr.Input:return this.replaceIds(i.data,e,["id"]),i;case tr.StyleSheetRule:case tr.StyleDeclaration:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleId"]),i;case tr.Font:return i;case tr.Selection:return i.data.ranges.forEach((i=>{this.replaceIds(i,e,["start","end"])})),i;case tr.AdoptedStyleSheet:return this.replaceIds(i.data,e,["id"]),this.replaceStyleIds(i.data,e,["styleIds"]),null===(o=i.data.styles)||void 0===o||o.forEach((i=>{this.replaceStyleIds(i,e,["styleId"])})),i}}return!1}replace(e,i,o,s){for(const a of s)(Array.isArray(i[a])||"number"==typeof i[a])&&(Array.isArray(i[a])?i[a]=e.getIds(o,i[a]):i[a]=e.getId(o,i[a]));return i}replaceIds(e,i,o){return this.replace(this.crossOriginIframeMirror,e,i,o)}replaceStyleIds(e,i,o){return this.replace(this.crossOriginIframeStyleMirror,e,i,o)}replaceIdOnNode(e,i){this.replaceIds(e,i,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,i)}))}patchRootIdOnNode(e,i){e.type===Lt.Document||e.rootId||(e.rootId=i),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,i)}))}}class ShadowDomManager{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,i){if(!isNativeShadowDom(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const o=initMutationObserver(Object.assign(Object.assign({},this.bypassOptions),{doc:i,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>o.disconnect())),this.restoreHandlers.push(initScrollObserver(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(initAdoptedStyleSheetObserver({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,i){const o=this;this.restoreHandlers.push(patch(e.prototype,"attachShadow",(function(e){return function(s){const a=e.call(this,s);return this.shadowRoot&&inDom(this)&&o.addShadowRoot(this.shadowRoot,i),a}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(i){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
1
+ "use strict";var e,r,i;(r=e||(e={})).assertEqual=e=>e,r.assertIs=function assertIs(e){},r.assertNever=function assertNever(e){throw new Error},r.arrayToEnum=e=>{const r={};for(const i of e)r[i]=i;return r},r.getValidEnumValues=e=>{const i=r.objectKeys(e).filter((r=>"number"!=typeof e[e[r]])),s={};for(const r of i)s[r]=e[r];return r.objectValues(s)},r.objectValues=e=>r.objectKeys(e).map((function(r){return e[r]})),r.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const r=[];for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&r.push(i);return r},r.find=(e,r)=>{for(const i of e)if(r(i))return i},r.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,r.joinValues=function joinValues(e,r=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(r)},r.jsonStringifyReplacer=(e,r)=>"bigint"==typeof r?r.toString():r,(i||(i={})).mergeShapes=(e,r)=>({...e,...r});const s=e.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=e=>{switch(typeof e){case"undefined":return s.undefined;case"string":return s.string;case"number":return isNaN(e)?s.nan:s.number;case"boolean":return s.boolean;case"function":return s.function;case"bigint":return s.bigint;case"symbol":return s.symbol;case"object":return Array.isArray(e)?s.array:null===e?s.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?s.promise:"undefined"!=typeof Map&&e instanceof Map?s.map:"undefined"!=typeof Set&&e instanceof Set?s.set:"undefined"!=typeof Date&&e instanceof Date?s.date:s.object;default:return s.unknown}},a=e.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 ZodError extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};const r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const r=e||function(e){return e.message},i={_errors:[]},processError=e=>{for(const s of e.issues)if("invalid_union"===s.code)s.unionErrors.map(processError);else if("invalid_return_type"===s.code)processError(s.returnTypeError);else if("invalid_arguments"===s.code)processError(s.argumentsError);else if(0===s.path.length)i._errors.push(r(s));else{let e=i,a=0;for(;a<s.path.length;){const i=s.path[a];a===s.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(r(s))):e[i]=e[i]||{_errors:[]},e=e[i],a++}}};return processError(this),i}static assert(e){if(!(e instanceof ZodError))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,e.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){const r={},i=[];for(const s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(e(s))):i.push(e(s));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(r,i)=>{let h;switch(r.code){case a.invalid_type:h=r.received===s.undefined?"Required":`Expected ${r.expected}, received ${r.received}`;break;case a.invalid_literal:h=`Invalid literal value, expected ${JSON.stringify(r.expected,e.jsonStringifyReplacer)}`;break;case a.unrecognized_keys:h=`Unrecognized key(s) in object: ${e.joinValues(r.keys,", ")}`;break;case a.invalid_union:h="Invalid input";break;case a.invalid_union_discriminator:h=`Invalid discriminator value. Expected ${e.joinValues(r.options)}`;break;case a.invalid_enum_value:h=`Invalid enum value. Expected ${e.joinValues(r.options)}, received '${r.received}'`;break;case a.invalid_arguments:h="Invalid function arguments";break;case a.invalid_return_type:h="Invalid function return type";break;case a.invalid_date:h="Invalid date";break;case a.invalid_string:"object"==typeof r.validation?"includes"in r.validation?(h=`Invalid input: must include "${r.validation.includes}"`,"number"==typeof r.validation.position&&(h=`${h} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?h=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?h=`Invalid input: must end with "${r.validation.endsWith}"`:e.assertNever(r.validation):h="regex"!==r.validation?`Invalid ${r.validation}`:"Invalid";break;case a.too_small:h="array"===r.type?`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:"string"===r.type?`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:"number"===r.type?`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:"date"===r.type?`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:"Invalid input";break;case a.too_big:h="array"===r.type?`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:"string"===r.type?`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:"number"===r.type?`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:"bigint"===r.type?`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:"date"===r.type?`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:"Invalid input";break;case a.custom:h="Invalid input";break;case a.invalid_intersection_types:h="Intersection results could not be merged";break;case a.not_multiple_of:h=`Number must be a multiple of ${r.multipleOf}`;break;case a.not_finite:h="Number must be finite";break;default:h=i.defaultError,e.assertNever(r)}return{message:h}};let h=errorMap;function getErrorMap(){return h}const makeIssue=e=>{const{data:r,path:i,errorMaps:s,issueData:a}=e,h=[...i,...a.path||[]],f={...a,path:h};if(void 0!==a.message)return{...a,path:h,message:a.message};let _="";const v=s.filter((e=>!!e)).slice().reverse();for(const b of v)_=b(f,{data:r,defaultError:_}).message;return{...a,path:h,message:_}};function addIssueToContext(e,r){const i=getErrorMap(),s=makeIssue({issueData:r,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,i,i===errorMap?void 0:errorMap].filter((e=>!!e))});e.common.issues.push(s)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,r){const i=[];for(const s of r){if("aborted"===s.status)return f;"dirty"===s.status&&e.dirty(),i.push(s.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){const i=[];for(const s of r){const e=await s.key,r=await s.value;i.push({key:e,value:r})}return ParseStatus.mergeObjectSync(e,i)}static mergeObjectSync(e,r){const i={};for(const s of r){const{key:r,value:a}=s;if("aborted"===r.status)return f;if("aborted"===a.status)return f;"dirty"===r.status&&e.dirty(),"dirty"===a.status&&e.dirty(),"__proto__"===r.value||void 0===a.value&&!s.alwaysSet||(i[r.value]=a.value)}return{status:e.value,value:i}}}const f=Object.freeze({status:"aborted"}),DIRTY=e=>({status:"dirty",value:e}),OK=e=>({status:"valid",value:e}),isAborted=e=>"aborted"===e.status,isDirty=e=>"dirty"===e.status,isValid=e=>"valid"===e.status,isAsync=e=>"undefined"!=typeof Promise&&e instanceof Promise;function __classPrivateFieldGet(e,r,i,s){if("function"==typeof r?e!==r||!s:!r.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r.get(e)}function __classPrivateFieldSet(e,r,i,s,a){if("function"==typeof r?e!==r||!a:!r.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r.set(e,i),i}var _,v,b,S;"function"==typeof SuppressedError&&SuppressedError,(v=_||(_={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},v.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,r,i,s){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,this._key=s}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const handleResult=(e,r)=>{if(isValid(r))return{success:!0,data:r.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const r=new ZodError(e.common.issues);return this._error=r,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:r,invalid_type_error:i,required_error:s,description:a}=e;if(r&&(i||s))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(r)return{errorMap:r,description:a};return{errorMap:(r,a)=>{var h,f;const{message:_}=e;return"invalid_enum_value"===r.code?{message:null!=_?_:a.defaultError}:void 0===a.data?{message:null!==(h=null!=_?_:s)&&void 0!==h?h:a.defaultError}:"invalid_type"!==r.code?{message:a.defaultError}:{message:null!==(f=null!=_?_:i)&&void 0!==f?f:a.defaultError}},description:a}}class ZodType{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return getParsedType(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:getParsedType(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const r=this._parse(e);if(isAsync(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){const r=this._parse(e);return Promise.resolve(r)}parse(e,r){const i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){var i;const s={common:{issues:[],async:null!==(i=null==r?void 0:r.async)&&void 0!==i&&i,contextualErrorMap:null==r?void 0:r.errorMap},path:(null==r?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},a=this._parseSync({data:e,path:s.path,parent:s});return handleResult(s,a)}async parseAsync(e,r){const i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){const i={common:{issues:[],contextualErrorMap:null==r?void 0:r.errorMap,async:!0},path:(null==r?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},s=this._parse({data:e,path:i.path,parent:i}),a=await(isAsync(s)?s:Promise.resolve(s));return handleResult(i,a)}refine(e,r){const getIssueProperties=e=>"string"==typeof r||void 0===r?{message:r}:"function"==typeof r?r(e):r;return this._refinement(((r,i)=>{const s=e(r),setError=()=>i.addIssue({code:a.custom,...getIssueProperties(r)});return"undefined"!=typeof Promise&&s instanceof Promise?s.then((e=>!!e||(setError(),!1))):!!s||(setError(),!1)}))}refinement(e,r){return this._refinement(((i,s)=>!!e(i)||(s.addIssue("function"==typeof r?r(i,s):r),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:B.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ZodOptional.create(this,this._def)}nullable(){return ZodNullable.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ZodArray.create(this,this._def)}promise(){return ZodPromise.create(this,this._def)}or(e){return ZodUnion.create([this,e],this._def)}and(e){return ZodIntersection.create(this,e,this._def)}transform(e){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:B.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const r="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:r,typeName:B.ZodDefault})}brand(){return new ZodBranded({typeName:B.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const r="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:r,typeName:B.ZodCatch})}describe(e){return new(0,this.constructor)({...this._def,description:e})}pipe(e){return ZodPipeline.create(this,e)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const I=/^c[^\s-]{8,}$/i,x=/^[0-9a-z]+$/,C=/^[0-9A-HJKMNP-TV-Z]{26}$/,T=/^[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,O=/^[a-z0-9_-]{21}$/i,R=/^[-+]?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)?)??$/,N=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let P;const D=/^(?:(?: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])$/,Z=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,A=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,L="((\\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])))",q=new RegExp(`^${L}$`);function timeRegexSource(e){let r="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?r=`${r}\\.\\d{${e.precision}}`:null==e.precision&&(r=`${r}(\\.\\d+)?`),r}function datetimeRegex(e){let r=`${L}T${timeRegexSource(e)}`;const i=[];return i.push(e.local?"Z?":"Z"),e.offset&&i.push("([+-]\\d{2}:?\\d{2})"),r=`${r}(${i.join("|")})`,new RegExp(`^${r}$`)}class ZodString extends ZodType{_parse(r){this._def.coerce&&(r.data=String(r.data));if(this._getType(r)!==s.string){const e=this._getOrReturnCtx(r);return addIssueToContext(e,{code:a.invalid_type,expected:s.string,received:e.parsedType}),f}const i=new ParseStatus;let h;for(const s of this._def.checks)if("min"===s.kind)r.data.length<s.value&&(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{code:a.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if("max"===s.kind)r.data.length>s.value&&(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{code:a.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),i.dirty());else if("length"===s.kind){const e=r.data.length>s.value,f=r.data.length<s.value;(e||f)&&(h=this._getOrReturnCtx(r,h),e?addIssueToContext(h,{code:a.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):f&&addIssueToContext(h,{code:a.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),i.dirty())}else if("email"===s.kind)N.test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"email",code:a.invalid_string,message:s.message}),i.dirty());else if("emoji"===s.kind)P||(P=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),P.test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"emoji",code:a.invalid_string,message:s.message}),i.dirty());else if("uuid"===s.kind)T.test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"uuid",code:a.invalid_string,message:s.message}),i.dirty());else if("nanoid"===s.kind)O.test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"nanoid",code:a.invalid_string,message:s.message}),i.dirty());else if("cuid"===s.kind)I.test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"cuid",code:a.invalid_string,message:s.message}),i.dirty());else if("cuid2"===s.kind)x.test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"cuid2",code:a.invalid_string,message:s.message}),i.dirty());else if("ulid"===s.kind)C.test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"ulid",code:a.invalid_string,message:s.message}),i.dirty());else if("url"===s.kind)try{new URL(r.data)}catch(b){h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"url",code:a.invalid_string,message:s.message}),i.dirty()}else if("regex"===s.kind){s.regex.lastIndex=0;s.regex.test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"regex",code:a.invalid_string,message:s.message}),i.dirty())}else if("trim"===s.kind)r.data=r.data.trim();else if("includes"===s.kind)r.data.includes(s.value,s.position)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{code:a.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),i.dirty());else if("toLowerCase"===s.kind)r.data=r.data.toLowerCase();else if("toUpperCase"===s.kind)r.data=r.data.toUpperCase();else if("startsWith"===s.kind)r.data.startsWith(s.value)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{code:a.invalid_string,validation:{startsWith:s.value},message:s.message}),i.dirty());else if("endsWith"===s.kind)r.data.endsWith(s.value)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{code:a.invalid_string,validation:{endsWith:s.value},message:s.message}),i.dirty());else if("datetime"===s.kind){datetimeRegex(s).test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{code:a.invalid_string,validation:"datetime",message:s.message}),i.dirty())}else if("date"===s.kind){q.test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{code:a.invalid_string,validation:"date",message:s.message}),i.dirty())}else if("time"===s.kind){new RegExp(`^${timeRegexSource(s)}$`).test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{code:a.invalid_string,validation:"time",message:s.message}),i.dirty())}else"duration"===s.kind?R.test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"duration",code:a.invalid_string,message:s.message}),i.dirty()):"ip"===s.kind?(_=r.data,("v4"!==(v=s.version)&&v||!D.test(_))&&("v6"!==v&&v||!Z.test(_))&&(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"ip",code:a.invalid_string,message:s.message}),i.dirty())):"base64"===s.kind?A.test(r.data)||(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{validation:"base64",code:a.invalid_string,message:s.message}),i.dirty()):e.assertNever(s);var _,v;return{status:i.value,value:r.data}}_regex(e,r,i){return this.refinement((r=>e.test(r)),{validation:r,code:a.invalid_string,..._.errToObj(i)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",..._.errToObj(e)})}url(e){return this._addCheck({kind:"url",..._.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",..._.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",..._.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",..._.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",..._.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",..._.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",..._.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",..._.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",..._.errToObj(e)})}datetime(e){var r,i;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(r=null==e?void 0:e.offset)&&void 0!==r&&r,local:null!==(i=null==e?void 0:e.local)&&void 0!==i&&i,..._.errToObj(null==e?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return"string"==typeof e?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,..._.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",..._.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,..._.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:null==r?void 0:r.position,..._.errToObj(null==r?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,..._.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,..._.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,..._.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,..._.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,..._.errToObj(r)})}nonempty(e){return this.min(1,_.errToObj(e))}trim(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ZodString({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e=>"datetime"===e.kind))}get isDate(){return!!this._def.checks.find((e=>"date"===e.kind))}get isTime(){return!!this._def.checks.find((e=>"time"===e.kind))}get isDuration(){return!!this._def.checks.find((e=>"duration"===e.kind))}get isEmail(){return!!this._def.checks.find((e=>"email"===e.kind))}get isURL(){return!!this._def.checks.find((e=>"url"===e.kind))}get isEmoji(){return!!this._def.checks.find((e=>"emoji"===e.kind))}get isUUID(){return!!this._def.checks.find((e=>"uuid"===e.kind))}get isNANOID(){return!!this._def.checks.find((e=>"nanoid"===e.kind))}get isCUID(){return!!this._def.checks.find((e=>"cuid"===e.kind))}get isCUID2(){return!!this._def.checks.find((e=>"cuid2"===e.kind))}get isULID(){return!!this._def.checks.find((e=>"ulid"===e.kind))}get isIP(){return!!this._def.checks.find((e=>"ip"===e.kind))}get isBase64(){return!!this._def.checks.find((e=>"base64"===e.kind))}get minLength(){let e=null;for(const r of this._def.checks)"min"===r.kind&&(null===e||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(const r of this._def.checks)"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return e}}function floatSafeRemainder(e,r){const i=(e.toString().split(".")[1]||"").length,s=(r.toString().split(".")[1]||"").length,a=i>s?i:s;return parseInt(e.toFixed(a).replace(".",""))%parseInt(r.toFixed(a).replace(".",""))/Math.pow(10,a)}ZodString.create=e=>{var r;return new ZodString({checks:[],typeName:B.ZodString,coerce:null!==(r=null==e?void 0:e.coerce)&&void 0!==r&&r,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(r){this._def.coerce&&(r.data=Number(r.data));if(this._getType(r)!==s.number){const e=this._getOrReturnCtx(r);return addIssueToContext(e,{code:a.invalid_type,expected:s.number,received:e.parsedType}),f}let i;const h=new ParseStatus;for(const s of this._def.checks)if("int"===s.kind)e.isInteger(r.data)||(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:a.invalid_type,expected:"integer",received:"float",message:s.message}),h.dirty());else if("min"===s.kind){(s.inclusive?r.data<s.value:r.data<=s.value)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:a.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),h.dirty())}else if("max"===s.kind){(s.inclusive?r.data>s.value:r.data>=s.value)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:a.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),h.dirty())}else"multipleOf"===s.kind?0!==floatSafeRemainder(r.data,s.value)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:a.not_multiple_of,multipleOf:s.value,message:s.message}),h.dirty()):"finite"===s.kind?Number.isFinite(r.data)||(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:a.not_finite,message:s.message}),h.dirty()):e.assertNever(s);return{status:h.value,value:r.data}}gte(e,r){return this.setLimit("min",e,!0,_.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.toString(r))}setLimit(e,r,i,s){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:_.toString(s)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:_.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:_.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:_.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:_.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:_.toString(e)})}get minValue(){let e=null;for(const r of this._def.checks)"min"===r.kind&&(null===e||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find((r=>"int"===r.kind||"multipleOf"===r.kind&&e.isInteger(r.value)))}get isFinite(){let e=null,r=null;for(const i of this._def.checks){if("finite"===i.kind||"int"===i.kind||"multipleOf"===i.kind)return!0;"min"===i.kind?(null===r||i.value>r)&&(r=i.value):"max"===i.kind&&(null===e||i.value<e)&&(e=i.value)}return Number.isFinite(r)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:B.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodBigInt extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(r){this._def.coerce&&(r.data=BigInt(r.data));if(this._getType(r)!==s.bigint){const e=this._getOrReturnCtx(r);return addIssueToContext(e,{code:a.invalid_type,expected:s.bigint,received:e.parsedType}),f}let i;const h=new ParseStatus;for(const s of this._def.checks)if("min"===s.kind){(s.inclusive?r.data<s.value:r.data<=s.value)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:a.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),h.dirty())}else if("max"===s.kind){(s.inclusive?r.data>s.value:r.data>=s.value)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:a.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),h.dirty())}else"multipleOf"===s.kind?r.data%s.value!==BigInt(0)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:a.not_multiple_of,multipleOf:s.value,message:s.message}),h.dirty()):e.assertNever(s);return{status:h.value,value:r.data}}gte(e,r){return this.setLimit("min",e,!0,_.toString(r))}gt(e,r){return this.setLimit("min",e,!1,_.toString(r))}lte(e,r){return this.setLimit("max",e,!0,_.toString(r))}lt(e,r){return this.setLimit("max",e,!1,_.toString(r))}setLimit(e,r,i,s){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:_.toString(s)}]})}_addCheck(e){return new ZodBigInt({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:_.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:_.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:_.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:_.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:_.toString(r)})}get minValue(){let e=null;for(const r of this._def.checks)"min"===r.kind&&(null===e||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(const r of this._def.checks)"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return e}}ZodBigInt.create=e=>{var r;return new ZodBigInt({checks:[],typeName:B.ZodBigInt,coerce:null!==(r=null==e?void 0:e.coerce)&&void 0!==r&&r,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==s.boolean){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:a.invalid_type,expected:s.boolean,received:r.parsedType}),f}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:B.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(r){this._def.coerce&&(r.data=new Date(r.data));if(this._getType(r)!==s.date){const e=this._getOrReturnCtx(r);return addIssueToContext(e,{code:a.invalid_type,expected:s.date,received:e.parsedType}),f}if(isNaN(r.data.getTime())){return addIssueToContext(this._getOrReturnCtx(r),{code:a.invalid_date}),f}const i=new ParseStatus;let h;for(const s of this._def.checks)"min"===s.kind?r.data.getTime()<s.value&&(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{code:a.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),i.dirty()):"max"===s.kind?r.data.getTime()>s.value&&(h=this._getOrReturnCtx(r,h),addIssueToContext(h,{code:a.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),i.dirty()):e.assertNever(s);return{status:i.value,value:new Date(r.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:_.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:_.toString(r)})}get minDate(){let e=null;for(const r of this._def.checks)"min"===r.kind&&(null===e||r.value>e)&&(e=r.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const r of this._def.checks)"max"===r.kind&&(null===e||r.value<e)&&(e=r.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:B.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==s.symbol){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:a.invalid_type,expected:s.symbol,received:r.parsedType}),f}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:B.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==s.undefined){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:a.invalid_type,expected:s.undefined,received:r.parsedType}),f}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:B.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==s.null){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:a.invalid_type,expected:s.null,received:r.parsedType}),f}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:B.ZodNull,...processCreateParams(e)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(e){return OK(e.data)}}ZodAny.create=e=>new ZodAny({typeName:B.ZodAny,...processCreateParams(e)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(e){return OK(e.data)}}ZodUnknown.create=e=>new ZodUnknown({typeName:B.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:a.invalid_type,expected:s.never,received:r.parsedType}),f}}ZodNever.create=e=>new ZodNever({typeName:B.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==s.undefined){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:a.invalid_type,expected:s.void,received:r.parsedType}),f}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:B.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:r,status:i}=this._processInputParams(e),h=this._def;if(r.parsedType!==s.array)return addIssueToContext(r,{code:a.invalid_type,expected:s.array,received:r.parsedType}),f;if(null!==h.exactLength){const e=r.data.length>h.exactLength.value,s=r.data.length<h.exactLength.value;(e||s)&&(addIssueToContext(r,{code:e?a.too_big:a.too_small,minimum:s?h.exactLength.value:void 0,maximum:e?h.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:h.exactLength.message}),i.dirty())}if(null!==h.minLength&&r.data.length<h.minLength.value&&(addIssueToContext(r,{code:a.too_small,minimum:h.minLength.value,type:"array",inclusive:!0,exact:!1,message:h.minLength.message}),i.dirty()),null!==h.maxLength&&r.data.length>h.maxLength.value&&(addIssueToContext(r,{code:a.too_big,maximum:h.maxLength.value,type:"array",inclusive:!0,exact:!1,message:h.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map(((e,i)=>h.type._parseAsync(new ParseInputLazyPath(r,e,r.path,i))))).then((e=>ParseStatus.mergeArray(i,e)));const _=[...r.data].map(((e,i)=>h.type._parseSync(new ParseInputLazyPath(r,e,r.path,i))));return ParseStatus.mergeArray(i,_)}get element(){return this._def.type}min(e,r){return new ZodArray({...this._def,minLength:{value:e,message:_.toString(r)}})}max(e,r){return new ZodArray({...this._def,maxLength:{value:e,message:_.toString(r)}})}length(e,r){return new ZodArray({...this._def,exactLength:{value:e,message:_.toString(r)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const r={};for(const i in e.shape){const s=e.shape[i];r[i]=ZodOptional.create(deepPartialify(s))}return new ZodObject({...e._def,shape:()=>r})}return e instanceof ZodArray?new ZodArray({...e._def,type:deepPartialify(e.element)}):e instanceof ZodOptional?ZodOptional.create(deepPartialify(e.unwrap())):e instanceof ZodNullable?ZodNullable.create(deepPartialify(e.unwrap())):e instanceof ZodTuple?ZodTuple.create(e.items.map((e=>deepPartialify(e)))):e}ZodArray.create=(e,r)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:B.ZodArray,...processCreateParams(r)});class ZodObject extends ZodType{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const r=this._def.shape(),i=e.objectKeys(r);return this._cached={shape:r,keys:i}}_parse(e){if(this._getType(e)!==s.object){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:a.invalid_type,expected:s.object,received:r.parsedType}),f}const{status:r,ctx:i}=this._processInputParams(e),{shape:h,keys:_}=this._getCached(),v=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const s in i.data)_.includes(s)||v.push(s);const b=[];for(const s of _){const e=h[s],r=i.data[s];b.push({key:{status:"valid",value:s},value:e._parse(new ParseInputLazyPath(i,r,i.path,s)),alwaysSet:s in i.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const r of v)b.push({key:{status:"valid",value:r},value:{status:"valid",value:i.data[r]}});else if("strict"===e)v.length>0&&(addIssueToContext(i,{code:a.unrecognized_keys,keys:v}),r.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const r of v){const s=i.data[r];b.push({key:{status:"valid",value:r},value:e._parse(new ParseInputLazyPath(i,s,i.path,r)),alwaysSet:r in i.data})}}return i.common.async?Promise.resolve().then((async()=>{const e=[];for(const r of b){const i=await r.key,s=await r.value;e.push({key:i,value:s,alwaysSet:r.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(r,e))):ParseStatus.mergeObjectSync(r,b)}get shape(){return this._def.shape()}strict(e){return _.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(r,i)=>{var s,a,h,f;const v=null!==(h=null===(a=(s=this._def).errorMap)||void 0===a?void 0:a.call(s,r,i).message)&&void 0!==h?h:i.defaultError;return"unrecognized_keys"===r.code?{message:null!==(f=_.errToObj(e).message)&&void 0!==f?f:v}:{message:v}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(e){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new ZodObject({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:B.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(r){const i={};return e.objectKeys(r).forEach((e=>{r[e]&&this.shape[e]&&(i[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>i})}omit(r){const i={};return e.objectKeys(this.shape).forEach((e=>{r[e]||(i[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>i})}deepPartial(){return deepPartialify(this)}partial(r){const i={};return e.objectKeys(this.shape).forEach((e=>{const s=this.shape[e];r&&!r[e]?i[e]=s:i[e]=s.optional()})),new ZodObject({...this._def,shape:()=>i})}required(r){const i={};return e.objectKeys(this.shape).forEach((e=>{if(r&&!r[e])i[e]=this.shape[e];else{let r=this.shape[e];for(;r instanceof ZodOptional;)r=r._def.innerType;i[e]=r}})),new ZodObject({...this._def,shape:()=>i})}keyof(){return createZodEnum(e.objectKeys(this.shape))}}ZodObject.create=(e,r)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:B.ZodObject,...processCreateParams(r)}),ZodObject.strictCreate=(e,r)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:B.ZodObject,...processCreateParams(r)}),ZodObject.lazycreate=(e,r)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:B.ZodObject,...processCreateParams(r)});class ZodUnion extends ZodType{_parse(e){const{ctx:r}=this._processInputParams(e),i=this._def.options;if(r.common.async)return Promise.all(i.map((async e=>{const i={...r,common:{...r.common,issues:[]},parent:null};return{result:await e._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}}))).then((function handleResults(e){for(const r of e)if("valid"===r.result.status)return r.result;for(const s of e)if("dirty"===s.result.status)return r.common.issues.push(...s.ctx.common.issues),s.result;const i=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(r,{code:a.invalid_union,unionErrors:i}),f}));{let e;const s=[];for(const a of i){const i={...r,common:{...r.common,issues:[]},parent:null},h=a._parseSync({data:r.data,path:r.path,parent:i});if("valid"===h.status)return h;"dirty"!==h.status||e||(e={result:h,ctx:i}),i.common.issues.length&&s.push(i.common.issues)}if(e)return r.common.issues.push(...e.ctx.common.issues),e.result;const h=s.map((e=>new ZodError(e)));return addIssueToContext(r,{code:a.invalid_union,unionErrors:h}),f}}get options(){return this._def.options}}ZodUnion.create=(e,r)=>new ZodUnion({options:e,typeName:B.ZodUnion,...processCreateParams(r)});const getDiscriminator=r=>r instanceof ZodLazy?getDiscriminator(r.schema):r instanceof ZodEffects?getDiscriminator(r.innerType()):r instanceof ZodLiteral?[r.value]:r instanceof ZodEnum?r.options:r instanceof ZodNativeEnum?e.objectValues(r.enum):r instanceof ZodDefault?getDiscriminator(r._def.innerType):r instanceof ZodUndefined?[void 0]:r instanceof ZodNull?[null]:r instanceof ZodOptional?[void 0,...getDiscriminator(r.unwrap())]:r instanceof ZodNullable?[null,...getDiscriminator(r.unwrap())]:r instanceof ZodBranded||r instanceof ZodReadonly?getDiscriminator(r.unwrap()):r instanceof ZodCatch?getDiscriminator(r._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==s.object)return addIssueToContext(r,{code:a.invalid_type,expected:s.object,received:r.parsedType}),f;const i=this.discriminator,h=r.data[i],_=this.optionsMap.get(h);return _?r.common.async?_._parseAsync({data:r.data,path:r.path,parent:r}):_._parseSync({data:r.data,path:r.path,parent:r}):(addIssueToContext(r,{code:a.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),f)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,i){const s=new Map;for(const a of r){const r=getDiscriminator(a.shape[e]);if(!r.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const i of r){if(s.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);s.set(i,a)}}return new ZodDiscriminatedUnion({typeName:B.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:s,...processCreateParams(i)})}}function mergeValues(r,i){const a=getParsedType(r),h=getParsedType(i);if(r===i)return{valid:!0,data:r};if(a===s.object&&h===s.object){const s=e.objectKeys(i),a=e.objectKeys(r).filter((e=>-1!==s.indexOf(e))),h={...r,...i};for(const e of a){const s=mergeValues(r[e],i[e]);if(!s.valid)return{valid:!1};h[e]=s.data}return{valid:!0,data:h}}if(a===s.array&&h===s.array){if(r.length!==i.length)return{valid:!1};const e=[];for(let s=0;s<r.length;s++){const a=mergeValues(r[s],i[s]);if(!a.valid)return{valid:!1};e.push(a.data)}return{valid:!0,data:e}}return a===s.date&&h===s.date&&+r==+i?{valid:!0,data:r}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:r,ctx:i}=this._processInputParams(e),handleParsed=(e,s)=>{if(isAborted(e)||isAborted(s))return f;const h=mergeValues(e.value,s.value);return h.valid?((isDirty(e)||isDirty(s))&&r.dirty(),{status:r.value,value:h.data}):(addIssueToContext(i,{code:a.invalid_intersection_types}),f)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then((([e,r])=>handleParsed(e,r))):handleParsed(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}}ZodIntersection.create=(e,r,i)=>new ZodIntersection({left:e,right:r,typeName:B.ZodIntersection,...processCreateParams(i)});class ZodTuple extends ZodType{_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==s.array)return addIssueToContext(i,{code:a.invalid_type,expected:s.array,received:i.parsedType}),f;if(i.data.length<this._def.items.length)return addIssueToContext(i,{code:a.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),f;!this._def.rest&&i.data.length>this._def.items.length&&(addIssueToContext(i,{code:a.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const h=[...i.data].map(((e,r)=>{const s=this._def.items[r]||this._def.rest;return s?s._parse(new ParseInputLazyPath(i,e,i.path,r)):null})).filter((e=>!!e));return i.common.async?Promise.all(h).then((e=>ParseStatus.mergeArray(r,e))):ParseStatus.mergeArray(r,h)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,r)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:B.ZodTuple,rest:null,...processCreateParams(r)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==s.object)return addIssueToContext(i,{code:a.invalid_type,expected:s.object,received:i.parsedType}),f;const h=[],_=this._def.keyType,v=this._def.valueType;for(const s in i.data)h.push({key:_._parse(new ParseInputLazyPath(i,s,i.path,s)),value:v._parse(new ParseInputLazyPath(i,i.data[s],i.path,s)),alwaysSet:s in i.data});return i.common.async?ParseStatus.mergeObjectAsync(r,h):ParseStatus.mergeObjectSync(r,h)}get element(){return this._def.valueType}static create(e,r,i){return new ZodRecord(r instanceof ZodType?{keyType:e,valueType:r,typeName:B.ZodRecord,...processCreateParams(i)}:{keyType:ZodString.create(),valueType:e,typeName:B.ZodRecord,...processCreateParams(r)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==s.map)return addIssueToContext(i,{code:a.invalid_type,expected:s.map,received:i.parsedType}),f;const h=this._def.keyType,_=this._def.valueType,v=[...i.data.entries()].map((([e,r],s)=>({key:h._parse(new ParseInputLazyPath(i,e,i.path,[s,"key"])),value:_._parse(new ParseInputLazyPath(i,r,i.path,[s,"value"]))})));if(i.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const i of v){const s=await i.key,a=await i.value;if("aborted"===s.status||"aborted"===a.status)return f;"dirty"!==s.status&&"dirty"!==a.status||r.dirty(),e.set(s.value,a.value)}return{status:r.value,value:e}}))}{const e=new Map;for(const i of v){const s=i.key,a=i.value;if("aborted"===s.status||"aborted"===a.status)return f;"dirty"!==s.status&&"dirty"!==a.status||r.dirty(),e.set(s.value,a.value)}return{status:r.value,value:e}}}}ZodMap.create=(e,r,i)=>new ZodMap({valueType:r,keyType:e,typeName:B.ZodMap,...processCreateParams(i)});class ZodSet extends ZodType{_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==s.set)return addIssueToContext(i,{code:a.invalid_type,expected:s.set,received:i.parsedType}),f;const h=this._def;null!==h.minSize&&i.data.size<h.minSize.value&&(addIssueToContext(i,{code:a.too_small,minimum:h.minSize.value,type:"set",inclusive:!0,exact:!1,message:h.minSize.message}),r.dirty()),null!==h.maxSize&&i.data.size>h.maxSize.value&&(addIssueToContext(i,{code:a.too_big,maximum:h.maxSize.value,type:"set",inclusive:!0,exact:!1,message:h.maxSize.message}),r.dirty());const _=this._def.valueType;function finalizeSet(e){const i=new Set;for(const s of e){if("aborted"===s.status)return f;"dirty"===s.status&&r.dirty(),i.add(s.value)}return{status:r.value,value:i}}const v=[...i.data.values()].map(((e,r)=>_._parse(new ParseInputLazyPath(i,e,i.path,r))));return i.common.async?Promise.all(v).then((e=>finalizeSet(e))):finalizeSet(v)}min(e,r){return new ZodSet({...this._def,minSize:{value:e,message:_.toString(r)}})}max(e,r){return new ZodSet({...this._def,maxSize:{value:e,message:_.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,r)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:B.ZodSet,...processCreateParams(r)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==s.function)return addIssueToContext(r,{code:a.invalid_type,expected:s.function,received:r.parsedType}),f;function makeArgsIssue(e,i){return makeIssue({data:e,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:a.invalid_arguments,argumentsError:i}})}function makeReturnsIssue(e,i){return makeIssue({data:e,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:a.invalid_return_type,returnTypeError:i}})}const i={errorMap:r.common.contextualErrorMap},h=r.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...r){const s=new ZodError([]),a=await e._def.args.parseAsync(r,i).catch((e=>{throw s.addIssue(makeArgsIssue(r,e)),s})),f=await Reflect.apply(h,this,a);return await e._def.returns._def.type.parseAsync(f,i).catch((e=>{throw s.addIssue(makeReturnsIssue(f,e)),s}))}))}{const e=this;return OK((function(...r){const s=e._def.args.safeParse(r,i);if(!s.success)throw new ZodError([makeArgsIssue(r,s.error)]);const a=Reflect.apply(h,this,s.data),f=e._def.returns.safeParse(a,i);if(!f.success)throw new ZodError([makeReturnsIssue(a,f.error)]);return f.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ZodFunction({...this._def,args:ZodTuple.create(e).rest(ZodUnknown.create())})}returns(e){return new ZodFunction({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,i){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:r||ZodUnknown.create(),typeName:B.ZodFunction,...processCreateParams(i)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}}ZodLazy.create=(e,r)=>new ZodLazy({getter:e,typeName:B.ZodLazy,...processCreateParams(r)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{received:r.data,code:a.invalid_literal,expected:this._def.value}),f}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,r){return new ZodEnum({values:e,typeName:B.ZodEnum,...processCreateParams(r)})}ZodLiteral.create=(e,r)=>new ZodLiteral({value:e,typeName:B.ZodLiteral,...processCreateParams(r)});class ZodEnum extends ZodType{constructor(){super(...arguments),b.set(this,void 0)}_parse(r){if("string"!=typeof r.data){const i=this._getOrReturnCtx(r),s=this._def.values;return addIssueToContext(i,{expected:e.joinValues(s),received:i.parsedType,code:a.invalid_type}),f}if(__classPrivateFieldGet(this,b)||__classPrivateFieldSet(this,b,new Set(this._def.values)),!__classPrivateFieldGet(this,b).has(r.data)){const e=this._getOrReturnCtx(r),i=this._def.values;return addIssueToContext(e,{received:e.data,code:a.invalid_enum_value,options:i}),f}return OK(r.data)}get options(){return this._def.values}get enum(){const e={};for(const r of this._def.values)e[r]=r;return e}get Values(){const e={};for(const r of this._def.values)e[r]=r;return e}get Enum(){const e={};for(const r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return ZodEnum.create(e,{...this._def,...r})}exclude(e,r=this._def){return ZodEnum.create(this.options.filter((r=>!e.includes(r))),{...this._def,...r})}}b=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),S.set(this,void 0)}_parse(r){const i=e.getValidEnumValues(this._def.values),h=this._getOrReturnCtx(r);if(h.parsedType!==s.string&&h.parsedType!==s.number){const r=e.objectValues(i);return addIssueToContext(h,{expected:e.joinValues(r),received:h.parsedType,code:a.invalid_type}),f}if(__classPrivateFieldGet(this,S)||__classPrivateFieldSet(this,S,new Set(e.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,S).has(r.data)){const r=e.objectValues(i);return addIssueToContext(h,{received:h.data,code:a.invalid_enum_value,options:r}),f}return OK(r.data)}get enum(){return this._def.values}}S=new WeakMap,ZodNativeEnum.create=(e,r)=>new ZodNativeEnum({values:e,typeName:B.ZodNativeEnum,...processCreateParams(r)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==s.promise&&!1===r.common.async)return addIssueToContext(r,{code:a.invalid_type,expected:s.promise,received:r.parsedType}),f;const i=r.parsedType===s.promise?r.data:Promise.resolve(r.data);return OK(i.then((e=>this._def.type.parseAsync(e,{path:r.path,errorMap:r.common.contextualErrorMap}))))}}ZodPromise.create=(e,r)=>new ZodPromise({type:e,typeName:B.ZodPromise,...processCreateParams(r)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===B.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){const{status:i,ctx:s}=this._processInputParams(r),a=this._def.effect||null,h={addIssue:e=>{addIssueToContext(s,e),e.fatal?i.abort():i.dirty()},get path(){return s.path}};if(h.addIssue=h.addIssue.bind(h),"preprocess"===a.type){const e=a.transform(s.data,h);if(s.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===i.value)return f;const r=await this._def.schema._parseAsync({data:e,path:s.path,parent:s});return"aborted"===r.status?f:"dirty"===r.status||"dirty"===i.value?DIRTY(r.value):r}));{if("aborted"===i.value)return f;const r=this._def.schema._parseSync({data:e,path:s.path,parent:s});return"aborted"===r.status?f:"dirty"===r.status||"dirty"===i.value?DIRTY(r.value):r}}if("refinement"===a.type){const executeRefinement=e=>{const r=a.refinement(e,h);if(s.common.async)return Promise.resolve(r);if(r instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===e.status?f:("dirty"===e.status&&i.dirty(),executeRefinement(e.value),{status:i.value,value:e.value})}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>"aborted"===e.status?f:("dirty"===e.status&&i.dirty(),executeRefinement(e.value).then((()=>({status:i.value,value:e.value}))))))}if("transform"===a.type){if(!1===s.common.async){const e=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!isValid(e))return e;const r=a.transform(e.value,h);if(r instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:i.value,value:r}}return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then((e=>isValid(e)?Promise.resolve(a.transform(e.value,h)).then((e=>({status:i.value,value:e}))):e))}e.assertNever(a)}}ZodEffects.create=(e,r,i)=>new ZodEffects({schema:e,typeName:B.ZodEffects,effect:r,...processCreateParams(i)}),ZodEffects.createWithPreprocess=(e,r,i)=>new ZodEffects({schema:r,effect:{type:"preprocess",transform:e},typeName:B.ZodEffects,...processCreateParams(i)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===s.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,r)=>new ZodOptional({innerType:e,typeName:B.ZodOptional,...processCreateParams(r)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===s.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,r)=>new ZodNullable({innerType:e,typeName:B.ZodNullable,...processCreateParams(r)});class ZodDefault extends ZodType{_parse(e){const{ctx:r}=this._processInputParams(e);let i=r.data;return r.parsedType===s.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,r)=>new ZodDefault({innerType:e,typeName:B.ZodDefault,defaultValue:"function"==typeof r.default?r.default:()=>r.default,...processCreateParams(r)});class ZodCatch extends ZodType{_parse(e){const{ctx:r}=this._processInputParams(e),i={...r,common:{...r.common,issues:[]}},s=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return isAsync(s)?s.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(i.common.issues)},input:i.data})}))):{status:"valid",value:"valid"===s.status?s.value:this._def.catchValue({get error(){return new ZodError(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,r)=>new ZodCatch({innerType:e,typeName:B.ZodCatch,catchValue:"function"==typeof r.catch?r.catch:()=>r.catch,...processCreateParams(r)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==s.nan){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:a.invalid_type,expected:s.nan,received:r.parsedType}),f}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:B.ZodNaN,...processCreateParams(e)});const $=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:r}=this._processInputParams(e),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?f:"dirty"===e.status?(r.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:i.path,parent:i})})()}{const e=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?f:"dirty"===e.status?(r.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:i.path,parent:i})}}static create(e,r){return new ZodPipeline({in:e,out:r,typeName:B.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const r=this._def.innerType._parse(e),freeze=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(r)?r.then((e=>freeze(e))):freeze(r)}unwrap(){return this._def.innerType}}function custom(e,r={},i){return e?ZodAny.create().superRefine(((s,a)=>{var h,f;if(!e(s)){const e="function"==typeof r?r(s):"string"==typeof r?{message:r}:r,_=null===(f=null!==(h=e.fatal)&&void 0!==h?h:i)||void 0===f||f,v="string"==typeof e?{message:e}:e;a.addIssue({code:"custom",...v,fatal:_})}})):ZodAny.create()}ZodReadonly.create=(e,r)=>new ZodReadonly({innerType:e,typeName:B.ZodReadonly,...processCreateParams(r)});const U={object:ZodObject.lazycreate};var B,z;(z=B||(B={})).ZodString="ZodString",z.ZodNumber="ZodNumber",z.ZodNaN="ZodNaN",z.ZodBigInt="ZodBigInt",z.ZodBoolean="ZodBoolean",z.ZodDate="ZodDate",z.ZodSymbol="ZodSymbol",z.ZodUndefined="ZodUndefined",z.ZodNull="ZodNull",z.ZodAny="ZodAny",z.ZodUnknown="ZodUnknown",z.ZodNever="ZodNever",z.ZodVoid="ZodVoid",z.ZodArray="ZodArray",z.ZodObject="ZodObject",z.ZodUnion="ZodUnion",z.ZodDiscriminatedUnion="ZodDiscriminatedUnion",z.ZodIntersection="ZodIntersection",z.ZodTuple="ZodTuple",z.ZodRecord="ZodRecord",z.ZodMap="ZodMap",z.ZodSet="ZodSet",z.ZodFunction="ZodFunction",z.ZodLazy="ZodLazy",z.ZodLiteral="ZodLiteral",z.ZodEnum="ZodEnum",z.ZodEffects="ZodEffects",z.ZodNativeEnum="ZodNativeEnum",z.ZodOptional="ZodOptional",z.ZodNullable="ZodNullable",z.ZodDefault="ZodDefault",z.ZodCatch="ZodCatch",z.ZodPromise="ZodPromise",z.ZodBranded="ZodBranded",z.ZodPipeline="ZodPipeline",z.ZodReadonly="ZodReadonly";const W=ZodString.create,K=ZodNumber.create,G=ZodNaN.create,J=ZodBigInt.create,Y=ZodBoolean.create,X=ZodDate.create,Q=ZodSymbol.create,ee=ZodUndefined.create,te=ZodNull.create,re=ZodAny.create,ne=ZodUnknown.create,ie=ZodNever.create,oe=ZodVoid.create,se=ZodArray.create,ae=ZodObject.create,ce=ZodObject.strictCreate,de=ZodUnion.create,ue=ZodDiscriminatedUnion.create,le=ZodIntersection.create,pe=ZodTuple.create,he=ZodRecord.create,fe=ZodMap.create,me=ZodSet.create,ge=ZodFunction.create,_e=ZodLazy.create,ye=ZodLiteral.create,ve=ZodEnum.create,be=ZodNativeEnum.create,Se=ZodPromise.create,ke=ZodEffects.create,we=ZodOptional.create,Ie=ZodNullable.create,xe=ZodEffects.createWithPreprocess,Ee=ZodPipeline.create,Ce={string:e=>ZodString.create({...e,coerce:!0}),number:e=>ZodNumber.create({...e,coerce:!0}),boolean:e=>ZodBoolean.create({...e,coerce:!0}),bigint:e=>ZodBigInt.create({...e,coerce:!0}),date:e=>ZodDate.create({...e,coerce:!0})},Te=f;var Oe=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:function setErrorMap(e){h=e},getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:[],addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:f,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return e},get objectUtil(){return i},ZodParsedType:s,getParsedType:getParsedType,ZodType:ZodType,datetimeRegex:datetimeRegex,ZodString:ZodString,ZodNumber:ZodNumber,ZodBigInt:ZodBigInt,ZodBoolean:ZodBoolean,ZodDate:ZodDate,ZodSymbol:ZodSymbol,ZodUndefined:ZodUndefined,ZodNull:ZodNull,ZodAny:ZodAny,ZodUnknown:ZodUnknown,ZodNever:ZodNever,ZodVoid:ZodVoid,ZodArray:ZodArray,ZodObject:ZodObject,ZodUnion:ZodUnion,ZodDiscriminatedUnion:ZodDiscriminatedUnion,ZodIntersection:ZodIntersection,ZodTuple:ZodTuple,ZodRecord:ZodRecord,ZodMap:ZodMap,ZodSet:ZodSet,ZodFunction:ZodFunction,ZodLazy:ZodLazy,ZodLiteral:ZodLiteral,ZodEnum:ZodEnum,ZodNativeEnum:ZodNativeEnum,ZodPromise:ZodPromise,ZodEffects:ZodEffects,ZodTransformer:ZodEffects,ZodOptional:ZodOptional,ZodNullable:ZodNullable,ZodDefault:ZodDefault,ZodCatch:ZodCatch,ZodNaN:ZodNaN,BRAND:$,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:U,get ZodFirstPartyTypeKind(){return B},coerce:Ce,any:re,array:se,bigint:J,boolean:Y,date:X,discriminatedUnion:ue,effect:ke,enum:ve,function:ge,instanceof:(e,r={message:`Input not instance of ${e.name}`})=>custom((r=>r instanceof e),r),intersection:le,lazy:_e,literal:ye,map:fe,nan:G,nativeEnum:be,never:ie,null:te,nullable:Ie,number:K,object:ae,oboolean:()=>Y().optional(),onumber:()=>K().optional(),optional:we,ostring:()=>W().optional(),pipeline:Ee,preprocess:xe,promise:Se,record:he,set:me,strictObject:ce,string:W,symbol:Q,transformer:ke,tuple:pe,undefined:ee,union:de,unknown:ne,void:oe,NEVER:Te,ZodIssueCode:a,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:ZodError});const Re=Oe.union([Oe.string(),Oe.boolean(),Oe.number(),Oe.undefined()]),Me=Oe.record(Oe.string(),Oe.union([Re,Oe.array(Re)])),Ne=Oe.string().min(1,"Event name is required");var __assign=function(){return __assign=Object.assign||function __assign2(e){for(var r,i=1,s=arguments.length;i<s;i++)for(var a in r=arguments[i])Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a]);return e},__assign.apply(this,arguments)};function __awaiter$1(e,r,i,s){return new(i||(i=Promise))((function(a,h){function fulfilled(e){try{step(s.next(e))}catch(r){h(r)}}function rejected(e){try{step(s.throw(e))}catch(r){h(r)}}function step(e){e.done?a(e.value):function adopt(e){return e instanceof i?e:new i((function(r){r(e)}))}(e.value).then(fulfilled,rejected)}step((s=s.apply(e,r||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var Pe={default:"endpoint"},De={default:"tlsEndpoint"},Ze="Client timeout",Ae="Network connection error",Le="Network request aborted",je="Response cannot be parsed",Fe="Blocked by CSP",qe="The endpoint parameter is not a valid URL";function E$1(e){for(var r="",i=0;i<e.length;++i)if(i>0){var s=e[i].toLowerCase();s!==e[i]?r+=" ".concat(s):r+=e[i]}else r+=e[i].toUpperCase();return r}var $e=E$1("WrongRegion"),Ue=E$1("SubscriptionNotActive"),Be=E$1("UnsupportedVersion"),ze=E$1("InstallationMethodRestricted"),Ve=E$1("HostnameRestricted"),We=E$1("IntegrationFailed"),Ke="API key required",He="API key not found",Ge="API key expired",Je="Request cannot be parsed",Ye="Request failed",Xe="Request failed to process",Qe="Too many requests, rate limit exceeded",et="Not available for this origin",tt="Not available with restricted header",rt=Ke,nt=He,it=Ge,ot="Failed to load the JS script of the agent",st="9319";function M(e,r){var i,s,a,h,f,_=[],v=(f=function __spreadArray(e,r,i){if(i||2===arguments.length)for(var s,a=0,h=r.length;a<h;a++)!s&&a in r||(s||(s=Array.prototype.slice.call(r,0,a)),s[a]=r[a]);return e.concat(s||Array.prototype.slice.call(r))}([],e,!0),i={current:function(){return f[0]},postpone:function(){var e=f.shift();void 0!==e&&f.push(e)},exclude:function(){f.shift()}},h=0,s=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,h++))},a=new Set,[i.current(),function(e,r){var h,f=r instanceof Error?r.message:"";if(f===Fe||f===qe)i.exclude(),h=0;else if(f===st)i.exclude();else if(f===ot){var _=Date.now()-e.getTime()<50,v=i.current();v&&_&&!a.has(v)&&(a.add(v),h=0),i.postpone()}else i.postpone();var b=i.current();return void 0===b?void 0:[b,null!=h?h:e.getTime()+s()-Date.now()]}]),b=v[0],S=v[1];if(void 0===b)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var p2=function(e){var i=new Date,r3=function(r){return _.push({url:e,startedAt:i,finishedAt:new Date,error:r})},s=r(e);return s.then((function(){return r3()}),r3),s.catch((function(e){if(_.length>=5)throw e;var r=S(i,e);if(!r)throw e;var s,a=r[0],h=r[1];return(s=h,new Promise((function(e){return setTimeout(e,s)}))).then((function(){return p2(a)}))}))};return p2(b).then((function(e){return[e,_]}))}var at="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",ct=at;function F(e){var r;e.scriptUrlPattern;var i,s,a,h,f,_,v,b=e.token,S=e.apiKey,I=void 0===S?b:S,x=function __rest$1(e,r){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&r.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(s=Object.getOwnPropertySymbols(e);a<s.length;a++)r.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(i[s[a]]=e[s[a]])}return i}(e,["scriptUrlPattern","token","apiKey"]),C=null!==(r=function r$2(e,r){return i=e,s=r,Object.prototype.hasOwnProperty.call(i,s)?e[r]:void 0;var i,s}(e,"scriptUrlPattern"))&&void 0!==r?r:at,T=(f=[],_=function(){f.push({time:new Date,state:document.visibilityState})},i=document,s="visibilitychange",a=_,i.addEventListener(s,a,h),v=function(){return i.removeEventListener(s,a,h)},_(),[f,v]),O=T[0],R=T[1];return Promise.resolve().then((function(){if(!I||"string"!=typeof I)throw new Error(Ke);var e=function(e,r){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,r){var i=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?i(r):"<loaderVersion>"===e?i("3.11.1"):e}))}(String(e),r)}))}(C,I);return M(e,V)})).catch((function(e){throw R(),function(e){return e instanceof Error&&e.message===st?new Error(ot):e}(e)})).then((function(e){var r=e[0],i=e[1];return R(),r.load(__assign(__assign({},x),{ldi:{attempts:i,visibilityStates:O}}))}))}function V(e){return function o$2(e,r,i,s){var a,h=document,f="securitypolicyviolation",u3=function(r){var i=new URL(e,location.href),s=r.blockedURI;s!==i.href&&s!==i.protocol.slice(0,-1)&&s!==i.origin||(a=r,R2())};h.addEventListener(f,u3);var R2=function(){return h.removeEventListener(f,u3)};return Promise.resolve().then(r).then((function(e){return R2(),e}),(function(e){return new Promise((function(e){var r=new MessageChannel;r.port1.onmessage=function(){return e()},r.port2.postMessage(null)})).then((function(){if(R2(),a)return i(a);throw e}))}))}(e,(function(){return r=e,new Promise((function(e,i){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(r){if(r instanceof Error&&"TypeError"===r.name)return!0;throw r}}(r))throw new Error(qe);var s=document.createElement("script"),o2=function(){var e;return null===(e=s.parentNode)||void 0===e?void 0:e.removeChild(s)},a=document.head||document.getElementsByTagName("head")[0];s.onload=function(){o2(),e()},s.onerror=function(){o2(),i(new Error(ot))},s.async=!0,s.src=r,a.appendChild(s)}));var r}),(function(){throw new Error(Fe)})).then(k)}function k(){var e,r,i,s,a=window,h="__fpjs_p_l_b",f=a[h];if(e=a,r=h,(null==(s=null===(i=Object.getOwnPropertyDescriptor)||void 0===i?void 0:i.call(Object,e,r))?void 0:s.configurable)?delete e[r]:s&&!s.writable||(e[r]=void 0),"function"!=typeof(null==f?void 0:f.load))throw new Error(st);return f}var dt={load:F,defaultScriptUrlPattern:ct,ERROR_SCRIPT_LOAD_FAIL:ot,ERROR_API_KEY_EXPIRED:Ge,ERROR_API_KEY_INVALID:He,ERROR_API_KEY_MISSING:Ke,ERROR_BAD_REQUEST_FORMAT:Je,ERROR_BAD_RESPONSE_FORMAT:je,ERROR_CLIENT_TIMEOUT:Ze,ERROR_CSP_BLOCK:Fe,ERROR_FORBIDDEN_ENDPOINT:Ve,ERROR_FORBIDDEN_HEADER:tt,ERROR_FORBIDDEN_ORIGIN:et,ERROR_GENERAL_SERVER_FAILURE:Ye,ERROR_INSTALLATION_METHOD_RESTRICTED:ze,ERROR_INTEGRATION_FAILURE:We,ERROR_INVALID_ENDPOINT:qe,ERROR_NETWORK_ABORT:Le,ERROR_NETWORK_CONNECTION:Ae,ERROR_RATE_LIMIT:Qe,ERROR_SERVER_TIMEOUT:Xe,ERROR_SUBSCRIPTION_NOT_ACTIVE:Ue,ERROR_TOKEN_EXPIRED:it,ERROR_TOKEN_INVALID:nt,ERROR_TOKEN_MISSING:rt,ERROR_UNSUPPORTED_VERSION:Be,ERROR_WRONG_REGION:$e,defaultEndpoint:Pe,defaultTlsEndpoint:De};const ut=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:Ge,ERROR_API_KEY_INVALID:He,ERROR_API_KEY_MISSING:Ke,ERROR_BAD_REQUEST_FORMAT:Je,ERROR_BAD_RESPONSE_FORMAT:je,ERROR_CLIENT_TIMEOUT:Ze,ERROR_CSP_BLOCK:Fe,ERROR_FORBIDDEN_ENDPOINT:Ve,ERROR_FORBIDDEN_HEADER:tt,ERROR_FORBIDDEN_ORIGIN:et,ERROR_GENERAL_SERVER_FAILURE:Ye,ERROR_INSTALLATION_METHOD_RESTRICTED:ze,ERROR_INTEGRATION_FAILURE:We,ERROR_INVALID_ENDPOINT:qe,ERROR_NETWORK_ABORT:Le,ERROR_NETWORK_CONNECTION:Ae,ERROR_RATE_LIMIT:Qe,ERROR_SCRIPT_LOAD_FAIL:ot,ERROR_SERVER_TIMEOUT:Xe,ERROR_SUBSCRIPTION_NOT_ACTIVE:Ue,ERROR_TOKEN_EXPIRED:it,ERROR_TOKEN_INVALID:nt,ERROR_TOKEN_MISSING:rt,ERROR_UNSUPPORTED_VERSION:Be,ERROR_WRONG_REGION:$e,default:dt,defaultEndpoint:Pe,defaultScriptUrlPattern:ct,defaultTlsEndpoint:De,load:F},Symbol.toStringTag,{value:"Module"})),lt="@fpjs@client@",DEFAULT_NOW_PROVIDER=()=>Date.now();class CacheKey{constructor(e){var r;this.tag=e.tag||null,this.linkedId=e.linkedId||null,this.extendedResult=null!==(r=e.extendedResult)&&void 0!==r&&r}toKey(){return`${JSON.stringify(this.tag)}__${JSON.stringify(this.linkedId)}__${this.extendedResult}`}}function getKeyWithPrefix(e,r){return`${r}__${e}`}function removePrefixFromKey(e,r){return e.replace(`${r}__`,"")}class LocalStorageCache{constructor(e=lt){this.prefix=e}set(e,r){window.localStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(r))}get(e){const r=window.localStorage.getItem(getKeyWithPrefix(e,this.prefix));if(r)try{return JSON.parse(r)}catch(i){return}}remove(e){window.localStorage.removeItem(getKeyWithPrefix(e,this.prefix))}allKeys(){return Object.keys(window.localStorage).filter((e=>e.startsWith(this.prefix))).map((e=>removePrefixFromKey(e,this.prefix)))}}class SessionStorageCache{constructor(e=lt){this.prefix=e}set(e,r){window.sessionStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(r))}get(e){const r=window.sessionStorage.getItem(getKeyWithPrefix(e,this.prefix));if(r)try{return JSON.parse(r)}catch(i){return}}remove(e){window.sessionStorage.removeItem(getKeyWithPrefix(e,this.prefix))}allKeys(){return Object.keys(window.sessionStorage).filter((e=>e.startsWith(this.prefix))).map((e=>removePrefixFromKey(e,this.prefix)))}}class CacheManager{constructor(e,r=3600,i){this.cache=e,this.cacheTime=r,this.nowProvider=i||DEFAULT_NOW_PROVIDER}get(e){return __awaiter$1(this,void 0,void 0,(function*(){const r=yield this.cache.get(e.toKey());if(!r)return;const i=yield this.nowProvider(),s=Math.floor(i/1e3);if(!(r.expiresAt<s))return r.body;yield this.cache.remove(e.toKey())}))}set(e,r){return __awaiter$1(this,void 0,void 0,(function*(){const i=yield this.wrapCacheEntry(r);yield this.cache.set(e.toKey(),i)}))}clearCache(){return __awaiter$1(this,void 0,void 0,(function*(){const e=yield this.cache.allKeys();yield Promise.all(e.map((e=>this.cache.remove(e))))}))}wrapCacheEntry(e){return __awaiter$1(this,void 0,void 0,(function*(){const r=yield this.nowProvider(),i=Math.floor(r/1e3)+this.cacheTime;return{body:e,expiresAt:i}}))}}class InMemoryCache{constructor(){this.enclosedCache=function(){const e={};return{set(r,i){e[r]=i},get(r){const i=e[r];if(i)return i},remove(r){delete e[r]},allKeys:()=>Object.keys(e)}}()}}class CacheStub{set(){}get(){}remove(){}allKeys(){return[]}}var pt,ht;(ht=pt||(pt={})).Memory="memory",ht.LocalStorage="localstorage",ht.SessionStorage="sessionstorage",ht.NoCache="nocache";const ft={[pt.Memory]:()=>(new InMemoryCache).enclosedCache,[pt.LocalStorage]:e=>new LocalStorageCache(e),[pt.SessionStorage]:e=>new SessionStorageCache(e),[pt.NoCache]:()=>new CacheStub},cacheFactory=e=>ft[e];class FpjsClient{constructor(e){var r;let i;if(this.inFlightRequests=new Map,this.agentPromise=null,this.customAgent=null==e?void 0:e.customAgent,this.agent={get:()=>{throw new Error("FPJSAgent hasn't loaded yet. Make sure to call the init() method first.")}},this.loadOptions=null==e?void 0:e.loadOptions,(null==e?void 0:e.cache)&&(null==e?void 0:e.cacheLocation)&&console.warn("Both `cache` and `cacheLocation` options have been specified in the FpjsClient configuration; ignoring `cacheLocation` and using `cache`."),null==e?void 0:e.cache)i=e.cache;else{if(this.cacheLocation=(null==e?void 0:e.cacheLocation)||pt.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(e=>{switch(e){case pt.SessionStorage:try{window.sessionStorage.getItem("item")}catch(r){return!1}return!0;case pt.LocalStorage:try{window.localStorage.getItem("item")}catch(r){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=pt.Memory),i=cacheFactory(this.cacheLocation)(null==e?void 0:e.cachePrefix)}if((null==e?void 0:e.cacheTimeInSeconds)&&e.cacheTimeInSeconds>86400)throw new Error("Cache time cannot exceed 86400 seconds (24 hours)");const s=null!==(r=null==e?void 0:e.cacheTimeInSeconds)&&void 0!==r?r:3600;this.cacheManager=new CacheManager(i,s)}init(e){return __awaiter$1(this,void 0,void 0,(function*(){var r,i;if(!this.loadOptions&&!e)throw new TypeError("No load options provided");const s=Object.assign(Object.assign(Object.assign({},this.loadOptions),e),{integrationInfo:[...(null===(r=this.loadOptions)||void 0===r?void 0:r.integrationInfo)||[],...(null==e?void 0:e.integrationInfo)||[],"fingerprintjs-pro-spa/1.3.2"]});if(!this.agentPromise){const e=null!==(i=this.customAgent)&&void 0!==i?i:ut;this.agentPromise=e.load(s).then((e=>(this.agent=e,e))).catch((e=>{throw this.agentPromise=null,e}))}return this.agentPromise}))}getVisitorData(){return __awaiter$1(this,arguments,void 0,(function*(e={},r=!1){const i=FpjsClient.makeCacheKey(e).toKey();if(!this.inFlightRequests.has(i)){const s=this._identify(e,r).finally((()=>{this.inFlightRequests.delete(i)}));this.inFlightRequests.set(i,s)}return yield this.inFlightRequests.get(i)}))}getVisitorDataFromCache(){return __awaiter$1(this,arguments,void 0,(function*(e={}){const r=FpjsClient.makeCacheKey(e),i=yield this.cacheManager.get(r);return i?Object.assign(Object.assign({},i),{cacheHit:!0}):void 0}))}isInCache(){return __awaiter$1(this,arguments,void 0,(function*(e={}){return Boolean(yield this.getVisitorDataFromCache(e))}))}clearCache(){return __awaiter$1(this,void 0,void 0,(function*(){yield this.cacheManager.clearCache()}))}static makeCacheKey(e){return new CacheKey(e)}_identify(e){return __awaiter$1(this,arguments,void 0,(function*(e,r=!1){const i=FpjsClient.makeCacheKey(e);if(!r){const e=yield this.cacheManager.get(i);if(e)return Object.assign(Object.assign({},e),{cacheHit:!0})}const s=yield this.agent.get(e);return yield this.cacheManager.set(i,s),Object.assign(Object.assign({},s),{cacheHit:!1})}))}}const mt="default_fingerprint_cache",gt=7,_t="apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",getExpirationDate=e=>new Date((new Date).getTime()+24*e*60*60*1e3).getTime(),getCachedFingerprint=()=>{const{cacheName:e=mt}=window.fingerprintConfig;try{const r=JSON.parse(localStorage.getItem(e)||"null");return r&&r.expiresAt>Date.now()?r.fingerprint:(localStorage.removeItem(e),null)}catch{return null}};function isFingerprintReady(){return void 0!==window.fpClient}const yt={initFingerprint:async function initFingerprint(e,r){const i=[Pe],s=[ct];r&&(i.unshift(r),s.unshift(function buildProxyUrl(e){return`${e}?${_t}`}(r))),window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:e,endpoint:i,scriptUrlPattern:s}});try{await window.fpClient.init()}catch(Or){throw console.error("Error initializing identification service:",Or),Or}},getFingerprint:async function getFingerprint(e=!1){if(!window.fingerprintConfig)throw new Error("Fingerprint configuration is not initialized.");const r=getCachedFingerprint();if(r)return r;if(e)return"";if(!isFingerprintReady())throw new Error("Identification service is not initialized.");try{const e=window.fpClient,{visitorId:r}=await e.getVisitorData();return(e=>{const{cacheName:r=mt,cacheTimeInDays:i=gt}=window.fingerprintConfig,s={fingerprint:e,expiresAt:getExpirationDate(i)};localStorage.setItem(r,JSON.stringify(s))})(r),r}catch(Or){throw console.error("Error retrieving fingerprint:",Or),Or}},isFingerprintReady:isFingerprintReady,getCachedFingerprint:getCachedFingerprint},vt={sandbox:{search:"https://search.resertravel.com/api",purchase:"https://purchases.resertravel.com/api",core:""},production:{search:"https://search.reservamos.mx/api",purchase:"https://compras.reservamos.mx/api",core:""}},bt="sandbox",St={env:bt,headers:{},searchUrl:vt[bt].search,purchaseUrl:vt[bt].purchase,coreUrl:vt[bt].core,version:"v2",coreVersion:"v1",apiKey:void 0,userAuthToken:void 0,withCredentials:!1};let kt=Object.assign({},St);const wt={1:{code:200,message:"Operación no autorizada"}},It={3:{code:300,message:"Parámetros incorrectos"},7:{code:301,message:"Fecha inválida"}},xt={10:{code:400,message:"No existe el viaje"},20:{code:60,message:"No se encontró el viaje"},21:{code:60,message:"Tarifa no disponible"},22:{code:60,message:"Tarifa no disponible"}},n=e=>({11:{code:500,message:e},12:{code:501,message:e}}),Et={23:{code:60,message:"Estudiante no disponible"},24:{code:60,message:"Profesor no disponible"},25:{code:60,message:"Menor no disponible"},26:{code:60,message:"Capacidades diferentes no disponible"},27:{code:60,message:"INSEN no disponible"},28:{code:60,message:"General no disponible"},29:{code:60,message:"Error desconocido"}},c$1=e=>({30:{code:30,message:e}}),Ct={50:{code:50,message:"Unknow Error"}},i$2=e=>({...wt,...It,...xt,...n(e),...Et,...Ct,...c$1(e)});class o extends Error{constructor(e=-100,r="Unknown error",i=null){super(r),this.code=e,this.details=i,this.stack=(new Error).stack}}async function w(e){const r=await e.json();if(e.ok)return r;if(![404,422,500].includes(e.status))throw new o(e.status,r.message||e.statusText,r);switch(e.status){case 404:throw new o(100,"Not found");case 422:return r;case 500:throw new o(101,"Server error");default:throw new o}}function l$1(e){if(e.errors instanceof Array){const{code:r=-100,message:i="Unknown error"}=e.errors[0]||{},s=i$2(i)[r];throw s?new o(s.code,s.message,e.errors[0]):new o(r,i,e.errors[0])}return e}function c(e,r={},i={},s){const{apiKey:a,withCredentials:h,userAuthToken:f,headers:_}=kt,v={Accept:"application/json",Authorization:`Token token=${i.apiKey||a}`,"Content-Type":"application/json"};return f&&(v.Authorization=`Token ${i.apiKey||a}, Bearer ${f}`),r.headers=function y(...e){const r=Object.keys(Object.assign({},...e)).reduce(((r,i)=>({...r,[i]:e.map((e=>i in e&&e[i])).filter(Boolean)})),{});return new Headers(r)}(_,v),r.credentials=h?"include":"omit","string"!=typeof r.body&&(r.body=JSON.stringify(r.body)),fetch(e,r).then(w).then(l$1).catch(s)}let Tt=class u{constructor({url:e,watch:r,expect:i,maxRetries:s=30,interval:a=2e3,eachCall:h=null}){this.url=e,this.watch=r,this.expect=i instanceof Array?i:[i],this.interval=a,this.maxRetries=s,this.eachCall=h&&h.bind(this),this.aborted=!1,this.timers=[],this.execute=this.execute.bind(this),this.executeEachCall=this.executeEachCall.bind(this)}start(){return this.execute(this.maxRetries)}abort(){this.aborted=!0}execute(e){return function E(e,r={},i){return c(e,r,{},i)}(this.url,{},(e=>this.executeEachCall("error",e))).then((r=>{if(this.expect.includes(r[this.watch])||1===e||this.aborted){let i=r[this.watch];1===e?i="retries_exceeded":this.aborted&&(i="aborted"),this.timers.forEach(clearInterval),this.executeEachCall(i,r)}else if("failed"===r[this.watch])this.timers.forEach(clearInterval),this.executeEachCall("failed",r);else{this.executeEachCall("pending",r);const i=window.setTimeout(this.execute,this.interval,e-1);this.timers.push(i)}}))}executeEachCall(e,r){this.eachCall instanceof Function&&this.eachCall({status:e,payload:r})&&this.abort()}};const Ot=function j({apiName:e,defaultApiVersion:r}){let i,s,a={"Content-Type":"application/json"};function d2(){if(!i)throw new Error(`Base URL is not set for ${e} API.`)}const h={body:{}};return{get:async function w2(e,s={}){d2();const{headers:a={},apiVersion:h=r}=s,f=`${i}/${h}/${e}`;return(await fetch(f,{headers:a})).json()},post:async function y2(e,f=h){d2();const{body:_,headers:v={},apiVersion:b=r}=f,S=`${i}/${b}/${e}`,I={...a,...v,...s?{Authorization:s}:{}};return(await fetch(S,{method:"POST",body:JSON.stringify(_),headers:I})).json()},delete:async function b2(e,h={}){d2();const{headers:f={},apiVersion:_=r}=h,v=`${i}/${_}/${e}`,b={...a,...f,...s?{Authorization:s}:{}};return(await fetch(v,{method:"DELETE",headers:b})).json()},setAuthorizationHeader:function p2(e){s=e},setConfig:function f2(e){i=e.baseUrl,a={...a,...e.defaultHeaders||{}}},poll:function H(e,s){const a={url:`${i}/${r}/${e}`,watch:s.watch,expect:s.expect,eachCall:s.onEachResponse};return new Tt(a)}}}({apiName:"Core",defaultApiVersion:"v1"});const Rt={createAnonymousProfile:async function t(e){const{data:r}=await Ot.post("anonymous_profiles/identify",{body:e});return r}};const Mt={getRecommendedTrips:function d({searchId:e,userIdentifier:r}){return Ot.get(`trip_recommendations/${e}/${r}`)},createRecommendedPlaces:async function m(e){return Ot.post("profiles",{body:e})},pollRecommendedPlaces:function u2(e,r){const{start:i,onEachResponse:s}=r,a=`profiles/${e}`,h={watch:"state",expect:"finished",onEachResponse:s},f=Ot.poll(a,h);return i&&f.start(),f},createRecommendedSeats:function i$1(e){return Ot.post("seat_recommendations",{body:e})},getRecommendedSeats:function p({distinct_id:e,...r}){return Ot.post(`seat_recommendations/${e}`,{body:r})},getFrequentPassengers:async function f$1(e){return Ot.get(`passengers/${e}`)},createFrequentPassengers:async function l(e){return Ot.post("passengers",{body:e})},deleteFrequentPassenger:async function g(e,r){return Ot.delete(`passengers/${e}/${r}`)}},Nt={setConfig:Ot.setConfig,recommendations:Mt,profiles:Rt};let Pt;const Dt=window.location.origin,Zt={sandbox:{baseUrl:"https://datalake-api-dev.reservamossaas.com/api",defaultHeaders:{Origin:Dt,Authorization:"Bearer 753bf0710dc920a84236d42241d4f487"}},prod:{baseUrl:"https://data-lake.reservamossaas.com/api",defaultHeaders:{Origin:Dt,Authorization:"Bearer 753bf0710dc920a84236d42241d4f487"}}};const At={setEnvironment:function setEnvironment(e){Pt=e},getCoreAPIConfig:function getCoreAPIConfig(){if(!Pt)throw new Error("Unable to get core API config, environment not set. Use configService.setEnvironment(environment) to set the environment.");return Zt[Pt]}};var Lt,jt;function isShadowRoot(e){const r=null==e?void 0:e.host;return Boolean((null==r?void 0:r.shadowRoot)===e)}function isNativeShadowDom(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function stringifyStylesheet(e){try{const r=e.rules||e.cssRules;return r?function fixBrowserCompatibilityIssuesInCSS(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}(Array.from(r,stringifyRule).join("")):null}catch(Or){return null}}function stringifyRule(e){let r;if(function isCSSImportRule(e){return"styleSheet"in e}(e))try{r=stringifyStylesheet(e.styleSheet)||function escapeImportStatement(e){const{cssText:r}=e;if(r.split('"').length<3)return r;const i=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?i.push("layer"):e.layerName&&i.push(`layer(${e.layerName})`),e.supportsText&&i.push(`supports(${e.supportsText})`),e.media.length&&i.push(e.media.mediaText),i.join(" ")+";"}(e)}catch(Or){}else if(function isCSSStyleRule(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function fixSafariColons(e){const r=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(r,"$1\\$2")}(e.cssText);return r||e.cssText}(jt=Lt||(Lt={}))[jt.Document=0]="Document",jt[jt.DocumentType=1]="DocumentType",jt[jt.Element=2]="Element",jt[jt.Text=3]="Text",jt[jt.CDATA=4]="CDATA",jt[jt.Comment=5]="Comment";class Mirror{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(e){var r;if(!e)return-1;const i=null===(r=this.getMeta(e))||void 0===r?void 0:r.id;return null!=i?i:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){const r=this.getId(e);this.idNodeMap.delete(r),e.childNodes&&e.childNodes.forEach((e=>this.removeNodeFromMap(e)))}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,r){const i=r.id;this.idNodeMap.set(i,e),this.nodeMetaMap.set(e,r)}replace(e,r){const i=this.getNode(e);if(i){const e=this.nodeMetaMap.get(i);e&&this.nodeMetaMap.set(r,e)}this.idNodeMap.set(e,r)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function maskInputValue({element:e,maskInputOptions:r,tagName:i,type:s,value:a,maskInputFn:h}){let f=a||"";const _=s&&toLowerCase(s);return(r[i.toLowerCase()]||_&&r[_])&&(f=h?h(f,e):"*".repeat(f.length)),f}function toLowerCase(e){return e.toLowerCase()}const Ft="__rrweb_original__";function getInputType(e){const r=e.type;return e.hasAttribute("data-rr-is-password")?"password":r?toLowerCase(r):null}function extractFileExtension(e,r){var i;let s;try{s=new URL(e,null!=r?r:window.location.href)}catch(h){return null}const a=s.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(i=null==a?void 0:a[1])&&void 0!==i?i:null}let qt=1;const $t=new RegExp("[^a-z0-9-_:]"),Ut=-2;function genId(){return qt++}let Bt,zt;const Vt=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Wt=/^(?:[a-z+]+:)?\/\//i,Kt=/^www\..*/i,Ht=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,r){return(e||"").replace(Vt,((e,i,s,a,h,f)=>{const _=s||h||f,v=i||a||"";if(!_)return e;if(Wt.test(_)||Kt.test(_))return`url(${v}${_}${v})`;if(Ht.test(_))return`url(${v}${_}${v})`;if("/"===_[0])return`url(${v}${function extractOrigin(e){let r="";return r=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],r=r.split("?")[0],r}(r)+_}${v})`;const b=r.split("/"),S=_.split("/");b.pop();for(const r of S)"."!==r&&(".."===r?b.pop():b.push(r));return`url(${v}${b.join("/")}${v})`}))}const Gt=/^[^ \t\n\r\u000c]+/,Jt=/^[, \t\n\r\u000c]+/;function absoluteToDoc(e,r){if(!r||""===r.trim())return r;const i=e.createElement("a");return i.href=r,i.href}function isSVGElement(e){return Boolean("svg"===e.tagName||e.ownerSVGElement)}function getHref(){const e=document.createElement("a");return e.href="",e.href}function transformAttribute(e,r,i,s){return s?"src"===i||"href"===i&&("use"!==r||"#"!==s[0])||"xlink:href"===i&&"#"!==s[0]?absoluteToDoc(e,s):"background"!==i||"table"!==r&&"td"!==r&&"th"!==r?"srcset"===i?function getAbsoluteSrcsetString(e,r){if(""===r.trim())return r;let i=0;function collectCharacters(e){let s;const a=e.exec(r.substring(i));return a?(s=a[0],i+=s.length,s):""}const s=[];for(;collectCharacters(Jt),!(i>=r.length);){let a=collectCharacters(Gt);if(","===a.slice(-1))a=absoluteToDoc(e,a.substring(0,a.length-1)),s.push(a);else{let h="";a=absoluteToDoc(e,a);let f=!1;for(;;){const e=r.charAt(i);if(""===e){s.push((a+h).trim());break}if(f)")"===e&&(f=!1);else{if(","===e){i+=1,s.push((a+h).trim());break}"("===e&&(f=!0)}h+=e,i+=1}}}return s.join(", ")}(e,s):"style"===i?absoluteToStylesheet(s,getHref()):"object"===r&&"data"===i?absoluteToDoc(e,s):s:absoluteToDoc(e,s):s}function ignoreAttribute(e,r,i){return("video"===e||"audio"===e)&&"autoplay"===r}function classMatchesRegex(e,r,i){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!i&&classMatchesRegex(e.parentNode,r,i);for(let s=e.classList.length;s--;){const i=e.classList[s];if(r.test(i))return!0}return!!i&&classMatchesRegex(e.parentNode,r,i)}function needMaskingText(e,r,i,s){try{const a=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===a)return!1;if("string"==typeof r){if(s){if(a.closest(`.${r}`))return!0}else if(a.classList.contains(r))return!0}else if(classMatchesRegex(a,r,s))return!0;if(i)if(s){if(a.closest(i))return!0}else if(a.matches(i))return!0}catch(a){}return!1}function serializeNode(e,r){const{doc:i,mirror:s,blockClass:a,blockSelector:h,needsMask:f,inlineStylesheet:_,maskInputOptions:v={},maskTextFn:b,maskInputFn:S,dataURLOptions:I={},inlineImages:x,recordCanvas:C,keepIframeSrcFn:T,newlyAddedElement:O=!1}=r,R=function getRootId(e,r){if(!r.hasNode(e))return;const i=r.getId(e);return 1===i?void 0:i}(i,s);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Lt.Document,childNodes:[],compatMode:e.compatMode}:{type:Lt.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Lt.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:R};case e.ELEMENT_NODE:return function serializeElementNode(e,r){const{doc:i,blockClass:s,blockSelector:a,inlineStylesheet:h,maskInputOptions:f={},maskInputFn:_,dataURLOptions:v={},inlineImages:b,recordCanvas:S,keepIframeSrcFn:I,newlyAddedElement:x=!1,rootId:C}=r,T=function _isBlockedElement(e,r,i){try{if("string"==typeof r){if(e.classList.contains(r))return!0}else for(let i=e.classList.length;i--;){const s=e.classList[i];if(r.test(s))return!0}if(i)return e.matches(i)}catch(s){}return!1}(e,s,a),O=function getValidTagName(e){if(e instanceof HTMLFormElement)return"form";const r=toLowerCase(e.tagName);return $t.test(r)?"div":r}(e);let R={};const N=e.attributes.length;for(let Z=0;Z<N;Z++){const r=e.attributes[Z];ignoreAttribute(O,r.name,r.value)||(R[r.name]=transformAttribute(i,O,toLowerCase(r.name),r.value))}if("link"===O&&h){const r=Array.from(i.styleSheets).find((r=>r.href===e.href));let s=null;r&&(s=stringifyStylesheet(r)),s&&(delete R.rel,delete R.href,R._cssText=absoluteToStylesheet(s,r.href))}if("style"===O&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const r=stringifyStylesheet(e.sheet);r&&(R._cssText=absoluteToStylesheet(r,getHref()))}if("input"===O||"textarea"===O||"select"===O){const r=e.value,i=e.checked;"radio"!==R.type&&"checkbox"!==R.type&&"submit"!==R.type&&"button"!==R.type&&r?R.value=maskInputValue({element:e,type:getInputType(e),tagName:O,value:r,maskInputOptions:f,maskInputFn:_}):i&&(R.checked=i)}"option"===O&&(e.selected&&!f.select?R.selected=!0:delete R.selected);if("canvas"===O&&S)if("2d"===e.__context)(function is2DCanvasBlank(e){const r=e.getContext("2d");if(!r)return!0;for(let i=0;i<e.width;i+=50)for(let s=0;s<e.height;s+=50){const a=r.getImageData,h=Ft in a?a[Ft]:a;if(new Uint32Array(h.call(r,i,s,Math.min(50,e.width-i),Math.min(50,e.height-s)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(R.rr_dataURL=e.toDataURL(v.type,v.quality));else if(!("__context"in e)){const r=e.toDataURL(v.type,v.quality),i=document.createElement("canvas");i.width=e.width,i.height=e.height;r!==i.toDataURL(v.type,v.quality)&&(R.rr_dataURL=r)}if("img"===O&&b){Bt||(Bt=i.createElement("canvas"),zt=Bt.getContext("2d"));const r=e,s=r.crossOrigin;r.crossOrigin="anonymous";const recordInlineImage=()=>{r.removeEventListener("load",recordInlineImage);try{Bt.width=r.naturalWidth,Bt.height=r.naturalHeight,zt.drawImage(r,0,0),R.rr_dataURL=Bt.toDataURL(v.type,v.quality)}catch(e){console.warn(`Cannot inline img src=${r.currentSrc}! Error: ${e}`)}s?R.crossOrigin=s:r.removeAttribute("crossorigin")};r.complete&&0!==r.naturalWidth?recordInlineImage():r.addEventListener("load",recordInlineImage)}if("audio"===O||"video"===O){const r=R;r.rr_mediaState=e.paused?"paused":"played",r.rr_mediaCurrentTime=e.currentTime,r.rr_mediaPlaybackRate=e.playbackRate,r.rr_mediaMuted=e.muted,r.rr_mediaLoop=e.loop,r.rr_mediaVolume=e.volume}x||(e.scrollLeft&&(R.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(R.rr_scrollTop=e.scrollTop));if(T){const{width:r,height:i}=e.getBoundingClientRect();R={class:R.class,rr_width:`${r}px`,rr_height:`${i}px`}}"iframe"!==O||I(R.src)||(e.contentDocument||(R.rr_src=R.src),delete R.src);let P;try{customElements.get(O)&&(P=!0)}catch(D){}return{type:Lt.Element,tagName:O,attributes:R,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:T,rootId:C,isCustom:P}}(e,{doc:i,blockClass:a,blockSelector:h,inlineStylesheet:_,maskInputOptions:v,maskInputFn:S,dataURLOptions:I,inlineImages:x,recordCanvas:C,keepIframeSrcFn:T,newlyAddedElement:O,rootId:R});case e.TEXT_NODE:return function serializeTextNode(e,r){var i;const{needsMask:s,maskTextFn:a,rootId:h}=r,f=e.parentNode&&e.parentNode.tagName;let _=e.textContent;const v="STYLE"===f||void 0,b="SCRIPT"===f||void 0;if(v&&_){try{e.nextSibling||e.previousSibling||(null===(i=e.parentNode.sheet)||void 0===i?void 0:i.cssRules)&&(_=stringifyStylesheet(e.parentNode.sheet))}catch(S){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${S}`,e)}_=absoluteToStylesheet(_,getHref())}b&&(_="SCRIPT_PLACEHOLDER");!v&&!b&&_&&s&&(_=a?a(_,e.parentElement):_.replace(/[\S]/g,"*"));return{type:Lt.Text,textContent:_||"",isStyle:v,rootId:h}}(e,{needsMask:f,maskTextFn:b,rootId:R});case e.CDATA_SECTION_NODE:return{type:Lt.CDATA,textContent:"",rootId:R};case e.COMMENT_NODE:return{type:Lt.Comment,textContent:e.textContent||"",rootId:R};default:return!1}}function lowerIfExists(e){return null==e?"":e.toLowerCase()}function serializeNodeWithId(e,r){const{doc:i,mirror:s,blockClass:a,blockSelector:h,maskTextClass:f,maskTextSelector:_,skipChild:v=!1,inlineStylesheet:b=!0,maskInputOptions:S={},maskTextFn:I,maskInputFn:x,slimDOMOptions:C,dataURLOptions:T={},inlineImages:O=!1,recordCanvas:R=!1,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D=5e3,onStylesheetLoad:Z,stylesheetLoadTimeout:A=5e3,keepIframeSrcFn:L=()=>!1,newlyAddedElement:q=!1}=r;let{needsMask:$}=r,{preserveWhiteSpace:U=!0}=r;if(!$&&e.childNodes){$=needMaskingText(e,f,_,void 0===$)}const B=serializeNode(e,{doc:i,mirror:s,blockClass:a,blockSelector:h,needsMask:$,inlineStylesheet:b,maskInputOptions:S,maskTextFn:I,maskInputFn:x,dataURLOptions:T,inlineImages:O,recordCanvas:R,keepIframeSrcFn:L,newlyAddedElement:q});if(!B)return console.warn(e,"not serialized"),null;let z;z=s.hasNode(e)?s.getId(e):!function slimDOMExcluded(e,r){if(r.comment&&e.type===Lt.Comment)return!0;if(e.type===Lt.Element){if(r.script&&("script"===e.tagName||"link"===e.tagName&&("preload"===e.attributes.rel||"modulepreload"===e.attributes.rel)&&"script"===e.attributes.as||"link"===e.tagName&&"prefetch"===e.attributes.rel&&"string"==typeof e.attributes.href&&"js"===extractFileExtension(e.attributes.href)))return!0;if(r.headFavicon&&("link"===e.tagName&&"shortcut icon"===e.attributes.rel||"meta"===e.tagName&&(lowerIfExists(e.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===lowerIfExists(e.attributes.name)||"icon"===lowerIfExists(e.attributes.rel)||"apple-touch-icon"===lowerIfExists(e.attributes.rel)||"shortcut icon"===lowerIfExists(e.attributes.rel))))return!0;if("meta"===e.tagName){if(r.headMetaDescKeywords&&lowerIfExists(e.attributes.name).match(/^description|keywords$/))return!0;if(r.headMetaSocial&&(lowerIfExists(e.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===lowerIfExists(e.attributes.name)))return!0;if(r.headMetaRobots&&("robots"===lowerIfExists(e.attributes.name)||"googlebot"===lowerIfExists(e.attributes.name)||"bingbot"===lowerIfExists(e.attributes.name)))return!0;if(r.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(r.headMetaAuthorship&&("author"===lowerIfExists(e.attributes.name)||"generator"===lowerIfExists(e.attributes.name)||"framework"===lowerIfExists(e.attributes.name)||"publisher"===lowerIfExists(e.attributes.name)||"progid"===lowerIfExists(e.attributes.name)||lowerIfExists(e.attributes.property).match(/^article:/)||lowerIfExists(e.attributes.property).match(/^product:/)))return!0;if(r.headMetaVerification&&("google-site-verification"===lowerIfExists(e.attributes.name)||"yandex-verification"===lowerIfExists(e.attributes.name)||"csrf-token"===lowerIfExists(e.attributes.name)||"p:domain_verify"===lowerIfExists(e.attributes.name)||"verify-v1"===lowerIfExists(e.attributes.name)||"verification"===lowerIfExists(e.attributes.name)||"shopify-checkout-api-token"===lowerIfExists(e.attributes.name)))return!0}}return!1}(B,C)&&(U||B.type!==Lt.Text||B.isStyle||B.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():Ut;const W=Object.assign(B,{id:z});if(s.add(e,W),z===Ut)return null;N&&N(e);let K=!v;if(W.type===Lt.Element){K=K&&!W.needBlock,delete W.needBlock;const r=e.shadowRoot;r&&isNativeShadowDom(r)&&(W.isShadowHost=!0)}if((W.type===Lt.Document||W.type===Lt.Element)&&K){C.headWhitespace&&W.type===Lt.Element&&"head"===W.tagName&&(U=!1);const r={doc:i,mirror:s,blockClass:a,blockSelector:h,needsMask:$,maskTextClass:f,maskTextSelector:_,skipChild:v,inlineStylesheet:b,maskInputOptions:S,maskTextFn:I,maskInputFn:x,slimDOMOptions:C,dataURLOptions:T,inlineImages:O,recordCanvas:R,preserveWhiteSpace:U,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D,onStylesheetLoad:Z,stylesheetLoadTimeout:A,keepIframeSrcFn:L};if(W.type===Lt.Element&&"textarea"===W.tagName&&void 0!==W.attributes.value);else for(const i of Array.from(e.childNodes)){const e=serializeNodeWithId(i,r);e&&W.childNodes.push(e)}if(function isElement(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(const i of Array.from(e.shadowRoot.childNodes)){const s=serializeNodeWithId(i,r);s&&(isNativeShadowDom(e.shadowRoot)&&(s.isShadow=!0),W.childNodes.push(s))}}return e.parentNode&&isShadowRoot(e.parentNode)&&isNativeShadowDom(e.parentNode)&&(W.isShadow=!0),W.type===Lt.Element&&"iframe"===W.tagName&&function onceIframeLoaded(e,r,i){const s=e.contentWindow;if(!s)return;let a,h=!1;try{a=s.document.readyState}catch(Or){return}if("complete"!==a){const s=setTimeout((()=>{h||(r(),h=!0)}),i);return void e.addEventListener("load",(()=>{clearTimeout(s),h=!0,r()}))}const f="about:blank";if(s.location.href!==f||e.src===f||""===e.src)return setTimeout(r,0),e.addEventListener("load",r);e.addEventListener("load",r)}(e,(()=>{const r=e.contentDocument;if(r&&P){const i=serializeNodeWithId(r,{doc:r,mirror:s,blockClass:a,blockSelector:h,needsMask:$,maskTextClass:f,maskTextSelector:_,skipChild:!1,inlineStylesheet:b,maskInputOptions:S,maskTextFn:I,maskInputFn:x,slimDOMOptions:C,dataURLOptions:T,inlineImages:O,recordCanvas:R,preserveWhiteSpace:U,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D,onStylesheetLoad:Z,stylesheetLoadTimeout:A,keepIframeSrcFn:L});i&&P(e,i)}}),D),W.type===Lt.Element&&"link"===W.tagName&&"string"==typeof W.attributes.rel&&("stylesheet"===W.attributes.rel||"preload"===W.attributes.rel&&"string"==typeof W.attributes.href&&"css"===extractFileExtension(W.attributes.href))&&function onceStylesheetLoaded(e,r,i){let s,a=!1;try{s=e.sheet}catch(Or){return}if(s)return;const h=setTimeout((()=>{a||(r(),a=!0)}),i);e.addEventListener("load",(()=>{clearTimeout(h),a=!0,r()}))}(e,(()=>{if(Z){const r=serializeNodeWithId(e,{doc:i,mirror:s,blockClass:a,blockSelector:h,needsMask:$,maskTextClass:f,maskTextSelector:_,skipChild:!1,inlineStylesheet:b,maskInputOptions:S,maskTextFn:I,maskInputFn:x,slimDOMOptions:C,dataURLOptions:T,inlineImages:O,recordCanvas:R,preserveWhiteSpace:U,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D,onStylesheetLoad:Z,stylesheetLoadTimeout:A,keepIframeSrcFn:L});r&&Z(e,r)}}),A),W}function on(e,r,i=document){const s={capture:!0,passive:!0};return i.addEventListener(e,r,s),()=>i.removeEventListener(e,r,s)}const Yt="Please stop import mirror directly. Instead of that,\r\nnow you can use replayer.getMirror() to access the mirror instance of a replayer,\r\nor you can use record.mirror to access the mirror instance during recording.";let Xt={map:{},getId:()=>(console.error(Yt),-1),getNode:()=>(console.error(Yt),null),removeNodeFromMap(){console.error(Yt)},has:()=>(console.error(Yt),!1),reset(){console.error(Yt)}};function throttle(e,r,i={}){let s=null,a=0;return function(...h){const f=Date.now();a||!1!==i.leading||(a=f);const _=r-(f-a),v=this;_<=0||_>r?(s&&(clearTimeout(s),s=null),a=f,e.apply(v,h)):s||!1===i.trailing||(s=setTimeout((()=>{a=!1===i.leading?0:Date.now(),s=null,e.apply(v,h)}),_))}}function hookSetter(e,r,i,s,a=window){const h=a.Object.getOwnPropertyDescriptor(e,r);return a.Object.defineProperty(e,r,s?i:{set(e){setTimeout((()=>{i.set.call(this,e)}),0),h&&h.set&&h.set.call(this,e)}}),()=>hookSetter(e,r,h||{},!0)}function patch(e,r,i){try{if(!(r in e))return()=>{};const s=e[r],a=i(s);return"function"==typeof a&&(a.prototype=a.prototype||{},Object.defineProperties(a,{__rrweb_original__:{enumerable:!1,value:s}})),e[r]=a,()=>{e[r]=s}}catch(s){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Xt=new Proxy(Xt,{get:(e,r,i)=>("map"===r&&console.error(Yt),Reflect.get(e,r,i))}));let Qt=Date.now;function getWindowScroll(e){var r,i,s,a,h,f;const _=e.document;return{left:_.scrollingElement?_.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==_?void 0:_.documentElement.scrollLeft)||(null===(i=null===(r=null==_?void 0:_.body)||void 0===r?void 0:r.parentElement)||void 0===i?void 0:i.scrollLeft)||(null===(s=null==_?void 0:_.body)||void 0===s?void 0:s.scrollLeft)||0,top:_.scrollingElement?_.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==_?void 0:_.documentElement.scrollTop)||(null===(h=null===(a=null==_?void 0:_.body)||void 0===a?void 0:a.parentElement)||void 0===h?void 0:h.scrollTop)||(null===(f=null==_?void 0:_.body)||void 0===f?void 0:f.scrollTop)||0}}function getWindowHeight(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function getWindowWidth(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function closestElementOfNode(e){if(!e)return null;return e.nodeType===e.ELEMENT_NODE?e:e.parentElement}function isBlocked(e,r,i,s){if(!e)return!1;const a=closestElementOfNode(e);if(!a)return!1;try{if("string"==typeof r){if(a.classList.contains(r))return!0;if(s&&null!==a.closest("."+r))return!0}else if(classMatchesRegex(a,r,s))return!0}catch(h){}if(i){if(a.matches(i))return!0;if(s&&null!==a.closest(i))return!0}return!1}function isIgnored(e,r){return r.getId(e)===Ut}function isAncestorRemoved(e,r){if(isShadowRoot(e))return!1;const i=r.getId(e);return!r.has(i)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||isAncestorRemoved(e.parentNode,r))}function legacy_isTouchEvent(e){return Boolean(e.changedTouches)}function isSerializedIframe(e,r){return Boolean("IFRAME"===e.nodeName&&r.getMeta(e))}function isSerializedStylesheet(e,r){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&r.getMeta(e))}function hasShadowRoot(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(Qt=()=>(new Date).getTime());class StyleSheetMirror{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var r;return null!==(r=this.styleIDMap.get(e))&&void 0!==r?r:-1}has(e){return this.styleIDMap.has(e)}add(e,r){if(this.has(e))return this.getId(e);let i;return i=void 0===r?this.id++:r,this.styleIDMap.set(e,i),this.idStyleMap.set(i,e),i}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function getShadowHost(e){var r,i;let s=null;return(null===(i=null===(r=e.getRootNode)||void 0===r?void 0:r.call(e))||void 0===i?void 0:i.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(s=e.getRootNode().host),s}function shadowHostInDom(e){const r=e.ownerDocument;if(!r)return!1;const i=function getRootShadowHost(e){let r,i=e;for(;r=getShadowHost(i);)i=r;return i}(e);return r.contains(i)}function inDom(e){const r=e.ownerDocument;return!!r&&(r.contains(e)||shadowHostInDom(e))}var er=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(er||{}),tr=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(tr||{}),rr=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(rr||{}),nr=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(nr||{}),ir=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(ir||{});function isNodeInLinkedList(e){return"__ln"in e}class DoubleLinkedList{constructor(){this.length=0,this.head=null,this.tail=null}get(e){if(e>=this.length)throw new Error("Position outside of list range");let r=this.head;for(let i=0;i<e;i++)r=(null==r?void 0:r.next)||null;return r}addNode(e){const r={value:e,previous:null,next:null};if(e.__ln=r,e.previousSibling&&isNodeInLinkedList(e.previousSibling)){const i=e.previousSibling.__ln.next;r.next=i,r.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=r,i&&(i.previous=r)}else if(e.nextSibling&&isNodeInLinkedList(e.nextSibling)&&e.nextSibling.__ln.previous){const i=e.nextSibling.__ln.previous;r.previous=i,r.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=r,i&&(i.next=r)}else this.head&&(this.head.previous=r),r.next=this.head,this.head=r;null===r.next&&(this.tail=r),this.length++}removeNode(e){const r=e.__ln;this.head&&(r.previous?(r.previous.next=r.next,r.next?r.next.previous=r.previous:this.tail=r.previous):(this.head=r.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const moveKey=(e,r)=>`${e}@${r}`;class MutationBuffer{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=e=>{e.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const e=[],r=new Set,i=new DoubleLinkedList,getNextId=e=>{let r=e,i=Ut;for(;i===Ut;)r=r&&r.nextSibling,i=r&&this.mirror.getId(r);return i},pushAdd=s=>{if(!s.parentNode||!inDom(s)||"TEXTAREA"===s.parentNode.tagName)return;const a=isShadowRoot(s.parentNode)?this.mirror.getId(getShadowHost(s)):this.mirror.getId(s.parentNode),h=getNextId(s);if(-1===a||-1===h)return i.addNode(s);const f=serializeNodeWithId(s,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:e=>{isSerializedIframe(e,this.mirror)&&this.iframeManager.addIframe(e),isSerializedStylesheet(e,this.mirror)&&this.stylesheetManager.trackLinkElement(e),hasShadowRoot(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc)},onIframeLoad:(e,r)=>{this.iframeManager.attachIframe(e,r),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,r)=>{this.stylesheetManager.attachLinkElement(e,r)}});f&&(e.push({parentId:a,nextId:h,node:f}),r.add(f.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const h of this.movedSet)isParentRemoved(this.removes,h,this.mirror)&&!this.movedSet.has(h.parentNode)||pushAdd(h);for(const h of this.addedSet)isAncestorInSet(this.droppedSet,h)||isParentRemoved(this.removes,h,this.mirror)?isAncestorInSet(this.movedSet,h)?pushAdd(h):this.droppedSet.add(h):pushAdd(h);let s=null;for(;i.length;){let e=null;if(s){const r=this.mirror.getId(s.value.parentNode),i=getNextId(s.value);-1!==r&&-1!==i&&(e=s)}if(!e){let r=i.tail;for(;r;){const i=r;if(r=r.previous,i){const r=this.mirror.getId(i.value.parentNode);if(-1===getNextId(i.value))continue;if(-1!==r){e=i;break}{const r=i.value;if(r.parentNode&&r.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const s=r.parentNode.host;if(-1!==this.mirror.getId(s)){e=i;break}}}}}}if(!e){for(;i.head;)i.removeNode(i.head.value);break}s=e.previous,i.removeNode(e.value),pushAdd(e.value)}const a={texts:this.texts.map((e=>{const r=e.node;return r.parentNode&&"TEXTAREA"===r.parentNode.tagName&&this.genTextAreaValueMutation(r.parentNode),{id:this.mirror.getId(r),value:e.value}})).filter((e=>!r.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:r}=e;if("string"==typeof r.style){const i=JSON.stringify(e.styleDiff),s=JSON.stringify(e._unchangedStyles);i.length<r.style.length&&(i+s).split("var(").length===r.style.split("var(").length&&(r.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:r}})).filter((e=>!r.has(e.id))).filter((e=>this.mirror.has(e.id))),removes:this.removes,adds:e};(a.texts.length||a.attributes.length||a.removes.length||a.adds.length)&&(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.genTextAreaValueMutation=e=>{let r=this.attributeMap.get(e);r||(r={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(r),this.attributeMap.set(e,r)),r.attributes.value=Array.from(e.childNodes,(e=>e.textContent||"")).join("")},this.processMutation=e=>{if(!isIgnored(e.target,this.mirror))switch(e.type){case"characterData":{const r=e.target.textContent;isBlocked(e.target,this.blockClass,this.blockSelector,!1)||r===e.oldValue||this.texts.push({value:needMaskingText(e.target,this.maskTextClass,this.maskTextSelector,!0)&&r?this.maskTextFn?this.maskTextFn(r,closestElementOfNode(e.target)):r.replace(/[\S]/g,"*"):r,node:e.target});break}case"attributes":{const i=e.target;let s=e.attributeName,a=e.target.getAttribute(s);if("value"===s){const e=getInputType(i);a=maskInputValue({element:i,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:e,value:a,maskInputFn:this.maskInputFn})}if(isBlocked(e.target,this.blockClass,this.blockSelector,!1)||a===e.oldValue)return;let h=this.attributeMap.get(e.target);if("IFRAME"===i.tagName&&"src"===s&&!this.keepIframeSrcFn(a)){if(i.contentDocument)return;s="rr_src"}if(h||(h={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(h),this.attributeMap.set(e.target,h)),"type"===s&&"INPUT"===i.tagName&&"password"===(e.oldValue||"").toLowerCase()&&i.setAttribute("data-rr-is-password","true"),!ignoreAttribute(i.tagName,s)&&(h.attributes[s]=transformAttribute(this.doc,toLowerCase(i.tagName),toLowerCase(s),a),"style"===s)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(r){this.unattachedDoc=this.doc}const s=this.unattachedDoc.createElement("span");e.oldValue&&s.setAttribute("style",e.oldValue);for(const e of Array.from(i.style)){const r=i.style.getPropertyValue(e),a=i.style.getPropertyPriority(e);r!==s.style.getPropertyValue(e)||a!==s.style.getPropertyPriority(e)?h.styleDiff[e]=""===a?r:[r,a]:h._unchangedStyles[e]=[r,a]}for(const e of Array.from(s.style))""===i.style.getPropertyValue(e)&&(h.styleDiff[e]=!1)}break}case"childList":if(isBlocked(e.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===e.target.tagName)return void this.genTextAreaValueMutation(e.target);e.addedNodes.forEach((r=>this.genAdds(r,e.target))),e.removedNodes.forEach((r=>{const i=this.mirror.getId(r),s=isShadowRoot(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);isBlocked(e.target,this.blockClass,this.blockSelector,!1)||isIgnored(r,this.mirror)||!function isSerialized(e,r){return-1!==r.getId(e)}(r,this.mirror)||(this.addedSet.has(r)?(deepDelete(this.addedSet,r),this.droppedSet.add(r)):this.addedSet.has(e.target)&&-1===i||isAncestorRemoved(e.target,this.mirror)||(this.movedSet.has(r)&&this.movedMap[moveKey(i,s)]?deepDelete(this.movedSet,r):this.removes.push({parentId:s,id:i,isShadow:!(!isShadowRoot(e.target)||!isNativeShadowDom(e.target))||void 0})),this.mapRemoves.push(r))}))}},this.genAdds=(e,r)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!this.addedSet.has(e)&&!this.movedSet.has(e)){if(this.mirror.hasNode(e)){if(isIgnored(e,this.mirror))return;this.movedSet.add(e);let i=null;r&&this.mirror.hasNode(r)&&(i=this.mirror.getId(r)),i&&-1!==i&&(this.movedMap[moveKey(this.mirror.getId(e),i)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);isBlocked(e,this.blockClass,this.blockSelector,!1)||(e.childNodes.forEach((e=>this.genAdds(e))),hasShadowRoot(e)&&e.shadowRoot.childNodes.forEach((r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)})))}}}init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach((r=>{this[r]=e[r]}))}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function deepDelete(e,r){e.delete(r),r.childNodes.forEach((r=>deepDelete(e,r)))}function isParentRemoved(e,r,i){return 0!==e.length&&_isParentRemoved(e,r,i)}function _isParentRemoved(e,r,i){const{parentNode:s}=r;if(!s)return!1;const a=i.getId(s);return!!e.some((e=>e.id===a))||_isParentRemoved(e,s,i)}function isAncestorInSet(e,r){return 0!==e.size&&_isAncestorInSet(e,r)}function _isAncestorInSet(e,r){const{parentNode:i}=r;return!!i&&(!!e.has(i)||_isAncestorInSet(e,i))}let or;const callbackWrapper=e=>{if(!or)return e;return(...r)=>{try{return e(...r)}catch(Or){if(or&&!0===or(Or))return;throw Or}}},sr=[];function getEventTarget(e){try{if("composedPath"in e){const r=e.composedPath();if(r.length)return r[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(r){}return e&&e.target}function initMutationObserver(e,r){var i,s;const a=new MutationBuffer;sr.push(a),a.init(e);let h=window.MutationObserver||window.__rrMutationObserver;const f=null===(s=null===(i=null===window||void 0===window?void 0:window.Zone)||void 0===i?void 0:i.__symbol__)||void 0===s?void 0:s.call(i,"MutationObserver");f&&window[f]&&(h=window[f]);const _=new h(callbackWrapper(a.processMutations.bind(a)));return _.observe(r,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),_}function initMouseInteractionObserver({mouseInteractionCb:e,doc:r,mirror:i,blockClass:s,blockSelector:a,sampling:h}){if(!1===h.mouseInteraction)return()=>{};const f=!0===h.mouseInteraction||void 0===h.mouseInteraction?{}:h.mouseInteraction,_=[];let v=null;return Object.keys(rr).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==f[e])).forEach((h=>{let f=toLowerCase(h);const b=(r=>h=>{const f=getEventTarget(h);if(isBlocked(f,s,a,!0))return;let _=null,b=r;if("pointerType"in h){switch(h.pointerType){case"mouse":_=nr.Mouse;break;case"touch":_=nr.Touch;break;case"pen":_=nr.Pen}_===nr.Touch?rr[r]===rr.MouseDown?b="TouchStart":rr[r]===rr.MouseUp&&(b="TouchEnd"):nr.Pen}else legacy_isTouchEvent(h)&&(_=nr.Touch);null!==_?(v=_,(b.startsWith("Touch")&&_===nr.Touch||b.startsWith("Mouse")&&_===nr.Mouse)&&(_=null)):rr[r]===rr.Click&&(_=v,v=null);const S=legacy_isTouchEvent(h)?h.changedTouches[0]:h;if(!S)return;const I=i.getId(f),{clientX:x,clientY:C}=S;callbackWrapper(e)(Object.assign({type:rr[b],id:I,x:x,y:C},null!==_&&{pointerType:_}))})(h);if(window.PointerEvent)switch(rr[h]){case rr.MouseDown:case rr.MouseUp:f=f.replace("mouse","pointer");break;case rr.TouchStart:case rr.TouchEnd:return}_.push(on(f,b,r))})),callbackWrapper((()=>{_.forEach((e=>e()))}))}function initScrollObserver({scrollCb:e,doc:r,mirror:i,blockClass:s,blockSelector:a,sampling:h}){return on("scroll",callbackWrapper(throttle(callbackWrapper((h=>{const f=getEventTarget(h);if(!f||isBlocked(f,s,a,!0))return;const _=i.getId(f);if(f===r&&r.defaultView){const i=getWindowScroll(r.defaultView);e({id:_,x:i.left,y:i.top})}else e({id:_,x:f.scrollLeft,y:f.scrollTop})})),h.scroll||100)),r)}const ar=["INPUT","TEXTAREA","SELECT"],cr=new WeakMap;function getNestedCSSRulePositions(e){return function recurse(e,r){if(hasNestedCSSRule("CSSGroupingRule")&&e.parentRule instanceof CSSGroupingRule||hasNestedCSSRule("CSSMediaRule")&&e.parentRule instanceof CSSMediaRule||hasNestedCSSRule("CSSSupportsRule")&&e.parentRule instanceof CSSSupportsRule||hasNestedCSSRule("CSSConditionRule")&&e.parentRule instanceof CSSConditionRule){const i=Array.from(e.parentRule.cssRules).indexOf(e);r.unshift(i)}else if(e.parentStyleSheet){const i=Array.from(e.parentStyleSheet.cssRules).indexOf(e);r.unshift(i)}return r}(e,[])}function getIdAndStyleId(e,r,i){let s,a;return e?(e.ownerNode?s=r.getId(e.ownerNode):a=i.getId(e),{styleId:a,id:s}):{}}function initAdoptedStyleSheetObserver({mirror:e,stylesheetManager:r},i){var s,a,h;let f=null;f="#document"===i.nodeName?e.getId(i):e.getId(i.host);const _="#document"===i.nodeName?null===(s=i.defaultView)||void 0===s?void 0:s.Document:null===(h=null===(a=i.ownerDocument)||void 0===a?void 0:a.defaultView)||void 0===h?void 0:h.ShadowRoot,v=(null==_?void 0:_.prototype)?Object.getOwnPropertyDescriptor(null==_?void 0:_.prototype,"adoptedStyleSheets"):void 0;return null!==f&&-1!==f&&_&&v?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:v.configurable,enumerable:v.enumerable,get(){var e;return null===(e=v.get)||void 0===e?void 0:e.call(this)},set(e){var i;const s=null===(i=v.set)||void 0===i?void 0:i.call(this,e);if(null!==f&&-1!==f)try{r.adoptStyleSheets(e,f)}catch(a){}return s}}),callbackWrapper((()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:v.configurable,enumerable:v.enumerable,get:v.get,set:v.set})}))):()=>{}}function initObservers(e,r={}){const i=e.doc.defaultView;if(!i)return()=>{};let s;!function mergeHooks(e,r){const{mutationCb:i,mousemoveCb:s,mouseInteractionCb:a,scrollCb:h,viewportResizeCb:f,inputCb:_,mediaInteractionCb:v,styleSheetRuleCb:b,styleDeclarationCb:S,canvasMutationCb:I,fontCb:x,selectionCb:C,customElementCb:T}=e;e.mutationCb=(...e)=>{r.mutation&&r.mutation(...e),i(...e)},e.mousemoveCb=(...e)=>{r.mousemove&&r.mousemove(...e),s(...e)},e.mouseInteractionCb=(...e)=>{r.mouseInteraction&&r.mouseInteraction(...e),a(...e)},e.scrollCb=(...e)=>{r.scroll&&r.scroll(...e),h(...e)},e.viewportResizeCb=(...e)=>{r.viewportResize&&r.viewportResize(...e),f(...e)},e.inputCb=(...e)=>{r.input&&r.input(...e),_(...e)},e.mediaInteractionCb=(...e)=>{r.mediaInteaction&&r.mediaInteaction(...e),v(...e)},e.styleSheetRuleCb=(...e)=>{r.styleSheetRule&&r.styleSheetRule(...e),b(...e)},e.styleDeclarationCb=(...e)=>{r.styleDeclaration&&r.styleDeclaration(...e),S(...e)},e.canvasMutationCb=(...e)=>{r.canvasMutation&&r.canvasMutation(...e),I(...e)},e.fontCb=(...e)=>{r.font&&r.font(...e),x(...e)},e.selectionCb=(...e)=>{r.selection&&r.selection(...e),C(...e)},e.customElementCb=(...e)=>{r.customElement&&r.customElement(...e),T(...e)}}(e,r),e.recordDOM&&(s=initMutationObserver(e,e.doc));const a=function initMoveObserver({mousemoveCb:e,sampling:r,doc:i,mirror:s}){if(!1===r.mousemove)return()=>{};const a="number"==typeof r.mousemove?r.mousemove:50,h="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500;let f,_=[];const v=throttle(callbackWrapper((r=>{const i=Date.now()-f;e(_.map((e=>(e.timeOffset-=i,e))),r),_=[],f=null})),h),b=callbackWrapper(throttle(callbackWrapper((e=>{const r=getEventTarget(e),{clientX:i,clientY:a}=legacy_isTouchEvent(e)?e.changedTouches[0]:e;f||(f=Qt()),_.push({x:i,y:a,id:s.getId(r),timeOffset:Qt()-f}),v("undefined"!=typeof DragEvent&&e instanceof DragEvent?tr.Drag:e instanceof MouseEvent?tr.MouseMove:tr.TouchMove)})),a,{trailing:!1})),S=[on("mousemove",b,i),on("touchmove",b,i),on("drag",b,i)];return callbackWrapper((()=>{S.forEach((e=>e()))}))}(e),h=initMouseInteractionObserver(e),f=initScrollObserver(e),_=function initViewportResizeObserver({viewportResizeCb:e},{win:r}){let i=-1,s=-1;return on("resize",callbackWrapper(throttle(callbackWrapper((()=>{const r=getWindowHeight(),a=getWindowWidth();i===r&&s===a||(e({width:Number(a),height:Number(r)}),i=r,s=a)})),200)),r)}(e,{win:i}),v=function initInputObserver({inputCb:e,doc:r,mirror:i,blockClass:s,blockSelector:a,ignoreClass:h,ignoreSelector:f,maskInputOptions:_,maskInputFn:v,sampling:b,userTriggeredOnInput:S}){function eventHandler(e){let i=getEventTarget(e);const b=e.isTrusted,I=i&&i.tagName;if(i&&"OPTION"===I&&(i=i.parentElement),!i||!I||ar.indexOf(I)<0||isBlocked(i,s,a,!0))return;if(i.classList.contains(h)||f&&i.matches(f))return;let x=i.value,C=!1;const T=getInputType(i)||"";"radio"===T||"checkbox"===T?C=i.checked:(_[I.toLowerCase()]||_[T])&&(x=maskInputValue({element:i,maskInputOptions:_,tagName:I,type:T,value:x,maskInputFn:v})),cbWithDedup(i,S?{text:x,isChecked:C,userTriggered:b}:{text:x,isChecked:C});const O=i.name;"radio"===T&&O&&C&&r.querySelectorAll(`input[type="radio"][name="${O}"]`).forEach((e=>{if(e!==i){const r=e.value;cbWithDedup(e,S?{text:r,isChecked:!C,userTriggered:!1}:{text:r,isChecked:!C})}}))}function cbWithDedup(r,s){const a=cr.get(r);if(!a||a.text!==s.text||a.isChecked!==s.isChecked){cr.set(r,s);const a=i.getId(r);callbackWrapper(e)(Object.assign(Object.assign({},s),{id:a}))}}const I=("last"===b.input?["change"]:["input","change"]).map((e=>on(e,callbackWrapper(eventHandler),r))),x=r.defaultView;if(!x)return()=>{I.forEach((e=>e()))};const C=x.Object.getOwnPropertyDescriptor(x.HTMLInputElement.prototype,"value"),T=[[x.HTMLInputElement.prototype,"value"],[x.HTMLInputElement.prototype,"checked"],[x.HTMLSelectElement.prototype,"value"],[x.HTMLTextAreaElement.prototype,"value"],[x.HTMLSelectElement.prototype,"selectedIndex"],[x.HTMLOptionElement.prototype,"selected"]];return C&&C.set&&I.push(...T.map((e=>hookSetter(e[0],e[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,x)))),callbackWrapper((()=>{I.forEach((e=>e()))}))}(e),b=function initMediaInteractionObserver({mediaInteractionCb:e,blockClass:r,blockSelector:i,mirror:s,sampling:a,doc:h}){const f=callbackWrapper((h=>throttle(callbackWrapper((a=>{const f=getEventTarget(a);if(!f||isBlocked(f,r,i,!0))return;const{currentTime:_,volume:v,muted:b,playbackRate:S,loop:I}=f;e({type:h,id:s.getId(f),currentTime:_,volume:v,muted:b,playbackRate:S,loop:I})})),a.media||500))),_=[on("play",f(0),h),on("pause",f(1),h),on("seeked",f(2),h),on("volumechange",f(3),h),on("ratechange",f(4),h)];return callbackWrapper((()=>{_.forEach((e=>e()))}))}(e);let styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};e.recordDOM&&(styleSheetObserver=function initStyleSheetObserver({styleSheetRuleCb:e,mirror:r,stylesheetManager:i},{win:s}){if(!s.CSSStyleSheet||!s.CSSStyleSheet.prototype)return()=>{};const a=s.CSSStyleSheet.prototype.insertRule;s.CSSStyleSheet.prototype.insertRule=new Proxy(a,{apply:callbackWrapper(((s,a,h)=>{const[f,_]=h,{id:v,styleId:b}=getIdAndStyleId(a,r,i.styleMirror);return(v&&-1!==v||b&&-1!==b)&&e({id:v,styleId:b,adds:[{rule:f,index:_}]}),s.apply(a,h)}))});const h=s.CSSStyleSheet.prototype.deleteRule;let f,_;s.CSSStyleSheet.prototype.deleteRule=new Proxy(h,{apply:callbackWrapper(((s,a,h)=>{const[f]=h,{id:_,styleId:v}=getIdAndStyleId(a,r,i.styleMirror);return(_&&-1!==_||v&&-1!==v)&&e({id:_,styleId:v,removes:[{index:f}]}),s.apply(a,h)}))}),s.CSSStyleSheet.prototype.replace&&(f=s.CSSStyleSheet.prototype.replace,s.CSSStyleSheet.prototype.replace=new Proxy(f,{apply:callbackWrapper(((s,a,h)=>{const[f]=h,{id:_,styleId:v}=getIdAndStyleId(a,r,i.styleMirror);return(_&&-1!==_||v&&-1!==v)&&e({id:_,styleId:v,replace:f}),s.apply(a,h)}))})),s.CSSStyleSheet.prototype.replaceSync&&(_=s.CSSStyleSheet.prototype.replaceSync,s.CSSStyleSheet.prototype.replaceSync=new Proxy(_,{apply:callbackWrapper(((s,a,h)=>{const[f]=h,{id:_,styleId:v}=getIdAndStyleId(a,r,i.styleMirror);return(_&&-1!==_||v&&-1!==v)&&e({id:_,styleId:v,replaceSync:f}),s.apply(a,h)}))}));const v={};canMonkeyPatchNestedCSSRule("CSSGroupingRule")?v.CSSGroupingRule=s.CSSGroupingRule:(canMonkeyPatchNestedCSSRule("CSSMediaRule")&&(v.CSSMediaRule=s.CSSMediaRule),canMonkeyPatchNestedCSSRule("CSSConditionRule")&&(v.CSSConditionRule=s.CSSConditionRule),canMonkeyPatchNestedCSSRule("CSSSupportsRule")&&(v.CSSSupportsRule=s.CSSSupportsRule));const b={};return Object.entries(v).forEach((([s,a])=>{b[s]={insertRule:a.prototype.insertRule,deleteRule:a.prototype.deleteRule},a.prototype.insertRule=new Proxy(b[s].insertRule,{apply:callbackWrapper(((s,a,h)=>{const[f,_]=h,{id:v,styleId:b}=getIdAndStyleId(a.parentStyleSheet,r,i.styleMirror);return(v&&-1!==v||b&&-1!==b)&&e({id:v,styleId:b,adds:[{rule:f,index:[...getNestedCSSRulePositions(a),_||0]}]}),s.apply(a,h)}))}),a.prototype.deleteRule=new Proxy(b[s].deleteRule,{apply:callbackWrapper(((s,a,h)=>{const[f]=h,{id:_,styleId:v}=getIdAndStyleId(a.parentStyleSheet,r,i.styleMirror);return(_&&-1!==_||v&&-1!==v)&&e({id:_,styleId:v,removes:[{index:[...getNestedCSSRulePositions(a),f]}]}),s.apply(a,h)}))})})),callbackWrapper((()=>{s.CSSStyleSheet.prototype.insertRule=a,s.CSSStyleSheet.prototype.deleteRule=h,f&&(s.CSSStyleSheet.prototype.replace=f),_&&(s.CSSStyleSheet.prototype.replaceSync=_),Object.entries(v).forEach((([e,r])=>{r.prototype.insertRule=b[e].insertRule,r.prototype.deleteRule=b[e].deleteRule}))}))}(e,{win:i}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(e,e.doc),styleDeclarationObserver=function initStyleDeclarationObserver({styleDeclarationCb:e,mirror:r,ignoreCSSAttributes:i,stylesheetManager:s},{win:a}){const h=a.CSSStyleDeclaration.prototype.setProperty;a.CSSStyleDeclaration.prototype.setProperty=new Proxy(h,{apply:callbackWrapper(((a,f,_)=>{var v;const[b,S,I]=_;if(i.has(b))return h.apply(f,[b,S,I]);const{id:x,styleId:C}=getIdAndStyleId(null===(v=f.parentRule)||void 0===v?void 0:v.parentStyleSheet,r,s.styleMirror);return(x&&-1!==x||C&&-1!==C)&&e({id:x,styleId:C,set:{property:b,value:S,priority:I},index:getNestedCSSRulePositions(f.parentRule)}),a.apply(f,_)}))});const f=a.CSSStyleDeclaration.prototype.removeProperty;return a.CSSStyleDeclaration.prototype.removeProperty=new Proxy(f,{apply:callbackWrapper(((a,h,_)=>{var v;const[b]=_;if(i.has(b))return f.apply(h,[b]);const{id:S,styleId:I}=getIdAndStyleId(null===(v=h.parentRule)||void 0===v?void 0:v.parentStyleSheet,r,s.styleMirror);return(S&&-1!==S||I&&-1!==I)&&e({id:S,styleId:I,remove:{property:b},index:getNestedCSSRulePositions(h.parentRule)}),a.apply(h,_)}))}),callbackWrapper((()=>{a.CSSStyleDeclaration.prototype.setProperty=h,a.CSSStyleDeclaration.prototype.removeProperty=f}))}(e,{win:i}),e.collectFonts&&(fontObserver=function initFontObserver({fontCb:e,doc:r}){const i=r.defaultView;if(!i)return()=>{};const s=[],a=new WeakMap,h=i.FontFace;i.FontFace=function FontFace(e,r,i){const s=new h(e,r,i);return a.set(s,{family:e,buffer:"string"!=typeof r,descriptors:i,fontSource:"string"==typeof r?r:JSON.stringify(Array.from(new Uint8Array(r)))}),s};const f=patch(r.fonts,"add",(function(r){return function(i){return setTimeout(callbackWrapper((()=>{const r=a.get(i);r&&(e(r),a.delete(i))})),0),r.apply(this,[i])}}));return s.push((()=>{i.FontFace=h})),s.push(f),callbackWrapper((()=>{s.forEach((e=>e()))}))}(e)));const S=function initSelectionObserver(e){const{doc:r,mirror:i,blockClass:s,blockSelector:a,selectionCb:h}=e;let f=!0;const _=callbackWrapper((()=>{const e=r.getSelection();if(!e||f&&(null==e?void 0:e.isCollapsed))return;f=e.isCollapsed||!1;const _=[],v=e.rangeCount||0;for(let r=0;r<v;r++){const h=e.getRangeAt(r),{startContainer:f,startOffset:v,endContainer:b,endOffset:S}=h;isBlocked(f,s,a,!0)||isBlocked(b,s,a,!0)||_.push({start:i.getId(f),startOffset:v,end:i.getId(b),endOffset:S})}h({ranges:_})}));return _(),on("selectionchange",_)}(e),I=function initCustomElementObserver({doc:e,customElementCb:r}){const i=e.defaultView;return i&&i.customElements?patch(i.customElements,"define",(function(e){return function(i,s,a){try{r({define:{name:i}})}catch(h){console.warn(`Custom element callback failed for ${i}`)}return e.apply(this,[i,s,a])}})):()=>{}}(e),x=[];for(const C of e.plugins)x.push(C.observer(C.callback,i,C.options));return callbackWrapper((()=>{sr.forEach((e=>e.reset())),null==s||s.disconnect(),a(),h(),f(),_(),v(),b(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),S(),I(),x.forEach((e=>e()))}))}function hasNestedCSSRule(e){return void 0!==window[e]}function canMonkeyPatchNestedCSSRule(e){return Boolean(void 0!==window[e]&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class CrossOriginIframeMirror{constructor(e){this.generateIdFn=e,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(e,r,i,s){const a=i||this.getIdToRemoteIdMap(e),h=s||this.getRemoteIdToIdMap(e);let f=a.get(r);return f||(f=this.generateIdFn(),a.set(r,f),h.set(f,r)),f}getIds(e,r){const i=this.getIdToRemoteIdMap(e),s=this.getRemoteIdToIdMap(e);return r.map((r=>this.getId(e,r,i,s)))}getRemoteId(e,r,i){const s=i||this.getRemoteIdToIdMap(e);if("number"!=typeof r)return r;const a=s.get(r);return a||-1}getRemoteIds(e,r){const i=this.getRemoteIdToIdMap(e);return r.map((r=>this.getRemoteId(e,r,i)))}reset(e){if(!e)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let r=this.iframeIdToRemoteIdMap.get(e);return r||(r=new Map,this.iframeIdToRemoteIdMap.set(e,r)),r}getRemoteIdToIdMap(e){let r=this.iframeRemoteIdToIdMap.get(e);return r||(r=new Map,this.iframeRemoteIdToIdMap.set(e,r)),r}}class IframeManager{constructor(e){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new CrossOriginIframeMirror(genId),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}attachIframe(e,r){var i;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:r}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(i=this.loadListener)||void 0===i||i.call(this,e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}handleMessage(e){const r=e;if("rrweb"!==r.data.type||r.origin!==r.data.origin)return;if(!e.source)return;const i=this.crossOriginIframeMap.get(e.source);if(!i)return;const s=this.transformCrossOriginEvent(i,r.data.event);s&&this.wrappedEmit(s,r.data.isCheckout)}transformCrossOriginEvent(e,r){var i;switch(r.type){case er.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(r.data.node,e);const i=r.data.node.id;return this.crossOriginIframeRootIdMap.set(e,i),this.patchRootIdOnNode(r.data.node,i),{timestamp:r.timestamp,type:er.IncrementalSnapshot,data:{source:tr.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case er.Meta:case er.Load:case er.DomContentLoaded:return!1;case er.Plugin:return r;case er.Custom:return this.replaceIds(r.data.payload,e,["id","parentId","previousId","nextId"]),r;case er.IncrementalSnapshot:switch(r.data.source){case tr.Mutation:return r.data.adds.forEach((r=>{this.replaceIds(r,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,e);const i=this.crossOriginIframeRootIdMap.get(e);i&&this.patchRootIdOnNode(r.node,i)})),r.data.removes.forEach((r=>{this.replaceIds(r,e,["parentId","id"])})),r.data.attributes.forEach((r=>{this.replaceIds(r,e,["id"])})),r.data.texts.forEach((r=>{this.replaceIds(r,e,["id"])})),r;case tr.Drag:case tr.TouchMove:case tr.MouseMove:return r.data.positions.forEach((r=>{this.replaceIds(r,e,["id"])})),r;case tr.ViewportResize:return!1;case tr.MediaInteraction:case tr.MouseInteraction:case tr.Scroll:case tr.CanvasMutation:case tr.Input:return this.replaceIds(r.data,e,["id"]),r;case tr.StyleSheetRule:case tr.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case tr.Font:return r;case tr.Selection:return r.data.ranges.forEach((r=>{this.replaceIds(r,e,["start","end"])})),r;case tr.AdoptedStyleSheet:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleIds"]),null===(i=r.data.styles)||void 0===i||i.forEach((r=>{this.replaceStyleIds(r,e,["styleId"])})),r}}return!1}replace(e,r,i,s){for(const a of s)(Array.isArray(r[a])||"number"==typeof r[a])&&(Array.isArray(r[a])?r[a]=e.getIds(i,r[a]):r[a]=e.getId(i,r[a]));return r}replaceIds(e,r,i){return this.replace(this.crossOriginIframeMirror,e,r,i)}replaceStyleIds(e,r,i){return this.replace(this.crossOriginIframeStyleMirror,e,r,i)}replaceIdOnNode(e,r){this.replaceIds(e,r,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,r)}))}patchRootIdOnNode(e,r){e.type===Lt.Document||e.rootId||(e.rootId=r),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,r)}))}}class ShadowDomManager{constructor(e){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,r){if(!isNativeShadowDom(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const i=initMutationObserver(Object.assign(Object.assign({},this.bypassOptions),{doc:r,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>i.disconnect())),this.restoreHandlers.push(initScrollObserver(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:e,mirror:this.mirror}))),setTimeout((()=>{e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(e.host)),this.restoreHandlers.push(initAdoptedStyleSheetObserver({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e))}),0)}observeAttachShadow(e){e.contentWindow&&e.contentDocument&&this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,r){const i=this;this.restoreHandlers.push(patch(e.prototype,"attachShadow",(function(e){return function(s){const a=e.call(this,s);return this.shadowRoot&&inDom(this)&&i.addShadowRoot(this.shadowRoot,r),a}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(r){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -12,7 +12,7 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
12
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */function __awaiter(e,i,o,s){return new(o||(o=Promise))((function(i,a){function fulfilled(e){try{step(s.next(e))}catch(i){a(i)}}function rejected(e){try{step(s.throw(e))}catch(i){a(i)}}function step(e){e.done?i(e.value):function adopt(e){return e instanceof o?e:new o((function(i){i(e)}))}(e.value).then(fulfilled,rejected)}step((s=s.apply(e,[])).next())}))}for(var dr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ur="undefined"==typeof Uint8Array?[]:new Uint8Array(256),lr=0;lr<64;lr++)ur[dr.charCodeAt(lr)]=lr;const pr=new Map;const saveWebGLVar=(e,i,o)=>{if(!e||!isInstanceOfWebGLObject(e,i)&&"object"!=typeof e)return;const s=function variableListFor(e,i){let o=pr.get(e);return o||(o=new Map,pr.set(e,o)),o.has(i)||o.set(i,[]),o.get(i)}(o,e.constructor.name);let a=s.indexOf(e);return-1===a&&(a=s.length,s.push(e)),a};function serializeArg(e,i,o){if(e instanceof Array)return e.map((e=>serializeArg(e,i,o)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const i=e.constructor.name,o=function(e){var i,o=new Uint8Array(e),s=o.length,a="";for(i=0;i<s;i+=3)a+=dr[o[i]>>2],a+=dr[(3&o[i])<<4|o[i+1]>>4],a+=dr[(15&o[i+1])<<2|o[i+2]>>6],a+=dr[63&o[i+2]];return s%3==2?a=a.substring(0,a.length-1)+"=":s%3==1&&(a=a.substring(0,a.length-2)+"=="),a}(e);return{rr_type:i,base64:o}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[serializeArg(e.buffer,i,o),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const i=e.constructor.name,{src:o}=e;return{rr_type:i,src:o}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[serializeArg(e.data,i,o),e.width,e.height]}}if(isInstanceOfWebGLObject(e,i)||"object"==typeof e){return{rr_type:e.constructor.name,index:saveWebGLVar(e,i,o)}}return e}const serializeArgs=(e,i,o)=>e.map((e=>serializeArg(e,i,o))),isInstanceOfWebGLObject=(e,i)=>{const o=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof i[e]));return Boolean(o.find((o=>e instanceof i[o])))};function initCanvasContextObserver(e,i,o,s){const a=[];try{const h=patch(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(a,...h){if(!isBlocked(this,i,o,!0)){const e=function getNormalizedContextName(e){return"experimental-webgl"===e?"webgl":e}(a);if("__context"in this||(this.__context=e),s&&["webgl","webgl2"].includes(e))if(h[0]&&"object"==typeof h[0]){const e=h[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else h.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[a,...h])}}));a.push(h)}catch(h){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{a.forEach((e=>e()))}}function patchGLPrototype(e,i,o,s,a,h,f){const g=[],_=Object.getOwnPropertyNames(e);for(const b of _)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(b))try{if("function"!=typeof e[b])continue;const h=patch(e,b,(function(e){return function(...h){const g=e.apply(this,h);if(saveWebGLVar(g,f,this),"tagName"in this.canvas&&!isBlocked(this.canvas,s,a,!0)){const e=serializeArgs(h,f,this),s={type:i,property:b,args:e};o(this.canvas,s)}return g}}));g.push(h)}catch(v){const s=hookSetter(e,b,{set(e){o(this.canvas,{type:i,property:b,args:[e],setter:!0})}});g.push(s)}return g}var hr=function createInlineWorkerFactory(e,i){var o;return function WorkerFactory2(i){return o=o||function createURL(e,i){var o=function funcToSource(e){var i=e.toString().split("\n");i.pop(),i.shift();for(var o=i[0].search(/\S/),s=/(['"])__worker_loader_strict__(['"])/g,a=0,h=i.length;a<h;++a)i[a]=i[a].substring(o).replace(s,"$1use strict$2")+"\n";return i}(e),s=new Blob(o,{type:"application/javascript"});return URL.createObjectURL(s)}(e),new Worker(o,i)}}((function(){!function(){
15
+ ***************************************************************************** */function __awaiter(e,r,i,s){return new(i||(i=Promise))((function(r,a){function fulfilled(e){try{step(s.next(e))}catch(r){a(r)}}function rejected(e){try{step(s.throw(e))}catch(r){a(r)}}function step(e){e.done?r(e.value):function adopt(e){return e instanceof i?e:new i((function(r){r(e)}))}(e.value).then(fulfilled,rejected)}step((s=s.apply(e,[])).next())}))}for(var dr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ur="undefined"==typeof Uint8Array?[]:new Uint8Array(256),lr=0;lr<64;lr++)ur[dr.charCodeAt(lr)]=lr;const pr=new Map;const saveWebGLVar=(e,r,i)=>{if(!e||!isInstanceOfWebGLObject(e,r)&&"object"!=typeof e)return;const s=function variableListFor(e,r){let i=pr.get(e);return i||(i=new Map,pr.set(e,i)),i.has(r)||i.set(r,[]),i.get(r)}(i,e.constructor.name);let a=s.indexOf(e);return-1===a&&(a=s.length,s.push(e)),a};function serializeArg(e,r,i){if(e instanceof Array)return e.map((e=>serializeArg(e,r,i)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){const r=e.constructor.name,i=function(e){var r,i=new Uint8Array(e),s=i.length,a="";for(r=0;r<s;r+=3)a+=dr[i[r]>>2],a+=dr[(3&i[r])<<4|i[r+1]>>4],a+=dr[(15&i[r+1])<<2|i[r+2]>>6],a+=dr[63&i[r+2]];return s%3==2?a=a.substring(0,a.length-1)+"=":s%3==1&&(a=a.substring(0,a.length-2)+"=="),a}(e);return{rr_type:r,base64:i}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[serializeArg(e.buffer,r,i),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const r=e.constructor.name,{src:i}=e;return{rr_type:r,src:i}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[serializeArg(e.data,r,i),e.width,e.height]}}if(isInstanceOfWebGLObject(e,r)||"object"==typeof e){return{rr_type:e.constructor.name,index:saveWebGLVar(e,r,i)}}return e}const serializeArgs=(e,r,i)=>e.map((e=>serializeArg(e,r,i))),isInstanceOfWebGLObject=(e,r)=>{const i=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof r[e]));return Boolean(i.find((i=>e instanceof r[i])))};function initCanvasContextObserver(e,r,i,s){const a=[];try{const h=patch(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(a,...h){if(!isBlocked(this,r,i,!0)){const e=function getNormalizedContextName(e){return"experimental-webgl"===e?"webgl":e}(a);if("__context"in this||(this.__context=e),s&&["webgl","webgl2"].includes(e))if(h[0]&&"object"==typeof h[0]){const e=h[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else h.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[a,...h])}}));a.push(h)}catch(h){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{a.forEach((e=>e()))}}function patchGLPrototype(e,r,i,s,a,h,f){const _=[],v=Object.getOwnPropertyNames(e);for(const S of v)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(S))try{if("function"!=typeof e[S])continue;const h=patch(e,S,(function(e){return function(...h){const _=e.apply(this,h);if(saveWebGLVar(_,f,this),"tagName"in this.canvas&&!isBlocked(this.canvas,s,a,!0)){const e=serializeArgs(h,f,this),s={type:r,property:S,args:e};i(this.canvas,s)}return _}}));_.push(h)}catch(b){const s=hookSetter(e,S,{set(e){i(this.canvas,{type:r,property:S,args:[e],setter:!0})}});_.push(s)}return _}var hr=function createInlineWorkerFactory(e,r){var i;return function WorkerFactory2(r){return i=i||function createURL(e,r){var i=function funcToSource(e){var r=e.toString().split("\n");r.pop(),r.shift();for(var i=r[0].search(/\S/),s=/(['"])__worker_loader_strict__(['"])/g,a=0,h=r.length;a<h;++a)r[a]=r[a].substring(i).replace(s,"$1use strict$2")+"\n";return r}(e),s=new Blob(i,{type:"application/javascript"});return URL.createObjectURL(s)}(e),new Worker(i,r)}}((function(){!function(){
16
16
  /*! *****************************************************************************
17
17
  Copyright (c) Microsoft Corporation.
18
18
 
@@ -27,5 +27,5 @@ PERFORMANCE OF THIS SOFTWARE.
27
27
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
28
28
  PERFORMANCE OF THIS SOFTWARE.
29
29
  ***************************************************************************** */
30
- function __awaiter2(e,i,o,s){return new(o||(o=Promise))((function(i,a){function fulfilled(e){try{step(s.next(e))}catch(i){a(i)}}function rejected(e){try{step(s.throw(e))}catch(i){a(i)}}function step(e){e.done?i(e.value):function adopt(e){return e instanceof o?e:new o((function(i){i(e)}))}(e.value).then(fulfilled,rejected)}step((s=s.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i="undefined"==typeof Uint8Array?[]:new Uint8Array(256),o=0;o<64;o++)i[e.charCodeAt(o)]=o;var encode2=function(i){var o,s=new Uint8Array(i),a=s.length,h="";for(o=0;o<a;o+=3)h+=e[s[o]>>2],h+=e[(3&s[o])<<4|s[o+1]>>4],h+=e[(15&s[o+1])<<2|s[o+2]>>6],h+=e[63&s[o+2]];return a%3==2?h=h.substring(0,h.length-1)+"=":a%3==1&&(h=h.substring(0,h.length-2)+"=="),h};const s=new Map,a=new Map;const h=self;h.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return h.postMessage({id:e.data.id});{const{id:i,bitmap:o,width:f,height:g,dataURLOptions:_}=e.data,v=function getTransparentBlobFor(e,i,o){return __awaiter2(this,0,void 0,(function*(){const s=`${e}-${i}`;if("OffscreenCanvas"in globalThis){if(a.has(s))return a.get(s);const h=new OffscreenCanvas(e,i);h.getContext("2d");const f=yield h.convertToBlob(o),g=yield f.arrayBuffer(),_=encode2(g);return a.set(s,_),_}return""}))}(f,g,_),b=new OffscreenCanvas(f,g);b.getContext("2d").drawImage(o,0,0),o.close();const S=yield b.convertToBlob(_),I=S.type,x=yield S.arrayBuffer(),T=encode2(x);if(!s.has(i)&&(yield v)===T)return s.set(i,T),h.postMessage({id:i});if(s.get(i)===T)return h.postMessage({id:i});h.postMessage({id:i,type:I,base64:T,width:f,height:g}),s.set(i,T)}}))}}()}));class CanvasManager{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,i)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(i)};const{sampling:i="all",win:o,blockClass:s,blockSelector:a,recordCanvas:h,dataURLOptions:f}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,h&&"all"===i&&this.initCanvasMutationObserver(o,s,a),h&&"number"==typeof i&&this.initCanvasFPSObserver(i,o,s,a,{dataURLOptions:f})}initCanvasFPSObserver(e,i,o,s,a){const h=initCanvasContextObserver(i,o,s,!0),f=new Map,g=new hr;g.onmessage=e=>{const{id:i}=e.data;if(f.set(i,!1),!("base64"in e.data))return;const{base64:o,type:s,width:a,height:h}=e.data;this.mutationCb({id:i,type:ir["2D"],commands:[{property:"clearRect",args:[0,0,a,h]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:o}],type:s}]},0,0]}]})};const _=1e3/e;let v,b=0;const takeCanvasSnapshots=e=>{b&&e-b<_||(b=e,(()=>{const e=[];return i.document.querySelectorAll("canvas").forEach((i=>{isBlocked(i,o,s,!0)||e.push(i)})),e})().forEach((e=>__awaiter(this,0,void 0,(function*(){var i;const o=this.mirror.getId(e);if(f.get(o))return;if(0===e.width||0===e.height)return;if(f.set(o,!0),["webgl","webgl2"].includes(e.__context)){const o=e.getContext(e.__context);!1===(null===(i=null==o?void 0:o.getContextAttributes())||void 0===i?void 0:i.preserveDrawingBuffer)&&o.clear(o.COLOR_BUFFER_BIT)}const s=yield createImageBitmap(e);g.postMessage({id:o,bitmap:s,width:e.width,height:e.height,dataURLOptions:a.dataURLOptions},[s])}))))),v=requestAnimationFrame(takeCanvasSnapshots)};v=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{h(),cancelAnimationFrame(v)}}initCanvasMutationObserver(e,i,o){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=initCanvasContextObserver(e,i,o,!1),a=function initCanvas2DMutationObserver(e,i,o,s){const a=[],h=Object.getOwnPropertyNames(i.CanvasRenderingContext2D.prototype);for(const g of h)try{if("function"!=typeof i.CanvasRenderingContext2D.prototype[g])continue;const h=patch(i.CanvasRenderingContext2D.prototype,g,(function(a){return function(...h){return isBlocked(this.canvas,o,s,!0)||setTimeout((()=>{const o=serializeArgs(h,i,this);e(this.canvas,{type:ir["2D"],property:g,args:o})}),0),a.apply(this,h)}}));a.push(h)}catch(f){const o=hookSetter(i.CanvasRenderingContext2D.prototype,g,{set(i){e(this.canvas,{type:ir["2D"],property:g,args:[i],setter:!0})}});a.push(o)}return()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,i,o),h=function initCanvasWebGLMutationObserver(e,i,o,s,a){const h=[];return h.push(...patchGLPrototype(i.WebGLRenderingContext.prototype,ir.WebGL,e,o,s,0,i)),void 0!==i.WebGL2RenderingContext&&h.push(...patchGLPrototype(i.WebGL2RenderingContext.prototype,ir.WebGL2,e,o,s,0,i)),()=>{h.forEach((e=>e()))}}(this.processMutation.bind(this),e,i,o,this.mirror);this.resetObservers=()=>{s(),a(),h()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=e=>{this.rafStamps.latestId=e,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,i)=>{const o=this.mirror.getId(i);this.flushPendingCanvasMutationFor(i,o)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,i){if(this.frozen||this.locked)return;const o=this.pendingCanvasMutations.get(e);if(!o||-1===i)return;const s=o.map((e=>{const i=function __rest(e,i){var o={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&i.indexOf(s)<0&&(o[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(s=Object.getOwnPropertySymbols(e);a<s.length;a++)i.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(o[s[a]]=e[s[a]])}return o}(e,["type"]);return i})),{type:a}=o[0];this.mutationCb({id:i,type:a,commands:s}),this.pendingCanvasMutations.delete(e)}}class StylesheetManager{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new StyleSheetMirror,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,i){if(0===e.length)return;const o={id:i,styleIds:[]},s=[];for(const a of e){let e;this.styleMirror.has(a)?e=this.styleMirror.getId(a):(e=this.styleMirror.add(a),s.push({styleId:e,rules:Array.from(a.rules||CSSRule,((e,i)=>({rule:stringifyRule(e),index:i})))})),o.styleIds.push(e)}s.length>0&&(o.styles=s),this.adoptedStyleSheetCb(o)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class ProcessedNodeManager{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,i){const o=this.nodeMap.get(e);return o&&Array.from(o).some((e=>e!==i))}add(e,i){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(i))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(e){return Object.assign(Object.assign({},e),{timestamp:Qt()})}let fr,mr,gr,_r=!1;const yr=function createMirror(){return new Mirror}();function record(e={}){const{emit:i,checkoutEveryNms:o,checkoutEveryNth:s,blockClass:a="rr-block",blockSelector:h=null,ignoreClass:f="rr-ignore",ignoreSelector:g=null,maskTextClass:_="rr-mask",maskTextSelector:v=null,inlineStylesheet:b=!0,maskAllInputs:S,maskInputOptions:I,slimDOMOptions:x,maskInputFn:T,maskTextFn:O,hooks:R,packFn:N,sampling:P={},dataURLOptions:D={},mousemoveWait:Z,recordDOM:A=!0,recordCanvas:L=!1,recordCrossOriginIframes:j=!1,recordAfter:q=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:U=!1,collectFonts:B=!1,inlineImages:z=!1,plugins:W,keepIframeSrcFn:K=()=>!1,ignoreCSSAttributes:H=new Set([]),errorHandler:G}=e;!function registerErrorHandler(e){or=e}(G);const J=!j||window.parent===window;let Y=!1;if(!J)try{window.parent.document&&(Y=!1)}catch(se){Y=!0}if(J&&!i)throw new Error("emit function is required");void 0!==Z&&void 0===P.mousemove&&(P.mousemove=Z),yr.reset();const X=!0===S?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==I?I:{password:!0},Q=!0===x||"all"===x?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===x,headMetaDescKeywords:"all"===x}:x||{};let ee;!function polyfill(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let i=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===i)return!0}while(i=i&&i.parentNode);return!1})}();let te=0;const eventProcessor=e=>{for(const i of W||[])i.eventProcessor&&(e=i.eventProcessor(e));return N&&!Y&&(e=N(e)),e};fr=(e,a)=>{var h;if(!(null===(h=sr[0])||void 0===h?void 0:h.isFrozen())||e.type===er.FullSnapshot||e.type===er.IncrementalSnapshot&&e.data.source===tr.Mutation||sr.forEach((e=>e.unfreeze())),J)null==i||i(eventProcessor(e),a);else if(Y){const i={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:a};window.parent.postMessage(i,"*")}if(e.type===er.FullSnapshot)ee=e,te=0;else if(e.type===er.IncrementalSnapshot){if(e.data.source===tr.Mutation&&e.data.isAttachIframe)return;te++;const i=s&&te>=s,a=o&&e.timestamp-ee.timestamp>o;(i||a)&&mr(!0)}};const wrappedMutationEmit=e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Mutation},e)}))},wrappedScrollEmit=e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Scroll},e)})),wrappedCanvasMutationEmit=e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.CanvasMutation},e)})),re=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.AdoptedStyleSheet},e)}))}),ne=new IframeManager({mirror:yr,mutationCb:wrappedMutationEmit,stylesheetManager:re,recordCrossOriginIframes:j,wrappedEmit:fr});for(const ae of W||[])ae.getMirror&&ae.getMirror({nodeMirror:yr,crossOriginIframeMirror:ne.crossOriginIframeMirror,crossOriginIframeStyleMirror:ne.crossOriginIframeStyleMirror});const ie=new ProcessedNodeManager;gr=new CanvasManager({recordCanvas:L,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:a,blockSelector:h,mirror:yr,sampling:P.canvas,dataURLOptions:D});const oe=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:a,blockSelector:h,maskTextClass:_,maskTextSelector:v,inlineStylesheet:b,maskInputOptions:X,dataURLOptions:D,maskTextFn:O,maskInputFn:T,recordCanvas:L,inlineImages:z,sampling:P,slimDOMOptions:Q,iframeManager:ne,stylesheetManager:re,canvasManager:gr,keepIframeSrcFn:K,processedNodeManager:ie},mirror:yr});mr=(e=!1)=>{if(!A)return;fr(wrapEvent({type:er.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),re.reset(),oe.init(),sr.forEach((e=>e.lock()));const i=function snapshot(e,i){const{mirror:o=new Mirror,blockClass:s="rr-block",blockSelector:a=null,maskTextClass:h="rr-mask",maskTextSelector:f=null,inlineStylesheet:g=!0,inlineImages:_=!1,recordCanvas:v=!1,maskAllInputs:b=!1,maskTextFn:S,maskInputFn:I,slimDOM:x=!1,dataURLOptions:T,preserveWhiteSpace:O,onSerialize:R,onIframeLoad:N,iframeLoadTimeout:P,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:A=()=>!1}=i||{};return serializeNodeWithId(e,{doc:e,mirror:o,blockClass:s,blockSelector:a,maskTextClass:h,maskTextSelector:f,skipChild:!1,inlineStylesheet:g,maskInputOptions:!0===b?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===b?{password:!0}:b,maskTextFn:S,maskInputFn:I,slimDOMOptions:!0===x||"all"===x?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===x,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===x?{}:x,dataURLOptions:T,inlineImages:_,recordCanvas:v,preserveWhiteSpace:O,onSerialize:R,onIframeLoad:N,iframeLoadTimeout:P,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:A,newlyAddedElement:!1})}(document,{mirror:yr,blockClass:a,blockSelector:h,maskTextClass:_,maskTextSelector:v,inlineStylesheet:b,maskAllInputs:X,maskTextFn:O,slimDOM:Q,dataURLOptions:D,recordCanvas:L,inlineImages:z,onSerialize:e=>{isSerializedIframe(e,yr)&&ne.addIframe(e),isSerializedStylesheet(e,yr)&&re.trackLinkElement(e),hasShadowRoot(e)&&oe.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,i)=>{ne.attachIframe(e,i),oe.observeAttachShadow(e)},onStylesheetLoad:(e,i)=>{re.attachLinkElement(e,i)},keepIframeSrcFn:K});if(!i)return console.warn("Failed to snapshot the document");fr(wrapEvent({type:er.FullSnapshot,data:{node:i,initialOffset:getWindowScroll(window)}}),e),sr.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&re.adoptStyleSheets(document.adoptedStyleSheets,yr.getId(document))};try{const e=[],observe=e=>{var i;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,i)=>fr(wrapEvent({type:er.IncrementalSnapshot,data:{source:i,positions:e}})),mouseInteractionCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.ViewportResize},e)})),inputCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Input},e)})),mediaInteractionCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.MediaInteraction},e)})),styleSheetRuleCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.StyleSheetRule},e)})),styleDeclarationCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Font},e)})),selectionCb:e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Selection},e)}))},customElementCb:e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.CustomElement},e)}))},blockClass:a,ignoreClass:f,ignoreSelector:g,maskTextClass:_,maskTextSelector:v,maskInputOptions:X,inlineStylesheet:b,sampling:P,recordDOM:A,recordCanvas:L,inlineImages:z,userTriggeredOnInput:U,collectFonts:B,doc:e,maskInputFn:T,maskTextFn:O,keepIframeSrcFn:K,blockSelector:h,slimDOMOptions:Q,dataURLOptions:D,mirror:yr,iframeManager:ne,stylesheetManager:re,shadowDomManager:oe,processedNodeManager:ie,canvasManager:gr,ignoreCSSAttributes:H,plugins:(null===(i=null==W?void 0:W.filter((e=>e.observer)))||void 0===i?void 0:i.map((e=>({observer:e.observer,options:e.options,callback:i=>fr(wrapEvent({type:er.Plugin,data:{plugin:e.name,payload:i}}))}))))||[]},R)};ne.addLoadListener((i=>{try{e.push(observe(i.contentDocument))}catch(Or){console.warn(Or)}}));const init2=()=>{mr(),e.push(observe(document)),_r=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{fr(wrapEvent({type:er.DomContentLoaded,data:{}})),"DOMContentLoaded"===q&&init2()}))),e.push(on("load",(()=>{fr(wrapEvent({type:er.Load,data:{}})),"load"===q&&init2()}),window))),()=>{e.forEach((e=>e())),ie.destroy(),_r=!1,function unregisterErrorHandler(){or=void 0}()}}catch(Or){console.warn(Or)}}record.addCustomEvent=(e,i)=>{if(!_r)throw new Error("please add custom event after start recording");fr(wrapEvent({type:er.Custom,data:{tag:e,payload:i}}))},record.freezePage=()=>{sr.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!_r)throw new Error("please take full snapshot after start recording");mr(e)},record.mirror=yr;var vr,br=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(br||{}),Sr=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Sr||{}),kr={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var wr={hostname:""};vr={navigator:{userAgent:"",onLine:!0},document:{location:wr,referrer:""},screen:{width:0,height:0},location:wr}}else vr=window;var Ir,xr,Cr,Er,Tr,Or,Rr,Mr,Nr,Pr,Dr=864e5,Zr=8e3,Ar=Array.prototype,Lr=Function.prototype,jr=Object.prototype,Fr=Ar.slice,$r=jr.toString,qr=jr.hasOwnProperty,Ur=vr.console,Br=vr.navigator,zr=vr.document,Vr=vr.opera,Wr=vr.screen,Kr=Br.userAgent,Hr=Lr.bind,Gr=Ar.forEach,Jr=Ar.indexOf,Yr=Ar.map,Xr=Array.isArray,Qr={},en={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},tn={log:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur)try{Ur.log.apply(Ur,arguments)}catch(e){en.each(arguments,(function(e){Ur.log(e)}))}},warn:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur){var e=["Mixpanel warning:"].concat(en.toArray(arguments));try{Ur.warn.apply(Ur,e)}catch(i){en.each(e,(function(e){Ur.warn(e)}))}}},error:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur){var e=["Mixpanel error:"].concat(en.toArray(arguments));try{Ur.error.apply(Ur,e)}catch(i){en.each(e,(function(e){Ur.error(e)}))}}},critical:function(){if(!en.isUndefined(Ur)&&Ur){var e=["Mixpanel error:"].concat(en.toArray(arguments));try{Ur.error.apply(Ur,e)}catch(i){en.each(e,(function(e){Ur.error(e)}))}}}},log_func_with_prefix=function(e,i){return function(){return arguments[0]="["+i+"] "+arguments[0],e.apply(tn,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(tn.log,e),error:log_func_with_prefix(tn.error,e),critical:log_func_with_prefix(tn.critical,e)}};en.bind=function(e,i){var o,s;if(Hr&&e.bind===Hr)return Hr.apply(e,Fr.call(arguments,1));if(!en.isFunction(e))throw new TypeError;return o=Fr.call(arguments,2),s=function(){if(!(this instanceof s))return e.apply(i,o.concat(Fr.call(arguments)));var a={};a.prototype=e.prototype;var h=new a;a.prototype=null;var f=e.apply(h,o.concat(Fr.call(arguments)));return Object(f)===f?f:h},s},en.each=function(e,i,o){if(null!=e)if(Gr&&e.forEach===Gr)e.forEach(i,o);else if(e.length===+e.length){for(var s=0,a=e.length;s<a;s++)if(s in e&&i.call(o,e[s],s,e)===Qr)return}else for(var h in e)if(qr.call(e,h)&&i.call(o,e[h],h,e)===Qr)return},en.extend=function(e){return en.each(Fr.call(arguments,1),(function(i){for(var o in i)void 0!==i[o]&&(e[o]=i[o])})),e},en.isArray=Xr||function(e){return"[object Array]"===$r.call(e)},en.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(i){return!1}},en.isArguments=function(e){return!(!e||!qr.call(e,"callee"))},en.toArray=function(e){return e?e.toArray?e.toArray():en.isArray(e)||en.isArguments(e)?Fr.call(e):en.values(e):[]},en.map=function(e,i,o){if(Yr&&e.map===Yr)return e.map(i,o);var s=[];return en.each(e,(function(e){s.push(i.call(o,e))})),s},en.keys=function(e){var i=[];return null===e||en.each(e,(function(e,o){i[i.length]=o})),i},en.values=function(e){var i=[];return null===e||en.each(e,(function(e){i[i.length]=e})),i},en.include=function(e,i){var o=!1;return null===e?o:Jr&&e.indexOf===Jr?-1!=e.indexOf(i):(en.each(e,(function(e){if(o||(o=e===i))return Qr})),o)},en.includes=function(e,i){return-1!==e.indexOf(i)},en.inherit=function(e,i){return e.prototype=new i,e.prototype.constructor=e,e.superclass=i.prototype,e},en.isObject=function(e){return e===Object(e)&&!en.isArray(e)},en.isEmptyObject=function(e){if(en.isObject(e)){for(var i in e)if(qr.call(e,i))return!1;return!0}return!1},en.isUndefined=function(e){return void 0===e},en.isString=function(e){return"[object String]"==$r.call(e)},en.isDate=function(e){return"[object Date]"==$r.call(e)},en.isNumber=function(e){return"[object Number]"==$r.call(e)},en.isElement=function(e){return!(!e||1!==e.nodeType)},en.encodeDates=function(e){return en.each(e,(function(i,o){en.isDate(i)?e[o]=en.formatDate(i):en.isObject(i)&&(e[o]=en.encodeDates(i))})),e},en.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},en.formatDate=function(e){function pad(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+pad(e.getUTCMonth()+1)+"-"+pad(e.getUTCDate())+"T"+pad(e.getUTCHours())+":"+pad(e.getUTCMinutes())+":"+pad(e.getUTCSeconds())},en.strip_empty_properties=function(e){var i={};return en.each(e,(function(e,o){en.isString(e)&&e.length>0&&(i[o]=e)})),i},en.truncate=function(e,i){var o;return"string"==typeof e?o=e.slice(0,i):en.isArray(e)?(o=[],en.each(e,(function(e){o.push(en.truncate(e,i))}))):en.isObject(e)?(o={},en.each(e,(function(e,s){o[s]=en.truncate(e,i)}))):o=e,o},en.JSONEncode=function(){return function(e){var quote=function(e){var i=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return i.lastIndex=0,i.test(e)?'"'+e.replace(i,(function(e){var i=o[e];return"string"==typeof i?i:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,i){var o="",s=0,a="",h="",f=0,g=o,_=[],v=i[e];switch(v&&"object"==typeof v&&"function"==typeof v.toJSON&&(v=v.toJSON(e)),typeof v){case"string":return quote(v);case"number":return isFinite(v)?String(v):"null";case"boolean":case"null":return String(v);case"object":if(!v)return"null";if(o+=" ",_=[],"[object Array]"===$r.apply(v)){for(f=v.length,s=0;s<f;s+=1)_[s]=str(s,v)||"null";return h=0===_.length?"[]":o?"[\n"+o+_.join(",\n"+o)+"\n"+g+"]":"["+_.join(",")+"]",o=g,h}for(a in v)qr.call(v,a)&&(h=str(a,v))&&_.push(quote(a)+(o?": ":":")+h);return h=0===_.length?"{}":o?"{"+_.join(",")+g+"}":"{"+_.join(",")+"}",o=g,h}};return str("",{"":e})}}(),en.JSONDecode=(Tr={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Or=function(e){var i=new SyntaxError(e);throw i.at=Ir,i.text=Cr,i},Rr=function(e){return e&&e!==xr&&Or("Expected '"+e+"' instead of '"+xr+"'"),xr=Cr.charAt(Ir),Ir+=1,xr},Mr=function(){var e,i="";for("-"===xr&&(i="-",Rr("-"));xr>="0"&&xr<="9";)i+=xr,Rr();if("."===xr)for(i+=".";Rr()&&xr>="0"&&xr<="9";)i+=xr;if("e"===xr||"E"===xr)for(i+=xr,Rr(),"-"!==xr&&"+"!==xr||(i+=xr,Rr());xr>="0"&&xr<="9";)i+=xr,Rr();if(e=+i,isFinite(e))return e;Or("Bad number")},Nr=function(){var e,i,o,s="";if('"'===xr)for(;Rr();){if('"'===xr)return Rr(),s;if("\\"===xr)if(Rr(),"u"===xr){for(o=0,i=0;i<4&&(e=parseInt(Rr(),16),isFinite(e));i+=1)o=16*o+e;s+=String.fromCharCode(o)}else{if("string"!=typeof Tr[xr])break;s+=Tr[xr]}else s+=xr}Or("Bad string")},Pr=function(){for(;xr&&xr<=" ";)Rr()},Er=function(){switch(Pr(),xr){case"{":return function(){var e,i={};if("{"===xr){if(Rr("{"),Pr(),"}"===xr)return Rr("}"),i;for(;xr;){if(e=Nr(),Pr(),Rr(":"),Object.hasOwnProperty.call(i,e)&&Or('Duplicate key "'+e+'"'),i[e]=Er(),Pr(),"}"===xr)return Rr("}"),i;Rr(","),Pr()}}Or("Bad object")}();case"[":return function(){var e=[];if("["===xr){if(Rr("["),Pr(),"]"===xr)return Rr("]"),e;for(;xr;){if(e.push(Er()),Pr(),"]"===xr)return Rr("]"),e;Rr(","),Pr()}}Or("Bad array")}();case'"':return Nr();case"-":return Mr();default:return xr>="0"&&xr<="9"?Mr():function(){switch(xr){case"t":return Rr("t"),Rr("r"),Rr("u"),Rr("e"),!0;case"f":return Rr("f"),Rr("a"),Rr("l"),Rr("s"),Rr("e"),!1;case"n":return Rr("n"),Rr("u"),Rr("l"),Rr("l"),null}Or('Unexpected "'+xr+'"')}()}},function(e){var i;return Cr=e,Ir=0,xr=" ",i=Er(),Pr(),xr&&Or("Syntax error"),i}),en.base64Encode=function(e){var i,o,s,a,h,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",g=0,_=0,v="",b=[];if(!e)return e;e=en.utf8Encode(e);do{i=(h=e.charCodeAt(g++)<<16|e.charCodeAt(g++)<<8|e.charCodeAt(g++))>>18&63,o=h>>12&63,s=h>>6&63,a=63&h,b[_++]=f.charAt(i)+f.charAt(o)+f.charAt(s)+f.charAt(a)}while(g<e.length);switch(v=b.join(""),e.length%3){case 1:v=v.slice(0,-2)+"==";break;case 2:v=v.slice(0,-1)+"="}return v},en.utf8Encode=function(e){var i,o,s,a,h="";for(i=o=0,s=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,a=0;a<s;a++){var f=e.charCodeAt(a),g=null;f<128?o++:g=f>127&&f<2048?String.fromCharCode(f>>6|192,63&f|128):String.fromCharCode(f>>12|224,f>>6&63|128,63&f|128),null!==g&&(o>i&&(h+=e.substring(i,o)),h+=g,i=o=a+1)}return o>i&&(h+=e.substring(i,e.length)),h},en.UUID=function(){var T2=function(){var e,i=1*new Date;if(vr.performance&&vr.performance.now)e=vr.performance.now();else for(e=0;i==1*new Date;)e++;return i.toString(16)+Math.floor(e).toString(16)};return function(){var e=(Wr.height*Wr.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,i,o=Kr,s=[],a=0;function xor(e,i){var o,a=0;for(o=0;o<i.length;o++)a|=s[o]<<8*o;return e^a}for(e=0;e<o.length;e++)i=o.charCodeAt(e),s.unshift(255&i),s.length>=4&&(a=xor(a,s),s=[]);return s.length>0&&(a=xor(a,s)),a.toString(16)}()+"-"+e+"-"+T2()}}();var rn=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];en.isBlockedUA=function(e){var i;for(e=e.toLowerCase(),i=0;i<rn.length;i++)if(-1!==e.indexOf(rn[i]))return!0;return!1},en.HTTPBuildQuery=function(e,i){var o,s,a=[];return en.isUndefined(i)&&(i="&"),en.each(e,(function(e,i){o=encodeURIComponent(e.toString()),s=encodeURIComponent(i),a[a.length]=s+"="+o})),a.join(i)},en.getQueryParam=function(e,i){i=i.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var o=new RegExp("[\\?&]"+i+"=([^&#]*)").exec(e);if(null===o||o&&"string"!=typeof o[1]&&o[1].length)return"";var s=o[1];try{s=decodeURIComponent(s)}catch(a){tn.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},en.cookie={get:function(e){for(var i=e+"=",o=zr.cookie.split(";"),s=0;s<o.length;s++){for(var a=o[s];" "==a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(i))return decodeURIComponent(a.substring(i.length,a.length))}return null},parse:function(e){var i;try{i=en.JSONDecode(en.cookie.get(e))||{}}catch(o){}return i},set_seconds:function(e,i,o,s,a,h,f){var g="",_="",v="";if(f)g="; domain="+f;else if(s){var b=extract_domain(zr.location.hostname);g=b?"; domain=."+b:""}if(o){var S=new Date;S.setTime(S.getTime()+1e3*o),_="; expires="+S.toGMTString()}h&&(a=!0,v="; SameSite=None"),a&&(v+="; secure"),zr.cookie=e+"="+encodeURIComponent(i)+_+"; path=/"+g+v},set:function(e,i,o,s,a,h,f){var g="",_="",v="";if(f)g="; domain="+f;else if(s){var b=extract_domain(zr.location.hostname);g=b?"; domain=."+b:""}if(o){var S=new Date;S.setTime(S.getTime()+24*o*60*60*1e3),_="; expires="+S.toGMTString()}h&&(a=!0,v="; SameSite=None"),a&&(v+="; secure");var I=e+"="+encodeURIComponent(i)+_+"; path=/"+g+v;return zr.cookie=I,I},remove:function(e,i,o){en.cookie.set(e,"",-1,i,!1,!1,o)}};var nn=null,localStorageSupported=function(e,i){if(null!==nn&&!i)return nn;var o=!0;try{e=e||window.localStorage;var s="__mplss_"+cheap_guid(8);e.setItem(s,"xyz"),"xyz"!==e.getItem(s)&&(o=!1),e.removeItem(s)}catch(a){o=!1}return nn=o,o};en.localStorage={is_supported:function(e){var i=localStorageSupported(null,e);return i||tn.error("localStorage unsupported; falling back to cookie store"),i},error:function(e){tn.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(i){en.localStorage.error(i)}return null},parse:function(e){try{return en.JSONDecode(en.localStorage.get(e))||{}}catch(i){}return null},set:function(e,i){try{window.localStorage.setItem(e,i)}catch(o){en.localStorage.error(o)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(i){en.localStorage.error(i)}}},en.register_event=function(){function fixEvent(e){return e&&(e.preventDefault=fixEvent.preventDefault,e.stopPropagation=fixEvent.stopPropagation),e}return fixEvent.preventDefault=function(){this.returnValue=!1},fixEvent.stopPropagation=function(){this.cancelBubble=!0},function(e,i,o,s,a){if(e)if(e.addEventListener&&!s)e.addEventListener(i,o,!!a);else{var h="on"+i,f=e[h];e[h]=function makeHandler(e,i,o){var handler=function(s){if(s=s||fixEvent(window.event)){var a,h,f=!0;return en.isFunction(o)&&(a=o(s)),h=i.call(e,s),!1!==a&&!1!==h||(f=!1),f}};return handler}(e,o,f)}else tn.error("No valid element provided to register_event")}}();var sn=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');en.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(i,o){var s=" "+o+" ";return(" "+i.className+" ").replace(e," ").indexOf(s)>=0}function getElementsBySelector(e){if(!zr.getElementsByTagName)return[];var i,o,s,a,h,f,g,_,v,b,S=e.split(" "),I=[zr];for(f=0;f<S.length;f++)if((i=S[f].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){s=(o=i.split("#"))[0];var x=o[1],T=zr.getElementById(x);if(!T||s&&T.nodeName.toLowerCase()!=s)return[];I=[T]}else if(i.indexOf(".")>-1){s=(o=i.split("."))[0];var O=o[1];for(s||(s="*"),a=[],h=0,g=0;g<I.length;g++)for(v="*"==s?getAllChildren(I[g]):I[g].getElementsByTagName(s),_=0;_<v.length;_++)a[h++]=v[_];for(I=[],b=0,g=0;g<a.length;g++)a[g].className&&en.isString(a[g].className)&&hasClass(a[g],O)&&(I[b++]=a[g])}else{var R=i.match(sn);if(R){s=R[1];var N,P=R[2],D=R[3],Z=R[4];for(s||(s="*"),a=[],h=0,g=0;g<I.length;g++)for(v="*"==s?getAllChildren(I[g]):I[g].getElementsByTagName(s),_=0;_<v.length;_++)a[h++]=v[_];switch(I=[],b=0,D){case"=":N=function(e){return e.getAttribute(P)==Z};break;case"~":N=function(e){return e.getAttribute(P).match(new RegExp("\\b"+Z+"\\b"))};break;case"|":N=function(e){return e.getAttribute(P).match(new RegExp("^"+Z+"-?"))};break;case"^":N=function(e){return 0===e.getAttribute(P).indexOf(Z)};break;case"$":N=function(e){return e.getAttribute(P).lastIndexOf(Z)==e.getAttribute(P).length-Z.length};break;case"*":N=function(e){return e.getAttribute(P).indexOf(Z)>-1};break;default:N=function(e){return e.getAttribute(P)}}for(I=[],b=0,g=0;g<a.length;g++)N(a[g])&&(I[b++]=a[g])}else{for(s=i,a=[],h=0,g=0;g<I.length;g++)for(v=I[g].getElementsByTagName(s),_=0;_<v.length;_++)a[h++]=v[_];I=a}}return I}return function(e){return en.isElement(e)?[e]:en.isObject(e)&&!en.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var an=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],cn=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];en.info={campaignParams:function(e){var i="",o={};return en.each(an,(function(s){(i=en.getQueryParam(zr.URL,s)).length?o[s]=i:void 0!==e&&(o[s]=e)})),o},clickParams:function(){var e="",i={};return en.each(cn,(function(o){(e=en.getQueryParam(zr.URL,o)).length&&(i[o]=e)})),i},marketingParams:function(){return en.extend(en.info.campaignParams(),en.info.clickParams())},searchEngine:function(e){return 0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},searchInfo:function(e){var i=en.info.searchEngine(e),o="yahoo"!=i?"q":"p",s={};if(null!==i){s.$search_engine=i;var a=en.getQueryParam(e,o);a.length&&(s.mp_keyword=a)}return s},browser:function(e,i,o){return i=i||"",o||en.includes(e," OPR/")?en.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":en.includes(e,"IEMobile")||en.includes(e,"WPDesktop")?"Internet Explorer Mobile":en.includes(e,"SamsungBrowser/")?"Samsung Internet":en.includes(e,"Edge")||en.includes(e,"Edg/")?"Microsoft Edge":en.includes(e,"FBIOS")?"Facebook Mobile":en.includes(e,"Chrome")?"Chrome":en.includes(e,"CriOS")?"Chrome iOS":en.includes(e,"UCWEB")||en.includes(e,"UCBrowser")?"UC Browser":en.includes(e,"FxiOS")?"Firefox iOS":en.includes(i,"Apple")?en.includes(e,"Mobile")?"Mobile Safari":"Safari":en.includes(e,"Android")?"Android Mobile":en.includes(e,"Konqueror")?"Konqueror":en.includes(e,"Firefox")?"Firefox":en.includes(e,"MSIE")||en.includes(e,"Trident/")?"Internet Explorer":en.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,i,o){var s={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/}[en.info.browser(e,i,o)];if(void 0===s)return null;var a=e.match(s);return a?parseFloat(a[a.length-2]):null},os:function(){var e=Kr;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var i=e.split("/");return i.length>=3?i[2]:""},currentUrl:function(){return vr.location.href},properties:function(e){return"object"!=typeof e&&(e={}),en.extend(en.strip_empty_properties({$os:en.info.os(),$browser:en.info.browser(Kr,Br.vendor,Vr),$referrer:zr.referrer,$referring_domain:en.info.referringDomain(zr.referrer),$device:en.info.device(Kr)}),{$current_url:en.info.currentUrl(),$browser_version:en.info.browserVersion(Kr,Br.vendor,Vr),$screen_height:Wr.height,$screen_width:Wr.width,mp_lib:"web",$lib_version:kr.LIB_VERSION,$insert_id:cheap_guid(),time:en.timestamp()/1e3},en.strip_empty_properties(e))},people_properties:function(){return en.extend(en.strip_empty_properties({$os:en.info.os(),$browser:en.info.browser(Kr,Br.vendor,Vr)}),{$browser_version:en.info.browserVersion(Kr,Br.vendor,Vr)})},mpPageViewProperties:function(){return en.strip_empty_properties({current_page_title:zr.title,current_domain:vr.location.hostname,current_url_path:vr.location.pathname,current_url_protocol:vr.location.protocol,current_url_search:vr.location.search})}};var cheap_guid=function(e){var i=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?i.substring(0,e):i},dn=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,un=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var i=un,o=e.split("."),s=o[o.length-1];(s.length>4||"com"===s||"org"===s)&&(i=dn);var a=e.match(i);return a?a[0]:""},ln=null,pn=null;"undefined"!=typeof JSON&&(ln=JSON.stringify,pn=JSON.parse),ln=ln||en.JSONEncode,pn=pn||en.JSONDecode,en.toArray=en.toArray,en.isObject=en.isObject,en.JSONEncode=en.JSONEncode,en.JSONDecode=en.JSONDecode,en.isBlockedUA=en.isBlockedUA,en.isEmptyObject=en.isEmptyObject,en.info=en.info,en.info.device=en.info.device,en.info.browser=en.info.browser,en.info.browserVersion=en.info.browserVersion,en.info.properties=en.info.properties;var hn="__mp_opt_in_out_";function optIn(e,i){_optInOut(!0,e,i)}function optOut(e,i){_optInOut(!1,e,i)}function hasOptedIn(e,i){return"1"===_getStorageValue(e,i)}function hasOptedOut(e,i){if(function _hasDoNotTrackFlagOn(e){if(e&&e.ignoreDnt)return!1;var i=e&&e.window||vr,o=i.navigator||{},s=!1;return en.each([o.doNotTrack,o.msDoNotTrack,i.doNotTrack],(function(e){en.includes([!0,1,"1","yes"],e)&&(s=!0)})),s}(i))return tn.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var o="0"===_getStorageValue(e,i);return o&&tn.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),o}function addOptOutCheckMixpanelLib(e){return _addOptOutCheck(e,(function(e){return this.get_config(e)}))}function addOptOutCheckMixpanelPeople(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function addOptOutCheckMixpanelGroup(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function clearOptInOut(e,i){_getStorage(i=i||{}).remove(_getStorageKey(e,i),!!i.crossSubdomainCookie,i.cookieDomain)}function _getStorage(e){return"localStorage"===(e=e||{}).persistenceType?en.localStorage:en.cookie}function _getStorageKey(e,i){return((i=i||{}).persistencePrefix||hn)+e}function _getStorageValue(e,i){return _getStorage(i).get(_getStorageKey(e,i))}function _optInOut(e,i,o){en.isString(i)&&i.length?(_getStorage(o=o||{}).set(_getStorageKey(i,o),e?1:0,en.isNumber(o.cookieExpiration)?o.cookieExpiration:null,!!o.crossSubdomainCookie,!!o.secureCookie,!!o.crossSiteCookie,o.cookieDomain),o.track&&e&&o.track(o.trackEventName||"$opt_in",o.trackProperties,{send_immediately:!0})):tn.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,i){return function(){var o=!1;try{var s=i.call(this,"token"),a=i.call(this,"ignore_dnt"),h=i.call(this,"opt_out_tracking_persistence_type"),f=i.call(this,"opt_out_tracking_cookie_prefix"),g=i.call(this,"window");s&&(o=hasOptedOut(s,{ignoreDnt:a,persistenceType:h,persistencePrefix:f,window:g}))}catch(v){tn.error("Unexpected error when checking tracking opt-out status: "+v)}if(!o)return e.apply(this,arguments);var _=arguments[arguments.length-1];"function"==typeof _&&_(0)}}var fn=console_with_prefix("lock"),SharedLock=function(e,i){i=i||{},this.storageKey=e,this.storage=i.storage||window.localStorage,this.pollIntervalMS=i.pollIntervalMS||100,this.timeoutMS=i.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,i,o){o||"function"==typeof i||(o=i,i=null);var s=o||(new Date).getTime()+"|"+Math.random(),a=(new Date).getTime(),h=this.storageKey,f=this.pollIntervalMS,g=this.timeoutMS,_=this.storage,v=h+":X",b=h+":Y",S=h+":Z",reportError=function(e){i&&i(e)},delay=function(e){if((new Date).getTime()-a>g)return fn.error("Timeout waiting for mutex on "+h+"; clearing lock. ["+s+"]"),_.removeItem(S),_.removeItem(b),void loop();setTimeout((function(){try{e()}catch(i){reportError(i)}}),f*(Math.random()+.1))},waitFor=function(e,i){e()?i():delay((function(){waitFor(e,i)}))},getSetY=function(){var e=_.getItem(b);if(e&&e!==s)return!1;if(_.setItem(b,s),_.getItem(b)===s)return!0;if(!localStorageSupported(_,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){_.setItem(v,s),waitFor(getSetY,(function(){_.getItem(v)!==s?delay((function(){_.getItem(b)===s?waitFor((function(){return!_.getItem(S)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){_.setItem(S,"1");try{e()}finally{_.removeItem(S),_.getItem(b)===s&&_.removeItem(b),_.getItem(v)===s&&_.removeItem(v)}};try{if(!localStorageSupported(_,!0))throw new Error("localStorage support check failed");loop()}catch(I){reportError(I)}};var mn=console_with_prefix("batch"),RequestQueue=function(e,i){i=i||{},this.storageKey=e,this.storage=i.storage||window.localStorage,this.reportError=i.errorReporter||en.bind(mn.error,mn),this.lock=new SharedLock(e,{storage:this.storage}),this.usePersistence=i.usePersistence,this.pid=i.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(e,i,o){var s={id:cheap_guid(),flushAfter:(new Date).getTime()+2*i,payload:e};this.usePersistence?this.lock.withLock(en.bind((function lockAcquired(){var i;try{var a=this.readFromStorage();a.push(s),(i=this.saveToStorage(a))&&this.memQueue.push(s)}catch(h){this.reportError("Error enqueueing item",e),i=!1}o&&o(i)}),this),en.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),o&&o(!1)}),this),this.pid):(this.memQueue.push(s),o&&o(!0))},RequestQueue.prototype.fillBatch=function(e){var i=this.memQueue.slice(0,e);if(this.usePersistence&&i.length<e){var o=this.readFromStorage();if(o.length){var s={};en.each(i,(function(e){s[e.id]=!0}));for(var a=0;a<o.length;a++){var h=o[a];if((new Date).getTime()>h.flushAfter&&!s[h.id]&&(h.orphaned=!0,i.push(h),i.length>=e))break}}}return i};var filterOutIDsAndInvalid=function(e,i){var o=[];return en.each(e,(function(e){e.id&&!i[e.id]&&o.push(e)})),o};RequestQueue.prototype.removeItemsByID=function(e,i){var o={};if(en.each(e,(function(e){o[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,o),this.usePersistence){var s=en.bind((function(){var i;try{var s=this.readFromStorage();if(s=filterOutIDsAndInvalid(s,o),i=this.saveToStorage(s)){s=this.readFromStorage();for(var a=0;a<s.length;a++){var h=s[a];if(h.id&&o[h.id])return this.reportError("Item not removed from storage"),!1}}}catch(f){this.reportError("Error removing items",e),i=!1}return i}),this);this.lock.withLock((function lockAcquired(){var e=s();i&&i(e)}),en.bind((function lockFailure(e){var o=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(o=s()))try{this.storage.removeItem(this.storageKey)}catch(a){this.reportError("Error clearing queue",a)}i&&i(o)}),this),this.pid)}else i&&i(!0)};var updatePayloads=function(e,i){var o=[];return en.each(e,(function(e){var s=e.id;if(s in i){var a=i[s];null!==a&&(e.payload=a,o.push(e))}else o.push(e)})),o};RequestQueue.prototype.updatePayloads=function(e,i){this.memQueue=updatePayloads(this.memQueue,e),this.usePersistence?this.lock.withLock(en.bind((function lockAcquired(){var o;try{var s=this.readFromStorage();s=updatePayloads(s,e),o=this.saveToStorage(s)}catch(a){this.reportError("Error updating items",e),o=!1}i&&i(o)}),this),en.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),i&&i(!1)}),this),this.pid):i&&i(!0)},RequestQueue.prototype.readFromStorage=function(){var e;try{(e=this.storage.getItem(this.storageKey))&&(e=pn(e),en.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null))}catch(i){this.reportError("Error retrieving queue",i),e=null}return e||[]},RequestQueue.prototype.saveToStorage=function(e){try{return this.storage.setItem(this.storageKey,ln(e)),!0}catch(i){return this.reportError("Error saving queue",i),!1}},RequestQueue.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var gn=console_with_prefix("batch"),RequestBatcher=function(e,i){this.errorReporter=i.errorReporter,this.queue=new RequestQueue(e,{errorReporter:en.bind(this.reportError,this),storage:i.storage,usePersistence:i.usePersistence}),this.libConfig=i.libConfig,this.sendRequest=i.sendRequestFunc,this.beforeSendHook=i.beforeSendHook,this.stopAllBatching=i.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=i.flushOnlyOnInterval||!1};RequestBatcher.prototype.enqueue=function(e,i){this.queue.enqueue(e,this.flushInterval,i)},RequestBatcher.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},RequestBatcher.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},RequestBatcher.prototype.clear=function(){this.queue.clear()},RequestBatcher.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},RequestBatcher.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},RequestBatcher.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(en.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void gn.log("Flush: Request already in progress");e=e||{};var i=this.libConfig.batch_request_timeout_ms,o=(new Date).getTime(),s=this.batchSize,a=this.queue.fillBatch(s),h=a.length===s,f=[],g={};if(en.each(a,(function(e){var i=e.payload;if(this.beforeSendHook&&!e.orphaned&&(i=this.beforeSendHook(i)),i){i.event&&i.properties&&(i.properties=en.extend({},i.properties,{mp_sent_by_lib_version:kr.LIB_VERSION}));var o=!0,s=e.id;s?(this.itemIdsSentSuccessfully[s]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:a.length,timesSent:this.itemIdsSentSuccessfully[s]}),o=!1):this.reportError("[dupe] found item with no ID",{item:e}),o&&f.push(i)}g[e.id]=i}),this),f.length<1)return void this.resetFlush();this.requestInProgress=!0;var _=en.bind((function(f){this.requestInProgress=!1;try{var _=!1;if(e.unloading)this.queue.updatePayloads(g);else if(en.isObject(f)&&"timeout"===f.error&&(new Date).getTime()-o>=i)this.reportError("Network timeout; retrying"),this.flush();else if(en.isObject(f)&&(f.httpStatusCode>=500||429===f.httpStatusCode||f.httpStatusCode<=0&&(S=vr.navigator.onLine,!en.isUndefined(S)&&!S)||"timeout"===f.error)){var v=2*this.flushInterval;f.retryAfter&&(v=1e3*parseInt(f.retryAfter,10)||v),v=Math.min(6e5,v),this.reportError("Error; retry in "+v+" ms"),this.scheduleFlush(v)}else if(en.isObject(f)&&413===f.httpStatusCode)if(a.length>1){var b=Math.max(1,Math.floor(s/2));this.batchSize=Math.min(this.batchSize,b,a.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",a),this.resetBatchSize(),_=!0;else _=!0;_&&(this.queue.removeItemsByID(en.map(a,(function(e){return e.id})),en.bind((function(e){e?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!h?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())}),this)),en.each(a,en.bind((function(e){var i=e.id;i?(this.itemIdsSentSuccessfully[i]=this.itemIdsSentSuccessfully[i]||0,this.itemIdsSentSuccessfully[i]++,this.itemIdsSentSuccessfully[i]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:a.length,timesSent:this.itemIdsSentSuccessfully[i]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(I){this.reportError("Error handling API response",I),this.resetFlush()}var S}),this),v={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:i};e.unloading&&(v.transport="sendBeacon"),gn.log("MIXPANEL REQUEST:",f),this.sendRequest(f,v,_)}catch(b){this.reportError("Error flushing request queue",b),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,i){if(gn.error.apply(gn.error,arguments),this.errorReporter)try{i instanceof Error||(i=new Error(e)),this.errorReporter(e,i)}catch(o){gn.error(o)}};var _n=console_with_prefix("recorder"),yn=vr.CompressionStream,vn={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},bn=new Set([Sr.MouseMove,Sr.MouseInteraction,Sr.Scroll,Sr.ViewportResize,Sr.Input,Sr.TouchMove,Sr.MediaInteraction,Sr.Drag,Sr.Selection]);var MixpanelRecorder=function(e){this._mixpanel=e,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=Dr,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:vn,sendRequestFunc:en.bind(this.flushEventsWithOptOut,this),errorReporter:en.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},MixpanelRecorder.prototype.get_config=function(e){return this._mixpanel.get_config(e)},MixpanelRecorder.prototype.startRecording=function(e){if(null===this._stopRecording){this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>Dr&&(this.recordMaxMs=Dr,_n.critical("record_max_ms cannot be greater than "+Dr+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>Zr&&(this.recordMinMs=Zr,_n.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=en.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var i=en.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(en.bind((function(){_n.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),o=this.get_config("record_block_selector");""!==o&&null!==o||(o=void 0),this._stopRecording=record({emit:en.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===br.IncrementalSnapshot&&bn.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),i())}),this),blockClass:this.get_config("record_block_class"),blockSelector:o,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),i(),this.maxTimeoutId=setTimeout(en.bind(this.resetRecording,this),this.recordMaxMs)}else _n.log("Recording already in progress, skipping startRecording.")},MixpanelRecorder.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},MixpanelRecorder.prototype.stopRecording=function(){null!==this._stopRecording&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},MixpanelRecorder.prototype.flushEventsWithOptOut=function(e,i,o){this._flushEvents(e,i,o,en.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,i,o,s){var a=en.bind((function(i,o){200===i.status&&this.replayId===e&&this.seqNo++,s({status:0,httpStatusCode:i.status,responseBody:o,retryAfter:i.headers.get("Retry-After")})}),this);vr.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(i),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:o}).then((function(e){e.json().then((function(i){a(e,i)})).catch((function(e){s({error:e})}))})).catch((function(e){s({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,i,o){const s=e.length;if(s>0){var a=this.replayId,h=e[0].timestamp;0!==this.seqNo&&this.replayStartTime||(0!==this.seqNo&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=h);var f=e[s-1].timestamp-this.replayStartTime,g={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:h/1e3,replay_id:a,replay_length_ms:f,replay_start_time:this.replayStartTime/1e3},_=en.JSONEncode(e),v=this._mixpanel.get_property("$device_id");v&&(g.$device_id=v);var b=this._mixpanel.get_property("$user_id");if(b&&(g.$user_id=b),yn){var S=new Blob([_],{type:"application/json"}).stream().pipeThrough(new yn("gzip"));new Response(S).blob().then(en.bind((function(e){g.format="gzip",this._sendRequest(a,g,e,o)}),this))}else g.format="body",this._sendRequest(a,g,_,o)}})),MixpanelRecorder.prototype.reportError=function(e,i){_n.error.apply(_n.error,arguments);try{i||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,i)}catch(o){_n.error(o)}},vr.__mp_recorder=MixpanelRecorder;var DomTracker=function(){};DomTracker.prototype.create_properties=function(){},DomTracker.prototype.event_handler=function(){},DomTracker.prototype.after_track_handler=function(){},DomTracker.prototype.init=function(e){return this.mp=e,this},DomTracker.prototype.track=function(e,i,o,s){var a=this,h=en.dom_query(e);if(0!==h.length)return en.each(h,(function(e){en.register_event(e,this.override_event,(function(e){var h={},f=a.create_properties(o,this),g=a.mp.get_config("track_links_timeout");a.event_handler(e,this,h),window.setTimeout(a.track_callback(s,f,h,!0),g),a.mp.track(i,f,a.track_callback(s,f,h))}))}),this),!0;tn.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,i,o,s){s=s||!1;var a=this;return function(){o.callback_fired||(o.callback_fired=!0,e&&!1===e(s,i)||a.after_track_handler(i,o,s))}},DomTracker.prototype.create_properties=function(e,i){return"function"==typeof e?e(i):en.extend({},e)};var LinkTracker=function(){this.override_event="click"};en.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(e,i){var o=LinkTracker.superclass.create_properties.apply(this,arguments);return i.href&&(o.url=i.href),o},LinkTracker.prototype.event_handler=function(e,i,o){o.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===i.target,o.href=i.href,o.new_tab||e.preventDefault()},LinkTracker.prototype.after_track_handler=function(e,i){i.new_tab||setTimeout((function(){window.location=i.href}),0)};var FormTracker=function(){this.override_event="submit"};en.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(e,i,o){o.element=i,e.preventDefault()},FormTracker.prototype.after_track_handler=function(e,i){setTimeout((function(){i.element.submit()}),0)};var Sn="$set",kn="$set_once",wn="$unset",In="$add",xn="$append",Cn="$union",En="$remove",Tn={set_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[Sn]=s,o},unset_action:function(e){var i={},o=[];return en.isArray(e)||(e=[e]),en.each(e,(function(e){this._is_reserved_property(e)||o.push(e)}),this),i[wn]=o,i},set_once_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[kn]=s,o},union_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=en.isArray(e)?e:[e])}),this):s[e]=en.isArray(i)?i:[i],o[Cn]=s,o},append_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[xn]=s,o},remove_action:function(e,i){var o={},s={};return en.isObject(e)?en.each(e,(function(e,i){this._is_reserved_property(i)||(s[i]=e)}),this):s[e]=i,o[En]=s,o},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};en.extend(MixpanelGroup.prototype,Tn),MixpanelGroup.prototype._init=function(e,i,o){this._mixpanel=e,this._group_key=i,this._group_id=o},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(e,i,o){var s=this.set_action(e,i);return en.isObject(e)&&(o=i),this._send_request(s,o)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,i,o){var s=this.set_once_action(e,i);return en.isObject(e)&&(o=i),this._send_request(s,o)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(e,i){var o=this.unset_action(e);return this._send_request(o,i)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(e,i,o){en.isObject(e)&&(o=i);var s=this.union_action(e,i);return this._send_request(s,o)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(e){var i=this.delete_action();return this._send_request(i,e)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(e,i,o){var s=this.remove_action(e,i);return this._send_request(s,o)})),MixpanelGroup.prototype._send_request=function(e,i){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var o=en.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:o,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},i)},MixpanelGroup.prototype._is_reserved_property=function(e){return"$group_key"===e||"$group_id"===e},MixpanelGroup.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelGroup.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},MixpanelGroup.prototype.remove=MixpanelGroup.prototype.remove,MixpanelGroup.prototype.set=MixpanelGroup.prototype.set,MixpanelGroup.prototype.set_once=MixpanelGroup.prototype.set_once,MixpanelGroup.prototype.union=MixpanelGroup.prototype.union,MixpanelGroup.prototype.unset=MixpanelGroup.prototype.unset,MixpanelGroup.prototype.toString=MixpanelGroup.prototype.toString;var MixpanelPeople=function(){};en.extend(MixpanelPeople.prototype,Tn),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,i,o){var s=this.set_action(e,i);return en.isObject(e)&&(o=i),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),s[Sn]=en.extend({},en.info.people_properties(),s[Sn]),this._send_request(s,o)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,i,o){var s=this.set_once_action(e,i);return en.isObject(e)&&(o=i),this._send_request(s,o)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(e,i){var o=this.unset_action(e);return this._send_request(o,i)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(e,i,o){var s={},a={};return en.isObject(e)?(en.each(e,(function(e,i){if(!this._is_reserved_property(i)){if(isNaN(parseFloat(e)))return void tn.error("Invalid increment value passed to mixpanel.people.increment - must be a number");a[i]=e}}),this),o=i):(en.isUndefined(i)&&(i=1),a[e]=i),s[In]=a,this._send_request(s,o)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,i,o){en.isObject(e)&&(o=i);var s=this.append_action(e,i);return this._send_request(s,o)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,i,o){en.isObject(e)&&(o=i);var s=this.remove_action(e,i);return this._send_request(s,o)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,i,o){en.isObject(e)&&(o=i);var s=this.union_action(e,i);return this._send_request(s,o)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,i,o){if(en.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",en.extend({$amount:e},i),o);tn.error("Invalid value passed to mixpanel.people.track_charge - must be a number")})),MixpanelPeople.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},MixpanelPeople.prototype.delete_user=function(){if(this._identify_called()){var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)}tn.error("mixpanel.people.delete_user() requires you to call identify() first")},MixpanelPeople.prototype.toString=function(){return this._mixpanel.toString()+".people"},MixpanelPeople.prototype._send_request=function(e,i){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var o=this._mixpanel.get_property("$device_id"),s=this._mixpanel.get_property("$user_id"),a=this._mixpanel.get_property("$had_persisted_distinct_id");o&&(e.$device_id=o),s&&(e.$user_id=s),a&&(e.$had_persisted_distinct_id=a);var h=en.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:h,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},i):(this._enqueue(e),en.isUndefined(i)||(this._get_config("verbose")?i({status:-1,error:null}):i(-1)),en.truncate(h,255))},MixpanelPeople.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelPeople.prototype._identify_called=function(){return!0===this._mixpanel._flags.identify_called},MixpanelPeople.prototype._enqueue=function(e){Sn in e?this._mixpanel.persistence._add_to_people_queue(Sn,e):kn in e?this._mixpanel.persistence._add_to_people_queue(kn,e):wn in e?this._mixpanel.persistence._add_to_people_queue(wn,e):In in e?this._mixpanel.persistence._add_to_people_queue(In,e):xn in e?this._mixpanel.persistence._add_to_people_queue(xn,e):En in e?this._mixpanel.persistence._add_to_people_queue(En,e):Cn in e?this._mixpanel.persistence._add_to_people_queue(Cn,e):tn.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,i,o,s){var a=this,h=en.extend({},this._mixpanel.persistence.load_queue(e)),f=h;en.isUndefined(h)||!en.isObject(h)||en.isEmptyObject(h)||(a._mixpanel.persistence._pop_from_people_queue(e,h),a._mixpanel.persistence.save(),s&&(f=s(h)),i.call(a,f,(function(i,s){0===i&&a._mixpanel.persistence._add_to_people_queue(e,h),en.isUndefined(o)||o(i,s)})))},MixpanelPeople.prototype._flush=function(e,i,o,s,a,h,f){var g=this;this._flush_one_queue(Sn,this.set,e),this._flush_one_queue(kn,this.set_once,s),this._flush_one_queue(wn,this.unset,h,(function(e){return en.keys(e)})),this._flush_one_queue(In,this.increment,i),this._flush_one_queue(Cn,this.union,a);var _=this._mixpanel.persistence.load_queue(xn);if(!en.isUndefined(_)&&en.isArray(_)&&_.length)for(var v,append_callback=function(e,i){0===e&&g._mixpanel.persistence._add_to_people_queue(xn,v),en.isUndefined(o)||o(e,i)},b=_.length-1;b>=0;b--)_=this._mixpanel.persistence.load_queue(xn),v=_.pop(),g._mixpanel.persistence.save(),en.isEmptyObject(v)||g.append(v,append_callback);var S=this._mixpanel.persistence.load_queue(En);if(!en.isUndefined(S)&&en.isArray(S)&&S.length)for(var I,remove_callback=function(e,i){0===e&&g._mixpanel.persistence._add_to_people_queue(En,I),en.isUndefined(f)||f(e,i)},x=S.length-1;x>=0;x--)S=this._mixpanel.persistence.load_queue(En),I=S.pop(),g._mixpanel.persistence.save(),en.isEmptyObject(I)||g.remove(I,remove_callback)},MixpanelPeople.prototype._is_reserved_property=function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e},MixpanelPeople.prototype.set=MixpanelPeople.prototype.set,MixpanelPeople.prototype.set_once=MixpanelPeople.prototype.set_once,MixpanelPeople.prototype.unset=MixpanelPeople.prototype.unset,MixpanelPeople.prototype.increment=MixpanelPeople.prototype.increment,MixpanelPeople.prototype.append=MixpanelPeople.prototype.append,MixpanelPeople.prototype.remove=MixpanelPeople.prototype.remove,MixpanelPeople.prototype.union=MixpanelPeople.prototype.union,MixpanelPeople.prototype.track_charge=MixpanelPeople.prototype.track_charge,MixpanelPeople.prototype.clear_charges=MixpanelPeople.prototype.clear_charges,MixpanelPeople.prototype.delete_user=MixpanelPeople.prototype.delete_user,MixpanelPeople.prototype.toString=MixpanelPeople.prototype.toString;var On,Rn="__mps",Mn="__mpso",Nn="__mpus",Pn="__mpa",Dn="__mpap",Zn="__mpr",An="__mpu",Ln="$people_distinct_id",jn="__alias",Fn="__timers",$n=[Rn,Mn,Nn,Pn,Dn,Zn,An,Ln,jn,Fn],MixpanelPersistence=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var i=e.persistence;"cookie"!==i&&"localStorage"!==i&&(tn.critical("Unknown persistence type "+i+"; falling back to cookie"),i=e.persistence="cookie"),"localStorage"===i&&en.localStorage.is_supported()?this.storage=en.localStorage:this.storage=en.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),en.each(this.props,(function(i,o){en.include($n,o)||(e[o]=i)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=en.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,i;this.storage===en.localStorage?(e=en.cookie.parse(this.name),en.cookie.remove(this.name),en.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===en.cookie&&(i=en.localStorage.parse(this.name),en.localStorage.remove(this.name),i&&this.register_once(i))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,en.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},MixpanelPersistence.prototype.load_prop=function(e){return this.load(),this.props[e]},MixpanelPersistence.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},MixpanelPersistence.prototype.clear=function(){this.remove(),this.props={}},MixpanelPersistence.prototype.register_once=function(e,i,o){return!!en.isObject(e)&&(void 0===i&&(i="None"),this.expire_days=void 0===o?this.default_expiry:o,this.load(),en.each(e,(function(e,o){this.props.hasOwnProperty(o)&&this.props[o]!==i||(this.props[o]=e)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(e,i){return!!en.isObject(e)&&(this.expire_days=void 0===i?this.default_expiry:i,this.load(),en.extend(this.props,e),this.save(),!0)},MixpanelPersistence.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},MixpanelPersistence.prototype.update_search_keyword=function(e){this.register(en.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:en.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return en.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},MixpanelPersistence.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},MixpanelPersistence.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},MixpanelPersistence.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},MixpanelPersistence.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},MixpanelPersistence.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},MixpanelPersistence.prototype.get_cross_subdomain=function(){return this.cross_subdomain},MixpanelPersistence.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},MixpanelPersistence.prototype._add_to_people_queue=function(e,i){var o=this._get_queue_key(e),s=i[e],a=this._get_or_create_queue(Sn),h=this._get_or_create_queue(kn),f=this._get_or_create_queue(wn),g=this._get_or_create_queue(In),_=this._get_or_create_queue(Cn),v=this._get_or_create_queue(En,[]),b=this._get_or_create_queue(xn,[]);o===Rn?(en.extend(a,s),this._pop_from_people_queue(In,s),this._pop_from_people_queue(Cn,s),this._pop_from_people_queue(wn,s)):o===Mn?(en.each(s,(function(e,i){i in h||(h[i]=e)})),this._pop_from_people_queue(wn,s)):o===Nn?en.each(s,(function(e){en.each([a,h,g,_],(function(i){e in i&&delete i[e]})),en.each(b,(function(i){e in i&&delete i[e]})),f[e]=!0})):o===Pn?(en.each(s,(function(e,i){i in a?a[i]+=e:(i in g||(g[i]=0),g[i]+=e)}),this),this._pop_from_people_queue(wn,s)):o===An?(en.each(s,(function(e,i){en.isArray(e)&&(i in _||(_[i]=[]),_[i]=_[i].concat(e))})),this._pop_from_people_queue(wn,s)):o===Zn?(v.push(s),this._pop_from_people_queue(xn,s)):o===Dn&&(b.push(s),this._pop_from_people_queue(wn,s)),tn.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),tn.log(i),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,i){var o=this.props[this._get_queue_key(e)];en.isUndefined(o)||en.each(i,(function(i,s){e===xn||e===En?en.each(o,(function(e){e[s]===i&&delete e[s]})):delete o[s]}),this)},MixpanelPersistence.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},MixpanelPersistence.prototype._get_queue_key=function(e){return e===Sn?Rn:e===kn?Mn:e===wn?Nn:e===In?Pn:e===xn?Dn:e===En?Zn:e===Cn?An:void tn.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,i){var o=this._get_queue_key(e);return i=en.isUndefined(i)?{}:i,this.props[o]||(this.props[o]=i)},MixpanelPersistence.prototype.set_event_timer=function(e,i){var o=this.load_prop(Fn)||{};o[e]=i,this.props[Fn]=o,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var i=(this.load_prop(Fn)||{})[e];return en.isUndefined(i)||(delete this.props[Fn][e],this.save()),i};var qn,load_extra_bundle=function(e,i){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},Un="mixpanel",Bn="base64",zn="$device:",Vn=vr.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Wn=!Vn&&-1===Kr.indexOf("MSIE")&&-1===Kr.indexOf("Mozilla"),Kn=null;Br.sendBeacon&&(Kn=function(){return Br.sendBeacon.apply(Br,arguments)});var Hn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},Gn={api_host:"https://api-js.mixpanel.com",api_routes:Hn,api_method:"POST",api_transport:"XHR",api_payload_format:Bn,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:NOOP_FUNC,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:NOOP_FUNC,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:18e5,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:Dr,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Jn=!1,MixpanelLib=function(){},create_mplib=function(e,i,o){var s,a=o===Un?qn:qn[o];if(a&&0===On)s=a;else{if(a&&!en.isArray(a))return void tn.error("You have already initialized "+o);s=new MixpanelLib}if(s._cached_groups={},s._init(e,i,o),s.people=new MixpanelPeople,s.people._init(s),!s.get_config("skip_first_touch_marketing")){var h=en.info.campaignParams(null),f={},g=!1;en.each(h,(function(e,i){f["initial_"+i]=e,e&&(g=!0)})),g&&s.people.set_once(f)}return kr.DEBUG=kr.DEBUG||s.get_config("debug"),!en.isUndefined(a)&&en.isArray(a)&&(s._execute_array.call(s.people,a.people),s._execute_array(a)),s};MixpanelLib.prototype.init=function(e,i,o){if(en.isUndefined(o))this.report_error("You must name your new library: init(token, config, name)");else{if(o!==Un){var s=create_mplib(e,i,o);return qn[o]=s,s._loaded(),s}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(e,i,o){i=i||{},this.__loaded=!0,this.config={};var s={};"api_payload_format"in i||(i.api_host||Gn.api_host).match(/\.mixpanel\.com/)&&(s.api_payload_format="json");if(this.set_config(en.extend({},Gn,s,i,{name:o,token:e,callback_fn:(o===Un?o:Un+"."+o)+"._jsc"})),this._jsc=NOOP_FUNC,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests)if(en.localStorage.is_supported(!0)&&Vn){if(this.init_batchers(),Kn&&vr.addEventListener){var a=en.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);vr.addEventListener("pagehide",(function(e){e.persisted&&a()})),vr.addEventListener("visibilitychange",(function(){"hidden"===zr.visibilityState&&a()}))}}else this._batch_requests=!1,tn.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),en.each(this.get_batcher_configs(),(function(e){tn.log("Clearing batch queue "+e.queue_key),en.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var h=en.UUID();this.get_distinct_id()||this.register_once({distinct_id:zn+h,$device_id:h},"");var f=this.get_config("track_pageview");f&&this._init_url_change_tracking(f),this.get_config("record_sessions_percent")>0&&100*Math.random()<=this.get_config("record_sessions_percent")&&this.start_session_recording()},MixpanelLib.prototype.start_session_recording=addOptOutCheckMixpanelLib((function(){if(vr.MutationObserver){var e=en.bind((function(){this._recorder=this._recorder||new vr.__mp_recorder(this),this._recorder.startRecording()}),this);en.isUndefined(vr.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else tn.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():tn.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var e={};if(this._recorder){var i=this._recorder.replayId;i&&(e.$mp_replay_id=i)}return e},MixpanelLib.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=en.info.campaignParams(null);en.each(e,function(e,i){this.unregister(i)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(zr.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(en.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(zr.referrer)},MixpanelLib.prototype._dom_loaded=function(){en.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||en.each(this.__request_queue,(function(e){this._send_request.apply(this,e)}),this),delete this.__dom_loaded_queue,delete this.__request_queue},MixpanelLib.prototype._track_dom=function(e,i){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!Jn)return this.__dom_loaded_queue.push([e,i]),!1;var o=(new e).init(this);return o.track.apply(o,i)},MixpanelLib.prototype._init_url_change_tracking=function(e){var i="";if(this.track_pageview()&&(i=en.info.currentUrl()),en.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){vr.addEventListener("popstate",(function(){vr.dispatchEvent(new Event("mp_locationchange"))})),vr.addEventListener("hashchange",(function(){vr.dispatchEvent(new Event("mp_locationchange"))}));var o=vr.history.pushState;"function"==typeof o&&(vr.history.pushState=function(e,i,s){o.call(vr.history,e,i,s),vr.dispatchEvent(new Event("mp_locationchange"))});var s=vr.history.replaceState;"function"==typeof s&&(vr.history.replaceState=function(e,i,o){s.call(vr.history,e,i,o),vr.dispatchEvent(new Event("mp_locationchange"))}),vr.addEventListener("mp_locationchange",function(){var o=en.info.currentUrl(),s=!1;("full-url"===e?s=o!==i:"url-with-path-and-query-string"===e?s=o.split("#")[0]!==i.split("#")[0]:"url-with-path"===e&&(s=o.split("#")[0].split("?")[0]!==i.split("#")[0].split("?")[0]),s)&&(this.track_pageview()&&(i=o))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,i){if(en.isUndefined(e))return null;if(Vn){return function(o){e(o,i)}}var o=this._jsc,s=""+Math.floor(1e8*Math.random()),a=this.get_config("callback_fn")+"["+s+"]";return o[s]=function(a){delete o[s],e(a,i)},a},MixpanelLib.prototype._send_request=function(e,i,o,s){var a=!0;if(Wn)return this.__request_queue.push(arguments),a;var h={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},f=null;s||!en.isFunction(o)&&"string"!=typeof o||(s=o,o=null),o=en.extend(h,o||{}),Vn||(o.method="GET");var g="POST"===o.method,_=Kn&&g&&"sendbeacon"===o.transport.toLowerCase(),v=o.verbose;i.verbose&&(v=!0),this.get_config("test")&&(i.test=1),v&&(i.verbose=1),this.get_config("img")&&(i.img=1),Vn||(s?i.callback=s:(v||this.get_config("test"))&&(i.callback="(function(){})")),i.ip=this.get_config("ip")?1:0,i._=(new Date).getTime().toString(),g&&(f="data="+encodeURIComponent(i.data),delete i.data),e+="?"+en.HTTPBuildQuery(i);var b=this;if("img"in i){var S=zr.createElement("img");S.src=e,zr.body.appendChild(S)}else if(_){try{a=Kn(e,f)}catch(N){b.report_error(N),a=!1}try{s&&s(a?1:0)}catch(N){b.report_error(N)}}else if(Vn)try{var I=new XMLHttpRequest;I.open(o.method,e,!0);var x=this.get_config("xhr_headers");if(g&&(x["Content-Type"]="application/x-www-form-urlencoded"),en.each(x,(function(e,i){I.setRequestHeader(i,e)})),o.timeout_ms&&void 0!==I.timeout){I.timeout=o.timeout_ms;var T=(new Date).getTime()}I.withCredentials=!0,I.onreadystatechange=function(){var e;if(4===I.readyState)if(200===I.status){if(s)if(v){var i;try{i=en.JSONDecode(I.responseText)}catch(N){if(b.report_error(N),!o.ignore_json_errors)return;i=I.responseText}s(i)}else s(Number(I.responseText))}else if(e=I.timeout&&!I.status&&(new Date).getTime()-T>=I.timeout?"timeout":"Bad HTTP status: "+I.status+" "+I.statusText,b.report_error(e),s)if(v){var a=I.responseHeaders||{};s({status:0,httpStatusCode:I.status,error:e,retryAfter:a["Retry-After"]})}else s(0)},I.send(f)}catch(N){b.report_error(N),a=!1}else{var O=zr.createElement("script");O.type="text/javascript",O.async=!0,O.defer=!0,O.src=e;var R=zr.getElementsByTagName("script")[0];R.parentNode.insertBefore(O,R)}return a},MixpanelLib.prototype._execute_array=function(e){var i,o=[],s=[],a=[];en.each(e,(function(e){e&&(i=e[0],en.isArray(i)?a.push(e):"function"==typeof e?e.call(this):en.isArray(e)&&"alias"===i?o.push(e):en.isArray(e)&&-1!==i.indexOf("track")&&"function"==typeof this[i]?a.push(e):s.push(e))}),this);var execute=function(e,i){en.each(e,(function(e){if(en.isArray(e[0])){var o=i;en.each(e,(function(e){o=o[e[0]].apply(o,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),i)};execute(o,this),execute(s,this),execute(a,this)},MixpanelLib.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},MixpanelLib.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token"),i=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+i.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+i.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+i.groups,queue_key:e+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=en.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:en.bind((function(i,o,s){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(i),o,this._prepare_callback(s,i))}),this),beforeSendHook:en.bind((function(i){return this._run_hook("before_send_"+e.type,i)}),this),stopAllBatchingFunc:en.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),i=this.get_batcher_configs();this.request_batchers={events:e(i.events),people:e(i.people),groups:e(i.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},MixpanelLib.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,en.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,en.each(this.request_batchers,(function(e){e.stop(),e.clear()}))},MixpanelLib.prototype.push=function(e){this._execute_array([e])},MixpanelLib.prototype.disable=function(e){void 0===e?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},MixpanelLib.prototype._encode_data_for_request=function(e){var i=en.JSONEncode(e);return this.get_config("api_payload_format")===Bn&&(i=en.base64Encode(i)),{data:i}},MixpanelLib.prototype._track_or_batch=function(e,i){var o=en.truncate(e.data,255),s=e.endpoint,a=e.batcher,h=e.should_send_immediately,f=e.send_request_options||{};i=i||NOOP_FUNC;var g=!0,_=en.bind((function(){return f.skip_hooks||(o=this._run_hook("before_send_"+e.type,o)),o?(tn.log("MIXPANEL REQUEST:"),tn.log(o),this._send_request(s,this._encode_data_for_request(o),f,this._prepare_callback(i,o))):null}),this);return this._batch_requests&&!h?a.enqueue(o,(function(e){e?i(1,o):_()})):g=_(),g&&o},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,i,o,s){s||"function"!=typeof o||(s=o,o=null);var a=(o=o||{}).transport;a&&(o.transport=a);var h=o.send_immediately;if("function"!=typeof s&&(s=NOOP_FUNC),en.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(i=en.extend({},i)).token=this.get_config("token");var f=this.persistence.remove_event_timer(e);if(!en.isUndefined(f)){var g=(new Date).getTime()-f;i.$duration=parseFloat((g/1e3).toFixed(3))}this._set_default_superprops();var _=this.get_config("track_marketing")?en.info.marketingParams():{};i=en.extend({},en.info.properties({mp_loader:this.get_config("mp_loader")}),_,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),i);var v=this.get_config("property_blacklist");en.isArray(v)?en.each(v,(function(e){delete i[e]})):this.report_error("Invalid value for property_blacklist config: "+v);var b={event:e,properties:i};return this._track_or_batch({type:"events",data:b,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:h,send_request_options:o},s)}s(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,i,o){en.isArray(i)||(i=[i]);var s={};return s[e]=i,this.register(s),this.people.set(e,i,o)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,i,o){var s=this.get_property(e),a={};return void 0===s?(a[e]=[i],this.register(a)):-1===s.indexOf(i)&&(s.push(i),a[e]=s,this.register(a)),this.people.union(e,i,o)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,i,o){var s=this.get_property(e);if(void 0!==s){var a=s.indexOf(i);a>-1&&(s.splice(a,1),this.register({group_key:s})),0===s.length&&this.unregister(e)}return this.people.remove(e,i,o)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,i,o,s){var a=en.extend({},i||{});return en.each(o,(function(e,i){null!=e&&(a[i]=e)})),this.track(e,a,s)})),MixpanelLib.prototype._create_map_key=function(e,i){return e+"_"+JSON.stringify(i)},MixpanelLib.prototype._remove_group_from_cache=function(e,i){delete this._cached_groups[this._create_map_key(e,i)]},MixpanelLib.prototype.get_group=function(e,i){var o=this._create_map_key(e,i),s=this._cached_groups[o];return void 0!==s&&s._group_key===e&&s._group_id===i||((s=new MixpanelGroup)._init(this,e,i),this._cached_groups[o]=s),s},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,i){"object"!=typeof e&&(e={});var o=(i=i||{}).event_name||"$mp_web_page_view",s=en.extend(en.info.mpPageViewProperties(),en.info.campaignParams(),en.info.clickParams()),a=en.extend({},s,e);return this.track(o,a)})),MixpanelLib.prototype.track_links=function(){return this._track_dom.call(this,LinkTracker,arguments)},MixpanelLib.prototype.track_forms=function(){return this._track_dom.call(this,FormTracker,arguments)},MixpanelLib.prototype.time_event=function(e){en.isUndefined(e)?this.report_error("No event name provided to mixpanel.time_event"):this._event_is_disabled(e)||this.persistence.set_event_timer(e,(new Date).getTime())};var Yn={persistent:!0},options_for_register=function(e){var i;return i=en.isObject(e)?e:en.isUndefined(e)?{}:{days:e},en.extend({},Yn,i)};MixpanelLib.prototype.register=function(e,i){var o=options_for_register(i);o.persistent?this.persistence.register(e,o.days):en.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,i,o){var s=options_for_register(o);s.persistent?this.persistence.register_once(e,i,s.days):(void 0===i&&(i="None"),en.each(e,(function(e,o){this.unpersisted_superprops.hasOwnProperty(o)&&this.unpersisted_superprops[o]!==i||(this.unpersisted_superprops[o]=e)}),this))},MixpanelLib.prototype.unregister=function(e,i){(i=options_for_register(i)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,i){var o={};o[e]=i,this.register(o)},MixpanelLib.prototype.identify=function(e,i,o,s,a,h,f,g){var _=this.get_distinct_id();if(e&&_!==e){if("string"==typeof e&&0===e.indexOf(zn))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var v=_;this.register_once({$had_persisted_distinct_id:!0,$device_id:v},"")}e!==_&&e!==this.get_property(jn)&&(this.unregister(jn),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(i,o,s,a,h,f,g),e!==_&&this.track("$identify",{distinct_id:e,$anon_distinct_id:_},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=en.UUID();this.register_once({distinct_id:zn+e,$device_id:e},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(e,i){if(e===this.get_property(Ln))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var o=this;return en.isUndefined(i)&&(i=this.get_distinct_id()),e!==i?(this._register_single(jn,e),this.track("$create_alias",{alias:e,distinct_id:i},{skip_hooks:!0},(function(){o.identify(e)}))):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},MixpanelLib.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},MixpanelLib.prototype.set_config=function(e){en.isObject(e)&&(en.extend(this.config,e),e.batch_size&&en.each(this.request_batchers,(function(e){e.resetBatchSize()})),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),kr.DEBUG=kr.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(e){return this.config[e]},MixpanelLib.prototype._run_hook=function(e){var i=(this.config.hooks[e]||IDENTITY_FUNC).apply(this,Fr.call(arguments,1));return void 0===i&&(this.report_error(e+" hook did not return a value"),i=null),i},MixpanelLib.prototype.get_property=function(e){return this.persistence.load_prop([e])},MixpanelLib.prototype.toString=function(){var e=this.get_config("name");return e!==Un&&(e=Un+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return en.isBlockedUA(Kr)||this._flags.disable_all_events||en.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&en.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_tracking()||!this.get_config("opt_out_tracking_by_default")&&!en.cookie.get("mp_optout")||(en.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},MixpanelLib.prototype._gdpr_update_persistence=function(e){var i;if(e&&e.clear_persistence)i=!0;else{if(!e||!e.enable_persistence)return;i=!1}this.get_config("disable_persistence")||this.persistence.disabled===i||this.persistence.set_disabled(i),i?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},MixpanelLib.prototype._gdpr_call_func=function(e,i){return i=en.extend({track:en.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},i),en.localStorage.is_supported()||(i.persistence_type="cookie"),e(this.get_config("token"),{track:i.track,trackEventName:i.track_event_name,trackProperties:i.track_properties,persistenceType:i.persistence_type,persistencePrefix:i.cookie_prefix,cookieDomain:i.cookie_domain,cookieExpiration:i.cookie_expiration,crossSiteCookie:i.cross_site_cookie,crossSubdomainCookie:i.cross_subdomain_cookie,secureCookie:i.secure_cookie,ignoreDnt:i.ignore_dnt})},MixpanelLib.prototype.opt_in_tracking=function(e){e=en.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=en.extend({clear_persistence:!0,delete_user:!0},e)).delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(optOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(hasOptedIn,e)},MixpanelLib.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(hasOptedOut,e)},MixpanelLib.prototype.clear_opt_in_out_tracking=function(e){e=en.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,i){tn.error.apply(tn.error,arguments);try{i||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,i)}catch(o){tn.error(o)}},MixpanelLib.prototype.init=MixpanelLib.prototype.init,MixpanelLib.prototype.reset=MixpanelLib.prototype.reset,MixpanelLib.prototype.disable=MixpanelLib.prototype.disable,MixpanelLib.prototype.time_event=MixpanelLib.prototype.time_event,MixpanelLib.prototype.track=MixpanelLib.prototype.track,MixpanelLib.prototype.track_links=MixpanelLib.prototype.track_links,MixpanelLib.prototype.track_forms=MixpanelLib.prototype.track_forms,MixpanelLib.prototype.track_pageview=MixpanelLib.prototype.track_pageview,MixpanelLib.prototype.register=MixpanelLib.prototype.register,MixpanelLib.prototype.register_once=MixpanelLib.prototype.register_once,MixpanelLib.prototype.unregister=MixpanelLib.prototype.unregister,MixpanelLib.prototype.identify=MixpanelLib.prototype.identify,MixpanelLib.prototype.alias=MixpanelLib.prototype.alias,MixpanelLib.prototype.name_tag=MixpanelLib.prototype.name_tag,MixpanelLib.prototype.set_config=MixpanelLib.prototype.set_config,MixpanelLib.prototype.get_config=MixpanelLib.prototype.get_config,MixpanelLib.prototype.get_property=MixpanelLib.prototype.get_property,MixpanelLib.prototype.get_distinct_id=MixpanelLib.prototype.get_distinct_id,MixpanelLib.prototype.toString=MixpanelLib.prototype.toString,MixpanelLib.prototype.opt_out_tracking=MixpanelLib.prototype.opt_out_tracking,MixpanelLib.prototype.opt_in_tracking=MixpanelLib.prototype.opt_in_tracking,MixpanelLib.prototype.has_opted_out_tracking=MixpanelLib.prototype.has_opted_out_tracking,MixpanelLib.prototype.has_opted_in_tracking=MixpanelLib.prototype.has_opted_in_tracking,MixpanelLib.prototype.clear_opt_in_out_tracking=MixpanelLib.prototype.clear_opt_in_out_tracking,MixpanelLib.prototype.get_group=MixpanelLib.prototype.get_group,MixpanelLib.prototype.set_group=MixpanelLib.prototype.set_group,MixpanelLib.prototype.add_group=MixpanelLib.prototype.add_group,MixpanelLib.prototype.remove_group=MixpanelLib.prototype.remove_group,MixpanelLib.prototype.track_with_groups=MixpanelLib.prototype.track_with_groups,MixpanelLib.prototype.start_batch_senders=MixpanelLib.prototype.start_batch_senders,MixpanelLib.prototype.stop_batch_senders=MixpanelLib.prototype.stop_batch_senders,MixpanelLib.prototype.start_session_recording=MixpanelLib.prototype.start_session_recording,MixpanelLib.prototype.stop_session_recording=MixpanelLib.prototype.stop_session_recording,MixpanelLib.prototype.get_session_recording_properties=MixpanelLib.prototype.get_session_recording_properties,MixpanelLib.prototype.DEFAULT_API_ROUTES=Hn,MixpanelPersistence.prototype.properties=MixpanelPersistence.prototype.properties,MixpanelPersistence.prototype.update_search_keyword=MixpanelPersistence.prototype.update_search_keyword,MixpanelPersistence.prototype.update_referrer_info=MixpanelPersistence.prototype.update_referrer_info,MixpanelPersistence.prototype.get_cross_subdomain=MixpanelPersistence.prototype.get_cross_subdomain,MixpanelPersistence.prototype.clear=MixpanelPersistence.prototype.clear;var Xn={},override_mp_init_func=function(){qn.init=function(e,i,o){if(o)return qn[o]||(qn[o]=Xn[o]=create_mplib(e,i,o),qn[o]._loaded()),qn[o];var s=qn;Xn[Un]?s=Xn[Un]:e&&((s=create_mplib(e,i,Un))._loaded(),Xn[Un]=s),qn=s,1===On&&(vr[Un]=qn),en.each(Xn,(function(e,i){i!==Un&&(qn[i]=e)})),qn._=en}};var Qn=function init_as_module(e){return load_extra_bundle=e,On=0,qn=new MixpanelLib,override_mp_init_func(),qn.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,Jn=!0,Wn=!1,en.each(Xn,(function(e){e._dom_loaded()})))}if(zr.addEventListener)"complete"===zr.readyState?dom_loaded_handler():zr.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(zr.attachEvent){zr.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===vr.frameElement}catch(i){}zr.documentElement.doScroll&&e&&function do_scroll_check(){try{zr.documentElement.doScroll("left")}catch(i){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}en.register_event(vr,"load",dom_loaded_handler,!0)}(),qn}((function loadNoop(e,i){i()}));const ei="mp_distinct_id";function isReady(){return void 0!==window.mixpanel}function updateCachedDistinctId(e){localStorage.setItem(ei,e)}const ti={init:function init$2(e,i=!1,o){return new Promise((s=>{Qn.init(e,{debug:i,loaded:()=>{window.mixpanel=Qn,s()},...o&&{api_host:o}})}))},isReady:isReady,track:function track(e,i){isReady()&&Qn.track(e,{...i,"Reservamos Version":"1.0.12"})},identify:function identify$1(e,i){Qn.identify(e),updateCachedDistinctId(e),Qn.people.set(i)},attachProperty:function attachProperty(e,i){isReady()&&Qn.people.union(e,[i])},getMixpanelDistinctId:()=>{const e=localStorage.getItem(ei);if(Qn&&Qn.get_distinct_id){const e=Qn.get_distinct_id();return updateCachedDistinctId(e),e}return e||null}},ri=Te.object({firstName:Te.string().optional(),lastName:Te.string().optional(),email:Te.string().email().optional(),phone:Te.string().optional()}),ni=["web","web-mobile","ios","android","app"],ii=Te.enum(ni).refine((e=>ni.includes(e)),{message:`Product must be one of: ${ni.join(", ")}`}),oi=Te.object({product:ii});const dateValidation=e=>!(!/^\d{4}-\d{2}-\d{2}$/.test(e)&&!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(e))||!(!/^\d{4}-\d{2}-\d{2}/.test(e)||isNaN(Date.parse(e))),stringField=e=>Te.string().refine((e=>e),{message:`${e} must be a string`}),numberField=e=>Te.number().refine((e=>e),{message:`${e} must be a number`}),intField=e=>Te.number().int().refine((e=>e),{message:`${e} must be an integer`}),dateField=e=>Te.string().refine(dateValidation,{message:`Invalid ${e} datetime format`}),arrayField=(e,i,o)=>Te.array(e).min(o,`${i} must have at least ${o} items`),si=Te.object({Origin:stringField("Origin").optional(),Destination:stringField("Destination").optional(),Departure:dateField("Departure").optional(),Return:dateField("Return").optional(),"Departure Date":stringField("Departure Date").optional(),product:ii});const ai=Te.object({"Passenger Birthdate":dateField("Passenger Birthdate"),"Passenger Seat":stringField("Passenger Seat"),"Passenger Name":stringField("Passenger Name"),"Passenger Document Type":stringField("Document Type"),"Passenger Document Id":stringField("Document ID")}).strict(),ci=Te.object({"Departure Arrival":dateField("Departure Arrival"),"Departure Destination":stringField("Departure Destination"),"Departure Destination Terminal":stringField("Departure Destination Terminal"),"Departure Line":stringField("Departure Line"),"Departure Origin":stringField("Departure Origin"),"Departure Origin Terminal":stringField("Departure Origin Terminal"),"Departure Price":numberField("Departure Price"),"Departure Route":stringField("Departure Route"),"Departure Stops":intField("Departure Stops"),"Departure Time":dateField("Departure Time"),"Departure Transport Type":stringField("Departure Transport Type"),"Departure Transporter":stringField("Departure Transporter"),"Return Arrival":dateField("Return Arrival").optional(),"Return Destination":stringField("Return Destination").optional(),"Return Destination Terminal":stringField("Return Destination Terminal").optional(),"Return Line":stringField("Return Line").optional(),"Return Origin":stringField("Return Origin").optional(),"Return Origin Terminal":stringField("Return Origin Terminal").optional(),"Return Price":numberField("Return Price").optional(),"Return Route":stringField("Return Route").optional(),"Return Stops":intField("Return Stops").optional(),"Return Time":dateField("Return Time").optional(),"Return Transport Type":stringField("Return Transport Type").optional(),"Return Transporter":stringField("Return Transporter").optional(),"Recommended Trip":Te.boolean(),"Recommended Trip Type":stringField("Recommended Trip Type").optional()}),di=Te.object({Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count").optional(),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()}).strict();const ui=Te.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),"Payment Type":Te.string().min(1,"Payment Type is required"),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional(),Insurance:(li="Insurance",Te.boolean({required_error:`${li} is required`,invalid_type_error:`${li} must be a boolean`})).optional(),Coupon:stringField("Coupon").optional(),"User Status":stringField("User Status").optional()}).strict();var li;const pi=Te.object({Arrival:Te.string().refine(dateValidation,{message:"Invalid arrival datetime format"}),Departure:Te.string().refine(dateValidation,{message:"Invalid departure datetime format"}),Destination:Te.string().min(1,"Destination is required"),"Destination Terminal":Te.string().min(1,"Destination terminal is required"),Line:Te.string().min(1,"Line is required").optional(),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin terminal is required"),Price:Te.number().positive("Price must be a positive number"),"Result Position":Te.number().int("Result Position must be an integer"),Route:Te.string().min(1,"Route is required"),Stops:Te.number().int("Stops must be an integer").nonnegative("Stops must be non-negative"),"Transport Type":Te.string().min(1,"Transport Type is required"),Transporter:Te.string().min(1,"Transporter is required"),product:ii,"Recommended Trip":Te.boolean(),"Recommended Trip Type":Te.string().optional(),"Trip Type":Te.string().min(1,"Trip Type is required"),"Bus Type":Te.string().min(1,"Bus Type is required")});const hi=Te.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()}).strict();const fi=Te.object({Departure:Te.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),"Departure Delta":Te.number().int("Departure Delta must be an integer"),Destination:Te.string().min(1,"Destination is required"),"Destination Terminal":Te.string().min(1,"Destination terminal is required"),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin terminal is required"),Passengers:Te.number().int("Passenger count must be an integer"),Return:Te.string().refine(dateValidation,{message:"Invalid Return date or datetime format. Must include at least YYYY-MM-DD"}).optional(),Route:Te.string().min(1,"Route is required"),"Trip Length":Te.number().positive().optional(),Categories:Te.array(Te.string()).optional(),product:ii});const mi=Te.object({Arrival:Te.string().refine(dateValidation,{message:"Invalid arrival date or datetime format. Must include at least YYYY-MM-DD"}),Departure:Te.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),Destination:Te.string().min(1,"Destination is required"),"Destination Terminal":Te.string().min(1,"Destination Terminal is required"),Line:Te.string().min(1,"Line is required").optional(),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin Terminal is required"),Price:Te.number().positive("Price must be a positive number"),Route:Te.string().min(1,"Route is required"),Stops:Te.number().int("Stops must be an integer").nonnegative().optional(),Tickets:Te.number().int("Tickets must be an integer").positive(),Transporter:Te.string().min(1,"Transporter is required"),Way:Te.enum(["Departure","Return"],{description:"Way must be either 'Departure' or 'Return'"}),product:ii});const gi=Te.object({"Bus count":Te.number().int("Bus count must be an integer"),Departure:Te.string().refine(dateValidation,{message:"Invalid departure datetime format"}),"Departure Delta":Te.number().int("Departure Delta must be an integer").optional(),Destination:Te.string().min(1,"Destination is required").optional(),"Destination Terminal":Te.string().min(1,"Destination terminal is required").optional(),"Has Frequent Buses":Te.boolean().default(!1).optional(),Origin:Te.string().min(1,"Origin is required"),"Origin Terminal":Te.string().min(1,"Origin terminal is required"),Route:Te.string().min(1,"Route is required"),product:ii}),_i=Te.object({mixpanelToken:Te.string().min(1,"Mixpanel token is required"),debug:Te.boolean().optional(),identificationKey:Te.string().min(1,"Identification key is required"),isSandbox:Te.boolean().optional(),mixpanelProxyUrl:Te.string().optional(),identifyProxyUrl:Te.string().optional()}),SchemaErrorFormatter=e=>e.issues.map((e=>{let i="INVALID_FIELD",o="",s="",a="";return"invalid_type"===e.code?(i="TYPE_MISMATCH",o=e.expected,s=e.received,a=`Expected ${o} but received ${s}. Please provide a value of type ${o}.`):"too_small"===e.code?(i="VALUE_TOO_SMALL",a=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(i="VALUE_TOO_BIG",a=`Reduce the value to no more than ${e.maximum}.`):(i="INVALID_FIELD",a="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:i,expected:o,received:s,message:e.message,suggestion:a}})),yi={Search:fi,"Seat Change":mi,"Interest In Home":oi,"Passengers Created":di,"Payment Attempt":ui,"Interest In Search":si,"View Results":gi,"Purchase Attempt":hi,"Picked Departure":pi};function validateProps(e,i){try{i.parse(e)}catch(Or){if(Or instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Or)}}throw{message:"Unknown validation error"}}}const vi={parseEventProps:function parseEventProps(e,i){const o=yi[e]||Re;try{o.parse(i)}catch(Or){if(Or instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Or)}}throw{message:"Unknown validation error"}}},parseInitProps:function parseInitProps(e){validateProps(e,_i)},parseIdentifyProps:function parseIdentifyProps(e){validateProps(e,ri)},validateProps:validateProps};function isTrackerReady(){return ti.isReady()}let bi=null;const Si="geolocationPermissionTimestamp",ki=6048e5;function updatePermissionTimestamp(e){localStorage.setItem(Si,e.toString())}const wi={init:function init(){return new Promise((e=>{if(function isPermissionTimestampValid(e){return!!e&&Date.now()-parseInt(e,10)<ki}(localStorage.getItem(Si)))return void e(bi);const i="Geolocation Requested",o=Date.now();navigator.geolocation.getCurrentPosition((s=>{const{latitude:a,longitude:h}=s.coords;bi={lat:a,long:h},updatePermissionTimestamp(o),isTrackerReady()&&trackCustomEvent(i,{geolocationAccepted:!0}),e(bi)}),(()=>{updatePermissionTimestamp(o),isTrackerReady()&&trackCustomEvent(i,{geolocationAccepted:!1}),e(null)}))}))},getCoordinates:function getCoordinates(){return bi}},Ii=["Search","View Results"],xi={utm_brand:"UTM Brand",utm_kxconfig:"UTM KXConfig",gad_source:"GAD Source",gclid:"GCLID"};function trackEventError(e,i,o){tryTrackEvent((async()=>{try{ti.track("Track Event Error",{"Failed Event Name":e,"Error Message":(null==i?void 0:i.message)??"Failed to track event","Validation Errors":(null==i?void 0:i.errors)||[],"Event Payload":o})}catch(s){console.error("Failed to track error event:",s)}}))}async function tryTrackEvent(e){ti.isReady()?await e():window.addEventListener("Tracker Ready",(async()=>{await e()}))}async function trackEvent(e,i,o={}){if(!ti.isReady())throw new Error("Mixpanel is not initialized.");try{vi.parseEventProps(e,i);const s=!Ii.includes(e);ti.getMixpanelDistinctId();const a=await _t.getFingerprint(s),h={},f=wi.getCoordinates();f&&(h.$latitude=f.lat,h.$longitude=f.long);const g={"User Fingerprint":a},_=function extractTrackingParams(){try{const e=new URLSearchParams(window.location.search),i={};return Object.entries(xi).forEach((([o,s])=>{const a=e.get(o);a&&(i[s]=a)})),i}catch(Or){return console.error("Error extracting tracking parameters:",Or),{}}}(),v=function flattenEventData(e){return Object.entries(e).reduce(((e,[i,o])=>Array.isArray(o)?Array.isArray(o)&&o.every((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e))?(e[i]=o,e):(o.forEach((i=>{"object"==typeof i&&null!==i&&Object.entries(i).forEach((([i,o])=>{e[i]?e[i].push(o):e[i]=[o]}))})),e):(e[i]=o,e)),{})}(i),b={...g,...v,..._,...h,...o};ti.track(e,b)}catch(Or){console.error(`Error tracking event '${e}':`,Or),trackEventError(e,Or,i)}}function trackCustomEvent(e,i={},o={}){try{Me.parse(e),trackEvent(e,i,o)}catch(Or){console.error("Error trackCustomEvent:",Or),trackEventError(e,Or,i)}}const Ci=Te.object({email:Te.string().email().optional(),phone:Te.string().optional(),cpf:Te.string().optional(),passport:Te.string().optional(),rg:Te.string().optional(),firstName:Te.string().optional(),lastName:Te.string().optional()}).refine((e=>e.email||e.phone),{message:"At least one of 'email' or 'phone' must be provided"});async function createAnonymousProfile(e){try{vi.validateProps(e,Ci);const i=[],o=_t.getCachedFingerprint(),s=ti.getMixpanelDistinctId();o&&i.push({key:"fingerprint",value:o}),s&&i.push({key:"distinct_id",value:s});const a=function getAnonymousProfilePayload(e,i){let o="phone",s=e.phone||"";const a=[],h={};e.email&&(o="email",s=e.email);const f=["cpf","passport","rg","email","phone","salesforceid"],g=["name","firstName","lastName"];return Object.entries(e).forEach((([e,i])=>{e=function isCamelCase(e){return!(!e||e.includes(" ")||e[0]!==e[0].toLowerCase()||/[^a-zA-Z]/.test(e)||!/[A-Z]/.test(e))}(e)?e:e.toLocaleLowerCase(),f.includes(e)&&i?e!==o&&a.push({key:e,value:i}):g.includes(e)&&i&&(h[e]=i)})),i.length&&i.forEach((e=>a.push(e))),{identifier_key:o,identifier_value:s,details:h,identifiers:a}}(e,i);return await Nt.profiles.createAnonymousProfile(a)}catch(Or){return void console.error("Could not create anonymous profile:",Or)}}const Ei=["firstName","lastName","email","phone"];Te.object({"Operation Id":stringField("Operation Id"),Trips:arrayField(ci,"Trips",1).optional(),"Passenger Count":numberField("Passenger Count").optional(),Total:numberField("Total").optional(),"Trip Count":numberField("Trip Count").optional(),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()});const Ti=Te.object({category:Te.string(),number:Te.string().optional(),occupied:Te.boolean().optional(),adjacent_seats:Te.null().optional()}),Oi=Te.object({bus:Te.array(Te.array(Te.array(Ti)))}),Ri=Te.object({bus_type:Te.string(),selected_seats:Te.string(),bus_scheme:Oi});const Mi=Te.object({category:Te.string(),number:Te.string().optional(),occupied:Te.boolean().optional(),adjacent_seats:Te.null().optional()}),Ni=Te.object({bus:Te.array(Te.array(Te.array(Mi)))}),Pi=Te.object({bus_scheme:Ni,total_seats:Te.number()});const Di=Te.object({searchId:Te.number().min(1,"SearchId is required")});const Zi={init:async function init$1(e){vi.parseInitProps(e);const{mixpanelToken:i,debug:o=!1,identificationKey:s,isSandbox:a=!1,mixpanelProxyUrl:h,identifyProxyUrl:f}=e;wi.init(),await ti.init(i,o,h);try{await _t.initFingerprint(s,f)}catch(Or){console.error("Error initializing identification service:",Or)}At.setEnvironment(a?"sandbox":"prod"),Nt.setConfig(At.getCoreAPIConfig()),function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},isReady:isTrackerReady,identify:async function identify(e,i={}){tryTrackEvent((async()=>{try{if(vi.parseIdentifyProps(i),!e)throw console.error("User ID is required for identification."),new Error("User ID is required for identification.");const o=await createAnonymousProfile(i);o&&(i.reservamos_one_id=o.id);const s=function mapProperties(e){return{$first_name:null==e?void 0:e.firstName,$last_name:null==e?void 0:e.lastName,$email:null==e?void 0:e.email,$phone:null==e?void 0:e.phone,...Object.keys(e).reduce(((i,o)=>(Ei.includes(o)||(i[o]=e[o]),i)),{})}}(i);ti.identify(e,s);const a=await _t.getFingerprint();a&&ti.attachProperty("Known Fingerprints",a)}catch(Or){console.error("Error identifying user",Or),trackEventError("Identify",Or,{userId:e,properties:i})}finally{(async(e,i)=>{var o,s;try{const a=wi.getCoordinates();if(!a)return;i.first_name=i.firstName,i.last_name=i.lastName,i.latitude=a.lat,i.longitude=a.long,i.ip="0",i.name=`${i.firstName} ${i.lastName}`,delete i.firstName,delete i.lastName;const h=At.getCoreAPIConfig();fetch(`${h.baseUrl}/v1/datalake/identify`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:(null==(o=h.defaultHeaders)?void 0:o.Authorization)||"",Origin:(null==(s=h.defaultHeaders)?void 0:s.Origin)||""},body:JSON.stringify({profile_params:{...i,distinct_id:e}})})}catch(Or){console.error("Error identifying user-service",Or)}})(e,i)}}))},identifiers:{getFingerprintId:_t.getCachedFingerprint,getDistinctId:ti.getMixpanelDistinctId},profiles:{createAnonymousProfile:createAnonymousProfile},recommendations:{getRecommendedPlaces:async function getRecommendedPlaces(){const e=ti.getMixpanelDistinctId();if(!e)throw new Error("No distinct ID found");const i=await Nt.recommendations.createRecommendedPlaces({distinct_id:e});if(!i)throw new Error("No response received");return await(async e=>new Promise(((i,o)=>{const{state:s,polling_id:a}=e;"finished"!==s?Nt.recommendations.pollRecommendedPlaces(a,{start:!0,watch:"state",expect:"finished",onEachResponse:e=>{"finished"!==e.status?"failed"!==e.status||o(e):i(e)}}):i(e)})))(i)},createRecommendedSeats:async function createRecommendedSeats$1(e){try{vi.validateProps(e,Ri);const i=ti.getMixpanelDistinctId(),o=_t.getCachedFingerprint();if(!i)throw new Error("No distinct ID found");return await Nt.recommendations.createRecommendedSeats({...e,distinct_id:i,device_fingerprint:o||""})}catch(Or){throw console.error("Could not create recommended seats:",Or),new Error(Or instanceof Error?Or.message:String(Or))}},getRecommendedSeats:async function createRecommendedSeats(e){try{vi.validateProps(e,Pi);const i=ti.getMixpanelDistinctId();if(!i)throw new Error("No distinct ID found");return await Nt.recommendations.getRecommendedSeats({...e,distinct_id:i})}catch(Or){throw console.error("Could not create recommended seats:",Or),new Error(Or instanceof Error?Or.message:String(Or))}},getRecommendedTrips:async function getRecommendedTrips({searchId:e}){try{vi.validateProps({searchId:e},Di);const i=_t.getCachedFingerprint()||ti.getMixpanelDistinctId();if(!i)throw new Error("No identifier id");return await Nt.recommendations.getRecommendedTrips({searchId:e,userIdentifier:String(i)})}catch(Or){throw console.error("Could not get recommended trips:",Or),new Error(Or instanceof Error?Or.message:String(Or))}}},track:{search:function trackSearch(e,i={}){trackEvent("Search",e,i)},seatChange:function trackSeatChange(e,i={}){trackEvent("Seat Change",e,i)},interestInHome:function trackInterestInHome(e,i={}){trackEvent("Interest In Home",e,i)},interestInSearch:function trackInterestInSearch(e,i={}){trackEvent("Interest In Search",e,i)},viewResults:function trackViewResults(e,i={}){trackEvent("View Results",e,i)},passengersCreated:function trackPassengersCreated(e,i={}){trackEvent("Passengers Created",e,i)},paymentAttempt:async(e,i={})=>{trackEvent("Payment Attempt",e,i)},purchaseAttempt:function trackPurchaseAttempt(e,i={}){trackEvent("Purchase Attempt",e,i)},pickedDeparture:function trackSearch$1(e,i={}){trackEvent("Picked Departure",e,i)},customEvent:trackCustomEvent,purchaseCanceled:function trackPurchaseCanceled(e,i={}){trackEvent("Purchase Canceled",e,i)}}};module.exports=Zi;
30
+ function __awaiter2(e,r,i,s){return new(i||(i=Promise))((function(r,a){function fulfilled(e){try{step(s.next(e))}catch(r){a(r)}}function rejected(e){try{step(s.throw(e))}catch(r){a(r)}}function step(e){e.done?r(e.value):function adopt(e){return e instanceof i?e:new i((function(r){r(e)}))}(e.value).then(fulfilled,rejected)}step((s=s.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r="undefined"==typeof Uint8Array?[]:new Uint8Array(256),i=0;i<64;i++)r[e.charCodeAt(i)]=i;var encode2=function(r){var i,s=new Uint8Array(r),a=s.length,h="";for(i=0;i<a;i+=3)h+=e[s[i]>>2],h+=e[(3&s[i])<<4|s[i+1]>>4],h+=e[(15&s[i+1])<<2|s[i+2]>>6],h+=e[63&s[i+2]];return a%3==2?h=h.substring(0,h.length-1)+"=":a%3==1&&(h=h.substring(0,h.length-2)+"=="),h};const s=new Map,a=new Map;const h=self;h.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return h.postMessage({id:e.data.id});{const{id:r,bitmap:i,width:f,height:_,dataURLOptions:v}=e.data,b=function getTransparentBlobFor(e,r,i){return __awaiter2(this,0,void 0,(function*(){const s=`${e}-${r}`;if("OffscreenCanvas"in globalThis){if(a.has(s))return a.get(s);const h=new OffscreenCanvas(e,r);h.getContext("2d");const f=yield h.convertToBlob(i),_=yield f.arrayBuffer(),v=encode2(_);return a.set(s,v),v}return""}))}(f,_,v),S=new OffscreenCanvas(f,_);S.getContext("2d").drawImage(i,0,0),i.close();const I=yield S.convertToBlob(v),x=I.type,C=yield I.arrayBuffer(),T=encode2(C);if(!s.has(r)&&(yield b)===T)return s.set(r,T),h.postMessage({id:r});if(s.get(r)===T)return h.postMessage({id:r});h.postMessage({id:r,type:x,base64:T,width:f,height:_}),s.set(r,T)}}))}}()}));class CanvasManager{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,r)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(r)};const{sampling:r="all",win:i,blockClass:s,blockSelector:a,recordCanvas:h,dataURLOptions:f}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,h&&"all"===r&&this.initCanvasMutationObserver(i,s,a),h&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,s,a,{dataURLOptions:f})}initCanvasFPSObserver(e,r,i,s,a){const h=initCanvasContextObserver(r,i,s,!0),f=new Map,_=new hr;_.onmessage=e=>{const{id:r}=e.data;if(f.set(r,!1),!("base64"in e.data))return;const{base64:i,type:s,width:a,height:h}=e.data;this.mutationCb({id:r,type:ir["2D"],commands:[{property:"clearRect",args:[0,0,a,h]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:s}]},0,0]}]})};const v=1e3/e;let b,S=0;const takeCanvasSnapshots=e=>{S&&e-S<v||(S=e,(()=>{const e=[];return r.document.querySelectorAll("canvas").forEach((r=>{isBlocked(r,i,s,!0)||e.push(r)})),e})().forEach((e=>__awaiter(this,0,void 0,(function*(){var r;const i=this.mirror.getId(e);if(f.get(i))return;if(0===e.width||0===e.height)return;if(f.set(i,!0),["webgl","webgl2"].includes(e.__context)){const i=e.getContext(e.__context);!1===(null===(r=null==i?void 0:i.getContextAttributes())||void 0===r?void 0:r.preserveDrawingBuffer)&&i.clear(i.COLOR_BUFFER_BIT)}const s=yield createImageBitmap(e);_.postMessage({id:i,bitmap:s,width:e.width,height:e.height,dataURLOptions:a.dataURLOptions},[s])}))))),b=requestAnimationFrame(takeCanvasSnapshots)};b=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{h(),cancelAnimationFrame(b)}}initCanvasMutationObserver(e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const s=initCanvasContextObserver(e,r,i,!1),a=function initCanvas2DMutationObserver(e,r,i,s){const a=[],h=Object.getOwnPropertyNames(r.CanvasRenderingContext2D.prototype);for(const _ of h)try{if("function"!=typeof r.CanvasRenderingContext2D.prototype[_])continue;const h=patch(r.CanvasRenderingContext2D.prototype,_,(function(a){return function(...h){return isBlocked(this.canvas,i,s,!0)||setTimeout((()=>{const i=serializeArgs(h,r,this);e(this.canvas,{type:ir["2D"],property:_,args:i})}),0),a.apply(this,h)}}));a.push(h)}catch(f){const i=hookSetter(r.CanvasRenderingContext2D.prototype,_,{set(r){e(this.canvas,{type:ir["2D"],property:_,args:[r],setter:!0})}});a.push(i)}return()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,r,i),h=function initCanvasWebGLMutationObserver(e,r,i,s,a){const h=[];return h.push(...patchGLPrototype(r.WebGLRenderingContext.prototype,ir.WebGL,e,i,s,0,r)),void 0!==r.WebGL2RenderingContext&&h.push(...patchGLPrototype(r.WebGL2RenderingContext.prototype,ir.WebGL2,e,i,s,0,r)),()=>{h.forEach((e=>e()))}}(this.processMutation.bind(this),e,r,i,this.mirror);this.resetObservers=()=>{s(),a(),h()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=e=>{this.rafStamps.latestId=e,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,r)=>{const i=this.mirror.getId(r);this.flushPendingCanvasMutationFor(r,i)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,r){if(this.frozen||this.locked)return;const i=this.pendingCanvasMutations.get(e);if(!i||-1===r)return;const s=i.map((e=>{const r=function __rest(e,r){var i={};for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&r.indexOf(s)<0&&(i[s]=e[s]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(s=Object.getOwnPropertySymbols(e);a<s.length;a++)r.indexOf(s[a])<0&&Object.prototype.propertyIsEnumerable.call(e,s[a])&&(i[s[a]]=e[s[a]])}return i}(e,["type"]);return r})),{type:a}=i[0];this.mutationCb({id:r,type:a,commands:s}),this.pendingCanvasMutations.delete(e)}}class StylesheetManager{constructor(e){this.trackedLinkElements=new WeakSet,this.styleMirror=new StyleSheetMirror,this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,r){"_cssText"in r.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:r.id,attributes:r.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,r){if(0===e.length)return;const i={id:r,styleIds:[]},s=[];for(const a of e){let e;this.styleMirror.has(a)?e=this.styleMirror.getId(a):(e=this.styleMirror.add(a),s.push({styleId:e,rules:Array.from(a.rules||CSSRule,((e,r)=>({rule:stringifyRule(e),index:r})))})),i.styleIds.push(e)}s.length>0&&(i.styles=s),this.adoptedStyleSheetCb(i)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}}class ProcessedNodeManager{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(e,r){const i=this.nodeMap.get(e);return i&&Array.from(i).some((e=>e!==r))}add(e,r){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(r))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(e){return Object.assign(Object.assign({},e),{timestamp:Qt()})}let fr,mr,gr,_r=!1;const yr=function createMirror(){return new Mirror}();function record(e={}){const{emit:r,checkoutEveryNms:i,checkoutEveryNth:s,blockClass:a="rr-block",blockSelector:h=null,ignoreClass:f="rr-ignore",ignoreSelector:_=null,maskTextClass:v="rr-mask",maskTextSelector:b=null,inlineStylesheet:S=!0,maskAllInputs:I,maskInputOptions:x,slimDOMOptions:C,maskInputFn:T,maskTextFn:O,hooks:R,packFn:N,sampling:P={},dataURLOptions:D={},mousemoveWait:Z,recordDOM:A=!0,recordCanvas:L=!1,recordCrossOriginIframes:q=!1,recordAfter:$=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:U=!1,collectFonts:B=!1,inlineImages:z=!1,plugins:W,keepIframeSrcFn:K=()=>!1,ignoreCSSAttributes:G=new Set([]),errorHandler:J}=e;!function registerErrorHandler(e){or=e}(J);const Y=!q||window.parent===window;let X=!1;if(!Y)try{window.parent.document&&(X=!1)}catch(ae){X=!0}if(Y&&!r)throw new Error("emit function is required");void 0!==Z&&void 0===P.mousemove&&(P.mousemove=Z),yr.reset();const Q=!0===I?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:void 0!==x?x:{password:!0},ee=!0===C||"all"===C?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===C,headMetaDescKeywords:"all"===C}:C||{};let te;!function polyfill(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...e)=>{let r=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===r)return!0}while(r=r&&r.parentNode);return!1})}();let re=0;const eventProcessor=e=>{for(const r of W||[])r.eventProcessor&&(e=r.eventProcessor(e));return N&&!X&&(e=N(e)),e};fr=(e,a)=>{var h;if(!(null===(h=sr[0])||void 0===h?void 0:h.isFrozen())||e.type===er.FullSnapshot||e.type===er.IncrementalSnapshot&&e.data.source===tr.Mutation||sr.forEach((e=>e.unfreeze())),Y)null==r||r(eventProcessor(e),a);else if(X){const r={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:a};window.parent.postMessage(r,"*")}if(e.type===er.FullSnapshot)te=e,re=0;else if(e.type===er.IncrementalSnapshot){if(e.data.source===tr.Mutation&&e.data.isAttachIframe)return;re++;const r=s&&re>=s,a=i&&e.timestamp-te.timestamp>i;(r||a)&&mr(!0)}};const wrappedMutationEmit=e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Mutation},e)}))},wrappedScrollEmit=e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Scroll},e)})),wrappedCanvasMutationEmit=e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.CanvasMutation},e)})),ne=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.AdoptedStyleSheet},e)}))}),ie=new IframeManager({mirror:yr,mutationCb:wrappedMutationEmit,stylesheetManager:ne,recordCrossOriginIframes:q,wrappedEmit:fr});for(const ce of W||[])ce.getMirror&&ce.getMirror({nodeMirror:yr,crossOriginIframeMirror:ie.crossOriginIframeMirror,crossOriginIframeStyleMirror:ie.crossOriginIframeStyleMirror});const oe=new ProcessedNodeManager;gr=new CanvasManager({recordCanvas:L,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:a,blockSelector:h,mirror:yr,sampling:P.canvas,dataURLOptions:D});const se=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:a,blockSelector:h,maskTextClass:v,maskTextSelector:b,inlineStylesheet:S,maskInputOptions:Q,dataURLOptions:D,maskTextFn:O,maskInputFn:T,recordCanvas:L,inlineImages:z,sampling:P,slimDOMOptions:ee,iframeManager:ie,stylesheetManager:ne,canvasManager:gr,keepIframeSrcFn:K,processedNodeManager:oe},mirror:yr});mr=(e=!1)=>{if(!A)return;fr(wrapEvent({type:er.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),ne.reset(),se.init(),sr.forEach((e=>e.lock()));const r=function snapshot(e,r){const{mirror:i=new Mirror,blockClass:s="rr-block",blockSelector:a=null,maskTextClass:h="rr-mask",maskTextSelector:f=null,inlineStylesheet:_=!0,inlineImages:v=!1,recordCanvas:b=!1,maskAllInputs:S=!1,maskTextFn:I,maskInputFn:x,slimDOM:C=!1,dataURLOptions:T,preserveWhiteSpace:O,onSerialize:R,onIframeLoad:N,iframeLoadTimeout:P,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:A=()=>!1}=r||{};return serializeNodeWithId(e,{doc:e,mirror:i,blockClass:s,blockSelector:a,maskTextClass:h,maskTextSelector:f,skipChild:!1,inlineStylesheet:_,maskInputOptions:!0===S?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:!1===S?{password:!0}:S,maskTextFn:I,maskInputFn:x,slimDOMOptions:!0===C||"all"===C?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===C,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===C?{}:C,dataURLOptions:T,inlineImages:v,recordCanvas:b,preserveWhiteSpace:O,onSerialize:R,onIframeLoad:N,iframeLoadTimeout:P,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:A,newlyAddedElement:!1})}(document,{mirror:yr,blockClass:a,blockSelector:h,maskTextClass:v,maskTextSelector:b,inlineStylesheet:S,maskAllInputs:Q,maskTextFn:O,slimDOM:ee,dataURLOptions:D,recordCanvas:L,inlineImages:z,onSerialize:e=>{isSerializedIframe(e,yr)&&ie.addIframe(e),isSerializedStylesheet(e,yr)&&ne.trackLinkElement(e),hasShadowRoot(e)&&se.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,r)=>{ie.attachIframe(e,r),se.observeAttachShadow(e)},onStylesheetLoad:(e,r)=>{ne.attachLinkElement(e,r)},keepIframeSrcFn:K});if(!r)return console.warn("Failed to snapshot the document");fr(wrapEvent({type:er.FullSnapshot,data:{node:r,initialOffset:getWindowScroll(window)}}),e),sr.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ne.adoptStyleSheets(document.adoptedStyleSheets,yr.getId(document))};try{const e=[],observe=e=>{var r;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,r)=>fr(wrapEvent({type:er.IncrementalSnapshot,data:{source:r,positions:e}})),mouseInteractionCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.ViewportResize},e)})),inputCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Input},e)})),mediaInteractionCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.MediaInteraction},e)})),styleSheetRuleCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.StyleSheetRule},e)})),styleDeclarationCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Font},e)})),selectionCb:e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.Selection},e)}))},customElementCb:e=>{fr(wrapEvent({type:er.IncrementalSnapshot,data:Object.assign({source:tr.CustomElement},e)}))},blockClass:a,ignoreClass:f,ignoreSelector:_,maskTextClass:v,maskTextSelector:b,maskInputOptions:Q,inlineStylesheet:S,sampling:P,recordDOM:A,recordCanvas:L,inlineImages:z,userTriggeredOnInput:U,collectFonts:B,doc:e,maskInputFn:T,maskTextFn:O,keepIframeSrcFn:K,blockSelector:h,slimDOMOptions:ee,dataURLOptions:D,mirror:yr,iframeManager:ie,stylesheetManager:ne,shadowDomManager:se,processedNodeManager:oe,canvasManager:gr,ignoreCSSAttributes:G,plugins:(null===(r=null==W?void 0:W.filter((e=>e.observer)))||void 0===r?void 0:r.map((e=>({observer:e.observer,options:e.options,callback:r=>fr(wrapEvent({type:er.Plugin,data:{plugin:e.name,payload:r}}))}))))||[]},R)};ie.addLoadListener((r=>{try{e.push(observe(r.contentDocument))}catch(Or){console.warn(Or)}}));const init2=()=>{mr(),e.push(observe(document)),_r=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{fr(wrapEvent({type:er.DomContentLoaded,data:{}})),"DOMContentLoaded"===$&&init2()}))),e.push(on("load",(()=>{fr(wrapEvent({type:er.Load,data:{}})),"load"===$&&init2()}),window))),()=>{e.forEach((e=>e())),oe.destroy(),_r=!1,function unregisterErrorHandler(){or=void 0}()}}catch(Or){console.warn(Or)}}record.addCustomEvent=(e,r)=>{if(!_r)throw new Error("please add custom event after start recording");fr(wrapEvent({type:er.Custom,data:{tag:e,payload:r}}))},record.freezePage=()=>{sr.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!_r)throw new Error("please take full snapshot after start recording");mr(e)},record.mirror=yr;var vr,br=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(br||{}),Sr=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Sr||{}),kr={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var wr={hostname:""};vr={navigator:{userAgent:"",onLine:!0},document:{location:wr,referrer:""},screen:{width:0,height:0},location:wr}}else vr=window;var Ir,xr,Er,Cr,Tr,Or,Rr,Mr,Nr,Pr,Dr=864e5,Zr=8e3,Ar=Array.prototype,Lr=Function.prototype,jr=Object.prototype,Fr=Ar.slice,qr=jr.toString,$r=jr.hasOwnProperty,Ur=vr.console,Br=vr.navigator,zr=vr.document,Vr=vr.opera,Wr=vr.screen,Kr=Br.userAgent,Hr=Lr.bind,Gr=Ar.forEach,Jr=Ar.indexOf,Yr=Ar.map,Xr=Array.isArray,Qr={},en={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},tn={log:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur)try{Ur.log.apply(Ur,arguments)}catch(e){en.each(arguments,(function(e){Ur.log(e)}))}},warn:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur){var e=["Mixpanel warning:"].concat(en.toArray(arguments));try{Ur.warn.apply(Ur,e)}catch(r){en.each(e,(function(e){Ur.warn(e)}))}}},error:function(){if(kr.DEBUG&&!en.isUndefined(Ur)&&Ur){var e=["Mixpanel error:"].concat(en.toArray(arguments));try{Ur.error.apply(Ur,e)}catch(r){en.each(e,(function(e){Ur.error(e)}))}}},critical:function(){if(!en.isUndefined(Ur)&&Ur){var e=["Mixpanel error:"].concat(en.toArray(arguments));try{Ur.error.apply(Ur,e)}catch(r){en.each(e,(function(e){Ur.error(e)}))}}}},log_func_with_prefix=function(e,r){return function(){return arguments[0]="["+r+"] "+arguments[0],e.apply(tn,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(tn.log,e),error:log_func_with_prefix(tn.error,e),critical:log_func_with_prefix(tn.critical,e)}};en.bind=function(e,r){var i,s;if(Hr&&e.bind===Hr)return Hr.apply(e,Fr.call(arguments,1));if(!en.isFunction(e))throw new TypeError;return i=Fr.call(arguments,2),s=function(){if(!(this instanceof s))return e.apply(r,i.concat(Fr.call(arguments)));var a={};a.prototype=e.prototype;var h=new a;a.prototype=null;var f=e.apply(h,i.concat(Fr.call(arguments)));return Object(f)===f?f:h},s},en.each=function(e,r,i){if(null!=e)if(Gr&&e.forEach===Gr)e.forEach(r,i);else if(e.length===+e.length){for(var s=0,a=e.length;s<a;s++)if(s in e&&r.call(i,e[s],s,e)===Qr)return}else for(var h in e)if($r.call(e,h)&&r.call(i,e[h],h,e)===Qr)return},en.extend=function(e){return en.each(Fr.call(arguments,1),(function(r){for(var i in r)void 0!==r[i]&&(e[i]=r[i])})),e},en.isArray=Xr||function(e){return"[object Array]"===qr.call(e)},en.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(r){return!1}},en.isArguments=function(e){return!(!e||!$r.call(e,"callee"))},en.toArray=function(e){return e?e.toArray?e.toArray():en.isArray(e)||en.isArguments(e)?Fr.call(e):en.values(e):[]},en.map=function(e,r,i){if(Yr&&e.map===Yr)return e.map(r,i);var s=[];return en.each(e,(function(e){s.push(r.call(i,e))})),s},en.keys=function(e){var r=[];return null===e||en.each(e,(function(e,i){r[r.length]=i})),r},en.values=function(e){var r=[];return null===e||en.each(e,(function(e){r[r.length]=e})),r},en.include=function(e,r){var i=!1;return null===e?i:Jr&&e.indexOf===Jr?-1!=e.indexOf(r):(en.each(e,(function(e){if(i||(i=e===r))return Qr})),i)},en.includes=function(e,r){return-1!==e.indexOf(r)},en.inherit=function(e,r){return e.prototype=new r,e.prototype.constructor=e,e.superclass=r.prototype,e},en.isObject=function(e){return e===Object(e)&&!en.isArray(e)},en.isEmptyObject=function(e){if(en.isObject(e)){for(var r in e)if($r.call(e,r))return!1;return!0}return!1},en.isUndefined=function(e){return void 0===e},en.isString=function(e){return"[object String]"==qr.call(e)},en.isDate=function(e){return"[object Date]"==qr.call(e)},en.isNumber=function(e){return"[object Number]"==qr.call(e)},en.isElement=function(e){return!(!e||1!==e.nodeType)},en.encodeDates=function(e){return en.each(e,(function(r,i){en.isDate(r)?e[i]=en.formatDate(r):en.isObject(r)&&(e[i]=en.encodeDates(r))})),e},en.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},en.formatDate=function(e){function pad(e){return e<10?"0"+e:e}return e.getUTCFullYear()+"-"+pad(e.getUTCMonth()+1)+"-"+pad(e.getUTCDate())+"T"+pad(e.getUTCHours())+":"+pad(e.getUTCMinutes())+":"+pad(e.getUTCSeconds())},en.strip_empty_properties=function(e){var r={};return en.each(e,(function(e,i){en.isString(e)&&e.length>0&&(r[i]=e)})),r},en.truncate=function(e,r){var i;return"string"==typeof e?i=e.slice(0,r):en.isArray(e)?(i=[],en.each(e,(function(e){i.push(en.truncate(e,r))}))):en.isObject(e)?(i={},en.each(e,(function(e,s){i[s]=en.truncate(e,r)}))):i=e,i},en.JSONEncode=function(){return function(e){var quote=function(e){var r=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,i={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return r.lastIndex=0,r.test(e)?'"'+e.replace(r,(function(e){var r=i[e];return"string"==typeof r?r:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,r){var i="",s=0,a="",h="",f=0,_=i,v=[],b=r[e];switch(b&&"object"==typeof b&&"function"==typeof b.toJSON&&(b=b.toJSON(e)),typeof b){case"string":return quote(b);case"number":return isFinite(b)?String(b):"null";case"boolean":case"null":return String(b);case"object":if(!b)return"null";if(i+=" ",v=[],"[object Array]"===qr.apply(b)){for(f=b.length,s=0;s<f;s+=1)v[s]=str(s,b)||"null";return h=0===v.length?"[]":i?"[\n"+i+v.join(",\n"+i)+"\n"+_+"]":"["+v.join(",")+"]",i=_,h}for(a in b)$r.call(b,a)&&(h=str(a,b))&&v.push(quote(a)+(i?": ":":")+h);return h=0===v.length?"{}":i?"{"+v.join(",")+_+"}":"{"+v.join(",")+"}",i=_,h}};return str("",{"":e})}}(),en.JSONDecode=(Tr={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Or=function(e){var r=new SyntaxError(e);throw r.at=Ir,r.text=Er,r},Rr=function(e){return e&&e!==xr&&Or("Expected '"+e+"' instead of '"+xr+"'"),xr=Er.charAt(Ir),Ir+=1,xr},Mr=function(){var e,r="";for("-"===xr&&(r="-",Rr("-"));xr>="0"&&xr<="9";)r+=xr,Rr();if("."===xr)for(r+=".";Rr()&&xr>="0"&&xr<="9";)r+=xr;if("e"===xr||"E"===xr)for(r+=xr,Rr(),"-"!==xr&&"+"!==xr||(r+=xr,Rr());xr>="0"&&xr<="9";)r+=xr,Rr();if(e=+r,isFinite(e))return e;Or("Bad number")},Nr=function(){var e,r,i,s="";if('"'===xr)for(;Rr();){if('"'===xr)return Rr(),s;if("\\"===xr)if(Rr(),"u"===xr){for(i=0,r=0;r<4&&(e=parseInt(Rr(),16),isFinite(e));r+=1)i=16*i+e;s+=String.fromCharCode(i)}else{if("string"!=typeof Tr[xr])break;s+=Tr[xr]}else s+=xr}Or("Bad string")},Pr=function(){for(;xr&&xr<=" ";)Rr()},Cr=function(){switch(Pr(),xr){case"{":return function(){var e,r={};if("{"===xr){if(Rr("{"),Pr(),"}"===xr)return Rr("}"),r;for(;xr;){if(e=Nr(),Pr(),Rr(":"),Object.hasOwnProperty.call(r,e)&&Or('Duplicate key "'+e+'"'),r[e]=Cr(),Pr(),"}"===xr)return Rr("}"),r;Rr(","),Pr()}}Or("Bad object")}();case"[":return function(){var e=[];if("["===xr){if(Rr("["),Pr(),"]"===xr)return Rr("]"),e;for(;xr;){if(e.push(Cr()),Pr(),"]"===xr)return Rr("]"),e;Rr(","),Pr()}}Or("Bad array")}();case'"':return Nr();case"-":return Mr();default:return xr>="0"&&xr<="9"?Mr():function(){switch(xr){case"t":return Rr("t"),Rr("r"),Rr("u"),Rr("e"),!0;case"f":return Rr("f"),Rr("a"),Rr("l"),Rr("s"),Rr("e"),!1;case"n":return Rr("n"),Rr("u"),Rr("l"),Rr("l"),null}Or('Unexpected "'+xr+'"')}()}},function(e){var r;return Er=e,Ir=0,xr=" ",r=Cr(),Pr(),xr&&Or("Syntax error"),r}),en.base64Encode=function(e){var r,i,s,a,h,f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_=0,v=0,b="",S=[];if(!e)return e;e=en.utf8Encode(e);do{r=(h=e.charCodeAt(_++)<<16|e.charCodeAt(_++)<<8|e.charCodeAt(_++))>>18&63,i=h>>12&63,s=h>>6&63,a=63&h,S[v++]=f.charAt(r)+f.charAt(i)+f.charAt(s)+f.charAt(a)}while(_<e.length);switch(b=S.join(""),e.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b},en.utf8Encode=function(e){var r,i,s,a,h="";for(r=i=0,s=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,a=0;a<s;a++){var f=e.charCodeAt(a),_=null;f<128?i++:_=f>127&&f<2048?String.fromCharCode(f>>6|192,63&f|128):String.fromCharCode(f>>12|224,f>>6&63|128,63&f|128),null!==_&&(i>r&&(h+=e.substring(r,i)),h+=_,r=i=a+1)}return i>r&&(h+=e.substring(r,e.length)),h},en.UUID=function(){var T2=function(){var e,r=1*new Date;if(vr.performance&&vr.performance.now)e=vr.performance.now();else for(e=0;r==1*new Date;)e++;return r.toString(16)+Math.floor(e).toString(16)};return function(){var e=(Wr.height*Wr.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,r,i=Kr,s=[],a=0;function xor(e,r){var i,a=0;for(i=0;i<r.length;i++)a|=s[i]<<8*i;return e^a}for(e=0;e<i.length;e++)r=i.charCodeAt(e),s.unshift(255&r),s.length>=4&&(a=xor(a,s),s=[]);return s.length>0&&(a=xor(a,s)),a.toString(16)}()+"-"+e+"-"+T2()}}();var rn=["ahrefsbot","ahrefssiteaudit","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];en.isBlockedUA=function(e){var r;for(e=e.toLowerCase(),r=0;r<rn.length;r++)if(-1!==e.indexOf(rn[r]))return!0;return!1},en.HTTPBuildQuery=function(e,r){var i,s,a=[];return en.isUndefined(r)&&(r="&"),en.each(e,(function(e,r){i=encodeURIComponent(e.toString()),s=encodeURIComponent(r),a[a.length]=s+"="+i})),a.join(r)},en.getQueryParam=function(e,r){r=r.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var i=new RegExp("[\\?&]"+r+"=([^&#]*)").exec(e);if(null===i||i&&"string"!=typeof i[1]&&i[1].length)return"";var s=i[1];try{s=decodeURIComponent(s)}catch(a){tn.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},en.cookie={get:function(e){for(var r=e+"=",i=zr.cookie.split(";"),s=0;s<i.length;s++){for(var a=i[s];" "==a.charAt(0);)a=a.substring(1,a.length);if(0===a.indexOf(r))return decodeURIComponent(a.substring(r.length,a.length))}return null},parse:function(e){var r;try{r=en.JSONDecode(en.cookie.get(e))||{}}catch(i){}return r},set_seconds:function(e,r,i,s,a,h,f){var _="",v="",b="";if(f)_="; domain="+f;else if(s){var S=extract_domain(zr.location.hostname);_=S?"; domain=."+S:""}if(i){var I=new Date;I.setTime(I.getTime()+1e3*i),v="; expires="+I.toGMTString()}h&&(a=!0,b="; SameSite=None"),a&&(b+="; secure"),zr.cookie=e+"="+encodeURIComponent(r)+v+"; path=/"+_+b},set:function(e,r,i,s,a,h,f){var _="",v="",b="";if(f)_="; domain="+f;else if(s){var S=extract_domain(zr.location.hostname);_=S?"; domain=."+S:""}if(i){var I=new Date;I.setTime(I.getTime()+24*i*60*60*1e3),v="; expires="+I.toGMTString()}h&&(a=!0,b="; SameSite=None"),a&&(b+="; secure");var x=e+"="+encodeURIComponent(r)+v+"; path=/"+_+b;return zr.cookie=x,x},remove:function(e,r,i){en.cookie.set(e,"",-1,r,!1,!1,i)}};var nn=null,localStorageSupported=function(e,r){if(null!==nn&&!r)return nn;var i=!0;try{e=e||window.localStorage;var s="__mplss_"+cheap_guid(8);e.setItem(s,"xyz"),"xyz"!==e.getItem(s)&&(i=!1),e.removeItem(s)}catch(a){i=!1}return nn=i,i};en.localStorage={is_supported:function(e){var r=localStorageSupported(null,e);return r||tn.error("localStorage unsupported; falling back to cookie store"),r},error:function(e){tn.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(r){en.localStorage.error(r)}return null},parse:function(e){try{return en.JSONDecode(en.localStorage.get(e))||{}}catch(r){}return null},set:function(e,r){try{window.localStorage.setItem(e,r)}catch(i){en.localStorage.error(i)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(r){en.localStorage.error(r)}}},en.register_event=function(){function fixEvent(e){return e&&(e.preventDefault=fixEvent.preventDefault,e.stopPropagation=fixEvent.stopPropagation),e}return fixEvent.preventDefault=function(){this.returnValue=!1},fixEvent.stopPropagation=function(){this.cancelBubble=!0},function(e,r,i,s,a){if(e)if(e.addEventListener&&!s)e.addEventListener(r,i,!!a);else{var h="on"+r,f=e[h];e[h]=function makeHandler(e,r,i){var handler=function(s){if(s=s||fixEvent(window.event)){var a,h,f=!0;return en.isFunction(i)&&(a=i(s)),h=r.call(e,s),!1!==a&&!1!==h||(f=!1),f}};return handler}(e,i,f)}else tn.error("No valid element provided to register_event")}}();var sn=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');en.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(r,i){var s=" "+i+" ";return(" "+r.className+" ").replace(e," ").indexOf(s)>=0}function getElementsBySelector(e){if(!zr.getElementsByTagName)return[];var r,i,s,a,h,f,_,v,b,S,I=e.split(" "),x=[zr];for(f=0;f<I.length;f++)if((r=I[f].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){s=(i=r.split("#"))[0];var C=i[1],T=zr.getElementById(C);if(!T||s&&T.nodeName.toLowerCase()!=s)return[];x=[T]}else if(r.indexOf(".")>-1){s=(i=r.split("."))[0];var O=i[1];for(s||(s="*"),a=[],h=0,_=0;_<x.length;_++)for(b="*"==s?getAllChildren(x[_]):x[_].getElementsByTagName(s),v=0;v<b.length;v++)a[h++]=b[v];for(x=[],S=0,_=0;_<a.length;_++)a[_].className&&en.isString(a[_].className)&&hasClass(a[_],O)&&(x[S++]=a[_])}else{var R=r.match(sn);if(R){s=R[1];var N,P=R[2],D=R[3],Z=R[4];for(s||(s="*"),a=[],h=0,_=0;_<x.length;_++)for(b="*"==s?getAllChildren(x[_]):x[_].getElementsByTagName(s),v=0;v<b.length;v++)a[h++]=b[v];switch(x=[],S=0,D){case"=":N=function(e){return e.getAttribute(P)==Z};break;case"~":N=function(e){return e.getAttribute(P).match(new RegExp("\\b"+Z+"\\b"))};break;case"|":N=function(e){return e.getAttribute(P).match(new RegExp("^"+Z+"-?"))};break;case"^":N=function(e){return 0===e.getAttribute(P).indexOf(Z)};break;case"$":N=function(e){return e.getAttribute(P).lastIndexOf(Z)==e.getAttribute(P).length-Z.length};break;case"*":N=function(e){return e.getAttribute(P).indexOf(Z)>-1};break;default:N=function(e){return e.getAttribute(P)}}for(x=[],S=0,_=0;_<a.length;_++)N(a[_])&&(x[S++]=a[_])}else{for(s=r,a=[],h=0,_=0;_<x.length;_++)for(b=x[_].getElementsByTagName(s),v=0;v<b.length;v++)a[h++]=b[v];x=a}}return x}return function(e){return en.isElement(e)?[e]:en.isObject(e)&&!en.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var an=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],cn=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];en.info={campaignParams:function(e){var r="",i={};return en.each(an,(function(s){(r=en.getQueryParam(zr.URL,s)).length?i[s]=r:void 0!==e&&(i[s]=e)})),i},clickParams:function(){var e="",r={};return en.each(cn,(function(i){(e=en.getQueryParam(zr.URL,i)).length&&(r[i]=e)})),r},marketingParams:function(){return en.extend(en.info.campaignParams(),en.info.clickParams())},searchEngine:function(e){return 0===e.search("https?://(.*)google.([^/?]*)")?"google":0===e.search("https?://(.*)bing.com")?"bing":0===e.search("https?://(.*)yahoo.com")?"yahoo":0===e.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},searchInfo:function(e){var r=en.info.searchEngine(e),i="yahoo"!=r?"q":"p",s={};if(null!==r){s.$search_engine=r;var a=en.getQueryParam(e,i);a.length&&(s.mp_keyword=a)}return s},browser:function(e,r,i){return r=r||"",i||en.includes(e," OPR/")?en.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":en.includes(e,"IEMobile")||en.includes(e,"WPDesktop")?"Internet Explorer Mobile":en.includes(e,"SamsungBrowser/")?"Samsung Internet":en.includes(e,"Edge")||en.includes(e,"Edg/")?"Microsoft Edge":en.includes(e,"FBIOS")?"Facebook Mobile":en.includes(e,"Chrome")?"Chrome":en.includes(e,"CriOS")?"Chrome iOS":en.includes(e,"UCWEB")||en.includes(e,"UCBrowser")?"UC Browser":en.includes(e,"FxiOS")?"Firefox iOS":en.includes(r,"Apple")?en.includes(e,"Mobile")?"Mobile Safari":"Safari":en.includes(e,"Android")?"Android Mobile":en.includes(e,"Konqueror")?"Konqueror":en.includes(e,"Firefox")?"Firefox":en.includes(e,"MSIE")||en.includes(e,"Trident/")?"Internet Explorer":en.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,r,i){var s={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/}[en.info.browser(e,r,i)];if(void 0===s)return null;var a=e.match(s);return a?parseFloat(a[a.length-2]):null},os:function(){var e=Kr;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var r=e.split("/");return r.length>=3?r[2]:""},currentUrl:function(){return vr.location.href},properties:function(e){return"object"!=typeof e&&(e={}),en.extend(en.strip_empty_properties({$os:en.info.os(),$browser:en.info.browser(Kr,Br.vendor,Vr),$referrer:zr.referrer,$referring_domain:en.info.referringDomain(zr.referrer),$device:en.info.device(Kr)}),{$current_url:en.info.currentUrl(),$browser_version:en.info.browserVersion(Kr,Br.vendor,Vr),$screen_height:Wr.height,$screen_width:Wr.width,mp_lib:"web",$lib_version:kr.LIB_VERSION,$insert_id:cheap_guid(),time:en.timestamp()/1e3},en.strip_empty_properties(e))},people_properties:function(){return en.extend(en.strip_empty_properties({$os:en.info.os(),$browser:en.info.browser(Kr,Br.vendor,Vr)}),{$browser_version:en.info.browserVersion(Kr,Br.vendor,Vr)})},mpPageViewProperties:function(){return en.strip_empty_properties({current_page_title:zr.title,current_domain:vr.location.hostname,current_url_path:vr.location.pathname,current_url_protocol:vr.location.protocol,current_url_search:vr.location.search})}};var cheap_guid=function(e){var r=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?r.substring(0,e):r},dn=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,un=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var r=un,i=e.split("."),s=i[i.length-1];(s.length>4||"com"===s||"org"===s)&&(r=dn);var a=e.match(r);return a?a[0]:""},ln=null,pn=null;"undefined"!=typeof JSON&&(ln=JSON.stringify,pn=JSON.parse),ln=ln||en.JSONEncode,pn=pn||en.JSONDecode,en.toArray=en.toArray,en.isObject=en.isObject,en.JSONEncode=en.JSONEncode,en.JSONDecode=en.JSONDecode,en.isBlockedUA=en.isBlockedUA,en.isEmptyObject=en.isEmptyObject,en.info=en.info,en.info.device=en.info.device,en.info.browser=en.info.browser,en.info.browserVersion=en.info.browserVersion,en.info.properties=en.info.properties;var hn="__mp_opt_in_out_";function optIn(e,r){_optInOut(!0,e,r)}function optOut(e,r){_optInOut(!1,e,r)}function hasOptedIn(e,r){return"1"===_getStorageValue(e,r)}function hasOptedOut(e,r){if(function _hasDoNotTrackFlagOn(e){if(e&&e.ignoreDnt)return!1;var r=e&&e.window||vr,i=r.navigator||{},s=!1;return en.each([i.doNotTrack,i.msDoNotTrack,r.doNotTrack],(function(e){en.includes([!0,1,"1","yes"],e)&&(s=!0)})),s}(r))return tn.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var i="0"===_getStorageValue(e,r);return i&&tn.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),i}function addOptOutCheckMixpanelLib(e){return _addOptOutCheck(e,(function(e){return this.get_config(e)}))}function addOptOutCheckMixpanelPeople(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function addOptOutCheckMixpanelGroup(e){return _addOptOutCheck(e,(function(e){return this._get_config(e)}))}function clearOptInOut(e,r){_getStorage(r=r||{}).remove(_getStorageKey(e,r),!!r.crossSubdomainCookie,r.cookieDomain)}function _getStorage(e){return"localStorage"===(e=e||{}).persistenceType?en.localStorage:en.cookie}function _getStorageKey(e,r){return((r=r||{}).persistencePrefix||hn)+e}function _getStorageValue(e,r){return _getStorage(r).get(_getStorageKey(e,r))}function _optInOut(e,r,i){en.isString(r)&&r.length?(_getStorage(i=i||{}).set(_getStorageKey(r,i),e?1:0,en.isNumber(i.cookieExpiration)?i.cookieExpiration:null,!!i.crossSubdomainCookie,!!i.secureCookie,!!i.crossSiteCookie,i.cookieDomain),i.track&&e&&i.track(i.trackEventName||"$opt_in",i.trackProperties,{send_immediately:!0})):tn.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,r){return function(){var i=!1;try{var s=r.call(this,"token"),a=r.call(this,"ignore_dnt"),h=r.call(this,"opt_out_tracking_persistence_type"),f=r.call(this,"opt_out_tracking_cookie_prefix"),_=r.call(this,"window");s&&(i=hasOptedOut(s,{ignoreDnt:a,persistenceType:h,persistencePrefix:f,window:_}))}catch(b){tn.error("Unexpected error when checking tracking opt-out status: "+b)}if(!i)return e.apply(this,arguments);var v=arguments[arguments.length-1];"function"==typeof v&&v(0)}}var fn=console_with_prefix("lock"),SharedLock=function(e,r){r=r||{},this.storageKey=e,this.storage=r.storage||window.localStorage,this.pollIntervalMS=r.pollIntervalMS||100,this.timeoutMS=r.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,r,i){i||"function"==typeof r||(i=r,r=null);var s=i||(new Date).getTime()+"|"+Math.random(),a=(new Date).getTime(),h=this.storageKey,f=this.pollIntervalMS,_=this.timeoutMS,v=this.storage,b=h+":X",S=h+":Y",I=h+":Z",reportError=function(e){r&&r(e)},delay=function(e){if((new Date).getTime()-a>_)return fn.error("Timeout waiting for mutex on "+h+"; clearing lock. ["+s+"]"),v.removeItem(I),v.removeItem(S),void loop();setTimeout((function(){try{e()}catch(r){reportError(r)}}),f*(Math.random()+.1))},waitFor=function(e,r){e()?r():delay((function(){waitFor(e,r)}))},getSetY=function(){var e=v.getItem(S);if(e&&e!==s)return!1;if(v.setItem(S,s),v.getItem(S)===s)return!0;if(!localStorageSupported(v,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){v.setItem(b,s),waitFor(getSetY,(function(){v.getItem(b)!==s?delay((function(){v.getItem(S)===s?waitFor((function(){return!v.getItem(I)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){v.setItem(I,"1");try{e()}finally{v.removeItem(I),v.getItem(S)===s&&v.removeItem(S),v.getItem(b)===s&&v.removeItem(b)}};try{if(!localStorageSupported(v,!0))throw new Error("localStorage support check failed");loop()}catch(x){reportError(x)}};var mn=console_with_prefix("batch"),RequestQueue=function(e,r){r=r||{},this.storageKey=e,this.storage=r.storage||window.localStorage,this.reportError=r.errorReporter||en.bind(mn.error,mn),this.lock=new SharedLock(e,{storage:this.storage}),this.usePersistence=r.usePersistence,this.pid=r.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(e,r,i){var s={id:cheap_guid(),flushAfter:(new Date).getTime()+2*r,payload:e};this.usePersistence?this.lock.withLock(en.bind((function lockAcquired(){var r;try{var a=this.readFromStorage();a.push(s),(r=this.saveToStorage(a))&&this.memQueue.push(s)}catch(h){this.reportError("Error enqueueing item",e),r=!1}i&&i(r)}),this),en.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),i&&i(!1)}),this),this.pid):(this.memQueue.push(s),i&&i(!0))},RequestQueue.prototype.fillBatch=function(e){var r=this.memQueue.slice(0,e);if(this.usePersistence&&r.length<e){var i=this.readFromStorage();if(i.length){var s={};en.each(r,(function(e){s[e.id]=!0}));for(var a=0;a<i.length;a++){var h=i[a];if((new Date).getTime()>h.flushAfter&&!s[h.id]&&(h.orphaned=!0,r.push(h),r.length>=e))break}}}return r};var filterOutIDsAndInvalid=function(e,r){var i=[];return en.each(e,(function(e){e.id&&!r[e.id]&&i.push(e)})),i};RequestQueue.prototype.removeItemsByID=function(e,r){var i={};if(en.each(e,(function(e){i[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,i),this.usePersistence){var s=en.bind((function(){var r;try{var s=this.readFromStorage();if(s=filterOutIDsAndInvalid(s,i),r=this.saveToStorage(s)){s=this.readFromStorage();for(var a=0;a<s.length;a++){var h=s[a];if(h.id&&i[h.id])return this.reportError("Item not removed from storage"),!1}}}catch(f){this.reportError("Error removing items",e),r=!1}return r}),this);this.lock.withLock((function lockAcquired(){var e=s();r&&r(e)}),en.bind((function lockFailure(e){var i=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(i=s()))try{this.storage.removeItem(this.storageKey)}catch(a){this.reportError("Error clearing queue",a)}r&&r(i)}),this),this.pid)}else r&&r(!0)};var updatePayloads=function(e,r){var i=[];return en.each(e,(function(e){var s=e.id;if(s in r){var a=r[s];null!==a&&(e.payload=a,i.push(e))}else i.push(e)})),i};RequestQueue.prototype.updatePayloads=function(e,r){this.memQueue=updatePayloads(this.memQueue,e),this.usePersistence?this.lock.withLock(en.bind((function lockAcquired(){var i;try{var s=this.readFromStorage();s=updatePayloads(s,e),i=this.saveToStorage(s)}catch(a){this.reportError("Error updating items",e),i=!1}r&&r(i)}),this),en.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),r&&r(!1)}),this),this.pid):r&&r(!0)},RequestQueue.prototype.readFromStorage=function(){var e;try{(e=this.storage.getItem(this.storageKey))&&(e=pn(e),en.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null))}catch(r){this.reportError("Error retrieving queue",r),e=null}return e||[]},RequestQueue.prototype.saveToStorage=function(e){try{return this.storage.setItem(this.storageKey,ln(e)),!0}catch(r){return this.reportError("Error saving queue",r),!1}},RequestQueue.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var gn=console_with_prefix("batch"),RequestBatcher=function(e,r){this.errorReporter=r.errorReporter,this.queue=new RequestQueue(e,{errorReporter:en.bind(this.reportError,this),storage:r.storage,usePersistence:r.usePersistence}),this.libConfig=r.libConfig,this.sendRequest=r.sendRequestFunc,this.beforeSendHook=r.beforeSendHook,this.stopAllBatching=r.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=r.flushOnlyOnInterval||!1};RequestBatcher.prototype.enqueue=function(e,r){this.queue.enqueue(e,this.flushInterval,r)},RequestBatcher.prototype.start=function(){this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},RequestBatcher.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},RequestBatcher.prototype.clear=function(){this.queue.clear()},RequestBatcher.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},RequestBatcher.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},RequestBatcher.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(en.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void gn.log("Flush: Request already in progress");e=e||{};var r=this.libConfig.batch_request_timeout_ms,i=(new Date).getTime(),s=this.batchSize,a=this.queue.fillBatch(s),h=a.length===s,f=[],_={};if(en.each(a,(function(e){var r=e.payload;if(this.beforeSendHook&&!e.orphaned&&(r=this.beforeSendHook(r)),r){r.event&&r.properties&&(r.properties=en.extend({},r.properties,{mp_sent_by_lib_version:kr.LIB_VERSION}));var i=!0,s=e.id;s?(this.itemIdsSentSuccessfully[s]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:a.length,timesSent:this.itemIdsSentSuccessfully[s]}),i=!1):this.reportError("[dupe] found item with no ID",{item:e}),i&&f.push(r)}_[e.id]=r}),this),f.length<1)return void this.resetFlush();this.requestInProgress=!0;var v=en.bind((function(f){this.requestInProgress=!1;try{var v=!1;if(e.unloading)this.queue.updatePayloads(_);else if(en.isObject(f)&&"timeout"===f.error&&(new Date).getTime()-i>=r)this.reportError("Network timeout; retrying"),this.flush();else if(en.isObject(f)&&(f.httpStatusCode>=500||429===f.httpStatusCode||f.httpStatusCode<=0&&(I=vr.navigator.onLine,!en.isUndefined(I)&&!I)||"timeout"===f.error)){var b=2*this.flushInterval;f.retryAfter&&(b=1e3*parseInt(f.retryAfter,10)||b),b=Math.min(6e5,b),this.reportError("Error; retry in "+b+" ms"),this.scheduleFlush(b)}else if(en.isObject(f)&&413===f.httpStatusCode)if(a.length>1){var S=Math.max(1,Math.floor(s/2));this.batchSize=Math.min(this.batchSize,S,a.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",a),this.resetBatchSize(),v=!0;else v=!0;v&&(this.queue.removeItemsByID(en.map(a,(function(e){return e.id})),en.bind((function(e){e?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!h?this.resetFlush():this.flush()):(this.reportError("Failed to remove items from queue"),++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush())}),this)),en.each(a,en.bind((function(e){var r=e.id;r?(this.itemIdsSentSuccessfully[r]=this.itemIdsSentSuccessfully[r]||0,this.itemIdsSentSuccessfully[r]++,this.itemIdsSentSuccessfully[r]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:a.length,timesSent:this.itemIdsSentSuccessfully[r]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(x){this.reportError("Error handling API response",x),this.resetFlush()}var I}),this),b={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:r};e.unloading&&(b.transport="sendBeacon"),gn.log("MIXPANEL REQUEST:",f),this.sendRequest(f,b,v)}catch(S){this.reportError("Error flushing request queue",S),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,r){if(gn.error.apply(gn.error,arguments),this.errorReporter)try{r instanceof Error||(r=new Error(e)),this.errorReporter(e,r)}catch(i){gn.error(i)}};var _n=console_with_prefix("recorder"),yn=vr.CompressionStream,vn={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},bn=new Set([Sr.MouseMove,Sr.MouseInteraction,Sr.Scroll,Sr.ViewportResize,Sr.Input,Sr.TouchMove,Sr.MediaInteraction,Sr.Drag,Sr.Selection]);var MixpanelRecorder=function(e){this._mixpanel=e,this._stopRecording=null,this.recEvents=[],this.seqNo=0,this.replayId=null,this.replayStartTime=null,this.sendBatchId=null,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=Dr,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:vn,sendRequestFunc:en.bind(this.flushEventsWithOptOut,this),errorReporter:en.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},MixpanelRecorder.prototype.get_config=function(e){return this._mixpanel.get_config(e)},MixpanelRecorder.prototype.startRecording=function(e){if(null===this._stopRecording){this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>Dr&&(this.recordMaxMs=Dr,_n.critical("record_max_ms cannot be greater than "+Dr+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>Zr&&(this.recordMinMs=Zr,_n.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=en.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var r=en.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(en.bind((function(){_n.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),i=this.get_config("record_block_selector");""!==i&&null!==i||(i=void 0),this._stopRecording=record({emit:en.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===br.IncrementalSnapshot&&bn.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),r())}),this),blockClass:this.get_config("record_block_class"),blockSelector:i,collectFonts:this.get_config("record_collect_fonts"),inlineImages:this.get_config("record_inline_images"),maskAllInputs:!0,maskTextClass:this.get_config("record_mask_text_class"),maskTextSelector:this.get_config("record_mask_text_selector")}),r(),this.maxTimeoutId=setTimeout(en.bind(this.resetRecording,this),this.recordMaxMs)}else _n.log("Recording already in progress, skipping startRecording.")},MixpanelRecorder.prototype.resetRecording=function(){this.stopRecording(),this.startRecording(!0)},MixpanelRecorder.prototype.stopRecording=function(){null!==this._stopRecording&&(this._stopRecording(),this._stopRecording=null),this.batcher.stopped?this.batcher.clear():(this.batcher.flush(),this.batcher.stop()),this.replayId=null,clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId)},MixpanelRecorder.prototype.flushEventsWithOptOut=function(e,r,i){this._flushEvents(e,r,i,en.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,r,i,s){var a=en.bind((function(r,i){200===r.status&&this.replayId===e&&this.seqNo++,s({status:0,httpStatusCode:r.status,responseBody:i,retryAfter:r.headers.get("Retry-After")})}),this);vr.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(r),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:i}).then((function(e){e.json().then((function(r){a(e,r)})).catch((function(e){s({error:e})}))})).catch((function(e){s({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,r,i){const s=e.length;if(s>0){var a=this.replayId,h=e[0].timestamp;0!==this.seqNo&&this.replayStartTime||(0!==this.seqNo&&this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=h);var f=e[s-1].timestamp-this.replayStartTime,_={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:h/1e3,replay_id:a,replay_length_ms:f,replay_start_time:this.replayStartTime/1e3},v=en.JSONEncode(e),b=this._mixpanel.get_property("$device_id");b&&(_.$device_id=b);var S=this._mixpanel.get_property("$user_id");if(S&&(_.$user_id=S),yn){var I=new Blob([v],{type:"application/json"}).stream().pipeThrough(new yn("gzip"));new Response(I).blob().then(en.bind((function(e){_.format="gzip",this._sendRequest(a,_,e,i)}),this))}else _.format="body",this._sendRequest(a,_,v,i)}})),MixpanelRecorder.prototype.reportError=function(e,r){_n.error.apply(_n.error,arguments);try{r||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,r)}catch(i){_n.error(i)}},vr.__mp_recorder=MixpanelRecorder;var DomTracker=function(){};DomTracker.prototype.create_properties=function(){},DomTracker.prototype.event_handler=function(){},DomTracker.prototype.after_track_handler=function(){},DomTracker.prototype.init=function(e){return this.mp=e,this},DomTracker.prototype.track=function(e,r,i,s){var a=this,h=en.dom_query(e);if(0!==h.length)return en.each(h,(function(e){en.register_event(e,this.override_event,(function(e){var h={},f=a.create_properties(i,this),_=a.mp.get_config("track_links_timeout");a.event_handler(e,this,h),window.setTimeout(a.track_callback(s,f,h,!0),_),a.mp.track(r,f,a.track_callback(s,f,h))}))}),this),!0;tn.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,r,i,s){s=s||!1;var a=this;return function(){i.callback_fired||(i.callback_fired=!0,e&&!1===e(s,r)||a.after_track_handler(r,i,s))}},DomTracker.prototype.create_properties=function(e,r){return"function"==typeof e?e(r):en.extend({},e)};var LinkTracker=function(){this.override_event="click"};en.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(e,r){var i=LinkTracker.superclass.create_properties.apply(this,arguments);return r.href&&(i.url=r.href),i},LinkTracker.prototype.event_handler=function(e,r,i){i.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===r.target,i.href=r.href,i.new_tab||e.preventDefault()},LinkTracker.prototype.after_track_handler=function(e,r){r.new_tab||setTimeout((function(){window.location=r.href}),0)};var FormTracker=function(){this.override_event="submit"};en.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(e,r,i){i.element=r,e.preventDefault()},FormTracker.prototype.after_track_handler=function(e,r){setTimeout((function(){r.element.submit()}),0)};var Sn="$set",kn="$set_once",wn="$unset",In="$add",xn="$append",En="$union",Cn="$remove",Tn={set_action:function(e,r){var i={},s={};return en.isObject(e)?en.each(e,(function(e,r){this._is_reserved_property(r)||(s[r]=e)}),this):s[e]=r,i[Sn]=s,i},unset_action:function(e){var r={},i=[];return en.isArray(e)||(e=[e]),en.each(e,(function(e){this._is_reserved_property(e)||i.push(e)}),this),r[wn]=i,r},set_once_action:function(e,r){var i={},s={};return en.isObject(e)?en.each(e,(function(e,r){this._is_reserved_property(r)||(s[r]=e)}),this):s[e]=r,i[kn]=s,i},union_action:function(e,r){var i={},s={};return en.isObject(e)?en.each(e,(function(e,r){this._is_reserved_property(r)||(s[r]=en.isArray(e)?e:[e])}),this):s[e]=en.isArray(r)?r:[r],i[En]=s,i},append_action:function(e,r){var i={},s={};return en.isObject(e)?en.each(e,(function(e,r){this._is_reserved_property(r)||(s[r]=e)}),this):s[e]=r,i[xn]=s,i},remove_action:function(e,r){var i={},s={};return en.isObject(e)?en.each(e,(function(e,r){this._is_reserved_property(r)||(s[r]=e)}),this):s[e]=r,i[Cn]=s,i},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};en.extend(MixpanelGroup.prototype,Tn),MixpanelGroup.prototype._init=function(e,r,i){this._mixpanel=e,this._group_key=r,this._group_id=i},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(e,r,i){var s=this.set_action(e,r);return en.isObject(e)&&(i=r),this._send_request(s,i)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,r,i){var s=this.set_once_action(e,r);return en.isObject(e)&&(i=r),this._send_request(s,i)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(e,r){var i=this.unset_action(e);return this._send_request(i,r)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(e,r,i){en.isObject(e)&&(i=r);var s=this.union_action(e,r);return this._send_request(s,i)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(e){var r=this.delete_action();return this._send_request(r,e)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(e,r,i){var s=this.remove_action(e,r);return this._send_request(s,i)})),MixpanelGroup.prototype._send_request=function(e,r){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var i=en.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:i,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},r)},MixpanelGroup.prototype._is_reserved_property=function(e){return"$group_key"===e||"$group_id"===e},MixpanelGroup.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelGroup.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},MixpanelGroup.prototype.remove=MixpanelGroup.prototype.remove,MixpanelGroup.prototype.set=MixpanelGroup.prototype.set,MixpanelGroup.prototype.set_once=MixpanelGroup.prototype.set_once,MixpanelGroup.prototype.union=MixpanelGroup.prototype.union,MixpanelGroup.prototype.unset=MixpanelGroup.prototype.unset,MixpanelGroup.prototype.toString=MixpanelGroup.prototype.toString;var MixpanelPeople=function(){};en.extend(MixpanelPeople.prototype,Tn),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,r,i){var s=this.set_action(e,r);return en.isObject(e)&&(i=r),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),s[Sn]=en.extend({},en.info.people_properties(),s[Sn]),this._send_request(s,i)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,r,i){var s=this.set_once_action(e,r);return en.isObject(e)&&(i=r),this._send_request(s,i)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(e,r){var i=this.unset_action(e);return this._send_request(i,r)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(e,r,i){var s={},a={};return en.isObject(e)?(en.each(e,(function(e,r){if(!this._is_reserved_property(r)){if(isNaN(parseFloat(e)))return void tn.error("Invalid increment value passed to mixpanel.people.increment - must be a number");a[r]=e}}),this),i=r):(en.isUndefined(r)&&(r=1),a[e]=r),s[In]=a,this._send_request(s,i)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,r,i){en.isObject(e)&&(i=r);var s=this.append_action(e,r);return this._send_request(s,i)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,r,i){en.isObject(e)&&(i=r);var s=this.remove_action(e,r);return this._send_request(s,i)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,r,i){en.isObject(e)&&(i=r);var s=this.union_action(e,r);return this._send_request(s,i)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,r,i){if(en.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",en.extend({$amount:e},r),i);tn.error("Invalid value passed to mixpanel.people.track_charge - must be a number")})),MixpanelPeople.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},MixpanelPeople.prototype.delete_user=function(){if(this._identify_called()){var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)}tn.error("mixpanel.people.delete_user() requires you to call identify() first")},MixpanelPeople.prototype.toString=function(){return this._mixpanel.toString()+".people"},MixpanelPeople.prototype._send_request=function(e,r){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var i=this._mixpanel.get_property("$device_id"),s=this._mixpanel.get_property("$user_id"),a=this._mixpanel.get_property("$had_persisted_distinct_id");i&&(e.$device_id=i),s&&(e.$user_id=s),a&&(e.$had_persisted_distinct_id=a);var h=en.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:h,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},r):(this._enqueue(e),en.isUndefined(r)||(this._get_config("verbose")?r({status:-1,error:null}):r(-1)),en.truncate(h,255))},MixpanelPeople.prototype._get_config=function(e){return this._mixpanel.get_config(e)},MixpanelPeople.prototype._identify_called=function(){return!0===this._mixpanel._flags.identify_called},MixpanelPeople.prototype._enqueue=function(e){Sn in e?this._mixpanel.persistence._add_to_people_queue(Sn,e):kn in e?this._mixpanel.persistence._add_to_people_queue(kn,e):wn in e?this._mixpanel.persistence._add_to_people_queue(wn,e):In in e?this._mixpanel.persistence._add_to_people_queue(In,e):xn in e?this._mixpanel.persistence._add_to_people_queue(xn,e):Cn in e?this._mixpanel.persistence._add_to_people_queue(Cn,e):En in e?this._mixpanel.persistence._add_to_people_queue(En,e):tn.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,r,i,s){var a=this,h=en.extend({},this._mixpanel.persistence.load_queue(e)),f=h;en.isUndefined(h)||!en.isObject(h)||en.isEmptyObject(h)||(a._mixpanel.persistence._pop_from_people_queue(e,h),a._mixpanel.persistence.save(),s&&(f=s(h)),r.call(a,f,(function(r,s){0===r&&a._mixpanel.persistence._add_to_people_queue(e,h),en.isUndefined(i)||i(r,s)})))},MixpanelPeople.prototype._flush=function(e,r,i,s,a,h,f){var _=this;this._flush_one_queue(Sn,this.set,e),this._flush_one_queue(kn,this.set_once,s),this._flush_one_queue(wn,this.unset,h,(function(e){return en.keys(e)})),this._flush_one_queue(In,this.increment,r),this._flush_one_queue(En,this.union,a);var v=this._mixpanel.persistence.load_queue(xn);if(!en.isUndefined(v)&&en.isArray(v)&&v.length)for(var b,append_callback=function(e,r){0===e&&_._mixpanel.persistence._add_to_people_queue(xn,b),en.isUndefined(i)||i(e,r)},S=v.length-1;S>=0;S--)v=this._mixpanel.persistence.load_queue(xn),b=v.pop(),_._mixpanel.persistence.save(),en.isEmptyObject(b)||_.append(b,append_callback);var I=this._mixpanel.persistence.load_queue(Cn);if(!en.isUndefined(I)&&en.isArray(I)&&I.length)for(var x,remove_callback=function(e,r){0===e&&_._mixpanel.persistence._add_to_people_queue(Cn,x),en.isUndefined(f)||f(e,r)},C=I.length-1;C>=0;C--)I=this._mixpanel.persistence.load_queue(Cn),x=I.pop(),_._mixpanel.persistence.save(),en.isEmptyObject(x)||_.remove(x,remove_callback)},MixpanelPeople.prototype._is_reserved_property=function(e){return"$distinct_id"===e||"$token"===e||"$device_id"===e||"$user_id"===e||"$had_persisted_distinct_id"===e},MixpanelPeople.prototype.set=MixpanelPeople.prototype.set,MixpanelPeople.prototype.set_once=MixpanelPeople.prototype.set_once,MixpanelPeople.prototype.unset=MixpanelPeople.prototype.unset,MixpanelPeople.prototype.increment=MixpanelPeople.prototype.increment,MixpanelPeople.prototype.append=MixpanelPeople.prototype.append,MixpanelPeople.prototype.remove=MixpanelPeople.prototype.remove,MixpanelPeople.prototype.union=MixpanelPeople.prototype.union,MixpanelPeople.prototype.track_charge=MixpanelPeople.prototype.track_charge,MixpanelPeople.prototype.clear_charges=MixpanelPeople.prototype.clear_charges,MixpanelPeople.prototype.delete_user=MixpanelPeople.prototype.delete_user,MixpanelPeople.prototype.toString=MixpanelPeople.prototype.toString;var On,Rn="__mps",Mn="__mpso",Nn="__mpus",Pn="__mpa",Dn="__mpap",Zn="__mpr",An="__mpu",Ln="$people_distinct_id",jn="__alias",Fn="__timers",qn=[Rn,Mn,Nn,Pn,Dn,Zn,An,Ln,jn,Fn],MixpanelPersistence=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var r=e.persistence;"cookie"!==r&&"localStorage"!==r&&(tn.critical("Unknown persistence type "+r+"; falling back to cookie"),r=e.persistence="cookie"),"localStorage"===r&&en.localStorage.is_supported()?this.storage=en.localStorage:this.storage=en.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),en.each(this.props,(function(r,i){en.include(qn,i)||(e[i]=r)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=en.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,r;this.storage===en.localStorage?(e=en.cookie.parse(this.name),en.cookie.remove(this.name),en.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===en.cookie&&(r=en.localStorage.parse(this.name),en.localStorage.remove(this.name),r&&this.register_once(r))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,en.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},MixpanelPersistence.prototype.load_prop=function(e){return this.load(),this.props[e]},MixpanelPersistence.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},MixpanelPersistence.prototype.clear=function(){this.remove(),this.props={}},MixpanelPersistence.prototype.register_once=function(e,r,i){return!!en.isObject(e)&&(void 0===r&&(r="None"),this.expire_days=void 0===i?this.default_expiry:i,this.load(),en.each(e,(function(e,i){this.props.hasOwnProperty(i)&&this.props[i]!==r||(this.props[i]=e)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(e,r){return!!en.isObject(e)&&(this.expire_days=void 0===r?this.default_expiry:r,this.load(),en.extend(this.props,e),this.save(),!0)},MixpanelPersistence.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},MixpanelPersistence.prototype.update_search_keyword=function(e){this.register(en.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:en.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return en.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},MixpanelPersistence.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},MixpanelPersistence.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},MixpanelPersistence.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},MixpanelPersistence.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},MixpanelPersistence.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},MixpanelPersistence.prototype.get_cross_subdomain=function(){return this.cross_subdomain},MixpanelPersistence.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},MixpanelPersistence.prototype._add_to_people_queue=function(e,r){var i=this._get_queue_key(e),s=r[e],a=this._get_or_create_queue(Sn),h=this._get_or_create_queue(kn),f=this._get_or_create_queue(wn),_=this._get_or_create_queue(In),v=this._get_or_create_queue(En),b=this._get_or_create_queue(Cn,[]),S=this._get_or_create_queue(xn,[]);i===Rn?(en.extend(a,s),this._pop_from_people_queue(In,s),this._pop_from_people_queue(En,s),this._pop_from_people_queue(wn,s)):i===Mn?(en.each(s,(function(e,r){r in h||(h[r]=e)})),this._pop_from_people_queue(wn,s)):i===Nn?en.each(s,(function(e){en.each([a,h,_,v],(function(r){e in r&&delete r[e]})),en.each(S,(function(r){e in r&&delete r[e]})),f[e]=!0})):i===Pn?(en.each(s,(function(e,r){r in a?a[r]+=e:(r in _||(_[r]=0),_[r]+=e)}),this),this._pop_from_people_queue(wn,s)):i===An?(en.each(s,(function(e,r){en.isArray(e)&&(r in v||(v[r]=[]),v[r]=v[r].concat(e))})),this._pop_from_people_queue(wn,s)):i===Zn?(b.push(s),this._pop_from_people_queue(xn,s)):i===Dn&&(S.push(s),this._pop_from_people_queue(wn,s)),tn.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),tn.log(r),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,r){var i=this.props[this._get_queue_key(e)];en.isUndefined(i)||en.each(r,(function(r,s){e===xn||e===Cn?en.each(i,(function(e){e[s]===r&&delete e[s]})):delete i[s]}),this)},MixpanelPersistence.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},MixpanelPersistence.prototype._get_queue_key=function(e){return e===Sn?Rn:e===kn?Mn:e===wn?Nn:e===In?Pn:e===xn?Dn:e===Cn?Zn:e===En?An:void tn.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,r){var i=this._get_queue_key(e);return r=en.isUndefined(r)?{}:r,this.props[i]||(this.props[i]=r)},MixpanelPersistence.prototype.set_event_timer=function(e,r){var i=this.load_prop(Fn)||{};i[e]=r,this.props[Fn]=i,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var r=(this.load_prop(Fn)||{})[e];return en.isUndefined(r)||(delete this.props[Fn][e],this.save()),r};var $n,load_extra_bundle=function(e,r){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},Un="mixpanel",Bn="base64",zn="$device:",Vn=vr.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Wn=!Vn&&-1===Kr.indexOf("MSIE")&&-1===Kr.indexOf("Mozilla"),Kn=null;Br.sendBeacon&&(Kn=function(){return Br.sendBeacon.apply(Br,arguments)});var Hn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},Gn={api_host:"https://api-js.mixpanel.com",api_routes:Hn,api_method:"POST",api_transport:"XHR",api_payload_format:Bn,app_host:"https://mixpanel.com",cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:NOOP_FUNC,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:NOOP_FUNC,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_collect_fonts:!1,record_idle_timeout_ms:18e5,record_inline_images:!1,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:Dr,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Jn=!1,MixpanelLib=function(){},create_mplib=function(e,r,i){var s,a=i===Un?$n:$n[i];if(a&&0===On)s=a;else{if(a&&!en.isArray(a))return void tn.error("You have already initialized "+i);s=new MixpanelLib}if(s._cached_groups={},s._init(e,r,i),s.people=new MixpanelPeople,s.people._init(s),!s.get_config("skip_first_touch_marketing")){var h=en.info.campaignParams(null),f={},_=!1;en.each(h,(function(e,r){f["initial_"+r]=e,e&&(_=!0)})),_&&s.people.set_once(f)}return kr.DEBUG=kr.DEBUG||s.get_config("debug"),!en.isUndefined(a)&&en.isArray(a)&&(s._execute_array.call(s.people,a.people),s._execute_array(a)),s};MixpanelLib.prototype.init=function(e,r,i){if(en.isUndefined(i))this.report_error("You must name your new library: init(token, config, name)");else{if(i!==Un){var s=create_mplib(e,r,i);return $n[i]=s,s._loaded(),s}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(e,r,i){r=r||{},this.__loaded=!0,this.config={};var s={};"api_payload_format"in r||(r.api_host||Gn.api_host).match(/\.mixpanel\.com/)&&(s.api_payload_format="json");if(this.set_config(en.extend({},Gn,s,r,{name:i,token:e,callback_fn:(i===Un?i:Un+"."+i)+"._jsc"})),this._jsc=NOOP_FUNC,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests)if(en.localStorage.is_supported(!0)&&Vn){if(this.init_batchers(),Kn&&vr.addEventListener){var a=en.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);vr.addEventListener("pagehide",(function(e){e.persisted&&a()})),vr.addEventListener("visibilitychange",(function(){"hidden"===zr.visibilityState&&a()}))}}else this._batch_requests=!1,tn.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),en.each(this.get_batcher_configs(),(function(e){tn.log("Clearing batch queue "+e.queue_key),en.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var h=en.UUID();this.get_distinct_id()||this.register_once({distinct_id:zn+h,$device_id:h},"");var f=this.get_config("track_pageview");f&&this._init_url_change_tracking(f),this.get_config("record_sessions_percent")>0&&100*Math.random()<=this.get_config("record_sessions_percent")&&this.start_session_recording()},MixpanelLib.prototype.start_session_recording=addOptOutCheckMixpanelLib((function(){if(vr.MutationObserver){var e=en.bind((function(){this._recorder=this._recorder||new vr.__mp_recorder(this),this._recorder.startRecording()}),this);en.isUndefined(vr.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else tn.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():tn.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var e={};if(this._recorder){var r=this._recorder.replayId;r&&(e.$mp_replay_id=r)}return e},MixpanelLib.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=en.info.campaignParams(null);en.each(e,function(e,r){this.unregister(r)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(zr.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(en.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(zr.referrer)},MixpanelLib.prototype._dom_loaded=function(){en.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||en.each(this.__request_queue,(function(e){this._send_request.apply(this,e)}),this),delete this.__dom_loaded_queue,delete this.__request_queue},MixpanelLib.prototype._track_dom=function(e,r){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!Jn)return this.__dom_loaded_queue.push([e,r]),!1;var i=(new e).init(this);return i.track.apply(i,r)},MixpanelLib.prototype._init_url_change_tracking=function(e){var r="";if(this.track_pageview()&&(r=en.info.currentUrl()),en.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){vr.addEventListener("popstate",(function(){vr.dispatchEvent(new Event("mp_locationchange"))})),vr.addEventListener("hashchange",(function(){vr.dispatchEvent(new Event("mp_locationchange"))}));var i=vr.history.pushState;"function"==typeof i&&(vr.history.pushState=function(e,r,s){i.call(vr.history,e,r,s),vr.dispatchEvent(new Event("mp_locationchange"))});var s=vr.history.replaceState;"function"==typeof s&&(vr.history.replaceState=function(e,r,i){s.call(vr.history,e,r,i),vr.dispatchEvent(new Event("mp_locationchange"))}),vr.addEventListener("mp_locationchange",function(){var i=en.info.currentUrl(),s=!1;("full-url"===e?s=i!==r:"url-with-path-and-query-string"===e?s=i.split("#")[0]!==r.split("#")[0]:"url-with-path"===e&&(s=i.split("#")[0].split("?")[0]!==r.split("#")[0].split("?")[0]),s)&&(this.track_pageview()&&(r=i))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,r){if(en.isUndefined(e))return null;if(Vn){return function(i){e(i,r)}}var i=this._jsc,s=""+Math.floor(1e8*Math.random()),a=this.get_config("callback_fn")+"["+s+"]";return i[s]=function(a){delete i[s],e(a,r)},a},MixpanelLib.prototype._send_request=function(e,r,i,s){var a=!0;if(Wn)return this.__request_queue.push(arguments),a;var h={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},f=null;s||!en.isFunction(i)&&"string"!=typeof i||(s=i,i=null),i=en.extend(h,i||{}),Vn||(i.method="GET");var _="POST"===i.method,v=Kn&&_&&"sendbeacon"===i.transport.toLowerCase(),b=i.verbose;r.verbose&&(b=!0),this.get_config("test")&&(r.test=1),b&&(r.verbose=1),this.get_config("img")&&(r.img=1),Vn||(s?r.callback=s:(b||this.get_config("test"))&&(r.callback="(function(){})")),r.ip=this.get_config("ip")?1:0,r._=(new Date).getTime().toString(),_&&(f="data="+encodeURIComponent(r.data),delete r.data),e+="?"+en.HTTPBuildQuery(r);var S=this;if("img"in r){var I=zr.createElement("img");I.src=e,zr.body.appendChild(I)}else if(v){try{a=Kn(e,f)}catch(N){S.report_error(N),a=!1}try{s&&s(a?1:0)}catch(N){S.report_error(N)}}else if(Vn)try{var x=new XMLHttpRequest;x.open(i.method,e,!0);var C=this.get_config("xhr_headers");if(_&&(C["Content-Type"]="application/x-www-form-urlencoded"),en.each(C,(function(e,r){x.setRequestHeader(r,e)})),i.timeout_ms&&void 0!==x.timeout){x.timeout=i.timeout_ms;var T=(new Date).getTime()}x.withCredentials=!0,x.onreadystatechange=function(){var e;if(4===x.readyState)if(200===x.status){if(s)if(b){var r;try{r=en.JSONDecode(x.responseText)}catch(N){if(S.report_error(N),!i.ignore_json_errors)return;r=x.responseText}s(r)}else s(Number(x.responseText))}else if(e=x.timeout&&!x.status&&(new Date).getTime()-T>=x.timeout?"timeout":"Bad HTTP status: "+x.status+" "+x.statusText,S.report_error(e),s)if(b){var a=x.responseHeaders||{};s({status:0,httpStatusCode:x.status,error:e,retryAfter:a["Retry-After"]})}else s(0)},x.send(f)}catch(N){S.report_error(N),a=!1}else{var O=zr.createElement("script");O.type="text/javascript",O.async=!0,O.defer=!0,O.src=e;var R=zr.getElementsByTagName("script")[0];R.parentNode.insertBefore(O,R)}return a},MixpanelLib.prototype._execute_array=function(e){var r,i=[],s=[],a=[];en.each(e,(function(e){e&&(r=e[0],en.isArray(r)?a.push(e):"function"==typeof e?e.call(this):en.isArray(e)&&"alias"===r?i.push(e):en.isArray(e)&&-1!==r.indexOf("track")&&"function"==typeof this[r]?a.push(e):s.push(e))}),this);var execute=function(e,r){en.each(e,(function(e){if(en.isArray(e[0])){var i=r;en.each(e,(function(e){i=i[e[0]].apply(i,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),r)};execute(i,this),execute(s,this),execute(a,this)},MixpanelLib.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},MixpanelLib.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token"),r=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+r.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+r.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+r.groups,queue_key:e+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=en.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:en.bind((function(r,i,s){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(r),i,this._prepare_callback(s,r))}),this),beforeSendHook:en.bind((function(r){return this._run_hook("before_send_"+e.type,r)}),this),stopAllBatchingFunc:en.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),r=this.get_batcher_configs();this.request_batchers={events:e(r.events),people:e(r.people),groups:e(r.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},MixpanelLib.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,en.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,en.each(this.request_batchers,(function(e){e.stop(),e.clear()}))},MixpanelLib.prototype.push=function(e){this._execute_array([e])},MixpanelLib.prototype.disable=function(e){void 0===e?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},MixpanelLib.prototype._encode_data_for_request=function(e){var r=en.JSONEncode(e);return this.get_config("api_payload_format")===Bn&&(r=en.base64Encode(r)),{data:r}},MixpanelLib.prototype._track_or_batch=function(e,r){var i=en.truncate(e.data,255),s=e.endpoint,a=e.batcher,h=e.should_send_immediately,f=e.send_request_options||{};r=r||NOOP_FUNC;var _=!0,v=en.bind((function(){return f.skip_hooks||(i=this._run_hook("before_send_"+e.type,i)),i?(tn.log("MIXPANEL REQUEST:"),tn.log(i),this._send_request(s,this._encode_data_for_request(i),f,this._prepare_callback(r,i))):null}),this);return this._batch_requests&&!h?a.enqueue(i,(function(e){e?r(1,i):v()})):_=v(),_&&i},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,r,i,s){s||"function"!=typeof i||(s=i,i=null);var a=(i=i||{}).transport;a&&(i.transport=a);var h=i.send_immediately;if("function"!=typeof s&&(s=NOOP_FUNC),en.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(r=en.extend({},r)).token=this.get_config("token");var f=this.persistence.remove_event_timer(e);if(!en.isUndefined(f)){var _=(new Date).getTime()-f;r.$duration=parseFloat((_/1e3).toFixed(3))}this._set_default_superprops();var v=this.get_config("track_marketing")?en.info.marketingParams():{};r=en.extend({},en.info.properties({mp_loader:this.get_config("mp_loader")}),v,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),r);var b=this.get_config("property_blacklist");en.isArray(b)?en.each(b,(function(e){delete r[e]})):this.report_error("Invalid value for property_blacklist config: "+b);var S={event:e,properties:r};return this._track_or_batch({type:"events",data:S,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:h,send_request_options:i},s)}s(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,r,i){en.isArray(r)||(r=[r]);var s={};return s[e]=r,this.register(s),this.people.set(e,r,i)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,r,i){var s=this.get_property(e),a={};return void 0===s?(a[e]=[r],this.register(a)):-1===s.indexOf(r)&&(s.push(r),a[e]=s,this.register(a)),this.people.union(e,r,i)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,r,i){var s=this.get_property(e);if(void 0!==s){var a=s.indexOf(r);a>-1&&(s.splice(a,1),this.register({group_key:s})),0===s.length&&this.unregister(e)}return this.people.remove(e,r,i)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,r,i,s){var a=en.extend({},r||{});return en.each(i,(function(e,r){null!=e&&(a[r]=e)})),this.track(e,a,s)})),MixpanelLib.prototype._create_map_key=function(e,r){return e+"_"+JSON.stringify(r)},MixpanelLib.prototype._remove_group_from_cache=function(e,r){delete this._cached_groups[this._create_map_key(e,r)]},MixpanelLib.prototype.get_group=function(e,r){var i=this._create_map_key(e,r),s=this._cached_groups[i];return void 0!==s&&s._group_key===e&&s._group_id===r||((s=new MixpanelGroup)._init(this,e,r),this._cached_groups[i]=s),s},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,r){"object"!=typeof e&&(e={});var i=(r=r||{}).event_name||"$mp_web_page_view",s=en.extend(en.info.mpPageViewProperties(),en.info.campaignParams(),en.info.clickParams()),a=en.extend({},s,e);return this.track(i,a)})),MixpanelLib.prototype.track_links=function(){return this._track_dom.call(this,LinkTracker,arguments)},MixpanelLib.prototype.track_forms=function(){return this._track_dom.call(this,FormTracker,arguments)},MixpanelLib.prototype.time_event=function(e){en.isUndefined(e)?this.report_error("No event name provided to mixpanel.time_event"):this._event_is_disabled(e)||this.persistence.set_event_timer(e,(new Date).getTime())};var Yn={persistent:!0},options_for_register=function(e){var r;return r=en.isObject(e)?e:en.isUndefined(e)?{}:{days:e},en.extend({},Yn,r)};MixpanelLib.prototype.register=function(e,r){var i=options_for_register(r);i.persistent?this.persistence.register(e,i.days):en.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,r,i){var s=options_for_register(i);s.persistent?this.persistence.register_once(e,r,s.days):(void 0===r&&(r="None"),en.each(e,(function(e,i){this.unpersisted_superprops.hasOwnProperty(i)&&this.unpersisted_superprops[i]!==r||(this.unpersisted_superprops[i]=e)}),this))},MixpanelLib.prototype.unregister=function(e,r){(r=options_for_register(r)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,r){var i={};i[e]=r,this.register(i)},MixpanelLib.prototype.identify=function(e,r,i,s,a,h,f,_){var v=this.get_distinct_id();if(e&&v!==e){if("string"==typeof e&&0===e.indexOf(zn))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var b=v;this.register_once({$had_persisted_distinct_id:!0,$device_id:b},"")}e!==v&&e!==this.get_property(jn)&&(this.unregister(jn),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(r,i,s,a,h,f,_),e!==v&&this.track("$identify",{distinct_id:e,$anon_distinct_id:v},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=en.UUID();this.register_once({distinct_id:zn+e,$device_id:e},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(e,r){if(e===this.get_property(Ln))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var i=this;return en.isUndefined(r)&&(r=this.get_distinct_id()),e!==r?(this._register_single(jn,e),this.track("$create_alias",{alias:e,distinct_id:r},{skip_hooks:!0},(function(){i.identify(e)}))):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},MixpanelLib.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},MixpanelLib.prototype.set_config=function(e){en.isObject(e)&&(en.extend(this.config,e),e.batch_size&&en.each(this.request_batchers,(function(e){e.resetBatchSize()})),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),kr.DEBUG=kr.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(e){return this.config[e]},MixpanelLib.prototype._run_hook=function(e){var r=(this.config.hooks[e]||IDENTITY_FUNC).apply(this,Fr.call(arguments,1));return void 0===r&&(this.report_error(e+" hook did not return a value"),r=null),r},MixpanelLib.prototype.get_property=function(e){return this.persistence.load_prop([e])},MixpanelLib.prototype.toString=function(){var e=this.get_config("name");return e!==Un&&(e=Un+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return en.isBlockedUA(Kr)||this._flags.disable_all_events||en.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&en.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_tracking()||!this.get_config("opt_out_tracking_by_default")&&!en.cookie.get("mp_optout")||(en.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},MixpanelLib.prototype._gdpr_update_persistence=function(e){var r;if(e&&e.clear_persistence)r=!0;else{if(!e||!e.enable_persistence)return;r=!1}this.get_config("disable_persistence")||this.persistence.disabled===r||this.persistence.set_disabled(r),r?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},MixpanelLib.prototype._gdpr_call_func=function(e,r){return r=en.extend({track:en.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},r),en.localStorage.is_supported()||(r.persistence_type="cookie"),e(this.get_config("token"),{track:r.track,trackEventName:r.track_event_name,trackProperties:r.track_properties,persistenceType:r.persistence_type,persistencePrefix:r.cookie_prefix,cookieDomain:r.cookie_domain,cookieExpiration:r.cookie_expiration,crossSiteCookie:r.cross_site_cookie,crossSubdomainCookie:r.cross_subdomain_cookie,secureCookie:r.secure_cookie,ignoreDnt:r.ignore_dnt})},MixpanelLib.prototype.opt_in_tracking=function(e){e=en.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=en.extend({clear_persistence:!0,delete_user:!0},e)).delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(optOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(hasOptedIn,e)},MixpanelLib.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(hasOptedOut,e)},MixpanelLib.prototype.clear_opt_in_out_tracking=function(e){e=en.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,r){tn.error.apply(tn.error,arguments);try{r||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,r)}catch(i){tn.error(i)}},MixpanelLib.prototype.init=MixpanelLib.prototype.init,MixpanelLib.prototype.reset=MixpanelLib.prototype.reset,MixpanelLib.prototype.disable=MixpanelLib.prototype.disable,MixpanelLib.prototype.time_event=MixpanelLib.prototype.time_event,MixpanelLib.prototype.track=MixpanelLib.prototype.track,MixpanelLib.prototype.track_links=MixpanelLib.prototype.track_links,MixpanelLib.prototype.track_forms=MixpanelLib.prototype.track_forms,MixpanelLib.prototype.track_pageview=MixpanelLib.prototype.track_pageview,MixpanelLib.prototype.register=MixpanelLib.prototype.register,MixpanelLib.prototype.register_once=MixpanelLib.prototype.register_once,MixpanelLib.prototype.unregister=MixpanelLib.prototype.unregister,MixpanelLib.prototype.identify=MixpanelLib.prototype.identify,MixpanelLib.prototype.alias=MixpanelLib.prototype.alias,MixpanelLib.prototype.name_tag=MixpanelLib.prototype.name_tag,MixpanelLib.prototype.set_config=MixpanelLib.prototype.set_config,MixpanelLib.prototype.get_config=MixpanelLib.prototype.get_config,MixpanelLib.prototype.get_property=MixpanelLib.prototype.get_property,MixpanelLib.prototype.get_distinct_id=MixpanelLib.prototype.get_distinct_id,MixpanelLib.prototype.toString=MixpanelLib.prototype.toString,MixpanelLib.prototype.opt_out_tracking=MixpanelLib.prototype.opt_out_tracking,MixpanelLib.prototype.opt_in_tracking=MixpanelLib.prototype.opt_in_tracking,MixpanelLib.prototype.has_opted_out_tracking=MixpanelLib.prototype.has_opted_out_tracking,MixpanelLib.prototype.has_opted_in_tracking=MixpanelLib.prototype.has_opted_in_tracking,MixpanelLib.prototype.clear_opt_in_out_tracking=MixpanelLib.prototype.clear_opt_in_out_tracking,MixpanelLib.prototype.get_group=MixpanelLib.prototype.get_group,MixpanelLib.prototype.set_group=MixpanelLib.prototype.set_group,MixpanelLib.prototype.add_group=MixpanelLib.prototype.add_group,MixpanelLib.prototype.remove_group=MixpanelLib.prototype.remove_group,MixpanelLib.prototype.track_with_groups=MixpanelLib.prototype.track_with_groups,MixpanelLib.prototype.start_batch_senders=MixpanelLib.prototype.start_batch_senders,MixpanelLib.prototype.stop_batch_senders=MixpanelLib.prototype.stop_batch_senders,MixpanelLib.prototype.start_session_recording=MixpanelLib.prototype.start_session_recording,MixpanelLib.prototype.stop_session_recording=MixpanelLib.prototype.stop_session_recording,MixpanelLib.prototype.get_session_recording_properties=MixpanelLib.prototype.get_session_recording_properties,MixpanelLib.prototype.DEFAULT_API_ROUTES=Hn,MixpanelPersistence.prototype.properties=MixpanelPersistence.prototype.properties,MixpanelPersistence.prototype.update_search_keyword=MixpanelPersistence.prototype.update_search_keyword,MixpanelPersistence.prototype.update_referrer_info=MixpanelPersistence.prototype.update_referrer_info,MixpanelPersistence.prototype.get_cross_subdomain=MixpanelPersistence.prototype.get_cross_subdomain,MixpanelPersistence.prototype.clear=MixpanelPersistence.prototype.clear;var Xn={},override_mp_init_func=function(){$n.init=function(e,r,i){if(i)return $n[i]||($n[i]=Xn[i]=create_mplib(e,r,i),$n[i]._loaded()),$n[i];var s=$n;Xn[Un]?s=Xn[Un]:e&&((s=create_mplib(e,r,Un))._loaded(),Xn[Un]=s),$n=s,1===On&&(vr[Un]=$n),en.each(Xn,(function(e,r){r!==Un&&($n[r]=e)})),$n._=en}};var Qn=function init_as_module(e){return load_extra_bundle=e,On=0,$n=new MixpanelLib,override_mp_init_func(),$n.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,Jn=!0,Wn=!1,en.each(Xn,(function(e){e._dom_loaded()})))}if(zr.addEventListener)"complete"===zr.readyState?dom_loaded_handler():zr.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(zr.attachEvent){zr.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===vr.frameElement}catch(r){}zr.documentElement.doScroll&&e&&function do_scroll_check(){try{zr.documentElement.doScroll("left")}catch(r){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}en.register_event(vr,"load",dom_loaded_handler,!0)}(),$n}((function loadNoop(e,r){r()}));const ei="mp_distinct_id";function isReady(){return void 0!==window.mixpanel}function updateCachedDistinctId(e){localStorage.setItem(ei,e)}const ti={init:function init$2(e,r=!1,i){return new Promise((s=>{Qn.init(e,{debug:r,loaded:()=>{window.mixpanel=Qn,s()},...i&&{api_host:i}})}))},isReady:isReady,track:function track(e,r){isReady()&&Qn.track(e,{...r,"Reservamos Version":"1.0.14"})},identify:function identify$1(e,r){Qn.identify(e),updateCachedDistinctId(e),Qn.people.set(r)},attachProperty:function attachProperty(e,r){isReady()&&Qn.people.union(e,[r])},getMixpanelDistinctId:()=>{const e=localStorage.getItem(ei);if(Qn&&Qn.get_distinct_id){const e=Qn.get_distinct_id();return updateCachedDistinctId(e),e}return e||null}},ri=Oe.object({firstName:Oe.string().optional(),lastName:Oe.string().optional(),email:Oe.string().email().optional(),phone:Oe.string().optional()}),ni=["web","web-mobile","ios","android","app"],ii=Oe.enum(ni).refine((e=>ni.includes(e)),{message:`Product must be one of: ${ni.join(", ")}`}),oi=Oe.object({product:ii});const dateValidation=e=>!(!/^\d{4}-\d{2}-\d{2}$/.test(e)&&!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(e))||!(!/^\d{4}-\d{2}-\d{2}/.test(e)||isNaN(Date.parse(e))),stringField=e=>Oe.string().refine((e=>e),{message:`${e} must be a string`}),numberField=e=>Oe.number().refine((e=>e),{message:`${e} must be a number`}),intField=e=>Oe.number().int().refine((e=>e),{message:`${e} must be an integer`}),dateField=e=>Oe.string().refine(dateValidation,{message:`Invalid ${e} datetime format`}),arrayField=(e,r,i)=>Oe.array(e).min(i,`${r} must have at least ${i} items`),si=Oe.object({Origin:stringField("Origin").optional(),Destination:stringField("Destination").optional(),Departure:dateField("Departure").optional(),Return:dateField("Return").optional(),"Departure Date":stringField("Departure Date").optional(),product:ii});const ai=Oe.object({"Passenger Birthdate":dateField("Passenger Birthdate"),"Passenger Seat":stringField("Passenger Seat"),"Passenger Name":stringField("Passenger Name"),"Passenger Document Type":stringField("Document Type"),"Passenger Document Id":stringField("Document ID")}).strict(),ci=Oe.object({"Departure Arrival":dateField("Departure Arrival"),"Departure Destination":stringField("Departure Destination"),"Departure Destination Terminal":stringField("Departure Destination Terminal"),"Departure Line":stringField("Departure Line"),"Departure Origin":stringField("Departure Origin"),"Departure Origin Terminal":stringField("Departure Origin Terminal"),"Departure Price":numberField("Departure Price"),"Departure Route":stringField("Departure Route"),"Departure Stops":intField("Departure Stops"),"Departure Time":dateField("Departure Time"),"Departure Transport Type":stringField("Departure Transport Type"),"Departure Transporter":stringField("Departure Transporter"),"Return Arrival":dateField("Return Arrival").optional(),"Return Destination":stringField("Return Destination").optional(),"Return Destination Terminal":stringField("Return Destination Terminal").optional(),"Return Line":stringField("Return Line").optional(),"Return Origin":stringField("Return Origin").optional(),"Return Origin Terminal":stringField("Return Origin Terminal").optional(),"Return Price":numberField("Return Price").optional(),"Return Route":stringField("Return Route").optional(),"Return Stops":intField("Return Stops").optional(),"Return Time":dateField("Return Time").optional(),"Return Transport Type":stringField("Return Transport Type").optional(),"Return Transporter":stringField("Return Transporter").optional(),"Recommended Trip":Oe.boolean(),"Recommended Trip Type":stringField("Recommended Trip Type").optional()}),di=Oe.object({Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count").optional(),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()}).strict();const ui=Oe.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),"Payment Type":Oe.string().min(1,"Payment Type is required"),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional(),Insurance:(li="Insurance",Oe.boolean({required_error:`${li} is required`,invalid_type_error:`${li} must be a boolean`})).optional(),Coupon:stringField("Coupon").optional(),"User Status":stringField("User Status").optional()}).strict();var li;const pi=Oe.object({Arrival:Oe.string().refine(dateValidation,{message:"Invalid arrival datetime format"}),Departure:Oe.string().refine(dateValidation,{message:"Invalid departure datetime format"}),Destination:Oe.string().min(1,"Destination is required"),"Destination Terminal":Oe.string().min(1,"Destination terminal is required"),Line:Oe.string().min(1,"Line is required").optional(),Origin:Oe.string().min(1,"Origin is required"),"Origin Terminal":Oe.string().min(1,"Origin terminal is required"),Price:Oe.number().positive("Price must be a positive number"),"Result Position":Oe.number().int("Result Position must be an integer"),Route:Oe.string().min(1,"Route is required"),Stops:Oe.number().int("Stops must be an integer").nonnegative("Stops must be non-negative"),"Transport Type":Oe.string().min(1,"Transport Type is required"),Transporter:Oe.string().min(1,"Transporter is required"),product:ii,"Recommended Trip":Oe.boolean(),"Recommended Trip Type":Oe.string().optional(),"Trip Type":Oe.string().min(1,"Trip Type is required"),"Bus Type":Oe.string().min(1,"Bus Type is required")});const hi=Oe.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(ci,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),Total:numberField("Total"),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()}).strict();const fi=Oe.object({Departure:Oe.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),"Departure Delta":Oe.number().int("Departure Delta must be an integer"),Destination:Oe.string().min(1,"Destination is required"),"Destination Terminal":Oe.string().min(1,"Destination terminal is required"),Origin:Oe.string().min(1,"Origin is required"),"Origin Terminal":Oe.string().min(1,"Origin terminal is required"),Passengers:Oe.number().int("Passenger count must be an integer"),Return:Oe.string().refine(dateValidation,{message:"Invalid Return date or datetime format. Must include at least YYYY-MM-DD"}).optional(),Route:Oe.string().min(1,"Route is required"),"Trip Length":Oe.number().positive().optional(),Categories:Oe.array(Oe.string()).optional(),product:ii});const mi=Oe.object({Arrival:Oe.string().refine(dateValidation,{message:"Invalid arrival date or datetime format. Must include at least YYYY-MM-DD"}),Departure:Oe.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),Destination:Oe.string().min(1,"Destination is required"),"Destination Terminal":Oe.string().min(1,"Destination Terminal is required"),Line:Oe.string().min(1,"Line is required").optional(),Origin:Oe.string().min(1,"Origin is required"),"Origin Terminal":Oe.string().min(1,"Origin Terminal is required"),Price:Oe.number().positive("Price must be a positive number"),Route:Oe.string().min(1,"Route is required"),Stops:Oe.number().int("Stops must be an integer").nonnegative().optional(),Tickets:Oe.number().int("Tickets must be an integer").positive(),Transporter:Oe.string().min(1,"Transporter is required"),Way:Oe.enum(["Departure","Return"],{description:"Way must be either 'Departure' or 'Return'"}),product:ii});const gi=Oe.object({"Bus count":Oe.number().int("Bus count must be an integer"),Departure:Oe.string().refine(dateValidation,{message:"Invalid departure datetime format"}),"Departure Delta":Oe.number().int("Departure Delta must be an integer").optional(),Destination:Oe.string().min(1,"Destination is required").optional(),"Destination Terminal":Oe.string().min(1,"Destination terminal is required").optional(),"Has Frequent Buses":Oe.boolean().default(!1).optional(),Origin:Oe.string().min(1,"Origin is required"),"Origin Terminal":Oe.string().min(1,"Origin terminal is required"),Route:Oe.string().min(1,"Route is required"),product:ii}),_i=Oe.object({mixpanelToken:Oe.string().min(1,"Mixpanel token is required"),debug:Oe.boolean().optional(),identificationKey:Oe.string().min(1,"Identification key is required"),isSandbox:Oe.boolean().optional(),mixpanelProxyUrl:Oe.string().optional(),identifyProxyUrl:Oe.string().optional()}),SchemaErrorFormatter=e=>e.issues.map((e=>{let r="INVALID_FIELD",i="",s="",a="";return"invalid_type"===e.code?(r="TYPE_MISMATCH",i=e.expected,s=e.received,a=`Expected ${i} but received ${s}. Please provide a value of type ${i}.`):"too_small"===e.code?(r="VALUE_TOO_SMALL",a=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(r="VALUE_TOO_BIG",a=`Reduce the value to no more than ${e.maximum}.`):(r="INVALID_FIELD",a="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:r,expected:i,received:s,message:e.message,suggestion:a}})),yi={Search:fi,"Seat Change":mi,"Interest In Home":oi,"Passengers Created":di,"Payment Attempt":ui,"Interest In Search":si,"View Results":gi,"Purchase Attempt":hi,"Picked Departure":pi};function validateProps(e,r){try{r.parse(e)}catch(Or){if(Or instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Or)}}throw{message:"Unknown validation error"}}}const vi={parseEventProps:function parseEventProps(e,r){const i=yi[e]||Me;try{i.parse(r)}catch(Or){if(Or instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Or)}}throw{message:"Unknown validation error"}}},parseInitProps:function parseInitProps(e){validateProps(e,_i)},parseIdentifyProps:function parseIdentifyProps(e){validateProps(e,ri)},validateProps:validateProps};function isTrackerReady(){return ti.isReady()}let bi=null;const Si="geolocationPermissionTimestamp",ki=6048e5;function updatePermissionTimestamp(e){localStorage.setItem(Si,e.toString())}const wi={init:function init(){return new Promise((e=>{if(function isPermissionTimestampValid(e){return!!e&&Date.now()-parseInt(e,10)<ki}(localStorage.getItem(Si)))return void e(bi);const r="Geolocation Requested",i=Date.now();navigator.geolocation.getCurrentPosition((s=>{const{latitude:a,longitude:h}=s.coords;bi={lat:a,long:h},updatePermissionTimestamp(i),isTrackerReady()&&trackCustomEvent(r,{geolocationAccepted:!0}),e(bi)}),(()=>{updatePermissionTimestamp(i),isTrackerReady()&&trackCustomEvent(r,{geolocationAccepted:!1}),e(null)}))}))},getCoordinates:function getCoordinates(){return bi}},Ii=["Search","View Results"],xi={utm_brand:"UTM Brand",utm_kxconfig:"UTM KXConfig",gad_source:"GAD Source",gclid:"GCLID"};function trackEventError(e,r,i){tryTrackEvent((async()=>{try{ti.track("Track Event Error",{"Failed Event Name":e,"Error Message":(null==r?void 0:r.message)??"Failed to track event","Validation Errors":(null==r?void 0:r.errors)||[],"Event Payload":i})}catch(s){console.error("Failed to track error event:",s)}}))}async function tryTrackEvent(e){ti.isReady()?await e():window.addEventListener("Tracker Ready",(async()=>{await e()}))}async function trackEvent(e,r,i={}){if(!ti.isReady())throw new Error("Mixpanel is not initialized.");try{vi.parseEventProps(e,r);const s=!Ii.includes(e);ti.getMixpanelDistinctId();const a=await yt.getFingerprint(s),h={},f=wi.getCoordinates();f&&(h.$latitude=f.lat,h.$longitude=f.long);const _={"User Fingerprint":a},v=function extractTrackingParams(){try{const e=new URLSearchParams(window.location.search),r={};return Object.entries(xi).forEach((([i,s])=>{const a=e.get(i);a&&(r[s]=a)})),r}catch(Or){return console.error("Error extracting tracking parameters:",Or),{}}}(),b=function flattenEventData(e){return Object.entries(e).reduce(((e,[r,i])=>Array.isArray(i)?Array.isArray(i)&&i.every((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e))?(e[r]=i,e):(i.forEach((r=>{"object"==typeof r&&null!==r&&Object.entries(r).forEach((([r,i])=>{e[r]?e[r].push(i):e[r]=[i]}))})),e):(e[r]=i,e)),{})}(r),S={..._,...b,...v,...h,...i};ti.track(e,S)}catch(Or){console.error(`Error tracking event '${e}':`,Or),trackEventError(e,Or,r)}}function trackCustomEvent(e,r={},i={}){try{Ne.parse(e),trackEvent(e,r,i)}catch(Or){console.error("Error trackCustomEvent:",Or),trackEventError(e,Or,r)}}const Ei=Oe.object({email:Oe.string().email().optional(),phone:Oe.string().optional(),cpf:Oe.string().optional(),passport:Oe.string().optional(),rg:Oe.string().optional(),firstName:Oe.string().optional(),lastName:Oe.string().optional()}).refine((e=>e.email||e.phone),{message:"At least one of 'email' or 'phone' must be provided"});async function createAnonymousProfile(e){try{vi.validateProps(e,Ei);const r=[],i=yt.getCachedFingerprint(),s=ti.getMixpanelDistinctId();i&&r.push({key:"fingerprint",value:i}),s&&r.push({key:"distinct_id",value:s});const a=function getAnonymousProfilePayload(e,r){let i="phone",s=e.phone||"";const a=[],h={};e.email&&(i="email",s=e.email);const f=["cpf","passport","rg","email","phone","salesforceid"],_=["name","firstName","lastName"];return Object.entries(e).forEach((([e,r])=>{e=function isCamelCase(e){return!(!e||e.includes(" ")||e[0]!==e[0].toLowerCase()||/[^a-zA-Z]/.test(e)||!/[A-Z]/.test(e))}(e)?e:e.toLocaleLowerCase(),f.includes(e)&&r?e!==i&&a.push({key:e,value:r}):_.includes(e)&&r&&(h[e]=r)})),r.length&&r.forEach((e=>a.push(e))),{identifier_key:i,identifier_value:s,details:h,identifiers:a}}(e,r);return await Nt.profiles.createAnonymousProfile(a)}catch(Or){return void console.error("Could not create anonymous profile:",Or)}}const Ci=["firstName","lastName","email","phone"];Oe.object({"Operation Id":stringField("Operation Id"),Trips:arrayField(ci,"Trips",1).optional(),"Passenger Count":numberField("Passenger Count").optional(),Total:numberField("Total").optional(),"Trip Count":numberField("Trip Count").optional(),product:ii,Passengers:arrayField(ai,"Passengers",1).optional()});const Ti=Oe.object({id:Oe.number(),first_name:Oe.string(),last_name:Oe.string(),second_last_name:Oe.string(),category:Oe.string(),bus_category:Oe.string(),gender:Oe.string(),email:Oe.string()}),Oi=Oe.object({passengers:Oe.array(Ti).min(1)});const Ri=Oe.object({category:Oe.string(),number:Oe.string().optional(),occupied:Oe.boolean().optional(),adjacent_seats:Oe.null().optional()}),Mi=Oe.object({bus:Oe.array(Oe.array(Oe.array(Ri)))}),Ni=Oe.object({bus_type:Oe.string(),selected_seats:Oe.string(),bus_scheme:Mi});const Pi=Oe.object({passengerId:Oe.string()}).refine((e=>e.passengerId),{message:"A 'passengerId' must be provided"});const Di=Oe.object({category:Oe.string(),number:Oe.string().optional(),occupied:Oe.boolean().optional(),adjacent_seats:Oe.null().optional()}),Zi=Oe.object({bus:Oe.array(Oe.array(Oe.array(Di)))}),Ai=Oe.object({bus_scheme:Zi,total_seats:Oe.number()});const Li=Oe.object({searchId:Oe.number().min(1,"SearchId is required")});const ji={init:async function init$1(e){vi.parseInitProps(e);const{mixpanelToken:r,debug:i=!1,identificationKey:s,isSandbox:a=!1,mixpanelProxyUrl:h,identifyProxyUrl:f}=e;wi.init(),await ti.init(r,i,h);try{await yt.initFingerprint(s,f)}catch(Or){console.error("Error initializing identification service:",Or)}At.setEnvironment(a?"sandbox":"prod"),Nt.setConfig(At.getCoreAPIConfig()),function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},isReady:isTrackerReady,identify:async function identify(e,r={}){tryTrackEvent((async()=>{try{if(vi.parseIdentifyProps(r),!e)throw console.error("User ID is required for identification."),new Error("User ID is required for identification.");const i=await createAnonymousProfile(r);i&&(r.reservamos_one_id=i.id);const s=function mapProperties(e){return{$first_name:null==e?void 0:e.firstName,$last_name:null==e?void 0:e.lastName,$email:null==e?void 0:e.email,$phone:null==e?void 0:e.phone,...Object.keys(e).reduce(((r,i)=>(Ci.includes(i)||(r[i]=e[i]),r)),{})}}(r);ti.identify(e,s);const a=await yt.getFingerprint();a&&ti.attachProperty("Known Fingerprints",a)}catch(Or){console.error("Error identifying user",Or),trackEventError("Identify",Or,{userId:e,properties:r})}finally{(async(e,r)=>{var i,s;try{const a=wi.getCoordinates();if(!a)return;r.first_name=r.firstName,r.last_name=r.lastName,r.latitude=a.lat,r.longitude=a.long,r.ip="0",r.name=`${r.firstName} ${r.lastName}`,delete r.firstName,delete r.lastName;const h=At.getCoreAPIConfig();fetch(`${h.baseUrl}/v1/datalake/identify`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:(null==(i=h.defaultHeaders)?void 0:i.Authorization)||"",Origin:(null==(s=h.defaultHeaders)?void 0:s.Origin)||""},body:JSON.stringify({profile_params:{...r,distinct_id:e}})})}catch(Or){console.error("Error identifying user-service",Or)}})(e,r)}}))},identifiers:{getFingerprintId:yt.getCachedFingerprint,getDistinctId:ti.getMixpanelDistinctId},profiles:{createAnonymousProfile:createAnonymousProfile},recommendations:{getRecommendedPlaces:async function getRecommendedPlaces(){const e=ti.getMixpanelDistinctId();if(!e)throw new Error("No distinct ID found");const r=await Nt.recommendations.createRecommendedPlaces({distinct_id:e});if(!r)throw new Error("No response received");return await(async e=>new Promise(((r,i)=>{const{state:s,polling_id:a}=e;"finished"!==s?Nt.recommendations.pollRecommendedPlaces(a,{start:!0,watch:"state",expect:"finished",onEachResponse:e=>{"finished"!==e.status?"failed"!==e.status||i(e):r(e)}}):r(e)})))(r)},createRecommendedSeats:async function createRecommendedSeats$1(e){try{vi.validateProps(e,Ni);const r=ti.getMixpanelDistinctId(),i=yt.getCachedFingerprint();if(!r)throw new Error("No distinct ID found");return await Nt.recommendations.createRecommendedSeats({...e,distinct_id:r,device_fingerprint:i||""})}catch(Or){throw console.error("Could not create recommended seats:",Or),new Error(Or instanceof Error?Or.message:String(Or))}},getRecommendedSeats:async function createRecommendedSeats(e){try{vi.validateProps(e,Ai);const r=ti.getMixpanelDistinctId();if(!r)throw new Error("No distinct ID found");return await Nt.recommendations.getRecommendedSeats({...e,distinct_id:r})}catch(Or){throw console.error("Could not create recommended seats:",Or),new Error(Or instanceof Error?Or.message:String(Or))}},getRecommendedTrips:async function getRecommendedTrips({searchId:e}){try{vi.validateProps({searchId:e},Li);const r=yt.getCachedFingerprint()||ti.getMixpanelDistinctId();if(!r)throw new Error("No identifier id");return await Nt.recommendations.getRecommendedTrips({searchId:e,userIdentifier:String(r)})}catch(Or){throw console.error("Could not get recommended trips:",Or),new Error(Or instanceof Error?Or.message:String(Or))}},createFrequentPassengers:async function createFrequentPassengers(e){try{vi.validateProps(e,Oi);const r=ti.getMixpanelDistinctId(),i=yt.getCachedFingerprint();if(!r)throw new Error("No distinct ID found");return await Nt.recommendations.createFrequentPassengers({...e,distinct_id:r,device_fingerprint:i||""})}catch(Or){throw new Error(Or instanceof Error?Or.message:String(Or))}},getFrequentPassengers:async function getFrequentPassengers(){try{const e=ti.getMixpanelDistinctId();if(!e)throw new Error("No distinct ID found");return await Nt.recommendations.getFrequentPassengers(e)}catch(Or){throw new Error(Or instanceof Error?Or.message:String(Or))}},deleteFrequentPassenger:async function deleteFrequentPassengers(e){try{vi.validateProps(e,Pi);const r=ti.getMixpanelDistinctId();if(!r)throw new Error("No distinct ID found");return await Nt.recommendations.deleteFrequentPassenger(r,e.passengerId)}catch(Or){throw new Error(Or instanceof Error?Or.message:String(Or))}}},track:{search:function trackSearch(e,r={}){trackEvent("Search",e,r)},seatChange:function trackSeatChange(e,r={}){trackEvent("Seat Change",e,r)},interestInHome:function trackInterestInHome(e,r={}){trackEvent("Interest In Home",e,r)},interestInSearch:function trackInterestInSearch(e,r={}){trackEvent("Interest In Search",e,r)},viewResults:function trackViewResults(e,r={}){trackEvent("View Results",e,r)},passengersCreated:function trackPassengersCreated(e,r={}){trackEvent("Passengers Created",e,r)},paymentAttempt:async(e,r={})=>{trackEvent("Payment Attempt",e,r)},purchaseAttempt:function trackPurchaseAttempt(e,r={}){trackEvent("Purchase Attempt",e,r)},pickedDeparture:function trackSearch$1(e,r={}){trackEvent("Picked Departure",e,r)},customEvent:trackCustomEvent,purchaseCanceled:function trackPurchaseCanceled(e,r={}){trackEvent("Purchase Canceled",e,r)}}};module.exports=ji;
31
31
  //# sourceMappingURL=browser-analytics.cjs.map