@reservamos/browser-analytics 0.1.0
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/CHANGELOG.md +7 -0
- package/LICENSE.md +9 -0
- package/README.md +51 -0
- package/dist/browser-analytics.cjs +30 -0
- package/dist/browser-analytics.d.ts +40 -0
- package/dist/browser-analytics.esm.js +9150 -0
- package/dist/browser-analytics.iife.js +30 -0
- package/package.json +91 -0
- package/src/events/trackTest.ts +10 -0
- package/src/fingerprint.ts +131 -0
- package/src/index.ts +12 -0
- package/src/init.ts +68 -0
- package/src/mixpanel.ts +36 -0
- package/src/track.ts +43 -0
- package/src/utils/validateConfig.ts +16 -0
- package/src/vite-env.d.ts +1 -0
package/CHANGELOG.md
ADDED
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Matronator
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Reservamos Browser Analytics
|
|
2
|
+
|
|
3
|
+
This library is a lightweight and optimized solution for tracking user events and utilizing an identification system to build user preferences, designed to be used in any Single Page Application (SPA). It allows third-party websites to send predefined events with ease.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Modular and maintainable TypeScript code
|
|
8
|
+
- Functional programming approach
|
|
9
|
+
- Strong type safety with TypeScript
|
|
10
|
+
- Clear and concise error handling
|
|
11
|
+
- Easy integration with minimal configuration
|
|
12
|
+
- Comprehensive documentation and usage examples
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
To install the library, use npm or yarn
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install reservamos-browser-analytics
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// Import the tracker
|
|
26
|
+
import tracker from '@reservamos/browser-analytics';
|
|
27
|
+
|
|
28
|
+
// Also import the InitConfig interface if you want to use type safety
|
|
29
|
+
// import tracker, { InitConfig } from "@reservamos/browser-analytics";
|
|
30
|
+
|
|
31
|
+
// You can also import only the functions you need
|
|
32
|
+
// import { init, track, identify } from "@reservamos/browser-analytics";
|
|
33
|
+
|
|
34
|
+
// Define the configuration for the tracker
|
|
35
|
+
const config: InitConfig = {
|
|
36
|
+
mixpanelToken: 'YOUR_MIXPANEL_TOKEN',
|
|
37
|
+
identificationKey: 'YOUR_IDENTIFICATION_KEY',
|
|
38
|
+
debug: true,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Initialize the tracker with the config
|
|
42
|
+
tracker.init(config);
|
|
43
|
+
|
|
44
|
+
// Listen for the "Tracker Ready" event
|
|
45
|
+
window.addEventListener('Tracker Ready', () => {
|
|
46
|
+
console.log('Tracker Ready');
|
|
47
|
+
|
|
48
|
+
// Track a test event
|
|
49
|
+
tracker.trackTest();
|
|
50
|
+
});
|
|
51
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";var e,t;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(Z){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(Z){}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}Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}}),(t=e||(e={}))[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.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 l=i&&toLowerCase(i);return(t[n.toLowerCase()]||l&&t[l])&&(c=a?a(c,e):"*".repeat(c.length)),c}function toLowerCase(e){return e.toLowerCase()}const n="__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 i=1;const s=new RegExp("[^a-z0-9-_:]"),a=-2;function genId(){return i++}let c,l;const u=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,p=/^(?:[a-z+]+:)?\/\//i,d=/^www\..*/i,h=/^(data:)([^,]*),(.*)/i;function absoluteToStylesheet(e,t){return(e||"").replace(u,((e,n,i,s,a,c)=>{const l=i||a||c,u=n||s||"";if(!l)return e;if(p.test(l)||d.test(l))return`url(${u}${l}${u})`;if(h.test(l))return`url(${u}${l}${u})`;if("/"===l[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)+l}${u})`;const f=t.split("/"),_=l.split("/");f.pop();for(const t of _)"."!==t&&(".."===t?f.pop():f.push(t));return`url(${u}${f.join("/")}${u})`}))}const f=/^[^ \t\n\r\u000c]+/,_=/^[, \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(_),!(n>=t.length);){let s=collectCharacters(f);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(t,i){const{doc:a,mirror:u,blockClass:p,blockSelector:d,needsMask:h,inlineStylesheet:f,maskInputOptions:_={},maskTextFn:m,maskInputFn:g,dataURLOptions:y={},inlineImages:v,recordCanvas:b,keepIframeSrcFn:S,newlyAddedElement:w=!1}=i,I=function getRootId(e,t){if(!t.hasNode(e))return;const n=t.getId(e);return 1===n?void 0:n}(a,u);switch(t.nodeType){case t.DOCUMENT_NODE:return"CSS1Compat"!==t.compatMode?{type:e.Document,childNodes:[],compatMode:t.compatMode}:{type:e.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:e.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:I};case t.ELEMENT_NODE:return function serializeElementNode(t,i){const{doc:a,blockClass:u,blockSelector:p,inlineStylesheet:d,maskInputOptions:h={},maskInputFn:f,dataURLOptions:_={},inlineImages:m,recordCanvas:g,keepIframeSrcFn:y,newlyAddedElement:v=!1,rootId:b}=i,S=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}(t,u,p),w=function getValidTagName(e){if(e instanceof HTMLFormElement)return"form";const t=toLowerCase(e.tagName);return s.test(t)?"div":t}(t);let I={};const O=t.attributes.length;for(let e=0;e<O;e++){const n=t.attributes[e];ignoreAttribute(w,n.name,n.value)||(I[n.name]=transformAttribute(a,w,toLowerCase(n.name),n.value))}if("link"===w&&d){const e=Array.from(a.styleSheets).find((e=>e.href===t.href));let n=null;e&&(n=stringifyStylesheet(e)),n&&(delete I.rel,delete I.href,I._cssText=absoluteToStylesheet(n,e.href))}if("style"===w&&t.sheet&&!(t.innerText||t.textContent||"").trim().length){const e=stringifyStylesheet(t.sheet);e&&(I._cssText=absoluteToStylesheet(e,getHref()))}if("input"===w||"textarea"===w||"select"===w){const e=t.value,n=t.checked;"radio"!==I.type&&"checkbox"!==I.type&&"submit"!==I.type&&"button"!==I.type&&e?I.value=maskInputValue({element:t,type:getInputType(t),tagName:w,value:e,maskInputOptions:h,maskInputFn:f}):n&&(I.checked=n)}"option"===w&&(t.selected&&!h.select?I.selected=!0:delete I.selected);if("canvas"===w&&g)if("2d"===t.__context)(function is2DCanvasBlank(e){const t=e.getContext("2d");if(!t)return!0;for(let i=0;i<e.width;i+=50)for(let s=0;s<e.height;s+=50){const a=t.getImageData,c=n in a?a[n]:a;if(new Uint32Array(c.call(t,i,s,Math.min(50,e.width-i),Math.min(50,e.height-s)).data.buffer).some((e=>0!==e)))return!1}return!0})(t)||(I.rr_dataURL=t.toDataURL(_.type,_.quality));else if(!("__context"in t)){const e=t.toDataURL(_.type,_.quality),n=document.createElement("canvas");n.width=t.width,n.height=t.height;e!==n.toDataURL(_.type,_.quality)&&(I.rr_dataURL=e)}if("img"===w&&m){c||(c=a.createElement("canvas"),l=c.getContext("2d"));const e=t,n=e.crossOrigin;e.crossOrigin="anonymous";const recordInlineImage=()=>{e.removeEventListener("load",recordInlineImage);try{c.width=e.naturalWidth,c.height=e.naturalHeight,l.drawImage(e,0,0),I.rr_dataURL=c.toDataURL(_.type,_.quality)}catch(t){console.warn(`Cannot inline img src=${e.currentSrc}! Error: ${t}`)}n?I.crossOrigin=n:e.removeAttribute("crossorigin")};e.complete&&0!==e.naturalWidth?recordInlineImage():e.addEventListener("load",recordInlineImage)}if("audio"===w||"video"===w){const e=I;e.rr_mediaState=t.paused?"paused":"played",e.rr_mediaCurrentTime=t.currentTime,e.rr_mediaPlaybackRate=t.playbackRate,e.rr_mediaMuted=t.muted,e.rr_mediaLoop=t.loop,e.rr_mediaVolume=t.volume}v||(t.scrollLeft&&(I.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(I.rr_scrollTop=t.scrollTop));if(S){const{width:e,height:n}=t.getBoundingClientRect();I={class:I.class,rr_width:`${e}px`,rr_height:`${n}px`}}"iframe"!==w||y(I.src)||(t.contentDocument||(I.rr_src=I.src),delete I.src);let C;try{customElements.get(w)&&(C=!0)}catch(R){}return{type:e.Element,tagName:w,attributes:I,childNodes:[],isSVG:isSVGElement(t)||void 0,needBlock:S,rootId:b,isCustom:C}}(t,{doc:a,blockClass:p,blockSelector:d,inlineStylesheet:f,maskInputOptions:_,maskInputFn:g,dataURLOptions:y,inlineImages:v,recordCanvas:b,keepIframeSrcFn:S,newlyAddedElement:w,rootId:I});case t.TEXT_NODE:return function serializeTextNode(t,n){var i;const{needsMask:s,maskTextFn:a,rootId:c}=n,l=t.parentNode&&t.parentNode.tagName;let u=t.textContent;const p="STYLE"===l||void 0,d="SCRIPT"===l||void 0;if(p&&u){try{t.nextSibling||t.previousSibling||(null===(i=t.parentNode.sheet)||void 0===i?void 0:i.cssRules)&&(u=stringifyStylesheet(t.parentNode.sheet))}catch(h){console.warn(`Cannot get CSS styles from text's parentNode. Error: ${h}`,t)}u=absoluteToStylesheet(u,getHref())}d&&(u="SCRIPT_PLACEHOLDER");!p&&!d&&u&&s&&(u=a?a(u,t.parentElement):u.replace(/[\S]/g,"*"));return{type:e.Text,textContent:u||"",isStyle:p,rootId:c}}(t,{needsMask:h,maskTextFn:m,rootId:I});case t.CDATA_SECTION_NODE:return{type:e.CDATA,textContent:"",rootId:I};case t.COMMENT_NODE:return{type:e.Comment,textContent:t.textContent||"",rootId:I};default:return!1}}function lowerIfExists(e){return null==e?"":e.toLowerCase()}function serializeNodeWithId(t,n){const{doc:i,mirror:s,blockClass:c,blockSelector:l,maskTextClass:u,maskTextSelector:p,skipChild:d=!1,inlineStylesheet:h=!0,maskInputOptions:f={},maskTextFn:_,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y={},inlineImages:v=!1,recordCanvas:b=!1,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I=5e3,onStylesheetLoad:O,stylesheetLoadTimeout:C=5e3,keepIframeSrcFn:R=()=>!1,newlyAddedElement:x=!1}=n;let{needsMask:T}=n,{preserveWhiteSpace:N=!0}=n;if(!T&&t.childNodes){T=needMaskingText(t,u,p,void 0===T)}const D=serializeNode(t,{doc:i,mirror:s,blockClass:c,blockSelector:l,needsMask:T,inlineStylesheet:h,maskInputOptions:f,maskTextFn:_,maskInputFn:m,dataURLOptions:y,inlineImages:v,recordCanvas:b,keepIframeSrcFn:R,newlyAddedElement:x});if(!D)return console.warn(t,"not serialized"),null;let A;A=s.hasNode(t)?s.getId(t):!function slimDOMExcluded(t,n){if(n.comment&&t.type===e.Comment)return!0;if(t.type===e.Element){if(n.script&&("script"===t.tagName||"link"===t.tagName&&("preload"===t.attributes.rel||"modulepreload"===t.attributes.rel)&&"script"===t.attributes.as||"link"===t.tagName&&"prefetch"===t.attributes.rel&&"string"==typeof t.attributes.href&&"js"===extractFileExtension(t.attributes.href)))return!0;if(n.headFavicon&&("link"===t.tagName&&"shortcut icon"===t.attributes.rel||"meta"===t.tagName&&(lowerIfExists(t.attributes.name).match(/^msapplication-tile(image|color)$/)||"application-name"===lowerIfExists(t.attributes.name)||"icon"===lowerIfExists(t.attributes.rel)||"apple-touch-icon"===lowerIfExists(t.attributes.rel)||"shortcut icon"===lowerIfExists(t.attributes.rel))))return!0;if("meta"===t.tagName){if(n.headMetaDescKeywords&&lowerIfExists(t.attributes.name).match(/^description|keywords$/))return!0;if(n.headMetaSocial&&(lowerIfExists(t.attributes.property).match(/^(og|twitter|fb):/)||lowerIfExists(t.attributes.name).match(/^(og|twitter):/)||"pinterest"===lowerIfExists(t.attributes.name)))return!0;if(n.headMetaRobots&&("robots"===lowerIfExists(t.attributes.name)||"googlebot"===lowerIfExists(t.attributes.name)||"bingbot"===lowerIfExists(t.attributes.name)))return!0;if(n.headMetaHttpEquiv&&void 0!==t.attributes["http-equiv"])return!0;if(n.headMetaAuthorship&&("author"===lowerIfExists(t.attributes.name)||"generator"===lowerIfExists(t.attributes.name)||"framework"===lowerIfExists(t.attributes.name)||"publisher"===lowerIfExists(t.attributes.name)||"progid"===lowerIfExists(t.attributes.name)||lowerIfExists(t.attributes.property).match(/^article:/)||lowerIfExists(t.attributes.property).match(/^product:/)))return!0;if(n.headMetaVerification&&("google-site-verification"===lowerIfExists(t.attributes.name)||"yandex-verification"===lowerIfExists(t.attributes.name)||"csrf-token"===lowerIfExists(t.attributes.name)||"p:domain_verify"===lowerIfExists(t.attributes.name)||"verify-v1"===lowerIfExists(t.attributes.name)||"verification"===lowerIfExists(t.attributes.name)||"shopify-checkout-api-token"===lowerIfExists(t.attributes.name)))return!0}}return!1}(D,g)&&(N||D.type!==e.Text||D.isStyle||D.textContent.replace(/^\s+|\s+$/gm,"").length)?genId():a;const L=Object.assign(D,{id:A});if(s.add(t,L),A===a)return null;S&&S(t);let P=!d;if(L.type===e.Element){P=P&&!L.needBlock,delete L.needBlock;const e=t.shadowRoot;e&&isNativeShadowDom(e)&&(L.isShadowHost=!0)}if((L.type===e.Document||L.type===e.Element)&&P){g.headWhitespace&&L.type===e.Element&&"head"===L.tagName&&(N=!1);const n={doc:i,mirror:s,blockClass:c,blockSelector:l,needsMask:T,maskTextClass:u,maskTextSelector:p,skipChild:d,inlineStylesheet:h,maskInputOptions:f,maskTextFn:_,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y,inlineImages:v,recordCanvas:b,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I,onStylesheetLoad:O,stylesheetLoadTimeout:C,keepIframeSrcFn:R};if(L.type===e.Element&&"textarea"===L.tagName&&void 0!==L.attributes.value);else for(const e of Array.from(t.childNodes)){const t=serializeNodeWithId(e,n);t&&L.childNodes.push(t)}if(function isElement(e){return e.nodeType===e.ELEMENT_NODE}(t)&&t.shadowRoot)for(const e of Array.from(t.shadowRoot.childNodes)){const i=serializeNodeWithId(e,n);i&&(isNativeShadowDom(t.shadowRoot)&&(i.isShadow=!0),L.childNodes.push(i))}}return t.parentNode&&isShadowRoot(t.parentNode)&&isNativeShadowDom(t.parentNode)&&(L.isShadow=!0),L.type===e.Element&&"iframe"===L.tagName&&function onceIframeLoaded(e,t,n){const i=e.contentWindow;if(!i)return;let s,a=!1;try{s=i.document.readyState}catch(Z){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)}(t,(()=>{const e=t.contentDocument;if(e&&w){const n=serializeNodeWithId(e,{doc:e,mirror:s,blockClass:c,blockSelector:l,needsMask:T,maskTextClass:u,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:_,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y,inlineImages:v,recordCanvas:b,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I,onStylesheetLoad:O,stylesheetLoadTimeout:C,keepIframeSrcFn:R});n&&w(t,n)}}),I),L.type===e.Element&&"link"===L.tagName&&"string"==typeof L.attributes.rel&&("stylesheet"===L.attributes.rel||"preload"===L.attributes.rel&&"string"==typeof L.attributes.href&&"css"===extractFileExtension(L.attributes.href))&&function onceStylesheetLoaded(e,t,n){let i,s=!1;try{i=e.sheet}catch(Z){return}if(i)return;const a=setTimeout((()=>{s||(t(),s=!0)}),n);e.addEventListener("load",(()=>{clearTimeout(a),s=!0,t()}))}(t,(()=>{if(O){const e=serializeNodeWithId(t,{doc:i,mirror:s,blockClass:c,blockSelector:l,needsMask:T,maskTextClass:u,maskTextSelector:p,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:_,maskInputFn:m,slimDOMOptions:g,dataURLOptions:y,inlineImages:v,recordCanvas:b,preserveWhiteSpace:N,onSerialize:S,onIframeLoad:w,iframeLoadTimeout:I,onStylesheetLoad:O,stylesheetLoadTimeout:C,keepIframeSrcFn:R});e&&O(t,e)}}),C),L}function on(e,t,n=document){const i={capture:!0,passive:!0};return n.addEventListener(e,t,i),()=>n.removeEventListener(e,t,i)}const m="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 g={map:{},getId:()=>(console.error(m),-1),getNode:()=>(console.error(m),null),removeNodeFromMap(){console.error(m)},has:()=>(console.error(m),!1),reset(){console.error(m)}};function throttle(e,t,n={}){let i=null,s=0;return function(...a){const c=Date.now();s||!1!==n.leading||(s=c);const l=t-(c-s),u=this;l<=0||l>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)}),l))}}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&&(g=new Proxy(g,{get:(e,t,n)=>("map"===t&&console.error(m),Reflect.get(e,t,n))}));let y=Date.now;function getWindowScroll(e){var t,n,i,s,a,c;const l=e.document;return{left:l.scrollingElement?l.scrollingElement.scrollLeft:void 0!==e.pageXOffset?e.pageXOffset:(null==l?void 0:l.documentElement.scrollLeft)||(null===(n=null===(t=null==l?void 0:l.body)||void 0===t?void 0:t.parentElement)||void 0===n?void 0:n.scrollLeft)||(null===(i=null==l?void 0:l.body)||void 0===i?void 0:i.scrollLeft)||0,top:l.scrollingElement?l.scrollingElement.scrollTop:void 0!==e.pageYOffset?e.pageYOffset:(null==l?void 0:l.documentElement.scrollTop)||(null===(a=null===(s=null==l?void 0:l.body)||void 0===s?void 0:s.parentElement)||void 0===a?void 0:a.scrollTop)||(null===(c=null==l?void 0:l.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)===a}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())||(y=()=>(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 v=(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))(v||{}),b=(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))(b||{}),S=(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))(S||{}),w=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(w||{}),I=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(I||{});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=a;for(;n===a;)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 O;const callbackWrapper=e=>{if(!O)return e;return(...t)=>{try{return e(...t)}catch(Z){if(O&&!0===O(Z))return;throw Z}}},C=[];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;C.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 l=new a(callbackWrapper(s.processMutations.bind(s)));return l.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),l}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,l=[];let u=null;return Object.keys(S).filter((e=>Number.isNaN(Number(e))&&!e.endsWith("_Departed")&&!1!==c[e])).forEach((a=>{let c=toLowerCase(a);const p=(t=>a=>{const c=getEventTarget(a);if(isBlocked(c,i,s,!0))return;let l=null,p=t;if("pointerType"in a){switch(a.pointerType){case"mouse":l=w.Mouse;break;case"touch":l=w.Touch;break;case"pen":l=w.Pen}l===w.Touch?S[t]===S.MouseDown?p="TouchStart":S[t]===S.MouseUp&&(p="TouchEnd"):w.Pen}else legacy_isTouchEvent(a)&&(l=w.Touch);null!==l?(u=l,(p.startsWith("Touch")&&l===w.Touch||p.startsWith("Mouse")&&l===w.Mouse)&&(l=null)):S[t]===S.Click&&(l=u,u=null);const d=legacy_isTouchEvent(a)?a.changedTouches[0]:a;if(!d)return;const h=n.getId(c),{clientX:f,clientY:_}=d;callbackWrapper(e)(Object.assign({type:S[p],id:h,x:f,y:_},null!==l&&{pointerType:l}))})(a);if(window.PointerEvent)switch(S[a]){case S.MouseDown:case S.MouseUp:c=c.replace("mouse","pointer");break;case S.TouchStart:case S.TouchEnd:return}l.push(on(c,p,t))})),callbackWrapper((()=>{l.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 l=n.getId(c);if(c===t&&t.defaultView){const n=getWindowScroll(t.defaultView);e({id:l,x:n.left,y:n.top})}else e({id:l,x:c.scrollLeft,y:c.scrollTop})})),a.scroll||100)),t)}const R=["INPUT","TEXTAREA","SELECT"],x=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 l="#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==l?void 0:l.prototype)?Object.getOwnPropertyDescriptor(null==l?void 0:l.prototype,"adoptedStyleSheets"):void 0;return null!==c&&-1!==c&&l&&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:l,mediaInteractionCb:u,styleSheetRuleCb:p,styleDeclarationCb:d,canvasMutationCb:h,fontCb:f,selectionCb:_,customElementCb:m}=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),l(...e)},e.mediaInteractionCb=(...e)=>{t.mediaInteaction&&t.mediaInteaction(...e),u(...e)},e.styleSheetRuleCb=(...e)=>{t.styleSheetRule&&t.styleSheetRule(...e),p(...e)},e.styleDeclarationCb=(...e)=>{t.styleDeclaration&&t.styleDeclaration(...e),d(...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),_(...e)},e.customElementCb=(...e)=>{t.customElement&&t.customElement(...e),m(...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,l=[];const u=throttle(callbackWrapper((t=>{const n=Date.now()-c;e(l.map((e=>(e.timeOffset-=n,e))),t),l=[],c=null})),a),p=callbackWrapper(throttle(callbackWrapper((e=>{const t=getEventTarget(e),{clientX:n,clientY:s}=legacy_isTouchEvent(e)?e.changedTouches[0]:e;c||(c=y()),l.push({x:n,y:s,id:i.getId(t),timeOffset:y()-c}),u("undefined"!=typeof DragEvent&&e instanceof DragEvent?b.Drag:e instanceof MouseEvent?b.MouseMove:b.TouchMove)})),s,{trailing:!1})),d=[on("mousemove",p,n),on("touchmove",p,n),on("drag",p,n)];return callbackWrapper((()=>{d.forEach((e=>e()))}))}(e),a=initMouseInteractionObserver(e),c=initScrollObserver(e),l=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:l,maskInputFn:u,sampling:p,userTriggeredOnInput:d}){function eventHandler(e){let n=getEventTarget(e);const p=e.isTrusted,h=n&&n.tagName;if(n&&"OPTION"===h&&(n=n.parentElement),!n||!h||R.indexOf(h)<0||isBlocked(n,i,s,!0))return;if(n.classList.contains(a)||c&&n.matches(c))return;let f=n.value,_=!1;const m=getInputType(n)||"";"radio"===m||"checkbox"===m?_=n.checked:(l[h.toLowerCase()]||l[m])&&(f=maskInputValue({element:n,maskInputOptions:l,tagName:h,type:m,value:f,maskInputFn:u})),cbWithDedup(n,d?{text:f,isChecked:_,userTriggered:p}:{text:f,isChecked:_});const g=n.name;"radio"===m&&g&&_&&t.querySelectorAll(`input[type="radio"][name="${g}"]`).forEach((e=>{if(e!==n){const t=e.value;cbWithDedup(e,d?{text:t,isChecked:!_,userTriggered:!1}:{text:t,isChecked:!_})}}))}function cbWithDedup(t,i){const s=x.get(t);if(!s||s.text!==i.text||s.isChecked!==i.isChecked){x.set(t,i);const s=n.getId(t);callbackWrapper(e)(Object.assign(Object.assign({},i),{id:s}))}}const h=("last"===p.input?["change"]:["input","change"]).map((e=>on(e,callbackWrapper(eventHandler),t))),f=t.defaultView;if(!f)return()=>{h.forEach((e=>e()))};const _=f.Object.getOwnPropertyDescriptor(f.HTMLInputElement.prototype,"value"),m=[[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 _&&_.set&&h.push(...m.map((e=>hookSetter(e[0],e[1],{set(){callbackWrapper(eventHandler)({target:this,isTrusted:!1})}},!1,f)))),callbackWrapper((()=>{h.forEach((e=>e()))}))}(e),p=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:l,volume:u,muted:p,playbackRate:d,loop:h}=c;e({type:a,id:i.getId(c),currentTime:l,volume:u,muted:p,playbackRate:d,loop:h})})),s.media||500))),l=[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((()=>{l.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,l]=a,{id:u,styleId:p}=getIdAndStyleId(s,t,n.styleMirror);return(u&&-1!==u||p&&-1!==p)&&e({id:u,styleId:p,adds:[{rule:c,index:l}]}),i.apply(s,a)}))});const a=i.CSSStyleSheet.prototype.deleteRule;let c,l;i.CSSStyleSheet.prototype.deleteRule=new Proxy(a,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:l,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,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:l,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,styleId:u,replace:c}),i.apply(s,a)}))})),i.CSSStyleSheet.prototype.replaceSync&&(l=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:l,styleId:u}=getIdAndStyleId(s,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,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 p={};return Object.entries(u).forEach((([i,s])=>{p[i]={insertRule:s.prototype.insertRule,deleteRule:s.prototype.deleteRule},s.prototype.insertRule=new Proxy(p[i].insertRule,{apply:callbackWrapper(((i,s,a)=>{const[c,l]=a,{id:u,styleId:p}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(u&&-1!==u||p&&-1!==p)&&e({id:u,styleId:p,adds:[{rule:c,index:[...getNestedCSSRulePositions(s),l||0]}]}),i.apply(s,a)}))}),s.prototype.deleteRule=new Proxy(p[i].deleteRule,{apply:callbackWrapper(((i,s,a)=>{const[c]=a,{id:l,styleId:u}=getIdAndStyleId(s.parentStyleSheet,t,n.styleMirror);return(l&&-1!==l||u&&-1!==u)&&e({id:l,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),l&&(i.CSSStyleSheet.prototype.replaceSync=l),Object.entries(u).forEach((([e,t])=>{t.prototype.insertRule=p[e].insertRule,t.prototype.deleteRule=p[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,l)=>{var u;const[p,d,h]=l;if(n.has(p))return a.apply(c,[p,d,h]);const{id:f,styleId:_}=getIdAndStyleId(null===(u=c.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(f&&-1!==f||_&&-1!==_)&&e({id:f,styleId:_,set:{property:p,value:d,priority:h},index:getNestedCSSRulePositions(c.parentRule)}),s.apply(c,l)}))});const c=s.CSSStyleDeclaration.prototype.removeProperty;return s.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:callbackWrapper(((s,a,l)=>{var u;const[p]=l;if(n.has(p))return c.apply(a,[p]);const{id:d,styleId:h}=getIdAndStyleId(null===(u=a.parentRule)||void 0===u?void 0:u.parentStyleSheet,t,i.styleMirror);return(d&&-1!==d||h&&-1!==h)&&e({id:d,styleId:h,remove:{property:p},index:getNestedCSSRulePositions(a.parentRule)}),s.apply(a,l)}))}),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 d=function initSelectionObserver(e){const{doc:t,mirror:n,blockClass:i,blockSelector:s,selectionCb:a}=e;let c=!0;const l=callbackWrapper((()=>{const e=t.getSelection();if(!e||c&&(null==e?void 0:e.isCollapsed))return;c=e.isCollapsed||!1;const l=[],u=e.rangeCount||0;for(let t=0;t<u;t++){const a=e.getRangeAt(t),{startContainer:c,startOffset:u,endContainer:p,endOffset:d}=a;isBlocked(c,i,s,!0)||isBlocked(p,i,s,!0)||l.push({start:n.getId(c),startOffset:u,end:n.getId(p),endOffset:d})}a({ranges:l})}));return l(),on("selectionchange",l)}(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 _ of e.plugins)f.push(_.observer(_.callback,n,_.options));return callbackWrapper((()=>{C.forEach((e=>e.reset())),null==i||i.disconnect(),s(),a(),c(),l(),u(),p(),styleSheetObserver(),adoptedStyleSheetObserver(),styleDeclarationObserver(),fontObserver(),d(),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 v.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:v.IncrementalSnapshot,data:{source:b.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case v.Meta:case v.Load:case v.DomContentLoaded:return!1;case v.Plugin:return t;case v.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case v.IncrementalSnapshot:switch(t.data.source){case b.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 b.Drag:case b.TouchMove:case b.MouseMove:return t.data.positions.forEach((t=>{this.replaceIds(t,e,["id"])})),t;case b.ViewportResize:return!1;case b.MediaInteraction:case b.MouseInteraction:case b.Scroll:case b.CanvasMutation:case b.Input:return this.replaceIds(t.data,e,["id"]),t;case b.StyleSheetRule:case b.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case b.Font:return t;case b.Selection:return t.data.ranges.forEach((t=>{this.replaceIds(t,e,["start","end"])})),t;case b.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(t,n){t.type===e.Document||t.rootId||(t.rootId=n),"childNodes"in t&&t.childNodes.forEach((e=>{this.patchRootIdOnNode(e,n)}))}}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
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */function __awaiter$1(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 T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",N="undefined"==typeof Uint8Array?[]:new Uint8Array(256),D=0;D<64;D++)N[T.charCodeAt(D)]=D;const A=new Map;const saveWebGLVar=(e,t,n)=>{if(!e||!isInstanceOfWebGLObject(e,t)&&"object"!=typeof e)return;const i=function variableListFor(e,t){let n=A.get(e);return n||(n=new Map,A.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}(n,e.constructor.name);let s=i.indexOf(e);return-1===s&&(s=i.length,i.push(e)),s};function serializeArg(e,t,n){if(e instanceof Array)return e.map((e=>serializeArg(e,t,n)));if(null===e)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray){return{rr_type:e.constructor.name,args:[Object.values(e)]}}if(e instanceof ArrayBuffer){return{rr_type:e.constructor.name,base64:function(e){var t,n=new Uint8Array(e),i=n.length,s="";for(t=0;t<i;t+=3)s+=T[n[t]>>2],s+=T[(3&n[t])<<4|n[t+1]>>4],s+=T[(15&n[t+1])<<2|n[t+2]>>6],s+=T[63&n[t+2]];return i%3==2?s=s.substring(0,s.length-1)+"=":i%3==1&&(s=s.substring(0,s.length-2)+"=="),s}(e)}}if(e instanceof DataView){return{rr_type:e.constructor.name,args:[serializeArg(e.buffer,t,n),e.byteOffset,e.byteLength]}}if(e instanceof HTMLImageElement){const t=e.constructor.name,{src:n}=e;return{rr_type:t,src:n}}if(e instanceof HTMLCanvasElement){return{rr_type:"HTMLImageElement",src:e.toDataURL()}}if(e instanceof ImageData){return{rr_type:e.constructor.name,args:[serializeArg(e.data,t,n),e.width,e.height]}}if(isInstanceOfWebGLObject(e,t)||"object"==typeof e){return{rr_type:e.constructor.name,index:saveWebGLVar(e,t,n)}}return e}const serializeArgs=(e,t,n)=>e.map((e=>serializeArg(e,t,n))),isInstanceOfWebGLObject=(e,t)=>{const n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter((e=>"function"==typeof t[e]));return Boolean(n.find((n=>e instanceof t[n])))};function initCanvasContextObserver(e,t,n,i){const s=[];try{const a=patch(e.HTMLCanvasElement.prototype,"getContext",(function(e){return function(s,...a){if(!isBlocked(this,t,n,!0)){const e=function getNormalizedContextName(e){return"experimental-webgl"===e?"webgl":e}(s);if("__context"in this||(this.__context=e),i&&["webgl","webgl2"].includes(e))if(a[0]&&"object"==typeof a[0]){const e=a[0];e.preserveDrawingBuffer||(e.preserveDrawingBuffer=!0)}else a.splice(0,1,{preserveDrawingBuffer:!0})}return e.apply(this,[s,...a])}}));s.push(a)}catch(a){console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{s.forEach((e=>e()))}}function patchGLPrototype(e,t,n,i,s,a,c){const l=[],u=Object.getOwnPropertyNames(e);for(const d of u)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(d))try{if("function"!=typeof e[d])continue;const a=patch(e,d,(function(e){return function(...a){const l=e.apply(this,a);if(saveWebGLVar(l,c,this),"tagName"in this.canvas&&!isBlocked(this.canvas,i,s,!0)){const e=serializeArgs(a,c,this),i={type:t,property:d,args:e};n(this.canvas,i)}return l}}));l.push(a)}catch(p){const i=hookSetter(e,d,{set(e){n(this.canvas,{type:t,property:d,args:[e],setter:!0})}});l.push(i)}return l}var L=function createInlineWorkerFactory(e,t){var n;return function WorkerFactory2(t){return n=n||function createURL(e,t){var n=function funcToSource(e){var t=e.toString().split("\n");t.pop(),t.shift();for(var n=t[0].search(/\S/),i=/(['"])__worker_loader_strict__(['"])/g,s=0,a=t.length;s<a;++s)t[s]=t[s].substring(n).replace(i,"$1use strict$2")+"\n";return t}(e),i=new Blob(n,{type:"application/javascript"});return URL.createObjectURL(i)}(e),new Worker(n,t)}}((function(){!function(){
|
|
16
|
+
/*! *****************************************************************************
|
|
17
|
+
Copyright (c) Microsoft Corporation.
|
|
18
|
+
|
|
19
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
+
purpose with or without fee is hereby granted.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
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:l,dataURLOptions:u}=e.data,p=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),l=yield c.arrayBuffer(),u=encode2(l);return s.set(i,u),u}return""}))}(c,l,u),d=new OffscreenCanvas(c,l);d.getContext("2d").drawImage(n,0,0),n.close();const h=yield d.convertToBlob(u),f=h.type,_=yield h.arrayBuffer(),m=encode2(_);if(!i.has(t)&&(yield p)===m)return i.set(t,m),a.postMessage({id:t});if(i.get(t)===m)return a.postMessage({id:t});a.postMessage({id:t,type:f,base64:m,width:c,height:l}),i.set(t,m)}}))}}()}));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,l=new L;l.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:I["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 p,d=0;const takeCanvasSnapshots=e=>{d&&e-d<u||(d=e,(()=>{const e=[];return t.document.querySelectorAll("canvas").forEach((t=>{isBlocked(t,n,i,!0)||e.push(t)})),e})().forEach((e=>__awaiter$1(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);l.postMessage({id:n,bitmap:i,width:e.width,height:e.height,dataURLOptions:s.dataURLOptions},[i])}))))),p=requestAnimationFrame(takeCanvasSnapshots)};p=requestAnimationFrame(takeCanvasSnapshots),this.resetObservers=()=>{a(),cancelAnimationFrame(p)}}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 l of a)try{if("function"!=typeof t.CanvasRenderingContext2D.prototype[l])continue;const a=patch(t.CanvasRenderingContext2D.prototype,l,(function(s){return function(...a){return isBlocked(this.canvas,n,i,!0)||setTimeout((()=>{const n=serializeArgs(a,t,this);e(this.canvas,{type:I["2D"],property:l,args:n})}),0),s.apply(this,a)}}));s.push(a)}catch(c){const n=hookSetter(t.CanvasRenderingContext2D.prototype,l,{set(t){e(this.canvas,{type:I["2D"],property:l,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,I.WebGL,e,n,i,0,t)),void 0!==t.WebGL2RenderingContext&&a.push(...patchGLPrototype(t.WebGL2RenderingContext.prototype,I.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=>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,["type"]))),{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:y()})}let P,q,U,j=!1;const B=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:l=null,maskTextClass:u="rr-mask",maskTextSelector:p=null,inlineStylesheet:d=!0,maskAllInputs:h,maskInputOptions:f,slimDOMOptions:_,maskInputFn:m,maskTextFn:g,hooks:y,packFn:S,sampling:w={},dataURLOptions:I={},mousemoveWait:R,recordDOM:x=!0,recordCanvas:T=!1,recordCrossOriginIframes:N=!1,recordAfter:D=("DOMContentLoaded"===e.recordAfter?e.recordAfter:"load"),userTriggeredOnInput:A=!1,collectFonts:L=!1,inlineImages:$=!1,plugins:W,keepIframeSrcFn:z=()=>!1,ignoreCSSAttributes:H=new Set([]),errorHandler:K}=e;!function registerErrorHandler(e){O=e}(K);const G=!N||window.parent===window;let J=!1;if(!G)try{window.parent.document&&(J=!1)}catch(ie){J=!0}if(G&&!t)throw new Error("emit function is required");void 0!==R&&void 0===w.mousemove&&(w.mousemove=R),B.reset();const X=!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===_||"all"===_?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:"all"===_,headMetaDescKeywords:"all"===_}:_||{};let Y;!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 ee=0;const eventProcessor=e=>{for(const t of W||[])t.eventProcessor&&(e=t.eventProcessor(e));return S&&!J&&(e=S(e)),e};P=(e,s)=>{var a;if(!(null===(a=C[0])||void 0===a?void 0:a.isFrozen())||e.type===v.FullSnapshot||e.type===v.IncrementalSnapshot&&e.data.source===b.Mutation||C.forEach((e=>e.unfreeze())),G)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===v.FullSnapshot)Y=e,ee=0;else if(e.type===v.IncrementalSnapshot){if(e.data.source===b.Mutation&&e.data.isAttachIframe)return;ee++;const t=i&&ee>=i,s=n&&e.timestamp-Y.timestamp>n;(t||s)&&q(!0)}};const wrappedMutationEmit=e=>{P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.Mutation},e)}))},wrappedScrollEmit=e=>P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.Scroll},e)})),wrappedCanvasMutationEmit=e=>P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.CanvasMutation},e)})),te=new StylesheetManager({mutationCb:wrappedMutationEmit,adoptedStyleSheetCb:e=>P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.AdoptedStyleSheet},e)}))}),re=new IframeManager({mirror:B,mutationCb:wrappedMutationEmit,stylesheetManager:te,recordCrossOriginIframes:N,wrappedEmit:P});for(const v of W||[])v.getMirror&&v.getMirror({nodeMirror:B,crossOriginIframeMirror:re.crossOriginIframeMirror,crossOriginIframeStyleMirror:re.crossOriginIframeStyleMirror});const ne=new ProcessedNodeManager;U=new CanvasManager({recordCanvas:T,mutationCb:wrappedCanvasMutationEmit,win:window,blockClass:s,blockSelector:a,mirror:B,sampling:w.canvas,dataURLOptions:I});const oe=new ShadowDomManager({mutationCb:wrappedMutationEmit,scrollCb:wrappedScrollEmit,bypassOptions:{blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:p,inlineStylesheet:d,maskInputOptions:X,dataURLOptions:I,maskTextFn:g,maskInputFn:m,recordCanvas:T,inlineImages:$,sampling:w,slimDOMOptions:Q,iframeManager:re,stylesheetManager:te,canvasManager:U,keepIframeSrcFn:z,processedNodeManager:ne},mirror:B});q=(e=!1)=>{if(!x)return;P(wrapEvent({type:v.Meta,data:{href:window.location.href,width:getWindowWidth(),height:getWindowHeight()}}),e),te.reset(),oe.init(),C.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:l=!0,inlineImages:u=!1,recordCanvas:p=!1,maskAllInputs:d=!1,maskTextFn:h,maskInputFn:f,slimDOM:_=!1,dataURLOptions:m,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:l,maskInputOptions:!0===d?{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===d?{password:!0}:d,maskTextFn:h,maskInputFn:f,slimDOMOptions:!0===_||"all"===_?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:"all"===_,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:!1===_?{}:_,dataURLOptions:m,inlineImages:u,recordCanvas:p,preserveWhiteSpace:g,onSerialize:y,onIframeLoad:v,iframeLoadTimeout:b,onStylesheetLoad:S,stylesheetLoadTimeout:w,keepIframeSrcFn:I,newlyAddedElement:!1})}(document,{mirror:B,blockClass:s,blockSelector:a,maskTextClass:u,maskTextSelector:p,inlineStylesheet:d,maskAllInputs:X,maskTextFn:g,slimDOM:Q,dataURLOptions:I,recordCanvas:T,inlineImages:$,onSerialize:e=>{isSerializedIframe(e,B)&&re.addIframe(e),isSerializedStylesheet(e,B)&&te.trackLinkElement(e),hasShadowRoot(e)&&oe.addShadowRoot(e.shadowRoot,document)},onIframeLoad:(e,t)=>{re.attachIframe(e,t),oe.observeAttachShadow(e)},onStylesheetLoad:(e,t)=>{te.attachLinkElement(e,t)},keepIframeSrcFn:z});if(!t)return console.warn("Failed to snapshot the document");P(wrapEvent({type:v.FullSnapshot,data:{node:t,initialOffset:getWindowScroll(window)}}),e),C.forEach((e=>e.unlock())),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&te.adoptStyleSheets(document.adoptedStyleSheets,B.getId(document))};try{const e=[],observe=e=>{var t;return callbackWrapper(initObservers)({mutationCb:wrappedMutationEmit,mousemoveCb:(e,t)=>P(wrapEvent({type:v.IncrementalSnapshot,data:{source:t,positions:e}})),mouseInteractionCb:e=>P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.MouseInteraction},e)})),scrollCb:wrappedScrollEmit,viewportResizeCb:e=>P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.ViewportResize},e)})),inputCb:e=>P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.Input},e)})),mediaInteractionCb:e=>P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.MediaInteraction},e)})),styleSheetRuleCb:e=>P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.StyleSheetRule},e)})),styleDeclarationCb:e=>P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.StyleDeclaration},e)})),canvasMutationCb:wrappedCanvasMutationEmit,fontCb:e=>P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.Font},e)})),selectionCb:e=>{P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.Selection},e)}))},customElementCb:e=>{P(wrapEvent({type:v.IncrementalSnapshot,data:Object.assign({source:b.CustomElement},e)}))},blockClass:s,ignoreClass:c,ignoreSelector:l,maskTextClass:u,maskTextSelector:p,maskInputOptions:X,inlineStylesheet:d,sampling:w,recordDOM:x,recordCanvas:T,inlineImages:$,userTriggeredOnInput:A,collectFonts:L,doc:e,maskInputFn:m,maskTextFn:g,keepIframeSrcFn:z,blockSelector:a,slimDOMOptions:Q,dataURLOptions:I,mirror:B,iframeManager:re,stylesheetManager:te,shadowDomManager:oe,processedNodeManager:ne,canvasManager:U,ignoreCSSAttributes:H,plugins:(null===(t=null==W?void 0:W.filter((e=>e.observer)))||void 0===t?void 0:t.map((e=>({observer:e.observer,options:e.options,callback:t=>P(wrapEvent({type:v.Plugin,data:{plugin:e.name,payload:t}}))}))))||[]},y)};re.addLoadListener((t=>{try{e.push(observe(t.contentDocument))}catch(Z){console.warn(Z)}}));const init2=()=>{q(),e.push(observe(document)),j=!0};return"interactive"===document.readyState||"complete"===document.readyState?init2():(e.push(on("DOMContentLoaded",(()=>{P(wrapEvent({type:v.DomContentLoaded,data:{}})),"DOMContentLoaded"===D&&init2()}))),e.push(on("load",(()=>{P(wrapEvent({type:v.Load,data:{}})),"load"===D&&init2()}),window))),()=>{e.forEach((e=>e())),ne.destroy(),j=!1,function unregisterErrorHandler(){O=void 0}()}}catch(Z){console.warn(Z)}}record.addCustomEvent=(e,t)=>{if(!j)throw new Error("please add custom event after start recording");P(wrapEvent({type:v.Custom,data:{tag:e,payload:t}}))},record.freezePage=()=>{C.forEach((e=>e.freeze()))},record.takeFullSnapshot=e=>{if(!j)throw new Error("please take full snapshot after start recording");q(e)},record.mirror=B;var $,W=(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))(W||{}),z=(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))(z||{}),H={DEBUG:!1,LIB_VERSION:"2.55.1"};if("undefined"==typeof window){var K={hostname:""};$={navigator:{userAgent:"",onLine:!0},document:{location:K,referrer:""},screen:{width:0,height:0},location:K}}else $=window;var G,J,X,Q,Y,Z,ee,te,re,ne,oe=864e5,ie=8e3,se=Array.prototype,ae=Function.prototype,ce=Object.prototype,le=se.slice,ue=ce.toString,pe=ce.hasOwnProperty,de=$.console,he=$.navigator,fe=$.document,_e=$.opera,me=$.screen,ge=he.userAgent,ye=ae.bind,ve=se.forEach,be=se.indexOf,Se=se.map,ke=Array.isArray,we={},Ie={trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},Ee={log:function(){if(H.DEBUG&&!Ie.isUndefined(de)&&de)try{de.log.apply(de,arguments)}catch(e){Ie.each(arguments,(function(e){de.log(e)}))}},warn:function(){if(H.DEBUG&&!Ie.isUndefined(de)&&de){var e=["Mixpanel warning:"].concat(Ie.toArray(arguments));try{de.warn.apply(de,e)}catch(t){Ie.each(e,(function(e){de.warn(e)}))}}},error:function(){if(H.DEBUG&&!Ie.isUndefined(de)&&de){var e=["Mixpanel error:"].concat(Ie.toArray(arguments));try{de.error.apply(de,e)}catch(t){Ie.each(e,(function(e){de.error(e)}))}}},critical:function(){if(!Ie.isUndefined(de)&&de){var e=["Mixpanel error:"].concat(Ie.toArray(arguments));try{de.error.apply(de,e)}catch(t){Ie.each(e,(function(e){de.error(e)}))}}}},log_func_with_prefix=function(e,t){return function(){return arguments[0]="["+t+"] "+arguments[0],e.apply(Ee,arguments)}},console_with_prefix=function(e){return{log:log_func_with_prefix(Ee.log,e),error:log_func_with_prefix(Ee.error,e),critical:log_func_with_prefix(Ee.critical,e)}};Ie.bind=function(e,t){var n,i;if(ye&&e.bind===ye)return ye.apply(e,le.call(arguments,1));if(!Ie.isFunction(e))throw new TypeError;return n=le.call(arguments,2),i=function(){if(!(this instanceof i))return e.apply(t,n.concat(le.call(arguments)));var s={};s.prototype=e.prototype;var a=new s;s.prototype=null;var c=e.apply(a,n.concat(le.call(arguments)));return Object(c)===c?c:a},i},Ie.each=function(e,t,n){if(null!=e)if(ve&&e.forEach===ve)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)===we)return}else for(var a in e)if(pe.call(e,a)&&t.call(n,e[a],a,e)===we)return},Ie.extend=function(e){return Ie.each(le.call(arguments,1),(function(t){for(var n in t)void 0!==t[n]&&(e[n]=t[n])})),e},Ie.isArray=ke||function(e){return"[object Array]"===ue.call(e)},Ie.isFunction=function(e){try{return/^\s*\bfunction\b/.test(e)}catch(t){return!1}},Ie.isArguments=function(e){return!(!e||!pe.call(e,"callee"))},Ie.toArray=function(e){return e?e.toArray?e.toArray():Ie.isArray(e)||Ie.isArguments(e)?le.call(e):Ie.values(e):[]},Ie.map=function(e,t,n){if(Se&&e.map===Se)return e.map(t,n);var i=[];return Ie.each(e,(function(e){i.push(t.call(n,e))})),i},Ie.keys=function(e){var t=[];return null===e||Ie.each(e,(function(e,n){t[t.length]=n})),t},Ie.values=function(e){var t=[];return null===e||Ie.each(e,(function(e){t[t.length]=e})),t},Ie.include=function(e,t){var n=!1;return null===e?n:be&&e.indexOf===be?-1!=e.indexOf(t):(Ie.each(e,(function(e){if(n||(n=e===t))return we})),n)},Ie.includes=function(e,t){return-1!==e.indexOf(t)},Ie.inherit=function(e,t){return e.prototype=new t,e.prototype.constructor=e,e.superclass=t.prototype,e},Ie.isObject=function(e){return e===Object(e)&&!Ie.isArray(e)},Ie.isEmptyObject=function(e){if(Ie.isObject(e)){for(var t in e)if(pe.call(e,t))return!1;return!0}return!1},Ie.isUndefined=function(e){return void 0===e},Ie.isString=function(e){return"[object String]"==ue.call(e)},Ie.isDate=function(e){return"[object Date]"==ue.call(e)},Ie.isNumber=function(e){return"[object Number]"==ue.call(e)},Ie.isElement=function(e){return!(!e||1!==e.nodeType)},Ie.encodeDates=function(e){return Ie.each(e,(function(t,n){Ie.isDate(t)?e[n]=Ie.formatDate(t):Ie.isObject(t)&&(e[n]=Ie.encodeDates(t))})),e},Ie.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},Ie.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())},Ie.strip_empty_properties=function(e){var t={};return Ie.each(e,(function(e,n){Ie.isString(e)&&e.length>0&&(t[n]=e)})),t},Ie.truncate=function(e,t){var n;return"string"==typeof e?n=e.slice(0,t):Ie.isArray(e)?(n=[],Ie.each(e,(function(e){n.push(Ie.truncate(e,t))}))):Ie.isObject(e)?(n={},Ie.each(e,(function(e,i){n[i]=Ie.truncate(e,t)}))):n=e,n},Ie.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,l=n,u=[],p=t[e];switch(p&&"object"==typeof p&&"function"==typeof p.toJSON&&(p=p.toJSON(e)),typeof p){case"string":return quote(p);case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":return String(p);case"object":if(!p)return"null";if(n+=" ",u=[],"[object Array]"===ue.apply(p)){for(c=p.length,i=0;i<c;i+=1)u[i]=str(i,p)||"null";return a=0===u.length?"[]":n?"[\n"+n+u.join(",\n"+n)+"\n"+l+"]":"["+u.join(",")+"]",n=l,a}for(s in p)pe.call(p,s)&&(a=str(s,p))&&u.push(quote(s)+(n?": ":":")+a);return a=0===u.length?"{}":n?"{"+u.join(",")+l+"}":"{"+u.join(",")+"}",n=l,a}};return str("",{"":e})}}(),Ie.JSONDecode=(Y={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},Z=function(e){var t=new SyntaxError(e);throw t.at=G,t.text=X,t},ee=function(e){return e&&e!==J&&Z("Expected '"+e+"' instead of '"+J+"'"),J=X.charAt(G),G+=1,J},te=function(){var e,t="";for("-"===J&&(t="-",ee("-"));J>="0"&&J<="9";)t+=J,ee();if("."===J)for(t+=".";ee()&&J>="0"&&J<="9";)t+=J;if("e"===J||"E"===J)for(t+=J,ee(),"-"!==J&&"+"!==J||(t+=J,ee());J>="0"&&J<="9";)t+=J,ee();if(e=+t,isFinite(e))return e;Z("Bad number")},re=function(){var e,t,n,i="";if('"'===J)for(;ee();){if('"'===J)return ee(),i;if("\\"===J)if(ee(),"u"===J){for(n=0,t=0;t<4&&(e=parseInt(ee(),16),isFinite(e));t+=1)n=16*n+e;i+=String.fromCharCode(n)}else{if("string"!=typeof Y[J])break;i+=Y[J]}else i+=J}Z("Bad string")},ne=function(){for(;J&&J<=" ";)ee()},Q=function(){switch(ne(),J){case"{":return function(){var e,t={};if("{"===J){if(ee("{"),ne(),"}"===J)return ee("}"),t;for(;J;){if(e=re(),ne(),ee(":"),Object.hasOwnProperty.call(t,e)&&Z('Duplicate key "'+e+'"'),t[e]=Q(),ne(),"}"===J)return ee("}"),t;ee(","),ne()}}Z("Bad object")}();case"[":return function(){var e=[];if("["===J){if(ee("["),ne(),"]"===J)return ee("]"),e;for(;J;){if(e.push(Q()),ne(),"]"===J)return ee("]"),e;ee(","),ne()}}Z("Bad array")}();case'"':return re();case"-":return te();default:return J>="0"&&J<="9"?te():function(){switch(J){case"t":return ee("t"),ee("r"),ee("u"),ee("e"),!0;case"f":return ee("f"),ee("a"),ee("l"),ee("s"),ee("e"),!1;case"n":return ee("n"),ee("u"),ee("l"),ee("l"),null}Z('Unexpected "'+J+'"')}()}},function(e){var t;return X=e,G=0,J=" ",t=Q(),ne(),J&&Z("Syntax error"),t}),Ie.base64Encode=function(e){var t,n,i,s,a,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=0,u=0,p="",d=[];if(!e)return e;e=Ie.utf8Encode(e);do{t=(a=e.charCodeAt(l++)<<16|e.charCodeAt(l++)<<8|e.charCodeAt(l++))>>18&63,n=a>>12&63,i=a>>6&63,s=63&a,d[u++]=c.charAt(t)+c.charAt(n)+c.charAt(i)+c.charAt(s)}while(l<e.length);switch(p=d.join(""),e.length%3){case 1:p=p.slice(0,-2)+"==";break;case 2:p=p.slice(0,-1)+"="}return p},Ie.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),l=null;c<128?n++:l=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!==l&&(n>t&&(a+=e.substring(t,n)),a+=l,t=n=s+1)}return n>t&&(a+=e.substring(t,e.length)),a},Ie.UUID=function(){var T2=function(){var e,t=1*new Date;if($.performance&&$.performance.now)e=$.performance.now();else for(e=0;t==1*new Date;)e++;return t.toString(16)+Math.floor(e).toString(16)};return function(){var e=(me.height*me.width).toString(16);return T2()+"-"+Math.random().toString(16).replace(".","")+"-"+function(){var e,t,n=ge,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 Oe=["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"];Ie.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<Oe.length;t++)if(-1!==e.indexOf(Oe[t]))return!0;return!1},Ie.HTTPBuildQuery=function(e,t){var n,i,s=[];return Ie.isUndefined(t)&&(t="&"),Ie.each(e,(function(e,t){n=encodeURIComponent(e.toString()),i=encodeURIComponent(t),s[s.length]=i+"="+n})),s.join(t)},Ie.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){Ee.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")},Ie.cookie={get:function(e){for(var t=e+"=",n=fe.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=Ie.JSONDecode(Ie.cookie.get(e))||{}}catch(n){}return t},set_seconds:function(e,t,n,i,s,a,c){var l="",u="",p="";if(c)l="; domain="+c;else if(i){var d=extract_domain(fe.location.hostname);l=d?"; domain=."+d:""}if(n){var h=new Date;h.setTime(h.getTime()+1e3*n),u="; expires="+h.toGMTString()}a&&(s=!0,p="; SameSite=None"),s&&(p+="; secure"),fe.cookie=e+"="+encodeURIComponent(t)+u+"; path=/"+l+p},set:function(e,t,n,i,s,a,c){var l="",u="",p="";if(c)l="; domain="+c;else if(i){var d=extract_domain(fe.location.hostname);l=d?"; domain=."+d:""}if(n){var h=new Date;h.setTime(h.getTime()+24*n*60*60*1e3),u="; expires="+h.toGMTString()}a&&(s=!0,p="; SameSite=None"),s&&(p+="; secure");var f=e+"="+encodeURIComponent(t)+u+"; path=/"+l+p;return fe.cookie=f,f},remove:function(e,t,n){Ie.cookie.set(e,"",-1,t,!1,!1,n)}};var Ce=null,localStorageSupported=function(e,t){if(null!==Ce&&!t)return Ce;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 Ce=n,n};Ie.localStorage={is_supported:function(e){var t=localStorageSupported(null,e);return t||Ee.error("localStorage unsupported; falling back to cookie store"),t},error:function(e){Ee.error("localStorage error: "+e)},get:function(e){try{return window.localStorage.getItem(e)}catch(t){Ie.localStorage.error(t)}return null},parse:function(e){try{return Ie.JSONDecode(Ie.localStorage.get(e))||{}}catch(t){}return null},set:function(e,t){try{window.localStorage.setItem(e,t)}catch(n){Ie.localStorage.error(n)}},remove:function(e){try{window.localStorage.removeItem(e)}catch(t){Ie.localStorage.error(t)}}},Ie.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 Ie.isFunction(n)&&(s=n(i)),a=t.call(e,i),!1!==s&&!1!==a||(c=!1),c}};return handler}(e,n,c)}else Ee.error("No valid element provided to register_event")}}();var Me=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');Ie.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(!fe.getElementsByTagName)return[];var t,n,i,s,a,c,l,u,p,d,h=e.split(" "),f=[fe];for(c=0;c<h.length;c++)if((t=h[c].replace(/^\s+/,"").replace(/\s+$/,"")).indexOf("#")>-1){i=(n=t.split("#"))[0];var _=n[1],m=fe.getElementById(_);if(!m||i&&m.nodeName.toLowerCase()!=i)return[];f=[m]}else if(t.indexOf(".")>-1){i=(n=t.split("."))[0];var g=n[1];for(i||(i="*"),s=[],a=0,l=0;l<f.length;l++)for(p="*"==i?getAllChildren(f[l]):f[l].getElementsByTagName(i),u=0;u<p.length;u++)s[a++]=p[u];for(f=[],d=0,l=0;l<s.length;l++)s[l].className&&Ie.isString(s[l].className)&&hasClass(s[l],g)&&(f[d++]=s[l])}else{var y=t.match(Me);if(y){i=y[1];var v,b=y[2],S=y[3],w=y[4];for(i||(i="*"),s=[],a=0,l=0;l<f.length;l++)for(p="*"==i?getAllChildren(f[l]):f[l].getElementsByTagName(i),u=0;u<p.length;u++)s[a++]=p[u];switch(f=[],d=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=[],d=0,l=0;l<s.length;l++)v(s[l])&&(f[d++]=s[l])}else{for(i=t,s=[],a=0,l=0;l<f.length;l++)for(p=f[l].getElementsByTagName(i),u=0;u<p.length;u++)s[a++]=p[u];f=s}}return f}return function(e){return Ie.isElement(e)?[e]:Ie.isObject(e)&&!Ie.isUndefined(e.length)?e:getElementsBySelector.call(this,e)}}();var Re=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],xe=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];Ie.info={campaignParams:function(e){var t="",n={};return Ie.each(Re,(function(i){(t=Ie.getQueryParam(fe.URL,i)).length?n[i]=t:void 0!==e&&(n[i]=e)})),n},clickParams:function(){var e="",t={};return Ie.each(xe,(function(n){(e=Ie.getQueryParam(fe.URL,n)).length&&(t[n]=e)})),t},marketingParams:function(){return Ie.extend(Ie.info.campaignParams(),Ie.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=Ie.info.searchEngine(e),n="yahoo"!=t?"q":"p",i={};if(null!==t){i.$search_engine=t;var s=Ie.getQueryParam(e,n);s.length&&(i.mp_keyword=s)}return i},browser:function(e,t,n){return t=t||"",n||Ie.includes(e," OPR/")?Ie.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":Ie.includes(e,"IEMobile")||Ie.includes(e,"WPDesktop")?"Internet Explorer Mobile":Ie.includes(e,"SamsungBrowser/")?"Samsung Internet":Ie.includes(e,"Edge")||Ie.includes(e,"Edg/")?"Microsoft Edge":Ie.includes(e,"FBIOS")?"Facebook Mobile":Ie.includes(e,"Chrome")?"Chrome":Ie.includes(e,"CriOS")?"Chrome iOS":Ie.includes(e,"UCWEB")||Ie.includes(e,"UCBrowser")?"UC Browser":Ie.includes(e,"FxiOS")?"Firefox iOS":Ie.includes(t,"Apple")?Ie.includes(e,"Mobile")?"Mobile Safari":"Safari":Ie.includes(e,"Android")?"Android Mobile":Ie.includes(e,"Konqueror")?"Konqueror":Ie.includes(e,"Firefox")?"Firefox":Ie.includes(e,"MSIE")||Ie.includes(e,"Trident/")?"Internet Explorer":Ie.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+)?)/}[Ie.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=ge;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 $.location.href},properties:function(e){return"object"!=typeof e&&(e={}),Ie.extend(Ie.strip_empty_properties({$os:Ie.info.os(),$browser:Ie.info.browser(ge,he.vendor,_e),$referrer:fe.referrer,$referring_domain:Ie.info.referringDomain(fe.referrer),$device:Ie.info.device(ge)}),{$current_url:Ie.info.currentUrl(),$browser_version:Ie.info.browserVersion(ge,he.vendor,_e),$screen_height:me.height,$screen_width:me.width,mp_lib:"web",$lib_version:H.LIB_VERSION,$insert_id:cheap_guid(),time:Ie.timestamp()/1e3},Ie.strip_empty_properties(e))},people_properties:function(){return Ie.extend(Ie.strip_empty_properties({$os:Ie.info.os(),$browser:Ie.info.browser(ge,he.vendor,_e)}),{$browser_version:Ie.info.browserVersion(ge,he.vendor,_e)})},mpPageViewProperties:function(){return Ie.strip_empty_properties({current_page_title:fe.title,current_domain:$.location.hostname,current_url_path:$.location.pathname,current_url_protocol:$.location.protocol,current_url_search:$.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},Te=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,Ne=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,extract_domain=function(e){var t=Ne,n=e.split("."),i=n[n.length-1];(i.length>4||"com"===i||"org"===i)&&(t=Te);var s=e.match(t);return s?s[0]:""},De=null,Ae=null;"undefined"!=typeof JSON&&(De=JSON.stringify,Ae=JSON.parse),De=De||Ie.JSONEncode,Ae=Ae||Ie.JSONDecode,Ie.toArray=Ie.toArray,Ie.isObject=Ie.isObject,Ie.JSONEncode=Ie.JSONEncode,Ie.JSONDecode=Ie.JSONDecode,Ie.isBlockedUA=Ie.isBlockedUA,Ie.isEmptyObject=Ie.isEmptyObject,Ie.info=Ie.info,Ie.info.device=Ie.info.device,Ie.info.browser=Ie.info.browser,Ie.info.browserVersion=Ie.info.browserVersion,Ie.info.properties=Ie.info.properties;var Le="__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||$,n=t.navigator||{},i=!1;return Ie.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],(function(e){Ie.includes([!0,1,"1","yes"],e)&&(i=!0)})),i}(t))return Ee.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&&Ee.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?Ie.localStorage:Ie.cookie}function _getStorageKey(e,t){return((t=t||{}).persistencePrefix||Le)+e}function _getStorageValue(e,t){return _getStorage(t).get(_getStorageKey(e,t))}function _optInOut(e,t,n){Ie.isString(t)&&t.length?(_getStorage(n=n||{}).set(_getStorageKey(t,n),e?1:0,Ie.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})):Ee.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"),l=t.call(this,"window");i&&(n=hasOptedOut(i,{ignoreDnt:s,persistenceType:a,persistencePrefix:c,window:l}))}catch(p){Ee.error("Unexpected error when checking tracking opt-out status: "+p)}if(!n)return e.apply(this,arguments);var u=arguments[arguments.length-1];"function"==typeof u&&u(0)}}var Pe=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,l=this.timeoutMS,u=this.storage,p=a+":X",d=a+":Y",h=a+":Z",reportError=function(e){t&&t(e)},delay=function(e){if((new Date).getTime()-s>l)return Pe.error("Timeout waiting for mutex on "+a+"; clearing lock. ["+i+"]"),u.removeItem(h),u.removeItem(d),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(d);if(e&&e!==i)return!1;if(u.setItem(d,i),u.getItem(d)===i)return!0;if(!localStorageSupported(u,!0))throw new Error("localStorage support dropped while acquiring lock");return!1},loop=function(){u.setItem(p,i),waitFor(getSetY,(function(){u.getItem(p)!==i?delay((function(){u.getItem(d)===i?waitFor((function(){return!u.getItem(h)}),criticalSection):loop()})):criticalSection()}))},criticalSection=function(){u.setItem(h,"1");try{e()}finally{u.removeItem(h),u.getItem(d)===i&&u.removeItem(d),u.getItem(p)===i&&u.removeItem(p)}};try{if(!localStorageSupported(u,!0))throw new Error("localStorage support check failed");loop()}catch(f){reportError(f)}};var Fe=console_with_prefix("batch"),RequestQueue=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||window.localStorage,this.reportError=t.errorReporter||Ie.bind(Fe.error,Fe),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(Ie.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),Ie.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={};Ie.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 Ie.each(e,(function(e){e.id&&!t[e.id]&&n.push(e)})),n};RequestQueue.prototype.removeItemsByID=function(e,t){var n={};if(Ie.each(e,(function(e){n[e]=!0})),this.memQueue=filterOutIDsAndInvalid(this.memQueue,n),this.usePersistence){var i=Ie.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)}),Ie.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 Ie.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(Ie.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),Ie.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=Ae(e),Ie.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,De(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 qe=console_with_prefix("batch"),RequestBatcher=function(e,t){this.errorReporter=t.errorReporter,this.queue=new RequestQueue(e,{errorReporter:Ie.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(Ie.bind((function(){this.stopped||this.flush()}),this),this.flushInterval))},RequestBatcher.prototype.flush=function(e){try{if(this.requestInProgress)return void qe.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=[],l={};if(Ie.each(s,(function(e){var t=e.payload;if(this.beforeSendHook&&!e.orphaned&&(t=this.beforeSendHook(t)),t){t.event&&t.properties&&(t.properties=Ie.extend({},t.properties,{mp_sent_by_lib_version:H.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)}l[e.id]=t}),this),c.length<1)return void this.resetFlush();this.requestInProgress=!0;var u=Ie.bind((function(c){this.requestInProgress=!1;try{var u=!1;if(e.unloading)this.queue.updatePayloads(l);else if(Ie.isObject(c)&&"timeout"===c.error&&(new Date).getTime()-n>=t)this.reportError("Network timeout; retrying"),this.flush();else if(Ie.isObject(c)&&(c.httpStatusCode>=500||429===c.httpStatusCode||c.httpStatusCode<=0&&(h=$.navigator.onLine,!Ie.isUndefined(h)&&!h)||"timeout"===c.error)){var p=2*this.flushInterval;c.retryAfter&&(p=1e3*parseInt(c.retryAfter,10)||p),p=Math.min(6e5,p),this.reportError("Error; retry in "+p+" ms"),this.scheduleFlush(p)}else if(Ie.isObject(c)&&413===c.httpStatusCode)if(s.length>1){var d=Math.max(1,Math.floor(i/2));this.batchSize=Math.min(this.batchSize,d,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(Ie.map(s,(function(e){return e.id})),Ie.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)),Ie.each(s,Ie.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),p={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};e.unloading&&(p.transport="sendBeacon"),qe.log("MIXPANEL REQUEST:",c),this.sendRequest(c,p,u)}catch(d){this.reportError("Error flushing request queue",d),this.resetFlush()}},RequestBatcher.prototype.reportError=function(e,t){if(qe.error.apply(qe.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){qe.error(n)}};var Ue=console_with_prefix("recorder"),je=$.CompressionStream,Be={batch_size:1e3,batch_flush_interval_ms:1e4,batch_request_timeout_ms:9e4,batch_autostart:!0},$e=new Set([z.MouseMove,z.MouseInteraction,z.Scroll,z.ViewportResize,z.Input,z.TouchMove,z.MediaInteraction,z.Drag,z.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=oe,this.recordMinMs=0,this._initBatcher()};MixpanelRecorder.prototype._initBatcher=function(){this.batcher=new RequestBatcher("__mprec",{libConfig:Be,sendRequestFunc:Ie.bind(this.flushEventsWithOptOut,this),errorReporter:Ie.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>oe&&(this.recordMaxMs=oe,Ue.critical("record_max_ms cannot be greater than "+oe+"ms. Capping value.")),this.recordMinMs=this.get_config("record_min_ms"),this.recordMinMs>ie&&(this.recordMinMs=ie,Ue.critical("record_min_ms cannot be greater than 8000ms. Capping value.")),this.recEvents=[],this.seqNo=0,this.replayStartTime=(new Date).getTime(),this.replayId=Ie.UUID(),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=Ie.bind((function(){clearTimeout(this.idleTimeoutId),this.idleTimeoutId=setTimeout(Ie.bind((function(){Ue.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:Ie.bind((function(e){this.batcher.enqueue(e),function isUserEvent(e){return e.type===W.IncrementalSnapshot&&$e.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(Ie.bind(this.resetRecording,this),this.recordMaxMs)}else Ue.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,Ie.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=Ie.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);$.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,l={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=Ie.JSONEncode(e),p=this._mixpanel.get_property("$device_id");p&&(l.$device_id=p);var d=this._mixpanel.get_property("$user_id");if(d&&(l.$user_id=d),je){var h=new Blob([u],{type:"application/json"}).stream().pipeThrough(new je("gzip"));new Response(h).blob().then(Ie.bind((function(e){l.format="gzip",this._sendRequest(s,l,e,n)}),this))}else l.format="body",this._sendRequest(s,l,u,n)}})),MixpanelRecorder.prototype.reportError=function(e,t){Ue.error.apply(Ue.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Ue.error(n)}},$.__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=Ie.dom_query(e);if(0!==a.length)return Ie.each(a,(function(e){Ie.register_event(e,this.override_event,(function(e){var a={},c=s.create_properties(n,this),l=s.mp.get_config("track_links_timeout");s.event_handler(e,this,a),window.setTimeout(s.track_callback(i,c,a,!0),l),s.mp.track(t,c,s.track_callback(i,c,a))}))}),this),!0;Ee.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):Ie.extend({},e)};var LinkTracker=function(){this.override_event="click"};Ie.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"};Ie.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 We="$set",ze="$set_once",Ve="$unset",He="$add",Ke="$append",Ge="$union",Je="$remove",Xe={set_action:function(e,t){var n={},i={};return Ie.isObject(e)?Ie.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[We]=i,n},unset_action:function(e){var t={},n=[];return Ie.isArray(e)||(e=[e]),Ie.each(e,(function(e){this._is_reserved_property(e)||n.push(e)}),this),t[Ve]=n,t},set_once_action:function(e,t){var n={},i={};return Ie.isObject(e)?Ie.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[ze]=i,n},union_action:function(e,t){var n={},i={};return Ie.isObject(e)?Ie.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=Ie.isArray(e)?e:[e])}),this):i[e]=Ie.isArray(t)?t:[t],n[Ge]=i,n},append_action:function(e,t){var n={},i={};return Ie.isObject(e)?Ie.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Ke]=i,n},remove_action:function(e,t){var n={},i={};return Ie.isObject(e)?Ie.each(e,(function(e,t){this._is_reserved_property(t)||(i[t]=e)}),this):i[e]=t,n[Je]=i,n},delete_action:function(){var e={$delete:""};return e}},MixpanelGroup=function(){};Ie.extend(MixpanelGroup.prototype,Xe),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 Ie.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 Ie.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){Ie.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=Ie.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(){};Ie.extend(MixpanelPeople.prototype,Xe),MixpanelPeople.prototype._init=function(e){this._mixpanel=e},MixpanelPeople.prototype.set=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_action(e,t);return Ie.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),i[We]=Ie.extend({},Ie.info.people_properties(),i[We]),this._send_request(i,n)})),MixpanelPeople.prototype.set_once=addOptOutCheckMixpanelPeople((function(e,t,n){var i=this.set_once_action(e,t);return Ie.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 Ie.isObject(e)?(Ie.each(e,(function(e,t){if(!this._is_reserved_property(t)){if(isNaN(parseFloat(e)))return void Ee.error("Invalid increment value passed to mixpanel.people.increment - must be a number");s[t]=e}}),this),n=t):(Ie.isUndefined(t)&&(t=1),s[e]=t),i[He]=s,this._send_request(i,n)})),MixpanelPeople.prototype.append=addOptOutCheckMixpanelPeople((function(e,t,n){Ie.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){Ie.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){Ie.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(Ie.isNumber(e)||(e=parseFloat(e),!isNaN(e)))return this.append("$transactions",Ie.extend({$amount:e},t),n);Ee.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)}Ee.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=Ie.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),Ie.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),Ie.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){We in e?this._mixpanel.persistence._add_to_people_queue(We,e):ze in e?this._mixpanel.persistence._add_to_people_queue(ze,e):Ve in e?this._mixpanel.persistence._add_to_people_queue(Ve,e):He in e?this._mixpanel.persistence._add_to_people_queue(He,e):Ke in e?this._mixpanel.persistence._add_to_people_queue(Ke,e):Je in e?this._mixpanel.persistence._add_to_people_queue(Je,e):Ge in e?this._mixpanel.persistence._add_to_people_queue(Ge,e):Ee.error("Invalid call to _enqueue():",e)},MixpanelPeople.prototype._flush_one_queue=function(e,t,n,i){var s=this,a=Ie.extend({},this._mixpanel.persistence.load_queue(e)),c=a;Ie.isUndefined(a)||!Ie.isObject(a)||Ie.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),Ie.isUndefined(n)||n(t,i)})))},MixpanelPeople.prototype._flush=function(e,t,n,i,s,a,c){var l=this;this._flush_one_queue(We,this.set,e),this._flush_one_queue(ze,this.set_once,i),this._flush_one_queue(Ve,this.unset,a,(function(e){return Ie.keys(e)})),this._flush_one_queue(He,this.increment,t),this._flush_one_queue(Ge,this.union,s);var u=this._mixpanel.persistence.load_queue(Ke);if(!Ie.isUndefined(u)&&Ie.isArray(u)&&u.length)for(var p,append_callback=function(e,t){0===e&&l._mixpanel.persistence._add_to_people_queue(Ke,p),Ie.isUndefined(n)||n(e,t)},d=u.length-1;d>=0;d--)u=this._mixpanel.persistence.load_queue(Ke),p=u.pop(),l._mixpanel.persistence.save(),Ie.isEmptyObject(p)||l.append(p,append_callback);var h=this._mixpanel.persistence.load_queue(Je);if(!Ie.isUndefined(h)&&Ie.isArray(h)&&h.length)for(var f,remove_callback=function(e,t){0===e&&l._mixpanel.persistence._add_to_people_queue(Je,f),Ie.isUndefined(c)||c(e,t)},_=h.length-1;_>=0;_--)h=this._mixpanel.persistence.load_queue(Je),f=h.pop(),l._mixpanel.persistence.save(),Ie.isEmptyObject(f)||l.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 Qe,Ye="__mps",Ze="__mpso",et="__mpus",tt="__mpa",rt="__mpap",nt="__mpr",ot="__mpu",it="$people_distinct_id",st="__alias",at="__timers",ct=[Ye,Ze,et,tt,rt,nt,ot,it,st,at],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&&(Ee.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),"localStorage"===t&&Ie.localStorage.is_supported()?this.storage=Ie.localStorage:this.storage=Ie.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};MixpanelPersistence.prototype.properties=function(){var e={};return this.load(),Ie.each(this.props,(function(t,n){Ie.include(ct,n)||(e[n]=t)})),e},MixpanelPersistence.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=Ie.extend({},e))}},MixpanelPersistence.prototype.upgrade=function(){var e,t;this.storage===Ie.localStorage?(e=Ie.cookie.parse(this.name),Ie.cookie.remove(this.name),Ie.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===Ie.cookie&&(t=Ie.localStorage.parse(this.name),Ie.localStorage.remove(this.name),t&&this.register_once(t))},MixpanelPersistence.prototype.save=function(){this.disabled||this.storage.set(this.name,Ie.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!!Ie.isObject(e)&&(void 0===t&&(t="None"),this.expire_days=void 0===n?this.default_expiry:n,this.load(),Ie.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!!Ie.isObject(e)&&(this.expire_days=void 0===t?this.default_expiry:t,this.load(),Ie.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(Ie.info.searchInfo(e))},MixpanelPersistence.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:Ie.info.referringDomain(e)||"$direct"},"")},MixpanelPersistence.prototype.get_referrer_info=function(){return Ie.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(We),a=this._get_or_create_queue(ze),c=this._get_or_create_queue(Ve),l=this._get_or_create_queue(He),u=this._get_or_create_queue(Ge),p=this._get_or_create_queue(Je,[]),d=this._get_or_create_queue(Ke,[]);n===Ye?(Ie.extend(s,i),this._pop_from_people_queue(He,i),this._pop_from_people_queue(Ge,i),this._pop_from_people_queue(Ve,i)):n===Ze?(Ie.each(i,(function(e,t){t in a||(a[t]=e)})),this._pop_from_people_queue(Ve,i)):n===et?Ie.each(i,(function(e){Ie.each([s,a,l,u],(function(t){e in t&&delete t[e]})),Ie.each(d,(function(t){e in t&&delete t[e]})),c[e]=!0})):n===tt?(Ie.each(i,(function(e,t){t in s?s[t]+=e:(t in l||(l[t]=0),l[t]+=e)}),this),this._pop_from_people_queue(Ve,i)):n===ot?(Ie.each(i,(function(e,t){Ie.isArray(e)&&(t in u||(u[t]=[]),u[t]=u[t].concat(e))})),this._pop_from_people_queue(Ve,i)):n===nt?(p.push(i),this._pop_from_people_queue(Ke,i)):n===rt&&(d.push(i),this._pop_from_people_queue(Ve,i)),Ee.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Ee.log(t),this.save()},MixpanelPersistence.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];Ie.isUndefined(n)||Ie.each(t,(function(t,i){e===Ke||e===Je?Ie.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===We?Ye:e===ze?Ze:e===Ve?et:e===He?tt:e===Ke?rt:e===Je?nt:e===Ge?ot:void Ee.error("Invalid queue:",e)},MixpanelPersistence.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=Ie.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},MixpanelPersistence.prototype.set_event_timer=function(e,t){var n=this.load_prop(at)||{};n[e]=t,this.props[at]=n,this.save()},MixpanelPersistence.prototype.remove_event_timer=function(e){var t=(this.load_prop(at)||{})[e];return Ie.isUndefined(t)||(delete this.props[at][e],this.save()),t};var lt,load_extra_bundle=function(e,t){throw new Error(e+" not available in this build.")},IDENTITY_FUNC=function(e){return e},NOOP_FUNC=function(){},ut="mixpanel",pt="base64",dt="$device:",ht=$.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,ft=!ht&&-1===ge.indexOf("MSIE")&&-1===ge.indexOf("Mozilla"),_t=null;he.sendBeacon&&(_t=function(){return he.sendBeacon.apply(he,arguments)});var mt={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},gt={api_host:"https://api-js.mixpanel.com",api_routes:mt,api_method:"POST",api_transport:"XHR",api_payload_format:pt,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:oe,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},yt=!1,MixpanelLib=function(){},create_mplib=function(e,t,n){var i,s=n===ut?lt:lt[n];if(s&&0===Qe)i=s;else{if(s&&!Ie.isArray(s))return void Ee.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=Ie.info.campaignParams(null),c={},l=!1;Ie.each(a,(function(e,t){c["initial_"+t]=e,e&&(l=!0)})),l&&i.people.set_once(c)}return H.DEBUG=H.DEBUG||i.get_config("debug"),!Ie.isUndefined(s)&&Ie.isArray(s)&&(i._execute_array.call(i.people,s.people),i._execute_array(s)),i};MixpanelLib.prototype.init=function(e,t,n){if(Ie.isUndefined(n))this.report_error("You must name your new library: init(token, config, name)");else{if(n!==ut){var i=create_mplib(e,t,n);return lt[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||gt.api_host).match(/\.mixpanel\.com/)&&(i.api_payload_format="json");if(this.set_config(Ie.extend({},gt,i,t,{name:n,token:e,callback_fn:(n===ut?n:ut+"."+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(Ie.localStorage.is_supported(!0)&&ht){if(this.init_batchers(),_t&&$.addEventListener){var s=Ie.bind((function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})}),this);$.addEventListener("pagehide",(function(e){e.persisted&&s()})),$.addEventListener("visibilitychange",(function(){"hidden"===fe.visibilityState&&s()}))}}else this._batch_requests=!1,Ee.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),Ie.each(this.get_batcher_configs(),(function(e){Ee.log("Clearing batch queue "+e.queue_key),Ie.localStorage.remove(e.queue_key)}));this.persistence=this.cookie=new MixpanelPersistence(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=Ie.UUID();this.get_distinct_id()||this.register_once({distinct_id:dt+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($.MutationObserver){var e=Ie.bind((function(){this._recorder=this._recorder||new $.__mp_recorder(this),this._recorder.startRecording()}),this);Ie.isUndefined($.__mp_recorder)?load_extra_bundle(this.get_config("recorder_src"),e):e()}else Ee.critical("Browser does not support MutationObserver; skipping session recording")})),MixpanelLib.prototype.stop_session_recording=function(){this._recorder?this._recorder.stopRecording():Ee.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=Ie.info.campaignParams(null);Ie.each(e,function(e,t){this.unregister(t)}.bind(this))}},MixpanelLib.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(fe.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(Ie.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(fe.referrer)},MixpanelLib.prototype._dom_loaded=function(){Ie.each(this.__dom_loaded_queue,(function(e){this._track_dom.apply(this,e)}),this),this.has_opted_out_tracking()||Ie.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(!yt)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=Ie.info.currentUrl()),Ie.include(["full-url","url-with-path-and-query-string","url-with-path"],e)){$.addEventListener("popstate",(function(){$.dispatchEvent(new Event("mp_locationchange"))})),$.addEventListener("hashchange",(function(){$.dispatchEvent(new Event("mp_locationchange"))}));var n=$.history.pushState;"function"==typeof n&&($.history.pushState=function(e,t,i){n.call($.history,e,t,i),$.dispatchEvent(new Event("mp_locationchange"))});var i=$.history.replaceState;"function"==typeof i&&($.history.replaceState=function(e,t,n){i.call($.history,e,t,n),$.dispatchEvent(new Event("mp_locationchange"))}),$.addEventListener("mp_locationchange",function(){var n=Ie.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(Ie.isUndefined(e))return null;if(ht){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(ft)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||!Ie.isFunction(n)&&"string"!=typeof n||(i=n,n=null),n=Ie.extend(a,n||{}),ht||(n.method="GET");var l="POST"===n.method,u=_t&&l&&"sendbeacon"===n.transport.toLowerCase(),p=n.verbose;t.verbose&&(p=!0),this.get_config("test")&&(t.test=1),p&&(t.verbose=1),this.get_config("img")&&(t.img=1),ht||(i?t.callback=i:(p||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=(new Date).getTime().toString(),l&&(c="data="+encodeURIComponent(t.data),delete t.data),e+="?"+Ie.HTTPBuildQuery(t);var d=this;if("img"in t){var h=fe.createElement("img");h.src=e,fe.body.appendChild(h)}else if(u){try{s=_t(e,c)}catch(v){d.report_error(v),s=!1}try{i&&i(s?1:0)}catch(v){d.report_error(v)}}else if(ht)try{var f=new XMLHttpRequest;f.open(n.method,e,!0);var _=this.get_config("xhr_headers");if(l&&(_["Content-Type"]="application/x-www-form-urlencoded"),Ie.each(_,(function(e,t){f.setRequestHeader(t,e)})),n.timeout_ms&&void 0!==f.timeout){f.timeout=n.timeout_ms;var m=(new Date).getTime()}f.withCredentials=!0,f.onreadystatechange=function(){var e;if(4===f.readyState)if(200===f.status){if(i)if(p){var t;try{t=Ie.JSONDecode(f.responseText)}catch(v){if(d.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()-m>=f.timeout?"timeout":"Bad HTTP status: "+f.status+" "+f.statusText,d.report_error(e),i)if(p){var s=f.responseHeaders||{};i({status:0,httpStatusCode:f.status,error:e,retryAfter:s["Retry-After"]})}else i(0)},f.send(c)}catch(v){d.report_error(v),s=!1}else{var g=fe.createElement("script");g.type="text/javascript",g.async=!0,g.defer=!0,g.src=e;var y=fe.getElementsByTagName("script")[0];y.parentNode.insertBefore(g,y)}return s},MixpanelLib.prototype._execute_array=function(e){var t,n=[],i=[],s=[];Ie.each(e,(function(e){e&&(t=e[0],Ie.isArray(t)?s.push(e):"function"==typeof e?e.call(this):Ie.isArray(e)&&"alias"===t?n.push(e):Ie.isArray(e)&&-1!==t.indexOf("track")&&"function"==typeof this[t]?s.push(e):i.push(e))}),this);var execute=function(e,t){Ie.each(e,(function(e){if(Ie.isArray(e[0])){var n=t;Ie.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=Ie.bind((function(e){return new RequestBatcher(e.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:Ie.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:Ie.bind((function(t){return this._run_hook("before_send_"+e.type,t)}),this),stopAllBatchingFunc:Ie.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,Ie.each(this.request_batchers,(function(e){e.start()})))},MixpanelLib.prototype.stop_batch_senders=function(){this._batch_requests=!1,Ie.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=Ie.JSONEncode(e);return this.get_config("api_payload_format")===pt&&(t=Ie.base64Encode(t)),{data:t}},MixpanelLib.prototype._track_or_batch=function(e,t){var n=Ie.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 l=!0,u=Ie.bind((function(){return c.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(Ee.log("MIXPANEL REQUEST:"),Ee.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()})):l=u(),l&&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),Ie.isUndefined(e))this.report_error("No event name provided to mixpanel.track");else{if(!this._event_is_disabled(e)){(t=Ie.extend({},t)).token=this.get_config("token");var c=this.persistence.remove_event_timer(e);if(!Ie.isUndefined(c)){var l=(new Date).getTime()-c;t.$duration=parseFloat((l/1e3).toFixed(3))}this._set_default_superprops();var u=this.get_config("track_marketing")?Ie.info.marketingParams():{};t=Ie.extend({},Ie.info.properties({mp_loader:this.get_config("mp_loader")}),u,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var p=this.get_config("property_blacklist");Ie.isArray(p)?Ie.each(p,(function(e){delete t[e]})):this.report_error("Invalid value for property_blacklist config: "+p);var d={event:e,properties:t};return this._track_or_batch({type:"events",data:d,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){Ie.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=Ie.extend({},t||{});return Ie.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=Ie.extend(Ie.info.mpPageViewProperties(),Ie.info.campaignParams(),Ie.info.clickParams()),s=Ie.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){Ie.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 vt={persistent:!0},options_for_register=function(e){var t;return t=Ie.isObject(e)?e:Ie.isUndefined(e)?{}:{days:e},Ie.extend({},vt,t)};MixpanelLib.prototype.register=function(e,t){var n=options_for_register(t);n.persistent?this.persistence.register(e,n.days):Ie.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"),Ie.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,l){var u=this.get_distinct_id();if(e&&u!==e){if("string"==typeof e&&0===e.indexOf(dt))return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var p=u;this.register_once({$had_persisted_distinct_id:!0,$device_id:p},"")}e!==u&&e!==this.get_property(st)&&(this.unregister(st),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,i,s,a,c,l),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=Ie.UUID();this.register_once({distinct_id:dt+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(it))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return Ie.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(st,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){Ie.isObject(e)&&(Ie.extend(this.config,e),e.batch_size&&Ie.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),H.DEBUG=H.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,le.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!==ut&&(e=ut+"."+e),e},MixpanelLib.prototype._event_is_disabled=function(e){return Ie.isBlockedUA(ge)||this._flags.disable_all_events||Ie.include(this.__disabled_events,e)},MixpanelLib.prototype._gdpr_init=function(){"localStorage"===this.get_config("opt_out_tracking_persistence_type")&&Ie.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")&&!Ie.cookie.get("mp_optout")||(Ie.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=Ie.extend({track:Ie.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),Ie.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=Ie.extend({enable_persistence:!0},e),this._gdpr_call_func(optIn,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.opt_out_tracking=function(e){(e=Ie.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=Ie.extend({enable_persistence:!0},e),this._gdpr_call_func(clearOptInOut,e),this._gdpr_update_persistence(e)},MixpanelLib.prototype.report_error=function(e,t){Ee.error.apply(Ee.error,arguments);try{t||e instanceof Error||(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Ee.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=mt,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 bt={},override_mp_init_func=function(){lt.init=function(e,t,n){if(n)return lt[n]||(lt[n]=bt[n]=create_mplib(e,t,n),lt[n]._loaded()),lt[n];var i=lt;bt[ut]?i=bt[ut]:e&&((i=create_mplib(e,t,ut))._loaded(),bt[ut]=i),lt=i,1===Qe&&($[ut]=lt),Ie.each(bt,(function(e,t){t!==ut&&(lt[t]=e)})),lt._=Ie}};var St=function init_as_module(e){return load_extra_bundle=e,Qe=0,lt=new MixpanelLib,override_mp_init_func(),lt.init(),function(){function dom_loaded_handler(){dom_loaded_handler.done||(dom_loaded_handler.done=!0,yt=!0,ft=!1,Ie.each(bt,(function(e){e._dom_loaded()})))}if(fe.addEventListener)"complete"===fe.readyState?dom_loaded_handler():fe.addEventListener("DOMContentLoaded",dom_loaded_handler,!1);else if(fe.attachEvent){fe.attachEvent("onreadystatechange",dom_loaded_handler);var e=!1;try{e=null===$.frameElement}catch(t){}fe.documentElement.doScroll&&e&&function do_scroll_check(){try{fe.documentElement.doScroll("left")}catch(t){return void setTimeout(do_scroll_check,1)}dom_loaded_handler()}()}Ie.register_event($,"load",dom_loaded_handler,!0)}(),lt}((function loadNoop(e,t){t()})),__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(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 kt={default:"endpoint"},wt={default:"tlsEndpoint"},It="Client timeout",Et="Network connection error",Ot="Network request aborted",Ct="Response cannot be parsed",Mt="Blocked by CSP",Rt="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 xt=E("WrongRegion"),Tt=E("SubscriptionNotActive"),Nt=E("UnsupportedVersion"),Dt=E("InstallationMethodRestricted"),At=E("HostnameRestricted"),Lt=E("IntegrationFailed"),Pt="API key required",Ft="API key not found",qt="API key expired",Ut="Request cannot be parsed",jt="Request failed",Bt="Request failed to process",$t="Too many requests, rate limit exceeded",Wt="Not available for this origin",zt="Not available with restricted header",Vt=Pt,Ht=Ft,Kt=qt,Gt="Failed to load the JS script of the agent",Jt="9319";function M(e,t){var n,i,s,a,c,l=[],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===Mt||c===Rt)n.exclude(),a=0;else if(c===Jt)n.exclude();else if(c===Gt){var l=Date.now()-e.getTime()<50,u=n.current();u&&l&&!s.has(u)&&(s.add(u),a=0),n.postpone()}else n.postpone();var p=n.current();return void 0===p?void 0:[p,null!=a?a:e.getTime()+i()-Date.now()]}]),p=u[0],d=u[1];if(void 0===p)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 l.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(l.length>=5)throw e;var t=d(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(p).then((function(e){return[e,l]}))}var Xt="https://fpnpmcdn.net/v<version>/<apiKey>/loader_v<loaderVersion>.js",Qt=Xt;function F(e){var t;e.scriptUrlPattern;var n,i,s,a,c,l,u,p=e.token,d=e.apiKey,h=void 0===d?p:d,f=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,["scriptUrlPattern","token","apiKey"]),_=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:Xt,m=(c=[],l=function(){c.push({time:new Date,state:document.visibilityState})},n=document,i="visibilitychange",s=l,n.addEventListener(i,s,a),u=function(){return n.removeEventListener(i,s,a)},l(),[c,u]),g=m[0],y=m[1];return Promise.resolve().then((function(){if(!h||"string"!=typeof h)throw new Error(Pt);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)}))}(_,h);return M(e,V)})).catch((function(e){throw y(),function(e){return e instanceof Error&&e.message===Jt?new Error(Gt):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(Rt);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(Gt))},i.async=!0,i.src=t,s.appendChild(i)}));var t}),(function(){throw new Error(Mt)})).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(Jt);return c}var Yt={load:F,defaultScriptUrlPattern:Qt,ERROR_SCRIPT_LOAD_FAIL:Gt,ERROR_API_KEY_EXPIRED:qt,ERROR_API_KEY_INVALID:Ft,ERROR_API_KEY_MISSING:Pt,ERROR_BAD_REQUEST_FORMAT:Ut,ERROR_BAD_RESPONSE_FORMAT:Ct,ERROR_CLIENT_TIMEOUT:It,ERROR_CSP_BLOCK:Mt,ERROR_FORBIDDEN_ENDPOINT:At,ERROR_FORBIDDEN_HEADER:zt,ERROR_FORBIDDEN_ORIGIN:Wt,ERROR_GENERAL_SERVER_FAILURE:jt,ERROR_INSTALLATION_METHOD_RESTRICTED:Dt,ERROR_INTEGRATION_FAILURE:Lt,ERROR_INVALID_ENDPOINT:Rt,ERROR_NETWORK_ABORT:Ot,ERROR_NETWORK_CONNECTION:Et,ERROR_RATE_LIMIT:$t,ERROR_SERVER_TIMEOUT:Bt,ERROR_SUBSCRIPTION_NOT_ACTIVE:Tt,ERROR_TOKEN_EXPIRED:Kt,ERROR_TOKEN_INVALID:Ht,ERROR_TOKEN_MISSING:Vt,ERROR_UNSUPPORTED_VERSION:Nt,ERROR_WRONG_REGION:xt,defaultEndpoint:kt,defaultTlsEndpoint:wt};const Zt=Object.freeze(Object.defineProperty({__proto__:null,ERROR_API_KEY_EXPIRED:qt,ERROR_API_KEY_INVALID:Ft,ERROR_API_KEY_MISSING:Pt,ERROR_BAD_REQUEST_FORMAT:Ut,ERROR_BAD_RESPONSE_FORMAT:Ct,ERROR_CLIENT_TIMEOUT:It,ERROR_CSP_BLOCK:Mt,ERROR_FORBIDDEN_ENDPOINT:At,ERROR_FORBIDDEN_HEADER:zt,ERROR_FORBIDDEN_ORIGIN:Wt,ERROR_GENERAL_SERVER_FAILURE:jt,ERROR_INSTALLATION_METHOD_RESTRICTED:Dt,ERROR_INTEGRATION_FAILURE:Lt,ERROR_INVALID_ENDPOINT:Rt,ERROR_NETWORK_ABORT:Ot,ERROR_NETWORK_CONNECTION:Et,ERROR_RATE_LIMIT:$t,ERROR_SCRIPT_LOAD_FAIL:Gt,ERROR_SERVER_TIMEOUT:Bt,ERROR_SUBSCRIPTION_NOT_ACTIVE:Tt,ERROR_TOKEN_EXPIRED:Kt,ERROR_TOKEN_INVALID:Ht,ERROR_TOKEN_MISSING:Vt,ERROR_UNSUPPORTED_VERSION:Nt,ERROR_WRONG_REGION:xt,default:Yt,defaultEndpoint:kt,defaultScriptUrlPattern:Qt,defaultTlsEndpoint:wt,load:F},Symbol.toStringTag,{value:"Module"})),er="@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=er){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=er){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(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(this,void 0,void 0,(function*(){const n=yield this.wrapCacheEntry(t);yield this.cache.set(e.toKey(),n)}))}clearCache(){return __awaiter(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(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 tr,rr;(rr=tr||(tr={})).Memory="memory",rr.LocalStorage="localstorage",rr.SessionStorage="sessionstorage",rr.NoCache="nocache";const nr={[tr.Memory]:()=>(new InMemoryCache).enclosedCache,[tr.LocalStorage]:e=>new LocalStorageCache(e),[tr.SessionStorage]:e=>new SessionStorageCache(e),[tr.NoCache]:()=>new CacheStub},cacheFactory=e=>nr[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)||tr.SessionStorage,!cacheFactory(this.cacheLocation))throw new Error(`Invalid cache location "${this.cacheLocation}"`);(e=>{switch(e){case tr.SessionStorage:try{window.sessionStorage.getItem("item")}catch(t){return!1}return!0;case tr.LocalStorage:try{window.localStorage.getItem("item")}catch(t){return!1}return!0;default:return!0}})(this.cacheLocation)||(this.cacheLocation=tr.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(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:Zt;this.agentPromise=e.load(i).then((e=>(this.agent=e,e))).catch((e=>{throw this.agentPromise=null,e}))}return this.agentPromise}))}getVisitorData(){return __awaiter(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(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(this,arguments,void 0,(function*(e={}){return Boolean(yield this.getVisitorDataFromCache(e))}))}clearCache(){return __awaiter(this,void 0,void 0,(function*(){yield this.cacheManager.clearCache()}))}static makeCacheKey(e){return new CacheKey(e)}_identify(e){return __awaiter(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 or="default_fingerprint_cache",ir=7,getExpirationDate=e=>new Date((new Date).getTime()+24*e*60*60*1e3).getTime(),getCachedFingerprint=()=>{const{cacheName:e=or}=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}},setCachedFingerprint=e=>{const{cacheName:t=or,cacheTimeInDays:n=ir}=window.fingerprintConfig,i={fingerprint:e,expiresAt:getExpirationDate(n)};localStorage.setItem(t,JSON.stringify(i))};async function getFingerprint(e=!1){if(!window.fingerprintConfig)throw new Error("Fingerprint configuration is not initialized.");const t=getCachedFingerprint();if(t)return t;if(e)return"";if(!function isFingerprintReady(){return void 0!==window.fpClient}())throw new Error("Identification service is not initialized.");try{const e=window.fpClient,{visitorId:t}=await e.getVisitorData();return setCachedFingerprint(t),t}catch(Z){throw console.error("Error retrieving fingerprint:",Z),Z}}const sr=["Track Test"];async function trackEvent(e,t){if(!function isMixpanelReady(){return void 0!==window.mixpanel}())throw new Error("Mixpanel is not initialized.");try{const n=!sr.includes(e),i=await getFingerprint(n),s={...{"User Fingerprint":i},...t};St.track(e,s)}catch(Z){throw console.error("Error tracking event:",Z),Z}}function trackTest(){trackEvent("Track Test",{})}async function init(e){!function validateConfig(e){if(!e.mixpanelToken)throw new Error("mixpanelToken is required");if(!e.identificationKey)throw new Error("identificationKey is required")}(e);const{mixpanelToken:t,debug:n=!1,identificationKey:i}=e;await function initMixpanel(e,t=!1){return new Promise((n=>{St.init(e,{debug:t,loaded:()=>{window.mixpanel=St,n()}})}))}(t,n);try{await async function initFingerprint(e){window.fingerprintConfig={},window.fpClient=new FpjsClient({loadOptions:{apiKey:e}});try{await window.fpClient.init()}catch(Z){throw console.error("Error initializing identification service:",Z),Z}}(i)}catch(Z){console.error("Error initializing identification service:",Z)}!function onLoaded(){window.dispatchEvent(new CustomEvent("Tracker Ready"))}()}const ar={init:init,trackTest:trackTest};exports.default=ar,exports.init=init,exports.trackTest=trackTest;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Generated by dts-bundle-generator v9.5.1
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
First test event to track, it purpose is to test the tracking library and the identification service.ws
|
|
5
|
+
*/
|
|
6
|
+
export declare function trackTest(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Configuration object for initializing the tracking library.
|
|
9
|
+
*/
|
|
10
|
+
export interface InitConfig {
|
|
11
|
+
/**
|
|
12
|
+
* The Mixpanel token used for authenticating API requests.
|
|
13
|
+
*/
|
|
14
|
+
mixpanelToken: string;
|
|
15
|
+
/**
|
|
16
|
+
* Optional flag to enable or disable debug mode.
|
|
17
|
+
* When set to true, additional debug information will be logged.
|
|
18
|
+
*/
|
|
19
|
+
debug?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Key for tracking user identities.
|
|
22
|
+
*/
|
|
23
|
+
identificationKey: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Initializes the tracking library with the provided configuration.
|
|
27
|
+
* @param {InitConfig} config - The configuration object for initialization.
|
|
28
|
+
* @throws {Error} Throws an error if the configuration is invalid.
|
|
29
|
+
*/
|
|
30
|
+
export declare function init(config: InitConfig): Promise<void>;
|
|
31
|
+
declare const tracker: {
|
|
32
|
+
init: typeof init;
|
|
33
|
+
trackTest: typeof trackTest;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
tracker as default,
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export {};
|