@reservamos/browser-analytics 1.0.13 → 1.0.21

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
- var browserAnalytics=function(){"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]])),o={};for(const r of i)o[r]=e[r];return r.objectValues(o)},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 o=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 o.undefined;case"string":return o.string;case"number":return isNaN(e)?o.nan:o.number;case"boolean":return o.boolean;case"function":return o.function;case"bigint":return o.bigint;case"symbol":return o.symbol;case"object":return Array.isArray(e)?o.array:null===e?o.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?o.promise:"undefined"!=typeof Map&&e instanceof Map?o.map:"undefined"!=typeof Set&&e instanceof Set?o.set:"undefined"!=typeof Date&&e instanceof Date?o.date:o.object;default:return o.unknown}},s=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 o of e.issues)if("invalid_union"===o.code)o.unionErrors.map(processError);else if("invalid_return_type"===o.code)processError(o.returnTypeError);else if("invalid_arguments"===o.code)processError(o.argumentsError);else if(0===o.path.length)i._errors.push(r(o));else{let e=i,s=0;for(;s<o.path.length;){const i=o.path[s];s===o.path.length-1?(e[i]=e[i]||{_errors:[]},e[i]._errors.push(r(o))):e[i]=e[i]||{_errors:[]},e=e[i],s++}}};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 o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(e(o))):i.push(e(o));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(r,i)=>{let a;switch(r.code){case s.invalid_type:a=r.received===o.undefined?"Required":`Expected ${r.expected}, received ${r.received}`;break;case s.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(r.expected,e.jsonStringifyReplacer)}`;break;case s.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(r.keys,", ")}`;break;case s.invalid_union:a="Invalid input";break;case s.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(r.options)}`;break;case s.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(r.options)}, received '${r.received}'`;break;case s.invalid_arguments:a="Invalid function arguments";break;case s.invalid_return_type:a="Invalid function return type";break;case s.invalid_date:a="Invalid date";break;case s.invalid_string:"object"==typeof r.validation?"includes"in r.validation?(a=`Invalid input: must include "${r.validation.includes}"`,"number"==typeof r.validation.position&&(a=`${a} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?a=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?a=`Invalid input: must end with "${r.validation.endsWith}"`:e.assertNever(r.validation):a="regex"!==r.validation?`Invalid ${r.validation}`:"Invalid";break;case s.too_small:a="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 s.too_big:a="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 s.custom:a="Invalid input";break;case s.invalid_intersection_types:a="Intersection results could not be merged";break;case s.not_multiple_of:a=`Number must be a multiple of ${r.multipleOf}`;break;case s.not_finite:a="Number must be finite";break;default:a=i.defaultError,e.assertNever(r)}return{message:a}};let a=errorMap;function getErrorMap(){return a}const makeIssue=e=>{const{data:r,path:i,errorMaps:o,issueData:s}=e,a=[...i,...s.path||[]],h={...s,path:a};if(void 0!==s.message)return{...s,path:a,message:s.message};let f="";const g=o.filter((e=>!!e)).slice().reverse();for(const _ of g)f=_(h,{data:r,defaultError:f}).message;return{...s,path:a,message:f}};function addIssueToContext(e,r){const i=getErrorMap(),o=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(o)}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 o of r){if("aborted"===o.status)return h;"dirty"===o.status&&e.dirty(),i.push(o.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){const i=[];for(const o of r){const e=await o.key,r=await o.value;i.push({key:e,value:r})}return ParseStatus.mergeObjectSync(e,i)}static mergeObjectSync(e,r){const i={};for(const o of r){const{key:r,value:s}=o;if("aborted"===r.status)return h;if("aborted"===s.status)return h;"dirty"===r.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===r.value||void 0===s.value&&!o.alwaysSet||(i[r.value]=s.value)}return{status:e.value,value:i}}}const h=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,o){if("function"==typeof r?e!==r||!o:!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,o,s){if("function"==typeof r?e!==r||!s:!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 f,g,_,y;"function"==typeof SuppressedError&&SuppressedError,(g=f||(f={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},g.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,r,i,o){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,this._key=o}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:o,description:s}=e;if(r&&(i||o))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(r)return{errorMap:r,description:s};return{errorMap:(r,s)=>{var a,h;const{message:f}=e;return"invalid_enum_value"===r.code?{message:null!=f?f:s.defaultError}:void 0===s.data?{message:null!==(a=null!=f?f:o)&&void 0!==a?a:s.defaultError}:"invalid_type"!==r.code?{message:s.defaultError}:{message:null!==(h=null!=f?f:i)&&void 0!==h?h:s.defaultError}},description:s}}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 o={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)},s=this._parseSync({data:e,path:o.path,parent:o});return handleResult(o,s)}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)},o=this._parse({data:e,path:i.path,parent:i}),s=await(isAsync(o)?o:Promise.resolve(o));return handleResult(i,s)}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 o=e(r),setError=()=>i.addIssue({code:s.custom,...getIssueProperties(r)});return"undefined"!=typeof Promise&&o instanceof Promise?o.then((e=>!!e||(setError(),!1))):!!o||(setError(),!1)}))}refinement(e,r){return this._refinement(((i,o)=>!!e(i)||(o.addIssue("function"==typeof r?r(i,o):r),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:q.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:q.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:q.ZodDefault})}brand(){return new ZodBranded({typeName:q.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:q.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 v=/^c[^\s-]{8,}$/i,b=/^[0-9a-z]+$/,S=/^[0-9A-HJKMNP-TV-Z]{26}$/,I=/^[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,x=/^[a-z0-9_-]{21}$/i,T=/^[-+]?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)?)??$/,O=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let R;const N=/^(?:(?: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])$/,P=/^(([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})))$/,D=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Z="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",A=new RegExp(`^${Z}$`);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=`${Z}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)!==o.string){const e=this._getOrReturnCtx(r);return addIssueToContext(e,{code:s.invalid_type,expected:o.string,received:e.parsedType}),h}const i=new ParseStatus;let a;for(const o of this._def.checks)if("min"===o.kind)r.data.length<o.value&&(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{code:s.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if("max"===o.kind)r.data.length>o.value&&(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{code:s.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if("length"===o.kind){const e=r.data.length>o.value,h=r.data.length<o.value;(e||h)&&(a=this._getOrReturnCtx(r,a),e?addIssueToContext(a,{code:s.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):h&&addIssueToContext(a,{code:s.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if("email"===o.kind)O.test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"email",code:s.invalid_string,message:o.message}),i.dirty());else if("emoji"===o.kind)R||(R=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),R.test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"emoji",code:s.invalid_string,message:o.message}),i.dirty());else if("uuid"===o.kind)I.test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"uuid",code:s.invalid_string,message:o.message}),i.dirty());else if("nanoid"===o.kind)x.test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"nanoid",code:s.invalid_string,message:o.message}),i.dirty());else if("cuid"===o.kind)v.test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"cuid",code:s.invalid_string,message:o.message}),i.dirty());else if("cuid2"===o.kind)b.test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"cuid2",code:s.invalid_string,message:o.message}),i.dirty());else if("ulid"===o.kind)S.test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"ulid",code:s.invalid_string,message:o.message}),i.dirty());else if("url"===o.kind)try{new URL(r.data)}catch(_){a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"url",code:s.invalid_string,message:o.message}),i.dirty()}else if("regex"===o.kind){o.regex.lastIndex=0;o.regex.test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"regex",code:s.invalid_string,message:o.message}),i.dirty())}else if("trim"===o.kind)r.data=r.data.trim();else if("includes"===o.kind)r.data.includes(o.value,o.position)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{code:s.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty());else if("toLowerCase"===o.kind)r.data=r.data.toLowerCase();else if("toUpperCase"===o.kind)r.data=r.data.toUpperCase();else if("startsWith"===o.kind)r.data.startsWith(o.value)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{code:s.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty());else if("endsWith"===o.kind)r.data.endsWith(o.value)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{code:s.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty());else if("datetime"===o.kind){datetimeRegex(o).test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{code:s.invalid_string,validation:"datetime",message:o.message}),i.dirty())}else if("date"===o.kind){A.test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{code:s.invalid_string,validation:"date",message:o.message}),i.dirty())}else if("time"===o.kind){new RegExp(`^${timeRegexSource(o)}$`).test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{code:s.invalid_string,validation:"time",message:o.message}),i.dirty())}else"duration"===o.kind?T.test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"duration",code:s.invalid_string,message:o.message}),i.dirty()):"ip"===o.kind?(f=r.data,("v4"!==(g=o.version)&&g||!N.test(f))&&("v6"!==g&&g||!P.test(f))&&(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"ip",code:s.invalid_string,message:o.message}),i.dirty())):"base64"===o.kind?D.test(r.data)||(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{validation:"base64",code:s.invalid_string,message:o.message}),i.dirty()):e.assertNever(o);var f,g;return{status:i.value,value:r.data}}_regex(e,r,i){return this.refinement((r=>e.test(r)),{validation:r,code:s.invalid_string,...f.errToObj(i)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...f.errToObj(e)})}url(e){return this._addCheck({kind:"url",...f.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...f.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...f.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...f.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...f.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...f.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...f.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...f.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...f.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,...f.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,...f.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...f.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...f.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:null==r?void 0:r.position,...f.errToObj(null==r?void 0:r.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...f.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...f.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...f.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...f.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...f.errToObj(r)})}nonempty(e){return this.min(1,f.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,o=(r.toString().split(".")[1]||"").length,s=i>o?i:o;return parseInt(e.toFixed(s).replace(".",""))%parseInt(r.toFixed(s).replace(".",""))/Math.pow(10,s)}ZodString.create=e=>{var r;return new ZodString({checks:[],typeName:q.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)!==o.number){const e=this._getOrReturnCtx(r);return addIssueToContext(e,{code:s.invalid_type,expected:o.number,received:e.parsedType}),h}let i;const a=new ParseStatus;for(const o of this._def.checks)if("int"===o.kind)e.isInteger(r.data)||(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:s.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty());else if("min"===o.kind){(o.inclusive?r.data<o.value:r.data<=o.value)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:s.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty())}else if("max"===o.kind){(o.inclusive?r.data>o.value:r.data>=o.value)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:s.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty())}else"multipleOf"===o.kind?0!==floatSafeRemainder(r.data,o.value)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:s.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):"finite"===o.kind?Number.isFinite(r.data)||(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:s.not_finite,message:o.message}),a.dirty()):e.assertNever(o);return{status:a.value,value:r.data}}gte(e,r){return this.setLimit("min",e,!0,f.toString(r))}gt(e,r){return this.setLimit("min",e,!1,f.toString(r))}lte(e,r){return this.setLimit("max",e,!0,f.toString(r))}lt(e,r){return this.setLimit("max",e,!1,f.toString(r))}setLimit(e,r,i,o){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:f.toString(o)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:f.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:f.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f.toString(e)})}get minValue(){let e=null;for(const 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:q.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)!==o.bigint){const e=this._getOrReturnCtx(r);return addIssueToContext(e,{code:s.invalid_type,expected:o.bigint,received:e.parsedType}),h}let i;const a=new ParseStatus;for(const o of this._def.checks)if("min"===o.kind){(o.inclusive?r.data<o.value:r.data<=o.value)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:s.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty())}else if("max"===o.kind){(o.inclusive?r.data>o.value:r.data>=o.value)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:s.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty())}else"multipleOf"===o.kind?r.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(r,i),addIssueToContext(i,{code:s.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):e.assertNever(o);return{status:a.value,value:r.data}}gte(e,r){return this.setLimit("min",e,!0,f.toString(r))}gt(e,r){return this.setLimit("min",e,!1,f.toString(r))}lte(e,r){return this.setLimit("max",e,!0,f.toString(r))}lt(e,r){return this.setLimit("max",e,!1,f.toString(r))}setLimit(e,r,i,o){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:f.toString(o)}]})}_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:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:f.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:q.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)!==o.boolean){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:s.invalid_type,expected:o.boolean,received:r.parsedType}),h}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:q.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)!==o.date){const e=this._getOrReturnCtx(r);return addIssueToContext(e,{code:s.invalid_type,expected:o.date,received:e.parsedType}),h}if(isNaN(r.data.getTime())){return addIssueToContext(this._getOrReturnCtx(r),{code:s.invalid_date}),h}const i=new ParseStatus;let a;for(const o of this._def.checks)"min"===o.kind?r.data.getTime()<o.value&&(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{code:s.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):"max"===o.kind?r.data.getTime()>o.value&&(a=this._getOrReturnCtx(r,a),addIssueToContext(a,{code:s.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):e.assertNever(o);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:f.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:f.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:q.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==o.symbol){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:s.invalid_type,expected:o.symbol,received:r.parsedType}),h}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:q.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==o.undefined){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:s.invalid_type,expected:o.undefined,received:r.parsedType}),h}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:q.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==o.null){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:s.invalid_type,expected:o.null,received:r.parsedType}),h}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:q.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:q.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:q.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:s.invalid_type,expected:o.never,received:r.parsedType}),h}}ZodNever.create=e=>new ZodNever({typeName:q.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==o.undefined){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:s.invalid_type,expected:o.void,received:r.parsedType}),h}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:q.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:r,status:i}=this._processInputParams(e),a=this._def;if(r.parsedType!==o.array)return addIssueToContext(r,{code:s.invalid_type,expected:o.array,received:r.parsedType}),h;if(null!==a.exactLength){const e=r.data.length>a.exactLength.value,o=r.data.length<a.exactLength.value;(e||o)&&(addIssueToContext(r,{code:e?s.too_big:s.too_small,minimum:o?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),i.dirty())}if(null!==a.minLength&&r.data.length<a.minLength.value&&(addIssueToContext(r,{code:s.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),i.dirty()),null!==a.maxLength&&r.data.length>a.maxLength.value&&(addIssueToContext(r,{code:s.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map(((e,i)=>a.type._parseAsync(new ParseInputLazyPath(r,e,r.path,i))))).then((e=>ParseStatus.mergeArray(i,e)));const f=[...r.data].map(((e,i)=>a.type._parseSync(new ParseInputLazyPath(r,e,r.path,i))));return ParseStatus.mergeArray(i,f)}get element(){return this._def.type}min(e,r){return new ZodArray({...this._def,minLength:{value:e,message:f.toString(r)}})}max(e,r){return new ZodArray({...this._def,maxLength:{value:e,message:f.toString(r)}})}length(e,r){return new ZodArray({...this._def,exactLength:{value:e,message:f.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 o=e.shape[i];r[i]=ZodOptional.create(deepPartialify(o))}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:q.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)!==o.object){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:s.invalid_type,expected:o.object,received:r.parsedType}),h}const{status:r,ctx:i}=this._processInputParams(e),{shape:a,keys:f}=this._getCached(),g=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const o in i.data)f.includes(o)||g.push(o);const _=[];for(const o of f){const e=a[o],r=i.data[o];_.push({key:{status:"valid",value:o},value:e._parse(new ParseInputLazyPath(i,r,i.path,o)),alwaysSet:o in i.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const r of g)_.push({key:{status:"valid",value:r},value:{status:"valid",value:i.data[r]}});else if("strict"===e)g.length>0&&(addIssueToContext(i,{code:s.unrecognized_keys,keys:g}),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 g){const o=i.data[r];_.push({key:{status:"valid",value:r},value:e._parse(new ParseInputLazyPath(i,o,i.path,r)),alwaysSet:r in i.data})}}return i.common.async?Promise.resolve().then((async()=>{const e=[];for(const r of _){const i=await r.key,o=await r.value;e.push({key:i,value:o,alwaysSet:r.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(r,e))):ParseStatus.mergeObjectSync(r,_)}get shape(){return this._def.shape()}strict(e){return f.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(r,i)=>{var o,s,a,h;const g=null!==(a=null===(s=(o=this._def).errorMap)||void 0===s?void 0:s.call(o,r,i).message)&&void 0!==a?a:i.defaultError;return"unrecognized_keys"===r.code?{message:null!==(h=f.errToObj(e).message)&&void 0!==h?h:g}:{message:g}}}:{}})}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:q.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 o=this.shape[e];r&&!r[e]?i[e]=o:i[e]=o.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:q.ZodObject,...processCreateParams(r)}),ZodObject.strictCreate=(e,r)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:q.ZodObject,...processCreateParams(r)}),ZodObject.lazycreate=(e,r)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:q.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 o of e)if("dirty"===o.result.status)return r.common.issues.push(...o.ctx.common.issues),o.result;const i=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(r,{code:s.invalid_union,unionErrors:i}),h}));{let e;const o=[];for(const s of i){const i={...r,common:{...r.common,issues:[]},parent:null},a=s._parseSync({data:r.data,path:r.path,parent:i});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:i}),i.common.issues.length&&o.push(i.common.issues)}if(e)return r.common.issues.push(...e.ctx.common.issues),e.result;const a=o.map((e=>new ZodError(e)));return addIssueToContext(r,{code:s.invalid_union,unionErrors:a}),h}}get options(){return this._def.options}}ZodUnion.create=(e,r)=>new ZodUnion({options:e,typeName:q.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!==o.object)return addIssueToContext(r,{code:s.invalid_type,expected:o.object,received:r.parsedType}),h;const i=this.discriminator,a=r.data[i],f=this.optionsMap.get(a);return f?r.common.async?f._parseAsync({data:r.data,path:r.path,parent:r}):f._parseSync({data:r.data,path:r.path,parent:r}):(addIssueToContext(r,{code:s.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),h)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,i){const o=new Map;for(const s of r){const r=getDiscriminator(s.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(o.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);o.set(i,s)}}return new ZodDiscriminatedUnion({typeName:q.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:o,...processCreateParams(i)})}}function mergeValues(r,i){const s=getParsedType(r),a=getParsedType(i);if(r===i)return{valid:!0,data:r};if(s===o.object&&a===o.object){const o=e.objectKeys(i),s=e.objectKeys(r).filter((e=>-1!==o.indexOf(e))),a={...r,...i};for(const e of s){const o=mergeValues(r[e],i[e]);if(!o.valid)return{valid:!1};a[e]=o.data}return{valid:!0,data:a}}if(s===o.array&&a===o.array){if(r.length!==i.length)return{valid:!1};const e=[];for(let o=0;o<r.length;o++){const s=mergeValues(r[o],i[o]);if(!s.valid)return{valid:!1};e.push(s.data)}return{valid:!0,data:e}}return s===o.date&&a===o.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,o)=>{if(isAborted(e)||isAborted(o))return h;const a=mergeValues(e.value,o.value);return a.valid?((isDirty(e)||isDirty(o))&&r.dirty(),{status:r.value,value:a.data}):(addIssueToContext(i,{code:s.invalid_intersection_types}),h)};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:q.ZodIntersection,...processCreateParams(i)});class ZodTuple extends ZodType{_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==o.array)return addIssueToContext(i,{code:s.invalid_type,expected:o.array,received:i.parsedType}),h;if(i.data.length<this._def.items.length)return addIssueToContext(i,{code:s.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),h;!this._def.rest&&i.data.length>this._def.items.length&&(addIssueToContext(i,{code:s.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());const a=[...i.data].map(((e,r)=>{const o=this._def.items[r]||this._def.rest;return o?o._parse(new ParseInputLazyPath(i,e,i.path,r)):null})).filter((e=>!!e));return i.common.async?Promise.all(a).then((e=>ParseStatus.mergeArray(r,e))):ParseStatus.mergeArray(r,a)}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:q.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!==o.object)return addIssueToContext(i,{code:s.invalid_type,expected:o.object,received:i.parsedType}),h;const a=[],f=this._def.keyType,g=this._def.valueType;for(const o in i.data)a.push({key:f._parse(new ParseInputLazyPath(i,o,i.path,o)),value:g._parse(new ParseInputLazyPath(i,i.data[o],i.path,o)),alwaysSet:o in i.data});return i.common.async?ParseStatus.mergeObjectAsync(r,a):ParseStatus.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(e,r,i){return new ZodRecord(r instanceof ZodType?{keyType:e,valueType:r,typeName:q.ZodRecord,...processCreateParams(i)}:{keyType:ZodString.create(),valueType:e,typeName:q.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!==o.map)return addIssueToContext(i,{code:s.invalid_type,expected:o.map,received:i.parsedType}),h;const a=this._def.keyType,f=this._def.valueType,g=[...i.data.entries()].map((([e,r],o)=>({key:a._parse(new ParseInputLazyPath(i,e,i.path,[o,"key"])),value:f._parse(new ParseInputLazyPath(i,r,i.path,[o,"value"]))})));if(i.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const i of g){const o=await i.key,s=await i.value;if("aborted"===o.status||"aborted"===s.status)return h;"dirty"!==o.status&&"dirty"!==s.status||r.dirty(),e.set(o.value,s.value)}return{status:r.value,value:e}}))}{const e=new Map;for(const i of g){const o=i.key,s=i.value;if("aborted"===o.status||"aborted"===s.status)return h;"dirty"!==o.status&&"dirty"!==s.status||r.dirty(),e.set(o.value,s.value)}return{status:r.value,value:e}}}}ZodMap.create=(e,r,i)=>new ZodMap({valueType:r,keyType:e,typeName:q.ZodMap,...processCreateParams(i)});class ZodSet extends ZodType{_parse(e){const{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==o.set)return addIssueToContext(i,{code:s.invalid_type,expected:o.set,received:i.parsedType}),h;const a=this._def;null!==a.minSize&&i.data.size<a.minSize.value&&(addIssueToContext(i,{code:s.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),null!==a.maxSize&&i.data.size>a.maxSize.value&&(addIssueToContext(i,{code:s.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());const f=this._def.valueType;function finalizeSet(e){const i=new Set;for(const o of e){if("aborted"===o.status)return h;"dirty"===o.status&&r.dirty(),i.add(o.value)}return{status:r.value,value:i}}const g=[...i.data.values()].map(((e,r)=>f._parse(new ParseInputLazyPath(i,e,i.path,r))));return i.common.async?Promise.all(g).then((e=>finalizeSet(e))):finalizeSet(g)}min(e,r){return new ZodSet({...this._def,minSize:{value:e,message:f.toString(r)}})}max(e,r){return new ZodSet({...this._def,maxSize:{value:e,message:f.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:q.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!==o.function)return addIssueToContext(r,{code:s.invalid_type,expected:o.function,received:r.parsedType}),h;function makeArgsIssue(e,i){return makeIssue({data:e,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:s.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:s.invalid_return_type,returnTypeError:i}})}const i={errorMap:r.common.contextualErrorMap},a=r.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...r){const o=new ZodError([]),s=await e._def.args.parseAsync(r,i).catch((e=>{throw o.addIssue(makeArgsIssue(r,e)),o})),h=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(h,i).catch((e=>{throw o.addIssue(makeReturnsIssue(h,e)),o}))}))}{const e=this;return OK((function(...r){const o=e._def.args.safeParse(r,i);if(!o.success)throw new ZodError([makeArgsIssue(r,o.error)]);const s=Reflect.apply(a,this,o.data),h=e._def.returns.safeParse(s,i);if(!h.success)throw new ZodError([makeReturnsIssue(s,h.error)]);return h.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:q.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:q.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:s.invalid_literal,expected:this._def.value}),h}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,r){return new ZodEnum({values:e,typeName:q.ZodEnum,...processCreateParams(r)})}ZodLiteral.create=(e,r)=>new ZodLiteral({value:e,typeName:q.ZodLiteral,...processCreateParams(r)});class ZodEnum extends ZodType{constructor(){super(...arguments),_.set(this,void 0)}_parse(r){if("string"!=typeof r.data){const i=this._getOrReturnCtx(r),o=this._def.values;return addIssueToContext(i,{expected:e.joinValues(o),received:i.parsedType,code:s.invalid_type}),h}if(__classPrivateFieldGet(this,_)||__classPrivateFieldSet(this,_,new Set(this._def.values)),!__classPrivateFieldGet(this,_).has(r.data)){const e=this._getOrReturnCtx(r),i=this._def.values;return addIssueToContext(e,{received:e.data,code:s.invalid_enum_value,options:i}),h}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})}}_=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),y.set(this,void 0)}_parse(r){const i=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(r);if(a.parsedType!==o.string&&a.parsedType!==o.number){const r=e.objectValues(i);return addIssueToContext(a,{expected:e.joinValues(r),received:a.parsedType,code:s.invalid_type}),h}if(__classPrivateFieldGet(this,y)||__classPrivateFieldSet(this,y,new Set(e.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,y).has(r.data)){const r=e.objectValues(i);return addIssueToContext(a,{received:a.data,code:s.invalid_enum_value,options:r}),h}return OK(r.data)}get enum(){return this._def.values}}y=new WeakMap,ZodNativeEnum.create=(e,r)=>new ZodNativeEnum({values:e,typeName:q.ZodNativeEnum,...processCreateParams(r)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:r}=this._processInputParams(e);if(r.parsedType!==o.promise&&!1===r.common.async)return addIssueToContext(r,{code:s.invalid_type,expected:o.promise,received:r.parsedType}),h;const i=r.parsedType===o.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:q.ZodPromise,...processCreateParams(r)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===q.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(r){const{status:i,ctx:o}=this._processInputParams(r),s=this._def.effect||null,a={addIssue:e=>{addIssueToContext(o,e),e.fatal?i.abort():i.dirty()},get path(){return o.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===s.type){const e=s.transform(o.data,a);if(o.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===i.value)return h;const r=await this._def.schema._parseAsync({data:e,path:o.path,parent:o});return"aborted"===r.status?h:"dirty"===r.status||"dirty"===i.value?DIRTY(r.value):r}));{if("aborted"===i.value)return h;const r=this._def.schema._parseSync({data:e,path:o.path,parent:o});return"aborted"===r.status?h:"dirty"===r.status||"dirty"===i.value?DIRTY(r.value):r}}if("refinement"===s.type){const executeRefinement=e=>{const r=s.refinement(e,a);if(o.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===o.common.async){const e=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});return"aborted"===e.status?h:("dirty"===e.status&&i.dirty(),executeRefinement(e.value),{status:i.value,value:e.value})}return this._def.schema._parseAsync({data:o.data,path:o.path,parent:o}).then((e=>"aborted"===e.status?h:("dirty"===e.status&&i.dirty(),executeRefinement(e.value).then((()=>({status:i.value,value:e.value}))))))}if("transform"===s.type){if(!1===o.common.async){const e=this._def.schema._parseSync({data:o.data,path:o.path,parent:o});if(!isValid(e))return e;const r=s.transform(e.value,a);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:o.data,path:o.path,parent:o}).then((e=>isValid(e)?Promise.resolve(s.transform(e.value,a)).then((e=>({status:i.value,value:e}))):e))}e.assertNever(s)}}ZodEffects.create=(e,r,i)=>new ZodEffects({schema:e,typeName:q.ZodEffects,effect:r,...processCreateParams(i)}),ZodEffects.createWithPreprocess=(e,r,i)=>new ZodEffects({schema:r,effect:{type:"preprocess",transform:e},typeName:q.ZodEffects,...processCreateParams(i)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===o.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,r)=>new ZodOptional({innerType:e,typeName:q.ZodOptional,...processCreateParams(r)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===o.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,r)=>new ZodNullable({innerType:e,typeName:q.ZodNullable,...processCreateParams(r)});class ZodDefault extends ZodType{_parse(e){const{ctx:r}=this._processInputParams(e);let i=r.data;return r.parsedType===o.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:q.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:[]}},o=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return isAsync(o)?o.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"===o.status?o.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:q.ZodCatch,catchValue:"function"==typeof r.catch?r.catch:()=>r.catch,...processCreateParams(r)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==o.nan){const r=this._getOrReturnCtx(e);return addIssueToContext(r,{code:s.invalid_type,expected:o.nan,received:r.parsedType}),h}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:q.ZodNaN,...processCreateParams(e)});const L=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?h:"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?h:"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:q.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(((o,s)=>{var a,h;if(!e(o)){const e="function"==typeof r?r(o):"string"==typeof r?{message:r}:r,f=null===(h=null!==(a=e.fatal)&&void 0!==a?a:i)||void 0===h||h,g="string"==typeof e?{message:e}:e;s.addIssue({code:"custom",...g,fatal:f})}})):ZodAny.create()}ZodReadonly.create=(e,r)=>new ZodReadonly({innerType:e,typeName:q.ZodReadonly,...processCreateParams(r)});const j={object:ZodObject.lazycreate};var q,U;(U=q||(q={})).ZodString="ZodString",U.ZodNumber="ZodNumber",U.ZodNaN="ZodNaN",U.ZodBigInt="ZodBigInt",U.ZodBoolean="ZodBoolean",U.ZodDate="ZodDate",U.ZodSymbol="ZodSymbol",U.ZodUndefined="ZodUndefined",U.ZodNull="ZodNull",U.ZodAny="ZodAny",U.ZodUnknown="ZodUnknown",U.ZodNever="ZodNever",U.ZodVoid="ZodVoid",U.ZodArray="ZodArray",U.ZodObject="ZodObject",U.ZodUnion="ZodUnion",U.ZodDiscriminatedUnion="ZodDiscriminatedUnion",U.ZodIntersection="ZodIntersection",U.ZodTuple="ZodTuple",U.ZodRecord="ZodRecord",U.ZodMap="ZodMap",U.ZodSet="ZodSet",U.ZodFunction="ZodFunction",U.ZodLazy="ZodLazy",U.ZodLiteral="ZodLiteral",U.ZodEnum="ZodEnum",U.ZodEffects="ZodEffects",U.ZodNativeEnum="ZodNativeEnum",U.ZodOptional="ZodOptional",U.ZodNullable="ZodNullable",U.ZodDefault="ZodDefault",U.ZodCatch="ZodCatch",U.ZodPromise="ZodPromise",U.ZodBranded="ZodBranded",U.ZodPipeline="ZodPipeline",U.ZodReadonly="ZodReadonly";const B=ZodString.create,z=ZodNumber.create,W=ZodNaN.create,K=ZodBigInt.create,H=ZodBoolean.create,G=ZodDate.create,J=ZodSymbol.create,Y=ZodUndefined.create,X=ZodNull.create,Q=ZodAny.create,ee=ZodUnknown.create,te=ZodNever.create,re=ZodVoid.create,ne=ZodArray.create,ie=ZodObject.create,oe=ZodObject.strictCreate,se=ZodUnion.create,ae=ZodDiscriminatedUnion.create,ce=ZodIntersection.create,de=ZodTuple.create,ue=ZodRecord.create,le=ZodMap.create,pe=ZodSet.create,he=ZodFunction.create,fe=ZodLazy.create,me=ZodLiteral.create,ge=ZodEnum.create,_e=ZodNativeEnum.create,ye=ZodPromise.create,ve=ZodEffects.create,be=ZodOptional.create,Se=ZodNullable.create,ke=ZodEffects.createWithPreprocess,we=ZodPipeline.create,Ie={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})},xe=h;var Ee=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:function setErrorMap(e){a=e},getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:[],addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:h,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return e},get objectUtil(){return i},ZodParsedType:o,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:L,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:j,get ZodFirstPartyTypeKind(){return q},coerce:Ie,any:Q,array:ne,bigint:K,boolean:H,date:G,discriminatedUnion:ae,effect:ve,enum:ge,function:he,instanceof:(e,r={message:`Input not instance of ${e.name}`})=>custom((r=>r instanceof e),r),intersection:ce,lazy:fe,literal:me,map:le,nan:W,nativeEnum:_e,never:te,null:X,nullable:Se,number:z,object:ie,oboolean:()=>H().optional(),onumber:()=>z().optional(),optional:be,ostring:()=>B().optional(),pipeline:we,preprocess:ke,promise:ye,record:ue,set:pe,strictObject:oe,string:B,symbol:J,transformer:ve,tuple:de,undefined:Y,union:se,unknown:ee,void:re,NEVER:xe,ZodIssueCode:s,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:ZodError});const Ce=Ee.union([Ee.string(),Ee.boolean(),Ee.number(),Ee.undefined()]),Te=Ee.record(Ee.string(),Ee.union([Ce,Ee.array(Ce)])),Oe=Ee.string().min(1,"Event name is required");var __assign=function(){return __assign=Object.assign||function __assign2(e){for(var r,i=1,o=arguments.length;i<o;i++)for(var s in r=arguments[i])Object.prototype.hasOwnProperty.call(r,s)&&(e[s]=r[s]);return e},__assign.apply(this,arguments)};function __awaiter$1(e,r,i,o){return new(i||(i=Promise))((function(s,a){function fulfilled(e){try{step(o.next(e))}catch(r){a(r)}}function rejected(e){try{step(o.throw(e))}catch(r){a(r)}}function step(e){e.done?s(e.value):function adopt(e){return e instanceof i?e:new i((function(r){r(e)}))}(e.value).then(fulfilled,rejected)}step((o=o.apply(e,r||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var Re={default:"endpoint"},Me={default:"tlsEndpoint"},Ne="Client timeout",Pe="Network connection error",De="Network request aborted",Ze="Response cannot be parsed",Ae="Blocked by CSP",Le="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 o=e[i].toLowerCase();o!==e[i]?r+=" ".concat(o):r+=e[i]}else r+=e[i].toUpperCase();return r}var je=E$1("WrongRegion"),Fe=E$1("SubscriptionNotActive"),qe=E$1("UnsupportedVersion"),$e=E$1("InstallationMethodRestricted"),Ue=E$1("HostnameRestricted"),Be=E$1("IntegrationFailed"),ze="API key required",Ve="API key not found",We="API key expired",Ke="Request cannot be parsed",He="Request failed",Ge="Request failed to process",Je="Too many requests, rate limit exceeded",Ye="Not available for this origin",Xe="Not available with restricted header",Qe=ze,et=Ve,tt=We,rt="Failed to load the JS script of the agent",nt="9319";function M(e,r){var i,o,s,a,h,f=[],g=(h=function __spreadArray(e,r,i){if(i||2===arguments.length)for(var o,s=0,a=r.length;s<a;s++)!o&&s in r||(o||(o=Array.prototype.slice.call(r,0,s)),o[s]=r[s]);return e.concat(o||Array.prototype.slice.call(r))}([],e,!0),i={current:function(){return h[0]},postpone:function(){var e=h.shift();void 0!==e&&h.push(e)},exclude:function(){h.shift()}},a=0,o=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,a++))},s=new Set,[i.current(),function(e,r){var a,h=r instanceof Error?r.message:"";if(h===Ae||h===Le)i.exclude(),a=0;else if(h===nt)i.exclude();else if(h===rt){var f=Date.now()-e.getTime()<50,g=i.current();g&&f&&!s.has(g)&&(s.add(g),a=0),i.postpone()}else i.postpone();var _=i.current();return void 0===_?void 0:[_,null!=a?a:e.getTime()+o()-Date.now()]}]),_=g[0],y=g[1];if(void 0===_)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 f.push({url:e,startedAt:i,finishedAt:new Date,error:r})},o=r(e);return o.then((function(){return r3()}),r3),o.catch((function(e){if(f.length>=5)throw e;var r=y(i,e);if(!r)throw e;var o,s=r[0],a=r[1];return(o=a,new Promise((function(e){return setTimeout(e,o)}))).then((function(){return p2(s)}))}))};return p2(_).then((function(e){return[e,f]}))}var it="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",ot=it;function F(e){var r;e.scriptUrlPattern;var i,o,s,a,h,f,g,_=e.token,y=e.apiKey,v=void 0===y?_:y,b=function __rest$1(e,r){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(o=Object.getOwnPropertySymbols(e);s<o.length;s++)r.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(e,o[s])&&(i[o[s]]=e[o[s]])}return i}(e,["scriptUrlPattern","token","apiKey"]),S=null!==(r=function r$2(e,r){return i=e,o=r,Object.prototype.hasOwnProperty.call(i,o)?e[r]:void 0;var i,o}(e,"scriptUrlPattern"))&&void 0!==r?r:it,I=(h=[],f=function(){h.push({time:new Date,state:document.visibilityState})},i=document,o="visibilitychange",s=f,i.addEventListener(o,s,a),g=function(){return i.removeEventListener(o,s,a)},f(),[h,g]),x=I[0],T=I[1];return Promise.resolve().then((function(){if(!v||"string"!=typeof v)throw new Error(ze);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)}))}(S,v);return M(e,V)})).catch((function(e){throw T(),function(e){return e instanceof Error&&e.message===nt?new Error(rt):e}(e)})).then((function(e){var r=e[0],i=e[1];return T(),r.load(__assign(__assign({},b),{ldi:{attempts:i,visibilityStates:x}}))}))}function V(e){return function o$1(e,r,i,o){var s,a=document,h="securitypolicyviolation",u2=function(r){var i=new URL(e,location.href),o=r.blockedURI;o!==i.href&&o!==i.protocol.slice(0,-1)&&o!==i.origin||(s=r,R2())};a.addEventListener(h,u2);var R2=function(){return a.removeEventListener(h,u2)};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(),s)return i(s);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(Le);var o=document.createElement("script"),o2=function(){var e;return null===(e=o.parentNode)||void 0===e?void 0:e.removeChild(o)},s=document.head||document.getElementsByTagName("head")[0];o.onload=function(){o2(),e()},o.onerror=function(){o2(),i(new Error(rt))},o.async=!0,o.src=r,s.appendChild(o)}));var r}),(function(){throw new Error(Ae)})).then(k)}function k(){var e,r,i,o,s=window,a="__fpjs_p_l_b",h=s[a];if(e=s,r=a,(null==(o=null===(i=Object.getOwnPropertyDescriptor)||void 0===i?void 0:i.call(Object,e,r))?void 0:o.configurable)?delete e[r]:o&&!o.writable||(e[r]=void 0),"function"!=typeof(null==h?void 0:h.load))throw new Error(nt);return h}var st={load:F,defaultScriptUrlPattern:ot,ERROR_SCRIPT_LOAD_FAIL:rt,ERROR_API_KEY_EXPIRED:We,ERROR_API_KEY_INVALID:Ve,ERROR_API_KEY_MISSING:ze,ERROR_BAD_REQUEST_FORMAT:Ke,ERROR_BAD_RESPONSE_FORMAT:Ze,ERROR_CLIENT_TIMEOUT:Ne,ERROR_CSP_BLOCK:Ae,ERROR_FORBIDDEN_ENDPOINT:Ue,ERROR_FORBIDDEN_HEADER:Xe,ERROR_FORBIDDEN_ORIGIN:Ye,ERROR_GENERAL_SERVER_FAILURE:He,ERROR_INSTALLATION_METHOD_RESTRICTED:$e,ERROR_INTEGRATION_FAILURE:Be,ERROR_INVALID_ENDPOINT:Le,ERROR_NETWORK_ABORT:De,ERROR_NETWORK_CONNECTION:Pe,ERROR_RATE_LIMIT:Je,ERROR_SERVER_TIMEOUT:Ge,ERROR_SUBSCRIPTION_NOT_ACTIVE:Fe,ERROR_TOKEN_EXPIRED:tt,ERROR_TOKEN_INVALID:et,ERROR_TOKEN_MISSING:Qe,ERROR_UNSUPPORTED_VERSION:qe,ERROR_WRONG_REGION:je,defaultEndpoint:Re,defaultTlsEndpoint:Me};const at=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:We,ERROR_API_KEY_INVALID:Ve,ERROR_API_KEY_MISSING:ze,ERROR_BAD_REQUEST_FORMAT:Ke,ERROR_BAD_RESPONSE_FORMAT:Ze,ERROR_CLIENT_TIMEOUT:Ne,ERROR_CSP_BLOCK:Ae,ERROR_FORBIDDEN_ENDPOINT:Ue,ERROR_FORBIDDEN_HEADER:Xe,ERROR_FORBIDDEN_ORIGIN:Ye,ERROR_GENERAL_SERVER_FAILURE:He,ERROR_INSTALLATION_METHOD_RESTRICTED:$e,ERROR_INTEGRATION_FAILURE:Be,ERROR_INVALID_ENDPOINT:Le,ERROR_NETWORK_ABORT:De,ERROR_NETWORK_CONNECTION:Pe,ERROR_RATE_LIMIT:Je,ERROR_SCRIPT_LOAD_FAIL:rt,ERROR_SERVER_TIMEOUT:Ge,ERROR_SUBSCRIPTION_NOT_ACTIVE:Fe,ERROR_TOKEN_EXPIRED:tt,ERROR_TOKEN_INVALID:et,ERROR_TOKEN_MISSING:Qe,ERROR_UNSUPPORTED_VERSION:qe,ERROR_WRONG_REGION:je,default:st,defaultEndpoint:Re,defaultScriptUrlPattern:ot,defaultTlsEndpoint:Me,load:F},Symbol.toStringTag,{value:"Module"})),ct="@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=ct){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=ct){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(),o=Math.floor(i/1e3);if(!(r.expiresAt<o))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 dt,ut;(ut=dt||(dt={})).Memory="memory",ut.LocalStorage="localstorage",ut.SessionStorage="sessionstorage",ut.NoCache="nocache";const lt={[dt.Memory]:()=>(new InMemoryCache).enclosedCache,[dt.LocalStorage]:e=>new LocalStorageCache(e),[dt.SessionStorage]:e=>new SessionStorageCache(e),[dt.NoCache]:()=>new CacheStub},cacheFactory=e=>lt[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)||dt.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(e=>{switch(e){case dt.SessionStorage:try{window.sessionStorage.getItem("item")}catch(r){return!1}return!0;case dt.LocalStorage:try{window.localStorage.getItem("item")}catch(r){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=dt.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 o=null!==(r=null==e?void 0:e.cacheTimeInSeconds)&&void 0!==r?r:3600;this.cacheManager=new CacheManager(i,o)}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 o=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:at;this.agentPromise=e.load(o).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 o=this._identify(e,r).finally((()=>{this.inFlightRequests.delete(i)}));this.inFlightRequests.set(i,o)}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 o=yield this.agent.get(e);return yield this.cacheManager.set(i,o),Object.assign(Object.assign({},o),{cacheHit:!1})}))}}const pt="default_fingerprint_cache",ht=7,ft="apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",getExpirationDate=e=>new Date((new Date).getTime()+24*e*60*60*1e3).getTime(),getCachedFingerprint=()=>{const{cacheName:e=pt}=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 mt={initFingerprint:async function initFingerprint(e,r){const i=[Re],o=[ot];r&&(i.unshift(r),o.unshift(function buildProxyUrl(e){return`${e}?${ft}`}(r))),window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:e,endpoint:i,scriptUrlPattern:o}});try{await window.fpClient.init()}catch(Cr){throw console.error("Error initializing identification service:",Cr),Cr}},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=pt,cacheTimeInDays:i=ht}=window.fingerprintConfig,o={fingerprint:e,expiresAt:getExpirationDate(i)};localStorage.setItem(r,JSON.stringify(o))})(r),r}catch(Cr){throw console.error("Error retrieving fingerprint:",Cr),Cr}},isFingerprintReady:isFingerprintReady,getCachedFingerprint:getCachedFingerprint},gt={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:""}},_t="sandbox",yt={env:_t,headers:{},searchUrl:gt[_t].search,purchaseUrl:gt[_t].purchase,coreUrl:gt[_t].core,version:"v2",coreVersion:"v1",apiKey:void 0,userAuthToken:void 0,withCredentials:!1};let vt=Object.assign({},yt);const bt={1:{code:200,message:"Operación no autorizada"}},St={3:{code:300,message:"Parámetros incorrectos"},7:{code:301,message:"Fecha inválida"}},kt={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}}),wt={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}}),It={50:{code:50,message:"Unknow Error"}},i$2=e=>({...bt,...St,...kt,...n(e),...wt,...It,...c$1(e)});let xt=class t extends Error{constructor(e=-100,r="Unknown error"){super(r),this.code=e,this.stack=(new Error).stack}};function l$1(e){const r=e.json();if(e.ok)return r;if(![404,422,500].includes(e.status))throw new xt(e.status,e.statusText);switch(e.status){case 404:throw new xt(100,"Not found");case 422:return r;case 500:throw new xt(101,"Server error");default:throw new xt}}function w(e){if(e.errors instanceof Array){const{code:r=-100,message:i="Unknown error"}=e.errors[0]||{},o=i$2(i)[r];throw o?new xt(o.code,o.message):new xt(r,i)}return e}function c(e,r={},i={},o){const{apiKey:s,withCredentials:a,userAuthToken:h,headers:f}=vt,g={Accept:"application/json",Authorization:`Token token=${i.apiKey||s}`,"Content-Type":"application/json"};return h&&(g.Authorization=`Token ${i.apiKey||s}, Bearer ${h}`),r.headers=function y$1(...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)}(f,g),r.credentials=a?"include":"omit","string"!=typeof r.body&&(r.body=JSON.stringify(r.body)),fetch(e,r).then(l$1).then(w).catch(o)}let Et=class u{constructor({url:e,watch:r,expect:i,maxRetries:o=30,interval:s=2e3,eachCall:a=null}){this.url=e,this.watch=r,this.expect=i instanceof Array?i:[i],this.interval=s,this.maxRetries=o,this.eachCall=a&&a.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 Ct=function C({apiName:e,defaultApiVersion:r}){let i,o,s={"Content-Type":"application/json"};function u2(){if(!i)throw new Error(`Base URL is not set for ${e} API.`)}const a={body:{}};return{get:async function y2(e,o={}){u2();const{headers:s={},apiVersion:a=r}=o,h=`${i}/${a}/${e}`;return(await fetch(h,{headers:s})).json()},post:async function $(e,h=a){u2();const{body:f,headers:g={},apiVersion:_=r}=h,y=`${i}/${_}/${e}`,v={...s,...g,...o?{Authorization:o}:{}};return(await fetch(y,{method:"POST",body:JSON.stringify(f),headers:v})).json()},setAuthorizationHeader:function p2(e){o=e},setConfig:function f2(e){i=e.baseUrl,s={...s,...e.defaultHeaders||{}}},poll:function w2(e,o){const s={url:`${i}/${r}/${e}`,watch:o.watch,expect:o.expect,eachCall:o.onEachResponse};return new Et(s)}}}({apiName:"Core",defaultApiVersion:"v1"});const Tt={createAnonymousProfile:async function t(e){const{data:r}=await Ct.post("anonymous_profiles/identify",{body:e});return r}};const Ot={getRecommendedTrips:function i$1({searchId:e,userIdentifier:r}){return Ct.get(`trip_recommendations/${e}/${r}`)},createRecommendedPlaces:async function u(e){return Ct.post("profiles",{body:e})},pollRecommendedPlaces:function m(e,r){const{start:i,onEachResponse:o}=r,s=`profiles/${e}`,a={watch:"state",expect:"finished",onEachResponse:o},h=Ct.poll(s,a);return i&&h.start(),h},createRecommendedSeats:function d(e){return Ct.post("seat_recommendations",{body:e})},getRecommendedSeats:function p({distinct_id:e,...r}){return Ct.post(`seat_recommendations/${e}`,{body:r})},getFrequentPassengers:async function l(e){return Ct.get(`passengers/${e}`)},createFrequentPassengers:async function f$1(e){return Ct.post("passengers",{body:e})}},Rt={setConfig:Ct.setConfig,recommendations:Ot,profiles:Tt};let Mt;const Nt=window.location.origin,Pt={sandbox:{baseUrl:"https://datalake-api-dev.reservamossaas.com/api",defaultHeaders:{Origin:Nt,Authorization:"Bearer 753bf0710dc920a84236d42241d4f487"}},prod:{baseUrl:"https://data-lake.reservamossaas.com/api",defaultHeaders:{Origin:Nt,Authorization:"Bearer 753bf0710dc920a84236d42241d4f487"}}};const Dt={setEnvironment:function setEnvironment(e){Mt=e},getCoreAPIConfig:function getCoreAPIConfig(){if(!Mt)throw new Error("Unable to get core API config, environment not set. Use configService.setEnvironment(environment) to set the environment.");return Pt[Mt]}};var Zt,At;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(Cr){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(Cr){}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}(At=Zt||(Zt={}))[At.Document=0]="Document",At[At.DocumentType=1]="DocumentType",At[At.Element=2]="Element",At[At.Text=3]="Text",At[At.CDATA=4]="CDATA",At[At.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:o,value:s,maskInputFn:a}){let h=s||"";const f=o&&toLowerCase(o);return(r[i.toLowerCase()]||f&&r[f])&&(h=a?a(h,e):"*".repeat(h.length)),h}function toLowerCase(e){return e.toLowerCase()}const Lt="__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 o;try{o=new URL(e,null!=r?r:window.location.href)}catch(a){return null}const s=o.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(i=null==s?void 0:s[1])&&void 0!==i?i:null}let jt=1;const Ft=new RegExp("[^a-z0-9-_:]"),qt=-2;function genId(){return jt++}let $t,Ut;const Bt=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,zt=/^(?:[a-z+]+:)?\/\//i,Vt=/^www\..*/i,Wt=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,r){return(e||"").replace(Bt,((e,i,o,s,a,h)=>{const f=o||a||h,g=i||s||"";if(!f)return e;if(zt.test(f)||Vt.test(f))return`url(${g}${f}${g})`;if(Wt.test(f))return`url(${g}${f}${g})`;if("/"===f[0])return`url(${g}${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)+f}${g})`;const _=r.split("/"),y=f.split("/");_.pop();for(const r of y)"."!==r&&(".."===r?_.pop():_.push(r));return`url(${g}${_.join("/")}${g})`}))}const Kt=/^[^ \t\n\r\u000c]+/,Ht=/^[, \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,o){return o?"src"===i||"href"===i&&("use"!==r||"#"!==o[0])||"xlink:href"===i&&"#"!==o[0]?absoluteToDoc(e,o):"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 o;const s=e.exec(r.substring(i));return s?(o=s[0],i+=o.length,o):""}const o=[];for(;collectCharacters(Ht),!(i>=r.length);){let s=collectCharacters(Kt);if(","===s.slice(-1))s=absoluteToDoc(e,s.substring(0,s.length-1)),o.push(s);else{let a="";s=absoluteToDoc(e,s);let h=!1;for(;;){const e=r.charAt(i);if(""===e){o.push((s+a).trim());break}if(h)")"===e&&(h=!1);else{if(","===e){i+=1,o.push((s+a).trim());break}"("===e&&(h=!0)}a+=e,i+=1}}}return o.join(", ")}(e,o):"style"===i?absoluteToStylesheet(o,getHref()):"object"===r&&"data"===i?absoluteToDoc(e,o):o:absoluteToDoc(e,o):o}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 o=e.classList.length;o--;){const i=e.classList[o];if(r.test(i))return!0}return!!i&&classMatchesRegex(e.parentNode,r,i)}function needMaskingText(e,r,i,o){try{const s=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===s)return!1;if("string"==typeof r){if(o){if(s.closest(`.${r}`))return!0}else if(s.classList.contains(r))return!0}else if(classMatchesRegex(s,r,o))return!0;if(i)if(o){if(s.closest(i))return!0}else if(s.matches(i))return!0}catch(s){}return!1}function serializeNode(e,r){const{doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:h,inlineStylesheet:f,maskInputOptions:g={},maskTextFn:_,maskInputFn:y,dataURLOptions:v={},inlineImages:b,recordCanvas:S,keepIframeSrcFn:I,newlyAddedElement:x=!1}=r,T=function getRootId(e,r){if(!r.hasNode(e))return;const i=r.getId(e);return 1===i?void 0:i}(i,o);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:Zt.Document,childNodes:[],compatMode:e.compatMode}:{type:Zt.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Zt.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:T};case e.ELEMENT_NODE:return function serializeElementNode(e,r){const{doc:i,blockClass:o,blockSelector:s,inlineStylesheet:a,maskInputOptions:h={},maskInputFn:f,dataURLOptions:g={},inlineImages:_,recordCanvas:y,keepIframeSrcFn:v,newlyAddedElement:b=!1,rootId:S}=r,I=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 o=e.classList[i];if(r.test(o))return!0}if(i)return e.matches(i)}catch(o){}return!1}(e,o,s),x=function getValidTagName(e){if(e instanceof HTMLFormElement)return"form";const r=toLowerCase(e.tagName);return Ft.test(r)?"div":r}(e);let T={};const O=e.attributes.length;for(let P=0;P<O;P++){const r=e.attributes[P];ignoreAttribute(x,r.name,r.value)||(T[r.name]=transformAttribute(i,x,toLowerCase(r.name),r.value))}if("link"===x&&a){const r=Array.from(i.styleSheets).find((r=>r.href===e.href));let o=null;r&&(o=stringifyStylesheet(r)),o&&(delete T.rel,delete T.href,T._cssText=absoluteToStylesheet(o,r.href))}if("style"===x&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const r=stringifyStylesheet(e.sheet);r&&(T._cssText=absoluteToStylesheet(r,getHref()))}if("input"===x||"textarea"===x||"select"===x){const r=e.value,i=e.checked;"radio"!==T.type&&"checkbox"!==T.type&&"submit"!==T.type&&"button"!==T.type&&r?T.value=maskInputValue({element:e,type:getInputType(e),tagName:x,value:r,maskInputOptions:h,maskInputFn:f}):i&&(T.checked=i)}"option"===x&&(e.selected&&!h.select?T.selected=!0:delete T.selected);if("canvas"===x&&y)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 o=0;o<e.height;o+=50){const s=r.getImageData,a=Lt in s?s[Lt]:s;if(new Uint32Array(a.call(r,i,o,Math.min(50,e.width-i),Math.min(50,e.height-o)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(T.rr_dataURL=e.toDataURL(g.type,g.quality));else if(!("__context"in e)){const r=e.toDataURL(g.type,g.quality),i=document.createElement("canvas");i.width=e.width,i.height=e.height;r!==i.toDataURL(g.type,g.quality)&&(T.rr_dataURL=r)}if("img"===x&&_){$t||($t=i.createElement("canvas"),Ut=$t.getContext("2d"));const r=e,o=r.crossOrigin;r.crossOrigin="anonymous";const recordInlineImage=()=>{r.removeEventListener("load",recordInlineImage);try{$t.width=r.naturalWidth,$t.height=r.naturalHeight,Ut.drawImage(r,0,0),T.rr_dataURL=$t.toDataURL(g.type,g.quality)}catch(e){console.warn(`Cannot inline img src=${r.currentSrc}! Error: ${e}`)}o?T.crossOrigin=o:r.removeAttribute("crossorigin")};r.complete&&0!==r.naturalWidth?recordInlineImage():r.addEventListener("load",recordInlineImage)}if("audio"===x||"video"===x){const r=T;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}b||(e.scrollLeft&&(T.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(T.rr_scrollTop=e.scrollTop));if(I){const{width:r,height:i}=e.getBoundingClientRect();T={class:T.class,rr_width:`${r}px`,rr_height:`${i}px`}}"iframe"!==x||v(T.src)||(e.contentDocument||(T.rr_src=T.src),delete T.src);let R;try{customElements.get(x)&&(R=!0)}catch(N){}return{type:Zt.Element,tagName:x,attributes:T,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:I,rootId:S,isCustom:R}}(e,{doc:i,blockClass:s,blockSelector:a,inlineStylesheet:f,maskInputOptions:g,maskInputFn:y,dataURLOptions:v,inlineImages:b,recordCanvas:S,keepIframeSrcFn:I,newlyAddedElement:x,rootId:T});case e.TEXT_NODE:return function serializeTextNode(e,r){var i;const{needsMask:o,maskTextFn:s,rootId:a}=r,h=e.parentNode&&e.parentNode.tagName;let f=e.textContent;const g="STYLE"===h||void 0,_="SCRIPT"===h||void 0;if(g&&f){try{e.nextSibling||e.previousSibling||(null===(i=e.parentNode.sheet)||void 0===i?void 0:i.cssRules)&&(f=stringifyStylesheet(e.parentNode.sheet))}catch(y){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${y}`,e)}f=absoluteToStylesheet(f,getHref())}_&&(f="SCRIPT_PLACEHOLDER");!g&&!_&&f&&o&&(f=s?s(f,e.parentElement):f.replace(/[\S]/g,"*"));return{type:Zt.Text,textContent:f||"",isStyle:g,rootId:a}}(e,{needsMask:h,maskTextFn:_,rootId:T});case e.CDATA_SECTION_NODE:return{type:Zt.CDATA,textContent:"",rootId:T};case e.COMMENT_NODE:return{type:Zt.Comment,textContent:e.textContent||"",rootId:T};default:return!1}}function lowerIfExists(e){return null==e?"":e.toLowerCase()}function serializeNodeWithId(e,r){const{doc:i,mirror:o,blockClass:s,blockSelector:a,maskTextClass:h,maskTextSelector:f,skipChild:g=!1,inlineStylesheet:_=!0,maskInputOptions:y={},maskTextFn:v,maskInputFn:b,slimDOMOptions:S,dataURLOptions:I={},inlineImages:x=!1,recordCanvas:T=!1,onSerialize:O,onIframeLoad:R,iframeLoadTimeout:N=5e3,onStylesheetLoad:P,stylesheetLoadTimeout:D=5e3,keepIframeSrcFn:Z=()=>!1,newlyAddedElement:A=!1}=r;let{needsMask:L}=r,{preserveWhiteSpace:j=!0}=r;if(!L&&e.childNodes){L=needMaskingText(e,h,f,void 0===L)}const q=serializeNode(e,{doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:L,inlineStylesheet:_,maskInputOptions:y,maskTextFn:v,maskInputFn:b,dataURLOptions:I,inlineImages:x,recordCanvas:T,keepIframeSrcFn:Z,newlyAddedElement:A});if(!q)return console.warn(e,"not serialized"),null;let U;U=o.hasNode(e)?o.getId(e):!function slimDOMExcluded(e,r){if(r.comment&&e.type===Zt.Comment)return!0;if(e.type===Zt.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}(q,S)&&(j||q.type!==Zt.Text||q.isStyle||q.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():qt;const B=Object.assign(q,{id:U});if(o.add(e,B),U===qt)return null;O&&O(e);let z=!g;if(B.type===Zt.Element){z=z&&!B.needBlock,delete B.needBlock;const r=e.shadowRoot;r&&isNativeShadowDom(r)&&(B.isShadowHost=!0)}if((B.type===Zt.Document||B.type===Zt.Element)&&z){S.headWhitespace&&B.type===Zt.Element&&"head"===B.tagName&&(j=!1);const r={doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:L,maskTextClass:h,maskTextSelector:f,skipChild:g,inlineStylesheet:_,maskInputOptions:y,maskTextFn:v,maskInputFn:b,slimDOMOptions:S,dataURLOptions:I,inlineImages:x,recordCanvas:T,preserveWhiteSpace:j,onSerialize:O,onIframeLoad:R,iframeLoadTimeout:N,onStylesheetLoad:P,stylesheetLoadTimeout:D,keepIframeSrcFn:Z};if(B.type===Zt.Element&&"textarea"===B.tagName&&void 0!==B.attributes.value);else for(const i of Array.from(e.childNodes)){const e=serializeNodeWithId(i,r);e&&B.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 o=serializeNodeWithId(i,r);o&&(isNativeShadowDom(e.shadowRoot)&&(o.isShadow=!0),B.childNodes.push(o))}}return e.parentNode&&isShadowRoot(e.parentNode)&&isNativeShadowDom(e.parentNode)&&(B.isShadow=!0),B.type===Zt.Element&&"iframe"===B.tagName&&function onceIframeLoaded(e,r,i){const o=e.contentWindow;if(!o)return;let s,a=!1;try{s=o.document.readyState}catch(Cr){return}if("complete"!==s){const o=setTimeout((()=>{a||(r(),a=!0)}),i);return void e.addEventListener("load",(()=>{clearTimeout(o),a=!0,r()}))}const h="about:blank";if(o.location.href!==h||e.src===h||""===e.src)return setTimeout(r,0),e.addEventListener("load",r);e.addEventListener("load",r)}(e,(()=>{const r=e.contentDocument;if(r&&R){const i=serializeNodeWithId(r,{doc:r,mirror:o,blockClass:s,blockSelector:a,needsMask:L,maskTextClass:h,maskTextSelector:f,skipChild:!1,inlineStylesheet:_,maskInputOptions:y,maskTextFn:v,maskInputFn:b,slimDOMOptions:S,dataURLOptions:I,inlineImages:x,recordCanvas:T,preserveWhiteSpace:j,onSerialize:O,onIframeLoad:R,iframeLoadTimeout:N,onStylesheetLoad:P,stylesheetLoadTimeout:D,keepIframeSrcFn:Z});i&&R(e,i)}}),N),B.type===Zt.Element&&"link"===B.tagName&&"string"==typeof B.attributes.rel&&("stylesheet"===B.attributes.rel||"preload"===B.attributes.rel&&"string"==typeof B.attributes.href&&"css"===extractFileExtension(B.attributes.href))&&function onceStylesheetLoaded(e,r,i){let o,s=!1;try{o=e.sheet}catch(Cr){return}if(o)return;const a=setTimeout((()=>{s||(r(),s=!0)}),i);e.addEventListener("load",(()=>{clearTimeout(a),s=!0,r()}))}(e,(()=>{if(P){const r=serializeNodeWithId(e,{doc:i,mirror:o,blockClass:s,blockSelector:a,needsMask:L,maskTextClass:h,maskTextSelector:f,skipChild:!1,inlineStylesheet:_,maskInputOptions:y,maskTextFn:v,maskInputFn:b,slimDOMOptions:S,dataURLOptions:I,inlineImages:x,recordCanvas:T,preserveWhiteSpace:j,onSerialize:O,onIframeLoad:R,iframeLoadTimeout:N,onStylesheetLoad:P,stylesheetLoadTimeout:D,keepIframeSrcFn:Z});r&&P(e,r)}}),D),B}function on(e,r,i=document){const o={capture:!0,passive:!0};return i.addEventListener(e,r,o),()=>i.removeEventListener(e,r,o)}const Gt="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 Jt={map:{},getId:()=>(console.error(Gt),-1),getNode:()=>(console.error(Gt),null),removeNodeFromMap(){console.error(Gt)},has:()=>(console.error(Gt),!1),reset(){console.error(Gt)}};function throttle(e,r,i={}){let o=null,s=0;return function(...a){const h=Date.now();s||!1!==i.leading||(s=h);const f=r-(h-s),g=this;f<=0||f>r?(o&&(clearTimeout(o),o=null),s=h,e.apply(g,a)):o||!1===i.trailing||(o=setTimeout((()=>{s=!1===i.leading?0:Date.now(),o=null,e.apply(g,a)}),f))}}function hookSetter(e,r,i,o,s=window){const a=s.Object.getOwnPropertyDescriptor(e,r);return s.Object.defineProperty(e,r,o?i:{set(e){setTimeout((()=>{i.set.call(this,e)}),0),a&&a.set&&a.set.call(this,e)}}),()=>hookSetter(e,r,a||{},!0)}function patch(e,r,i){try{if(!(r in e))return()=>{};const o=e[r],s=i(o);return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:o}})),e[r]=s,()=>{e[r]=o}}catch(o){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(Jt=new Proxy(Jt,{get:(e,r,i)=>("map"===r&&console.error(Gt),Reflect.get(e,r,i))}));let Yt=Date.now;function getWindowScroll(e){var r,i,o,s,a,h;const f=e.document;return{left:f.scrollingElement?f.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==f?void 0:f.documentElement.scrollLeft)||(null===(i=null===(r=null==f?void 0:f.body)||void 0===r?void 0:r.parentElement)||void 0===i?void 0:i.scrollLeft)||(null===(o=null==f?void 0:f.body)||void 0===o?void 0:o.scrollLeft)||0,top:f.scrollingElement?f.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==f?void 0:f.documentElement.scrollTop)||(null===(a=null===(s=null==f?void 0:f.body)||void 0===s?void 0:s.parentElement)||void 0===a?void 0:a.scrollTop)||(null===(h=null==f?void 0:f.body)||void 0===h?void 0:h.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,o){if(!e)return!1;const s=closestElementOfNode(e);if(!s)return!1;try{if("string"==typeof r){if(s.classList.contains(r))return!0;if(o&&null!==s.closest("."+r))return!0}else if(classMatchesRegex(s,r,o))return!0}catch(a){}if(i){if(s.matches(i))return!0;if(o&&null!==s.closest(i))return!0}return!1}function isIgnored(e,r){return r.getId(e)===qt}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())||(Yt=()=>(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 o=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&&(o=e.getRootNode().host),o}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 Xt=(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))(Xt||{}),Qt=(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))(Qt||{}),er=(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))(er||{}),tr=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(tr||{}),rr=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(rr||{});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=qt;for(;i===qt;)r=r&&r.nextSibling,i=r&&this.mirror.getId(r);return i},pushAdd=o=>{if(!o.parentNode||!inDom(o)||"TEXTAREA"===o.parentNode.tagName)return;const s=isShadowRoot(o.parentNode)?this.mirror.getId(getShadowHost(o)):this.mirror.getId(o.parentNode),a=getNextId(o);if(-1===s||-1===a)return i.addNode(o);const h=serializeNodeWithId(o,{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(o)&&this.shadowDomManager.addShadowRoot(o.shadowRoot,this.doc)},onIframeLoad:(e,r)=>{this.iframeManager.attachIframe(e,r),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,r)=>{this.stylesheetManager.attachLinkElement(e,r)}});h&&(e.push({parentId:s,nextId:a,node:h}),r.add(h.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const a of this.movedSet)isParentRemoved(this.removes,a,this.mirror)&&!this.movedSet.has(a.parentNode)||pushAdd(a);for(const a of this.addedSet)isAncestorInSet(this.droppedSet,a)||isParentRemoved(this.removes,a,this.mirror)?isAncestorInSet(this.movedSet,a)?pushAdd(a):this.droppedSet.add(a):pushAdd(a);let o=null;for(;i.length;){let e=null;if(o){const r=this.mirror.getId(o.value.parentNode),i=getNextId(o.value);-1!==r&&-1!==i&&(e=o)}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 o=r.parentNode.host;if(-1!==this.mirror.getId(o)){e=i;break}}}}}}if(!e){for(;i.head;)i.removeNode(i.head.value);break}o=e.previous,i.removeNode(e.value),pushAdd(e.value)}const s={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),o=JSON.stringify(e._unchangedStyles);i.length<r.style.length&&(i+o).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};(s.texts.length||s.attributes.length||s.removes.length||s.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(s))},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 o=e.attributeName,s=e.target.getAttribute(o);if("value"===o){const e=getInputType(i);s=maskInputValue({element:i,maskInputOptions:this.maskInputOptions,tagName:i.tagName,type:e,value:s,maskInputFn:this.maskInputFn})}if(isBlocked(e.target,this.blockClass,this.blockSelector,!1)||s===e.oldValue)return;let a=this.attributeMap.get(e.target);if("IFRAME"===i.tagName&&"src"===o&&!this.keepIframeSrcFn(s)){if(i.contentDocument)return;o="rr_src"}if(a||(a={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(e.target,a)),"type"===o&&"INPUT"===i.tagName&&"password"===(e.oldValue||"").toLowerCase()&&i.setAttribute("data-rr-is-password","true"),!ignoreAttribute(i.tagName,o)&&(a.attributes[o]=transformAttribute(this.doc,toLowerCase(i.tagName),toLowerCase(o),s),"style"===o)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(r){this.unattachedDoc=this.doc}const o=this.unattachedDoc.createElement("span");e.oldValue&&o.setAttribute("style",e.oldValue);for(const e of Array.from(i.style)){const r=i.style.getPropertyValue(e),s=i.style.getPropertyPriority(e);r!==o.style.getPropertyValue(e)||s!==o.style.getPropertyPriority(e)?a.styleDiff[e]=""===s?r:[r,s]:a._unchangedStyles[e]=[r,s]}for(const e of Array.from(o.style))""===i.style.getPropertyValue(e)&&(a.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),o=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,o)]?deepDelete(this.movedSet,r):this.removes.push({parentId:o,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:o}=r;if(!o)return!1;const s=i.getId(o);return!!e.some((e=>e.id===s))||_isParentRemoved(e,o,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 nr;const callbackWrapper=e=>{if(!nr)return e;return(...r)=>{try{return e(...r)}catch(Cr){if(nr&&!0===nr(Cr))return;throw Cr}}},ir=[];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,o;const s=new MutationBuffer;ir.push(s),s.init(e);let a=window.MutationObserver||window.__rrMutationObserver;const h=null===(o=null===(i=null===window||void 0===window?void 0:window.Zone)||void 0===i?void 0:i.__symbol__)||void 0===o?void 0:o.call(i,"MutationObserver");h&&window[h]&&(a=window[h]);const f=new a(callbackWrapper(s.processMutations.bind(s)));return f.observe(r,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),f}function initMouseInteractionObserver({mouseInteractionCb:e,doc:r,mirror:i,blockClass:o,blockSelector:s,sampling:a}){if(!1===a.mouseInteraction)return()=>{};const h=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,f=[];let g=null;return Object.keys(er).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==h[e])).forEach((a=>{let h=toLowerCase(a);const _=(r=>a=>{const h=getEventTarget(a);if(isBlocked(h,o,s,!0))return;let f=null,_=r;if("pointerType"in a){switch(a.pointerType){case"mouse":f=tr.Mouse;break;case"touch":f=tr.Touch;break;case"pen":f=tr.Pen}f===tr.Touch?er[r]===er.MouseDown?_="TouchStart":er[r]===er.MouseUp&&(_="TouchEnd"):tr.Pen}else legacy_isTouchEvent(a)&&(f=tr.Touch);null!==f?(g=f,(_.startsWith("Touch")&&f===tr.Touch||_.startsWith("Mouse")&&f===tr.Mouse)&&(f=null)):er[r]===er.Click&&(f=g,g=null);const y=legacy_isTouchEvent(a)?a.changedTouches[0]:a;if(!y)return;const v=i.getId(h),{clientX:b,clientY:S}=y;callbackWrapper(e)(Object.assign({type:er[_],id:v,x:b,y:S},null!==f&&{pointerType:f}))})(a);if(window.PointerEvent)switch(er[a]){case er.MouseDown:case er.MouseUp:h=h.replace("mouse","pointer");break;case er.TouchStart:case er.TouchEnd:return}f.push(on(h,_,r))})),callbackWrapper((()=>{f.forEach((e=>e()))}))}function initScrollObserver({scrollCb:e,doc:r,mirror:i,blockClass:o,blockSelector:s,sampling:a}){return on("scroll",callbackWrapper(throttle(callbackWrapper((a=>{const h=getEventTarget(a);if(!h||isBlocked(h,o,s,!0))return;const f=i.getId(h);if(h===r&&r.defaultView){const i=getWindowScroll(r.defaultView);e({id:f,x:i.left,y:i.top})}else e({id:f,x:h.scrollLeft,y:h.scrollTop})})),a.scroll||100)),r)}const or=["INPUT","TEXTAREA","SELECT"],sr=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 o,s;return e?(e.ownerNode?o=r.getId(e.ownerNode):s=i.getId(e),{styleId:s,id:o}):{}}function initAdoptedStyleSheetObserver({mirror:e,stylesheetManager:r},i){var o,s,a;let h=null;h="#document"===i.nodeName?e.getId(i):e.getId(i.host);const f="#document"===i.nodeName?null===(o=i.defaultView)||void 0===o?void 0:o.Document:null===(a=null===(s=i.ownerDocument)||void 0===s?void 0:s.defaultView)||void 0===a?void 0:a.ShadowRoot,g=(null==f?void 0:f.prototype)?Object.getOwnPropertyDescriptor(null==f?void 0:f.prototype,"adoptedStyleSheets"):void 0;return null!==h&&-1!==h&&f&&g?(Object.defineProperty(i,"adoptedStyleSheets",{configurable:g.configurable,enumerable:g.enumerable,get(){var e;return null===(e=g.get)||void 0===e?void 0:e.call(this)},set(e){var i;const o=null===(i=g.set)||void 0===i?void 0:i.call(this,e);if(null!==h&&-1!==h)try{r.adoptStyleSheets(e,h)}catch(s){}return o}}),callbackWrapper((()=>{Object.defineProperty(i,"adoptedStyleSheets",{configurable:g.configurable,enumerable:g.enumerable,get:g.get,set:g.set})}))):()=>{}}function initObservers(e,r={}){const i=e.doc.defaultView;if(!i)return()=>{};let o;!function mergeHooks(e,r){const{mutationCb:i,mousemoveCb:o,mouseInteractionCb:s,scrollCb:a,viewportResizeCb:h,inputCb:f,mediaInteractionCb:g,styleSheetRuleCb:_,styleDeclarationCb:y,canvasMutationCb:v,fontCb:b,selectionCb:S,customElementCb:I}=e;e.mutationCb=(...e)=>{r.mutation&&r.mutation(...e),i(...e)},e.mousemoveCb=(...e)=>{r.mousemove&&r.mousemove(...e),o(...e)},e.mouseInteractionCb=(...e)=>{r.mouseInteraction&&r.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{r.scroll&&r.scroll(...e),a(...e)},e.viewportResizeCb=(...e)=>{r.viewportResize&&r.viewportResize(...e),h(...e)},e.inputCb=(...e)=>{r.input&&r.input(...e),f(...e)},e.mediaInteractionCb=(...e)=>{r.mediaInteaction&&r.mediaInteaction(...e),g(...e)},e.styleSheetRuleCb=(...e)=>{r.styleSheetRule&&r.styleSheetRule(...e),_(...e)},e.styleDeclarationCb=(...e)=>{r.styleDeclaration&&r.styleDeclaration(...e),y(...e)},e.canvasMutationCb=(...e)=>{r.canvasMutation&&r.canvasMutation(...e),v(...e)},e.fontCb=(...e)=>{r.font&&r.font(...e),b(...e)},e.selectionCb=(...e)=>{r.selection&&r.selection(...e),S(...e)},e.customElementCb=(...e)=>{r.customElement&&r.customElement(...e),I(...e)}}(e,r),e.recordDOM&&(o=initMutationObserver(e,e.doc));const s=function initMoveObserver({mousemoveCb:e,sampling:r,doc:i,mirror:o}){if(!1===r.mousemove)return()=>{};const s="number"==typeof r.mousemove?r.mousemove:50,a="number"==typeof r.mousemoveCallback?r.mousemoveCallback:500;let h,f=[];const g=throttle(callbackWrapper((r=>{const i=Date.now()-h;e(f.map((e=>(e.timeOffset-=i,e))),r),f=[],h=null})),a),_=callbackWrapper(throttle(callbackWrapper((e=>{const r=getEventTarget(e),{clientX:i,clientY:s}=legacy_isTouchEvent(e)?e.changedTouches[0]:e;h||(h=Yt()),f.push({x:i,y:s,id:o.getId(r),timeOffset:Yt()-h}),g("undefined"!=typeof DragEvent&&e instanceof DragEvent?Qt.Drag:e instanceof MouseEvent?Qt.MouseMove:Qt.TouchMove)})),s,{trailing:!1})),y=[on("mousemove",_,i),on("touchmove",_,i),on("drag",_,i)];return callbackWrapper((()=>{y.forEach((e=>e()))}))}(e),a=initMouseInteractionObserver(e),h=initScrollObserver(e),f=function initViewportResizeObserver({viewportResizeCb:e},{win:r}){let i=-1,o=-1;return on("resize",callbackWrapper(throttle(callbackWrapper((()=>{const r=getWindowHeight(),s=getWindowWidth();i===r&&o===s||(e({width:Number(s),height:Number(r)}),i=r,o=s)})),200)),r)}(e,{win:i}),g=function initInputObserver({inputCb:e,doc:r,mirror:i,blockClass:o,blockSelector:s,ignoreClass:a,ignoreSelector:h,maskInputOptions:f,maskInputFn:g,sampling:_,userTriggeredOnInput:y}){function eventHandler(e){let i=getEventTarget(e);const _=e.isTrusted,v=i&&i.tagName;if(i&&"OPTION"===v&&(i=i.parentElement),!i||!v||or.indexOf(v)<0||isBlocked(i,o,s,!0))return;if(i.classList.contains(a)||h&&i.matches(h))return;let b=i.value,S=!1;const I=getInputType(i)||"";"radio"===I||"checkbox"===I?S=i.checked:(f[v.toLowerCase()]||f[I])&&(b=maskInputValue({element:i,maskInputOptions:f,tagName:v,type:I,value:b,maskInputFn:g})),cbWithDedup(i,y?{text:b,isChecked:S,userTriggered:_}:{text:b,isChecked:S});const x=i.name;"radio"===I&&x&&S&&r.querySelectorAll(`input[type="radio"][name="${x}"]`).forEach((e=>{if(e!==i){const r=e.value;cbWithDedup(e,y?{text:r,isChecked:!S,userTriggered:!1}:{text:r,isChecked:!S})}}))}function cbWithDedup(r,o){const s=sr.get(r);if(!s||s.text!==o.text||s.isChecked!==o.isChecked){sr.set(r,o);const s=i.getId(r);callbackWrapper(e)(Object.assign(Object.assign({},o),{id:s}))}}const v=("last"===_.input?["change"]:["input","change"]).map((e=>on(e,callbackWrapper(eventHandler),r))),b=r.defaultView;if(!b)return()=>{v.forEach((e=>e()))};const S=b.Object.getOwnPropertyDescriptor(b.HTMLInputElement.prototype,"value"),I=[[b.HTMLInputElement.prototype,"value"],[b.HTMLInputElement.prototype,"checked"],[b.HTMLSelectElement.prototype,"value"],[b.HTMLTextAreaElement.prototype,"value"],[b.HTMLSelectElement.prototype,"selectedIndex"],[b.HTMLOptionElement.prototype,"selected"]];return S&&S.set&&v.push(...I.map((e=>hookSetter(e[0],e[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,b)))),callbackWrapper((()=>{v.forEach((e=>e()))}))}(e),_=function initMediaInteractionObserver({mediaInteractionCb:e,blockClass:r,blockSelector:i,mirror:o,sampling:s,doc:a}){const h=callbackWrapper((a=>throttle(callbackWrapper((s=>{const h=getEventTarget(s);if(!h||isBlocked(h,r,i,!0))return;const{currentTime:f,volume:g,muted:_,playbackRate:y,loop:v}=h;e({type:a,id:o.getId(h),currentTime:f,volume:g,muted:_,playbackRate:y,loop:v})})),s.media||500))),f=[on("play",h(0),a),on("pause",h(1),a),on("seeked",h(2),a),on("volumechange",h(3),a),on("ratechange",h(4),a)];return callbackWrapper((()=>{f.forEach((e=>e()))}))}(e);let styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};e.recordDOM&&(styleSheetObserver=function initStyleSheetObserver({styleSheetRuleCb:e,mirror:r,stylesheetManager:i},{win:o}){if(!o.CSSStyleSheet||!o.CSSStyleSheet.prototype)return()=>{};const s=o.CSSStyleSheet.prototype.insertRule;o.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:callbackWrapper(((o,s,a)=>{const[h,f]=a,{id:g,styleId:_}=getIdAndStyleId(s,r,i.styleMirror);return(g&&-1!==g||_&&-1!==_)&&e({id:g,styleId:_,adds:[{rule:h,index:f}]}),o.apply(s,a)}))});const a=o.CSSStyleSheet.prototype.deleteRule;let h,f;o.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:callbackWrapper(((o,s,a)=>{const[h]=a,{id:f,styleId:g}=getIdAndStyleId(s,r,i.styleMirror);return(f&&-1!==f||g&&-1!==g)&&e({id:f,styleId:g,removes:[{index:h}]}),o.apply(s,a)}))}),o.CSSStyleSheet.prototype.replace&&(h=o.CSSStyleSheet.prototype.replace,o.CSSStyleSheet.prototype.replace=new Proxy(h,{apply:callbackWrapper(((o,s,a)=>{const[h]=a,{id:f,styleId:g}=getIdAndStyleId(s,r,i.styleMirror);return(f&&-1!==f||g&&-1!==g)&&e({id:f,styleId:g,replace:h}),o.apply(s,a)}))})),o.CSSStyleSheet.prototype.replaceSync&&(f=o.CSSStyleSheet.prototype.replaceSync,o.CSSStyleSheet.prototype.replaceSync=new Proxy(f,{apply:callbackWrapper(((o,s,a)=>{const[h]=a,{id:f,styleId:g}=getIdAndStyleId(s,r,i.styleMirror);return(f&&-1!==f||g&&-1!==g)&&e({id:f,styleId:g,replaceSync:h}),o.apply(s,a)}))}));const g={};canMonkeyPatchNestedCSSRule("CSSGroupingRule")?g.CSSGroupingRule=o.CSSGroupingRule:(canMonkeyPatchNestedCSSRule("CSSMediaRule")&&(g.CSSMediaRule=o.CSSMediaRule),canMonkeyPatchNestedCSSRule("CSSConditionRule")&&(g.CSSConditionRule=o.CSSConditionRule),canMonkeyPatchNestedCSSRule("CSSSupportsRule")&&(g.CSSSupportsRule=o.CSSSupportsRule));const _={};return Object.entries(g).forEach((([o,s])=>{_[o]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(_[o].insertRule,{apply:callbackWrapper(((o,s,a)=>{const[h,f]=a,{id:g,styleId:_}=getIdAndStyleId(s.parentStyleSheet,r,i.styleMirror);return(g&&-1!==g||_&&-1!==_)&&e({id:g,styleId:_,adds:[{rule:h,index:[...getNestedCSSRulePositions(s),f||0]}]}),o.apply(s,a)}))}),s.prototype.deleteRule=new Proxy(_[o].deleteRule,{apply:callbackWrapper(((o,s,a)=>{const[h]=a,{id:f,styleId:g}=getIdAndStyleId(s.parentStyleSheet,r,i.styleMirror);return(f&&-1!==f||g&&-1!==g)&&e({id:f,styleId:g,removes:[{index:[...getNestedCSSRulePositions(s),h]}]}),o.apply(s,a)}))})})),callbackWrapper((()=>{o.CSSStyleSheet.prototype.insertRule=s,o.CSSStyleSheet.prototype.deleteRule=a,h&&(o.CSSStyleSheet.prototype.replace=h),f&&(o.CSSStyleSheet.prototype.replaceSync=f),Object.entries(g).forEach((([e,r])=>{r.prototype.insertRule=_[e].insertRule,r.prototype.deleteRule=_[e].deleteRule}))}))}(e,{win:i}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(e,e.doc),styleDeclarationObserver=function initStyleDeclarationObserver({styleDeclarationCb:e,mirror:r,ignoreCSSAttributes:i,stylesheetManager:o},{win:s}){const a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:callbackWrapper(((s,h,f)=>{var g;const[_,y,v]=f;if(i.has(_))return a.apply(h,[_,y,v]);const{id:b,styleId:S}=getIdAndStyleId(null===(g=h.parentRule)||void 0===g?void 0:g.parentStyleSheet,r,o.styleMirror);return(b&&-1!==b||S&&-1!==S)&&e({id:b,styleId:S,set:{property:_,value:y,priority:v},index:getNestedCSSRulePositions(h.parentRule)}),s.apply(h,f)}))});const h=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(h,{apply:callbackWrapper(((s,a,f)=>{var g;const[_]=f;if(i.has(_))return h.apply(a,[_]);const{id:y,styleId:v}=getIdAndStyleId(null===(g=a.parentRule)||void 0===g?void 0:g.parentStyleSheet,r,o.styleMirror);return(y&&-1!==y||v&&-1!==v)&&e({id:y,styleId:v,remove:{property:_},index:getNestedCSSRulePositions(a.parentRule)}),s.apply(a,f)}))}),callbackWrapper((()=>{s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=h}))}(e,{win:i}),e.collectFonts&&(fontObserver=function initFontObserver({fontCb:e,doc:r}){const i=r.defaultView;if(!i)return()=>{};const o=[],s=new WeakMap,a=i.FontFace;i.FontFace=function FontFace(e,r,i){const o=new a(e,r,i);return s.set(o,{family:e,buffer:"string"!=typeof r,descriptors:i,fontSource:"string"==typeof r?r:JSON.stringify(Array.from(new Uint8Array(r)))}),o};const h=patch(r.fonts,"add",(function(r){return function(i){return setTimeout(callbackWrapper((()=>{const r=s.get(i);r&&(e(r),s.delete(i))})),0),r.apply(this,[i])}}));return o.push((()=>{i.FontFace=a})),o.push(h),callbackWrapper((()=>{o.forEach((e=>e()))}))}(e)));const y=function initSelectionObserver(e){const{doc:r,mirror:i,blockClass:o,blockSelector:s,selectionCb:a}=e;let h=!0;const f=callbackWrapper((()=>{const e=r.getSelection();if(!e||h&&(null==e?void 0:e.isCollapsed))return;h=e.isCollapsed||!1;const f=[],g=e.rangeCount||0;for(let r=0;r<g;r++){const a=e.getRangeAt(r),{startContainer:h,startOffset:g,endContainer:_,endOffset:y}=a;isBlocked(h,o,s,!0)||isBlocked(_,o,s,!0)||f.push({start:i.getId(h),startOffset:g,end:i.getId(_),endOffset:y})}a({ranges:f})}));return f(),on("selectionchange",f)}(e),v=function initCustomElementObserver({doc:e,customElementCb:r}){const i=e.defaultView;return i&&i.customElements?patch(i.customElements,"define",(function(e){return function(i,o,s){try{r({define:{name:i}})}catch(a){console.warn(`Custom element callback failed for ${i}`)}return e.apply(this,[i,o,s])}})):()=>{}}(e),b=[];for(const S of e.plugins)b.push(S.observer(S.callback,i,S.options));return callbackWrapper((()=>{ir.forEach((e=>e.reset())),null==o||o.disconnect(),s(),a(),h(),f(),g(),_(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),y(),v(),b.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,o){const s=i||this.getIdToRemoteIdMap(e),a=o||this.getRemoteIdToIdMap(e);let h=s.get(r);return h||(h=this.generateIdFn(),s.set(r,h),a.set(h,r)),h}getIds(e,r){const i=this.getIdToRemoteIdMap(e),o=this.getRemoteIdToIdMap(e);return r.map((r=>this.getId(e,r,i,o)))}getRemoteId(e,r,i){const o=i||this.getRemoteIdToIdMap(e);if("number"!=typeof r)return r;const s=o.get(r);return s||-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 o=this.transformCrossOriginEvent(i,r.data.event);o&&this.wrappedEmit(o,r.data.isCheckout)}transformCrossOriginEvent(e,r){var i;switch(r.type){case Xt.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:Xt.IncrementalSnapshot,data:{source:Qt.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:r.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Xt.Meta:case Xt.Load:case Xt.DomContentLoaded:return!1;case Xt.Plugin:return r;case Xt.Custom:return this.replaceIds(r.data.payload,e,["id","parentId","previousId","nextId"]),r;case Xt.IncrementalSnapshot:switch(r.data.source){case Qt.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 Qt.Drag:case Qt.TouchMove:case Qt.MouseMove:return r.data.positions.forEach((r=>{this.replaceIds(r,e,["id"])})),r;case Qt.ViewportResize:return!1;case Qt.MediaInteraction:case Qt.MouseInteraction:case Qt.Scroll:case Qt.CanvasMutation:case Qt.Input:return this.replaceIds(r.data,e,["id"]),r;case Qt.StyleSheetRule:case Qt.StyleDeclaration:return this.replaceIds(r.data,e,["id"]),this.replaceStyleIds(r.data,e,["styleId"]),r;case Qt.Font:return r;case Qt.Selection:return r.data.ranges.forEach((r=>{this.replaceIds(r,e,["start","end"])})),r;case Qt.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,o){for(const s of o)(Array.isArray(r[s])||"number"==typeof r[s])&&(Array.isArray(r[s])?r[s]=e.getIds(i,r[s]):r[s]=e.getId(i,r[s]));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===Zt.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(o){const s=e.call(this,o);return this.shadowRoot&&inDom(this)&&i.addShadowRoot(this.shadowRoot,r),s}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(r){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
1
+ var browserAnalytics=function(){"use strict";var r,i,s;(i=r||(r={})).assertEqual=r=>r,i.assertIs=function assertIs(r){},i.assertNever=function assertNever(r){throw new Error},i.arrayToEnum=r=>{const i={};for(const s of r)i[s]=s;return i},i.getValidEnumValues=r=>{const s=i.objectKeys(r).filter((i=>"number"!=typeof r[r[i]])),a={};for(const i of s)a[i]=r[i];return i.objectValues(a)},i.objectValues=r=>i.objectKeys(r).map((function(i){return r[i]})),i.objectKeys="function"==typeof Object.keys?r=>Object.keys(r):r=>{const i=[];for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&i.push(s);return i},i.find=(r,i)=>{for(const s of r)if(i(s))return s},i.isInteger="function"==typeof Number.isInteger?r=>Number.isInteger(r):r=>"number"==typeof r&&isFinite(r)&&Math.floor(r)===r,i.joinValues=function joinValues(r,i=" | "){return r.map((r=>"string"==typeof r?`'${r}'`:r)).join(i)},i.jsonStringifyReplacer=(r,i)=>"bigint"==typeof i?i.toString():i,(s||(s={})).mergeShapes=(r,i)=>({...r,...i});const a=r.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),getParsedType=r=>{switch(typeof r){case"undefined":return a.undefined;case"string":return a.string;case"number":return isNaN(r)?a.nan:a.number;case"boolean":return a.boolean;case"function":return a.function;case"bigint":return a.bigint;case"symbol":return a.symbol;case"object":return Array.isArray(r)?a.array:null===r?a.null:r.then&&"function"==typeof r.then&&r.catch&&"function"==typeof r.catch?a.promise:"undefined"!=typeof Map&&r instanceof Map?a.map:"undefined"!=typeof Set&&r instanceof Set?a.set:"undefined"!=typeof Date&&r instanceof Date?a.date:a.object;default:return a.unknown}},h=r.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(r){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const i=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,i):this.__proto__=i,this.name="ZodError",this.issues=r}get errors(){return this.issues}format(r){const i=r||function(r){return r.message},s={_errors:[]},processError=r=>{for(const a of r.issues)if("invalid_union"===a.code)a.unionErrors.map(processError);else if("invalid_return_type"===a.code)processError(a.returnTypeError);else if("invalid_arguments"===a.code)processError(a.argumentsError);else if(0===a.path.length)s._errors.push(i(a));else{let r=s,h=0;for(;h<a.path.length;){const s=a.path[h];h===a.path.length-1?(r[s]=r[s]||{_errors:[]},r[s]._errors.push(i(a))):r[s]=r[s]||{_errors:[]},r=r[s],h++}}};return processError(this),s}static assert(r){if(!(r instanceof ZodError))throw new Error(`Not a ZodError: ${r}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,r.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(r=r=>r.message){const i={},s=[];for(const a of this.issues)a.path.length>0?(i[a.path[0]]=i[a.path[0]]||[],i[a.path[0]].push(r(a))):s.push(r(a));return{formErrors:s,fieldErrors:i}}get formErrors(){return this.flatten()}}ZodError.create=r=>new ZodError(r);const errorMap=(i,s)=>{let f;switch(i.code){case h.invalid_type:f=i.received===a.undefined?"Required":`Expected ${i.expected}, received ${i.received}`;break;case h.invalid_literal:f=`Invalid literal value, expected ${JSON.stringify(i.expected,r.jsonStringifyReplacer)}`;break;case h.unrecognized_keys:f=`Unrecognized key(s) in object: ${r.joinValues(i.keys,", ")}`;break;case h.invalid_union:f="Invalid input";break;case h.invalid_union_discriminator:f=`Invalid discriminator value. Expected ${r.joinValues(i.options)}`;break;case h.invalid_enum_value:f=`Invalid enum value. Expected ${r.joinValues(i.options)}, received '${i.received}'`;break;case h.invalid_arguments:f="Invalid function arguments";break;case h.invalid_return_type:f="Invalid function return type";break;case h.invalid_date:f="Invalid date";break;case h.invalid_string:"object"==typeof i.validation?"includes"in i.validation?(f=`Invalid input: must include "${i.validation.includes}"`,"number"==typeof i.validation.position&&(f=`${f} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?f=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?f=`Invalid input: must end with "${i.validation.endsWith}"`:r.assertNever(i.validation):f="regex"!==i.validation?`Invalid ${i.validation}`:"Invalid";break;case h.too_small:f="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 h.too_big:f="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 h.custom:f="Invalid input";break;case h.invalid_intersection_types:f="Intersection results could not be merged";break;case h.not_multiple_of:f=`Number must be a multiple of ${i.multipleOf}`;break;case h.not_finite:f="Number must be finite";break;default:f=s.defaultError,r.assertNever(i)}return{message:f}};let f=errorMap;function getErrorMap(){return f}const makeIssue=r=>{const{data:i,path:s,errorMaps:a,issueData:h}=r,f=[...s,...h.path||[]],_={...h,path:f};if(void 0!==h.message)return{...h,path:f,message:h.message};let v="";const b=a.filter((r=>!!r)).slice().reverse();for(const S of b)v=S(_,{data:i,defaultError:v}).message;return{...h,path:f,message:v}};function addIssueToContext(r,i){const s=getErrorMap(),a=makeIssue({issueData:i,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,s,s===errorMap?void 0:errorMap].filter((r=>!!r))});r.common.issues.push(a)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(r,i){const s=[];for(const a of i){if("aborted"===a.status)return _;"dirty"===a.status&&r.dirty(),s.push(a.value)}return{status:r.value,value:s}}static async mergeObjectAsync(r,i){const s=[];for(const a of i){const r=await a.key,i=await a.value;s.push({key:r,value:i})}return ParseStatus.mergeObjectSync(r,s)}static mergeObjectSync(r,i){const s={};for(const a of i){const{key:i,value:h}=a;if("aborted"===i.status)return _;if("aborted"===h.status)return _;"dirty"===i.status&&r.dirty(),"dirty"===h.status&&r.dirty(),"__proto__"===i.value||void 0===h.value&&!a.alwaysSet||(s[i.value]=h.value)}return{status:r.value,value:s}}}const _=Object.freeze({status:"aborted"}),DIRTY=r=>({status:"dirty",value:r}),OK=r=>({status:"valid",value:r}),isAborted=r=>"aborted"===r.status,isDirty=r=>"dirty"===r.status,isValid=r=>"valid"===r.status,isAsync=r=>"undefined"!=typeof Promise&&r instanceof Promise;function __classPrivateFieldGet(r,i,s,a){if("function"==typeof i?r!==i||!a:!i.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return i.get(r)}function __classPrivateFieldSet(r,i,s,a,h){if("function"==typeof i?r!==i||!h:!i.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i.set(r,s),s}var v,b,S,k;"function"==typeof SuppressedError&&SuppressedError,(b=v||(v={})).errToObj=r=>"string"==typeof r?{message:r}:r||{},b.toString=r=>"string"==typeof r?r:null==r?void 0:r.message;class ParseInputLazyPath{constructor(r,i,s,a){this._cachedPath=[],this.parent=r,this.data=i,this._path=s,this._key=a}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=(r,i)=>{if(isValid(i))return{success:!0,data:i.value};if(!r.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(r.common.issues);return this._error=i,this._error}}};function processCreateParams(r){if(!r)return{};const{errorMap:i,invalid_type_error:s,required_error:a,description:h}=r;if(i&&(s||a))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(i)return{errorMap:i,description:h};return{errorMap:(i,h)=>{var f,_;const{message:v}=r;return"invalid_enum_value"===i.code?{message:null!=v?v:h.defaultError}:void 0===h.data?{message:null!==(f=null!=v?v:a)&&void 0!==f?f:h.defaultError}:"invalid_type"!==i.code?{message:h.defaultError}:{message:null!==(_=null!=v?v:s)&&void 0!==_?_:h.defaultError}},description:h}}class ZodType{constructor(r){this.spa=this.safeParseAsync,this._def=r,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(r){return getParsedType(r.data)}_getOrReturnCtx(r,i){return i||{common:r.parent.common,data:r.data,parsedType:getParsedType(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}_processInputParams(r){return{status:new ParseStatus,ctx:{common:r.parent.common,data:r.data,parsedType:getParsedType(r.data),schemaErrorMap:this._def.errorMap,path:r.path,parent:r.parent}}}_parseSync(r){const i=this._parse(r);if(isAsync(i))throw new Error("Synchronous parse encountered promise.");return i}_parseAsync(r){const i=this._parse(r);return Promise.resolve(i)}parse(r,i){const s=this.safeParse(r,i);if(s.success)return s.data;throw s.error}safeParse(r,i){var s;const a={common:{issues:[],async:null!==(s=null==i?void 0:i.async)&&void 0!==s&&s,contextualErrorMap:null==i?void 0:i.errorMap},path:(null==i?void 0:i.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:r,parsedType:getParsedType(r)},h=this._parseSync({data:r,path:a.path,parent:a});return handleResult(a,h)}async parseAsync(r,i){const s=await this.safeParseAsync(r,i);if(s.success)return s.data;throw s.error}async safeParseAsync(r,i){const s={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:r,parsedType:getParsedType(r)},a=this._parse({data:r,path:s.path,parent:s}),h=await(isAsync(a)?a:Promise.resolve(a));return handleResult(s,h)}refine(r,i){const getIssueProperties=r=>"string"==typeof i||void 0===i?{message:i}:"function"==typeof i?i(r):i;return this._refinement(((i,s)=>{const a=r(i),setError=()=>s.addIssue({code:h.custom,...getIssueProperties(i)});return"undefined"!=typeof Promise&&a instanceof Promise?a.then((r=>!!r||(setError(),!1))):!!a||(setError(),!1)}))}refinement(r,i){return this._refinement(((s,a)=>!!r(s)||(a.addIssue("function"==typeof i?i(s,a):i),!1)))}_refinement(r){return new ZodEffects({schema:this,typeName:z.ZodEffects,effect:{type:"refinement",refinement:r}})}superRefine(r){return this._refinement(r)}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(r){return ZodUnion.create([this,r],this._def)}and(r){return ZodIntersection.create(this,r,this._def)}transform(r){return new ZodEffects({...processCreateParams(this._def),schema:this,typeName:z.ZodEffects,effect:{type:"transform",transform:r}})}default(r){const i="function"==typeof r?r:()=>r;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:i,typeName:z.ZodDefault})}brand(){return new ZodBranded({typeName:z.ZodBranded,type:this,...processCreateParams(this._def)})}catch(r){const i="function"==typeof r?r:()=>r;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:i,typeName:z.ZodCatch})}describe(r){return new(0,this.constructor)({...this._def,description:r})}pipe(r){return ZodPipeline.create(this,r)}readonly(){return ZodReadonly.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const I=/^c[^\s-]{8,}$/i,C=/^[0-9a-z]+$/,T=/^[0-9A-HJKMNP-TV-Z]{26}$/,O=/^[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,R=/^[a-z0-9_-]{21}$/i,M=/^[-+]?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(r){let i="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return r.precision?i=`${i}\\.\\d{${r.precision}}`:null==r.precision&&(i=`${i}(\\.\\d+)?`),i}function datetimeRegex(r){let i=`${L}T${timeRegexSource(r)}`;const s=[];return s.push(r.local?"Z?":"Z"),r.offset&&s.push("([+-]\\d{2}:?\\d{2})"),i=`${i}(${s.join("|")})`,new RegExp(`^${i}$`)}class ZodString extends ZodType{_parse(i){this._def.coerce&&(i.data=String(i.data));if(this._getType(i)!==a.string){const r=this._getOrReturnCtx(i);return addIssueToContext(r,{code:h.invalid_type,expected:a.string,received:r.parsedType}),_}const s=new ParseStatus;let f;for(const a of this._def.checks)if("min"===a.kind)i.data.length<a.value&&(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{code:h.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if("max"===a.kind)i.data.length>a.value&&(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{code:h.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if("length"===a.kind){const r=i.data.length>a.value,_=i.data.length<a.value;(r||_)&&(f=this._getOrReturnCtx(i,f),r?addIssueToContext(f,{code:h.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):_&&addIssueToContext(f,{code:h.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if("email"===a.kind)N.test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"email",code:h.invalid_string,message:a.message}),s.dirty());else if("emoji"===a.kind)P||(P=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),P.test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"emoji",code:h.invalid_string,message:a.message}),s.dirty());else if("uuid"===a.kind)O.test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"uuid",code:h.invalid_string,message:a.message}),s.dirty());else if("nanoid"===a.kind)R.test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"nanoid",code:h.invalid_string,message:a.message}),s.dirty());else if("cuid"===a.kind)I.test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"cuid",code:h.invalid_string,message:a.message}),s.dirty());else if("cuid2"===a.kind)C.test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"cuid2",code:h.invalid_string,message:a.message}),s.dirty());else if("ulid"===a.kind)T.test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"ulid",code:h.invalid_string,message:a.message}),s.dirty());else if("url"===a.kind)try{new URL(i.data)}catch(S){f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"url",code:h.invalid_string,message:a.message}),s.dirty()}else if("regex"===a.kind){a.regex.lastIndex=0;a.regex.test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"regex",code:h.invalid_string,message:a.message}),s.dirty())}else if("trim"===a.kind)i.data=i.data.trim();else if("includes"===a.kind)i.data.includes(a.value,a.position)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{code:h.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty());else if("toLowerCase"===a.kind)i.data=i.data.toLowerCase();else if("toUpperCase"===a.kind)i.data=i.data.toUpperCase();else if("startsWith"===a.kind)i.data.startsWith(a.value)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{code:h.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty());else if("endsWith"===a.kind)i.data.endsWith(a.value)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{code:h.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty());else if("datetime"===a.kind){datetimeRegex(a).test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{code:h.invalid_string,validation:"datetime",message:a.message}),s.dirty())}else if("date"===a.kind){q.test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{code:h.invalid_string,validation:"date",message:a.message}),s.dirty())}else if("time"===a.kind){new RegExp(`^${timeRegexSource(a)}$`).test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{code:h.invalid_string,validation:"time",message:a.message}),s.dirty())}else"duration"===a.kind?M.test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"duration",code:h.invalid_string,message:a.message}),s.dirty()):"ip"===a.kind?(v=i.data,("v4"!==(b=a.version)&&b||!D.test(v))&&("v6"!==b&&b||!Z.test(v))&&(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"ip",code:h.invalid_string,message:a.message}),s.dirty())):"base64"===a.kind?A.test(i.data)||(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{validation:"base64",code:h.invalid_string,message:a.message}),s.dirty()):r.assertNever(a);var v,b;return{status:s.value,value:i.data}}_regex(r,i,s){return this.refinement((i=>r.test(i)),{validation:i,code:h.invalid_string,...v.errToObj(s)})}_addCheck(r){return new ZodString({...this._def,checks:[...this._def.checks,r]})}email(r){return this._addCheck({kind:"email",...v.errToObj(r)})}url(r){return this._addCheck({kind:"url",...v.errToObj(r)})}emoji(r){return this._addCheck({kind:"emoji",...v.errToObj(r)})}uuid(r){return this._addCheck({kind:"uuid",...v.errToObj(r)})}nanoid(r){return this._addCheck({kind:"nanoid",...v.errToObj(r)})}cuid(r){return this._addCheck({kind:"cuid",...v.errToObj(r)})}cuid2(r){return this._addCheck({kind:"cuid2",...v.errToObj(r)})}ulid(r){return this._addCheck({kind:"ulid",...v.errToObj(r)})}base64(r){return this._addCheck({kind:"base64",...v.errToObj(r)})}ip(r){return this._addCheck({kind:"ip",...v.errToObj(r)})}datetime(r){var i,s;return"string"==typeof r?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:r}):this._addCheck({kind:"datetime",precision:void 0===(null==r?void 0:r.precision)?null:null==r?void 0:r.precision,offset:null!==(i=null==r?void 0:r.offset)&&void 0!==i&&i,local:null!==(s=null==r?void 0:r.local)&&void 0!==s&&s,...v.errToObj(null==r?void 0:r.message)})}date(r){return this._addCheck({kind:"date",message:r})}time(r){return"string"==typeof r?this._addCheck({kind:"time",precision:null,message:r}):this._addCheck({kind:"time",precision:void 0===(null==r?void 0:r.precision)?null:null==r?void 0:r.precision,...v.errToObj(null==r?void 0:r.message)})}duration(r){return this._addCheck({kind:"duration",...v.errToObj(r)})}regex(r,i){return this._addCheck({kind:"regex",regex:r,...v.errToObj(i)})}includes(r,i){return this._addCheck({kind:"includes",value:r,position:null==i?void 0:i.position,...v.errToObj(null==i?void 0:i.message)})}startsWith(r,i){return this._addCheck({kind:"startsWith",value:r,...v.errToObj(i)})}endsWith(r,i){return this._addCheck({kind:"endsWith",value:r,...v.errToObj(i)})}min(r,i){return this._addCheck({kind:"min",value:r,...v.errToObj(i)})}max(r,i){return this._addCheck({kind:"max",value:r,...v.errToObj(i)})}length(r,i){return this._addCheck({kind:"length",value:r,...v.errToObj(i)})}nonempty(r){return this.min(1,v.errToObj(r))}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((r=>"datetime"===r.kind))}get isDate(){return!!this._def.checks.find((r=>"date"===r.kind))}get isTime(){return!!this._def.checks.find((r=>"time"===r.kind))}get isDuration(){return!!this._def.checks.find((r=>"duration"===r.kind))}get isEmail(){return!!this._def.checks.find((r=>"email"===r.kind))}get isURL(){return!!this._def.checks.find((r=>"url"===r.kind))}get isEmoji(){return!!this._def.checks.find((r=>"emoji"===r.kind))}get isUUID(){return!!this._def.checks.find((r=>"uuid"===r.kind))}get isNANOID(){return!!this._def.checks.find((r=>"nanoid"===r.kind))}get isCUID(){return!!this._def.checks.find((r=>"cuid"===r.kind))}get isCUID2(){return!!this._def.checks.find((r=>"cuid2"===r.kind))}get isULID(){return!!this._def.checks.find((r=>"ulid"===r.kind))}get isIP(){return!!this._def.checks.find((r=>"ip"===r.kind))}get isBase64(){return!!this._def.checks.find((r=>"base64"===r.kind))}get minLength(){let r=null;for(const i of this._def.checks)"min"===i.kind&&(null===r||i.value>r)&&(r=i.value);return r}get maxLength(){let r=null;for(const i of this._def.checks)"max"===i.kind&&(null===r||i.value<r)&&(r=i.value);return r}}function floatSafeRemainder(r,i){const s=(r.toString().split(".")[1]||"").length,a=(i.toString().split(".")[1]||"").length,h=s>a?s:a;return parseInt(r.toFixed(h).replace(".",""))%parseInt(i.toFixed(h).replace(".",""))/Math.pow(10,h)}ZodString.create=r=>{var i;return new ZodString({checks:[],typeName:z.ZodString,coerce:null!==(i=null==r?void 0:r.coerce)&&void 0!==i&&i,...processCreateParams(r)})};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)!==a.number){const r=this._getOrReturnCtx(i);return addIssueToContext(r,{code:h.invalid_type,expected:a.number,received:r.parsedType}),_}let s;const f=new ParseStatus;for(const a of this._def.checks)if("int"===a.kind)r.isInteger(i.data)||(s=this._getOrReturnCtx(i,s),addIssueToContext(s,{code:h.invalid_type,expected:"integer",received:"float",message:a.message}),f.dirty());else if("min"===a.kind){(a.inclusive?i.data<a.value:i.data<=a.value)&&(s=this._getOrReturnCtx(i,s),addIssueToContext(s,{code:h.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),f.dirty())}else if("max"===a.kind){(a.inclusive?i.data>a.value:i.data>=a.value)&&(s=this._getOrReturnCtx(i,s),addIssueToContext(s,{code:h.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),f.dirty())}else"multipleOf"===a.kind?0!==floatSafeRemainder(i.data,a.value)&&(s=this._getOrReturnCtx(i,s),addIssueToContext(s,{code:h.not_multiple_of,multipleOf:a.value,message:a.message}),f.dirty()):"finite"===a.kind?Number.isFinite(i.data)||(s=this._getOrReturnCtx(i,s),addIssueToContext(s,{code:h.not_finite,message:a.message}),f.dirty()):r.assertNever(a);return{status:f.value,value:i.data}}gte(r,i){return this.setLimit("min",r,!0,v.toString(i))}gt(r,i){return this.setLimit("min",r,!1,v.toString(i))}lte(r,i){return this.setLimit("max",r,!0,v.toString(i))}lt(r,i){return this.setLimit("max",r,!1,v.toString(i))}setLimit(r,i,s,a){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:r,value:i,inclusive:s,message:v.toString(a)}]})}_addCheck(r){return new ZodNumber({...this._def,checks:[...this._def.checks,r]})}int(r){return this._addCheck({kind:"int",message:v.toString(r)})}positive(r){return this._addCheck({kind:"min",value:0,inclusive:!1,message:v.toString(r)})}negative(r){return this._addCheck({kind:"max",value:0,inclusive:!1,message:v.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:0,inclusive:!0,message:v.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:0,inclusive:!0,message:v.toString(r)})}multipleOf(r,i){return this._addCheck({kind:"multipleOf",value:r,message:v.toString(i)})}finite(r){return this._addCheck({kind:"finite",message:v.toString(r)})}safe(r){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:v.toString(r)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:v.toString(r)})}get minValue(){let r=null;for(const i of this._def.checks)"min"===i.kind&&(null===r||i.value>r)&&(r=i.value);return r}get maxValue(){let r=null;for(const i of this._def.checks)"max"===i.kind&&(null===r||i.value<r)&&(r=i.value);return r}get isInt(){return!!this._def.checks.find((i=>"int"===i.kind||"multipleOf"===i.kind&&r.isInteger(i.value)))}get isFinite(){let r=null,i=null;for(const s of this._def.checks){if("finite"===s.kind||"int"===s.kind||"multipleOf"===s.kind)return!0;"min"===s.kind?(null===i||s.value>i)&&(i=s.value):"max"===s.kind&&(null===r||s.value<r)&&(r=s.value)}return Number.isFinite(i)&&Number.isFinite(r)}}ZodNumber.create=r=>new ZodNumber({checks:[],typeName:z.ZodNumber,coerce:(null==r?void 0:r.coerce)||!1,...processCreateParams(r)});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)!==a.bigint){const r=this._getOrReturnCtx(i);return addIssueToContext(r,{code:h.invalid_type,expected:a.bigint,received:r.parsedType}),_}let s;const f=new ParseStatus;for(const a of this._def.checks)if("min"===a.kind){(a.inclusive?i.data<a.value:i.data<=a.value)&&(s=this._getOrReturnCtx(i,s),addIssueToContext(s,{code:h.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),f.dirty())}else if("max"===a.kind){(a.inclusive?i.data>a.value:i.data>=a.value)&&(s=this._getOrReturnCtx(i,s),addIssueToContext(s,{code:h.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),f.dirty())}else"multipleOf"===a.kind?i.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(i,s),addIssueToContext(s,{code:h.not_multiple_of,multipleOf:a.value,message:a.message}),f.dirty()):r.assertNever(a);return{status:f.value,value:i.data}}gte(r,i){return this.setLimit("min",r,!0,v.toString(i))}gt(r,i){return this.setLimit("min",r,!1,v.toString(i))}lte(r,i){return this.setLimit("max",r,!0,v.toString(i))}lt(r,i){return this.setLimit("max",r,!1,v.toString(i))}setLimit(r,i,s,a){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:r,value:i,inclusive:s,message:v.toString(a)}]})}_addCheck(r){return new ZodBigInt({...this._def,checks:[...this._def.checks,r]})}positive(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:v.toString(r)})}negative(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:v.toString(r)})}nonpositive(r){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:v.toString(r)})}nonnegative(r){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:v.toString(r)})}multipleOf(r,i){return this._addCheck({kind:"multipleOf",value:r,message:v.toString(i)})}get minValue(){let r=null;for(const i of this._def.checks)"min"===i.kind&&(null===r||i.value>r)&&(r=i.value);return r}get maxValue(){let r=null;for(const i of this._def.checks)"max"===i.kind&&(null===r||i.value<r)&&(r=i.value);return r}}ZodBigInt.create=r=>{var i;return new ZodBigInt({checks:[],typeName:z.ZodBigInt,coerce:null!==(i=null==r?void 0:r.coerce)&&void 0!==i&&i,...processCreateParams(r)})};class ZodBoolean extends ZodType{_parse(r){this._def.coerce&&(r.data=Boolean(r.data));if(this._getType(r)!==a.boolean){const i=this._getOrReturnCtx(r);return addIssueToContext(i,{code:h.invalid_type,expected:a.boolean,received:i.parsedType}),_}return OK(r.data)}}ZodBoolean.create=r=>new ZodBoolean({typeName:z.ZodBoolean,coerce:(null==r?void 0:r.coerce)||!1,...processCreateParams(r)});class ZodDate extends ZodType{_parse(i){this._def.coerce&&(i.data=new Date(i.data));if(this._getType(i)!==a.date){const r=this._getOrReturnCtx(i);return addIssueToContext(r,{code:h.invalid_type,expected:a.date,received:r.parsedType}),_}if(isNaN(i.data.getTime())){return addIssueToContext(this._getOrReturnCtx(i),{code:h.invalid_date}),_}const s=new ParseStatus;let f;for(const a of this._def.checks)"min"===a.kind?i.data.getTime()<a.value&&(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{code:h.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):"max"===a.kind?i.data.getTime()>a.value&&(f=this._getOrReturnCtx(i,f),addIssueToContext(f,{code:h.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):r.assertNever(a);return{status:s.value,value:new Date(i.data.getTime())}}_addCheck(r){return new ZodDate({...this._def,checks:[...this._def.checks,r]})}min(r,i){return this._addCheck({kind:"min",value:r.getTime(),message:v.toString(i)})}max(r,i){return this._addCheck({kind:"max",value:r.getTime(),message:v.toString(i)})}get minDate(){let r=null;for(const i of this._def.checks)"min"===i.kind&&(null===r||i.value>r)&&(r=i.value);return null!=r?new Date(r):null}get maxDate(){let r=null;for(const i of this._def.checks)"max"===i.kind&&(null===r||i.value<r)&&(r=i.value);return null!=r?new Date(r):null}}ZodDate.create=r=>new ZodDate({checks:[],coerce:(null==r?void 0:r.coerce)||!1,typeName:z.ZodDate,...processCreateParams(r)});class ZodSymbol extends ZodType{_parse(r){if(this._getType(r)!==a.symbol){const i=this._getOrReturnCtx(r);return addIssueToContext(i,{code:h.invalid_type,expected:a.symbol,received:i.parsedType}),_}return OK(r.data)}}ZodSymbol.create=r=>new ZodSymbol({typeName:z.ZodSymbol,...processCreateParams(r)});class ZodUndefined extends ZodType{_parse(r){if(this._getType(r)!==a.undefined){const i=this._getOrReturnCtx(r);return addIssueToContext(i,{code:h.invalid_type,expected:a.undefined,received:i.parsedType}),_}return OK(r.data)}}ZodUndefined.create=r=>new ZodUndefined({typeName:z.ZodUndefined,...processCreateParams(r)});class ZodNull extends ZodType{_parse(r){if(this._getType(r)!==a.null){const i=this._getOrReturnCtx(r);return addIssueToContext(i,{code:h.invalid_type,expected:a.null,received:i.parsedType}),_}return OK(r.data)}}ZodNull.create=r=>new ZodNull({typeName:z.ZodNull,...processCreateParams(r)});class ZodAny extends ZodType{constructor(){super(...arguments),this._any=!0}_parse(r){return OK(r.data)}}ZodAny.create=r=>new ZodAny({typeName:z.ZodAny,...processCreateParams(r)});class ZodUnknown extends ZodType{constructor(){super(...arguments),this._unknown=!0}_parse(r){return OK(r.data)}}ZodUnknown.create=r=>new ZodUnknown({typeName:z.ZodUnknown,...processCreateParams(r)});class ZodNever extends ZodType{_parse(r){const i=this._getOrReturnCtx(r);return addIssueToContext(i,{code:h.invalid_type,expected:a.never,received:i.parsedType}),_}}ZodNever.create=r=>new ZodNever({typeName:z.ZodNever,...processCreateParams(r)});class ZodVoid extends ZodType{_parse(r){if(this._getType(r)!==a.undefined){const i=this._getOrReturnCtx(r);return addIssueToContext(i,{code:h.invalid_type,expected:a.void,received:i.parsedType}),_}return OK(r.data)}}ZodVoid.create=r=>new ZodVoid({typeName:z.ZodVoid,...processCreateParams(r)});class ZodArray extends ZodType{_parse(r){const{ctx:i,status:s}=this._processInputParams(r),f=this._def;if(i.parsedType!==a.array)return addIssueToContext(i,{code:h.invalid_type,expected:a.array,received:i.parsedType}),_;if(null!==f.exactLength){const r=i.data.length>f.exactLength.value,a=i.data.length<f.exactLength.value;(r||a)&&(addIssueToContext(i,{code:r?h.too_big:h.too_small,minimum:a?f.exactLength.value:void 0,maximum:r?f.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:f.exactLength.message}),s.dirty())}if(null!==f.minLength&&i.data.length<f.minLength.value&&(addIssueToContext(i,{code:h.too_small,minimum:f.minLength.value,type:"array",inclusive:!0,exact:!1,message:f.minLength.message}),s.dirty()),null!==f.maxLength&&i.data.length>f.maxLength.value&&(addIssueToContext(i,{code:h.too_big,maximum:f.maxLength.value,type:"array",inclusive:!0,exact:!1,message:f.maxLength.message}),s.dirty()),i.common.async)return Promise.all([...i.data].map(((r,s)=>f.type._parseAsync(new ParseInputLazyPath(i,r,i.path,s))))).then((r=>ParseStatus.mergeArray(s,r)));const v=[...i.data].map(((r,s)=>f.type._parseSync(new ParseInputLazyPath(i,r,i.path,s))));return ParseStatus.mergeArray(s,v)}get element(){return this._def.type}min(r,i){return new ZodArray({...this._def,minLength:{value:r,message:v.toString(i)}})}max(r,i){return new ZodArray({...this._def,maxLength:{value:r,message:v.toString(i)}})}length(r,i){return new ZodArray({...this._def,exactLength:{value:r,message:v.toString(i)}})}nonempty(r){return this.min(1,r)}}function deepPartialify(r){if(r instanceof ZodObject){const i={};for(const s in r.shape){const a=r.shape[s];i[s]=ZodOptional.create(deepPartialify(a))}return new ZodObject({...r._def,shape:()=>i})}return r instanceof ZodArray?new ZodArray({...r._def,type:deepPartialify(r.element)}):r instanceof ZodOptional?ZodOptional.create(deepPartialify(r.unwrap())):r instanceof ZodNullable?ZodNullable.create(deepPartialify(r.unwrap())):r instanceof ZodTuple?ZodTuple.create(r.items.map((r=>deepPartialify(r)))):r}ZodArray.create=(r,i)=>new ZodArray({type:r,minLength:null,maxLength:null,exactLength:null,typeName:z.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(),s=r.objectKeys(i);return this._cached={shape:i,keys:s}}_parse(r){if(this._getType(r)!==a.object){const i=this._getOrReturnCtx(r);return addIssueToContext(i,{code:h.invalid_type,expected:a.object,received:i.parsedType}),_}const{status:i,ctx:s}=this._processInputParams(r),{shape:f,keys:v}=this._getCached(),b=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const a in s.data)v.includes(a)||b.push(a);const S=[];for(const a of v){const r=f[a],i=s.data[a];S.push({key:{status:"valid",value:a},value:r._parse(new ParseInputLazyPath(s,i,s.path,a)),alwaysSet:a in s.data})}if(this._def.catchall instanceof ZodNever){const r=this._def.unknownKeys;if("passthrough"===r)for(const i of b)S.push({key:{status:"valid",value:i},value:{status:"valid",value:s.data[i]}});else if("strict"===r)b.length>0&&(addIssueToContext(s,{code:h.unrecognized_keys,keys:b}),i.dirty());else if("strip"!==r)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const r=this._def.catchall;for(const i of b){const a=s.data[i];S.push({key:{status:"valid",value:i},value:r._parse(new ParseInputLazyPath(s,a,s.path,i)),alwaysSet:i in s.data})}}return s.common.async?Promise.resolve().then((async()=>{const r=[];for(const i of S){const s=await i.key,a=await i.value;r.push({key:s,value:a,alwaysSet:i.alwaysSet})}return r})).then((r=>ParseStatus.mergeObjectSync(i,r))):ParseStatus.mergeObjectSync(i,S)}get shape(){return this._def.shape()}strict(r){return v.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==r?{errorMap:(i,s)=>{var a,h,f,_;const b=null!==(f=null===(h=(a=this._def).errorMap)||void 0===h?void 0:h.call(a,i,s).message)&&void 0!==f?f:s.defaultError;return"unrecognized_keys"===i.code?{message:null!==(_=v.errToObj(r).message)&&void 0!==_?_:b}:{message:b}}}:{}})}strip(){return new ZodObject({...this._def,unknownKeys:"strip"})}passthrough(){return new ZodObject({...this._def,unknownKeys:"passthrough"})}extend(r){return new ZodObject({...this._def,shape:()=>({...this._def.shape(),...r})})}merge(r){return new ZodObject({unknownKeys:r._def.unknownKeys,catchall:r._def.catchall,shape:()=>({...this._def.shape(),...r._def.shape()}),typeName:z.ZodObject})}setKey(r,i){return this.augment({[r]:i})}catchall(r){return new ZodObject({...this._def,catchall:r})}pick(i){const s={};return r.objectKeys(i).forEach((r=>{i[r]&&this.shape[r]&&(s[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>s})}omit(i){const s={};return r.objectKeys(this.shape).forEach((r=>{i[r]||(s[r]=this.shape[r])})),new ZodObject({...this._def,shape:()=>s})}deepPartial(){return deepPartialify(this)}partial(i){const s={};return r.objectKeys(this.shape).forEach((r=>{const a=this.shape[r];i&&!i[r]?s[r]=a:s[r]=a.optional()})),new ZodObject({...this._def,shape:()=>s})}required(i){const s={};return r.objectKeys(this.shape).forEach((r=>{if(i&&!i[r])s[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ZodOptional;)i=i._def.innerType;s[r]=i}})),new ZodObject({...this._def,shape:()=>s})}keyof(){return createZodEnum(r.objectKeys(this.shape))}}ZodObject.create=(r,i)=>new ZodObject({shape:()=>r,unknownKeys:"strip",catchall:ZodNever.create(),typeName:z.ZodObject,...processCreateParams(i)}),ZodObject.strictCreate=(r,i)=>new ZodObject({shape:()=>r,unknownKeys:"strict",catchall:ZodNever.create(),typeName:z.ZodObject,...processCreateParams(i)}),ZodObject.lazycreate=(r,i)=>new ZodObject({shape:r,unknownKeys:"strip",catchall:ZodNever.create(),typeName:z.ZodObject,...processCreateParams(i)});class ZodUnion extends ZodType{_parse(r){const{ctx:i}=this._processInputParams(r),s=this._def.options;if(i.common.async)return Promise.all(s.map((async r=>{const s={...i,common:{...i.common,issues:[]},parent:null};return{result:await r._parseAsync({data:i.data,path:i.path,parent:s}),ctx:s}}))).then((function handleResults(r){for(const i of r)if("valid"===i.result.status)return i.result;for(const a of r)if("dirty"===a.result.status)return i.common.issues.push(...a.ctx.common.issues),a.result;const s=r.map((r=>new ZodError(r.ctx.common.issues)));return addIssueToContext(i,{code:h.invalid_union,unionErrors:s}),_}));{let r;const a=[];for(const h of s){const s={...i,common:{...i.common,issues:[]},parent:null},f=h._parseSync({data:i.data,path:i.path,parent:s});if("valid"===f.status)return f;"dirty"!==f.status||r||(r={result:f,ctx:s}),s.common.issues.length&&a.push(s.common.issues)}if(r)return i.common.issues.push(...r.ctx.common.issues),r.result;const f=a.map((r=>new ZodError(r)));return addIssueToContext(i,{code:h.invalid_union,unionErrors:f}),_}}get options(){return this._def.options}}ZodUnion.create=(r,i)=>new ZodUnion({options:r,typeName:z.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?r.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(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==a.object)return addIssueToContext(i,{code:h.invalid_type,expected:a.object,received:i.parsedType}),_;const s=this.discriminator,f=i.data[s],v=this.optionsMap.get(f);return v?i.common.async?v._parseAsync({data:i.data,path:i.path,parent:i}):v._parseSync({data:i.data,path:i.path,parent:i}):(addIssueToContext(i,{code:h.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),_)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(r,i,s){const a=new Map;for(const h of i){const i=getDiscriminator(h.shape[r]);if(!i.length)throw new Error(`A discriminator value for key \`${r}\` could not be extracted from all schema options`);for(const s of i){if(a.has(s))throw new Error(`Discriminator property ${String(r)} has duplicate value ${String(s)}`);a.set(s,h)}}return new ZodDiscriminatedUnion({typeName:z.ZodDiscriminatedUnion,discriminator:r,options:i,optionsMap:a,...processCreateParams(s)})}}function mergeValues(i,s){const h=getParsedType(i),f=getParsedType(s);if(i===s)return{valid:!0,data:i};if(h===a.object&&f===a.object){const a=r.objectKeys(s),h=r.objectKeys(i).filter((r=>-1!==a.indexOf(r))),f={...i,...s};for(const r of h){const a=mergeValues(i[r],s[r]);if(!a.valid)return{valid:!1};f[r]=a.data}return{valid:!0,data:f}}if(h===a.array&&f===a.array){if(i.length!==s.length)return{valid:!1};const r=[];for(let a=0;a<i.length;a++){const h=mergeValues(i[a],s[a]);if(!h.valid)return{valid:!1};r.push(h.data)}return{valid:!0,data:r}}return h===a.date&&f===a.date&&+i==+s?{valid:!0,data:i}:{valid:!1}}class ZodIntersection extends ZodType{_parse(r){const{status:i,ctx:s}=this._processInputParams(r),handleParsed=(r,a)=>{if(isAborted(r)||isAborted(a))return _;const f=mergeValues(r.value,a.value);return f.valid?((isDirty(r)||isDirty(a))&&i.dirty(),{status:i.value,value:f.data}):(addIssueToContext(s,{code:h.invalid_intersection_types}),_)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then((([r,i])=>handleParsed(r,i))):handleParsed(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ZodIntersection.create=(r,i,s)=>new ZodIntersection({left:r,right:i,typeName:z.ZodIntersection,...processCreateParams(s)});class ZodTuple extends ZodType{_parse(r){const{status:i,ctx:s}=this._processInputParams(r);if(s.parsedType!==a.array)return addIssueToContext(s,{code:h.invalid_type,expected:a.array,received:s.parsedType}),_;if(s.data.length<this._def.items.length)return addIssueToContext(s,{code:h.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&s.data.length>this._def.items.length&&(addIssueToContext(s,{code:h.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),i.dirty());const f=[...s.data].map(((r,i)=>{const a=this._def.items[i]||this._def.rest;return a?a._parse(new ParseInputLazyPath(s,r,s.path,i)):null})).filter((r=>!!r));return s.common.async?Promise.all(f).then((r=>ParseStatus.mergeArray(i,r))):ParseStatus.mergeArray(i,f)}get items(){return this._def.items}rest(r){return new ZodTuple({...this._def,rest:r})}}ZodTuple.create=(r,i)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:r,typeName:z.ZodTuple,rest:null,...processCreateParams(i)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:i,ctx:s}=this._processInputParams(r);if(s.parsedType!==a.object)return addIssueToContext(s,{code:h.invalid_type,expected:a.object,received:s.parsedType}),_;const f=[],v=this._def.keyType,b=this._def.valueType;for(const a in s.data)f.push({key:v._parse(new ParseInputLazyPath(s,a,s.path,a)),value:b._parse(new ParseInputLazyPath(s,s.data[a],s.path,a)),alwaysSet:a in s.data});return s.common.async?ParseStatus.mergeObjectAsync(i,f):ParseStatus.mergeObjectSync(i,f)}get element(){return this._def.valueType}static create(r,i,s){return new ZodRecord(i instanceof ZodType?{keyType:r,valueType:i,typeName:z.ZodRecord,...processCreateParams(s)}:{keyType:ZodString.create(),valueType:r,typeName:z.ZodRecord,...processCreateParams(i)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(r){const{status:i,ctx:s}=this._processInputParams(r);if(s.parsedType!==a.map)return addIssueToContext(s,{code:h.invalid_type,expected:a.map,received:s.parsedType}),_;const f=this._def.keyType,v=this._def.valueType,b=[...s.data.entries()].map((([r,i],a)=>({key:f._parse(new ParseInputLazyPath(s,r,s.path,[a,"key"])),value:v._parse(new ParseInputLazyPath(s,i,s.path,[a,"value"]))})));if(s.common.async){const r=new Map;return Promise.resolve().then((async()=>{for(const s of b){const a=await s.key,h=await s.value;if("aborted"===a.status||"aborted"===h.status)return _;"dirty"!==a.status&&"dirty"!==h.status||i.dirty(),r.set(a.value,h.value)}return{status:i.value,value:r}}))}{const r=new Map;for(const s of b){const a=s.key,h=s.value;if("aborted"===a.status||"aborted"===h.status)return _;"dirty"!==a.status&&"dirty"!==h.status||i.dirty(),r.set(a.value,h.value)}return{status:i.value,value:r}}}}ZodMap.create=(r,i,s)=>new ZodMap({valueType:i,keyType:r,typeName:z.ZodMap,...processCreateParams(s)});class ZodSet extends ZodType{_parse(r){const{status:i,ctx:s}=this._processInputParams(r);if(s.parsedType!==a.set)return addIssueToContext(s,{code:h.invalid_type,expected:a.set,received:s.parsedType}),_;const f=this._def;null!==f.minSize&&s.data.size<f.minSize.value&&(addIssueToContext(s,{code:h.too_small,minimum:f.minSize.value,type:"set",inclusive:!0,exact:!1,message:f.minSize.message}),i.dirty()),null!==f.maxSize&&s.data.size>f.maxSize.value&&(addIssueToContext(s,{code:h.too_big,maximum:f.maxSize.value,type:"set",inclusive:!0,exact:!1,message:f.maxSize.message}),i.dirty());const v=this._def.valueType;function finalizeSet(r){const s=new Set;for(const a of r){if("aborted"===a.status)return _;"dirty"===a.status&&i.dirty(),s.add(a.value)}return{status:i.value,value:s}}const b=[...s.data.values()].map(((r,i)=>v._parse(new ParseInputLazyPath(s,r,s.path,i))));return s.common.async?Promise.all(b).then((r=>finalizeSet(r))):finalizeSet(b)}min(r,i){return new ZodSet({...this._def,minSize:{value:r,message:v.toString(i)}})}max(r,i){return new ZodSet({...this._def,maxSize:{value:r,message:v.toString(i)}})}size(r,i){return this.min(r,i).max(r,i)}nonempty(r){return this.min(1,r)}}ZodSet.create=(r,i)=>new ZodSet({valueType:r,minSize:null,maxSize:null,typeName:z.ZodSet,...processCreateParams(i)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==a.function)return addIssueToContext(i,{code:h.invalid_type,expected:a.function,received:i.parsedType}),_;function makeArgsIssue(r,s){return makeIssue({data:r,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,getErrorMap(),errorMap].filter((r=>!!r)),issueData:{code:h.invalid_arguments,argumentsError:s}})}function makeReturnsIssue(r,s){return makeIssue({data:r,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,getErrorMap(),errorMap].filter((r=>!!r)),issueData:{code:h.invalid_return_type,returnTypeError:s}})}const s={errorMap:i.common.contextualErrorMap},f=i.data;if(this._def.returns instanceof ZodPromise){const r=this;return OK((async function(...i){const a=new ZodError([]),h=await r._def.args.parseAsync(i,s).catch((r=>{throw a.addIssue(makeArgsIssue(i,r)),a})),_=await Reflect.apply(f,this,h);return await r._def.returns._def.type.parseAsync(_,s).catch((r=>{throw a.addIssue(makeReturnsIssue(_,r)),a}))}))}{const r=this;return OK((function(...i){const a=r._def.args.safeParse(i,s);if(!a.success)throw new ZodError([makeArgsIssue(i,a.error)]);const h=Reflect.apply(f,this,a.data),_=r._def.returns.safeParse(h,s);if(!_.success)throw new ZodError([makeReturnsIssue(h,_.error)]);return _.data}))}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...r){return new ZodFunction({...this._def,args:ZodTuple.create(r).rest(ZodUnknown.create())})}returns(r){return new ZodFunction({...this._def,returns:r})}implement(r){return this.parse(r)}strictImplement(r){return this.parse(r)}static create(r,i,s){return new ZodFunction({args:r||ZodTuple.create([]).rest(ZodUnknown.create()),returns:i||ZodUnknown.create(),typeName:z.ZodFunction,...processCreateParams(s)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(r){const{ctx:i}=this._processInputParams(r);return this._def.getter()._parse({data:i.data,path:i.path,parent:i})}}ZodLazy.create=(r,i)=>new ZodLazy({getter:r,typeName:z.ZodLazy,...processCreateParams(i)});class ZodLiteral extends ZodType{_parse(r){if(r.data!==this._def.value){const i=this._getOrReturnCtx(r);return addIssueToContext(i,{received:i.data,code:h.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:r.data}}get value(){return this._def.value}}function createZodEnum(r,i){return new ZodEnum({values:r,typeName:z.ZodEnum,...processCreateParams(i)})}ZodLiteral.create=(r,i)=>new ZodLiteral({value:r,typeName:z.ZodLiteral,...processCreateParams(i)});class ZodEnum extends ZodType{constructor(){super(...arguments),S.set(this,void 0)}_parse(i){if("string"!=typeof i.data){const s=this._getOrReturnCtx(i),a=this._def.values;return addIssueToContext(s,{expected:r.joinValues(a),received:s.parsedType,code:h.invalid_type}),_}if(__classPrivateFieldGet(this,S)||__classPrivateFieldSet(this,S,new Set(this._def.values)),!__classPrivateFieldGet(this,S).has(i.data)){const r=this._getOrReturnCtx(i),s=this._def.values;return addIssueToContext(r,{received:r.data,code:h.invalid_enum_value,options:s}),_}return OK(i.data)}get options(){return this._def.values}get enum(){const r={};for(const i of this._def.values)r[i]=i;return r}get Values(){const r={};for(const i of this._def.values)r[i]=i;return r}get Enum(){const r={};for(const i of this._def.values)r[i]=i;return r}extract(r,i=this._def){return ZodEnum.create(r,{...this._def,...i})}exclude(r,i=this._def){return ZodEnum.create(this.options.filter((i=>!r.includes(i))),{...this._def,...i})}}S=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),k.set(this,void 0)}_parse(i){const s=r.getValidEnumValues(this._def.values),f=this._getOrReturnCtx(i);if(f.parsedType!==a.string&&f.parsedType!==a.number){const i=r.objectValues(s);return addIssueToContext(f,{expected:r.joinValues(i),received:f.parsedType,code:h.invalid_type}),_}if(__classPrivateFieldGet(this,k)||__classPrivateFieldSet(this,k,new Set(r.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,k).has(i.data)){const i=r.objectValues(s);return addIssueToContext(f,{received:f.data,code:h.invalid_enum_value,options:i}),_}return OK(i.data)}get enum(){return this._def.values}}k=new WeakMap,ZodNativeEnum.create=(r,i)=>new ZodNativeEnum({values:r,typeName:z.ZodNativeEnum,...processCreateParams(i)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(r){const{ctx:i}=this._processInputParams(r);if(i.parsedType!==a.promise&&!1===i.common.async)return addIssueToContext(i,{code:h.invalid_type,expected:a.promise,received:i.parsedType}),_;const s=i.parsedType===a.promise?i.data:Promise.resolve(i.data);return OK(s.then((r=>this._def.type.parseAsync(r,{path:i.path,errorMap:i.common.contextualErrorMap}))))}}ZodPromise.create=(r,i)=>new ZodPromise({type:r,typeName:z.ZodPromise,...processCreateParams(i)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===z.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(i){const{status:s,ctx:a}=this._processInputParams(i),h=this._def.effect||null,f={addIssue:r=>{addIssueToContext(a,r),r.fatal?s.abort():s.dirty()},get path(){return a.path}};if(f.addIssue=f.addIssue.bind(f),"preprocess"===h.type){const r=h.transform(a.data,f);if(a.common.async)return Promise.resolve(r).then((async r=>{if("aborted"===s.value)return _;const i=await this._def.schema._parseAsync({data:r,path:a.path,parent:a});return"aborted"===i.status?_:"dirty"===i.status||"dirty"===s.value?DIRTY(i.value):i}));{if("aborted"===s.value)return _;const i=this._def.schema._parseSync({data:r,path:a.path,parent:a});return"aborted"===i.status?_:"dirty"===i.status||"dirty"===s.value?DIRTY(i.value):i}}if("refinement"===h.type){const executeRefinement=r=>{const i=h.refinement(r,f);if(a.common.async)return Promise.resolve(i);if(i instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return r};if(!1===a.common.async){const r=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return"aborted"===r.status?_:("dirty"===r.status&&s.dirty(),executeRefinement(r.value),{status:s.value,value:r.value})}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((r=>"aborted"===r.status?_:("dirty"===r.status&&s.dirty(),executeRefinement(r.value).then((()=>({status:s.value,value:r.value}))))))}if("transform"===h.type){if(!1===a.common.async){const r=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!isValid(r))return r;const i=h.transform(r.value,f);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:i}}return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then((r=>isValid(r)?Promise.resolve(h.transform(r.value,f)).then((r=>({status:s.value,value:r}))):r))}r.assertNever(h)}}ZodEffects.create=(r,i,s)=>new ZodEffects({schema:r,typeName:z.ZodEffects,effect:i,...processCreateParams(s)}),ZodEffects.createWithPreprocess=(r,i,s)=>new ZodEffects({schema:i,effect:{type:"preprocess",transform:r},typeName:z.ZodEffects,...processCreateParams(s)});class ZodOptional extends ZodType{_parse(r){return this._getType(r)===a.undefined?OK(void 0):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}ZodOptional.create=(r,i)=>new ZodOptional({innerType:r,typeName:z.ZodOptional,...processCreateParams(i)});class ZodNullable extends ZodType{_parse(r){return this._getType(r)===a.null?OK(null):this._def.innerType._parse(r)}unwrap(){return this._def.innerType}}ZodNullable.create=(r,i)=>new ZodNullable({innerType:r,typeName:z.ZodNullable,...processCreateParams(i)});class ZodDefault extends ZodType{_parse(r){const{ctx:i}=this._processInputParams(r);let s=i.data;return i.parsedType===a.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:i.path,parent:i})}removeDefault(){return this._def.innerType}}ZodDefault.create=(r,i)=>new ZodDefault({innerType:r,typeName:z.ZodDefault,defaultValue:"function"==typeof i.default?i.default:()=>i.default,...processCreateParams(i)});class ZodCatch extends ZodType{_parse(r){const{ctx:i}=this._processInputParams(r),s={...i,common:{...i.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return isAsync(a)?a.then((r=>({status:"valid",value:"valid"===r.status?r.value:this._def.catchValue({get error(){return new ZodError(s.common.issues)},input:s.data})}))):{status:"valid",value:"valid"===a.status?a.value:this._def.catchValue({get error(){return new ZodError(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(r,i)=>new ZodCatch({innerType:r,typeName:z.ZodCatch,catchValue:"function"==typeof i.catch?i.catch:()=>i.catch,...processCreateParams(i)});class ZodNaN extends ZodType{_parse(r){if(this._getType(r)!==a.nan){const i=this._getOrReturnCtx(r);return addIssueToContext(i,{code:h.invalid_type,expected:a.nan,received:i.parsedType}),_}return{status:"valid",value:r.data}}}ZodNaN.create=r=>new ZodNaN({typeName:z.ZodNaN,...processCreateParams(r)});const $=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(r){const{ctx:i}=this._processInputParams(r),s=i.data;return this._def.type._parse({data:s,path:i.path,parent:i})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(r){const{status:i,ctx:s}=this._processInputParams(r);if(s.common.async){return(async()=>{const r=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return"aborted"===r.status?_:"dirty"===r.status?(i.dirty(),DIRTY(r.value)):this._def.out._parseAsync({data:r.value,path:s.path,parent:s})})()}{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return"aborted"===r.status?_:"dirty"===r.status?(i.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(r,i){return new ZodPipeline({in:r,out:i,typeName:z.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(r){const i=this._def.innerType._parse(r),freeze=r=>(isValid(r)&&(r.value=Object.freeze(r.value)),r);return isAsync(i)?i.then((r=>freeze(r))):freeze(i)}unwrap(){return this._def.innerType}}function custom(r,i={},s){return r?ZodAny.create().superRefine(((a,h)=>{var f,_;if(!r(a)){const r="function"==typeof i?i(a):"string"==typeof i?{message:i}:i,v=null===(_=null!==(f=r.fatal)&&void 0!==f?f:s)||void 0===_||_,b="string"==typeof r?{message:r}:r;h.addIssue({code:"custom",...b,fatal:v})}})):ZodAny.create()}ZodReadonly.create=(r,i)=>new ZodReadonly({innerType:r,typeName:z.ZodReadonly,...processCreateParams(i)});const U={object:ZodObject.lazycreate};var z,W;(W=z||(z={})).ZodString="ZodString",W.ZodNumber="ZodNumber",W.ZodNaN="ZodNaN",W.ZodBigInt="ZodBigInt",W.ZodBoolean="ZodBoolean",W.ZodDate="ZodDate",W.ZodSymbol="ZodSymbol",W.ZodUndefined="ZodUndefined",W.ZodNull="ZodNull",W.ZodAny="ZodAny",W.ZodUnknown="ZodUnknown",W.ZodNever="ZodNever",W.ZodVoid="ZodVoid",W.ZodArray="ZodArray",W.ZodObject="ZodObject",W.ZodUnion="ZodUnion",W.ZodDiscriminatedUnion="ZodDiscriminatedUnion",W.ZodIntersection="ZodIntersection",W.ZodTuple="ZodTuple",W.ZodRecord="ZodRecord",W.ZodMap="ZodMap",W.ZodSet="ZodSet",W.ZodFunction="ZodFunction",W.ZodLazy="ZodLazy",W.ZodLiteral="ZodLiteral",W.ZodEnum="ZodEnum",W.ZodEffects="ZodEffects",W.ZodNativeEnum="ZodNativeEnum",W.ZodOptional="ZodOptional",W.ZodNullable="ZodNullable",W.ZodDefault="ZodDefault",W.ZodCatch="ZodCatch",W.ZodPromise="ZodPromise",W.ZodBranded="ZodBranded",W.ZodPipeline="ZodPipeline",W.ZodReadonly="ZodReadonly";const K=ZodString.create,H=ZodNumber.create,G=ZodNaN.create,Y=ZodBigInt.create,J=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,Ee=ZodEffects.createWithPreprocess,xe=ZodPipeline.create,Ce={string:r=>ZodString.create({...r,coerce:!0}),number:r=>ZodNumber.create({...r,coerce:!0}),boolean:r=>ZodBoolean.create({...r,coerce:!0}),bigint:r=>ZodBigInt.create({...r,coerce:!0}),date:r=>ZodDate.create({...r,coerce:!0})},Te=_;var Oe=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:function setErrorMap(r){f=r},getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:[],addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:_,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return r},get objectUtil(){return s},ZodParsedType:a,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 z},coerce:Ce,any:re,array:se,bigint:Y,boolean:J,date:X,discriminatedUnion:ue,effect:ke,enum:ve,function:ge,instanceof:(r,i={message:`Input not instance of ${r.name}`})=>custom((i=>i instanceof r),i),intersection:le,lazy:_e,literal:ye,map:fe,nan:G,nativeEnum:be,never:ie,null:te,nullable:Ie,number:H,object:ae,oboolean:()=>J().optional(),onumber:()=>H().optional(),optional:we,ostring:()=>K().optional(),pipeline:xe,preprocess:Ee,promise:Se,record:he,set:me,strictObject:ce,string:K,symbol:Q,transformer:ke,tuple:pe,undefined:ee,union:de,unknown:ne,void:oe,NEVER:Te,ZodIssueCode:h,quotelessJson:r=>JSON.stringify(r,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");function __awaiter$1(r,i,s,a){return new(s||(s=Promise))((function(h,f){function fulfilled(r){try{step(a.next(r))}catch(i){f(i)}}function rejected(r){try{step(a.throw(r))}catch(i){f(i)}}function step(r){r.done?h(r.value):function adopt(r){return r instanceof s?r:new s((function(i){i(r)}))}(r.value).then(fulfilled,rejected)}step((a=a.apply(r,i||[])).next())}))}function n$2(r){let i="";for(let s=0;s<r.length;++s)if(s>0){const a=r[s].toLowerCase();a!==r[s]?i+=` ${a}`:i+=r[s]}else i+=r[s].toUpperCase();return i}"function"==typeof SuppressedError&&SuppressedError;const 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",$e="Handle on demand agent data error",Ue=n$2("WrongRegion"),Be=n$2("SubscriptionNotActive"),ze=n$2("UnsupportedVersion"),Ve=n$2("InstallationMethodRestricted"),We=n$2("HostnameRestricted"),Ke=n$2("IntegrationFailed"),He=n$2("NetworkRestricted"),Ge=n$2("InvalidProxyIntegrationSecret"),Ye=n$2("InvalidProxyIntegrationHeaders"),Je=n$2("ProxyIntegrationSecretEnvironmentMismatch"),Xe="API key required",Qe="API key not found",et="API key expired",tt="Request cannot be parsed",rt="Request failed",nt="Request failed to process",it="Too many requests, rate limit exceeded",ot="Not available for this origin",st="Not available with restricted header",at=Xe,ct=Qe,dt=et;const ut="Failed to load the JS script of the agent",lt="9319";const pt="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",ht=pt;function B(r){var i,s;const{picked:a,rest:h}=function(r,i){const s={},a={};for(const[h,f]of Object.entries(r))i.includes(h)?s[h]=f:a[h]=f;return{picked:s,rest:a}}(r,["scriptUrlPattern","token","apiKey"]),f=a.token,_=null!==(i=a.apiKey)&&void 0!==i?i:f,v=null!==(s=function e(r,i){return s=r,a=i,Object.prototype.hasOwnProperty.call(s,a)?r[i]:void 0;var s,a}(r,"scriptUrlPattern"))&&void 0!==s?s:pt,[b,S]=function(){const r=[],t3=()=>{r.push({time:new Date,state:document.visibilityState})},i=(s=document,a="visibilitychange",h=t3,s.addEventListener(a,h,f),()=>s.removeEventListener(a,h,f));var s,a,h,f;return t3(),[r,i]}();return Promise.resolve().then((()=>{if(!_||"string"!=typeof _)throw new Error(Xe);var r,i;return function V(r,i){const s=[],[a,h]=function(r){const i=function(r){const i=[...r];return{current:()=>i[0],postpone(){const r=i.shift();void 0!==r&&i.push(r)},exclude(){i.shift()}}}(r),s=function(){let r=0;return()=>Math.random()*Math.min(3e3,100*Math.pow(2,r++))}(),a=new Set;return[i.current(),(r,h)=>{let f;const _=h instanceof Error?h.message:"";if(_===Fe||_===qe)i.exclude(),f=0;else if(_===lt)i.exclude();else if(_===ut){const s=Date.now()-r.getTime()<50,h=i.current();h&&s&&!a.has(h)&&(a.add(h),f=0),i.postpone()}else i.postpone();const v=i.current();return void 0===v?void 0:[v,null!=f?f:r.getTime()+s()-Date.now()]}]}(r);let f;if(void 0===a)return Promise.reject(new TypeError("The list of script URL patterns is empty"));const R2=r=>{const a=new Date,s2=i=>s.push({url:r,startedAt:a,finishedAt:new Date,error:i}),_=i(r);return _.then((()=>s2()),s2),_.catch((r=>{if(null!=f||(f=r),s.length>=5)throw f;const i=h(a,r);if(!i)throw f;const[_,v]=i;return(b=v,new Promise((r=>setTimeout(r,b)))).then((()=>R2(_)));var b}))};return R2(a).then((r=>[r,s]))}((r=v,i=_,(Array.isArray(r)?r:[r]).map((r=>function(r,i){const s=encodeURIComponent;return r.replace(/<[^<>]+>/g,(r=>"<version>"===r?"3":"<apiKey>"===r?s(i):"<loaderVersion>"===r?s("3.12.6"):r))}(String(r),i)))),F)})).catch((r=>{throw S(),(i=r)instanceof Error&&i.message===lt?new Error(ut):i;var i})).then((([r,i])=>(S(),r.load({...h,ldi:{attempts:i,visibilityStates:b}}))))}function F(r){return function t$3(r,i,s,a){const h=document,f="securitypolicyviolation";let _;const s2=i=>{const s=new URL(r,location.href),{blockedURI:a}=i;a!==s.href&&a!==s.protocol.slice(0,-1)&&a!==s.origin||(_=i,a2())};h.addEventListener(f,s2);const a2=()=>h.removeEventListener(f,s2);return Promise.resolve().then(i).then((r=>(a2(),r)),(r=>new Promise((r=>{const i=new MessageChannel;i.port1.onmessage=()=>r(),i.port2.postMessage(null)})).then((()=>{if(a2(),_)return s(_);throw r}))))}(r,(()=>{return i=r,new Promise(((r,s)=>{if(function(r){if(URL.prototype)try{return new URL(r,location.href),!1}catch(i){if(i instanceof Error&&"TypeError"===i.name)return!0;throw i}}(i))throw new Error(qe);const a=document.createElement("script"),o2=()=>{var r;return null===(r=a.parentNode)||void 0===r?void 0:r.removeChild(a)},h=document.head||document.getElementsByTagName("head")[0];a.onload=()=>{o2(),r()},a.onerror=()=>{o2(),s(new Error(ut))},a.async=!0,a.src=i,h.appendChild(a)}));var i}),(()=>{throw new Error(Fe)})).then(x)}function x(){const r=window,i="__fpjs_p_l_b",s=r[i];if(function(r,i){var s;const a=null===(s=Object.getOwnPropertyDescriptor)||void 0===s?void 0:s.call(Object,r,i);(null==a?void 0:a.configurable)?delete r[i]:a&&!a.writable||(r[i]=void 0)}(r,i),"function"!=typeof(null==s?void 0:s.load))throw new Error(lt);return s}var ft={load:B,defaultScriptUrlPattern:ht,ERROR_SCRIPT_LOAD_FAIL:ut,ERROR_API_KEY_EXPIRED:et,ERROR_API_KEY_INVALID:Qe,ERROR_API_KEY_MISSING:Xe,ERROR_BAD_REQUEST_FORMAT:tt,ERROR_BAD_RESPONSE_FORMAT:je,ERROR_CLIENT_TIMEOUT:Ze,ERROR_CSP_BLOCK:Fe,ERROR_FORBIDDEN_ENDPOINT:We,ERROR_FORBIDDEN_HEADER:st,ERROR_FORBIDDEN_ORIGIN:ot,ERROR_GENERAL_SERVER_FAILURE:rt,ERROR_HANDLE_AGENT_DATA:$e,ERROR_INSTALLATION_METHOD_RESTRICTED:Ve,ERROR_INTEGRATION_FAILURE:Ke,ERROR_INVALID_ENDPOINT:qe,ERROR_INVALID_PROXY_INTEGRATION_HEADERS:Ye,ERROR_INVALID_PROXY_INTEGRATION_SECRET:Ge,ERROR_NETWORK_ABORT:Le,ERROR_NETWORK_CONNECTION:Ae,ERROR_NETWORK_RESTRICTED:He,ERROR_PROXY_INTEGRATION_SECRET_ENVIRONMENT_MISMATCH:Je,ERROR_RATE_LIMIT:it,ERROR_SERVER_TIMEOUT:nt,ERROR_SUBSCRIPTION_NOT_ACTIVE:Be,ERROR_TOKEN_EXPIRED:dt,ERROR_TOKEN_INVALID:ct,ERROR_TOKEN_MISSING:at,ERROR_UNSUPPORTED_VERSION:ze,ERROR_WRONG_REGION:Ue,defaultEndpoint:Pe,defaultTlsEndpoint:De};const mt=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:et,ERROR_API_KEY_INVALID:Qe,ERROR_API_KEY_MISSING:Xe,ERROR_BAD_REQUEST_FORMAT:tt,ERROR_BAD_RESPONSE_FORMAT:je,ERROR_CLIENT_TIMEOUT:Ze,ERROR_CSP_BLOCK:Fe,ERROR_FORBIDDEN_ENDPOINT:We,ERROR_FORBIDDEN_HEADER:st,ERROR_FORBIDDEN_ORIGIN:ot,ERROR_GENERAL_SERVER_FAILURE:rt,ERROR_HANDLE_AGENT_DATA:$e,ERROR_INSTALLATION_METHOD_RESTRICTED:Ve,ERROR_INTEGRATION_FAILURE:Ke,ERROR_INVALID_ENDPOINT:qe,ERROR_INVALID_PROXY_INTEGRATION_HEADERS:Ye,ERROR_INVALID_PROXY_INTEGRATION_SECRET:Ge,ERROR_NETWORK_ABORT:Le,ERROR_NETWORK_CONNECTION:Ae,ERROR_NETWORK_RESTRICTED:He,ERROR_PROXY_INTEGRATION_SECRET_ENVIRONMENT_MISMATCH:Je,ERROR_RATE_LIMIT:it,ERROR_SCRIPT_LOAD_FAIL:ut,ERROR_SERVER_TIMEOUT:nt,ERROR_SUBSCRIPTION_NOT_ACTIVE:Be,ERROR_TOKEN_EXPIRED:dt,ERROR_TOKEN_INVALID:ct,ERROR_TOKEN_MISSING:at,ERROR_UNSUPPORTED_VERSION:ze,ERROR_WRONG_REGION:Ue,default:ft,defaultEndpoint:Pe,defaultScriptUrlPattern:ht,defaultTlsEndpoint:De,load:B},Symbol.toStringTag,{value:"Module"})),gt="@fpjs@client@",DEFAULT_NOW_PROVIDER=()=>Date.now();class CacheKey{constructor(r){var i;this.tag=r.tag||null,this.linkedId=r.linkedId||null,this.extendedResult=null!==(i=r.extendedResult)&&void 0!==i&&i}toKey(){return`${JSON.stringify(this.tag)}__${JSON.stringify(this.linkedId)}__${this.extendedResult}`}}function getKeyWithPrefix(r,i){return`${i}__${r}`}function removePrefixFromKey(r,i){return r.replace(`${i}__`,"")}class LocalStorageCache{constructor(r=gt){this.prefix=r}set(r,i){window.localStorage.setItem(getKeyWithPrefix(r,this.prefix),JSON.stringify(i))}get(r){const i=window.localStorage.getItem(getKeyWithPrefix(r,this.prefix));if(i)try{return JSON.parse(i)}catch(s){return}}remove(r){window.localStorage.removeItem(getKeyWithPrefix(r,this.prefix))}allKeys(){return Object.keys(window.localStorage).filter((r=>r.startsWith(this.prefix))).map((r=>removePrefixFromKey(r,this.prefix)))}}class SessionStorageCache{constructor(r=gt){this.prefix=r}set(r,i){window.sessionStorage.setItem(getKeyWithPrefix(r,this.prefix),JSON.stringify(i))}get(r){const i=window.sessionStorage.getItem(getKeyWithPrefix(r,this.prefix));if(i)try{return JSON.parse(i)}catch(s){return}}remove(r){window.sessionStorage.removeItem(getKeyWithPrefix(r,this.prefix))}allKeys(){return Object.keys(window.sessionStorage).filter((r=>r.startsWith(this.prefix))).map((r=>removePrefixFromKey(r,this.prefix)))}}class CacheManager{constructor(r,i=3600,s){this.cache=r,this.cacheTime=i,this.nowProvider=s||DEFAULT_NOW_PROVIDER}get(r){return __awaiter$1(this,void 0,void 0,(function*(){const i=yield this.cache.get(r.toKey());if(!i)return;const s=yield this.nowProvider(),a=Math.floor(s/1e3);if(!(i.expiresAt<a))return i.body;yield this.cache.remove(r.toKey())}))}set(r,i){return __awaiter$1(this,void 0,void 0,(function*(){const s=yield this.wrapCacheEntry(i);yield this.cache.set(r.toKey(),s)}))}clearCache(){return __awaiter$1(this,void 0,void 0,(function*(){const r=yield this.cache.allKeys();yield Promise.all(r.map((r=>this.cache.remove(r))))}))}wrapCacheEntry(r){return __awaiter$1(this,void 0,void 0,(function*(){const i=yield this.nowProvider(),s=Math.floor(i/1e3)+this.cacheTime;return{body:r,expiresAt:s}}))}}class InMemoryCache{constructor(){this.enclosedCache=function(){const r={};return{set(i,s){r[i]=s},get(i){const s=r[i];if(s)return s},remove(i){delete r[i]},allKeys:()=>Object.keys(r)}}()}}class CacheStub{set(){}get(){}remove(){}allKeys(){return[]}}var _t,yt;(yt=_t||(_t={})).Memory="memory",yt.LocalStorage="localstorage",yt.SessionStorage="sessionstorage",yt.NoCache="nocache";const vt={[_t.Memory]:()=>(new InMemoryCache).enclosedCache,[_t.LocalStorage]:r=>new LocalStorageCache(r),[_t.SessionStorage]:r=>new SessionStorageCache(r),[_t.NoCache]:()=>new CacheStub},cacheFactory=r=>vt[r];class FpjsClient{constructor(r){var i;let s;if(this.inFlightRequests=new Map,this.agentPromise=null,this.customAgent=null==r?void 0:r.customAgent,this.agent={collect:()=>{throw new Error("FPJSAgent hasn't loaded yet. Make sure to call the init() method first.")},get:()=>{throw new Error("FPJSAgent hasn't loaded yet. Make sure to call the init() method first.")}},this.loadOptions=null==r?void 0:r.loadOptions,(null==r?void 0:r.cache)&&(null==r?void 0:r.cacheLocation)&&console.warn("Both `cache` and `cacheLocation` options have been specified in the FpjsClient configuration; ignoring `cacheLocation` and using `cache`."),null==r?void 0:r.cache)s=r.cache;else{if(this.cacheLocation=(null==r?void 0:r.cacheLocation)||_t.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(r=>{switch(r){case _t.SessionStorage:try{window.sessionStorage.getItem("item")}catch(i){return!1}return!0;case _t.LocalStorage:try{window.localStorage.getItem("item")}catch(i){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=_t.Memory),s=cacheFactory(this.cacheLocation)(null==r?void 0:r.cachePrefix)}if((null==r?void 0:r.cacheTimeInSeconds)&&r.cacheTimeInSeconds>86400)throw new Error("Cache time cannot exceed 86400 seconds (24 hours)");const a=null!==(i=null==r?void 0:r.cacheTimeInSeconds)&&void 0!==i?i:3600;this.cacheManager=new CacheManager(s,a)}init(r){return __awaiter$1(this,void 0,void 0,(function*(){var i,s,a;if(!this.loadOptions&&!r)throw new TypeError("No load options provided");const h=!0===(null===(i=this.loadOptions)||void 0===i?void 0:i.silent)?[]:[...(null===(s=this.loadOptions)||void 0===s?void 0:s.integrationInfo)||[],...(null==r?void 0:r.integrationInfo)||[],"spa-sdk/1.3.3"],f=Object.assign(Object.assign(Object.assign({},this.loadOptions),r),{integrationInfo:h});if(!this.agentPromise){const r=null!==(a=this.customAgent)&&void 0!==a?a:mt;this.agentPromise=r.load(f).then((r=>(this.agent=r,r))).catch((r=>{throw this.agentPromise=null,r}))}return this.agentPromise}))}getVisitorData(){return __awaiter$1(this,arguments,void 0,(function*(r={},i=!1){const s=FpjsClient.makeCacheKey(r).toKey();if(!this.inFlightRequests.has(s)){const a=this._identify(r,i).finally((()=>{this.inFlightRequests.delete(s)}));this.inFlightRequests.set(s,a)}return yield this.inFlightRequests.get(s)}))}getVisitorDataFromCache(){return __awaiter$1(this,arguments,void 0,(function*(r={}){const i=FpjsClient.makeCacheKey(r),s=yield this.cacheManager.get(i);return s?Object.assign(Object.assign({},s),{cacheHit:!0}):void 0}))}isInCache(){return __awaiter$1(this,arguments,void 0,(function*(r={}){return Boolean(yield this.getVisitorDataFromCache(r))}))}clearCache(){return __awaiter$1(this,void 0,void 0,(function*(){yield this.cacheManager.clearCache()}))}static makeCacheKey(r){return new CacheKey(r)}_identify(r){return __awaiter$1(this,arguments,void 0,(function*(r,i=!1){const s=FpjsClient.makeCacheKey(r);if(!i){const r=yield this.cacheManager.get(s);if(r)return Object.assign(Object.assign({},r),{cacheHit:!0})}const a=yield this.agent.get(r);return yield this.cacheManager.set(s,a),Object.assign(Object.assign({},a),{cacheHit:!1})}))}}const bt="default_fingerprint_cache",St=7,kt="apiKey=<apiKey>&version=<version>&loaderVersion=<loaderVersion>",getExpirationDate=r=>new Date((new Date).getTime()+24*r*60*60*1e3).getTime(),getCachedFingerprint=()=>{const{cacheName:r=bt}=window.fingerprintConfig;try{const i=JSON.parse(localStorage.getItem(r)||"null");return i&&i.expiresAt>Date.now()?i.fingerprint:(localStorage.removeItem(r),null)}catch{return null}};function isFingerprintReady(){return void 0!==window.fpClient}const wt={initFingerprint:async function initFingerprint(r,i){const s=[Pe],a=[ht];i&&(s.unshift(i),a.unshift(function buildProxyUrl(r){return`${r}?${kt}`}(i))),window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:r,endpoint:s,scriptUrlPattern:a}});try{await window.fpClient.init()}catch(Dr){throw console.error("Error initializing identification service:",Dr),Dr}},getFingerprint:async function getFingerprint(r=!1){if(!window.fingerprintConfig)throw new Error("Fingerprint configuration is not initialized.");const i=getCachedFingerprint();if(i)return i;if(r)return"";if(!isFingerprintReady())throw new Error("Identification service is not initialized.");try{const r=window.fpClient,{visitorId:i}=await r.getVisitorData();return(r=>{const{cacheName:i=bt,cacheTimeInDays:s=St}=window.fingerprintConfig,a={fingerprint:r,expiresAt:getExpirationDate(s)};localStorage.setItem(i,JSON.stringify(a))})(i),i}catch(Dr){throw console.error("Error retrieving fingerprint:",Dr),Dr}},isFingerprintReady:isFingerprintReady,getCachedFingerprint:getCachedFingerprint},It={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:""}},Et="sandbox",xt={env:Et,headers:{},searchUrl:It[Et].search,purchaseUrl:It[Et].purchase,coreUrl:It[Et].core,version:"v2",coreVersion:"v1",apiKey:void 0,userAuthToken:void 0,withCredentials:!1};let Ct=Object.assign({},xt);const Tt={1:{code:200,message:"Operación no autorizada"}},Ot={3:{code:300,message:"Parámetros incorrectos"},7:{code:301,message:"Fecha inválida"}},Rt={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=r=>({11:{code:500,message:r},12:{code:501,message:r}}),Mt={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=r=>({30:{code:30,message:r}}),Nt={50:{code:50,message:"Unknow Error"}},i$2=r=>({...Tt,...Ot,...Rt,...n(r),...Mt,...Nt,...c$1(r)});class o extends Error{constructor(r=-100,i="Unknown error",s=null){super(i),this.code=r,this.details=s,this.stack=(new Error).stack}}async function w(r){const i=await r.json();if(r.ok)return i;if(![404,422,500].includes(r.status))throw new o(r.status,i.message||r.statusText,i);switch(r.status){case 404:throw new o(100,"Not found");case 422:return i;case 500:throw new o(101,"Server error");default:throw new o}}function l$1(r){if(r.errors instanceof Array){const{code:i=-100,message:s="Unknown error"}=r.errors[0]||{},a=i$2(s)[i];throw a?new o(a.code,a.message,r.errors[0]):new o(i,s,r.errors[0])}return r}function c(r,i={},s={},a){const{apiKey:h,withCredentials:f,userAuthToken:_,headers:v}=Ct,b={Accept:"application/json",Authorization:`Token token=${s.apiKey||h}`,"Content-Type":"application/json"};return _&&(b.Authorization=`Token ${s.apiKey||h}, Bearer ${_}`),i.headers=function y(...r){const i=Object.keys(Object.assign({},...r)).reduce(((i,s)=>({...i,[s]:r.map((r=>s in r&&r[s])).filter(Boolean)})),{});return new Headers(i)}(v,b),i.credentials=f?"include":"omit","string"!=typeof i.body&&(i.body=JSON.stringify(i.body)),fetch(r,i).then(w).then(l$1).catch(a)}let Pt=class u{constructor({url:r,watch:i,expect:s,maxRetries:a=30,interval:h=2e3,eachCall:f=null}){this.url=r,this.watch=i,this.expect=s instanceof Array?s:[s],this.interval=h,this.maxRetries=a,this.eachCall=f&&f.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(r){return function E(r,i={},s){return c(r,i,{},s)}(this.url,{},(r=>this.executeEachCall("error",r))).then((i=>{if(this.expect.includes(i[this.watch])||1===r||this.aborted){let s=i[this.watch];1===r?s="retries_exceeded":this.aborted&&(s="aborted"),this.timers.forEach(clearInterval),this.executeEachCall(s,i)}else if("failed"===i[this.watch])this.timers.forEach(clearInterval),this.executeEachCall("failed",i);else{this.executeEachCall("pending",i);const s=window.setTimeout(this.execute,this.interval,r-1);this.timers.push(s)}}))}executeEachCall(r,i){this.eachCall instanceof Function&&this.eachCall({status:r,payload:i})&&this.abort()}};const Dt=function j({apiName:r,defaultApiVersion:i}){let s,a,h={"Content-Type":"application/json"};function d2(){if(!s)throw new Error(`Base URL is not set for ${r} API.`)}const f={body:{}};return{get:async function w2(r,a={}){d2();const{headers:h={},apiVersion:f=i}=a,_=`${s}/${f}/${r}`;return(await fetch(_,{headers:h})).json()},post:async function y2(r,_=f){d2();const{body:v,headers:b={},apiVersion:S=i}=_,k=`${s}/${S}/${r}`,I={...h,...b,...a?{Authorization:a}:{}};return(await fetch(k,{method:"POST",body:JSON.stringify(v),headers:I})).json()},delete:async function b2(r,f={}){d2();const{headers:_={},apiVersion:v=i}=f,b=`${s}/${v}/${r}`,S={...h,..._,...a?{Authorization:a}:{}};return(await fetch(b,{method:"DELETE",headers:S})).json()},setAuthorizationHeader:function p2(r){a=r},setConfig:function f2(r){s=r.baseUrl,h={...h,...r.defaultHeaders||{}}},poll:function H2(r,a){const h={url:`${s}/${i}/${r}`,watch:a.watch,expect:a.expect,eachCall:a.onEachResponse};return new Pt(h)}}}({apiName:"Core",defaultApiVersion:"v1"});const Zt={createAnonymousProfile:async function t(r){const{data:i}=await Dt.post("anonymous_profiles/identify",{body:r});return i}};const At={getRecommendedTrips:function d({searchId:r,userIdentifier:i}){return Dt.get(`trip_recommendations/${r}/${i}`)},createRecommendedPlaces:async function m(r){return Dt.post("profiles",{body:r})},pollRecommendedPlaces:function u(r,i){const{start:s,onEachResponse:a}=i,h=`profiles/${r}`,f={watch:"state",expect:"finished",onEachResponse:a},_=Dt.poll(h,f);return s&&_.start(),_},createRecommendedSeats:function i$1(r){return Dt.post("seat_recommendations",{body:r})},getRecommendedSeats:function p({distinct_id:r,...i}){return Dt.post(`seat_recommendations/${r}`,{body:i})},getFrequentPassengers:async function f$1(r){return Dt.get(`passengers/${r}`)},createFrequentPassengers:async function l(r){return Dt.post("passengers",{body:r})},deleteFrequentPassenger:async function g(r,i){return Dt.delete(`passengers/${r}/${i}`)}},Lt={setConfig:Dt.setConfig,recommendations:At,profiles:Zt};let jt;const Ft=window.location.origin,qt={sandbox:{baseUrl:"https://datalake-api-dev.reservamossaas.com/api",defaultHeaders:{Origin:Ft,Authorization:"Bearer 753bf0710dc920a84236d42241d4f487"}},prod:{baseUrl:"https://data-lake.reservamossaas.com/api",defaultHeaders:{Origin:Ft,Authorization:"Bearer 753bf0710dc920a84236d42241d4f487"}}};const $t={setEnvironment:function setEnvironment(r){jt=r},getCoreAPIConfig:function getCoreAPIConfig(){if(!jt)throw new Error("Unable to get core API config, environment not set. Use configService.setEnvironment(environment) to set the environment.");return qt[jt]}};var Ut,Bt;function isShadowRoot(r){const i=null==r?void 0:r.host;return Boolean((null==i?void 0:i.shadowRoot)===r)}function isNativeShadowDom(r){return"[object ShadowRoot]"===Object.prototype.toString.call(r)}function stringifyStylesheet(r){try{const i=r.rules||r.cssRules;return i?function fixBrowserCompatibilityIssuesInCSS(r){return r.includes(" background-clip: text;")&&!r.includes(" -webkit-background-clip: text;")&&(r=r.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),r}(Array.from(i,stringifyRule).join("")):null}catch(Dr){return null}}function stringifyRule(r){let i;if(function isCSSImportRule(r){return"styleSheet"in r}(r))try{i=stringifyStylesheet(r.styleSheet)||function escapeImportStatement(r){const{cssText:i}=r;if(i.split('"').length<3)return i;const s=["@import",`url(${JSON.stringify(r.href)})`];return""===r.layerName?s.push("layer"):r.layerName&&s.push(`layer(${r.layerName})`),r.supportsText&&s.push(`supports(${r.supportsText})`),r.media.length&&s.push(r.media.mediaText),s.join(" ")+";"}(r)}catch(Dr){}else if(function isCSSStyleRule(r){return"selectorText"in r}(r)&&r.selectorText.includes(":"))return function fixSafariColons(r){const i=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return r.replace(i,"$1\\$2")}(r.cssText);return i||r.cssText}(Bt=Ut||(Ut={}))[Bt.Document=0]="Document",Bt[Bt.DocumentType=1]="DocumentType",Bt[Bt.Element=2]="Element",Bt[Bt.Text=3]="Text",Bt[Bt.CDATA=4]="CDATA",Bt[Bt.Comment=5]="Comment";class Mirror{constructor(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}getId(r){var i;if(!r)return-1;const s=null===(i=this.getMeta(r))||void 0===i?void 0:i.id;return null!=s?s:-1}getNode(r){return this.idNodeMap.get(r)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(r){return this.nodeMetaMap.get(r)||null}removeNodeFromMap(r){const i=this.getId(r);this.idNodeMap.delete(i),r.childNodes&&r.childNodes.forEach((r=>this.removeNodeFromMap(r)))}has(r){return this.idNodeMap.has(r)}hasNode(r){return this.nodeMetaMap.has(r)}add(r,i){const s=i.id;this.idNodeMap.set(s,r),this.nodeMetaMap.set(r,i)}replace(r,i){const s=this.getNode(r);if(s){const r=this.nodeMetaMap.get(s);r&&this.nodeMetaMap.set(i,r)}this.idNodeMap.set(r,i)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function maskInputValue({element:r,maskInputOptions:i,tagName:s,type:a,value:h,maskInputFn:f}){let _=h||"";const v=a&&toLowerCase(a);return(i[s.toLowerCase()]||v&&i[v])&&(_=f?f(_,r):"*".repeat(_.length)),_}function toLowerCase(r){return r.toLowerCase()}const zt="__rrweb_original__";function getInputType(r){const i=r.type;return r.hasAttribute("data-rr-is-password")?"password":i?toLowerCase(i):null}function extractFileExtension(r,i){var s;let a;try{a=new URL(r,null!=i?i:window.location.href)}catch(f){return null}const h=a.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(s=null==h?void 0:h[1])&&void 0!==s?s:null}let Vt=1;const Wt=new RegExp("[^a-z0-9-_:]"),Kt=-2;function genId(){return Vt++}let Ht,Gt;const Yt=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Jt=/^(?:[a-z+]+:)?\/\//i,Xt=/^www\..*/i,Qt=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(r,i){return(r||"").replace(Yt,((r,s,a,h,f,_)=>{const v=a||f||_,b=s||h||"";if(!v)return r;if(Jt.test(v)||Xt.test(v))return`url(${b}${v}${b})`;if(Qt.test(v))return`url(${b}${v}${b})`;if("/"===v[0])return`url(${b}${function extractOrigin(r){let i="";return i=r.indexOf("//")>-1?r.split("/").slice(0,3).join("/"):r.split("/")[0],i=i.split("?")[0],i}(i)+v}${b})`;const S=i.split("/"),k=v.split("/");S.pop();for(const i of k)"."!==i&&(".."===i?S.pop():S.push(i));return`url(${b}${S.join("/")}${b})`}))}const er=/^[^ \t\n\r\u000c]+/,tr=/^[, \t\n\r\u000c]+/;function absoluteToDoc(r,i){if(!i||""===i.trim())return i;const s=r.createElement("a");return s.href=i,s.href}function isSVGElement(r){return Boolean("svg"===r.tagName||r.ownerSVGElement)}function getHref(){const r=document.createElement("a");return r.href="",r.href}function transformAttribute(r,i,s,a){return a?"src"===s||"href"===s&&("use"!==i||"#"!==a[0])||"xlink:href"===s&&"#"!==a[0]?absoluteToDoc(r,a):"background"!==s||"table"!==i&&"td"!==i&&"th"!==i?"srcset"===s?function getAbsoluteSrcsetString(r,i){if(""===i.trim())return i;let s=0;function collectCharacters(r){let a;const h=r.exec(i.substring(s));return h?(a=h[0],s+=a.length,a):""}const a=[];for(;collectCharacters(tr),!(s>=i.length);){let h=collectCharacters(er);if(","===h.slice(-1))h=absoluteToDoc(r,h.substring(0,h.length-1)),a.push(h);else{let f="";h=absoluteToDoc(r,h);let _=!1;for(;;){const r=i.charAt(s);if(""===r){a.push((h+f).trim());break}if(_)")"===r&&(_=!1);else{if(","===r){s+=1,a.push((h+f).trim());break}"("===r&&(_=!0)}f+=r,s+=1}}}return a.join(", ")}(r,a):"style"===s?absoluteToStylesheet(a,getHref()):"object"===i&&"data"===s?absoluteToDoc(r,a):a:absoluteToDoc(r,a):a}function ignoreAttribute(r,i,s){return("video"===r||"audio"===r)&&"autoplay"===i}function classMatchesRegex(r,i,s){if(!r)return!1;if(r.nodeType!==r.ELEMENT_NODE)return!!s&&classMatchesRegex(r.parentNode,i,s);for(let a=r.classList.length;a--;){const s=r.classList[a];if(i.test(s))return!0}return!!s&&classMatchesRegex(r.parentNode,i,s)}function needMaskingText(r,i,s,a){try{const h=r.nodeType===r.ELEMENT_NODE?r:r.parentElement;if(null===h)return!1;if("string"==typeof i){if(a){if(h.closest(`.${i}`))return!0}else if(h.classList.contains(i))return!0}else if(classMatchesRegex(h,i,a))return!0;if(s)if(a){if(h.closest(s))return!0}else if(h.matches(s))return!0}catch(h){}return!1}function serializeNode(r,i){const{doc:s,mirror:a,blockClass:h,blockSelector:f,needsMask:_,inlineStylesheet:v,maskInputOptions:b={},maskTextFn:S,maskInputFn:k,dataURLOptions:I={},inlineImages:C,recordCanvas:T,keepIframeSrcFn:O,newlyAddedElement:R=!1}=i,M=function getRootId(r,i){if(!i.hasNode(r))return;const s=i.getId(r);return 1===s?void 0:s}(s,a);switch(r.nodeType){case r.DOCUMENT_NODE:return"CSS1Compat"!==r.compatMode?{type:Ut.Document,childNodes:[],compatMode:r.compatMode}:{type:Ut.Document,childNodes:[]};case r.DOCUMENT_TYPE_NODE:return{type:Ut.DocumentType,name:r.name,publicId:r.publicId,systemId:r.systemId,rootId:M};case r.ELEMENT_NODE:return function serializeElementNode(r,i){const{doc:s,blockClass:a,blockSelector:h,inlineStylesheet:f,maskInputOptions:_={},maskInputFn:v,dataURLOptions:b={},inlineImages:S,recordCanvas:k,keepIframeSrcFn:I,newlyAddedElement:C=!1,rootId:T}=i,O=function _isBlockedElement(r,i,s){try{if("string"==typeof i){if(r.classList.contains(i))return!0}else for(let s=r.classList.length;s--;){const a=r.classList[s];if(i.test(a))return!0}if(s)return r.matches(s)}catch(a){}return!1}(r,a,h),R=function getValidTagName(r){if(r instanceof HTMLFormElement)return"form";const i=toLowerCase(r.tagName);return Wt.test(i)?"div":i}(r);let M={};const N=r.attributes.length;for(let Z=0;Z<N;Z++){const i=r.attributes[Z];ignoreAttribute(R,i.name,i.value)||(M[i.name]=transformAttribute(s,R,toLowerCase(i.name),i.value))}if("link"===R&&f){const i=Array.from(s.styleSheets).find((i=>i.href===r.href));let a=null;i&&(a=stringifyStylesheet(i)),a&&(delete M.rel,delete M.href,M._cssText=absoluteToStylesheet(a,i.href))}if("style"===R&&r.sheet&&!(r.innerText||r.textContent||"").trim().length){const i=stringifyStylesheet(r.sheet);i&&(M._cssText=absoluteToStylesheet(i,getHref()))}if("input"===R||"textarea"===R||"select"===R){const i=r.value,s=r.checked;"radio"!==M.type&&"checkbox"!==M.type&&"submit"!==M.type&&"button"!==M.type&&i?M.value=maskInputValue({element:r,type:getInputType(r),tagName:R,value:i,maskInputOptions:_,maskInputFn:v}):s&&(M.checked=s)}"option"===R&&(r.selected&&!_.select?M.selected=!0:delete M.selected);if("canvas"===R&&k)if("2d"===r.__context)(function is2DCanvasBlank(r){const i=r.getContext("2d");if(!i)return!0;for(let s=0;s<r.width;s+=50)for(let a=0;a<r.height;a+=50){const h=i.getImageData,f=zt in h?h[zt]:h;if(new Uint32Array(f.call(i,s,a,Math.min(50,r.width-s),Math.min(50,r.height-a)).data.buffer).some((r=>0!==r)))return!1}return!0})(r)||(M.rr_dataURL=r.toDataURL(b.type,b.quality));else if(!("__context"in r)){const i=r.toDataURL(b.type,b.quality),s=document.createElement("canvas");s.width=r.width,s.height=r.height;i!==s.toDataURL(b.type,b.quality)&&(M.rr_dataURL=i)}if("img"===R&&S){Ht||(Ht=s.createElement("canvas"),Gt=Ht.getContext("2d"));const i=r,a=i.crossOrigin;i.crossOrigin="anonymous";const recordInlineImage=()=>{i.removeEventListener("load",recordInlineImage);try{Ht.width=i.naturalWidth,Ht.height=i.naturalHeight,Gt.drawImage(i,0,0),M.rr_dataURL=Ht.toDataURL(b.type,b.quality)}catch(r){console.warn(`Cannot inline img src=${i.currentSrc}! Error: ${r}`)}a?M.crossOrigin=a:i.removeAttribute("crossorigin")};i.complete&&0!==i.naturalWidth?recordInlineImage():i.addEventListener("load",recordInlineImage)}if("audio"===R||"video"===R){const i=M;i.rr_mediaState=r.paused?"paused":"played",i.rr_mediaCurrentTime=r.currentTime,i.rr_mediaPlaybackRate=r.playbackRate,i.rr_mediaMuted=r.muted,i.rr_mediaLoop=r.loop,i.rr_mediaVolume=r.volume}C||(r.scrollLeft&&(M.rr_scrollLeft=r.scrollLeft),r.scrollTop&&(M.rr_scrollTop=r.scrollTop));if(O){const{width:i,height:s}=r.getBoundingClientRect();M={class:M.class,rr_width:`${i}px`,rr_height:`${s}px`}}"iframe"!==R||I(M.src)||(r.contentDocument||(M.rr_src=M.src),delete M.src);let P;try{customElements.get(R)&&(P=!0)}catch(D){}return{type:Ut.Element,tagName:R,attributes:M,childNodes:[],isSVG:isSVGElement(r)||void 0,needBlock:O,rootId:T,isCustom:P}}(r,{doc:s,blockClass:h,blockSelector:f,inlineStylesheet:v,maskInputOptions:b,maskInputFn:k,dataURLOptions:I,inlineImages:C,recordCanvas:T,keepIframeSrcFn:O,newlyAddedElement:R,rootId:M});case r.TEXT_NODE:return function serializeTextNode(r,i){var s;const{needsMask:a,maskTextFn:h,rootId:f}=i,_=r.parentNode&&r.parentNode.tagName;let v=r.textContent;const b="STYLE"===_||void 0,S="SCRIPT"===_||void 0;if(b&&v){try{r.nextSibling||r.previousSibling||(null===(s=r.parentNode.sheet)||void 0===s?void 0:s.cssRules)&&(v=stringifyStylesheet(r.parentNode.sheet))}catch(k){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${k}`,r)}v=absoluteToStylesheet(v,getHref())}S&&(v="SCRIPT_PLACEHOLDER");!b&&!S&&v&&a&&(v=h?h(v,r.parentElement):v.replace(/[\S]/g,"*"));return{type:Ut.Text,textContent:v||"",isStyle:b,rootId:f}}(r,{needsMask:_,maskTextFn:S,rootId:M});case r.CDATA_SECTION_NODE:return{type:Ut.CDATA,textContent:"",rootId:M};case r.COMMENT_NODE:return{type:Ut.Comment,textContent:r.textContent||"",rootId:M};default:return!1}}function lowerIfExists(r){return null==r?"":r.toLowerCase()}function serializeNodeWithId(r,i){const{doc:s,mirror:a,blockClass:h,blockSelector:f,maskTextClass:_,maskTextSelector:v,skipChild:b=!1,inlineStylesheet:S=!0,maskInputOptions:k={},maskTextFn:I,maskInputFn:C,slimDOMOptions:T,dataURLOptions:O={},inlineImages:R=!1,recordCanvas:M=!1,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D=5e3,onStylesheetLoad:Z,stylesheetLoadTimeout:A=5e3,keepIframeSrcFn:L=()=>!1,newlyAddedElement:q=!1}=i;let{needsMask:$}=i,{preserveWhiteSpace:U=!0}=i;if(!$&&r.childNodes){$=needMaskingText(r,_,v,void 0===$)}const z=serializeNode(r,{doc:s,mirror:a,blockClass:h,blockSelector:f,needsMask:$,inlineStylesheet:S,maskInputOptions:k,maskTextFn:I,maskInputFn:C,dataURLOptions:O,inlineImages:R,recordCanvas:M,keepIframeSrcFn:L,newlyAddedElement:q});if(!z)return console.warn(r,"not serialized"),null;let W;W=a.hasNode(r)?a.getId(r):!function slimDOMExcluded(r,i){if(i.comment&&r.type===Ut.Comment)return!0;if(r.type===Ut.Element){if(i.script&&("script"===r.tagName||"link"===r.tagName&&("preload"===r.attributes.rel||"modulepreload"===r.attributes.rel)&&"script"===r.attributes.as||"link"===r.tagName&&"prefetch"===r.attributes.rel&&"string"==typeof r.attributes.href&&"js"===extractFileExtension(r.attributes.href)))return!0;if(i.headFavicon&&("link"===r.tagName&&"shortcut icon"===r.attributes.rel||"meta"===r.tagName&&(lowerIfExists(r.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===lowerIfExists(r.attributes.name)||"icon"===lowerIfExists(r.attributes.rel)||"apple-touch-icon"===lowerIfExists(r.attributes.rel)||"shortcut icon"===lowerIfExists(r.attributes.rel))))return!0;if("meta"===r.tagName){if(i.headMetaDescKeywords&&lowerIfExists(r.attributes.name).match(/^description|keywords$/))return!0;if(i.headMetaSocial&&(lowerIfExists(r.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(r.attributes.name).match(/^(og|twitter):/)||"pinterest"===lowerIfExists(r.attributes.name)))return!0;if(i.headMetaRobots&&("robots"===lowerIfExists(r.attributes.name)||"googlebot"===lowerIfExists(r.attributes.name)||"bingbot"===lowerIfExists(r.attributes.name)))return!0;if(i.headMetaHttpEquiv&&void 0!==r.attributes["http-equiv"])return!0;if(i.headMetaAuthorship&&("author"===lowerIfExists(r.attributes.name)||"generator"===lowerIfExists(r.attributes.name)||"framework"===lowerIfExists(r.attributes.name)||"publisher"===lowerIfExists(r.attributes.name)||"progid"===lowerIfExists(r.attributes.name)||lowerIfExists(r.attributes.property).match(/^article:/)||lowerIfExists(r.attributes.property).match(/^product:/)))return!0;if(i.headMetaVerification&&("google-site-verification"===lowerIfExists(r.attributes.name)||"yandex-verification"===lowerIfExists(r.attributes.name)||"csrf-token"===lowerIfExists(r.attributes.name)||"p:domain_verify"===lowerIfExists(r.attributes.name)||"verify-v1"===lowerIfExists(r.attributes.name)||"verification"===lowerIfExists(r.attributes.name)||"shopify-checkout-api-token"===lowerIfExists(r.attributes.name)))return!0}}return!1}(z,T)&&(U||z.type!==Ut.Text||z.isStyle||z.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():Kt;const K=Object.assign(z,{id:W});if(a.add(r,K),W===Kt)return null;N&&N(r);let H=!b;if(K.type===Ut.Element){H=H&&!K.needBlock,delete K.needBlock;const i=r.shadowRoot;i&&isNativeShadowDom(i)&&(K.isShadowHost=!0)}if((K.type===Ut.Document||K.type===Ut.Element)&&H){T.headWhitespace&&K.type===Ut.Element&&"head"===K.tagName&&(U=!1);const i={doc:s,mirror:a,blockClass:h,blockSelector:f,needsMask:$,maskTextClass:_,maskTextSelector:v,skipChild:b,inlineStylesheet:S,maskInputOptions:k,maskTextFn:I,maskInputFn:C,slimDOMOptions:T,dataURLOptions:O,inlineImages:R,recordCanvas:M,preserveWhiteSpace:U,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D,onStylesheetLoad:Z,stylesheetLoadTimeout:A,keepIframeSrcFn:L};if(K.type===Ut.Element&&"textarea"===K.tagName&&void 0!==K.attributes.value);else for(const s of Array.from(r.childNodes)){const r=serializeNodeWithId(s,i);r&&K.childNodes.push(r)}if(function isElement(r){return r.nodeType===r.ELEMENT_NODE}(r)&&r.shadowRoot)for(const s of Array.from(r.shadowRoot.childNodes)){const a=serializeNodeWithId(s,i);a&&(isNativeShadowDom(r.shadowRoot)&&(a.isShadow=!0),K.childNodes.push(a))}}return r.parentNode&&isShadowRoot(r.parentNode)&&isNativeShadowDom(r.parentNode)&&(K.isShadow=!0),K.type===Ut.Element&&"iframe"===K.tagName&&function onceIframeLoaded(r,i,s){const a=r.contentWindow;if(!a)return;let h,f=!1;try{h=a.document.readyState}catch(Dr){return}if("complete"!==h){const a=setTimeout((()=>{f||(i(),f=!0)}),s);return void r.addEventListener("load",(()=>{clearTimeout(a),f=!0,i()}))}const _="about:blank";if(a.location.href!==_||r.src===_||""===r.src)return setTimeout(i,0),r.addEventListener("load",i);r.addEventListener("load",i)}(r,(()=>{const i=r.contentDocument;if(i&&P){const s=serializeNodeWithId(i,{doc:i,mirror:a,blockClass:h,blockSelector:f,needsMask:$,maskTextClass:_,maskTextSelector:v,skipChild:!1,inlineStylesheet:S,maskInputOptions:k,maskTextFn:I,maskInputFn:C,slimDOMOptions:T,dataURLOptions:O,inlineImages:R,recordCanvas:M,preserveWhiteSpace:U,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D,onStylesheetLoad:Z,stylesheetLoadTimeout:A,keepIframeSrcFn:L});s&&P(r,s)}}),D),K.type===Ut.Element&&"link"===K.tagName&&"string"==typeof K.attributes.rel&&("stylesheet"===K.attributes.rel||"preload"===K.attributes.rel&&"string"==typeof K.attributes.href&&"css"===extractFileExtension(K.attributes.href))&&function onceStylesheetLoaded(r,i,s){let a,h=!1;try{a=r.sheet}catch(Dr){return}if(a)return;const f=setTimeout((()=>{h||(i(),h=!0)}),s);r.addEventListener("load",(()=>{clearTimeout(f),h=!0,i()}))}(r,(()=>{if(Z){const i=serializeNodeWithId(r,{doc:s,mirror:a,blockClass:h,blockSelector:f,needsMask:$,maskTextClass:_,maskTextSelector:v,skipChild:!1,inlineStylesheet:S,maskInputOptions:k,maskTextFn:I,maskInputFn:C,slimDOMOptions:T,dataURLOptions:O,inlineImages:R,recordCanvas:M,preserveWhiteSpace:U,onSerialize:N,onIframeLoad:P,iframeLoadTimeout:D,onStylesheetLoad:Z,stylesheetLoadTimeout:A,keepIframeSrcFn:L});i&&Z(r,i)}}),A),K}function on(r,i,s=document){const a={capture:!0,passive:!0};return s.addEventListener(r,i,a),()=>s.removeEventListener(r,i,a)}const rr="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 nr={map:{},getId:()=>(console.error(rr),-1),getNode:()=>(console.error(rr),null),removeNodeFromMap(){console.error(rr)},has:()=>(console.error(rr),!1),reset(){console.error(rr)}};function throttle(r,i,s={}){let a=null,h=0;return function(...f){const _=Date.now();h||!1!==s.leading||(h=_);const v=i-(_-h),b=this;v<=0||v>i?(a&&(clearTimeout(a),a=null),h=_,r.apply(b,f)):a||!1===s.trailing||(a=setTimeout((()=>{h=!1===s.leading?0:Date.now(),a=null,r.apply(b,f)}),v))}}function hookSetter(r,i,s,a,h=window){const f=h.Object.getOwnPropertyDescriptor(r,i);return h.Object.defineProperty(r,i,a?s:{set(r){setTimeout((()=>{s.set.call(this,r)}),0),f&&f.set&&f.set.call(this,r)}}),()=>hookSetter(r,i,f||{},!0)}function patch(r,i,s){try{if(!(i in r))return()=>{};const a=r[i],h=s(a);return"function"==typeof h&&(h.prototype=h.prototype||{},Object.defineProperties(h,{__rrweb_original__:{enumerable:!1,value:a}})),r[i]=h,()=>{r[i]=a}}catch(a){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(nr=new Proxy(nr,{get:(r,i,s)=>("map"===i&&console.error(rr),Reflect.get(r,i,s))}));let ir=Date.now;function getWindowScroll(r){var i,s,a,h,f,_;const v=r.document;return{left:v.scrollingElement?v.scrollingElement.scrollLeft:void 0!==r.pageXOffset?r.pageXOffset:(null==v?void 0:v.documentElement.scrollLeft)||(null===(s=null===(i=null==v?void 0:v.body)||void 0===i?void 0:i.parentElement)||void 0===s?void 0:s.scrollLeft)||(null===(a=null==v?void 0:v.body)||void 0===a?void 0:a.scrollLeft)||0,top:v.scrollingElement?v.scrollingElement.scrollTop:void 0!==r.pageYOffset?r.pageYOffset:(null==v?void 0:v.documentElement.scrollTop)||(null===(f=null===(h=null==v?void 0:v.body)||void 0===h?void 0:h.parentElement)||void 0===f?void 0:f.scrollTop)||(null===(_=null==v?void 0:v.body)||void 0===_?void 0:_.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(r){if(!r)return null;return r.nodeType===r.ELEMENT_NODE?r:r.parentElement}function isBlocked(r,i,s,a){if(!r)return!1;const h=closestElementOfNode(r);if(!h)return!1;try{if("string"==typeof i){if(h.classList.contains(i))return!0;if(a&&null!==h.closest("."+i))return!0}else if(classMatchesRegex(h,i,a))return!0}catch(f){}if(s){if(h.matches(s))return!0;if(a&&null!==h.closest(s))return!0}return!1}function isIgnored(r,i){return i.getId(r)===Kt}function isAncestorRemoved(r,i){if(isShadowRoot(r))return!1;const s=i.getId(r);return!i.has(s)||(!r.parentNode||r.parentNode.nodeType!==r.DOCUMENT_NODE)&&(!r.parentNode||isAncestorRemoved(r.parentNode,i))}function legacy_isTouchEvent(r){return Boolean(r.changedTouches)}function isSerializedIframe(r,i){return Boolean("IFRAME"===r.nodeName&&i.getMeta(r))}function isSerializedStylesheet(r,i){return Boolean("LINK"===r.nodeName&&r.nodeType===r.ELEMENT_NODE&&r.getAttribute&&"stylesheet"===r.getAttribute("rel")&&i.getMeta(r))}function hasShadowRoot(r){return Boolean(null==r?void 0:r.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(ir=()=>(new Date).getTime());class StyleSheetMirror{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(r){var i;return null!==(i=this.styleIDMap.get(r))&&void 0!==i?i:-1}has(r){return this.styleIDMap.has(r)}add(r,i){if(this.has(r))return this.getId(r);let s;return s=void 0===i?this.id++:i,this.styleIDMap.set(r,s),this.idStyleMap.set(s,r),s}getStyle(r){return this.idStyleMap.get(r)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function getShadowHost(r){var i,s;let a=null;return(null===(s=null===(i=r.getRootNode)||void 0===i?void 0:i.call(r))||void 0===s?void 0:s.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&r.getRootNode().host&&(a=r.getRootNode().host),a}function shadowHostInDom(r){const i=r.ownerDocument;if(!i)return!1;const s=function getRootShadowHost(r){let i,s=r;for(;i=getShadowHost(s);)s=i;return s}(r);return i.contains(s)}function inDom(r){const i=r.ownerDocument;return!!i&&(i.contains(r)||shadowHostInDom(r))}var or=(r=>(r[r.DomContentLoaded=0]="DomContentLoaded",r[r.Load=1]="Load",r[r.FullSnapshot=2]="FullSnapshot",r[r.IncrementalSnapshot=3]="IncrementalSnapshot",r[r.Meta=4]="Meta",r[r.Custom=5]="Custom",r[r.Plugin=6]="Plugin",r))(or||{}),sr=(r=>(r[r.Mutation=0]="Mutation",r[r.MouseMove=1]="MouseMove",r[r.MouseInteraction=2]="MouseInteraction",r[r.Scroll=3]="Scroll",r[r.ViewportResize=4]="ViewportResize",r[r.Input=5]="Input",r[r.TouchMove=6]="TouchMove",r[r.MediaInteraction=7]="MediaInteraction",r[r.StyleSheetRule=8]="StyleSheetRule",r[r.CanvasMutation=9]="CanvasMutation",r[r.Font=10]="Font",r[r.Log=11]="Log",r[r.Drag=12]="Drag",r[r.StyleDeclaration=13]="StyleDeclaration",r[r.Selection=14]="Selection",r[r.AdoptedStyleSheet=15]="AdoptedStyleSheet",r[r.CustomElement=16]="CustomElement",r))(sr||{}),ar=(r=>(r[r.MouseUp=0]="MouseUp",r[r.MouseDown=1]="MouseDown",r[r.Click=2]="Click",r[r.ContextMenu=3]="ContextMenu",r[r.DblClick=4]="DblClick",r[r.Focus=5]="Focus",r[r.Blur=6]="Blur",r[r.TouchStart=7]="TouchStart",r[r.TouchMove_Departed=8]="TouchMove_Departed",r[r.TouchEnd=9]="TouchEnd",r[r.TouchCancel=10]="TouchCancel",r))(ar||{}),cr=(r=>(r[r.Mouse=0]="Mouse",r[r.Pen=1]="Pen",r[r.Touch=2]="Touch",r))(cr||{}),dr=(r=>(r[r["2D"]=0]="2D",r[r.WebGL=1]="WebGL",r[r.WebGL2=2]="WebGL2",r))(dr||{});function isNodeInLinkedList(r){return"__ln"in r}class DoubleLinkedList{constructor(){this.length=0,this.head=null,this.tail=null}get(r){if(r>=this.length)throw new Error("Position outside of list range");let i=this.head;for(let s=0;s<r;s++)i=(null==i?void 0:i.next)||null;return i}addNode(r){const i={value:r,previous:null,next:null};if(r.__ln=i,r.previousSibling&&isNodeInLinkedList(r.previousSibling)){const s=r.previousSibling.__ln.next;i.next=s,i.previous=r.previousSibling.__ln,r.previousSibling.__ln.next=i,s&&(s.previous=i)}else if(r.nextSibling&&isNodeInLinkedList(r.nextSibling)&&r.nextSibling.__ln.previous){const s=r.nextSibling.__ln.previous;i.previous=s,i.next=r.nextSibling.__ln,r.nextSibling.__ln.previous=i,s&&(s.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(r){const i=r.__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),r.__ln&&delete r.__ln,this.length--)}}const moveKey=(r,i)=>`${r}@${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=r=>{r.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const r=[],i=new Set,s=new DoubleLinkedList,getNextId=r=>{let i=r,s=Kt;for(;s===Kt;)i=i&&i.nextSibling,s=i&&this.mirror.getId(i);return s},pushAdd=a=>{if(!a.parentNode||!inDom(a)||"TEXTAREA"===a.parentNode.tagName)return;const h=isShadowRoot(a.parentNode)?this.mirror.getId(getShadowHost(a)):this.mirror.getId(a.parentNode),f=getNextId(a);if(-1===h||-1===f)return s.addNode(a);const _=serializeNodeWithId(a,{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:r=>{isSerializedIframe(r,this.mirror)&&this.iframeManager.addIframe(r),isSerializedStylesheet(r,this.mirror)&&this.stylesheetManager.trackLinkElement(r),hasShadowRoot(a)&&this.shadowDomManager.addShadowRoot(a.shadowRoot,this.doc)},onIframeLoad:(r,i)=>{this.iframeManager.attachIframe(r,i),this.shadowDomManager.observeAttachShadow(r)},onStylesheetLoad:(r,i)=>{this.stylesheetManager.attachLinkElement(r,i)}});_&&(r.push({parentId:h,nextId:f,node:_}),i.add(_.id))};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const f of this.movedSet)isParentRemoved(this.removes,f,this.mirror)&&!this.movedSet.has(f.parentNode)||pushAdd(f);for(const f of this.addedSet)isAncestorInSet(this.droppedSet,f)||isParentRemoved(this.removes,f,this.mirror)?isAncestorInSet(this.movedSet,f)?pushAdd(f):this.droppedSet.add(f):pushAdd(f);let a=null;for(;s.length;){let r=null;if(a){const i=this.mirror.getId(a.value.parentNode),s=getNextId(a.value);-1!==i&&-1!==s&&(r=a)}if(!r){let i=s.tail;for(;i;){const s=i;if(i=i.previous,s){const i=this.mirror.getId(s.value.parentNode);if(-1===getNextId(s.value))continue;if(-1!==i){r=s;break}{const i=s.value;if(i.parentNode&&i.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const a=i.parentNode.host;if(-1!==this.mirror.getId(a)){r=s;break}}}}}}if(!r){for(;s.head;)s.removeNode(s.head.value);break}a=r.previous,s.removeNode(r.value),pushAdd(r.value)}const h={texts:this.texts.map((r=>{const i=r.node;return i.parentNode&&"TEXTAREA"===i.parentNode.tagName&&this.genTextAreaValueMutation(i.parentNode),{id:this.mirror.getId(i),value:r.value}})).filter((r=>!i.has(r.id))).filter((r=>this.mirror.has(r.id))),attributes:this.attributes.map((r=>{const{attributes:i}=r;if("string"==typeof i.style){const s=JSON.stringify(r.styleDiff),a=JSON.stringify(r._unchangedStyles);s.length<i.style.length&&(s+a).split("var(").length===i.style.split("var(").length&&(i.style=r.styleDiff)}return{id:this.mirror.getId(r.node),attributes:i}})).filter((r=>!i.has(r.id))).filter((r=>this.mirror.has(r.id))),removes:this.removes,adds:r};(h.texts.length||h.attributes.length||h.removes.length||h.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(h))},this.genTextAreaValueMutation=r=>{let i=this.attributeMap.get(r);i||(i={node:r,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(i),this.attributeMap.set(r,i)),i.attributes.value=Array.from(r.childNodes,(r=>r.textContent||"")).join("")},this.processMutation=r=>{if(!isIgnored(r.target,this.mirror))switch(r.type){case"characterData":{const i=r.target.textContent;isBlocked(r.target,this.blockClass,this.blockSelector,!1)||i===r.oldValue||this.texts.push({value:needMaskingText(r.target,this.maskTextClass,this.maskTextSelector,!0)&&i?this.maskTextFn?this.maskTextFn(i,closestElementOfNode(r.target)):i.replace(/[\S]/g,"*"):i,node:r.target});break}case"attributes":{const s=r.target;let a=r.attributeName,h=r.target.getAttribute(a);if("value"===a){const r=getInputType(s);h=maskInputValue({element:s,maskInputOptions:this.maskInputOptions,tagName:s.tagName,type:r,value:h,maskInputFn:this.maskInputFn})}if(isBlocked(r.target,this.blockClass,this.blockSelector,!1)||h===r.oldValue)return;let f=this.attributeMap.get(r.target);if("IFRAME"===s.tagName&&"src"===a&&!this.keepIframeSrcFn(h)){if(s.contentDocument)return;a="rr_src"}if(f||(f={node:r.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(f),this.attributeMap.set(r.target,f)),"type"===a&&"INPUT"===s.tagName&&"password"===(r.oldValue||"").toLowerCase()&&s.setAttribute("data-rr-is-password","true"),!ignoreAttribute(s.tagName,a)&&(f.attributes[a]=transformAttribute(this.doc,toLowerCase(s.tagName),toLowerCase(a),h),"style"===a)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(i){this.unattachedDoc=this.doc}const a=this.unattachedDoc.createElement("span");r.oldValue&&a.setAttribute("style",r.oldValue);for(const r of Array.from(s.style)){const i=s.style.getPropertyValue(r),h=s.style.getPropertyPriority(r);i!==a.style.getPropertyValue(r)||h!==a.style.getPropertyPriority(r)?f.styleDiff[r]=""===h?i:[i,h]:f._unchangedStyles[r]=[i,h]}for(const r of Array.from(a.style))""===s.style.getPropertyValue(r)&&(f.styleDiff[r]=!1)}break}case"childList":if(isBlocked(r.target,this.blockClass,this.blockSelector,!0))return;if("TEXTAREA"===r.target.tagName)return void this.genTextAreaValueMutation(r.target);r.addedNodes.forEach((i=>this.genAdds(i,r.target))),r.removedNodes.forEach((i=>{const s=this.mirror.getId(i),a=isShadowRoot(r.target)?this.mirror.getId(r.target.host):this.mirror.getId(r.target);isBlocked(r.target,this.blockClass,this.blockSelector,!1)||isIgnored(i,this.mirror)||!function isSerialized(r,i){return-1!==i.getId(r)}(i,this.mirror)||(this.addedSet.has(i)?(deepDelete(this.addedSet,i),this.droppedSet.add(i)):this.addedSet.has(r.target)&&-1===s||isAncestorRemoved(r.target,this.mirror)||(this.movedSet.has(i)&&this.movedMap[moveKey(s,a)]?deepDelete(this.movedSet,i):this.removes.push({parentId:a,id:s,isShadow:!(!isShadowRoot(r.target)||!isNativeShadowDom(r.target))||void 0})),this.mapRemoves.push(i))}))}},this.genAdds=(r,i)=>{if(!this.processedNodeManager.inOtherBuffer(r,this)&&!this.addedSet.has(r)&&!this.movedSet.has(r)){if(this.mirror.hasNode(r)){if(isIgnored(r,this.mirror))return;this.movedSet.add(r);let s=null;i&&this.mirror.hasNode(i)&&(s=this.mirror.getId(i)),s&&-1!==s&&(this.movedMap[moveKey(this.mirror.getId(r),s)]=!0)}else this.addedSet.add(r),this.droppedSet.delete(r);isBlocked(r,this.blockClass,this.blockSelector,!1)||(r.childNodes.forEach((r=>this.genAdds(r))),hasShadowRoot(r)&&r.shadowRoot.childNodes.forEach((i=>{this.processedNodeManager.add(i,this),this.genAdds(i,r)})))}}}init(r){["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]=r[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(r,i){r.delete(i),i.childNodes.forEach((i=>deepDelete(r,i)))}function isParentRemoved(r,i,s){return 0!==r.length&&_isParentRemoved(r,i,s)}function _isParentRemoved(r,i,s){const{parentNode:a}=i;if(!a)return!1;const h=s.getId(a);return!!r.some((r=>r.id===h))||_isParentRemoved(r,a,s)}function isAncestorInSet(r,i){return 0!==r.size&&_isAncestorInSet(r,i)}function _isAncestorInSet(r,i){const{parentNode:s}=i;return!!s&&(!!r.has(s)||_isAncestorInSet(r,s))}let ur;const callbackWrapper=r=>{if(!ur)return r;return(...i)=>{try{return r(...i)}catch(Dr){if(ur&&!0===ur(Dr))return;throw Dr}}},lr=[];function getEventTarget(r){try{if("composedPath"in r){const i=r.composedPath();if(i.length)return i[0]}else if("path"in r&&r.path.length)return r.path[0]}catch(i){}return r&&r.target}function initMutationObserver(r,i){var s,a;const h=new MutationBuffer;lr.push(h),h.init(r);let f=window.MutationObserver||window.__rrMutationObserver;const _=null===(a=null===(s=null===window||void 0===window?void 0:window.Zone)||void 0===s?void 0:s.__symbol__)||void 0===a?void 0:a.call(s,"MutationObserver");_&&window[_]&&(f=window[_]);const v=new f(callbackWrapper(h.processMutations.bind(h)));return v.observe(i,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),v}function initMouseInteractionObserver({mouseInteractionCb:r,doc:i,mirror:s,blockClass:a,blockSelector:h,sampling:f}){if(!1===f.mouseInteraction)return()=>{};const _=!0===f.mouseInteraction||void 0===f.mouseInteraction?{}:f.mouseInteraction,v=[];let b=null;return Object.keys(ar).filter((r=>Number.isNaN(Number(r))&&!r.endsWith("_Departed")&&!1!==_[r])).forEach((f=>{let _=toLowerCase(f);const S=(i=>f=>{const _=getEventTarget(f);if(isBlocked(_,a,h,!0))return;let v=null,S=i;if("pointerType"in f){switch(f.pointerType){case"mouse":v=cr.Mouse;break;case"touch":v=cr.Touch;break;case"pen":v=cr.Pen}v===cr.Touch?ar[i]===ar.MouseDown?S="TouchStart":ar[i]===ar.MouseUp&&(S="TouchEnd"):cr.Pen}else legacy_isTouchEvent(f)&&(v=cr.Touch);null!==v?(b=v,(S.startsWith("Touch")&&v===cr.Touch||S.startsWith("Mouse")&&v===cr.Mouse)&&(v=null)):ar[i]===ar.Click&&(v=b,b=null);const k=legacy_isTouchEvent(f)?f.changedTouches[0]:f;if(!k)return;const I=s.getId(_),{clientX:C,clientY:T}=k;callbackWrapper(r)(Object.assign({type:ar[S],id:I,x:C,y:T},null!==v&&{pointerType:v}))})(f);if(window.PointerEvent)switch(ar[f]){case ar.MouseDown:case ar.MouseUp:_=_.replace("mouse","pointer");break;case ar.TouchStart:case ar.TouchEnd:return}v.push(on(_,S,i))})),callbackWrapper((()=>{v.forEach((r=>r()))}))}function initScrollObserver({scrollCb:r,doc:i,mirror:s,blockClass:a,blockSelector:h,sampling:f}){return on("scroll",callbackWrapper(throttle(callbackWrapper((f=>{const _=getEventTarget(f);if(!_||isBlocked(_,a,h,!0))return;const v=s.getId(_);if(_===i&&i.defaultView){const s=getWindowScroll(i.defaultView);r({id:v,x:s.left,y:s.top})}else r({id:v,x:_.scrollLeft,y:_.scrollTop})})),f.scroll||100)),i)}const pr=["INPUT","TEXTAREA","SELECT"],hr=new WeakMap;function getNestedCSSRulePositions(r){return function recurse(r,i){if(hasNestedCSSRule("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||hasNestedCSSRule("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||hasNestedCSSRule("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||hasNestedCSSRule("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const s=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(s)}else if(r.parentStyleSheet){const s=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(s)}return i}(r,[])}function getIdAndStyleId(r,i,s){let a,h;return r?(r.ownerNode?a=i.getId(r.ownerNode):h=s.getId(r),{styleId:h,id:a}):{}}function initAdoptedStyleSheetObserver({mirror:r,stylesheetManager:i},s){var a,h,f;let _=null;_="#document"===s.nodeName?r.getId(s):r.getId(s.host);const v="#document"===s.nodeName?null===(a=s.defaultView)||void 0===a?void 0:a.Document:null===(f=null===(h=s.ownerDocument)||void 0===h?void 0:h.defaultView)||void 0===f?void 0:f.ShadowRoot,b=(null==v?void 0:v.prototype)?Object.getOwnPropertyDescriptor(null==v?void 0:v.prototype,"adoptedStyleSheets"):void 0;return null!==_&&-1!==_&&v&&b?(Object.defineProperty(s,"adoptedStyleSheets",{configurable:b.configurable,enumerable:b.enumerable,get(){var r;return null===(r=b.get)||void 0===r?void 0:r.call(this)},set(r){var s;const a=null===(s=b.set)||void 0===s?void 0:s.call(this,r);if(null!==_&&-1!==_)try{i.adoptStyleSheets(r,_)}catch(h){}return a}}),callbackWrapper((()=>{Object.defineProperty(s,"adoptedStyleSheets",{configurable:b.configurable,enumerable:b.enumerable,get:b.get,set:b.set})}))):()=>{}}function initObservers(r,i={}){const s=r.doc.defaultView;if(!s)return()=>{};let a;!function mergeHooks(r,i){const{mutationCb:s,mousemoveCb:a,mouseInteractionCb:h,scrollCb:f,viewportResizeCb:_,inputCb:v,mediaInteractionCb:b,styleSheetRuleCb:S,styleDeclarationCb:k,canvasMutationCb:I,fontCb:C,selectionCb:T,customElementCb:O}=r;r.mutationCb=(...r)=>{i.mutation&&i.mutation(...r),s(...r)},r.mousemoveCb=(...r)=>{i.mousemove&&i.mousemove(...r),a(...r)},r.mouseInteractionCb=(...r)=>{i.mouseInteraction&&i.mouseInteraction(...r),h(...r)},r.scrollCb=(...r)=>{i.scroll&&i.scroll(...r),f(...r)},r.viewportResizeCb=(...r)=>{i.viewportResize&&i.viewportResize(...r),_(...r)},r.inputCb=(...r)=>{i.input&&i.input(...r),v(...r)},r.mediaInteractionCb=(...r)=>{i.mediaInteaction&&i.mediaInteaction(...r),b(...r)},r.styleSheetRuleCb=(...r)=>{i.styleSheetRule&&i.styleSheetRule(...r),S(...r)},r.styleDeclarationCb=(...r)=>{i.styleDeclaration&&i.styleDeclaration(...r),k(...r)},r.canvasMutationCb=(...r)=>{i.canvasMutation&&i.canvasMutation(...r),I(...r)},r.fontCb=(...r)=>{i.font&&i.font(...r),C(...r)},r.selectionCb=(...r)=>{i.selection&&i.selection(...r),T(...r)},r.customElementCb=(...r)=>{i.customElement&&i.customElement(...r),O(...r)}}(r,i),r.recordDOM&&(a=initMutationObserver(r,r.doc));const h=function initMoveObserver({mousemoveCb:r,sampling:i,doc:s,mirror:a}){if(!1===i.mousemove)return()=>{};const h="number"==typeof i.mousemove?i.mousemove:50,f="number"==typeof i.mousemoveCallback?i.mousemoveCallback:500;let _,v=[];const b=throttle(callbackWrapper((i=>{const s=Date.now()-_;r(v.map((r=>(r.timeOffset-=s,r))),i),v=[],_=null})),f),S=callbackWrapper(throttle(callbackWrapper((r=>{const i=getEventTarget(r),{clientX:s,clientY:h}=legacy_isTouchEvent(r)?r.changedTouches[0]:r;_||(_=ir()),v.push({x:s,y:h,id:a.getId(i),timeOffset:ir()-_}),b("undefined"!=typeof DragEvent&&r instanceof DragEvent?sr.Drag:r instanceof MouseEvent?sr.MouseMove:sr.TouchMove)})),h,{trailing:!1})),k=[on("mousemove",S,s),on("touchmove",S,s),on("drag",S,s)];return callbackWrapper((()=>{k.forEach((r=>r()))}))}(r),f=initMouseInteractionObserver(r),_=initScrollObserver(r),v=function initViewportResizeObserver({viewportResizeCb:r},{win:i}){let s=-1,a=-1;return on("resize",callbackWrapper(throttle(callbackWrapper((()=>{const i=getWindowHeight(),h=getWindowWidth();s===i&&a===h||(r({width:Number(h),height:Number(i)}),s=i,a=h)})),200)),i)}(r,{win:s}),b=function initInputObserver({inputCb:r,doc:i,mirror:s,blockClass:a,blockSelector:h,ignoreClass:f,ignoreSelector:_,maskInputOptions:v,maskInputFn:b,sampling:S,userTriggeredOnInput:k}){function eventHandler(r){let s=getEventTarget(r);const S=r.isTrusted,I=s&&s.tagName;if(s&&"OPTION"===I&&(s=s.parentElement),!s||!I||pr.indexOf(I)<0||isBlocked(s,a,h,!0))return;if(s.classList.contains(f)||_&&s.matches(_))return;let C=s.value,T=!1;const O=getInputType(s)||"";"radio"===O||"checkbox"===O?T=s.checked:(v[I.toLowerCase()]||v[O])&&(C=maskInputValue({element:s,maskInputOptions:v,tagName:I,type:O,value:C,maskInputFn:b})),cbWithDedup(s,k?{text:C,isChecked:T,userTriggered:S}:{text:C,isChecked:T});const R=s.name;"radio"===O&&R&&T&&i.querySelectorAll(`input[type="radio"][name="${R}"]`).forEach((r=>{if(r!==s){const i=r.value;cbWithDedup(r,k?{text:i,isChecked:!T,userTriggered:!1}:{text:i,isChecked:!T})}}))}function cbWithDedup(i,a){const h=hr.get(i);if(!h||h.text!==a.text||h.isChecked!==a.isChecked){hr.set(i,a);const h=s.getId(i);callbackWrapper(r)(Object.assign(Object.assign({},a),{id:h}))}}const I=("last"===S.input?["change"]:["input","change"]).map((r=>on(r,callbackWrapper(eventHandler),i))),C=i.defaultView;if(!C)return()=>{I.forEach((r=>r()))};const T=C.Object.getOwnPropertyDescriptor(C.HTMLInputElement.prototype,"value"),O=[[C.HTMLInputElement.prototype,"value"],[C.HTMLInputElement.prototype,"checked"],[C.HTMLSelectElement.prototype,"value"],[C.HTMLTextAreaElement.prototype,"value"],[C.HTMLSelectElement.prototype,"selectedIndex"],[C.HTMLOptionElement.prototype,"selected"]];return T&&T.set&&I.push(...O.map((r=>hookSetter(r[0],r[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,C)))),callbackWrapper((()=>{I.forEach((r=>r()))}))}(r),S=function initMediaInteractionObserver({mediaInteractionCb:r,blockClass:i,blockSelector:s,mirror:a,sampling:h,doc:f}){const _=callbackWrapper((f=>throttle(callbackWrapper((h=>{const _=getEventTarget(h);if(!_||isBlocked(_,i,s,!0))return;const{currentTime:v,volume:b,muted:S,playbackRate:k,loop:I}=_;r({type:f,id:a.getId(_),currentTime:v,volume:b,muted:S,playbackRate:k,loop:I})})),h.media||500))),v=[on("play",_(0),f),on("pause",_(1),f),on("seeked",_(2),f),on("volumechange",_(3),f),on("ratechange",_(4),f)];return callbackWrapper((()=>{v.forEach((r=>r()))}))}(r);let styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};r.recordDOM&&(styleSheetObserver=function initStyleSheetObserver({styleSheetRuleCb:r,mirror:i,stylesheetManager:s},{win:a}){if(!a.CSSStyleSheet||!a.CSSStyleSheet.prototype)return()=>{};const h=a.CSSStyleSheet.prototype.insertRule;a.CSSStyleSheet.prototype.insertRule=new Proxy(h,{apply:callbackWrapper(((a,h,f)=>{const[_,v]=f,{id:b,styleId:S}=getIdAndStyleId(h,i,s.styleMirror);return(b&&-1!==b||S&&-1!==S)&&r({id:b,styleId:S,adds:[{rule:_,index:v}]}),a.apply(h,f)}))});const f=a.CSSStyleSheet.prototype.deleteRule;let _,v;a.CSSStyleSheet.prototype.deleteRule=new Proxy(f,{apply:callbackWrapper(((a,h,f)=>{const[_]=f,{id:v,styleId:b}=getIdAndStyleId(h,i,s.styleMirror);return(v&&-1!==v||b&&-1!==b)&&r({id:v,styleId:b,removes:[{index:_}]}),a.apply(h,f)}))}),a.CSSStyleSheet.prototype.replace&&(_=a.CSSStyleSheet.prototype.replace,a.CSSStyleSheet.prototype.replace=new Proxy(_,{apply:callbackWrapper(((a,h,f)=>{const[_]=f,{id:v,styleId:b}=getIdAndStyleId(h,i,s.styleMirror);return(v&&-1!==v||b&&-1!==b)&&r({id:v,styleId:b,replace:_}),a.apply(h,f)}))})),a.CSSStyleSheet.prototype.replaceSync&&(v=a.CSSStyleSheet.prototype.replaceSync,a.CSSStyleSheet.prototype.replaceSync=new Proxy(v,{apply:callbackWrapper(((a,h,f)=>{const[_]=f,{id:v,styleId:b}=getIdAndStyleId(h,i,s.styleMirror);return(v&&-1!==v||b&&-1!==b)&&r({id:v,styleId:b,replaceSync:_}),a.apply(h,f)}))}));const b={};canMonkeyPatchNestedCSSRule("CSSGroupingRule")?b.CSSGroupingRule=a.CSSGroupingRule:(canMonkeyPatchNestedCSSRule("CSSMediaRule")&&(b.CSSMediaRule=a.CSSMediaRule),canMonkeyPatchNestedCSSRule("CSSConditionRule")&&(b.CSSConditionRule=a.CSSConditionRule),canMonkeyPatchNestedCSSRule("CSSSupportsRule")&&(b.CSSSupportsRule=a.CSSSupportsRule));const S={};return Object.entries(b).forEach((([a,h])=>{S[a]={insertRule:h.prototype.insertRule,deleteRule:h.prototype.deleteRule},h.prototype.insertRule=new Proxy(S[a].insertRule,{apply:callbackWrapper(((a,h,f)=>{const[_,v]=f,{id:b,styleId:S}=getIdAndStyleId(h.parentStyleSheet,i,s.styleMirror);return(b&&-1!==b||S&&-1!==S)&&r({id:b,styleId:S,adds:[{rule:_,index:[...getNestedCSSRulePositions(h),v||0]}]}),a.apply(h,f)}))}),h.prototype.deleteRule=new Proxy(S[a].deleteRule,{apply:callbackWrapper(((a,h,f)=>{const[_]=f,{id:v,styleId:b}=getIdAndStyleId(h.parentStyleSheet,i,s.styleMirror);return(v&&-1!==v||b&&-1!==b)&&r({id:v,styleId:b,removes:[{index:[...getNestedCSSRulePositions(h),_]}]}),a.apply(h,f)}))})})),callbackWrapper((()=>{a.CSSStyleSheet.prototype.insertRule=h,a.CSSStyleSheet.prototype.deleteRule=f,_&&(a.CSSStyleSheet.prototype.replace=_),v&&(a.CSSStyleSheet.prototype.replaceSync=v),Object.entries(b).forEach((([r,i])=>{i.prototype.insertRule=S[r].insertRule,i.prototype.deleteRule=S[r].deleteRule}))}))}(r,{win:s}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(r,r.doc),styleDeclarationObserver=function initStyleDeclarationObserver({styleDeclarationCb:r,mirror:i,ignoreCSSAttributes:s,stylesheetManager:a},{win:h}){const f=h.CSSStyleDeclaration.prototype.setProperty;h.CSSStyleDeclaration.prototype.setProperty=new Proxy(f,{apply:callbackWrapper(((h,_,v)=>{var b;const[S,k,I]=v;if(s.has(S))return f.apply(_,[S,k,I]);const{id:C,styleId:T}=getIdAndStyleId(null===(b=_.parentRule)||void 0===b?void 0:b.parentStyleSheet,i,a.styleMirror);return(C&&-1!==C||T&&-1!==T)&&r({id:C,styleId:T,set:{property:S,value:k,priority:I},index:getNestedCSSRulePositions(_.parentRule)}),h.apply(_,v)}))});const _=h.CSSStyleDeclaration.prototype.removeProperty;return h.CSSStyleDeclaration.prototype.removeProperty=new Proxy(_,{apply:callbackWrapper(((h,f,v)=>{var b;const[S]=v;if(s.has(S))return _.apply(f,[S]);const{id:k,styleId:I}=getIdAndStyleId(null===(b=f.parentRule)||void 0===b?void 0:b.parentStyleSheet,i,a.styleMirror);return(k&&-1!==k||I&&-1!==I)&&r({id:k,styleId:I,remove:{property:S},index:getNestedCSSRulePositions(f.parentRule)}),h.apply(f,v)}))}),callbackWrapper((()=>{h.CSSStyleDeclaration.prototype.setProperty=f,h.CSSStyleDeclaration.prototype.removeProperty=_}))}(r,{win:s}),r.collectFonts&&(fontObserver=function initFontObserver({fontCb:r,doc:i}){const s=i.defaultView;if(!s)return()=>{};const a=[],h=new WeakMap,f=s.FontFace;s.FontFace=function FontFace(r,i,s){const a=new f(r,i,s);return h.set(a,{family:r,buffer:"string"!=typeof i,descriptors:s,fontSource:"string"==typeof i?i:JSON.stringify(Array.from(new Uint8Array(i)))}),a};const _=patch(i.fonts,"add",(function(i){return function(s){return setTimeout(callbackWrapper((()=>{const i=h.get(s);i&&(r(i),h.delete(s))})),0),i.apply(this,[s])}}));return a.push((()=>{s.FontFace=f})),a.push(_),callbackWrapper((()=>{a.forEach((r=>r()))}))}(r)));const k=function initSelectionObserver(r){const{doc:i,mirror:s,blockClass:a,blockSelector:h,selectionCb:f}=r;let _=!0;const v=callbackWrapper((()=>{const r=i.getSelection();if(!r||_&&(null==r?void 0:r.isCollapsed))return;_=r.isCollapsed||!1;const v=[],b=r.rangeCount||0;for(let i=0;i<b;i++){const f=r.getRangeAt(i),{startContainer:_,startOffset:b,endContainer:S,endOffset:k}=f;isBlocked(_,a,h,!0)||isBlocked(S,a,h,!0)||v.push({start:s.getId(_),startOffset:b,end:s.getId(S),endOffset:k})}f({ranges:v})}));return v(),on("selectionchange",v)}(r),I=function initCustomElementObserver({doc:r,customElementCb:i}){const s=r.defaultView;return s&&s.customElements?patch(s.customElements,"define",(function(r){return function(s,a,h){try{i({define:{name:s}})}catch(f){console.warn(`Custom element callback failed for ${s}`)}return r.apply(this,[s,a,h])}})):()=>{}}(r),C=[];for(const T of r.plugins)C.push(T.observer(T.callback,s,T.options));return callbackWrapper((()=>{lr.forEach((r=>r.reset())),null==a||a.disconnect(),h(),f(),_(),v(),b(),S(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),k(),I(),C.forEach((r=>r()))}))}function hasNestedCSSRule(r){return void 0!==window[r]}function canMonkeyPatchNestedCSSRule(r){return Boolean(void 0!==window[r]&&window[r].prototype&&"insertRule"in window[r].prototype&&"deleteRule"in window[r].prototype)}class CrossOriginIframeMirror{constructor(r){this.generateIdFn=r,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(r,i,s,a){const h=s||this.getIdToRemoteIdMap(r),f=a||this.getRemoteIdToIdMap(r);let _=h.get(i);return _||(_=this.generateIdFn(),h.set(i,_),f.set(_,i)),_}getIds(r,i){const s=this.getIdToRemoteIdMap(r),a=this.getRemoteIdToIdMap(r);return i.map((i=>this.getId(r,i,s,a)))}getRemoteId(r,i,s){const a=s||this.getRemoteIdToIdMap(r);if("number"!=typeof i)return i;const h=a.get(i);return h||-1}getRemoteIds(r,i){const s=this.getRemoteIdToIdMap(r);return i.map((i=>this.getRemoteId(r,i,s)))}reset(r){if(!r)return this.iframeIdToRemoteIdMap=new WeakMap,void(this.iframeRemoteIdToIdMap=new WeakMap);this.iframeIdToRemoteIdMap.delete(r),this.iframeRemoteIdToIdMap.delete(r)}getIdToRemoteIdMap(r){let i=this.iframeIdToRemoteIdMap.get(r);return i||(i=new Map,this.iframeIdToRemoteIdMap.set(r,i)),i}getRemoteIdToIdMap(r){let i=this.iframeRemoteIdToIdMap.get(r);return i||(i=new Map,this.iframeRemoteIdToIdMap.set(r,i)),i}}class IframeManager{constructor(r){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new CrossOriginIframeMirror(genId),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=r.mutationCb,this.wrappedEmit=r.wrappedEmit,this.stylesheetManager=r.stylesheetManager,this.recordCrossOriginIframes=r.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new CrossOriginIframeMirror(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=r.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(r){this.iframes.set(r,!0),r.contentWindow&&this.crossOriginIframeMap.set(r.contentWindow,r)}addLoadListener(r){this.loadListener=r}attachIframe(r,i){var s;this.mutationCb({adds:[{parentId:this.mirror.getId(r),nextId:null,node:i}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(s=this.loadListener)||void 0===s||s.call(this,r),r.contentDocument&&r.contentDocument.adoptedStyleSheets&&r.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(r.contentDocument.adoptedStyleSheets,this.mirror.getId(r.contentDocument))}handleMessage(r){const i=r;if("rrweb"!==i.data.type||i.origin!==i.data.origin)return;if(!r.source)return;const s=this.crossOriginIframeMap.get(r.source);if(!s)return;const a=this.transformCrossOriginEvent(s,i.data.event);a&&this.wrappedEmit(a,i.data.isCheckout)}transformCrossOriginEvent(r,i){var s;switch(i.type){case or.FullSnapshot:{this.crossOriginIframeMirror.reset(r),this.crossOriginIframeStyleMirror.reset(r),this.replaceIdOnNode(i.data.node,r);const s=i.data.node.id;return this.crossOriginIframeRootIdMap.set(r,s),this.patchRootIdOnNode(i.data.node,s),{timestamp:i.timestamp,type:or.IncrementalSnapshot,data:{source:sr.Mutation,adds:[{parentId:this.mirror.getId(r),nextId:null,node:i.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case or.Meta:case or.Load:case or.DomContentLoaded:return!1;case or.Plugin:return i;case or.Custom:return this.replaceIds(i.data.payload,r,["id","parentId","previousId","nextId"]),i;case or.IncrementalSnapshot:switch(i.data.source){case sr.Mutation:return i.data.adds.forEach((i=>{this.replaceIds(i,r,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,r);const s=this.crossOriginIframeRootIdMap.get(r);s&&this.patchRootIdOnNode(i.node,s)})),i.data.removes.forEach((i=>{this.replaceIds(i,r,["parentId","id"])})),i.data.attributes.forEach((i=>{this.replaceIds(i,r,["id"])})),i.data.texts.forEach((i=>{this.replaceIds(i,r,["id"])})),i;case sr.Drag:case sr.TouchMove:case sr.MouseMove:return i.data.positions.forEach((i=>{this.replaceIds(i,r,["id"])})),i;case sr.ViewportResize:return!1;case sr.MediaInteraction:case sr.MouseInteraction:case sr.Scroll:case sr.CanvasMutation:case sr.Input:return this.replaceIds(i.data,r,["id"]),i;case sr.StyleSheetRule:case sr.StyleDeclaration:return this.replaceIds(i.data,r,["id"]),this.replaceStyleIds(i.data,r,["styleId"]),i;case sr.Font:return i;case sr.Selection:return i.data.ranges.forEach((i=>{this.replaceIds(i,r,["start","end"])})),i;case sr.AdoptedStyleSheet:return this.replaceIds(i.data,r,["id"]),this.replaceStyleIds(i.data,r,["styleIds"]),null===(s=i.data.styles)||void 0===s||s.forEach((i=>{this.replaceStyleIds(i,r,["styleId"])})),i}}return!1}replace(r,i,s,a){for(const h of a)(Array.isArray(i[h])||"number"==typeof i[h])&&(Array.isArray(i[h])?i[h]=r.getIds(s,i[h]):i[h]=r.getId(s,i[h]));return i}replaceIds(r,i,s){return this.replace(this.crossOriginIframeMirror,r,i,s)}replaceStyleIds(r,i,s){return this.replace(this.crossOriginIframeStyleMirror,r,i,s)}replaceIdOnNode(r,i){this.replaceIds(r,i,["id","rootId"]),"childNodes"in r&&r.childNodes.forEach((r=>{this.replaceIdOnNode(r,i)}))}patchRootIdOnNode(r,i){r.type===Ut.Document||r.rootId||(r.rootId=i),"childNodes"in r&&r.childNodes.forEach((r=>{this.patchRootIdOnNode(r,i)}))}}class ShadowDomManager{constructor(r){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=r.mutationCb,this.scrollCb=r.scrollCb,this.bypassOptions=r.bypassOptions,this.mirror=r.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(r,i){if(!isNativeShadowDom(r))return;if(this.shadowDoms.has(r))return;this.shadowDoms.add(r);const s=initMutationObserver(Object.assign(Object.assign({},this.bypassOptions),{doc:i,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),r);this.restoreHandlers.push((()=>s.disconnect())),this.restoreHandlers.push(initScrollObserver(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:r,mirror:this.mirror}))),setTimeout((()=>{r.adoptedStyleSheets&&r.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(r.adoptedStyleSheets,this.mirror.getId(r.host)),this.restoreHandlers.push(initAdoptedStyleSheetObserver({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},r))}),0)}observeAttachShadow(r){r.contentWindow&&r.contentDocument&&this.patchAttachShadow(r.contentWindow.Element,r.contentDocument)}patchAttachShadow(r,i){const s=this;this.restoreHandlers.push(patch(r.prototype,"attachShadow",(function(r){return function(a){const h=r.call(this,a);return this.shadowRoot&&inDom(this)&&s.addShadowRoot(this.shadowRoot,i),h}})))}reset(){this.restoreHandlers.forEach((r=>{try{r()}catch(i){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
2
2
  /*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -12,7 +12,7 @@ var browserAnalytics=function(){"use strict";var e,r,i;(r=e||(e={})).assertEqual
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,r,i,o){return new(i||(i=Promise))((function(r,s){function fulfilled(e){try{step(o.next(e))}catch(r){s(r)}}function rejected(e){try{step(o.throw(e))}catch(r){s(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((o=o.apply(e,[])).next())}))}for(var ar="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cr="undefined"==typeof Uint8Array?[]:new Uint8Array(256),dr=0;dr<64;dr++)cr[ar.charCodeAt(dr)]=dr;const ur=new Map;const saveWebGLVar=(e,r,i)=>{if(!e||!isInstanceOfWebGLObject(e,r)&&"object"!=typeof e)return;const o=function variableListFor(e,r){let i=ur.get(e);return i||(i=new Map,ur.set(e,i)),i.has(r)||i.set(r,[]),i.get(r)}(i,e.constructor.name);let s=o.indexOf(e);return-1===s&&(s=o.length,o.push(e)),s};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){return{rr_type:e.constructor.name,base64:function(e){var r,i=new Uint8Array(e),o=i.length,s="";for(r=0;r<o;r+=3)s+=ar[i[r]>>2],s+=ar[(3&i[r])<<4|i[r+1]>>4],s+=ar[(15&i[r+1])<<2|i[r+2]>>6],s+=ar[63&i[r+2]];return o%3==2?s=s.substring(0,s.length-1)+"=":o%3==1&&(s=s.substring(0,s.length-2)+"=="),s}(e)}}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,o){const s=[];try{const a=patch(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(s,...a){if(!isBlocked(this,r,i,!0)){const e=function getNormalizedContextName(e){return"experimental-webgl"===e?"webgl":e}(s);if("__context"in this||(this.__context=e),o&&["webgl","webgl2"].includes(e))if(a[0]&&"object"==typeof a[0]){const e=a[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[s,...a])}}));s.push(a)}catch(a){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach((e=>e()))}}function patchGLPrototype(e,r,i,o,s,a,h){const f=[],g=Object.getOwnPropertyNames(e);for(const y of g)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(y))try{if("function"!=typeof e[y])continue;const a=patch(e,y,(function(e){return function(...a){const f=e.apply(this,a);if(saveWebGLVar(f,h,this),"tagName"in this.canvas&&!isBlocked(this.canvas,o,s,!0)){const e=serializeArgs(a,h,this),o={type:r,property:y,args:e};i(this.canvas,o)}return f}}));f.push(a)}catch(_){const o=hookSetter(e,y,{set(e){i(this.canvas,{type:r,property:y,args:[e],setter:!0})}});f.push(o)}return f}var lr=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/),o=/(['"])__worker_loader_strict__(['"])/g,s=0,a=r.length;s<a;++s)r[s]=r[s].substring(i).replace(o,"$1use strict$2")+"\n";return r}(e),o=new Blob(i,{type:"application/javascript"});return URL.createObjectURL(o)}(e),new Worker(i,r)}}((function(){!function(){
15
+ ***************************************************************************** */function __awaiter(r,i,s,a){return new(s||(s=Promise))((function(i,h){function fulfilled(r){try{step(a.next(r))}catch(i){h(i)}}function rejected(r){try{step(a.throw(r))}catch(i){h(i)}}function step(r){r.done?i(r.value):function adopt(r){return r instanceof s?r:new s((function(i){i(r)}))}(r.value).then(fulfilled,rejected)}step((a=a.apply(r,[])).next())}))}for(var fr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",mr="undefined"==typeof Uint8Array?[]:new Uint8Array(256),gr=0;gr<64;gr++)mr[fr.charCodeAt(gr)]=gr;const _r=new Map;const saveWebGLVar=(r,i,s)=>{if(!r||!isInstanceOfWebGLObject(r,i)&&"object"!=typeof r)return;const a=function variableListFor(r,i){let s=_r.get(r);return s||(s=new Map,_r.set(r,s)),s.has(i)||s.set(i,[]),s.get(i)}(s,r.constructor.name);let h=a.indexOf(r);return-1===h&&(h=a.length,a.push(r)),h};function serializeArg(r,i,s){if(r instanceof Array)return r.map((r=>serializeArg(r,i,s)));if(null===r)return r;if(r instanceof Float32Array||r instanceof Float64Array||r instanceof Int32Array||r instanceof Uint32Array||r instanceof Uint8Array||r instanceof Uint16Array||r instanceof Int16Array||r instanceof Int8Array||r instanceof Uint8ClampedArray){return{rr_type:r.constructor.name,args:[Object.values(r)]}}if(r instanceof ArrayBuffer){return{rr_type:r.constructor.name,base64:function(r){var i,s=new Uint8Array(r),a=s.length,h="";for(i=0;i<a;i+=3)h+=fr[s[i]>>2],h+=fr[(3&s[i])<<4|s[i+1]>>4],h+=fr[(15&s[i+1])<<2|s[i+2]>>6],h+=fr[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}(r)}}if(r instanceof DataView){return{rr_type:r.constructor.name,args:[serializeArg(r.buffer,i,s),r.byteOffset,r.byteLength]}}if(r instanceof HTMLImageElement){const i=r.constructor.name,{src:s}=r;return{rr_type:i,src:s}}if(r instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:r.toDataURL()}}if(r instanceof ImageData){return{rr_type:r.constructor.name,args:[serializeArg(r.data,i,s),r.width,r.height]}}if(isInstanceOfWebGLObject(r,i)||"object"==typeof r){return{rr_type:r.constructor.name,index:saveWebGLVar(r,i,s)}}return r}const serializeArgs=(r,i,s)=>r.map((r=>serializeArg(r,i,s))),isInstanceOfWebGLObject=(r,i)=>{const s=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((r=>"function"==typeof i[r]));return Boolean(s.find((s=>r instanceof i[s])))};function initCanvasContextObserver(r,i,s,a){const h=[];try{const f=patch(r.HTMLCanvasElement.prototype,"getContext",(function(r){return function(h,...f){if(!isBlocked(this,i,s,!0)){const r=function getNormalizedContextName(r){return"experimental-webgl"===r?"webgl":r}(h);if("__context"in this||(this.__context=r),a&&["webgl","webgl2"].includes(r))if(f[0]&&"object"==typeof f[0]){const r=f[0];r.preserveDrawingBuffer||(r.preserveDrawingBuffer=!0)}else f.splice(0,1,{preserveDrawingBuffer:!0})}return r.apply(this,[h,...f])}}));h.push(f)}catch(f){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{h.forEach((r=>r()))}}function patchGLPrototype(r,i,s,a,h,f,_){const v=[],b=Object.getOwnPropertyNames(r);for(const k of b)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(k))try{if("function"!=typeof r[k])continue;const f=patch(r,k,(function(r){return function(...f){const v=r.apply(this,f);if(saveWebGLVar(v,_,this),"tagName"in this.canvas&&!isBlocked(this.canvas,a,h,!0)){const r=serializeArgs(f,_,this),a={type:i,property:k,args:r};s(this.canvas,a)}return v}}));v.push(f)}catch(S){const a=hookSetter(r,k,{set(r){s(this.canvas,{type:i,property:k,args:[r],setter:!0})}});v.push(a)}return v}var yr=function createInlineWorkerFactory(r,i){var s;return function WorkerFactory2(i){return s=s||function createURL(r,i){var s=function funcToSource(r){var i=r.toString().split("\n");i.pop(),i.shift();for(var s=i[0].search(/\S/),a=/(['"])__worker_loader_strict__(['"])/g,h=0,f=i.length;h<f;++h)i[h]=i[h].substring(s).replace(a,"$1use strict$2")+"\n";return i}(r),a=new Blob(s,{type:"application/javascript"});return URL.createObjectURL(a)}(r),new Worker(s,i)}}((function(){!function(){
16
16
  /*! *****************************************************************************
17
17
  Copyright (c) Microsoft Corporation.
18
18
 
@@ -27,5 +27,5 @@ var browserAnalytics=function(){"use strict";var e,r,i;(r=e||(e={})).assertEqual
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,r,i,o){return new(i||(i=Promise))((function(r,s){function fulfilled(e){try{step(o.next(e))}catch(r){s(r)}}function rejected(e){try{step(o.throw(e))}catch(r){s(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((o=o.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,o=new Uint8Array(r),s=o.length,a="";for(i=0;i<s;i+=3)a+=e[o[i]>>2],a+=e[(3&o[i])<<4|o[i+1]>>4],a+=e[(15&o[i+1])<<2|o[i+2]>>6],a+=e[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};const o=new Map,s=new Map;const a=self;a.onmessage=function(e){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return a.postMessage({id:e.data.id});{const{id:r,bitmap:i,width:h,height:f,dataURLOptions:g}=e.data,_=function getTransparentBlobFor(e,r,i){return __awaiter2(this,0,void 0,(function*(){const o=`${e}-${r}`;if("OffscreenCanvas"in globalThis){if(s.has(o))return s.get(o);const a=new OffscreenCanvas(e,r);a.getContext("2d");const h=yield a.convertToBlob(i),f=yield h.arrayBuffer(),g=encode2(f);return s.set(o,g),g}return""}))}(h,f,g),y=new OffscreenCanvas(h,f);y.getContext("2d").drawImage(i,0,0),i.close();const v=yield y.convertToBlob(g),b=v.type,S=yield v.arrayBuffer(),I=encode2(S);if(!o.has(r)&&(yield _)===I)return o.set(r,I),a.postMessage({id:r});if(o.get(r)===I)return a.postMessage({id:r});a.postMessage({id:r,type:b,base64:I,width:h,height:f}),o.set(r,I)}}))}}()}));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:o,blockSelector:s,recordCanvas:a,dataURLOptions:h}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===r&&this.initCanvasMutationObserver(i,o,s),a&&"number"==typeof r&&this.initCanvasFPSObserver(r,i,o,s,{dataURLOptions:h})}initCanvasFPSObserver(e,r,i,o,s){const a=initCanvasContextObserver(r,i,o,!0),h=new Map,f=new lr;f.onmessage=e=>{const{id:r}=e.data;if(h.set(r,!1),!("base64"in e.data))return;const{base64:i,type:o,width:s,height:a}=e.data;this.mutationCb({id:r,type:rr["2D"],commands:[{property:"clearRect",args:[0,0,s,a]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:i}],type:o}]},0,0]}]})};const g=1e3/e;let _,y=0;const takeCanvasSnapshots=e=>{y&&e-y<g||(y=e,(()=>{const e=[];return r.document.querySelectorAll("canvas").forEach((r=>{isBlocked(r,i,o,!0)||e.push(r)})),e})().forEach((e=>__awaiter(this,0,void 0,(function*(){var r;const i=this.mirror.getId(e);if(h.get(i))return;if(0===e.width||0===e.height)return;if(h.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 o=yield createImageBitmap(e);f.postMessage({id:i,bitmap:o,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[o])}))))),_=requestAnimationFrame(takeCanvasSnapshots)};_=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{a(),cancelAnimationFrame(_)}}initCanvasMutationObserver(e,r,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const o=initCanvasContextObserver(e,r,i,!1),s=function initCanvas2DMutationObserver(e,r,i,o){const s=[],a=Object.getOwnPropertyNames(r.CanvasRenderingContext2D.prototype);for(const f of a)try{if("function"!=typeof r.CanvasRenderingContext2D.prototype[f])continue;const a=patch(r.CanvasRenderingContext2D.prototype,f,(function(s){return function(...a){return isBlocked(this.canvas,i,o,!0)||setTimeout((()=>{const i=serializeArgs(a,r,this);e(this.canvas,{type:rr["2D"],property:f,args:i})}),0),s.apply(this,a)}}));s.push(a)}catch(h){const i=hookSetter(r.CanvasRenderingContext2D.prototype,f,{set(r){e(this.canvas,{type:rr["2D"],property:f,args:[r],setter:!0})}});s.push(i)}return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,r,i),a=function initCanvasWebGLMutationObserver(e,r,i,o,s){const a=[];return a.push(...patchGLPrototype(r.WebGLRenderingContext.prototype,rr.WebGL,e,i,o,0,r)),void 0!==r.WebGL2RenderingContext&&a.push(...patchGLPrototype(r.WebGL2RenderingContext.prototype,rr.WebGL2,e,i,o,0,r)),()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,r,i,this.mirror);this.resetObservers=()=>{o(),s(),a()}}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 o=i.map((e=>function __rest(e,r){var i={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(i[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(o=Object.getOwnPropertySymbols(e);s<o.length;s++)r.indexOf(o[s])<0&&Object.prototype.propertyIsEnumerable.call(e,o[s])&&(i[o[s]]=e[o[s]])}return i}(e,["type"]))),{type:s}=i[0];this.mutationCb({id:r,type:s,commands:o}),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:[]},o=[];for(const s of e){let e;this.styleMirror.has(s)?e=this.styleMirror.getId(s):(e=this.styleMirror.add(s),o.push({styleId:e,rules:Array.from(s.rules||CSSRule,((e,r)=>({rule:stringifyRule(e),index:r})))})),i.styleIds.push(e)}o.length>0&&(i.styles=o),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:Yt()})}let pr,hr,fr,mr=!1;const gr=function createMirror(){return new Mirror}();function record(e={}){const{emit:r,checkoutEveryNms:i,checkoutEveryNth:o,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:h="rr-ignore",ignoreSelector:f=null,maskTextClass:g="rr-mask",maskTextSelector:_=null,inlineStylesheet:y=!0,maskAllInputs:v,maskInputOptions:b,slimDOMOptions:S,maskInputFn:I,maskTextFn:x,hooks:T,packFn:O,sampling:R={},dataURLOptions:N={},mousemoveWait:P,recordDOM:D=!0,recordCanvas:Z=!1,recordCrossOriginIframes:A=!1,recordAfter:L=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:j=!1,collectFonts:q=!1,inlineImages:U=!1,plugins:B,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:W=new Set([]),errorHandler:K}=e;!function registerErrorHandler(e){nr=e}(K);const H=!A||window.parent===window;let G=!1;if(!H)try{window.parent.document&&(G=!1)}catch(ie){G=!0}if(H&&!r)throw new Error("emit function is required");void 0!==P&&void 0===R.mousemove&&(R.mousemove=P),gr.reset();const J=!0===v?{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!==b?b:{password:!0},Y=!0===S||"all"===S?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===S,headMetaDescKeywords:"all"===S}:S||{};let X;!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 Q=0;const eventProcessor=e=>{for(const r of B||[])r.eventProcessor&&(e=r.eventProcessor(e));return O&&!G&&(e=O(e)),e};pr=(e,s)=>{var a;if(!(null===(a=ir[0])||void 0===a?void 0:a.isFrozen())||e.type===Xt.FullSnapshot||e.type===Xt.IncrementalSnapshot&&e.data.source===Qt.Mutation||ir.forEach((e=>e.unfreeze())),H)null==r||r(eventProcessor(e),s);else if(G){const r={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:s};window.parent.postMessage(r,"*")}if(e.type===Xt.FullSnapshot)X=e,Q=0;else if(e.type===Xt.IncrementalSnapshot){if(e.data.source===Qt.Mutation&&e.data.isAttachIframe)return;Q++;const r=o&&Q>=o,s=i&&e.timestamp-X.timestamp>i;(r||s)&&hr(!0)}};const wrappedMutationEmit=e=>{pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.Mutation},e)}))},wrappedScrollEmit=e=>pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.Scroll},e)})),wrappedCanvasMutationEmit=e=>pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.CanvasMutation},e)})),ee=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.AdoptedStyleSheet},e)}))}),te=new IframeManager({mirror:gr,mutationCb:wrappedMutationEmit,stylesheetManager:ee,recordCrossOriginIframes:A,wrappedEmit:pr});for(const oe of B||[])oe.getMirror&&oe.getMirror({nodeMirror:gr,crossOriginIframeMirror:te.crossOriginIframeMirror,crossOriginIframeStyleMirror:te.crossOriginIframeStyleMirror});const re=new ProcessedNodeManager;fr=new CanvasManager({recordCanvas:Z,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:s,blockSelector:a,mirror:gr,sampling:R.canvas,dataURLOptions:N});const ne=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:g,maskTextSelector:_,inlineStylesheet:y,maskInputOptions:J,dataURLOptions:N,maskTextFn:x,maskInputFn:I,recordCanvas:Z,inlineImages:U,sampling:R,slimDOMOptions:Y,iframeManager:te,stylesheetManager:ee,canvasManager:fr,keepIframeSrcFn:z,processedNodeManager:re},mirror:gr});hr=(e=!1)=>{if(!D)return;pr(wrapEvent({type:Xt.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),ee.reset(),ne.init(),ir.forEach((e=>e.lock()));const r=function snapshot(e,r){const{mirror:i=new Mirror,blockClass:o="rr-block",blockSelector:s=null,maskTextClass:a="rr-mask",maskTextSelector:h=null,inlineStylesheet:f=!0,inlineImages:g=!1,recordCanvas:_=!1,maskAllInputs:y=!1,maskTextFn:v,maskInputFn:b,slimDOM:S=!1,dataURLOptions:I,preserveWhiteSpace:x,onSerialize:T,onIframeLoad:O,iframeLoadTimeout:R,onStylesheetLoad:N,stylesheetLoadTimeout:P,keepIframeSrcFn:D=()=>!1}=r||{};return serializeNodeWithId(e,{doc:e,mirror:i,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:h,skipChild:!1,inlineStylesheet:f,maskInputOptions:!0===y?{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===y?{password:!0}:y,maskTextFn:v,maskInputFn:b,slimDOMOptions:!0===S||"all"===S?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===S,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===S?{}:S,dataURLOptions:I,inlineImages:g,recordCanvas:_,preserveWhiteSpace:x,onSerialize:T,onIframeLoad:O,iframeLoadTimeout:R,onStylesheetLoad:N,stylesheetLoadTimeout:P,keepIframeSrcFn:D,newlyAddedElement:!1})}(document,{mirror:gr,blockClass:s,blockSelector:a,maskTextClass:g,maskTextSelector:_,inlineStylesheet:y,maskAllInputs:J,maskTextFn:x,slimDOM:Y,dataURLOptions:N,recordCanvas:Z,inlineImages:U,onSerialize:e=>{isSerializedIframe(e,gr)&&te.addIframe(e),isSerializedStylesheet(e,gr)&&ee.trackLinkElement(e),hasShadowRoot(e)&&ne.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,r)=>{te.attachIframe(e,r),ne.observeAttachShadow(e)},onStylesheetLoad:(e,r)=>{ee.attachLinkElement(e,r)},keepIframeSrcFn:z});if(!r)return console.warn("Failed to snapshot the document");pr(wrapEvent({type:Xt.FullSnapshot,data:{node:r,initialOffset:getWindowScroll(window)}}),e),ir.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ee.adoptStyleSheets(document.adoptedStyleSheets,gr.getId(document))};try{const e=[],observe=e=>{var r;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,r)=>pr(wrapEvent({type:Xt.IncrementalSnapshot,data:{source:r,positions:e}})),mouseInteractionCb:e=>pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.ViewportResize},e)})),inputCb:e=>pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.Input},e)})),mediaInteractionCb:e=>pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.MediaInteraction},e)})),styleSheetRuleCb:e=>pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.StyleSheetRule},e)})),styleDeclarationCb:e=>pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.Font},e)})),selectionCb:e=>{pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.Selection},e)}))},customElementCb:e=>{pr(wrapEvent({type:Xt.IncrementalSnapshot,data:Object.assign({source:Qt.CustomElement},e)}))},blockClass:s,ignoreClass:h,ignoreSelector:f,maskTextClass:g,maskTextSelector:_,maskInputOptions:J,inlineStylesheet:y,sampling:R,recordDOM:D,recordCanvas:Z,inlineImages:U,userTriggeredOnInput:j,collectFonts:q,doc:e,maskInputFn:I,maskTextFn:x,keepIframeSrcFn:z,blockSelector:a,slimDOMOptions:Y,dataURLOptions:N,mirror:gr,iframeManager:te,stylesheetManager:ee,shadowDomManager:ne,processedNodeManager:re,canvasManager:fr,ignoreCSSAttributes:W,plugins:(null===(r=null==B?void 0:B.filter((e=>e.observer)))||void 0===r?void 0:r.map((e=>({observer:e.observer,options:e.options,callback:r=>pr(wrapEvent({type:Xt.Plugin,data:{plugin:e.name,payload:r}}))}))))||[]},T)};te.addLoadListener((r=>{try{e.push(observe(r.contentDocument))}catch(Cr){console.warn(Cr)}}));const init2=()=>{hr(),e.push(observe(document)),mr=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{pr(wrapEvent({type:Xt.DomContentLoaded,data:{}})),"DOMContentLoaded"===L&&init2()}))),e.push(on("load",(()=>{pr(wrapEvent({type:Xt.Load,data:{}})),"load"===L&&init2()}),window))),()=>{e.forEach((e=>e())),re.destroy(),mr=!1,function unregisterErrorHandler(){nr=void 0}()}}catch(Cr){console.warn(Cr)}}record.addCustomEvent=(e,r)=>{if(!mr)throw new Error("please add custom event after start recording");pr(wrapEvent({type:Xt.Custom,data:{tag:e,payload:r}}))},record.freezePage=()=>{ir.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!mr)throw new Error("please take full snapshot after start recording");hr(e)},record.mirror=gr;var _r,yr=(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))(yr||{}),vr=(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))(vr||{}),br={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var Sr={hostname:""};_r={navigator:{userAgent:"",onLine:!0},document:{location:Sr,referrer:""},screen:{width:0,height:0},location:Sr}}else _r=window;var kr,wr,Ir,xr,Er,Cr,Tr,Or,Rr,Mr,Nr=864e5,Pr=8e3,Dr=Array.prototype,Zr=Function.prototype,Ar=Object.prototype,Lr=Dr.slice,jr=Ar.toString,Fr=Ar.hasOwnProperty,qr=_r.console,$r=_r.navigator,Ur=_r.document,Br=_r.opera,zr=_r.screen,Vr=$r.userAgent,Wr=Zr.bind,Kr=Dr.forEach,Hr=Dr.indexOf,Gr=Dr.map,Jr=Array.isArray,Yr={},Xr={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},Qr={log:function(){if(br.DEBUG&&!Xr.isUndefined(qr)&&qr)try{qr.log.apply(qr,arguments)}catch(e){Xr.each(arguments,(function(e){qr.log(e)}))}},warn:function(){if(br.DEBUG&&!Xr.isUndefined(qr)&&qr){var e=["Mixpanel warning:"].concat(Xr.toArray(arguments));try{qr.warn.apply(qr,e)}catch(r){Xr.each(e,(function(e){qr.warn(e)}))}}},error:function(){if(br.DEBUG&&!Xr.isUndefined(qr)&&qr){var e=["Mixpanel error:"].concat(Xr.toArray(arguments));try{qr.error.apply(qr,e)}catch(r){Xr.each(e,(function(e){qr.error(e)}))}}},critical:function(){if(!Xr.isUndefined(qr)&&qr){var e=["Mixpanel error:"].concat(Xr.toArray(arguments));try{qr.error.apply(qr,e)}catch(r){Xr.each(e,(function(e){qr.error(e)}))}}}},log_func_with_prefix=function(e,r){return function(){return arguments[0]="["+r+"] "+arguments[0],e.apply(Qr,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(Qr.log,e),error:log_func_with_prefix(Qr.error,e),critical:log_func_with_prefix(Qr.critical,e)}};Xr.bind=function(e,r){var i,o;if(Wr&&e.bind===Wr)return Wr.apply(e,Lr.call(arguments,1));if(!Xr.isFunction(e))throw new TypeError;return i=Lr.call(arguments,2),o=function(){if(!(this instanceof o))return e.apply(r,i.concat(Lr.call(arguments)));var s={};s.prototype=e.prototype;var a=new s;s.prototype=null;var h=e.apply(a,i.concat(Lr.call(arguments)));return Object(h)===h?h:a},o},Xr.each=function(e,r,i){if(null!=e)if(Kr&&e.forEach===Kr)e.forEach(r,i);else if(e.length===+e.length){for(var o=0,s=e.length;o<s;o++)if(o in e&&r.call(i,e[o],o,e)===Yr)return}else for(var a in e)if(Fr.call(e,a)&&r.call(i,e[a],a,e)===Yr)return},Xr.extend=function(e){return Xr.each(Lr.call(arguments,1),(function(r){for(var i in r)void 0!==r[i]&&(e[i]=r[i])})),e},Xr.isArray=Jr||function(e){return"[object Array]"===jr.call(e)},Xr.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(r){return!1}},Xr.isArguments=function(e){return!(!e||!Fr.call(e,"callee"))},Xr.toArray=function(e){return e?e.toArray?e.toArray():Xr.isArray(e)||Xr.isArguments(e)?Lr.call(e):Xr.values(e):[]},Xr.map=function(e,r,i){if(Gr&&e.map===Gr)return e.map(r,i);var o=[];return Xr.each(e,(function(e){o.push(r.call(i,e))})),o},Xr.keys=function(e){var r=[];return null===e||Xr.each(e,(function(e,i){r[r.length]=i})),r},Xr.values=function(e){var r=[];return null===e||Xr.each(e,(function(e){r[r.length]=e})),r},Xr.include=function(e,r){var i=!1;return null===e?i:Hr&&e.indexOf===Hr?-1!=e.indexOf(r):(Xr.each(e,(function(e){if(i||(i=e===r))return Yr})),i)},Xr.includes=function(e,r){return-1!==e.indexOf(r)},Xr.inherit=function(e,r){return e.prototype=new r,e.prototype.constructor=e,e.superclass=r.prototype,e},Xr.isObject=function(e){return e===Object(e)&&!Xr.isArray(e)},Xr.isEmptyObject=function(e){if(Xr.isObject(e)){for(var r in e)if(Fr.call(e,r))return!1;return!0}return!1},Xr.isUndefined=function(e){return void 0===e},Xr.isString=function(e){return"[object String]"==jr.call(e)},Xr.isDate=function(e){return"[object Date]"==jr.call(e)},Xr.isNumber=function(e){return"[object Number]"==jr.call(e)},Xr.isElement=function(e){return!(!e||1!==e.nodeType)},Xr.encodeDates=function(e){return Xr.each(e,(function(r,i){Xr.isDate(r)?e[i]=Xr.formatDate(r):Xr.isObject(r)&&(e[i]=Xr.encodeDates(r))})),e},Xr.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Xr.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())},Xr.strip_empty_properties=function(e){var r={};return Xr.each(e,(function(e,i){Xr.isString(e)&&e.length>0&&(r[i]=e)})),r},Xr.truncate=function(e,r){var i;return"string"==typeof e?i=e.slice(0,r):Xr.isArray(e)?(i=[],Xr.each(e,(function(e){i.push(Xr.truncate(e,r))}))):Xr.isObject(e)?(i={},Xr.each(e,(function(e,o){i[o]=Xr.truncate(e,r)}))):i=e,i},Xr.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="",o=0,s="",a="",h=0,f=i,g=[],_=r[e];switch(_&&"object"==typeof _&&"function"==typeof _.toJSON&&(_=_.toJSON(e)),typeof _){case"string":return quote(_);case"number":return isFinite(_)?String(_):"null";case"boolean":case"null":return String(_);case"object":if(!_)return"null";if(i+=" ",g=[],"[object Array]"===jr.apply(_)){for(h=_.length,o=0;o<h;o+=1)g[o]=str(o,_)||"null";return a=0===g.length?"[]":i?"[\n"+i+g.join(",\n"+i)+"\n"+f+"]":"["+g.join(",")+"]",i=f,a}for(s in _)Fr.call(_,s)&&(a=str(s,_))&&g.push(quote(s)+(i?": ":":")+a);return a=0===g.length?"{}":i?"{"+g.join(",")+f+"}":"{"+g.join(",")+"}",i=f,a}};return str("",{"":e})}}(),Xr.JSONDecode=(Er={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Cr=function(e){var r=new SyntaxError(e);throw r.at=kr,r.text=Ir,r},Tr=function(e){return e&&e!==wr&&Cr("Expected '"+e+"' instead of '"+wr+"'"),wr=Ir.charAt(kr),kr+=1,wr},Or=function(){var e,r="";for("-"===wr&&(r="-",Tr("-"));wr>="0"&&wr<="9";)r+=wr,Tr();if("."===wr)for(r+=".";Tr()&&wr>="0"&&wr<="9";)r+=wr;if("e"===wr||"E"===wr)for(r+=wr,Tr(),"-"!==wr&&"+"!==wr||(r+=wr,Tr());wr>="0"&&wr<="9";)r+=wr,Tr();if(e=+r,isFinite(e))return e;Cr("Bad number")},Rr=function(){var e,r,i,o="";if('"'===wr)for(;Tr();){if('"'===wr)return Tr(),o;if("\\"===wr)if(Tr(),"u"===wr){for(i=0,r=0;r<4&&(e=parseInt(Tr(),16),isFinite(e));r+=1)i=16*i+e;o+=String.fromCharCode(i)}else{if("string"!=typeof Er[wr])break;o+=Er[wr]}else o+=wr}Cr("Bad string")},Mr=function(){for(;wr&&wr<=" ";)Tr()},xr=function(){switch(Mr(),wr){case"{":return function(){var e,r={};if("{"===wr){if(Tr("{"),Mr(),"}"===wr)return Tr("}"),r;for(;wr;){if(e=Rr(),Mr(),Tr(":"),Object.hasOwnProperty.call(r,e)&&Cr('Duplicate key "'+e+'"'),r[e]=xr(),Mr(),"}"===wr)return Tr("}"),r;Tr(","),Mr()}}Cr("Bad object")}();case"[":return function(){var e=[];if("["===wr){if(Tr("["),Mr(),"]"===wr)return Tr("]"),e;for(;wr;){if(e.push(xr()),Mr(),"]"===wr)return Tr("]"),e;Tr(","),Mr()}}Cr("Bad array")}();case'"':return Rr();case"-":return Or();default:return wr>="0"&&wr<="9"?Or():function(){switch(wr){case"t":return Tr("t"),Tr("r"),Tr("u"),Tr("e"),!0;case"f":return Tr("f"),Tr("a"),Tr("l"),Tr("s"),Tr("e"),!1;case"n":return Tr("n"),Tr("u"),Tr("l"),Tr("l"),null}Cr('Unexpected "'+wr+'"')}()}},function(e){var r;return Ir=e,kr=0,wr=" ",r=xr(),Mr(),wr&&Cr("Syntax error"),r}),Xr.base64Encode=function(e){var r,i,o,s,a,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",f=0,g=0,_="",y=[];if(!e)return e;e=Xr.utf8Encode(e);do{r=(a=e.charCodeAt(f++)<<16|e.charCodeAt(f++)<<8|e.charCodeAt(f++))>>18&63,i=a>>12&63,o=a>>6&63,s=63&a,y[g++]=h.charAt(r)+h.charAt(i)+h.charAt(o)+h.charAt(s)}while(f<e.length);switch(_=y.join(""),e.length%3){case 1:_=_.slice(0,-2)+"==";break;case 2:_=_.slice(0,-1)+"="}return _},Xr.utf8Encode=function(e){var r,i,o,s,a="";for(r=i=0,o=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<o;s++){var h=e.charCodeAt(s),f=null;h<128?i++:f=h>127&&h<2048?String.fromCharCode(h>>6|192,63&h|128):String.fromCharCode(h>>12|224,h>>6&63|128,63&h|128),null!==f&&(i>r&&(a+=e.substring(r,i)),a+=f,r=i=s+1)}return i>r&&(a+=e.substring(r,e.length)),a},Xr.UUID=function(){var T2=function(){var e,r=1*new Date;if(_r.performance&&_r.performance.now)e=_r.performance.now();else for(e=0;r==1*new Date;)e++;return r.toString(16)+Math.floor(e).toString(16)};return function(){var e=(zr.height*zr.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,r,i=Vr,o=[],s=0;function xor(e,r){var i,s=0;for(i=0;i<r.length;i++)s|=o[i]<<8*i;return e^s}for(e=0;e<i.length;e++)r=i.charCodeAt(e),o.unshift(255&r),o.length>=4&&(s=xor(s,o),o=[]);return o.length>0&&(s=xor(s,o)),s.toString(16)}()+"-"+e+"-"+T2()}}();var en=["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"];Xr.isBlockedUA=function(e){var r;for(e=e.toLowerCase(),r=0;r<en.length;r++)if(-1!==e.indexOf(en[r]))return!0;return!1},Xr.HTTPBuildQuery=function(e,r){var i,o,s=[];return Xr.isUndefined(r)&&(r="&"),Xr.each(e,(function(e,r){i=encodeURIComponent(e.toString()),o=encodeURIComponent(r),s[s.length]=o+"="+i})),s.join(r)},Xr.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 o=i[1];try{o=decodeURIComponent(o)}catch(s){Qr.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Xr.cookie={get:function(e){for(var r=e+"=",i=Ur.cookie.split(";"),o=0;o<i.length;o++){for(var s=i[o];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(r))return decodeURIComponent(s.substring(r.length,s.length))}return null},parse:function(e){var r;try{r=Xr.JSONDecode(Xr.cookie.get(e))||{}}catch(i){}return r},set_seconds:function(e,r,i,o,s,a,h){var f="",g="",_="";if(h)f="; domain="+h;else if(o){var y=extract_domain(Ur.location.hostname);f=y?"; domain=."+y:""}if(i){var v=new Date;v.setTime(v.getTime()+1e3*i),g="; expires="+v.toGMTString()}a&&(s=!0,_="; SameSite=None"),s&&(_+="; secure"),Ur.cookie=e+"="+encodeURIComponent(r)+g+"; path=/"+f+_},set:function(e,r,i,o,s,a,h){var f="",g="",_="";if(h)f="; domain="+h;else if(o){var y=extract_domain(Ur.location.hostname);f=y?"; domain=."+y:""}if(i){var v=new Date;v.setTime(v.getTime()+24*i*60*60*1e3),g="; expires="+v.toGMTString()}a&&(s=!0,_="; SameSite=None"),s&&(_+="; secure");var b=e+"="+encodeURIComponent(r)+g+"; path=/"+f+_;return Ur.cookie=b,b},remove:function(e,r,i){Xr.cookie.set(e,"",-1,r,!1,!1,i)}};var tn=null,localStorageSupported=function(e,r){if(null!==tn&&!r)return tn;var i=!0;try{e=e||window.localStorage;var o="__mplss_"+cheap_guid(8);e.setItem(o,"xyz"),"xyz"!==e.getItem(o)&&(i=!1),e.removeItem(o)}catch(s){i=!1}return tn=i,i};Xr.localStorage={is_supported:function(e){var r=localStorageSupported(null,e);return r||Qr.error("localStorage unsupported; falling back to cookie store"),r},error:function(e){Qr.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(r){Xr.localStorage.error(r)}return null},parse:function(e){try{return Xr.JSONDecode(Xr.localStorage.get(e))||{}}catch(r){}return null},set:function(e,r){try{window.localStorage.setItem(e,r)}catch(i){Xr.localStorage.error(i)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(r){Xr.localStorage.error(r)}}},Xr.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,o,s){if(e)if(e.addEventListener&&!o)e.addEventListener(r,i,!!s);else{var a="on"+r,h=e[a];e[a]=function makeHandler(e,r,i){var handler=function(o){if(o=o||fixEvent(window.event)){var s,a,h=!0;return Xr.isFunction(i)&&(s=i(o)),a=r.call(e,o),!1!==s&&!1!==a||(h=!1),h}};return handler}(e,i,h)}else Qr.error("No valid element provided to register_event")}}();var rn=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');Xr.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(r,i){var o=" "+i+" ";return(" "+r.className+" ").replace(e," ").indexOf(o)>=0}function getElementsBySelector(e){if(!Ur.getElementsByTagName)return[];var r,i,o,s,a,h,f,g,_,y,v=e.split(" "),b=[Ur];for(h=0;h<v.length;h++)if((r=v[h].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){o=(i=r.split("#"))[0];var S=i[1],I=Ur.getElementById(S);if(!I||o&&I.nodeName.toLowerCase()!=o)return[];b=[I]}else if(r.indexOf(".")>-1){o=(i=r.split("."))[0];var x=i[1];for(o||(o="*"),s=[],a=0,f=0;f<b.length;f++)for(_="*"==o?getAllChildren(b[f]):b[f].getElementsByTagName(o),g=0;g<_.length;g++)s[a++]=_[g];for(b=[],y=0,f=0;f<s.length;f++)s[f].className&&Xr.isString(s[f].className)&&hasClass(s[f],x)&&(b[y++]=s[f])}else{var T=r.match(rn);if(T){o=T[1];var O,R=T[2],N=T[3],P=T[4];for(o||(o="*"),s=[],a=0,f=0;f<b.length;f++)for(_="*"==o?getAllChildren(b[f]):b[f].getElementsByTagName(o),g=0;g<_.length;g++)s[a++]=_[g];switch(b=[],y=0,N){case"=":O=function(e){return e.getAttribute(R)==P};break;case"~":O=function(e){return e.getAttribute(R).match(new RegExp("\\b"+P+"\\b"))};break;case"|":O=function(e){return e.getAttribute(R).match(new RegExp("^"+P+"-?"))};break;case"^":O=function(e){return 0===e.getAttribute(R).indexOf(P)};break;case"$":O=function(e){return e.getAttribute(R).lastIndexOf(P)==e.getAttribute(R).length-P.length};break;case"*":O=function(e){return e.getAttribute(R).indexOf(P)>-1};break;default:O=function(e){return e.getAttribute(R)}}for(b=[],y=0,f=0;f<s.length;f++)O(s[f])&&(b[y++]=s[f])}else{for(o=r,s=[],a=0,f=0;f<b.length;f++)for(_=b[f].getElementsByTagName(o),g=0;g<_.length;g++)s[a++]=_[g];b=s}}return b}return function(e){return Xr.isElement(e)?[e]:Xr.isObject(e)&&!Xr.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var nn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],sn=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];Xr.info={campaignParams:function(e){var r="",i={};return Xr.each(nn,(function(o){(r=Xr.getQueryParam(Ur.URL,o)).length?i[o]=r:void 0!==e&&(i[o]=e)})),i},clickParams:function(){var e="",r={};return Xr.each(sn,(function(i){(e=Xr.getQueryParam(Ur.URL,i)).length&&(r[i]=e)})),r},marketingParams:function(){return Xr.extend(Xr.info.campaignParams(),Xr.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=Xr.info.searchEngine(e),i="yahoo"!=r?"q":"p",o={};if(null!==r){o.$search_engine=r;var s=Xr.getQueryParam(e,i);s.length&&(o.mp_keyword=s)}return o},browser:function(e,r,i){return r=r||"",i||Xr.includes(e," OPR/")?Xr.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":Xr.includes(e,"IEMobile")||Xr.includes(e,"WPDesktop")?"Internet Explorer Mobile":Xr.includes(e,"SamsungBrowser/")?"Samsung Internet":Xr.includes(e,"Edge")||Xr.includes(e,"Edg/")?"Microsoft Edge":Xr.includes(e,"FBIOS")?"Facebook Mobile":Xr.includes(e,"Chrome")?"Chrome":Xr.includes(e,"CriOS")?"Chrome iOS":Xr.includes(e,"UCWEB")||Xr.includes(e,"UCBrowser")?"UC Browser":Xr.includes(e,"FxiOS")?"Firefox iOS":Xr.includes(r,"Apple")?Xr.includes(e,"Mobile")?"Mobile Safari":"Safari":Xr.includes(e,"Android")?"Android Mobile":Xr.includes(e,"Konqueror")?"Konqueror":Xr.includes(e,"Firefox")?"Firefox":Xr.includes(e,"MSIE")||Xr.includes(e,"Trident/")?"Internet Explorer":Xr.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,r,i){var o={"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+)?)/}[Xr.info.browser(e,r,i)];if(void 0===o)return null;var s=e.match(o);return s?parseFloat(s[s.length-2]):null},os:function(){var e=Vr;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 _r.location.href},properties:function(e){return"object"!=typeof e&&(e={}),Xr.extend(Xr.strip_empty_properties({$os:Xr.info.os(),$browser:Xr.info.browser(Vr,$r.vendor,Br),$referrer:Ur.referrer,$referring_domain:Xr.info.referringDomain(Ur.referrer),$device:Xr.info.device(Vr)}),{$current_url:Xr.info.currentUrl(),$browser_version:Xr.info.browserVersion(Vr,$r.vendor,Br),$screen_height:zr.height,$screen_width:zr.width,mp_lib:"web",$lib_version:br.LIB_VERSION,$insert_id:cheap_guid(),time:Xr.timestamp()/1e3},Xr.strip_empty_properties(e))},people_properties:function(){return Xr.extend(Xr.strip_empty_properties({$os:Xr.info.os(),$browser:Xr.info.browser(Vr,$r.vendor,Br)}),{$browser_version:Xr.info.browserVersion(Vr,$r.vendor,Br)})},mpPageViewProperties:function(){return Xr.strip_empty_properties({current_page_title:Ur.title,current_domain:_r.location.hostname,current_url_path:_r.location.pathname,current_url_protocol:_r.location.protocol,current_url_search:_r.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},an=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,cn=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var r=cn,i=e.split("."),o=i[i.length-1];(o.length>4||"com"===o||"org"===o)&&(r=an);var s=e.match(r);return s?s[0]:""},dn=null,un=null;"undefined"!=typeof JSON&&(dn=JSON.stringify,un=JSON.parse),dn=dn||Xr.JSONEncode,un=un||Xr.JSONDecode,Xr.toArray=Xr.toArray,Xr.isObject=Xr.isObject,Xr.JSONEncode=Xr.JSONEncode,Xr.JSONDecode=Xr.JSONDecode,Xr.isBlockedUA=Xr.isBlockedUA,Xr.isEmptyObject=Xr.isEmptyObject,Xr.info=Xr.info,Xr.info.device=Xr.info.device,Xr.info.browser=Xr.info.browser,Xr.info.browserVersion=Xr.info.browserVersion,Xr.info.properties=Xr.info.properties;var ln="__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||_r,i=r.navigator||{},o=!1;return Xr.each([i.doNotTrack,i.msDoNotTrack,r.doNotTrack],(function(e){Xr.includes([!0,1,"1","yes"],e)&&(o=!0)})),o}(r))return Qr.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&&Qr.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?Xr.localStorage:Xr.cookie}function _getStorageKey(e,r){return((r=r||{}).persistencePrefix||ln)+e}function _getStorageValue(e,r){return _getStorage(r).get(_getStorageKey(e,r))}function _optInOut(e,r,i){Xr.isString(r)&&r.length?(_getStorage(i=i||{}).set(_getStorageKey(r,i),e?1:0,Xr.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})):Qr.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,r){return function(){var i=!1;try{var o=r.call(this,"token"),s=r.call(this,"ignore_dnt"),a=r.call(this,"opt_out_tracking_persistence_type"),h=r.call(this,"opt_out_tracking_cookie_prefix"),f=r.call(this,"window");o&&(i=hasOptedOut(o,{ignoreDnt:s,persistenceType:a,persistencePrefix:h,window:f}))}catch(_){Qr.error("Unexpected error when checking tracking opt-out status: "+_)}if(!i)return e.apply(this,arguments);var g=arguments[arguments.length-1];"function"==typeof g&&g(0)}}var pn=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 o=i||(new Date).getTime()+"|"+Math.random(),s=(new Date).getTime(),a=this.storageKey,h=this.pollIntervalMS,f=this.timeoutMS,g=this.storage,_=a+":X",y=a+":Y",v=a+":Z",reportError=function(e){r&&r(e)},delay=function(e){if((new Date).getTime()-s>f)return pn.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+o+"]"),g.removeItem(v),g.removeItem(y),void loop();setTimeout((function(){try{e()}catch(r){reportError(r)}}),h*(Math.random()+.1))},waitFor=function(e,r){e()?r():delay((function(){waitFor(e,r)}))},getSetY=function(){var e=g.getItem(y);if(e&&e!==o)return!1;if(g.setItem(y,o),g.getItem(y)===o)return!0;if(!localStorageSupported(g,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){g.setItem(_,o),waitFor(getSetY,(function(){g.getItem(_)!==o?delay((function(){g.getItem(y)===o?waitFor((function(){return!g.getItem(v)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){g.setItem(v,"1");try{e()}finally{g.removeItem(v),g.getItem(y)===o&&g.removeItem(y),g.getItem(_)===o&&g.removeItem(_)}};try{if(!localStorageSupported(g,!0))throw new Error("localStorage support check failed");loop()}catch(b){reportError(b)}};var hn=console_with_prefix("batch"),RequestQueue=function(e,r){r=r||{},this.storageKey=e,this.storage=r.storage||window.localStorage,this.reportError=r.errorReporter||Xr.bind(hn.error,hn),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 o={id:cheap_guid(),flushAfter:(new Date).getTime()+2*r,payload:e};this.usePersistence?this.lock.withLock(Xr.bind((function lockAcquired(){var r;try{var s=this.readFromStorage();s.push(o),(r=this.saveToStorage(s))&&this.memQueue.push(o)}catch(a){this.reportError("Error enqueueing item",e),r=!1}i&&i(r)}),this),Xr.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),i&&i(!1)}),this),this.pid):(this.memQueue.push(o),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 o={};Xr.each(r,(function(e){o[e.id]=!0}));for(var s=0;s<i.length;s++){var a=i[s];if((new Date).getTime()>a.flushAfter&&!o[a.id]&&(a.orphaned=!0,r.push(a),r.length>=e))break}}}return r};var filterOutIDsAndInvalid=function(e,r){var i=[];return Xr.each(e,(function(e){e.id&&!r[e.id]&&i.push(e)})),i};RequestQueue.prototype.removeItemsByID=function(e,r){var i={};if(Xr.each(e,(function(e){i[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,i),this.usePersistence){var o=Xr.bind((function(){var r;try{var o=this.readFromStorage();if(o=filterOutIDsAndInvalid(o,i),r=this.saveToStorage(o)){o=this.readFromStorage();for(var s=0;s<o.length;s++){var a=o[s];if(a.id&&i[a.id])return this.reportError("Item not removed from storage"),!1}}}catch(h){this.reportError("Error removing items",e),r=!1}return r}),this);this.lock.withLock((function lockAcquired(){var e=o();r&&r(e)}),Xr.bind((function lockFailure(e){var i=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(i=o()))try{this.storage.removeItem(this.storageKey)}catch(s){this.reportError("Error clearing queue",s)}r&&r(i)}),this),this.pid)}else r&&r(!0)};var updatePayloads=function(e,r){var i=[];return Xr.each(e,(function(e){var o=e.id;if(o in r){var s=r[o];null!==s&&(e.payload=s,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(Xr.bind((function lockAcquired(){var i;try{var o=this.readFromStorage();o=updatePayloads(o,e),i=this.saveToStorage(o)}catch(s){this.reportError("Error updating items",e),i=!1}r&&r(i)}),this),Xr.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=un(e),Xr.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,dn(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 fn=console_with_prefix("batch"),RequestBatcher=function(e,r){this.errorReporter=r.errorReporter,this.queue=new RequestQueue(e,{errorReporter:Xr.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(Xr.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void fn.log("Flush: Request already in progress");e=e||{};var r=this.libConfig.batch_request_timeout_ms,i=(new Date).getTime(),o=this.batchSize,s=this.queue.fillBatch(o),a=s.length===o,h=[],f={};if(Xr.each(s,(function(e){var r=e.payload;if(this.beforeSendHook&&!e.orphaned&&(r=this.beforeSendHook(r)),r){r.event&&r.properties&&(r.properties=Xr.extend({},r.properties,{mp_sent_by_lib_version:br.LIB_VERSION}));var i=!0,o=e.id;o?(this.itemIdsSentSuccessfully[o]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[o]}),i=!1):this.reportError("[dupe] found item with no ID",{item:e}),i&&h.push(r)}f[e.id]=r}),this),h.length<1)return void this.resetFlush();this.requestInProgress=!0;var g=Xr.bind((function(h){this.requestInProgress=!1;try{var g=!1;if(e.unloading)this.queue.updatePayloads(f);else if(Xr.isObject(h)&&"timeout"===h.error&&(new Date).getTime()-i>=r)this.reportError("Network timeout; retrying"),this.flush();else if(Xr.isObject(h)&&(h.httpStatusCode>=500||429===h.httpStatusCode||h.httpStatusCode<=0&&(v=_r.navigator.onLine,!Xr.isUndefined(v)&&!v)||"timeout"===h.error)){var _=2*this.flushInterval;h.retryAfter&&(_=1e3*parseInt(h.retryAfter,10)||_),_=Math.min(6e5,_),this.reportError("Error; retry in "+_+" ms"),this.scheduleFlush(_)}else if(Xr.isObject(h)&&413===h.httpStatusCode)if(s.length>1){var y=Math.max(1,Math.floor(o/2));this.batchSize=Math.min(this.batchSize,y,s.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",s),this.resetBatchSize(),g=!0;else g=!0;g&&(this.queue.removeItemsByID(Xr.map(s,(function(e){return e.id})),Xr.bind((function(e){e?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!a?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)),Xr.each(s,Xr.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:s.length,timesSent:this.itemIdsSentSuccessfully[r]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(b){this.reportError("Error handling API response",b),this.resetFlush()}var v}),this),_={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:r};e.unloading&&(_.transport="sendBeacon"),fn.log("MIXPANEL REQUEST:",h),this.sendRequest(h,_,g)}catch(y){this.reportError("Error flushing request queue",y),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,r){if(fn.error.apply(fn.error,arguments),this.errorReporter)try{r instanceof Error||(r=new Error(e)),this.errorReporter(e,r)}catch(i){fn.error(i)}};var mn=console_with_prefix("recorder"),gn=_r.CompressionStream,_n={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},yn=new Set([vr.MouseMove,vr.MouseInteraction,vr.Scroll,vr.ViewportResize,vr.Input,vr.TouchMove,vr.MediaInteraction,vr.Drag,vr.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=Nr,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:_n,sendRequestFunc:Xr.bind(this.flushEventsWithOptOut,this),errorReporter:Xr.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>Nr&&(this.recordMaxMs=Nr,mn.critical("record_max_ms cannot be greater than "+Nr+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>Pr&&(this.recordMinMs=Pr,mn.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=Xr.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var r=Xr.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(Xr.bind((function(){mn.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:Xr.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===yr.IncrementalSnapshot&&yn.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(Xr.bind(this.resetRecording,this),this.recordMaxMs)}else mn.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,Xr.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,r,i,o){var s=Xr.bind((function(r,i){200===r.status&&this.replayId===e&&this.seqNo++,o({status:0,httpStatusCode:r.status,responseBody:i,retryAfter:r.headers.get("Retry-After")})}),this);_r.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){s(e,r)})).catch((function(e){o({error:e})}))})).catch((function(e){o({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,r,i){const o=e.length;if(o>0){var s=this.replayId,a=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=a);var h=e[o-1].timestamp-this.replayStartTime,f={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:a/1e3,replay_id:s,replay_length_ms:h,replay_start_time:this.replayStartTime/1e3},g=Xr.JSONEncode(e),_=this._mixpanel.get_property("$device_id");_&&(f.$device_id=_);var y=this._mixpanel.get_property("$user_id");if(y&&(f.$user_id=y),gn){var v=new Blob([g],{type:"application/json"}).stream().pipeThrough(new gn("gzip"));new Response(v).blob().then(Xr.bind((function(e){f.format="gzip",this._sendRequest(s,f,e,i)}),this))}else f.format="body",this._sendRequest(s,f,g,i)}})),MixpanelRecorder.prototype.reportError=function(e,r){mn.error.apply(mn.error,arguments);try{r||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,r)}catch(i){mn.error(i)}},_r.__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,o){var s=this,a=Xr.dom_query(e);if(0!==a.length)return Xr.each(a,(function(e){Xr.register_event(e,this.override_event,(function(e){var a={},h=s.create_properties(i,this),f=s.mp.get_config("track_links_timeout");s.event_handler(e,this,a),window.setTimeout(s.track_callback(o,h,a,!0),f),s.mp.track(r,h,s.track_callback(o,h,a))}))}),this),!0;Qr.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,r,i,o){o=o||!1;var s=this;return function(){i.callback_fired||(i.callback_fired=!0,e&&!1===e(o,r)||s.after_track_handler(r,i,o))}},DomTracker.prototype.create_properties=function(e,r){return"function"==typeof e?e(r):Xr.extend({},e)};var LinkTracker=function(){this.override_event="click"};Xr.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"};Xr.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 vn="$set",bn="$set_once",Sn="$unset",kn="$add",wn="$append",In="$union",xn="$remove",En={set_action:function(e,r){var i={},o={};return Xr.isObject(e)?Xr.each(e,(function(e,r){this._is_reserved_property(r)||(o[r]=e)}),this):o[e]=r,i[vn]=o,i},unset_action:function(e){var r={},i=[];return Xr.isArray(e)||(e=[e]),Xr.each(e,(function(e){this._is_reserved_property(e)||i.push(e)}),this),r[Sn]=i,r},set_once_action:function(e,r){var i={},o={};return Xr.isObject(e)?Xr.each(e,(function(e,r){this._is_reserved_property(r)||(o[r]=e)}),this):o[e]=r,i[bn]=o,i},union_action:function(e,r){var i={},o={};return Xr.isObject(e)?Xr.each(e,(function(e,r){this._is_reserved_property(r)||(o[r]=Xr.isArray(e)?e:[e])}),this):o[e]=Xr.isArray(r)?r:[r],i[In]=o,i},append_action:function(e,r){var i={},o={};return Xr.isObject(e)?Xr.each(e,(function(e,r){this._is_reserved_property(r)||(o[r]=e)}),this):o[e]=r,i[wn]=o,i},remove_action:function(e,r){var i={},o={};return Xr.isObject(e)?Xr.each(e,(function(e,r){this._is_reserved_property(r)||(o[r]=e)}),this):o[e]=r,i[xn]=o,i},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};Xr.extend(MixpanelGroup.prototype,En),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 o=this.set_action(e,r);return Xr.isObject(e)&&(i=r),this._send_request(o,i)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,r,i){var o=this.set_once_action(e,r);return Xr.isObject(e)&&(i=r),this._send_request(o,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){Xr.isObject(e)&&(i=r);var o=this.union_action(e,r);return this._send_request(o,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 o=this.remove_action(e,r);return this._send_request(o,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=Xr.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(){};Xr.extend(MixpanelPeople.prototype,En),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,r,i){var o=this.set_action(e,r);return Xr.isObject(e)&&(i=r),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),o[vn]=Xr.extend({},Xr.info.people_properties(),o[vn]),this._send_request(o,i)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,r,i){var o=this.set_once_action(e,r);return Xr.isObject(e)&&(i=r),this._send_request(o,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 o={},s={};return Xr.isObject(e)?(Xr.each(e,(function(e,r){if(!this._is_reserved_property(r)){if(isNaN(parseFloat(e)))return void Qr.error("Invalid increment value passed to mixpanel.people.increment - must be a number");s[r]=e}}),this),i=r):(Xr.isUndefined(r)&&(r=1),s[e]=r),o[kn]=s,this._send_request(o,i)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,r,i){Xr.isObject(e)&&(i=r);var o=this.append_action(e,r);return this._send_request(o,i)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,r,i){Xr.isObject(e)&&(i=r);var o=this.remove_action(e,r);return this._send_request(o,i)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,r,i){Xr.isObject(e)&&(i=r);var o=this.union_action(e,r);return this._send_request(o,i)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,r,i){if(Xr.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",Xr.extend({$amount:e},r),i);Qr.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)}Qr.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"),o=this._mixpanel.get_property("$user_id"),s=this._mixpanel.get_property("$had_persisted_distinct_id");i&&(e.$device_id=i),o&&(e.$user_id=o),s&&(e.$had_persisted_distinct_id=s);var a=Xr.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:a,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},r):(this._enqueue(e),Xr.isUndefined(r)||(this._get_config("verbose")?r({status:-1,error:null}):r(-1)),Xr.truncate(a,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){vn in e?this._mixpanel.persistence._add_to_people_queue(vn,e):bn in e?this._mixpanel.persistence._add_to_people_queue(bn,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):xn in e?this._mixpanel.persistence._add_to_people_queue(xn,e):In in e?this._mixpanel.persistence._add_to_people_queue(In,e):Qr.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,r,i,o){var s=this,a=Xr.extend({},this._mixpanel.persistence.load_queue(e)),h=a;Xr.isUndefined(a)||!Xr.isObject(a)||Xr.isEmptyObject(a)||(s._mixpanel.persistence._pop_from_people_queue(e,a),s._mixpanel.persistence.save(),o&&(h=o(a)),r.call(s,h,(function(r,o){0===r&&s._mixpanel.persistence._add_to_people_queue(e,a),Xr.isUndefined(i)||i(r,o)})))},MixpanelPeople.prototype._flush=function(e,r,i,o,s,a,h){var f=this;this._flush_one_queue(vn,this.set,e),this._flush_one_queue(bn,this.set_once,o),this._flush_one_queue(Sn,this.unset,a,(function(e){return Xr.keys(e)})),this._flush_one_queue(kn,this.increment,r),this._flush_one_queue(In,this.union,s);var g=this._mixpanel.persistence.load_queue(wn);if(!Xr.isUndefined(g)&&Xr.isArray(g)&&g.length)for(var _,append_callback=function(e,r){0===e&&f._mixpanel.persistence._add_to_people_queue(wn,_),Xr.isUndefined(i)||i(e,r)},y=g.length-1;y>=0;y--)g=this._mixpanel.persistence.load_queue(wn),_=g.pop(),f._mixpanel.persistence.save(),Xr.isEmptyObject(_)||f.append(_,append_callback);var v=this._mixpanel.persistence.load_queue(xn);if(!Xr.isUndefined(v)&&Xr.isArray(v)&&v.length)for(var b,remove_callback=function(e,r){0===e&&f._mixpanel.persistence._add_to_people_queue(xn,b),Xr.isUndefined(h)||h(e,r)},S=v.length-1;S>=0;S--)v=this._mixpanel.persistence.load_queue(xn),b=v.pop(),f._mixpanel.persistence.save(),Xr.isEmptyObject(b)||f.remove(b,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 Cn,Tn="__mps",On="__mpso",Rn="__mpus",Mn="__mpa",Nn="__mpap",Pn="__mpr",Dn="__mpu",Zn="$people_distinct_id",An="__alias",Ln="__timers",jn=[Tn,On,Rn,Mn,Nn,Pn,Dn,Zn,An,Ln],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&&(Qr.critical("Unknown persistence type "+r+"; falling back to cookie"),r=e.persistence="cookie"),"localStorage"===r&&Xr.localStorage.is_supported()?this.storage=Xr.localStorage:this.storage=Xr.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),Xr.each(this.props,(function(r,i){Xr.include(jn,i)||(e[i]=r)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Xr.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,r;this.storage===Xr.localStorage?(e=Xr.cookie.parse(this.name),Xr.cookie.remove(this.name),Xr.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===Xr.cookie&&(r=Xr.localStorage.parse(this.name),Xr.localStorage.remove(this.name),r&&this.register_once(r))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,Xr.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!!Xr.isObject(e)&&(void 0===r&&(r="None"),this.expire_days=void 0===i?this.default_expiry:i,this.load(),Xr.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!!Xr.isObject(e)&&(this.expire_days=void 0===r?this.default_expiry:r,this.load(),Xr.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(Xr.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:Xr.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return Xr.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),o=r[e],s=this._get_or_create_queue(vn),a=this._get_or_create_queue(bn),h=this._get_or_create_queue(Sn),f=this._get_or_create_queue(kn),g=this._get_or_create_queue(In),_=this._get_or_create_queue(xn,[]),y=this._get_or_create_queue(wn,[]);i===Tn?(Xr.extend(s,o),this._pop_from_people_queue(kn,o),this._pop_from_people_queue(In,o),this._pop_from_people_queue(Sn,o)):i===On?(Xr.each(o,(function(e,r){r in a||(a[r]=e)})),this._pop_from_people_queue(Sn,o)):i===Rn?Xr.each(o,(function(e){Xr.each([s,a,f,g],(function(r){e in r&&delete r[e]})),Xr.each(y,(function(r){e in r&&delete r[e]})),h[e]=!0})):i===Mn?(Xr.each(o,(function(e,r){r in s?s[r]+=e:(r in f||(f[r]=0),f[r]+=e)}),this),this._pop_from_people_queue(Sn,o)):i===Dn?(Xr.each(o,(function(e,r){Xr.isArray(e)&&(r in g||(g[r]=[]),g[r]=g[r].concat(e))})),this._pop_from_people_queue(Sn,o)):i===Pn?(_.push(o),this._pop_from_people_queue(wn,o)):i===Nn&&(y.push(o),this._pop_from_people_queue(Sn,o)),Qr.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Qr.log(r),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,r){var i=this.props[this._get_queue_key(e)];Xr.isUndefined(i)||Xr.each(r,(function(r,o){e===wn||e===xn?Xr.each(i,(function(e){e[o]===r&&delete e[o]})):delete i[o]}),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===vn?Tn:e===bn?On:e===Sn?Rn:e===kn?Mn:e===wn?Nn:e===xn?Pn:e===In?Dn:void Qr.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,r){var i=this._get_queue_key(e);return r=Xr.isUndefined(r)?{}:r,this.props[i]||(this.props[i]=r)},MixpanelPersistence.prototype.set_event_timer=function(e,r){var i=this.load_prop(Ln)||{};i[e]=r,this.props[Ln]=i,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var r=(this.load_prop(Ln)||{})[e];return Xr.isUndefined(r)||(delete this.props[Ln][e],this.save()),r};var Fn,load_extra_bundle=function(e,r){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},qn="mixpanel",$n="base64",Un="$device:",Bn=_r.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,zn=!Bn&&-1===Vr.indexOf("MSIE")&&-1===Vr.indexOf("Mozilla"),Vn=null;$r.sendBeacon&&(Vn=function(){return $r.sendBeacon.apply($r,arguments)});var Wn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},Kn={api_host:"https://api-js.mixpanel.com",api_routes:Wn,api_method:"POST",api_transport:"XHR",api_payload_format:$n,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:Nr,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},Hn=!1,MixpanelLib=function(){},create_mplib=function(e,r,i){var o,s=i===qn?Fn:Fn[i];if(s&&0===Cn)o=s;else{if(s&&!Xr.isArray(s))return void Qr.error("You have already initialized "+i);o=new MixpanelLib}if(o._cached_groups={},o._init(e,r,i),o.people=new MixpanelPeople,o.people._init(o),!o.get_config("skip_first_touch_marketing")){var a=Xr.info.campaignParams(null),h={},f=!1;Xr.each(a,(function(e,r){h["initial_"+r]=e,e&&(f=!0)})),f&&o.people.set_once(h)}return br.DEBUG=br.DEBUG||o.get_config("debug"),!Xr.isUndefined(s)&&Xr.isArray(s)&&(o._execute_array.call(o.people,s.people),o._execute_array(s)),o};MixpanelLib.prototype.init=function(e,r,i){if(Xr.isUndefined(i))this.report_error("You must name your new library: init(token, config, name)");else{if(i!==qn){var o=create_mplib(e,r,i);return Fn[i]=o,o._loaded(),o}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 o={};"api_payload_format"in r||(r.api_host||Kn.api_host).match(/\.mixpanel\.com/)&&(o.api_payload_format="json");if(this.set_config(Xr.extend({},Kn,o,r,{name:i,token:e,callback_fn:(i===qn?i:qn+"."+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(Xr.localStorage.is_supported(!0)&&Bn){if(this.init_batchers(),Vn&&_r.addEventListener){var s=Xr.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);_r.addEventListener("pagehide",(function(e){e.persisted&&s()})),_r.addEventListener("visibilitychange",(function(){"hidden"===Ur.visibilityState&&s()}))}}else this._batch_requests=!1,Qr.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),Xr.each(this.get_batcher_configs(),(function(e){Qr.log("Clearing batch queue "+e.queue_key),Xr.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=Xr.UUID();this.get_distinct_id()||this.register_once({distinct_id:Un+a,$device_id:a},"");var h=this.get_config("track_pageview");h&&this._init_url_change_tracking(h),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(_r.MutationObserver){var e=Xr.bind((function(){this._recorder=this._recorder||new _r.__mp_recorder(this),this._recorder.startRecording()}),this);Xr.isUndefined(_r.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else Qr.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():Qr.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=Xr.info.campaignParams(null);Xr.each(e,function(e,r){this.unregister(r)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(Ur.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(Xr.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(Ur.referrer)},MixpanelLib.prototype._dom_loaded=function(){Xr.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||Xr.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(!Hn)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=Xr.info.currentUrl()),Xr.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){_r.addEventListener("popstate",(function(){_r.dispatchEvent(new Event("mp_locationchange"))})),_r.addEventListener("hashchange",(function(){_r.dispatchEvent(new Event("mp_locationchange"))}));var i=_r.history.pushState;"function"==typeof i&&(_r.history.pushState=function(e,r,o){i.call(_r.history,e,r,o),_r.dispatchEvent(new Event("mp_locationchange"))});var o=_r.history.replaceState;"function"==typeof o&&(_r.history.replaceState=function(e,r,i){o.call(_r.history,e,r,i),_r.dispatchEvent(new Event("mp_locationchange"))}),_r.addEventListener("mp_locationchange",function(){var i=Xr.info.currentUrl(),o=!1;("full-url"===e?o=i!==r:"url-with-path-and-query-string"===e?o=i.split("#")[0]!==r.split("#")[0]:"url-with-path"===e&&(o=i.split("#")[0].split("?")[0]!==r.split("#")[0].split("?")[0]),o)&&(this.track_pageview()&&(r=i))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,r){if(Xr.isUndefined(e))return null;if(Bn){return function(i){e(i,r)}}var i=this._jsc,o=""+Math.floor(1e8*Math.random()),s=this.get_config("callback_fn")+"["+o+"]";return i[o]=function(s){delete i[o],e(s,r)},s},MixpanelLib.prototype._send_request=function(e,r,i,o){var s=!0;if(zn)return this.__request_queue.push(arguments),s;var a={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},h=null;o||!Xr.isFunction(i)&&"string"!=typeof i||(o=i,i=null),i=Xr.extend(a,i||{}),Bn||(i.method="GET");var f="POST"===i.method,g=Vn&&f&&"sendbeacon"===i.transport.toLowerCase(),_=i.verbose;r.verbose&&(_=!0),this.get_config("test")&&(r.test=1),_&&(r.verbose=1),this.get_config("img")&&(r.img=1),Bn||(o?r.callback=o:(_||this.get_config("test"))&&(r.callback="(function(){})")),r.ip=this.get_config("ip")?1:0,r._=(new Date).getTime().toString(),f&&(h="data="+encodeURIComponent(r.data),delete r.data),e+="?"+Xr.HTTPBuildQuery(r);var y=this;if("img"in r){var v=Ur.createElement("img");v.src=e,Ur.body.appendChild(v)}else if(g){try{s=Vn(e,h)}catch(O){y.report_error(O),s=!1}try{o&&o(s?1:0)}catch(O){y.report_error(O)}}else if(Bn)try{var b=new XMLHttpRequest;b.open(i.method,e,!0);var S=this.get_config("xhr_headers");if(f&&(S["Content-Type"]="application/x-www-form-urlencoded"),Xr.each(S,(function(e,r){b.setRequestHeader(r,e)})),i.timeout_ms&&void 0!==b.timeout){b.timeout=i.timeout_ms;var I=(new Date).getTime()}b.withCredentials=!0,b.onreadystatechange=function(){var e;if(4===b.readyState)if(200===b.status){if(o)if(_){var r;try{r=Xr.JSONDecode(b.responseText)}catch(O){if(y.report_error(O),!i.ignore_json_errors)return;r=b.responseText}o(r)}else o(Number(b.responseText))}else if(e=b.timeout&&!b.status&&(new Date).getTime()-I>=b.timeout?"timeout":"Bad HTTP status: "+b.status+" "+b.statusText,y.report_error(e),o)if(_){var s=b.responseHeaders||{};o({status:0,httpStatusCode:b.status,error:e,retryAfter:s["Retry-After"]})}else o(0)},b.send(h)}catch(O){y.report_error(O),s=!1}else{var x=Ur.createElement("script");x.type="text/javascript",x.async=!0,x.defer=!0,x.src=e;var T=Ur.getElementsByTagName("script")[0];T.parentNode.insertBefore(x,T)}return s},MixpanelLib.prototype._execute_array=function(e){var r,i=[],o=[],s=[];Xr.each(e,(function(e){e&&(r=e[0],Xr.isArray(r)?s.push(e):"function"==typeof e?e.call(this):Xr.isArray(e)&&"alias"===r?i.push(e):Xr.isArray(e)&&-1!==r.indexOf("track")&&"function"==typeof this[r]?s.push(e):o.push(e))}),this);var execute=function(e,r){Xr.each(e,(function(e){if(Xr.isArray(e[0])){var i=r;Xr.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(o,this),execute(s,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=Xr.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:Xr.bind((function(r,i,o){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(r),i,this._prepare_callback(o,r))}),this),beforeSendHook:Xr.bind((function(r){return this._run_hook("before_send_"+e.type,r)}),this),stopAllBatchingFunc:Xr.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,Xr.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,Xr.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=Xr.JSONEncode(e);return this.get_config("api_payload_format")===$n&&(r=Xr.base64Encode(r)),{data:r}},MixpanelLib.prototype._track_or_batch=function(e,r){var i=Xr.truncate(e.data,255),o=e.endpoint,s=e.batcher,a=e.should_send_immediately,h=e.send_request_options||{};r=r||NOOP_FUNC;var f=!0,g=Xr.bind((function(){return h.skip_hooks||(i=this._run_hook("before_send_"+e.type,i)),i?(Qr.log("MIXPANEL REQUEST:"),Qr.log(i),this._send_request(o,this._encode_data_for_request(i),h,this._prepare_callback(r,i))):null}),this);return this._batch_requests&&!a?s.enqueue(i,(function(e){e?r(1,i):g()})):f=g(),f&&i},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,r,i,o){o||"function"!=typeof i||(o=i,i=null);var s=(i=i||{}).transport;s&&(i.transport=s);var a=i.send_immediately;if("function"!=typeof o&&(o=NOOP_FUNC),Xr.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(r=Xr.extend({},r)).token=this.get_config("token");var h=this.persistence.remove_event_timer(e);if(!Xr.isUndefined(h)){var f=(new Date).getTime()-h;r.$duration=parseFloat((f/1e3).toFixed(3))}this._set_default_superprops();var g=this.get_config("track_marketing")?Xr.info.marketingParams():{};r=Xr.extend({},Xr.info.properties({mp_loader:this.get_config("mp_loader")}),g,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),r);var _=this.get_config("property_blacklist");Xr.isArray(_)?Xr.each(_,(function(e){delete r[e]})):this.report_error("Invalid value for property_blacklist config: "+_);var y={event:e,properties:r};return this._track_or_batch({type:"events",data:y,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:a,send_request_options:i},o)}o(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,r,i){Xr.isArray(r)||(r=[r]);var o={};return o[e]=r,this.register(o),this.people.set(e,r,i)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,r,i){var o=this.get_property(e),s={};return void 0===o?(s[e]=[r],this.register(s)):-1===o.indexOf(r)&&(o.push(r),s[e]=o,this.register(s)),this.people.union(e,r,i)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,r,i){var o=this.get_property(e);if(void 0!==o){var s=o.indexOf(r);s>-1&&(o.splice(s,1),this.register({group_key:o})),0===o.length&&this.unregister(e)}return this.people.remove(e,r,i)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,r,i,o){var s=Xr.extend({},r||{});return Xr.each(i,(function(e,r){null!=e&&(s[r]=e)})),this.track(e,s,o)})),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),o=this._cached_groups[i];return void 0!==o&&o._group_key===e&&o._group_id===r||((o=new MixpanelGroup)._init(this,e,r),this._cached_groups[i]=o),o},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,r){"object"!=typeof e&&(e={});var i=(r=r||{}).event_name||"$mp_web_page_view",o=Xr.extend(Xr.info.mpPageViewProperties(),Xr.info.campaignParams(),Xr.info.clickParams()),s=Xr.extend({},o,e);return this.track(i,s)})),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){Xr.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 Gn={persistent:!0},options_for_register=function(e){var r;return r=Xr.isObject(e)?e:Xr.isUndefined(e)?{}:{days:e},Xr.extend({},Gn,r)};MixpanelLib.prototype.register=function(e,r){var i=options_for_register(r);i.persistent?this.persistence.register(e,i.days):Xr.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,r,i){var o=options_for_register(i);o.persistent?this.persistence.register_once(e,r,o.days):(void 0===r&&(r="None"),Xr.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,o,s,a,h,f){var g=this.get_distinct_id();if(e&&g!==e){if("string"==typeof e&&0===e.indexOf(Un))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var _=g;this.register_once({$had_persisted_distinct_id:!0,$device_id:_},"")}e!==g&&e!==this.get_property(An)&&(this.unregister(An),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(r,i,o,s,a,h,f),e!==g&&this.track("$identify",{distinct_id:e,$anon_distinct_id:g},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=Xr.UUID();this.register_once({distinct_id:Un+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(Zn))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var i=this;return Xr.isUndefined(r)&&(r=this.get_distinct_id()),e!==r?(this._register_single(An,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){Xr.isObject(e)&&(Xr.extend(this.config,e),e.batch_size&&Xr.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),br.DEBUG=br.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,Lr.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!==qn&&(e=qn+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return Xr.isBlockedUA(Vr)||this._flags.disable_all_events||Xr.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&Xr.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")&&!Xr.cookie.get("mp_optout")||(Xr.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=Xr.extend({track:Xr.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),Xr.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=Xr.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=Xr.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=Xr.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,r){Qr.error.apply(Qr.error,arguments);try{r||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,r)}catch(i){Qr.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=Wn,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 Jn={},override_mp_init_func=function(){Fn.init=function(e,r,i){if(i)return Fn[i]||(Fn[i]=Jn[i]=create_mplib(e,r,i),Fn[i]._loaded()),Fn[i];var o=Fn;Jn[qn]?o=Jn[qn]:e&&((o=create_mplib(e,r,qn))._loaded(),Jn[qn]=o),Fn=o,1===Cn&&(_r[qn]=Fn),Xr.each(Jn,(function(e,r){r!==qn&&(Fn[r]=e)})),Fn._=Xr}};var Yn=function init_as_module(e){return load_extra_bundle=e,Cn=0,Fn=new MixpanelLib,override_mp_init_func(),Fn.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,Hn=!0,zn=!1,Xr.each(Jn,(function(e){e._dom_loaded()})))}if(Ur.addEventListener)"complete"===Ur.readyState?dom_loaded_handler():Ur.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(Ur.attachEvent){Ur.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===_r.frameElement}catch(r){}Ur.documentElement.doScroll&&e&&function do_scroll_check(){try{Ur.documentElement.doScroll("left")}catch(r){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}Xr.register_event(_r,"load",dom_loaded_handler,!0)}(),Fn}((function loadNoop(e,r){r()}));const Xn="mp_distinct_id";function isReady(){return void 0!==window.mixpanel}function updateCachedDistinctId(e){localStorage.setItem(Xn,e)}const Qn={init:function init$2(e,r=!1,i){return new Promise((o=>{Yn.init(e,{debug:r,loaded:()=>{window.mixpanel=Yn,o()},...i&&{api_host:i}})}))},isReady:isReady,track:function track(e,r){isReady()&&Yn.track(e,{...r,"Reservamos Version":"1.0.13"})},identify:function identify$1(e,r){Yn.identify(e),updateCachedDistinctId(e),Yn.people.set(r)},attachProperty:function attachProperty(e,r){isReady()&&Yn.people.union(e,[r])},getMixpanelDistinctId:()=>{const e=localStorage.getItem(Xn);if(Yn&&Yn.get_distinct_id){const e=Yn.get_distinct_id();return updateCachedDistinctId(e),e}return e||null}},ei=Ee.object({firstName:Ee.string().optional(),lastName:Ee.string().optional(),email:Ee.string().email().optional(),phone:Ee.string().optional()}),ti=["web","web-mobile","ios","android","app"],ri=Ee.enum(ti).refine((e=>ti.includes(e)),{message:`Product must be one of: ${ti.join(", ")}`}),ni=Ee.object({product:ri});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=>Ee.string().refine((e=>e),{message:`${e} must be a string`}),numberField=e=>Ee.number().refine((e=>e),{message:`${e} must be a number`}),intField=e=>Ee.number().int().refine((e=>e),{message:`${e} must be an integer`}),dateField=e=>Ee.string().refine(dateValidation,{message:`Invalid ${e} datetime format`}),arrayField=(e,r,i)=>Ee.array(e).min(i,`${r} must have at least ${i} items`),ii=Ee.object({Origin:stringField("Origin").optional(),Destination:stringField("Destination").optional(),Departure:dateField("Departure").optional(),Return:dateField("Return").optional(),"Departure Date":stringField("Departure Date").optional(),product:ri});const oi=Ee.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(),si=Ee.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":Ee.boolean(),"Recommended Trip Type":stringField("Recommended Trip Type").optional()}),ai=Ee.object({Trips:arrayField(si,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count").optional(),Total:numberField("Total"),product:ri,Passengers:arrayField(oi,"Passengers",1).optional()}).strict();const ci=Ee.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(si,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),"Payment Type":Ee.string().min(1,"Payment Type is required"),Total:numberField("Total"),product:ri,Passengers:arrayField(oi,"Passengers",1).optional(),Insurance:(di="Insurance",Ee.boolean({required_error:`${di} is required`,invalid_type_error:`${di} must be a boolean`})).optional(),Coupon:stringField("Coupon").optional(),"User Status":stringField("User Status").optional()}).strict();var di;const ui=Ee.object({Arrival:Ee.string().refine(dateValidation,{message:"Invalid arrival datetime format"}),Departure:Ee.string().refine(dateValidation,{message:"Invalid departure datetime format"}),Destination:Ee.string().min(1,"Destination is required"),"Destination Terminal":Ee.string().min(1,"Destination terminal is required"),Line:Ee.string().min(1,"Line is required").optional(),Origin:Ee.string().min(1,"Origin is required"),"Origin Terminal":Ee.string().min(1,"Origin terminal is required"),Price:Ee.number().positive("Price must be a positive number"),"Result Position":Ee.number().int("Result Position must be an integer"),Route:Ee.string().min(1,"Route is required"),Stops:Ee.number().int("Stops must be an integer").nonnegative("Stops must be non-negative"),"Transport Type":Ee.string().min(1,"Transport Type is required"),Transporter:Ee.string().min(1,"Transporter is required"),product:ri,"Recommended Trip":Ee.boolean(),"Recommended Trip Type":Ee.string().optional(),"Trip Type":Ee.string().min(1,"Trip Type is required"),"Bus Type":Ee.string().min(1,"Bus Type is required")});const li=Ee.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(si,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),Total:numberField("Total"),product:ri,Passengers:arrayField(oi,"Passengers",1).optional()}).strict();const pi=Ee.object({Departure:Ee.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),"Departure Delta":Ee.number().int("Departure Delta must be an integer"),Destination:Ee.string().min(1,"Destination is required"),"Destination Terminal":Ee.string().min(1,"Destination terminal is required"),Origin:Ee.string().min(1,"Origin is required"),"Origin Terminal":Ee.string().min(1,"Origin terminal is required"),Passengers:Ee.number().int("Passenger count must be an integer"),Return:Ee.string().refine(dateValidation,{message:"Invalid Return date or datetime format. Must include at least YYYY-MM-DD"}).optional(),Route:Ee.string().min(1,"Route is required"),"Trip Length":Ee.number().positive().optional(),Categories:Ee.array(Ee.string()).optional(),product:ri});const hi=Ee.object({Arrival:Ee.string().refine(dateValidation,{message:"Invalid arrival date or datetime format. Must include at least YYYY-MM-DD"}),Departure:Ee.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),Destination:Ee.string().min(1,"Destination is required"),"Destination Terminal":Ee.string().min(1,"Destination Terminal is required"),Line:Ee.string().min(1,"Line is required").optional(),Origin:Ee.string().min(1,"Origin is required"),"Origin Terminal":Ee.string().min(1,"Origin Terminal is required"),Price:Ee.number().positive("Price must be a positive number"),Route:Ee.string().min(1,"Route is required"),Stops:Ee.number().int("Stops must be an integer").nonnegative().optional(),Tickets:Ee.number().int("Tickets must be an integer").positive(),Transporter:Ee.string().min(1,"Transporter is required"),Way:Ee.enum(["Departure","Return"],{description:"Way must be either 'Departure' or 'Return'"}),product:ri});const fi=Ee.object({"Bus count":Ee.number().int("Bus count must be an integer"),Departure:Ee.string().refine(dateValidation,{message:"Invalid departure datetime format"}),"Departure Delta":Ee.number().int("Departure Delta must be an integer").optional(),Destination:Ee.string().min(1,"Destination is required").optional(),"Destination Terminal":Ee.string().min(1,"Destination terminal is required").optional(),"Has Frequent Buses":Ee.boolean().default(!1).optional(),Origin:Ee.string().min(1,"Origin is required"),"Origin Terminal":Ee.string().min(1,"Origin terminal is required"),Route:Ee.string().min(1,"Route is required"),product:ri}),mi=Ee.object({mixpanelToken:Ee.string().min(1,"Mixpanel token is required"),debug:Ee.boolean().optional(),identificationKey:Ee.string().min(1,"Identification key is required"),isSandbox:Ee.boolean().optional(),mixpanelProxyUrl:Ee.string().optional(),identifyProxyUrl:Ee.string().optional()}),SchemaErrorFormatter=e=>e.issues.map((e=>{let r="INVALID_FIELD",i="",o="",s="";return"invalid_type"===e.code?(r="TYPE_MISMATCH",i=e.expected,o=e.received,s=`Expected ${i} but received ${o}. Please provide a value of type ${i}.`):"too_small"===e.code?(r="VALUE_TOO_SMALL",s=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(r="VALUE_TOO_BIG",s=`Reduce the value to no more than ${e.maximum}.`):(r="INVALID_FIELD",s="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:r,expected:i,received:o,message:e.message,suggestion:s}})),gi={Search:pi,"Seat Change":hi,"Interest In Home":ni,"Passengers Created":ai,"Payment Attempt":ci,"Interest In Search":ii,"View Results":fi,"Purchase Attempt":li,"Picked Departure":ui};function validateProps(e,r){try{r.parse(e)}catch(Cr){if(Cr instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Cr)}}throw{message:"Unknown validation error"}}}const _i={parseEventProps:function parseEventProps(e,r){const i=gi[e]||Te;try{i.parse(r)}catch(Cr){if(Cr instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Cr)}}throw{message:"Unknown validation error"}}},parseInitProps:function parseInitProps(e){validateProps(e,mi)},parseIdentifyProps:function parseIdentifyProps(e){validateProps(e,ei)},validateProps:validateProps};function isTrackerReady(){return Qn.isReady()}let yi=null;const vi="geolocationPermissionTimestamp",bi=6048e5;function updatePermissionTimestamp(e){localStorage.setItem(vi,e.toString())}const Si={init:function init(){return new Promise((e=>{if(function isPermissionTimestampValid(e){return!!e&&Date.now()-parseInt(e,10)<bi}(localStorage.getItem(vi)))return void e(yi);const r="Geolocation Requested",i=Date.now();navigator.geolocation.getCurrentPosition((o=>{const{latitude:s,longitude:a}=o.coords;yi={lat:s,long:a},updatePermissionTimestamp(i),isTrackerReady()&&trackCustomEvent(r,{geolocationAccepted:!0}),e(yi)}),(()=>{updatePermissionTimestamp(i),isTrackerReady()&&trackCustomEvent(r,{geolocationAccepted:!1}),e(null)}))}))},getCoordinates:function getCoordinates(){return yi}},ki=["Search","View Results"],wi={utm_brand:"UTM Brand",utm_kxconfig:"UTM KXConfig",gad_source:"GAD Source",gclid:"GCLID"};function trackEventError(e,r,i){tryTrackEvent((async()=>{try{Qn.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(o){console.error("Failed to track error event:",o)}}))}async function tryTrackEvent(e){Qn.isReady()?await e():window.addEventListener("Tracker Ready",(async()=>{await e()}))}async function trackEvent(e,r,i={}){if(!Qn.isReady())throw new Error("Mixpanel is not initialized.");try{_i.parseEventProps(e,r);const o=!ki.includes(e);Qn.getMixpanelDistinctId();const s=await mt.getFingerprint(o),a={},h=Si.getCoordinates();h&&(a.$latitude=h.lat,a.$longitude=h.long);const f={"User Fingerprint":s},g=function extractTrackingParams(){try{const e=new URLSearchParams(window.location.search),r={};return Object.entries(wi).forEach((([i,o])=>{const s=e.get(i);s&&(r[o]=s)})),r}catch(Cr){return console.error("Error extracting tracking parameters:",Cr),{}}}(),_=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),y={...f,..._,...g,...a,...i};Qn.track(e,y)}catch(Cr){console.error(`Error tracking event '${e}':`,Cr),trackEventError(e,Cr,r)}}function trackCustomEvent(e,r={},i={}){try{Oe.parse(e),trackEvent(e,r,i)}catch(Cr){console.error("Error trackCustomEvent:",Cr),trackEventError(e,Cr,r)}}const Ii=Ee.object({email:Ee.string().email().optional(),phone:Ee.string().optional(),cpf:Ee.string().optional(),passport:Ee.string().optional(),rg:Ee.string().optional(),firstName:Ee.string().optional(),lastName:Ee.string().optional()}).refine((e=>e.email||e.phone),{message:"At least one of 'email' or 'phone' must be provided"});async function createAnonymousProfile(e){try{_i.validateProps(e,Ii);const r=[],i=mt.getCachedFingerprint(),o=Qn.getMixpanelDistinctId();i&&r.push({key:"fingerprint",value:i}),o&&r.push({key:"distinct_id",value:o});const s=function getAnonymousProfilePayload(e,r){let i="phone",o=e.phone||"";const s=[],a={};e.email&&(i="email",o=e.email);const h=["cpf","passport","rg","email","phone","salesforceid"],f=["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(),h.includes(e)&&r?e!==i&&s.push({key:e,value:r}):f.includes(e)&&r&&(a[e]=r)})),r.length&&r.forEach((e=>s.push(e))),{identifier_key:i,identifier_value:o,details:a,identifiers:s}}(e,r);return await Rt.profiles.createAnonymousProfile(s)}catch(Cr){return void console.error("Could not create anonymous profile:",Cr)}}const xi=["firstName","lastName","email","phone"];Ee.object({"Operation Id":stringField("Operation Id"),Trips:arrayField(si,"Trips",1).optional(),"Passenger Count":numberField("Passenger Count").optional(),Total:numberField("Total").optional(),"Trip Count":numberField("Trip Count").optional(),product:ri,Passengers:arrayField(oi,"Passengers",1).optional()});const Ei=Ee.object({id:Ee.number(),first_name:Ee.string(),last_name:Ee.string(),second_last_name:Ee.string(),category:Ee.string(),bus_category:Ee.string(),gender:Ee.string(),email:Ee.string()}),Ci=Ee.object({passengers:Ee.array(Ei).min(1)});const Ti=Ee.object({category:Ee.string(),number:Ee.string().optional(),occupied:Ee.boolean().optional(),adjacent_seats:Ee.null().optional()}),Oi=Ee.object({bus:Ee.array(Ee.array(Ee.array(Ti)))}),Ri=Ee.object({bus_type:Ee.string(),selected_seats:Ee.string(),bus_scheme:Oi});const Mi=Ee.object({category:Ee.string(),number:Ee.string().optional(),occupied:Ee.boolean().optional(),adjacent_seats:Ee.null().optional()}),Ni=Ee.object({bus:Ee.array(Ee.array(Ee.array(Mi)))}),Pi=Ee.object({bus_scheme:Ni,total_seats:Ee.number()});const Di=Ee.object({searchId:Ee.number().min(1,"SearchId is required")});const Zi={init:async function init$1(e){_i.parseInitProps(e);const{mixpanelToken:r,debug:i=!1,identificationKey:o,isSandbox:s=!1,mixpanelProxyUrl:a,identifyProxyUrl:h}=e;Si.init(),await Qn.init(r,i,a);try{await mt.initFingerprint(o,h)}catch(Cr){console.error("Error initializing identification service:",Cr)}Dt.setEnvironment(s?"sandbox":"prod"),Rt.setConfig(Dt.getCoreAPIConfig()),function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},isReady:isTrackerReady,identify:async function identify(e,r={}){tryTrackEvent((async()=>{try{if(_i.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 o=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)=>(xi.includes(i)||(r[i]=e[i]),r)),{})}}(r);Qn.identify(e,o);const s=await mt.getFingerprint();s&&Qn.attachProperty("Known Fingerprints",s)}catch(Cr){console.error("Error identifying user",Cr),trackEventError("Identify",Cr,{userId:e,properties:r})}finally{(async(e,r)=>{var i,o;try{const s=Si.getCoordinates();if(!s)return;r.first_name=r.firstName,r.last_name=r.lastName,r.latitude=s.lat,r.longitude=s.long,r.ip="0",r.name=`${r.firstName} ${r.lastName}`,delete r.firstName,delete r.lastName;const a=Dt.getCoreAPIConfig();fetch(`${a.baseUrl}/v1/datalake/identify`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:(null==(i=a.defaultHeaders)?void 0:i.Authorization)||"",Origin:(null==(o=a.defaultHeaders)?void 0:o.Origin)||""},body:JSON.stringify({profile_params:{...r,distinct_id:e}})})}catch(Cr){console.error("Error identifying user-service",Cr)}})(e,r)}}))},identifiers:{getFingerprintId:mt.getCachedFingerprint,getDistinctId:Qn.getMixpanelDistinctId},profiles:{createAnonymousProfile:createAnonymousProfile},recommendations:{getRecommendedPlaces:async function getRecommendedPlaces(){const e=Qn.getMixpanelDistinctId();if(!e)throw new Error("No distinct ID found");const r=await Rt.recommendations.createRecommendedPlaces({distinct_id:e});if(!r)throw new Error("No response received");return await(async e=>new Promise(((r,i)=>{const{state:o,polling_id:s}=e;"finished"!==o?Rt.recommendations.pollRecommendedPlaces(s,{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{_i.validateProps(e,Ri);const r=Qn.getMixpanelDistinctId(),i=mt.getCachedFingerprint();if(!r)throw new Error("No distinct ID found");return await Rt.recommendations.createRecommendedSeats({...e,distinct_id:r,device_fingerprint:i||""})}catch(Cr){throw console.error("Could not create recommended seats:",Cr),new Error(Cr instanceof Error?Cr.message:String(Cr))}},getRecommendedSeats:async function createRecommendedSeats(e){try{_i.validateProps(e,Pi);const r=Qn.getMixpanelDistinctId();if(!r)throw new Error("No distinct ID found");return await Rt.recommendations.getRecommendedSeats({...e,distinct_id:r})}catch(Cr){throw console.error("Could not create recommended seats:",Cr),new Error(Cr instanceof Error?Cr.message:String(Cr))}},getRecommendedTrips:async function getRecommendedTrips({searchId:e}){try{_i.validateProps({searchId:e},Di);const r=mt.getCachedFingerprint()||Qn.getMixpanelDistinctId();if(!r)throw new Error("No identifier id");return await Rt.recommendations.getRecommendedTrips({searchId:e,userIdentifier:String(r)})}catch(Cr){throw console.error("Could not get recommended trips:",Cr),new Error(Cr instanceof Error?Cr.message:String(Cr))}},createFrequentPassengers:async function createFrequentPassengers(e){try{_i.validateProps(e,Ci);const r=Qn.getMixpanelDistinctId(),i=mt.getCachedFingerprint();if(!r)throw new Error("No distinct ID found");return await Rt.recommendations.createFrequentPassengers({...e,distinct_id:r,device_fingerprint:i||""})}catch(Cr){throw new Error(Cr instanceof Error?Cr.message:String(Cr))}},getFrequentPassengers:async function getFrequentPassengers(){try{const e=Qn.getMixpanelDistinctId();if(!e)throw new Error("No distinct ID found");return await Rt.recommendations.getFrequentPassengers(e)}catch(Cr){throw new Error(Cr instanceof Error?Cr.message:String(Cr))}}},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)}}};return Zi}();
30
+ function __awaiter2(r,i,s,a){return new(s||(s=Promise))((function(i,h){function fulfilled(r){try{step(a.next(r))}catch(i){h(i)}}function rejected(r){try{step(a.throw(r))}catch(i){h(i)}}function step(r){r.done?i(r.value):function adopt(r){return r instanceof s?r:new s((function(i){i(r)}))}(r.value).then(fulfilled,rejected)}step((a=a.apply(r,[])).next())}))}for(var r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i="undefined"==typeof Uint8Array?[]:new Uint8Array(256),s=0;s<64;s++)i[r.charCodeAt(s)]=s;var encode2=function(i){var s,a=new Uint8Array(i),h=a.length,f="";for(s=0;s<h;s+=3)f+=r[a[s]>>2],f+=r[(3&a[s])<<4|a[s+1]>>4],f+=r[(15&a[s+1])<<2|a[s+2]>>6],f+=r[63&a[s+2]];return h%3==2?f=f.substring(0,f.length-1)+"=":h%3==1&&(f=f.substring(0,f.length-2)+"=="),f};const a=new Map,h=new Map;const f=self;f.onmessage=function(r){return __awaiter2(this,0,void 0,(function*(){if(!("OffscreenCanvas"in globalThis))return f.postMessage({id:r.data.id});{const{id:i,bitmap:s,width:_,height:v,dataURLOptions:b}=r.data,S=function getTransparentBlobFor(r,i,s){return __awaiter2(this,0,void 0,(function*(){const a=`${r}-${i}`;if("OffscreenCanvas"in globalThis){if(h.has(a))return h.get(a);const f=new OffscreenCanvas(r,i);f.getContext("2d");const _=yield f.convertToBlob(s),v=yield _.arrayBuffer(),b=encode2(v);return h.set(a,b),b}return""}))}(_,v,b),k=new OffscreenCanvas(_,v);k.getContext("2d").drawImage(s,0,0),s.close();const I=yield k.convertToBlob(b),C=I.type,T=yield I.arrayBuffer(),O=encode2(T);if(!a.has(i)&&(yield S)===O)return a.set(i,O),f.postMessage({id:i});if(a.get(i)===O)return f.postMessage({id:i});f.postMessage({id:i,type:C,base64:O,width:_,height:v}),a.set(i,O)}}))}}()}));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(r){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(r,i)=>{!(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId)&&this.rafStamps.invokeId||(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(r)||this.pendingCanvasMutations.set(r,[]),this.pendingCanvasMutations.get(r).push(i)};const{sampling:i="all",win:s,blockClass:a,blockSelector:h,recordCanvas:f,dataURLOptions:_}=r;this.mutationCb=r.mutationCb,this.mirror=r.mirror,f&&"all"===i&&this.initCanvasMutationObserver(s,a,h),f&&"number"==typeof i&&this.initCanvasFPSObserver(i,s,a,h,{dataURLOptions:_})}initCanvasFPSObserver(r,i,s,a,h){const f=initCanvasContextObserver(i,s,a,!0),_=new Map,v=new yr;v.onmessage=r=>{const{id:i}=r.data;if(_.set(i,!1),!("base64"in r.data))return;const{base64:s,type:a,width:h,height:f}=r.data;this.mutationCb({id:i,type:dr["2D"],commands:[{property:"clearRect",args:[0,0,h,f]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:s}],type:a}]},0,0]}]})};const b=1e3/r;let S,k=0;const takeCanvasSnapshots=r=>{k&&r-k<b||(k=r,(()=>{const r=[];return i.document.querySelectorAll("canvas").forEach((i=>{isBlocked(i,s,a,!0)||r.push(i)})),r})().forEach((r=>__awaiter(this,0,void 0,(function*(){var i;const s=this.mirror.getId(r);if(_.get(s))return;if(0===r.width||0===r.height)return;if(_.set(s,!0),["webgl","webgl2"].includes(r.__context)){const s=r.getContext(r.__context);!1===(null===(i=null==s?void 0:s.getContextAttributes())||void 0===i?void 0:i.preserveDrawingBuffer)&&s.clear(s.COLOR_BUFFER_BIT)}const a=yield createImageBitmap(r);v.postMessage({id:s,bitmap:a,width:r.width,height:r.height,dataURLOptions:h.dataURLOptions},[a])}))))),S=requestAnimationFrame(takeCanvasSnapshots)};S=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{f(),cancelAnimationFrame(S)}}initCanvasMutationObserver(r,i,s){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const a=initCanvasContextObserver(r,i,s,!1),h=function initCanvas2DMutationObserver(r,i,s,a){const h=[],f=Object.getOwnPropertyNames(i.CanvasRenderingContext2D.prototype);for(const v of f)try{if("function"!=typeof i.CanvasRenderingContext2D.prototype[v])continue;const f=patch(i.CanvasRenderingContext2D.prototype,v,(function(h){return function(...f){return isBlocked(this.canvas,s,a,!0)||setTimeout((()=>{const s=serializeArgs(f,i,this);r(this.canvas,{type:dr["2D"],property:v,args:s})}),0),h.apply(this,f)}}));h.push(f)}catch(_){const s=hookSetter(i.CanvasRenderingContext2D.prototype,v,{set(i){r(this.canvas,{type:dr["2D"],property:v,args:[i],setter:!0})}});h.push(s)}return()=>{h.forEach((r=>r()))}}(this.processMutation.bind(this),r,i,s),f=function initCanvasWebGLMutationObserver(r,i,s,a,h){const f=[];return f.push(...patchGLPrototype(i.WebGLRenderingContext.prototype,dr.WebGL,r,s,a,0,i)),void 0!==i.WebGL2RenderingContext&&f.push(...patchGLPrototype(i.WebGL2RenderingContext.prototype,dr.WebGL2,r,s,a,0,i)),()=>{f.forEach((r=>r()))}}(this.processMutation.bind(this),r,i,s,this.mirror);this.resetObservers=()=>{a(),h(),f()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=r=>{this.rafStamps.latestId=r,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((r,i)=>{const s=this.mirror.getId(i);this.flushPendingCanvasMutationFor(i,s)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(r,i){if(this.frozen||this.locked)return;const s=this.pendingCanvasMutations.get(r);if(!s||-1===i)return;const a=s.map((r=>function __rest(r,i){var s={};for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&i.indexOf(a)<0&&(s[a]=r[a]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var h=0;for(a=Object.getOwnPropertySymbols(r);h<a.length;h++)i.indexOf(a[h])<0&&Object.prototype.propertyIsEnumerable.call(r,a[h])&&(s[a[h]]=r[a[h]])}return s}(r,["type"]))),{type:h}=s[0];this.mutationCb({id:i,type:h,commands:a}),this.pendingCanvasMutations.delete(r)}}class StylesheetManager{constructor(r){this.trackedLinkElements=new WeakSet,this.styleMirror=new StyleSheetMirror,this.mutationCb=r.mutationCb,this.adoptedStyleSheetCb=r.adoptedStyleSheetCb}attachLinkElement(r,i){"_cssText"in i.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:i.id,attributes:i.attributes}]}),this.trackLinkElement(r)}trackLinkElement(r){this.trackedLinkElements.has(r)||(this.trackedLinkElements.add(r),this.trackStylesheetInLinkElement(r))}adoptStyleSheets(r,i){if(0===r.length)return;const s={id:i,styleIds:[]},a=[];for(const h of r){let r;this.styleMirror.has(h)?r=this.styleMirror.getId(h):(r=this.styleMirror.add(h),a.push({styleId:r,rules:Array.from(h.rules||CSSRule,((r,i)=>({rule:stringifyRule(r),index:i})))})),s.styleIds.push(r)}a.length>0&&(s.styles=a),this.adoptedStyleSheetCb(s)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(r){}}class ProcessedNodeManager{constructor(){this.nodeMap=new WeakMap,this.loop=!0,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame((()=>{this.clear(),this.loop&&this.periodicallyClear()}))}inOtherBuffer(r,i){const s=this.nodeMap.get(r);return s&&Array.from(s).some((r=>r!==i))}add(r,i){this.nodeMap.set(r,(this.nodeMap.get(r)||new Set).add(i))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(r){return Object.assign(Object.assign({},r),{timestamp:ir()})}let vr,br,Sr,kr=!1;const wr=function createMirror(){return new Mirror}();function record(r={}){const{emit:i,checkoutEveryNms:s,checkoutEveryNth:a,blockClass:h="rr-block",blockSelector:f=null,ignoreClass:_="rr-ignore",ignoreSelector:v=null,maskTextClass:b="rr-mask",maskTextSelector:S=null,inlineStylesheet:k=!0,maskAllInputs:I,maskInputOptions:C,slimDOMOptions:T,maskInputFn:O,maskTextFn:R,hooks:M,packFn:N,sampling:P={},dataURLOptions:D={},mousemoveWait:Z,recordDOM:A=!0,recordCanvas:L=!1,recordCrossOriginIframes:q=!1,recordAfter:$=("DOMContentLoaded"===r.recordAfter?r.recordAfter:"load"),userTriggeredOnInput:U=!1,collectFonts:z=!1,inlineImages:W=!1,plugins:K,keepIframeSrcFn:H=()=>!1,ignoreCSSAttributes:G=new Set([]),errorHandler:Y}=r;!function registerErrorHandler(r){ur=r}(Y);const J=!q||window.parent===window;let X=!1;if(!J)try{window.parent.document&&(X=!1)}catch(ae){X=!0}if(J&&!i)throw new Error("emit function is required");void 0!==Z&&void 0===P.mousemove&&(P.mousemove=Z),wr.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!==C?C:{password:!0},ee=!0===T||"all"===T?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===T,headMetaDescKeywords:"all"===T}:T||{};let te;!function polyfill(r=window){"NodeList"in r&&!r.NodeList.prototype.forEach&&(r.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in r&&!r.DOMTokenList.prototype.forEach&&(r.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...r)=>{let i=r[0];if(!(0 in r))throw new TypeError("1 argument is required");do{if(this===i)return!0}while(i=i&&i.parentNode);return!1})}();let re=0;const eventProcessor=r=>{for(const i of K||[])i.eventProcessor&&(r=i.eventProcessor(r));return N&&!X&&(r=N(r)),r};vr=(r,h)=>{var f;if(!(null===(f=lr[0])||void 0===f?void 0:f.isFrozen())||r.type===or.FullSnapshot||r.type===or.IncrementalSnapshot&&r.data.source===sr.Mutation||lr.forEach((r=>r.unfreeze())),J)null==i||i(eventProcessor(r),h);else if(X){const i={type:"rrweb",event:eventProcessor(r),origin:window.location.origin,isCheckout:h};window.parent.postMessage(i,"*")}if(r.type===or.FullSnapshot)te=r,re=0;else if(r.type===or.IncrementalSnapshot){if(r.data.source===sr.Mutation&&r.data.isAttachIframe)return;re++;const i=a&&re>=a,h=s&&r.timestamp-te.timestamp>s;(i||h)&&br(!0)}};const wrappedMutationEmit=r=>{vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.Mutation},r)}))},wrappedScrollEmit=r=>vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.Scroll},r)})),wrappedCanvasMutationEmit=r=>vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.CanvasMutation},r)})),ne=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:r=>vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.AdoptedStyleSheet},r)}))}),ie=new IframeManager({mirror:wr,mutationCb:wrappedMutationEmit,stylesheetManager:ne,recordCrossOriginIframes:q,wrappedEmit:vr});for(const ce of K||[])ce.getMirror&&ce.getMirror({nodeMirror:wr,crossOriginIframeMirror:ie.crossOriginIframeMirror,crossOriginIframeStyleMirror:ie.crossOriginIframeStyleMirror});const oe=new ProcessedNodeManager;Sr=new CanvasManager({recordCanvas:L,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:h,blockSelector:f,mirror:wr,sampling:P.canvas,dataURLOptions:D});const se=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:h,blockSelector:f,maskTextClass:b,maskTextSelector:S,inlineStylesheet:k,maskInputOptions:Q,dataURLOptions:D,maskTextFn:R,maskInputFn:O,recordCanvas:L,inlineImages:W,sampling:P,slimDOMOptions:ee,iframeManager:ie,stylesheetManager:ne,canvasManager:Sr,keepIframeSrcFn:H,processedNodeManager:oe},mirror:wr});br=(r=!1)=>{if(!A)return;vr(wrapEvent({type:or.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),r),ne.reset(),se.init(),lr.forEach((r=>r.lock()));const i=function snapshot(r,i){const{mirror:s=new Mirror,blockClass:a="rr-block",blockSelector:h=null,maskTextClass:f="rr-mask",maskTextSelector:_=null,inlineStylesheet:v=!0,inlineImages:b=!1,recordCanvas:S=!1,maskAllInputs:k=!1,maskTextFn:I,maskInputFn:C,slimDOM:T=!1,dataURLOptions:O,preserveWhiteSpace:R,onSerialize:M,onIframeLoad:N,iframeLoadTimeout:P,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:A=()=>!1}=i||{};return serializeNodeWithId(r,{doc:r,mirror:s,blockClass:a,blockSelector:h,maskTextClass:f,maskTextSelector:_,skipChild:!1,inlineStylesheet:v,maskInputOptions:!0===k?{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===k?{password:!0}:k,maskTextFn:I,maskInputFn:C,slimDOMOptions:!0===T||"all"===T?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===T,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===T?{}:T,dataURLOptions:O,inlineImages:b,recordCanvas:S,preserveWhiteSpace:R,onSerialize:M,onIframeLoad:N,iframeLoadTimeout:P,onStylesheetLoad:D,stylesheetLoadTimeout:Z,keepIframeSrcFn:A,newlyAddedElement:!1})}(document,{mirror:wr,blockClass:h,blockSelector:f,maskTextClass:b,maskTextSelector:S,inlineStylesheet:k,maskAllInputs:Q,maskTextFn:R,slimDOM:ee,dataURLOptions:D,recordCanvas:L,inlineImages:W,onSerialize:r=>{isSerializedIframe(r,wr)&&ie.addIframe(r),isSerializedStylesheet(r,wr)&&ne.trackLinkElement(r),hasShadowRoot(r)&&se.addShadowRoot(r.shadowRoot,document)},onIframeLoad:(r,i)=>{ie.attachIframe(r,i),se.observeAttachShadow(r)},onStylesheetLoad:(r,i)=>{ne.attachLinkElement(r,i)},keepIframeSrcFn:H});if(!i)return console.warn("Failed to snapshot the document");vr(wrapEvent({type:or.FullSnapshot,data:{node:i,initialOffset:getWindowScroll(window)}}),r),lr.forEach((r=>r.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ne.adoptStyleSheets(document.adoptedStyleSheets,wr.getId(document))};try{const r=[],observe=r=>{var i;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(r,i)=>vr(wrapEvent({type:or.IncrementalSnapshot,data:{source:i,positions:r}})),mouseInteractionCb:r=>vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.MouseInteraction},r)})),scrollCb:wrappedScrollEmit,viewportResizeCb:r=>vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.ViewportResize},r)})),inputCb:r=>vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.Input},r)})),mediaInteractionCb:r=>vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.MediaInteraction},r)})),styleSheetRuleCb:r=>vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.StyleSheetRule},r)})),styleDeclarationCb:r=>vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.StyleDeclaration},r)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:r=>vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.Font},r)})),selectionCb:r=>{vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.Selection},r)}))},customElementCb:r=>{vr(wrapEvent({type:or.IncrementalSnapshot,data:Object.assign({source:sr.CustomElement},r)}))},blockClass:h,ignoreClass:_,ignoreSelector:v,maskTextClass:b,maskTextSelector:S,maskInputOptions:Q,inlineStylesheet:k,sampling:P,recordDOM:A,recordCanvas:L,inlineImages:W,userTriggeredOnInput:U,collectFonts:z,doc:r,maskInputFn:O,maskTextFn:R,keepIframeSrcFn:H,blockSelector:f,slimDOMOptions:ee,dataURLOptions:D,mirror:wr,iframeManager:ie,stylesheetManager:ne,shadowDomManager:se,processedNodeManager:oe,canvasManager:Sr,ignoreCSSAttributes:G,plugins:(null===(i=null==K?void 0:K.filter((r=>r.observer)))||void 0===i?void 0:i.map((r=>({observer:r.observer,options:r.options,callback:i=>vr(wrapEvent({type:or.Plugin,data:{plugin:r.name,payload:i}}))}))))||[]},M)};ie.addLoadListener((i=>{try{r.push(observe(i.contentDocument))}catch(Dr){console.warn(Dr)}}));const init2=()=>{br(),r.push(observe(document)),kr=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(r.push(on("DOMContentLoaded",(()=>{vr(wrapEvent({type:or.DomContentLoaded,data:{}})),"DOMContentLoaded"===$&&init2()}))),r.push(on("load",(()=>{vr(wrapEvent({type:or.Load,data:{}})),"load"===$&&init2()}),window))),()=>{r.forEach((r=>r())),oe.destroy(),kr=!1,function unregisterErrorHandler(){ur=void 0}()}}catch(Dr){console.warn(Dr)}}record.addCustomEvent=(r,i)=>{if(!kr)throw new Error("please add custom event after start recording");vr(wrapEvent({type:or.Custom,data:{tag:r,payload:i}}))},record.freezePage=()=>{lr.forEach((r=>r.freeze()))},record.takeFullSnapshot=r=>{if(!kr)throw new Error("please take full snapshot after start recording");br(r)},record.mirror=wr;var Ir,Er=(r=>(r[r.DomContentLoaded=0]="DomContentLoaded",r[r.Load=1]="Load",r[r.FullSnapshot=2]="FullSnapshot",r[r.IncrementalSnapshot=3]="IncrementalSnapshot",r[r.Meta=4]="Meta",r[r.Custom=5]="Custom",r[r.Plugin=6]="Plugin",r))(Er||{}),xr=(r=>(r[r.Mutation=0]="Mutation",r[r.MouseMove=1]="MouseMove",r[r.MouseInteraction=2]="MouseInteraction",r[r.Scroll=3]="Scroll",r[r.ViewportResize=4]="ViewportResize",r[r.Input=5]="Input",r[r.TouchMove=6]="TouchMove",r[r.MediaInteraction=7]="MediaInteraction",r[r.StyleSheetRule=8]="StyleSheetRule",r[r.CanvasMutation=9]="CanvasMutation",r[r.Font=10]="Font",r[r.Log=11]="Log",r[r.Drag=12]="Drag",r[r.StyleDeclaration=13]="StyleDeclaration",r[r.Selection=14]="Selection",r[r.AdoptedStyleSheet=15]="AdoptedStyleSheet",r[r.CustomElement=16]="CustomElement",r))(xr||{}),Cr={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var Tr={hostname:""};Ir={navigator:{userAgent:"",onLine:!0},document:{location:Tr,referrer:""},screen:{width:0,height:0},location:Tr}}else Ir=window;var Or,Rr,Mr,Nr,Pr,Dr,Zr,Ar,Lr,jr,Fr=864e5,qr=8e3,$r=Array.prototype,Ur=Function.prototype,Br=Object.prototype,zr=$r.slice,Vr=Br.toString,Wr=Br.hasOwnProperty,Kr=Ir.console,Hr=Ir.navigator,Gr=Ir.document,Yr=Ir.opera,Jr=Ir.screen,Xr=Hr.userAgent,Qr=Ur.bind,en=$r.forEach,tn=$r.indexOf,rn=$r.map,nn=Array.isArray,sn={},an={trim:function(r){return r.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},cn={log:function(){if(Cr.DEBUG&&!an.isUndefined(Kr)&&Kr)try{Kr.log.apply(Kr,arguments)}catch(r){an.each(arguments,(function(r){Kr.log(r)}))}},warn:function(){if(Cr.DEBUG&&!an.isUndefined(Kr)&&Kr){var r=["Mixpanel warning:"].concat(an.toArray(arguments));try{Kr.warn.apply(Kr,r)}catch(i){an.each(r,(function(r){Kr.warn(r)}))}}},error:function(){if(Cr.DEBUG&&!an.isUndefined(Kr)&&Kr){var r=["Mixpanel error:"].concat(an.toArray(arguments));try{Kr.error.apply(Kr,r)}catch(i){an.each(r,(function(r){Kr.error(r)}))}}},critical:function(){if(!an.isUndefined(Kr)&&Kr){var r=["Mixpanel error:"].concat(an.toArray(arguments));try{Kr.error.apply(Kr,r)}catch(i){an.each(r,(function(r){Kr.error(r)}))}}}},log_func_with_prefix=function(r,i){return function(){return arguments[0]="["+i+"] "+arguments[0],r.apply(cn,arguments)}},console_with_prefix=function(r){return{log:log_func_with_prefix(cn.log,r),error:log_func_with_prefix(cn.error,r),critical:log_func_with_prefix(cn.critical,r)}};an.bind=function(r,i){var s,a;if(Qr&&r.bind===Qr)return Qr.apply(r,zr.call(arguments,1));if(!an.isFunction(r))throw new TypeError;return s=zr.call(arguments,2),a=function(){if(!(this instanceof a))return r.apply(i,s.concat(zr.call(arguments)));var h={};h.prototype=r.prototype;var f=new h;h.prototype=null;var _=r.apply(f,s.concat(zr.call(arguments)));return Object(_)===_?_:f},a},an.each=function(r,i,s){if(null!=r)if(en&&r.forEach===en)r.forEach(i,s);else if(r.length===+r.length){for(var a=0,h=r.length;a<h;a++)if(a in r&&i.call(s,r[a],a,r)===sn)return}else for(var f in r)if(Wr.call(r,f)&&i.call(s,r[f],f,r)===sn)return},an.extend=function(r){return an.each(zr.call(arguments,1),(function(i){for(var s in i)void 0!==i[s]&&(r[s]=i[s])})),r},an.isArray=nn||function(r){return"[object Array]"===Vr.call(r)},an.isFunction=function(r){try{return/^\s*\bfunction\b/.test(r)}catch(i){return!1}},an.isArguments=function(r){return!(!r||!Wr.call(r,"callee"))},an.toArray=function(r){return r?r.toArray?r.toArray():an.isArray(r)||an.isArguments(r)?zr.call(r):an.values(r):[]},an.map=function(r,i,s){if(rn&&r.map===rn)return r.map(i,s);var a=[];return an.each(r,(function(r){a.push(i.call(s,r))})),a},an.keys=function(r){var i=[];return null===r||an.each(r,(function(r,s){i[i.length]=s})),i},an.values=function(r){var i=[];return null===r||an.each(r,(function(r){i[i.length]=r})),i},an.include=function(r,i){var s=!1;return null===r?s:tn&&r.indexOf===tn?-1!=r.indexOf(i):(an.each(r,(function(r){if(s||(s=r===i))return sn})),s)},an.includes=function(r,i){return-1!==r.indexOf(i)},an.inherit=function(r,i){return r.prototype=new i,r.prototype.constructor=r,r.superclass=i.prototype,r},an.isObject=function(r){return r===Object(r)&&!an.isArray(r)},an.isEmptyObject=function(r){if(an.isObject(r)){for(var i in r)if(Wr.call(r,i))return!1;return!0}return!1},an.isUndefined=function(r){return void 0===r},an.isString=function(r){return"[object String]"==Vr.call(r)},an.isDate=function(r){return"[object Date]"==Vr.call(r)},an.isNumber=function(r){return"[object Number]"==Vr.call(r)},an.isElement=function(r){return!(!r||1!==r.nodeType)},an.encodeDates=function(r){return an.each(r,(function(i,s){an.isDate(i)?r[s]=an.formatDate(i):an.isObject(i)&&(r[s]=an.encodeDates(i))})),r},an.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},an.formatDate=function(r){function pad(r){return r<10?"0"+r:r}return r.getUTCFullYear()+"-"+pad(r.getUTCMonth()+1)+"-"+pad(r.getUTCDate())+"T"+pad(r.getUTCHours())+":"+pad(r.getUTCMinutes())+":"+pad(r.getUTCSeconds())},an.strip_empty_properties=function(r){var i={};return an.each(r,(function(r,s){an.isString(r)&&r.length>0&&(i[s]=r)})),i},an.truncate=function(r,i){var s;return"string"==typeof r?s=r.slice(0,i):an.isArray(r)?(s=[],an.each(r,(function(r){s.push(an.truncate(r,i))}))):an.isObject(r)?(s={},an.each(r,(function(r,a){s[a]=an.truncate(r,i)}))):s=r,s},an.JSONEncode=function(){return function(r){var quote=function(r){var i=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return i.lastIndex=0,i.test(r)?'"'+r.replace(i,(function(r){var i=s[r];return"string"==typeof i?i:"\\u"+("0000"+r.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+r+'"'},str=function(r,i){var s="",a=0,h="",f="",_=0,v=s,b=[],S=i[r];switch(S&&"object"==typeof S&&"function"==typeof S.toJSON&&(S=S.toJSON(r)),typeof S){case"string":return quote(S);case"number":return isFinite(S)?String(S):"null";case"boolean":case"null":return String(S);case"object":if(!S)return"null";if(s+=" ",b=[],"[object Array]"===Vr.apply(S)){for(_=S.length,a=0;a<_;a+=1)b[a]=str(a,S)||"null";return f=0===b.length?"[]":s?"[\n"+s+b.join(",\n"+s)+"\n"+v+"]":"["+b.join(",")+"]",s=v,f}for(h in S)Wr.call(S,h)&&(f=str(h,S))&&b.push(quote(h)+(s?": ":":")+f);return f=0===b.length?"{}":s?"{"+b.join(",")+v+"}":"{"+b.join(",")+"}",s=v,f}};return str("",{"":r})}}(),an.JSONDecode=(Pr={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Dr=function(r){var i=new SyntaxError(r);throw i.at=Or,i.text=Mr,i},Zr=function(r){return r&&r!==Rr&&Dr("Expected '"+r+"' instead of '"+Rr+"'"),Rr=Mr.charAt(Or),Or+=1,Rr},Ar=function(){var r,i="";for("-"===Rr&&(i="-",Zr("-"));Rr>="0"&&Rr<="9";)i+=Rr,Zr();if("."===Rr)for(i+=".";Zr()&&Rr>="0"&&Rr<="9";)i+=Rr;if("e"===Rr||"E"===Rr)for(i+=Rr,Zr(),"-"!==Rr&&"+"!==Rr||(i+=Rr,Zr());Rr>="0"&&Rr<="9";)i+=Rr,Zr();if(r=+i,isFinite(r))return r;Dr("Bad number")},Lr=function(){var r,i,s,a="";if('"'===Rr)for(;Zr();){if('"'===Rr)return Zr(),a;if("\\"===Rr)if(Zr(),"u"===Rr){for(s=0,i=0;i<4&&(r=parseInt(Zr(),16),isFinite(r));i+=1)s=16*s+r;a+=String.fromCharCode(s)}else{if("string"!=typeof Pr[Rr])break;a+=Pr[Rr]}else a+=Rr}Dr("Bad string")},jr=function(){for(;Rr&&Rr<=" ";)Zr()},Nr=function(){switch(jr(),Rr){case"{":return function(){var r,i={};if("{"===Rr){if(Zr("{"),jr(),"}"===Rr)return Zr("}"),i;for(;Rr;){if(r=Lr(),jr(),Zr(":"),Object.hasOwnProperty.call(i,r)&&Dr('Duplicate key "'+r+'"'),i[r]=Nr(),jr(),"}"===Rr)return Zr("}"),i;Zr(","),jr()}}Dr("Bad object")}();case"[":return function(){var r=[];if("["===Rr){if(Zr("["),jr(),"]"===Rr)return Zr("]"),r;for(;Rr;){if(r.push(Nr()),jr(),"]"===Rr)return Zr("]"),r;Zr(","),jr()}}Dr("Bad array")}();case'"':return Lr();case"-":return Ar();default:return Rr>="0"&&Rr<="9"?Ar():function(){switch(Rr){case"t":return Zr("t"),Zr("r"),Zr("u"),Zr("e"),!0;case"f":return Zr("f"),Zr("a"),Zr("l"),Zr("s"),Zr("e"),!1;case"n":return Zr("n"),Zr("u"),Zr("l"),Zr("l"),null}Dr('Unexpected "'+Rr+'"')}()}},function(r){var i;return Mr=r,Or=0,Rr=" ",i=Nr(),jr(),Rr&&Dr("Syntax error"),i}),an.base64Encode=function(r){var i,s,a,h,f,_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=0,b=0,S="",k=[];if(!r)return r;r=an.utf8Encode(r);do{i=(f=r.charCodeAt(v++)<<16|r.charCodeAt(v++)<<8|r.charCodeAt(v++))>>18&63,s=f>>12&63,a=f>>6&63,h=63&f,k[b++]=_.charAt(i)+_.charAt(s)+_.charAt(a)+_.charAt(h)}while(v<r.length);switch(S=k.join(""),r.length%3){case 1:S=S.slice(0,-2)+"==";break;case 2:S=S.slice(0,-1)+"="}return S},an.utf8Encode=function(r){var i,s,a,h,f="";for(i=s=0,a=(r=(r+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,h=0;h<a;h++){var _=r.charCodeAt(h),v=null;_<128?s++:v=_>127&&_<2048?String.fromCharCode(_>>6|192,63&_|128):String.fromCharCode(_>>12|224,_>>6&63|128,63&_|128),null!==v&&(s>i&&(f+=r.substring(i,s)),f+=v,i=s=h+1)}return s>i&&(f+=r.substring(i,r.length)),f},an.UUID=function(){var T2=function(){var r,i=1*new Date;if(Ir.performance&&Ir.performance.now)r=Ir.performance.now();else for(r=0;i==1*new Date;)r++;return i.toString(16)+Math.floor(r).toString(16)};return function(){var r=(Jr.height*Jr.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var r,i,s=Xr,a=[],h=0;function xor(r,i){var s,h=0;for(s=0;s<i.length;s++)h|=a[s]<<8*s;return r^h}for(r=0;r<s.length;r++)i=s.charCodeAt(r),a.unshift(255&i),a.length>=4&&(h=xor(h,a),a=[]);return a.length>0&&(h=xor(h,a)),h.toString(16)}()+"-"+r+"-"+T2()}}();var dn=["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"];an.isBlockedUA=function(r){var i;for(r=r.toLowerCase(),i=0;i<dn.length;i++)if(-1!==r.indexOf(dn[i]))return!0;return!1},an.HTTPBuildQuery=function(r,i){var s,a,h=[];return an.isUndefined(i)&&(i="&"),an.each(r,(function(r,i){s=encodeURIComponent(r.toString()),a=encodeURIComponent(i),h[h.length]=a+"="+s})),h.join(i)},an.getQueryParam=function(r,i){i=i.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var s=new RegExp("[\\?&]"+i+"=([^&#]*)").exec(r);if(null===s||s&&"string"!=typeof s[1]&&s[1].length)return"";var a=s[1];try{a=decodeURIComponent(a)}catch(h){cn.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},an.cookie={get:function(r){for(var i=r+"=",s=Gr.cookie.split(";"),a=0;a<s.length;a++){for(var h=s[a];" "==h.charAt(0);)h=h.substring(1,h.length);if(0===h.indexOf(i))return decodeURIComponent(h.substring(i.length,h.length))}return null},parse:function(r){var i;try{i=an.JSONDecode(an.cookie.get(r))||{}}catch(s){}return i},set_seconds:function(r,i,s,a,h,f,_){var v="",b="",S="";if(_)v="; domain="+_;else if(a){var k=extract_domain(Gr.location.hostname);v=k?"; domain=."+k:""}if(s){var I=new Date;I.setTime(I.getTime()+1e3*s),b="; expires="+I.toGMTString()}f&&(h=!0,S="; SameSite=None"),h&&(S+="; secure"),Gr.cookie=r+"="+encodeURIComponent(i)+b+"; path=/"+v+S},set:function(r,i,s,a,h,f,_){var v="",b="",S="";if(_)v="; domain="+_;else if(a){var k=extract_domain(Gr.location.hostname);v=k?"; domain=."+k:""}if(s){var I=new Date;I.setTime(I.getTime()+24*s*60*60*1e3),b="; expires="+I.toGMTString()}f&&(h=!0,S="; SameSite=None"),h&&(S+="; secure");var C=r+"="+encodeURIComponent(i)+b+"; path=/"+v+S;return Gr.cookie=C,C},remove:function(r,i,s){an.cookie.set(r,"",-1,i,!1,!1,s)}};var un=null,localStorageSupported=function(r,i){if(null!==un&&!i)return un;var s=!0;try{r=r||window.localStorage;var a="__mplss_"+cheap_guid(8);r.setItem(a,"xyz"),"xyz"!==r.getItem(a)&&(s=!1),r.removeItem(a)}catch(h){s=!1}return un=s,s};an.localStorage={is_supported:function(r){var i=localStorageSupported(null,r);return i||cn.error("localStorage unsupported; falling back to cookie store"),i},error:function(r){cn.error("localStorage error: "+r)},get:function(r){try{return window.localStorage.getItem(r)}catch(i){an.localStorage.error(i)}return null},parse:function(r){try{return an.JSONDecode(an.localStorage.get(r))||{}}catch(i){}return null},set:function(r,i){try{window.localStorage.setItem(r,i)}catch(s){an.localStorage.error(s)}},remove:function(r){try{window.localStorage.removeItem(r)}catch(i){an.localStorage.error(i)}}},an.register_event=function(){function fixEvent(r){return r&&(r.preventDefault=fixEvent.preventDefault,r.stopPropagation=fixEvent.stopPropagation),r}return fixEvent.preventDefault=function(){this.returnValue=!1},fixEvent.stopPropagation=function(){this.cancelBubble=!0},function(r,i,s,a,h){if(r)if(r.addEventListener&&!a)r.addEventListener(i,s,!!h);else{var f="on"+i,_=r[f];r[f]=function makeHandler(r,i,s){var handler=function(a){if(a=a||fixEvent(window.event)){var h,f,_=!0;return an.isFunction(s)&&(h=s(a)),f=i.call(r,a),!1!==h&&!1!==f||(_=!1),_}};return handler}(r,s,_)}else cn.error("No valid element provided to register_event")}}();var ln=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');an.dom_query=function(){function getAllChildren(r){return r.all?r.all:r.getElementsByTagName("*")}var r=/[\t\r\n]/g;function hasClass(i,s){var a=" "+s+" ";return(" "+i.className+" ").replace(r," ").indexOf(a)>=0}function getElementsBySelector(r){if(!Gr.getElementsByTagName)return[];var i,s,a,h,f,_,v,b,S,k,I=r.split(" "),C=[Gr];for(_=0;_<I.length;_++)if((i=I[_].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){a=(s=i.split("#"))[0];var T=s[1],O=Gr.getElementById(T);if(!O||a&&O.nodeName.toLowerCase()!=a)return[];C=[O]}else if(i.indexOf(".")>-1){a=(s=i.split("."))[0];var R=s[1];for(a||(a="*"),h=[],f=0,v=0;v<C.length;v++)for(S="*"==a?getAllChildren(C[v]):C[v].getElementsByTagName(a),b=0;b<S.length;b++)h[f++]=S[b];for(C=[],k=0,v=0;v<h.length;v++)h[v].className&&an.isString(h[v].className)&&hasClass(h[v],R)&&(C[k++]=h[v])}else{var M=i.match(ln);if(M){a=M[1];var N,P=M[2],D=M[3],Z=M[4];for(a||(a="*"),h=[],f=0,v=0;v<C.length;v++)for(S="*"==a?getAllChildren(C[v]):C[v].getElementsByTagName(a),b=0;b<S.length;b++)h[f++]=S[b];switch(C=[],k=0,D){case"=":N=function(r){return r.getAttribute(P)==Z};break;case"~":N=function(r){return r.getAttribute(P).match(new RegExp("\\b"+Z+"\\b"))};break;case"|":N=function(r){return r.getAttribute(P).match(new RegExp("^"+Z+"-?"))};break;case"^":N=function(r){return 0===r.getAttribute(P).indexOf(Z)};break;case"$":N=function(r){return r.getAttribute(P).lastIndexOf(Z)==r.getAttribute(P).length-Z.length};break;case"*":N=function(r){return r.getAttribute(P).indexOf(Z)>-1};break;default:N=function(r){return r.getAttribute(P)}}for(C=[],k=0,v=0;v<h.length;v++)N(h[v])&&(C[k++]=h[v])}else{for(a=i,h=[],f=0,v=0;v<C.length;v++)for(S=C[v].getElementsByTagName(a),b=0;b<S.length;b++)h[f++]=S[b];C=h}}return C}return function(r){return an.isElement(r)?[r]:an.isObject(r)&&!an.isUndefined(r.length)?r:getElementsBySelector.call(this,r)}}();var pn=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],hn=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];an.info={campaignParams:function(r){var i="",s={};return an.each(pn,(function(a){(i=an.getQueryParam(Gr.URL,a)).length?s[a]=i:void 0!==r&&(s[a]=r)})),s},clickParams:function(){var r="",i={};return an.each(hn,(function(s){(r=an.getQueryParam(Gr.URL,s)).length&&(i[s]=r)})),i},marketingParams:function(){return an.extend(an.info.campaignParams(),an.info.clickParams())},searchEngine:function(r){return 0===r.search("https?://(.*)google.([^/?]*)")?"google":0===r.search("https?://(.*)bing.com")?"bing":0===r.search("https?://(.*)yahoo.com")?"yahoo":0===r.search("https?://(.*)duckduckgo.com")?"duckduckgo":null},searchInfo:function(r){var i=an.info.searchEngine(r),s="yahoo"!=i?"q":"p",a={};if(null!==i){a.$search_engine=i;var h=an.getQueryParam(r,s);h.length&&(a.mp_keyword=h)}return a},browser:function(r,i,s){return i=i||"",s||an.includes(r," OPR/")?an.includes(r,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(r)?"BlackBerry":an.includes(r,"IEMobile")||an.includes(r,"WPDesktop")?"Internet Explorer Mobile":an.includes(r,"SamsungBrowser/")?"Samsung Internet":an.includes(r,"Edge")||an.includes(r,"Edg/")?"Microsoft Edge":an.includes(r,"FBIOS")?"Facebook Mobile":an.includes(r,"Chrome")?"Chrome":an.includes(r,"CriOS")?"Chrome iOS":an.includes(r,"UCWEB")||an.includes(r,"UCBrowser")?"UC Browser":an.includes(r,"FxiOS")?"Firefox iOS":an.includes(i,"Apple")?an.includes(r,"Mobile")?"Mobile Safari":"Safari":an.includes(r,"Android")?"Android Mobile":an.includes(r,"Konqueror")?"Konqueror":an.includes(r,"Firefox")?"Firefox":an.includes(r,"MSIE")||an.includes(r,"Trident/")?"Internet Explorer":an.includes(r,"Gecko")?"Mozilla":""},browserVersion:function(r,i,s){var a={"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+)?)/}[an.info.browser(r,i,s)];if(void 0===a)return null;var h=r.match(a);return h?parseFloat(h[h.length-2]):null},os:function(){var r=Xr;return/Windows/i.test(r)?/Phone/.test(r)||/WPDesktop/.test(r)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(r)?"iOS":/Android/.test(r)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(r)?"BlackBerry":/Mac/i.test(r)?"Mac OS X":/Linux/.test(r)?"Linux":/CrOS/.test(r)?"Chrome OS":""},device:function(r){return/Windows Phone/i.test(r)||/WPDesktop/.test(r)?"Windows Phone":/iPad/.test(r)?"iPad":/iPod/.test(r)?"iPod Touch":/iPhone/.test(r)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(r)?"BlackBerry":/Android/.test(r)?"Android":""},referringDomain:function(r){var i=r.split("/");return i.length>=3?i[2]:""},currentUrl:function(){return Ir.location.href},properties:function(r){return"object"!=typeof r&&(r={}),an.extend(an.strip_empty_properties({$os:an.info.os(),$browser:an.info.browser(Xr,Hr.vendor,Yr),$referrer:Gr.referrer,$referring_domain:an.info.referringDomain(Gr.referrer),$device:an.info.device(Xr)}),{$current_url:an.info.currentUrl(),$browser_version:an.info.browserVersion(Xr,Hr.vendor,Yr),$screen_height:Jr.height,$screen_width:Jr.width,mp_lib:"web",$lib_version:Cr.LIB_VERSION,$insert_id:cheap_guid(),time:an.timestamp()/1e3},an.strip_empty_properties(r))},people_properties:function(){return an.extend(an.strip_empty_properties({$os:an.info.os(),$browser:an.info.browser(Xr,Hr.vendor,Yr)}),{$browser_version:an.info.browserVersion(Xr,Hr.vendor,Yr)})},mpPageViewProperties:function(){return an.strip_empty_properties({current_page_title:Gr.title,current_domain:Ir.location.hostname,current_url_path:Ir.location.pathname,current_url_protocol:Ir.location.protocol,current_url_search:Ir.location.search})}};var cheap_guid=function(r){var i=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return r?i.substring(0,r):i},fn=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,mn=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(r){var i=mn,s=r.split("."),a=s[s.length-1];(a.length>4||"com"===a||"org"===a)&&(i=fn);var h=r.match(i);return h?h[0]:""},gn=null,_n=null;"undefined"!=typeof JSON&&(gn=JSON.stringify,_n=JSON.parse),gn=gn||an.JSONEncode,_n=_n||an.JSONDecode,an.toArray=an.toArray,an.isObject=an.isObject,an.JSONEncode=an.JSONEncode,an.JSONDecode=an.JSONDecode,an.isBlockedUA=an.isBlockedUA,an.isEmptyObject=an.isEmptyObject,an.info=an.info,an.info.device=an.info.device,an.info.browser=an.info.browser,an.info.browserVersion=an.info.browserVersion,an.info.properties=an.info.properties;var yn="__mp_opt_in_out_";function optIn(r,i){_optInOut(!0,r,i)}function optOut(r,i){_optInOut(!1,r,i)}function hasOptedIn(r,i){return"1"===_getStorageValue(r,i)}function hasOptedOut(r,i){if(function _hasDoNotTrackFlagOn(r){if(r&&r.ignoreDnt)return!1;var i=r&&r.window||Ir,s=i.navigator||{},a=!1;return an.each([s.doNotTrack,s.msDoNotTrack,i.doNotTrack],(function(r){an.includes([!0,1,"1","yes"],r)&&(a=!0)})),a}(i))return cn.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 s="0"===_getStorageValue(r,i);return s&&cn.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),s}function addOptOutCheckMixpanelLib(r){return _addOptOutCheck(r,(function(r){return this.get_config(r)}))}function addOptOutCheckMixpanelPeople(r){return _addOptOutCheck(r,(function(r){return this._get_config(r)}))}function addOptOutCheckMixpanelGroup(r){return _addOptOutCheck(r,(function(r){return this._get_config(r)}))}function clearOptInOut(r,i){_getStorage(i=i||{}).remove(_getStorageKey(r,i),!!i.crossSubdomainCookie,i.cookieDomain)}function _getStorage(r){return"localStorage"===(r=r||{}).persistenceType?an.localStorage:an.cookie}function _getStorageKey(r,i){return((i=i||{}).persistencePrefix||yn)+r}function _getStorageValue(r,i){return _getStorage(i).get(_getStorageKey(r,i))}function _optInOut(r,i,s){an.isString(i)&&i.length?(_getStorage(s=s||{}).set(_getStorageKey(i,s),r?1:0,an.isNumber(s.cookieExpiration)?s.cookieExpiration:null,!!s.crossSubdomainCookie,!!s.secureCookie,!!s.crossSiteCookie,s.cookieDomain),s.track&&r&&s.track(s.trackEventName||"$opt_in",s.trackProperties,{send_immediately:!0})):cn.error("gdpr."+(r?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(r,i){return function(){var s=!1;try{var a=i.call(this,"token"),h=i.call(this,"ignore_dnt"),f=i.call(this,"opt_out_tracking_persistence_type"),_=i.call(this,"opt_out_tracking_cookie_prefix"),v=i.call(this,"window");a&&(s=hasOptedOut(a,{ignoreDnt:h,persistenceType:f,persistencePrefix:_,window:v}))}catch(S){cn.error("Unexpected error when checking tracking opt-out status: "+S)}if(!s)return r.apply(this,arguments);var b=arguments[arguments.length-1];"function"==typeof b&&b(0)}}var vn=console_with_prefix("lock"),SharedLock=function(r,i){i=i||{},this.storageKey=r,this.storage=i.storage||window.localStorage,this.pollIntervalMS=i.pollIntervalMS||100,this.timeoutMS=i.timeoutMS||2e3};SharedLock.prototype.withLock=function(r,i,s){s||"function"==typeof i||(s=i,i=null);var a=s||(new Date).getTime()+"|"+Math.random(),h=(new Date).getTime(),f=this.storageKey,_=this.pollIntervalMS,v=this.timeoutMS,b=this.storage,S=f+":X",k=f+":Y",I=f+":Z",reportError=function(r){i&&i(r)},delay=function(r){if((new Date).getTime()-h>v)return vn.error("Timeout waiting for mutex on "+f+"; clearing lock. ["+a+"]"),b.removeItem(I),b.removeItem(k),void loop();setTimeout((function(){try{r()}catch(i){reportError(i)}}),_*(Math.random()+.1))},waitFor=function(r,i){r()?i():delay((function(){waitFor(r,i)}))},getSetY=function(){var r=b.getItem(k);if(r&&r!==a)return!1;if(b.setItem(k,a),b.getItem(k)===a)return!0;if(!localStorageSupported(b,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){b.setItem(S,a),waitFor(getSetY,(function(){b.getItem(S)!==a?delay((function(){b.getItem(k)===a?waitFor((function(){return!b.getItem(I)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){b.setItem(I,"1");try{r()}finally{b.removeItem(I),b.getItem(k)===a&&b.removeItem(k),b.getItem(S)===a&&b.removeItem(S)}};try{if(!localStorageSupported(b,!0))throw new Error("localStorage support check failed");loop()}catch(C){reportError(C)}};var bn=console_with_prefix("batch"),RequestQueue=function(r,i){i=i||{},this.storageKey=r,this.storage=i.storage||window.localStorage,this.reportError=i.errorReporter||an.bind(bn.error,bn),this.lock=new SharedLock(r,{storage:this.storage}),this.usePersistence=i.usePersistence,this.pid=i.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(r,i,s){var a={id:cheap_guid(),flushAfter:(new Date).getTime()+2*i,payload:r};this.usePersistence?this.lock.withLock(an.bind((function lockAcquired(){var i;try{var h=this.readFromStorage();h.push(a),(i=this.saveToStorage(h))&&this.memQueue.push(a)}catch(f){this.reportError("Error enqueueing item",r),i=!1}s&&s(i)}),this),an.bind((function lockFailure(r){this.reportError("Error acquiring storage lock",r),s&&s(!1)}),this),this.pid):(this.memQueue.push(a),s&&s(!0))},RequestQueue.prototype.fillBatch=function(r){var i=this.memQueue.slice(0,r);if(this.usePersistence&&i.length<r){var s=this.readFromStorage();if(s.length){var a={};an.each(i,(function(r){a[r.id]=!0}));for(var h=0;h<s.length;h++){var f=s[h];if((new Date).getTime()>f.flushAfter&&!a[f.id]&&(f.orphaned=!0,i.push(f),i.length>=r))break}}}return i};var filterOutIDsAndInvalid=function(r,i){var s=[];return an.each(r,(function(r){r.id&&!i[r.id]&&s.push(r)})),s};RequestQueue.prototype.removeItemsByID=function(r,i){var s={};if(an.each(r,(function(r){s[r]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,s),this.usePersistence){var a=an.bind((function(){var i;try{var a=this.readFromStorage();if(a=filterOutIDsAndInvalid(a,s),i=this.saveToStorage(a)){a=this.readFromStorage();for(var h=0;h<a.length;h++){var f=a[h];if(f.id&&s[f.id])return this.reportError("Item not removed from storage"),!1}}}catch(_){this.reportError("Error removing items",r),i=!1}return i}),this);this.lock.withLock((function lockAcquired(){var r=a();i&&i(r)}),an.bind((function lockFailure(r){var s=!1;if(this.reportError("Error acquiring storage lock",r),!localStorageSupported(this.storage,!0)&&!(s=a()))try{this.storage.removeItem(this.storageKey)}catch(h){this.reportError("Error clearing queue",h)}i&&i(s)}),this),this.pid)}else i&&i(!0)};var updatePayloads=function(r,i){var s=[];return an.each(r,(function(r){var a=r.id;if(a in i){var h=i[a];null!==h&&(r.payload=h,s.push(r))}else s.push(r)})),s};RequestQueue.prototype.updatePayloads=function(r,i){this.memQueue=updatePayloads(this.memQueue,r),this.usePersistence?this.lock.withLock(an.bind((function lockAcquired(){var s;try{var a=this.readFromStorage();a=updatePayloads(a,r),s=this.saveToStorage(a)}catch(h){this.reportError("Error updating items",r),s=!1}i&&i(s)}),this),an.bind((function lockFailure(r){this.reportError("Error acquiring storage lock",r),i&&i(!1)}),this),this.pid):i&&i(!0)},RequestQueue.prototype.readFromStorage=function(){var r;try{(r=this.storage.getItem(this.storageKey))&&(r=_n(r),an.isArray(r)||(this.reportError("Invalid storage entry:",r),r=null))}catch(i){this.reportError("Error retrieving queue",i),r=null}return r||[]},RequestQueue.prototype.saveToStorage=function(r){try{return this.storage.setItem(this.storageKey,gn(r)),!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 Sn=console_with_prefix("batch"),RequestBatcher=function(r,i){this.errorReporter=i.errorReporter,this.queue=new RequestQueue(r,{errorReporter:an.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(r,i){this.queue.enqueue(r,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(r){this.flushInterval=r,this.stopped||(this.timeoutID=setTimeout(an.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(r){try{if(this.requestInProgress)return void Sn.log("Flush: Request already in progress");r=r||{};var i=this.libConfig.batch_request_timeout_ms,s=(new Date).getTime(),a=this.batchSize,h=this.queue.fillBatch(a),f=h.length===a,_=[],v={};if(an.each(h,(function(r){var i=r.payload;if(this.beforeSendHook&&!r.orphaned&&(i=this.beforeSendHook(i)),i){i.event&&i.properties&&(i.properties=an.extend({},i.properties,{mp_sent_by_lib_version:Cr.LIB_VERSION}));var s=!0,a=r.id;a?(this.itemIdsSentSuccessfully[a]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:r,batchSize:h.length,timesSent:this.itemIdsSentSuccessfully[a]}),s=!1):this.reportError("[dupe] found item with no ID",{item:r}),s&&_.push(i)}v[r.id]=i}),this),_.length<1)return void this.resetFlush();this.requestInProgress=!0;var b=an.bind((function(_){this.requestInProgress=!1;try{var b=!1;if(r.unloading)this.queue.updatePayloads(v);else if(an.isObject(_)&&"timeout"===_.error&&(new Date).getTime()-s>=i)this.reportError("Network timeout; retrying"),this.flush();else if(an.isObject(_)&&(_.httpStatusCode>=500||429===_.httpStatusCode||_.httpStatusCode<=0&&(I=Ir.navigator.onLine,!an.isUndefined(I)&&!I)||"timeout"===_.error)){var S=2*this.flushInterval;_.retryAfter&&(S=1e3*parseInt(_.retryAfter,10)||S),S=Math.min(6e5,S),this.reportError("Error; retry in "+S+" ms"),this.scheduleFlush(S)}else if(an.isObject(_)&&413===_.httpStatusCode)if(h.length>1){var k=Math.max(1,Math.floor(a/2));this.batchSize=Math.min(this.batchSize,k,h.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush()}else this.reportError("Single-event request too large; dropping",h),this.resetBatchSize(),b=!0;else b=!0;b&&(this.queue.removeItemsByID(an.map(h,(function(r){return r.id})),an.bind((function(r){r?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!f?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)),an.each(h,an.bind((function(r){var i=r.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:r,batchSize:h.length,timesSent:this.itemIdsSentSuccessfully[i]})):this.reportError("[dupe] found item with no ID while removing",{item:r})}),this)))}catch(C){this.reportError("Error handling API response",C),this.resetFlush()}var I}),this),S={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:i};r.unloading&&(S.transport="sendBeacon"),Sn.log("MIXPANEL REQUEST:",_),this.sendRequest(_,S,b)}catch(k){this.reportError("Error flushing request queue",k),this.resetFlush()}},RequestBatcher.prototype.reportError=function(r,i){if(Sn.error.apply(Sn.error,arguments),this.errorReporter)try{i instanceof Error||(i=new Error(r)),this.errorReporter(r,i)}catch(s){Sn.error(s)}};var kn=console_with_prefix("recorder"),wn=Ir.CompressionStream,In={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},En=new Set([xr.MouseMove,xr.MouseInteraction,xr.Scroll,xr.ViewportResize,xr.Input,xr.TouchMove,xr.MediaInteraction,xr.Drag,xr.Selection]);var MixpanelRecorder=function(r){this._mixpanel=r,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=Fr,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:In,sendRequestFunc:an.bind(this.flushEventsWithOptOut,this),errorReporter:an.bind(this.reportError,this),flushOnlyOnInterval:!0,usePersistence:!1})},MixpanelRecorder.prototype.get_config=function(r){return this._mixpanel.get_config(r)},MixpanelRecorder.prototype.startRecording=function(r){if(null===this._stopRecording){this.recordMaxMs=this.get_config("record_max_ms"),this.recordMaxMs>Fr&&(this.recordMaxMs=Fr,kn.critical("record_max_ms cannot be greater than "+Fr+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>qr&&(this.recordMinMs=qr,kn.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=an.UUID(),r||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var i=an.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(an.bind((function(){kn.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),s=this.get_config("record_block_selector");""!==s&&null!==s||(s=void 0),this._stopRecording=record({emit:an.bind((function(r){this.batcher.enqueue(r),function isUserEvent(r){return r.type===Er.IncrementalSnapshot&&En.has(r.data.source)}(r)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),i())}),this),blockClass:this.get_config("record_block_class"),blockSelector:s,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(an.bind(this.resetRecording,this),this.recordMaxMs)}else kn.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(r,i,s){this._flushEvents(r,i,s,an.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(r){0===r&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(r,i,s,a){var h=an.bind((function(i,s){200===i.status&&this.replayId===r&&this.seqNo++,a({status:0,httpStatusCode:i.status,responseBody:s,retryAfter:i.headers.get("Retry-After")})}),this);Ir.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:s}).then((function(r){r.json().then((function(i){h(r,i)})).catch((function(r){a({error:r})}))})).catch((function(r){a({error:r,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(r,i,s){const a=r.length;if(a>0){var h=this.replayId,f=r[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=f);var _=r[a-1].timestamp-this.replayStartTime,v={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:f/1e3,replay_id:h,replay_length_ms:_,replay_start_time:this.replayStartTime/1e3},b=an.JSONEncode(r),S=this._mixpanel.get_property("$device_id");S&&(v.$device_id=S);var k=this._mixpanel.get_property("$user_id");if(k&&(v.$user_id=k),wn){var I=new Blob([b],{type:"application/json"}).stream().pipeThrough(new wn("gzip"));new Response(I).blob().then(an.bind((function(r){v.format="gzip",this._sendRequest(h,v,r,s)}),this))}else v.format="body",this._sendRequest(h,v,b,s)}})),MixpanelRecorder.prototype.reportError=function(r,i){kn.error.apply(kn.error,arguments);try{i||r instanceof Error||(r=new Error(r)),this.get_config("error_reporter")(r,i)}catch(s){kn.error(s)}},Ir.__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(r){return this.mp=r,this},DomTracker.prototype.track=function(r,i,s,a){var h=this,f=an.dom_query(r);if(0!==f.length)return an.each(f,(function(r){an.register_event(r,this.override_event,(function(r){var f={},_=h.create_properties(s,this),v=h.mp.get_config("track_links_timeout");h.event_handler(r,this,f),window.setTimeout(h.track_callback(a,_,f,!0),v),h.mp.track(i,_,h.track_callback(a,_,f))}))}),this),!0;cn.error("The DOM query ("+r+") returned 0 elements")},DomTracker.prototype.track_callback=function(r,i,s,a){a=a||!1;var h=this;return function(){s.callback_fired||(s.callback_fired=!0,r&&!1===r(a,i)||h.after_track_handler(i,s,a))}},DomTracker.prototype.create_properties=function(r,i){return"function"==typeof r?r(i):an.extend({},r)};var LinkTracker=function(){this.override_event="click"};an.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(r,i){var s=LinkTracker.superclass.create_properties.apply(this,arguments);return i.href&&(s.url=i.href),s},LinkTracker.prototype.event_handler=function(r,i,s){s.new_tab=2===r.which||r.metaKey||r.ctrlKey||"_blank"===i.target,s.href=i.href,s.new_tab||r.preventDefault()},LinkTracker.prototype.after_track_handler=function(r,i){i.new_tab||setTimeout((function(){window.location=i.href}),0)};var FormTracker=function(){this.override_event="submit"};an.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(r,i,s){s.element=i,r.preventDefault()},FormTracker.prototype.after_track_handler=function(r,i){setTimeout((function(){i.element.submit()}),0)};var xn="$set",Cn="$set_once",Tn="$unset",On="$add",Rn="$append",Mn="$union",Nn="$remove",Pn={set_action:function(r,i){var s={},a={};return an.isObject(r)?an.each(r,(function(r,i){this._is_reserved_property(i)||(a[i]=r)}),this):a[r]=i,s[xn]=a,s},unset_action:function(r){var i={},s=[];return an.isArray(r)||(r=[r]),an.each(r,(function(r){this._is_reserved_property(r)||s.push(r)}),this),i[Tn]=s,i},set_once_action:function(r,i){var s={},a={};return an.isObject(r)?an.each(r,(function(r,i){this._is_reserved_property(i)||(a[i]=r)}),this):a[r]=i,s[Cn]=a,s},union_action:function(r,i){var s={},a={};return an.isObject(r)?an.each(r,(function(r,i){this._is_reserved_property(i)||(a[i]=an.isArray(r)?r:[r])}),this):a[r]=an.isArray(i)?i:[i],s[Mn]=a,s},append_action:function(r,i){var s={},a={};return an.isObject(r)?an.each(r,(function(r,i){this._is_reserved_property(i)||(a[i]=r)}),this):a[r]=i,s[Rn]=a,s},remove_action:function(r,i){var s={},a={};return an.isObject(r)?an.each(r,(function(r,i){this._is_reserved_property(i)||(a[i]=r)}),this):a[r]=i,s[Nn]=a,s},delete_action:function(){var r={$delete:""};return r}},MixpanelGroup=function(){};an.extend(MixpanelGroup.prototype,Pn),MixpanelGroup.prototype._init=function(r,i,s){this._mixpanel=r,this._group_key=i,this._group_id=s},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(r,i,s){var a=this.set_action(r,i);return an.isObject(r)&&(s=i),this._send_request(a,s)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(r,i,s){var a=this.set_once_action(r,i);return an.isObject(r)&&(s=i),this._send_request(a,s)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(r,i){var s=this.unset_action(r);return this._send_request(s,i)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(r,i,s){an.isObject(r)&&(s=i);var a=this.union_action(r,i);return this._send_request(a,s)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(r){var i=this.delete_action();return this._send_request(i,r)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(r,i,s){var a=this.remove_action(r,i);return this._send_request(a,s)})),MixpanelGroup.prototype._send_request=function(r,i){r.$group_key=this._group_key,r.$group_id=this._group_id,r.$token=this._get_config("token");var s=an.encodeDates(r);return this._mixpanel._track_or_batch({type:"groups",data:s,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(r){return"$group_key"===r||"$group_id"===r},MixpanelGroup.prototype._get_config=function(r){return this._mixpanel.get_config(r)},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(){};an.extend(MixpanelPeople.prototype,Pn),MixpanelPeople.prototype._init=function(r){this._mixpanel=r},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(r,i,s){var a=this.set_action(r,i);return an.isObject(r)&&(s=i),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),a[xn]=an.extend({},an.info.people_properties(),a[xn]),this._send_request(a,s)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(r,i,s){var a=this.set_once_action(r,i);return an.isObject(r)&&(s=i),this._send_request(a,s)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(r,i){var s=this.unset_action(r);return this._send_request(s,i)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(r,i,s){var a={},h={};return an.isObject(r)?(an.each(r,(function(r,i){if(!this._is_reserved_property(i)){if(isNaN(parseFloat(r)))return void cn.error("Invalid increment value passed to mixpanel.people.increment - must be a number");h[i]=r}}),this),s=i):(an.isUndefined(i)&&(i=1),h[r]=i),a[On]=h,this._send_request(a,s)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(r,i,s){an.isObject(r)&&(s=i);var a=this.append_action(r,i);return this._send_request(a,s)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(r,i,s){an.isObject(r)&&(s=i);var a=this.remove_action(r,i);return this._send_request(a,s)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(r,i,s){an.isObject(r)&&(s=i);var a=this.union_action(r,i);return this._send_request(a,s)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(r,i,s){if(an.isNumber(r)||(r=parseFloat(r),!isNaN(r)))return this.append("$transactions",an.extend({$amount:r},i),s);cn.error("Invalid value passed to mixpanel.people.track_charge - must be a number")})),MixpanelPeople.prototype.clear_charges=function(r){return this.set("$transactions",[],r)},MixpanelPeople.prototype.delete_user=function(){if(this._identify_called()){var r={$delete:this._mixpanel.get_distinct_id()};return this._send_request(r)}cn.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(r,i){r.$token=this._get_config("token"),r.$distinct_id=this._mixpanel.get_distinct_id();var s=this._mixpanel.get_property("$device_id"),a=this._mixpanel.get_property("$user_id"),h=this._mixpanel.get_property("$had_persisted_distinct_id");s&&(r.$device_id=s),a&&(r.$user_id=a),h&&(r.$had_persisted_distinct_id=h);var f=an.encodeDates(r);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:f,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},i):(this._enqueue(r),an.isUndefined(i)||(this._get_config("verbose")?i({status:-1,error:null}):i(-1)),an.truncate(f,255))},MixpanelPeople.prototype._get_config=function(r){return this._mixpanel.get_config(r)},MixpanelPeople.prototype._identify_called=function(){return!0===this._mixpanel._flags.identify_called},MixpanelPeople.prototype._enqueue=function(r){xn in r?this._mixpanel.persistence._add_to_people_queue(xn,r):Cn in r?this._mixpanel.persistence._add_to_people_queue(Cn,r):Tn in r?this._mixpanel.persistence._add_to_people_queue(Tn,r):On in r?this._mixpanel.persistence._add_to_people_queue(On,r):Rn in r?this._mixpanel.persistence._add_to_people_queue(Rn,r):Nn in r?this._mixpanel.persistence._add_to_people_queue(Nn,r):Mn in r?this._mixpanel.persistence._add_to_people_queue(Mn,r):cn.error("Invalid call to _enqueue():",r)},MixpanelPeople.prototype._flush_one_queue=function(r,i,s,a){var h=this,f=an.extend({},this._mixpanel.persistence.load_queue(r)),_=f;an.isUndefined(f)||!an.isObject(f)||an.isEmptyObject(f)||(h._mixpanel.persistence._pop_from_people_queue(r,f),h._mixpanel.persistence.save(),a&&(_=a(f)),i.call(h,_,(function(i,a){0===i&&h._mixpanel.persistence._add_to_people_queue(r,f),an.isUndefined(s)||s(i,a)})))},MixpanelPeople.prototype._flush=function(r,i,s,a,h,f,_){var v=this;this._flush_one_queue(xn,this.set,r),this._flush_one_queue(Cn,this.set_once,a),this._flush_one_queue(Tn,this.unset,f,(function(r){return an.keys(r)})),this._flush_one_queue(On,this.increment,i),this._flush_one_queue(Mn,this.union,h);var b=this._mixpanel.persistence.load_queue(Rn);if(!an.isUndefined(b)&&an.isArray(b)&&b.length)for(var S,append_callback=function(r,i){0===r&&v._mixpanel.persistence._add_to_people_queue(Rn,S),an.isUndefined(s)||s(r,i)},k=b.length-1;k>=0;k--)b=this._mixpanel.persistence.load_queue(Rn),S=b.pop(),v._mixpanel.persistence.save(),an.isEmptyObject(S)||v.append(S,append_callback);var I=this._mixpanel.persistence.load_queue(Nn);if(!an.isUndefined(I)&&an.isArray(I)&&I.length)for(var C,remove_callback=function(r,i){0===r&&v._mixpanel.persistence._add_to_people_queue(Nn,C),an.isUndefined(_)||_(r,i)},T=I.length-1;T>=0;T--)I=this._mixpanel.persistence.load_queue(Nn),C=I.pop(),v._mixpanel.persistence.save(),an.isEmptyObject(C)||v.remove(C,remove_callback)},MixpanelPeople.prototype._is_reserved_property=function(r){return"$distinct_id"===r||"$token"===r||"$device_id"===r||"$user_id"===r||"$had_persisted_distinct_id"===r},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 Dn,Zn="__mps",An="__mpso",Ln="__mpus",jn="__mpa",Fn="__mpap",qn="__mpr",$n="__mpu",Un="$people_distinct_id",Bn="__alias",zn="__timers",Vn=[Zn,An,Ln,jn,Fn,qn,$n,Un,Bn,zn],MixpanelPersistence=function(r){this.props={},this.campaign_params_saved=!1,r.persistence_name?this.name="mp_"+r.persistence_name:this.name="mp_"+r.token+"_mixpanel";var i=r.persistence;"cookie"!==i&&"localStorage"!==i&&(cn.critical("Unknown persistence type "+i+"; falling back to cookie"),i=r.persistence="cookie"),"localStorage"===i&&an.localStorage.is_supported()?this.storage=an.localStorage:this.storage=an.cookie,this.load(),this.update_config(r),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var r={};return this.load(),an.each(this.props,(function(i,s){an.include(Vn,s)||(r[s]=i)})),r},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var r=this.storage.parse(this.name);r&&(this.props=an.extend({},r))}},MixpanelPersistence.prototype.upgrade=function(){var r,i;this.storage===an.localStorage?(r=an.cookie.parse(this.name),an.cookie.remove(this.name),an.cookie.remove(this.name,!0),r&&this.register_once(r)):this.storage===an.cookie&&(i=an.localStorage.parse(this.name),an.localStorage.remove(this.name),i&&this.register_once(i))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,an.JSONEncode(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},MixpanelPersistence.prototype.load_prop=function(r){return this.load(),this.props[r]},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(r,i,s){return!!an.isObject(r)&&(void 0===i&&(i="None"),this.expire_days=void 0===s?this.default_expiry:s,this.load(),an.each(r,(function(r,s){this.props.hasOwnProperty(s)&&this.props[s]!==i||(this.props[s]=r)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(r,i){return!!an.isObject(r)&&(this.expire_days=void 0===i?this.default_expiry:i,this.load(),an.extend(this.props,r),this.save(),!0)},MixpanelPersistence.prototype.unregister=function(r){this.load(),r in this.props&&(delete this.props[r],this.save())},MixpanelPersistence.prototype.update_search_keyword=function(r){this.register(an.info.searchInfo(r))},MixpanelPersistence.prototype.update_referrer_info=function(r){this.register_once({$initial_referrer:r||"$direct",$initial_referring_domain:an.info.referringDomain(r)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return an.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},MixpanelPersistence.prototype.update_config=function(r){this.default_expiry=this.expire_days=r.cookie_expiration,this.set_disabled(r.disable_persistence),this.set_cookie_domain(r.cookie_domain),this.set_cross_site(r.cross_site_cookie),this.set_cross_subdomain(r.cross_subdomain_cookie),this.set_secure(r.secure_cookie)},MixpanelPersistence.prototype.set_disabled=function(r){this.disabled=r,this.disabled?this.remove():this.save()},MixpanelPersistence.prototype.set_cookie_domain=function(r){r!==this.cookie_domain&&(this.remove(),this.cookie_domain=r,this.save())},MixpanelPersistence.prototype.set_cross_site=function(r){r!==this.cross_site&&(this.cross_site=r,this.remove(),this.save())},MixpanelPersistence.prototype.set_cross_subdomain=function(r){r!==this.cross_subdomain&&(this.cross_subdomain=r,this.remove(),this.save())},MixpanelPersistence.prototype.get_cross_subdomain=function(){return this.cross_subdomain},MixpanelPersistence.prototype.set_secure=function(r){r!==this.secure&&(this.secure=!!r,this.remove(),this.save())},MixpanelPersistence.prototype._add_to_people_queue=function(r,i){var s=this._get_queue_key(r),a=i[r],h=this._get_or_create_queue(xn),f=this._get_or_create_queue(Cn),_=this._get_or_create_queue(Tn),v=this._get_or_create_queue(On),b=this._get_or_create_queue(Mn),S=this._get_or_create_queue(Nn,[]),k=this._get_or_create_queue(Rn,[]);s===Zn?(an.extend(h,a),this._pop_from_people_queue(On,a),this._pop_from_people_queue(Mn,a),this._pop_from_people_queue(Tn,a)):s===An?(an.each(a,(function(r,i){i in f||(f[i]=r)})),this._pop_from_people_queue(Tn,a)):s===Ln?an.each(a,(function(r){an.each([h,f,v,b],(function(i){r in i&&delete i[r]})),an.each(k,(function(i){r in i&&delete i[r]})),_[r]=!0})):s===jn?(an.each(a,(function(r,i){i in h?h[i]+=r:(i in v||(v[i]=0),v[i]+=r)}),this),this._pop_from_people_queue(Tn,a)):s===$n?(an.each(a,(function(r,i){an.isArray(r)&&(i in b||(b[i]=[]),b[i]=b[i].concat(r))})),this._pop_from_people_queue(Tn,a)):s===qn?(S.push(a),this._pop_from_people_queue(Rn,a)):s===Fn&&(k.push(a),this._pop_from_people_queue(Tn,a)),cn.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),cn.log(i),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(r,i){var s=this.props[this._get_queue_key(r)];an.isUndefined(s)||an.each(i,(function(i,a){r===Rn||r===Nn?an.each(s,(function(r){r[a]===i&&delete r[a]})):delete s[a]}),this)},MixpanelPersistence.prototype.load_queue=function(r){return this.load_prop(this._get_queue_key(r))},MixpanelPersistence.prototype._get_queue_key=function(r){return r===xn?Zn:r===Cn?An:r===Tn?Ln:r===On?jn:r===Rn?Fn:r===Nn?qn:r===Mn?$n:void cn.error("Invalid queue:",r)},MixpanelPersistence.prototype._get_or_create_queue=function(r,i){var s=this._get_queue_key(r);return i=an.isUndefined(i)?{}:i,this.props[s]||(this.props[s]=i)},MixpanelPersistence.prototype.set_event_timer=function(r,i){var s=this.load_prop(zn)||{};s[r]=i,this.props[zn]=s,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(r){var i=(this.load_prop(zn)||{})[r];return an.isUndefined(i)||(delete this.props[zn][r],this.save()),i};var Wn,load_extra_bundle=function(r,i){throw new Error(r+" not available in this build.")},IDENTITY_FUNC=function(r){return r},NOOP_FUNC=function(){},Kn="mixpanel",Hn="base64",Gn="$device:",Yn=Ir.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Jn=!Yn&&-1===Xr.indexOf("MSIE")&&-1===Xr.indexOf("Mozilla"),Xn=null;Hr.sendBeacon&&(Xn=function(){return Hr.sendBeacon.apply(Hr,arguments)});var Qn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},ei={api_host:"https://api-js.mixpanel.com",api_routes:Qn,api_method:"POST",api_transport:"XHR",api_payload_format:Hn,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:Fr,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},ti=!1,MixpanelLib=function(){},create_mplib=function(r,i,s){var a,h=s===Kn?Wn:Wn[s];if(h&&0===Dn)a=h;else{if(h&&!an.isArray(h))return void cn.error("You have already initialized "+s);a=new MixpanelLib}if(a._cached_groups={},a._init(r,i,s),a.people=new MixpanelPeople,a.people._init(a),!a.get_config("skip_first_touch_marketing")){var f=an.info.campaignParams(null),_={},v=!1;an.each(f,(function(r,i){_["initial_"+i]=r,r&&(v=!0)})),v&&a.people.set_once(_)}return Cr.DEBUG=Cr.DEBUG||a.get_config("debug"),!an.isUndefined(h)&&an.isArray(h)&&(a._execute_array.call(a.people,h.people),a._execute_array(h)),a};MixpanelLib.prototype.init=function(r,i,s){if(an.isUndefined(s))this.report_error("You must name your new library: init(token, config, name)");else{if(s!==Kn){var a=create_mplib(r,i,s);return Wn[s]=a,a._loaded(),a}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(r,i,s){i=i||{},this.__loaded=!0,this.config={};var a={};"api_payload_format"in i||(i.api_host||ei.api_host).match(/\.mixpanel\.com/)&&(a.api_payload_format="json");if(this.set_config(an.extend({},ei,a,i,{name:s,token:r,callback_fn:(s===Kn?s:Kn+"."+s)+"._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(an.localStorage.is_supported(!0)&&Yn){if(this.init_batchers(),Xn&&Ir.addEventListener){var h=an.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);Ir.addEventListener("pagehide",(function(r){r.persisted&&h()})),Ir.addEventListener("visibilitychange",(function(){"hidden"===Gr.visibilityState&&h()}))}}else this._batch_requests=!1,cn.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),an.each(this.get_batcher_configs(),(function(r){cn.log("Clearing batch queue "+r.queue_key),an.localStorage.remove(r.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var f=an.UUID();this.get_distinct_id()||this.register_once({distinct_id:Gn+f,$device_id:f},"");var _=this.get_config("track_pageview");_&&this._init_url_change_tracking(_),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(Ir.MutationObserver){var r=an.bind((function(){this._recorder=this._recorder||new Ir.__mp_recorder(this),this._recorder.startRecording()}),this);an.isUndefined(Ir.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),r):r()}else cn.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():cn.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var r={};if(this._recorder){var i=this._recorder.replayId;i&&(r.$mp_replay_id=i)}return r},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 r=an.info.campaignParams(null);an.each(r,function(r,i){this.unregister(i)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(Gr.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(an.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(Gr.referrer)},MixpanelLib.prototype._dom_loaded=function(){an.each(this.__dom_loaded_queue,(function(r){this._track_dom.apply(this,r)}),this),this.has_opted_out_tracking()||an.each(this.__request_queue,(function(r){this._send_request.apply(this,r)}),this),delete this.__dom_loaded_queue,delete this.__request_queue},MixpanelLib.prototype._track_dom=function(r,i){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!ti)return this.__dom_loaded_queue.push([r,i]),!1;var s=(new r).init(this);return s.track.apply(s,i)},MixpanelLib.prototype._init_url_change_tracking=function(r){var i="";if(this.track_pageview()&&(i=an.info.currentUrl()),an.include(["full-url","url-with-path-and-query-string","url-with-path"],r)){Ir.addEventListener("popstate",(function(){Ir.dispatchEvent(new Event("mp_locationchange"))})),Ir.addEventListener("hashchange",(function(){Ir.dispatchEvent(new Event("mp_locationchange"))}));var s=Ir.history.pushState;"function"==typeof s&&(Ir.history.pushState=function(r,i,a){s.call(Ir.history,r,i,a),Ir.dispatchEvent(new Event("mp_locationchange"))});var a=Ir.history.replaceState;"function"==typeof a&&(Ir.history.replaceState=function(r,i,s){a.call(Ir.history,r,i,s),Ir.dispatchEvent(new Event("mp_locationchange"))}),Ir.addEventListener("mp_locationchange",function(){var s=an.info.currentUrl(),a=!1;("full-url"===r?a=s!==i:"url-with-path-and-query-string"===r?a=s.split("#")[0]!==i.split("#")[0]:"url-with-path"===r&&(a=s.split("#")[0].split("?")[0]!==i.split("#")[0].split("?")[0]),a)&&(this.track_pageview()&&(i=s))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(r,i){if(an.isUndefined(r))return null;if(Yn){return function(s){r(s,i)}}var s=this._jsc,a=""+Math.floor(1e8*Math.random()),h=this.get_config("callback_fn")+"["+a+"]";return s[a]=function(h){delete s[a],r(h,i)},h},MixpanelLib.prototype._send_request=function(r,i,s,a){var h=!0;if(Jn)return this.__request_queue.push(arguments),h;var f={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},_=null;a||!an.isFunction(s)&&"string"!=typeof s||(a=s,s=null),s=an.extend(f,s||{}),Yn||(s.method="GET");var v="POST"===s.method,b=Xn&&v&&"sendbeacon"===s.transport.toLowerCase(),S=s.verbose;i.verbose&&(S=!0),this.get_config("test")&&(i.test=1),S&&(i.verbose=1),this.get_config("img")&&(i.img=1),Yn||(a?i.callback=a:(S||this.get_config("test"))&&(i.callback="(function(){})")),i.ip=this.get_config("ip")?1:0,i._=(new Date).getTime().toString(),v&&(_="data="+encodeURIComponent(i.data),delete i.data),r+="?"+an.HTTPBuildQuery(i);var k=this;if("img"in i){var I=Gr.createElement("img");I.src=r,Gr.body.appendChild(I)}else if(b){try{h=Xn(r,_)}catch(N){k.report_error(N),h=!1}try{a&&a(h?1:0)}catch(N){k.report_error(N)}}else if(Yn)try{var C=new XMLHttpRequest;C.open(s.method,r,!0);var T=this.get_config("xhr_headers");if(v&&(T["Content-Type"]="application/x-www-form-urlencoded"),an.each(T,(function(r,i){C.setRequestHeader(i,r)})),s.timeout_ms&&void 0!==C.timeout){C.timeout=s.timeout_ms;var O=(new Date).getTime()}C.withCredentials=!0,C.onreadystatechange=function(){var r;if(4===C.readyState)if(200===C.status){if(a)if(S){var i;try{i=an.JSONDecode(C.responseText)}catch(N){if(k.report_error(N),!s.ignore_json_errors)return;i=C.responseText}a(i)}else a(Number(C.responseText))}else if(r=C.timeout&&!C.status&&(new Date).getTime()-O>=C.timeout?"timeout":"Bad HTTP status: "+C.status+" "+C.statusText,k.report_error(r),a)if(S){var h=C.responseHeaders||{};a({status:0,httpStatusCode:C.status,error:r,retryAfter:h["Retry-After"]})}else a(0)},C.send(_)}catch(N){k.report_error(N),h=!1}else{var R=Gr.createElement("script");R.type="text/javascript",R.async=!0,R.defer=!0,R.src=r;var M=Gr.getElementsByTagName("script")[0];M.parentNode.insertBefore(R,M)}return h},MixpanelLib.prototype._execute_array=function(r){var i,s=[],a=[],h=[];an.each(r,(function(r){r&&(i=r[0],an.isArray(i)?h.push(r):"function"==typeof r?r.call(this):an.isArray(r)&&"alias"===i?s.push(r):an.isArray(r)&&-1!==i.indexOf("track")&&"function"==typeof this[i]?h.push(r):a.push(r))}),this);var execute=function(r,i){an.each(r,(function(r){if(an.isArray(r[0])){var s=i;an.each(r,(function(r){s=s[r[0]].apply(s,r.slice(1))}))}else this[r[0]].apply(this,r.slice(1))}),i)};execute(s,this),execute(a,this),execute(h,this)},MixpanelLib.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},MixpanelLib.prototype.get_batcher_configs=function(){var r="__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:r+"_ev"},people:{type:"people",endpoint:"/"+i.engage,queue_key:r+"_pp"},groups:{type:"groups",endpoint:"/"+i.groups,queue_key:r+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var r=an.bind((function(r){return new RequestBatcher(r.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:an.bind((function(i,s,a){this._send_request(this.get_config("api_host")+r.endpoint,this._encode_data_for_request(i),s,this._prepare_callback(a,i))}),this),beforeSendHook:an.bind((function(i){return this._run_hook("before_send_"+r.type,i)}),this),stopAllBatchingFunc:an.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),i=this.get_batcher_configs();this.request_batchers={events:r(i.events),people:r(i.people),groups:r(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,an.each(this.request_batchers,(function(r){r.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,an.each(this.request_batchers,(function(r){r.stop(),r.clear()}))},MixpanelLib.prototype.push=function(r){this._execute_array([r])},MixpanelLib.prototype.disable=function(r){void 0===r?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(r)},MixpanelLib.prototype._encode_data_for_request=function(r){var i=an.JSONEncode(r);return this.get_config("api_payload_format")===Hn&&(i=an.base64Encode(i)),{data:i}},MixpanelLib.prototype._track_or_batch=function(r,i){var s=an.truncate(r.data,255),a=r.endpoint,h=r.batcher,f=r.should_send_immediately,_=r.send_request_options||{};i=i||NOOP_FUNC;var v=!0,b=an.bind((function(){return _.skip_hooks||(s=this._run_hook("before_send_"+r.type,s)),s?(cn.log("MIXPANEL REQUEST:"),cn.log(s),this._send_request(a,this._encode_data_for_request(s),_,this._prepare_callback(i,s))):null}),this);return this._batch_requests&&!f?h.enqueue(s,(function(r){r?i(1,s):b()})):v=b(),v&&s},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(r,i,s,a){a||"function"!=typeof s||(a=s,s=null);var h=(s=s||{}).transport;h&&(s.transport=h);var f=s.send_immediately;if("function"!=typeof a&&(a=NOOP_FUNC),an.isUndefined(r))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(r)){(i=an.extend({},i)).token=this.get_config("token");var _=this.persistence.remove_event_timer(r);if(!an.isUndefined(_)){var v=(new Date).getTime()-_;i.$duration=parseFloat((v/1e3).toFixed(3))}this._set_default_superprops();var b=this.get_config("track_marketing")?an.info.marketingParams():{};i=an.extend({},an.info.properties({mp_loader:this.get_config("mp_loader")}),b,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),i);var S=this.get_config("property_blacklist");an.isArray(S)?an.each(S,(function(r){delete i[r]})):this.report_error("Invalid value for property_blacklist config: "+S);var k={event:r,properties:i};return this._track_or_batch({type:"events",data:k,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:f,send_request_options:s},a)}a(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(r,i,s){an.isArray(i)||(i=[i]);var a={};return a[r]=i,this.register(a),this.people.set(r,i,s)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(r,i,s){var a=this.get_property(r),h={};return void 0===a?(h[r]=[i],this.register(h)):-1===a.indexOf(i)&&(a.push(i),h[r]=a,this.register(h)),this.people.union(r,i,s)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(r,i,s){var a=this.get_property(r);if(void 0!==a){var h=a.indexOf(i);h>-1&&(a.splice(h,1),this.register({group_key:a})),0===a.length&&this.unregister(r)}return this.people.remove(r,i,s)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(r,i,s,a){var h=an.extend({},i||{});return an.each(s,(function(r,i){null!=r&&(h[i]=r)})),this.track(r,h,a)})),MixpanelLib.prototype._create_map_key=function(r,i){return r+"_"+JSON.stringify(i)},MixpanelLib.prototype._remove_group_from_cache=function(r,i){delete this._cached_groups[this._create_map_key(r,i)]},MixpanelLib.prototype.get_group=function(r,i){var s=this._create_map_key(r,i),a=this._cached_groups[s];return void 0!==a&&a._group_key===r&&a._group_id===i||((a=new MixpanelGroup)._init(this,r,i),this._cached_groups[s]=a),a},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(r,i){"object"!=typeof r&&(r={});var s=(i=i||{}).event_name||"$mp_web_page_view",a=an.extend(an.info.mpPageViewProperties(),an.info.campaignParams(),an.info.clickParams()),h=an.extend({},a,r);return this.track(s,h)})),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(r){an.isUndefined(r)?this.report_error("No event name provided to mixpanel.time_event"):this._event_is_disabled(r)||this.persistence.set_event_timer(r,(new Date).getTime())};var ri={persistent:!0},options_for_register=function(r){var i;return i=an.isObject(r)?r:an.isUndefined(r)?{}:{days:r},an.extend({},ri,i)};MixpanelLib.prototype.register=function(r,i){var s=options_for_register(i);s.persistent?this.persistence.register(r,s.days):an.extend(this.unpersisted_superprops,r)},MixpanelLib.prototype.register_once=function(r,i,s){var a=options_for_register(s);a.persistent?this.persistence.register_once(r,i,a.days):(void 0===i&&(i="None"),an.each(r,(function(r,s){this.unpersisted_superprops.hasOwnProperty(s)&&this.unpersisted_superprops[s]!==i||(this.unpersisted_superprops[s]=r)}),this))},MixpanelLib.prototype.unregister=function(r,i){(i=options_for_register(i)).persistent?this.persistence.unregister(r):delete this.unpersisted_superprops[r]},MixpanelLib.prototype._register_single=function(r,i){var s={};s[r]=i,this.register(s)},MixpanelLib.prototype.identify=function(r,i,s,a,h,f,_,v){var b=this.get_distinct_id();if(r&&b!==r){if("string"==typeof r&&0===r.indexOf(Gn))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:r})}if(!this.get_property("$device_id")){var S=b;this.register_once({$had_persisted_distinct_id:!0,$device_id:S},"")}r!==b&&r!==this.get_property(Bn)&&(this.unregister(Bn),this.register({distinct_id:r})),this._flags.identify_called=!0,this.people._flush(i,s,a,h,f,_,v),r!==b&&this.track("$identify",{distinct_id:r,$anon_distinct_id:b},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var r=an.UUID();this.register_once({distinct_id:Gn+r,$device_id:r},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(r,i){if(r===this.get_property(Un))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var s=this;return an.isUndefined(i)&&(i=this.get_distinct_id()),r!==i?(this._register_single(Bn,r),this.track("$create_alias",{alias:r,distinct_id:i},{skip_hooks:!0},(function(){s.identify(r)}))):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(r),-1)},MixpanelLib.prototype.name_tag=function(r){this._register_single("mp_name_tag",r)},MixpanelLib.prototype.set_config=function(r){an.isObject(r)&&(an.extend(this.config,r),r.batch_size&&an.each(this.request_batchers,(function(r){r.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),Cr.DEBUG=Cr.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(r){return this.config[r]},MixpanelLib.prototype._run_hook=function(r){var i=(this.config.hooks[r]||IDENTITY_FUNC).apply(this,zr.call(arguments,1));return void 0===i&&(this.report_error(r+" hook did not return a value"),i=null),i},MixpanelLib.prototype.get_property=function(r){return this.persistence.load_prop([r])},MixpanelLib.prototype.toString=function(){var r=this.get_config("name");return r!==Kn&&(r=Kn+"."+r),r},MixpanelLib.prototype._event_is_disabled=function(r){return an.isBlockedUA(Xr)||this._flags.disable_all_events||an.include(this.__disabled_events,r)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&an.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")&&!an.cookie.get("mp_optout")||(an.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},MixpanelLib.prototype._gdpr_update_persistence=function(r){var i;if(r&&r.clear_persistence)i=!0;else{if(!r||!r.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(r,i){return i=an.extend({track:an.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),an.localStorage.is_supported()||(i.persistence_type="cookie"),r(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(r){r=an.extend({enable_persistence:!0},r),this._gdpr_call_func(optIn,r),this._gdpr_update_persistence(r)},MixpanelLib.prototype.opt_out_tracking=function(r){(r=an.extend({clear_persistence:!0,delete_user:!0},r)).delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(optOut,r),this._gdpr_update_persistence(r)},MixpanelLib.prototype.has_opted_in_tracking=function(r){return this._gdpr_call_func(hasOptedIn,r)},MixpanelLib.prototype.has_opted_out_tracking=function(r){return this._gdpr_call_func(hasOptedOut,r)},MixpanelLib.prototype.clear_opt_in_out_tracking=function(r){r=an.extend({enable_persistence:!0},r),this._gdpr_call_func(clearOptInOut,r),this._gdpr_update_persistence(r)},MixpanelLib.prototype.report_error=function(r,i){cn.error.apply(cn.error,arguments);try{i||r instanceof Error||(r=new Error(r)),this.get_config("error_reporter")(r,i)}catch(s){cn.error(s)}},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=Qn,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 ni={},override_mp_init_func=function(){Wn.init=function(r,i,s){if(s)return Wn[s]||(Wn[s]=ni[s]=create_mplib(r,i,s),Wn[s]._loaded()),Wn[s];var a=Wn;ni[Kn]?a=ni[Kn]:r&&((a=create_mplib(r,i,Kn))._loaded(),ni[Kn]=a),Wn=a,1===Dn&&(Ir[Kn]=Wn),an.each(ni,(function(r,i){i!==Kn&&(Wn[i]=r)})),Wn._=an}};var ii=function init_as_module(r){return load_extra_bundle=r,Dn=0,Wn=new MixpanelLib,override_mp_init_func(),Wn.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,ti=!0,Jn=!1,an.each(ni,(function(r){r._dom_loaded()})))}if(Gr.addEventListener)"complete"===Gr.readyState?dom_loaded_handler():Gr.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(Gr.attachEvent){Gr.attachEvent("onreadystatechange",dom_loaded_handler);var r=!1;try{r=null===Ir.frameElement}catch(i){}Gr.documentElement.doScroll&&r&&function do_scroll_check(){try{Gr.documentElement.doScroll("left")}catch(i){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}an.register_event(Ir,"load",dom_loaded_handler,!0)}(),Wn}((function loadNoop(r,i){i()}));const oi="mp_distinct_id";function isReady(){return void 0!==window.mixpanel}function updateCachedDistinctId(r){localStorage.setItem(oi,r)}const si={init:function init$2(r,i=!1,s){return new Promise((a=>{ii.init(r,{debug:i,loaded:()=>{window.mixpanel=ii,a()},...s&&{api_host:s}})}))},isReady:isReady,track:function track(r,i){isReady()&&ii.track(r,{...i,"Reservamos Version":"1.0.21"})},identify:function identify$1(r,i){ii.identify(r),updateCachedDistinctId(r),ii.people.set(i)},attachProperty:function attachProperty(r,i){isReady()&&ii.people.union(r,[i])},getMixpanelDistinctId:()=>{const r=localStorage.getItem(oi);if(ii&&ii.get_distinct_id){const r=ii.get_distinct_id();return updateCachedDistinctId(r),r}return r||null}},ai=Oe.object({firstName:Oe.string().optional(),lastName:Oe.string().optional(),email:Oe.string().email().optional(),phone:Oe.string().optional()}),ci=["web","web-mobile","ios","android","app"],di=Oe.enum(ci).refine((r=>ci.includes(r)),{message:`Product must be one of: ${ci.join(", ")}`}),ui=Oe.object({product:di});const dateValidation=r=>!(!/^\d{4}-\d{2}-\d{2}$/.test(r)&&!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$/.test(r))||!(!/^\d{4}-\d{2}-\d{2}/.test(r)||isNaN(Date.parse(r))),stringField=r=>Oe.string().refine((r=>r),{message:`${r} must be a string`}),numberField=r=>Oe.number().refine((r=>r),{message:`${r} must be a number`}),intField=r=>Oe.number().int().refine((r=>r),{message:`${r} must be an integer`}),dateField=r=>Oe.string().refine(dateValidation,{message:`Invalid ${r} datetime format`}),arrayField=(r,i,s)=>Oe.array(r).min(s,`${i} must have at least ${s} items`),li=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:di});const pi=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(),hi=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()}),fi=Oe.object({Trips:arrayField(hi,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count").optional(),Total:numberField("Total"),product:di,Passengers:arrayField(pi,"Passengers",1).optional()}).strict();const mi=Oe.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(hi,"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:di,Passengers:arrayField(pi,"Passengers",1).optional(),Insurance:(gi="Insurance",Oe.boolean({required_error:`${gi} is required`,invalid_type_error:`${gi} must be a boolean`})).optional(),Coupon:stringField("Coupon").optional(),"User Status":stringField("User Status").optional()}).strict();var gi;const _i=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:di,"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 yi=Oe.object({"Operation Id":stringField("Operation Id").optional(),Trips:arrayField(hi,"Trips",1),"Passenger Count":intField("Passenger Count"),"Trip Count":intField("Trip Count"),Total:numberField("Total"),product:di,Passengers:arrayField(pi,"Passengers",1).optional()}).strict();const vi=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:di});const bi=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:di});const Si=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:di}),ki=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=r=>r.issues.map((r=>{let i="INVALID_FIELD",s="",a="",h="";return"invalid_type"===r.code?(i="TYPE_MISMATCH",s=r.expected,a=r.received,h=`Expected ${s} but received ${a}. Please provide a value of type ${s}.`):"too_small"===r.code?(i="VALUE_TOO_SMALL",h=`Increase the value to at least ${r.minimum}.`):"too_big"===r.code?(i="VALUE_TOO_BIG",h=`Reduce the value to no more than ${r.maximum}.`):(i="INVALID_FIELD",h="Ensure the field matches the expected format and value type."),{field:r.path.join("."),error_type:i,expected:s,received:a,message:r.message,suggestion:h}})),wi={Search:vi,"Seat Change":bi,"Interest In Home":ui,"Passengers Created":fi,"Payment Attempt":mi,"Interest In Search":li,"View Results":Si,"Purchase Attempt":yi,"Picked Departure":_i};function validateProps(r,i){try{i.parse(r)}catch(Dr){if(Dr instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Dr)}}throw{message:"Unknown validation error"}}}const Ii={parseEventProps:function parseEventProps(r,i){const s=wi[r]||Me;try{s.parse(i)}catch(Dr){if(Dr instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Dr)}}throw{message:"Unknown validation error"}}},parseInitProps:function parseInitProps(r){validateProps(r,ki)},parseIdentifyProps:function parseIdentifyProps(r){validateProps(r,ai)},validateProps:validateProps};function isTrackerReady(){return si.isReady()}let Ei=null;const xi="geolocationPermissionTimestamp",Ci=6048e5;function updatePermissionTimestamp(r){localStorage.setItem(xi,r.toString())}const Ti={init:function init(){return new Promise((r=>{if(function isPermissionTimestampValid(r){return!!r&&Date.now()-parseInt(r,10)<Ci}(localStorage.getItem(xi)))return void r(Ei);const i="Geolocation Requested",s=Date.now();navigator.geolocation.getCurrentPosition((a=>{const{latitude:h,longitude:f}=a.coords;Ei={lat:h,long:f},updatePermissionTimestamp(s),isTrackerReady()&&trackCustomEvent(i,{geolocationAccepted:!0}),r(Ei)}),(()=>{updatePermissionTimestamp(s),isTrackerReady()&&trackCustomEvent(i,{geolocationAccepted:!1}),r(null)}))}))},getCoordinates:function getCoordinates(){return Ei}},Oi=["Search","View Results"],Ri={utm_brand:"UTM Brand",utm_kxconfig:"UTM KXConfig",gad_source:"GAD Source",gclid:"GCLID"};function trackEventError(r,i,s){tryTrackEvent((async()=>{try{si.track("Track Event Error",{"Failed Event Name":r,"Error Message":(null==i?void 0:i.message)??"Failed to track event","Validation Errors":(null==i?void 0:i.errors)||[],"Event Payload":s})}catch(a){console.error("Failed to track error event:",a)}}))}async function tryTrackEvent(r){si.isReady()?await r():window.addEventListener("Tracker Ready",(async()=>{await r()}))}async function trackEvent(r,i,s={}){if(!si.isReady())throw new Error("Mixpanel is not initialized.");try{Ii.parseEventProps(r,i);const a=!Oi.includes(r);si.getMixpanelDistinctId();const h=await wt.getFingerprint(a),f={},_=Ti.getCoordinates();_&&(f.$latitude=_.lat,f.$longitude=_.long);const v={"User Fingerprint":h},b=function extractTrackingParams(){try{const r=new URLSearchParams(window.location.search),i={};return Object.entries(Ri).forEach((([s,a])=>{const h=r.get(s);h&&(i[a]=h)})),i}catch(Dr){return console.error("Error extracting tracking parameters:",Dr),{}}}(),S=function flattenEventData(r){return Object.entries(r).reduce(((r,[i,s])=>Array.isArray(s)?Array.isArray(s)&&s.every((r=>"string"==typeof r||"number"==typeof r||"boolean"==typeof r))?(r[i]=s,r):(s.forEach((i=>{"object"==typeof i&&null!==i&&Object.entries(i).forEach((([i,s])=>{r[i]?r[i].push(s):r[i]=[s]}))})),r):(r[i]=s,r)),{})}(i),k={...v,...S,...b,...f,...s};si.track(r,k)}catch(Dr){console.error(`Error tracking event '${r}':`,Dr),trackEventError(r,Dr,i)}}function trackCustomEvent(r,i={},s={}){try{Ne.parse(r),trackEvent(r,i,s)}catch(Dr){console.error("Error trackCustomEvent:",Dr),trackEventError(r,Dr,i)}}const Mi=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((r=>r.email||r.phone),{message:"At least one of 'email' or 'phone' must be provided"});async function createAnonymousProfile(r){try{Ii.validateProps(r,Mi);const i=[],s=wt.getCachedFingerprint(),a=si.getMixpanelDistinctId();s&&i.push({key:"fingerprint",value:s}),a&&i.push({key:"distinct_id",value:a});const h=function getAnonymousProfilePayload(r,i){let s="phone",a=r.phone||"";const h=[],f={};r.email&&(s="email",a=r.email);const _=["cpf","passport","rg","email","phone","salesforceid"],v=["name","firstName","lastName"];return Object.entries(r).forEach((([r,i])=>{r=function isCamelCase(r){return!(!r||r.includes(" ")||r[0]!==r[0].toLowerCase()||/[^a-zA-Z]/.test(r)||!/[A-Z]/.test(r))}(r)?r:r.toLocaleLowerCase(),_.includes(r)&&i?r!==s&&h.push({key:r,value:i}):v.includes(r)&&i&&(f[r]=i)})),i.length&&i.forEach((r=>h.push(r))),{identifier_key:s,identifier_value:a,details:f,identifiers:h}}(r,i);return await Lt.profiles.createAnonymousProfile(h)}catch(Dr){return void console.error("Could not create anonymous profile:",Dr)}}const Ni=["firstName","lastName","email","phone"];Oe.object({"Operation Id":stringField("Operation Id"),Trips:arrayField(hi,"Trips",1).optional(),"Passenger Count":numberField("Passenger Count").optional(),Total:numberField("Total").optional(),"Trip Count":numberField("Trip Count").optional(),product:di,Passengers:arrayField(pi,"Passengers",1).optional()});const Pi=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()}),Di=Oe.object({passengers:Oe.array(Pi).min(1)});const Zi=Oe.object({category:Oe.string(),number:Oe.string().optional(),occupied:Oe.boolean().optional(),adjacent_seats:Oe.null().optional()}),Ai=Oe.object({bus:Oe.array(Oe.array(Oe.array(Zi)))}),Li=Oe.object({bus_type:Oe.string(),selected_seats:Oe.string(),bus_scheme:Ai});const ji=Oe.object({passengerId:Oe.string()}).refine((r=>r.passengerId),{message:"A 'passengerId' must be provided"});const Fi=Oe.object({category:Oe.string(),number:Oe.string().optional(),occupied:Oe.boolean().optional(),adjacent_seats:Oe.null().optional()}),qi=Oe.object({bus:Oe.array(Oe.array(Oe.array(Fi)))}),$i=Oe.object({bus_scheme:qi,total_seats:Oe.number()});const Ui=Oe.object({searchId:Oe.number().min(1,"SearchId is required")});const Bi={init:async function init$1(r){Ii.parseInitProps(r);const{mixpanelToken:i,debug:s=!1,identificationKey:a,isSandbox:h=!1,mixpanelProxyUrl:f,identifyProxyUrl:_}=r;Ti.init(),await si.init(i,s,f);try{await wt.initFingerprint(a,_)}catch(Dr){console.error("Error initializing identification service:",Dr)}$t.setEnvironment(h?"sandbox":"prod"),Lt.setConfig($t.getCoreAPIConfig()),function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},isReady:isTrackerReady,identify:async function identify(r,i={}){tryTrackEvent((async()=>{try{if(Ii.parseIdentifyProps(i),!r)throw console.error("User ID is required for identification."),new Error("User ID is required for identification.");const s=await createAnonymousProfile(i);s&&(i.reservamos_one_id=s.id);const a=function mapProperties(r){return{$first_name:null==r?void 0:r.firstName,$last_name:null==r?void 0:r.lastName,$email:null==r?void 0:r.email,$phone:null==r?void 0:r.phone,...Object.keys(r).reduce(((i,s)=>(Ni.includes(s)||(i[s]=r[s]),i)),{})}}(i);si.identify(r,a);const h=await wt.getFingerprint();h&&si.attachProperty("Known Fingerprints",h)}catch(Dr){console.error("Error identifying user",Dr),trackEventError("Identify",Dr,{userId:r,properties:i})}finally{(async(r,i)=>{var s,a;try{const h=Ti.getCoordinates();if(!h)return;i.first_name=i.firstName,i.last_name=i.lastName,i.latitude=h.lat,i.longitude=h.long,i.ip="0",i.name=`${i.firstName} ${i.lastName}`,delete i.firstName,delete i.lastName;const f=$t.getCoreAPIConfig();fetch(`${f.baseUrl}/v1/datalake/identify`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:(null==(s=f.defaultHeaders)?void 0:s.Authorization)||"",Origin:(null==(a=f.defaultHeaders)?void 0:a.Origin)||""},body:JSON.stringify({profile_params:{...i,distinct_id:r}})})}catch(Dr){console.error("Error identifying user-service",Dr)}})(r,i)}}))},identifiers:{getFingerprintId:wt.getCachedFingerprint,getDistinctId:si.getMixpanelDistinctId},profiles:{createAnonymousProfile:createAnonymousProfile},recommendations:{getRecommendedPlaces:async function getRecommendedPlaces(){const r=si.getMixpanelDistinctId();if(!r)throw new Error("No distinct ID found");const i=await Lt.recommendations.createRecommendedPlaces({distinct_id:r});if(!i)throw new Error("No response received");return await(async r=>new Promise(((i,s)=>{const{state:a,polling_id:h}=r;"finished"!==a?Lt.recommendations.pollRecommendedPlaces(h,{start:!0,watch:"state",expect:"finished",onEachResponse:r=>{"finished"!==r.status?"failed"!==r.status||s(r):i(r)}}):i(r)})))(i)},createRecommendedSeats:async function createRecommendedSeats$1(r){try{Ii.validateProps(r,Li);const i=si.getMixpanelDistinctId(),s=wt.getCachedFingerprint();if(!i)throw new Error("No distinct ID found");return await Lt.recommendations.createRecommendedSeats({...r,distinct_id:i,device_fingerprint:s||""})}catch(Dr){throw console.error("Could not create recommended seats:",Dr),new Error(Dr instanceof Error?Dr.message:String(Dr))}},getRecommendedSeats:async function createRecommendedSeats(r){try{Ii.validateProps(r,$i);const i=si.getMixpanelDistinctId();if(!i)throw new Error("No distinct ID found");return await Lt.recommendations.getRecommendedSeats({...r,distinct_id:i})}catch(Dr){throw console.error("Could not create recommended seats:",Dr),new Error(Dr instanceof Error?Dr.message:String(Dr))}},getRecommendedTrips:async function getRecommendedTrips({searchId:r}){try{Ii.validateProps({searchId:r},Ui);const i=wt.getCachedFingerprint()||si.getMixpanelDistinctId();if(!i)throw new Error("No identifier id");return await Lt.recommendations.getRecommendedTrips({searchId:r,userIdentifier:String(i)})}catch(Dr){throw console.error("Could not get recommended trips:",Dr),new Error(Dr instanceof Error?Dr.message:String(Dr))}},createFrequentPassengers:async function createFrequentPassengers(r){try{Ii.validateProps(r,Di);const i=si.getMixpanelDistinctId(),s=wt.getCachedFingerprint();if(!i)throw new Error("No distinct ID found");return await Lt.recommendations.createFrequentPassengers({...r,distinct_id:i,device_fingerprint:s||""})}catch(Dr){throw new Error(Dr instanceof Error?Dr.message:String(Dr))}},getFrequentPassengers:async function getFrequentPassengers(){try{const r=si.getMixpanelDistinctId();if(!r)throw new Error("No distinct ID found");return await Lt.recommendations.getFrequentPassengers(r)}catch(Dr){throw new Error(Dr instanceof Error?Dr.message:String(Dr))}},deleteFrequentPassenger:async function deleteFrequentPassengers(r){try{Ii.validateProps(r,ji);const i=si.getMixpanelDistinctId();if(!i)throw new Error("No distinct ID found");return await Lt.recommendations.deleteFrequentPassenger(i,r.passengerId)}catch(Dr){throw new Error(Dr instanceof Error?Dr.message:String(Dr))}}},track:{search:function trackSearch(r,i={}){trackEvent("Search",r,i)},seatChange:function trackSeatChange(r,i={}){trackEvent("Seat Change",r,i)},interestInHome:function trackInterestInHome(r,i={}){trackEvent("Interest In Home",r,i)},interestInSearch:function trackInterestInSearch(r,i={}){trackEvent("Interest In Search",r,i)},viewResults:function trackViewResults(r,i={}){trackEvent("View Results",r,i)},passengersCreated:function trackPassengersCreated(r,i={}){trackEvent("Passengers Created",r,i)},paymentAttempt:async(r,i={})=>{trackEvent("Payment Attempt",r,i)},purchaseAttempt:function trackPurchaseAttempt(r,i={}){trackEvent("Purchase Attempt",r,i)},pickedDeparture:function trackSearch$1(r,i={}){trackEvent("Picked Departure",r,i)},customEvent:trackCustomEvent,purchaseCanceled:function trackPurchaseCanceled(r,i={}){trackEvent("Purchase Canceled",r,i)}}};return Bi}();
31
31
  //# sourceMappingURL=browser-analytics.iife.js.map