@reservamos/browser-analytics 0.1.4-alpha.2 → 0.1.4-alpha.3
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.
- package/dist/browser-analytics.cjs +2 -2
- package/dist/browser-analytics.d.ts +83 -20
- package/dist/browser-analytics.esm.js +37 -4
- package/dist/browser-analytics.iife.js +2 -2
- package/package.json +1 -1
- package/src/events/seatChange/index.ts +7 -0
- package/src/events/seatChange/seatChangeSchema.ts +46 -0
- package/src/events/seatChange/trackSeatChange.ts +10 -0
- package/src/index.ts +5 -2
- package/src/services/validator.ts +2 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e,t,n;(t=e||(e={})).assertEqual=e=>e,t.assertIs=function assertIs(e){},t.assertNever=function assertNever(e){throw new Error},t.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},t.getValidEnumValues=e=>{const n=t.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),i={};for(const t of n)i[t]=e[t];return t.objectValues(i)},t.objectValues=e=>t.objectKeys(e).map((function(t){return e[t]})),t.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},t.find=(e,t)=>{for(const n of e)if(t(n))return n},t.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,t.joinValues=function joinValues(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},t.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(n||(n={})).mergeShapes=(e,t)=>({...e,...t});const i=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 i.undefined;case"string":return i.string;case"number":return isNaN(e)?i.nan:i.number;case"boolean":return i.boolean;case"function":return i.function;case"bigint":return i.bigint;case"symbol":return i.symbol;case"object":return Array.isArray(e)?i.array:null===e?i.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?i.promise:"undefined"!=typeof Map&&e instanceof Map?i.map:"undefined"!=typeof Set&&e instanceof Set?i.set:"undefined"!=typeof Date&&e instanceof Date?i.date:i.object;default:return i.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 t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},processError=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(processError);else if("invalid_return_type"===i.code)processError(i.returnTypeError);else if("invalid_arguments"===i.code)processError(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,s=0;for(;s<i.path.length;){const n=i.path[s];s===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],s++}}};return processError(this),n}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 t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(t,n)=>{let a;switch(t.code){case s.invalid_type:a=t.received===i.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case s.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case s.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case s.invalid_union:a="Invalid input";break;case s.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case s.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.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 t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case s.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case s.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.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 ${t.multipleOf}`;break;case s.not_finite:a="Number must be finite";break;default:a=n.defaultError,e.assertNever(t)}return{message:a}};let a=errorMap;function getErrorMap(){return a}const makeIssue=e=>{const{data:t,path:n,errorMaps:i,issueData:s}=e,a=[...n,...s.path||[]],c={...s,path:a};if(void 0!==s.message)return{...s,path:a,message:s.message};let d="";const u=i.filter((e=>!!e)).slice().reverse();for(const l of u)d=l(c,{data:t,defaultError:d}).message;return{...s,path:a,message:d}};function addIssueToContext(e,t){const n=getErrorMap(),i=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===errorMap?void 0:errorMap].filter((e=>!!e))});e.common.issues.push(i)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if("aborted"===i.status)return c;"dirty"===i.status&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t){const e=await i.key,t=await i.value;n.push({key:e,value:t})}return ParseStatus.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:t,value:s}=i;if("aborted"===t.status)return c;if("aborted"===s.status)return c;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!i.alwaysSet||(n[t.value]=s.value)}return{status:e.value,value:n}}}const c=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,t,n,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function __classPrivateFieldSet(e,t,n,i,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var d,u,l,p;"function"==typeof SuppressedError&&SuppressedError,(u=d||(d={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},u.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}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,t)=>{if(isValid(t))return{success:!0,data:t.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 t=new ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:i,description:s}=e;if(t&&(n||i))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{var a,c;const{message:d}=e;return"invalid_enum_value"===t.code?{message:null!=d?d:s.defaultError}:void 0===s.data?{message:null!==(a=null!=d?d:i)&&void 0!==a?a:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(c=null!=d?d:n)&&void 0!==c?c: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,t){return t||{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 t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},s=this._parseSync({data:e,path:i.path,parent:i});return handleResult(i,s)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(isAsync(i)?i:Promise.resolve(i));return handleResult(n,s)}refine(e,t){const getIssueProperties=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const i=e(t),setError=()=>n.addIssue({code:s.custom,...getIssueProperties(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(setError(),!1))):!!i||(setError(),!1)}))}refinement(e,t){return this._refinement(((n,i)=>!!e(n)||(i.addIssue("function"==typeof t?t(n,i):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:R.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:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new ZodBranded({typeName:R.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:R.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 h=/^c[^\s-]{8,}$/i,f=/^[0-9a-z]+$/,m=/^[0-9A-HJKMNP-TV-Z]{26}$/,_=/^[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,g=/^[a-z0-9_-]{21}$/i,y=/^[-+]?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)?)??$/,v=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let b;const S=/^(?:(?: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])$/,w=/^(([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})))$/,I=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x="((\\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])))",C=new RegExp(`^${x}$`);function timeRegexSource(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function datetimeRegex(e){let t=`${x}T${timeRegexSource(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}class ZodString extends ZodType{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==i.string){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.string,received:e.parsedType}),c}const n=new ParseStatus;let a;for(const i of this._def.checks)if("min"===i.kind)t.data.length<i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if("max"===i.kind)t.data.length>i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if("length"===i.kind){const e=t.data.length>i.value,c=t.data.length<i.value;(e||c)&&(a=this._getOrReturnCtx(t,a),e?addIssueToContext(a,{code:s.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&addIssueToContext(a,{code:s.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if("email"===i.kind)v.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"email",code:s.invalid_string,message:i.message}),n.dirty());else if("emoji"===i.kind)b||(b=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),b.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"emoji",code:s.invalid_string,message:i.message}),n.dirty());else if("uuid"===i.kind)_.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"uuid",code:s.invalid_string,message:i.message}),n.dirty());else if("nanoid"===i.kind)g.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"nanoid",code:s.invalid_string,message:i.message}),n.dirty());else if("cuid"===i.kind)h.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"cuid",code:s.invalid_string,message:i.message}),n.dirty());else if("cuid2"===i.kind)f.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"cuid2",code:s.invalid_string,message:i.message}),n.dirty());else if("ulid"===i.kind)m.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"ulid",code:s.invalid_string,message:i.message}),n.dirty());else if("url"===i.kind)try{new URL(t.data)}catch(l){a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"url",code:s.invalid_string,message:i.message}),n.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"regex",code:s.invalid_string,message:i.message}),n.dirty())}else if("trim"===i.kind)t.data=t.data.trim();else if("includes"===i.kind)t.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty());else if("toLowerCase"===i.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===i.kind)t.data=t.data.toUpperCase();else if("startsWith"===i.kind)t.data.startsWith(i.value)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty());else if("endsWith"===i.kind)t.data.endsWith(i.value)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty());else if("datetime"===i.kind){datetimeRegex(i).test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"datetime",message:i.message}),n.dirty())}else if("date"===i.kind){C.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"date",message:i.message}),n.dirty())}else if("time"===i.kind){new RegExp(`^${timeRegexSource(i)}$`).test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"time",message:i.message}),n.dirty())}else"duration"===i.kind?y.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"duration",code:s.invalid_string,message:i.message}),n.dirty()):"ip"===i.kind?(d=t.data,("v4"!==(u=i.version)&&u||!S.test(d))&&("v6"!==u&&u||!w.test(d))&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"ip",code:s.invalid_string,message:i.message}),n.dirty())):"base64"===i.kind?I.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"base64",code:s.invalid_string,message:i.message}),n.dirty()):e.assertNever(i);var d,u;return{status:n.value,value:t.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:s.invalid_string,...d.errToObj(n)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...d.errToObj(e)})}url(e){return this._addCheck({kind:"url",...d.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...d.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...d.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...d.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...d.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...d.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...d.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...d.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...d.errToObj(e)})}datetime(e){var t,n;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!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...d.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,...d.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...d.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...d.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...d.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...d.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...d.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...d.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...d.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...d.errToObj(t)})}nonempty(e){return this.min(1,d.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 t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,s=n>i?n:i;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:R.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==i.number){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.number,received:e.parsedType}),c}let n;const a=new ParseStatus;for(const i of this._def.checks)if("int"===i.kind)e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty());else if("min"===i.kind){(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty())}else if("max"===i.kind){(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty())}else"multipleOf"===i.kind?0!==floatSafeRemainder(t.data,i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):"finite"===i.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_finite,message:i.message}),a.dirty()):e.assertNever(i);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,d.toString(t))}gt(e,t){return this.setLimit("min",e,!1,d.toString(t))}lte(e,t){return this.setLimit("max",e,!0,d.toString(t))}lt(e,t){return this.setLimit("max",e,!1,d.toString(t))}setLimit(e,t,n,i){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:d.toString(i)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:d.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:d.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:d.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:d.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:d.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:d.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:d.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:d.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:d.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:R.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(t){this._def.coerce&&(t.data=BigInt(t.data));if(this._getType(t)!==i.bigint){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.bigint,received:e.parsedType}),c}let n;const a=new ParseStatus;for(const i of this._def.checks)if("min"===i.kind){(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty())}else if("max"===i.kind){(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty())}else"multipleOf"===i.kind?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):e.assertNever(i);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,d.toString(t))}gt(e,t){return this.setLimit("min",e,!1,d.toString(t))}lte(e,t){return this.setLimit("max",e,!0,d.toString(t))}lt(e,t){return this.setLimit("max",e,!1,d.toString(t))}setLimit(e,t,n,i){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:d.toString(i)}]})}_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:d.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:d.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:d.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:d.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:d.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:R.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==i.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.boolean,received:t.parsedType}),c}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:R.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==i.date){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.date,received:e.parsedType}),c}if(isNaN(t.data.getTime())){return addIssueToContext(this._getOrReturnCtx(t),{code:s.invalid_date}),c}const n=new ParseStatus;let a;for(const i of this._def.checks)"min"===i.kind?t.data.getTime()<i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):"max"===i.kind?t.data.getTime()>i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):e.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:d.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:d.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:R.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==i.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.symbol,received:t.parsedType}),c}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:R.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.undefined,received:t.parsedType}),c}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:R.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==i.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.null,received:t.parsedType}),c}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:R.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:R.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:R.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.never,received:t.parsedType}),c}}ZodNever.create=e=>new ZodNever({typeName:R.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.void,received:t.parsedType}),c}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:R.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==i.array)return addIssueToContext(t,{code:s.invalid_type,expected:i.array,received:t.parsedType}),c;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(addIssueToContext(t,{code:e?s.too_big:s.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(addIssueToContext(t,{code:s.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(addIssueToContext(t,{code:s.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new ParseInputLazyPath(t,e,t.path,n))))).then((e=>ParseStatus.mergeArray(n,e)));const d=[...t.data].map(((e,n)=>a.type._parseSync(new ParseInputLazyPath(t,e,t.path,n))));return ParseStatus.mergeArray(n,d)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:d.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:d.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:d.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const n in e.shape){const i=e.shape[n];t[n]=ZodOptional.create(deepPartialify(i))}return new ZodObject({...e._def,shape:()=>t})}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,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...processCreateParams(t)});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 t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(e){if(this._getType(e)!==i.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.object,received:t.parsedType}),c}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:d}=this._getCached(),u=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const i in n.data)d.includes(i)||u.push(i);const l=[];for(const i of d){const e=a[i],t=n.data[i];l.push({key:{status:"valid",value:i},value:e._parse(new ParseInputLazyPath(n,t,n.path,i)),alwaysSet:i in n.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of u)l.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)u.length>0&&(addIssueToContext(n,{code:s.unrecognized_keys,keys:u}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of u){const i=n.data[t];l.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(n,i,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of l){const n=await t.key,i=await t.value;e.push({key:n,value:i,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return d.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var i,s,a,c;const u=null!==(a=null===(s=(i=this._def).errorMap)||void 0===s?void 0:s.call(i,t,n).message)&&void 0!==a?a:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(c=d.errToObj(e).message)&&void 0!==c?c:u}:{message:u}}}:{}})}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:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(t){const n={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(n[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>n})}omit(t){const n={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(n[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>n})}deepPartial(){return deepPartialify(this)}partial(t){const n={};return e.objectKeys(this.shape).forEach((e=>{const i=this.shape[e];t&&!t[e]?n[e]=i:n[e]=i.optional()})),new ZodObject({...this._def,shape:()=>n})}required(t){const n={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof ZodOptional;)t=t._def.innerType;n[e]=t}})),new ZodObject({...this._def,shape:()=>n})}keyof(){return createZodEnum(e.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function handleResults(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const i of e)if("dirty"===i.result.status)return t.common.issues.push(...i.ctx.common.issues),i.result;const n=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:s.invalid_union,unionErrors:n}),c}));{let e;const i=[];for(const s of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=s._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&i.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=i.map((e=>new ZodError(e)));return addIssueToContext(t,{code:s.invalid_union,unionErrors:a}),c}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:R.ZodUnion,...processCreateParams(t)});const getDiscriminator=t=>t instanceof ZodLazy?getDiscriminator(t.schema):t instanceof ZodEffects?getDiscriminator(t.innerType()):t instanceof ZodLiteral?[t.value]:t instanceof ZodEnum?t.options:t instanceof ZodNativeEnum?e.objectValues(t.enum):t instanceof ZodDefault?getDiscriminator(t._def.innerType):t instanceof ZodUndefined?[void 0]:t instanceof ZodNull?[null]:t instanceof ZodOptional?[void 0,...getDiscriminator(t.unwrap())]:t instanceof ZodNullable?[null,...getDiscriminator(t.unwrap())]:t instanceof ZodBranded||t instanceof ZodReadonly?getDiscriminator(t.unwrap()):t instanceof ZodCatch?getDiscriminator(t._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return addIssueToContext(t,{code:s.invalid_type,expected:i.object,received:t.parsedType}),c;const n=this.discriminator,a=t.data[n],d=this.optionsMap.get(a);return d?t.common.async?d._parseAsync({data:t.data,path:t.path,parent:t}):d._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:s.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),c)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const s of t){const t=getDiscriminator(s.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(i.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);i.set(n,s)}}return new ZodDiscriminatedUnion({typeName:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...processCreateParams(n)})}}function mergeValues(t,n){const s=getParsedType(t),a=getParsedType(n);if(t===n)return{valid:!0,data:t};if(s===i.object&&a===i.object){const i=e.objectKeys(n),s=e.objectKeys(t).filter((e=>-1!==i.indexOf(e))),a={...t,...n};for(const e of s){const i=mergeValues(t[e],n[e]);if(!i.valid)return{valid:!1};a[e]=i.data}return{valid:!0,data:a}}if(s===i.array&&a===i.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let i=0;i<t.length;i++){const s=mergeValues(t[i],n[i]);if(!s.valid)return{valid:!1};e.push(s.data)}return{valid:!0,data:e}}return s===i.date&&a===i.date&&+t==+n?{valid:!0,data:t}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),handleParsed=(e,i)=>{if(isAborted(e)||isAborted(i))return c;const a=mergeValues(e.value,i.value);return a.valid?((isDirty(e)||isDirty(i))&&t.dirty(),{status:t.value,value:a.data}):(addIssueToContext(n,{code:s.invalid_intersection_types}),c)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>handleParsed(e,t))):handleParsed(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ZodIntersection.create=(e,t,n)=>new ZodIntersection({left:e,right:t,typeName:R.ZodIntersection,...processCreateParams(n)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.array)return addIssueToContext(n,{code:s.invalid_type,expected:i.array,received:n.parsedType}),c;if(n.data.length<this._def.items.length)return addIssueToContext(n,{code:s.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c;!this._def.rest&&n.data.length>this._def.items.length&&(addIssueToContext(n,{code:s.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const i=this._def.items[t]||this._def.rest;return i?i._parse(new ParseInputLazyPath(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:R.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.object)return addIssueToContext(n,{code:s.invalid_type,expected:i.object,received:n.parsedType}),c;const a=[],d=this._def.keyType,u=this._def.valueType;for(const i in n.data)a.push({key:d._parse(new ParseInputLazyPath(n,i,n.path,i)),value:u._parse(new ParseInputLazyPath(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?ParseStatus.mergeObjectAsync(t,a):ParseStatus.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:R.ZodRecord,...processCreateParams(n)}:{keyType:ZodString.create(),valueType:e,typeName:R.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.map)return addIssueToContext(n,{code:s.invalid_type,expected:i.map,received:n.parsedType}),c;const a=this._def.keyType,d=this._def.valueType,u=[...n.data.entries()].map((([e,t],i)=>({key:a._parse(new ParseInputLazyPath(n,e,n.path,[i,"key"])),value:d._parse(new ParseInputLazyPath(n,t,n.path,[i,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of u){const i=await n.key,s=await n.value;if("aborted"===i.status||"aborted"===s.status)return c;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of u){const i=n.key,s=n.value;if("aborted"===i.status||"aborted"===s.status)return c;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,n)=>new ZodMap({valueType:t,keyType:e,typeName:R.ZodMap,...processCreateParams(n)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.set)return addIssueToContext(n,{code:s.invalid_type,expected:i.set,received:n.parsedType}),c;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(addIssueToContext(n,{code:s.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(addIssueToContext(n,{code:s.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const d=this._def.valueType;function finalizeSet(e){const n=new Set;for(const i of e){if("aborted"===i.status)return c;"dirty"===i.status&&t.dirty(),n.add(i.value)}return{status:t.value,value:n}}const u=[...n.data.values()].map(((e,t)=>d._parse(new ParseInputLazyPath(n,e,n.path,t))));return n.common.async?Promise.all(u).then((e=>finalizeSet(e))):finalizeSet(u)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:d.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:d.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:R.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return addIssueToContext(t,{code:s.invalid_type,expected:i.function,received:t.parsedType}),c;function makeArgsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:s.invalid_arguments,argumentsError:n}})}function makeReturnsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:s.invalid_return_type,returnTypeError:n}})}const n={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...t){const i=new ZodError([]),s=await e._def.args.parseAsync(t,n).catch((e=>{throw i.addIssue(makeArgsIssue(t,e)),i})),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,n).catch((e=>{throw i.addIssue(makeReturnsIssue(c,e)),i}))}))}{const e=this;return OK((function(...t){const i=e._def.args.safeParse(t,n);if(!i.success)throw new ZodError([makeArgsIssue(t,i.error)]);const s=Reflect.apply(a,this,i.data),c=e._def.returns.safeParse(s,n);if(!c.success)throw new ZodError([makeReturnsIssue(s,c.error)]);return c.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,t,n){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:R.ZodFunction,...processCreateParams(n)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:R.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:s.invalid_literal,expected:this._def.value}),c}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:R.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:R.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{constructor(){super(...arguments),l.set(this,void 0)}_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),i=this._def.values;return addIssueToContext(n,{expected:e.joinValues(i),received:n.parsedType,code:s.invalid_type}),c}if(__classPrivateFieldGet(this,l)||__classPrivateFieldSet(this,l,new Set(this._def.values)),!__classPrivateFieldGet(this,l).has(t.data)){const e=this._getOrReturnCtx(t),n=this._def.values;return addIssueToContext(e,{received:e.data,code:s.invalid_enum_value,options:n}),c}return OK(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}l=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),p.set(this,void 0)}_parse(t){const n=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==i.string&&a.parsedType!==i.number){const t=e.objectValues(n);return addIssueToContext(a,{expected:e.joinValues(t),received:a.parsedType,code:s.invalid_type}),c}if(__classPrivateFieldGet(this,p)||__classPrivateFieldSet(this,p,new Set(e.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,p).has(t.data)){const t=e.objectValues(n);return addIssueToContext(a,{received:a.data,code:s.invalid_enum_value,options:t}),c}return OK(t.data)}get enum(){return this._def.values}}p=new WeakMap,ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:R.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.promise&&!1===t.common.async)return addIssueToContext(t,{code:s.invalid_type,expected:i.promise,received:t.parsedType}),c;const n=t.parsedType===i.promise?t.data:Promise.resolve(t.data);return OK(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:R.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:i}=this._processInputParams(t),s=this._def.effect||null,a={addIssue:e=>{addIssueToContext(i,e),e.fatal?n.abort():n.dirty()},get path(){return i.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===s.type){const e=s.transform(i.data,a);if(i.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===n.value)return c;const t=await this._def.schema._parseAsync({data:e,path:i.path,parent:i});return"aborted"===t.status?c:"dirty"===t.status||"dirty"===n.value?DIRTY(t.value):t}));{if("aborted"===n.value)return c;const t=this._def.schema._parseSync({data:e,path:i.path,parent:i});return"aborted"===t.status?c:"dirty"===t.status||"dirty"===n.value?DIRTY(t.value):t}}if("refinement"===s.type){const executeRefinement=e=>{const t=s.refinement(e,a);if(i.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?c:("dirty"===e.status&&n.dirty(),executeRefinement(e.value),{status:n.value,value:e.value})}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>"aborted"===e.status?c:("dirty"===e.status&&n.dirty(),executeRefinement(e.value).then((()=>({status:n.value,value:e.value}))))))}if("transform"===s.type){if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!isValid(e))return e;const t=s.transform(e.value,a);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:t}}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>isValid(e)?Promise.resolve(s.transform(e.value,a)).then((e=>({status:n.value,value:e}))):e))}e.assertNever(s)}}ZodEffects.create=(e,t,n)=>new ZodEffects({schema:e,typeName:R.ZodEffects,effect:t,...processCreateParams(n)}),ZodEffects.createWithPreprocess=(e,t,n)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:R.ZodEffects,...processCreateParams(n)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===i.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:R.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===i.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:R.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===i.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:R.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return isAsync(i)?i.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:R.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==i.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.nan,received:t.parsedType}),c}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:R.ZodNaN,...processCreateParams(e)});const O=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?c:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?c:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:R.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e),freeze=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(t)?t.then((e=>freeze(e))):freeze(t)}unwrap(){return this._def.innerType}}function custom(e,t={},n){return e?ZodAny.create().superRefine(((i,s)=>{var a,c;if(!e(i)){const e="function"==typeof t?t(i):"string"==typeof t?{message:t}:t,d=null===(c=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===c||c,u="string"==typeof e?{message:e}:e;s.addIssue({code:"custom",...u,fatal:d})}})):ZodAny.create()}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:R.ZodReadonly,...processCreateParams(t)});const T={object:ZodObject.lazycreate};var R,N;(N=R||(R={})).ZodString="ZodString",N.ZodNumber="ZodNumber",N.ZodNaN="ZodNaN",N.ZodBigInt="ZodBigInt",N.ZodBoolean="ZodBoolean",N.ZodDate="ZodDate",N.ZodSymbol="ZodSymbol",N.ZodUndefined="ZodUndefined",N.ZodNull="ZodNull",N.ZodAny="ZodAny",N.ZodUnknown="ZodUnknown",N.ZodNever="ZodNever",N.ZodVoid="ZodVoid",N.ZodArray="ZodArray",N.ZodObject="ZodObject",N.ZodUnion="ZodUnion",N.ZodDiscriminatedUnion="ZodDiscriminatedUnion",N.ZodIntersection="ZodIntersection",N.ZodTuple="ZodTuple",N.ZodRecord="ZodRecord",N.ZodMap="ZodMap",N.ZodSet="ZodSet",N.ZodFunction="ZodFunction",N.ZodLazy="ZodLazy",N.ZodLiteral="ZodLiteral",N.ZodEnum="ZodEnum",N.ZodEffects="ZodEffects",N.ZodNativeEnum="ZodNativeEnum",N.ZodOptional="ZodOptional",N.ZodNullable="ZodNullable",N.ZodDefault="ZodDefault",N.ZodCatch="ZodCatch",N.ZodPromise="ZodPromise",N.ZodBranded="ZodBranded",N.ZodPipeline="ZodPipeline",N.ZodReadonly="ZodReadonly";const Z=ZodString.create,P=ZodNumber.create,D=ZodNaN.create,A=ZodBigInt.create,L=ZodBoolean.create,j=ZodDate.create,U=ZodSymbol.create,q=ZodUndefined.create,$=ZodNull.create,B=ZodAny.create,z=ZodUnknown.create,W=ZodNever.create,K=ZodVoid.create,H=ZodArray.create,G=ZodObject.create,J=ZodObject.strictCreate,Y=ZodUnion.create,X=ZodDiscriminatedUnion.create,Q=ZodIntersection.create,ee=ZodTuple.create,te=ZodRecord.create,re=ZodMap.create,ne=ZodSet.create,ie=ZodFunction.create,oe=ZodLazy.create,se=ZodLiteral.create,ae=ZodEnum.create,ce=ZodNativeEnum.create,de=ZodPromise.create,ue=ZodEffects.create,le=ZodOptional.create,pe=ZodNullable.create,he=ZodEffects.createWithPreprocess,fe=ZodPipeline.create,me={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})},_e=c;var ge=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:function setErrorMap(e){a=e},getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:[],addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:c,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return e},get objectUtil(){return n},ZodParsedType:i,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:O,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:T,get ZodFirstPartyTypeKind(){return R},coerce:me,any:B,array:H,bigint:A,boolean:L,date:j,discriminatedUnion:X,effect:ue,enum:ae,function:ie,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>custom((t=>t instanceof e),t),intersection:Q,lazy:oe,literal:se,map:re,nan:D,nativeEnum:ce,never:W,null:$,nullable:pe,number:P,object:G,oboolean:()=>L().optional(),onumber:()=>P().optional(),optional:le,ostring:()=>Z().optional(),pipeline:fe,preprocess:he,promise:de,record:te,set:ne,strictObject:J,string:Z,symbol:U,transformer:ue,tuple:ee,undefined:q,union:Y,unknown:z,void:K,NEVER:_e,ZodIssueCode:s,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:ZodError});const ye=ge.object({firstName:ge.string().optional(),lastName:ge.string().optional(),email:ge.string().email().optional(),phone:ge.string().regex(/^\+?[1-9]\d{1,14}$/).optional()}),ve=["web","web-mobile","ios","android","app"],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))),be=ge.object({Departure:ge.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),"Departure Delta":ge.number().int("Departure Delta must be an integer"),Destination:ge.string().min(1,"Destination is required"),"Destination Terminal":ge.string().min(1,"Destination terminal is required"),"User Fingerprint":ge.string().or(ge.null()).refine((e=>null===e||"string"==typeof e),{message:"User fingerprint must be a string or null"}).optional(),Origin:ge.string().min(1,"Origin is required"),"Origin Terminal":ge.string().min(1,"Origin terminal is required"),Passengers:ge.number().int("Passenger count must be an integer"),Return:ge.string().refine(dateValidation,{message:"Invalid Return date or datetime format. Must include at least YYYY-MM-DD"}).optional(),Route:ge.string().min(1,"Route is required"),"Trip Length":ge.number().positive().optional(),product:ge.enum(ve).refine((e=>ve.includes(e)),{message:`Product must be one of: ${ve.join(", ")}`})});var __assign=function(){return __assign=Object.assign||function __assign2(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign.apply(this,arguments)};function __awaiter$1(e,t,n,i){return new(n||(n=Promise))((function(s,a){function fulfilled(e){try{step(i.next(e))}catch(t){a(t)}}function rejected(e){try{step(i.throw(e))}catch(t){a(t)}}function step(e){e.done?s(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var Se={default:"endpoint"},ke={default:"tlsEndpoint"},we="Client timeout",Ie="Network connection error",xe="Network request aborted",Ee="Response cannot be parsed",Ce="Blocked by CSP",Oe="The endpoint parameter is not a valid URL";function E(e){for(var t="",n=0;n<e.length;++n)if(n>0){var i=e[n].toLowerCase();i!==e[n]?t+=" ".concat(i):t+=e[n]}else t+=e[n].toUpperCase();return t}var Te=E("WrongRegion"),Re=E("SubscriptionNotActive"),Me=E("UnsupportedVersion"),Ne=E("InstallationMethodRestricted"),Ze=E("HostnameRestricted"),Pe=E("IntegrationFailed"),De="API key required",Ae="API key not found",Le="API key expired",je="Request cannot be parsed",Fe="Request failed",Ue="Request failed to process",qe="Too many requests, rate limit exceeded",$e="Not available for this origin",Be="Not available with restricted header",ze=De,We=Ae,Ve=Le,Ke="Failed to load the JS script of the agent",He="9319";function M(e,t){var n,i,s,a,c,d=[],u=(c=function __spreadArray(e,t,n){if(n||2===arguments.length)for(var i,s=0,a=t.length;s<a;s++)!i&&s in t||(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}([],e,!0),n={current:function(){return c[0]},postpone:function(){var e=c.shift();void 0!==e&&c.push(e)},exclude:function(){c.shift()}},a=0,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,a++))},s=new Set,[n.current(),function(e,t){var a,c=t instanceof Error?t.message:"";if(c===Ce||c===Oe)n.exclude(),a=0;else if(c===He)n.exclude();else if(c===Ke){var d=Date.now()-e.getTime()<50,u=n.current();u&&d&&!s.has(u)&&(s.add(u),a=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=a?a:e.getTime()+i()-Date.now()]}]),l=u[0],p=u[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var p2=function(e){var n=new Date,r3=function(t){return d.push({url:e,startedAt:n,finishedAt:new Date,error:t})},i=t(e);return i.then((function(){return r3()}),r3),i.catch((function(e){if(d.length>=5)throw e;var t=p(n,e);if(!t)throw e;var i,s=t[0],a=t[1];return(i=a,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return p2(s)}))}))};return p2(l).then((function(e){return[e,d]}))}var Ge="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Je=Ge;function F(e){var t;e.scriptUrlPattern;var n,i,s,a,c,d,u,l=e.token,p=e.apiKey,h=void 0===p?l:p,f=function __rest$1(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["scriptUrlPattern","token","apiKey"]),m=null!==(t=function r(e,t){return n=e,i=t,Object.prototype.hasOwnProperty.call(n,i)?e[t]:void 0;var n,i}(e,"scriptUrlPattern"))&&void 0!==t?t:Ge,_=(c=[],d=function(){c.push({time:new Date,state:document.visibilityState})},n=document,i="visibilitychange",s=d,n.addEventListener(i,s,a),u=function(){return n.removeEventListener(i,s,a)},d(),[c,u]),g=_[0],y=_[1];return Promise.resolve().then((function(){if(!h||"string"!=typeof h)throw new Error(De);var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.11.1"):e}))}(String(e),t)}))}(m,h);return M(e,V)})).catch((function(e){throw y(),function(e){return e instanceof Error&&e.message===He?new Error(Ke):e}(e)})).then((function(e){var t=e[0],n=e[1];return y(),t.load(__assign(__assign({},f),{ldi:{attempts:n,visibilityStates:g}}))}))}function V(e){return function o(e,t,n,i){var s,a=document,c="securitypolicyviolation",u2=function(t){var n=new URL(e,location.href),i=t.blockedURI;i!==n.href&&i!==n.protocol.slice(0,-1)&&i!==n.origin||(s=t,R2())};a.addEventListener(c,u2);var R2=function(){return a.removeEventListener(c,u2)};return Promise.resolve().then(t).then((function(e){return R2(),e}),(function(e){return new Promise((function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})).then((function(){if(R2(),s)return n(s);throw e}))}))}(e,(function(){return t=e,new Promise((function(e,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(t){if(t instanceof Error&&"TypeError"===t.name)return!0;throw t}}(t))throw new Error(Oe);var i=document.createElement("script"),o2=function(){var e;return null===(e=i.parentNode)||void 0===e?void 0:e.removeChild(i)},s=document.head||document.getElementsByTagName("head")[0];i.onload=function(){o2(),e()},i.onerror=function(){o2(),n(new Error(Ke))},i.async=!0,i.src=t,s.appendChild(i)}));var t}),(function(){throw new Error(Ce)})).then(k)}function k(){var e,t,n,i,s=window,a="__fpjs_p_l_b",c=s[a];if(e=s,t=a,(null==(i=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t))?void 0:i.configurable)?delete e[t]:i&&!i.writable||(e[t]=void 0),"function"!=typeof(null==c?void 0:c.load))throw new Error(He);return c}var Ye={load:F,defaultScriptUrlPattern:Je,ERROR_SCRIPT_LOAD_FAIL:Ke,ERROR_API_KEY_EXPIRED:Le,ERROR_API_KEY_INVALID:Ae,ERROR_API_KEY_MISSING:De,ERROR_BAD_REQUEST_FORMAT:je,ERROR_BAD_RESPONSE_FORMAT:Ee,ERROR_CLIENT_TIMEOUT:we,ERROR_CSP_BLOCK:Ce,ERROR_FORBIDDEN_ENDPOINT:Ze,ERROR_FORBIDDEN_HEADER:Be,ERROR_FORBIDDEN_ORIGIN:$e,ERROR_GENERAL_SERVER_FAILURE:Fe,ERROR_INSTALLATION_METHOD_RESTRICTED:Ne,ERROR_INTEGRATION_FAILURE:Pe,ERROR_INVALID_ENDPOINT:Oe,ERROR_NETWORK_ABORT:xe,ERROR_NETWORK_CONNECTION:Ie,ERROR_RATE_LIMIT:qe,ERROR_SERVER_TIMEOUT:Ue,ERROR_SUBSCRIPTION_NOT_ACTIVE:Re,ERROR_TOKEN_EXPIRED:Ve,ERROR_TOKEN_INVALID:We,ERROR_TOKEN_MISSING:ze,ERROR_UNSUPPORTED_VERSION:Me,ERROR_WRONG_REGION:Te,defaultEndpoint:Se,defaultTlsEndpoint:ke};const Xe=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:Le,ERROR_API_KEY_INVALID:Ae,ERROR_API_KEY_MISSING:De,ERROR_BAD_REQUEST_FORMAT:je,ERROR_BAD_RESPONSE_FORMAT:Ee,ERROR_CLIENT_TIMEOUT:we,ERROR_CSP_BLOCK:Ce,ERROR_FORBIDDEN_ENDPOINT:Ze,ERROR_FORBIDDEN_HEADER:Be,ERROR_FORBIDDEN_ORIGIN:$e,ERROR_GENERAL_SERVER_FAILURE:Fe,ERROR_INSTALLATION_METHOD_RESTRICTED:Ne,ERROR_INTEGRATION_FAILURE:Pe,ERROR_INVALID_ENDPOINT:Oe,ERROR_NETWORK_ABORT:xe,ERROR_NETWORK_CONNECTION:Ie,ERROR_RATE_LIMIT:qe,ERROR_SCRIPT_LOAD_FAIL:Ke,ERROR_SERVER_TIMEOUT:Ue,ERROR_SUBSCRIPTION_NOT_ACTIVE:Re,ERROR_TOKEN_EXPIRED:Ve,ERROR_TOKEN_INVALID:We,ERROR_TOKEN_MISSING:ze,ERROR_UNSUPPORTED_VERSION:Me,ERROR_WRONG_REGION:Te,default:Ye,defaultEndpoint:Se,defaultScriptUrlPattern:Je,defaultTlsEndpoint:ke,load:F},Symbol.toStringTag,{value:"Module"})),Qe="@fpjs@client@",DEFAULT_NOW_PROVIDER=()=>Date.now();class CacheKey{constructor(e){var t;this.tag=e.tag||null,this.linkedId=e.linkedId||null,this.extendedResult=null!==(t=e.extendedResult)&&void 0!==t&&t}toKey(){return`${JSON.stringify(this.tag)}__${JSON.stringify(this.linkedId)}__${this.extendedResult}`}}function getKeyWithPrefix(e,t){return`${t}__${e}`}function removePrefixFromKey(e,t){return e.replace(`${t}__`,"")}class LocalStorageCache{constructor(e=Qe){this.prefix=e}set(e,t){window.localStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(t))}get(e){const t=window.localStorage.getItem(getKeyWithPrefix(e,this.prefix));if(t)try{return JSON.parse(t)}catch(n){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=Qe){this.prefix=e}set(e,t){window.sessionStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(t))}get(e){const t=window.sessionStorage.getItem(getKeyWithPrefix(e,this.prefix));if(t)try{return JSON.parse(t)}catch(n){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,t=3600,n){this.cache=e,this.cacheTime=t,this.nowProvider=n||DEFAULT_NOW_PROVIDER}get(e){return __awaiter$1(this,void 0,void 0,(function*(){const t=yield this.cache.get(e.toKey());if(!t)return;const n=yield this.nowProvider(),i=Math.floor(n/1e3);if(!(t.expiresAt<i))return t.body;yield this.cache.remove(e.toKey())}))}set(e,t){return __awaiter$1(this,void 0,void 0,(function*(){const n=yield this.wrapCacheEntry(t);yield this.cache.set(e.toKey(),n)}))}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 t=yield this.nowProvider(),n=Math.floor(t/1e3)+this.cacheTime;return{body:e,expiresAt:n}}))}}class InMemoryCache{constructor(){this.enclosedCache=function(){const e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class CacheStub{set(){}get(){}remove(){}allKeys(){return[]}}var et,tt;(tt=et||(et={})).Memory="memory",tt.LocalStorage="localstorage",tt.SessionStorage="sessionstorage",tt.NoCache="nocache";const rt={[et.Memory]:()=>(new InMemoryCache).enclosedCache,[et.LocalStorage]:e=>new LocalStorageCache(e),[et.SessionStorage]:e=>new SessionStorageCache(e),[et.NoCache]:()=>new CacheStub},cacheFactory=e=>rt[e];class FpjsClient{constructor(e){var t;let n;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)n=e.cache;else{if(this.cacheLocation=(null==e?void 0:e.cacheLocation)||et.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(e=>{switch(e){case et.SessionStorage:try{window.sessionStorage.getItem("item")}catch(t){return!1}return!0;case et.LocalStorage:try{window.localStorage.getItem("item")}catch(t){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=et.Memory),n=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 i=null!==(t=null==e?void 0:e.cacheTimeInSeconds)&&void 0!==t?t:3600;this.cacheManager=new CacheManager(n,i)}init(e){return __awaiter$1(this,void 0,void 0,(function*(){var t,n;if(!this.loadOptions&&!e)throw new TypeError("No load options provided");const i=Object.assign(Object.assign(Object.assign({},this.loadOptions),e),{integrationInfo:[...(null===(t=this.loadOptions)||void 0===t?void 0:t.integrationInfo)||[],...(null==e?void 0:e.integrationInfo)||[],"fingerprintjs-pro-spa/1.3.2"]});if(!this.agentPromise){const e=null!==(n=this.customAgent)&&void 0!==n?n:Xe;this.agentPromise=e.load(i).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={},t=!1){const n=FpjsClient.makeCacheKey(e).toKey();if(!this.inFlightRequests.has(n)){const i=this._identify(e,t).finally((()=>{this.inFlightRequests.delete(n)}));this.inFlightRequests.set(n,i)}return yield this.inFlightRequests.get(n)}))}getVisitorDataFromCache(){return __awaiter$1(this,arguments,void 0,(function*(e={}){const t=FpjsClient.makeCacheKey(e),n=yield this.cacheManager.get(t);return n?Object.assign(Object.assign({},n),{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,t=!1){const n=FpjsClient.makeCacheKey(e);if(!t){const e=yield this.cacheManager.get(n);if(e)return Object.assign(Object.assign({},e),{cacheHit:!0})}const i=yield this.agent.get(e);return yield this.cacheManager.set(n,i),Object.assign(Object.assign({},i),{cacheHit:!1})}))}}const nt="default_fingerprint_cache",it=7,getExpirationDate=e=>new Date((new Date).getTime()+24*e*60*60*1e3).getTime();function isFingerprintReady(){return void 0!==window.fpClient}const ot={initFingerprint:async function initFingerprint(e){window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:e}});try{await window.fpClient.init()}catch(Xt){throw console.error("Error initializing identification service:",Xt),Xt}},getFingerprint:async function getFingerprint(e=!1){if(!window.fingerprintConfig)throw new Error("Fingerprint configuration is not initialized.");const t=(()=>{const{cacheName:e=nt}=window.fingerprintConfig;try{const t=JSON.parse(localStorage.getItem(e)||"null");return t&&t.expiresAt>Date.now()?t.fingerprint:(localStorage.removeItem(e),null)}catch{return null}})();if(t)return t;if(e)return"";if(!isFingerprintReady())throw new Error("Identification service is not initialized.");try{const e=window.fpClient,{visitorId:t}=await e.getVisitorData();return(e=>{const{cacheName:t=nt,cacheTimeInDays:n=it}=window.fingerprintConfig,i={fingerprint:e,expiresAt:getExpirationDate(n)};localStorage.setItem(t,JSON.stringify(i))})(t),t}catch(Xt){throw console.error("Error retrieving fingerprint:",Xt),Xt}},isFingerprintReady:isFingerprintReady};var st,at;function isShadowRoot(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function isNativeShadowDom(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function stringifyStylesheet(e){try{const t=e.rules||e.cssRules;return t?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(t,stringifyRule).join("")):null}catch(Xt){return null}}function stringifyRule(e){let t;if(function isCSSImportRule(e){return"styleSheet"in e}(e))try{t=stringifyStylesheet(e.styleSheet)||function escapeImportStatement(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(Xt){}else if(function isCSSStyleRule(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function fixSafariColons(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(e.cssText);return t||e.cssText}(at=st||(st={}))[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 t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-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 t=this.getId(e);this.idNodeMap.delete(t),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,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function maskInputValue({element:e,maskInputOptions:t,tagName:n,type:i,value:s,maskInputFn:a}){let c=s||"";const d=i&&toLowerCase(i);return(t[n.toLowerCase()]||d&&t[d])&&(c=a?a(c,e):"*".repeat(c.length)),c}function toLowerCase(e){return e.toLowerCase()}const ct="__rrweb_original__";function getInputType(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?toLowerCase(t):null}function extractFileExtension(e,t){var n;let i;try{i=new URL(e,null!=t?t:window.location.href)}catch(a){return null}const s=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==s?void 0:s[1])&&void 0!==n?n:null}let dt=1;const ut=new RegExp("[^a-z0-9-_:]"),lt=-2;function genId(){return dt++}let pt,ht;const ft=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,mt=/^(?:[a-z+]+:)?\/\//i,_t=/^www\..*/i,gt=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,t){return(e||"").replace(ft,((e,n,i,s,a,c)=>{const d=i||a||c,u=n||s||"";if(!d)return e;if(mt.test(d)||_t.test(d))return`url(${u}${d}${u})`;if(gt.test(d))return`url(${u}${d}${u})`;if("/"===d[0])return`url(${u}${function extractOrigin(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+d}${u})`;const l=t.split("/"),p=d.split("/");l.pop();for(const t of p)"."!==t&&(".."===t?l.pop():l.push(t));return`url(${u}${l.join("/")}${u})`}))}const yt=/^[^ \t\n\r\u000c]+/,vt=/^[, \t\n\r\u000c]+/;function absoluteToDoc(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.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,t,n,i){return i?"src"===n||"href"===n&&("use"!==t||"#"!==i[0])||"xlink:href"===n&&"#"!==i[0]?absoluteToDoc(e,i):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function getAbsoluteSrcsetString(e,t){if(""===t.trim())return t;let n=0;function collectCharacters(e){let i;const s=e.exec(t.substring(n));return s?(i=s[0],n+=i.length,i):""}const i=[];for(;collectCharacters(vt),!(n>=t.length);){let s=collectCharacters(yt);if(","===s.slice(-1))s=absoluteToDoc(e,s.substring(0,s.length-1)),i.push(s);else{let a="";s=absoluteToDoc(e,s);let c=!1;for(;;){const e=t.charAt(n);if(""===e){i.push((s+a).trim());break}if(c)")"===e&&(c=!1);else{if(","===e){n+=1,i.push((s+a).trim());break}"("===e&&(c=!0)}a+=e,n+=1}}}return i.join(", ")}(e,i):"style"===n?absoluteToStylesheet(i,getHref()):"object"===t&&"data"===n?absoluteToDoc(e,i):i:absoluteToDoc(e,i):i}function ignoreAttribute(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function classMatchesRegex(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&classMatchesRegex(e.parentNode,t,n);for(let i=e.classList.length;i--;){const n=e.classList[i];if(t.test(n))return!0}return!!n&&classMatchesRegex(e.parentNode,t,n)}function needMaskingText(e,t,n,i){try{const s=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===s)return!1;if("string"==typeof t){if(i){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(classMatchesRegex(s,t,i))return!0;if(n)if(i){if(s.closest(n))return!0}else if(s.matches(n))return!0}catch(s){}return!1}function serializeNode(e,t){const{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:c,inlineStylesheet:d,maskInputOptions:u={},maskTextFn:l,maskInputFn:p,dataURLOptions:h={},inlineImages:f,recordCanvas:m,keepIframeSrcFn:_,newlyAddedElement:g=!1}=t,y=function getRootId(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,i);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:st.Document,childNodes:[],compatMode:e.compatMode}:{type:st.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:st.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function serializeElementNode(e,t){const{doc:n,blockClass:i,blockSelector:s,inlineStylesheet:a,maskInputOptions:c={},maskInputFn:d,dataURLOptions:u={},inlineImages:l,recordCanvas:p,keepIframeSrcFn:h,newlyAddedElement:f=!1,rootId:m}=t,_=function _isBlockedElement(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}if(n)return e.matches(n)}catch(i){}return!1}(e,i,s),g=function getValidTagName(e){if(e instanceof HTMLFormElement)return"form";const t=toLowerCase(e.tagName);return ut.test(t)?"div":t}(e);let y={};const v=e.attributes.length;for(let w=0;w<v;w++){const t=e.attributes[w];ignoreAttribute(g,t.name,t.value)||(y[t.name]=transformAttribute(n,g,toLowerCase(t.name),t.value))}if("link"===g&&a){const t=Array.from(n.styleSheets).find((t=>t.href===e.href));let i=null;t&&(i=stringifyStylesheet(t)),i&&(delete y.rel,delete y.href,y._cssText=absoluteToStylesheet(i,t.href))}if("style"===g&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const t=stringifyStylesheet(e.sheet);t&&(y._cssText=absoluteToStylesheet(t,getHref()))}if("input"===g||"textarea"===g||"select"===g){const t=e.value,n=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=maskInputValue({element:e,type:getInputType(e),tagName:g,value:t,maskInputOptions:c,maskInputFn:d}):n&&(y.checked=n)}"option"===g&&(e.selected&&!c.select?y.selected=!0:delete y.selected);if("canvas"===g&&p)if("2d"===e.__context)(function is2DCanvasBlank(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let i=0;i<e.height;i+=50){const s=t.getImageData,a=ct in s?s[ct]:s;if(new Uint32Array(a.call(t,n,i,Math.min(50,e.width-n),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(y.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),n=document.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(u.type,u.quality)&&(y.rr_dataURL=t)}if("img"===g&&l){pt||(pt=n.createElement("canvas"),ht=pt.getContext("2d"));const t=e,i=t.crossOrigin;t.crossOrigin="anonymous";const recordInlineImage=()=>{t.removeEventListener("load",recordInlineImage);try{pt.width=t.naturalWidth,pt.height=t.naturalHeight,ht.drawImage(t,0,0),y.rr_dataURL=pt.toDataURL(u.type,u.quality)}catch(e){console.warn(`Cannot inline img src=${t.currentSrc}! Error: ${e}`)}i?y.crossOrigin=i:t.removeAttribute("crossorigin")};t.complete&&0!==t.naturalWidth?recordInlineImage():t.addEventListener("load",recordInlineImage)}if("audio"===g||"video"===g){const t=y;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(_){const{width:t,height:n}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==g||h(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);let b;try{customElements.get(g)&&(b=!0)}catch(S){}return{type:st.Element,tagName:g,attributes:y,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:_,rootId:m,isCustom:b}}(e,{doc:n,blockClass:s,blockSelector:a,inlineStylesheet:d,maskInputOptions:u,maskInputFn:p,dataURLOptions:h,inlineImages:f,recordCanvas:m,keepIframeSrcFn:_,newlyAddedElement:g,rootId:y});case e.TEXT_NODE:return function serializeTextNode(e,t){var n;const{needsMask:i,maskTextFn:s,rootId:a}=t,c=e.parentNode&&e.parentNode.tagName;let d=e.textContent;const u="STYLE"===c||void 0,l="SCRIPT"===c||void 0;if(u&&d){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(d=stringifyStylesheet(e.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,e)}d=absoluteToStylesheet(d,getHref())}l&&(d="SCRIPT_PLACEHOLDER");!u&&!l&&d&&i&&(d=s?s(d,e.parentElement):d.replace(/[\S]/g,"*"));return{type:st.Text,textContent:d||"",isStyle:u,rootId:a}}(e,{needsMask:c,maskTextFn:l,rootId:y});case e.CDATA_SECTION_NODE:return{type:st.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:st.Comment,textContent:e.textContent||"",rootId:y};default:return!1}}function lowerIfExists(e){return null==e?"":e.toLowerCase()}function serializeNodeWithId(e,t){const{doc:n,mirror:i,blockClass:s,blockSelector:a,maskTextClass:c,maskTextSelector:d,skipChild:u=!1,inlineStylesheet:l=!0,maskInputOptions:p={},maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:_={},inlineImages:g=!1,recordCanvas:y=!1,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:C=!1}=t;let{needsMask:O}=t,{preserveWhiteSpace:T=!0}=t;if(!O&&e.childNodes){O=needMaskingText(e,c,d,void 0===O)}const R=serializeNode(e,{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:O,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,dataURLOptions:_,inlineImages:g,recordCanvas:y,keepIframeSrcFn:x,newlyAddedElement:C});if(!R)return console.warn(e,"not serialized"),null;let N;N=i.hasNode(e)?i.getId(e):!function slimDOMExcluded(e,t){if(t.comment&&e.type===st.Comment)return!0;if(e.type===st.Element){if(t.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(t.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(t.headMetaDescKeywords&&lowerIfExists(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(lowerIfExists(e.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===lowerIfExists(e.attributes.name)||"googlebot"===lowerIfExists(e.attributes.name)||"bingbot"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.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(t.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}(R,m)&&(T||R.type!==st.Text||R.isStyle||R.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():lt;const Z=Object.assign(R,{id:N});if(i.add(e,Z),N===lt)return null;v&&v(e);let P=!u;if(Z.type===st.Element){P=P&&!Z.needBlock,delete Z.needBlock;const t=e.shadowRoot;t&&isNativeShadowDom(t)&&(Z.isShadowHost=!0)}if((Z.type===st.Document||Z.type===st.Element)&&P){m.headWhitespace&&Z.type===st.Element&&"head"===Z.tagName&&(T=!1);const t={doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:O,maskTextClass:c,maskTextSelector:d,skipChild:u,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:_,inlineImages:g,recordCanvas:y,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:I,keepIframeSrcFn:x};if(Z.type===st.Element&&"textarea"===Z.tagName&&void 0!==Z.attributes.value);else for(const n of Array.from(e.childNodes)){const e=serializeNodeWithId(n,t);e&&Z.childNodes.push(e)}if(function isElement(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(const n of Array.from(e.shadowRoot.childNodes)){const i=serializeNodeWithId(n,t);i&&(isNativeShadowDom(e.shadowRoot)&&(i.isShadow=!0),Z.childNodes.push(i))}}return e.parentNode&&isShadowRoot(e.parentNode)&&isNativeShadowDom(e.parentNode)&&(Z.isShadow=!0),Z.type===st.Element&&"iframe"===Z.tagName&&function onceIframeLoaded(e,t,n){const i=e.contentWindow;if(!i)return;let s,a=!1;try{s=i.document.readyState}catch(Xt){return}if("complete"!==s){const i=setTimeout((()=>{a||(t(),a=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(i),a=!0,t()}))}const c="about:blank";if(i.location.href!==c||e.src===c||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.contentDocument;if(t&&b){const n=serializeNodeWithId(t,{doc:t,mirror:i,blockClass:s,blockSelector:a,needsMask:O,maskTextClass:c,maskTextSelector:d,skipChild:!1,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:_,inlineImages:g,recordCanvas:y,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:I,keepIframeSrcFn:x});n&&b(e,n)}}),S),Z.type===st.Element&&"link"===Z.tagName&&"string"==typeof Z.attributes.rel&&("stylesheet"===Z.attributes.rel||"preload"===Z.attributes.rel&&"string"==typeof Z.attributes.href&&"css"===extractFileExtension(Z.attributes.href))&&function onceStylesheetLoaded(e,t,n){let i,s=!1;try{i=e.sheet}catch(Xt){return}if(i)return;const a=setTimeout((()=>{s||(t(),s=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(a),s=!0,t()}))}(e,(()=>{if(w){const t=serializeNodeWithId(e,{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:O,maskTextClass:c,maskTextSelector:d,skipChild:!1,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:_,inlineImages:g,recordCanvas:y,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:I,keepIframeSrcFn:x});t&&w(e,t)}}),I),Z}function on(e,t,n=document){const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}const bt="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 St={map:{},getId:()=>(console.error(bt),-1),getNode:()=>(console.error(bt),null),removeNodeFromMap(){console.error(bt)},has:()=>(console.error(bt),!1),reset(){console.error(bt)}};function throttle(e,t,n={}){let i=null,s=0;return function(...a){const c=Date.now();s||!1!==n.leading||(s=c);const d=t-(c-s),u=this;d<=0||d>t?(i&&(clearTimeout(i),i=null),s=c,e.apply(u,a)):i||!1===n.trailing||(i=setTimeout((()=>{s=!1===n.leading?0:Date.now(),i=null,e.apply(u,a)}),d))}}function hookSetter(e,t,n,i,s=window){const a=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,i?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),a&&a.set&&a.set.call(this,e)}}),()=>hookSetter(e,t,a||{},!0)}function patch(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],s=n(i);return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=s,()=>{e[t]=i}}catch(i){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(St=new Proxy(St,{get:(e,t,n)=>("map"===t&&console.error(bt),Reflect.get(e,t,n))}));let kt=Date.now;function getWindowScroll(e){var t,n,i,s,a,c;const d=e.document;return{left:d.scrollingElement?d.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==d?void 0:d.documentElement.scrollLeft)||(null===(n=null===(t=null==d?void 0:d.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null==d?void 0:d.body)||void 0===i?void 0:i.scrollLeft)||0,top:d.scrollingElement?d.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==d?void 0:d.documentElement.scrollTop)||(null===(a=null===(s=null==d?void 0:d.body)||void 0===s?void 0:s.parentElement)||void 0===a?void 0:a.scrollTop)||(null===(c=null==d?void 0:d.body)||void 0===c?void 0:c.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,t,n,i){if(!e)return!1;const s=closestElementOfNode(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(i&&null!==s.closest("."+t))return!0}else if(classMatchesRegex(s,t,i))return!0}catch(a){}if(n){if(s.matches(n))return!0;if(i&&null!==s.closest(n))return!0}return!1}function isIgnored(e,t){return t.getId(e)===lt}function isAncestorRemoved(e,t){if(isShadowRoot(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||isAncestorRemoved(e.parentNode,t))}function legacy_isTouchEvent(e){return Boolean(e.changedTouches)}function isSerializedIframe(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function isSerializedStylesheet(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function hasShadowRoot(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(kt=()=>(new Date).getTime());class StyleSheetMirror{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}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 t,n;let i=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(i=e.getRootNode().host),i}function shadowHostInDom(e){const t=e.ownerDocument;if(!t)return!1;const n=function getRootShadowHost(e){let t,n=e;for(;t=getShadowHost(n);)n=t;return n}(e);return t.contains(n)}function inDom(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||shadowHostInDom(e))}var wt=(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))(wt||{}),It=(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))(It||{}),xt=(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))(xt||{}),Et=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Et||{}),Ct=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ct||{});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 t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&isNodeInLinkedList(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&isNodeInLinkedList(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const moveKey=(e,t)=>`${e}@${t}`;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=[],t=new Set,n=new DoubleLinkedList,getNextId=e=>{let t=e,n=lt;for(;n===lt;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},pushAdd=i=>{if(!i.parentNode||!inDom(i)||"TEXTAREA"===i.parentNode.tagName)return;const s=isShadowRoot(i.parentNode)?this.mirror.getId(getShadowHost(i)):this.mirror.getId(i.parentNode),a=getNextId(i);if(-1===s||-1===a)return n.addNode(i);const c=serializeNodeWithId(i,{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(i)&&this.shadowDomManager.addShadowRoot(i.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});c&&(e.push({parentId:s,nextId:a,node:c}),t.add(c.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 i=null;for(;n.length;){let e=null;if(i){const t=this.mirror.getId(i.value.parentNode),n=getNextId(i.value);-1!==t&&-1!==n&&(e=i)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===getNextId(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=t.parentNode.host;if(-1!==this.mirror.getId(i)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}i=e.previous,n.removeNode(e.value),pushAdd(e.value)}const s={texts:this.texts.map((e=>{const t=e.node;return t.parentNode&&"TEXTAREA"===t.parentNode.tagName&&this.genTextAreaValueMutation(t.parentNode),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+i).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.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 t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.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 t=e.target.textContent;isBlocked(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:needMaskingText(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,closestElementOfNode(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let i=e.attributeName,s=e.target.getAttribute(i);if("value"===i){const e=getInputType(n);s=maskInputValue({element:n,maskInputOptions:this.maskInputOptions,tagName:n.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"===n.tagName&&"src"===i&&!this.keepIframeSrcFn(s)){if(n.contentDocument)return;i="rr_src"}if(a||(a={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(e.target,a)),"type"===i&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!ignoreAttribute(n.tagName,i)&&(a.attributes[i]=transformAttribute(this.doc,toLowerCase(n.tagName),toLowerCase(i),s),"style"===i)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const i=this.unattachedDoc.createElement("span");e.oldValue&&i.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),s=n.style.getPropertyPriority(e);t!==i.style.getPropertyValue(e)||s!==i.style.getPropertyPriority(e)?a.styleDiff[e]=""===s?t:[t,s]:a._unchangedStyles[e]=[t,s]}for(const e of Array.from(i.style))""===n.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((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),i=isShadowRoot(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);isBlocked(e.target,this.blockClass,this.blockSelector,!1)||isIgnored(t,this.mirror)||!function isSerialized(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(deepDelete(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||isAncestorRemoved(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[moveKey(n,i)]?deepDelete(this.movedSet,t):this.removes.push({parentId:i,id:n,isShadow:!(!isShadowRoot(e.target)||!isNativeShadowDom(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{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 n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[moveKey(this.mirror.getId(e),n)]=!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((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,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((t=>{this[t]=e[t]}))}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,t){e.delete(t),t.childNodes.forEach((t=>deepDelete(e,t)))}function isParentRemoved(e,t,n){return 0!==e.length&&_isParentRemoved(e,t,n)}function _isParentRemoved(e,t,n){const{parentNode:i}=t;if(!i)return!1;const s=n.getId(i);return!!e.some((e=>e.id===s))||_isParentRemoved(e,i,n)}function isAncestorInSet(e,t){return 0!==e.size&&_isAncestorInSet(e,t)}function _isAncestorInSet(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||_isAncestorInSet(e,n))}let Ot;const callbackWrapper=e=>{if(!Ot)return e;return(...t)=>{try{return e(...t)}catch(Xt){if(Ot&&!0===Ot(Xt))return;throw Xt}}},Tt=[];function getEventTarget(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(t){}return e&&e.target}function initMutationObserver(e,t){var n,i;const s=new MutationBuffer;Tt.push(s),s.init(e);let a=window.MutationObserver||window.__rrMutationObserver;const c=null===(i=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===i?void 0:i.call(n,"MutationObserver");c&&window[c]&&(a=window[c]);const d=new a(callbackWrapper(s.processMutations.bind(s)));return d.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),d}function initMouseInteractionObserver({mouseInteractionCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){if(!1===a.mouseInteraction)return()=>{};const c=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,d=[];let u=null;return Object.keys(xt).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==c[e])).forEach((a=>{let c=toLowerCase(a);const l=(t=>a=>{const c=getEventTarget(a);if(isBlocked(c,i,s,!0))return;let d=null,l=t;if("pointerType"in a){switch(a.pointerType){case"mouse":d=Et.Mouse;break;case"touch":d=Et.Touch;break;case"pen":d=Et.Pen}d===Et.Touch?xt[t]===xt.MouseDown?l="TouchStart":xt[t]===xt.MouseUp&&(l="TouchEnd"):Et.Pen}else legacy_isTouchEvent(a)&&(d=Et.Touch);null!==d?(u=d,(l.startsWith("Touch")&&d===Et.Touch||l.startsWith("Mouse")&&d===Et.Mouse)&&(d=null)):xt[t]===xt.Click&&(d=u,u=null);const p=legacy_isTouchEvent(a)?a.changedTouches[0]:a;if(!p)return;const h=n.getId(c),{clientX:f,clientY:m}=p;callbackWrapper(e)(Object.assign({type:xt[l],id:h,x:f,y:m},null!==d&&{pointerType:d}))})(a);if(window.PointerEvent)switch(xt[a]){case xt.MouseDown:case xt.MouseUp:c=c.replace("mouse","pointer");break;case xt.TouchStart:case xt.TouchEnd:return}d.push(on(c,l,t))})),callbackWrapper((()=>{d.forEach((e=>e()))}))}function initScrollObserver({scrollCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){return on("scroll",callbackWrapper(throttle(callbackWrapper((a=>{const c=getEventTarget(a);if(!c||isBlocked(c,i,s,!0))return;const d=n.getId(c);if(c===t&&t.defaultView){const n=getWindowScroll(t.defaultView);e({id:d,x:n.left,y:n.top})}else e({id:d,x:c.scrollLeft,y:c.scrollTop})})),a.scroll||100)),t)}const Rt=["INPUT","TEXTAREA","SELECT"],Mt=new WeakMap;function getNestedCSSRulePositions(e){return function recurse(e,t){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 n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function getIdAndStyleId(e,t,n){let i,s;return e?(e.ownerNode?i=t.getId(e.ownerNode):s=n.getId(e),{styleId:s,id:i}):{}}function initAdoptedStyleSheetObserver({mirror:e,stylesheetManager:t},n){var i,s,a;let c=null;c="#document"===n.nodeName?e.getId(n):e.getId(n.host);const d="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(a=null===(s=n.ownerDocument)||void 0===s?void 0:s.defaultView)||void 0===a?void 0:a.ShadowRoot,u=(null==d?void 0:d.prototype)?Object.getOwnPropertyDescriptor(null==d?void 0:d.prototype,"adoptedStyleSheets"):void 0;return null!==c&&-1!==c&&d&&u?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null===(e=u.get)||void 0===e?void 0:e.call(this)},set(e){var n;const i=null===(n=u.set)||void 0===n?void 0:n.call(this,e);if(null!==c&&-1!==c)try{t.adoptStyleSheets(e,c)}catch(s){}return i}}),callbackWrapper((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function initObservers(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let i;!function mergeHooks(e,t){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:s,scrollCb:a,viewportResizeCb:c,inputCb:d,mediaInteractionCb:u,styleSheetRuleCb:l,styleDeclarationCb:p,canvasMutationCb:h,fontCb:f,selectionCb:m,customElementCb:_}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),i(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),a(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),c(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),d(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),u(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),p(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),h(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),f(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),m(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),_(...e)}}(e,t),e.recordDOM&&(i=initMutationObserver(e,e.doc));const s=function initMoveObserver({mousemoveCb:e,sampling:t,doc:n,mirror:i}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,a="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let c,d=[];const u=throttle(callbackWrapper((t=>{const n=Date.now()-c;e(d.map((e=>(e.timeOffset-=n,e))),t),d=[],c=null})),a),l=callbackWrapper(throttle(callbackWrapper((e=>{const t=getEventTarget(e),{clientX:n,clientY:s}=legacy_isTouchEvent(e)?e.changedTouches[0]:e;c||(c=kt()),d.push({x:n,y:s,id:i.getId(t),timeOffset:kt()-c}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?It.Drag:e instanceof MouseEvent?It.MouseMove:It.TouchMove)})),s,{trailing:!1})),p=[on("mousemove",l,n),on("touchmove",l,n),on("drag",l,n)];return callbackWrapper((()=>{p.forEach((e=>e()))}))}(e),a=initMouseInteractionObserver(e),c=initScrollObserver(e),d=function initViewportResizeObserver({viewportResizeCb:e},{win:t}){let n=-1,i=-1;return on("resize",callbackWrapper(throttle(callbackWrapper((()=>{const t=getWindowHeight(),s=getWindowWidth();n===t&&i===s||(e({width:Number(s),height:Number(t)}),n=t,i=s)})),200)),t)}(e,{win:n}),u=function initInputObserver({inputCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,ignoreClass:a,ignoreSelector:c,maskInputOptions:d,maskInputFn:u,sampling:l,userTriggeredOnInput:p}){function eventHandler(e){let n=getEventTarget(e);const l=e.isTrusted,h=n&&n.tagName;if(n&&"OPTION"===h&&(n=n.parentElement),!n||!h||Rt.indexOf(h)<0||isBlocked(n,i,s,!0))return;if(n.classList.contains(a)||c&&n.matches(c))return;let f=n.value,m=!1;const _=getInputType(n)||"";"radio"===_||"checkbox"===_?m=n.checked:(d[h.toLowerCase()]||d[_])&&(f=maskInputValue({element:n,maskInputOptions:d,tagName:h,type:_,value:f,maskInputFn:u})),cbWithDedup(n,p?{text:f,isChecked:m,userTriggered:l}:{text:f,isChecked:m});const g=n.name;"radio"===_&&g&&m&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach((e=>{if(e!==n){const t=e.value;cbWithDedup(e,p?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}}))}function cbWithDedup(t,i){const s=Mt.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){Mt.set(t,i);const s=n.getId(t);callbackWrapper(e)(Object.assign(Object.assign({},i),{id:s}))}}const h=("last"===l.input?["change"]:["input","change"]).map((e=>on(e,callbackWrapper(eventHandler),t))),f=t.defaultView;if(!f)return()=>{h.forEach((e=>e()))};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),_=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&h.push(..._.map((e=>hookSetter(e[0],e[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,f)))),callbackWrapper((()=>{h.forEach((e=>e()))}))}(e),l=function initMediaInteractionObserver({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:i,sampling:s,doc:a}){const c=callbackWrapper((a=>throttle(callbackWrapper((s=>{const c=getEventTarget(s);if(!c||isBlocked(c,t,n,!0))return;const{currentTime:d,volume:u,muted:l,playbackRate:p,loop:h}=c;e({type:a,id:i.getId(c),currentTime:d,volume:u,muted:l,playbackRate:p,loop:h})})),s.media||500))),d=[on("play",c(0),a),on("pause",c(1),a),on("seeked",c(2),a),on("volumechange",c(3),a),on("ratechange",c(4),a)];return callbackWrapper((()=>{d.forEach((e=>e()))}))}(e);let styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};e.recordDOM&&(styleSheetObserver=function initStyleSheetObserver({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const s=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:callbackWrapper(((i,s,a)=>{const[c,d]=a,{id:u,styleId:l}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&e({id:u,styleId:l,adds:[{rule:c,index:d}]}),i.apply(s,a)}))});const a=i.CSSStyleSheet.prototype.deleteRule;let c,d;i.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,removes:[{index:c}]}),i.apply(s,a)}))}),i.CSSStyleSheet.prototype.replace&&(c=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,replace:c}),i.apply(s,a)}))})),i.CSSStyleSheet.prototype.replaceSync&&(d=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(d,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,replaceSync:c}),i.apply(s,a)}))}));const u={};canMonkeyPatchNestedCSSRule("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(canMonkeyPatchNestedCSSRule("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),canMonkeyPatchNestedCSSRule("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),canMonkeyPatchNestedCSSRule("CSSSupportsRule")&&(u.CSSSupportsRule=i.CSSSupportsRule));const l={};return Object.entries(u).forEach((([i,s])=>{l[i]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(l[i].insertRule,{apply:callbackWrapper(((i,s,a)=>{const[c,d]=a,{id:u,styleId:l}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&e({id:u,styleId:l,adds:[{rule:c,index:[...getNestedCSSRulePositions(s),d||0]}]}),i.apply(s,a)}))}),s.prototype.deleteRule=new Proxy(l[i].deleteRule,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,removes:[{index:[...getNestedCSSRulePositions(s),c]}]}),i.apply(s,a)}))})})),callbackWrapper((()=>{i.CSSStyleSheet.prototype.insertRule=s,i.CSSStyleSheet.prototype.deleteRule=a,c&&(i.CSSStyleSheet.prototype.replace=c),d&&(i.CSSStyleSheet.prototype.replaceSync=d),Object.entries(u).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(e,e.doc),styleDeclarationObserver=function initStyleDeclarationObserver({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:i},{win:s}){const a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:callbackWrapper(((s,c,d)=>{var u;const[l,p,h]=d;if(n.has(l))return a.apply(c,[l,p,h]);const{id:f,styleId:m}=getIdAndStyleId(null===(u=c.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(f&&-1!==f||m&&-1!==m)&&e({id:f,styleId:m,set:{property:l,value:p,priority:h},index:getNestedCSSRulePositions(c.parentRule)}),s.apply(c,d)}))});const c=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:callbackWrapper(((s,a,d)=>{var u;const[l]=d;if(n.has(l))return c.apply(a,[l]);const{id:p,styleId:h}=getIdAndStyleId(null===(u=a.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(p&&-1!==p||h&&-1!==h)&&e({id:p,styleId:h,remove:{property:l},index:getNestedCSSRulePositions(a.parentRule)}),s.apply(a,d)}))}),callbackWrapper((()=>{s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=c}))}(e,{win:n}),e.collectFonts&&(fontObserver=function initFontObserver({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const i=[],s=new WeakMap,a=n.FontFace;n.FontFace=function FontFace(e,t,n){const i=new a(e,t,n);return s.set(i,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};const c=patch(t.fonts,"add",(function(t){return function(n){return setTimeout(callbackWrapper((()=>{const t=s.get(n);t&&(e(t),s.delete(n))})),0),t.apply(this,[n])}}));return i.push((()=>{n.FontFace=a})),i.push(c),callbackWrapper((()=>{i.forEach((e=>e()))}))}(e)));const p=function initSelectionObserver(e){const{doc:t,mirror:n,blockClass:i,blockSelector:s,selectionCb:a}=e;let c=!0;const d=callbackWrapper((()=>{const e=t.getSelection();if(!e||c&&(null==e?void 0:e.isCollapsed))return;c=e.isCollapsed||!1;const d=[],u=e.rangeCount||0;for(let t=0;t<u;t++){const a=e.getRangeAt(t),{startContainer:c,startOffset:u,endContainer:l,endOffset:p}=a;isBlocked(c,i,s,!0)||isBlocked(l,i,s,!0)||d.push({start:n.getId(c),startOffset:u,end:n.getId(l),endOffset:p})}a({ranges:d})}));return d(),on("selectionchange",d)}(e),h=function initCustomElementObserver({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?patch(n.customElements,"define",(function(e){return function(n,i,s){try{t({define:{name:n}})}catch(a){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,i,s])}})):()=>{}}(e),f=[];for(const m of e.plugins)f.push(m.observer(m.callback,n,m.options));return callbackWrapper((()=>{Tt.forEach((e=>e.reset())),null==i||i.disconnect(),s(),a(),c(),d(),u(),l(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),p(),h(),f.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,t,n,i){const s=n||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e);let c=s.get(t);return c||(c=this.generateIdFn(),s.set(t,c),a.set(c,t)),c}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,i)))}getRemoteId(e,t,n){const i=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const s=i.get(t);return s||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}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 t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}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,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.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 t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case wt.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:wt.IncrementalSnapshot,data:{source:It.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case wt.Meta:case wt.Load:case wt.DomContentLoaded:return!1;case wt.Plugin:return t;case wt.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case wt.IncrementalSnapshot:switch(t.data.source){case It.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case It.Drag:case It.TouchMove:case It.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case It.ViewportResize:return!1;case It.MediaInteraction:case It.MouseInteraction:case It.Scroll:case It.CanvasMutation:case It.Input:return this.replaceIds(t.data,e,["id"]),t;case It.StyleSheetRule:case It.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case It.Font:return t;case It.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case It.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,i){for(const s of i)(Array.isArray(t[s])||"number"==typeof t[s])&&(Array.isArray(t[s])?t[s]=e.getIds(n,t[s]):t[s]=e.getId(n,t[s]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===st.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}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,t){if(!isNativeShadowDom(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=initMutationObserver(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.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,t){const n=this;this.restoreHandlers.push(patch(e.prototype,"attachShadow",(function(e){return function(i){const s=e.call(this,i);return this.shadowRoot&&inDom(this)&&n.addShadowRoot(this.shadowRoot,t),s}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
|
|
1
|
+
"use strict";var e,t,n;(t=e||(e={})).assertEqual=e=>e,t.assertIs=function assertIs(e){},t.assertNever=function assertNever(e){throw new Error},t.arrayToEnum=e=>{const t={};for(const n of e)t[n]=n;return t},t.getValidEnumValues=e=>{const n=t.objectKeys(e).filter((t=>"number"!=typeof e[e[t]])),i={};for(const t of n)i[t]=e[t];return t.objectValues(i)},t.objectValues=e=>t.objectKeys(e).map((function(t){return e[t]})),t.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{const t=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t},t.find=(e,t)=>{for(const n of e)if(t(n))return n},t.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,t.joinValues=function joinValues(e,t=" | "){return e.map((e=>"string"==typeof e?`'${e}'`:e)).join(t)},t.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(n||(n={})).mergeShapes=(e,t)=>({...e,...t});const i=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 i.undefined;case"string":return i.string;case"number":return isNaN(e)?i.nan:i.number;case"boolean":return i.boolean;case"function":return i.function;case"bigint":return i.bigint;case"symbol":return i.symbol;case"object":return Array.isArray(e)?i.array:null===e?i.null:e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch?i.promise:"undefined"!=typeof Map&&e instanceof Map?i.map:"undefined"!=typeof Set&&e instanceof Set?i.set:"undefined"!=typeof Date&&e instanceof Date?i.date:i.object;default:return i.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 t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){const t=e||function(e){return e.message},n={_errors:[]},processError=e=>{for(const i of e.issues)if("invalid_union"===i.code)i.unionErrors.map(processError);else if("invalid_return_type"===i.code)processError(i.returnTypeError);else if("invalid_arguments"===i.code)processError(i.argumentsError);else if(0===i.path.length)n._errors.push(t(i));else{let e=n,s=0;for(;s<i.path.length;){const n=i.path[s];s===i.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(i))):e[n]=e[n]||{_errors:[]},e=e[n],s++}}};return processError(this),n}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 t={},n=[];for(const i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}ZodError.create=e=>new ZodError(e);const errorMap=(t,n)=>{let a;switch(t.code){case s.invalid_type:a=t.received===i.undefined?"Required":`Expected ${t.expected}, received ${t.received}`;break;case s.invalid_literal:a=`Invalid literal value, expected ${JSON.stringify(t.expected,e.jsonStringifyReplacer)}`;break;case s.unrecognized_keys:a=`Unrecognized key(s) in object: ${e.joinValues(t.keys,", ")}`;break;case s.invalid_union:a="Invalid input";break;case s.invalid_union_discriminator:a=`Invalid discriminator value. Expected ${e.joinValues(t.options)}`;break;case s.invalid_enum_value:a=`Invalid enum value. Expected ${e.joinValues(t.options)}, received '${t.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 t.validation?"includes"in t.validation?(a=`Invalid input: must include "${t.validation.includes}"`,"number"==typeof t.validation.position&&(a=`${a} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?a=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?a=`Invalid input: must end with "${t.validation.endsWith}"`:e.assertNever(t.validation):a="regex"!==t.validation?`Invalid ${t.validation}`:"Invalid";break;case s.too_small:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:"date"===t.type?`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:"Invalid input";break;case s.too_big:a="array"===t.type?`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:"string"===t.type?`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:"number"===t.type?`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"bigint"===t.type?`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:"date"===t.type?`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.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 ${t.multipleOf}`;break;case s.not_finite:a="Number must be finite";break;default:a=n.defaultError,e.assertNever(t)}return{message:a}};let a=errorMap;function getErrorMap(){return a}const makeIssue=e=>{const{data:t,path:n,errorMaps:i,issueData:s}=e,a=[...n,...s.path||[]],c={...s,path:a};if(void 0!==s.message)return{...s,path:a,message:s.message};let d="";const u=i.filter((e=>!!e)).slice().reverse();for(const l of u)d=l(c,{data:t,defaultError:d}).message;return{...s,path:a,message:d}};function addIssueToContext(e,t){const n=getErrorMap(),i=makeIssue({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===errorMap?void 0:errorMap].filter((e=>!!e))});e.common.issues.push(i)}class ParseStatus{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const i of t){if("aborted"===i.status)return c;"dirty"===i.status&&e.dirty(),n.push(i.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const i of t){const e=await i.key,t=await i.value;n.push({key:e,value:t})}return ParseStatus.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const i of t){const{key:t,value:s}=i;if("aborted"===t.status)return c;if("aborted"===s.status)return c;"dirty"===t.status&&e.dirty(),"dirty"===s.status&&e.dirty(),"__proto__"===t.value||void 0===s.value&&!i.alwaysSet||(n[t.value]=s.value)}return{status:e.value,value:n}}}const c=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,t,n,i){if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t.get(e)}function __classPrivateFieldSet(e,t,n,i,s){if("function"==typeof t?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return t.set(e,n),n}var d,u,l,p;"function"==typeof SuppressedError&&SuppressedError,(u=d||(d={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},u.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ParseInputLazyPath{constructor(e,t,n,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=i}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,t)=>{if(isValid(t))return{success:!0,data:t.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 t=new ZodError(e.common.issues);return this._error=t,this._error}}};function processCreateParams(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:i,description:s}=e;if(t&&(n||i))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');if(t)return{errorMap:t,description:s};return{errorMap:(t,s)=>{var a,c;const{message:d}=e;return"invalid_enum_value"===t.code?{message:null!=d?d:s.defaultError}:void 0===s.data?{message:null!==(a=null!=d?d:i)&&void 0!==a?a:s.defaultError}:"invalid_type"!==t.code?{message:s.defaultError}:{message:null!==(c=null!=d?d:n)&&void 0!==c?c: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,t){return t||{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 t=this._parse(e);if(isAsync(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;const i={common:{issues:[],async:null!==(n=null==t?void 0:t.async)&&void 0!==n&&n,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},s=this._parseSync({data:e,path:i.path,parent:i});return handleResult(i,s)}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:getParsedType(e)},i=this._parse({data:e,path:n.path,parent:n}),s=await(isAsync(i)?i:Promise.resolve(i));return handleResult(n,s)}refine(e,t){const getIssueProperties=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement(((t,n)=>{const i=e(t),setError=()=>n.addIssue({code:s.custom,...getIssueProperties(t)});return"undefined"!=typeof Promise&&i instanceof Promise?i.then((e=>!!e||(setError(),!1))):!!i||(setError(),!1)}))}refinement(e,t){return this._refinement(((n,i)=>!!e(n)||(i.addIssue("function"==typeof t?t(n,i):t),!1)))}_refinement(e){return new ZodEffects({schema:this,typeName:R.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:R.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t="function"==typeof e?e:()=>e;return new ZodDefault({...processCreateParams(this._def),innerType:this,defaultValue:t,typeName:R.ZodDefault})}brand(){return new ZodBranded({typeName:R.ZodBranded,type:this,...processCreateParams(this._def)})}catch(e){const t="function"==typeof e?e:()=>e;return new ZodCatch({...processCreateParams(this._def),innerType:this,catchValue:t,typeName:R.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 h=/^c[^\s-]{8,}$/i,f=/^[0-9a-z]+$/,m=/^[0-9A-HJKMNP-TV-Z]{26}$/,_=/^[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,g=/^[a-z0-9_-]{21}$/i,y=/^[-+]?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)?)??$/,v=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let b;const S=/^(?:(?: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])$/,w=/^(([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})))$/,I=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,x="((\\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])))",C=new RegExp(`^${x}$`);function timeRegexSource(e){let t="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return e.precision?t=`${t}\\.\\d{${e.precision}}`:null==e.precision&&(t=`${t}(\\.\\d+)?`),t}function datetimeRegex(e){let t=`${x}T${timeRegexSource(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}class ZodString extends ZodType{_parse(t){this._def.coerce&&(t.data=String(t.data));if(this._getType(t)!==i.string){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.string,received:e.parsedType}),c}const n=new ParseStatus;let a;for(const i of this._def.checks)if("min"===i.kind)t.data.length<i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if("max"===i.kind)t.data.length>i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if("length"===i.kind){const e=t.data.length>i.value,c=t.data.length<i.value;(e||c)&&(a=this._getOrReturnCtx(t,a),e?addIssueToContext(a,{code:s.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):c&&addIssueToContext(a,{code:s.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if("email"===i.kind)v.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"email",code:s.invalid_string,message:i.message}),n.dirty());else if("emoji"===i.kind)b||(b=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),b.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"emoji",code:s.invalid_string,message:i.message}),n.dirty());else if("uuid"===i.kind)_.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"uuid",code:s.invalid_string,message:i.message}),n.dirty());else if("nanoid"===i.kind)g.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"nanoid",code:s.invalid_string,message:i.message}),n.dirty());else if("cuid"===i.kind)h.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"cuid",code:s.invalid_string,message:i.message}),n.dirty());else if("cuid2"===i.kind)f.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"cuid2",code:s.invalid_string,message:i.message}),n.dirty());else if("ulid"===i.kind)m.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"ulid",code:s.invalid_string,message:i.message}),n.dirty());else if("url"===i.kind)try{new URL(t.data)}catch(l){a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"url",code:s.invalid_string,message:i.message}),n.dirty()}else if("regex"===i.kind){i.regex.lastIndex=0;i.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"regex",code:s.invalid_string,message:i.message}),n.dirty())}else if("trim"===i.kind)t.data=t.data.trim();else if("includes"===i.kind)t.data.includes(i.value,i.position)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty());else if("toLowerCase"===i.kind)t.data=t.data.toLowerCase();else if("toUpperCase"===i.kind)t.data=t.data.toUpperCase();else if("startsWith"===i.kind)t.data.startsWith(i.value)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty());else if("endsWith"===i.kind)t.data.endsWith(i.value)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty());else if("datetime"===i.kind){datetimeRegex(i).test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"datetime",message:i.message}),n.dirty())}else if("date"===i.kind){C.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"date",message:i.message}),n.dirty())}else if("time"===i.kind){new RegExp(`^${timeRegexSource(i)}$`).test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.invalid_string,validation:"time",message:i.message}),n.dirty())}else"duration"===i.kind?y.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"duration",code:s.invalid_string,message:i.message}),n.dirty()):"ip"===i.kind?(d=t.data,("v4"!==(u=i.version)&&u||!S.test(d))&&("v6"!==u&&u||!w.test(d))&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"ip",code:s.invalid_string,message:i.message}),n.dirty())):"base64"===i.kind?I.test(t.data)||(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{validation:"base64",code:s.invalid_string,message:i.message}),n.dirty()):e.assertNever(i);var d,u;return{status:n.value,value:t.data}}_regex(e,t,n){return this.refinement((t=>e.test(t)),{validation:t,code:s.invalid_string,...d.errToObj(n)})}_addCheck(e){return new ZodString({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...d.errToObj(e)})}url(e){return this._addCheck({kind:"url",...d.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...d.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...d.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...d.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...d.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...d.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...d.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...d.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...d.errToObj(e)})}datetime(e){var t,n;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!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,local:null!==(n=null==e?void 0:e.local)&&void 0!==n&&n,...d.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,...d.errToObj(null==e?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...d.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...d.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...d.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...d.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...d.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...d.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...d.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...d.errToObj(t)})}nonempty(e){return this.min(1,d.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 t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}function floatSafeRemainder(e,t){const n=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,s=n>i?n:i;return parseInt(e.toFixed(s).replace(".",""))%parseInt(t.toFixed(s).replace(".",""))/Math.pow(10,s)}ZodString.create=e=>{var t;return new ZodString({checks:[],typeName:R.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodNumber extends ZodType{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){this._def.coerce&&(t.data=Number(t.data));if(this._getType(t)!==i.number){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.number,received:e.parsedType}),c}let n;const a=new ParseStatus;for(const i of this._def.checks)if("int"===i.kind)e.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.invalid_type,expected:"integer",received:"float",message:i.message}),a.dirty());else if("min"===i.kind){(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty())}else if("max"===i.kind){(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),a.dirty())}else"multipleOf"===i.kind?0!==floatSafeRemainder(t.data,i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):"finite"===i.kind?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_finite,message:i.message}),a.dirty()):e.assertNever(i);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,d.toString(t))}gt(e,t){return this.setLimit("min",e,!1,d.toString(t))}lte(e,t){return this.setLimit("max",e,!0,d.toString(t))}lt(e,t){return this.setLimit("max",e,!1,d.toString(t))}setLimit(e,t,n,i){return new ZodNumber({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:d.toString(i)}]})}_addCheck(e){return new ZodNumber({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:d.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:d.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:d.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:d.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:d.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:d.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:d.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:d.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:d.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find((t=>"int"===t.kind||"multipleOf"===t.kind&&e.isInteger(t.value)))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if("finite"===n.kind||"int"===n.kind||"multipleOf"===n.kind)return!0;"min"===n.kind?(null===t||n.value>t)&&(t=n.value):"max"===n.kind&&(null===e||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ZodNumber.create=e=>new ZodNumber({checks:[],typeName:R.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(t){this._def.coerce&&(t.data=BigInt(t.data));if(this._getType(t)!==i.bigint){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.bigint,received:e.parsedType}),c}let n;const a=new ParseStatus;for(const i of this._def.checks)if("min"===i.kind){(i.inclusive?t.data<i.value:t.data<=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty())}else if("max"===i.kind){(i.inclusive?t.data>i.value:t.data>=i.value)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),a.dirty())}else"multipleOf"===i.kind?t.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(t,n),addIssueToContext(n,{code:s.not_multiple_of,multipleOf:i.value,message:i.message}),a.dirty()):e.assertNever(i);return{status:a.value,value:t.data}}gte(e,t){return this.setLimit("min",e,!0,d.toString(t))}gt(e,t){return this.setLimit("min",e,!1,d.toString(t))}lte(e,t){return this.setLimit("max",e,!0,d.toString(t))}lt(e,t){return this.setLimit("max",e,!1,d.toString(t))}setLimit(e,t,n,i){return new ZodBigInt({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:d.toString(i)}]})}_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:d.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:d.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:d.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:d.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:d.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ZodBigInt.create=e=>{var t;return new ZodBigInt({checks:[],typeName:R.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...processCreateParams(e)})};class ZodBoolean extends ZodType{_parse(e){this._def.coerce&&(e.data=Boolean(e.data));if(this._getType(e)!==i.boolean){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.boolean,received:t.parsedType}),c}return OK(e.data)}}ZodBoolean.create=e=>new ZodBoolean({typeName:R.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...processCreateParams(e)});class ZodDate extends ZodType{_parse(t){this._def.coerce&&(t.data=new Date(t.data));if(this._getType(t)!==i.date){const e=this._getOrReturnCtx(t);return addIssueToContext(e,{code:s.invalid_type,expected:i.date,received:e.parsedType}),c}if(isNaN(t.data.getTime())){return addIssueToContext(this._getOrReturnCtx(t),{code:s.invalid_date}),c}const n=new ParseStatus;let a;for(const i of this._def.checks)"min"===i.kind?t.data.getTime()<i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):"max"===i.kind?t.data.getTime()>i.value&&(a=this._getOrReturnCtx(t,a),addIssueToContext(a,{code:s.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):e.assertNever(i);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(e){return new ZodDate({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:d.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:d.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}ZodDate.create=e=>new ZodDate({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:R.ZodDate,...processCreateParams(e)});class ZodSymbol extends ZodType{_parse(e){if(this._getType(e)!==i.symbol){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.symbol,received:t.parsedType}),c}return OK(e.data)}}ZodSymbol.create=e=>new ZodSymbol({typeName:R.ZodSymbol,...processCreateParams(e)});class ZodUndefined extends ZodType{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.undefined,received:t.parsedType}),c}return OK(e.data)}}ZodUndefined.create=e=>new ZodUndefined({typeName:R.ZodUndefined,...processCreateParams(e)});class ZodNull extends ZodType{_parse(e){if(this._getType(e)!==i.null){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.null,received:t.parsedType}),c}return OK(e.data)}}ZodNull.create=e=>new ZodNull({typeName:R.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:R.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:R.ZodUnknown,...processCreateParams(e)});class ZodNever extends ZodType{_parse(e){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.never,received:t.parsedType}),c}}ZodNever.create=e=>new ZodNever({typeName:R.ZodNever,...processCreateParams(e)});class ZodVoid extends ZodType{_parse(e){if(this._getType(e)!==i.undefined){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.void,received:t.parsedType}),c}return OK(e.data)}}ZodVoid.create=e=>new ZodVoid({typeName:R.ZodVoid,...processCreateParams(e)});class ZodArray extends ZodType{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),a=this._def;if(t.parsedType!==i.array)return addIssueToContext(t,{code:s.invalid_type,expected:i.array,received:t.parsedType}),c;if(null!==a.exactLength){const e=t.data.length>a.exactLength.value,i=t.data.length<a.exactLength.value;(e||i)&&(addIssueToContext(t,{code:e?s.too_big:s.too_small,minimum:i?a.exactLength.value:void 0,maximum:e?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(null!==a.minLength&&t.data.length<a.minLength.value&&(addIssueToContext(t,{code:s.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),null!==a.maxLength&&t.data.length>a.maxLength.value&&(addIssueToContext(t,{code:s.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map(((e,n)=>a.type._parseAsync(new ParseInputLazyPath(t,e,t.path,n))))).then((e=>ParseStatus.mergeArray(n,e)));const d=[...t.data].map(((e,n)=>a.type._parseSync(new ParseInputLazyPath(t,e,t.path,n))));return ParseStatus.mergeArray(n,d)}get element(){return this._def.type}min(e,t){return new ZodArray({...this._def,minLength:{value:e,message:d.toString(t)}})}max(e,t){return new ZodArray({...this._def,maxLength:{value:e,message:d.toString(t)}})}length(e,t){return new ZodArray({...this._def,exactLength:{value:e,message:d.toString(t)}})}nonempty(e){return this.min(1,e)}}function deepPartialify(e){if(e instanceof ZodObject){const t={};for(const n in e.shape){const i=e.shape[n];t[n]=ZodOptional.create(deepPartialify(i))}return new ZodObject({...e._def,shape:()=>t})}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,t)=>new ZodArray({type:e,minLength:null,maxLength:null,exactLength:null,typeName:R.ZodArray,...processCreateParams(t)});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 t=this._def.shape(),n=e.objectKeys(t);return this._cached={shape:t,keys:n}}_parse(e){if(this._getType(e)!==i.object){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.object,received:t.parsedType}),c}const{status:t,ctx:n}=this._processInputParams(e),{shape:a,keys:d}=this._getCached(),u=[];if(!(this._def.catchall instanceof ZodNever&&"strip"===this._def.unknownKeys))for(const i in n.data)d.includes(i)||u.push(i);const l=[];for(const i of d){const e=a[i],t=n.data[i];l.push({key:{status:"valid",value:i},value:e._parse(new ParseInputLazyPath(n,t,n.path,i)),alwaysSet:i in n.data})}if(this._def.catchall instanceof ZodNever){const e=this._def.unknownKeys;if("passthrough"===e)for(const t of u)l.push({key:{status:"valid",value:t},value:{status:"valid",value:n.data[t]}});else if("strict"===e)u.length>0&&(addIssueToContext(n,{code:s.unrecognized_keys,keys:u}),t.dirty());else if("strip"!==e)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const e=this._def.catchall;for(const t of u){const i=n.data[t];l.push({key:{status:"valid",value:t},value:e._parse(new ParseInputLazyPath(n,i,n.path,t)),alwaysSet:t in n.data})}}return n.common.async?Promise.resolve().then((async()=>{const e=[];for(const t of l){const n=await t.key,i=await t.value;e.push({key:n,value:i,alwaysSet:t.alwaysSet})}return e})).then((e=>ParseStatus.mergeObjectSync(t,e))):ParseStatus.mergeObjectSync(t,l)}get shape(){return this._def.shape()}strict(e){return d.errToObj,new ZodObject({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,n)=>{var i,s,a,c;const u=null!==(a=null===(s=(i=this._def).errorMap)||void 0===s?void 0:s.call(i,t,n).message)&&void 0!==a?a:n.defaultError;return"unrecognized_keys"===t.code?{message:null!==(c=d.errToObj(e).message)&&void 0!==c?c:u}:{message:u}}}:{}})}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:R.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new ZodObject({...this._def,catchall:e})}pick(t){const n={};return e.objectKeys(t).forEach((e=>{t[e]&&this.shape[e]&&(n[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>n})}omit(t){const n={};return e.objectKeys(this.shape).forEach((e=>{t[e]||(n[e]=this.shape[e])})),new ZodObject({...this._def,shape:()=>n})}deepPartial(){return deepPartialify(this)}partial(t){const n={};return e.objectKeys(this.shape).forEach((e=>{const i=this.shape[e];t&&!t[e]?n[e]=i:n[e]=i.optional()})),new ZodObject({...this._def,shape:()=>n})}required(t){const n={};return e.objectKeys(this.shape).forEach((e=>{if(t&&!t[e])n[e]=this.shape[e];else{let t=this.shape[e];for(;t instanceof ZodOptional;)t=t._def.innerType;n[e]=t}})),new ZodObject({...this._def,shape:()=>n})}keyof(){return createZodEnum(e.objectKeys(this.shape))}}ZodObject.create=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)}),ZodObject.strictCreate=(e,t)=>new ZodObject({shape:()=>e,unknownKeys:"strict",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)}),ZodObject.lazycreate=(e,t)=>new ZodObject({shape:e,unknownKeys:"strip",catchall:ZodNever.create(),typeName:R.ZodObject,...processCreateParams(t)});class ZodUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;if(t.common.async)return Promise.all(n.map((async e=>{const n={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:n}),ctx:n}}))).then((function handleResults(e){for(const t of e)if("valid"===t.result.status)return t.result;for(const i of e)if("dirty"===i.result.status)return t.common.issues.push(...i.ctx.common.issues),i.result;const n=e.map((e=>new ZodError(e.ctx.common.issues)));return addIssueToContext(t,{code:s.invalid_union,unionErrors:n}),c}));{let e;const i=[];for(const s of n){const n={...t,common:{...t.common,issues:[]},parent:null},a=s._parseSync({data:t.data,path:t.path,parent:n});if("valid"===a.status)return a;"dirty"!==a.status||e||(e={result:a,ctx:n}),n.common.issues.length&&i.push(n.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;const a=i.map((e=>new ZodError(e)));return addIssueToContext(t,{code:s.invalid_union,unionErrors:a}),c}}get options(){return this._def.options}}ZodUnion.create=(e,t)=>new ZodUnion({options:e,typeName:R.ZodUnion,...processCreateParams(t)});const getDiscriminator=t=>t instanceof ZodLazy?getDiscriminator(t.schema):t instanceof ZodEffects?getDiscriminator(t.innerType()):t instanceof ZodLiteral?[t.value]:t instanceof ZodEnum?t.options:t instanceof ZodNativeEnum?e.objectValues(t.enum):t instanceof ZodDefault?getDiscriminator(t._def.innerType):t instanceof ZodUndefined?[void 0]:t instanceof ZodNull?[null]:t instanceof ZodOptional?[void 0,...getDiscriminator(t.unwrap())]:t instanceof ZodNullable?[null,...getDiscriminator(t.unwrap())]:t instanceof ZodBranded||t instanceof ZodReadonly?getDiscriminator(t.unwrap()):t instanceof ZodCatch?getDiscriminator(t._def.innerType):[];class ZodDiscriminatedUnion extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.object)return addIssueToContext(t,{code:s.invalid_type,expected:i.object,received:t.parsedType}),c;const n=this.discriminator,a=t.data[n],d=this.optionsMap.get(a);return d?t.common.async?d._parseAsync({data:t.data,path:t.path,parent:t}):d._parseSync({data:t.data,path:t.path,parent:t}):(addIssueToContext(t,{code:s.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),c)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){const i=new Map;for(const s of t){const t=getDiscriminator(s.shape[e]);if(!t.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const n of t){if(i.has(n))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);i.set(n,s)}}return new ZodDiscriminatedUnion({typeName:R.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...processCreateParams(n)})}}function mergeValues(t,n){const s=getParsedType(t),a=getParsedType(n);if(t===n)return{valid:!0,data:t};if(s===i.object&&a===i.object){const i=e.objectKeys(n),s=e.objectKeys(t).filter((e=>-1!==i.indexOf(e))),a={...t,...n};for(const e of s){const i=mergeValues(t[e],n[e]);if(!i.valid)return{valid:!1};a[e]=i.data}return{valid:!0,data:a}}if(s===i.array&&a===i.array){if(t.length!==n.length)return{valid:!1};const e=[];for(let i=0;i<t.length;i++){const s=mergeValues(t[i],n[i]);if(!s.valid)return{valid:!1};e.push(s.data)}return{valid:!0,data:e}}return s===i.date&&a===i.date&&+t==+n?{valid:!0,data:t}:{valid:!1}}class ZodIntersection extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),handleParsed=(e,i)=>{if(isAborted(e)||isAborted(i))return c;const a=mergeValues(e.value,i.value);return a.valid?((isDirty(e)||isDirty(i))&&t.dirty(),{status:t.value,value:a.data}):(addIssueToContext(n,{code:s.invalid_intersection_types}),c)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then((([e,t])=>handleParsed(e,t))):handleParsed(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}ZodIntersection.create=(e,t,n)=>new ZodIntersection({left:e,right:t,typeName:R.ZodIntersection,...processCreateParams(n)});class ZodTuple extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.array)return addIssueToContext(n,{code:s.invalid_type,expected:i.array,received:n.parsedType}),c;if(n.data.length<this._def.items.length)return addIssueToContext(n,{code:s.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),c;!this._def.rest&&n.data.length>this._def.items.length&&(addIssueToContext(n,{code:s.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...n.data].map(((e,t)=>{const i=this._def.items[t]||this._def.rest;return i?i._parse(new ParseInputLazyPath(n,e,n.path,t)):null})).filter((e=>!!e));return n.common.async?Promise.all(a).then((e=>ParseStatus.mergeArray(t,e))):ParseStatus.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ZodTuple({...this._def,rest:e})}}ZodTuple.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ZodTuple({items:e,typeName:R.ZodTuple,rest:null,...processCreateParams(t)})};class ZodRecord extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.object)return addIssueToContext(n,{code:s.invalid_type,expected:i.object,received:n.parsedType}),c;const a=[],d=this._def.keyType,u=this._def.valueType;for(const i in n.data)a.push({key:d._parse(new ParseInputLazyPath(n,i,n.path,i)),value:u._parse(new ParseInputLazyPath(n,n.data[i],n.path,i)),alwaysSet:i in n.data});return n.common.async?ParseStatus.mergeObjectAsync(t,a):ParseStatus.mergeObjectSync(t,a)}get element(){return this._def.valueType}static create(e,t,n){return new ZodRecord(t instanceof ZodType?{keyType:e,valueType:t,typeName:R.ZodRecord,...processCreateParams(n)}:{keyType:ZodString.create(),valueType:e,typeName:R.ZodRecord,...processCreateParams(t)})}}class ZodMap extends ZodType{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.map)return addIssueToContext(n,{code:s.invalid_type,expected:i.map,received:n.parsedType}),c;const a=this._def.keyType,d=this._def.valueType,u=[...n.data.entries()].map((([e,t],i)=>({key:a._parse(new ParseInputLazyPath(n,e,n.path,[i,"key"])),value:d._parse(new ParseInputLazyPath(n,t,n.path,[i,"value"]))})));if(n.common.async){const e=new Map;return Promise.resolve().then((async()=>{for(const n of u){const i=await n.key,s=await n.value;if("aborted"===i.status||"aborted"===s.status)return c;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}))}{const e=new Map;for(const n of u){const i=n.key,s=n.value;if("aborted"===i.status||"aborted"===s.status)return c;"dirty"!==i.status&&"dirty"!==s.status||t.dirty(),e.set(i.value,s.value)}return{status:t.value,value:e}}}}ZodMap.create=(e,t,n)=>new ZodMap({valueType:t,keyType:e,typeName:R.ZodMap,...processCreateParams(n)});class ZodSet extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==i.set)return addIssueToContext(n,{code:s.invalid_type,expected:i.set,received:n.parsedType}),c;const a=this._def;null!==a.minSize&&n.data.size<a.minSize.value&&(addIssueToContext(n,{code:s.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),t.dirty()),null!==a.maxSize&&n.data.size>a.maxSize.value&&(addIssueToContext(n,{code:s.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),t.dirty());const d=this._def.valueType;function finalizeSet(e){const n=new Set;for(const i of e){if("aborted"===i.status)return c;"dirty"===i.status&&t.dirty(),n.add(i.value)}return{status:t.value,value:n}}const u=[...n.data.values()].map(((e,t)=>d._parse(new ParseInputLazyPath(n,e,n.path,t))));return n.common.async?Promise.all(u).then((e=>finalizeSet(e))):finalizeSet(u)}min(e,t){return new ZodSet({...this._def,minSize:{value:e,message:d.toString(t)}})}max(e,t){return new ZodSet({...this._def,maxSize:{value:e,message:d.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ZodSet.create=(e,t)=>new ZodSet({valueType:e,minSize:null,maxSize:null,typeName:R.ZodSet,...processCreateParams(t)});class ZodFunction extends ZodType{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.function)return addIssueToContext(t,{code:s.invalid_type,expected:i.function,received:t.parsedType}),c;function makeArgsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:s.invalid_arguments,argumentsError:n}})}function makeReturnsIssue(e,n){return makeIssue({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,getErrorMap(),errorMap].filter((e=>!!e)),issueData:{code:s.invalid_return_type,returnTypeError:n}})}const n={errorMap:t.common.contextualErrorMap},a=t.data;if(this._def.returns instanceof ZodPromise){const e=this;return OK((async function(...t){const i=new ZodError([]),s=await e._def.args.parseAsync(t,n).catch((e=>{throw i.addIssue(makeArgsIssue(t,e)),i})),c=await Reflect.apply(a,this,s);return await e._def.returns._def.type.parseAsync(c,n).catch((e=>{throw i.addIssue(makeReturnsIssue(c,e)),i}))}))}{const e=this;return OK((function(...t){const i=e._def.args.safeParse(t,n);if(!i.success)throw new ZodError([makeArgsIssue(t,i.error)]);const s=Reflect.apply(a,this,i.data),c=e._def.returns.safeParse(s,n);if(!c.success)throw new ZodError([makeReturnsIssue(s,c.error)]);return c.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,t,n){return new ZodFunction({args:e||ZodTuple.create([]).rest(ZodUnknown.create()),returns:t||ZodUnknown.create(),typeName:R.ZodFunction,...processCreateParams(n)})}}class ZodLazy extends ZodType{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}ZodLazy.create=(e,t)=>new ZodLazy({getter:e,typeName:R.ZodLazy,...processCreateParams(t)});class ZodLiteral extends ZodType{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{received:t.data,code:s.invalid_literal,expected:this._def.value}),c}return{status:"valid",value:e.data}}get value(){return this._def.value}}function createZodEnum(e,t){return new ZodEnum({values:e,typeName:R.ZodEnum,...processCreateParams(t)})}ZodLiteral.create=(e,t)=>new ZodLiteral({value:e,typeName:R.ZodLiteral,...processCreateParams(t)});class ZodEnum extends ZodType{constructor(){super(...arguments),l.set(this,void 0)}_parse(t){if("string"!=typeof t.data){const n=this._getOrReturnCtx(t),i=this._def.values;return addIssueToContext(n,{expected:e.joinValues(i),received:n.parsedType,code:s.invalid_type}),c}if(__classPrivateFieldGet(this,l)||__classPrivateFieldSet(this,l,new Set(this._def.values)),!__classPrivateFieldGet(this,l).has(t.data)){const e=this._getOrReturnCtx(t),n=this._def.values;return addIssueToContext(e,{received:e.data,code:s.invalid_enum_value,options:n}),c}return OK(t.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return ZodEnum.create(e,{...this._def,...t})}exclude(e,t=this._def){return ZodEnum.create(this.options.filter((t=>!e.includes(t))),{...this._def,...t})}}l=new WeakMap,ZodEnum.create=createZodEnum;class ZodNativeEnum extends ZodType{constructor(){super(...arguments),p.set(this,void 0)}_parse(t){const n=e.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==i.string&&a.parsedType!==i.number){const t=e.objectValues(n);return addIssueToContext(a,{expected:e.joinValues(t),received:a.parsedType,code:s.invalid_type}),c}if(__classPrivateFieldGet(this,p)||__classPrivateFieldSet(this,p,new Set(e.getValidEnumValues(this._def.values))),!__classPrivateFieldGet(this,p).has(t.data)){const t=e.objectValues(n);return addIssueToContext(a,{received:a.data,code:s.invalid_enum_value,options:t}),c}return OK(t.data)}get enum(){return this._def.values}}p=new WeakMap,ZodNativeEnum.create=(e,t)=>new ZodNativeEnum({values:e,typeName:R.ZodNativeEnum,...processCreateParams(t)});class ZodPromise extends ZodType{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==i.promise&&!1===t.common.async)return addIssueToContext(t,{code:s.invalid_type,expected:i.promise,received:t.parsedType}),c;const n=t.parsedType===i.promise?t.data:Promise.resolve(t.data);return OK(n.then((e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap}))))}}ZodPromise.create=(e,t)=>new ZodPromise({type:e,typeName:R.ZodPromise,...processCreateParams(t)});class ZodEffects extends ZodType{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===R.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:i}=this._processInputParams(t),s=this._def.effect||null,a={addIssue:e=>{addIssueToContext(i,e),e.fatal?n.abort():n.dirty()},get path(){return i.path}};if(a.addIssue=a.addIssue.bind(a),"preprocess"===s.type){const e=s.transform(i.data,a);if(i.common.async)return Promise.resolve(e).then((async e=>{if("aborted"===n.value)return c;const t=await this._def.schema._parseAsync({data:e,path:i.path,parent:i});return"aborted"===t.status?c:"dirty"===t.status||"dirty"===n.value?DIRTY(t.value):t}));{if("aborted"===n.value)return c;const t=this._def.schema._parseSync({data:e,path:i.path,parent:i});return"aborted"===t.status?c:"dirty"===t.status||"dirty"===n.value?DIRTY(t.value):t}}if("refinement"===s.type){const executeRefinement=e=>{const t=s.refinement(e,a);if(i.common.async)return Promise.resolve(t);if(t instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return"aborted"===e.status?c:("dirty"===e.status&&n.dirty(),executeRefinement(e.value),{status:n.value,value:e.value})}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>"aborted"===e.status?c:("dirty"===e.status&&n.dirty(),executeRefinement(e.value).then((()=>({status:n.value,value:e.value}))))))}if("transform"===s.type){if(!1===i.common.async){const e=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!isValid(e))return e;const t=s.transform(e.value,a);if(t instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:t}}return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then((e=>isValid(e)?Promise.resolve(s.transform(e.value,a)).then((e=>({status:n.value,value:e}))):e))}e.assertNever(s)}}ZodEffects.create=(e,t,n)=>new ZodEffects({schema:e,typeName:R.ZodEffects,effect:t,...processCreateParams(n)}),ZodEffects.createWithPreprocess=(e,t,n)=>new ZodEffects({schema:t,effect:{type:"preprocess",transform:e},typeName:R.ZodEffects,...processCreateParams(n)});class ZodOptional extends ZodType{_parse(e){return this._getType(e)===i.undefined?OK(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodOptional.create=(e,t)=>new ZodOptional({innerType:e,typeName:R.ZodOptional,...processCreateParams(t)});class ZodNullable extends ZodType{_parse(e){return this._getType(e)===i.null?OK(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ZodNullable.create=(e,t)=>new ZodNullable({innerType:e,typeName:R.ZodNullable,...processCreateParams(t)});class ZodDefault extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===i.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}ZodDefault.create=(e,t)=>new ZodDefault({innerType:e,typeName:R.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...processCreateParams(t)});class ZodCatch extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return isAsync(i)?i.then((e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}))):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}ZodCatch.create=(e,t)=>new ZodCatch({innerType:e,typeName:R.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...processCreateParams(t)});class ZodNaN extends ZodType{_parse(e){if(this._getType(e)!==i.nan){const t=this._getOrReturnCtx(e);return addIssueToContext(t,{code:s.invalid_type,expected:i.nan,received:t.parsedType}),c}return{status:"valid",value:e.data}}}ZodNaN.create=e=>new ZodNaN({typeName:R.ZodNaN,...processCreateParams(e)});const O=Symbol("zod_brand");class ZodBranded extends ZodType{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class ZodPipeline extends ZodType{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async){return(async()=>{const e=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?c:"dirty"===e.status?(t.dirty(),DIRTY(e.value)):this._def.out._parseAsync({data:e.value,path:n.path,parent:n})})()}{const e=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return"aborted"===e.status?c:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:n.path,parent:n})}}static create(e,t){return new ZodPipeline({in:e,out:t,typeName:R.ZodPipeline})}}class ZodReadonly extends ZodType{_parse(e){const t=this._def.innerType._parse(e),freeze=e=>(isValid(e)&&(e.value=Object.freeze(e.value)),e);return isAsync(t)?t.then((e=>freeze(e))):freeze(t)}unwrap(){return this._def.innerType}}function custom(e,t={},n){return e?ZodAny.create().superRefine(((i,s)=>{var a,c;if(!e(i)){const e="function"==typeof t?t(i):"string"==typeof t?{message:t}:t,d=null===(c=null!==(a=e.fatal)&&void 0!==a?a:n)||void 0===c||c,u="string"==typeof e?{message:e}:e;s.addIssue({code:"custom",...u,fatal:d})}})):ZodAny.create()}ZodReadonly.create=(e,t)=>new ZodReadonly({innerType:e,typeName:R.ZodReadonly,...processCreateParams(t)});const T={object:ZodObject.lazycreate};var R,N;(N=R||(R={})).ZodString="ZodString",N.ZodNumber="ZodNumber",N.ZodNaN="ZodNaN",N.ZodBigInt="ZodBigInt",N.ZodBoolean="ZodBoolean",N.ZodDate="ZodDate",N.ZodSymbol="ZodSymbol",N.ZodUndefined="ZodUndefined",N.ZodNull="ZodNull",N.ZodAny="ZodAny",N.ZodUnknown="ZodUnknown",N.ZodNever="ZodNever",N.ZodVoid="ZodVoid",N.ZodArray="ZodArray",N.ZodObject="ZodObject",N.ZodUnion="ZodUnion",N.ZodDiscriminatedUnion="ZodDiscriminatedUnion",N.ZodIntersection="ZodIntersection",N.ZodTuple="ZodTuple",N.ZodRecord="ZodRecord",N.ZodMap="ZodMap",N.ZodSet="ZodSet",N.ZodFunction="ZodFunction",N.ZodLazy="ZodLazy",N.ZodLiteral="ZodLiteral",N.ZodEnum="ZodEnum",N.ZodEffects="ZodEffects",N.ZodNativeEnum="ZodNativeEnum",N.ZodOptional="ZodOptional",N.ZodNullable="ZodNullable",N.ZodDefault="ZodDefault",N.ZodCatch="ZodCatch",N.ZodPromise="ZodPromise",N.ZodBranded="ZodBranded",N.ZodPipeline="ZodPipeline",N.ZodReadonly="ZodReadonly";const Z=ZodString.create,P=ZodNumber.create,D=ZodNaN.create,A=ZodBigInt.create,L=ZodBoolean.create,j=ZodDate.create,U=ZodSymbol.create,q=ZodUndefined.create,$=ZodNull.create,B=ZodAny.create,z=ZodUnknown.create,W=ZodNever.create,K=ZodVoid.create,H=ZodArray.create,G=ZodObject.create,Y=ZodObject.strictCreate,J=ZodUnion.create,X=ZodDiscriminatedUnion.create,Q=ZodIntersection.create,ee=ZodTuple.create,te=ZodRecord.create,re=ZodMap.create,ne=ZodSet.create,ie=ZodFunction.create,oe=ZodLazy.create,se=ZodLiteral.create,ae=ZodEnum.create,ce=ZodNativeEnum.create,de=ZodPromise.create,ue=ZodEffects.create,le=ZodOptional.create,pe=ZodNullable.create,he=ZodEffects.createWithPreprocess,fe=ZodPipeline.create,me={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})},_e=c;var ge=Object.freeze({__proto__:null,defaultErrorMap:errorMap,setErrorMap:function setErrorMap(e){a=e},getErrorMap:getErrorMap,makeIssue:makeIssue,EMPTY_PATH:[],addIssueToContext:addIssueToContext,ParseStatus:ParseStatus,INVALID:c,DIRTY:DIRTY,OK:OK,isAborted:isAborted,isDirty:isDirty,isValid:isValid,isAsync:isAsync,get util(){return e},get objectUtil(){return n},ZodParsedType:i,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:O,ZodBranded:ZodBranded,ZodPipeline:ZodPipeline,ZodReadonly:ZodReadonly,custom:custom,Schema:ZodType,ZodSchema:ZodType,late:T,get ZodFirstPartyTypeKind(){return R},coerce:me,any:B,array:H,bigint:A,boolean:L,date:j,discriminatedUnion:X,effect:ue,enum:ae,function:ie,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>custom((t=>t instanceof e),t),intersection:Q,lazy:oe,literal:se,map:re,nan:D,nativeEnum:ce,never:W,null:$,nullable:pe,number:P,object:G,oboolean:()=>L().optional(),onumber:()=>P().optional(),optional:le,ostring:()=>Z().optional(),pipeline:fe,preprocess:he,promise:de,record:te,set:ne,strictObject:Y,string:Z,symbol:U,transformer:ue,tuple:ee,undefined:q,union:J,unknown:z,void:K,NEVER:_e,ZodIssueCode:s,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:ZodError});const ye=ge.object({firstName:ge.string().optional(),lastName:ge.string().optional(),email:ge.string().email().optional(),phone:ge.string().regex(/^\+?[1-9]\d{1,14}$/).optional()}),ve=["web","web-mobile","ios","android","app"],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))),userFingerPrintValidation=e=>null===e||"string"==typeof e,be=ge.object({Departure:ge.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),"Departure Delta":ge.number().int("Departure Delta must be an integer"),Destination:ge.string().min(1,"Destination is required"),"Destination Terminal":ge.string().min(1,"Destination terminal is required"),"User Fingerprint":ge.string().or(ge.null()).refine(userFingerPrintValidation,{message:"User fingerprint must be a string or null"}).optional(),Origin:ge.string().min(1,"Origin is required"),"Origin Terminal":ge.string().min(1,"Origin terminal is required"),Passengers:ge.number().int("Passenger count must be an integer"),Return:ge.string().refine(dateValidation,{message:"Invalid Return date or datetime format. Must include at least YYYY-MM-DD"}).optional(),Route:ge.string().min(1,"Route is required"),"Trip Length":ge.number().positive().optional(),product:ge.enum(ve).refine((e=>ve.includes(e)),{message:`Product must be one of: ${ve.join(", ")}`})});var __assign=function(){return __assign=Object.assign||function __assign2(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},__assign.apply(this,arguments)};function __awaiter$1(e,t,n,i){return new(n||(n=Promise))((function(s,a){function fulfilled(e){try{step(i.next(e))}catch(t){a(t)}}function rejected(e){try{step(i.throw(e))}catch(t){a(t)}}function step(e){e.done?s(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var Se={default:"endpoint"},ke={default:"tlsEndpoint"},we="Client timeout",Ie="Network connection error",xe="Network request aborted",Ee="Response cannot be parsed",Ce="Blocked by CSP",Oe="The endpoint parameter is not a valid URL";function E(e){for(var t="",n=0;n<e.length;++n)if(n>0){var i=e[n].toLowerCase();i!==e[n]?t+=" ".concat(i):t+=e[n]}else t+=e[n].toUpperCase();return t}var Te=E("WrongRegion"),Re=E("SubscriptionNotActive"),Me=E("UnsupportedVersion"),Ne=E("InstallationMethodRestricted"),Ze=E("HostnameRestricted"),Pe=E("IntegrationFailed"),De="API key required",Ae="API key not found",Le="API key expired",je="Request cannot be parsed",Fe="Request failed",Ue="Request failed to process",qe="Too many requests, rate limit exceeded",$e="Not available for this origin",Be="Not available with restricted header",ze=De,We=Ae,Ve=Le,Ke="Failed to load the JS script of the agent",He="9319";function M(e,t){var n,i,s,a,c,d=[],u=(c=function __spreadArray(e,t,n){if(n||2===arguments.length)for(var i,s=0,a=t.length;s<a;s++)!i&&s in t||(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))}([],e,!0),n={current:function(){return c[0]},postpone:function(){var e=c.shift();void 0!==e&&c.push(e)},exclude:function(){c.shift()}},a=0,i=function(){return Math.random()*Math.min(3e3,100*Math.pow(2,a++))},s=new Set,[n.current(),function(e,t){var a,c=t instanceof Error?t.message:"";if(c===Ce||c===Oe)n.exclude(),a=0;else if(c===He)n.exclude();else if(c===Ke){var d=Date.now()-e.getTime()<50,u=n.current();u&&d&&!s.has(u)&&(s.add(u),a=0),n.postpone()}else n.postpone();var l=n.current();return void 0===l?void 0:[l,null!=a?a:e.getTime()+i()-Date.now()]}]),l=u[0],p=u[1];if(void 0===l)return Promise.reject(new TypeError("The list of script URL patterns is empty"));var p2=function(e){var n=new Date,r3=function(t){return d.push({url:e,startedAt:n,finishedAt:new Date,error:t})},i=t(e);return i.then((function(){return r3()}),r3),i.catch((function(e){if(d.length>=5)throw e;var t=p(n,e);if(!t)throw e;var i,s=t[0],a=t[1];return(i=a,new Promise((function(e){return setTimeout(e,i)}))).then((function(){return p2(s)}))}))};return p2(l).then((function(e){return[e,d]}))}var Ge="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Ye=Ge;function F(e){var t;e.scriptUrlPattern;var n,i,s,a,c,d,u,l=e.token,p=e.apiKey,h=void 0===p?l:p,f=function __rest$1(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["scriptUrlPattern","token","apiKey"]),m=null!==(t=function r(e,t){return n=e,i=t,Object.prototype.hasOwnProperty.call(n,i)?e[t]:void 0;var n,i}(e,"scriptUrlPattern"))&&void 0!==t?t:Ge,_=(c=[],d=function(){c.push({time:new Date,state:document.visibilityState})},n=document,i="visibilitychange",s=d,n.addEventListener(i,s,a),u=function(){return n.removeEventListener(i,s,a)},d(),[c,u]),g=_[0],y=_[1];return Promise.resolve().then((function(){if(!h||"string"!=typeof h)throw new Error(De);var e=function(e,t){return(Array.isArray(e)?e:[e]).map((function(e){return function(e,t){var n=encodeURIComponent;return e.replace(/<[^<>]+>/g,(function(e){return"<version>"===e?"3":"<apiKey>"===e?n(t):"<loaderVersion>"===e?n("3.11.1"):e}))}(String(e),t)}))}(m,h);return M(e,V)})).catch((function(e){throw y(),function(e){return e instanceof Error&&e.message===He?new Error(Ke):e}(e)})).then((function(e){var t=e[0],n=e[1];return y(),t.load(__assign(__assign({},f),{ldi:{attempts:n,visibilityStates:g}}))}))}function V(e){return function o(e,t,n,i){var s,a=document,c="securitypolicyviolation",u2=function(t){var n=new URL(e,location.href),i=t.blockedURI;i!==n.href&&i!==n.protocol.slice(0,-1)&&i!==n.origin||(s=t,R2())};a.addEventListener(c,u2);var R2=function(){return a.removeEventListener(c,u2)};return Promise.resolve().then(t).then((function(e){return R2(),e}),(function(e){return new Promise((function(e){var t=new MessageChannel;t.port1.onmessage=function(){return e()},t.port2.postMessage(null)})).then((function(){if(R2(),s)return n(s);throw e}))}))}(e,(function(){return t=e,new Promise((function(e,n){if(function(e){if(URL.prototype)try{return new URL(e,location.href),!1}catch(t){if(t instanceof Error&&"TypeError"===t.name)return!0;throw t}}(t))throw new Error(Oe);var i=document.createElement("script"),o2=function(){var e;return null===(e=i.parentNode)||void 0===e?void 0:e.removeChild(i)},s=document.head||document.getElementsByTagName("head")[0];i.onload=function(){o2(),e()},i.onerror=function(){o2(),n(new Error(Ke))},i.async=!0,i.src=t,s.appendChild(i)}));var t}),(function(){throw new Error(Ce)})).then(k)}function k(){var e,t,n,i,s=window,a="__fpjs_p_l_b",c=s[a];if(e=s,t=a,(null==(i=null===(n=Object.getOwnPropertyDescriptor)||void 0===n?void 0:n.call(Object,e,t))?void 0:i.configurable)?delete e[t]:i&&!i.writable||(e[t]=void 0),"function"!=typeof(null==c?void 0:c.load))throw new Error(He);return c}var Je={load:F,defaultScriptUrlPattern:Ye,ERROR_SCRIPT_LOAD_FAIL:Ke,ERROR_API_KEY_EXPIRED:Le,ERROR_API_KEY_INVALID:Ae,ERROR_API_KEY_MISSING:De,ERROR_BAD_REQUEST_FORMAT:je,ERROR_BAD_RESPONSE_FORMAT:Ee,ERROR_CLIENT_TIMEOUT:we,ERROR_CSP_BLOCK:Ce,ERROR_FORBIDDEN_ENDPOINT:Ze,ERROR_FORBIDDEN_HEADER:Be,ERROR_FORBIDDEN_ORIGIN:$e,ERROR_GENERAL_SERVER_FAILURE:Fe,ERROR_INSTALLATION_METHOD_RESTRICTED:Ne,ERROR_INTEGRATION_FAILURE:Pe,ERROR_INVALID_ENDPOINT:Oe,ERROR_NETWORK_ABORT:xe,ERROR_NETWORK_CONNECTION:Ie,ERROR_RATE_LIMIT:qe,ERROR_SERVER_TIMEOUT:Ue,ERROR_SUBSCRIPTION_NOT_ACTIVE:Re,ERROR_TOKEN_EXPIRED:Ve,ERROR_TOKEN_INVALID:We,ERROR_TOKEN_MISSING:ze,ERROR_UNSUPPORTED_VERSION:Me,ERROR_WRONG_REGION:Te,defaultEndpoint:Se,defaultTlsEndpoint:ke};const Xe=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:Le,ERROR_API_KEY_INVALID:Ae,ERROR_API_KEY_MISSING:De,ERROR_BAD_REQUEST_FORMAT:je,ERROR_BAD_RESPONSE_FORMAT:Ee,ERROR_CLIENT_TIMEOUT:we,ERROR_CSP_BLOCK:Ce,ERROR_FORBIDDEN_ENDPOINT:Ze,ERROR_FORBIDDEN_HEADER:Be,ERROR_FORBIDDEN_ORIGIN:$e,ERROR_GENERAL_SERVER_FAILURE:Fe,ERROR_INSTALLATION_METHOD_RESTRICTED:Ne,ERROR_INTEGRATION_FAILURE:Pe,ERROR_INVALID_ENDPOINT:Oe,ERROR_NETWORK_ABORT:xe,ERROR_NETWORK_CONNECTION:Ie,ERROR_RATE_LIMIT:qe,ERROR_SCRIPT_LOAD_FAIL:Ke,ERROR_SERVER_TIMEOUT:Ue,ERROR_SUBSCRIPTION_NOT_ACTIVE:Re,ERROR_TOKEN_EXPIRED:Ve,ERROR_TOKEN_INVALID:We,ERROR_TOKEN_MISSING:ze,ERROR_UNSUPPORTED_VERSION:Me,ERROR_WRONG_REGION:Te,default:Je,defaultEndpoint:Se,defaultScriptUrlPattern:Ye,defaultTlsEndpoint:ke,load:F},Symbol.toStringTag,{value:"Module"})),Qe="@fpjs@client@",DEFAULT_NOW_PROVIDER=()=>Date.now();class CacheKey{constructor(e){var t;this.tag=e.tag||null,this.linkedId=e.linkedId||null,this.extendedResult=null!==(t=e.extendedResult)&&void 0!==t&&t}toKey(){return`${JSON.stringify(this.tag)}__${JSON.stringify(this.linkedId)}__${this.extendedResult}`}}function getKeyWithPrefix(e,t){return`${t}__${e}`}function removePrefixFromKey(e,t){return e.replace(`${t}__`,"")}class LocalStorageCache{constructor(e=Qe){this.prefix=e}set(e,t){window.localStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(t))}get(e){const t=window.localStorage.getItem(getKeyWithPrefix(e,this.prefix));if(t)try{return JSON.parse(t)}catch(n){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=Qe){this.prefix=e}set(e,t){window.sessionStorage.setItem(getKeyWithPrefix(e,this.prefix),JSON.stringify(t))}get(e){const t=window.sessionStorage.getItem(getKeyWithPrefix(e,this.prefix));if(t)try{return JSON.parse(t)}catch(n){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,t=3600,n){this.cache=e,this.cacheTime=t,this.nowProvider=n||DEFAULT_NOW_PROVIDER}get(e){return __awaiter$1(this,void 0,void 0,(function*(){const t=yield this.cache.get(e.toKey());if(!t)return;const n=yield this.nowProvider(),i=Math.floor(n/1e3);if(!(t.expiresAt<i))return t.body;yield this.cache.remove(e.toKey())}))}set(e,t){return __awaiter$1(this,void 0,void 0,(function*(){const n=yield this.wrapCacheEntry(t);yield this.cache.set(e.toKey(),n)}))}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 t=yield this.nowProvider(),n=Math.floor(t/1e3)+this.cacheTime;return{body:e,expiresAt:n}}))}}class InMemoryCache{constructor(){this.enclosedCache=function(){const e={};return{set(t,n){e[t]=n},get(t){const n=e[t];if(n)return n},remove(t){delete e[t]},allKeys:()=>Object.keys(e)}}()}}class CacheStub{set(){}get(){}remove(){}allKeys(){return[]}}var et,tt;(tt=et||(et={})).Memory="memory",tt.LocalStorage="localstorage",tt.SessionStorage="sessionstorage",tt.NoCache="nocache";const rt={[et.Memory]:()=>(new InMemoryCache).enclosedCache,[et.LocalStorage]:e=>new LocalStorageCache(e),[et.SessionStorage]:e=>new SessionStorageCache(e),[et.NoCache]:()=>new CacheStub},cacheFactory=e=>rt[e];class FpjsClient{constructor(e){var t;let n;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)n=e.cache;else{if(this.cacheLocation=(null==e?void 0:e.cacheLocation)||et.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(e=>{switch(e){case et.SessionStorage:try{window.sessionStorage.getItem("item")}catch(t){return!1}return!0;case et.LocalStorage:try{window.localStorage.getItem("item")}catch(t){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=et.Memory),n=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 i=null!==(t=null==e?void 0:e.cacheTimeInSeconds)&&void 0!==t?t:3600;this.cacheManager=new CacheManager(n,i)}init(e){return __awaiter$1(this,void 0,void 0,(function*(){var t,n;if(!this.loadOptions&&!e)throw new TypeError("No load options provided");const i=Object.assign(Object.assign(Object.assign({},this.loadOptions),e),{integrationInfo:[...(null===(t=this.loadOptions)||void 0===t?void 0:t.integrationInfo)||[],...(null==e?void 0:e.integrationInfo)||[],"fingerprintjs-pro-spa/1.3.2"]});if(!this.agentPromise){const e=null!==(n=this.customAgent)&&void 0!==n?n:Xe;this.agentPromise=e.load(i).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={},t=!1){const n=FpjsClient.makeCacheKey(e).toKey();if(!this.inFlightRequests.has(n)){const i=this._identify(e,t).finally((()=>{this.inFlightRequests.delete(n)}));this.inFlightRequests.set(n,i)}return yield this.inFlightRequests.get(n)}))}getVisitorDataFromCache(){return __awaiter$1(this,arguments,void 0,(function*(e={}){const t=FpjsClient.makeCacheKey(e),n=yield this.cacheManager.get(t);return n?Object.assign(Object.assign({},n),{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,t=!1){const n=FpjsClient.makeCacheKey(e);if(!t){const e=yield this.cacheManager.get(n);if(e)return Object.assign(Object.assign({},e),{cacheHit:!0})}const i=yield this.agent.get(e);return yield this.cacheManager.set(n,i),Object.assign(Object.assign({},i),{cacheHit:!1})}))}}const nt="default_fingerprint_cache",it=7,getExpirationDate=e=>new Date((new Date).getTime()+24*e*60*60*1e3).getTime();function isFingerprintReady(){return void 0!==window.fpClient}const ot={initFingerprint:async function initFingerprint(e){window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:e}});try{await window.fpClient.init()}catch(Xt){throw console.error("Error initializing identification service:",Xt),Xt}},getFingerprint:async function getFingerprint(e=!1){if(!window.fingerprintConfig)throw new Error("Fingerprint configuration is not initialized.");const t=(()=>{const{cacheName:e=nt}=window.fingerprintConfig;try{const t=JSON.parse(localStorage.getItem(e)||"null");return t&&t.expiresAt>Date.now()?t.fingerprint:(localStorage.removeItem(e),null)}catch{return null}})();if(t)return t;if(e)return"";if(!isFingerprintReady())throw new Error("Identification service is not initialized.");try{const e=window.fpClient,{visitorId:t}=await e.getVisitorData();return(e=>{const{cacheName:t=nt,cacheTimeInDays:n=it}=window.fingerprintConfig,i={fingerprint:e,expiresAt:getExpirationDate(n)};localStorage.setItem(t,JSON.stringify(i))})(t),t}catch(Xt){throw console.error("Error retrieving fingerprint:",Xt),Xt}},isFingerprintReady:isFingerprintReady};var st,at;function isShadowRoot(e){const t=null==e?void 0:e.host;return Boolean((null==t?void 0:t.shadowRoot)===e)}function isNativeShadowDom(e){return"[object ShadowRoot]"===Object.prototype.toString.call(e)}function stringifyStylesheet(e){try{const t=e.rules||e.cssRules;return t?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(t,stringifyRule).join("")):null}catch(Xt){return null}}function stringifyRule(e){let t;if(function isCSSImportRule(e){return"styleSheet"in e}(e))try{t=stringifyStylesheet(e.styleSheet)||function escapeImportStatement(e){const{cssText:t}=e;if(t.split('"').length<3)return t;const n=["@import",`url(${JSON.stringify(e.href)})`];return""===e.layerName?n.push("layer"):e.layerName&&n.push(`layer(${e.layerName})`),e.supportsText&&n.push(`supports(${e.supportsText})`),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}(e)}catch(Xt){}else if(function isCSSStyleRule(e){return"selectorText"in e}(e)&&e.selectorText.includes(":"))return function fixSafariColons(e){const t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}(e.cssText);return t||e.cssText}(at=st||(st={}))[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 t;if(!e)return-1;const n=null===(t=this.getMeta(e))||void 0===t?void 0:t.id;return null!=n?n:-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 t=this.getId(e);this.idNodeMap.delete(t),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,t){const n=t.id;this.idNodeMap.set(n,e),this.nodeMetaMap.set(e,t)}replace(e,t){const n=this.getNode(e);if(n){const e=this.nodeMetaMap.get(n);e&&this.nodeMetaMap.set(t,e)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}}function maskInputValue({element:e,maskInputOptions:t,tagName:n,type:i,value:s,maskInputFn:a}){let c=s||"";const d=i&&toLowerCase(i);return(t[n.toLowerCase()]||d&&t[d])&&(c=a?a(c,e):"*".repeat(c.length)),c}function toLowerCase(e){return e.toLowerCase()}const ct="__rrweb_original__";function getInputType(e){const t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?toLowerCase(t):null}function extractFileExtension(e,t){var n;let i;try{i=new URL(e,null!=t?t:window.location.href)}catch(a){return null}const s=i.pathname.match(/\.([0-9a-z]+)(?:$)/i);return null!==(n=null==s?void 0:s[1])&&void 0!==n?n:null}let dt=1;const ut=new RegExp("[^a-z0-9-_:]"),lt=-2;function genId(){return dt++}let pt,ht;const ft=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,mt=/^(?:[a-z+]+:)?\/\//i,_t=/^www\..*/i,gt=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,t){return(e||"").replace(ft,((e,n,i,s,a,c)=>{const d=i||a||c,u=n||s||"";if(!d)return e;if(mt.test(d)||_t.test(d))return`url(${u}${d}${u})`;if(gt.test(d))return`url(${u}${d}${u})`;if("/"===d[0])return`url(${u}${function extractOrigin(e){let t="";return t=e.indexOf("//")>-1?e.split("/").slice(0,3).join("/"):e.split("/")[0],t=t.split("?")[0],t}(t)+d}${u})`;const l=t.split("/"),p=d.split("/");l.pop();for(const t of p)"."!==t&&(".."===t?l.pop():l.push(t));return`url(${u}${l.join("/")}${u})`}))}const yt=/^[^ \t\n\r\u000c]+/,vt=/^[, \t\n\r\u000c]+/;function absoluteToDoc(e,t){if(!t||""===t.trim())return t;const n=e.createElement("a");return n.href=t,n.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,t,n,i){return i?"src"===n||"href"===n&&("use"!==t||"#"!==i[0])||"xlink:href"===n&&"#"!==i[0]?absoluteToDoc(e,i):"background"!==n||"table"!==t&&"td"!==t&&"th"!==t?"srcset"===n?function getAbsoluteSrcsetString(e,t){if(""===t.trim())return t;let n=0;function collectCharacters(e){let i;const s=e.exec(t.substring(n));return s?(i=s[0],n+=i.length,i):""}const i=[];for(;collectCharacters(vt),!(n>=t.length);){let s=collectCharacters(yt);if(","===s.slice(-1))s=absoluteToDoc(e,s.substring(0,s.length-1)),i.push(s);else{let a="";s=absoluteToDoc(e,s);let c=!1;for(;;){const e=t.charAt(n);if(""===e){i.push((s+a).trim());break}if(c)")"===e&&(c=!1);else{if(","===e){n+=1,i.push((s+a).trim());break}"("===e&&(c=!0)}a+=e,n+=1}}}return i.join(", ")}(e,i):"style"===n?absoluteToStylesheet(i,getHref()):"object"===t&&"data"===n?absoluteToDoc(e,i):i:absoluteToDoc(e,i):i}function ignoreAttribute(e,t,n){return("video"===e||"audio"===e)&&"autoplay"===t}function classMatchesRegex(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return!!n&&classMatchesRegex(e.parentNode,t,n);for(let i=e.classList.length;i--;){const n=e.classList[i];if(t.test(n))return!0}return!!n&&classMatchesRegex(e.parentNode,t,n)}function needMaskingText(e,t,n,i){try{const s=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(null===s)return!1;if("string"==typeof t){if(i){if(s.closest(`.${t}`))return!0}else if(s.classList.contains(t))return!0}else if(classMatchesRegex(s,t,i))return!0;if(n)if(i){if(s.closest(n))return!0}else if(s.matches(n))return!0}catch(s){}return!1}function serializeNode(e,t){const{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:c,inlineStylesheet:d,maskInputOptions:u={},maskTextFn:l,maskInputFn:p,dataURLOptions:h={},inlineImages:f,recordCanvas:m,keepIframeSrcFn:_,newlyAddedElement:g=!1}=t,y=function getRootId(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(n,i);switch(e.nodeType){case e.DOCUMENT_NODE:return"CSS1Compat"!==e.compatMode?{type:st.Document,childNodes:[],compatMode:e.compatMode}:{type:st.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:st.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return function serializeElementNode(e,t){const{doc:n,blockClass:i,blockSelector:s,inlineStylesheet:a,maskInputOptions:c={},maskInputFn:d,dataURLOptions:u={},inlineImages:l,recordCanvas:p,keepIframeSrcFn:h,newlyAddedElement:f=!1,rootId:m}=t,_=function _isBlockedElement(e,t,n){try{if("string"==typeof t){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){const i=e.classList[n];if(t.test(i))return!0}if(n)return e.matches(n)}catch(i){}return!1}(e,i,s),g=function getValidTagName(e){if(e instanceof HTMLFormElement)return"form";const t=toLowerCase(e.tagName);return ut.test(t)?"div":t}(e);let y={};const v=e.attributes.length;for(let w=0;w<v;w++){const t=e.attributes[w];ignoreAttribute(g,t.name,t.value)||(y[t.name]=transformAttribute(n,g,toLowerCase(t.name),t.value))}if("link"===g&&a){const t=Array.from(n.styleSheets).find((t=>t.href===e.href));let i=null;t&&(i=stringifyStylesheet(t)),i&&(delete y.rel,delete y.href,y._cssText=absoluteToStylesheet(i,t.href))}if("style"===g&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){const t=stringifyStylesheet(e.sheet);t&&(y._cssText=absoluteToStylesheet(t,getHref()))}if("input"===g||"textarea"===g||"select"===g){const t=e.value,n=e.checked;"radio"!==y.type&&"checkbox"!==y.type&&"submit"!==y.type&&"button"!==y.type&&t?y.value=maskInputValue({element:e,type:getInputType(e),tagName:g,value:t,maskInputOptions:c,maskInputFn:d}):n&&(y.checked=n)}"option"===g&&(e.selected&&!c.select?y.selected=!0:delete y.selected);if("canvas"===g&&p)if("2d"===e.__context)(function is2DCanvasBlank(e){const t=e.getContext("2d");if(!t)return!0;for(let n=0;n<e.width;n+=50)for(let i=0;i<e.height;i+=50){const s=t.getImageData,a=ct in s?s[ct]:s;if(new Uint32Array(a.call(t,n,i,Math.min(50,e.width-n),Math.min(50,e.height-i)).data.buffer).some((e=>0!==e)))return!1}return!0})(e)||(y.rr_dataURL=e.toDataURL(u.type,u.quality));else if(!("__context"in e)){const t=e.toDataURL(u.type,u.quality),n=document.createElement("canvas");n.width=e.width,n.height=e.height;t!==n.toDataURL(u.type,u.quality)&&(y.rr_dataURL=t)}if("img"===g&&l){pt||(pt=n.createElement("canvas"),ht=pt.getContext("2d"));const t=e,i=t.crossOrigin;t.crossOrigin="anonymous";const recordInlineImage=()=>{t.removeEventListener("load",recordInlineImage);try{pt.width=t.naturalWidth,pt.height=t.naturalHeight,ht.drawImage(t,0,0),y.rr_dataURL=pt.toDataURL(u.type,u.quality)}catch(e){console.warn(`Cannot inline img src=${t.currentSrc}! Error: ${e}`)}i?y.crossOrigin=i:t.removeAttribute("crossorigin")};t.complete&&0!==t.naturalWidth?recordInlineImage():t.addEventListener("load",recordInlineImage)}if("audio"===g||"video"===g){const t=y;t.rr_mediaState=e.paused?"paused":"played",t.rr_mediaCurrentTime=e.currentTime,t.rr_mediaPlaybackRate=e.playbackRate,t.rr_mediaMuted=e.muted,t.rr_mediaLoop=e.loop,t.rr_mediaVolume=e.volume}f||(e.scrollLeft&&(y.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(y.rr_scrollTop=e.scrollTop));if(_){const{width:t,height:n}=e.getBoundingClientRect();y={class:y.class,rr_width:`${t}px`,rr_height:`${n}px`}}"iframe"!==g||h(y.src)||(e.contentDocument||(y.rr_src=y.src),delete y.src);let b;try{customElements.get(g)&&(b=!0)}catch(S){}return{type:st.Element,tagName:g,attributes:y,childNodes:[],isSVG:isSVGElement(e)||void 0,needBlock:_,rootId:m,isCustom:b}}(e,{doc:n,blockClass:s,blockSelector:a,inlineStylesheet:d,maskInputOptions:u,maskInputFn:p,dataURLOptions:h,inlineImages:f,recordCanvas:m,keepIframeSrcFn:_,newlyAddedElement:g,rootId:y});case e.TEXT_NODE:return function serializeTextNode(e,t){var n;const{needsMask:i,maskTextFn:s,rootId:a}=t,c=e.parentNode&&e.parentNode.tagName;let d=e.textContent;const u="STYLE"===c||void 0,l="SCRIPT"===c||void 0;if(u&&d){try{e.nextSibling||e.previousSibling||(null===(n=e.parentNode.sheet)||void 0===n?void 0:n.cssRules)&&(d=stringifyStylesheet(e.parentNode.sheet))}catch(p){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${p}`,e)}d=absoluteToStylesheet(d,getHref())}l&&(d="SCRIPT_PLACEHOLDER");!u&&!l&&d&&i&&(d=s?s(d,e.parentElement):d.replace(/[\S]/g,"*"));return{type:st.Text,textContent:d||"",isStyle:u,rootId:a}}(e,{needsMask:c,maskTextFn:l,rootId:y});case e.CDATA_SECTION_NODE:return{type:st.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:st.Comment,textContent:e.textContent||"",rootId:y};default:return!1}}function lowerIfExists(e){return null==e?"":e.toLowerCase()}function serializeNodeWithId(e,t){const{doc:n,mirror:i,blockClass:s,blockSelector:a,maskTextClass:c,maskTextSelector:d,skipChild:u=!1,inlineStylesheet:l=!0,maskInputOptions:p={},maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:_={},inlineImages:g=!1,recordCanvas:y=!1,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S=5e3,onStylesheetLoad:w,stylesheetLoadTimeout:I=5e3,keepIframeSrcFn:x=()=>!1,newlyAddedElement:C=!1}=t;let{needsMask:O}=t,{preserveWhiteSpace:T=!0}=t;if(!O&&e.childNodes){O=needMaskingText(e,c,d,void 0===O)}const R=serializeNode(e,{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:O,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,dataURLOptions:_,inlineImages:g,recordCanvas:y,keepIframeSrcFn:x,newlyAddedElement:C});if(!R)return console.warn(e,"not serialized"),null;let N;N=i.hasNode(e)?i.getId(e):!function slimDOMExcluded(e,t){if(t.comment&&e.type===st.Comment)return!0;if(e.type===st.Element){if(t.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(t.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(t.headMetaDescKeywords&&lowerIfExists(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(lowerIfExists(e.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(e.attributes.name).match(/^(og|twitter):/)||"pinterest"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaRobots&&("robots"===lowerIfExists(e.attributes.name)||"googlebot"===lowerIfExists(e.attributes.name)||"bingbot"===lowerIfExists(e.attributes.name)))return!0;if(t.headMetaHttpEquiv&&void 0!==e.attributes["http-equiv"])return!0;if(t.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(t.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}(R,m)&&(T||R.type!==st.Text||R.isStyle||R.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():lt;const Z=Object.assign(R,{id:N});if(i.add(e,Z),N===lt)return null;v&&v(e);let P=!u;if(Z.type===st.Element){P=P&&!Z.needBlock,delete Z.needBlock;const t=e.shadowRoot;t&&isNativeShadowDom(t)&&(Z.isShadowHost=!0)}if((Z.type===st.Document||Z.type===st.Element)&&P){m.headWhitespace&&Z.type===st.Element&&"head"===Z.tagName&&(T=!1);const t={doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:O,maskTextClass:c,maskTextSelector:d,skipChild:u,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:_,inlineImages:g,recordCanvas:y,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:I,keepIframeSrcFn:x};if(Z.type===st.Element&&"textarea"===Z.tagName&&void 0!==Z.attributes.value);else for(const n of Array.from(e.childNodes)){const e=serializeNodeWithId(n,t);e&&Z.childNodes.push(e)}if(function isElement(e){return e.nodeType===e.ELEMENT_NODE}(e)&&e.shadowRoot)for(const n of Array.from(e.shadowRoot.childNodes)){const i=serializeNodeWithId(n,t);i&&(isNativeShadowDom(e.shadowRoot)&&(i.isShadow=!0),Z.childNodes.push(i))}}return e.parentNode&&isShadowRoot(e.parentNode)&&isNativeShadowDom(e.parentNode)&&(Z.isShadow=!0),Z.type===st.Element&&"iframe"===Z.tagName&&function onceIframeLoaded(e,t,n){const i=e.contentWindow;if(!i)return;let s,a=!1;try{s=i.document.readyState}catch(Xt){return}if("complete"!==s){const i=setTimeout((()=>{a||(t(),a=!0)}),n);return void e.addEventListener("load",(()=>{clearTimeout(i),a=!0,t()}))}const c="about:blank";if(i.location.href!==c||e.src===c||""===e.src)return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}(e,(()=>{const t=e.contentDocument;if(t&&b){const n=serializeNodeWithId(t,{doc:t,mirror:i,blockClass:s,blockSelector:a,needsMask:O,maskTextClass:c,maskTextSelector:d,skipChild:!1,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:_,inlineImages:g,recordCanvas:y,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:I,keepIframeSrcFn:x});n&&b(e,n)}}),S),Z.type===st.Element&&"link"===Z.tagName&&"string"==typeof Z.attributes.rel&&("stylesheet"===Z.attributes.rel||"preload"===Z.attributes.rel&&"string"==typeof Z.attributes.href&&"css"===extractFileExtension(Z.attributes.href))&&function onceStylesheetLoaded(e,t,n){let i,s=!1;try{i=e.sheet}catch(Xt){return}if(i)return;const a=setTimeout((()=>{s||(t(),s=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(a),s=!0,t()}))}(e,(()=>{if(w){const t=serializeNodeWithId(e,{doc:n,mirror:i,blockClass:s,blockSelector:a,needsMask:O,maskTextClass:c,maskTextSelector:d,skipChild:!1,inlineStylesheet:l,maskInputOptions:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:m,dataURLOptions:_,inlineImages:g,recordCanvas:y,preserveWhiteSpace:T,onSerialize:v,onIframeLoad:b,iframeLoadTimeout:S,onStylesheetLoad:w,stylesheetLoadTimeout:I,keepIframeSrcFn:x});t&&w(e,t)}}),I),Z}function on(e,t,n=document){const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}const bt="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 St={map:{},getId:()=>(console.error(bt),-1),getNode:()=>(console.error(bt),null),removeNodeFromMap(){console.error(bt)},has:()=>(console.error(bt),!1),reset(){console.error(bt)}};function throttle(e,t,n={}){let i=null,s=0;return function(...a){const c=Date.now();s||!1!==n.leading||(s=c);const d=t-(c-s),u=this;d<=0||d>t?(i&&(clearTimeout(i),i=null),s=c,e.apply(u,a)):i||!1===n.trailing||(i=setTimeout((()=>{s=!1===n.leading?0:Date.now(),i=null,e.apply(u,a)}),d))}}function hookSetter(e,t,n,i,s=window){const a=s.Object.getOwnPropertyDescriptor(e,t);return s.Object.defineProperty(e,t,i?n:{set(e){setTimeout((()=>{n.set.call(this,e)}),0),a&&a.set&&a.set.call(this,e)}}),()=>hookSetter(e,t,a||{},!0)}function patch(e,t,n){try{if(!(t in e))return()=>{};const i=e[t],s=n(i);return"function"==typeof s&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:i}})),e[t]=s,()=>{e[t]=i}}catch(i){return()=>{}}}"undefined"!=typeof window&&window.Proxy&&window.Reflect&&(St=new Proxy(St,{get:(e,t,n)=>("map"===t&&console.error(bt),Reflect.get(e,t,n))}));let kt=Date.now;function getWindowScroll(e){var t,n,i,s,a,c;const d=e.document;return{left:d.scrollingElement?d.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==d?void 0:d.documentElement.scrollLeft)||(null===(n=null===(t=null==d?void 0:d.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null==d?void 0:d.body)||void 0===i?void 0:i.scrollLeft)||0,top:d.scrollingElement?d.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==d?void 0:d.documentElement.scrollTop)||(null===(a=null===(s=null==d?void 0:d.body)||void 0===s?void 0:s.parentElement)||void 0===a?void 0:a.scrollTop)||(null===(c=null==d?void 0:d.body)||void 0===c?void 0:c.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,t,n,i){if(!e)return!1;const s=closestElementOfNode(e);if(!s)return!1;try{if("string"==typeof t){if(s.classList.contains(t))return!0;if(i&&null!==s.closest("."+t))return!0}else if(classMatchesRegex(s,t,i))return!0}catch(a){}if(n){if(s.matches(n))return!0;if(i&&null!==s.closest(n))return!0}return!1}function isIgnored(e,t){return t.getId(e)===lt}function isAncestorRemoved(e,t){if(isShadowRoot(e))return!1;const n=t.getId(e);return!t.has(n)||(!e.parentNode||e.parentNode.nodeType!==e.DOCUMENT_NODE)&&(!e.parentNode||isAncestorRemoved(e.parentNode,t))}function legacy_isTouchEvent(e){return Boolean(e.changedTouches)}function isSerializedIframe(e,t){return Boolean("IFRAME"===e.nodeName&&t.getMeta(e))}function isSerializedStylesheet(e,t){return Boolean("LINK"===e.nodeName&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&"stylesheet"===e.getAttribute("rel")&&t.getMeta(e))}function hasShadowRoot(e){return Boolean(null==e?void 0:e.shadowRoot)}/[1-9][0-9]{12}/.test(Date.now().toString())||(kt=()=>(new Date).getTime());class StyleSheetMirror{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(e){var t;return null!==(t=this.styleIDMap.get(e))&&void 0!==t?t:-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let n;return n=void 0===t?this.id++:t,this.styleIDMap.set(e,n),this.idStyleMap.set(n,e),n}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 t,n;let i=null;return(null===(n=null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||void 0===n?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(i=e.getRootNode().host),i}function shadowHostInDom(e){const t=e.ownerDocument;if(!t)return!1;const n=function getRootShadowHost(e){let t,n=e;for(;t=getShadowHost(n);)n=t;return n}(e);return t.contains(n)}function inDom(e){const t=e.ownerDocument;return!!t&&(t.contains(e)||shadowHostInDom(e))}var wt=(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))(wt||{}),It=(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))(It||{}),xt=(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))(xt||{}),Et=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(Et||{}),Ct=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Ct||{});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 t=this.head;for(let n=0;n<e;n++)t=(null==t?void 0:t.next)||null;return t}addNode(e){const t={value:e,previous:null,next:null};if(e.__ln=t,e.previousSibling&&isNodeInLinkedList(e.previousSibling)){const n=e.previousSibling.__ln.next;t.next=n,t.previous=e.previousSibling.__ln,e.previousSibling.__ln.next=t,n&&(n.previous=t)}else if(e.nextSibling&&isNodeInLinkedList(e.nextSibling)&&e.nextSibling.__ln.previous){const n=e.nextSibling.__ln.previous;t.previous=n,t.next=e.nextSibling.__ln,e.nextSibling.__ln.previous=t,n&&(n.next=t)}else this.head&&(this.head.previous=t),t.next=this.head,this.head=t;null===t.next&&(this.tail=t),this.length++}removeNode(e){const t=e.__ln;this.head&&(t.previous?(t.previous.next=t.next,t.next?t.next.previous=t.previous:this.tail=t.previous):(this.head=t.next,this.head?this.head.previous=null:this.tail=null),e.__ln&&delete e.__ln,this.length--)}}const moveKey=(e,t)=>`${e}@${t}`;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=[],t=new Set,n=new DoubleLinkedList,getNextId=e=>{let t=e,n=lt;for(;n===lt;)t=t&&t.nextSibling,n=t&&this.mirror.getId(t);return n},pushAdd=i=>{if(!i.parentNode||!inDom(i)||"TEXTAREA"===i.parentNode.tagName)return;const s=isShadowRoot(i.parentNode)?this.mirror.getId(getShadowHost(i)):this.mirror.getId(i.parentNode),a=getNextId(i);if(-1===s||-1===a)return n.addNode(i);const c=serializeNodeWithId(i,{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(i)&&this.shadowDomManager.addShadowRoot(i.shadowRoot,this.doc)},onIframeLoad:(e,t)=>{this.iframeManager.attachIframe(e,t),this.shadowDomManager.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{this.stylesheetManager.attachLinkElement(e,t)}});c&&(e.push({parentId:s,nextId:a,node:c}),t.add(c.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 i=null;for(;n.length;){let e=null;if(i){const t=this.mirror.getId(i.value.parentNode),n=getNextId(i.value);-1!==t&&-1!==n&&(e=i)}if(!e){let t=n.tail;for(;t;){const n=t;if(t=t.previous,n){const t=this.mirror.getId(n.value.parentNode);if(-1===getNextId(n.value))continue;if(-1!==t){e=n;break}{const t=n.value;if(t.parentNode&&t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const i=t.parentNode.host;if(-1!==this.mirror.getId(i)){e=n;break}}}}}}if(!e){for(;n.head;)n.removeNode(n.head.value);break}i=e.previous,n.removeNode(e.value),pushAdd(e.value)}const s={texts:this.texts.map((e=>{const t=e.node;return t.parentNode&&"TEXTAREA"===t.parentNode.tagName&&this.genTextAreaValueMutation(t.parentNode),{id:this.mirror.getId(t),value:e.value}})).filter((e=>!t.has(e.id))).filter((e=>this.mirror.has(e.id))),attributes:this.attributes.map((e=>{const{attributes:t}=e;if("string"==typeof t.style){const n=JSON.stringify(e.styleDiff),i=JSON.stringify(e._unchangedStyles);n.length<t.style.length&&(n+i).split("var(").length===t.style.split("var(").length&&(t.style=e.styleDiff)}return{id:this.mirror.getId(e.node),attributes:t}})).filter((e=>!t.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 t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t)),t.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 t=e.target.textContent;isBlocked(e.target,this.blockClass,this.blockSelector,!1)||t===e.oldValue||this.texts.push({value:needMaskingText(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,closestElementOfNode(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{const n=e.target;let i=e.attributeName,s=e.target.getAttribute(i);if("value"===i){const e=getInputType(n);s=maskInputValue({element:n,maskInputOptions:this.maskInputOptions,tagName:n.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"===n.tagName&&"src"===i&&!this.keepIframeSrcFn(s)){if(n.contentDocument)return;i="rr_src"}if(a||(a={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(a),this.attributeMap.set(e.target,a)),"type"===i&&"INPUT"===n.tagName&&"password"===(e.oldValue||"").toLowerCase()&&n.setAttribute("data-rr-is-password","true"),!ignoreAttribute(n.tagName,i)&&(a.attributes[i]=transformAttribute(this.doc,toLowerCase(n.tagName),toLowerCase(i),s),"style"===i)){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch(t){this.unattachedDoc=this.doc}const i=this.unattachedDoc.createElement("span");e.oldValue&&i.setAttribute("style",e.oldValue);for(const e of Array.from(n.style)){const t=n.style.getPropertyValue(e),s=n.style.getPropertyPriority(e);t!==i.style.getPropertyValue(e)||s!==i.style.getPropertyPriority(e)?a.styleDiff[e]=""===s?t:[t,s]:a._unchangedStyles[e]=[t,s]}for(const e of Array.from(i.style))""===n.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((t=>this.genAdds(t,e.target))),e.removedNodes.forEach((t=>{const n=this.mirror.getId(t),i=isShadowRoot(e.target)?this.mirror.getId(e.target.host):this.mirror.getId(e.target);isBlocked(e.target,this.blockClass,this.blockSelector,!1)||isIgnored(t,this.mirror)||!function isSerialized(e,t){return-1!==t.getId(e)}(t,this.mirror)||(this.addedSet.has(t)?(deepDelete(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&-1===n||isAncestorRemoved(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[moveKey(n,i)]?deepDelete(this.movedSet,t):this.removes.push({parentId:i,id:n,isShadow:!(!isShadowRoot(e.target)||!isNativeShadowDom(e.target))||void 0})),this.mapRemoves.push(t))}))}},this.genAdds=(e,t)=>{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 n=null;t&&this.mirror.hasNode(t)&&(n=this.mirror.getId(t)),n&&-1!==n&&(this.movedMap[moveKey(this.mirror.getId(e),n)]=!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((t=>{this.processedNodeManager.add(t,this),this.genAdds(t,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((t=>{this[t]=e[t]}))}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,t){e.delete(t),t.childNodes.forEach((t=>deepDelete(e,t)))}function isParentRemoved(e,t,n){return 0!==e.length&&_isParentRemoved(e,t,n)}function _isParentRemoved(e,t,n){const{parentNode:i}=t;if(!i)return!1;const s=n.getId(i);return!!e.some((e=>e.id===s))||_isParentRemoved(e,i,n)}function isAncestorInSet(e,t){return 0!==e.size&&_isAncestorInSet(e,t)}function _isAncestorInSet(e,t){const{parentNode:n}=t;return!!n&&(!!e.has(n)||_isAncestorInSet(e,n))}let Ot;const callbackWrapper=e=>{if(!Ot)return e;return(...t)=>{try{return e(...t)}catch(Xt){if(Ot&&!0===Ot(Xt))return;throw Xt}}},Tt=[];function getEventTarget(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch(t){}return e&&e.target}function initMutationObserver(e,t){var n,i;const s=new MutationBuffer;Tt.push(s),s.init(e);let a=window.MutationObserver||window.__rrMutationObserver;const c=null===(i=null===(n=null===window||void 0===window?void 0:window.Zone)||void 0===n?void 0:n.__symbol__)||void 0===i?void 0:i.call(n,"MutationObserver");c&&window[c]&&(a=window[c]);const d=new a(callbackWrapper(s.processMutations.bind(s)));return d.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),d}function initMouseInteractionObserver({mouseInteractionCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){if(!1===a.mouseInteraction)return()=>{};const c=!0===a.mouseInteraction||void 0===a.mouseInteraction?{}:a.mouseInteraction,d=[];let u=null;return Object.keys(xt).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==c[e])).forEach((a=>{let c=toLowerCase(a);const l=(t=>a=>{const c=getEventTarget(a);if(isBlocked(c,i,s,!0))return;let d=null,l=t;if("pointerType"in a){switch(a.pointerType){case"mouse":d=Et.Mouse;break;case"touch":d=Et.Touch;break;case"pen":d=Et.Pen}d===Et.Touch?xt[t]===xt.MouseDown?l="TouchStart":xt[t]===xt.MouseUp&&(l="TouchEnd"):Et.Pen}else legacy_isTouchEvent(a)&&(d=Et.Touch);null!==d?(u=d,(l.startsWith("Touch")&&d===Et.Touch||l.startsWith("Mouse")&&d===Et.Mouse)&&(d=null)):xt[t]===xt.Click&&(d=u,u=null);const p=legacy_isTouchEvent(a)?a.changedTouches[0]:a;if(!p)return;const h=n.getId(c),{clientX:f,clientY:m}=p;callbackWrapper(e)(Object.assign({type:xt[l],id:h,x:f,y:m},null!==d&&{pointerType:d}))})(a);if(window.PointerEvent)switch(xt[a]){case xt.MouseDown:case xt.MouseUp:c=c.replace("mouse","pointer");break;case xt.TouchStart:case xt.TouchEnd:return}d.push(on(c,l,t))})),callbackWrapper((()=>{d.forEach((e=>e()))}))}function initScrollObserver({scrollCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,sampling:a}){return on("scroll",callbackWrapper(throttle(callbackWrapper((a=>{const c=getEventTarget(a);if(!c||isBlocked(c,i,s,!0))return;const d=n.getId(c);if(c===t&&t.defaultView){const n=getWindowScroll(t.defaultView);e({id:d,x:n.left,y:n.top})}else e({id:d,x:c.scrollLeft,y:c.scrollTop})})),a.scroll||100)),t)}const Rt=["INPUT","TEXTAREA","SELECT"],Mt=new WeakMap;function getNestedCSSRulePositions(e){return function recurse(e,t){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 n=Array.from(e.parentRule.cssRules).indexOf(e);t.unshift(n)}else if(e.parentStyleSheet){const n=Array.from(e.parentStyleSheet.cssRules).indexOf(e);t.unshift(n)}return t}(e,[])}function getIdAndStyleId(e,t,n){let i,s;return e?(e.ownerNode?i=t.getId(e.ownerNode):s=n.getId(e),{styleId:s,id:i}):{}}function initAdoptedStyleSheetObserver({mirror:e,stylesheetManager:t},n){var i,s,a;let c=null;c="#document"===n.nodeName?e.getId(n):e.getId(n.host);const d="#document"===n.nodeName?null===(i=n.defaultView)||void 0===i?void 0:i.Document:null===(a=null===(s=n.ownerDocument)||void 0===s?void 0:s.defaultView)||void 0===a?void 0:a.ShadowRoot,u=(null==d?void 0:d.prototype)?Object.getOwnPropertyDescriptor(null==d?void 0:d.prototype,"adoptedStyleSheets"):void 0;return null!==c&&-1!==c&&d&&u?(Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get(){var e;return null===(e=u.get)||void 0===e?void 0:e.call(this)},set(e){var n;const i=null===(n=u.set)||void 0===n?void 0:n.call(this,e);if(null!==c&&-1!==c)try{t.adoptStyleSheets(e,c)}catch(s){}return i}}),callbackWrapper((()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:u.configurable,enumerable:u.enumerable,get:u.get,set:u.set})}))):()=>{}}function initObservers(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};let i;!function mergeHooks(e,t){const{mutationCb:n,mousemoveCb:i,mouseInteractionCb:s,scrollCb:a,viewportResizeCb:c,inputCb:d,mediaInteractionCb:u,styleSheetRuleCb:l,styleDeclarationCb:p,canvasMutationCb:h,fontCb:f,selectionCb:m,customElementCb:_}=e;e.mutationCb=(...e)=>{t.mutation&&t.mutation(...e),n(...e)},e.mousemoveCb=(...e)=>{t.mousemove&&t.mousemove(...e),i(...e)},e.mouseInteractionCb=(...e)=>{t.mouseInteraction&&t.mouseInteraction(...e),s(...e)},e.scrollCb=(...e)=>{t.scroll&&t.scroll(...e),a(...e)},e.viewportResizeCb=(...e)=>{t.viewportResize&&t.viewportResize(...e),c(...e)},e.inputCb=(...e)=>{t.input&&t.input(...e),d(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),u(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),l(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),p(...e)},e.canvasMutationCb=(...e)=>{t.canvasMutation&&t.canvasMutation(...e),h(...e)},e.fontCb=(...e)=>{t.font&&t.font(...e),f(...e)},e.selectionCb=(...e)=>{t.selection&&t.selection(...e),m(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),_(...e)}}(e,t),e.recordDOM&&(i=initMutationObserver(e,e.doc));const s=function initMoveObserver({mousemoveCb:e,sampling:t,doc:n,mirror:i}){if(!1===t.mousemove)return()=>{};const s="number"==typeof t.mousemove?t.mousemove:50,a="number"==typeof t.mousemoveCallback?t.mousemoveCallback:500;let c,d=[];const u=throttle(callbackWrapper((t=>{const n=Date.now()-c;e(d.map((e=>(e.timeOffset-=n,e))),t),d=[],c=null})),a),l=callbackWrapper(throttle(callbackWrapper((e=>{const t=getEventTarget(e),{clientX:n,clientY:s}=legacy_isTouchEvent(e)?e.changedTouches[0]:e;c||(c=kt()),d.push({x:n,y:s,id:i.getId(t),timeOffset:kt()-c}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?It.Drag:e instanceof MouseEvent?It.MouseMove:It.TouchMove)})),s,{trailing:!1})),p=[on("mousemove",l,n),on("touchmove",l,n),on("drag",l,n)];return callbackWrapper((()=>{p.forEach((e=>e()))}))}(e),a=initMouseInteractionObserver(e),c=initScrollObserver(e),d=function initViewportResizeObserver({viewportResizeCb:e},{win:t}){let n=-1,i=-1;return on("resize",callbackWrapper(throttle(callbackWrapper((()=>{const t=getWindowHeight(),s=getWindowWidth();n===t&&i===s||(e({width:Number(s),height:Number(t)}),n=t,i=s)})),200)),t)}(e,{win:n}),u=function initInputObserver({inputCb:e,doc:t,mirror:n,blockClass:i,blockSelector:s,ignoreClass:a,ignoreSelector:c,maskInputOptions:d,maskInputFn:u,sampling:l,userTriggeredOnInput:p}){function eventHandler(e){let n=getEventTarget(e);const l=e.isTrusted,h=n&&n.tagName;if(n&&"OPTION"===h&&(n=n.parentElement),!n||!h||Rt.indexOf(h)<0||isBlocked(n,i,s,!0))return;if(n.classList.contains(a)||c&&n.matches(c))return;let f=n.value,m=!1;const _=getInputType(n)||"";"radio"===_||"checkbox"===_?m=n.checked:(d[h.toLowerCase()]||d[_])&&(f=maskInputValue({element:n,maskInputOptions:d,tagName:h,type:_,value:f,maskInputFn:u})),cbWithDedup(n,p?{text:f,isChecked:m,userTriggered:l}:{text:f,isChecked:m});const g=n.name;"radio"===_&&g&&m&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach((e=>{if(e!==n){const t=e.value;cbWithDedup(e,p?{text:t,isChecked:!m,userTriggered:!1}:{text:t,isChecked:!m})}}))}function cbWithDedup(t,i){const s=Mt.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){Mt.set(t,i);const s=n.getId(t);callbackWrapper(e)(Object.assign(Object.assign({},i),{id:s}))}}const h=("last"===l.input?["change"]:["input","change"]).map((e=>on(e,callbackWrapper(eventHandler),t))),f=t.defaultView;if(!f)return()=>{h.forEach((e=>e()))};const m=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),_=[[f.HTMLInputElement.prototype,"value"],[f.HTMLInputElement.prototype,"checked"],[f.HTMLSelectElement.prototype,"value"],[f.HTMLTextAreaElement.prototype,"value"],[f.HTMLSelectElement.prototype,"selectedIndex"],[f.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&h.push(..._.map((e=>hookSetter(e[0],e[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,f)))),callbackWrapper((()=>{h.forEach((e=>e()))}))}(e),l=function initMediaInteractionObserver({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:i,sampling:s,doc:a}){const c=callbackWrapper((a=>throttle(callbackWrapper((s=>{const c=getEventTarget(s);if(!c||isBlocked(c,t,n,!0))return;const{currentTime:d,volume:u,muted:l,playbackRate:p,loop:h}=c;e({type:a,id:i.getId(c),currentTime:d,volume:u,muted:l,playbackRate:p,loop:h})})),s.media||500))),d=[on("play",c(0),a),on("pause",c(1),a),on("seeked",c(2),a),on("volumechange",c(3),a),on("ratechange",c(4),a)];return callbackWrapper((()=>{d.forEach((e=>e()))}))}(e);let styleSheetObserver=()=>{},adoptedStyleSheetObserver=()=>{},styleDeclarationObserver=()=>{},fontObserver=()=>{};e.recordDOM&&(styleSheetObserver=function initStyleSheetObserver({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:i}){if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return()=>{};const s=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(s,{apply:callbackWrapper(((i,s,a)=>{const[c,d]=a,{id:u,styleId:l}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&e({id:u,styleId:l,adds:[{rule:c,index:d}]}),i.apply(s,a)}))});const a=i.CSSStyleSheet.prototype.deleteRule;let c,d;i.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,removes:[{index:c}]}),i.apply(s,a)}))}),i.CSSStyleSheet.prototype.replace&&(c=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,replace:c}),i.apply(s,a)}))})),i.CSSStyleSheet.prototype.replaceSync&&(d=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(d,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,replaceSync:c}),i.apply(s,a)}))}));const u={};canMonkeyPatchNestedCSSRule("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(canMonkeyPatchNestedCSSRule("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),canMonkeyPatchNestedCSSRule("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),canMonkeyPatchNestedCSSRule("CSSSupportsRule")&&(u.CSSSupportsRule=i.CSSSupportsRule));const l={};return Object.entries(u).forEach((([i,s])=>{l[i]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(l[i].insertRule,{apply:callbackWrapper(((i,s,a)=>{const[c,d]=a,{id:u,styleId:l}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||l&&-1!==l)&&e({id:u,styleId:l,adds:[{rule:c,index:[...getNestedCSSRulePositions(s),d||0]}]}),i.apply(s,a)}))}),s.prototype.deleteRule=new Proxy(l[i].deleteRule,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:d,styleId:u}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(d&&-1!==d||u&&-1!==u)&&e({id:d,styleId:u,removes:[{index:[...getNestedCSSRulePositions(s),c]}]}),i.apply(s,a)}))})})),callbackWrapper((()=>{i.CSSStyleSheet.prototype.insertRule=s,i.CSSStyleSheet.prototype.deleteRule=a,c&&(i.CSSStyleSheet.prototype.replace=c),d&&(i.CSSStyleSheet.prototype.replaceSync=d),Object.entries(u).forEach((([e,t])=>{t.prototype.insertRule=l[e].insertRule,t.prototype.deleteRule=l[e].deleteRule}))}))}(e,{win:n}),adoptedStyleSheetObserver=initAdoptedStyleSheetObserver(e,e.doc),styleDeclarationObserver=function initStyleDeclarationObserver({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:i},{win:s}){const a=s.CSSStyleDeclaration.prototype.setProperty;s.CSSStyleDeclaration.prototype.setProperty=new Proxy(a,{apply:callbackWrapper(((s,c,d)=>{var u;const[l,p,h]=d;if(n.has(l))return a.apply(c,[l,p,h]);const{id:f,styleId:m}=getIdAndStyleId(null===(u=c.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(f&&-1!==f||m&&-1!==m)&&e({id:f,styleId:m,set:{property:l,value:p,priority:h},index:getNestedCSSRulePositions(c.parentRule)}),s.apply(c,d)}))});const c=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:callbackWrapper(((s,a,d)=>{var u;const[l]=d;if(n.has(l))return c.apply(a,[l]);const{id:p,styleId:h}=getIdAndStyleId(null===(u=a.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(p&&-1!==p||h&&-1!==h)&&e({id:p,styleId:h,remove:{property:l},index:getNestedCSSRulePositions(a.parentRule)}),s.apply(a,d)}))}),callbackWrapper((()=>{s.CSSStyleDeclaration.prototype.setProperty=a,s.CSSStyleDeclaration.prototype.removeProperty=c}))}(e,{win:n}),e.collectFonts&&(fontObserver=function initFontObserver({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const i=[],s=new WeakMap,a=n.FontFace;n.FontFace=function FontFace(e,t,n){const i=new a(e,t,n);return s.set(i,{family:e,buffer:"string"!=typeof t,descriptors:n,fontSource:"string"==typeof t?t:JSON.stringify(Array.from(new Uint8Array(t)))}),i};const c=patch(t.fonts,"add",(function(t){return function(n){return setTimeout(callbackWrapper((()=>{const t=s.get(n);t&&(e(t),s.delete(n))})),0),t.apply(this,[n])}}));return i.push((()=>{n.FontFace=a})),i.push(c),callbackWrapper((()=>{i.forEach((e=>e()))}))}(e)));const p=function initSelectionObserver(e){const{doc:t,mirror:n,blockClass:i,blockSelector:s,selectionCb:a}=e;let c=!0;const d=callbackWrapper((()=>{const e=t.getSelection();if(!e||c&&(null==e?void 0:e.isCollapsed))return;c=e.isCollapsed||!1;const d=[],u=e.rangeCount||0;for(let t=0;t<u;t++){const a=e.getRangeAt(t),{startContainer:c,startOffset:u,endContainer:l,endOffset:p}=a;isBlocked(c,i,s,!0)||isBlocked(l,i,s,!0)||d.push({start:n.getId(c),startOffset:u,end:n.getId(l),endOffset:p})}a({ranges:d})}));return d(),on("selectionchange",d)}(e),h=function initCustomElementObserver({doc:e,customElementCb:t}){const n=e.defaultView;return n&&n.customElements?patch(n.customElements,"define",(function(e){return function(n,i,s){try{t({define:{name:n}})}catch(a){console.warn(`Custom element callback failed for ${n}`)}return e.apply(this,[n,i,s])}})):()=>{}}(e),f=[];for(const m of e.plugins)f.push(m.observer(m.callback,n,m.options));return callbackWrapper((()=>{Tt.forEach((e=>e.reset())),null==i||i.disconnect(),s(),a(),c(),d(),u(),l(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),p(),h(),f.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,t,n,i){const s=n||this.getIdToRemoteIdMap(e),a=i||this.getRemoteIdToIdMap(e);let c=s.get(t);return c||(c=this.generateIdFn(),s.set(t,c),a.set(c,t)),c}getIds(e,t){const n=this.getIdToRemoteIdMap(e),i=this.getRemoteIdToIdMap(e);return t.map((t=>this.getId(e,t,n,i)))}getRemoteId(e,t,n){const i=n||this.getRemoteIdToIdMap(e);if("number"!=typeof t)return t;const s=i.get(t);return s||-1}getRemoteIds(e,t){const n=this.getRemoteIdToIdMap(e);return t.map((t=>this.getRemoteId(e,t,n)))}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 t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}}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,t){var n;this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),null===(n=this.loadListener)||void 0===n||n.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 t=e;if("rrweb"!==t.data.type||t.origin!==t.data.origin)return;if(!e.source)return;const n=this.crossOriginIframeMap.get(e.source);if(!n)return;const i=this.transformCrossOriginEvent(n,t.data.event);i&&this.wrappedEmit(i,t.data.isCheckout)}transformCrossOriginEvent(e,t){var n;switch(t.type){case wt.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);const n=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,n),this.patchRootIdOnNode(t.data.node,n),{timestamp:t.timestamp,type:wt.IncrementalSnapshot,data:{source:It.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case wt.Meta:case wt.Load:case wt.DomContentLoaded:return!1;case wt.Plugin:return t;case wt.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case wt.IncrementalSnapshot:switch(t.data.source){case It.Mutation:return t.data.adds.forEach((t=>{this.replaceIds(t,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(t.node,e);const n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(t.node,n)})),t.data.removes.forEach((t=>{this.replaceIds(t,e,["parentId","id"])})),t.data.attributes.forEach((t=>{this.replaceIds(t,e,["id"])})),t.data.texts.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case It.Drag:case It.TouchMove:case It.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case It.ViewportResize:return!1;case It.MediaInteraction:case It.MouseInteraction:case It.Scroll:case It.CanvasMutation:case It.Input:return this.replaceIds(t.data,e,["id"]),t;case It.StyleSheetRule:case It.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case It.Font:return t;case It.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case It.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),null===(n=t.data.styles)||void 0===n||n.forEach((t=>{this.replaceStyleIds(t,e,["styleId"])})),t}}return!1}replace(e,t,n,i){for(const s of i)(Array.isArray(t[s])||"number"==typeof t[s])&&(Array.isArray(t[s])?t[s]=e.getIds(n,t[s]):t[s]=e.getId(n,t[s]));return t}replaceIds(e,t,n){return this.replace(this.crossOriginIframeMirror,e,t,n)}replaceStyleIds(e,t,n){return this.replace(this.crossOriginIframeStyleMirror,e,t,n)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach((e=>{this.replaceIdOnNode(e,t)}))}patchRootIdOnNode(e,t){e.type===st.Document||e.rootId||(e.rootId=t),"childNodes"in e&&e.childNodes.forEach((e=>{this.patchRootIdOnNode(e,t)}))}}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,t){if(!isNativeShadowDom(e))return;if(this.shadowDoms.has(e))return;this.shadowDoms.add(e);const n=initMutationObserver(Object.assign(Object.assign({},this.bypassOptions),{doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),e);this.restoreHandlers.push((()=>n.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,t){const n=this;this.restoreHandlers.push(patch(e.prototype,"attachShadow",(function(e){return function(i){const s=e.call(this,i);return this.shadowRoot&&inDom(this)&&n.addShadowRoot(this.shadowRoot,t),s}})))}reset(){this.restoreHandlers.forEach((e=>{try{e()}catch(t){}})),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}
|
|
2
2
|
/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -27,4 +27,4 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
27
27
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
28
|
PERFORMANCE OF THIS SOFTWARE.
|
|
29
29
|
***************************************************************************** */
|
|
30
|
-
function __awaiter2(e,t,n,i){return new(n||(n=Promise))((function(t,s){function fulfilled(e){try{step(i.next(e))}catch(t){s(t)}}function rejected(e){try{step(i.throw(e))}catch(t){s(t)}}function step(e){e.done?t(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),n=0;n<64;n++)t[e.charCodeAt(n)]=n;var encode2=function(t){var n,i=new Uint8Array(t),s=i.length,a="";for(n=0;n<s;n+=3)a+=e[i[n]>>2],a+=e[(3&i[n])<<4|i[n+1]>>4],a+=e[(15&i[n+1])<<2|i[n+2]>>6],a+=e[63&i[n+2]];return s%3==2?a=a.substring(0,a.length-1)+"=":s%3==1&&(a=a.substring(0,a.length-2)+"=="),a};const i=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:t,bitmap:n,width:c,height:d,dataURLOptions:u}=e.data,l=function getTransparentBlobFor(e,t,n){return __awaiter2(this,0,void 0,(function*(){const i=`${e}-${t}`;if("OffscreenCanvas"in globalThis){if(s.has(i))return s.get(i);const a=new OffscreenCanvas(e,t);a.getContext("2d");const c=yield a.convertToBlob(n),d=yield c.arrayBuffer(),u=encode2(d);return s.set(i,u),u}return""}))}(c,d,u),p=new OffscreenCanvas(c,d);p.getContext("2d").drawImage(n,0,0),n.close();const h=yield p.convertToBlob(u),f=h.type,m=yield h.arrayBuffer(),_=encode2(m);if(!i.has(t)&&(yield l)===_)return i.set(t,_),a.postMessage({id:t});if(i.get(t)===_)return a.postMessage({id:t});a.postMessage({id:t,type:f,base64:_,width:c,height:d}),i.set(t,_)}}))}}()}));class CanvasManager{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(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(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:s,recordCanvas:a,dataURLOptions:c}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===t&&this.initCanvasMutationObserver(n,i,s),a&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,s,{dataURLOptions:c})}initCanvasFPSObserver(e,t,n,i,s){const a=initCanvasContextObserver(t,n,i,!0),c=new Map,d=new At;d.onmessage=e=>{const{id:t}=e.data;if(c.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:s,height:a}=e.data;this.mutationCb({id:t,type:Ct["2D"],commands:[{property:"clearRect",args:[0,0,s,a]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const u=1e3/e;let l,p=0;const takeCanvasSnapshots=e=>{p&&e-p<u||(p=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{isBlocked(t,n,i,!0)||e.push(t)})),e})().forEach((e=>__awaiter(this,0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(c.get(n))return;if(0===e.width||0===e.height)return;if(c.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const i=yield createImageBitmap(e);d.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[i])}))))),l=requestAnimationFrame(takeCanvasSnapshots)};l=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{a(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=initCanvasContextObserver(e,t,n,!1),s=function initCanvas2DMutationObserver(e,t,n,i){const s=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const d of a)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[d])continue;const a=patch(t.CanvasRenderingContext2D.prototype,d,(function(s){return function(...a){return isBlocked(this.canvas,n,i,!0)||setTimeout((()=>{const n=serializeArgs(a,t,this);e(this.canvas,{type:Ct["2D"],property:d,args:n})}),0),s.apply(this,a)}}));s.push(a)}catch(c){const n=hookSetter(t.CanvasRenderingContext2D.prototype,d,{set(t){e(this.canvas,{type:Ct["2D"],property:d,args:[t],setter:!0})}});s.push(n)}return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),a=function initCanvasWebGLMutationObserver(e,t,n,i,s){const a=[];return a.push(...patchGLPrototype(t.WebGLRenderingContext.prototype,Ct.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&a.push(...patchGLPrototype(t.WebGL2RenderingContext.prototype,Ct.WebGL2,e,n,i,0,t)),()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{i(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=e=>{this.rafStamps.latestId=e,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const i=n.map((e=>{const t=function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["type"]);return t})),{type:s}=n[0];this.mutationCb({id:t,type:s,commands:i}),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,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},i=[];for(const s of e){let e;this.styleMirror.has(s)?e=this.styleMirror.getId(s):(e=this.styleMirror.add(s),i.push({styleId:e,rules:Array.from(s.rules||CSSRule,((e,t)=>({rule:stringifyRule(e),index:t})))})),n.styleIds.push(e)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}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,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(e){return Object.assign(Object.assign({},e),{timestamp:kt()})}let Lt,jt,Ft,Ut=!1;const qt=function createMirror(){return new Mirror}();function record(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:c="rr-ignore",ignoreSelector:d=null,maskTextClass:u="rr-mask",maskTextSelector:l=null,inlineStylesheet:p=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:m,maskInputFn:_,maskTextFn:g,hooks:y,packFn:v,sampling:b={},dataURLOptions:S={},mousemoveWait:w,recordDOM:I=!0,recordCanvas:x=!1,recordCrossOriginIframes:C=!1,recordAfter:O=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:T=!1,collectFonts:R=!1,inlineImages:N=!1,plugins:Z,keepIframeSrcFn:P=()=>!1,ignoreCSSAttributes:D=new Set([]),errorHandler:A}=e;!function registerErrorHandler(e){Ot=e}(A);const L=!C||window.parent===window;let j=!1;if(!L)try{window.parent.document&&(j=!1)}catch(G){j=!0}if(L&&!t)throw new Error("emit function is required");void 0!==w&&void 0===b.mousemove&&(b.mousemove=w),qt.reset();const U=!0===h?{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!==f?f:{password:!0},q=!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===m,headMetaDescKeywords:"all"===m}:m||{};let $;!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 t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let B=0;const eventProcessor=e=>{for(const t of Z||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!j&&(e=v(e)),e};Lt=(e,s)=>{var a;if(!(null===(a=Tt[0])||void 0===a?void 0:a.isFrozen())||e.type===wt.FullSnapshot||e.type===wt.IncrementalSnapshot&&e.data.source===It.Mutation||Tt.forEach((e=>e.unfreeze())),L)null==t||t(eventProcessor(e),s);else if(j){const t={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:s};window.parent.postMessage(t,"*")}if(e.type===wt.FullSnapshot)$=e,B=0;else if(e.type===wt.IncrementalSnapshot){if(e.data.source===It.Mutation&&e.data.isAttachIframe)return;B++;const t=i&&B>=i,s=n&&e.timestamp-$.timestamp>n;(t||s)&&jt(!0)}};const wrappedMutationEmit=e=>{Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.Mutation},e)}))},wrappedScrollEmit=e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.Scroll},e)})),wrappedCanvasMutationEmit=e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.CanvasMutation},e)})),z=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.AdoptedStyleSheet},e)}))}),W=new IframeManager({mirror:qt,mutationCb:wrappedMutationEmit,stylesheetManager:z,recordCrossOriginIframes:C,wrappedEmit:Lt});for(const J of Z||[])J.getMirror&&J.getMirror({nodeMirror:qt,crossOriginIframeMirror:W.crossOriginIframeMirror,crossOriginIframeStyleMirror:W.crossOriginIframeStyleMirror});const K=new ProcessedNodeManager;Ft=new CanvasManager({recordCanvas:x,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:s,blockSelector:a,mirror:qt,sampling:b.canvas,dataURLOptions:S});const H=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:l,inlineStylesheet:p,maskInputOptions:U,dataURLOptions:S,maskTextFn:g,maskInputFn:_,recordCanvas:x,inlineImages:N,sampling:b,slimDOMOptions:q,iframeManager:W,stylesheetManager:z,canvasManager:Ft,keepIframeSrcFn:P,processedNodeManager:K},mirror:qt});jt=(e=!1)=>{if(!I)return;Lt(wrapEvent({type:wt.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),z.reset(),H.init(),Tt.forEach((e=>e.lock()));const t=function snapshot(e,t){const{mirror:n=new Mirror,blockClass:i="rr-block",blockSelector:s=null,maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,inlineImages:u=!1,recordCanvas:l=!1,maskAllInputs:p=!1,maskTextFn:h,maskInputFn:f,slimDOM:m=!1,dataURLOptions:_,preserveWhiteSpace:g,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:w,keepIframeSrcFn:I=()=>!1}=t||{};return serializeNodeWithId(e,{doc:e,mirror:n,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:!0===p?{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===p?{password:!0}:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===m,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===m?{}:m,dataURLOptions:_,inlineImages:u,recordCanvas:l,preserveWhiteSpace:g,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:w,keepIframeSrcFn:I,newlyAddedElement:!1})}(document,{mirror:qt,blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:l,inlineStylesheet:p,maskAllInputs:U,maskTextFn:g,slimDOM:q,dataURLOptions:S,recordCanvas:x,inlineImages:N,onSerialize:e=>{isSerializedIframe(e,qt)&&W.addIframe(e),isSerializedStylesheet(e,qt)&&z.trackLinkElement(e),hasShadowRoot(e)&&H.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{W.attachIframe(e,t),H.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:P});if(!t)return console.warn("Failed to snapshot the document");Lt(wrapEvent({type:wt.FullSnapshot,data:{node:t,initialOffset:getWindowScroll(window)}}),e),Tt.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,qt.getId(document))};try{const e=[],observe=e=>{var t;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,t)=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.ViewportResize},e)})),inputCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.Input},e)})),mediaInteractionCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.MediaInteraction},e)})),styleSheetRuleCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.StyleSheetRule},e)})),styleDeclarationCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.Font},e)})),selectionCb:e=>{Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.Selection},e)}))},customElementCb:e=>{Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.CustomElement},e)}))},blockClass:s,ignoreClass:c,ignoreSelector:d,maskTextClass:u,maskTextSelector:l,maskInputOptions:U,inlineStylesheet:p,sampling:b,recordDOM:I,recordCanvas:x,inlineImages:N,userTriggeredOnInput:T,collectFonts:R,doc:e,maskInputFn:_,maskTextFn:g,keepIframeSrcFn:P,blockSelector:a,slimDOMOptions:q,dataURLOptions:S,mirror:qt,iframeManager:W,stylesheetManager:z,shadowDomManager:H,processedNodeManager:K,canvasManager:Ft,ignoreCSSAttributes:D,plugins:(null===(t=null==Z?void 0:Z.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Lt(wrapEvent({type:wt.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},y)};W.addLoadListener((t=>{try{e.push(observe(t.contentDocument))}catch(Xt){console.warn(Xt)}}));const init2=()=>{jt(),e.push(observe(document)),Ut=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{Lt(wrapEvent({type:wt.DomContentLoaded,data:{}})),"DOMContentLoaded"===O&&init2()}))),e.push(on("load",(()=>{Lt(wrapEvent({type:wt.Load,data:{}})),"load"===O&&init2()}),window))),()=>{e.forEach((e=>e())),K.destroy(),Ut=!1,function unregisterErrorHandler(){Ot=void 0}()}}catch(Xt){console.warn(Xt)}}record.addCustomEvent=(e,t)=>{if(!Ut)throw new Error("please add custom event after start recording");Lt(wrapEvent({type:wt.Custom,data:{tag:e,payload:t}}))},record.freezePage=()=>{Tt.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!Ut)throw new Error("please take full snapshot after start recording");jt(e)},record.mirror=qt;var $t,Bt=(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))(Bt||{}),zt=(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))(zt||{}),Wt={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var Vt={hostname:""};$t={navigator:{userAgent:"",onLine:!0},document:{location:Vt,referrer:""},screen:{width:0,height:0},location:Vt}}else $t=window;var Kt,Ht,Gt,Jt,Yt,Xt,Qt,er,tr,rr,nr=864e5,ir=8e3,or=Array.prototype,sr=Function.prototype,ar=Object.prototype,cr=or.slice,dr=ar.toString,ur=ar.hasOwnProperty,lr=$t.console,pr=$t.navigator,hr=$t.document,fr=$t.opera,mr=$t.screen,_r=pr.userAgent,gr=sr.bind,yr=or.forEach,vr=or.indexOf,br=or.map,Sr=Array.isArray,kr={},wr={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},Ir={log:function(){if(Wt.DEBUG&&!wr.isUndefined(lr)&&lr)try{lr.log.apply(lr,arguments)}catch(e){wr.each(arguments,(function(e){lr.log(e)}))}},warn:function(){if(Wt.DEBUG&&!wr.isUndefined(lr)&&lr){var e=["Mixpanel warning:"].concat(wr.toArray(arguments));try{lr.warn.apply(lr,e)}catch(t){wr.each(e,(function(e){lr.warn(e)}))}}},error:function(){if(Wt.DEBUG&&!wr.isUndefined(lr)&&lr){var e=["Mixpanel error:"].concat(wr.toArray(arguments));try{lr.error.apply(lr,e)}catch(t){wr.each(e,(function(e){lr.error(e)}))}}},critical:function(){if(!wr.isUndefined(lr)&&lr){var e=["Mixpanel error:"].concat(wr.toArray(arguments));try{lr.error.apply(lr,e)}catch(t){wr.each(e,(function(e){lr.error(e)}))}}}},log_func_with_prefix=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(Ir,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(Ir.log,e),error:log_func_with_prefix(Ir.error,e),critical:log_func_with_prefix(Ir.critical,e)}};wr.bind=function(e,t){var n,i;if(gr&&e.bind===gr)return gr.apply(e,cr.call(arguments,1));if(!wr.isFunction(e))throw new TypeError;return n=cr.call(arguments,2),i=function(){if(!(this instanceof i))return e.apply(t,n.concat(cr.call(arguments)));var s={};s.prototype=e.prototype;var a=new s;s.prototype=null;var c=e.apply(a,n.concat(cr.call(arguments)));return Object(c)===c?c:a},i},wr.each=function(e,t,n){if(null!=e)if(yr&&e.forEach===yr)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(i in e&&t.call(n,e[i],i,e)===kr)return}else for(var a in e)if(ur.call(e,a)&&t.call(n,e[a],a,e)===kr)return},wr.extend=function(e){return wr.each(cr.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},wr.isArray=Sr||function(e){return"[object Array]"===dr.call(e)},wr.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},wr.isArguments=function(e){return!(!e||!ur.call(e,"callee"))},wr.toArray=function(e){return e?e.toArray?e.toArray():wr.isArray(e)||wr.isArguments(e)?cr.call(e):wr.values(e):[]},wr.map=function(e,t,n){if(br&&e.map===br)return e.map(t,n);var i=[];return wr.each(e,(function(e){i.push(t.call(n,e))})),i},wr.keys=function(e){var t=[];return null===e||wr.each(e,(function(e,n){t[t.length]=n})),t},wr.values=function(e){var t=[];return null===e||wr.each(e,(function(e){t[t.length]=e})),t},wr.include=function(e,t){var n=!1;return null===e?n:vr&&e.indexOf===vr?-1!=e.indexOf(t):(wr.each(e,(function(e){if(n||(n=e===t))return kr})),n)},wr.includes=function(e,t){return-1!==e.indexOf(t)},wr.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},wr.isObject=function(e){return e===Object(e)&&!wr.isArray(e)},wr.isEmptyObject=function(e){if(wr.isObject(e)){for(var t in e)if(ur.call(e,t))return!1;return!0}return!1},wr.isUndefined=function(e){return void 0===e},wr.isString=function(e){return"[object String]"==dr.call(e)},wr.isDate=function(e){return"[object Date]"==dr.call(e)},wr.isNumber=function(e){return"[object Number]"==dr.call(e)},wr.isElement=function(e){return!(!e||1!==e.nodeType)},wr.encodeDates=function(e){return wr.each(e,(function(t,n){wr.isDate(t)?e[n]=wr.formatDate(t):wr.isObject(t)&&(e[n]=wr.encodeDates(t))})),e},wr.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},wr.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())},wr.strip_empty_properties=function(e){var t={};return wr.each(e,(function(e,n){wr.isString(e)&&e.length>0&&(t[n]=e)})),t},wr.truncate=function(e,t){var n;return"string"==typeof e?n=e.slice(0,t):wr.isArray(e)?(n=[],wr.each(e,(function(e){n.push(wr.truncate(e,t))}))):wr.isObject(e)?(n={},wr.each(e,(function(e,i){n[i]=wr.truncate(e,t)}))):n=e,n},wr.JSONEncode=function(){return function(e){var quote=function(e){var t=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return t.lastIndex=0,t.test(e)?'"'+e.replace(t,(function(e){var t=n[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,t){var n="",i=0,s="",a="",c=0,d=n,u=[],l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(n+=" ",u=[],"[object Array]"===dr.apply(l)){for(c=l.length,i=0;i<c;i+=1)u[i]=str(i,l)||"null";return a=0===u.length?"[]":n?"[\n"+n+u.join(",\n"+n)+"\n"+d+"]":"["+u.join(",")+"]",n=d,a}for(s in l)ur.call(l,s)&&(a=str(s,l))&&u.push(quote(s)+(n?": ":":")+a);return a=0===u.length?"{}":n?"{"+u.join(",")+d+"}":"{"+u.join(",")+"}",n=d,a}};return str("",{"":e})}}(),wr.JSONDecode=(Yt={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Xt=function(e){var t=new SyntaxError(e);throw t.at=Kt,t.text=Gt,t},Qt=function(e){return e&&e!==Ht&&Xt("Expected '"+e+"' instead of '"+Ht+"'"),Ht=Gt.charAt(Kt),Kt+=1,Ht},er=function(){var e,t="";for("-"===Ht&&(t="-",Qt("-"));Ht>="0"&&Ht<="9";)t+=Ht,Qt();if("."===Ht)for(t+=".";Qt()&&Ht>="0"&&Ht<="9";)t+=Ht;if("e"===Ht||"E"===Ht)for(t+=Ht,Qt(),"-"!==Ht&&"+"!==Ht||(t+=Ht,Qt());Ht>="0"&&Ht<="9";)t+=Ht,Qt();if(e=+t,isFinite(e))return e;Xt("Bad number")},tr=function(){var e,t,n,i="";if('"'===Ht)for(;Qt();){if('"'===Ht)return Qt(),i;if("\\"===Ht)if(Qt(),"u"===Ht){for(n=0,t=0;t<4&&(e=parseInt(Qt(),16),isFinite(e));t+=1)n=16*n+e;i+=String.fromCharCode(n)}else{if("string"!=typeof Yt[Ht])break;i+=Yt[Ht]}else i+=Ht}Xt("Bad string")},rr=function(){for(;Ht&&Ht<=" ";)Qt()},Jt=function(){switch(rr(),Ht){case"{":return function(){var e,t={};if("{"===Ht){if(Qt("{"),rr(),"}"===Ht)return Qt("}"),t;for(;Ht;){if(e=tr(),rr(),Qt(":"),Object.hasOwnProperty.call(t,e)&&Xt('Duplicate key "'+e+'"'),t[e]=Jt(),rr(),"}"===Ht)return Qt("}"),t;Qt(","),rr()}}Xt("Bad object")}();case"[":return function(){var e=[];if("["===Ht){if(Qt("["),rr(),"]"===Ht)return Qt("]"),e;for(;Ht;){if(e.push(Jt()),rr(),"]"===Ht)return Qt("]"),e;Qt(","),rr()}}Xt("Bad array")}();case'"':return tr();case"-":return er();default:return Ht>="0"&&Ht<="9"?er():function(){switch(Ht){case"t":return Qt("t"),Qt("r"),Qt("u"),Qt("e"),!0;case"f":return Qt("f"),Qt("a"),Qt("l"),Qt("s"),Qt("e"),!1;case"n":return Qt("n"),Qt("u"),Qt("l"),Qt("l"),null}Xt('Unexpected "'+Ht+'"')}()}},function(e){var t;return Gt=e,Kt=0,Ht=" ",t=Jt(),rr(),Ht&&Xt("Syntax error"),t}),wr.base64Encode=function(e){var t,n,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=0,u=0,l="",p=[];if(!e)return e;e=wr.utf8Encode(e);do{t=(a=e.charCodeAt(d++)<<16|e.charCodeAt(d++)<<8|e.charCodeAt(d++))>>18&63,n=a>>12&63,i=a>>6&63,s=63&a,p[u++]=c.charAt(t)+c.charAt(n)+c.charAt(i)+c.charAt(s)}while(d<e.length);switch(l=p.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l},wr.utf8Encode=function(e){var t,n,i,s,a="";for(t=n=0,i=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<i;s++){var c=e.charCodeAt(s),d=null;c<128?n++:d=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==d&&(n>t&&(a+=e.substring(t,n)),a+=d,t=n=s+1)}return n>t&&(a+=e.substring(t,e.length)),a},wr.UUID=function(){var T2=function(){var e,t=1*new Date;if($t.performance&&$t.performance.now)e=$t.performance.now();else for(e=0;t==1*new Date;)e++;return t.toString(16)+Math.floor(e).toString(16)};return function(){var e=(mr.height*mr.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=_r,i=[],s=0;function xor(e,t){var n,s=0;for(n=0;n<t.length;n++)s|=i[n]<<8*n;return e^s}for(e=0;e<n.length;e++)t=n.charCodeAt(e),i.unshift(255&t),i.length>=4&&(s=xor(s,i),i=[]);return i.length>0&&(s=xor(s,i)),s.toString(16)}()+"-"+e+"-"+T2()}}();var xr=["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"];wr.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<xr.length;t++)if(-1!==e.indexOf(xr[t]))return!0;return!1},wr.HTTPBuildQuery=function(e,t){var n,i,s=[];return wr.isUndefined(t)&&(t="&"),wr.each(e,(function(e,t){n=encodeURIComponent(e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+n})),s.join(t)},wr.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);if(null===n||n&&"string"!=typeof n[1]&&n[1].length)return"";var i=n[1];try{i=decodeURIComponent(i)}catch(s){Ir.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},wr.cookie={get:function(e){for(var t=e+"=",n=hr.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}return null},parse:function(e){var t;try{t=wr.JSONDecode(wr.cookie.get(e))||{}}catch(n){}return t},set_seconds:function(e,t,n,i,s,a,c){var d="",u="",l="";if(c)d="; domain="+c;else if(i){var p=extract_domain(hr.location.hostname);d=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+1e3*n),u="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure"),hr.cookie=e+"="+encodeURIComponent(t)+u+"; path=/"+d+l},set:function(e,t,n,i,s,a,c){var d="",u="",l="";if(c)d="; domain="+c;else if(i){var p=extract_domain(hr.location.hostname);d=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+24*n*60*60*1e3),u="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure");var f=e+"="+encodeURIComponent(t)+u+"; path=/"+d+l;return hr.cookie=f,f},remove:function(e,t,n){wr.cookie.set(e,"",-1,t,!1,!1,n)}};var Er=null,localStorageSupported=function(e,t){if(null!==Er&&!t)return Er;var n=!0;try{e=e||window.localStorage;var i="__mplss_"+cheap_guid(8);e.setItem(i,"xyz"),"xyz"!==e.getItem(i)&&(n=!1),e.removeItem(i)}catch(s){n=!1}return Er=n,n};wr.localStorage={is_supported:function(e){var t=localStorageSupported(null,e);return t||Ir.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){Ir.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(t){wr.localStorage.error(t)}return null},parse:function(e){try{return wr.JSONDecode(wr.localStorage.get(e))||{}}catch(t){}return null},set:function(e,t){try{window.localStorage.setItem(e,t)}catch(n){wr.localStorage.error(n)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(t){wr.localStorage.error(t)}}},wr.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,t,n,i,s){if(e)if(e.addEventListener&&!i)e.addEventListener(t,n,!!s);else{var a="on"+t,c=e[a];e[a]=function makeHandler(e,t,n){var handler=function(i){if(i=i||fixEvent(window.event)){var s,a,c=!0;return wr.isFunction(n)&&(s=n(i)),a=t.call(e,i),!1!==s&&!1!==a||(c=!1),c}};return handler}(e,n,c)}else Ir.error("No valid element provided to register_event")}}();var Cr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');wr.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(t,n){var i=" "+n+" ";return(" "+t.className+" ").replace(e," ").indexOf(i)>=0}function getElementsBySelector(e){if(!hr.getElementsByTagName)return[];var t,n,i,s,a,c,d,u,l,p,h=e.split(" "),f=[hr];for(c=0;c<h.length;c++)if((t=h[c].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){i=(n=t.split("#"))[0];var m=n[1],_=hr.getElementById(m);if(!_||i&&_.nodeName.toLowerCase()!=i)return[];f=[_]}else if(t.indexOf(".")>-1){i=(n=t.split("."))[0];var g=n[1];for(i||(i="*"),s=[],a=0,d=0;d<f.length;d++)for(l="*"==i?getAllChildren(f[d]):f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];for(f=[],p=0,d=0;d<s.length;d++)s[d].className&&wr.isString(s[d].className)&&hasClass(s[d],g)&&(f[p++]=s[d])}else{var y=t.match(Cr);if(y){i=y[1];var v,b=y[2],S=y[3],w=y[4];for(i||(i="*"),s=[],a=0,d=0;d<f.length;d++)for(l="*"==i?getAllChildren(f[d]):f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];switch(f=[],p=0,S){case"=":v=function(e){return e.getAttribute(b)==w};break;case"~":v=function(e){return e.getAttribute(b).match(new RegExp("\\b"+w+"\\b"))};break;case"|":v=function(e){return e.getAttribute(b).match(new RegExp("^"+w+"-?"))};break;case"^":v=function(e){return 0===e.getAttribute(b).indexOf(w)};break;case"$":v=function(e){return e.getAttribute(b).lastIndexOf(w)==e.getAttribute(b).length-w.length};break;case"*":v=function(e){return e.getAttribute(b).indexOf(w)>-1};break;default:v=function(e){return e.getAttribute(b)}}for(f=[],p=0,d=0;d<s.length;d++)v(s[d])&&(f[p++]=s[d])}else{for(i=t,s=[],a=0,d=0;d<f.length;d++)for(l=f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];f=s}}return f}return function(e){return wr.isElement(e)?[e]:wr.isObject(e)&&!wr.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var Or=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Tr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];wr.info={campaignParams:function(e){var t="",n={};return wr.each(Or,(function(i){(t=wr.getQueryParam(hr.URL,i)).length?n[i]=t:void 0!==e&&(n[i]=e)})),n},clickParams:function(){var e="",t={};return wr.each(Tr,(function(n){(e=wr.getQueryParam(hr.URL,n)).length&&(t[n]=e)})),t},marketingParams:function(){return wr.extend(wr.info.campaignParams(),wr.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 t=wr.info.searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(null!==t){i.$search_engine=t;var s=wr.getQueryParam(e,n);s.length&&(i.mp_keyword=s)}return i},browser:function(e,t,n){return t=t||"",n||wr.includes(e," OPR/")?wr.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":wr.includes(e,"IEMobile")||wr.includes(e,"WPDesktop")?"Internet Explorer Mobile":wr.includes(e,"SamsungBrowser/")?"Samsung Internet":wr.includes(e,"Edge")||wr.includes(e,"Edg/")?"Microsoft Edge":wr.includes(e,"FBIOS")?"Facebook Mobile":wr.includes(e,"Chrome")?"Chrome":wr.includes(e,"CriOS")?"Chrome iOS":wr.includes(e,"UCWEB")||wr.includes(e,"UCBrowser")?"UC Browser":wr.includes(e,"FxiOS")?"Firefox iOS":wr.includes(t,"Apple")?wr.includes(e,"Mobile")?"Mobile Safari":"Safari":wr.includes(e,"Android")?"Android Mobile":wr.includes(e,"Konqueror")?"Konqueror":wr.includes(e,"Firefox")?"Firefox":wr.includes(e,"MSIE")||wr.includes(e,"Trident/")?"Internet Explorer":wr.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var i={"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+)?)/}[wr.info.browser(e,t,n)];if(void 0===i)return null;var s=e.match(i);return s?parseFloat(s[s.length-2]):null},os:function(){var e=_r;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 t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return $t.location.href},properties:function(e){return"object"!=typeof e&&(e={}),wr.extend(wr.strip_empty_properties({$os:wr.info.os(),$browser:wr.info.browser(_r,pr.vendor,fr),$referrer:hr.referrer,$referring_domain:wr.info.referringDomain(hr.referrer),$device:wr.info.device(_r)}),{$current_url:wr.info.currentUrl(),$browser_version:wr.info.browserVersion(_r,pr.vendor,fr),$screen_height:mr.height,$screen_width:mr.width,mp_lib:"web",$lib_version:Wt.LIB_VERSION,$insert_id:cheap_guid(),time:wr.timestamp()/1e3},wr.strip_empty_properties(e))},people_properties:function(){return wr.extend(wr.strip_empty_properties({$os:wr.info.os(),$browser:wr.info.browser(_r,pr.vendor,fr)}),{$browser_version:wr.info.browserVersion(_r,pr.vendor,fr)})},mpPageViewProperties:function(){return wr.strip_empty_properties({current_page_title:hr.title,current_domain:$t.location.hostname,current_url_path:$t.location.pathname,current_url_protocol:$t.location.protocol,current_url_search:$t.location.search})}};var cheap_guid=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},Rr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Mr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var t=Mr,n=e.split("."),i=n[n.length-1];(i.length>4||"com"===i||"org"===i)&&(t=Rr);var s=e.match(t);return s?s[0]:""},Nr=null,Zr=null;"undefined"!=typeof JSON&&(Nr=JSON.stringify,Zr=JSON.parse),Nr=Nr||wr.JSONEncode,Zr=Zr||wr.JSONDecode,wr.toArray=wr.toArray,wr.isObject=wr.isObject,wr.JSONEncode=wr.JSONEncode,wr.JSONDecode=wr.JSONDecode,wr.isBlockedUA=wr.isBlockedUA,wr.isEmptyObject=wr.isEmptyObject,wr.info=wr.info,wr.info.device=wr.info.device,wr.info.browser=wr.info.browser,wr.info.browserVersion=wr.info.browserVersion,wr.info.properties=wr.info.properties;var Pr="__mp_opt_in_out_";function optIn(e,t){_optInOut(!0,e,t)}function optOut(e,t){_optInOut(!1,e,t)}function hasOptedIn(e,t){return"1"===_getStorageValue(e,t)}function hasOptedOut(e,t){if(function _hasDoNotTrackFlagOn(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||$t,n=t.navigator||{},i=!1;return wr.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){wr.includes([!0,1,"1","yes"],e)&&(i=!0)})),i}(t))return Ir.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 n="0"===_getStorageValue(e,t);return n&&Ir.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}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,t){_getStorage(t=t||{}).remove(_getStorageKey(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function _getStorage(e){return"localStorage"===(e=e||{}).persistenceType?wr.localStorage:wr.cookie}function _getStorageKey(e,t){return((t=t||{}).persistencePrefix||Pr)+e}function _getStorageValue(e,t){return _getStorage(t).get(_getStorageKey(e,t))}function _optInOut(e,t,n){wr.isString(t)&&t.length?(_getStorage(n=n||{}).set(_getStorageKey(t,n),e?1:0,wr.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&e&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})):Ir.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,t){return function(){var n=!1;try{var i=t.call(this,"token"),s=t.call(this,"ignore_dnt"),a=t.call(this,"opt_out_tracking_persistence_type"),c=t.call(this,"opt_out_tracking_cookie_prefix"),d=t.call(this,"window");i&&(n=hasOptedOut(i,{ignoreDnt:s,persistenceType:a,persistencePrefix:c,window:d}))}catch(l){Ir.error("Unexpected error when checking tracking opt-out status: "+l)}if(!n)return e.apply(this,arguments);var u=arguments[arguments.length-1];"function"==typeof u&&u(0)}}var Dr=console_with_prefix("lock"),SharedLock=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,t,n){n||"function"==typeof t||(n=t,t=null);var i=n||(new Date).getTime()+"|"+Math.random(),s=(new Date).getTime(),a=this.storageKey,c=this.pollIntervalMS,d=this.timeoutMS,u=this.storage,l=a+":X",p=a+":Y",h=a+":Z",reportError=function(e){t&&t(e)},delay=function(e){if((new Date).getTime()-s>d)return Dr.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+i+"]"),u.removeItem(h),u.removeItem(p),void loop();setTimeout((function(){try{e()}catch(t){reportError(t)}}),c*(Math.random()+.1))},waitFor=function(e,t){e()?t():delay((function(){waitFor(e,t)}))},getSetY=function(){var e=u.getItem(p);if(e&&e!==i)return!1;if(u.setItem(p,i),u.getItem(p)===i)return!0;if(!localStorageSupported(u,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){u.setItem(l,i),waitFor(getSetY,(function(){u.getItem(l)!==i?delay((function(){u.getItem(p)===i?waitFor((function(){return!u.getItem(h)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){u.setItem(h,"1");try{e()}finally{u.removeItem(h),u.getItem(p)===i&&u.removeItem(p),u.getItem(l)===i&&u.removeItem(l)}};try{if(!localStorageSupported(u,!0))throw new Error("localStorage support check failed");loop()}catch(f){reportError(f)}};var Ar=console_with_prefix("batch"),RequestQueue=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.reportError=t.errorReporter||wr.bind(Ar.error,Ar),this.lock=new SharedLock(e,{storage:this.storage}),this.usePersistence=t.usePersistence,this.pid=t.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(e,t,n){var i={id:cheap_guid(),flushAfter:(new Date).getTime()+2*t,payload:e};this.usePersistence?this.lock.withLock(wr.bind((function lockAcquired(){var t;try{var s=this.readFromStorage();s.push(i),(t=this.saveToStorage(s))&&this.memQueue.push(i)}catch(a){this.reportError("Error enqueueing item",e),t=!1}n&&n(t)}),this),wr.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),n&&n(!1)}),this),this.pid):(this.memQueue.push(i),n&&n(!0))},RequestQueue.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);if(this.usePersistence&&t.length<e){var n=this.readFromStorage();if(n.length){var i={};wr.each(t,(function(e){i[e.id]=!0}));for(var s=0;s<n.length;s++){var a=n[s];if((new Date).getTime()>a.flushAfter&&!i[a.id]&&(a.orphaned=!0,t.push(a),t.length>=e))break}}}return t};var filterOutIDsAndInvalid=function(e,t){var n=[];return wr.each(e,(function(e){e.id&&!t[e.id]&&n.push(e)})),n};RequestQueue.prototype.removeItemsByID=function(e,t){var n={};if(wr.each(e,(function(e){n[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,n),this.usePersistence){var i=wr.bind((function(){var t;try{var i=this.readFromStorage();if(i=filterOutIDsAndInvalid(i,n),t=this.saveToStorage(i)){i=this.readFromStorage();for(var s=0;s<i.length;s++){var a=i[s];if(a.id&&n[a.id])return this.reportError("Item not removed from storage"),!1}}}catch(c){this.reportError("Error removing items",e),t=!1}return t}),this);this.lock.withLock((function lockAcquired(){var e=i();t&&t(e)}),wr.bind((function lockFailure(e){var n=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(n=i()))try{this.storage.removeItem(this.storageKey)}catch(s){this.reportError("Error clearing queue",s)}t&&t(n)}),this),this.pid)}else t&&t(!0)};var updatePayloads=function(e,t){var n=[];return wr.each(e,(function(e){var i=e.id;if(i in t){var s=t[i];null!==s&&(e.payload=s,n.push(e))}else n.push(e)})),n};RequestQueue.prototype.updatePayloads=function(e,t){this.memQueue=updatePayloads(this.memQueue,e),this.usePersistence?this.lock.withLock(wr.bind((function lockAcquired(){var n;try{var i=this.readFromStorage();i=updatePayloads(i,e),n=this.saveToStorage(i)}catch(s){this.reportError("Error updating items",e),n=!1}t&&t(n)}),this),wr.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),t&&t(!1)}),this),this.pid):t&&t(!0)},RequestQueue.prototype.readFromStorage=function(){var e;try{(e=this.storage.getItem(this.storageKey))&&(e=Zr(e),wr.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null))}catch(t){this.reportError("Error retrieving queue",t),e=null}return e||[]},RequestQueue.prototype.saveToStorage=function(e){try{return this.storage.setItem(this.storageKey,Nr(e)),!0}catch(t){return this.reportError("Error saving queue",t),!1}},RequestQueue.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var Lr=console_with_prefix("batch"),RequestBatcher=function(e,t){this.errorReporter=t.errorReporter,this.queue=new RequestQueue(e,{errorReporter:wr.bind(this.reportError,this),storage:t.storage,usePersistence:t.usePersistence}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.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=t.flushOnlyOnInterval||!1};RequestBatcher.prototype.enqueue=function(e,t){this.queue.enqueue(e,this.flushInterval,t)},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(wr.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void Lr.log("Flush: Request already in progress");e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=(new Date).getTime(),i=this.batchSize,s=this.queue.fillBatch(i),a=s.length===i,c=[],d={};if(wr.each(s,(function(e){var t=e.payload;if(this.beforeSendHook&&!e.orphaned&&(t=this.beforeSendHook(t)),t){t.event&&t.properties&&(t.properties=wr.extend({},t.properties,{mp_sent_by_lib_version:Wt.LIB_VERSION}));var n=!0,i=e.id;i?(this.itemIdsSentSuccessfully[i]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[i]}),n=!1):this.reportError("[dupe] found item with no ID",{item:e}),n&&c.push(t)}d[e.id]=t}),this),c.length<1)return void this.resetFlush();this.requestInProgress=!0;var u=wr.bind((function(c){this.requestInProgress=!1;try{var u=!1;if(e.unloading)this.queue.updatePayloads(d);else if(wr.isObject(c)&&"timeout"===c.error&&(new Date).getTime()-n>=t)this.reportError("Network timeout; retrying"),this.flush();else if(wr.isObject(c)&&(c.httpStatusCode>=500||429===c.httpStatusCode||c.httpStatusCode<=0&&(h=$t.navigator.onLine,!wr.isUndefined(h)&&!h)||"timeout"===c.error)){var l=2*this.flushInterval;c.retryAfter&&(l=1e3*parseInt(c.retryAfter,10)||l),l=Math.min(6e5,l),this.reportError("Error; retry in "+l+" ms"),this.scheduleFlush(l)}else if(wr.isObject(c)&&413===c.httpStatusCode)if(s.length>1){var p=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,p,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(),u=!0;else u=!0;u&&(this.queue.removeItemsByID(wr.map(s,(function(e){return e.id})),wr.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)),wr.each(s,wr.bind((function(e){var t=e.id;t?(this.itemIdsSentSuccessfully[t]=this.itemIdsSentSuccessfully[t]||0,this.itemIdsSentSuccessfully[t]++,this.itemIdsSentSuccessfully[t]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[t]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(f){this.reportError("Error handling API response",f),this.resetFlush()}var h}),this),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};e.unloading&&(l.transport="sendBeacon"),Lr.log("MIXPANEL REQUEST:",c),this.sendRequest(c,l,u)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,t){if(Lr.error.apply(Lr.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){Lr.error(n)}};var jr=console_with_prefix("recorder"),Fr=$t.CompressionStream,Ur={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},qr=new Set([zt.MouseMove,zt.MouseInteraction,zt.Scroll,zt.ViewportResize,zt.Input,zt.TouchMove,zt.MediaInteraction,zt.Drag,zt.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:Ur,sendRequestFunc:wr.bind(this.flushEventsWithOptOut,this),errorReporter:wr.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,jr.critical("record_max_ms cannot be greater than "+nr+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>ir&&(this.recordMinMs=ir,jr.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=wr.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=wr.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(wr.bind((function(){jr.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),n=this.get_config("record_block_selector");""!==n&&null!==n||(n=void 0),this._stopRecording=record({emit:wr.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===Bt.IncrementalSnapshot&&qr.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t())}),this),blockClass:this.get_config("record_block_class"),blockSelector:n,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")}),t(),this.maxTimeoutId=setTimeout(wr.bind(this.resetRecording,this),this.recordMaxMs)}else jr.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,t,n){this._flushEvents(e,t,n,wr.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,t,n,i){var s=wr.bind((function(t,n){200===t.status&&this.replayId===e&&this.seqNo++,i({status:0,httpStatusCode:t.status,responseBody:n,retryAfter:t.headers.get("Retry-After")})}),this);$t.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then((function(e){e.json().then((function(t){s(e,t)})).catch((function(e){i({error:e})}))})).catch((function(e){i({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,t,n){const i=e.length;if(i>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 c=e[i-1].timestamp-this.replayStartTime,d={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:a/1e3,replay_id:s,replay_length_ms:c,replay_start_time:this.replayStartTime/1e3},u=wr.JSONEncode(e),l=this._mixpanel.get_property("$device_id");l&&(d.$device_id=l);var p=this._mixpanel.get_property("$user_id");if(p&&(d.$user_id=p),Fr){var h=new Blob([u],{type:"application/json"}).stream().pipeThrough(new Fr("gzip"));new Response(h).blob().then(wr.bind((function(e){d.format="gzip",this._sendRequest(s,d,e,n)}),this))}else d.format="body",this._sendRequest(s,d,u,n)}})),MixpanelRecorder.prototype.reportError=function(e,t){jr.error.apply(jr.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){jr.error(n)}},$t.__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,t,n,i){var s=this,a=wr.dom_query(e);if(0!==a.length)return wr.each(a,(function(e){wr.register_event(e,this.override_event,(function(e){var a={},c=s.create_properties(n,this),d=s.mp.get_config("track_links_timeout");s.event_handler(e,this,a),window.setTimeout(s.track_callback(i,c,a,!0),d),s.mp.track(t,c,s.track_callback(i,c,a))}))}),this),!0;Ir.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,t,n,i){i=i||!1;var s=this;return function(){n.callback_fired||(n.callback_fired=!0,e&&!1===e(i,t)||s.after_track_handler(t,n,i))}},DomTracker.prototype.create_properties=function(e,t){return"function"==typeof e?e(t):wr.extend({},e)};var LinkTracker=function(){this.override_event="click"};wr.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(e,t){var n=LinkTracker.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},LinkTracker.prototype.event_handler=function(e,t,n){n.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===t.target,n.href=t.href,n.new_tab||e.preventDefault()},LinkTracker.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout((function(){window.location=t.href}),0)};var FormTracker=function(){this.override_event="submit"};wr.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},FormTracker.prototype.after_track_handler=function(e,t){setTimeout((function(){t.element.submit()}),0)};var $r="$set",Br="$set_once",zr="$unset",Wr="$add",Vr="$append",Kr="$union",Hr="$remove",Gr={set_action:function(e,t){var n={},i={};return wr.isObject(e)?wr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[$r]=i,n},unset_action:function(e){var t={},n=[];return wr.isArray(e)||(e=[e]),wr.each(e,(function(e){this._is_reserved_property(e)||n.push(e)}),this),t[zr]=n,t},set_once_action:function(e,t){var n={},i={};return wr.isObject(e)?wr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Br]=i,n},union_action:function(e,t){var n={},i={};return wr.isObject(e)?wr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=wr.isArray(e)?e:[e])}),this):i[e]=wr.isArray(t)?t:[t],n[Kr]=i,n},append_action:function(e,t){var n={},i={};return wr.isObject(e)?wr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Vr]=i,n},remove_action:function(e,t){var n={},i={};return wr.isObject(e)?wr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Hr]=i,n},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};wr.extend(MixpanelGroup.prototype,Gr),MixpanelGroup.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_action(e,t);return wr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_once_action(e,t);return wr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(e,t,n){wr.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(e){var t=this.delete_action();return this._send_request(t,e)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var n=wr.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},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(){};wr.extend(MixpanelPeople.prototype,Gr),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_action(e,t);return wr.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[$r]=wr.extend({},wr.info.people_properties(),i[$r]),this._send_request(i,n)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_once_action(e,t);return wr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(e,t,n){var i={},s={};return wr.isObject(e)?(wr.each(e,(function(e,t){if(!this._is_reserved_property(t)){if(isNaN(parseFloat(e)))return void Ir.error("Invalid increment value passed to mixpanel.people.increment - must be a number");s[t]=e}}),this),n=t):(wr.isUndefined(t)&&(t=1),s[e]=t),i[Wr]=s,this._send_request(i,n)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,t,n){wr.isObject(e)&&(n=t);var i=this.append_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,t,n){wr.isObject(e)&&(n=t);var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,t,n){wr.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,t,n){if(wr.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",wr.extend({$amount:e},t),n);Ir.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)}Ir.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,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),i=this._mixpanel.get_property("$user_id"),s=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),i&&(e.$user_id=i),s&&(e.$had_persisted_distinct_id=s);var a=wr.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},t):(this._enqueue(e),wr.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),wr.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){$r in e?this._mixpanel.persistence._add_to_people_queue($r,e):Br in e?this._mixpanel.persistence._add_to_people_queue(Br,e):zr in e?this._mixpanel.persistence._add_to_people_queue(zr,e):Wr in e?this._mixpanel.persistence._add_to_people_queue(Wr,e):Vr in e?this._mixpanel.persistence._add_to_people_queue(Vr,e):Hr in e?this._mixpanel.persistence._add_to_people_queue(Hr,e):Kr in e?this._mixpanel.persistence._add_to_people_queue(Kr,e):Ir.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,t,n,i){var s=this,a=wr.extend({},this._mixpanel.persistence.load_queue(e)),c=a;wr.isUndefined(a)||!wr.isObject(a)||wr.isEmptyObject(a)||(s._mixpanel.persistence._pop_from_people_queue(e,a),s._mixpanel.persistence.save(),i&&(c=i(a)),t.call(s,c,(function(t,i){0===t&&s._mixpanel.persistence._add_to_people_queue(e,a),wr.isUndefined(n)||n(t,i)})))},MixpanelPeople.prototype._flush=function(e,t,n,i,s,a,c){var d=this;this._flush_one_queue($r,this.set,e),this._flush_one_queue(Br,this.set_once,i),this._flush_one_queue(zr,this.unset,a,(function(e){return wr.keys(e)})),this._flush_one_queue(Wr,this.increment,t),this._flush_one_queue(Kr,this.union,s);var u=this._mixpanel.persistence.load_queue(Vr);if(!wr.isUndefined(u)&&wr.isArray(u)&&u.length)for(var l,append_callback=function(e,t){0===e&&d._mixpanel.persistence._add_to_people_queue(Vr,l),wr.isUndefined(n)||n(e,t)},p=u.length-1;p>=0;p--)u=this._mixpanel.persistence.load_queue(Vr),l=u.pop(),d._mixpanel.persistence.save(),wr.isEmptyObject(l)||d.append(l,append_callback);var h=this._mixpanel.persistence.load_queue(Hr);if(!wr.isUndefined(h)&&wr.isArray(h)&&h.length)for(var f,remove_callback=function(e,t){0===e&&d._mixpanel.persistence._add_to_people_queue(Hr,f),wr.isUndefined(c)||c(e,t)},m=h.length-1;m>=0;m--)h=this._mixpanel.persistence.load_queue(Hr),f=h.pop(),d._mixpanel.persistence.save(),wr.isEmptyObject(f)||d.remove(f,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 Jr,Yr="__mps",Xr="__mpso",Qr="__mpus",en="__mpa",tn="__mpap",rn="__mpr",nn="__mpu",sn="$people_distinct_id",an="__alias",cn="__timers",dn=[Yr,Xr,Qr,en,tn,rn,nn,sn,an,cn],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 t=e.persistence;"cookie"!==t&&"localStorage"!==t&&(Ir.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),"localStorage"===t&&wr.localStorage.is_supported()?this.storage=wr.localStorage:this.storage=wr.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),wr.each(this.props,(function(t,n){wr.include(dn,n)||(e[n]=t)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=wr.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,t;this.storage===wr.localStorage?(e=wr.cookie.parse(this.name),wr.cookie.remove(this.name),wr.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===wr.cookie&&(t=wr.localStorage.parse(this.name),wr.localStorage.remove(this.name),t&&this.register_once(t))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,wr.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,t,n){return!!wr.isObject(e)&&(void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n,this.load(),wr.each(e,(function(e,n){this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(e,t){return!!wr.isObject(e)&&(this.expire_days=void 0===t?this.default_expiry:t,this.load(),wr.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(wr.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:wr.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return wr.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,t){var n=this._get_queue_key(e),i=t[e],s=this._get_or_create_queue($r),a=this._get_or_create_queue(Br),c=this._get_or_create_queue(zr),d=this._get_or_create_queue(Wr),u=this._get_or_create_queue(Kr),l=this._get_or_create_queue(Hr,[]),p=this._get_or_create_queue(Vr,[]);n===Yr?(wr.extend(s,i),this._pop_from_people_queue(Wr,i),this._pop_from_people_queue(Kr,i),this._pop_from_people_queue(zr,i)):n===Xr?(wr.each(i,(function(e,t){t in a||(a[t]=e)})),this._pop_from_people_queue(zr,i)):n===Qr?wr.each(i,(function(e){wr.each([s,a,d,u],(function(t){e in t&&delete t[e]})),wr.each(p,(function(t){e in t&&delete t[e]})),c[e]=!0})):n===en?(wr.each(i,(function(e,t){t in s?s[t]+=e:(t in d||(d[t]=0),d[t]+=e)}),this),this._pop_from_people_queue(zr,i)):n===nn?(wr.each(i,(function(e,t){wr.isArray(e)&&(t in u||(u[t]=[]),u[t]=u[t].concat(e))})),this._pop_from_people_queue(zr,i)):n===rn?(l.push(i),this._pop_from_people_queue(Vr,i)):n===tn&&(p.push(i),this._pop_from_people_queue(zr,i)),Ir.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Ir.log(t),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];wr.isUndefined(n)||wr.each(t,(function(t,i){e===Vr||e===Hr?wr.each(n,(function(e){e[i]===t&&delete e[i]})):delete n[i]}),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===$r?Yr:e===Br?Xr:e===zr?Qr:e===Wr?en:e===Vr?tn:e===Hr?rn:e===Kr?nn:void Ir.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=wr.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},MixpanelPersistence.prototype.set_event_timer=function(e,t){var n=this.load_prop(cn)||{};n[e]=t,this.props[cn]=n,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var t=(this.load_prop(cn)||{})[e];return wr.isUndefined(t)||(delete this.props[cn][e],this.save()),t};var un,load_extra_bundle=function(e,t){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},ln="mixpanel",pn="base64",hn="$device:",fn=$t.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,mn=!fn&&-1===_r.indexOf("MSIE")&&-1===_r.indexOf("Mozilla"),_n=null;pr.sendBeacon&&(_n=function(){return pr.sendBeacon.apply(pr,arguments)});var gn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},yn={api_host:"https://api-js.mixpanel.com",api_routes:gn,api_method:"POST",api_transport:"XHR",api_payload_format:pn,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"},vn=!1,MixpanelLib=function(){},create_mplib=function(e,t,n){var i,s=n===ln?un:un[n];if(s&&0===Jr)i=s;else{if(s&&!wr.isArray(s))return void Ir.error("You have already initialized "+n);i=new MixpanelLib}if(i._cached_groups={},i._init(e,t,n),i.people=new MixpanelPeople,i.people._init(i),!i.get_config("skip_first_touch_marketing")){var a=wr.info.campaignParams(null),c={},d=!1;wr.each(a,(function(e,t){c["initial_"+t]=e,e&&(d=!0)})),d&&i.people.set_once(c)}return Wt.DEBUG=Wt.DEBUG||i.get_config("debug"),!wr.isUndefined(s)&&wr.isArray(s)&&(i._execute_array.call(i.people,s.people),i._execute_array(s)),i};MixpanelLib.prototype.init=function(e,t,n){if(wr.isUndefined(n))this.report_error("You must name your new library: init(token, config, name)");else{if(n!==ln){var i=create_mplib(e,t,n);return un[n]=i,i._loaded(),i}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(e,t,n){t=t||{},this.__loaded=!0,this.config={};var i={};"api_payload_format"in t||(t.api_host||yn.api_host).match(/\.mixpanel\.com/)&&(i.api_payload_format="json");if(this.set_config(wr.extend({},yn,i,t,{name:n,token:e,callback_fn:(n===ln?n:ln+"."+n)+"._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(wr.localStorage.is_supported(!0)&&fn){if(this.init_batchers(),_n&&$t.addEventListener){var s=wr.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);$t.addEventListener("pagehide",(function(e){e.persisted&&s()})),$t.addEventListener("visibilitychange",(function(){"hidden"===hr.visibilityState&&s()}))}}else this._batch_requests=!1,Ir.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),wr.each(this.get_batcher_configs(),(function(e){Ir.log("Clearing batch queue "+e.queue_key),wr.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=wr.UUID();this.get_distinct_id()||this.register_once({distinct_id:hn+a,$device_id:a},"");var c=this.get_config("track_pageview");c&&this._init_url_change_tracking(c),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($t.MutationObserver){var e=wr.bind((function(){this._recorder=this._recorder||new $t.__mp_recorder(this),this._recorder.startRecording()}),this);wr.isUndefined($t.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else Ir.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():Ir.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var e={};if(this._recorder){var t=this._recorder.replayId;t&&(e.$mp_replay_id=t)}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=wr.info.campaignParams(null);wr.each(e,function(e,t){this.unregister(t)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(hr.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(wr.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(hr.referrer)},MixpanelLib.prototype._dom_loaded=function(){wr.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||wr.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,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!vn)return this.__dom_loaded_queue.push([e,t]),!1;var n=(new e).init(this);return n.track.apply(n,t)},MixpanelLib.prototype._init_url_change_tracking=function(e){var t="";if(this.track_pageview()&&(t=wr.info.currentUrl()),wr.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){$t.addEventListener("popstate",(function(){$t.dispatchEvent(new Event("mp_locationchange"))})),$t.addEventListener("hashchange",(function(){$t.dispatchEvent(new Event("mp_locationchange"))}));var n=$t.history.pushState;"function"==typeof n&&($t.history.pushState=function(e,t,i){n.call($t.history,e,t,i),$t.dispatchEvent(new Event("mp_locationchange"))});var i=$t.history.replaceState;"function"==typeof i&&($t.history.replaceState=function(e,t,n){i.call($t.history,e,t,n),$t.dispatchEvent(new Event("mp_locationchange"))}),$t.addEventListener("mp_locationchange",function(){var n=wr.info.currentUrl(),i=!1;("full-url"===e?i=n!==t:"url-with-path-and-query-string"===e?i=n.split("#")[0]!==t.split("#")[0]:"url-with-path"===e&&(i=n.split("#")[0].split("?")[0]!==t.split("#")[0].split("?")[0]),i)&&(this.track_pageview()&&(t=n))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,t){if(wr.isUndefined(e))return null;if(fn){return function(n){e(n,t)}}var n=this._jsc,i=""+Math.floor(1e8*Math.random()),s=this.get_config("callback_fn")+"["+i+"]";return n[i]=function(s){delete n[i],e(s,t)},s},MixpanelLib.prototype._send_request=function(e,t,n,i){var s=!0;if(mn)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")},c=null;i||!wr.isFunction(n)&&"string"!=typeof n||(i=n,n=null),n=wr.extend(a,n||{}),fn||(n.method="GET");var d="POST"===n.method,u=_n&&d&&"sendbeacon"===n.transport.toLowerCase(),l=n.verbose;t.verbose&&(l=!0),this.get_config("test")&&(t.test=1),l&&(t.verbose=1),this.get_config("img")&&(t.img=1),fn||(i?t.callback=i:(l||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=(new Date).getTime().toString(),d&&(c="data="+encodeURIComponent(t.data),delete t.data),e+="?"+wr.HTTPBuildQuery(t);var p=this;if("img"in t){var h=hr.createElement("img");h.src=e,hr.body.appendChild(h)}else if(u){try{s=_n(e,c)}catch(v){p.report_error(v),s=!1}try{i&&i(s?1:0)}catch(v){p.report_error(v)}}else if(fn)try{var f=new XMLHttpRequest;f.open(n.method,e,!0);var m=this.get_config("xhr_headers");if(d&&(m["Content-Type"]="application/x-www-form-urlencoded"),wr.each(m,(function(e,t){f.setRequestHeader(t,e)})),n.timeout_ms&&void 0!==f.timeout){f.timeout=n.timeout_ms;var _=(new Date).getTime()}f.withCredentials=!0,f.onreadystatechange=function(){var e;if(4===f.readyState)if(200===f.status){if(i)if(l){var t;try{t=wr.JSONDecode(f.responseText)}catch(v){if(p.report_error(v),!n.ignore_json_errors)return;t=f.responseText}i(t)}else i(Number(f.responseText))}else if(e=f.timeout&&!f.status&&(new Date).getTime()-_>=f.timeout?"timeout":"Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(e),i)if(l){var s=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:e,retryAfter:s["Retry-After"]})}else i(0)},f.send(c)}catch(v){p.report_error(v),s=!1}else{var g=hr.createElement("script");g.type="text/javascript",g.async=!0,g.defer=!0,g.src=e;var y=hr.getElementsByTagName("script")[0];y.parentNode.insertBefore(g,y)}return s},MixpanelLib.prototype._execute_array=function(e){var t,n=[],i=[],s=[];wr.each(e,(function(e){e&&(t=e[0],wr.isArray(t)?s.push(e):"function"==typeof e?e.call(this):wr.isArray(e)&&"alias"===t?n.push(e):wr.isArray(e)&&-1!==t.indexOf("track")&&"function"==typeof this[t]?s.push(e):i.push(e))}),this);var execute=function(e,t){wr.each(e,(function(e){if(wr.isArray(e[0])){var n=t;wr.each(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};execute(n,this),execute(i,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"),t=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+t.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+t.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+t.groups,queue_key:e+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=wr.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:wr.bind((function(t,n,i){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(t),n,this._prepare_callback(i,t))}),this),beforeSendHook:wr.bind((function(t){return this._run_hook("before_send_"+e.type,t)}),this),stopAllBatchingFunc:wr.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.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,wr.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,wr.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 t=wr.JSONEncode(e);return this.get_config("api_payload_format")===pn&&(t=wr.base64Encode(t)),{data:t}},MixpanelLib.prototype._track_or_batch=function(e,t){var n=wr.truncate(e.data,255),i=e.endpoint,s=e.batcher,a=e.should_send_immediately,c=e.send_request_options||{};t=t||NOOP_FUNC;var d=!0,u=wr.bind((function(){return c.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(Ir.log("MIXPANEL REQUEST:"),Ir.log(n),this._send_request(i,this._encode_data_for_request(n),c,this._prepare_callback(t,n))):null}),this);return this._batch_requests&&!a?s.enqueue(n,(function(e){e?t(1,n):u()})):d=u(),d&&n},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,t,n,i){i||"function"!=typeof n||(i=n,n=null);var s=(n=n||{}).transport;s&&(n.transport=s);var a=n.send_immediately;if("function"!=typeof i&&(i=NOOP_FUNC),wr.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(t=wr.extend({},t)).token=this.get_config("token");var c=this.persistence.remove_event_timer(e);if(!wr.isUndefined(c)){var d=(new Date).getTime()-c;t.$duration=parseFloat((d/1e3).toFixed(3))}this._set_default_superprops();var u=this.get_config("track_marketing")?wr.info.marketingParams():{};t=wr.extend({},wr.info.properties({mp_loader:this.get_config("mp_loader")}),u,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var l=this.get_config("property_blacklist");wr.isArray(l)?wr.each(l,(function(e){delete t[e]})):this.report_error("Invalid value for property_blacklist config: "+l);var p={event:e,properties:t};return this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:a,send_request_options:n},i)}i(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,t,n){wr.isArray(t)||(t=[t]);var i={};return i[e]=t,this.register(i),this.people.set(e,t,n)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e),s={};return void 0===i?(s[e]=[t],this.register(s)):-1===i.indexOf(t)&&(i.push(t),s[e]=i,this.register(s)),this.people.union(e,t,n)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e);if(void 0!==i){var s=i.indexOf(t);s>-1&&(i.splice(s,1),this.register({group_key:i})),0===i.length&&this.unregister(e)}return this.people.remove(e,t,n)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,t,n,i){var s=wr.extend({},t||{});return wr.each(n,(function(e,t){null!=e&&(s[t]=e)})),this.track(e,s,i)})),MixpanelLib.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},MixpanelLib.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},MixpanelLib.prototype.get_group=function(e,t){var n=this._create_map_key(e,t),i=this._cached_groups[n];return void 0!==i&&i._group_key===e&&i._group_id===t||((i=new MixpanelGroup)._init(this,e,t),this._cached_groups[n]=i),i},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,t){"object"!=typeof e&&(e={});var n=(t=t||{}).event_name||"$mp_web_page_view",i=wr.extend(wr.info.mpPageViewProperties(),wr.info.campaignParams(),wr.info.clickParams()),s=wr.extend({},i,e);return this.track(n,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){wr.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 bn={persistent:!0},options_for_register=function(e){var t;return t=wr.isObject(e)?e:wr.isUndefined(e)?{}:{days:e},wr.extend({},bn,t)};MixpanelLib.prototype.register=function(e,t){var n=options_for_register(t);n.persistent?this.persistence.register(e,n.days):wr.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,t,n){var i=options_for_register(n);i.persistent?this.persistence.register_once(e,t,i.days):(void 0===t&&(t="None"),wr.each(e,(function(e,n){this.unpersisted_superprops.hasOwnProperty(n)&&this.unpersisted_superprops[n]!==t||(this.unpersisted_superprops[n]=e)}),this))},MixpanelLib.prototype.unregister=function(e,t){(t=options_for_register(t)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},MixpanelLib.prototype.identify=function(e,t,n,i,s,a,c,d){var u=this.get_distinct_id();if(e&&u!==e){if("string"==typeof e&&0===e.indexOf(hn))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var l=u;this.register_once({$had_persisted_distinct_id:!0,$device_id:l},"")}e!==u&&e!==this.get_property(an)&&(this.unregister(an),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,i,s,a,c,d),e!==u&&this.track("$identify",{distinct_id:e,$anon_distinct_id:u},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=wr.UUID();this.register_once({distinct_id:hn+e,$device_id:e},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(e,t){if(e===this.get_property(sn))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return wr.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(an,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},(function(){n.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){wr.isObject(e)&&(wr.extend(this.config,e),e.batch_size&&wr.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),Wt.DEBUG=Wt.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(e){return this.config[e]},MixpanelLib.prototype._run_hook=function(e){var t=(this.config.hooks[e]||IDENTITY_FUNC).apply(this,cr.call(arguments,1));return void 0===t&&(this.report_error(e+" hook did not return a value"),t=null),t},MixpanelLib.prototype.get_property=function(e){return this.persistence.load_prop([e])},MixpanelLib.prototype.toString=function(){var e=this.get_config("name");return e!==ln&&(e=ln+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return wr.isBlockedUA(_r)||this._flags.disable_all_events||wr.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&wr.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")&&!wr.cookie.get("mp_optout")||(wr.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 t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t),t?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},MixpanelLib.prototype._gdpr_call_func=function(e,t){return t=wr.extend({track:wr.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")},t),wr.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},MixpanelLib.prototype.opt_in_tracking=function(e){e=wr.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=wr.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=wr.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,t){Ir.error.apply(Ir.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Ir.error(n)}},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=gn,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 Sn={},override_mp_init_func=function(){un.init=function(e,t,n){if(n)return un[n]||(un[n]=Sn[n]=create_mplib(e,t,n),un[n]._loaded()),un[n];var i=un;Sn[ln]?i=Sn[ln]:e&&((i=create_mplib(e,t,ln))._loaded(),Sn[ln]=i),un=i,1===Jr&&($t[ln]=un),wr.each(Sn,(function(e,t){t!==ln&&(un[t]=e)})),un._=wr}};var kn=function init_as_module(e){return load_extra_bundle=e,Jr=0,un=new MixpanelLib,override_mp_init_func(),un.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,vn=!0,mn=!1,wr.each(Sn,(function(e){e._dom_loaded()})))}if(hr.addEventListener)"complete"===hr.readyState?dom_loaded_handler():hr.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(hr.attachEvent){hr.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===$t.frameElement}catch(t){}hr.documentElement.doScroll&&e&&function do_scroll_check(){try{hr.documentElement.doScroll("left")}catch(t){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}wr.register_event($t,"load",dom_loaded_handler,!0)}(),un}((function loadNoop(e,t){t()}));function isReady(){return void 0!==window.mixpanel}const wn={init:function init$1(e,t=!1){return new Promise((n=>{kn.init(e,{debug:t,loaded:()=>{window.mixpanel=kn,n()}})}))},isReady:isReady,track:function track(e,t){isReady()&&kn.track(e,t)},identify:function identify$1(e,t){isReady()&&(kn.identify(e),kn.people.set(t))},attachProperty:function attachProperty(e,t){isReady()&&kn.people.union(e,[t])}},In=["Track Test"];async function trackEvent(e,t){if(!wn.isReady())throw new Error("Mixpanel is not initialized.");try{On.parseEventProps(e,t);const n=!In.includes(e),i=await ot.getFingerprint(n),s={...{"User Fingerprint":i},...t};wn.track(e,s)}catch(Xt){throw console.error("Error tracking event:",Xt),Xt}}const xn=ge.object({}),En=ge.object({mixpanelToken:ge.string().min(1,"Mixpanel token is required"),debug:ge.boolean().optional(),identificationKey:ge.string().min(1,"Identification key is required")}),SchemaErrorFormatter=e=>e.issues.map((e=>{let t="INVALID_FIELD",n="",i="",s="";return"invalid_type"===e.code?(t="TYPE_MISMATCH",n=e.expected,i=e.received,s=`Expected ${n} but received ${i}. Please provide a value of type ${n}.`):"too_small"===e.code?(t="VALUE_TOO_SMALL",s=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(t="VALUE_TOO_BIG",s=`Reduce the value to no more than ${e.maximum}.`):(t="INVALID_FIELD",s="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:t,expected:n,received:i,message:e.message,suggestion:s}})),Cn={"Track Test":xn,Search:be};function validateProps(e,t){try{t.parse(e)}catch(Xt){if(Xt instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Xt)}}throw{message:"Unknown validation error"}}}const On={parseEventProps:function parseEventProps(e,t){const n=Cn[e];if(!n)throw{message:`Event ${e} not found`};try{n.parse(t)}catch(Xt){if(Xt instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Xt)}}throw{message:"Unknown validation error"}}},parseInitProps:function parseInitProps(e){validateProps(e,En)},parseIdentifyProps:function parseIdentifyProps(e){validateProps(e,ye)}},Tn=["firstName","lastName","email","phone"];const Rn={init:async function init(e){On.parseInitProps(e);const{mixpanelToken:t,debug:n=!1,identificationKey:i}=e;await wn.init(t,n);try{await ot.initFingerprint(i)}catch(Xt){console.error("Error initializing identification service:",Xt)}!function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},identify:async function identify(e,t={}){if(!wn.isReady())throw new Error("Analytics service is not initialized");try{if(On.parseIdentifyProps(t),!e)throw new Error("User ID is required");const n=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(((t,n)=>(Tn.includes(n)||(t[n]=e[n]),t)),{})}}(t);wn.identify(e,n);const i=await ot.getFingerprint();i&&wn.attachProperty("Known Fingerprints",i)}catch(Xt){console.error("Error attaching fingerprint:",Xt)}},track:{test:function trackTest(){trackEvent("Track Test",{})},search:function trackSearch(e){trackEvent("Search",e)}}};module.exports=Rn;
|
|
30
|
+
function __awaiter2(e,t,n,i){return new(n||(n=Promise))((function(t,s){function fulfilled(e){try{step(i.next(e))}catch(t){s(t)}}function rejected(e){try{step(i.throw(e))}catch(t){s(t)}}function step(e){e.done?t(e.value):function adopt(e){return e instanceof n?e:new n((function(t){t(e)}))}(e.value).then(fulfilled,rejected)}step((i=i.apply(e,[])).next())}))}for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t="undefined"==typeof Uint8Array?[]:new Uint8Array(256),n=0;n<64;n++)t[e.charCodeAt(n)]=n;var encode2=function(t){var n,i=new Uint8Array(t),s=i.length,a="";for(n=0;n<s;n+=3)a+=e[i[n]>>2],a+=e[(3&i[n])<<4|i[n+1]>>4],a+=e[(15&i[n+1])<<2|i[n+2]>>6],a+=e[63&i[n+2]];return s%3==2?a=a.substring(0,a.length-1)+"=":s%3==1&&(a=a.substring(0,a.length-2)+"=="),a};const i=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:t,bitmap:n,width:c,height:d,dataURLOptions:u}=e.data,l=function getTransparentBlobFor(e,t,n){return __awaiter2(this,0,void 0,(function*(){const i=`${e}-${t}`;if("OffscreenCanvas"in globalThis){if(s.has(i))return s.get(i);const a=new OffscreenCanvas(e,t);a.getContext("2d");const c=yield a.convertToBlob(n),d=yield c.arrayBuffer(),u=encode2(d);return s.set(i,u),u}return""}))}(c,d,u),p=new OffscreenCanvas(c,d);p.getContext("2d").drawImage(n,0,0),n.close();const h=yield p.convertToBlob(u),f=h.type,m=yield h.arrayBuffer(),_=encode2(m);if(!i.has(t)&&(yield l)===_)return i.set(t,_),a.postMessage({id:t});if(i.get(t)===_)return a.postMessage({id:t});a.postMessage({id:t,type:f,base64:_,width:c,height:d}),i.set(t,_)}}))}}()}));class CanvasManager{reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(e,t)=>{!(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(t)};const{sampling:t="all",win:n,blockClass:i,blockSelector:s,recordCanvas:a,dataURLOptions:c}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,a&&"all"===t&&this.initCanvasMutationObserver(n,i,s),a&&"number"==typeof t&&this.initCanvasFPSObserver(t,n,i,s,{dataURLOptions:c})}initCanvasFPSObserver(e,t,n,i,s){const a=initCanvasContextObserver(t,n,i,!0),c=new Map,d=new At;d.onmessage=e=>{const{id:t}=e.data;if(c.set(t,!1),!("base64"in e.data))return;const{base64:n,type:i,width:s,height:a}=e.data;this.mutationCb({id:t,type:Ct["2D"],commands:[{property:"clearRect",args:[0,0,s,a]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:n}],type:i}]},0,0]}]})};const u=1e3/e;let l,p=0;const takeCanvasSnapshots=e=>{p&&e-p<u||(p=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{isBlocked(t,n,i,!0)||e.push(t)})),e})().forEach((e=>__awaiter(this,0,void 0,(function*(){var t;const n=this.mirror.getId(e);if(c.get(n))return;if(0===e.width||0===e.height)return;if(c.set(n,!0),["webgl","webgl2"].includes(e.__context)){const n=e.getContext(e.__context);!1===(null===(t=null==n?void 0:n.getContextAttributes())||void 0===t?void 0:t.preserveDrawingBuffer)&&n.clear(n.COLOR_BUFFER_BIT)}const i=yield createImageBitmap(e);d.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[i])}))))),l=requestAnimationFrame(takeCanvasSnapshots)};l=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{a(),cancelAnimationFrame(l)}}initCanvasMutationObserver(e,t,n){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=initCanvasContextObserver(e,t,n,!1),s=function initCanvas2DMutationObserver(e,t,n,i){const s=[],a=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const d of a)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[d])continue;const a=patch(t.CanvasRenderingContext2D.prototype,d,(function(s){return function(...a){return isBlocked(this.canvas,n,i,!0)||setTimeout((()=>{const n=serializeArgs(a,t,this);e(this.canvas,{type:Ct["2D"],property:d,args:n})}),0),s.apply(this,a)}}));s.push(a)}catch(c){const n=hookSetter(t.CanvasRenderingContext2D.prototype,d,{set(t){e(this.canvas,{type:Ct["2D"],property:d,args:[t],setter:!0})}});s.push(n)}return()=>{s.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n),a=function initCanvasWebGLMutationObserver(e,t,n,i,s){const a=[];return a.push(...patchGLPrototype(t.WebGLRenderingContext.prototype,Ct.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&a.push(...patchGLPrototype(t.WebGL2RenderingContext.prototype,Ct.WebGL2,e,n,i,0,t)),()=>{a.forEach((e=>e()))}}(this.processMutation.bind(this),e,t,n,this.mirror);this.resetObservers=()=>{i(),s(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}startRAFTimestamping(){const setLatestRAFTimestamp=e=>{this.rafStamps.latestId=e,requestAnimationFrame(setLatestRAFTimestamp)};requestAnimationFrame(setLatestRAFTimestamp)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach(((e,t)=>{const n=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,n)})),requestAnimationFrame((()=>this.flushPendingCanvasMutations()))}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;const n=this.pendingCanvasMutations.get(e);if(!n||-1===t)return;const i=n.map((e=>{const t=function __rest(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,["type"]);return t})),{type:s}=n[0];this.mutationCb({id:t,type:s,commands:i}),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,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(0===e.length)return;const n={id:t,styleIds:[]},i=[];for(const s of e){let e;this.styleMirror.has(s)?e=this.styleMirror.getId(s):(e=this.styleMirror.add(s),i.push({styleId:e,rules:Array.from(s.rules||CSSRule,((e,t)=>({rule:stringifyRule(e),index:t})))})),n.styleIds.push(e)}i.length>0&&(n.styles=i),this.adoptedStyleSheetCb(n)}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,t){const n=this.nodeMap.get(e);return n&&Array.from(n).some((e=>e!==t))}add(e,t){this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}clear(){this.nodeMap=new WeakMap}destroy(){this.loop=!1}}function wrapEvent(e){return Object.assign(Object.assign({},e),{timestamp:kt()})}let Lt,jt,Ft,Ut=!1;const qt=function createMirror(){return new Mirror}();function record(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:i,blockClass:s="rr-block",blockSelector:a=null,ignoreClass:c="rr-ignore",ignoreSelector:d=null,maskTextClass:u="rr-mask",maskTextSelector:l=null,inlineStylesheet:p=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:m,maskInputFn:_,maskTextFn:g,hooks:y,packFn:v,sampling:b={},dataURLOptions:S={},mousemoveWait:w,recordDOM:I=!0,recordCanvas:x=!1,recordCrossOriginIframes:C=!1,recordAfter:O=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:T=!1,collectFonts:R=!1,inlineImages:N=!1,plugins:Z,keepIframeSrcFn:P=()=>!1,ignoreCSSAttributes:D=new Set([]),errorHandler:A}=e;!function registerErrorHandler(e){Ot=e}(A);const L=!C||window.parent===window;let j=!1;if(!L)try{window.parent.document&&(j=!1)}catch(G){j=!0}if(L&&!t)throw new Error("emit function is required");void 0!==w&&void 0===b.mousemove&&(b.mousemove=w),qt.reset();const U=!0===h?{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!==f?f:{password:!0},q=!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===m,headMetaDescKeywords:"all"===m}:m||{};let $;!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 t=e[0];if(!(0 in e))throw new TypeError("1 argument is required");do{if(this===t)return!0}while(t=t&&t.parentNode);return!1})}();let B=0;const eventProcessor=e=>{for(const t of Z||[])t.eventProcessor&&(e=t.eventProcessor(e));return v&&!j&&(e=v(e)),e};Lt=(e,s)=>{var a;if(!(null===(a=Tt[0])||void 0===a?void 0:a.isFrozen())||e.type===wt.FullSnapshot||e.type===wt.IncrementalSnapshot&&e.data.source===It.Mutation||Tt.forEach((e=>e.unfreeze())),L)null==t||t(eventProcessor(e),s);else if(j){const t={type:"rrweb",event:eventProcessor(e),origin:window.location.origin,isCheckout:s};window.parent.postMessage(t,"*")}if(e.type===wt.FullSnapshot)$=e,B=0;else if(e.type===wt.IncrementalSnapshot){if(e.data.source===It.Mutation&&e.data.isAttachIframe)return;B++;const t=i&&B>=i,s=n&&e.timestamp-$.timestamp>n;(t||s)&&jt(!0)}};const wrappedMutationEmit=e=>{Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.Mutation},e)}))},wrappedScrollEmit=e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.Scroll},e)})),wrappedCanvasMutationEmit=e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.CanvasMutation},e)})),z=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.AdoptedStyleSheet},e)}))}),W=new IframeManager({mirror:qt,mutationCb:wrappedMutationEmit,stylesheetManager:z,recordCrossOriginIframes:C,wrappedEmit:Lt});for(const Y of Z||[])Y.getMirror&&Y.getMirror({nodeMirror:qt,crossOriginIframeMirror:W.crossOriginIframeMirror,crossOriginIframeStyleMirror:W.crossOriginIframeStyleMirror});const K=new ProcessedNodeManager;Ft=new CanvasManager({recordCanvas:x,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:s,blockSelector:a,mirror:qt,sampling:b.canvas,dataURLOptions:S});const H=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:l,inlineStylesheet:p,maskInputOptions:U,dataURLOptions:S,maskTextFn:g,maskInputFn:_,recordCanvas:x,inlineImages:N,sampling:b,slimDOMOptions:q,iframeManager:W,stylesheetManager:z,canvasManager:Ft,keepIframeSrcFn:P,processedNodeManager:K},mirror:qt});jt=(e=!1)=>{if(!I)return;Lt(wrapEvent({type:wt.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),z.reset(),H.init(),Tt.forEach((e=>e.lock()));const t=function snapshot(e,t){const{mirror:n=new Mirror,blockClass:i="rr-block",blockSelector:s=null,maskTextClass:a="rr-mask",maskTextSelector:c=null,inlineStylesheet:d=!0,inlineImages:u=!1,recordCanvas:l=!1,maskAllInputs:p=!1,maskTextFn:h,maskInputFn:f,slimDOM:m=!1,dataURLOptions:_,preserveWhiteSpace:g,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:w,keepIframeSrcFn:I=()=>!1}=t||{};return serializeNodeWithId(e,{doc:e,mirror:n,blockClass:i,blockSelector:s,maskTextClass:a,maskTextSelector:c,skipChild:!1,inlineStylesheet:d,maskInputOptions:!0===p?{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===p?{password:!0}:p,maskTextFn:h,maskInputFn:f,slimDOMOptions:!0===m||"all"===m?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===m,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===m?{}:m,dataURLOptions:_,inlineImages:u,recordCanvas:l,preserveWhiteSpace:g,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:w,keepIframeSrcFn:I,newlyAddedElement:!1})}(document,{mirror:qt,blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:l,inlineStylesheet:p,maskAllInputs:U,maskTextFn:g,slimDOM:q,dataURLOptions:S,recordCanvas:x,inlineImages:N,onSerialize:e=>{isSerializedIframe(e,qt)&&W.addIframe(e),isSerializedStylesheet(e,qt)&&z.trackLinkElement(e),hasShadowRoot(e)&&H.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{W.attachIframe(e,t),H.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{z.attachLinkElement(e,t)},keepIframeSrcFn:P});if(!t)return console.warn("Failed to snapshot the document");Lt(wrapEvent({type:wt.FullSnapshot,data:{node:t,initialOffset:getWindowScroll(window)}}),e),Tt.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&z.adoptStyleSheets(document.adoptedStyleSheets,qt.getId(document))};try{const e=[],observe=e=>{var t;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,t)=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.ViewportResize},e)})),inputCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.Input},e)})),mediaInteractionCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.MediaInteraction},e)})),styleSheetRuleCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.StyleSheetRule},e)})),styleDeclarationCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.Font},e)})),selectionCb:e=>{Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.Selection},e)}))},customElementCb:e=>{Lt(wrapEvent({type:wt.IncrementalSnapshot,data:Object.assign({source:It.CustomElement},e)}))},blockClass:s,ignoreClass:c,ignoreSelector:d,maskTextClass:u,maskTextSelector:l,maskInputOptions:U,inlineStylesheet:p,sampling:b,recordDOM:I,recordCanvas:x,inlineImages:N,userTriggeredOnInput:T,collectFonts:R,doc:e,maskInputFn:_,maskTextFn:g,keepIframeSrcFn:P,blockSelector:a,slimDOMOptions:q,dataURLOptions:S,mirror:qt,iframeManager:W,stylesheetManager:z,shadowDomManager:H,processedNodeManager:K,canvasManager:Ft,ignoreCSSAttributes:D,plugins:(null===(t=null==Z?void 0:Z.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>Lt(wrapEvent({type:wt.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},y)};W.addLoadListener((t=>{try{e.push(observe(t.contentDocument))}catch(Xt){console.warn(Xt)}}));const init2=()=>{jt(),e.push(observe(document)),Ut=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{Lt(wrapEvent({type:wt.DomContentLoaded,data:{}})),"DOMContentLoaded"===O&&init2()}))),e.push(on("load",(()=>{Lt(wrapEvent({type:wt.Load,data:{}})),"load"===O&&init2()}),window))),()=>{e.forEach((e=>e())),K.destroy(),Ut=!1,function unregisterErrorHandler(){Ot=void 0}()}}catch(Xt){console.warn(Xt)}}record.addCustomEvent=(e,t)=>{if(!Ut)throw new Error("please add custom event after start recording");Lt(wrapEvent({type:wt.Custom,data:{tag:e,payload:t}}))},record.freezePage=()=>{Tt.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!Ut)throw new Error("please take full snapshot after start recording");jt(e)},record.mirror=qt;var $t,Bt=(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))(Bt||{}),zt=(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))(zt||{}),Wt={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var Vt={hostname:""};$t={navigator:{userAgent:"",onLine:!0},document:{location:Vt,referrer:""},screen:{width:0,height:0},location:Vt}}else $t=window;var Kt,Ht,Gt,Yt,Jt,Xt,Qt,er,tr,rr,nr=864e5,ir=8e3,or=Array.prototype,sr=Function.prototype,ar=Object.prototype,cr=or.slice,dr=ar.toString,ur=ar.hasOwnProperty,lr=$t.console,pr=$t.navigator,hr=$t.document,fr=$t.opera,mr=$t.screen,_r=pr.userAgent,gr=sr.bind,yr=or.forEach,vr=or.indexOf,br=or.map,Sr=Array.isArray,kr={},wr={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},Ir={log:function(){if(Wt.DEBUG&&!wr.isUndefined(lr)&&lr)try{lr.log.apply(lr,arguments)}catch(e){wr.each(arguments,(function(e){lr.log(e)}))}},warn:function(){if(Wt.DEBUG&&!wr.isUndefined(lr)&&lr){var e=["Mixpanel warning:"].concat(wr.toArray(arguments));try{lr.warn.apply(lr,e)}catch(t){wr.each(e,(function(e){lr.warn(e)}))}}},error:function(){if(Wt.DEBUG&&!wr.isUndefined(lr)&&lr){var e=["Mixpanel error:"].concat(wr.toArray(arguments));try{lr.error.apply(lr,e)}catch(t){wr.each(e,(function(e){lr.error(e)}))}}},critical:function(){if(!wr.isUndefined(lr)&&lr){var e=["Mixpanel error:"].concat(wr.toArray(arguments));try{lr.error.apply(lr,e)}catch(t){wr.each(e,(function(e){lr.error(e)}))}}}},log_func_with_prefix=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(Ir,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(Ir.log,e),error:log_func_with_prefix(Ir.error,e),critical:log_func_with_prefix(Ir.critical,e)}};wr.bind=function(e,t){var n,i;if(gr&&e.bind===gr)return gr.apply(e,cr.call(arguments,1));if(!wr.isFunction(e))throw new TypeError;return n=cr.call(arguments,2),i=function(){if(!(this instanceof i))return e.apply(t,n.concat(cr.call(arguments)));var s={};s.prototype=e.prototype;var a=new s;s.prototype=null;var c=e.apply(a,n.concat(cr.call(arguments)));return Object(c)===c?c:a},i},wr.each=function(e,t,n){if(null!=e)if(yr&&e.forEach===yr)e.forEach(t,n);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(i in e&&t.call(n,e[i],i,e)===kr)return}else for(var a in e)if(ur.call(e,a)&&t.call(n,e[a],a,e)===kr)return},wr.extend=function(e){return wr.each(cr.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},wr.isArray=Sr||function(e){return"[object Array]"===dr.call(e)},wr.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},wr.isArguments=function(e){return!(!e||!ur.call(e,"callee"))},wr.toArray=function(e){return e?e.toArray?e.toArray():wr.isArray(e)||wr.isArguments(e)?cr.call(e):wr.values(e):[]},wr.map=function(e,t,n){if(br&&e.map===br)return e.map(t,n);var i=[];return wr.each(e,(function(e){i.push(t.call(n,e))})),i},wr.keys=function(e){var t=[];return null===e||wr.each(e,(function(e,n){t[t.length]=n})),t},wr.values=function(e){var t=[];return null===e||wr.each(e,(function(e){t[t.length]=e})),t},wr.include=function(e,t){var n=!1;return null===e?n:vr&&e.indexOf===vr?-1!=e.indexOf(t):(wr.each(e,(function(e){if(n||(n=e===t))return kr})),n)},wr.includes=function(e,t){return-1!==e.indexOf(t)},wr.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},wr.isObject=function(e){return e===Object(e)&&!wr.isArray(e)},wr.isEmptyObject=function(e){if(wr.isObject(e)){for(var t in e)if(ur.call(e,t))return!1;return!0}return!1},wr.isUndefined=function(e){return void 0===e},wr.isString=function(e){return"[object String]"==dr.call(e)},wr.isDate=function(e){return"[object Date]"==dr.call(e)},wr.isNumber=function(e){return"[object Number]"==dr.call(e)},wr.isElement=function(e){return!(!e||1!==e.nodeType)},wr.encodeDates=function(e){return wr.each(e,(function(t,n){wr.isDate(t)?e[n]=wr.formatDate(t):wr.isObject(t)&&(e[n]=wr.encodeDates(t))})),e},wr.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},wr.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())},wr.strip_empty_properties=function(e){var t={};return wr.each(e,(function(e,n){wr.isString(e)&&e.length>0&&(t[n]=e)})),t},wr.truncate=function(e,t){var n;return"string"==typeof e?n=e.slice(0,t):wr.isArray(e)?(n=[],wr.each(e,(function(e){n.push(wr.truncate(e,t))}))):wr.isObject(e)?(n={},wr.each(e,(function(e,i){n[i]=wr.truncate(e,t)}))):n=e,n},wr.JSONEncode=function(){return function(e){var quote=function(e){var t=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return t.lastIndex=0,t.test(e)?'"'+e.replace(t,(function(e){var t=n[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}))+'"':'"'+e+'"'},str=function(e,t){var n="",i=0,s="",a="",c=0,d=n,u=[],l=t[e];switch(l&&"object"==typeof l&&"function"==typeof l.toJSON&&(l=l.toJSON(e)),typeof l){case"string":return quote(l);case"number":return isFinite(l)?String(l):"null";case"boolean":case"null":return String(l);case"object":if(!l)return"null";if(n+=" ",u=[],"[object Array]"===dr.apply(l)){for(c=l.length,i=0;i<c;i+=1)u[i]=str(i,l)||"null";return a=0===u.length?"[]":n?"[\n"+n+u.join(",\n"+n)+"\n"+d+"]":"["+u.join(",")+"]",n=d,a}for(s in l)ur.call(l,s)&&(a=str(s,l))&&u.push(quote(s)+(n?": ":":")+a);return a=0===u.length?"{}":n?"{"+u.join(",")+d+"}":"{"+u.join(",")+"}",n=d,a}};return str("",{"":e})}}(),wr.JSONDecode=(Jt={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Xt=function(e){var t=new SyntaxError(e);throw t.at=Kt,t.text=Gt,t},Qt=function(e){return e&&e!==Ht&&Xt("Expected '"+e+"' instead of '"+Ht+"'"),Ht=Gt.charAt(Kt),Kt+=1,Ht},er=function(){var e,t="";for("-"===Ht&&(t="-",Qt("-"));Ht>="0"&&Ht<="9";)t+=Ht,Qt();if("."===Ht)for(t+=".";Qt()&&Ht>="0"&&Ht<="9";)t+=Ht;if("e"===Ht||"E"===Ht)for(t+=Ht,Qt(),"-"!==Ht&&"+"!==Ht||(t+=Ht,Qt());Ht>="0"&&Ht<="9";)t+=Ht,Qt();if(e=+t,isFinite(e))return e;Xt("Bad number")},tr=function(){var e,t,n,i="";if('"'===Ht)for(;Qt();){if('"'===Ht)return Qt(),i;if("\\"===Ht)if(Qt(),"u"===Ht){for(n=0,t=0;t<4&&(e=parseInt(Qt(),16),isFinite(e));t+=1)n=16*n+e;i+=String.fromCharCode(n)}else{if("string"!=typeof Jt[Ht])break;i+=Jt[Ht]}else i+=Ht}Xt("Bad string")},rr=function(){for(;Ht&&Ht<=" ";)Qt()},Yt=function(){switch(rr(),Ht){case"{":return function(){var e,t={};if("{"===Ht){if(Qt("{"),rr(),"}"===Ht)return Qt("}"),t;for(;Ht;){if(e=tr(),rr(),Qt(":"),Object.hasOwnProperty.call(t,e)&&Xt('Duplicate key "'+e+'"'),t[e]=Yt(),rr(),"}"===Ht)return Qt("}"),t;Qt(","),rr()}}Xt("Bad object")}();case"[":return function(){var e=[];if("["===Ht){if(Qt("["),rr(),"]"===Ht)return Qt("]"),e;for(;Ht;){if(e.push(Yt()),rr(),"]"===Ht)return Qt("]"),e;Qt(","),rr()}}Xt("Bad array")}();case'"':return tr();case"-":return er();default:return Ht>="0"&&Ht<="9"?er():function(){switch(Ht){case"t":return Qt("t"),Qt("r"),Qt("u"),Qt("e"),!0;case"f":return Qt("f"),Qt("a"),Qt("l"),Qt("s"),Qt("e"),!1;case"n":return Qt("n"),Qt("u"),Qt("l"),Qt("l"),null}Xt('Unexpected "'+Ht+'"')}()}},function(e){var t;return Gt=e,Kt=0,Ht=" ",t=Yt(),rr(),Ht&&Xt("Syntax error"),t}),wr.base64Encode=function(e){var t,n,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d=0,u=0,l="",p=[];if(!e)return e;e=wr.utf8Encode(e);do{t=(a=e.charCodeAt(d++)<<16|e.charCodeAt(d++)<<8|e.charCodeAt(d++))>>18&63,n=a>>12&63,i=a>>6&63,s=63&a,p[u++]=c.charAt(t)+c.charAt(n)+c.charAt(i)+c.charAt(s)}while(d<e.length);switch(l=p.join(""),e.length%3){case 1:l=l.slice(0,-2)+"==";break;case 2:l=l.slice(0,-1)+"="}return l},wr.utf8Encode=function(e){var t,n,i,s,a="";for(t=n=0,i=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<i;s++){var c=e.charCodeAt(s),d=null;c<128?n++:d=c>127&&c<2048?String.fromCharCode(c>>6|192,63&c|128):String.fromCharCode(c>>12|224,c>>6&63|128,63&c|128),null!==d&&(n>t&&(a+=e.substring(t,n)),a+=d,t=n=s+1)}return n>t&&(a+=e.substring(t,e.length)),a},wr.UUID=function(){var T2=function(){var e,t=1*new Date;if($t.performance&&$t.performance.now)e=$t.performance.now();else for(e=0;t==1*new Date;)e++;return t.toString(16)+Math.floor(e).toString(16)};return function(){var e=(mr.height*mr.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=_r,i=[],s=0;function xor(e,t){var n,s=0;for(n=0;n<t.length;n++)s|=i[n]<<8*n;return e^s}for(e=0;e<n.length;e++)t=n.charCodeAt(e),i.unshift(255&t),i.length>=4&&(s=xor(s,i),i=[]);return i.length>0&&(s=xor(s,i)),s.toString(16)}()+"-"+e+"-"+T2()}}();var xr=["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"];wr.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<xr.length;t++)if(-1!==e.indexOf(xr[t]))return!0;return!1},wr.HTTPBuildQuery=function(e,t){var n,i,s=[];return wr.isUndefined(t)&&(t="&"),wr.each(e,(function(e,t){n=encodeURIComponent(e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+n})),s.join(t)},wr.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n=new RegExp("[\\?&]"+t+"=([^&#]*)").exec(e);if(null===n||n&&"string"!=typeof n[1]&&n[1].length)return"";var i=n[1];try{i=decodeURIComponent(i)}catch(s){Ir.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},wr.cookie={get:function(e){for(var t=e+"=",n=hr.cookie.split(";"),i=0;i<n.length;i++){for(var s=n[i];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}return null},parse:function(e){var t;try{t=wr.JSONDecode(wr.cookie.get(e))||{}}catch(n){}return t},set_seconds:function(e,t,n,i,s,a,c){var d="",u="",l="";if(c)d="; domain="+c;else if(i){var p=extract_domain(hr.location.hostname);d=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+1e3*n),u="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure"),hr.cookie=e+"="+encodeURIComponent(t)+u+"; path=/"+d+l},set:function(e,t,n,i,s,a,c){var d="",u="",l="";if(c)d="; domain="+c;else if(i){var p=extract_domain(hr.location.hostname);d=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+24*n*60*60*1e3),u="; expires="+h.toGMTString()}a&&(s=!0,l="; SameSite=None"),s&&(l+="; secure");var f=e+"="+encodeURIComponent(t)+u+"; path=/"+d+l;return hr.cookie=f,f},remove:function(e,t,n){wr.cookie.set(e,"",-1,t,!1,!1,n)}};var Er=null,localStorageSupported=function(e,t){if(null!==Er&&!t)return Er;var n=!0;try{e=e||window.localStorage;var i="__mplss_"+cheap_guid(8);e.setItem(i,"xyz"),"xyz"!==e.getItem(i)&&(n=!1),e.removeItem(i)}catch(s){n=!1}return Er=n,n};wr.localStorage={is_supported:function(e){var t=localStorageSupported(null,e);return t||Ir.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){Ir.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(t){wr.localStorage.error(t)}return null},parse:function(e){try{return wr.JSONDecode(wr.localStorage.get(e))||{}}catch(t){}return null},set:function(e,t){try{window.localStorage.setItem(e,t)}catch(n){wr.localStorage.error(n)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(t){wr.localStorage.error(t)}}},wr.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,t,n,i,s){if(e)if(e.addEventListener&&!i)e.addEventListener(t,n,!!s);else{var a="on"+t,c=e[a];e[a]=function makeHandler(e,t,n){var handler=function(i){if(i=i||fixEvent(window.event)){var s,a,c=!0;return wr.isFunction(n)&&(s=n(i)),a=t.call(e,i),!1!==s&&!1!==a||(c=!1),c}};return handler}(e,n,c)}else Ir.error("No valid element provided to register_event")}}();var Cr=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');wr.dom_query=function(){function getAllChildren(e){return e.all?e.all:e.getElementsByTagName("*")}var e=/[\t\r\n]/g;function hasClass(t,n){var i=" "+n+" ";return(" "+t.className+" ").replace(e," ").indexOf(i)>=0}function getElementsBySelector(e){if(!hr.getElementsByTagName)return[];var t,n,i,s,a,c,d,u,l,p,h=e.split(" "),f=[hr];for(c=0;c<h.length;c++)if((t=h[c].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){i=(n=t.split("#"))[0];var m=n[1],_=hr.getElementById(m);if(!_||i&&_.nodeName.toLowerCase()!=i)return[];f=[_]}else if(t.indexOf(".")>-1){i=(n=t.split("."))[0];var g=n[1];for(i||(i="*"),s=[],a=0,d=0;d<f.length;d++)for(l="*"==i?getAllChildren(f[d]):f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];for(f=[],p=0,d=0;d<s.length;d++)s[d].className&&wr.isString(s[d].className)&&hasClass(s[d],g)&&(f[p++]=s[d])}else{var y=t.match(Cr);if(y){i=y[1];var v,b=y[2],S=y[3],w=y[4];for(i||(i="*"),s=[],a=0,d=0;d<f.length;d++)for(l="*"==i?getAllChildren(f[d]):f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];switch(f=[],p=0,S){case"=":v=function(e){return e.getAttribute(b)==w};break;case"~":v=function(e){return e.getAttribute(b).match(new RegExp("\\b"+w+"\\b"))};break;case"|":v=function(e){return e.getAttribute(b).match(new RegExp("^"+w+"-?"))};break;case"^":v=function(e){return 0===e.getAttribute(b).indexOf(w)};break;case"$":v=function(e){return e.getAttribute(b).lastIndexOf(w)==e.getAttribute(b).length-w.length};break;case"*":v=function(e){return e.getAttribute(b).indexOf(w)>-1};break;default:v=function(e){return e.getAttribute(b)}}for(f=[],p=0,d=0;d<s.length;d++)v(s[d])&&(f[p++]=s[d])}else{for(i=t,s=[],a=0,d=0;d<f.length;d++)for(l=f[d].getElementsByTagName(i),u=0;u<l.length;u++)s[a++]=l[u];f=s}}return f}return function(e){return wr.isElement(e)?[e]:wr.isObject(e)&&!wr.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var Or=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],Tr=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];wr.info={campaignParams:function(e){var t="",n={};return wr.each(Or,(function(i){(t=wr.getQueryParam(hr.URL,i)).length?n[i]=t:void 0!==e&&(n[i]=e)})),n},clickParams:function(){var e="",t={};return wr.each(Tr,(function(n){(e=wr.getQueryParam(hr.URL,n)).length&&(t[n]=e)})),t},marketingParams:function(){return wr.extend(wr.info.campaignParams(),wr.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 t=wr.info.searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(null!==t){i.$search_engine=t;var s=wr.getQueryParam(e,n);s.length&&(i.mp_keyword=s)}return i},browser:function(e,t,n){return t=t||"",n||wr.includes(e," OPR/")?wr.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":wr.includes(e,"IEMobile")||wr.includes(e,"WPDesktop")?"Internet Explorer Mobile":wr.includes(e,"SamsungBrowser/")?"Samsung Internet":wr.includes(e,"Edge")||wr.includes(e,"Edg/")?"Microsoft Edge":wr.includes(e,"FBIOS")?"Facebook Mobile":wr.includes(e,"Chrome")?"Chrome":wr.includes(e,"CriOS")?"Chrome iOS":wr.includes(e,"UCWEB")||wr.includes(e,"UCBrowser")?"UC Browser":wr.includes(e,"FxiOS")?"Firefox iOS":wr.includes(t,"Apple")?wr.includes(e,"Mobile")?"Mobile Safari":"Safari":wr.includes(e,"Android")?"Android Mobile":wr.includes(e,"Konqueror")?"Konqueror":wr.includes(e,"Firefox")?"Firefox":wr.includes(e,"MSIE")||wr.includes(e,"Trident/")?"Internet Explorer":wr.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var i={"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+)?)/}[wr.info.browser(e,t,n)];if(void 0===i)return null;var s=e.match(i);return s?parseFloat(s[s.length-2]):null},os:function(){var e=_r;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 t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return $t.location.href},properties:function(e){return"object"!=typeof e&&(e={}),wr.extend(wr.strip_empty_properties({$os:wr.info.os(),$browser:wr.info.browser(_r,pr.vendor,fr),$referrer:hr.referrer,$referring_domain:wr.info.referringDomain(hr.referrer),$device:wr.info.device(_r)}),{$current_url:wr.info.currentUrl(),$browser_version:wr.info.browserVersion(_r,pr.vendor,fr),$screen_height:mr.height,$screen_width:mr.width,mp_lib:"web",$lib_version:Wt.LIB_VERSION,$insert_id:cheap_guid(),time:wr.timestamp()/1e3},wr.strip_empty_properties(e))},people_properties:function(){return wr.extend(wr.strip_empty_properties({$os:wr.info.os(),$browser:wr.info.browser(_r,pr.vendor,fr)}),{$browser_version:wr.info.browserVersion(_r,pr.vendor,fr)})},mpPageViewProperties:function(){return wr.strip_empty_properties({current_page_title:hr.title,current_domain:$t.location.hostname,current_url_path:$t.location.pathname,current_url_protocol:$t.location.protocol,current_url_search:$t.location.search})}};var cheap_guid=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},Rr=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Mr=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var t=Mr,n=e.split("."),i=n[n.length-1];(i.length>4||"com"===i||"org"===i)&&(t=Rr);var s=e.match(t);return s?s[0]:""},Nr=null,Zr=null;"undefined"!=typeof JSON&&(Nr=JSON.stringify,Zr=JSON.parse),Nr=Nr||wr.JSONEncode,Zr=Zr||wr.JSONDecode,wr.toArray=wr.toArray,wr.isObject=wr.isObject,wr.JSONEncode=wr.JSONEncode,wr.JSONDecode=wr.JSONDecode,wr.isBlockedUA=wr.isBlockedUA,wr.isEmptyObject=wr.isEmptyObject,wr.info=wr.info,wr.info.device=wr.info.device,wr.info.browser=wr.info.browser,wr.info.browserVersion=wr.info.browserVersion,wr.info.properties=wr.info.properties;var Pr="__mp_opt_in_out_";function optIn(e,t){_optInOut(!0,e,t)}function optOut(e,t){_optInOut(!1,e,t)}function hasOptedIn(e,t){return"1"===_getStorageValue(e,t)}function hasOptedOut(e,t){if(function _hasDoNotTrackFlagOn(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||$t,n=t.navigator||{},i=!1;return wr.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){wr.includes([!0,1,"1","yes"],e)&&(i=!0)})),i}(t))return Ir.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 n="0"===_getStorageValue(e,t);return n&&Ir.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}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,t){_getStorage(t=t||{}).remove(_getStorageKey(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function _getStorage(e){return"localStorage"===(e=e||{}).persistenceType?wr.localStorage:wr.cookie}function _getStorageKey(e,t){return((t=t||{}).persistencePrefix||Pr)+e}function _getStorageValue(e,t){return _getStorage(t).get(_getStorageKey(e,t))}function _optInOut(e,t,n){wr.isString(t)&&t.length?(_getStorage(n=n||{}).set(_getStorageKey(t,n),e?1:0,wr.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&e&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})):Ir.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token")}function _addOptOutCheck(e,t){return function(){var n=!1;try{var i=t.call(this,"token"),s=t.call(this,"ignore_dnt"),a=t.call(this,"opt_out_tracking_persistence_type"),c=t.call(this,"opt_out_tracking_cookie_prefix"),d=t.call(this,"window");i&&(n=hasOptedOut(i,{ignoreDnt:s,persistenceType:a,persistencePrefix:c,window:d}))}catch(l){Ir.error("Unexpected error when checking tracking opt-out status: "+l)}if(!n)return e.apply(this,arguments);var u=arguments[arguments.length-1];"function"==typeof u&&u(0)}}var Dr=console_with_prefix("lock"),SharedLock=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3};SharedLock.prototype.withLock=function(e,t,n){n||"function"==typeof t||(n=t,t=null);var i=n||(new Date).getTime()+"|"+Math.random(),s=(new Date).getTime(),a=this.storageKey,c=this.pollIntervalMS,d=this.timeoutMS,u=this.storage,l=a+":X",p=a+":Y",h=a+":Z",reportError=function(e){t&&t(e)},delay=function(e){if((new Date).getTime()-s>d)return Dr.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+i+"]"),u.removeItem(h),u.removeItem(p),void loop();setTimeout((function(){try{e()}catch(t){reportError(t)}}),c*(Math.random()+.1))},waitFor=function(e,t){e()?t():delay((function(){waitFor(e,t)}))},getSetY=function(){var e=u.getItem(p);if(e&&e!==i)return!1;if(u.setItem(p,i),u.getItem(p)===i)return!0;if(!localStorageSupported(u,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){u.setItem(l,i),waitFor(getSetY,(function(){u.getItem(l)!==i?delay((function(){u.getItem(p)===i?waitFor((function(){return!u.getItem(h)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){u.setItem(h,"1");try{e()}finally{u.removeItem(h),u.getItem(p)===i&&u.removeItem(p),u.getItem(l)===i&&u.removeItem(l)}};try{if(!localStorageSupported(u,!0))throw new Error("localStorage support check failed");loop()}catch(f){reportError(f)}};var Ar=console_with_prefix("batch"),RequestQueue=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.reportError=t.errorReporter||wr.bind(Ar.error,Ar),this.lock=new SharedLock(e,{storage:this.storage}),this.usePersistence=t.usePersistence,this.pid=t.pid||null,this.memQueue=[]};RequestQueue.prototype.enqueue=function(e,t,n){var i={id:cheap_guid(),flushAfter:(new Date).getTime()+2*t,payload:e};this.usePersistence?this.lock.withLock(wr.bind((function lockAcquired(){var t;try{var s=this.readFromStorage();s.push(i),(t=this.saveToStorage(s))&&this.memQueue.push(i)}catch(a){this.reportError("Error enqueueing item",e),t=!1}n&&n(t)}),this),wr.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),n&&n(!1)}),this),this.pid):(this.memQueue.push(i),n&&n(!0))},RequestQueue.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);if(this.usePersistence&&t.length<e){var n=this.readFromStorage();if(n.length){var i={};wr.each(t,(function(e){i[e.id]=!0}));for(var s=0;s<n.length;s++){var a=n[s];if((new Date).getTime()>a.flushAfter&&!i[a.id]&&(a.orphaned=!0,t.push(a),t.length>=e))break}}}return t};var filterOutIDsAndInvalid=function(e,t){var n=[];return wr.each(e,(function(e){e.id&&!t[e.id]&&n.push(e)})),n};RequestQueue.prototype.removeItemsByID=function(e,t){var n={};if(wr.each(e,(function(e){n[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,n),this.usePersistence){var i=wr.bind((function(){var t;try{var i=this.readFromStorage();if(i=filterOutIDsAndInvalid(i,n),t=this.saveToStorage(i)){i=this.readFromStorage();for(var s=0;s<i.length;s++){var a=i[s];if(a.id&&n[a.id])return this.reportError("Item not removed from storage"),!1}}}catch(c){this.reportError("Error removing items",e),t=!1}return t}),this);this.lock.withLock((function lockAcquired(){var e=i();t&&t(e)}),wr.bind((function lockFailure(e){var n=!1;if(this.reportError("Error acquiring storage lock",e),!localStorageSupported(this.storage,!0)&&!(n=i()))try{this.storage.removeItem(this.storageKey)}catch(s){this.reportError("Error clearing queue",s)}t&&t(n)}),this),this.pid)}else t&&t(!0)};var updatePayloads=function(e,t){var n=[];return wr.each(e,(function(e){var i=e.id;if(i in t){var s=t[i];null!==s&&(e.payload=s,n.push(e))}else n.push(e)})),n};RequestQueue.prototype.updatePayloads=function(e,t){this.memQueue=updatePayloads(this.memQueue,e),this.usePersistence?this.lock.withLock(wr.bind((function lockAcquired(){var n;try{var i=this.readFromStorage();i=updatePayloads(i,e),n=this.saveToStorage(i)}catch(s){this.reportError("Error updating items",e),n=!1}t&&t(n)}),this),wr.bind((function lockFailure(e){this.reportError("Error acquiring storage lock",e),t&&t(!1)}),this),this.pid):t&&t(!0)},RequestQueue.prototype.readFromStorage=function(){var e;try{(e=this.storage.getItem(this.storageKey))&&(e=Zr(e),wr.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null))}catch(t){this.reportError("Error retrieving queue",t),e=null}return e||[]},RequestQueue.prototype.saveToStorage=function(e){try{return this.storage.setItem(this.storageKey,Nr(e)),!0}catch(t){return this.reportError("Error saving queue",t),!1}},RequestQueue.prototype.clear=function(){this.memQueue=[],this.usePersistence&&this.storage.removeItem(this.storageKey)};var Lr=console_with_prefix("batch"),RequestBatcher=function(e,t){this.errorReporter=t.errorReporter,this.queue=new RequestQueue(e,{errorReporter:wr.bind(this.reportError,this),storage:t.storage,usePersistence:t.usePersistence}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.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=t.flushOnlyOnInterval||!1};RequestBatcher.prototype.enqueue=function(e,t){this.queue.enqueue(e,this.flushInterval,t)},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(wr.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void Lr.log("Flush: Request already in progress");e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=(new Date).getTime(),i=this.batchSize,s=this.queue.fillBatch(i),a=s.length===i,c=[],d={};if(wr.each(s,(function(e){var t=e.payload;if(this.beforeSendHook&&!e.orphaned&&(t=this.beforeSendHook(t)),t){t.event&&t.properties&&(t.properties=wr.extend({},t.properties,{mp_sent_by_lib_version:Wt.LIB_VERSION}));var n=!0,i=e.id;i?(this.itemIdsSentSuccessfully[i]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[i]}),n=!1):this.reportError("[dupe] found item with no ID",{item:e}),n&&c.push(t)}d[e.id]=t}),this),c.length<1)return void this.resetFlush();this.requestInProgress=!0;var u=wr.bind((function(c){this.requestInProgress=!1;try{var u=!1;if(e.unloading)this.queue.updatePayloads(d);else if(wr.isObject(c)&&"timeout"===c.error&&(new Date).getTime()-n>=t)this.reportError("Network timeout; retrying"),this.flush();else if(wr.isObject(c)&&(c.httpStatusCode>=500||429===c.httpStatusCode||c.httpStatusCode<=0&&(h=$t.navigator.onLine,!wr.isUndefined(h)&&!h)||"timeout"===c.error)){var l=2*this.flushInterval;c.retryAfter&&(l=1e3*parseInt(c.retryAfter,10)||l),l=Math.min(6e5,l),this.reportError("Error; retry in "+l+" ms"),this.scheduleFlush(l)}else if(wr.isObject(c)&&413===c.httpStatusCode)if(s.length>1){var p=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,p,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(),u=!0;else u=!0;u&&(this.queue.removeItemsByID(wr.map(s,(function(e){return e.id})),wr.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)),wr.each(s,wr.bind((function(e){var t=e.id;t?(this.itemIdsSentSuccessfully[t]=this.itemIdsSentSuccessfully[t]||0,this.itemIdsSentSuccessfully[t]++,this.itemIdsSentSuccessfully[t]>5&&this.reportError("[dupe] item ID sent too many times",{item:e,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[t]})):this.reportError("[dupe] found item with no ID while removing",{item:e})}),this)))}catch(f){this.reportError("Error handling API response",f),this.resetFlush()}var h}),this),l={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};e.unloading&&(l.transport="sendBeacon"),Lr.log("MIXPANEL REQUEST:",c),this.sendRequest(c,l,u)}catch(p){this.reportError("Error flushing request queue",p),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,t){if(Lr.error.apply(Lr.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){Lr.error(n)}};var jr=console_with_prefix("recorder"),Fr=$t.CompressionStream,Ur={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},qr=new Set([zt.MouseMove,zt.MouseInteraction,zt.Scroll,zt.ViewportResize,zt.Input,zt.TouchMove,zt.MediaInteraction,zt.Drag,zt.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:Ur,sendRequestFunc:wr.bind(this.flushEventsWithOptOut,this),errorReporter:wr.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,jr.critical("record_max_ms cannot be greater than "+nr+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>ir&&(this.recordMinMs=ir,jr.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=wr.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=wr.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(wr.bind((function(){jr.log("Idle timeout reached, restarting recording."),this.resetRecording()}),this),this.get_config("record_idle_timeout_ms"))}),this),n=this.get_config("record_block_selector");""!==n&&null!==n||(n=void 0),this._stopRecording=record({emit:wr.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===Bt.IncrementalSnapshot&&qr.has(e.data.source)}(e)&&(this.batcher.stopped&&(new Date).getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t())}),this),blockClass:this.get_config("record_block_class"),blockSelector:n,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")}),t(),this.maxTimeoutId=setTimeout(wr.bind(this.resetRecording,this),this.recordMaxMs)}else jr.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,t,n){this._flushEvents(e,t,n,wr.bind(this._onOptOut,this))},MixpanelRecorder.prototype._onOptOut=function(e){0===e&&(this.recEvents=[],this.stopRecording())},MixpanelRecorder.prototype._sendRequest=function(e,t,n,i){var s=wr.bind((function(t,n){200===t.status&&this.replayId===e&&this.seqNo++,i({status:0,httpStatusCode:t.status,responseBody:n,retryAfter:t.headers.get("Retry-After")})}),this);$t.fetch(this.get_config("api_host")+"/"+this.get_config("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.get_config("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then((function(e){e.json().then((function(t){s(e,t)})).catch((function(e){i({error:e})}))})).catch((function(e){i({error:e,httpStatusCode:0})}))},MixpanelRecorder.prototype._flushEvents=addOptOutCheckMixpanelLib((function(e,t,n){const i=e.length;if(i>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 c=e[i-1].timestamp-this.replayStartTime,d={distinct_id:String(this._mixpanel.get_distinct_id()),seq:this.seqNo,batch_start_time:a/1e3,replay_id:s,replay_length_ms:c,replay_start_time:this.replayStartTime/1e3},u=wr.JSONEncode(e),l=this._mixpanel.get_property("$device_id");l&&(d.$device_id=l);var p=this._mixpanel.get_property("$user_id");if(p&&(d.$user_id=p),Fr){var h=new Blob([u],{type:"application/json"}).stream().pipeThrough(new Fr("gzip"));new Response(h).blob().then(wr.bind((function(e){d.format="gzip",this._sendRequest(s,d,e,n)}),this))}else d.format="body",this._sendRequest(s,d,u,n)}})),MixpanelRecorder.prototype.reportError=function(e,t){jr.error.apply(jr.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){jr.error(n)}},$t.__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,t,n,i){var s=this,a=wr.dom_query(e);if(0!==a.length)return wr.each(a,(function(e){wr.register_event(e,this.override_event,(function(e){var a={},c=s.create_properties(n,this),d=s.mp.get_config("track_links_timeout");s.event_handler(e,this,a),window.setTimeout(s.track_callback(i,c,a,!0),d),s.mp.track(t,c,s.track_callback(i,c,a))}))}),this),!0;Ir.error("The DOM query ("+e+") returned 0 elements")},DomTracker.prototype.track_callback=function(e,t,n,i){i=i||!1;var s=this;return function(){n.callback_fired||(n.callback_fired=!0,e&&!1===e(i,t)||s.after_track_handler(t,n,i))}},DomTracker.prototype.create_properties=function(e,t){return"function"==typeof e?e(t):wr.extend({},e)};var LinkTracker=function(){this.override_event="click"};wr.inherit(LinkTracker,DomTracker),LinkTracker.prototype.create_properties=function(e,t){var n=LinkTracker.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},LinkTracker.prototype.event_handler=function(e,t,n){n.new_tab=2===e.which||e.metaKey||e.ctrlKey||"_blank"===t.target,n.href=t.href,n.new_tab||e.preventDefault()},LinkTracker.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout((function(){window.location=t.href}),0)};var FormTracker=function(){this.override_event="submit"};wr.inherit(FormTracker,DomTracker),FormTracker.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},FormTracker.prototype.after_track_handler=function(e,t){setTimeout((function(){t.element.submit()}),0)};var $r="$set",Br="$set_once",zr="$unset",Wr="$add",Vr="$append",Kr="$union",Hr="$remove",Gr={set_action:function(e,t){var n={},i={};return wr.isObject(e)?wr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[$r]=i,n},unset_action:function(e){var t={},n=[];return wr.isArray(e)||(e=[e]),wr.each(e,(function(e){this._is_reserved_property(e)||n.push(e)}),this),t[zr]=n,t},set_once_action:function(e,t){var n={},i={};return wr.isObject(e)?wr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Br]=i,n},union_action:function(e,t){var n={},i={};return wr.isObject(e)?wr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=wr.isArray(e)?e:[e])}),this):i[e]=wr.isArray(t)?t:[t],n[Kr]=i,n},append_action:function(e,t){var n={},i={};return wr.isObject(e)?wr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Vr]=i,n},remove_action:function(e,t){var n={},i={};return wr.isObject(e)?wr.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Hr]=i,n},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};wr.extend(MixpanelGroup.prototype,Gr),MixpanelGroup.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},MixpanelGroup.prototype.set=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_action(e,t);return wr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.set_once=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.set_once_action(e,t);return wr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelGroup.prototype.unset=addOptOutCheckMixpanelGroup((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelGroup.prototype.union=addOptOutCheckMixpanelGroup((function(e,t,n){wr.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype.delete=addOptOutCheckMixpanelGroup((function(e){var t=this.delete_action();return this._send_request(t,e)})),MixpanelGroup.prototype.remove=addOptOutCheckMixpanelGroup((function(e,t,n){var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelGroup.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var n=wr.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},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(){};wr.extend(MixpanelPeople.prototype,Gr),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_action(e,t);return wr.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[$r]=wr.extend({},wr.info.people_properties(),i[$r]),this._send_request(i,n)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_once_action(e,t);return wr.isObject(e)&&(n=t),this._send_request(i,n)})),MixpanelPeople.prototype.unset=addOptOutCheckMixpanelPeople((function(e,t){var n=this.unset_action(e);return this._send_request(n,t)})),MixpanelPeople.prototype.increment=addOptOutCheckMixpanelPeople((function(e,t,n){var i={},s={};return wr.isObject(e)?(wr.each(e,(function(e,t){if(!this._is_reserved_property(t)){if(isNaN(parseFloat(e)))return void Ir.error("Invalid increment value passed to mixpanel.people.increment - must be a number");s[t]=e}}),this),n=t):(wr.isUndefined(t)&&(t=1),s[e]=t),i[Wr]=s,this._send_request(i,n)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,t,n){wr.isObject(e)&&(n=t);var i=this.append_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.remove=addOptOutCheckMixpanelPeople((function(e,t,n){wr.isObject(e)&&(n=t);var i=this.remove_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.union=addOptOutCheckMixpanelPeople((function(e,t,n){wr.isObject(e)&&(n=t);var i=this.union_action(e,t);return this._send_request(i,n)})),MixpanelPeople.prototype.track_charge=addOptOutCheckMixpanelPeople((function(e,t,n){if(wr.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",wr.extend({$amount:e},t),n);Ir.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)}Ir.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,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),i=this._mixpanel.get_property("$user_id"),s=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),i&&(e.$user_id=i),s&&(e.$had_persisted_distinct_id=s);var a=wr.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},t):(this._enqueue(e),wr.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),wr.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){$r in e?this._mixpanel.persistence._add_to_people_queue($r,e):Br in e?this._mixpanel.persistence._add_to_people_queue(Br,e):zr in e?this._mixpanel.persistence._add_to_people_queue(zr,e):Wr in e?this._mixpanel.persistence._add_to_people_queue(Wr,e):Vr in e?this._mixpanel.persistence._add_to_people_queue(Vr,e):Hr in e?this._mixpanel.persistence._add_to_people_queue(Hr,e):Kr in e?this._mixpanel.persistence._add_to_people_queue(Kr,e):Ir.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,t,n,i){var s=this,a=wr.extend({},this._mixpanel.persistence.load_queue(e)),c=a;wr.isUndefined(a)||!wr.isObject(a)||wr.isEmptyObject(a)||(s._mixpanel.persistence._pop_from_people_queue(e,a),s._mixpanel.persistence.save(),i&&(c=i(a)),t.call(s,c,(function(t,i){0===t&&s._mixpanel.persistence._add_to_people_queue(e,a),wr.isUndefined(n)||n(t,i)})))},MixpanelPeople.prototype._flush=function(e,t,n,i,s,a,c){var d=this;this._flush_one_queue($r,this.set,e),this._flush_one_queue(Br,this.set_once,i),this._flush_one_queue(zr,this.unset,a,(function(e){return wr.keys(e)})),this._flush_one_queue(Wr,this.increment,t),this._flush_one_queue(Kr,this.union,s);var u=this._mixpanel.persistence.load_queue(Vr);if(!wr.isUndefined(u)&&wr.isArray(u)&&u.length)for(var l,append_callback=function(e,t){0===e&&d._mixpanel.persistence._add_to_people_queue(Vr,l),wr.isUndefined(n)||n(e,t)},p=u.length-1;p>=0;p--)u=this._mixpanel.persistence.load_queue(Vr),l=u.pop(),d._mixpanel.persistence.save(),wr.isEmptyObject(l)||d.append(l,append_callback);var h=this._mixpanel.persistence.load_queue(Hr);if(!wr.isUndefined(h)&&wr.isArray(h)&&h.length)for(var f,remove_callback=function(e,t){0===e&&d._mixpanel.persistence._add_to_people_queue(Hr,f),wr.isUndefined(c)||c(e,t)},m=h.length-1;m>=0;m--)h=this._mixpanel.persistence.load_queue(Hr),f=h.pop(),d._mixpanel.persistence.save(),wr.isEmptyObject(f)||d.remove(f,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 Yr,Jr="__mps",Xr="__mpso",Qr="__mpus",en="__mpa",tn="__mpap",rn="__mpr",nn="__mpu",sn="$people_distinct_id",an="__alias",cn="__timers",dn=[Jr,Xr,Qr,en,tn,rn,nn,sn,an,cn],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 t=e.persistence;"cookie"!==t&&"localStorage"!==t&&(Ir.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),"localStorage"===t&&wr.localStorage.is_supported()?this.storage=wr.localStorage:this.storage=wr.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),wr.each(this.props,(function(t,n){wr.include(dn,n)||(e[n]=t)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=wr.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,t;this.storage===wr.localStorage?(e=wr.cookie.parse(this.name),wr.cookie.remove(this.name),wr.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===wr.cookie&&(t=wr.localStorage.parse(this.name),wr.localStorage.remove(this.name),t&&this.register_once(t))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,wr.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,t,n){return!!wr.isObject(e)&&(void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n,this.load(),wr.each(e,(function(e,n){this.props.hasOwnProperty(n)&&this.props[n]!==t||(this.props[n]=e)}),this),this.save(),!0)},MixpanelPersistence.prototype.register=function(e,t){return!!wr.isObject(e)&&(this.expire_days=void 0===t?this.default_expiry:t,this.load(),wr.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(wr.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:wr.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return wr.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,t){var n=this._get_queue_key(e),i=t[e],s=this._get_or_create_queue($r),a=this._get_or_create_queue(Br),c=this._get_or_create_queue(zr),d=this._get_or_create_queue(Wr),u=this._get_or_create_queue(Kr),l=this._get_or_create_queue(Hr,[]),p=this._get_or_create_queue(Vr,[]);n===Jr?(wr.extend(s,i),this._pop_from_people_queue(Wr,i),this._pop_from_people_queue(Kr,i),this._pop_from_people_queue(zr,i)):n===Xr?(wr.each(i,(function(e,t){t in a||(a[t]=e)})),this._pop_from_people_queue(zr,i)):n===Qr?wr.each(i,(function(e){wr.each([s,a,d,u],(function(t){e in t&&delete t[e]})),wr.each(p,(function(t){e in t&&delete t[e]})),c[e]=!0})):n===en?(wr.each(i,(function(e,t){t in s?s[t]+=e:(t in d||(d[t]=0),d[t]+=e)}),this),this._pop_from_people_queue(zr,i)):n===nn?(wr.each(i,(function(e,t){wr.isArray(e)&&(t in u||(u[t]=[]),u[t]=u[t].concat(e))})),this._pop_from_people_queue(zr,i)):n===rn?(l.push(i),this._pop_from_people_queue(Vr,i)):n===tn&&(p.push(i),this._pop_from_people_queue(zr,i)),Ir.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Ir.log(t),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];wr.isUndefined(n)||wr.each(t,(function(t,i){e===Vr||e===Hr?wr.each(n,(function(e){e[i]===t&&delete e[i]})):delete n[i]}),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===$r?Jr:e===Br?Xr:e===zr?Qr:e===Wr?en:e===Vr?tn:e===Hr?rn:e===Kr?nn:void Ir.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=wr.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},MixpanelPersistence.prototype.set_event_timer=function(e,t){var n=this.load_prop(cn)||{};n[e]=t,this.props[cn]=n,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var t=(this.load_prop(cn)||{})[e];return wr.isUndefined(t)||(delete this.props[cn][e],this.save()),t};var un,load_extra_bundle=function(e,t){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},ln="mixpanel",pn="base64",hn="$device:",fn=$t.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,mn=!fn&&-1===_r.indexOf("MSIE")&&-1===_r.indexOf("Mozilla"),_n=null;pr.sendBeacon&&(_n=function(){return pr.sendBeacon.apply(pr,arguments)});var gn={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},yn={api_host:"https://api-js.mixpanel.com",api_routes:gn,api_method:"POST",api_transport:"XHR",api_payload_format:pn,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"},vn=!1,MixpanelLib=function(){},create_mplib=function(e,t,n){var i,s=n===ln?un:un[n];if(s&&0===Yr)i=s;else{if(s&&!wr.isArray(s))return void Ir.error("You have already initialized "+n);i=new MixpanelLib}if(i._cached_groups={},i._init(e,t,n),i.people=new MixpanelPeople,i.people._init(i),!i.get_config("skip_first_touch_marketing")){var a=wr.info.campaignParams(null),c={},d=!1;wr.each(a,(function(e,t){c["initial_"+t]=e,e&&(d=!0)})),d&&i.people.set_once(c)}return Wt.DEBUG=Wt.DEBUG||i.get_config("debug"),!wr.isUndefined(s)&&wr.isArray(s)&&(i._execute_array.call(i.people,s.people),i._execute_array(s)),i};MixpanelLib.prototype.init=function(e,t,n){if(wr.isUndefined(n))this.report_error("You must name your new library: init(token, config, name)");else{if(n!==ln){var i=create_mplib(e,t,n);return un[n]=i,i._loaded(),i}this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet")}},MixpanelLib.prototype._init=function(e,t,n){t=t||{},this.__loaded=!0,this.config={};var i={};"api_payload_format"in t||(t.api_host||yn.api_host).match(/\.mixpanel\.com/)&&(i.api_payload_format="json");if(this.set_config(wr.extend({},yn,i,t,{name:n,token:e,callback_fn:(n===ln?n:ln+"."+n)+"._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(wr.localStorage.is_supported(!0)&&fn){if(this.init_batchers(),_n&&$t.addEventListener){var s=wr.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);$t.addEventListener("pagehide",(function(e){e.persisted&&s()})),$t.addEventListener("visibilitychange",(function(){"hidden"===hr.visibilityState&&s()}))}}else this._batch_requests=!1,Ir.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),wr.each(this.get_batcher_configs(),(function(e){Ir.log("Clearing batch queue "+e.queue_key),wr.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=wr.UUID();this.get_distinct_id()||this.register_once({distinct_id:hn+a,$device_id:a},"");var c=this.get_config("track_pageview");c&&this._init_url_change_tracking(c),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($t.MutationObserver){var e=wr.bind((function(){this._recorder=this._recorder||new $t.__mp_recorder(this),this._recorder.startRecording()}),this);wr.isUndefined($t.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else Ir.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():Ir.critical("Session recorder module not loaded")},MixpanelLib.prototype.get_session_recording_properties=function(){var e={};if(this._recorder){var t=this._recorder.replayId;t&&(e.$mp_replay_id=t)}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=wr.info.campaignParams(null);wr.each(e,function(e,t){this.unregister(t)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(hr.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(wr.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(hr.referrer)},MixpanelLib.prototype._dom_loaded=function(){wr.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||wr.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,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!vn)return this.__dom_loaded_queue.push([e,t]),!1;var n=(new e).init(this);return n.track.apply(n,t)},MixpanelLib.prototype._init_url_change_tracking=function(e){var t="";if(this.track_pageview()&&(t=wr.info.currentUrl()),wr.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){$t.addEventListener("popstate",(function(){$t.dispatchEvent(new Event("mp_locationchange"))})),$t.addEventListener("hashchange",(function(){$t.dispatchEvent(new Event("mp_locationchange"))}));var n=$t.history.pushState;"function"==typeof n&&($t.history.pushState=function(e,t,i){n.call($t.history,e,t,i),$t.dispatchEvent(new Event("mp_locationchange"))});var i=$t.history.replaceState;"function"==typeof i&&($t.history.replaceState=function(e,t,n){i.call($t.history,e,t,n),$t.dispatchEvent(new Event("mp_locationchange"))}),$t.addEventListener("mp_locationchange",function(){var n=wr.info.currentUrl(),i=!1;("full-url"===e?i=n!==t:"url-with-path-and-query-string"===e?i=n.split("#")[0]!==t.split("#")[0]:"url-with-path"===e&&(i=n.split("#")[0].split("?")[0]!==t.split("#")[0].split("?")[0]),i)&&(this.track_pageview()&&(t=n))}.bind(this))}},MixpanelLib.prototype._prepare_callback=function(e,t){if(wr.isUndefined(e))return null;if(fn){return function(n){e(n,t)}}var n=this._jsc,i=""+Math.floor(1e8*Math.random()),s=this.get_config("callback_fn")+"["+i+"]";return n[i]=function(s){delete n[i],e(s,t)},s},MixpanelLib.prototype._send_request=function(e,t,n,i){var s=!0;if(mn)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")},c=null;i||!wr.isFunction(n)&&"string"!=typeof n||(i=n,n=null),n=wr.extend(a,n||{}),fn||(n.method="GET");var d="POST"===n.method,u=_n&&d&&"sendbeacon"===n.transport.toLowerCase(),l=n.verbose;t.verbose&&(l=!0),this.get_config("test")&&(t.test=1),l&&(t.verbose=1),this.get_config("img")&&(t.img=1),fn||(i?t.callback=i:(l||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=(new Date).getTime().toString(),d&&(c="data="+encodeURIComponent(t.data),delete t.data),e+="?"+wr.HTTPBuildQuery(t);var p=this;if("img"in t){var h=hr.createElement("img");h.src=e,hr.body.appendChild(h)}else if(u){try{s=_n(e,c)}catch(v){p.report_error(v),s=!1}try{i&&i(s?1:0)}catch(v){p.report_error(v)}}else if(fn)try{var f=new XMLHttpRequest;f.open(n.method,e,!0);var m=this.get_config("xhr_headers");if(d&&(m["Content-Type"]="application/x-www-form-urlencoded"),wr.each(m,(function(e,t){f.setRequestHeader(t,e)})),n.timeout_ms&&void 0!==f.timeout){f.timeout=n.timeout_ms;var _=(new Date).getTime()}f.withCredentials=!0,f.onreadystatechange=function(){var e;if(4===f.readyState)if(200===f.status){if(i)if(l){var t;try{t=wr.JSONDecode(f.responseText)}catch(v){if(p.report_error(v),!n.ignore_json_errors)return;t=f.responseText}i(t)}else i(Number(f.responseText))}else if(e=f.timeout&&!f.status&&(new Date).getTime()-_>=f.timeout?"timeout":"Bad HTTP status: "+f.status+" "+f.statusText,p.report_error(e),i)if(l){var s=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:e,retryAfter:s["Retry-After"]})}else i(0)},f.send(c)}catch(v){p.report_error(v),s=!1}else{var g=hr.createElement("script");g.type="text/javascript",g.async=!0,g.defer=!0,g.src=e;var y=hr.getElementsByTagName("script")[0];y.parentNode.insertBefore(g,y)}return s},MixpanelLib.prototype._execute_array=function(e){var t,n=[],i=[],s=[];wr.each(e,(function(e){e&&(t=e[0],wr.isArray(t)?s.push(e):"function"==typeof e?e.call(this):wr.isArray(e)&&"alias"===t?n.push(e):wr.isArray(e)&&-1!==t.indexOf("track")&&"function"==typeof this[t]?s.push(e):i.push(e))}),this);var execute=function(e,t){wr.each(e,(function(e){if(wr.isArray(e[0])){var n=t;wr.each(e,(function(e){n=n[e[0]].apply(n,e.slice(1))}))}else this[e[0]].apply(this,e.slice(1))}),t)};execute(n,this),execute(i,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"),t=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+t.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+t.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+t.groups,queue_key:e+"_gr"}},this._batcher_configs},MixpanelLib.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=wr.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:wr.bind((function(t,n,i){this._send_request(this.get_config("api_host")+e.endpoint,this._encode_data_for_request(t),n,this._prepare_callback(i,t))}),this),beforeSendHook:wr.bind((function(t){return this._run_hook("before_send_"+e.type,t)}),this),stopAllBatchingFunc:wr.bind(this.stop_batch_senders,this),usePersistence:!0})}),this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.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,wr.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,wr.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 t=wr.JSONEncode(e);return this.get_config("api_payload_format")===pn&&(t=wr.base64Encode(t)),{data:t}},MixpanelLib.prototype._track_or_batch=function(e,t){var n=wr.truncate(e.data,255),i=e.endpoint,s=e.batcher,a=e.should_send_immediately,c=e.send_request_options||{};t=t||NOOP_FUNC;var d=!0,u=wr.bind((function(){return c.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(Ir.log("MIXPANEL REQUEST:"),Ir.log(n),this._send_request(i,this._encode_data_for_request(n),c,this._prepare_callback(t,n))):null}),this);return this._batch_requests&&!a?s.enqueue(n,(function(e){e?t(1,n):u()})):d=u(),d&&n},MixpanelLib.prototype.track=addOptOutCheckMixpanelLib((function(e,t,n,i){i||"function"!=typeof n||(i=n,n=null);var s=(n=n||{}).transport;s&&(n.transport=s);var a=n.send_immediately;if("function"!=typeof i&&(i=NOOP_FUNC),wr.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(t=wr.extend({},t)).token=this.get_config("token");var c=this.persistence.remove_event_timer(e);if(!wr.isUndefined(c)){var d=(new Date).getTime()-c;t.$duration=parseFloat((d/1e3).toFixed(3))}this._set_default_superprops();var u=this.get_config("track_marketing")?wr.info.marketingParams():{};t=wr.extend({},wr.info.properties({mp_loader:this.get_config("mp_loader")}),u,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var l=this.get_config("property_blacklist");wr.isArray(l)?wr.each(l,(function(e){delete t[e]})):this.report_error("Invalid value for property_blacklist config: "+l);var p={event:e,properties:t};return this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:a,send_request_options:n},i)}i(0)}})),MixpanelLib.prototype.set_group=addOptOutCheckMixpanelLib((function(e,t,n){wr.isArray(t)||(t=[t]);var i={};return i[e]=t,this.register(i),this.people.set(e,t,n)})),MixpanelLib.prototype.add_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e),s={};return void 0===i?(s[e]=[t],this.register(s)):-1===i.indexOf(t)&&(i.push(t),s[e]=i,this.register(s)),this.people.union(e,t,n)})),MixpanelLib.prototype.remove_group=addOptOutCheckMixpanelLib((function(e,t,n){var i=this.get_property(e);if(void 0!==i){var s=i.indexOf(t);s>-1&&(i.splice(s,1),this.register({group_key:i})),0===i.length&&this.unregister(e)}return this.people.remove(e,t,n)})),MixpanelLib.prototype.track_with_groups=addOptOutCheckMixpanelLib((function(e,t,n,i){var s=wr.extend({},t||{});return wr.each(n,(function(e,t){null!=e&&(s[t]=e)})),this.track(e,s,i)})),MixpanelLib.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},MixpanelLib.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},MixpanelLib.prototype.get_group=function(e,t){var n=this._create_map_key(e,t),i=this._cached_groups[n];return void 0!==i&&i._group_key===e&&i._group_id===t||((i=new MixpanelGroup)._init(this,e,t),this._cached_groups[n]=i),i},MixpanelLib.prototype.track_pageview=addOptOutCheckMixpanelLib((function(e,t){"object"!=typeof e&&(e={});var n=(t=t||{}).event_name||"$mp_web_page_view",i=wr.extend(wr.info.mpPageViewProperties(),wr.info.campaignParams(),wr.info.clickParams()),s=wr.extend({},i,e);return this.track(n,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){wr.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 bn={persistent:!0},options_for_register=function(e){var t;return t=wr.isObject(e)?e:wr.isUndefined(e)?{}:{days:e},wr.extend({},bn,t)};MixpanelLib.prototype.register=function(e,t){var n=options_for_register(t);n.persistent?this.persistence.register(e,n.days):wr.extend(this.unpersisted_superprops,e)},MixpanelLib.prototype.register_once=function(e,t,n){var i=options_for_register(n);i.persistent?this.persistence.register_once(e,t,i.days):(void 0===t&&(t="None"),wr.each(e,(function(e,n){this.unpersisted_superprops.hasOwnProperty(n)&&this.unpersisted_superprops[n]!==t||(this.unpersisted_superprops[n]=e)}),this))},MixpanelLib.prototype.unregister=function(e,t){(t=options_for_register(t)).persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},MixpanelLib.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},MixpanelLib.prototype.identify=function(e,t,n,i,s,a,c,d){var u=this.get_distinct_id();if(e&&u!==e){if("string"==typeof e&&0===e.indexOf(hn))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var l=u;this.register_once({$had_persisted_distinct_id:!0,$device_id:l},"")}e!==u&&e!==this.get_property(an)&&(this.unregister(an),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,i,s,a,c,d),e!==u&&this.track("$identify",{distinct_id:e,$anon_distinct_id:u},{skip_hooks:!0})},MixpanelLib.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=wr.UUID();this.register_once({distinct_id:hn+e,$device_id:e},"")},MixpanelLib.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},MixpanelLib.prototype.alias=function(e,t){if(e===this.get_property(sn))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return wr.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(an,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},(function(){n.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){wr.isObject(e)&&(wr.extend(this.config,e),e.batch_size&&wr.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),Wt.DEBUG=Wt.DEBUG||this.get_config("debug"))},MixpanelLib.prototype.get_config=function(e){return this.config[e]},MixpanelLib.prototype._run_hook=function(e){var t=(this.config.hooks[e]||IDENTITY_FUNC).apply(this,cr.call(arguments,1));return void 0===t&&(this.report_error(e+" hook did not return a value"),t=null),t},MixpanelLib.prototype.get_property=function(e){return this.persistence.load_prop([e])},MixpanelLib.prototype.toString=function(){var e=this.get_config("name");return e!==ln&&(e=ln+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return wr.isBlockedUA(_r)||this._flags.disable_all_events||wr.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&wr.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")&&!wr.cookie.get("mp_optout")||(wr.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 t;if(e&&e.clear_persistence)t=!0;else{if(!e||!e.enable_persistence)return;t=!1}this.get_config("disable_persistence")||this.persistence.disabled===t||this.persistence.set_disabled(t),t?this.stop_batch_senders():this._batchers_were_started&&this.start_batch_senders()},MixpanelLib.prototype._gdpr_call_func=function(e,t){return t=wr.extend({track:wr.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")},t),wr.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},MixpanelLib.prototype.opt_in_tracking=function(e){e=wr.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=wr.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=wr.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,t){Ir.error.apply(Ir.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Ir.error(n)}},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=gn,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 Sn={},override_mp_init_func=function(){un.init=function(e,t,n){if(n)return un[n]||(un[n]=Sn[n]=create_mplib(e,t,n),un[n]._loaded()),un[n];var i=un;Sn[ln]?i=Sn[ln]:e&&((i=create_mplib(e,t,ln))._loaded(),Sn[ln]=i),un=i,1===Yr&&($t[ln]=un),wr.each(Sn,(function(e,t){t!==ln&&(un[t]=e)})),un._=wr}};var kn=function init_as_module(e){return load_extra_bundle=e,Yr=0,un=new MixpanelLib,override_mp_init_func(),un.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,vn=!0,mn=!1,wr.each(Sn,(function(e){e._dom_loaded()})))}if(hr.addEventListener)"complete"===hr.readyState?dom_loaded_handler():hr.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(hr.attachEvent){hr.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===$t.frameElement}catch(t){}hr.documentElement.doScroll&&e&&function do_scroll_check(){try{hr.documentElement.doScroll("left")}catch(t){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}wr.register_event($t,"load",dom_loaded_handler,!0)}(),un}((function loadNoop(e,t){t()}));function isReady(){return void 0!==window.mixpanel}const wn={init:function init$1(e,t=!1){return new Promise((n=>{kn.init(e,{debug:t,loaded:()=>{window.mixpanel=kn,n()}})}))},isReady:isReady,track:function track(e,t){isReady()&&kn.track(e,t)},identify:function identify$1(e,t){isReady()&&(kn.identify(e),kn.people.set(t))},attachProperty:function attachProperty(e,t){isReady()&&kn.people.union(e,[t])}},In=["Track Test"];async function trackEvent(e,t){if(!wn.isReady())throw new Error("Mixpanel is not initialized.");try{Tn.parseEventProps(e,t);const n=!In.includes(e),i=await ot.getFingerprint(n),s={...{"User Fingerprint":i},...t};wn.track(e,s)}catch(Xt){throw console.error("Error tracking event:",Xt),Xt}}const xn=ge.object({Arrival:ge.string().refine(dateValidation,{message:"Invalid arrival date or datetime format. Must include at least YYYY-MM-DD"}),Departure:ge.string().refine(dateValidation,{message:"Invalid departure date or datetime format. Must include at least YYYY-MM-DD"}),Destination:ge.string().min(1,"Destination is required"),"Destination Terminal":ge.string().min(1,"Destination Terminal is required"),Line:ge.string().min(1,"Line is required").optional(),Origin:ge.string().min(1,"Origin is required"),"Origin Terminal":ge.string().min(1,"Origin Terminal is required"),Price:ge.number().positive("Price must be a positive number"),Route:ge.string().min(1,"Route is required"),Stops:ge.number().int("Stops must be an integer").nonnegative().optional(),Tickets:ge.number().int("Tickets must be an integer").positive(),Transporter:ge.string().min(1,"Transporter is required"),"User Fingerprint":ge.string().or(ge.null()).refine(userFingerPrintValidation,{message:"User fingerprint must be a string or null"}).optional(),Way:ge.enum(["Departure","Return"],{description:"Way must be either 'Departure' or 'Return'"}),product:ge.enum(ve).refine((e=>ve.includes(e)),{message:`Product must be one of: ${ve.join(", ")}`})}),En=ge.object({}),Cn=ge.object({mixpanelToken:ge.string().min(1,"Mixpanel token is required"),debug:ge.boolean().optional(),identificationKey:ge.string().min(1,"Identification key is required")}),SchemaErrorFormatter=e=>e.issues.map((e=>{let t="INVALID_FIELD",n="",i="",s="";return"invalid_type"===e.code?(t="TYPE_MISMATCH",n=e.expected,i=e.received,s=`Expected ${n} but received ${i}. Please provide a value of type ${n}.`):"too_small"===e.code?(t="VALUE_TOO_SMALL",s=`Increase the value to at least ${e.minimum}.`):"too_big"===e.code?(t="VALUE_TOO_BIG",s=`Reduce the value to no more than ${e.maximum}.`):(t="INVALID_FIELD",s="Ensure the field matches the expected format and value type."),{field:e.path.join("."),error_type:t,expected:n,received:i,message:e.message,suggestion:s}})),On={"Track Test":En,Search:be,"Seat Change":xn};function validateProps(e,t){try{t.parse(e)}catch(Xt){if(Xt instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Xt)}}throw{message:"Unknown validation error"}}}const Tn={parseEventProps:function parseEventProps(e,t){const n=On[e];if(!n)throw{message:`Event ${e} not found`};try{n.parse(t)}catch(Xt){if(Xt instanceof ZodError){throw{message:"Schema validation failed",errors:SchemaErrorFormatter(Xt)}}throw{message:"Unknown validation error"}}},parseInitProps:function parseInitProps(e){validateProps(e,Cn)},parseIdentifyProps:function parseIdentifyProps(e){validateProps(e,ye)}},Rn=["firstName","lastName","email","phone"];const Mn={init:async function init(e){Tn.parseInitProps(e);const{mixpanelToken:t,debug:n=!1,identificationKey:i}=e;await wn.init(t,n);try{await ot.initFingerprint(i)}catch(Xt){console.error("Error initializing identification service:",Xt)}!function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()},identify:async function identify(e,t={}){if(!wn.isReady())throw new Error("Analytics service is not initialized");try{if(Tn.parseIdentifyProps(t),!e)throw new Error("User ID is required");const n=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(((t,n)=>(Rn.includes(n)||(t[n]=e[n]),t)),{})}}(t);wn.identify(e,n);const i=await ot.getFingerprint();i&&wn.attachProperty("Known Fingerprints",i)}catch(Xt){console.error("Error attaching fingerprint:",Xt)}},track:{test:function trackTest(){trackEvent("Track Test",{})},search:function trackSearch(e){trackEvent("Search",e)},seatChange:async e=>{trackEvent("Seat Change",e)}}};module.exports=Mn;
|